devflare 1.0.0-next.3 → 1.0.0-next.30
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 +15961 -1751
- package/README.md +389 -605
- package/bin/devflare.js +24 -14
- package/dist/account-fvf5gxc9.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 +4585 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +147 -0
- package/dist/build-x1fhfsgs.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 +267 -0
- package/dist/config/compiler/types.d.ts.map +1 -0
- package/dist/config/compiler.d.ts +22 -134
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/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 +3005 -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 +390 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +4495 -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-2d6x21jn.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-g85w9drn.js +1066 -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/dev-ymkq3thq.js +2609 -0
- package/dist/{doctor-fmgb3d28.js → doctor-sjrcz7x9.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-0gtmnw0m.js +895 -0
- package/dist/index-11p28kxx.js +256 -0
- package/dist/index-15fpa5tx.js +232 -0
- package/dist/index-1d4jg11n.js +542 -0
- package/dist/index-2sc756r1.js +1578 -0
- package/dist/index-3edvz3hs.js +124 -0
- package/dist/index-3jme4hgw.js +1234 -0
- package/dist/index-467tm7r4.js +1033 -0
- package/dist/index-5yvpk954.js +699 -0
- package/dist/index-627srx16.js +45 -0
- package/dist/index-62b3gt2g.js +12 -0
- package/dist/index-6sj0v0dk.js +2284 -0
- package/dist/index-706k4606.js +52 -0
- package/dist/index-7zfv1g9m.js +147 -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-c4jmfzz7.js +109 -0
- package/dist/index-c8p4njqy.js +479 -0
- package/dist/index-dm9q84c7.js +360 -0
- package/dist/index-fjmdb57t.js +581 -0
- package/dist/index-g4fcnwhc.js +1205 -0
- package/dist/{index-18hvb6gb.js → index-gn5wy09x.js} +13 -2
- package/dist/index-hpwa6vsw.js +239 -0
- package/dist/index-mg8vwqxf.js +514 -0
- package/dist/index-pmeashfz.js +476 -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-sqkbyw0c.js +1428 -0
- package/dist/index-stgn34cr.js +148 -0
- package/dist/index-t9y0sve5.js +155 -0
- package/dist/index-thwacc28.js +74 -0
- package/dist/index-vhqww6tt.js +307 -0
- package/dist/{index-1xpj0m4r.js → index-z9gy8w6b.js} +1 -1
- package/dist/index-za0r01bx.js +588 -0
- package/dist/index-zwmphmc5.js +185 -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-fthspvbx.js +77 -0
- package/dist/previews-aa16z2hj.js +1337 -0
- package/dist/productions-vemjgfz0.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-b0x50dd1.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-03w8zkg6.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-55q6b8nc.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts +7 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -0
- package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
- package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
- package/dist/worker-entry/extensions.d.ts +5 -0
- package/dist/worker-entry/extensions.d.ts.map +1 -0
- package/dist/worker-entry/routes.d.ts +22 -0
- package/dist/worker-entry/routes.d.ts.map +1 -0
- package/dist/worker-entry/surface-paths.d.ts +26 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/{worker-entrypoint-m9th0rg0.js → worker-entrypoint-3rmzd4c1.js} +3 -1
- 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,476 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mergeConfigForEnvironment
|
|
3
|
+
} from "./index-2sc756r1.js";
|
|
4
|
+
import {
|
|
5
|
+
createD1Database,
|
|
6
|
+
createKVNamespace,
|
|
7
|
+
createQueue,
|
|
8
|
+
createR2Bucket,
|
|
9
|
+
createVectorizeIndex,
|
|
10
|
+
deleteD1Database,
|
|
11
|
+
deleteHyperdrive,
|
|
12
|
+
deleteKVNamespace,
|
|
13
|
+
deleteQueue,
|
|
14
|
+
deleteR2Bucket,
|
|
15
|
+
deleteVectorizeIndex,
|
|
16
|
+
getEffectiveAccountId,
|
|
17
|
+
getPrimaryAccount,
|
|
18
|
+
listD1Databases,
|
|
19
|
+
listHyperdrives,
|
|
20
|
+
listKVNamespaces,
|
|
21
|
+
listQueues,
|
|
22
|
+
listR2Buckets,
|
|
23
|
+
listVectorizeIndexes
|
|
24
|
+
} from "./index-1d4jg11n.js";
|
|
25
|
+
import {
|
|
26
|
+
isPreviewScopedName,
|
|
27
|
+
materializePreviewScopedConfig,
|
|
28
|
+
materializePreviewScopedString
|
|
29
|
+
} from "./index-c8p4njqy.js";
|
|
30
|
+
|
|
31
|
+
// src/config/preview-resources.ts
|
|
32
|
+
var defaultPreviewScopedResourceLifecycleApi = {
|
|
33
|
+
getPrimaryAccount,
|
|
34
|
+
getEffectiveAccountId,
|
|
35
|
+
listKVNamespaces,
|
|
36
|
+
createKVNamespace,
|
|
37
|
+
deleteKVNamespace,
|
|
38
|
+
listD1Databases,
|
|
39
|
+
createD1Database,
|
|
40
|
+
deleteD1Database,
|
|
41
|
+
listR2Buckets,
|
|
42
|
+
createR2Bucket,
|
|
43
|
+
deleteR2Bucket,
|
|
44
|
+
listQueues,
|
|
45
|
+
createQueue,
|
|
46
|
+
deleteQueue,
|
|
47
|
+
listVectorizeIndexes,
|
|
48
|
+
createVectorizeIndex,
|
|
49
|
+
deleteVectorizeIndex,
|
|
50
|
+
listHyperdrives,
|
|
51
|
+
deleteHyperdrive
|
|
52
|
+
};
|
|
53
|
+
function resolvePreviewScopedResourceLifecycleApi(overrides) {
|
|
54
|
+
return {
|
|
55
|
+
...defaultPreviewScopedResourceLifecycleApi,
|
|
56
|
+
...overrides ?? {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function createEmptyPreviewScopedResourceNames() {
|
|
60
|
+
return {
|
|
61
|
+
kv: [],
|
|
62
|
+
d1: [],
|
|
63
|
+
r2: [],
|
|
64
|
+
queues: [],
|
|
65
|
+
vectorize: [],
|
|
66
|
+
hyperdrive: [],
|
|
67
|
+
analyticsEngine: [],
|
|
68
|
+
browser: []
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function createEmptyPreviewScopedResourcePlan() {
|
|
72
|
+
return {
|
|
73
|
+
kv: [],
|
|
74
|
+
d1: [],
|
|
75
|
+
r2: [],
|
|
76
|
+
queues: [],
|
|
77
|
+
vectorize: [],
|
|
78
|
+
hyperdrive: [],
|
|
79
|
+
analyticsEngine: [],
|
|
80
|
+
browser: []
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function createPreviewScopedResourceRef(value, bindingName, options) {
|
|
84
|
+
if (!isPreviewScopedName(value)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const baseName = materializePreviewScopedString(value, {
|
|
88
|
+
env: {}
|
|
89
|
+
});
|
|
90
|
+
const previewName = materializePreviewScopedString(value, options);
|
|
91
|
+
if (!baseName || !previewName || baseName === previewName) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
...bindingName ? { bindingName } : {},
|
|
96
|
+
baseName,
|
|
97
|
+
previewName
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function upsertPreviewScopedQueueRef(queueRefs, value, options) {
|
|
101
|
+
const ref = createPreviewScopedResourceRef(value, undefined, options);
|
|
102
|
+
if (!ref) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!queueRefs.has(ref.previewName)) {
|
|
106
|
+
queueRefs.set(ref.previewName, ref);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function applyHyperdriveBindingFallbacks(config, hyperdriveBindingFallbacks) {
|
|
110
|
+
if (!config.bindings?.hyperdrive || Object.keys(hyperdriveBindingFallbacks).length === 0) {
|
|
111
|
+
return config;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
...config,
|
|
115
|
+
bindings: {
|
|
116
|
+
...config.bindings,
|
|
117
|
+
hyperdrive: Object.fromEntries(Object.entries(config.bindings.hyperdrive).map(([bindingName, bindingConfig]) => {
|
|
118
|
+
const fallbackName = hyperdriveBindingFallbacks[bindingName];
|
|
119
|
+
if (!fallbackName) {
|
|
120
|
+
return [bindingName, bindingConfig];
|
|
121
|
+
}
|
|
122
|
+
return [bindingName, fallbackName];
|
|
123
|
+
}))
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function resolvePreviewScopedResourceLifecycleWarnings(plan) {
|
|
128
|
+
const warnings = [];
|
|
129
|
+
if (plan.analyticsEngine.length > 0) {
|
|
130
|
+
warnings.push("Workers Analytics Engine datasets are created automatically on first write, so Devflare does not provision or delete preview-scoped analytics datasets.");
|
|
131
|
+
}
|
|
132
|
+
if (plan.browser.length > 0) {
|
|
133
|
+
warnings.push("Browser Rendering bindings do not own account-scoped resources, so Devflare does not provision or delete preview-scoped browser bindings.");
|
|
134
|
+
}
|
|
135
|
+
return warnings;
|
|
136
|
+
}
|
|
137
|
+
function hasPreviewScopedLifecycleResources(plan) {
|
|
138
|
+
return plan.kv.length > 0 || plan.d1.length > 0 || plan.r2.length > 0 || plan.queues.length > 0 || plan.vectorize.length > 0 || plan.hyperdrive.length > 0;
|
|
139
|
+
}
|
|
140
|
+
async function resolveLifecycleAccountId(config, options, cloudflareApi) {
|
|
141
|
+
if (options.accountId?.trim()) {
|
|
142
|
+
return options.accountId.trim();
|
|
143
|
+
}
|
|
144
|
+
if (config.accountId?.trim()) {
|
|
145
|
+
return config.accountId.trim();
|
|
146
|
+
}
|
|
147
|
+
const primaryAccount = await cloudflareApi.getPrimaryAccount();
|
|
148
|
+
if (!primaryAccount) {
|
|
149
|
+
throw new Error("Could not resolve a Cloudflare account for preview-scoped resource lifecycle management. Set accountId in devflare.config.ts, pass --account, or authenticate with Wrangler.");
|
|
150
|
+
}
|
|
151
|
+
const effective = await cloudflareApi.getEffectiveAccountId(primaryAccount.id);
|
|
152
|
+
return effective.accountId;
|
|
153
|
+
}
|
|
154
|
+
async function loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi) {
|
|
155
|
+
const [namespaces, databases, buckets, queues, vectorizeIndexes, hyperdrives] = await Promise.all([
|
|
156
|
+
plan.kv.length > 0 ? cloudflareApi.listKVNamespaces(accountId) : Promise.resolve([]),
|
|
157
|
+
plan.d1.length > 0 ? cloudflareApi.listD1Databases(accountId) : Promise.resolve([]),
|
|
158
|
+
plan.r2.length > 0 ? cloudflareApi.listR2Buckets(accountId) : Promise.resolve([]),
|
|
159
|
+
plan.queues.length > 0 ? cloudflareApi.listQueues(accountId) : Promise.resolve([]),
|
|
160
|
+
plan.vectorize.length > 0 ? cloudflareApi.listVectorizeIndexes(accountId) : Promise.resolve([]),
|
|
161
|
+
plan.hyperdrive.length > 0 ? cloudflareApi.listHyperdrives(accountId) : Promise.resolve([])
|
|
162
|
+
]);
|
|
163
|
+
return {
|
|
164
|
+
namespaces,
|
|
165
|
+
databases,
|
|
166
|
+
buckets,
|
|
167
|
+
queues,
|
|
168
|
+
vectorizeIndexes,
|
|
169
|
+
hyperdrives
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function createPreviewScopedResourceResolutionCloudflareApi(state) {
|
|
173
|
+
return {
|
|
174
|
+
listKVNamespaces: async () => state.namespaces,
|
|
175
|
+
listD1Databases: async () => state.databases,
|
|
176
|
+
listHyperdrives: async () => state.hyperdrives
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function findVectorizeIndexByName(indexes, name) {
|
|
180
|
+
return indexes.find((index) => index.name === name);
|
|
181
|
+
}
|
|
182
|
+
function findKVNamespaceByName(namespaces, name) {
|
|
183
|
+
return namespaces.find((namespace) => namespace.name === name);
|
|
184
|
+
}
|
|
185
|
+
function findD1DatabaseByName(databases, name) {
|
|
186
|
+
return databases.find((database) => database.name === name);
|
|
187
|
+
}
|
|
188
|
+
function findR2BucketByName(buckets, name) {
|
|
189
|
+
return buckets.find((bucket) => bucket.name === name);
|
|
190
|
+
}
|
|
191
|
+
function findQueueByName(queues, name) {
|
|
192
|
+
return queues.find((queue) => queue.name === name);
|
|
193
|
+
}
|
|
194
|
+
function findHyperdriveByName(hyperdrives, name) {
|
|
195
|
+
return hyperdrives.find((hyperdrive) => hyperdrive.name === name);
|
|
196
|
+
}
|
|
197
|
+
function collectPreviewScopedResourcePlan(config, options = {}) {
|
|
198
|
+
const mergedConfig = mergeConfigForEnvironment(config, options.environment);
|
|
199
|
+
const plan = createEmptyPreviewScopedResourcePlan();
|
|
200
|
+
const bindings = mergedConfig.bindings;
|
|
201
|
+
if (!bindings) {
|
|
202
|
+
return plan;
|
|
203
|
+
}
|
|
204
|
+
if (bindings.kv) {
|
|
205
|
+
plan.kv = Object.entries(bindings.kv).map(([bindingName, bindingConfig]) => {
|
|
206
|
+
return typeof bindingConfig === "string" ? createPreviewScopedResourceRef(bindingConfig, bindingName, options) : null;
|
|
207
|
+
}).filter((ref) => ref !== null);
|
|
208
|
+
}
|
|
209
|
+
if (bindings.d1) {
|
|
210
|
+
plan.d1 = Object.entries(bindings.d1).map(([bindingName, bindingConfig]) => {
|
|
211
|
+
return typeof bindingConfig === "string" ? createPreviewScopedResourceRef(bindingConfig, bindingName, options) : null;
|
|
212
|
+
}).filter((ref) => ref !== null);
|
|
213
|
+
}
|
|
214
|
+
if (bindings.r2) {
|
|
215
|
+
plan.r2 = Object.entries(bindings.r2).map(([bindingName, bindingConfig]) => {
|
|
216
|
+
return createPreviewScopedResourceRef(bindingConfig, bindingName, options);
|
|
217
|
+
}).filter((ref) => ref !== null);
|
|
218
|
+
}
|
|
219
|
+
if (bindings.queues) {
|
|
220
|
+
const queueRefs = new Map;
|
|
221
|
+
for (const queueName of Object.values(bindings.queues.producers ?? {})) {
|
|
222
|
+
upsertPreviewScopedQueueRef(queueRefs, queueName, options);
|
|
223
|
+
}
|
|
224
|
+
for (const consumer of bindings.queues.consumers ?? []) {
|
|
225
|
+
upsertPreviewScopedQueueRef(queueRefs, consumer.queue, options);
|
|
226
|
+
if (consumer.deadLetterQueue) {
|
|
227
|
+
upsertPreviewScopedQueueRef(queueRefs, consumer.deadLetterQueue, options);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
plan.queues = Array.from(queueRefs.values());
|
|
231
|
+
}
|
|
232
|
+
if (bindings.vectorize) {
|
|
233
|
+
plan.vectorize = Object.entries(bindings.vectorize).map(([bindingName, bindingConfig]) => {
|
|
234
|
+
return createPreviewScopedResourceRef(bindingConfig.indexName, bindingName, options);
|
|
235
|
+
}).filter((ref) => ref !== null);
|
|
236
|
+
}
|
|
237
|
+
if (bindings.hyperdrive) {
|
|
238
|
+
plan.hyperdrive = Object.entries(bindings.hyperdrive).map(([bindingName, bindingConfig]) => {
|
|
239
|
+
if (typeof bindingConfig === "string") {
|
|
240
|
+
return createPreviewScopedResourceRef(bindingConfig, bindingName, options);
|
|
241
|
+
}
|
|
242
|
+
if (bindingConfig && typeof bindingConfig === "object" && "name" in bindingConfig && typeof bindingConfig.name === "string") {
|
|
243
|
+
if ("previewId" in bindingConfig && typeof bindingConfig.previewId === "string" && bindingConfig.previewId.trim()) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
const ref = createPreviewScopedResourceRef(bindingConfig.name, bindingName, options);
|
|
247
|
+
if (ref && bindingConfig.previewFallback === "base") {
|
|
248
|
+
ref.allowBaseFallback = true;
|
|
249
|
+
}
|
|
250
|
+
return ref;
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}).filter((ref) => ref !== null);
|
|
254
|
+
}
|
|
255
|
+
if (bindings.analyticsEngine) {
|
|
256
|
+
plan.analyticsEngine = Object.entries(bindings.analyticsEngine).map(([bindingName, bindingConfig]) => {
|
|
257
|
+
return createPreviewScopedResourceRef(bindingConfig.dataset, bindingName, options);
|
|
258
|
+
}).filter((ref) => ref !== null);
|
|
259
|
+
}
|
|
260
|
+
if (bindings.browser) {
|
|
261
|
+
plan.browser = Object.entries(bindings.browser).map(([bindingName, bindingConfig]) => {
|
|
262
|
+
if (typeof bindingConfig !== "string") {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
return createPreviewScopedResourceRef(bindingConfig, bindingName, options);
|
|
266
|
+
}).filter((ref) => ref !== null);
|
|
267
|
+
}
|
|
268
|
+
return plan;
|
|
269
|
+
}
|
|
270
|
+
async function preparePreviewScopedResourcesForDeploy(config, options = {}) {
|
|
271
|
+
const mergedConfig = mergeConfigForEnvironment(config, options.environment);
|
|
272
|
+
const plan = collectPreviewScopedResourcePlan(config, options);
|
|
273
|
+
const created = createEmptyPreviewScopedResourceNames();
|
|
274
|
+
const existing = createEmptyPreviewScopedResourceNames();
|
|
275
|
+
const warnings = resolvePreviewScopedResourceLifecycleWarnings(plan);
|
|
276
|
+
if (!hasPreviewScopedLifecycleResources(plan)) {
|
|
277
|
+
return {
|
|
278
|
+
config: materializePreviewScopedConfig(mergedConfig, options),
|
|
279
|
+
plan,
|
|
280
|
+
created,
|
|
281
|
+
existing,
|
|
282
|
+
warnings
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const cloudflareApi = resolvePreviewScopedResourceLifecycleApi(options.cloudflare);
|
|
286
|
+
const accountId = await resolveLifecycleAccountId(config, options, cloudflareApi);
|
|
287
|
+
const {
|
|
288
|
+
namespaces,
|
|
289
|
+
databases,
|
|
290
|
+
buckets,
|
|
291
|
+
queues,
|
|
292
|
+
vectorizeIndexes,
|
|
293
|
+
hyperdrives
|
|
294
|
+
} = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
|
|
295
|
+
for (const ref of plan.kv) {
|
|
296
|
+
if (findKVNamespaceByName(namespaces, ref.previewName)) {
|
|
297
|
+
existing.kv.push(ref.previewName);
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
const namespace = await cloudflareApi.createKVNamespace(accountId, ref.previewName);
|
|
301
|
+
created.kv.push(ref.previewName);
|
|
302
|
+
namespaces.push(namespace);
|
|
303
|
+
}
|
|
304
|
+
for (const ref of plan.d1) {
|
|
305
|
+
if (findD1DatabaseByName(databases, ref.previewName)) {
|
|
306
|
+
existing.d1.push(ref.previewName);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
const database = await cloudflareApi.createD1Database(accountId, ref.previewName);
|
|
310
|
+
created.d1.push(ref.previewName);
|
|
311
|
+
databases.push(database);
|
|
312
|
+
}
|
|
313
|
+
for (const ref of plan.r2) {
|
|
314
|
+
if (findR2BucketByName(buckets, ref.previewName)) {
|
|
315
|
+
existing.r2.push(ref.previewName);
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const bucket = await cloudflareApi.createR2Bucket(accountId, ref.previewName);
|
|
319
|
+
created.r2.push(ref.previewName);
|
|
320
|
+
buckets.push(bucket);
|
|
321
|
+
}
|
|
322
|
+
for (const ref of plan.queues) {
|
|
323
|
+
if (findQueueByName(queues, ref.previewName)) {
|
|
324
|
+
existing.queues.push(ref.previewName);
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
const queue = await cloudflareApi.createQueue(accountId, ref.previewName);
|
|
328
|
+
created.queues.push(ref.previewName);
|
|
329
|
+
queues.push(queue);
|
|
330
|
+
}
|
|
331
|
+
for (const ref of plan.vectorize) {
|
|
332
|
+
if (findVectorizeIndexByName(vectorizeIndexes, ref.previewName)) {
|
|
333
|
+
existing.vectorize.push(ref.previewName);
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
const baseIndex = findVectorizeIndexByName(vectorizeIndexes, ref.baseName);
|
|
337
|
+
if (!baseIndex) {
|
|
338
|
+
throw new Error(`Could not provision preview Vectorize index "${ref.previewName}" because the base index "${ref.baseName}" was not found.`);
|
|
339
|
+
}
|
|
340
|
+
const createdIndex = await cloudflareApi.createVectorizeIndex(accountId, {
|
|
341
|
+
name: ref.previewName,
|
|
342
|
+
dimensions: baseIndex.dimensions,
|
|
343
|
+
metric: baseIndex.metric,
|
|
344
|
+
description: baseIndex.description
|
|
345
|
+
});
|
|
346
|
+
created.vectorize.push(ref.previewName);
|
|
347
|
+
vectorizeIndexes.push(createdIndex);
|
|
348
|
+
}
|
|
349
|
+
const hyperdriveBindingFallbacks = {};
|
|
350
|
+
for (const ref of plan.hyperdrive) {
|
|
351
|
+
if (findHyperdriveByName(hyperdrives, ref.previewName)) {
|
|
352
|
+
existing.hyperdrive.push(ref.previewName);
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (!findHyperdriveByName(hyperdrives, ref.baseName)) {
|
|
356
|
+
throw new Error(`Could not resolve preview Hyperdrive "${ref.previewName}" because neither the preview config nor the base config "${ref.baseName}" exists in this account.`);
|
|
357
|
+
}
|
|
358
|
+
if (!ref.allowBaseFallback) {
|
|
359
|
+
const bindingLabel = ref.bindingName ? `"${ref.bindingName}"` : `for preview name "${ref.previewName}"`;
|
|
360
|
+
throw new Error(`Preview Hyperdrive binding ${bindingLabel} has no dedicated preview Hyperdrive configuration "${ref.previewName}" in this account. ` + "Either provision a dedicated preview Hyperdrive (or set `previewId` on the binding), " + "or opt in to reusing the base Hyperdrive by setting `previewFallback: 'base'` on the binding.");
|
|
361
|
+
}
|
|
362
|
+
if (ref.bindingName) {
|
|
363
|
+
hyperdriveBindingFallbacks[ref.bindingName] = ref.baseName;
|
|
364
|
+
}
|
|
365
|
+
warnings.push(`Preview Hyperdrive "${ref.previewName}" is not auto-provisioned because Cloudflare does not expose stored Hyperdrive credentials for cloning. Devflare will reuse the base Hyperdrive "${ref.baseName}" for binding ${ref.bindingName ?? ref.previewName}.`);
|
|
366
|
+
}
|
|
367
|
+
const preparedConfig = applyHyperdriveBindingFallbacks(mergedConfig, hyperdriveBindingFallbacks);
|
|
368
|
+
return {
|
|
369
|
+
accountId,
|
|
370
|
+
config: materializePreviewScopedConfig(preparedConfig, options),
|
|
371
|
+
resourceResolutionCloudflare: createPreviewScopedResourceResolutionCloudflareApi({
|
|
372
|
+
namespaces,
|
|
373
|
+
databases,
|
|
374
|
+
hyperdrives
|
|
375
|
+
}),
|
|
376
|
+
plan,
|
|
377
|
+
created,
|
|
378
|
+
existing,
|
|
379
|
+
warnings
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
async function cleanupPreviewScopedResources(config, options = {}) {
|
|
383
|
+
const plan = collectPreviewScopedResourcePlan(config, options);
|
|
384
|
+
const candidates = createEmptyPreviewScopedResourceNames();
|
|
385
|
+
const deleted = createEmptyPreviewScopedResourceNames();
|
|
386
|
+
const warnings = resolvePreviewScopedResourceLifecycleWarnings(plan);
|
|
387
|
+
if (!hasPreviewScopedLifecycleResources(plan)) {
|
|
388
|
+
return {
|
|
389
|
+
plan,
|
|
390
|
+
candidates,
|
|
391
|
+
deleted,
|
|
392
|
+
warnings
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
const cloudflareApi = resolvePreviewScopedResourceLifecycleApi(options.cloudflare);
|
|
396
|
+
const accountId = await resolveLifecycleAccountId(config, options, cloudflareApi);
|
|
397
|
+
const apply = options.apply === true;
|
|
398
|
+
const {
|
|
399
|
+
namespaces,
|
|
400
|
+
databases,
|
|
401
|
+
buckets,
|
|
402
|
+
queues,
|
|
403
|
+
vectorizeIndexes,
|
|
404
|
+
hyperdrives
|
|
405
|
+
} = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
|
|
406
|
+
const kvCandidates = plan.kv.map((ref) => findKVNamespaceByName(namespaces, ref.previewName)).filter((namespace) => namespace !== undefined);
|
|
407
|
+
for (const namespace of kvCandidates) {
|
|
408
|
+
candidates.kv.push(namespace.name);
|
|
409
|
+
if (!apply) {
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
await cloudflareApi.deleteKVNamespace(accountId, namespace.id);
|
|
413
|
+
deleted.kv.push(namespace.name);
|
|
414
|
+
}
|
|
415
|
+
const d1Candidates = plan.d1.map((ref) => findD1DatabaseByName(databases, ref.previewName)).filter((database) => database !== undefined);
|
|
416
|
+
for (const database of d1Candidates) {
|
|
417
|
+
candidates.d1.push(database.name);
|
|
418
|
+
if (!apply) {
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
await cloudflareApi.deleteD1Database(accountId, database.id);
|
|
422
|
+
deleted.d1.push(database.name);
|
|
423
|
+
}
|
|
424
|
+
const r2Candidates = plan.r2.map((ref) => findR2BucketByName(buckets, ref.previewName)).filter((bucket) => bucket !== undefined);
|
|
425
|
+
for (const bucket of r2Candidates) {
|
|
426
|
+
candidates.r2.push(bucket.name);
|
|
427
|
+
if (!apply) {
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
await cloudflareApi.deleteR2Bucket(accountId, bucket.name);
|
|
431
|
+
deleted.r2.push(bucket.name);
|
|
432
|
+
}
|
|
433
|
+
const queueCandidates = plan.queues.map((ref) => findQueueByName(queues, ref.previewName)).filter((queue) => queue !== undefined);
|
|
434
|
+
for (const queue of queueCandidates) {
|
|
435
|
+
candidates.queues.push(queue.name);
|
|
436
|
+
if (!apply) {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
if (!queue.id) {
|
|
440
|
+
warnings.push(`Skipping queue deletion for "${queue.name}" because Cloudflare did not return a queue id.`);
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
await cloudflareApi.deleteQueue(accountId, queue.id);
|
|
444
|
+
deleted.queues.push(queue.name);
|
|
445
|
+
}
|
|
446
|
+
const vectorizeCandidates = plan.vectorize.map((ref) => findVectorizeIndexByName(vectorizeIndexes, ref.previewName)).filter((index) => index !== undefined);
|
|
447
|
+
for (const index of vectorizeCandidates) {
|
|
448
|
+
candidates.vectorize.push(index.name);
|
|
449
|
+
if (!apply) {
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
await cloudflareApi.deleteVectorizeIndex(accountId, index.name);
|
|
453
|
+
deleted.vectorize.push(index.name);
|
|
454
|
+
}
|
|
455
|
+
const hyperdriveCandidates = plan.hyperdrive.map((ref) => findHyperdriveByName(hyperdrives, ref.previewName)).filter((hyperdrive) => hyperdrive !== undefined);
|
|
456
|
+
for (const hyperdrive of hyperdriveCandidates) {
|
|
457
|
+
candidates.hyperdrive.push(hyperdrive.name);
|
|
458
|
+
if (!apply) {
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
await cloudflareApi.deleteHyperdrive(accountId, hyperdrive.id);
|
|
462
|
+
deleted.hyperdrive.push(hyperdrive.name);
|
|
463
|
+
}
|
|
464
|
+
if (plan.hyperdrive.length > 0) {
|
|
465
|
+
warnings.push("Preview-scoped Hyperdrive cleanup only deletes preview configs that already exist. Devflare does not auto-provision preview Hyperdrives because Cloudflare does not expose stored Hyperdrive credentials for cloning.");
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
accountId,
|
|
469
|
+
plan,
|
|
470
|
+
candidates,
|
|
471
|
+
deleted,
|
|
472
|
+
warnings
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export { preparePreviewScopedResourcesForDeploy, cleanupPreviewScopedResources };
|
|
@@ -13,15 +13,44 @@ function defineConfig(config) {
|
|
|
13
13
|
// src/config/ref.ts
|
|
14
14
|
var resolvedCache = new WeakMap;
|
|
15
15
|
var pendingResolutions = new WeakMap;
|
|
16
|
+
var PENDING_REF_VALUE = "<pending>";
|
|
17
|
+
function extractConfigPathFromImportFn(fn) {
|
|
18
|
+
let source;
|
|
19
|
+
try {
|
|
20
|
+
source = Function.prototype.toString.call(fn);
|
|
21
|
+
} catch {
|
|
22
|
+
return PENDING_REF_VALUE;
|
|
23
|
+
}
|
|
24
|
+
if (!/import\s*\(/.test(source)) {
|
|
25
|
+
return PENDING_REF_VALUE;
|
|
26
|
+
}
|
|
27
|
+
const match = source.match(/import\s*\(\s*(['"`])([^'"`]+)\1\s*\)/);
|
|
28
|
+
const raw = match?.[2];
|
|
29
|
+
if (!raw || raw.length === 0) {
|
|
30
|
+
throw new Error("ref() could not extract a config path from the import function source. " + "The specifier must be a static string literal — dynamic or computed " + "specifiers (e.g. template literals with expressions) are not supported. " + "If this input has been minified, pass an unminified config source.");
|
|
31
|
+
}
|
|
32
|
+
if (match?.[1] === "`" && /\$\{/.test(raw)) {
|
|
33
|
+
throw new Error("ref() import specifier is a template literal with an embedded expression. " + "The specifier must be a static string literal so the config path can " + "be resolved ahead of time.");
|
|
34
|
+
}
|
|
35
|
+
if (raw.length < 2 && !/[./]/.test(raw)) {
|
|
36
|
+
throw new Error(`ref() extracted a suspiciously short config path (${JSON.stringify(raw)}). ` + "This usually indicates a minified bundle where the original specifier " + "was rewritten. Pass an unminified config source.");
|
|
37
|
+
}
|
|
38
|
+
return raw;
|
|
39
|
+
}
|
|
16
40
|
function ref(nameOrImport, maybeImport) {
|
|
17
41
|
const nameOverride = typeof nameOrImport === "string" ? nameOrImport : undefined;
|
|
18
|
-
|
|
42
|
+
let importFn;
|
|
43
|
+
if (typeof nameOrImport === "function") {
|
|
44
|
+
importFn = nameOrImport;
|
|
45
|
+
} else if (typeof maybeImport === "function") {
|
|
46
|
+
importFn = maybeImport;
|
|
47
|
+
}
|
|
19
48
|
if (!importFn) {
|
|
20
49
|
throw new Error("ref() requires an import function");
|
|
21
50
|
}
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
51
|
+
const resolvedImportFn = importFn;
|
|
52
|
+
const configPath = extractConfigPathFromImportFn(resolvedImportFn);
|
|
53
|
+
const doBindingCache = new Map;
|
|
25
54
|
async function doResolve() {
|
|
26
55
|
const cached = resolvedCache.get(proxy);
|
|
27
56
|
if (cached)
|
|
@@ -30,7 +59,7 @@ function ref(nameOrImport, maybeImport) {
|
|
|
30
59
|
if (pending)
|
|
31
60
|
return pending;
|
|
32
61
|
const promise = (async () => {
|
|
33
|
-
const module = await
|
|
62
|
+
const module = await resolvedImportFn();
|
|
34
63
|
const config = "default" in module ? module.default : module;
|
|
35
64
|
if (!config.name && !nameOverride) {
|
|
36
65
|
throw new Error('Referenced config must have a "name" property');
|
|
@@ -43,8 +72,11 @@ function ref(nameOrImport, maybeImport) {
|
|
|
43
72
|
resolvedCache.set(proxy, resolved);
|
|
44
73
|
return resolved;
|
|
45
74
|
})();
|
|
46
|
-
|
|
47
|
-
|
|
75
|
+
const trackedPromise = promise.finally(() => {
|
|
76
|
+
pendingResolutions.delete(proxy);
|
|
77
|
+
});
|
|
78
|
+
pendingResolutions.set(proxy, trackedPromise);
|
|
79
|
+
return trackedPromise;
|
|
48
80
|
}
|
|
49
81
|
function getResolved() {
|
|
50
82
|
const cached = resolvedCache.get(proxy);
|
|
@@ -60,7 +92,7 @@ function ref(nameOrImport, maybeImport) {
|
|
|
60
92
|
return cached.name;
|
|
61
93
|
if (nameOverride)
|
|
62
94
|
return nameOverride;
|
|
63
|
-
return
|
|
95
|
+
return PENDING_REF_VALUE;
|
|
64
96
|
},
|
|
65
97
|
entrypoint,
|
|
66
98
|
__ref: proxy
|
|
@@ -74,7 +106,7 @@ function ref(nameOrImport, maybeImport) {
|
|
|
74
106
|
return cached.name;
|
|
75
107
|
if (nameOverride)
|
|
76
108
|
return nameOverride;
|
|
77
|
-
return
|
|
109
|
+
return PENDING_REF_VALUE;
|
|
78
110
|
}
|
|
79
111
|
if (prop === "entrypoint")
|
|
80
112
|
return;
|
|
@@ -84,7 +116,11 @@ function ref(nameOrImport, maybeImport) {
|
|
|
84
116
|
}
|
|
85
117
|
});
|
|
86
118
|
function createDOBinding(bindingName) {
|
|
87
|
-
|
|
119
|
+
const cachedBinding = doBindingCache.get(bindingName);
|
|
120
|
+
if (cachedBinding) {
|
|
121
|
+
return cachedBinding;
|
|
122
|
+
}
|
|
123
|
+
const doBinding = {
|
|
88
124
|
get className() {
|
|
89
125
|
const cached = resolvedCache.get(proxy);
|
|
90
126
|
if (cached?.config.bindings?.durableObjects) {
|
|
@@ -96,7 +132,7 @@ function ref(nameOrImport, maybeImport) {
|
|
|
96
132
|
return doConfig.className;
|
|
97
133
|
}
|
|
98
134
|
}
|
|
99
|
-
return
|
|
135
|
+
return PENDING_REF_VALUE;
|
|
100
136
|
},
|
|
101
137
|
get scriptName() {
|
|
102
138
|
const cached = resolvedCache.get(proxy);
|
|
@@ -104,10 +140,13 @@ function ref(nameOrImport, maybeImport) {
|
|
|
104
140
|
return cached.name;
|
|
105
141
|
if (nameOverride)
|
|
106
142
|
return nameOverride;
|
|
107
|
-
return
|
|
143
|
+
return PENDING_REF_VALUE;
|
|
108
144
|
},
|
|
145
|
+
kind: "cross-worker",
|
|
109
146
|
__ref: proxy
|
|
110
147
|
};
|
|
148
|
+
doBindingCache.set(bindingName, doBinding);
|
|
149
|
+
return doBinding;
|
|
111
150
|
}
|
|
112
151
|
const knownProps = new Set(["name", "config", "configPath", "worker", "__import", "__nameOverride", "resolve", "then"]);
|
|
113
152
|
const proxyTarget = {
|
|
@@ -119,7 +158,7 @@ function ref(nameOrImport, maybeImport) {
|
|
|
119
158
|
},
|
|
120
159
|
configPath,
|
|
121
160
|
worker: workerAccessor,
|
|
122
|
-
__import:
|
|
161
|
+
__import: resolvedImportFn,
|
|
123
162
|
__nameOverride: nameOverride,
|
|
124
163
|
resolve: doResolve
|
|
125
164
|
};
|
|
@@ -132,6 +171,13 @@ function ref(nameOrImport, maybeImport) {
|
|
|
132
171
|
return Reflect.get(target, prop);
|
|
133
172
|
}
|
|
134
173
|
if (typeof prop === "string" && /^[A-Z][A-Z0-9_]*$/.test(prop)) {
|
|
174
|
+
const cached = resolvedCache.get(proxy);
|
|
175
|
+
if (cached) {
|
|
176
|
+
const doBindings = cached.config.bindings?.durableObjects;
|
|
177
|
+
if (!doBindings || !(prop in doBindings)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
135
181
|
return createDOBinding(prop);
|
|
136
182
|
}
|
|
137
183
|
return Reflect.get(target, prop);
|
|
@@ -140,29 +186,19 @@ function ref(nameOrImport, maybeImport) {
|
|
|
140
186
|
if (typeof prop === "string") {
|
|
141
187
|
if (knownProps.has(prop))
|
|
142
188
|
return true;
|
|
143
|
-
if (/^[A-Z][A-Z0-9_]*$/.test(prop))
|
|
189
|
+
if (/^[A-Z][A-Z0-9_]*$/.test(prop)) {
|
|
190
|
+
const cached = resolvedCache.get(proxy);
|
|
191
|
+
if (cached) {
|
|
192
|
+
const doBindings = cached.config.bindings?.durableObjects;
|
|
193
|
+
return !!doBindings && prop in doBindings;
|
|
194
|
+
}
|
|
144
195
|
return true;
|
|
196
|
+
}
|
|
145
197
|
}
|
|
146
198
|
return Reflect.has(target, prop);
|
|
147
199
|
}
|
|
148
200
|
});
|
|
149
201
|
return proxy;
|
|
150
202
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
await result.resolve();
|
|
154
|
-
return result;
|
|
155
|
-
}
|
|
156
|
-
function serviceBinding(refOrLegacy, options) {
|
|
157
|
-
if ("worker" in refOrLegacy) {
|
|
158
|
-
const entrypoint2 = options?.entrypoint;
|
|
159
|
-
return entrypoint2 ? refOrLegacy.worker(entrypoint2) : refOrLegacy.worker;
|
|
160
|
-
}
|
|
161
|
-
const entrypoint = options?.entrypoint ?? refOrLegacy.entrypoint;
|
|
162
|
-
return {
|
|
163
|
-
service: refOrLegacy.name,
|
|
164
|
-
...entrypoint && { entrypoint },
|
|
165
|
-
__ref: refOrLegacy
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
export { defineConfig, ref, resolveRef, serviceBinding };
|
|
203
|
+
|
|
204
|
+
export { defineConfig, ref };
|