devflare 1.0.0-next.5 → 1.0.0-next.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LLM.md +17312 -2139
- package/README.md +397 -605
- package/bin/devflare.js +30 -14
- package/dist/_chunks/account-Csog80ie.js +462 -0
- package/dist/_chunks/account-resources-CsmVowJp.js +159 -0
- package/dist/_chunks/ai-CBEuLdoP.js +322 -0
- package/dist/_chunks/api-TzdliH-6.js +568 -0
- package/dist/_chunks/build-Ccza8VQz.js +24 -0
- package/dist/_chunks/build-artifacts-BNssqhxE.js +483 -0
- package/dist/_chunks/cli-CU7wSG1-.js +1163 -0
- package/dist/_chunks/cloudflare-BaloqI3H.js +157 -0
- package/dist/_chunks/colors-DiK6wPJ5.js +13 -0
- package/dist/_chunks/command-utils-_bGRraDR.js +45 -0
- package/dist/_chunks/compiler-BtLp9T9N.js +500 -0
- package/dist/_chunks/config-QU8UEWmA.js +78 -0
- package/dist/_chunks/config-path-1yI7BiDU.js +42 -0
- package/dist/_chunks/context-CX50Y2Kb.js +2250 -0
- package/dist/_chunks/decorators-QmV57ixr.js +19 -0
- package/dist/_chunks/dependencies-C2oxFjU_.js +57 -0
- package/dist/_chunks/deploy-aifBaMVv.js +1032 -0
- package/dist/_chunks/dev-DF_3baGr.js +3483 -0
- package/dist/_chunks/doctor-tR9kGT_Z.js +219 -0
- package/dist/_chunks/durable-object-DMtH0XYX.js +234 -0
- package/dist/_chunks/env-S0_nMVz1.js +125 -0
- package/dist/_chunks/family-DKPp4wqj.js +143 -0
- package/dist/_chunks/generated-artifacts-dMJY4KAt.js +32 -0
- package/dist/_chunks/glob-CmQOvunB.js +56 -0
- package/dist/_chunks/init-DnkJOmpW.js +165 -0
- package/dist/_chunks/loader-OQ2AWpqm.js +1308 -0
- package/dist/_chunks/local-dev-vars-CTSa-wvF.js +81 -0
- package/dist/_chunks/local-hyperdrive-CJ90j46O.js +119 -0
- package/dist/_chunks/local-media-bindings-DsAW4AMF.js +335 -0
- package/dist/_chunks/local-secrets-CYoHfvQ1.js +123 -0
- package/dist/_chunks/local-workflow-entrypoints-8d_mXh8T.js +90 -0
- package/dist/_chunks/login-rVWUZOKC.js +51 -0
- package/dist/_chunks/package-metadata-DjHBLB-z.js +39 -0
- package/dist/_chunks/preferences-BKp_7XJx.js +241 -0
- package/dist/_chunks/preview-C3Cdr8an.js +462 -0
- package/dist/_chunks/preview-registry-ClAbLTHH.js +1186 -0
- package/dist/_chunks/preview-resources-DRWR0gaB.js +359 -0
- package/dist/_chunks/previews-BxNq8Y_J.js +1134 -0
- package/dist/_chunks/productions-DK7xwbEs.js +411 -0
- package/dist/_chunks/ref-CYJNAAe_.js +178 -0
- package/dist/_chunks/remote-CZnP-HLJ.js +79 -0
- package/dist/_chunks/remote-config-D39BY9ji.js +132 -0
- package/dist/_chunks/resolve-package-qizBfCIm.js +152 -0
- package/dist/_chunks/rolldown-runtime-CvQ6eiug.js +14 -0
- package/dist/_chunks/routes-B6XiI8Sa.js +851 -0
- package/dist/_chunks/runtime-DL-Nz3k8.js +550 -0
- package/dist/_chunks/schema-normalization-GjhTATHL.js +666 -0
- package/dist/_chunks/secrets-qT1JaBGt.js +95 -0
- package/dist/_chunks/tail-CuWI04BL.js +239 -0
- package/dist/_chunks/token-Dmi0KXyX.js +333 -0
- package/dist/_chunks/tokens-iVcgNXi-.js +221 -0
- package/dist/_chunks/types-BquPXsFg.js +484 -0
- package/dist/_chunks/ui-BUoZApvE.js +103 -0
- package/dist/_chunks/usage-BBTGzjon.js +272 -0
- package/dist/_chunks/vite-D_wLDGBs.js +1267 -0
- package/dist/_chunks/vite-utils-OVLMV605.js +183 -0
- package/dist/_chunks/worker-DEF-e8LL.js +410 -0
- package/dist/_chunks/worker-bundler-dTTnYU3n.js +458 -0
- package/dist/_chunks/worker-entrypoint-CQW77lG8.js +247 -0
- package/dist/_chunks/workerName-CFJsLZA-.js +23 -0
- package/dist/bridge/client.d.ts +49 -7
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/gateway-runtime.d.ts +8 -0
- package/dist/bridge/gateway-runtime.d.ts.map +1 -0
- package/dist/bridge/index.d.ts +6 -6
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/log.d.ts +5 -0
- package/dist/bridge/log.d.ts.map +1 -0
- package/dist/bridge/miniflare.d.ts +85 -2
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +12 -11
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/server.d.ts +2 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/bridge/v2/body-streams.d.ts +53 -0
- package/dist/bridge/v2/body-streams.d.ts.map +1 -0
- package/dist/bridge/v2/codec.d.ts +106 -0
- package/dist/bridge/v2/codec.d.ts.map +1 -0
- package/dist/bridge/v2/control-messages.d.ts +46 -0
- package/dist/bridge/v2/control-messages.d.ts.map +1 -0
- package/dist/bridge/v2/frames.d.ts +109 -0
- package/dist/bridge/v2/frames.d.ts.map +1 -0
- package/dist/bridge/v2/index.d.ts +11 -0
- package/dist/bridge/v2/index.d.ts.map +1 -0
- package/dist/bridge/v2/serialization.d.ts +48 -0
- package/dist/bridge/v2/serialization.d.ts.map +1 -0
- package/dist/bridge/v2/transport.d.ts +31 -0
- package/dist/bridge/v2/transport.d.ts.map +1 -0
- package/dist/bridge/v2/value-codec.d.ts +61 -0
- package/dist/bridge/v2/value-codec.d.ts.map +1 -0
- package/dist/bridge/{serialization.d.ts → v2/value-serialization.d.ts} +40 -18
- package/dist/bridge/v2/value-serialization.d.ts.map +1 -0
- package/dist/bridge/{protocol.d.ts → v2/wire.d.ts} +32 -8
- package/dist/bridge/v2/wire.d.ts.map +1 -0
- package/dist/bridge/v2/ws-relay.d.ts +53 -0
- package/dist/bridge/v2/ws-relay.d.ts.map +1 -0
- package/dist/browser-shim/handler.d.ts +2 -2
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser-shim/index.d.ts +2 -2
- package/dist/browser-shim/server.d.ts +63 -0
- package/dist/browser-shim/server.d.ts.map +1 -1
- package/dist/browser.d.ts +5705 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +80 -0
- package/dist/bundler/defaults.d.ts +23 -0
- package/dist/bundler/defaults.d.ts.map +1 -0
- package/dist/bundler/do-bundler.d.ts +7 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/index.d.ts +3 -1
- package/dist/bundler/index.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +53 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +13 -0
- package/dist/bundler/worker-bundler.d.ts.map +1 -0
- package/dist/bundler/worker-compat.d.ts +4 -0
- package/dist/bundler/worker-compat.d.ts.map +1 -0
- package/dist/cli/build-manifest.d.ts +66 -0
- package/dist/cli/build-manifest.d.ts.map +1 -0
- package/dist/cli/command-utils.d.ts +18 -0
- package/dist/cli/command-utils.d.ts.map +1 -0
- package/dist/cli/commands/account.d.ts +2 -2
- package/dist/cli/commands/account.d.ts.map +1 -1
- package/dist/cli/commands/ai.d.ts +1 -1
- package/dist/cli/commands/ai.d.ts.map +1 -1
- package/dist/cli/commands/build-artifacts.d.ts +40 -0
- package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts +2 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/deploy/metadata.d.ts +18 -0
- package/dist/cli/commands/deploy/metadata.d.ts.map +1 -0
- package/dist/cli/commands/deploy/prepare.d.ts +23 -0
- package/dist/cli/commands/deploy/prepare.d.ts.map +1 -0
- package/dist/cli/commands/deploy/runtime.d.ts +4 -0
- package/dist/cli/commands/deploy/runtime.d.ts.map +1 -0
- package/dist/cli/commands/deploy/verification.d.ts +36 -0
- package/dist/cli/commands/deploy/verification.d.ts.map +1 -0
- package/dist/cli/commands/deploy.d.ts +2 -2
- package/dist/cli/commands/deploy.d.ts.map +1 -1
- package/dist/cli/commands/dev.d.ts +9 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -2
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/login.d.ts +4 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
- package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/family.d.ts +10 -0
- package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/render.d.ts +8 -0
- package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/theme.d.ts +10 -0
- package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
- package/dist/cli/commands/previews-support/types.d.ts +70 -0
- package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
- package/dist/cli/commands/previews.d.ts +4 -0
- package/dist/cli/commands/previews.d.ts.map +1 -0
- package/dist/cli/commands/productions.d.ts +4 -0
- package/dist/cli/commands/productions.d.ts.map +1 -0
- package/dist/cli/commands/remote.d.ts +1 -1
- package/dist/cli/commands/remote.d.ts.map +1 -1
- package/dist/cli/commands/secrets.d.ts +4 -0
- package/dist/cli/commands/secrets.d.ts.map +1 -0
- package/dist/cli/commands/tail.d.ts +44 -0
- package/dist/cli/commands/tail.d.ts.map +1 -0
- package/dist/cli/commands/token.d.ts +4 -0
- package/dist/cli/commands/token.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
- package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/generator.d.ts +121 -0
- package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
- package/dist/cli/commands/type-generation/models.d.ts +27 -0
- package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
- package/dist/cli/commands/types.d.ts +2 -2
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/worker.d.ts +4 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/config-path.d.ts +6 -0
- package/dist/cli/config-path.d.ts.map +1 -0
- package/dist/cli/dependencies.d.ts +2 -1
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/deploy-strategy.d.ts +17 -0
- package/dist/cli/deploy-strategy.d.ts.map +1 -0
- package/dist/cli/deploy-target.d.ts +17 -0
- package/dist/cli/deploy-target.d.ts.map +1 -0
- package/dist/cli/generated-artifacts.d.ts +12 -0
- package/dist/cli/generated-artifacts.d.ts.map +1 -0
- package/dist/cli/gradual-deploy.d.ts +49 -0
- package/dist/cli/gradual-deploy.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/account.d.ts +3 -0
- package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/core.d.ts +4 -0
- package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/index.d.ts +3 -0
- package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/misc.d.ts +3 -0
- package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/previews.d.ts +3 -0
- package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
- package/dist/cli/help-pages/pages/productions.d.ts +3 -0
- package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
- package/dist/cli/help-pages/render.d.ts +12 -0
- package/dist/cli/help-pages/render.d.ts.map +1 -0
- package/dist/cli/help-pages/shared.d.ts +15 -0
- package/dist/cli/help-pages/shared.d.ts.map +1 -0
- package/dist/cli/help-pages/types.d.ts +23 -0
- package/dist/cli/help-pages/types.d.ts.map +1 -0
- package/dist/cli/help.d.ts +6 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/package-metadata.d.ts +16 -0
- package/dist/cli/package-metadata.d.ts.map +1 -0
- package/dist/cli/preview-bindings.d.ts +49 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +10 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/cli/ui.d.ts +37 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/workspace-build-guard.d.ts +14 -0
- package/dist/cli/workspace-build-guard.d.ts.map +1 -0
- package/dist/cli/wrangler-auth.d.ts +1 -1
- package/dist/cloudflare/account-core.d.ts +6 -0
- package/dist/cloudflare/account-core.d.ts.map +1 -0
- package/dist/cloudflare/account-resources.d.ts +40 -0
- package/dist/cloudflare/account-resources.d.ts.map +1 -0
- package/dist/cloudflare/account-status.d.ts +11 -0
- package/dist/cloudflare/account-status.d.ts.map +1 -0
- package/dist/cloudflare/account-workers.d.ts +14 -0
- package/dist/cloudflare/account-workers.d.ts.map +1 -0
- package/dist/cloudflare/account.d.ts +7 -64
- package/dist/cloudflare/account.d.ts.map +1 -1
- package/dist/cloudflare/api.d.ts +71 -3
- package/dist/cloudflare/api.d.ts.map +1 -1
- package/dist/cloudflare/auth.d.ts +1 -1
- package/dist/cloudflare/auth.d.ts.map +1 -1
- package/dist/cloudflare/index.d.ts +61 -6
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -13
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts +10 -0
- package/dist/cloudflare/known-permission-group-ids.generated.d.ts.map +1 -0
- package/dist/cloudflare/kv-namespace.d.ts +4 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
- package/dist/cloudflare/preferences.d.ts +7 -0
- package/dist/cloudflare/preferences.d.ts.map +1 -1
- package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
- package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-inference.d.ts +14 -0
- package/dist/cloudflare/preview-registry-inference.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-records.d.ts +4 -0
- package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-shape.d.ts +47 -0
- package/dist/cloudflare/preview-registry-shape.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-store.d.ts +14 -0
- package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-transport.d.ts +4 -0
- package/dist/cloudflare/preview-registry-transport.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry-types.d.ts +103 -0
- package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
- package/dist/cloudflare/preview-registry.d.ts +42 -0
- package/dist/cloudflare/preview-registry.d.ts.map +1 -0
- package/dist/cloudflare/preview-urls.d.ts +3 -0
- package/dist/cloudflare/preview-urls.d.ts.map +1 -0
- package/dist/cloudflare/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/remote-config.d.ts.map +1 -1
- package/dist/cloudflare/tokens.d.ts +44 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +124 -7
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts +31 -3
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/binding-resolution-helpers.d.ts +41 -0
- package/dist/config/binding-resolution-helpers.d.ts.map +1 -0
- package/dist/config/compatibility.d.ts +3 -0
- package/dist/config/compatibility.d.ts.map +1 -0
- package/dist/config/compiler/bindings.d.ts +14 -0
- package/dist/config/compiler/bindings.d.ts.map +1 -0
- package/dist/config/compiler/core-helpers.d.ts +6 -0
- package/dist/config/compiler/core-helpers.d.ts.map +1 -0
- package/dist/config/compiler/do-workers.d.ts +34 -0
- package/dist/config/compiler/do-workers.d.ts.map +1 -0
- package/dist/config/compiler/paths.d.ts +18 -0
- package/dist/config/compiler/paths.d.ts.map +1 -0
- package/dist/config/compiler/types.d.ts +309 -0
- package/dist/config/compiler/types.d.ts.map +1 -0
- package/dist/config/compiler.d.ts +22 -134
- package/dist/config/compiler.d.ts.map +1 -1
- package/dist/config/cron.d.ts +19 -0
- package/dist/config/cron.d.ts.map +1 -0
- package/dist/config/define.d.ts +8 -5
- package/dist/config/define.d.ts.map +1 -1
- package/dist/config/deploy-resources.d.ts +58 -0
- package/dist/config/deploy-resources.d.ts.map +1 -0
- package/dist/config/env-vars.d.ts +309 -0
- package/dist/config/env-vars.d.ts.map +1 -0
- package/dist/config/framework-providers.d.ts +9 -0
- package/dist/config/framework-providers.d.ts.map +1 -0
- package/dist/config/index.d.ts +12 -5
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/loader.d.ts +2 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/local-dev-vars.d.ts +15 -0
- package/dist/config/local-dev-vars.d.ts.map +1 -0
- package/dist/config/preview-resources.d.ts +83 -0
- package/dist/config/preview-resources.d.ts.map +1 -0
- package/dist/config/preview.d.ts +29 -0
- package/dist/config/preview.d.ts.map +1 -0
- package/dist/config/ref.d.ts +16 -25
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve-phased.d.ts +72 -0
- package/dist/config/resolve-phased.d.ts.map +1 -0
- package/dist/config/resolve.d.ts +11 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resource-resolution.d.ts +80 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +2087 -0
- package/dist/config/schema-bindings.d.ts.map +1 -0
- package/dist/config/schema-build.d.ts +67 -0
- package/dist/config/schema-build.d.ts.map +1 -0
- package/dist/config/schema-env.d.ts +3771 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +267 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +557 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-platform.d.ts +520 -0
- package/dist/config/schema-types-bindings-platform.d.ts.map +1 -0
- package/dist/config/schema-types-bindings-resources.d.ts +802 -0
- package/dist/config/schema-types-bindings-resources.d.ts.map +1 -0
- package/dist/config/schema-types-bindings.d.ts +293 -0
- package/dist/config/schema-types-bindings.d.ts.map +1 -0
- package/dist/config/schema-types-build.d.ts +86 -0
- package/dist/config/schema-types-build.d.ts.map +1 -0
- package/dist/config/schema-types-runtime-server.d.ts +122 -0
- package/dist/config/schema-types-runtime-server.d.ts.map +1 -0
- package/dist/config/schema-types-runtime.d.ts +913 -0
- package/dist/config/schema-types-runtime.d.ts.map +1 -0
- package/dist/config/schema-types.d.ts +458 -0
- package/dist/config/schema-types.d.ts.map +1 -0
- package/dist/config/schema.d.ts +5699 -2021
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/service-bindings-validation.d.ts +36 -0
- package/dist/config/service-bindings-validation.d.ts.map +1 -0
- package/dist/config-entry.d.ts +7 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-entry.js +3 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +2 -9
- package/dist/dev-server/d1-migrations.d.ts +36 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/dev-server-state.d.ts +59 -0
- package/dist/dev-server/dev-server-state.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +21 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/index.d.ts +1 -1
- package/dist/dev-server/miniflare-bindings.d.ts +90 -0
- package/dist/dev-server/miniflare-bindings.d.ts.map +1 -0
- package/dist/dev-server/miniflare-dev-config.d.ts +36 -0
- package/dist/dev-server/miniflare-dev-config.d.ts.map +1 -0
- package/dist/dev-server/miniflare-log.d.ts +20 -0
- package/dist/dev-server/miniflare-log.d.ts.map +1 -0
- package/dist/dev-server/miniflare-worker-config.d.ts +93 -0
- package/dist/dev-server/miniflare-worker-config.d.ts.map +1 -0
- package/dist/dev-server/reload-queue.d.ts +13 -0
- package/dist/dev-server/reload-queue.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts +8 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -0
- package/dist/dev-server/server-startup-helpers.d.ts +84 -0
- package/dist/dev-server/server-startup-helpers.d.ts.map +1 -0
- package/dist/dev-server/server.d.ts +2 -0
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +15 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +19 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +17 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/index.d.ts +8 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -298
- package/dist/runtime/context-events.d.ts +13 -0
- package/dist/runtime/context-events.d.ts.map +1 -0
- package/dist/runtime/context-types.d.ts +82 -0
- package/dist/runtime/context-types.d.ts.map +1 -0
- package/dist/runtime/context.d.ts +20 -44
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +70 -55
- package/dist/runtime/exports.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +10 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -111
- package/dist/runtime/middleware.d.ts +119 -67
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/runtime/router/index.d.ts +7 -0
- package/dist/runtime/router/index.d.ts.map +1 -0
- package/dist/runtime/router/types.d.ts +24 -0
- package/dist/runtime/router/types.d.ts.map +1 -0
- package/dist/runtime/validation.d.ts +18 -4
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/secrets/local-secrets.d.ts +46 -0
- package/dist/secrets/local-secrets.d.ts.map +1 -0
- package/dist/shims/local-hyperdrive.d.ts +12 -0
- package/dist/shims/local-hyperdrive.d.ts.map +1 -0
- package/dist/shims/local-media-bindings.d.ts +19 -0
- package/dist/shims/local-media-bindings.d.ts.map +1 -0
- package/dist/shims/local-worker-loader.d.ts +3 -0
- package/dist/shims/local-worker-loader.d.ts.map +1 -0
- package/dist/sveltekit/index.d.ts +1 -1
- package/dist/sveltekit/index.d.ts.map +1 -1
- package/dist/sveltekit/index.js +313 -167
- package/dist/sveltekit/local-bindings.d.ts +4 -0
- package/dist/sveltekit/local-bindings.d.ts.map +1 -0
- package/dist/sveltekit/platform.d.ts +20 -2
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/ai-search.d.ts +39 -0
- package/dist/test/ai-search.d.ts.map +1 -0
- package/dist/test/alarm.d.ts +55 -0
- package/dist/test/alarm.d.ts.map +1 -0
- package/dist/test/binding-hints.d.ts +10 -0
- package/dist/test/binding-hints.d.ts.map +1 -0
- package/dist/test/cf.d.ts +71 -35
- package/dist/test/cf.d.ts.map +1 -1
- package/dist/test/containers.d.ts +87 -0
- package/dist/test/containers.d.ts.map +1 -0
- package/dist/test/email.d.ts +16 -7
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +20 -21
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +4981 -70
- package/dist/test/offline-bindings.d.ts +115 -0
- package/dist/test/offline-bindings.d.ts.map +1 -0
- package/dist/test/queue.d.ts.map +1 -1
- package/dist/test/remote-ai.d.ts.map +1 -1
- package/dist/test/remote-cloudflare.d.ts +13 -0
- package/dist/test/remote-cloudflare.d.ts.map +1 -0
- package/dist/test/remote-vectorize.d.ts.map +1 -1
- package/dist/test/resolve-service-bindings.d.ts +64 -4
- package/dist/test/resolve-service-bindings.d.ts.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +14 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- package/dist/test/simple-context-bindings.d.ts +13 -0
- package/dist/test/simple-context-bindings.d.ts.map +1 -0
- package/dist/test/simple-context-durable-objects.d.ts +6 -0
- package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
- package/dist/test/simple-context-env.d.ts +35 -0
- package/dist/test/simple-context-env.d.ts.map +1 -0
- package/dist/test/simple-context-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
- package/dist/test/simple-context-handlers.d.ts +12 -0
- package/dist/test/simple-context-handlers.d.ts.map +1 -0
- package/dist/test/simple-context-lifecycle.d.ts +32 -0
- package/dist/test/simple-context-lifecycle.d.ts.map +1 -0
- package/dist/test/simple-context-mfconfig.d.ts +10 -0
- package/dist/test/simple-context-mfconfig.d.ts.map +1 -0
- package/dist/test/simple-context-multi-worker.d.ts +16 -0
- package/dist/test/simple-context-multi-worker.d.ts.map +1 -0
- package/dist/test/simple-context-paths.d.ts +40 -0
- package/dist/test/simple-context-paths.d.ts.map +1 -0
- package/dist/test/simple-context-runtime.d.ts +19 -0
- package/dist/test/simple-context-runtime.d.ts.map +1 -0
- package/dist/test/simple-context-startup.d.ts +11 -0
- package/dist/test/simple-context-startup.d.ts.map +1 -0
- package/dist/test/simple-context-transport.d.ts +14 -0
- package/dist/test/simple-context-transport.d.ts.map +1 -0
- package/dist/test/simple-context.d.ts +8 -27
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts +3 -2
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/utilities/analytics-engine.d.ts +22 -0
- package/dist/test/utilities/analytics-engine.d.ts.map +1 -0
- package/dist/test/utilities/artifacts.d.ts +11 -0
- package/dist/test/utilities/artifacts.d.ts.map +1 -0
- package/dist/test/utilities/context.d.ts +39 -0
- package/dist/test/utilities/context.d.ts.map +1 -0
- package/dist/test/utilities/d1.d.ts +21 -0
- package/dist/test/utilities/d1.d.ts.map +1 -0
- package/dist/test/utilities/env.d.ts +43 -0
- package/dist/test/utilities/env.d.ts.map +1 -0
- package/dist/test/utilities/kv.d.ts +11 -0
- package/dist/test/utilities/kv.d.ts.map +1 -0
- package/dist/test/utilities/media.d.ts +16 -0
- package/dist/test/utilities/media.d.ts.map +1 -0
- package/dist/test/utilities/platform.d.ts +41 -0
- package/dist/test/utilities/platform.d.ts.map +1 -0
- package/dist/test/utilities/queue.d.ts +5 -0
- package/dist/test/utilities/queue.d.ts.map +1 -0
- package/dist/test/utilities/r2.d.ts +2 -0
- package/dist/test/utilities/r2.d.ts.map +1 -0
- package/dist/test/utilities/stream-flagship.d.ts +27 -0
- package/dist/test/utilities/stream-flagship.d.ts.map +1 -0
- package/dist/test/utilities/vectorize.d.ts +38 -0
- package/dist/test/utilities/vectorize.d.ts.map +1 -0
- package/dist/test/utilities/workflows.d.ts +26 -0
- package/dist/test/utilities/workflows.d.ts.map +1 -0
- package/dist/test/utilities.d.ts +13 -98
- package/dist/test/utilities.d.ts.map +1 -1
- package/dist/test/worker.d.ts +6 -0
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/transform/durable-object.d.ts.map +1 -1
- package/dist/transform/index.d.ts +2 -2
- package/dist/transform/worker-entrypoint.d.ts +5 -0
- package/dist/transform/worker-entrypoint.d.ts.map +1 -1
- package/dist/utils/entrypoint-discovery.d.ts +6 -3
- package/dist/utils/entrypoint-discovery.d.ts.map +1 -1
- package/dist/utils/glob.d.ts.map +1 -1
- package/dist/utils/resolve-package.d.ts.map +1 -1
- package/dist/utils/send-email.d.ts +15 -0
- package/dist/utils/send-email.d.ts.map +1 -0
- package/dist/utils/send-email.js +163 -0
- package/dist/vite/config-file.d.ts +25 -0
- package/dist/vite/config-file.d.ts.map +1 -0
- package/dist/vite/index.d.ts +3 -2
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +2 -339
- package/dist/vite/plugin-config-hook.d.ts +28 -0
- package/dist/vite/plugin-config-hook.d.ts.map +1 -0
- package/dist/vite/plugin-context.d.ts +27 -0
- package/dist/vite/plugin-context.d.ts.map +1 -0
- package/dist/vite/plugin-durable-objects.d.ts +18 -0
- package/dist/vite/plugin-durable-objects.d.ts.map +1 -0
- package/dist/vite/plugin-programmatic.d.ts +44 -0
- package/dist/vite/plugin-programmatic.d.ts.map +1 -0
- package/dist/vite/plugin-service-bindings.d.ts +13 -0
- package/dist/vite/plugin-service-bindings.d.ts.map +1 -0
- package/dist/vite/plugin-transform.d.ts +41 -0
- package/dist/vite/plugin-transform.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +10 -41
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-entry/composed-worker.d.ts +7 -0
- package/dist/worker-entry/composed-worker.d.ts.map +1 -0
- package/dist/worker-entry/durable-object-discovery.d.ts +20 -0
- package/dist/worker-entry/durable-object-discovery.d.ts.map +1 -0
- package/dist/worker-entry/extensions.d.ts +5 -0
- package/dist/worker-entry/extensions.d.ts.map +1 -0
- package/dist/worker-entry/routes.d.ts +22 -0
- package/dist/worker-entry/routes.d.ts.map +1 -0
- package/dist/worker-entry/surface-paths.d.ts +26 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-entry/validate-fetch-style.d.ts +12 -0
- package/dist/worker-entry/validate-fetch-style.d.ts.map +1 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts +7 -0
- package/dist/workflows/local-workflow-entrypoints.d.ts.map +1 -0
- package/package.json +159 -116
- package/R2.md +0 -170
- package/dist/account-rvrj687w.js +0 -397
- package/dist/ai-dx4fr9jh.js +0 -107
- package/dist/bridge/protocol.d.ts.map +0 -1
- package/dist/bridge/serialization.d.ts.map +0 -1
- package/dist/browser-shim/worker.d.ts +0 -14
- package/dist/browser-shim/worker.d.ts.map +0 -1
- package/dist/build-mnf6v8gd.js +0 -53
- package/dist/deploy-nhceck39.js +0 -70
- package/dist/dev-b9dmrj7b.js +0 -2417
- package/dist/doctor-fmgb3d28.js +0 -190
- package/dist/durable-object-t4kbb0yt.js +0 -13
- package/dist/index-07q6yxyc.js +0 -168
- package/dist/index-18hvb6gb.js +0 -194
- package/dist/index-1xpj0m4r.js +0 -57
- package/dist/index-37x76zdn.js +0 -4
- package/dist/index-3t6rypgc.js +0 -13
- package/dist/index-67qcae0f.js +0 -183
- package/dist/index-a855bdsx.js +0 -18
- package/dist/index-d8bdkx2h.js +0 -109
- package/dist/index-ep3445yc.js +0 -2225
- package/dist/index-gz1gndna.js +0 -307
- package/dist/index-hcex3rgh.js +0 -266
- package/dist/index-m2q41jwa.js +0 -462
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-pf5s73n9.js +0 -1413
- package/dist/index-rbht7m9r.js +0 -36
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-tk6ej9dj.js +0 -94
- package/dist/index-z14anrqp.js +0 -226
- package/dist/init-f9mgmew3.js +0 -186
- package/dist/remote-q59qk463.js +0 -97
- package/dist/test/bridge-context.d.ts +0 -76
- package/dist/test/bridge-context.d.ts.map +0 -1
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
- package/dist/types-5nyrz1sz.js +0 -454
- package/dist/worker-entrypoint-m9th0rg0.js +0 -13
package/bin/devflare.js
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
3
|
+
import { dirname, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
5
|
+
|
|
6
|
+
const currentDir = dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
const sourceCliEntryPath = resolve(currentDir, '../src/cli/index.ts')
|
|
8
|
+
const distCliEntryPath = resolve(currentDir, '../dist/cli/index.js')
|
|
9
|
+
// Only the bun runtime can execute the TypeScript source directly (it tolerates
|
|
10
|
+
// `.ts` + extensionless relative imports); under node — the default shebang and
|
|
11
|
+
// what published consumers use — always run the built dist. In the monorepo
|
|
12
|
+
// this means `devflare <cmd>` under node needs a prior build, which the
|
|
13
|
+
// build/CI pipeline guarantees. A published install has no `src/`, so it falls
|
|
14
|
+
// through to dist under any runtime.
|
|
15
|
+
const runningBun = Boolean(process.versions.bun)
|
|
16
|
+
const cliEntryPath =
|
|
17
|
+
runningBun && existsSync(sourceCliEntryPath) ? sourceCliEntryPath : distCliEntryPath
|
|
18
|
+
|
|
19
|
+
const { runCli } = await import(pathToFileURL(cliEntryPath).href)
|
|
20
|
+
|
|
21
|
+
const args = process.argv.slice(2)
|
|
22
|
+
|
|
23
|
+
runCli(args)
|
|
24
|
+
.then((result) => {
|
|
25
|
+
process.exit(result.exitCode)
|
|
26
|
+
})
|
|
27
|
+
.catch((error) => {
|
|
28
|
+
console.error('CLI error:', error)
|
|
29
|
+
process.exit(1)
|
|
30
|
+
})
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { n as CloudflareAPIError, t as AuthenticationError } from "./api-TzdliH-6.js";
|
|
2
|
+
import { a as setGlobalDefaultAccountId, i as getWorkspaceAccountId, o as setWorkspaceAccountId, r as getGlobalDefaultAccountId } from "./preferences-BKp_7XJx.js";
|
|
3
|
+
import { t as account } from "./cloudflare-BaloqI3H.js";
|
|
4
|
+
import { a as DIM, c as RESET, i as CYAN_BOLD, r as CYAN } from "./colors-DiK6wPJ5.js";
|
|
5
|
+
import { c as formatCommand, d as green, f as logLine, g as yellow, h as whiteDim, l as formatLabelValue, n as bold, o as dim, p as logTable, r as createCliTheme } from "./ui-BUoZApvE.js";
|
|
6
|
+
import { n as getConfiguredAccountId } from "./command-utils-_bGRraDR.js";
|
|
7
|
+
//#region src/cli/commands/account.ts
|
|
8
|
+
const ACCOUNT_SUBCOMMANDS = [
|
|
9
|
+
"info",
|
|
10
|
+
"workers",
|
|
11
|
+
"kv",
|
|
12
|
+
"d1",
|
|
13
|
+
"r2",
|
|
14
|
+
"vectorize",
|
|
15
|
+
"limits",
|
|
16
|
+
"usage",
|
|
17
|
+
"global",
|
|
18
|
+
"workspace"
|
|
19
|
+
];
|
|
20
|
+
function isAccountSubcommand(value) {
|
|
21
|
+
return ACCOUNT_SUBCOMMANDS.includes(value);
|
|
22
|
+
}
|
|
23
|
+
const CLI_API_OPTIONS = { timeout: 1e4 };
|
|
24
|
+
function formatDate(date) {
|
|
25
|
+
if (!date) return "N/A";
|
|
26
|
+
return date.toLocaleDateString("en-US", {
|
|
27
|
+
year: "numeric",
|
|
28
|
+
month: "short",
|
|
29
|
+
day: "numeric"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function formatPercent(value) {
|
|
33
|
+
if (value === void 0) return "N/A";
|
|
34
|
+
return `${value.toFixed(1)}%`;
|
|
35
|
+
}
|
|
36
|
+
function logSection(logger, title, theme, count, accent = "cyan") {
|
|
37
|
+
logLine(logger);
|
|
38
|
+
logLine(logger, `${accent === "yellow" ? yellow(title, theme) : accent === "green" ? green(title, theme) : bold(title, theme)}${count === void 0 ? "" : ` ${dim(`(${count})`, theme)}`}`);
|
|
39
|
+
}
|
|
40
|
+
function logEmptyState(logger, message, theme) {
|
|
41
|
+
logLine(logger);
|
|
42
|
+
logLine(logger, dim(message, theme));
|
|
43
|
+
logLine(logger);
|
|
44
|
+
return { exitCode: 0 };
|
|
45
|
+
}
|
|
46
|
+
async function runAccountCommand(parsed, logger, options) {
|
|
47
|
+
const theme = createCliTheme(parsed.options);
|
|
48
|
+
if (!await account.isAuthenticated()) {
|
|
49
|
+
logger.error("Not authenticated with Cloudflare");
|
|
50
|
+
logLine(logger, dim("Run: devflare login", theme));
|
|
51
|
+
return { exitCode: 1 };
|
|
52
|
+
}
|
|
53
|
+
const subcommand = parsed.args[0];
|
|
54
|
+
const rawSubcommand = parsed.args[0];
|
|
55
|
+
if (rawSubcommand && !isAccountSubcommand(rawSubcommand)) {
|
|
56
|
+
logger.error(`Unknown account subcommand: ${rawSubcommand}`);
|
|
57
|
+
logLine(logger, dim(`Available account subcommands: ${ACCOUNT_SUBCOMMANDS.join(", ")}`, theme));
|
|
58
|
+
return { exitCode: 1 };
|
|
59
|
+
}
|
|
60
|
+
if (subcommand === "global") return await selectGlobalAccount(logger, theme);
|
|
61
|
+
if (subcommand === "workspace") return await selectWorkspaceAccount(logger, theme);
|
|
62
|
+
try {
|
|
63
|
+
let accountId = parsed.options.account;
|
|
64
|
+
if (!accountId) accountId = await getConfiguredAccountId(options.cwd ?? process.cwd());
|
|
65
|
+
if (!accountId) {
|
|
66
|
+
const primary = await account.getPrimaryAccount();
|
|
67
|
+
if (!primary) {
|
|
68
|
+
logger.error("No Cloudflare accounts found");
|
|
69
|
+
return { exitCode: 1 };
|
|
70
|
+
}
|
|
71
|
+
accountId = primary.id;
|
|
72
|
+
}
|
|
73
|
+
switch (subcommand) {
|
|
74
|
+
case "workers": return await showWorkers(accountId, logger, theme);
|
|
75
|
+
case "kv": return await showKV(accountId, logger, theme);
|
|
76
|
+
case "d1": return await showD1(accountId, logger, theme);
|
|
77
|
+
case "r2": return await showR2(accountId, logger, theme);
|
|
78
|
+
case "vectorize": return await showVectorize(accountId, logger, theme);
|
|
79
|
+
case "limits": return await handleLimits(accountId, parsed, logger, theme);
|
|
80
|
+
case "usage": return await showUsage(accountId, logger, theme);
|
|
81
|
+
default: return await showAccountOverview(accountId, logger, theme);
|
|
82
|
+
}
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (error instanceof AuthenticationError) {
|
|
85
|
+
logger.error(error.message);
|
|
86
|
+
return { exitCode: 1 };
|
|
87
|
+
}
|
|
88
|
+
if (error instanceof CloudflareAPIError) {
|
|
89
|
+
logger.error(`API Error: ${error.message}`);
|
|
90
|
+
return { exitCode: 1 };
|
|
91
|
+
}
|
|
92
|
+
if (error instanceof Error) {
|
|
93
|
+
if (error.name === "AbortError" || error.message.includes("timed out")) {
|
|
94
|
+
logger.error("Request timed out. The Cloudflare API is slow or unavailable.");
|
|
95
|
+
return { exitCode: 1 };
|
|
96
|
+
}
|
|
97
|
+
logger.error(`Error: ${error.message}`);
|
|
98
|
+
return { exitCode: 1 };
|
|
99
|
+
}
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function showAccountOverview(accountId, logger, theme) {
|
|
104
|
+
logSection(logger, "Accounts", theme);
|
|
105
|
+
let accounts = [];
|
|
106
|
+
let limitedAccountView = false;
|
|
107
|
+
try {
|
|
108
|
+
accounts = await account.getAccounts();
|
|
109
|
+
} catch {
|
|
110
|
+
const fallbackAccount = await account.getAccountById(accountId);
|
|
111
|
+
if (!fallbackAccount) {
|
|
112
|
+
logger.error("Could not inspect Cloudflare accounts with the current credentials");
|
|
113
|
+
return { exitCode: 1 };
|
|
114
|
+
}
|
|
115
|
+
accounts = [fallbackAccount];
|
|
116
|
+
limitedAccountView = true;
|
|
117
|
+
}
|
|
118
|
+
if (accounts.length === 0) {
|
|
119
|
+
logger.error("No Cloudflare accounts found");
|
|
120
|
+
return { exitCode: 1 };
|
|
121
|
+
}
|
|
122
|
+
const workspaceId = getWorkspaceAccountId();
|
|
123
|
+
const globalId = await getGlobalDefaultAccountId(accountId);
|
|
124
|
+
if (limitedAccountView) logLine(logger, dim("Using the configured account directly because the current credentials cannot enumerate all Cloudflare accounts.", theme));
|
|
125
|
+
for (let i = 0; i < accounts.length; i++) {
|
|
126
|
+
const acc = accounts[i];
|
|
127
|
+
const isWorkspace = acc.id === workspaceId;
|
|
128
|
+
const isGlobal = acc.id === globalId;
|
|
129
|
+
let badge = "";
|
|
130
|
+
if (isWorkspace) badge = ` ${CYAN_BOLD}(workspace)${RESET}`;
|
|
131
|
+
else if (isGlobal) badge = workspaceId ? ` ${DIM}(global)${RESET}` : ` ${CYAN}(global)${RESET}`;
|
|
132
|
+
if (i > 0) logLine(logger);
|
|
133
|
+
logLine(logger, `${dim("account", theme)} ${green(acc.name, theme)}${badge}`);
|
|
134
|
+
logLine(logger, formatLabelValue("id", whiteDim(acc.id, theme), theme, 10));
|
|
135
|
+
logLine(logger, formatLabelValue("type", acc.type, theme, 10));
|
|
136
|
+
}
|
|
137
|
+
logSection(logger, "Commands", theme);
|
|
138
|
+
logLine(logger, formatCommand("devflare account global", "Set global default account", theme));
|
|
139
|
+
logLine(logger, formatCommand("devflare account workspace", "Set workspace account", theme));
|
|
140
|
+
logLine(logger, formatCommand("devflare account workers", "List Workers", theme));
|
|
141
|
+
logLine(logger, formatCommand("devflare account kv", "List KV namespaces", theme));
|
|
142
|
+
logLine(logger, formatCommand("devflare account d1", "List D1 databases", theme));
|
|
143
|
+
logLine(logger, formatCommand("devflare account r2", "List R2 buckets", theme));
|
|
144
|
+
logLine(logger, formatCommand("devflare account vectorize", "List Vectorize indexes", theme));
|
|
145
|
+
logLine(logger, formatCommand("devflare account limits", "View or set usage limits", theme));
|
|
146
|
+
logLine(logger, formatCommand("devflare account usage", "View detailed usage", theme));
|
|
147
|
+
logLine(logger, formatCommand("devflare ai", "View AI models and pricing", theme));
|
|
148
|
+
logLine(logger);
|
|
149
|
+
return { exitCode: 0 };
|
|
150
|
+
}
|
|
151
|
+
async function selectGlobalAccount(logger, theme) {
|
|
152
|
+
const accounts = await account.getAccounts();
|
|
153
|
+
if (accounts.length === 0) {
|
|
154
|
+
logger.error("No Cloudflare accounts found");
|
|
155
|
+
return { exitCode: 1 };
|
|
156
|
+
}
|
|
157
|
+
if (accounts.length === 1) {
|
|
158
|
+
await setGlobalDefaultAccountId(accounts[0].id);
|
|
159
|
+
logger.success(`Global default set to: ${accounts[0].name}`);
|
|
160
|
+
return { exitCode: 0 };
|
|
161
|
+
}
|
|
162
|
+
const currentGlobal = await getGlobalDefaultAccountId(accounts[0].id);
|
|
163
|
+
const options = accounts.map((acc) => {
|
|
164
|
+
return {
|
|
165
|
+
label: acc.id === currentGlobal ? `${acc.name} ${CYAN}(default)${RESET}` : acc.name,
|
|
166
|
+
value: acc.id,
|
|
167
|
+
hint: acc.id.substring(0, 8) + "..."
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
const selected = await logger.prompt("Select global default account:", {
|
|
171
|
+
type: "select",
|
|
172
|
+
options,
|
|
173
|
+
initial: currentGlobal ?? accounts[0].id
|
|
174
|
+
});
|
|
175
|
+
if (!selected || typeof selected === "symbol") {
|
|
176
|
+
logLine(logger, dim("Cancelled", theme));
|
|
177
|
+
return { exitCode: 0 };
|
|
178
|
+
}
|
|
179
|
+
await setGlobalDefaultAccountId(selected, accounts[0].id);
|
|
180
|
+
const selectedAccount = accounts.find((a) => a.id === selected);
|
|
181
|
+
logger.success(`Global default set to: ${selectedAccount?.name}`);
|
|
182
|
+
logLine(logger, `${dim("saved to", theme)} ~/.devflare/preferences.json + cloud KV`);
|
|
183
|
+
return { exitCode: 0 };
|
|
184
|
+
}
|
|
185
|
+
async function selectWorkspaceAccount(logger, theme) {
|
|
186
|
+
const accounts = await account.getAccounts();
|
|
187
|
+
if (accounts.length === 0) {
|
|
188
|
+
logger.error("No Cloudflare accounts found");
|
|
189
|
+
return { exitCode: 1 };
|
|
190
|
+
}
|
|
191
|
+
if (accounts.length === 1) {
|
|
192
|
+
const pkgPath = setWorkspaceAccountId(accounts[0].id);
|
|
193
|
+
logger.success(`Workspace account set to: ${accounts[0].name}`);
|
|
194
|
+
logLine(logger, `${dim("saved to", theme)} ${pkgPath}`);
|
|
195
|
+
return { exitCode: 0 };
|
|
196
|
+
}
|
|
197
|
+
const currentWorkspace = getWorkspaceAccountId();
|
|
198
|
+
const options = accounts.map((acc) => {
|
|
199
|
+
return {
|
|
200
|
+
label: acc.id === currentWorkspace ? `${acc.name} ${CYAN}(workspace)${RESET}` : acc.name,
|
|
201
|
+
value: acc.id,
|
|
202
|
+
hint: acc.id.substring(0, 8) + "..."
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
const selected = await logger.prompt("Select workspace account:", {
|
|
206
|
+
type: "select",
|
|
207
|
+
options,
|
|
208
|
+
initial: currentWorkspace ?? accounts[0].id
|
|
209
|
+
});
|
|
210
|
+
if (!selected || typeof selected === "symbol") {
|
|
211
|
+
logLine(logger, dim("Cancelled", theme));
|
|
212
|
+
return { exitCode: 0 };
|
|
213
|
+
}
|
|
214
|
+
const pkgPath = setWorkspaceAccountId(selected);
|
|
215
|
+
const selectedAccount = accounts.find((a) => a.id === selected);
|
|
216
|
+
logger.success(`Workspace account set to: ${selectedAccount?.name}`);
|
|
217
|
+
logLine(logger, `${dim("saved to", theme)} ${pkgPath}`);
|
|
218
|
+
return { exitCode: 0 };
|
|
219
|
+
}
|
|
220
|
+
async function showWorkers(accountId, logger, theme) {
|
|
221
|
+
const workers = await account.workers(accountId, CLI_API_OPTIONS);
|
|
222
|
+
if (workers.length === 0) return logEmptyState(logger, "No Workers found", theme);
|
|
223
|
+
logSection(logger, "Workers", theme, workers.length, "green");
|
|
224
|
+
logTable(logger, {
|
|
225
|
+
title: "Worker list",
|
|
226
|
+
rows: workers,
|
|
227
|
+
columns: [{
|
|
228
|
+
label: "Name",
|
|
229
|
+
width: 30,
|
|
230
|
+
value: (worker) => worker.name
|
|
231
|
+
}, {
|
|
232
|
+
label: "Modified",
|
|
233
|
+
width: 20,
|
|
234
|
+
value: (worker) => whiteDim(formatDate(worker.modifiedOn), theme)
|
|
235
|
+
}],
|
|
236
|
+
theme,
|
|
237
|
+
titleAccent: "green"
|
|
238
|
+
});
|
|
239
|
+
logLine(logger);
|
|
240
|
+
return { exitCode: 0 };
|
|
241
|
+
}
|
|
242
|
+
async function showKV(accountId, logger, theme) {
|
|
243
|
+
const namespaces = await account.kv(accountId, CLI_API_OPTIONS);
|
|
244
|
+
if (namespaces.length === 0) return logEmptyState(logger, "No KV namespaces found", theme);
|
|
245
|
+
logSection(logger, "KV namespaces", theme, namespaces.length);
|
|
246
|
+
logTable(logger, {
|
|
247
|
+
title: "Namespace list",
|
|
248
|
+
rows: namespaces,
|
|
249
|
+
columns: [{
|
|
250
|
+
label: "Name",
|
|
251
|
+
width: 35,
|
|
252
|
+
value: (ns) => ns.name
|
|
253
|
+
}, {
|
|
254
|
+
label: "ID",
|
|
255
|
+
width: 35,
|
|
256
|
+
value: (ns) => whiteDim(ns.id, theme)
|
|
257
|
+
}],
|
|
258
|
+
theme,
|
|
259
|
+
titleAccent: "cyan"
|
|
260
|
+
});
|
|
261
|
+
logLine(logger);
|
|
262
|
+
return { exitCode: 0 };
|
|
263
|
+
}
|
|
264
|
+
async function showD1(accountId, logger, theme) {
|
|
265
|
+
const databases = await account.d1(accountId, CLI_API_OPTIONS);
|
|
266
|
+
if (databases.length === 0) return logEmptyState(logger, "No D1 databases found", theme);
|
|
267
|
+
logSection(logger, "D1 databases", theme, databases.length, "yellow");
|
|
268
|
+
logTable(logger, {
|
|
269
|
+
title: "Database list",
|
|
270
|
+
rows: databases,
|
|
271
|
+
columns: [
|
|
272
|
+
{
|
|
273
|
+
label: "Name",
|
|
274
|
+
width: 25,
|
|
275
|
+
value: (db) => db.name
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
label: "ID",
|
|
279
|
+
width: 40,
|
|
280
|
+
value: (db) => whiteDim(db.id, theme)
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
label: "Tables",
|
|
284
|
+
width: 8,
|
|
285
|
+
value: (db) => String(db.tableCount ?? "N/A")
|
|
286
|
+
}
|
|
287
|
+
],
|
|
288
|
+
theme,
|
|
289
|
+
titleAccent: "yellow"
|
|
290
|
+
});
|
|
291
|
+
logLine(logger);
|
|
292
|
+
return { exitCode: 0 };
|
|
293
|
+
}
|
|
294
|
+
async function showR2(accountId, logger, theme) {
|
|
295
|
+
const buckets = await account.r2(accountId, CLI_API_OPTIONS);
|
|
296
|
+
if (buckets.length === 0) return logEmptyState(logger, "No R2 buckets found", theme);
|
|
297
|
+
logSection(logger, "R2 buckets", theme, buckets.length, "green");
|
|
298
|
+
logTable(logger, {
|
|
299
|
+
title: "Bucket list",
|
|
300
|
+
rows: buckets,
|
|
301
|
+
columns: [
|
|
302
|
+
{
|
|
303
|
+
label: "Name",
|
|
304
|
+
width: 30,
|
|
305
|
+
value: (bucket) => bucket.name
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
label: "Created",
|
|
309
|
+
width: 20,
|
|
310
|
+
value: (bucket) => whiteDim(formatDate(bucket.createdOn), theme)
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
label: "Location",
|
|
314
|
+
width: 10,
|
|
315
|
+
value: (bucket) => bucket.location ?? "auto"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
theme,
|
|
319
|
+
titleAccent: "green"
|
|
320
|
+
});
|
|
321
|
+
logLine(logger);
|
|
322
|
+
return { exitCode: 0 };
|
|
323
|
+
}
|
|
324
|
+
async function showVectorize(accountId, logger, theme) {
|
|
325
|
+
const indexes = await account.vectorize(accountId, CLI_API_OPTIONS);
|
|
326
|
+
if (indexes.length === 0) return logEmptyState(logger, "No Vectorize indexes found", theme);
|
|
327
|
+
logSection(logger, "Vectorize indexes", theme, indexes.length, "yellow");
|
|
328
|
+
logTable(logger, {
|
|
329
|
+
title: "Index list",
|
|
330
|
+
rows: indexes,
|
|
331
|
+
columns: [
|
|
332
|
+
{
|
|
333
|
+
label: "Name",
|
|
334
|
+
width: 25,
|
|
335
|
+
value: (idx) => idx.name
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
label: "Dimensions",
|
|
339
|
+
width: 12,
|
|
340
|
+
value: (idx) => String(idx.dimensions)
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
label: "Metric",
|
|
344
|
+
width: 15,
|
|
345
|
+
value: (idx) => idx.metric
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
theme,
|
|
349
|
+
titleAccent: "yellow"
|
|
350
|
+
});
|
|
351
|
+
logLine(logger);
|
|
352
|
+
return { exitCode: 0 };
|
|
353
|
+
}
|
|
354
|
+
async function showUsage(accountId, logger, theme) {
|
|
355
|
+
const usages = await account.getAllUsageSummaries(accountId);
|
|
356
|
+
const limits = await account.getLimits(accountId);
|
|
357
|
+
logSection(logger, "Usage", theme, void 0, "yellow");
|
|
358
|
+
logLine(logger, formatLabelValue("limits", limits.enabled ? green("enabled", theme) : dim("disabled", theme), theme, 12));
|
|
359
|
+
if (usages.length === 0) return logEmptyState(logger, "No usage tracked yet", theme);
|
|
360
|
+
logTable(logger, {
|
|
361
|
+
title: "Usage by service",
|
|
362
|
+
rows: usages,
|
|
363
|
+
columns: [
|
|
364
|
+
{
|
|
365
|
+
label: "Service",
|
|
366
|
+
width: 15,
|
|
367
|
+
value: (usage) => usage.service
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
label: "Today",
|
|
371
|
+
width: 10,
|
|
372
|
+
value: (usage) => String(usage.today)
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
label: "Limit",
|
|
376
|
+
width: 10,
|
|
377
|
+
value: (usage) => usage.limit?.toString() ?? "∞"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
label: "%",
|
|
381
|
+
width: 10,
|
|
382
|
+
value: (usage) => formatPercent(usage.percentUsed)
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
label: "Status",
|
|
386
|
+
width: 10,
|
|
387
|
+
value: (usage) => usage.withinLimit ? green("ok", theme) : yellow("limit", theme)
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
theme,
|
|
391
|
+
titleAccent: "yellow"
|
|
392
|
+
});
|
|
393
|
+
logLine(logger);
|
|
394
|
+
return { exitCode: 0 };
|
|
395
|
+
}
|
|
396
|
+
async function handleLimits(accountId, parsed, logger, theme) {
|
|
397
|
+
switch (parsed.args[1]) {
|
|
398
|
+
case "set": return await setLimit(accountId, parsed, logger, theme);
|
|
399
|
+
case "enable":
|
|
400
|
+
await account.setLimitsEnabled(accountId, true);
|
|
401
|
+
logger.success("Usage limits enabled");
|
|
402
|
+
return { exitCode: 0 };
|
|
403
|
+
case "disable":
|
|
404
|
+
await account.setLimitsEnabled(accountId, false);
|
|
405
|
+
logger.success("Usage limits disabled");
|
|
406
|
+
return { exitCode: 0 };
|
|
407
|
+
default: return await showLimits(accountId, logger, theme);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async function showLimits(accountId, logger, theme) {
|
|
411
|
+
const limits = await account.getLimits(accountId);
|
|
412
|
+
logSection(logger, "Usage limits", theme, void 0, "yellow");
|
|
413
|
+
logLine(logger, formatLabelValue("status", limits.enabled ? green("enabled", theme) : dim("disabled", theme), theme, 16));
|
|
414
|
+
logLine(logger);
|
|
415
|
+
logLine(logger, dim("current limits", theme));
|
|
416
|
+
logLine(logger, formatLabelValue("AI Requests/Day", String(limits.aiRequestsPerDay ?? "Unlimited"), theme, 18));
|
|
417
|
+
logLine(logger, formatLabelValue("AI Tokens/Day", String(limits.aiTokensPerDay ?? "Unlimited"), theme, 18));
|
|
418
|
+
logLine(logger, formatLabelValue("Vectorize Ops/Day", String(limits.vectorizeOpsPerDay ?? "Unlimited"), theme, 18));
|
|
419
|
+
logSection(logger, "Commands", theme);
|
|
420
|
+
logLine(logger, formatCommand("devflare account limits set ai-requests 50", "Set the AI request daily limit", theme));
|
|
421
|
+
logLine(logger, formatCommand("devflare account limits set ai-tokens 5000", "Set the AI token daily limit", theme));
|
|
422
|
+
logLine(logger, formatCommand("devflare account limits set vectorize-ops 500", "Set the Vectorize daily limit", theme));
|
|
423
|
+
logLine(logger, formatCommand("devflare account limits enable", "Enable usage limits", theme));
|
|
424
|
+
logLine(logger, formatCommand("devflare account limits disable", "Disable usage limits", theme));
|
|
425
|
+
logLine(logger);
|
|
426
|
+
return { exitCode: 0 };
|
|
427
|
+
}
|
|
428
|
+
async function setLimit(accountId, parsed, logger, theme) {
|
|
429
|
+
const limitName = parsed.args[2];
|
|
430
|
+
const limitValue = parsed.args[3];
|
|
431
|
+
if (!limitName || !limitValue) {
|
|
432
|
+
logger.error("Usage: devflare account limits set <limit-name> <value>");
|
|
433
|
+
logLine(logger, dim("Limit names: ai-requests, ai-tokens, vectorize-ops", theme));
|
|
434
|
+
return { exitCode: 1 };
|
|
435
|
+
}
|
|
436
|
+
const value = Number.parseInt(limitValue, 10);
|
|
437
|
+
if (Number.isNaN(value) || value < 0) {
|
|
438
|
+
logger.error("Limit value must be a positive number");
|
|
439
|
+
return { exitCode: 1 };
|
|
440
|
+
}
|
|
441
|
+
switch (limitName) {
|
|
442
|
+
case "ai-requests":
|
|
443
|
+
await account.setLimits(accountId, { aiRequestsPerDay: value });
|
|
444
|
+
logger.success(`AI requests limit set to ${value}/day`);
|
|
445
|
+
break;
|
|
446
|
+
case "ai-tokens":
|
|
447
|
+
await account.setLimits(accountId, { aiTokensPerDay: value });
|
|
448
|
+
logger.success(`AI tokens limit set to ${value}/day`);
|
|
449
|
+
break;
|
|
450
|
+
case "vectorize-ops":
|
|
451
|
+
await account.setLimits(accountId, { vectorizeOpsPerDay: value });
|
|
452
|
+
logger.success(`Vectorize ops limit set to ${value}/day`);
|
|
453
|
+
break;
|
|
454
|
+
default:
|
|
455
|
+
logger.error(`Unknown limit: ${limitName}`);
|
|
456
|
+
logLine(logger, dim("Valid limits: ai-requests, ai-tokens, vectorize-ops", theme));
|
|
457
|
+
return { exitCode: 1 };
|
|
458
|
+
}
|
|
459
|
+
return { exitCode: 0 };
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
export { runAccountCommand };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { a as apiGetAll, n as CloudflareAPIError, r as apiDelete, s as apiPost } from "./api-TzdliH-6.js";
|
|
2
|
+
//#region src/cloudflare/account-resources.ts
|
|
3
|
+
async function listKVNamespaces(accountId, options) {
|
|
4
|
+
return (await apiGetAll(`/accounts/${accountId}/storage/kv/namespaces`, options)).map((namespace) => ({
|
|
5
|
+
id: namespace.id,
|
|
6
|
+
name: namespace.title
|
|
7
|
+
}));
|
|
8
|
+
}
|
|
9
|
+
async function createKVNamespace(accountId, title, options) {
|
|
10
|
+
const namespace = await apiPost(`/accounts/${accountId}/storage/kv/namespaces`, { title }, options);
|
|
11
|
+
return {
|
|
12
|
+
id: namespace.id,
|
|
13
|
+
name: namespace.title
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async function deleteKVNamespace(accountId, namespaceId, options) {
|
|
17
|
+
await apiDelete(`/accounts/${accountId}/storage/kv/namespaces/${encodeURIComponent(namespaceId)}`, options);
|
|
18
|
+
}
|
|
19
|
+
async function listD1Databases(accountId, options) {
|
|
20
|
+
return (await apiGetAll(`/accounts/${accountId}/d1/database`, options)).map((database) => ({
|
|
21
|
+
id: database.uuid,
|
|
22
|
+
name: database.name,
|
|
23
|
+
version: database.version,
|
|
24
|
+
tableCount: database.num_tables,
|
|
25
|
+
sizeBytes: database.file_size
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
async function createD1Database(accountId, name, options) {
|
|
29
|
+
const created = await apiPost(`/accounts/${accountId}/d1/database`, {
|
|
30
|
+
name,
|
|
31
|
+
...options?.jurisdiction ? { jurisdiction: options.jurisdiction } : {},
|
|
32
|
+
...options?.primaryLocationHint ? { primary_location_hint: options.primaryLocationHint } : {}
|
|
33
|
+
}, options);
|
|
34
|
+
return {
|
|
35
|
+
id: created.uuid,
|
|
36
|
+
name: created.name,
|
|
37
|
+
version: created.version,
|
|
38
|
+
tableCount: created.num_tables,
|
|
39
|
+
sizeBytes: created.file_size
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async function deleteD1Database(accountId, databaseId, options) {
|
|
43
|
+
await apiDelete(`/accounts/${accountId}/d1/database/${encodeURIComponent(databaseId)}`, options);
|
|
44
|
+
}
|
|
45
|
+
async function queryD1Database(accountId, databaseId, query, options) {
|
|
46
|
+
const { apiPost } = await import("./api-TzdliH-6.js").then((n) => n.l);
|
|
47
|
+
return apiPost(`/accounts/${accountId}/d1/database/${databaseId}/query`, query, options);
|
|
48
|
+
}
|
|
49
|
+
async function rawD1DatabaseQuery(accountId, databaseId, query, options) {
|
|
50
|
+
const { apiPost } = await import("./api-TzdliH-6.js").then((n) => n.l);
|
|
51
|
+
return apiPost(`/accounts/${accountId}/d1/database/${databaseId}/raw`, query, options);
|
|
52
|
+
}
|
|
53
|
+
async function listQueues(accountId, options) {
|
|
54
|
+
return (await apiGetAll(`/accounts/${accountId}/queues`, options)).filter((queue) => {
|
|
55
|
+
return typeof queue.queue_id === "string" && queue.queue_id.length > 0 && typeof queue.queue_name === "string" && queue.queue_name.length > 0;
|
|
56
|
+
}).map((queue) => ({
|
|
57
|
+
id: queue.queue_id,
|
|
58
|
+
name: queue.queue_name,
|
|
59
|
+
createdOn: queue.created_on ? new Date(queue.created_on) : void 0,
|
|
60
|
+
modifiedOn: queue.modified_on ? new Date(queue.modified_on) : void 0,
|
|
61
|
+
deliveryDelay: queue.settings?.delivery_delay,
|
|
62
|
+
deliveryPaused: queue.settings?.delivery_paused,
|
|
63
|
+
messageRetentionPeriod: queue.settings?.message_retention_period
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
async function createQueue(accountId, queueName, options) {
|
|
67
|
+
const queue = await apiPost(`/accounts/${accountId}/queues`, { queue_name: queueName }, options);
|
|
68
|
+
return {
|
|
69
|
+
id: queue.queue_id ?? "",
|
|
70
|
+
name: queue.queue_name ?? queueName,
|
|
71
|
+
createdOn: queue.created_on ? new Date(queue.created_on) : void 0,
|
|
72
|
+
modifiedOn: queue.modified_on ? new Date(queue.modified_on) : void 0,
|
|
73
|
+
deliveryDelay: queue.settings?.delivery_delay,
|
|
74
|
+
deliveryPaused: queue.settings?.delivery_paused,
|
|
75
|
+
messageRetentionPeriod: queue.settings?.message_retention_period
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async function deleteQueue(accountId, queueId, options) {
|
|
79
|
+
await apiDelete(`/accounts/${accountId}/queues/${encodeURIComponent(queueId)}`, options);
|
|
80
|
+
}
|
|
81
|
+
async function listR2Buckets(accountId, options) {
|
|
82
|
+
return (await apiGetAll(`/accounts/${accountId}/r2/buckets`, options)).map((bucket) => ({
|
|
83
|
+
name: bucket.name,
|
|
84
|
+
createdOn: new Date(bucket.creation_date),
|
|
85
|
+
location: bucket.location
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
async function createR2Bucket(accountId, name, options) {
|
|
89
|
+
const bucket = await apiPost(`/accounts/${accountId}/r2/buckets`, {
|
|
90
|
+
name,
|
|
91
|
+
...options?.locationHint ? { locationHint: options.locationHint } : {},
|
|
92
|
+
...options?.storageClass ? { storageClass: options.storageClass } : {}
|
|
93
|
+
}, options);
|
|
94
|
+
return {
|
|
95
|
+
name: bucket.name,
|
|
96
|
+
createdOn: bucket.creation_date ? new Date(bucket.creation_date) : /* @__PURE__ */ new Date(),
|
|
97
|
+
location: bucket.location
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async function deleteR2Bucket(accountId, bucketName, options) {
|
|
101
|
+
await apiDelete(`/accounts/${accountId}/r2/buckets/${encodeURIComponent(bucketName)}`, options);
|
|
102
|
+
}
|
|
103
|
+
async function listHyperdrives(accountId, options) {
|
|
104
|
+
return (await apiGetAll(`/accounts/${accountId}/hyperdrive/configs`, options)).map((hyperdrive) => ({
|
|
105
|
+
id: hyperdrive.id,
|
|
106
|
+
name: hyperdrive.name,
|
|
107
|
+
createdOn: hyperdrive.created_on ? new Date(hyperdrive.created_on) : void 0,
|
|
108
|
+
modifiedOn: hyperdrive.modified_on ? new Date(hyperdrive.modified_on) : void 0
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
async function deleteHyperdrive(accountId, hyperdriveId, options) {
|
|
112
|
+
await apiDelete(`/accounts/${accountId}/hyperdrive/configs/${encodeURIComponent(hyperdriveId)}`, options);
|
|
113
|
+
}
|
|
114
|
+
async function listVectorizeIndexes(accountId, options) {
|
|
115
|
+
try {
|
|
116
|
+
return (await apiGetAll(`/accounts/${accountId}/vectorize/v2/indexes`, options)).map((index) => ({
|
|
117
|
+
name: index.name,
|
|
118
|
+
dimensions: index.config.dimensions,
|
|
119
|
+
metric: index.config.metric,
|
|
120
|
+
description: index.description
|
|
121
|
+
}));
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (error instanceof CloudflareAPIError && error.code === 404) return [];
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async function createVectorizeIndex(accountId, index, options) {
|
|
128
|
+
const created = await apiPost(`/accounts/${accountId}/vectorize/v2/indexes`, {
|
|
129
|
+
name: index.name,
|
|
130
|
+
config: {
|
|
131
|
+
dimensions: index.dimensions,
|
|
132
|
+
metric: index.metric
|
|
133
|
+
},
|
|
134
|
+
...index.description ? { description: index.description } : {}
|
|
135
|
+
}, options);
|
|
136
|
+
return {
|
|
137
|
+
name: created.name,
|
|
138
|
+
dimensions: created.config.dimensions,
|
|
139
|
+
metric: created.config.metric,
|
|
140
|
+
description: created.description
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
async function deleteVectorizeIndex(accountId, indexName, options) {
|
|
144
|
+
await apiDelete(`/accounts/${accountId}/vectorize/v2/indexes/${encodeURIComponent(indexName)}`, options);
|
|
145
|
+
}
|
|
146
|
+
async function listAIModels(accountId, options) {
|
|
147
|
+
try {
|
|
148
|
+
return (await apiGetAll(`/accounts/${accountId}/ai/models/search`, options)).map((model) => ({
|
|
149
|
+
id: model.id,
|
|
150
|
+
name: model.name,
|
|
151
|
+
task: model.task?.name,
|
|
152
|
+
description: model.description
|
|
153
|
+
}));
|
|
154
|
+
} catch {
|
|
155
|
+
return [];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
export { listR2Buckets as _, createVectorizeIndex as a, rawD1DatabaseQuery as b, deleteKVNamespace as c, deleteVectorizeIndex as d, listAIModels as f, listQueues as g, listKVNamespaces as h, createR2Bucket as i, deleteQueue as l, listHyperdrives as m, createKVNamespace as n, deleteD1Database as o, listD1Databases as p, createQueue as r, deleteHyperdrive as s, createD1Database as t, deleteR2Bucket as u, listVectorizeIndexes as v, queryD1Database as y };
|