devflare 1.0.0-next.7 → 1.0.0-next.71
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 +17316 -2144
- package/README.md +398 -607
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-B9ULT9HA.js +462 -0
- package/dist/_chunks/account-resources-BdKj8q1h.js +159 -0
- package/dist/_chunks/ai-DKDn1iys.js +322 -0
- package/dist/_chunks/api-BKClUlUf.js +568 -0
- package/dist/_chunks/build-B9jQtUny.js +24 -0
- package/dist/_chunks/build-artifacts-C7AbI34o.js +484 -0
- package/dist/_chunks/cli-CBRR2-Xr.js +1214 -0
- package/dist/_chunks/cloudflare-D_5UWT84.js +157 -0
- package/dist/_chunks/colors-D0NVzAFN.js +13 -0
- package/dist/_chunks/command-utils-qlsHELwW.js +45 -0
- package/dist/_chunks/compiler-UxXQgEPq.js +521 -0
- package/dist/_chunks/config-CHdi5-5R.js +78 -0
- package/dist/_chunks/config-path-DzZbchb6.js +42 -0
- package/dist/_chunks/context-DGMev2AF.js +2515 -0
- package/dist/_chunks/decorators-eXNZ1S0N.js +19 -0
- package/dist/_chunks/dependencies-HLIhxbIe.js +57 -0
- package/dist/_chunks/deploy-dIZuouRW.js +1033 -0
- package/dist/_chunks/dev-CRW_hBA3.js +953 -0
- package/dist/_chunks/doctor-t8hKA53t.js +219 -0
- package/dist/_chunks/durable-object-DuMPM8re.js +234 -0
- package/dist/_chunks/env-D4uJqqgu.js +125 -0
- package/dist/_chunks/family-DHkROYgX.js +143 -0
- package/dist/_chunks/generated-artifacts-D_VIzDOi.js +31 -0
- package/dist/_chunks/generated-dir-DC2kM-mt.js +33 -0
- package/dist/_chunks/glob-DRw9sbfF.js +56 -0
- package/dist/_chunks/init-B9_QIZcO.js +165 -0
- package/dist/_chunks/loader-BC0skbnH.js +1330 -0
- package/dist/_chunks/local-dev-vars-BFLS-HoI.js +81 -0
- package/dist/_chunks/local-hyperdrive-CcORzo76.js +119 -0
- package/dist/_chunks/local-media-bindings-ZQe-epuw.js +335 -0
- package/dist/_chunks/local-secrets-C0n5oRgI.js +123 -0
- package/dist/_chunks/login-Ctw59McM.js +51 -0
- package/dist/_chunks/package-metadata-CLI488gB.js +39 -0
- package/dist/_chunks/preferences-CbYERA_m.js +241 -0
- package/dist/_chunks/preview-j9Kbx4-G.js +462 -0
- package/dist/_chunks/preview-registry-CTXU4mBc.js +1186 -0
- package/dist/_chunks/preview-resources-BNvfkfqP.js +359 -0
- package/dist/_chunks/previews-DXlf8SaQ.js +1133 -0
- package/dist/_chunks/productions-TkIy7b1Q.js +504 -0
- package/dist/_chunks/r2-presign-runtime-DlgH_FY8.js +291 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-DB8SU7ea.js +79 -0
- package/dist/_chunks/remote-config-Bw6qIVM4.js +132 -0
- package/dist/_chunks/resolve-package-DeJUGxoE.js +152 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-CRXB3-iw.js +851 -0
- package/dist/_chunks/runtime-BlKTWIgD.js +874 -0
- package/dist/_chunks/schema-normalization-CTdiY17P.js +667 -0
- package/dist/_chunks/secrets-CzSWX4-i.js +95 -0
- package/dist/_chunks/tail-DXKaqcPB.js +239 -0
- package/dist/_chunks/token-CEIRtse8.js +333 -0
- package/dist/_chunks/tokens-CE7-gV5E.js +221 -0
- package/dist/_chunks/types-BB15NBqw.js +484 -0
- package/dist/_chunks/ui-BhCdDC2N.js +103 -0
- package/dist/_chunks/usage-rRusKejc.js +272 -0
- package/dist/_chunks/vite-DTz2Pbtm.js +1267 -0
- package/dist/_chunks/vite-process-BhGXJ764.js +2928 -0
- package/dist/_chunks/vite-utils-D_VR07Ks.js +183 -0
- package/dist/_chunks/worker-CgIvLp-D.js +410 -0
- package/dist/_chunks/worker-bundler-CeMqQtBQ.js +457 -0
- package/dist/_chunks/worker-entrypoint-C8j23t6d.js +247 -0
- package/dist/_chunks/workerName-kEXwmV2m.js +23 -0
- package/dist/_chunks/workspace-CbollZBv.js +518 -0
- package/dist/_chunks/workspace-Ds3xMjOE.js +175 -0
- package/dist/bridge/client.d.ts +93 -8
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/do-rpc-dispatch.d.ts +23 -0
- package/dist/bridge/do-rpc-dispatch.d.ts.map +1 -0
- package/dist/bridge/do-websocket-connect.d.ts +33 -0
- package/dist/bridge/do-websocket-connect.d.ts.map +1 -0
- 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-gateway.d.ts +45 -0
- package/dist/bridge/miniflare-gateway.d.ts.map +1 -0
- package/dist/bridge/miniflare.d.ts +92 -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/r2-presign-runtime.d.ts +9 -0
- package/dist/bridge/r2-presign-runtime.d.ts.map +1 -0
- 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/v2/value-serialization.d.ts +139 -0
- 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/bridge/websocket-constructor.d.ts +38 -0
- package/dist/bridge/websocket-constructor.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 +5778 -43
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +73 -142
- 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 +52 -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/commands/workspace.d.ts +8 -0
- package/dist/cli/commands/workspace.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 +308 -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 +13 -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 +2124 -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 +3821 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +272 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +597 -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 +196 -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 +5796 -2023
- 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/workspace.d.ts +282 -0
- package/dist/config/workspace.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 +22 -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 +57 -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 +100 -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-health.d.ts +79 -0
- package/dist/dev-server/runtime-health.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 +24 -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/dev-server/workspace/merge-config.d.ts +81 -0
- package/dist/dev-server/workspace/merge-config.d.ts.map +1 -0
- package/dist/dev-server/workspace/prepare-app.d.ts +84 -0
- package/dist/dev-server/workspace/prepare-app.d.ts.map +1 -0
- package/dist/dev-server/workspace/server.d.ts +47 -0
- package/dist/dev-server/workspace/server.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 +10 -297
- 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 +11 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -184
- package/dist/runtime/middleware.d.ts +119 -67
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/r2-presign.d.ts +164 -0
- package/dist/runtime/r2-presign.d.ts.map +1 -0
- 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 +377 -169
- 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 +42 -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 +5115 -75
- package/dist/test/offline-bindings.d.ts +124 -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 +18 -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 +45 -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/send-email.d.ts +27 -0
- package/dist/test/utilities/send-email.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 +14 -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/generated-dir.d.ts +25 -0
- package/dist/utils/generated-dir.d.ts.map +1 -0
- 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 -407
- 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 +5 -8
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- 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 +160 -117
- 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 +0 -83
- 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-9myaxf07.js +0 -70
- package/dist/deploy-h1wz5p7m.js +0 -86
- package/dist/dev-rsdssknb.js +0 -2707
- package/dist/doctor-v7jy4s3r.js +0 -190
- package/dist/durable-object-t4kbb0yt.js +0 -13
- 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-62b3gt2g.js +0 -12
- package/dist/index-67qcae0f.js +0 -183
- package/dist/index-9ats0s83.js +0 -70
- package/dist/index-a0fjkq68.js +0 -198
- package/dist/index-a855bdsx.js +0 -18
- package/dist/index-ccrh4w3t.js +0 -1133
- package/dist/index-d8bdkx2h.js +0 -109
- package/dist/index-f8qh2tyh.js +0 -2152
- package/dist/index-gz1gndna.js +0 -307
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-k7r18na8.js +0 -0
- package/dist/index-n3np2d6t.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-npc1c8jx.js +0 -44
- package/dist/index-p7g30wd2.js +0 -281
- package/dist/index-rbht7m9r.js +0 -36
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- package/dist/index-v8vvsn9x.js +0 -169
- 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-wdcpnfvy.js +0 -487
- package/dist/worker-entrypoint-m9th0rg0.js +0 -13
package/dist/index-ccrh4w3t.js
DELETED
|
@@ -1,1133 +0,0 @@
|
|
|
1
|
-
// src/bridge/protocol.ts
|
|
2
|
-
var BinaryKind = {
|
|
3
|
-
StreamChunk: 1,
|
|
4
|
-
WsData: 2
|
|
5
|
-
};
|
|
6
|
-
var BinaryFlags = {
|
|
7
|
-
FIN: 1,
|
|
8
|
-
TEXT: 2
|
|
9
|
-
};
|
|
10
|
-
var BINARY_HEADER_SIZE = 10;
|
|
11
|
-
function encodeBinaryFrame(kind, id, seq, flags, payload) {
|
|
12
|
-
const frame = new Uint8Array(BINARY_HEADER_SIZE + payload.byteLength);
|
|
13
|
-
const view = new DataView(frame.buffer);
|
|
14
|
-
view.setUint8(0, kind);
|
|
15
|
-
view.setUint32(1, id, true);
|
|
16
|
-
view.setUint32(5, seq, true);
|
|
17
|
-
view.setUint8(9, flags);
|
|
18
|
-
frame.set(payload, BINARY_HEADER_SIZE);
|
|
19
|
-
return frame;
|
|
20
|
-
}
|
|
21
|
-
function decodeBinaryFrame(frame) {
|
|
22
|
-
if (frame.byteLength < BINARY_HEADER_SIZE) {
|
|
23
|
-
throw new Error(`Invalid binary frame: too short (${frame.byteLength} bytes)`);
|
|
24
|
-
}
|
|
25
|
-
const view = new DataView(frame.buffer, frame.byteOffset, frame.byteLength);
|
|
26
|
-
return {
|
|
27
|
-
kind: view.getUint8(0),
|
|
28
|
-
id: view.getUint32(1, true),
|
|
29
|
-
seq: view.getUint32(5, true),
|
|
30
|
-
flags: view.getUint8(9),
|
|
31
|
-
payload: frame.subarray(BINARY_HEADER_SIZE)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function parseJsonMsg(data) {
|
|
35
|
-
const msg = JSON.parse(data);
|
|
36
|
-
if (typeof msg !== "object" || msg === null || !("t" in msg)) {
|
|
37
|
-
throw new Error("Invalid message: missing type field");
|
|
38
|
-
}
|
|
39
|
-
return msg;
|
|
40
|
-
}
|
|
41
|
-
function stringifyJsonMsg(msg) {
|
|
42
|
-
return JSON.stringify(msg);
|
|
43
|
-
}
|
|
44
|
-
var rpcIdCounter = 0;
|
|
45
|
-
var streamIdCounter = 0;
|
|
46
|
-
var wsIdCounter = 0;
|
|
47
|
-
function nextRpcId() {
|
|
48
|
-
return `rpc_${++rpcIdCounter}`;
|
|
49
|
-
}
|
|
50
|
-
function nextStreamId() {
|
|
51
|
-
return ++streamIdCounter;
|
|
52
|
-
}
|
|
53
|
-
function nextWsId() {
|
|
54
|
-
return ++wsIdCounter;
|
|
55
|
-
}
|
|
56
|
-
var DEFAULT_CHUNK_SIZE = 256 * 1024;
|
|
57
|
-
var HTTP_TRANSFER_THRESHOLD = 512 * 1024;
|
|
58
|
-
var DEFAULT_BRIDGE_PORT = 8686;
|
|
59
|
-
|
|
60
|
-
// src/bridge/serialization.ts
|
|
61
|
-
async function serializeRequest(request, options) {
|
|
62
|
-
const streams = [];
|
|
63
|
-
const threshold = options?.httpThreshold ?? 10 * 1024 * 1024;
|
|
64
|
-
const headers = [];
|
|
65
|
-
request.headers.forEach((value, key) => {
|
|
66
|
-
headers.push([key, value]);
|
|
67
|
-
});
|
|
68
|
-
let body = null;
|
|
69
|
-
if (request.body) {
|
|
70
|
-
const bytes = await request.arrayBuffer();
|
|
71
|
-
if (bytes.byteLength > threshold) {
|
|
72
|
-
body = { type: "http", transferId: crypto.randomUUID() };
|
|
73
|
-
} else if (bytes.byteLength > 0) {
|
|
74
|
-
body = { type: "bytes", data: base64Encode(new Uint8Array(bytes)) };
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
serialized: {
|
|
79
|
-
url: request.url,
|
|
80
|
-
method: request.method,
|
|
81
|
-
headers,
|
|
82
|
-
body,
|
|
83
|
-
redirect: request.redirect
|
|
84
|
-
},
|
|
85
|
-
streams
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function deserializeRequest(serialized, getStream) {
|
|
89
|
-
let body = null;
|
|
90
|
-
if (serialized.body) {
|
|
91
|
-
switch (serialized.body.type) {
|
|
92
|
-
case "bytes":
|
|
93
|
-
body = base64Decode(serialized.body.data);
|
|
94
|
-
break;
|
|
95
|
-
case "stream":
|
|
96
|
-
if (getStream) {
|
|
97
|
-
body = getStream(serialized.body.sid) ?? null;
|
|
98
|
-
}
|
|
99
|
-
break;
|
|
100
|
-
case "http":
|
|
101
|
-
throw new Error("HTTP transfer body must be handled externally");
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return new Request(serialized.url, {
|
|
105
|
-
method: serialized.method,
|
|
106
|
-
headers: serialized.headers,
|
|
107
|
-
body,
|
|
108
|
-
redirect: serialized.redirect
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
async function serializeResponse(response, options) {
|
|
112
|
-
const streams = [];
|
|
113
|
-
const threshold = options?.httpThreshold ?? 10 * 1024 * 1024;
|
|
114
|
-
const headers = [];
|
|
115
|
-
response.headers.forEach((value, key) => {
|
|
116
|
-
headers.push([key, value]);
|
|
117
|
-
});
|
|
118
|
-
let body = null;
|
|
119
|
-
if (response.body) {
|
|
120
|
-
const bytes = await response.arrayBuffer();
|
|
121
|
-
if (bytes.byteLength > threshold) {
|
|
122
|
-
body = { type: "http", transferId: crypto.randomUUID() };
|
|
123
|
-
} else if (bytes.byteLength > 0) {
|
|
124
|
-
body = { type: "bytes", data: base64Encode(new Uint8Array(bytes)) };
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return {
|
|
128
|
-
serialized: {
|
|
129
|
-
status: response.status,
|
|
130
|
-
statusText: response.statusText,
|
|
131
|
-
headers,
|
|
132
|
-
body
|
|
133
|
-
},
|
|
134
|
-
streams
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function deserializeResponse(serialized, getStream) {
|
|
138
|
-
let body = null;
|
|
139
|
-
if (serialized.body) {
|
|
140
|
-
switch (serialized.body.type) {
|
|
141
|
-
case "bytes":
|
|
142
|
-
body = base64Decode(serialized.body.data);
|
|
143
|
-
break;
|
|
144
|
-
case "stream":
|
|
145
|
-
if (getStream) {
|
|
146
|
-
body = getStream(serialized.body.sid) ?? null;
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
149
|
-
case "http":
|
|
150
|
-
throw new Error("HTTP transfer body must be handled externally");
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return new Response(body, {
|
|
154
|
-
status: serialized.status,
|
|
155
|
-
statusText: serialized.statusText,
|
|
156
|
-
headers: serialized.headers
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
async function serializeValue(value) {
|
|
160
|
-
const streams = [];
|
|
161
|
-
const result = await serializeValueInternal(value, streams);
|
|
162
|
-
return { value: result, streams };
|
|
163
|
-
}
|
|
164
|
-
async function serializeValueInternal(value, streams) {
|
|
165
|
-
if (value === null || value === undefined) {
|
|
166
|
-
return value;
|
|
167
|
-
}
|
|
168
|
-
if (value instanceof Request) {
|
|
169
|
-
const { serialized, streams: reqStreams } = await serializeRequest(value);
|
|
170
|
-
streams.push(...reqStreams);
|
|
171
|
-
return { __type: "Request", ...serialized };
|
|
172
|
-
}
|
|
173
|
-
if (value instanceof Response) {
|
|
174
|
-
const { serialized, streams: resStreams } = await serializeResponse(value);
|
|
175
|
-
streams.push(...resStreams);
|
|
176
|
-
return { __type: "Response", ...serialized };
|
|
177
|
-
}
|
|
178
|
-
if (value instanceof ReadableStream) {
|
|
179
|
-
const sid = nextStreamId();
|
|
180
|
-
streams.push({ sid, stream: value });
|
|
181
|
-
return { __type: "ReadableStream", sid };
|
|
182
|
-
}
|
|
183
|
-
if (value instanceof Uint8Array) {
|
|
184
|
-
return { __type: "Uint8Array", data: base64Encode(value) };
|
|
185
|
-
}
|
|
186
|
-
if (value instanceof ArrayBuffer) {
|
|
187
|
-
return { __type: "ArrayBuffer", data: base64Encode(new Uint8Array(value)) };
|
|
188
|
-
}
|
|
189
|
-
if (Array.isArray(value)) {
|
|
190
|
-
return Promise.all(value.map((v) => serializeValueInternal(v, streams)));
|
|
191
|
-
}
|
|
192
|
-
if (typeof value === "object") {
|
|
193
|
-
const result = {};
|
|
194
|
-
for (const [k, v] of Object.entries(value)) {
|
|
195
|
-
result[k] = await serializeValueInternal(v, streams);
|
|
196
|
-
}
|
|
197
|
-
return result;
|
|
198
|
-
}
|
|
199
|
-
return value;
|
|
200
|
-
}
|
|
201
|
-
function deserializeValue(value, getStream) {
|
|
202
|
-
if (value === null || value === undefined) {
|
|
203
|
-
return value;
|
|
204
|
-
}
|
|
205
|
-
if (typeof value === "object" && value !== null) {
|
|
206
|
-
const obj = value;
|
|
207
|
-
if (obj.__type === "Request") {
|
|
208
|
-
return deserializeRequest(obj, getStream);
|
|
209
|
-
}
|
|
210
|
-
if (obj.__type === "Response") {
|
|
211
|
-
return deserializeResponse(obj, getStream);
|
|
212
|
-
}
|
|
213
|
-
if (obj.__type === "ReadableStream") {
|
|
214
|
-
const sid = obj.sid;
|
|
215
|
-
return getStream?.(sid) ?? null;
|
|
216
|
-
}
|
|
217
|
-
if (obj.__type === "Uint8Array") {
|
|
218
|
-
return base64Decode(obj.data);
|
|
219
|
-
}
|
|
220
|
-
if (obj.__type === "ArrayBuffer") {
|
|
221
|
-
return base64Decode(obj.data).buffer;
|
|
222
|
-
}
|
|
223
|
-
if (obj.__type === "R2Object") {
|
|
224
|
-
return deserializeR2Object(obj);
|
|
225
|
-
}
|
|
226
|
-
if (obj.__type === "R2ObjectBody") {
|
|
227
|
-
return deserializeR2ObjectBody(obj);
|
|
228
|
-
}
|
|
229
|
-
if (Array.isArray(value)) {
|
|
230
|
-
return value.map((v) => deserializeValue(v, getStream));
|
|
231
|
-
}
|
|
232
|
-
const result = {};
|
|
233
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
234
|
-
result[k] = deserializeValue(v, getStream);
|
|
235
|
-
}
|
|
236
|
-
return result;
|
|
237
|
-
}
|
|
238
|
-
return value;
|
|
239
|
-
}
|
|
240
|
-
function deserializeR2Object(obj) {
|
|
241
|
-
const serialized = obj;
|
|
242
|
-
return {
|
|
243
|
-
key: serialized.key,
|
|
244
|
-
version: serialized.version,
|
|
245
|
-
size: serialized.size,
|
|
246
|
-
etag: serialized.etag,
|
|
247
|
-
httpEtag: serialized.httpEtag,
|
|
248
|
-
checksums: serialized.checksums,
|
|
249
|
-
uploaded: serialized.uploaded ? new Date(serialized.uploaded) : new Date,
|
|
250
|
-
httpMetadata: serialized.httpMetadata,
|
|
251
|
-
customMetadata: serialized.customMetadata,
|
|
252
|
-
range: serialized.range,
|
|
253
|
-
storageClass: serialized.storageClass,
|
|
254
|
-
writeHttpMetadata(headers) {
|
|
255
|
-
if (serialized.httpMetadata?.contentType) {
|
|
256
|
-
headers.set("Content-Type", serialized.httpMetadata.contentType);
|
|
257
|
-
}
|
|
258
|
-
if (serialized.httpMetadata?.contentLanguage) {
|
|
259
|
-
headers.set("Content-Language", serialized.httpMetadata.contentLanguage);
|
|
260
|
-
}
|
|
261
|
-
if (serialized.httpMetadata?.contentDisposition) {
|
|
262
|
-
headers.set("Content-Disposition", serialized.httpMetadata.contentDisposition);
|
|
263
|
-
}
|
|
264
|
-
if (serialized.httpMetadata?.contentEncoding) {
|
|
265
|
-
headers.set("Content-Encoding", serialized.httpMetadata.contentEncoding);
|
|
266
|
-
}
|
|
267
|
-
if (serialized.httpMetadata?.cacheControl) {
|
|
268
|
-
headers.set("Cache-Control", serialized.httpMetadata.cacheControl);
|
|
269
|
-
}
|
|
270
|
-
if (serialized.httpMetadata?.cacheExpiry) {
|
|
271
|
-
headers.set("Expires", new Date(serialized.httpMetadata.cacheExpiry).toUTCString());
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function deserializeR2ObjectBody(obj) {
|
|
277
|
-
const serialized = obj;
|
|
278
|
-
const bodyBytes = serialized.bodyData ? base64Decode(serialized.bodyData) : new Uint8Array(0);
|
|
279
|
-
const r2ObjectBody = {
|
|
280
|
-
key: serialized.key,
|
|
281
|
-
version: serialized.version,
|
|
282
|
-
size: serialized.size,
|
|
283
|
-
etag: serialized.etag,
|
|
284
|
-
httpEtag: serialized.httpEtag,
|
|
285
|
-
checksums: serialized.checksums,
|
|
286
|
-
uploaded: serialized.uploaded ? new Date(serialized.uploaded) : new Date,
|
|
287
|
-
httpMetadata: serialized.httpMetadata,
|
|
288
|
-
customMetadata: serialized.customMetadata,
|
|
289
|
-
range: serialized.range,
|
|
290
|
-
storageClass: serialized.storageClass,
|
|
291
|
-
body: new ReadableStream({
|
|
292
|
-
start(controller) {
|
|
293
|
-
controller.enqueue(bodyBytes);
|
|
294
|
-
controller.close();
|
|
295
|
-
}
|
|
296
|
-
}),
|
|
297
|
-
bodyUsed: false,
|
|
298
|
-
async arrayBuffer() {
|
|
299
|
-
const copy = new Uint8Array(bodyBytes.byteLength);
|
|
300
|
-
copy.set(bodyBytes);
|
|
301
|
-
return copy.buffer;
|
|
302
|
-
},
|
|
303
|
-
async text() {
|
|
304
|
-
return new TextDecoder().decode(bodyBytes);
|
|
305
|
-
},
|
|
306
|
-
async json() {
|
|
307
|
-
const text = new TextDecoder().decode(bodyBytes);
|
|
308
|
-
return JSON.parse(text);
|
|
309
|
-
},
|
|
310
|
-
async blob() {
|
|
311
|
-
const contentType = serialized.httpMetadata?.contentType || "application/octet-stream";
|
|
312
|
-
const buffer = bodyBytes.buffer.slice(bodyBytes.byteOffset, bodyBytes.byteOffset + bodyBytes.byteLength);
|
|
313
|
-
return new Blob([buffer], { type: contentType });
|
|
314
|
-
},
|
|
315
|
-
writeHttpMetadata(headers) {
|
|
316
|
-
if (serialized.httpMetadata?.contentType) {
|
|
317
|
-
headers.set("Content-Type", serialized.httpMetadata.contentType);
|
|
318
|
-
}
|
|
319
|
-
if (serialized.httpMetadata?.contentLanguage) {
|
|
320
|
-
headers.set("Content-Language", serialized.httpMetadata.contentLanguage);
|
|
321
|
-
}
|
|
322
|
-
if (serialized.httpMetadata?.contentDisposition) {
|
|
323
|
-
headers.set("Content-Disposition", serialized.httpMetadata.contentDisposition);
|
|
324
|
-
}
|
|
325
|
-
if (serialized.httpMetadata?.contentEncoding) {
|
|
326
|
-
headers.set("Content-Encoding", serialized.httpMetadata.contentEncoding);
|
|
327
|
-
}
|
|
328
|
-
if (serialized.httpMetadata?.cacheControl) {
|
|
329
|
-
headers.set("Cache-Control", serialized.httpMetadata.cacheControl);
|
|
330
|
-
}
|
|
331
|
-
if (serialized.httpMetadata?.cacheExpiry) {
|
|
332
|
-
headers.set("Expires", new Date(serialized.httpMetadata.cacheExpiry).toUTCString());
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
return r2ObjectBody;
|
|
337
|
-
}
|
|
338
|
-
function base64Encode(bytes) {
|
|
339
|
-
if (typeof Buffer !== "undefined") {
|
|
340
|
-
return Buffer.from(bytes).toString("base64");
|
|
341
|
-
}
|
|
342
|
-
let binary = "";
|
|
343
|
-
for (let i = 0;i < bytes.byteLength; i++) {
|
|
344
|
-
binary += String.fromCharCode(bytes[i]);
|
|
345
|
-
}
|
|
346
|
-
return btoa(binary);
|
|
347
|
-
}
|
|
348
|
-
function base64Decode(str) {
|
|
349
|
-
if (typeof Buffer !== "undefined") {
|
|
350
|
-
return new Uint8Array(Buffer.from(str, "base64"));
|
|
351
|
-
}
|
|
352
|
-
const binary = atob(str);
|
|
353
|
-
const bytes = new Uint8Array(binary.length);
|
|
354
|
-
for (let i = 0;i < binary.length; i++) {
|
|
355
|
-
bytes[i] = binary.charCodeAt(i);
|
|
356
|
-
}
|
|
357
|
-
return bytes;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// src/bridge/client.ts
|
|
361
|
-
class BridgeClient {
|
|
362
|
-
ws = null;
|
|
363
|
-
url;
|
|
364
|
-
autoReconnect;
|
|
365
|
-
reconnectDelay;
|
|
366
|
-
connectTimeout;
|
|
367
|
-
pendingCalls = new Map;
|
|
368
|
-
activeStreams = new Map;
|
|
369
|
-
wsProxies = new Map;
|
|
370
|
-
outgoingStreams = new Map;
|
|
371
|
-
connectPromise = null;
|
|
372
|
-
isConnected = false;
|
|
373
|
-
constructor(options = {}) {
|
|
374
|
-
this.url = options.url ?? `ws://localhost:${DEFAULT_BRIDGE_PORT}`;
|
|
375
|
-
this.autoReconnect = options.autoReconnect ?? true;
|
|
376
|
-
this.reconnectDelay = options.reconnectDelay ?? 1000;
|
|
377
|
-
this.connectTimeout = options.connectTimeout ?? 5000;
|
|
378
|
-
}
|
|
379
|
-
getUrl() {
|
|
380
|
-
return this.url;
|
|
381
|
-
}
|
|
382
|
-
getHttpUrl() {
|
|
383
|
-
return this.url.replace(/^ws:\/\//, "http://").replace(/^wss:\/\//, "https://");
|
|
384
|
-
}
|
|
385
|
-
async connect() {
|
|
386
|
-
if (this.isConnected)
|
|
387
|
-
return;
|
|
388
|
-
if (this.connectPromise)
|
|
389
|
-
return this.connectPromise;
|
|
390
|
-
this.connectPromise = new Promise((resolve, reject) => {
|
|
391
|
-
const timeout = setTimeout(() => {
|
|
392
|
-
reject(new Error(`Connection timeout: ${this.url}`));
|
|
393
|
-
this.ws?.close();
|
|
394
|
-
}, this.connectTimeout);
|
|
395
|
-
try {
|
|
396
|
-
this.ws = new WebSocket(this.url);
|
|
397
|
-
this.ws.binaryType = "arraybuffer";
|
|
398
|
-
this.ws.onopen = () => {
|
|
399
|
-
clearTimeout(timeout);
|
|
400
|
-
this.isConnected = true;
|
|
401
|
-
this.connectPromise = null;
|
|
402
|
-
resolve();
|
|
403
|
-
};
|
|
404
|
-
this.ws.onerror = () => {
|
|
405
|
-
clearTimeout(timeout);
|
|
406
|
-
this.connectPromise = null;
|
|
407
|
-
reject(new Error("WebSocket connection failed"));
|
|
408
|
-
};
|
|
409
|
-
this.ws.onclose = () => {
|
|
410
|
-
this.handleDisconnect();
|
|
411
|
-
};
|
|
412
|
-
this.ws.onmessage = (event) => {
|
|
413
|
-
this.handleMessage(event.data);
|
|
414
|
-
};
|
|
415
|
-
} catch (error) {
|
|
416
|
-
clearTimeout(timeout);
|
|
417
|
-
this.connectPromise = null;
|
|
418
|
-
reject(error);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
return this.connectPromise;
|
|
422
|
-
}
|
|
423
|
-
disconnect() {
|
|
424
|
-
this.autoReconnect = false;
|
|
425
|
-
this.ws?.close();
|
|
426
|
-
this.ws = null;
|
|
427
|
-
this.isConnected = false;
|
|
428
|
-
for (const [id, pending] of this.pendingCalls) {
|
|
429
|
-
clearTimeout(pending.timeout);
|
|
430
|
-
pending.reject(new Error("Bridge disconnected"));
|
|
431
|
-
}
|
|
432
|
-
this.pendingCalls.clear();
|
|
433
|
-
}
|
|
434
|
-
get connected() {
|
|
435
|
-
return this.isConnected;
|
|
436
|
-
}
|
|
437
|
-
handleDisconnect() {
|
|
438
|
-
this.isConnected = false;
|
|
439
|
-
this.ws = null;
|
|
440
|
-
for (const [_id, pending] of this.pendingCalls) {
|
|
441
|
-
clearTimeout(pending.timeout);
|
|
442
|
-
pending.reject(new Error("Bridge disconnected"));
|
|
443
|
-
}
|
|
444
|
-
this.pendingCalls.clear();
|
|
445
|
-
for (const [_sid, stream] of this.activeStreams) {
|
|
446
|
-
stream.controller.error(new Error("Bridge disconnected"));
|
|
447
|
-
}
|
|
448
|
-
this.activeStreams.clear();
|
|
449
|
-
if (this.autoReconnect) {
|
|
450
|
-
setTimeout(() => {
|
|
451
|
-
this.connect().catch(() => {});
|
|
452
|
-
}, this.reconnectDelay);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
async call(method, params, timeoutMs = 30000) {
|
|
456
|
-
await this.ensureConnected();
|
|
457
|
-
const id = nextRpcId();
|
|
458
|
-
const { value: serializedParams, streams } = await serializeValue(params);
|
|
459
|
-
for (const streamRef of streams) {
|
|
460
|
-
this.outgoingStreams.set(streamRef.sid, streamRef);
|
|
461
|
-
}
|
|
462
|
-
return new Promise((resolve, reject) => {
|
|
463
|
-
const timeout = setTimeout(() => {
|
|
464
|
-
this.pendingCalls.delete(id);
|
|
465
|
-
reject(new Error(`RPC timeout: ${method}`));
|
|
466
|
-
}, timeoutMs);
|
|
467
|
-
this.pendingCalls.set(id, { resolve, reject, timeout });
|
|
468
|
-
const msg = {
|
|
469
|
-
t: "rpc.call",
|
|
470
|
-
id,
|
|
471
|
-
method,
|
|
472
|
-
params: serializedParams
|
|
473
|
-
};
|
|
474
|
-
this.send(msg);
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
async createWsProxy(binding, id, url, headers) {
|
|
478
|
-
await this.ensureConnected();
|
|
479
|
-
const wid = nextWsId();
|
|
480
|
-
const proxy = {
|
|
481
|
-
clientWs: null,
|
|
482
|
-
onMessage: () => {},
|
|
483
|
-
onClose: () => {}
|
|
484
|
-
};
|
|
485
|
-
this.wsProxies.set(wid, proxy);
|
|
486
|
-
const msg = {
|
|
487
|
-
t: "ws.open",
|
|
488
|
-
wid,
|
|
489
|
-
target: { binding, id, url, headers }
|
|
490
|
-
};
|
|
491
|
-
this.send(msg);
|
|
492
|
-
return {
|
|
493
|
-
wid,
|
|
494
|
-
send: (data) => {
|
|
495
|
-
const payload = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
496
|
-
const flags = typeof data === "string" ? BinaryFlags.TEXT : 0;
|
|
497
|
-
const frame = encodeBinaryFrame(BinaryKind.WsData, wid, 0, flags, payload);
|
|
498
|
-
this.ws?.send(frame);
|
|
499
|
-
},
|
|
500
|
-
close: (code, reason) => {
|
|
501
|
-
const closeMsg = { t: "ws.close", wid, code, reason };
|
|
502
|
-
this.send(closeMsg);
|
|
503
|
-
this.wsProxies.delete(wid);
|
|
504
|
-
},
|
|
505
|
-
onMessage: (handler) => {
|
|
506
|
-
proxy.onMessage = handler;
|
|
507
|
-
},
|
|
508
|
-
onClose: (handler) => {
|
|
509
|
-
proxy.onClose = handler;
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
createReadableStream(sid) {
|
|
514
|
-
return new ReadableStream({
|
|
515
|
-
start: (controller) => {
|
|
516
|
-
this.activeStreams.set(sid, {
|
|
517
|
-
controller,
|
|
518
|
-
buffer: [],
|
|
519
|
-
creditRemaining: 0
|
|
520
|
-
});
|
|
521
|
-
},
|
|
522
|
-
pull: async (controller) => {
|
|
523
|
-
const stream = this.activeStreams.get(sid);
|
|
524
|
-
if (!stream)
|
|
525
|
-
return;
|
|
526
|
-
const pullMsg = {
|
|
527
|
-
t: "stream.pull",
|
|
528
|
-
sid,
|
|
529
|
-
creditBytes: DEFAULT_CHUNK_SIZE * 4
|
|
530
|
-
};
|
|
531
|
-
this.send(pullMsg);
|
|
532
|
-
await new Promise((resolve) => {
|
|
533
|
-
const checkBuffer = () => {
|
|
534
|
-
const s = this.activeStreams.get(sid);
|
|
535
|
-
if (!s)
|
|
536
|
-
return resolve();
|
|
537
|
-
if (s.buffer.length > 0) {
|
|
538
|
-
const chunk = s.buffer.shift();
|
|
539
|
-
controller.enqueue(chunk);
|
|
540
|
-
resolve();
|
|
541
|
-
} else {
|
|
542
|
-
setTimeout(checkBuffer, 10);
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
checkBuffer();
|
|
546
|
-
});
|
|
547
|
-
},
|
|
548
|
-
cancel: () => {
|
|
549
|
-
this.activeStreams.delete(sid);
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
handleMessage(data) {
|
|
554
|
-
if (typeof data === "string") {
|
|
555
|
-
this.handleJsonMessage(data);
|
|
556
|
-
} else {
|
|
557
|
-
this.handleBinaryMessage(new Uint8Array(data));
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
handleJsonMessage(data) {
|
|
561
|
-
try {
|
|
562
|
-
const msg = parseJsonMsg(data);
|
|
563
|
-
switch (msg.t) {
|
|
564
|
-
case "rpc.ok":
|
|
565
|
-
this.handleRpcOk(msg);
|
|
566
|
-
break;
|
|
567
|
-
case "rpc.err":
|
|
568
|
-
this.handleRpcErr(msg);
|
|
569
|
-
break;
|
|
570
|
-
case "event":
|
|
571
|
-
this.handleEvent(msg);
|
|
572
|
-
break;
|
|
573
|
-
case "stream.pull":
|
|
574
|
-
this.handleStreamPull(msg);
|
|
575
|
-
break;
|
|
576
|
-
case "stream.end":
|
|
577
|
-
this.handleStreamEnd(msg);
|
|
578
|
-
break;
|
|
579
|
-
case "stream.abort":
|
|
580
|
-
this.handleStreamAbort(msg);
|
|
581
|
-
break;
|
|
582
|
-
case "ws.opened":
|
|
583
|
-
break;
|
|
584
|
-
case "ws.close":
|
|
585
|
-
this.handleWsClose(msg);
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
} catch (error) {}
|
|
589
|
-
}
|
|
590
|
-
handleBinaryMessage(frame) {
|
|
591
|
-
try {
|
|
592
|
-
const decoded = decodeBinaryFrame(frame);
|
|
593
|
-
switch (decoded.kind) {
|
|
594
|
-
case BinaryKind.StreamChunk:
|
|
595
|
-
this.handleStreamChunk(decoded);
|
|
596
|
-
break;
|
|
597
|
-
case BinaryKind.WsData:
|
|
598
|
-
this.handleWsData(decoded);
|
|
599
|
-
break;
|
|
600
|
-
}
|
|
601
|
-
} catch {}
|
|
602
|
-
}
|
|
603
|
-
handleRpcOk(msg) {
|
|
604
|
-
const pending = this.pendingCalls.get(msg.id);
|
|
605
|
-
if (!pending)
|
|
606
|
-
return;
|
|
607
|
-
clearTimeout(pending.timeout);
|
|
608
|
-
this.pendingCalls.delete(msg.id);
|
|
609
|
-
const result = deserializeValue(msg.result, (sid) => this.createReadableStream(sid));
|
|
610
|
-
pending.resolve(result);
|
|
611
|
-
}
|
|
612
|
-
handleRpcErr(msg) {
|
|
613
|
-
const pending = this.pendingCalls.get(msg.id);
|
|
614
|
-
if (!pending)
|
|
615
|
-
return;
|
|
616
|
-
clearTimeout(pending.timeout);
|
|
617
|
-
this.pendingCalls.delete(msg.id);
|
|
618
|
-
const error = new Error(msg.error.message);
|
|
619
|
-
error.code = msg.error.code;
|
|
620
|
-
error.details = msg.error.details;
|
|
621
|
-
pending.reject(error);
|
|
622
|
-
}
|
|
623
|
-
handleEvent(_msg) {}
|
|
624
|
-
handleStreamPull(msg) {
|
|
625
|
-
const streamRef = this.outgoingStreams.get(msg.sid);
|
|
626
|
-
if (!streamRef)
|
|
627
|
-
return;
|
|
628
|
-
this.pumpStream(streamRef, msg.creditBytes);
|
|
629
|
-
}
|
|
630
|
-
async pumpStream(streamRef, creditBytes) {
|
|
631
|
-
const reader = streamRef.stream.getReader();
|
|
632
|
-
let sent = 0;
|
|
633
|
-
let seq = 0;
|
|
634
|
-
try {
|
|
635
|
-
while (sent < creditBytes) {
|
|
636
|
-
const { done, value } = await reader.read();
|
|
637
|
-
if (done) {
|
|
638
|
-
this.send({ t: "stream.end", sid: streamRef.sid });
|
|
639
|
-
this.outgoingStreams.delete(streamRef.sid);
|
|
640
|
-
break;
|
|
641
|
-
}
|
|
642
|
-
if (value) {
|
|
643
|
-
const frame = encodeBinaryFrame(BinaryKind.StreamChunk, streamRef.sid, seq++, 0, value);
|
|
644
|
-
this.ws?.send(frame);
|
|
645
|
-
sent += value.byteLength;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
} catch (error) {
|
|
649
|
-
this.send({
|
|
650
|
-
t: "stream.abort",
|
|
651
|
-
sid: streamRef.sid,
|
|
652
|
-
error: String(error)
|
|
653
|
-
});
|
|
654
|
-
this.outgoingStreams.delete(streamRef.sid);
|
|
655
|
-
} finally {
|
|
656
|
-
reader.releaseLock();
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
handleStreamChunk(decoded) {
|
|
660
|
-
const stream = this.activeStreams.get(decoded.id);
|
|
661
|
-
if (!stream)
|
|
662
|
-
return;
|
|
663
|
-
stream.buffer.push(decoded.payload);
|
|
664
|
-
}
|
|
665
|
-
handleStreamEnd(msg) {
|
|
666
|
-
const stream = this.activeStreams.get(msg.sid);
|
|
667
|
-
if (!stream)
|
|
668
|
-
return;
|
|
669
|
-
for (const chunk of stream.buffer) {
|
|
670
|
-
stream.controller.enqueue(chunk);
|
|
671
|
-
}
|
|
672
|
-
stream.controller.close();
|
|
673
|
-
this.activeStreams.delete(msg.sid);
|
|
674
|
-
}
|
|
675
|
-
handleStreamAbort(msg) {
|
|
676
|
-
const stream = this.activeStreams.get(msg.sid);
|
|
677
|
-
if (!stream)
|
|
678
|
-
return;
|
|
679
|
-
stream.controller.error(new Error(msg.error ?? "Stream aborted"));
|
|
680
|
-
this.activeStreams.delete(msg.sid);
|
|
681
|
-
}
|
|
682
|
-
handleWsData(decoded) {
|
|
683
|
-
const proxy = this.wsProxies.get(decoded.id);
|
|
684
|
-
if (!proxy)
|
|
685
|
-
return;
|
|
686
|
-
const isText = (decoded.flags & BinaryFlags.TEXT) !== 0;
|
|
687
|
-
const data = isText ? new TextDecoder().decode(decoded.payload) : decoded.payload;
|
|
688
|
-
proxy.onMessage(data);
|
|
689
|
-
}
|
|
690
|
-
handleWsClose(msg) {
|
|
691
|
-
const proxy = this.wsProxies.get(msg.wid);
|
|
692
|
-
if (!proxy)
|
|
693
|
-
return;
|
|
694
|
-
proxy.onClose(msg.code, msg.reason);
|
|
695
|
-
this.wsProxies.delete(msg.wid);
|
|
696
|
-
}
|
|
697
|
-
async ensureConnected() {
|
|
698
|
-
if (!this.isConnected) {
|
|
699
|
-
await this.connect();
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
send(msg) {
|
|
703
|
-
if (!this.ws || !this.isConnected) {
|
|
704
|
-
throw new Error("Not connected to bridge");
|
|
705
|
-
}
|
|
706
|
-
this.ws.send(stringifyJsonMsg(msg));
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
var defaultClient = null;
|
|
710
|
-
function getClient(options) {
|
|
711
|
-
if (!defaultClient) {
|
|
712
|
-
defaultClient = new BridgeClient(options);
|
|
713
|
-
}
|
|
714
|
-
return defaultClient;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
// src/bridge/proxy.ts
|
|
718
|
-
function createKVProxy(client, bindingName) {
|
|
719
|
-
return {
|
|
720
|
-
async get(key, options) {
|
|
721
|
-
return client.call(`${bindingName}.get`, [key, options]);
|
|
722
|
-
},
|
|
723
|
-
async put(key, value, options) {
|
|
724
|
-
await client.call(`${bindingName}.put`, [key, value, options]);
|
|
725
|
-
},
|
|
726
|
-
async delete(key) {
|
|
727
|
-
await client.call(`${bindingName}.delete`, [key]);
|
|
728
|
-
},
|
|
729
|
-
async list(options) {
|
|
730
|
-
return client.call(`${bindingName}.list`, [options]);
|
|
731
|
-
},
|
|
732
|
-
async getWithMetadata(key, options) {
|
|
733
|
-
return client.call(`${bindingName}.getWithMetadata`, [key, options]);
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
function createR2Proxy(client, bindingName) {
|
|
738
|
-
return {
|
|
739
|
-
async head(key) {
|
|
740
|
-
return client.call(`${bindingName}.head`, [key]);
|
|
741
|
-
},
|
|
742
|
-
async get(key, options) {
|
|
743
|
-
return client.call(`${bindingName}.r2.get`, [key, options]);
|
|
744
|
-
},
|
|
745
|
-
async put(key, value, options) {
|
|
746
|
-
const size = getValueSize(value);
|
|
747
|
-
if (size > HTTP_TRANSFER_THRESHOLD) {
|
|
748
|
-
const transferId = `${bindingName}:${key}`;
|
|
749
|
-
const httpUrl = client.getHttpUrl();
|
|
750
|
-
const transferUrl = httpUrl.replace(/\/$/, "") + `/_devflare/transfer/${encodeURIComponent(transferId)}`;
|
|
751
|
-
const response = await fetch(transferUrl, {
|
|
752
|
-
method: "PUT",
|
|
753
|
-
body: value,
|
|
754
|
-
headers: {
|
|
755
|
-
...options?.httpMetadata?.contentType ? { "Content-Type": options.httpMetadata.contentType } : {}
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
if (!response.ok) {
|
|
759
|
-
const error = await response.text();
|
|
760
|
-
throw new Error(`HTTP transfer failed: ${error}`);
|
|
761
|
-
}
|
|
762
|
-
return response.json();
|
|
763
|
-
}
|
|
764
|
-
return client.call(`${bindingName}.r2.put`, [key, value, options]);
|
|
765
|
-
},
|
|
766
|
-
async delete(keys) {
|
|
767
|
-
await client.call(`${bindingName}.r2.delete`, [keys]);
|
|
768
|
-
},
|
|
769
|
-
async list(options) {
|
|
770
|
-
return client.call(`${bindingName}.r2.list`, [options]);
|
|
771
|
-
},
|
|
772
|
-
async createMultipartUpload(key, options) {
|
|
773
|
-
return client.call(`${bindingName}.createMultipartUpload`, [key, options]);
|
|
774
|
-
},
|
|
775
|
-
async resumeMultipartUpload(key, uploadId) {
|
|
776
|
-
return client.call(`${bindingName}.resumeMultipartUpload`, [key, uploadId]);
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
function getValueSize(value) {
|
|
781
|
-
if (value instanceof Blob)
|
|
782
|
-
return value.size;
|
|
783
|
-
if (value instanceof ArrayBuffer)
|
|
784
|
-
return value.byteLength;
|
|
785
|
-
if (value instanceof Uint8Array)
|
|
786
|
-
return value.byteLength;
|
|
787
|
-
if (typeof value === "string")
|
|
788
|
-
return value.length;
|
|
789
|
-
if (value instanceof ReadableStream)
|
|
790
|
-
return Infinity;
|
|
791
|
-
return 0;
|
|
792
|
-
}
|
|
793
|
-
function createD1Proxy(client, bindingName) {
|
|
794
|
-
return {
|
|
795
|
-
prepare(sql) {
|
|
796
|
-
return createD1StatementProxy(client, bindingName, sql, []);
|
|
797
|
-
},
|
|
798
|
-
async batch(statements) {
|
|
799
|
-
const serialized = statements.map((stmt) => {
|
|
800
|
-
const s = stmt;
|
|
801
|
-
return { sql: s._sql, bindings: s._bindings };
|
|
802
|
-
});
|
|
803
|
-
return client.call(`${bindingName}.batch`, [serialized]);
|
|
804
|
-
},
|
|
805
|
-
async exec(sql) {
|
|
806
|
-
return client.call(`${bindingName}.exec`, [sql]);
|
|
807
|
-
},
|
|
808
|
-
async dump() {
|
|
809
|
-
return client.call(`${bindingName}.dump`, []);
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
function createD1StatementProxy(client, bindingName, sql, bindings) {
|
|
814
|
-
const stmt = {
|
|
815
|
-
_sql: sql,
|
|
816
|
-
_bindings: bindings,
|
|
817
|
-
bind(...values) {
|
|
818
|
-
return createD1StatementProxy(client, bindingName, sql, values);
|
|
819
|
-
},
|
|
820
|
-
async first(column) {
|
|
821
|
-
return client.call(`${bindingName}.stmt.first`, [sql, ...bindings, column]);
|
|
822
|
-
},
|
|
823
|
-
async all() {
|
|
824
|
-
return client.call(`${bindingName}.stmt.all`, [sql, ...bindings]);
|
|
825
|
-
},
|
|
826
|
-
async run() {
|
|
827
|
-
return client.call(`${bindingName}.stmt.run`, [sql, ...bindings]);
|
|
828
|
-
},
|
|
829
|
-
async raw(options) {
|
|
830
|
-
return client.call(`${bindingName}.stmt.raw`, [sql, ...bindings, options]);
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
return stmt;
|
|
834
|
-
}
|
|
835
|
-
function createDOProxy(client, bindingName, proxyOptions = {}) {
|
|
836
|
-
return {
|
|
837
|
-
idFromName(name) {
|
|
838
|
-
return createDOIdProxy(client, bindingName, { type: "name", value: name });
|
|
839
|
-
},
|
|
840
|
-
idFromString(hexId) {
|
|
841
|
-
return createDOIdProxy(client, bindingName, { type: "hex", value: hexId });
|
|
842
|
-
},
|
|
843
|
-
newUniqueId(options) {
|
|
844
|
-
const tempId = crypto.randomUUID().replace(/-/g, "");
|
|
845
|
-
return createDOIdProxy(client, bindingName, { type: "unique", value: tempId, options });
|
|
846
|
-
},
|
|
847
|
-
get(id) {
|
|
848
|
-
const idProxy = id;
|
|
849
|
-
return createDOStubProxy(client, bindingName, idProxy._idInfo, proxyOptions);
|
|
850
|
-
},
|
|
851
|
-
getByName(name) {
|
|
852
|
-
const id = this.idFromName(name);
|
|
853
|
-
return this.get(id);
|
|
854
|
-
},
|
|
855
|
-
jurisdiction(jurisdiction) {
|
|
856
|
-
return createDOProxy(client, bindingName, proxyOptions);
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
function createDOIdProxy(client, bindingName, idInfo) {
|
|
861
|
-
return {
|
|
862
|
-
_idInfo: idInfo,
|
|
863
|
-
toString() {
|
|
864
|
-
if (idInfo.type === "hex")
|
|
865
|
-
return idInfo.value;
|
|
866
|
-
return `${idInfo.type}:${idInfo.value}`;
|
|
867
|
-
},
|
|
868
|
-
equals(other) {
|
|
869
|
-
return this.toString() === other.toString();
|
|
870
|
-
}
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
function createDOStubProxy(client, bindingName, idInfo, proxyOptions = {}) {
|
|
874
|
-
const { transformResult } = proxyOptions;
|
|
875
|
-
let resolvedId = null;
|
|
876
|
-
const resolveId = async () => {
|
|
877
|
-
if (resolvedId)
|
|
878
|
-
return resolvedId;
|
|
879
|
-
switch (idInfo.type) {
|
|
880
|
-
case "name":
|
|
881
|
-
resolvedId = await client.call(`${bindingName}.idFromName`, [idInfo.value]);
|
|
882
|
-
break;
|
|
883
|
-
case "hex":
|
|
884
|
-
resolvedId = { __type: "DOId", hex: idInfo.value };
|
|
885
|
-
break;
|
|
886
|
-
case "unique":
|
|
887
|
-
resolvedId = await client.call(`${bindingName}.newUniqueId`, [idInfo.options]);
|
|
888
|
-
break;
|
|
889
|
-
}
|
|
890
|
-
return resolvedId;
|
|
891
|
-
};
|
|
892
|
-
const stubBase = {
|
|
893
|
-
async fetch(input, init) {
|
|
894
|
-
const id = await resolveId();
|
|
895
|
-
const request = input instanceof Request ? input : new Request(input, init);
|
|
896
|
-
const { serialized } = await serializeRequest(request);
|
|
897
|
-
const result = await client.call(`${bindingName}.stub.fetch`, [bindingName, id, serialized]);
|
|
898
|
-
return deserializeResponse(result);
|
|
899
|
-
},
|
|
900
|
-
async connect(url, options) {
|
|
901
|
-
const id = await resolveId();
|
|
902
|
-
const headersList = [];
|
|
903
|
-
if (options?.headers) {
|
|
904
|
-
const headers = new Headers(options.headers);
|
|
905
|
-
headers.forEach((value, key) => {
|
|
906
|
-
headersList.push([key, value]);
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
const wsProxy = await client.createWsProxy(bindingName, id.hex, url, headersList);
|
|
910
|
-
let readController = null;
|
|
911
|
-
const readable = new ReadableStream({
|
|
912
|
-
start(controller) {
|
|
913
|
-
readController = controller;
|
|
914
|
-
},
|
|
915
|
-
cancel() {
|
|
916
|
-
wsProxy.close();
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
wsProxy.onMessage((data) => {
|
|
920
|
-
if (readController) {
|
|
921
|
-
const chunk = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
922
|
-
readController.enqueue(chunk);
|
|
923
|
-
}
|
|
924
|
-
});
|
|
925
|
-
wsProxy.onClose((code, reason) => {
|
|
926
|
-
if (readController) {
|
|
927
|
-
readController.close();
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
const writable = new WritableStream({
|
|
931
|
-
write(chunk) {
|
|
932
|
-
wsProxy.send(chunk);
|
|
933
|
-
},
|
|
934
|
-
close() {
|
|
935
|
-
wsProxy.close(1000, "Normal closure");
|
|
936
|
-
},
|
|
937
|
-
abort(reason) {
|
|
938
|
-
wsProxy.close(1001, reason?.toString() ?? "Aborted");
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
return {
|
|
942
|
-
readable,
|
|
943
|
-
writable,
|
|
944
|
-
get opened() {
|
|
945
|
-
return Promise.resolve({
|
|
946
|
-
remoteAddress: "127.0.0.1",
|
|
947
|
-
localAddress: "127.0.0.1"
|
|
948
|
-
});
|
|
949
|
-
},
|
|
950
|
-
get closed() {
|
|
951
|
-
return new Promise((resolve) => {
|
|
952
|
-
wsProxy.onClose(() => resolve());
|
|
953
|
-
});
|
|
954
|
-
},
|
|
955
|
-
close() {
|
|
956
|
-
wsProxy.close(1000, "Normal closure");
|
|
957
|
-
return Promise.resolve();
|
|
958
|
-
},
|
|
959
|
-
startTls() {
|
|
960
|
-
throw new Error("startTls not supported on DO WebSocket proxy");
|
|
961
|
-
}
|
|
962
|
-
};
|
|
963
|
-
},
|
|
964
|
-
get id() {
|
|
965
|
-
return createDOIdProxy(client, bindingName, idInfo);
|
|
966
|
-
},
|
|
967
|
-
get name() {
|
|
968
|
-
return idInfo.type === "name" ? idInfo.value : undefined;
|
|
969
|
-
}
|
|
970
|
-
};
|
|
971
|
-
return new Proxy(stubBase, {
|
|
972
|
-
get(target, prop) {
|
|
973
|
-
if (prop in target) {
|
|
974
|
-
return target[prop];
|
|
975
|
-
}
|
|
976
|
-
if (typeof prop === "symbol") {
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
return async (...args) => {
|
|
980
|
-
const id = await resolveId();
|
|
981
|
-
let result = await client.call(`${bindingName}.stub.rpc`, [
|
|
982
|
-
bindingName,
|
|
983
|
-
id,
|
|
984
|
-
prop,
|
|
985
|
-
args
|
|
986
|
-
]);
|
|
987
|
-
if (transformResult) {
|
|
988
|
-
result = transformResult(result);
|
|
989
|
-
}
|
|
990
|
-
return result;
|
|
991
|
-
};
|
|
992
|
-
}
|
|
993
|
-
});
|
|
994
|
-
}
|
|
995
|
-
function createQueueProxy(client, bindingName) {
|
|
996
|
-
return {
|
|
997
|
-
async send(message, options) {
|
|
998
|
-
await client.call(`${bindingName}.send`, [message, options]);
|
|
999
|
-
},
|
|
1000
|
-
async sendBatch(messages, options) {
|
|
1001
|
-
await client.call(`${bindingName}.sendBatch`, [messages, options]);
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
}
|
|
1005
|
-
function createAIProxy(client, bindingName) {
|
|
1006
|
-
return {
|
|
1007
|
-
async run(model, inputs, options) {
|
|
1008
|
-
return client.call(`${bindingName}.run`, [model, inputs, options]);
|
|
1009
|
-
}
|
|
1010
|
-
};
|
|
1011
|
-
}
|
|
1012
|
-
var globalBindingHints = {};
|
|
1013
|
-
function createEnvProxy(options = {}) {
|
|
1014
|
-
const client = options.client ?? getClient();
|
|
1015
|
-
const bindingProxies = new Map;
|
|
1016
|
-
const doProxyOptions = { transformResult: options.transformResult };
|
|
1017
|
-
const hints = { ...globalBindingHints, ...options.hints };
|
|
1018
|
-
return new Proxy({}, {
|
|
1019
|
-
get(target, prop) {
|
|
1020
|
-
if (typeof prop !== "string")
|
|
1021
|
-
return;
|
|
1022
|
-
if (bindingProxies.has(prop)) {
|
|
1023
|
-
return bindingProxies.get(prop);
|
|
1024
|
-
}
|
|
1025
|
-
const hint = hints[prop];
|
|
1026
|
-
let proxy;
|
|
1027
|
-
switch (hint) {
|
|
1028
|
-
case "kv":
|
|
1029
|
-
proxy = createKVProxy(client, prop);
|
|
1030
|
-
break;
|
|
1031
|
-
case "r2":
|
|
1032
|
-
proxy = createR2Proxy(client, prop);
|
|
1033
|
-
break;
|
|
1034
|
-
case "d1":
|
|
1035
|
-
proxy = createD1Proxy(client, prop);
|
|
1036
|
-
break;
|
|
1037
|
-
case "do":
|
|
1038
|
-
proxy = createDOProxy(client, prop, doProxyOptions);
|
|
1039
|
-
break;
|
|
1040
|
-
case "queue":
|
|
1041
|
-
proxy = createQueueProxy(client, prop);
|
|
1042
|
-
break;
|
|
1043
|
-
case "ai":
|
|
1044
|
-
proxy = createAIProxy(client, prop);
|
|
1045
|
-
break;
|
|
1046
|
-
case "secret":
|
|
1047
|
-
case "var":
|
|
1048
|
-
proxy = createSimpleBindingProxy(client, prop);
|
|
1049
|
-
break;
|
|
1050
|
-
default:
|
|
1051
|
-
proxy = createGenericBindingProxy(client, prop);
|
|
1052
|
-
}
|
|
1053
|
-
bindingProxies.set(prop, proxy);
|
|
1054
|
-
return proxy;
|
|
1055
|
-
},
|
|
1056
|
-
has(target, prop) {
|
|
1057
|
-
return typeof prop === "string";
|
|
1058
|
-
},
|
|
1059
|
-
ownKeys() {
|
|
1060
|
-
return Object.keys(hints);
|
|
1061
|
-
},
|
|
1062
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
1063
|
-
if (typeof prop === "string") {
|
|
1064
|
-
return { configurable: true, enumerable: true, writable: false };
|
|
1065
|
-
}
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
function createGenericBindingProxy(client, bindingName) {
|
|
1071
|
-
return new Proxy({}, {
|
|
1072
|
-
get(target, prop) {
|
|
1073
|
-
if (typeof prop !== "string")
|
|
1074
|
-
return;
|
|
1075
|
-
if (["get", "put", "delete", "list", "getWithMetadata"].includes(prop)) {
|
|
1076
|
-
return createKVProxy(client, bindingName)[prop];
|
|
1077
|
-
}
|
|
1078
|
-
if (["idFromName", "idFromString", "newUniqueId", "get"].includes(prop)) {
|
|
1079
|
-
return createDOProxy(client, bindingName)[prop];
|
|
1080
|
-
}
|
|
1081
|
-
if (["prepare", "batch", "exec", "dump"].includes(prop)) {
|
|
1082
|
-
return createD1Proxy(client, bindingName)[prop];
|
|
1083
|
-
}
|
|
1084
|
-
if (["head"].includes(prop)) {
|
|
1085
|
-
return createR2Proxy(client, bindingName)[prop];
|
|
1086
|
-
}
|
|
1087
|
-
return async (...args) => {
|
|
1088
|
-
return client.call(`${bindingName}.${prop}`, args);
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
function createSimpleBindingProxy(client, bindingName) {
|
|
1094
|
-
let cachedValue;
|
|
1095
|
-
let fetched = false;
|
|
1096
|
-
return {
|
|
1097
|
-
then(resolve, reject) {
|
|
1098
|
-
if (fetched) {
|
|
1099
|
-
resolve(cachedValue);
|
|
1100
|
-
return;
|
|
1101
|
-
}
|
|
1102
|
-
client.call(`${bindingName}.value`, []).then((value) => {
|
|
1103
|
-
cachedValue = value;
|
|
1104
|
-
fetched = true;
|
|
1105
|
-
resolve(value);
|
|
1106
|
-
}).catch(reject);
|
|
1107
|
-
},
|
|
1108
|
-
toString() {
|
|
1109
|
-
if (!fetched)
|
|
1110
|
-
throw new Error(`Binding ${bindingName} not yet fetched. Use await.`);
|
|
1111
|
-
return String(cachedValue);
|
|
1112
|
-
}
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
var globalEnvProxy = null;
|
|
1116
|
-
var bridgeEnv = new Proxy({}, {
|
|
1117
|
-
get(target, prop) {
|
|
1118
|
-
if (!globalEnvProxy) {
|
|
1119
|
-
globalEnvProxy = createEnvProxy({ lazy: true });
|
|
1120
|
-
}
|
|
1121
|
-
return globalEnvProxy[prop];
|
|
1122
|
-
}
|
|
1123
|
-
});
|
|
1124
|
-
function initEnv(options = {}) {
|
|
1125
|
-
globalEnvProxy = createEnvProxy(options);
|
|
1126
|
-
return globalEnvProxy;
|
|
1127
|
-
}
|
|
1128
|
-
function setBindingHints(hints) {
|
|
1129
|
-
globalBindingHints = { ...globalBindingHints, ...hints };
|
|
1130
|
-
globalEnvProxy = null;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
export { BinaryKind, BinaryFlags, encodeBinaryFrame, decodeBinaryFrame, parseJsonMsg, stringifyJsonMsg, serializeValue, deserializeValue, base64Encode, base64Decode, BridgeClient, getClient, createEnvProxy, bridgeEnv, initEnv, setBindingHints };
|