@builtbyfriends/bwf 0.0.0-stage → 1.9.2
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/AGENTS_TEMPLATE.md +4 -0
- package/LICENSE +22 -0
- package/README.md +48 -2
- package/dist/account-cmd-Ddt8lGeL.mjs +45 -0
- package/dist/agents-BLiMq9E1.mjs +113 -0
- package/dist/application-analysis-C9Ck2Yeg.mjs +1498 -0
- package/dist/application-routing-DbR-W5lG.mjs +25 -0
- package/dist/atomic-write-DA6eD1Kp.mjs +17 -0
- package/dist/auth-BKsUmWbT.d.mts +77 -0
- package/dist/auth-DkvoW5hB.mjs +33 -0
- package/dist/auth-aKyIWkdS.mjs +1 -0
- package/dist/auth-client-6-Ft9i9T.d.mts +5 -0
- package/dist/auth-client-DwCdwKbw.mjs +5 -0
- package/dist/auth-client-react-CJdeErvM.mjs +5 -0
- package/dist/auth-client-react-DvQLe5Zb.d.mts +5 -0
- package/dist/auth-link-CCl-hJol.mjs +26 -0
- package/dist/auth-migrations-DDeifS3v.mjs +206 -0
- package/dist/auth-router-BG74WFUf.mjs +66 -0
- package/dist/auth-xnkmpZUl.mjs +311 -0
- package/dist/base64-ikl9yBy3.mjs +15 -0
- package/dist/better-auth-shared-Br6TNaYJ.mjs +473 -0
- package/dist/better-auth-shared-CsBNvPOU.d.mts +56 -0
- package/dist/build-cmd-BnZezraT.mjs +153 -0
- package/dist/build-output-dir-Clj_unKN.mjs +402 -0
- package/dist/cancel-deploy-DKAj5U1Z.mjs +57 -0
- package/dist/cf-access-Bhz9wX6p.mjs +131 -0
- package/dist/cf-access-CUP5L08W.mjs +67 -0
- package/dist/cf-build-output-DA6uJomQ.mjs +1 -0
- package/dist/cf-build-output-DNQTwMNU.mjs +438 -0
- package/dist/cf-command-values-2kOtxMo1.mjs +26 -0
- package/dist/cf-config-migrate-COOCi4Ge.mjs +330 -0
- package/dist/cf-worker-settings-CIh4t_yG.mjs +41 -0
- package/dist/cli/cli.d.mts +1 -0
- package/dist/cli/cli.mjs +88 -0
- package/dist/cli/cloudflare-operation-process.d.mts +1 -0
- package/dist/cli/cloudflare-operation-process.mjs +1284 -0
- package/dist/cli/env-schema-probe.d.mts +43 -0
- package/dist/cli/env-schema-probe.mjs +165 -0
- package/dist/cli-main-BfYf6fnB.mjs +1846 -0
- package/dist/client-D3D5RM5h.mjs +940 -0
- package/dist/client-VF2Nzc7Z.mjs +1 -0
- package/dist/cloudflare-auth-DzkU9H6r.mjs +152 -0
- package/dist/cloudflare-cmd-Bm6UhzAQ.mjs +59 -0
- package/dist/cloudflare-config-i8yanry0.mjs +186 -0
- package/dist/cloudflare-connect-B4ItSbJi.mjs +55 -0
- package/dist/cloudflare-operations-BcK849ue.mjs +1 -0
- package/dist/cloudflare-operations-DGF7xH7O.mjs +627 -0
- package/dist/cloudflare-process-tThIjEB2.mjs +309 -0
- package/dist/cloudflare-user-output-CqONaAbP.mjs +19 -0
- package/dist/collect-8i0wU63d.mjs +1 -0
- package/dist/collect-C6Blu9yw.mjs +48 -0
- package/dist/config-CN_RFRkS.mjs +86 -0
- package/dist/config-D5G-Tx6o.mjs +1 -0
- package/dist/config-DOaFIK3w.mjs +88 -0
- package/dist/config-entry.d.mts +202 -0
- package/dist/config-entry.mjs +6 -0
- package/dist/config-tNx0HlFv.mjs +516 -0
- package/dist/connect-CSNWKLzB.mjs +84 -0
- package/dist/create-project-B35ux-LA.mjs +126 -0
- package/dist/create-project-tJ1KwNss.mjs +1 -0
- package/dist/database-provider-DkZo4VwN.mjs +5 -0
- package/dist/database-provider.d.mts +25 -0
- package/dist/database-provider.mjs +1 -0
- package/dist/db-SOv4E9wr.mjs +1735 -0
- package/dist/delete-BSKI7V23.mjs +65 -0
- package/dist/deploy-BCSQoKC0.mjs +2 -0
- package/dist/deploy-CWJ3JJs_.mjs +6512 -0
- package/dist/deploy.d.mts +31 -0
- package/dist/deploy.mjs +118 -0
- package/dist/dev-inbox-I0nqTCdf.mjs +216 -0
- package/dist/discover-DJPmQcL5.mjs +36 -0
- package/dist/discover-EVuydEoM.mjs +1 -0
- package/dist/dist-B6eN80gc.mjs +1612 -0
- package/dist/dist-Cp4b1_T9.mjs +1 -0
- package/dist/dist-DMYe8CZJ.mjs +48 -0
- package/dist/dist-STQXl8ck.mjs +1878 -0
- package/dist/domain-BJaAbxuQ.mjs +149 -0
- package/dist/dotenv-4NdUCXbB.mjs +156 -0
- package/dist/drizzle-DqVFXtlc.mjs +306 -0
- package/dist/drizzle-Ds5P0n-S.mjs +1 -0
- package/dist/edge.d.mts +2 -0
- package/dist/edge.mjs +1 -0
- package/dist/email-C_ATvNIG.mjs +2865 -0
- package/dist/email-cloudflare-oXk2G1G3.mjs +854 -0
- package/dist/email-protocol-CZ0bAkI8.mjs +81 -0
- package/dist/email-rIfZgVAB.mjs +742 -0
- package/dist/env-BGTu3KWZ.mjs +73 -0
- package/dist/env-DUyTzroe.mjs +88 -0
- package/dist/env-Dl4Wggec.mjs +71 -0
- package/dist/env-helpers-BX0APszT.mjs +135 -0
- package/dist/env-helpers-U56xuFgL.d.mts +20 -0
- package/dist/env-mask-BsHxq3R8.mjs +46 -0
- package/dist/env-public-Cw_xPi1D.d.mts +119 -0
- package/dist/env-raw-Bo6TtrHU.mjs +41 -0
- package/dist/env-types-Bg-dTh8u.mjs +56 -0
- package/dist/env-validation-BlXzGgLZ.mjs +1 -0
- package/dist/env-validation-DeqFUSKg.mjs +488 -0
- package/dist/fetch-CBgyyhzm.d.mts +87 -0
- package/dist/fetch-error-DmlRM6e4.mjs +264 -0
- package/dist/fetch-stream-2GUN3YN1.mjs +102 -0
- package/dist/fetch-stream-bUXynOyZ.d.mts +32 -0
- package/dist/fetch-tpPiSK10.mjs +25 -0
- package/dist/gen-dc13IRXh.mjs +509 -0
- package/dist/gen-kQqhFyOP.mjs +1 -0
- package/dist/generate-BgtlYpKg.mjs +1 -0
- package/dist/generate-Da9mWKzU.mjs +80 -0
- package/dist/generated-wrangler-config-CoDaaFsA.mjs +17 -0
- package/dist/git-metadata-Cukp5kV5.mjs +82 -0
- package/dist/github-cmd-DT5Onu6E.mjs +690 -0
- package/dist/handler-B_ocHStk.d.mts +279 -0
- package/dist/handler-CNq7aSs1.mjs +161 -0
- package/dist/help-BK35YcRa.mjs +1946 -0
- package/dist/help-DaRezBj7.mjs +1 -0
- package/dist/inbound-CqubE-9T.d.mts +311 -0
- package/dist/inbound-lHugZPuK.mjs +509 -0
- package/dist/index.d.mts +64 -0
- package/dist/index.mjs +4163 -0
- package/dist/info-CLQoCenb.mjs +109 -0
- package/dist/init-CXanf5ck.mjs +2486 -0
- package/dist/limits-CMmYT2l8.d.mts +16 -0
- package/dist/limits-D27Lp6FP.mjs +46 -0
- package/dist/link-DinwJnon.mjs +52 -0
- package/dist/list-B1WAE9Wt.mjs +130 -0
- package/dist/live-KkEeda1Z.d.mts +105 -0
- package/dist/live-saC8barp.mjs +410 -0
- package/dist/load-user-env-g0ahkZcj.mjs +34 -0
- package/dist/local-d1-bUoAtFUe.mjs +103 -0
- package/dist/log-JDnPc0cF.mjs +23 -0
- package/dist/login-BUzyiyHV.mjs +1 -0
- package/dist/login-Dbv_T3Ru.mjs +87 -0
- package/dist/logs-BjMJooJQ.mjs +129 -0
- package/dist/migrate-DjW9_-sS.mjs +1 -0
- package/dist/migrate-DtcfKqPW.mjs +125 -0
- package/dist/migration-handler-22qiuWPq.mjs +469 -0
- package/dist/migration-handler-Bb2BJh6g.d.mts +38 -0
- package/dist/mime-BMUN_QKG.mjs +1004 -0
- package/dist/mysql-migration-sql-CNuBSqdx.mjs +239 -0
- package/dist/neon-CJzQSycr.mjs +52 -0
- package/dist/node-tfv-3v0V.mjs +64 -0
- package/dist/operator-ai-logging-Ay7M4KWw.mjs +121 -0
- package/dist/operator-args-BiGmSlZx.mjs +722 -0
- package/dist/operator-auth-DdYZYEkO.mjs +47 -0
- package/dist/operator-client-DBujdELO.mjs +82 -0
- package/dist/operator-cmd-BsHKYJYt.mjs +1 -0
- package/dist/operator-cmd-DTIkOAnP.mjs +443 -0
- package/dist/output-Bb34lF0w.mjs +173 -0
- package/dist/output-CVolXKC1.mjs +1 -0
- package/dist/package-BX_giUBX.mjs +1444 -0
- package/dist/package-json-DvS6IFRv.mjs +43 -0
- package/dist/pg-DoyPxa_X.mjs +15 -0
- package/dist/picocolors-D1NxSLw-.mjs +71 -0
- package/dist/plan-BHNt1QhK.mjs +1 -0
- package/dist/plan-DX4_-OM5.mjs +58 -0
- package/dist/platform-args-C-DyuCNX.mjs +1 -0
- package/dist/platform-args-CyeQWaZ7.mjs +538 -0
- package/dist/platform-auth-config-BfXqKSyZ.mjs +371 -0
- package/dist/platform-auth-protection-5FR6qoP_.mjs +231 -0
- package/dist/platform-auth-recovery-B5ZlqA8K.mjs +309 -0
- package/dist/platform-cmd-CcFDxtrl.mjs +1 -0
- package/dist/platform-cmd-ChXeBrRH.mjs +193 -0
- package/dist/platform-discovery-Bxg9aZXU.mjs +40 -0
- package/dist/platform-domain-CwatS3cz.mjs +256 -0
- package/dist/platform-lifecycle-0cXTmMsh.mjs +8928 -0
- package/dist/platform-lifecycle-BcoBAMux.mjs +1 -0
- package/dist/platform-management-6Wbdbob5.mjs +1607 -0
- package/dist/platform-management-hhnczOzr.mjs +1 -0
- package/dist/platform-plans-config-CkbUKFpm.mjs +447 -0
- package/dist/platform-recovery-DgIwlqB-.mjs +96 -0
- package/dist/platform-registry-x1m9HBxf.mjs +450 -0
- package/dist/platform-runtime-logs-kkoiYFpF.mjs +72 -0
- package/dist/platform-setup-DX8y_6Kh.mjs +306 -0
- package/dist/prepare-B9mB47T5.mjs +84 -0
- package/dist/prepare-DNIq07so.mjs +13 -0
- package/dist/prepare-LHkyJqxi.mjs +1 -0
- package/dist/project-CC7eN00D.mjs +141 -0
- package/dist/project-DcSd4BeI.mjs +1 -0
- package/dist/project-cmd-BydRwr-x.mjs +109 -0
- package/dist/project-paths-iXHKRTTQ.mjs +159 -0
- package/dist/project-slug-BUy0lmyR.mjs +1 -0
- package/dist/project-slug-CO6ci9XG.mjs +7 -0
- package/dist/project-team-CvdLhDF2.mjs +129 -0
- package/dist/project-token-CwZdUEGu.mjs +70 -0
- package/dist/project-tsconfig-P9X952KG.mjs +98 -0
- package/dist/project-zero-trust-CKDoPdN1.mjs +64 -0
- package/dist/providers-Cd3c7wi0.mjs +64 -0
- package/dist/providers-Df69hb_X.d.mts +5 -0
- package/dist/provision-BA59NCPO.mjs +1 -0
- package/dist/provision-C90fULHJ.mjs +1814 -0
- package/dist/queues-Bc3FsBQT.d.mts +5 -0
- package/dist/r2-conditions-DSLmkiR5.mjs +60 -0
- package/dist/requests-DNhfyF3l.mjs +52 -0
- package/dist/resolve-project-BCsAMDRA.mjs +47 -0
- package/dist/resolve-project-DhU9_lIo.mjs +1 -0
- package/dist/resource-name-DlJ9QXzg.mjs +10 -0
- package/dist/response-HmNjB30w.mjs +29 -0
- package/dist/rollback-wi6WK5T6.mjs +150 -0
- package/dist/rolldown-runtime-uD8oG6U2.mjs +24 -0
- package/dist/route-types-CRWhr93D.mjs +592 -0
- package/dist/route-url-BIDZT78M.mjs +58 -0
- package/dist/route-url-Bla3Upsy.d.mts +42 -0
- package/dist/routes-stub.d.mts +24 -0
- package/dist/routes-stub.mjs +1 -0
- package/dist/routing-assets-CSheDWWM.mjs +54 -0
- package/dist/rpc-DcByS_q0.d.mts +39 -0
- package/dist/rpc-DtxIN9Tv.mjs +19 -0
- package/dist/runner-CPerdjIl.mjs +163 -0
- package/dist/runner-CUNtS5x7.mjs +1 -0
- package/dist/runner-mysql-BjSoQ-mW.mjs +1 -0
- package/dist/runner-mysql-BmTI2EiF.mjs +145 -0
- package/dist/runner-pg-2pjltt0t.mjs +1 -0
- package/dist/runner-pg-mYc75KfH.mjs +61 -0
- package/dist/runtime/ai.d.mts +50 -0
- package/dist/runtime/ai.mjs +455 -0
- package/dist/runtime/auth-client-react.d.mts +2 -0
- package/dist/runtime/auth-client-react.mjs +1 -0
- package/dist/runtime/auth-client.d.mts +2 -0
- package/dist/runtime/auth-client.mjs +1 -0
- package/dist/runtime/auth.d.mts +2 -0
- package/dist/runtime/auth.mjs +1 -0
- package/dist/runtime/better-auth-mysql.d.mts +5 -0
- package/dist/runtime/better-auth-mysql.mjs +21 -0
- package/dist/runtime/better-auth-pg.d.mts +5 -0
- package/dist/runtime/better-auth-pg.mjs +21 -0
- package/dist/runtime/better-auth.d.mts +6 -0
- package/dist/runtime/better-auth.mjs +22 -0
- package/dist/runtime/client-react.d.mts +5 -0
- package/dist/runtime/client-react.mjs +5 -0
- package/dist/runtime/client.d.mts +5 -0
- package/dist/runtime/client.mjs +5 -0
- package/dist/runtime/db-mysql.d.mts +2 -0
- package/dist/runtime/db-mysql.mjs +1 -0
- package/dist/runtime/db-pg.d.mts +2 -0
- package/dist/runtime/db-pg.mjs +1 -0
- package/dist/runtime/db.d.mts +17 -0
- package/dist/runtime/db.mjs +36 -0
- package/dist/runtime/drizzle-arktype.d.mts +1 -0
- package/dist/runtime/drizzle-arktype.mjs +2 -0
- package/dist/runtime/drizzle-valibot.d.mts +1 -0
- package/dist/runtime/drizzle-valibot.mjs +2 -0
- package/dist/runtime/drizzle-zod.d.mts +1 -0
- package/dist/runtime/drizzle-zod.mjs +2 -0
- package/dist/runtime/durable.d.mts +64 -0
- package/dist/runtime/durable.mjs +165 -0
- package/dist/runtime/email/testing.d.mts +108 -0
- package/dist/runtime/email/testing.mjs +268 -0
- package/dist/runtime/email-protocol.d.mts +25 -0
- package/dist/runtime/email-protocol.mjs +1 -0
- package/dist/runtime/email.d.mts +26 -0
- package/dist/runtime/email.mjs +524 -0
- package/dist/runtime/env-public-client.d.mts +19 -0
- package/dist/runtime/env-public-client.mjs +55 -0
- package/dist/runtime/env-public.d.mts +4 -0
- package/dist/runtime/env-public.mjs +277 -0
- package/dist/runtime/env.d.mts +12 -0
- package/dist/runtime/env.mjs +1 -0
- package/dist/runtime/fetch-server.d.mts +6 -0
- package/dist/runtime/fetch-server.mjs +29 -0
- package/dist/runtime/fetch-stream.d.mts +3 -0
- package/dist/runtime/fetch-stream.mjs +3 -0
- package/dist/runtime/fetch.d.mts +2 -0
- package/dist/runtime/fetch.mjs +3 -0
- package/dist/runtime/handler.d.mts +3 -0
- package/dist/runtime/handler.mjs +1 -0
- package/dist/runtime/kv.d.mts +45 -0
- package/dist/runtime/kv.mjs +103 -0
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +1 -0
- package/dist/runtime/live-client.d.mts +40 -0
- package/dist/runtime/live-client.mjs +282 -0
- package/dist/runtime/live-server.d.mts +11 -0
- package/dist/runtime/live-server.mjs +419 -0
- package/dist/runtime/live.d.mts +3 -0
- package/dist/runtime/live.mjs +1 -0
- package/dist/runtime/log.d.mts +24 -0
- package/dist/runtime/log.mjs +57 -0
- package/dist/runtime/migration-handler-mysql.d.mts +2 -0
- package/dist/runtime/migration-handler-mysql.mjs +111 -0
- package/dist/runtime/migration-handler-pg.d.mts +2 -0
- package/dist/runtime/migration-handler-pg.mjs +94 -0
- package/dist/runtime/migration-handler.d.mts +2 -0
- package/dist/runtime/migration-handler.mjs +1 -0
- package/dist/runtime/procedure.d.mts +27 -0
- package/dist/runtime/procedure.mjs +36 -0
- package/dist/runtime/procedures.d.mts +24 -0
- package/dist/runtime/procedures.mjs +56 -0
- package/dist/runtime/queues.d.mts +2 -0
- package/dist/runtime/queues.mjs +8 -0
- package/dist/runtime/remote/binding-handler.d.mts +11 -0
- package/dist/runtime/remote/binding-handler.mjs +227 -0
- package/dist/runtime/remote/index.d.mts +12 -0
- package/dist/runtime/remote/index.mjs +467 -0
- package/dist/runtime/response.d.mts +11 -0
- package/dist/runtime/response.mjs +1 -0
- package/dist/runtime/route-url.d.mts +2 -0
- package/dist/runtime/route-url.mjs +1 -0
- package/dist/runtime/routing.d.mts +53 -0
- package/dist/runtime/routing.mjs +425 -0
- package/dist/runtime/rpc-react.d.mts +16 -0
- package/dist/runtime/rpc-react.mjs +50 -0
- package/dist/runtime/rpc.d.mts +2 -0
- package/dist/runtime/rpc.mjs +1 -0
- package/dist/runtime/sandbox-container.d.mts +3 -0
- package/dist/runtime/sandbox-container.mjs +1 -0
- package/dist/runtime/sandbox.d.mts +5 -0
- package/dist/runtime/sandbox.mjs +196 -0
- package/dist/runtime/schema-d1.d.mts +1 -0
- package/dist/runtime/schema-d1.mjs +2 -0
- package/dist/runtime/schema-mysql.d.mts +1 -0
- package/dist/runtime/schema-mysql.mjs +2 -0
- package/dist/runtime/schema-pg.d.mts +1 -0
- package/dist/runtime/schema-pg.mjs +2 -0
- package/dist/runtime/seed.d.mts +34 -0
- package/dist/runtime/seed.mjs +5 -0
- package/dist/runtime/sse-client.d.mts +31 -0
- package/dist/runtime/sse-client.mjs +42 -0
- package/dist/runtime/sse.d.mts +32 -0
- package/dist/runtime/sse.mjs +1 -0
- package/dist/runtime/storage.d.mts +4 -0
- package/dist/runtime/storage.mjs +13 -0
- package/dist/runtime/validator.d.mts +2 -0
- package/dist/runtime/validator.mjs +1 -0
- package/dist/runtime/ws-server.d.mts +26 -0
- package/dist/runtime/ws-server.mjs +297 -0
- package/dist/runtime/ws.d.mts +2 -0
- package/dist/runtime/ws.mjs +108 -0
- package/dist/sandbox-CWDjoEG2.d.mts +50 -0
- package/dist/sandbox-container-BqamdFCx.d.mts +73 -0
- package/dist/sandbox-container-d1AHLpgn.mjs +291 -0
- package/dist/secret-D5XrWshs.mjs +146 -0
- package/dist/skills-Dr3AjuBF.mjs +63 -0
- package/dist/sqlite-validation-CLJXXN93.mjs +24 -0
- package/dist/sse-CxR30yMF.mjs +174 -0
- package/dist/standard-schema-CuDawHOC.d.mts +40 -0
- package/dist/static-asset-marker-mWMX2dLa.mjs +38 -0
- package/dist/subcommand-prompt-B9yUo--u.mjs +370 -0
- package/dist/terminal-log-text-DNsWJREL.mjs +31 -0
- package/dist/types-D7-4tBu7.d.mts +1 -0
- package/dist/untrusted-env-lL7RkYiC.mjs +50 -0
- package/dist/validate-B-zsjhiz.mjs +162 -0
- package/dist/validate-DbqGdPPY.mjs +1 -0
- package/dist/validator-8-NZs2Xr.mjs +168 -0
- package/dist/version-metadata-DPhqnpaa.mjs +23 -0
- package/dist/wrangler-C3uyPadQ.mjs +1 -0
- package/dist/wrangler-TqTvJFWS.mjs +1452 -0
- package/dist/ws-DZRiIpYw.d.mts +137 -0
- package/dist/yarn-pnp-DgWbE7z5.mjs +91 -0
- package/docs/guide/ai.md +273 -0
- package/docs/guide/app-types.md +101 -0
- package/docs/guide/auth.md +255 -0
- package/docs/guide/database/d1.md +86 -0
- package/docs/guide/database/mysql.md +72 -0
- package/docs/guide/database/postgresql.md +94 -0
- package/docs/guide/database.md +454 -0
- package/docs/guide/deployment.md +124 -0
- package/docs/guide/durable-state.md +192 -0
- package/docs/guide/edge/headers.md +47 -0
- package/docs/guide/edge/redirects.md +85 -0
- package/docs/guide/edge/rewrites.md +119 -0
- package/docs/guide/edge/static-assets.md +94 -0
- package/docs/guide/email/domains.md +119 -0
- package/docs/guide/email/receiving.md +142 -0
- package/docs/guide/email/sending.md +262 -0
- package/docs/guide/email.md +23 -0
- package/docs/guide/env-vars.md +115 -0
- package/docs/guide/index.md +37 -0
- package/docs/guide/jobs.md +80 -0
- package/docs/guide/kv.md +100 -0
- package/docs/guide/live.md +181 -0
- package/docs/guide/platform/administration/access.md +165 -0
- package/docs/guide/platform/administration/connected-apps.md +84 -0
- package/docs/guide/platform/administration/email.md +169 -0
- package/docs/guide/platform/administration/operations.md +100 -0
- package/docs/guide/platform/administration/plans.md +156 -0
- package/docs/guide/platform/administration/projects.md +74 -0
- package/docs/guide/platform/administration/zero-trust.md +205 -0
- package/docs/guide/platform/development/local.md +122 -0
- package/docs/guide/platform/development/runtime.md +115 -0
- package/docs/guide/platform/development/schema-ci.md +44 -0
- package/docs/guide/platform/installation/ci.md +62 -0
- package/docs/guide/platform/installation/credentials.md +140 -0
- package/docs/guide/platform/installation/domains.md +120 -0
- package/docs/guide/platform/installation/first-deployment.md +95 -0
- package/docs/guide/platform/installation/maintenance.md +250 -0
- package/docs/guide/platform/installation/prerequisites.md +176 -0
- package/docs/guide/platform/installation/setup.md +300 -0
- package/docs/guide/platform/installation/uninstall.md +110 -0
- package/docs/guide/platform-administration.md +19 -0
- package/docs/guide/platform-development.md +16 -0
- package/docs/guide/procedures.md +48 -0
- package/docs/guide/project-collaboration.md +99 -0
- package/docs/guide/queues.md +149 -0
- package/docs/guide/quickstart.md +129 -0
- package/docs/guide/remote-dev.md +67 -0
- package/docs/guide/sandboxes.md +134 -0
- package/docs/guide/self-hosted-platform.md +45 -0
- package/docs/guide/server-routing.md +283 -0
- package/docs/guide/sse.md +174 -0
- package/docs/guide/storage.md +82 -0
- package/docs/guide/testing.md +64 -0
- package/docs/guide/type-safety.md +270 -0
- package/docs/guide/typed-fetch.md +98 -0
- package/docs/guide/websockets.md +230 -0
- package/docs/index.md +102 -0
- package/docs/integrations/agents.md +38 -0
- package/docs/integrations/cloudflare.md +241 -0
- package/docs/integrations/hono.md +127 -0
- package/docs/reference/api/auth.md +195 -0
- package/docs/reference/api/client.md +90 -0
- package/docs/reference/api/database.md +118 -0
- package/docs/reference/api/deploy.md +63 -0
- package/docs/reference/api/durable.md +47 -0
- package/docs/reference/api/env.md +51 -0
- package/docs/reference/api/handlers.md +189 -0
- package/docs/reference/api/plugin.md +40 -0
- package/docs/reference/api/resources.md +116 -0
- package/docs/reference/api/rewrites.md +111 -0
- package/docs/reference/api/types.md +126 -0
- package/docs/reference/api.md +71 -0
- package/docs/reference/cli/auth.md +87 -0
- package/docs/reference/cli/database.md +159 -0
- package/docs/reference/cli/deploy.md +117 -0
- package/docs/reference/cli/domains.md +42 -0
- package/docs/reference/cli/email.md +145 -0
- package/docs/reference/cli/generate.md +113 -0
- package/docs/reference/cli/github.md +181 -0
- package/docs/reference/cli/platform-config.md +93 -0
- package/docs/reference/cli/platform-email.md +81 -0
- package/docs/reference/cli/platform-installation.md +166 -0
- package/docs/reference/cli/platform-operations.md +90 -0
- package/docs/reference/cli/platform-users.md +159 -0
- package/docs/reference/cli/platform-zero-trust.md +60 -0
- package/docs/reference/cli/platform.md +78 -0
- package/docs/reference/cli/project.md +208 -0
- package/docs/reference/cli/secrets.md +79 -0
- package/docs/reference/cli/setup.md +88 -0
- package/docs/reference/cli.md +115 -0
- package/docs/reference/config.md +478 -0
- package/docs/reference/resource-inference.md +72 -0
- package/docs/reference/structure.md +138 -0
- package/package.json +389 -3
- package/sandbox.Dockerfile +4 -0
- package/schema.json +353 -0
- package/skills/bwf/SKILL.md +100 -0
- package/skills/migrate-vite-cloudflare-to-bwf/SKILL.md +53 -0
- package/templates/assets/bwf.svg +5 -0
- package/templates/assets/icons.svg +49 -0
- package/templates/assets/react.svg +1 -0
- package/templates/assets/stack.svg +35 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// ../../node_modules/.pnpm/ofetch@2.0.0-alpha.3/node_modules/ofetch/dist/index.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Joins the given base URL and path, ensuring that there is only one slash between them.
|
|
4
|
+
*/
|
|
5
|
+
function joinURL(base, path) {
|
|
6
|
+
if (!base || base === "/") return path || "/";
|
|
7
|
+
if (!path || path === "/") return base || "/";
|
|
8
|
+
const baseHasTrailing = base[base.length - 1] === "/";
|
|
9
|
+
const pathHasLeading = path[0] === "/";
|
|
10
|
+
if (baseHasTrailing && pathHasLeading) return base + path.slice(1);
|
|
11
|
+
if (!baseHasTrailing && !pathHasLeading) return `${base}/${path}`;
|
|
12
|
+
return base + path;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Adds the base path to the input path, if it is not already present.
|
|
16
|
+
*/
|
|
17
|
+
function withBase(input = "", base = "") {
|
|
18
|
+
if (!base || base === "/") return input;
|
|
19
|
+
const _base = withoutTrailingSlash(base);
|
|
20
|
+
if (input.startsWith(_base)) return input;
|
|
21
|
+
return joinURL(_base, input);
|
|
22
|
+
}
|
|
23
|
+
function withoutTrailingSlash(path) {
|
|
24
|
+
if (!path || path === "/") return "/";
|
|
25
|
+
return path[path.length - 1] === "/" ? path.slice(0, -1) : path;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the URL with the given query parameters. If a query parameter is undefined, it is omitted.
|
|
29
|
+
*/
|
|
30
|
+
function withQuery(input, query) {
|
|
31
|
+
if (!query || Object.keys(query).length === 0) return input;
|
|
32
|
+
const searchIndex = input.indexOf("?");
|
|
33
|
+
if (searchIndex === -1) {
|
|
34
|
+
const normalizedQuery = Object.entries(query).filter(([, value]) => value !== void 0).flatMap(([key, value]) => {
|
|
35
|
+
if (Array.isArray(value)) return value.map((item) => [key, normalizeQueryValue(item)]);
|
|
36
|
+
return [[key, normalizeQueryValue(value)]];
|
|
37
|
+
});
|
|
38
|
+
const queryString$1 = new URLSearchParams(normalizedQuery).toString();
|
|
39
|
+
return queryString$1 ? `${input}?${queryString$1}` : input;
|
|
40
|
+
}
|
|
41
|
+
const searchParams = new URLSearchParams(input.slice(searchIndex + 1));
|
|
42
|
+
const base = input.slice(0, searchIndex);
|
|
43
|
+
for (const [key, value] of Object.entries(query)) if (value === void 0) searchParams.delete(key);
|
|
44
|
+
else if (Array.isArray(value)) for (const item of value) searchParams.append(key, normalizeQueryValue(item));
|
|
45
|
+
else searchParams.set(key, normalizeQueryValue(value));
|
|
46
|
+
const queryString = searchParams.toString();
|
|
47
|
+
return queryString ? `${base}?${queryString}` : base;
|
|
48
|
+
}
|
|
49
|
+
function normalizeQueryValue(value) {
|
|
50
|
+
if (value === null) return "";
|
|
51
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
52
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
53
|
+
return String(value);
|
|
54
|
+
}
|
|
55
|
+
var FetchError$1 = class extends Error {
|
|
56
|
+
constructor(message, opts) {
|
|
57
|
+
super(message, opts);
|
|
58
|
+
this.name = "FetchError";
|
|
59
|
+
if (opts?.cause && !this.cause) this.cause = opts.cause;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function createFetchError(ctx) {
|
|
63
|
+
const errorMessage = ctx.error?.message || ctx.error?.toString() || "";
|
|
64
|
+
const method = ctx.request?.method || ctx.options?.method || "GET";
|
|
65
|
+
const url = ctx.request?.url || String(ctx.request) || "/";
|
|
66
|
+
const fetchError = new FetchError$1(`${`[${method}] ${JSON.stringify(url)}`}: ${ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>"}${errorMessage ? ` ${errorMessage}` : ""}`, ctx.error ? { cause: ctx.error } : void 0);
|
|
67
|
+
for (const key of [
|
|
68
|
+
"request",
|
|
69
|
+
"options",
|
|
70
|
+
"response"
|
|
71
|
+
]) Object.defineProperty(fetchError, key, { get() {
|
|
72
|
+
return ctx[key];
|
|
73
|
+
} });
|
|
74
|
+
for (const [key, refKey] of [
|
|
75
|
+
["data", "_data"],
|
|
76
|
+
["status", "status"],
|
|
77
|
+
["statusCode", "status"],
|
|
78
|
+
["statusText", "statusText"],
|
|
79
|
+
["statusMessage", "statusText"]
|
|
80
|
+
]) Object.defineProperty(fetchError, key, { get() {
|
|
81
|
+
return ctx.response && ctx.response[refKey];
|
|
82
|
+
} });
|
|
83
|
+
return fetchError;
|
|
84
|
+
}
|
|
85
|
+
const payloadMethods = new Set(Object.freeze([
|
|
86
|
+
"PATCH",
|
|
87
|
+
"POST",
|
|
88
|
+
"PUT",
|
|
89
|
+
"DELETE"
|
|
90
|
+
]));
|
|
91
|
+
function isPayloadMethod(method = "GET") {
|
|
92
|
+
return payloadMethods.has(method.toUpperCase());
|
|
93
|
+
}
|
|
94
|
+
function isJSONSerializable(value) {
|
|
95
|
+
if (value === void 0) return false;
|
|
96
|
+
const t = typeof value;
|
|
97
|
+
if (t === "string" || t === "number" || t === "boolean" || t === null) return true;
|
|
98
|
+
if (t !== "object") return false;
|
|
99
|
+
if (Array.isArray(value)) return true;
|
|
100
|
+
if (value.buffer) return false;
|
|
101
|
+
if (value instanceof FormData || value instanceof URLSearchParams) return false;
|
|
102
|
+
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
|
|
103
|
+
}
|
|
104
|
+
const textTypes = /* @__PURE__ */ new Set([
|
|
105
|
+
"image/svg",
|
|
106
|
+
"application/xml",
|
|
107
|
+
"application/xhtml",
|
|
108
|
+
"application/html"
|
|
109
|
+
]);
|
|
110
|
+
const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
|
|
111
|
+
function detectResponseType(_contentType = "") {
|
|
112
|
+
if (!_contentType) return "json";
|
|
113
|
+
const contentType = _contentType.split(";").shift() || "";
|
|
114
|
+
if (JSON_RE.test(contentType)) return "json";
|
|
115
|
+
if (contentType === "text/event-stream") return "stream";
|
|
116
|
+
if (textTypes.has(contentType) || contentType.startsWith("text/")) return "text";
|
|
117
|
+
return "blob";
|
|
118
|
+
}
|
|
119
|
+
function resolveFetchOptions(request, input, defaults, Headers$1) {
|
|
120
|
+
const headers = mergeHeaders(input?.headers ?? request?.headers, defaults?.headers, Headers$1);
|
|
121
|
+
let query;
|
|
122
|
+
if (defaults?.query || defaults?.params || input?.params || input?.query) query = {
|
|
123
|
+
...defaults?.params,
|
|
124
|
+
...defaults?.query,
|
|
125
|
+
...input?.params,
|
|
126
|
+
...input?.query
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
...defaults,
|
|
130
|
+
...input,
|
|
131
|
+
query,
|
|
132
|
+
params: query,
|
|
133
|
+
headers
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function mergeHeaders(input, defaults, Headers$1) {
|
|
137
|
+
if (!defaults) return new Headers$1(input);
|
|
138
|
+
const headers = new Headers$1(defaults);
|
|
139
|
+
if (input) for (const [key, value] of Symbol.iterator in input || Array.isArray(input) ? input : new Headers$1(input)) headers.set(key, value);
|
|
140
|
+
return headers;
|
|
141
|
+
}
|
|
142
|
+
async function callHooks(context, hooks) {
|
|
143
|
+
if (hooks) if (Array.isArray(hooks)) for (const hook of hooks) await hook(context);
|
|
144
|
+
else await hooks(context);
|
|
145
|
+
}
|
|
146
|
+
const retryStatusCodes = /* @__PURE__ */ new Set([
|
|
147
|
+
408,
|
|
148
|
+
409,
|
|
149
|
+
425,
|
|
150
|
+
429,
|
|
151
|
+
500,
|
|
152
|
+
502,
|
|
153
|
+
503,
|
|
154
|
+
504
|
|
155
|
+
]);
|
|
156
|
+
const nullBodyResponses = /* @__PURE__ */ new Set([
|
|
157
|
+
101,
|
|
158
|
+
204,
|
|
159
|
+
205,
|
|
160
|
+
304
|
|
161
|
+
]);
|
|
162
|
+
function createFetch(globalOptions = {}) {
|
|
163
|
+
const { fetch: fetch$1 = globalThis.fetch } = globalOptions;
|
|
164
|
+
async function onError(context) {
|
|
165
|
+
const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false;
|
|
166
|
+
if (context.options.retry !== false && !isAbort) {
|
|
167
|
+
let retries;
|
|
168
|
+
if (typeof context.options.retry === "number") retries = context.options.retry;
|
|
169
|
+
else retries = isPayloadMethod(context.options.method) ? 0 : 1;
|
|
170
|
+
const responseCode = context.response && context.response.status || 500;
|
|
171
|
+
if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) {
|
|
172
|
+
const retryDelay = typeof context.options.retryDelay === "function" ? context.options.retryDelay(context) : context.options.retryDelay || 0;
|
|
173
|
+
if (retryDelay > 0) await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
174
|
+
return $fetchRaw(context.request, {
|
|
175
|
+
...context.options,
|
|
176
|
+
retry: retries - 1
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const error = createFetchError(context);
|
|
181
|
+
if (Error.captureStackTrace) Error.captureStackTrace(error, $fetchRaw);
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
const $fetchRaw = async function $fetchRaw$1(_request, _options = {}) {
|
|
185
|
+
const context = {
|
|
186
|
+
request: _request,
|
|
187
|
+
options: resolveFetchOptions(_request, _options, globalOptions.defaults, Headers),
|
|
188
|
+
response: void 0,
|
|
189
|
+
error: void 0
|
|
190
|
+
};
|
|
191
|
+
if (context.options.method) context.options.method = context.options.method.toUpperCase();
|
|
192
|
+
if (context.options.onRequest) await callHooks(context, context.options.onRequest);
|
|
193
|
+
if (typeof context.request === "string") {
|
|
194
|
+
if (context.options.baseURL) context.request = withBase(context.request, context.options.baseURL);
|
|
195
|
+
if (context.options.query) {
|
|
196
|
+
context.request = withQuery(context.request, context.options.query);
|
|
197
|
+
delete context.options.query;
|
|
198
|
+
}
|
|
199
|
+
if ("query" in context.options) delete context.options.query;
|
|
200
|
+
if ("params" in context.options) delete context.options.params;
|
|
201
|
+
}
|
|
202
|
+
if (context.options.body && isPayloadMethod(context.options.method)) {
|
|
203
|
+
if (isJSONSerializable(context.options.body)) {
|
|
204
|
+
const contentType = context.options.headers.get("content-type");
|
|
205
|
+
if (typeof context.options.body !== "string") context.options.body = contentType === "application/x-www-form-urlencoded" ? new URLSearchParams(context.options.body).toString() : JSON.stringify(context.options.body);
|
|
206
|
+
context.options.headers = new Headers(context.options.headers || {});
|
|
207
|
+
if (!contentType) context.options.headers.set("content-type", "application/json");
|
|
208
|
+
if (!context.options.headers.has("accept")) context.options.headers.set("accept", "application/json");
|
|
209
|
+
} else if ("pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || typeof context.options.body.pipe === "function") {
|
|
210
|
+
if (!("duplex" in context.options)) context.options.duplex = "half";
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (context.options.timeout) context.options.signal = context.options.signal ? AbortSignal.any([AbortSignal.timeout(context.options.timeout), context.options.signal]) : AbortSignal.timeout(context.options.timeout);
|
|
214
|
+
try {
|
|
215
|
+
context.response = await fetch$1(context.request, context.options);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
context.error = error;
|
|
218
|
+
if (context.options.onRequestError) await callHooks(context, context.options.onRequestError);
|
|
219
|
+
return await onError(context);
|
|
220
|
+
}
|
|
221
|
+
if ((context.response.body || context.response._bodyInit) && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD") {
|
|
222
|
+
const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || "");
|
|
223
|
+
switch (responseType) {
|
|
224
|
+
case "json": {
|
|
225
|
+
const data = await context.response.text();
|
|
226
|
+
if (data) {
|
|
227
|
+
const parseFunction = context.options.parseResponse || JSON.parse;
|
|
228
|
+
context.response._data = parseFunction(data);
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case "stream":
|
|
233
|
+
context.response._data = context.response.body || context.response._bodyInit;
|
|
234
|
+
break;
|
|
235
|
+
default: context.response._data = await context.response[responseType]();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (context.options.onResponse) await callHooks(context, context.options.onResponse);
|
|
239
|
+
if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) {
|
|
240
|
+
if (context.options.onResponseError) await callHooks(context, context.options.onResponseError);
|
|
241
|
+
return await onError(context);
|
|
242
|
+
}
|
|
243
|
+
return context.response;
|
|
244
|
+
};
|
|
245
|
+
const $fetch$1 = async function $fetch$2(request, options) {
|
|
246
|
+
return (await $fetchRaw(request, options))._data;
|
|
247
|
+
};
|
|
248
|
+
$fetch$1.raw = $fetchRaw;
|
|
249
|
+
$fetch$1.native = (...args) => fetch$1(...args);
|
|
250
|
+
$fetch$1.create = (defaultOptions = {}, customGlobalOptions = {}) => createFetch({
|
|
251
|
+
...globalOptions,
|
|
252
|
+
...customGlobalOptions,
|
|
253
|
+
defaults: {
|
|
254
|
+
...globalOptions.defaults,
|
|
255
|
+
...customGlobalOptions.defaults,
|
|
256
|
+
...defaultOptions
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
return $fetch$1;
|
|
260
|
+
}
|
|
261
|
+
const ofetch = createFetch({ fetch: globalThis.fetch ? (...args) => globalThis.fetch(...args) : () => Promise.reject(/* @__PURE__ */ new Error("[ofetch] global.fetch is not supported!")) });
|
|
262
|
+
// src/runtime/fetch-error.ts
|
|
263
|
+
const FetchError = FetchError$1;
|
|
264
|
+
export { createFetch as n, ofetch as r, FetchError as t };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { r as ofetch, t as FetchError } from "./fetch-error-DmlRM6e4.mjs";
|
|
2
|
+
import { n as asUsageLimit, r as limitFromResponse } from "./limits-D27Lp6FP.mjs";
|
|
3
|
+
import { t as interpolateRouteParams } from "./route-url-BIDZT78M.mjs";
|
|
4
|
+
// src/runtime/fetch-stream.ts
|
|
5
|
+
/**
|
|
6
|
+
* Consume an SSE endpoint as an async generator of text chunks.
|
|
7
|
+
*
|
|
8
|
+
* Parses Workers AI SSE format (`data: {"response":"chunk"}` + `data: [DONE]`)
|
|
9
|
+
* and plain text SSE (`data: some text`).
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { fetchStream } from "@builtbyfriends/bwf/client";
|
|
13
|
+
*
|
|
14
|
+
* for await (const chunk of fetchStream("/api/ai/chat", {
|
|
15
|
+
* method: "POST",
|
|
16
|
+
* body: { messages: [{ role: "user", content: "Hello" }] },
|
|
17
|
+
* })) {
|
|
18
|
+
* output += chunk;
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @yields {string} Text chunks from SSE data frames.
|
|
23
|
+
*/
|
|
24
|
+
async function* fetchStream(path, options) {
|
|
25
|
+
const url = interpolateRouteParams(path, options?.params);
|
|
26
|
+
const body = (await ofetch.raw(url, {
|
|
27
|
+
method: options?.method ?? "POST",
|
|
28
|
+
body: options?.body,
|
|
29
|
+
query: options?.query,
|
|
30
|
+
headers: options?.headers,
|
|
31
|
+
signal: options?.signal,
|
|
32
|
+
baseURL: options?.baseURL,
|
|
33
|
+
responseType: "stream"
|
|
34
|
+
}).catch(async (error) => {
|
|
35
|
+
const response = error && typeof error === "object" && "response" in error ? error.response : null;
|
|
36
|
+
if (response instanceof Response) throw await limitFromResponse(response, "ai") ?? error;
|
|
37
|
+
throw error;
|
|
38
|
+
}))._data;
|
|
39
|
+
if (!body) return;
|
|
40
|
+
const reader = body.getReader();
|
|
41
|
+
const decoder = new TextDecoder();
|
|
42
|
+
let buffer = "";
|
|
43
|
+
let event = "";
|
|
44
|
+
const terminal = (data) => {
|
|
45
|
+
if (event !== "nosam:error" && event !== "nosam:limit") return;
|
|
46
|
+
let message = "Generation was interrupted.";
|
|
47
|
+
let limit = null;
|
|
48
|
+
try {
|
|
49
|
+
const body = JSON.parse(data);
|
|
50
|
+
if (event === "nosam:limit") limit = asUsageLimit(body);
|
|
51
|
+
if (typeof body.message === "string") message = body.message;
|
|
52
|
+
} catch {}
|
|
53
|
+
throw limit ?? new FetchError(message);
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
while (true) {
|
|
57
|
+
const { done, value } = await reader.read();
|
|
58
|
+
if (done) break;
|
|
59
|
+
buffer += decoder.decode(value, { stream: true });
|
|
60
|
+
const lines = buffer.split("\n");
|
|
61
|
+
buffer = lines.pop();
|
|
62
|
+
for (const line of lines) {
|
|
63
|
+
const trimmed = line.trim();
|
|
64
|
+
if (trimmed.startsWith("event:")) {
|
|
65
|
+
event = trimmed.slice(6).trim();
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (!trimmed) {
|
|
69
|
+
event = "";
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (trimmed.startsWith(":")) continue;
|
|
73
|
+
if (trimmed.startsWith("data: ")) {
|
|
74
|
+
const data = trimmed.slice(6);
|
|
75
|
+
terminal(data);
|
|
76
|
+
if (data === "[DONE]") return;
|
|
77
|
+
const chunk = chunkText(data);
|
|
78
|
+
if (chunk !== void 0) yield chunk;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const trimmed = buffer.trim();
|
|
83
|
+
if (trimmed.startsWith("data: ")) {
|
|
84
|
+
const data = trimmed.slice(6);
|
|
85
|
+
terminal(data);
|
|
86
|
+
const chunk = data === "[DONE]" ? void 0 : chunkText(data);
|
|
87
|
+
if (chunk !== void 0) yield chunk;
|
|
88
|
+
}
|
|
89
|
+
} finally {
|
|
90
|
+
reader.releaseLock();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Workers AI frames carry text in `response`; other JSON with that key (e.g. usage metadata) is skipped. */
|
|
94
|
+
function chunkText(data) {
|
|
95
|
+
try {
|
|
96
|
+
const parsed = JSON.parse(data);
|
|
97
|
+
if (typeof parsed.response === "string") return parsed.response;
|
|
98
|
+
if ("response" in parsed) return;
|
|
99
|
+
} catch {}
|
|
100
|
+
return data;
|
|
101
|
+
}
|
|
102
|
+
export { fetchStream as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { i as QueryOption, n as MethodsOf, r as ParamsOption, t as BodyOption } from "./fetch-CBgyyhzm.mjs";
|
|
2
|
+
import { RouteMap } from "@builtbyfriends/bwf/routes";
|
|
3
|
+
type InputOf<P extends keyof RouteMap, M extends MethodsOf<P>> = RouteMap[P][M] extends {
|
|
4
|
+
input: infer I;
|
|
5
|
+
} ? I : {};
|
|
6
|
+
type StreamOptions<P extends keyof RouteMap, M extends MethodsOf<P>> = BodyOption<InputOf<P, M>> & QueryOption<InputOf<P, M>> & ParamsOption<InputOf<P, M>> & {
|
|
7
|
+
method?: M;
|
|
8
|
+
headers?: HeadersInit;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
baseURL?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Consume an SSE endpoint as an async generator of text chunks.
|
|
14
|
+
*
|
|
15
|
+
* Parses Workers AI SSE format (`data: {"response":"chunk"}` + `data: [DONE]`)
|
|
16
|
+
* and plain text SSE (`data: some text`).
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { fetchStream } from "@builtbyfriends/bwf/client";
|
|
20
|
+
*
|
|
21
|
+
* for await (const chunk of fetchStream("/api/ai/chat", {
|
|
22
|
+
* method: "POST",
|
|
23
|
+
* body: { messages: [{ role: "user", content: "Hello" }] },
|
|
24
|
+
* })) {
|
|
25
|
+
* output += chunk;
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @yields {string} Text chunks from SSE data frames.
|
|
30
|
+
*/
|
|
31
|
+
declare function fetchStream<P extends keyof RouteMap & string, M extends MethodsOf<P> = "POST" extends MethodsOf<P> ? "POST" : MethodsOf<P>>(path: P, options?: StreamOptions<P, M>): AsyncGenerator<string, void, undefined>;
|
|
32
|
+
export { fetchStream as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { n as createFetch } from "./fetch-error-DmlRM6e4.mjs";
|
|
2
|
+
import { t as interpolateRouteParams } from "./route-url-BIDZT78M.mjs";
|
|
3
|
+
// src/runtime/fetch.ts
|
|
4
|
+
const browserFetch = createRouteFetch((...args) => globalThis.fetch(...args));
|
|
5
|
+
async function fetch(path, options) {
|
|
6
|
+
return browserFetch(path, options);
|
|
7
|
+
}
|
|
8
|
+
/** Apply the same route interpolation and request options to browser and server transports. */
|
|
9
|
+
function createRouteFetch(transport) {
|
|
10
|
+
const client = createFetch({ fetch: transport });
|
|
11
|
+
return async (path, options) => {
|
|
12
|
+
const url = interpolateRouteParams(path, options?.params);
|
|
13
|
+
return client(url, {
|
|
14
|
+
method: options?.method ?? "GET",
|
|
15
|
+
body: options?.body,
|
|
16
|
+
query: options?.query,
|
|
17
|
+
headers: options?.headers,
|
|
18
|
+
signal: options?.signal,
|
|
19
|
+
baseURL: options?.baseURL,
|
|
20
|
+
retry: options?.retry,
|
|
21
|
+
timeout: options?.timeout
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export { fetch as n, createRouteFetch as t };
|