devflare 1.0.0-next.14 → 1.0.0-next.16
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 +9360 -1784
- package/README.md +391 -32
- package/bin/devflare.js +17 -7
- package/dist/account-0w8wdzjv.js +475 -0
- package/dist/account-eygq6qx7.js +475 -0
- package/dist/account-fw8nafav.js +475 -0
- package/dist/account-pzq69nys.js +475 -0
- package/dist/account-s66jb15j.js +475 -0
- package/dist/api-d6ekexs5.js +25 -0
- package/dist/bridge/index.d.ts +1 -1
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/miniflare.d.ts.map +1 -1
- package/dist/bridge/protocol.d.ts +1 -1
- package/dist/bridge/protocol.d.ts.map +1 -1
- package/dist/bridge/proxy.d.ts +0 -4
- package/dist/bridge/proxy.d.ts.map +1 -1
- package/dist/bridge/serialization.d.ts.map +1 -1
- package/dist/bridge/server.d.ts +1 -1
- package/dist/bridge/server.d.ts.map +1 -1
- package/dist/browser-shim/handler.d.ts +1 -1
- package/dist/browser-shim/handler.d.ts.map +1 -1
- package/dist/browser.d.ts +1651 -34
- package/dist/browser.d.ts.map +1 -1
- package/dist/build-1kmkwqgh.js +53 -0
- package/dist/build-506kjhcm.js +53 -0
- package/dist/build-66866ahs.js +53 -0
- package/dist/build-g1adm3ww.js +53 -0
- package/dist/build-p3r3117t.js +53 -0
- package/dist/bundler/do-bundler.d.ts.map +1 -1
- package/dist/bundler/rolldown-shared.d.ts +24 -0
- package/dist/bundler/rolldown-shared.d.ts.map +1 -0
- package/dist/bundler/worker-bundler.d.ts +0 -1
- package/dist/bundler/worker-bundler.d.ts.map +1 -1
- 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 +27 -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.d.ts.map +1 -1
- 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/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 +44 -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 +2 -1
- package/dist/cli/config-path.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/preview-bindings.d.ts +42 -0
- package/dist/cli/preview-bindings.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +11 -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 +4 -0
- package/dist/cloudflare/api.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/kv-namespace.d.ts +3 -0
- package/dist/cloudflare/kv-namespace.d.ts.map +1 -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-records.d.ts +61 -0
- package/dist/cloudflare/preview-registry-records.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-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/registry-schema.d.ts +253 -0
- package/dist/cloudflare/registry-schema.d.ts.map +1 -0
- package/dist/cloudflare/tokens.d.ts +18 -0
- package/dist/cloudflare/tokens.d.ts.map +1 -0
- package/dist/cloudflare/types.d.ts +122 -5
- package/dist/cloudflare/types.d.ts.map +1 -1
- package/dist/cloudflare/usage.d.ts.map +1 -1
- package/dist/config/compiler.d.ts +4 -0
- package/dist/config/compiler.d.ts.map +1 -1
- 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 +5 -3
- 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/preview-resources.d.ts +77 -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 +0 -22
- package/dist/config/ref.d.ts.map +1 -1
- package/dist/config/resolve.d.ts +1 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resource-resolution.d.ts +60 -0
- package/dist/config/resource-resolution.d.ts.map +1 -0
- package/dist/config/schema-bindings.d.ts +693 -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 +1341 -0
- package/dist/config/schema-env.d.ts.map +1 -0
- package/dist/config/schema-normalization.d.ts +64 -0
- package/dist/config/schema-normalization.d.ts.map +1 -0
- package/dist/config/schema-runtime.d.ts +230 -0
- package/dist/config/schema-runtime.d.ts.map +1 -0
- package/dist/config/schema.d.ts +640 -3669
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config-entry.d.ts +5 -0
- package/dist/config-entry.d.ts.map +1 -0
- package/dist/config-fjwke42y.js +59 -0
- package/dist/config-hwdqjse7.js +59 -0
- package/dist/config-pxvewrhv.js +59 -0
- package/dist/config-q0g5qdga.js +59 -0
- package/dist/decorators/durable-object.d.ts.map +1 -1
- package/dist/deploy-7nmzc9r8.js +609 -0
- package/dist/deploy-csfhdr64.js +691 -0
- package/dist/deploy-ex4g5avz.js +621 -0
- package/dist/deploy-jnb0bhka.js +609 -0
- package/dist/deploy-tp0g6qdp.js +609 -0
- package/dist/deploy-ykpcjkc2.js +690 -0
- package/dist/{dev-c1xc1gq9.js → dev-2pd33m28.js} +392 -348
- package/dist/dev-7ef5e2j1.js +2409 -0
- package/dist/dev-8nssqatr.js +2409 -0
- package/dist/dev-grznx8fn.js +2409 -0
- package/dist/dev-server/d1-migrations.d.ts +14 -0
- package/dist/dev-server/d1-migrations.d.ts.map +1 -0
- package/dist/dev-server/gateway-script.d.ts +8 -0
- package/dist/dev-server/gateway-script.d.ts.map +1 -0
- package/dist/dev-server/runtime-stdio.d.ts.map +1 -1
- package/dist/dev-server/server.d.ts.map +1 -1
- package/dist/dev-server/vite-process.d.ts +14 -0
- package/dist/dev-server/vite-process.d.ts.map +1 -0
- package/dist/dev-server/vite-utils.d.ts +1 -1
- package/dist/dev-server/vite-utils.d.ts.map +1 -1
- package/dist/dev-server/worker-source-watcher.d.ts +11 -0
- package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
- package/dist/dev-server/worker-surface-paths.d.ts +6 -0
- package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
- package/dist/{doctor-z4ffybce.js → doctor-04ammrrh.js} +67 -31
- package/dist/doctor-fmjj65mc.js +245 -0
- package/dist/doctor-fzkznce1.js +245 -0
- package/dist/doctor-sa5xv1bz.js +245 -0
- package/dist/index-091sh1ma.js +1229 -0
- package/dist/index-0apbm26n.js +788 -0
- package/dist/index-0eqksag4.js +418 -0
- package/dist/{index-dr6sbp8d.js → index-0kfzdywd.js} +15 -2
- package/dist/index-0w826dsr.js +379 -0
- package/dist/{index-rfhx0yd5.js → index-11m5a8wd.js} +110 -32
- package/dist/{index-xxwbb2nt.js → index-1sp39f2f.js} +114 -58
- package/dist/index-2jnrqbny.js +1301 -0
- package/dist/index-2pb7b9mw.js +378 -0
- package/dist/{index-0kzg8wed.js → index-2x53aqjm.js} +1071 -890
- package/dist/index-3ke5d2vn.js +1229 -0
- package/dist/index-43dq8yx8.js +788 -0
- package/dist/index-4rrttqj5.js +378 -0
- package/dist/index-4v9bc2pc.js +1367 -0
- package/dist/index-61jsjnsv.js +280 -0
- package/dist/index-6jef5emv.js +176 -0
- package/dist/index-6psz1h4c.js +788 -0
- package/dist/index-72mve6vh.js +168 -0
- package/dist/{index-zbvmtcn2.js → index-74198nxd.js} +179 -77
- package/dist/index-7g8zyws4.js +192 -0
- package/dist/index-7kcxjhta.js +456 -0
- package/dist/index-7v583xan.js +418 -0
- package/dist/index-7x0ybbtx.js +133 -0
- package/dist/index-816krz9p.js +52 -0
- package/dist/index-82f1z98k.js +41 -0
- package/dist/index-8t5nb4qx.js +133 -0
- package/dist/index-9az6s7ad.js +52 -0
- package/dist/{index-59df49vn.js → index-9ba1etyz.js} +29 -51
- package/dist/{index-001mw014.js → index-9fbtk7gv.js} +134 -248
- package/dist/index-9n6djthj.js +490 -0
- package/dist/index-aabgympv.js +39 -0
- package/dist/index-b8m6883k.js +74 -0
- package/dist/{index-5yxg30va.js → index-cgbvmse6.js} +15 -6
- package/dist/index-d8etnfef.js +1229 -0
- package/dist/index-e9yw4d6y.js +133 -0
- package/dist/index-epw1jxz5.js +1204 -0
- package/dist/index-f85s8gj3.js +2649 -0
- package/dist/index-fe2ngvh7.js +1229 -0
- package/dist/index-fvsadj32.js +192 -0
- package/dist/index-gs4y9gdf.js +456 -0
- package/dist/{index-fef08w43.js → index-h18pxvzs.js} +7 -6
- package/dist/index-hfj1a2c4.js +2649 -0
- package/dist/{index-8gtqgb3q.js → index-hjy8ctpc.js} +14 -92
- package/dist/index-htzf0py1.js +1204 -0
- package/dist/index-j185x270.js +897 -0
- package/dist/index-jb75kwa4.js +519 -0
- package/dist/index-jwd8pcb2.js +897 -0
- package/dist/index-k29yjhv0.js +52 -0
- package/dist/index-k6vq6kkt.js +456 -0
- package/dist/{index-vky23txa.js → index-m3fmw6mx.js} +2 -2
- package/dist/index-maxpsfk8.js +402 -0
- package/dist/index-mbdmrner.js +402 -0
- package/dist/index-mea5bc45.js +418 -0
- package/dist/index-mqekt778.js +185 -0
- package/dist/index-na3mnm1k.js +74 -0
- package/dist/index-p03n4qet.js +1367 -0
- package/dist/index-p296ban8.js +191 -0
- package/dist/index-pnbs1b8k.js +280 -0
- package/dist/index-q4kaz181.js +1207 -0
- package/dist/index-ry131z23.js +378 -0
- package/dist/index-sgb7c8nm.js +402 -0
- package/dist/index-sqrksgb2.js +133 -0
- package/dist/index-stgn34cr.js +148 -0
- package/dist/{index-v8vvsn9x.js → index-t08te69w.js} +1 -18
- package/dist/index-thna1tkd.js +280 -0
- package/dist/index-v5nmqthy.js +74 -0
- package/dist/{index-n932ytmq.js → index-vt4yxkmf.js} +2 -2
- package/dist/index-wyq6c6yj.js +402 -0
- package/dist/index-wztc9stx.js +418 -0
- package/dist/index-x9cwdxw5.js +456 -0
- package/dist/index-xk9djfjp.js +519 -0
- package/dist/index-yc0gcchc.js +418 -0
- package/dist/index-yqbxjysa.js +897 -0
- package/dist/index-yzddwp02.js +788 -0
- package/dist/index-zfhq6s96.js +74 -0
- package/dist/index-zt22fe2j.js +54 -0
- package/dist/index-zyt5byt6.js +2649 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/{init-na2atvz2.js → init-r4hnxan3.js} +24 -17
- package/dist/login-2hnz4m4n.js +77 -0
- package/dist/login-5bsxxpvc.js +77 -0
- package/dist/login-6tzvczw2.js +77 -0
- package/dist/login-bhaw72zc.js +77 -0
- package/dist/login-x8tgckqm.js +77 -0
- package/dist/previews-3rn8mz2c.js +1168 -0
- package/dist/previews-d487qde5.js +1200 -0
- package/dist/previews-gm3z0syj.js +1168 -0
- package/dist/previews-j9ymq4ys.js +1169 -0
- package/dist/previews-q031mx34.js +1168 -0
- package/dist/productions-120xg0aq.js +505 -0
- package/dist/productions-5ev5qweg.js +505 -0
- package/dist/productions-me3tdvr9.js +505 -0
- package/dist/productions-p5rbgp2f.js +505 -0
- package/dist/productions-x9p0pym1.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 +6 -267
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/exports.d.ts +3 -3
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/middleware.d.ts +8 -38
- package/dist/runtime/middleware.d.ts.map +1 -1
- package/dist/src/browser.js +23 -14
- package/dist/src/cli/index.js +3 -1
- package/dist/src/cloudflare/index.js +49 -2
- package/dist/src/config-entry.js +14 -0
- package/dist/src/index.js +33 -20
- package/dist/src/runtime/index.js +3 -9
- package/dist/src/sveltekit/index.js +10 -7
- package/dist/src/test/index.js +16 -18
- package/dist/src/vite/index.js +7 -4
- package/dist/sveltekit/platform.d.ts +1 -1
- package/dist/sveltekit/platform.d.ts.map +1 -1
- package/dist/test/cf.d.ts +10 -10
- package/dist/test/email.d.ts.map +1 -1
- package/dist/test/index.d.ts +1 -6
- package/dist/test/index.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/test/scheduled.d.ts.map +1 -1
- package/dist/test/should-skip.d.ts +0 -18
- package/dist/test/should-skip.d.ts.map +1 -1
- 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-gateway-script.d.ts +2 -0
- package/dist/test/simple-context-gateway-script.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.d.ts +1 -23
- package/dist/test/simple-context.d.ts.map +1 -1
- package/dist/test/tail.d.ts.map +1 -1
- package/dist/test/worker.d.ts.map +1 -1
- package/dist/token-kedhcret.js +419 -0
- package/dist/token-m8jmnjwk.js +419 -0
- package/dist/{types-sffr9681.js → types-0sqwkp7x.js} +244 -139
- package/dist/types-1gwr2ex6.js +572 -0
- package/dist/types-6e5yx6km.js +572 -0
- package/dist/types-p0gckpn6.js +572 -0
- package/dist/utils/send-email.d.ts.map +1 -1
- package/dist/vite/config-file.d.ts.map +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/worker-0srh2jfr.js +513 -0
- package/dist/worker-4xrfd10a.js +513 -0
- package/dist/worker-entry/composed-worker.d.ts +0 -7
- package/dist/worker-entry/composed-worker.d.ts.map +1 -1
- package/dist/worker-entry/surface-paths.d.ts +15 -0
- package/dist/worker-entry/surface-paths.d.ts.map +1 -0
- package/dist/worker-qtam8grz.js +513 -0
- package/dist/worker-qzm0b7br.js +513 -0
- package/dist/worker-y9ha6g44.js +513 -0
- package/package.json +17 -10
- package/R2.md +0 -200
- package/dist/account-8psavtg6.js +0 -420
- package/dist/build-n639efmn.js +0 -101
- package/dist/deploy-zvnq6xh7.js +0 -117
- package/dist/index-2q3pmzrx.js +0 -90
- package/dist/index-f4q0jbnj.js +0 -195
- package/dist/index-n7rs26ft.js +0 -77
- package/dist/index-tfyxa77h.js +0 -850
- package/dist/index-wyf3s77s.js +0 -343
- package/dist/test/multi-worker-context.d.ts +0 -114
- package/dist/test/multi-worker-context.d.ts.map +0 -1
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import {
|
|
2
|
+
account
|
|
3
|
+
} from "./index-e9yw4d6y.js";
|
|
4
|
+
import {
|
|
5
|
+
listTrackedRegistryState
|
|
6
|
+
} from "./index-epw1jxz5.js";
|
|
7
|
+
import {
|
|
8
|
+
createCliTheme,
|
|
9
|
+
green,
|
|
10
|
+
red,
|
|
11
|
+
yellow
|
|
12
|
+
} from "./index-stgn34cr.js";
|
|
13
|
+
import {
|
|
14
|
+
resolveConfigForEnvironment
|
|
15
|
+
} from "./index-6psz1h4c.js";
|
|
16
|
+
|
|
17
|
+
// src/cli/commands/previews-support/theme.ts
|
|
18
|
+
function shouldUseColor(options) {
|
|
19
|
+
return createCliTheme(options).useColor;
|
|
20
|
+
}
|
|
21
|
+
function formatRecordDate(date) {
|
|
22
|
+
return date ? date.toISOString().slice(0, 19).replace("T", " ") : "N/A";
|
|
23
|
+
}
|
|
24
|
+
function formatStatus(value, theme) {
|
|
25
|
+
switch (value) {
|
|
26
|
+
case "active":
|
|
27
|
+
return green(value, theme);
|
|
28
|
+
case "superseded":
|
|
29
|
+
case "reassigned":
|
|
30
|
+
case "orphaned":
|
|
31
|
+
return yellow(value, theme);
|
|
32
|
+
case "deleted":
|
|
33
|
+
case "rolled_back":
|
|
34
|
+
return red(value, theme);
|
|
35
|
+
default:
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function formatOverviewStatus(value, theme) {
|
|
40
|
+
switch (value) {
|
|
41
|
+
case "ready":
|
|
42
|
+
return green(value, theme);
|
|
43
|
+
case "partial":
|
|
44
|
+
return yellow(value, theme);
|
|
45
|
+
case "missing":
|
|
46
|
+
return red(value, theme);
|
|
47
|
+
default:
|
|
48
|
+
return formatStatus(value, theme);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/cli/commands/previews-support/family.ts
|
|
53
|
+
function isRelatedWorkerName(workerName, familyName) {
|
|
54
|
+
return workerName === familyName || workerName.startsWith(`${familyName}-`);
|
|
55
|
+
}
|
|
56
|
+
function getPreviewDisplayTimestamp(record) {
|
|
57
|
+
return (record.updatedAt ?? record.createdAt).getTime();
|
|
58
|
+
}
|
|
59
|
+
function getScopeDisplayTimestamp(record) {
|
|
60
|
+
return (record.updatedAt ?? record.createdAt).getTime();
|
|
61
|
+
}
|
|
62
|
+
function getDeploymentDisplayTimestamp(record) {
|
|
63
|
+
return record.createdAt.getTime();
|
|
64
|
+
}
|
|
65
|
+
function comparePreviewScopeRows(left, right) {
|
|
66
|
+
const leftTime = left.updatedAt?.getTime() ?? 0;
|
|
67
|
+
const rightTime = right.updatedAt?.getTime() ?? 0;
|
|
68
|
+
if (rightTime !== leftTime) {
|
|
69
|
+
return rightTime - leftTime;
|
|
70
|
+
}
|
|
71
|
+
return left.scope.localeCompare(right.scope);
|
|
72
|
+
}
|
|
73
|
+
function ensureWorkerGroup(groups, workerName) {
|
|
74
|
+
const existing = groups.get(workerName);
|
|
75
|
+
if (existing) {
|
|
76
|
+
return existing;
|
|
77
|
+
}
|
|
78
|
+
const created = {
|
|
79
|
+
workerName,
|
|
80
|
+
previews: [],
|
|
81
|
+
scopes: [],
|
|
82
|
+
deployments: [],
|
|
83
|
+
latestTimestamp: 0
|
|
84
|
+
};
|
|
85
|
+
groups.set(workerName, created);
|
|
86
|
+
return created;
|
|
87
|
+
}
|
|
88
|
+
function appendWorkerGroupRecords(groups, records, options) {
|
|
89
|
+
for (const record of records) {
|
|
90
|
+
const group = ensureWorkerGroup(groups, record.workerName);
|
|
91
|
+
options.append(group, record);
|
|
92
|
+
group.latestTimestamp = Math.max(group.latestTimestamp, options.getTimestamp(record));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function isVisibleTrackedRecord(record, includeAll) {
|
|
96
|
+
return includeAll || !record.deletedAt && record.status === "active";
|
|
97
|
+
}
|
|
98
|
+
function buildWorkerGroups(previews, scopes, deployments) {
|
|
99
|
+
const groups = new Map;
|
|
100
|
+
appendWorkerGroupRecords(groups, previews, {
|
|
101
|
+
append: (group, record) => {
|
|
102
|
+
group.previews.push(record);
|
|
103
|
+
},
|
|
104
|
+
getTimestamp: getPreviewDisplayTimestamp
|
|
105
|
+
});
|
|
106
|
+
appendWorkerGroupRecords(groups, scopes, {
|
|
107
|
+
append: (group, record) => {
|
|
108
|
+
group.scopes.push(record);
|
|
109
|
+
},
|
|
110
|
+
getTimestamp: getScopeDisplayTimestamp
|
|
111
|
+
});
|
|
112
|
+
appendWorkerGroupRecords(groups, deployments, {
|
|
113
|
+
append: (group, record) => {
|
|
114
|
+
group.deployments.push(record);
|
|
115
|
+
},
|
|
116
|
+
getTimestamp: getDeploymentDisplayTimestamp
|
|
117
|
+
});
|
|
118
|
+
return Array.from(groups.values()).sort((left, right) => {
|
|
119
|
+
if (right.latestTimestamp !== left.latestTimestamp) {
|
|
120
|
+
return right.latestTimestamp - left.latestTimestamp;
|
|
121
|
+
}
|
|
122
|
+
return left.workerName.localeCompare(right.workerName);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function collectConfiguredWorkerFamilies(config, environment) {
|
|
126
|
+
const resolvedConfig = resolveConfigForEnvironment(config, environment);
|
|
127
|
+
const families = new Map;
|
|
128
|
+
families.set(resolvedConfig.name, {
|
|
129
|
+
baseName: resolvedConfig.name,
|
|
130
|
+
roleLabel: "primary",
|
|
131
|
+
role: "primary"
|
|
132
|
+
});
|
|
133
|
+
for (const [bindingName, binding] of Object.entries(resolvedConfig.bindings?.services ?? {})) {
|
|
134
|
+
const existing = families.get(binding.service);
|
|
135
|
+
if (existing) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
families.set(binding.service, {
|
|
139
|
+
baseName: binding.service,
|
|
140
|
+
roleLabel: bindingName,
|
|
141
|
+
role: "service"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return Array.from(families.values());
|
|
145
|
+
}
|
|
146
|
+
function getLatestDeployment(group, predicate) {
|
|
147
|
+
return [...group.deployments].filter((record) => predicate ? predicate(record) : true).sort((left, right) => right.createdAt.getTime() - left.createdAt.getTime())[0];
|
|
148
|
+
}
|
|
149
|
+
function getGroupDisplayUrl(group) {
|
|
150
|
+
return getLatestDeployment(group, (record) => record.channel === "production" && record.status === "active" && Boolean(record.url))?.url ?? getLatestDeployment(group, (record) => record.channel === "preview" && record.status === "active" && Boolean(record.url))?.url ?? getLatestDeployment(group, (record) => Boolean(record.url))?.url ?? [...group.previews].sort((left, right) => getPreviewDisplayTimestamp(right) - getPreviewDisplayTimestamp(left))[0]?.scopeUrl ?? [...group.previews].sort((left, right) => getPreviewDisplayTimestamp(right) - getPreviewDisplayTimestamp(left))[0]?.previewUrl;
|
|
151
|
+
}
|
|
152
|
+
function getWorkerUrl(workerName, workersSubdomain) {
|
|
153
|
+
if (!workersSubdomain) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
return `https://${workerName}.${workersSubdomain}.workers.dev`;
|
|
157
|
+
}
|
|
158
|
+
function getWorkerScopeSuffix(workerName, baseName) {
|
|
159
|
+
if (!workerName.startsWith(`${baseName}-`)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const suffix = workerName.slice(baseName.length + 1).trim();
|
|
163
|
+
return suffix || undefined;
|
|
164
|
+
}
|
|
165
|
+
function buildWorkerGroupMap(groups) {
|
|
166
|
+
return new Map(groups.map((group) => [group.workerName, group]));
|
|
167
|
+
}
|
|
168
|
+
function getDedicatedPreviewFamilyNames(families, groupsByWorker) {
|
|
169
|
+
const familyNames = new Set;
|
|
170
|
+
const workerNames = Array.from(groupsByWorker.keys());
|
|
171
|
+
for (const family of families) {
|
|
172
|
+
if (family.role === "primary") {
|
|
173
|
+
familyNames.add(family.baseName);
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (workerNames.some((workerName) => Boolean(getWorkerScopeSuffix(workerName, family.baseName)))) {
|
|
177
|
+
familyNames.add(family.baseName);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return familyNames;
|
|
181
|
+
}
|
|
182
|
+
function buildStableWorkerRowsFromLiveWorkers(families, workers, workersSubdomain) {
|
|
183
|
+
const workersByName = new Map(workers.map((worker) => [worker.name, worker]));
|
|
184
|
+
return families.map((family) => {
|
|
185
|
+
const worker = workersByName.get(family.baseName);
|
|
186
|
+
const status = worker ? "active" : "missing";
|
|
187
|
+
return {
|
|
188
|
+
workerName: family.baseName,
|
|
189
|
+
role: family.roleLabel,
|
|
190
|
+
status,
|
|
191
|
+
updatedAt: worker?.modifiedOn,
|
|
192
|
+
url: worker ? getWorkerUrl(family.baseName, workersSubdomain) : undefined
|
|
193
|
+
};
|
|
194
|
+
}).sort((left, right) => {
|
|
195
|
+
if (left.role === "primary" && right.role !== "primary") {
|
|
196
|
+
return -1;
|
|
197
|
+
}
|
|
198
|
+
if (left.role !== "primary" && right.role === "primary") {
|
|
199
|
+
return 1;
|
|
200
|
+
}
|
|
201
|
+
return left.workerName.localeCompare(right.workerName);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function buildDedicatedWorkerPreviewScopeRows(families, groupsByWorker) {
|
|
205
|
+
const previewFamilyNames = getDedicatedPreviewFamilyNames(families, groupsByWorker);
|
|
206
|
+
const expectedFamilies = families.filter((family) => previewFamilyNames.has(family.baseName));
|
|
207
|
+
const scopeNames = new Set;
|
|
208
|
+
for (const family of expectedFamilies) {
|
|
209
|
+
for (const workerName of groupsByWorker.keys()) {
|
|
210
|
+
const scope = getWorkerScopeSuffix(workerName, family.baseName);
|
|
211
|
+
if (scope) {
|
|
212
|
+
scopeNames.add(scope);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return Array.from(scopeNames).map((scope) => {
|
|
217
|
+
const resolvedFamilies = expectedFamilies.map((family) => ({
|
|
218
|
+
family,
|
|
219
|
+
group: groupsByWorker.get(`${family.baseName}-${scope}`)
|
|
220
|
+
}));
|
|
221
|
+
const presentFamilies = resolvedFamilies.filter((entry) => entry.group);
|
|
222
|
+
const updatedAt = presentFamilies.reduce((latest, entry) => {
|
|
223
|
+
const currentDate = entry.group && entry.group.latestTimestamp > 0 ? new Date(entry.group.latestTimestamp) : undefined;
|
|
224
|
+
if (!currentDate) {
|
|
225
|
+
return latest;
|
|
226
|
+
}
|
|
227
|
+
if (!latest || currentDate.getTime() > latest.getTime()) {
|
|
228
|
+
return currentDate;
|
|
229
|
+
}
|
|
230
|
+
return latest;
|
|
231
|
+
}, undefined);
|
|
232
|
+
const primaryEntry = resolvedFamilies.find((entry) => entry.family.role === "primary");
|
|
233
|
+
const entryUrl = primaryEntry?.group ? getGroupDisplayUrl(primaryEntry.group) : presentFamilies[0]?.group ? getGroupDisplayUrl(presentFamilies[0].group) : undefined;
|
|
234
|
+
const missingLabels = resolvedFamilies.filter((entry) => !entry.group).map((entry) => entry.family.role === "primary" ? "primary" : entry.family.roleLabel);
|
|
235
|
+
const notes = [];
|
|
236
|
+
if (missingLabels.length > 0) {
|
|
237
|
+
notes.push(`missing ${missingLabels.join(", ")}`);
|
|
238
|
+
}
|
|
239
|
+
const strategy = "dedicated workers";
|
|
240
|
+
const status = presentFamilies.length === resolvedFamilies.length ? "ready" : "partial";
|
|
241
|
+
return {
|
|
242
|
+
scope,
|
|
243
|
+
strategy,
|
|
244
|
+
workersLabel: `${presentFamilies.length}/${resolvedFamilies.length}`,
|
|
245
|
+
status,
|
|
246
|
+
updatedAt,
|
|
247
|
+
notes: notes.length > 0 ? notes.join(" · ") : undefined,
|
|
248
|
+
entryUrl
|
|
249
|
+
};
|
|
250
|
+
}).sort(comparePreviewScopeRows);
|
|
251
|
+
}
|
|
252
|
+
function buildPreviewScopeRows(families, groupsByWorker) {
|
|
253
|
+
return buildDedicatedWorkerPreviewScopeRows(families, groupsByWorker);
|
|
254
|
+
}
|
|
255
|
+
function getDedicatedPreviewFamilyNamesFromWorkers(families, workers) {
|
|
256
|
+
const familyNames = new Set;
|
|
257
|
+
const workerNames = workers.map((worker) => worker.name);
|
|
258
|
+
for (const family of families) {
|
|
259
|
+
if (family.role === "primary") {
|
|
260
|
+
familyNames.add(family.baseName);
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (workerNames.some((workerName) => Boolean(getWorkerScopeSuffix(workerName, family.baseName)))) {
|
|
264
|
+
familyNames.add(family.baseName);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return familyNames;
|
|
268
|
+
}
|
|
269
|
+
function buildPreviewScopeRowsFromLiveWorkers(families, workers, workersSubdomain) {
|
|
270
|
+
const workersByName = new Map(workers.map((worker) => [worker.name, worker]));
|
|
271
|
+
const previewFamilyNames = getDedicatedPreviewFamilyNamesFromWorkers(families, workers);
|
|
272
|
+
const expectedFamilies = families.filter((family) => previewFamilyNames.has(family.baseName));
|
|
273
|
+
const workerCandidatesByScope = buildPreviewWorkerCandidatesByScope(families, workers);
|
|
274
|
+
return Array.from(workerCandidatesByScope.keys()).map((scope) => {
|
|
275
|
+
const resolvedFamilies = expectedFamilies.map((family) => ({
|
|
276
|
+
family,
|
|
277
|
+
worker: workersByName.get(`${family.baseName}-${scope}`)
|
|
278
|
+
}));
|
|
279
|
+
const presentFamilies = resolvedFamilies.filter((entry) => entry.worker);
|
|
280
|
+
const updatedAt = presentFamilies.reduce((latest, entry) => {
|
|
281
|
+
const currentDate = entry.worker?.modifiedOn;
|
|
282
|
+
if (!currentDate) {
|
|
283
|
+
return latest;
|
|
284
|
+
}
|
|
285
|
+
if (!latest || currentDate.getTime() > latest.getTime()) {
|
|
286
|
+
return currentDate;
|
|
287
|
+
}
|
|
288
|
+
return latest;
|
|
289
|
+
}, undefined);
|
|
290
|
+
const primaryEntry = resolvedFamilies.find((entry) => entry.family.role === "primary");
|
|
291
|
+
const entryWorker = primaryEntry?.worker ?? presentFamilies[0]?.worker;
|
|
292
|
+
const missingLabels = resolvedFamilies.filter((entry) => !entry.worker).map((entry) => entry.family.role === "primary" ? "primary" : entry.family.roleLabel);
|
|
293
|
+
const notes = [];
|
|
294
|
+
if (missingLabels.length > 0) {
|
|
295
|
+
notes.push(`missing ${missingLabels.join(", ")}`);
|
|
296
|
+
}
|
|
297
|
+
const strategy = "dedicated workers";
|
|
298
|
+
const status = presentFamilies.length === resolvedFamilies.length ? "ready" : "partial";
|
|
299
|
+
return {
|
|
300
|
+
scope,
|
|
301
|
+
strategy,
|
|
302
|
+
workersLabel: `${presentFamilies.length}/${resolvedFamilies.length}`,
|
|
303
|
+
status,
|
|
304
|
+
updatedAt,
|
|
305
|
+
notes: notes.length > 0 ? notes.join(" · ") : undefined,
|
|
306
|
+
entryUrl: entryWorker ? getWorkerUrl(entryWorker.name, workersSubdomain) : undefined
|
|
307
|
+
};
|
|
308
|
+
}).sort(comparePreviewScopeRows);
|
|
309
|
+
}
|
|
310
|
+
function filterFamilyRecords(records, families) {
|
|
311
|
+
return records.filter((record) => families.some((family) => isRelatedWorkerName(record.workerName, family.baseName)));
|
|
312
|
+
}
|
|
313
|
+
function isVisiblePreviewRecord(record, includeAll) {
|
|
314
|
+
return isVisibleTrackedRecord(record, includeAll);
|
|
315
|
+
}
|
|
316
|
+
function isVisibleScopeRecord(record, includeAll) {
|
|
317
|
+
return isVisibleTrackedRecord(record, includeAll);
|
|
318
|
+
}
|
|
319
|
+
function isVisibleDeploymentRecord(record, includeAll) {
|
|
320
|
+
return isVisibleTrackedRecord(record, includeAll);
|
|
321
|
+
}
|
|
322
|
+
async function loadTrackedPreviewScopeRows(accountId, databaseName, families, apiOptions) {
|
|
323
|
+
const registry = await account.getPreviewRegistryContext({
|
|
324
|
+
accountId,
|
|
325
|
+
databaseName,
|
|
326
|
+
apiOptions,
|
|
327
|
+
skipContextCache: true
|
|
328
|
+
});
|
|
329
|
+
if (!registry) {
|
|
330
|
+
return [];
|
|
331
|
+
}
|
|
332
|
+
const { previews, scopes, deployments } = await listTrackedRegistryState({
|
|
333
|
+
registry,
|
|
334
|
+
workerName: undefined,
|
|
335
|
+
apiOptions
|
|
336
|
+
});
|
|
337
|
+
const filteredPreviews = filterFamilyRecords(previews, families).filter((record) => isVisiblePreviewRecord(record, false));
|
|
338
|
+
const filteredScopes = filterFamilyRecords(scopes, families).filter((record) => isVisibleScopeRecord(record, false));
|
|
339
|
+
const filteredDeployments = filterFamilyRecords(deployments, families).filter((record) => isVisibleDeploymentRecord(record, false));
|
|
340
|
+
const workerGroups = buildWorkerGroups(filteredPreviews, filteredScopes, filteredDeployments);
|
|
341
|
+
return buildPreviewScopeRows(families, buildWorkerGroupMap(workerGroups));
|
|
342
|
+
}
|
|
343
|
+
function buildPreviewWorkerCandidatesByScope(families, workers) {
|
|
344
|
+
const candidates = new Map;
|
|
345
|
+
for (const worker of workers) {
|
|
346
|
+
for (const family of families) {
|
|
347
|
+
const scope = getWorkerScopeSuffix(worker.name, family.baseName);
|
|
348
|
+
if (!scope) {
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
const names = candidates.get(scope) ?? new Set;
|
|
352
|
+
names.add(worker.name);
|
|
353
|
+
candidates.set(scope, names);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return new Map(Array.from(candidates.entries()).map(([scope, workerNames]) => {
|
|
357
|
+
return [scope, Array.from(workerNames).sort((left, right) => left.localeCompare(right))];
|
|
358
|
+
}));
|
|
359
|
+
}
|
|
360
|
+
function orderPreviewWorkerNamesForDeletion(workerNames, scope, families) {
|
|
361
|
+
const familyPriority = new Map;
|
|
362
|
+
for (const family of families) {
|
|
363
|
+
familyPriority.set(family.baseName, {
|
|
364
|
+
priority: family.role === "primary" ? 0 : 1,
|
|
365
|
+
roleLabel: family.roleLabel
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
const resolveFamilyForWorker = (workerName) => {
|
|
369
|
+
for (const family of families) {
|
|
370
|
+
if (getWorkerScopeSuffix(workerName, family.baseName) === scope) {
|
|
371
|
+
const resolved = familyPriority.get(family.baseName);
|
|
372
|
+
if (resolved) {
|
|
373
|
+
return {
|
|
374
|
+
priority: resolved.priority,
|
|
375
|
+
roleLabel: resolved.roleLabel,
|
|
376
|
+
baseName: family.baseName
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
priority: 2,
|
|
383
|
+
roleLabel: workerName
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
return [...workerNames].sort((left, right) => {
|
|
387
|
+
const leftFamily = resolveFamilyForWorker(left);
|
|
388
|
+
const rightFamily = resolveFamilyForWorker(right);
|
|
389
|
+
if (leftFamily.priority !== rightFamily.priority) {
|
|
390
|
+
return leftFamily.priority - rightFamily.priority;
|
|
391
|
+
}
|
|
392
|
+
if (leftFamily.roleLabel !== rightFamily.roleLabel) {
|
|
393
|
+
return leftFamily.roleLabel.localeCompare(rightFamily.roleLabel);
|
|
394
|
+
}
|
|
395
|
+
if (leftFamily.baseName && rightFamily.baseName && leftFamily.baseName !== rightFamily.baseName) {
|
|
396
|
+
return leftFamily.baseName.localeCompare(rightFamily.baseName);
|
|
397
|
+
}
|
|
398
|
+
return left.localeCompare(right);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export { shouldUseColor, formatRecordDate, formatOverviewStatus, collectConfiguredWorkerFamilies, buildStableWorkerRowsFromLiveWorkers, buildPreviewScopeRowsFromLiveWorkers, loadTrackedPreviewScopeRows, buildPreviewWorkerCandidatesByScope, orderPreviewWorkerNamesForDeletion };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAccountOwnedAPIToken,
|
|
3
|
+
deleteAccountOwnedAPIToken,
|
|
4
|
+
listAccountOwnedAPITokens,
|
|
5
|
+
listAccountTokenPermissionGroups,
|
|
6
|
+
normalizeDevflareTokenName
|
|
7
|
+
} from "./index-72mve6vh.js";
|
|
8
|
+
import {
|
|
9
|
+
DEVFLARE_PREVIEW_REGISTRY_DATABASE,
|
|
10
|
+
cleanupPreviewRegistry,
|
|
11
|
+
ensurePreviewRegistry,
|
|
12
|
+
getPreviewRegistryContext,
|
|
13
|
+
listTrackedDeploymentRecords,
|
|
14
|
+
listTrackedPreviewAliasRecords,
|
|
15
|
+
listTrackedPreviewRecords,
|
|
16
|
+
listTrackedRegistryState,
|
|
17
|
+
reconcilePreviewRegistry,
|
|
18
|
+
retirePreviewRegistry
|
|
19
|
+
} from "./index-q4kaz181.js";
|
|
20
|
+
import {
|
|
21
|
+
canProceedWithTest,
|
|
22
|
+
getAllUsageSummaries,
|
|
23
|
+
getLimits,
|
|
24
|
+
getUsage,
|
|
25
|
+
getUsageSummary,
|
|
26
|
+
isWithinLimits,
|
|
27
|
+
recordTestUsage,
|
|
28
|
+
recordUsage,
|
|
29
|
+
resetUsage,
|
|
30
|
+
setLimits,
|
|
31
|
+
setLimitsEnabled,
|
|
32
|
+
shouldSkip
|
|
33
|
+
} from "./index-7g8zyws4.js";
|
|
34
|
+
import {
|
|
35
|
+
clearGlobalDefaultAccountId,
|
|
36
|
+
createD1Database,
|
|
37
|
+
deleteWorker,
|
|
38
|
+
getAccountById,
|
|
39
|
+
getAccountSummary,
|
|
40
|
+
getAccounts,
|
|
41
|
+
getAllServiceStatus,
|
|
42
|
+
getEffectiveAccountId,
|
|
43
|
+
getGlobalDefaultAccountId,
|
|
44
|
+
getPrimaryAccount,
|
|
45
|
+
getServiceStatus,
|
|
46
|
+
getWorkerVersionDetail,
|
|
47
|
+
getWorkersSubdomain,
|
|
48
|
+
getWorkspaceAccountId,
|
|
49
|
+
hasService,
|
|
50
|
+
listAIModels,
|
|
51
|
+
listD1Databases,
|
|
52
|
+
listKVNamespaces,
|
|
53
|
+
listR2Buckets,
|
|
54
|
+
listVectorizeIndexes,
|
|
55
|
+
listWorkerDeployments,
|
|
56
|
+
listWorkerVersions,
|
|
57
|
+
listWorkers,
|
|
58
|
+
queryD1Database,
|
|
59
|
+
rawD1DatabaseQuery,
|
|
60
|
+
renameWorker,
|
|
61
|
+
setGlobalDefaultAccountId,
|
|
62
|
+
setWorkspaceAccountId
|
|
63
|
+
} from "./index-xk9djfjp.js";
|
|
64
|
+
import {
|
|
65
|
+
getApiToken,
|
|
66
|
+
getWranglerAuth,
|
|
67
|
+
hasWranglerConfig,
|
|
68
|
+
isAuthenticated
|
|
69
|
+
} from "./index-0w826dsr.js";
|
|
70
|
+
|
|
71
|
+
// src/cloudflare/index.ts
|
|
72
|
+
var account = {
|
|
73
|
+
isAuthenticated,
|
|
74
|
+
hasWranglerConfig,
|
|
75
|
+
getApiToken,
|
|
76
|
+
getWranglerAuth,
|
|
77
|
+
getAccounts,
|
|
78
|
+
getPrimaryAccount,
|
|
79
|
+
getAccountById,
|
|
80
|
+
getAccountSummary,
|
|
81
|
+
workers: listWorkers,
|
|
82
|
+
renameWorker,
|
|
83
|
+
deleteWorker,
|
|
84
|
+
workerVersions: listWorkerVersions,
|
|
85
|
+
workerVersion: getWorkerVersionDetail,
|
|
86
|
+
workerDeployments: listWorkerDeployments,
|
|
87
|
+
workersSubdomain: getWorkersSubdomain,
|
|
88
|
+
kv: listKVNamespaces,
|
|
89
|
+
d1: listD1Databases,
|
|
90
|
+
createD1Database,
|
|
91
|
+
queryD1Database,
|
|
92
|
+
rawD1DatabaseQuery,
|
|
93
|
+
r2: listR2Buckets,
|
|
94
|
+
vectorize: listVectorizeIndexes,
|
|
95
|
+
ai: listAIModels,
|
|
96
|
+
getServiceStatus,
|
|
97
|
+
getAllServiceStatus,
|
|
98
|
+
hasService,
|
|
99
|
+
getUsage,
|
|
100
|
+
recordUsage,
|
|
101
|
+
resetUsage,
|
|
102
|
+
getAllUsageSummaries,
|
|
103
|
+
getUsageSummary,
|
|
104
|
+
getLimits,
|
|
105
|
+
setLimits,
|
|
106
|
+
setLimitsEnabled,
|
|
107
|
+
isWithinLimits,
|
|
108
|
+
canProceedWithTest,
|
|
109
|
+
recordTestUsage,
|
|
110
|
+
shouldSkip,
|
|
111
|
+
getGlobalDefaultAccountId,
|
|
112
|
+
setGlobalDefaultAccountId,
|
|
113
|
+
getWorkspaceAccountId,
|
|
114
|
+
setWorkspaceAccountId,
|
|
115
|
+
getEffectiveAccountId,
|
|
116
|
+
clearGlobalDefaultAccountId,
|
|
117
|
+
listAccountTokenPermissionGroups,
|
|
118
|
+
listAccountOwnedAPITokens,
|
|
119
|
+
createAccountOwnedAPIToken,
|
|
120
|
+
deleteAccountOwnedAPIToken,
|
|
121
|
+
normalizeDevflareTokenName,
|
|
122
|
+
previewRegistryDatabase: DEVFLARE_PREVIEW_REGISTRY_DATABASE,
|
|
123
|
+
ensurePreviewRegistry,
|
|
124
|
+
getPreviewRegistryContext,
|
|
125
|
+
listTrackedPreviewRecords,
|
|
126
|
+
listTrackedRegistryState,
|
|
127
|
+
listTrackedPreviewAliasRecords,
|
|
128
|
+
listTrackedDeploymentRecords,
|
|
129
|
+
reconcilePreviewRegistry,
|
|
130
|
+
cleanupPreviewRegistry,
|
|
131
|
+
retirePreviewRegistry
|
|
132
|
+
};
|
|
133
|
+
export { account };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BOLD,
|
|
3
|
+
CYAN,
|
|
4
|
+
CYAN_BOLD,
|
|
5
|
+
DIM,
|
|
6
|
+
GREEN,
|
|
7
|
+
RED,
|
|
8
|
+
RESET,
|
|
9
|
+
WHITE,
|
|
10
|
+
YELLOW
|
|
11
|
+
} from "./index-3t6rypgc.js";
|
|
12
|
+
|
|
13
|
+
// src/cli/ui.ts
|
|
14
|
+
var ANSI_REGEX = /\x1b\[[0-9;]*m/g;
|
|
15
|
+
function createCliTheme(options = {}) {
|
|
16
|
+
if (options["no-color"] === true) {
|
|
17
|
+
return { useColor: false };
|
|
18
|
+
}
|
|
19
|
+
if (process.env.NO_COLOR?.trim()) {
|
|
20
|
+
return { useColor: false };
|
|
21
|
+
}
|
|
22
|
+
if (process.env.TERM === "dumb") {
|
|
23
|
+
return { useColor: false };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
useColor: process.stdout?.isTTY === true
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function paint(value, code, theme) {
|
|
30
|
+
return theme.useColor ? `${code}${value}${RESET}` : value;
|
|
31
|
+
}
|
|
32
|
+
function dim(value, theme) {
|
|
33
|
+
return paint(value, DIM, theme);
|
|
34
|
+
}
|
|
35
|
+
function bold(value, theme) {
|
|
36
|
+
return paint(value, BOLD, theme);
|
|
37
|
+
}
|
|
38
|
+
function cyan(value, theme) {
|
|
39
|
+
return paint(value, CYAN, theme);
|
|
40
|
+
}
|
|
41
|
+
function cyanBold(value, theme) {
|
|
42
|
+
return paint(value, CYAN_BOLD, theme);
|
|
43
|
+
}
|
|
44
|
+
function green(value, theme) {
|
|
45
|
+
return paint(value, GREEN, theme);
|
|
46
|
+
}
|
|
47
|
+
function yellow(value, theme) {
|
|
48
|
+
return paint(value, YELLOW, theme);
|
|
49
|
+
}
|
|
50
|
+
function yellowBold(value, theme) {
|
|
51
|
+
return paint(value, `${BOLD}${YELLOW}`, theme);
|
|
52
|
+
}
|
|
53
|
+
function red(value, theme) {
|
|
54
|
+
return paint(value, RED, theme);
|
|
55
|
+
}
|
|
56
|
+
function whiteDim(value, theme) {
|
|
57
|
+
return paint(value, `${DIM}${WHITE}`, theme);
|
|
58
|
+
}
|
|
59
|
+
function accent(value, theme, kind = "cyan") {
|
|
60
|
+
switch (kind) {
|
|
61
|
+
case "yellow":
|
|
62
|
+
return yellowBold(value, theme);
|
|
63
|
+
case "green":
|
|
64
|
+
return green(value, theme);
|
|
65
|
+
case "red":
|
|
66
|
+
return red(value, theme);
|
|
67
|
+
case "dim":
|
|
68
|
+
return dim(value, theme);
|
|
69
|
+
case "bold":
|
|
70
|
+
return bold(value, theme);
|
|
71
|
+
case "white-dim":
|
|
72
|
+
return whiteDim(value, theme);
|
|
73
|
+
case "cyan":
|
|
74
|
+
default:
|
|
75
|
+
return cyanBold(value, theme);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function logLine(logger, message = "") {
|
|
79
|
+
logger.log(message);
|
|
80
|
+
}
|
|
81
|
+
function stripAnsi(value) {
|
|
82
|
+
return value.replace(ANSI_REGEX, "");
|
|
83
|
+
}
|
|
84
|
+
function truncateCell(value, width) {
|
|
85
|
+
if (value.length <= width) {
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
if (width <= 1) {
|
|
89
|
+
return "…";
|
|
90
|
+
}
|
|
91
|
+
return `${value.slice(0, width - 1)}…`;
|
|
92
|
+
}
|
|
93
|
+
function truncateStyledCell(value, width) {
|
|
94
|
+
const plainValue = stripAnsi(value);
|
|
95
|
+
if (plainValue.length <= width) {
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
const truncatedPlainValue = truncateCell(plainValue, width);
|
|
99
|
+
const prefixMatch = value.match(/^((?:\x1b\[[0-9;]*m)+)/);
|
|
100
|
+
const suffixMatch = value.match(/((?:\x1b\[[0-9;]*m)+)$/);
|
|
101
|
+
const prefix = prefixMatch?.[1] ?? "";
|
|
102
|
+
const suffix = prefix ? RESET : suffixMatch?.[1] ?? "";
|
|
103
|
+
return `${prefix}${truncatedPlainValue}${suffix}`;
|
|
104
|
+
}
|
|
105
|
+
function padStyledCell(value, width) {
|
|
106
|
+
const truncatedValue = truncateStyledCell(value, width);
|
|
107
|
+
const visibleLength = stripAnsi(truncatedValue).length;
|
|
108
|
+
return `${truncatedValue}${" ".repeat(Math.max(width - visibleLength, 0))}`;
|
|
109
|
+
}
|
|
110
|
+
function formatTableLine(values, widths) {
|
|
111
|
+
return values.map((value, index) => {
|
|
112
|
+
const width = widths[index];
|
|
113
|
+
if (width === undefined || index === values.length - 1) {
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
116
|
+
return padStyledCell(value, width);
|
|
117
|
+
}).join(" ");
|
|
118
|
+
}
|
|
119
|
+
function renderTable(rows, columns, theme) {
|
|
120
|
+
if (rows.length === 0) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
const widths = columns.map((column) => column.width);
|
|
124
|
+
return [
|
|
125
|
+
formatTableLine(columns.map((column) => dim(column.label, theme)), widths),
|
|
126
|
+
...rows.map((row) => formatTableLine(columns.map((column) => column.value(row)), widths))
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
function logTable(logger, options) {
|
|
130
|
+
if (options.rows.length === 0) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
logLine(logger, `${accent(options.title, options.theme, options.titleAccent)} ${dim(`(${options.rows.length})`, options.theme)}`);
|
|
134
|
+
for (const line of renderTable(options.rows, options.columns, options.theme)) {
|
|
135
|
+
logLine(logger, line);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function formatLabelValue(label, value, theme, labelWidth = 12) {
|
|
139
|
+
return `${dim(label.padEnd(labelWidth), theme)} ${value}`;
|
|
140
|
+
}
|
|
141
|
+
function formatCommand(command, description, theme) {
|
|
142
|
+
return ` ${cyan(command, theme)}${dim(" — ", theme)}${description}`;
|
|
143
|
+
}
|
|
144
|
+
function formatBullet(text, theme, bullet = "•") {
|
|
145
|
+
return ` ${dim(bullet, theme)} ${text}`;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { createCliTheme, dim, bold, cyan, cyanBold, green, yellow, yellowBold, red, whiteDim, accent, logLine, formatTableLine, logTable, formatLabelValue, formatCommand, formatBullet };
|
|
@@ -148,22 +148,5 @@ function ref(nameOrImport, maybeImport) {
|
|
|
148
148
|
});
|
|
149
149
|
return proxy;
|
|
150
150
|
}
|
|
151
|
-
async function resolveRef(configImport, options) {
|
|
152
|
-
const result = options?.workerName ? ref(options.workerName, configImport) : ref(configImport);
|
|
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
151
|
|
|
169
|
-
export { defineConfig, ref
|
|
152
|
+
export { defineConfig, ref };
|