devflare 1.0.0-next.3 → 1.0.0-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LLM.md +15964 -1751
- package/README.md +392 -605
- package/bin/devflare.js +24 -14
- package/dist/account-g99mzrqp.js +475 -0
- package/dist/api-2n6dd2ws.js +33 -0
- package/dist/bridge/client.d.ts +48 -6
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/gateway-runtime.d.ts +8 -0
- package/dist/bridge/gateway-runtime.d.ts.map +1 -0
- package/dist/bridge/index.d.ts +3 -3
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/log.d.ts +5 -0
- package/dist/bridge/log.d.ts.map +1 -0
- package/dist/bridge/miniflare.d.ts +74 -1
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +11 -10
- 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 +51 -0
- package/dist/bridge/v2/control-messages.d.ts.map +1 -0
- package/dist/bridge/v2/frames.d.ts +109 -0
- package/dist/bridge/v2/frames.d.ts.map +1 -0
- package/dist/bridge/v2/index.d.ts +11 -0
- package/dist/bridge/v2/index.d.ts.map +1 -0
- package/dist/bridge/v2/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} +28 -4
- package/dist/bridge/v2/wire.d.ts.map +1 -0
- package/dist/bridge/v2/ws-relay.d.ts +53 -0
- package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
- package/dist/browser-shim/handler.d.ts +1 -1
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser-shim/server.d.ts +63 -0
- package/dist/browser-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts +4621 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +147 -0
- package/dist/build-4tyjywn9.js +54 -0
- package/dist/bundler/defaults.d.ts +23 -0
- package/dist/bundler/defaults.d.ts.map +1 -0
- package/dist/bundler/do-bundler.d.ts +7 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/index.d.ts +2 -0
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +53 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +13 -0
- package/dist/bundler/worker-bundler.d.ts.map +1 -0
- package/dist/bundler/worker-compat.d.ts +4 -0
- package/dist/bundler/worker-compat.d.ts.map +1 -0
- package/dist/cli/build-manifest.d.ts +66 -0
- package/dist/cli/build-manifest.d.ts.map +1 -0
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +1 -1
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +40 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/deploy/metadata.d.ts +18 -0
- package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
- package/dist/cli/commands/deploy/prepare.d.ts +23 -0
- package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
- package/dist/cli/commands/deploy/runtime.d.ts +4 -0
- package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
- package/dist/cli/commands/deploy/verification.d.ts +36 -0
- package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
- package/dist/cli/commands/deploy.d.ts +2 -2
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +8 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +112 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +6 -0
- package/dist/cli/config-path.d.ts.map +1 -0
- package/dist/cli/dependencies.d.ts +1 -0
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +12 -0
- package/dist/cli/package-metadata.d.ts +16 -0
- package/dist/cli/package-metadata.d.ts.map +1 -0
- package/dist/cli/preview-bindings.d.ts +49 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +10 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +71 -3
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +57 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +49 -2
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
- package/dist/cloudflare/kv-namespace.d.ts +4 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts +7 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
- package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +4 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
- package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
- package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/preview-urls.d.ts +3 -0
- package/dist/cloudflare/preview-urls.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/tokens.d.ts +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 +30 -2
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts +41 -0
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
- package/dist/config/compatibility.d.ts +3 -0
- package/dist/config/compatibility.d.ts.map +1 -0
- package/dist/config/compiler/bindings.d.ts +14 -0
- package/dist/config/compiler/bindings.d.ts.map +1 -0
- package/dist/config/compiler/core-helpers.d.ts +6 -0
- package/dist/config/compiler/core-helpers.d.ts.map +1 -0
- package/dist/config/compiler/do-workers.d.ts +34 -0
- package/dist/config/compiler/do-workers.d.ts.map +1 -0
- package/dist/config/compiler/paths.d.ts +18 -0
- package/dist/config/compiler/paths.d.ts.map +1 -0
- package/dist/config/compiler/types.d.ts +270 -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/define.d.ts +7 -4
- 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 +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/local-dev-vars.d.ts +15 -0
- package/dist/config/local-dev-vars.d.ts.map +1 -0
- package/dist/config/preview-resources.d.ts +83 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +31 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +14 -23
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve-phased.d.ts +72 -0
- package/dist/config/resolve-phased.d.ts.map +1 -0
- package/dist/config/resolve.d.ts +11 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resource-resolution.d.ts +80 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +1495 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +3023 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +184 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +500 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +378 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +551 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +254 -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.d.ts +917 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +424 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +4537 -2214
- 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-88sdhx3w.js +105 -0
- package/dist/config-entry.d.ts +7 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-entry.js +16 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/deploy-8fpav2cw.js +1066 -0
- package/dist/dev-nxevkfdv.js +2609 -0
- package/dist/dev-server/d1-migrations.d.ts +36 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/dev-server-state.d.ts +59 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +21 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/miniflare-bindings.d.ts +59 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +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 +74 -0
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
- package/dist/dev-server/reload-queue.d.ts +13 -0
- package/dist/dev-server/reload-queue.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts +8 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
- package/dist/dev-server/server-startup-helpers.d.ts +84 -0
- package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
- package/dist/dev-server/server.d.ts +2 -0
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +15 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +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/{doctor-fmgb3d28.js → doctor-ztwx1y95.js} +104 -35
- package/dist/{durable-object-t4kbb0yt.js → durable-object-v3gsnybk.js} +1 -1
- package/dist/env.d.ts +10 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/index-11p28kxx.js +256 -0
- package/dist/index-15fpa5tx.js +232 -0
- package/dist/index-1d4jg11n.js +542 -0
- package/dist/index-3edvz3hs.js +124 -0
- package/dist/index-3jme4hgw.js +1234 -0
- package/dist/index-627srx16.js +45 -0
- package/dist/index-62b3gt2g.js +12 -0
- package/dist/index-67gr49zr.js +109 -0
- package/dist/index-69c0ed4a.js +895 -0
- package/dist/index-6sj0v0dk.js +2284 -0
- package/dist/index-7qd7nmdd.js +74 -0
- package/dist/index-85yjb686.js +413 -0
- package/dist/index-aabgympv.js +39 -0
- package/dist/{index-z14anrqp.js → index-aqrwyy57.js} +93 -31
- package/dist/index-c8p4njqy.js +479 -0
- package/dist/index-dfcp9hsd.js +1581 -0
- package/dist/index-dm9q84c7.js +360 -0
- package/dist/index-fcmj6641.js +147 -0
- package/dist/index-ft3trvra.js +476 -0
- package/dist/{index-18hvb6gb.js → index-gn5wy09x.js} +13 -2
- package/dist/index-hjjfxv02.js +708 -0
- package/dist/index-hpwa6vsw.js +239 -0
- package/dist/index-k9x5v335.js +1033 -0
- package/dist/index-mg8vwqxf.js +514 -0
- package/dist/index-ptwem1nt.js +1428 -0
- package/dist/{index-07q6yxyc.js → index-q8f4kawk.js} +68 -32
- package/dist/index-qmmqww7h.js +133 -0
- package/dist/{index-rbht7m9r.js → index-qwgr4q7s.js} +2 -1
- package/dist/index-qz6nbwpw.js +111 -0
- package/dist/index-rzp9ejrh.js +185 -0
- package/dist/index-s3km3y34.js +1205 -0
- package/dist/index-stgn34cr.js +148 -0
- package/dist/index-t9y0sve5.js +155 -0
- package/dist/index-vez803pp.js +52 -0
- package/dist/index-vhqww6tt.js +307 -0
- package/dist/index-xz18tstn.js +581 -0
- package/dist/{index-1xpj0m4r.js → index-z9gy8w6b.js} +1 -1
- package/dist/index-za0r01bx.js +588 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -269
- package/dist/{init-f9mgmew3.js → init-cwpergap.js} +63 -69
- package/dist/login-r5ve73kf.js +77 -0
- package/dist/previews-qjj98rpp.js +1337 -0
- package/dist/productions-gzdtge0e.js +505 -0
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +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 +8 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +108 -99
- package/dist/runtime/middleware.d.ts +102 -60
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/router/index.d.ts +7 -0
- package/dist/runtime/router/index.d.ts.map +1 -0
- package/dist/runtime/router/types.d.ts +24 -0
- package/dist/runtime/router/types.d.ts.map +1 -0
- package/dist/runtime/validation.d.ts +17 -3
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/secrets/local-secrets.d.ts +46 -0
- package/dist/secrets/local-secrets.d.ts.map +1 -0
- package/dist/secrets-4w5166km.js +91 -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.js +169 -75
- package/dist/sveltekit/local-bindings.d.ts +4 -0
- package/dist/sveltekit/local-bindings.d.ts.map +1 -0
- package/dist/sveltekit/platform.d.ts +19 -1
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/ai-search.d.ts +39 -0
- package/dist/test/ai-search.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts +11 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/cf.d.ts +35 -21
- package/dist/test/cf.d.ts.map +1 -1
- package/dist/test/containers.d.ts +87 -0
- package/dist/test/containers.d.ts.map +1 -0
- package/dist/test/email.d.ts +16 -7
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +5 -8
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4641 -43
- package/dist/test/offline-bindings.d.ts +65 -0
- package/dist/test/offline-bindings.d.ts.map +1 -0
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts +63 -3
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +14 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-bindings.d.ts +13 -0
- package/dist/test/simple-context-bindings.d.ts.map +1 -0
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-env.d.ts +35 -0
- package/dist/test/simple-context-env.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-handlers.d.ts +12 -0
- package/dist/test/simple-context-handlers.d.ts.map +1 -0
- package/dist/test/simple-context-lifecycle.d.ts +32 -0
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
- package/dist/test/simple-context-mfconfig.d.ts +10 -0
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
- package/dist/test/simple-context-multi-worker.d.ts +16 -0
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context-runtime.d.ts +19 -0
- package/dist/test/simple-context-runtime.d.ts.map +1 -0
- package/dist/test/simple-context-startup.d.ts +11 -0
- package/dist/test/simple-context-startup.d.ts.map +1 -0
- package/dist/test/simple-context-transport.d.ts +14 -0
- package/dist/test/simple-context-transport.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +7 -26
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +2 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/artifacts.d.ts +11 -0
- package/dist/test/utilities/artifacts.d.ts.map +1 -0
- package/dist/test/utilities/context.d.ts +39 -0
- package/dist/test/utilities/context.d.ts.map +1 -0
- package/dist/test/utilities/d1.d.ts +21 -0
- package/dist/test/utilities/d1.d.ts.map +1 -0
- package/dist/test/utilities/env.d.ts +40 -0
- package/dist/test/utilities/env.d.ts.map +1 -0
- package/dist/test/utilities/kv.d.ts +11 -0
- package/dist/test/utilities/kv.d.ts.map +1 -0
- package/dist/test/utilities/media.d.ts +16 -0
- package/dist/test/utilities/media.d.ts.map +1 -0
- package/dist/test/utilities/platform.d.ts +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/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +10 -98
- package/dist/test/utilities.d.ts.map +1 -1
- package/dist/test/worker.d.ts +6 -0
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/token-35jcdqq8.js +419 -0
- package/dist/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/worker-entrypoint.d.ts +5 -0
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/types-6vc02evc.js +705 -0
- package/dist/utils/entrypoint-discovery.d.ts +6 -3
- package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
- package/dist/utils/resolve-package.d.ts.map +1 -1
- package/dist/utils/send-email.d.ts +15 -0
- package/dist/utils/send-email.d.ts.map +1 -0
- package/dist/utils/send-email.js +19 -0
- package/dist/vite/config-file.d.ts +25 -0
- package/dist/vite/config-file.d.ts.map +1 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +25 -331
- package/dist/vite/plugin-config-hook.d.ts +28 -0
- package/dist/vite/plugin-config-hook.d.ts.map +1 -0
- package/dist/vite/plugin-context.d.ts +27 -0
- package/dist/vite/plugin-context.d.ts.map +1 -0
- package/dist/vite/plugin-durable-objects.d.ts +18 -0
- package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
- package/dist/vite/plugin-programmatic.d.ts +44 -0
- package/dist/vite/plugin-programmatic.d.ts.map +1 -0
- package/dist/vite/plugin-service-bindings.d.ts +13 -0
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
- package/dist/vite/plugin-transform.d.ts +41 -0
- package/dist/vite/plugin-transform.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +10 -41
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-entry/composed-worker.d.ts +7 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -0
- package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
- package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
- package/dist/worker-entry/extensions.d.ts +5 -0
- package/dist/worker-entry/extensions.d.ts.map +1 -0
- package/dist/worker-entry/routes.d.ts +22 -0
- package/dist/worker-entry/routes.d.ts.map +1 -0
- package/dist/worker-entry/surface-paths.d.ts +26 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/{worker-entrypoint-m9th0rg0.js → worker-entrypoint-3rmzd4c1.js} +3 -1
- package/dist/worker-f2v85f7d.js +513 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
- package/package.json +154 -115
- package/dist/account-rvrj687w.js +0 -397
- 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-pa8dhm20.js +0 -2162
- package/dist/index-67qcae0f.js +0 -183
- 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-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- 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
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloudflareAPIError,
|
|
3
|
+
apiDelete,
|
|
4
|
+
apiGet,
|
|
5
|
+
apiGetAll,
|
|
6
|
+
apiPatch,
|
|
7
|
+
apiPost,
|
|
8
|
+
kvDelete,
|
|
9
|
+
kvGet,
|
|
10
|
+
kvPut
|
|
11
|
+
} from "./index-mg8vwqxf.js";
|
|
12
|
+
import {
|
|
13
|
+
__require
|
|
14
|
+
} from "./index-37x76zdn.js";
|
|
15
|
+
|
|
16
|
+
// src/cloudflare/account-core.ts
|
|
17
|
+
async function getAccounts(options) {
|
|
18
|
+
const accounts = await apiGetAll("/accounts", options);
|
|
19
|
+
return accounts.map((account) => ({
|
|
20
|
+
id: account.id,
|
|
21
|
+
name: account.name,
|
|
22
|
+
type: account.type,
|
|
23
|
+
createdOn: account.created_on ? new Date(account.created_on) : undefined
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
async function getPrimaryAccount(options) {
|
|
27
|
+
const accounts = await getAccounts(options);
|
|
28
|
+
return accounts[0] ?? null;
|
|
29
|
+
}
|
|
30
|
+
async function getAccountById(accountId, options) {
|
|
31
|
+
try {
|
|
32
|
+
const account = await apiGet(`/accounts/${accountId}`, options);
|
|
33
|
+
return {
|
|
34
|
+
id: account.id,
|
|
35
|
+
name: account.name,
|
|
36
|
+
type: account.type,
|
|
37
|
+
createdOn: account.created_on ? new Date(account.created_on) : undefined
|
|
38
|
+
};
|
|
39
|
+
} catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/cloudflare/account-workers.ts
|
|
45
|
+
async function listWorkers(accountId, options) {
|
|
46
|
+
const scripts = await apiGetAll(`/accounts/${accountId}/workers/scripts`, options);
|
|
47
|
+
return scripts.map((script) => ({
|
|
48
|
+
name: script.name ?? script.id,
|
|
49
|
+
createdOn: new Date(script.created_on),
|
|
50
|
+
modifiedOn: new Date(script.modified_on)
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
async function renameWorker(accountId, workerId, newName, options) {
|
|
54
|
+
const encodedWorkerId = encodeURIComponent(workerId);
|
|
55
|
+
const result = await apiPatch(`/accounts/${accountId}/workers/workers/${encodedWorkerId}`, { name: newName }, options);
|
|
56
|
+
return {
|
|
57
|
+
id: result.id,
|
|
58
|
+
name: result.name
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async function deleteWorker(accountId, scriptName, options) {
|
|
62
|
+
const encodedScriptName = encodeURIComponent(scriptName);
|
|
63
|
+
await apiDelete(`/accounts/${accountId}/workers/scripts/${encodedScriptName}`, options);
|
|
64
|
+
}
|
|
65
|
+
function mapWorkerVersionInfo(version) {
|
|
66
|
+
return {
|
|
67
|
+
id: version.id ?? "",
|
|
68
|
+
number: version.number,
|
|
69
|
+
metadata: {
|
|
70
|
+
authorEmail: version.metadata?.author_email,
|
|
71
|
+
authorId: version.metadata?.author_id,
|
|
72
|
+
createdOn: version.metadata?.created_on ? new Date(version.metadata.created_on) : undefined,
|
|
73
|
+
modifiedOn: version.metadata?.modified_on ? new Date(version.metadata.modified_on) : undefined,
|
|
74
|
+
hasPreview: version.metadata?.has_preview === true || version.metadata?.hasPreview === true,
|
|
75
|
+
source: version.metadata?.source
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
async function listWorkerVersions(accountId, scriptName, options) {
|
|
80
|
+
const versions = [];
|
|
81
|
+
const encodedScriptName = encodeURIComponent(scriptName);
|
|
82
|
+
for (let page = 1;page <= 100; page++) {
|
|
83
|
+
const result = await apiGet(`/accounts/${accountId}/workers/scripts/${encodedScriptName}/versions?page=${page}&per_page=100`, options);
|
|
84
|
+
const items = result.items ?? [];
|
|
85
|
+
versions.push(...items.map((item) => mapWorkerVersionInfo(item)));
|
|
86
|
+
if (items.length < 100) {
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return versions;
|
|
91
|
+
}
|
|
92
|
+
async function getWorkerVersionDetail(accountId, scriptName, versionId, options) {
|
|
93
|
+
const encodedScriptName = encodeURIComponent(scriptName);
|
|
94
|
+
const result = await apiGet(`/accounts/${accountId}/workers/scripts/${encodedScriptName}/versions/${versionId}`, options);
|
|
95
|
+
return mapWorkerVersionInfo(result);
|
|
96
|
+
}
|
|
97
|
+
async function listWorkerDeployments(accountId, scriptName, options) {
|
|
98
|
+
const encodedScriptName = encodeURIComponent(scriptName);
|
|
99
|
+
const result = await apiGet(`/accounts/${accountId}/workers/scripts/${encodedScriptName}/deployments`, options);
|
|
100
|
+
return (result.deployments ?? []).map((deployment) => ({
|
|
101
|
+
id: deployment.id,
|
|
102
|
+
createdOn: new Date(deployment.created_on),
|
|
103
|
+
source: deployment.source,
|
|
104
|
+
strategy: deployment.strategy,
|
|
105
|
+
versions: deployment.versions.map((version) => ({
|
|
106
|
+
percentage: version.percentage,
|
|
107
|
+
versionId: version.version_id
|
|
108
|
+
})),
|
|
109
|
+
message: deployment.annotations?.["workers/message"],
|
|
110
|
+
triggeredBy: deployment.annotations?.["workers/triggered_by"],
|
|
111
|
+
authorEmail: deployment.author_email
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
async function getWorkersSubdomain(accountId, options) {
|
|
115
|
+
try {
|
|
116
|
+
const result = await apiGet(`/accounts/${accountId}/workers/subdomain`, options);
|
|
117
|
+
return result.subdomain || null;
|
|
118
|
+
} catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/cloudflare/account-resources.ts
|
|
124
|
+
async function listKVNamespaces(accountId, options) {
|
|
125
|
+
const namespaces = await apiGetAll(`/accounts/${accountId}/storage/kv/namespaces`, options);
|
|
126
|
+
return namespaces.map((namespace) => ({
|
|
127
|
+
id: namespace.id,
|
|
128
|
+
name: namespace.title
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
async function createKVNamespace(accountId, title, options) {
|
|
132
|
+
const namespace = await apiPost(`/accounts/${accountId}/storage/kv/namespaces`, { title }, options);
|
|
133
|
+
return {
|
|
134
|
+
id: namespace.id,
|
|
135
|
+
name: namespace.title
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async function deleteKVNamespace(accountId, namespaceId, options) {
|
|
139
|
+
const encodedNamespaceId = encodeURIComponent(namespaceId);
|
|
140
|
+
await apiDelete(`/accounts/${accountId}/storage/kv/namespaces/${encodedNamespaceId}`, options);
|
|
141
|
+
}
|
|
142
|
+
async function listD1Databases(accountId, options) {
|
|
143
|
+
const databases = await apiGetAll(`/accounts/${accountId}/d1/database`, options);
|
|
144
|
+
return databases.map((database) => ({
|
|
145
|
+
id: database.uuid,
|
|
146
|
+
name: database.name,
|
|
147
|
+
version: database.version,
|
|
148
|
+
tableCount: database.num_tables,
|
|
149
|
+
sizeBytes: database.file_size
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
async function createD1Database(accountId, name, options) {
|
|
153
|
+
const created = await apiPost(`/accounts/${accountId}/d1/database`, {
|
|
154
|
+
name,
|
|
155
|
+
...options?.jurisdiction ? { jurisdiction: options.jurisdiction } : {},
|
|
156
|
+
...options?.primaryLocationHint ? { primary_location_hint: options.primaryLocationHint } : {}
|
|
157
|
+
}, options);
|
|
158
|
+
return {
|
|
159
|
+
id: created.uuid,
|
|
160
|
+
name: created.name,
|
|
161
|
+
version: created.version,
|
|
162
|
+
tableCount: created.num_tables,
|
|
163
|
+
sizeBytes: created.file_size
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function deleteD1Database(accountId, databaseId, options) {
|
|
167
|
+
const encodedDatabaseId = encodeURIComponent(databaseId);
|
|
168
|
+
await apiDelete(`/accounts/${accountId}/d1/database/${encodedDatabaseId}`, options);
|
|
169
|
+
}
|
|
170
|
+
async function queryD1Database(accountId, databaseId, query, options) {
|
|
171
|
+
const { apiPost: apiPost2 } = await import("./api-2n6dd2ws.js");
|
|
172
|
+
return apiPost2(`/accounts/${accountId}/d1/database/${databaseId}/query`, query, options);
|
|
173
|
+
}
|
|
174
|
+
async function rawD1DatabaseQuery(accountId, databaseId, query, options) {
|
|
175
|
+
const { apiPost: apiPost2 } = await import("./api-2n6dd2ws.js");
|
|
176
|
+
return apiPost2(`/accounts/${accountId}/d1/database/${databaseId}/raw`, query, options);
|
|
177
|
+
}
|
|
178
|
+
async function listQueues(accountId, options) {
|
|
179
|
+
const queues = await apiGetAll(`/accounts/${accountId}/queues`, options);
|
|
180
|
+
return queues.filter((queue) => {
|
|
181
|
+
return typeof queue.queue_id === "string" && queue.queue_id.length > 0 && typeof queue.queue_name === "string" && queue.queue_name.length > 0;
|
|
182
|
+
}).map((queue) => ({
|
|
183
|
+
id: queue.queue_id,
|
|
184
|
+
name: queue.queue_name,
|
|
185
|
+
createdOn: queue.created_on ? new Date(queue.created_on) : undefined,
|
|
186
|
+
modifiedOn: queue.modified_on ? new Date(queue.modified_on) : undefined,
|
|
187
|
+
deliveryDelay: queue.settings?.delivery_delay,
|
|
188
|
+
deliveryPaused: queue.settings?.delivery_paused,
|
|
189
|
+
messageRetentionPeriod: queue.settings?.message_retention_period
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
async function createQueue(accountId, queueName, options) {
|
|
193
|
+
const queue = await apiPost(`/accounts/${accountId}/queues`, { queue_name: queueName }, options);
|
|
194
|
+
return {
|
|
195
|
+
id: queue.queue_id ?? "",
|
|
196
|
+
name: queue.queue_name ?? queueName,
|
|
197
|
+
createdOn: queue.created_on ? new Date(queue.created_on) : undefined,
|
|
198
|
+
modifiedOn: queue.modified_on ? new Date(queue.modified_on) : undefined,
|
|
199
|
+
deliveryDelay: queue.settings?.delivery_delay,
|
|
200
|
+
deliveryPaused: queue.settings?.delivery_paused,
|
|
201
|
+
messageRetentionPeriod: queue.settings?.message_retention_period
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
async function deleteQueue(accountId, queueId, options) {
|
|
205
|
+
const encodedQueueId = encodeURIComponent(queueId);
|
|
206
|
+
await apiDelete(`/accounts/${accountId}/queues/${encodedQueueId}`, options);
|
|
207
|
+
}
|
|
208
|
+
async function listR2Buckets(accountId, options) {
|
|
209
|
+
const buckets = await apiGetAll(`/accounts/${accountId}/r2/buckets`, options);
|
|
210
|
+
return buckets.map((bucket) => ({
|
|
211
|
+
name: bucket.name,
|
|
212
|
+
createdOn: new Date(bucket.creation_date),
|
|
213
|
+
location: bucket.location
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
async function createR2Bucket(accountId, name, options) {
|
|
217
|
+
const bucket = await apiPost(`/accounts/${accountId}/r2/buckets`, {
|
|
218
|
+
name,
|
|
219
|
+
...options?.locationHint ? { locationHint: options.locationHint } : {},
|
|
220
|
+
...options?.storageClass ? { storageClass: options.storageClass } : {}
|
|
221
|
+
}, options);
|
|
222
|
+
return {
|
|
223
|
+
name: bucket.name,
|
|
224
|
+
createdOn: bucket.creation_date ? new Date(bucket.creation_date) : new Date,
|
|
225
|
+
location: bucket.location
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
async function deleteR2Bucket(accountId, bucketName, options) {
|
|
229
|
+
const encodedBucketName = encodeURIComponent(bucketName);
|
|
230
|
+
await apiDelete(`/accounts/${accountId}/r2/buckets/${encodedBucketName}`, options);
|
|
231
|
+
}
|
|
232
|
+
async function listHyperdrives(accountId, options) {
|
|
233
|
+
const hyperdrives = await apiGetAll(`/accounts/${accountId}/hyperdrive/configs`, options);
|
|
234
|
+
return hyperdrives.map((hyperdrive) => ({
|
|
235
|
+
id: hyperdrive.id,
|
|
236
|
+
name: hyperdrive.name,
|
|
237
|
+
createdOn: hyperdrive.created_on ? new Date(hyperdrive.created_on) : undefined,
|
|
238
|
+
modifiedOn: hyperdrive.modified_on ? new Date(hyperdrive.modified_on) : undefined
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
async function deleteHyperdrive(accountId, hyperdriveId, options) {
|
|
242
|
+
const encodedHyperdriveId = encodeURIComponent(hyperdriveId);
|
|
243
|
+
await apiDelete(`/accounts/${accountId}/hyperdrive/configs/${encodedHyperdriveId}`, options);
|
|
244
|
+
}
|
|
245
|
+
async function listVectorizeIndexes(accountId, options) {
|
|
246
|
+
try {
|
|
247
|
+
const indexes = await apiGetAll(`/accounts/${accountId}/vectorize/v2/indexes`, options);
|
|
248
|
+
return indexes.map((index) => ({
|
|
249
|
+
name: index.name,
|
|
250
|
+
dimensions: index.config.dimensions,
|
|
251
|
+
metric: index.config.metric,
|
|
252
|
+
description: index.description
|
|
253
|
+
}));
|
|
254
|
+
} catch (error) {
|
|
255
|
+
if (error instanceof CloudflareAPIError && error.code === 404) {
|
|
256
|
+
return [];
|
|
257
|
+
}
|
|
258
|
+
throw error;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
async function createVectorizeIndex(accountId, index, options) {
|
|
262
|
+
const created = await apiPost(`/accounts/${accountId}/vectorize/v2/indexes`, {
|
|
263
|
+
name: index.name,
|
|
264
|
+
config: {
|
|
265
|
+
dimensions: index.dimensions,
|
|
266
|
+
metric: index.metric
|
|
267
|
+
},
|
|
268
|
+
...index.description ? { description: index.description } : {}
|
|
269
|
+
}, options);
|
|
270
|
+
return {
|
|
271
|
+
name: created.name,
|
|
272
|
+
dimensions: created.config.dimensions,
|
|
273
|
+
metric: created.config.metric,
|
|
274
|
+
description: created.description
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
async function deleteVectorizeIndex(accountId, indexName, options) {
|
|
278
|
+
const encodedIndexName = encodeURIComponent(indexName);
|
|
279
|
+
await apiDelete(`/accounts/${accountId}/vectorize/v2/indexes/${encodedIndexName}`, options);
|
|
280
|
+
}
|
|
281
|
+
async function listAIModels(accountId, options) {
|
|
282
|
+
try {
|
|
283
|
+
const models = await apiGetAll(`/accounts/${accountId}/ai/models/search`, options);
|
|
284
|
+
return models.map((model) => ({
|
|
285
|
+
id: model.id,
|
|
286
|
+
name: model.name,
|
|
287
|
+
task: model.task?.name,
|
|
288
|
+
description: model.description
|
|
289
|
+
}));
|
|
290
|
+
} catch {
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/cloudflare/account-status.ts
|
|
296
|
+
var SERVICE_STATUS_TIMEOUT_MS = 1e4;
|
|
297
|
+
var serviceInventoryFetchers = {
|
|
298
|
+
workers: listWorkers,
|
|
299
|
+
kv: listKVNamespaces,
|
|
300
|
+
d1: listD1Databases,
|
|
301
|
+
hyperdrive: listHyperdrives,
|
|
302
|
+
r2: listR2Buckets,
|
|
303
|
+
vectorize: listVectorizeIndexes,
|
|
304
|
+
ai: listAIModels
|
|
305
|
+
};
|
|
306
|
+
async function withServiceTimeout(operation) {
|
|
307
|
+
let timeoutId = null;
|
|
308
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
309
|
+
timeoutId = setTimeout(() => reject(new Error("timeout")), SERVICE_STATUS_TIMEOUT_MS);
|
|
310
|
+
});
|
|
311
|
+
try {
|
|
312
|
+
return await Promise.race([
|
|
313
|
+
operation,
|
|
314
|
+
timeoutPromise
|
|
315
|
+
]);
|
|
316
|
+
} finally {
|
|
317
|
+
if (timeoutId) {
|
|
318
|
+
clearTimeout(timeoutId);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function createAvailableServiceStatus(service, count) {
|
|
323
|
+
return {
|
|
324
|
+
service,
|
|
325
|
+
available: service === "ai" ? count > 0 : true,
|
|
326
|
+
count
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
async function getServiceStatus(accountId, service) {
|
|
330
|
+
const fetchInventory = serviceInventoryFetchers[service];
|
|
331
|
+
if (!fetchInventory) {
|
|
332
|
+
return {
|
|
333
|
+
service,
|
|
334
|
+
available: false
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
try {
|
|
338
|
+
const inventory = await withServiceTimeout(fetchInventory(accountId));
|
|
339
|
+
return createAvailableServiceStatus(service, inventory.length);
|
|
340
|
+
} catch {
|
|
341
|
+
return {
|
|
342
|
+
service,
|
|
343
|
+
available: false
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
async function getAllServiceStatus(accountId) {
|
|
348
|
+
const services = [
|
|
349
|
+
"workers",
|
|
350
|
+
"kv",
|
|
351
|
+
"d1",
|
|
352
|
+
"hyperdrive",
|
|
353
|
+
"r2",
|
|
354
|
+
"vectorize",
|
|
355
|
+
"ai"
|
|
356
|
+
];
|
|
357
|
+
return Promise.all(services.map((service) => getServiceStatus(accountId, service)));
|
|
358
|
+
}
|
|
359
|
+
async function hasService(accountId, service) {
|
|
360
|
+
const status = await getServiceStatus(accountId, service);
|
|
361
|
+
return status.available;
|
|
362
|
+
}
|
|
363
|
+
async function getAccountSummary(accountId) {
|
|
364
|
+
const account = await getAccountById(accountId);
|
|
365
|
+
if (!account) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
const services = await getAllServiceStatus(accountId);
|
|
369
|
+
return {
|
|
370
|
+
account,
|
|
371
|
+
services
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
// src/cloudflare/preferences.ts
|
|
375
|
+
import { homedir } from "node:os";
|
|
376
|
+
import { join } from "node:path";
|
|
377
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, renameSync, unlinkSync } from "node:fs";
|
|
378
|
+
|
|
379
|
+
// src/cloudflare/kv-namespace.ts
|
|
380
|
+
var DEVFLARE_KV_NAMESPACE_TITLE = "devflare-usage";
|
|
381
|
+
async function getOrCreateNamedKVNamespace(accountId, title = DEVFLARE_KV_NAMESPACE_TITLE, options) {
|
|
382
|
+
const namespaces = await apiGetAll(`/accounts/${accountId}/storage/kv/namespaces`, options);
|
|
383
|
+
const existing = namespaces.find((namespace) => namespace.title === title);
|
|
384
|
+
if (existing) {
|
|
385
|
+
return existing.id;
|
|
386
|
+
}
|
|
387
|
+
const created = await apiPost(`/accounts/${accountId}/storage/kv/namespaces`, { title }, options);
|
|
388
|
+
return created.id;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// src/cloudflare/preferences.ts
|
|
392
|
+
var GLOBAL_ACCOUNT_KEY = "settings:defaultAccountId";
|
|
393
|
+
var LOCAL_CACHE_DIR = ".devflare";
|
|
394
|
+
var LOCAL_CACHE_FILE = "preferences.json";
|
|
395
|
+
function writeFileAtomic(path, contents) {
|
|
396
|
+
const tmpPath = path + ".tmp-" + process.pid + "-" + Date.now();
|
|
397
|
+
writeFileSync(tmpPath, contents, "utf-8");
|
|
398
|
+
try {
|
|
399
|
+
renameSync(tmpPath, path);
|
|
400
|
+
} catch (error) {
|
|
401
|
+
try {
|
|
402
|
+
unlinkSync(tmpPath);
|
|
403
|
+
} catch {}
|
|
404
|
+
throw error;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function getLocalPreferencesPath() {
|
|
408
|
+
return join(homedir(), LOCAL_CACHE_DIR, LOCAL_CACHE_FILE);
|
|
409
|
+
}
|
|
410
|
+
function readLocalPreferences() {
|
|
411
|
+
const path = getLocalPreferencesPath();
|
|
412
|
+
if (!existsSync(path)) {
|
|
413
|
+
return {};
|
|
414
|
+
}
|
|
415
|
+
try {
|
|
416
|
+
const content = readFileSync(path, "utf-8");
|
|
417
|
+
return JSON.parse(content);
|
|
418
|
+
} catch {
|
|
419
|
+
return {};
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function writeLocalPreferences(prefs) {
|
|
423
|
+
const path = getLocalPreferencesPath();
|
|
424
|
+
const dir = join(homedir(), LOCAL_CACHE_DIR);
|
|
425
|
+
if (!existsSync(dir)) {
|
|
426
|
+
mkdirSync(dir, { recursive: true });
|
|
427
|
+
}
|
|
428
|
+
writeFileAtomic(path, JSON.stringify(prefs, null, "\t"));
|
|
429
|
+
}
|
|
430
|
+
function findPackageJsonPath(startDir) {
|
|
431
|
+
let dir = startDir ?? process.cwd();
|
|
432
|
+
while (dir !== join(dir, "..")) {
|
|
433
|
+
const pkgPath = join(dir, "package.json");
|
|
434
|
+
if (existsSync(pkgPath)) {
|
|
435
|
+
return pkgPath;
|
|
436
|
+
}
|
|
437
|
+
dir = join(dir, "..");
|
|
438
|
+
}
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
function readPackageJson(path) {
|
|
442
|
+
try {
|
|
443
|
+
const content = readFileSync(path, "utf-8");
|
|
444
|
+
return JSON.parse(content);
|
|
445
|
+
} catch {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function writePackageJson(path, pkg) {
|
|
450
|
+
writeFileAtomic(path, JSON.stringify(pkg, null, "\t") + `
|
|
451
|
+
`);
|
|
452
|
+
}
|
|
453
|
+
function getWorkspaceAccountId() {
|
|
454
|
+
const pkgPath = findPackageJsonPath();
|
|
455
|
+
if (!pkgPath)
|
|
456
|
+
return null;
|
|
457
|
+
const pkg = readPackageJson(pkgPath);
|
|
458
|
+
return pkg?.devflare?.accountId ?? null;
|
|
459
|
+
}
|
|
460
|
+
function setWorkspaceAccountId(accountId) {
|
|
461
|
+
let pkgPath = findPackageJsonPath();
|
|
462
|
+
let pkg;
|
|
463
|
+
if (pkgPath) {
|
|
464
|
+
pkg = readPackageJson(pkgPath) ?? {};
|
|
465
|
+
} else {
|
|
466
|
+
pkgPath = join(process.cwd(), "package.json");
|
|
467
|
+
pkg = {
|
|
468
|
+
name: "workspace",
|
|
469
|
+
private: true
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
if (!pkg.devflare) {
|
|
473
|
+
pkg.devflare = {};
|
|
474
|
+
}
|
|
475
|
+
pkg.devflare.accountId = accountId;
|
|
476
|
+
writePackageJson(pkgPath, pkg);
|
|
477
|
+
return pkgPath;
|
|
478
|
+
}
|
|
479
|
+
async function getOrCreatePreferencesNamespace(accountId) {
|
|
480
|
+
return getOrCreateNamedKVNamespace(accountId, DEVFLARE_KV_NAMESPACE_TITLE);
|
|
481
|
+
}
|
|
482
|
+
async function getGlobalDefaultAccountId(fallbackAccountId) {
|
|
483
|
+
const local = readLocalPreferences();
|
|
484
|
+
if (local.defaultAccountId) {
|
|
485
|
+
return local.defaultAccountId;
|
|
486
|
+
}
|
|
487
|
+
try {
|
|
488
|
+
const namespaceId = await getOrCreatePreferencesNamespace(fallbackAccountId);
|
|
489
|
+
const value = await kvGet(fallbackAccountId, namespaceId, GLOBAL_ACCOUNT_KEY);
|
|
490
|
+
if (value) {
|
|
491
|
+
writeLocalPreferences({
|
|
492
|
+
...local,
|
|
493
|
+
defaultAccountId: value,
|
|
494
|
+
lastUpdated: new Date().toISOString()
|
|
495
|
+
});
|
|
496
|
+
return value;
|
|
497
|
+
}
|
|
498
|
+
} catch (error) {
|
|
499
|
+
console.debug("[devflare preferences] cloud KV sync failed:", error instanceof Error ? error.message : String(error));
|
|
500
|
+
}
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
async function setGlobalDefaultAccountId(accountId, anyAccountId) {
|
|
504
|
+
const kvAccountId = anyAccountId ?? accountId;
|
|
505
|
+
const local = readLocalPreferences();
|
|
506
|
+
writeLocalPreferences({
|
|
507
|
+
...local,
|
|
508
|
+
defaultAccountId: accountId,
|
|
509
|
+
lastUpdated: new Date().toISOString()
|
|
510
|
+
});
|
|
511
|
+
try {
|
|
512
|
+
const namespaceId = await getOrCreatePreferencesNamespace(kvAccountId);
|
|
513
|
+
await kvPut(kvAccountId, namespaceId, GLOBAL_ACCOUNT_KEY, accountId);
|
|
514
|
+
} catch (error) {
|
|
515
|
+
console.debug("[devflare preferences] cloud KV sync failed:", error instanceof Error ? error.message : String(error));
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
async function getEffectiveAccountId(primaryAccountId) {
|
|
519
|
+
const workspaceId = getWorkspaceAccountId();
|
|
520
|
+
if (workspaceId) {
|
|
521
|
+
return { accountId: workspaceId, source: "workspace" };
|
|
522
|
+
}
|
|
523
|
+
const globalId = await getGlobalDefaultAccountId(primaryAccountId);
|
|
524
|
+
if (globalId) {
|
|
525
|
+
return { accountId: globalId, source: "global" };
|
|
526
|
+
}
|
|
527
|
+
return { accountId: primaryAccountId, source: "primary" };
|
|
528
|
+
}
|
|
529
|
+
async function clearGlobalDefaultAccountId(anyAccountId) {
|
|
530
|
+
const local = readLocalPreferences();
|
|
531
|
+
delete local.defaultAccountId;
|
|
532
|
+
local.lastUpdated = new Date().toISOString();
|
|
533
|
+
writeLocalPreferences(local);
|
|
534
|
+
try {
|
|
535
|
+
const namespaceId = await getOrCreatePreferencesNamespace(anyAccountId);
|
|
536
|
+
await kvDelete(anyAccountId, namespaceId, GLOBAL_ACCOUNT_KEY);
|
|
537
|
+
} catch (error) {
|
|
538
|
+
console.debug("[devflare preferences] cloud KV sync failed:", error instanceof Error ? error.message : String(error));
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export { getAccounts, getPrimaryAccount, getAccountById, listWorkers, renameWorker, deleteWorker, listWorkerVersions, getWorkerVersionDetail, listWorkerDeployments, getWorkersSubdomain, listKVNamespaces, createKVNamespace, deleteKVNamespace, listD1Databases, createD1Database, deleteD1Database, queryD1Database, rawD1DatabaseQuery, listQueues, createQueue, deleteQueue, listR2Buckets, createR2Bucket, deleteR2Bucket, listHyperdrives, deleteHyperdrive, listVectorizeIndexes, createVectorizeIndex, deleteVectorizeIndex, listAIModels, getServiceStatus, getAllServiceStatus, hasService, getAccountSummary, DEVFLARE_KV_NAMESPACE_TITLE, getOrCreateNamedKVNamespace, getWorkspaceAccountId, setWorkspaceAccountId, getGlobalDefaultAccountId, setGlobalDefaultAccountId, getEffectiveAccountId, clearGlobalDefaultAccountId };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_ENTRYPOINT_PATTERN,
|
|
3
|
+
findFiles,
|
|
4
|
+
findFilesSync
|
|
5
|
+
} from "./index-qwgr4q7s.js";
|
|
6
|
+
import {
|
|
7
|
+
__require
|
|
8
|
+
} from "./index-37x76zdn.js";
|
|
9
|
+
|
|
10
|
+
// src/utils/entrypoint-discovery.ts
|
|
11
|
+
import { readFileSync } from "fs";
|
|
12
|
+
var ENTRYPOINT_CLASS_PATTERN = /export\s+class\s+(\w+)\s+extends\s+WorkerEntrypoint/g;
|
|
13
|
+
function findEntrypointClasses(code) {
|
|
14
|
+
const classes = [];
|
|
15
|
+
ENTRYPOINT_CLASS_PATTERN.lastIndex = 0;
|
|
16
|
+
let match;
|
|
17
|
+
while ((match = ENTRYPOINT_CLASS_PATTERN.exec(code)) !== null) {
|
|
18
|
+
classes.push(match[1]);
|
|
19
|
+
}
|
|
20
|
+
return classes;
|
|
21
|
+
}
|
|
22
|
+
function discoverEntrypointsSync(cwd, pattern = DEFAULT_ENTRYPOINT_PATTERN) {
|
|
23
|
+
const discovered = [];
|
|
24
|
+
try {
|
|
25
|
+
const files = findFilesSync(pattern, { cwd });
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
try {
|
|
28
|
+
const code = readFileSync(file, "utf-8");
|
|
29
|
+
const classNames = findEntrypointClasses(code);
|
|
30
|
+
for (const className of classNames) {
|
|
31
|
+
discovered.push({ className, filePath: file });
|
|
32
|
+
}
|
|
33
|
+
} catch {}
|
|
34
|
+
}
|
|
35
|
+
} catch {}
|
|
36
|
+
return discovered;
|
|
37
|
+
}
|
|
38
|
+
async function discoverEntrypointsAsync(cwd, pattern = DEFAULT_ENTRYPOINT_PATTERN) {
|
|
39
|
+
const fs = await import("node:fs/promises");
|
|
40
|
+
const discovered = [];
|
|
41
|
+
const files = await findFiles(pattern, { cwd });
|
|
42
|
+
for (const filePath of files) {
|
|
43
|
+
try {
|
|
44
|
+
const code = await fs.readFile(filePath, "utf-8");
|
|
45
|
+
const classNames = findEntrypointClasses(code);
|
|
46
|
+
for (const className of classNames) {
|
|
47
|
+
discovered.push({ className, filePath });
|
|
48
|
+
}
|
|
49
|
+
} catch {}
|
|
50
|
+
}
|
|
51
|
+
return discovered;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/utils/resolve-package.ts
|
|
55
|
+
import { resolve, dirname } from "pathe";
|
|
56
|
+
import { readFileSync as readFileSync2, existsSync } from "node:fs";
|
|
57
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
58
|
+
import { createRequire } from "node:module";
|
|
59
|
+
var NOT_FOUND_CODES = new Set(["MODULE_NOT_FOUND", "ERR_MODULE_NOT_FOUND"]);
|
|
60
|
+
function isNotFoundError(error) {
|
|
61
|
+
if (!error || typeof error !== "object") {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const code = error.code;
|
|
65
|
+
return typeof code === "string" && NOT_FOUND_CODES.has(code);
|
|
66
|
+
}
|
|
67
|
+
function resolveSpecifier(specifier, fromDir) {
|
|
68
|
+
const fromFileUrl = pathToFileURL(resolve(fromDir, "package.json")).href;
|
|
69
|
+
const importMetaResolve = import.meta.resolve;
|
|
70
|
+
if (typeof importMetaResolve === "function") {
|
|
71
|
+
try {
|
|
72
|
+
const resolved = importMetaResolve(specifier, fromFileUrl);
|
|
73
|
+
if (typeof resolved === "string") {
|
|
74
|
+
return resolved.startsWith("file:") ? fileURLToPath(resolved) : resolved;
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (!isNotFoundError(error)) {
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const require_ = createRequire(fromFileUrl);
|
|
84
|
+
return require_.resolve(specifier);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
if (isNotFoundError(error)) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function resolvePackageSpecifier(specifier, fromDir) {
|
|
93
|
+
if (specifier.startsWith(".") || specifier.startsWith("/") || /^[A-Za-z]:/.test(specifier)) {
|
|
94
|
+
return resolve(fromDir, specifier);
|
|
95
|
+
}
|
|
96
|
+
const parts = specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0];
|
|
97
|
+
const subpath = specifier.startsWith("@") ? specifier.split("/").slice(2).join("/") : specifier.split("/").slice(1).join("/");
|
|
98
|
+
const pkgJsonPath = resolveSpecifier(`${parts}/package.json`, fromDir);
|
|
99
|
+
if (!pkgJsonPath) {
|
|
100
|
+
return resolve(fromDir, specifier);
|
|
101
|
+
}
|
|
102
|
+
const pkgDir = dirname(pkgJsonPath);
|
|
103
|
+
if (subpath) {
|
|
104
|
+
const pkgJson = JSON.parse(readFileSync2(pkgJsonPath, "utf-8"));
|
|
105
|
+
const exportPath = pkgJson.exports?.[`./${subpath}`];
|
|
106
|
+
if (exportPath) {
|
|
107
|
+
const targetPath = typeof exportPath === "string" ? exportPath : exportPath.default || exportPath.import;
|
|
108
|
+
return resolve(pkgDir, targetPath);
|
|
109
|
+
}
|
|
110
|
+
const directPath = resolve(pkgDir, `${subpath}.ts`);
|
|
111
|
+
if (existsSync(directPath))
|
|
112
|
+
return directPath;
|
|
113
|
+
const withExt = resolve(pkgDir, subpath);
|
|
114
|
+
if (existsSync(withExt))
|
|
115
|
+
return withExt;
|
|
116
|
+
if (existsSync(`${withExt}.ts`))
|
|
117
|
+
return `${withExt}.ts`;
|
|
118
|
+
if (existsSync(`${withExt}.js`))
|
|
119
|
+
return `${withExt}.js`;
|
|
120
|
+
}
|
|
121
|
+
return pkgDir;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { discoverEntrypointsSync, discoverEntrypointsAsync, resolvePackageSpecifier };
|