@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,455 @@
|
|
|
1
|
+
import { t as cfAccessHeaders } from "../cf-access-CUP5L08W.mjs";
|
|
2
|
+
import { n as bytesToBase64 } from "../base64-ikl9yBy3.mjs";
|
|
3
|
+
import { i as getRawRuntimeEnv } from "../env-raw-Bo6TtrHU.mjs";
|
|
4
|
+
import { r as limitFromResponse, t as UsageLimit } from "../limits-D27Lp6FP.mjs";
|
|
5
|
+
// src/runtime/ai-types.ts
|
|
6
|
+
/** Maps provider prefix to expected env var name for the API key */
|
|
7
|
+
const PROVIDER_KEY_MAP = {
|
|
8
|
+
openai: "OPENAI_API_KEY",
|
|
9
|
+
anthropic: "ANTHROPIC_API_KEY",
|
|
10
|
+
"google-ai-studio": "GOOGLE_API_KEY",
|
|
11
|
+
groq: "GROQ_API_KEY",
|
|
12
|
+
mistral: "MISTRAL_API_KEY",
|
|
13
|
+
grok: "GROK_API_KEY",
|
|
14
|
+
deepseek: "DEEPSEEK_API_KEY",
|
|
15
|
+
openrouter: "OPENROUTER_API_KEY",
|
|
16
|
+
perplexity: "PERPLEXITY_API_KEY",
|
|
17
|
+
cohere: "COHERE_API_KEY",
|
|
18
|
+
cerebras: "CEREBRAS_API_KEY",
|
|
19
|
+
huggingface: "HUGGINGFACE_API_KEY",
|
|
20
|
+
replicate: "REPLICATE_API_KEY",
|
|
21
|
+
baseten: "BASETEN_API_KEY",
|
|
22
|
+
cartesia: "CARTESIA_API_KEY",
|
|
23
|
+
deepgram: "DEEPGRAM_API_KEY",
|
|
24
|
+
elevenlabs: "ELEVENLABS_API_KEY",
|
|
25
|
+
fal: "FAL_API_KEY",
|
|
26
|
+
ideogram: "IDEOGRAM_API_KEY",
|
|
27
|
+
parallel: "PARALLEL_API_KEY"
|
|
28
|
+
};
|
|
29
|
+
// src/runtime/ai.ts
|
|
30
|
+
const NOSAM_FILE_MARKER = "__nosamFile";
|
|
31
|
+
const PROVIDER_AUTH_DEFAULTS = {
|
|
32
|
+
"google-ai-studio": {
|
|
33
|
+
header: "x-goog-api-key",
|
|
34
|
+
prefix: ""
|
|
35
|
+
},
|
|
36
|
+
anthropic: {
|
|
37
|
+
header: "x-api-key",
|
|
38
|
+
prefix: ""
|
|
39
|
+
},
|
|
40
|
+
elevenlabs: {
|
|
41
|
+
header: "xi-api-key",
|
|
42
|
+
prefix: ""
|
|
43
|
+
},
|
|
44
|
+
deepgram: {
|
|
45
|
+
header: "authorization",
|
|
46
|
+
prefix: "Token "
|
|
47
|
+
},
|
|
48
|
+
fal: {
|
|
49
|
+
header: "authorization",
|
|
50
|
+
prefix: "Key "
|
|
51
|
+
},
|
|
52
|
+
cartesia: {
|
|
53
|
+
header: "x-api-key",
|
|
54
|
+
prefix: ""
|
|
55
|
+
},
|
|
56
|
+
baseten: {
|
|
57
|
+
header: "authorization",
|
|
58
|
+
prefix: "Api-Key "
|
|
59
|
+
},
|
|
60
|
+
ideogram: {
|
|
61
|
+
header: "Api-Key",
|
|
62
|
+
prefix: ""
|
|
63
|
+
},
|
|
64
|
+
parallel: {
|
|
65
|
+
header: "x-api-key",
|
|
66
|
+
prefix: ""
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
function hasStreamFlag(value) {
|
|
70
|
+
return typeof value === "object" && value !== null && "stream" in value;
|
|
71
|
+
}
|
|
72
|
+
function mediaTypeFromContentType(contentType) {
|
|
73
|
+
if (!contentType) return null;
|
|
74
|
+
const [mediaType] = contentType.split(";", 1);
|
|
75
|
+
return mediaType?.trim().toLowerCase() || null;
|
|
76
|
+
}
|
|
77
|
+
function isJsonMediaType(mediaType) {
|
|
78
|
+
if (mediaType === "application/json") return true;
|
|
79
|
+
const slash = mediaType?.indexOf("/") ?? -1;
|
|
80
|
+
return Boolean(mediaType && slash >= 0 && mediaType.slice(slash + 1).endsWith("+json"));
|
|
81
|
+
}
|
|
82
|
+
async function readProxyResult(response) {
|
|
83
|
+
if (isJsonMediaType(mediaTypeFromContentType(response.headers.get("content-type")))) return response.json();
|
|
84
|
+
return response.blob();
|
|
85
|
+
}
|
|
86
|
+
function hasResponseMethod(value) {
|
|
87
|
+
return typeof value === "object" && value !== null && "response" in value && typeof value.response === "function";
|
|
88
|
+
}
|
|
89
|
+
function isBinaryView(value) {
|
|
90
|
+
return ArrayBuffer.isView(value);
|
|
91
|
+
}
|
|
92
|
+
function copyBinaryView(value) {
|
|
93
|
+
const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
94
|
+
const copy = new Uint8Array(bytes.byteLength);
|
|
95
|
+
copy.set(bytes);
|
|
96
|
+
return copy.buffer;
|
|
97
|
+
}
|
|
98
|
+
function arrayBufferToBase64(buffer) {
|
|
99
|
+
return bytesToBase64(new Uint8Array(buffer));
|
|
100
|
+
}
|
|
101
|
+
function fileNameFromBlob(value) {
|
|
102
|
+
const name = value.name;
|
|
103
|
+
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
104
|
+
}
|
|
105
|
+
async function serializeFormData(form) {
|
|
106
|
+
const entries = [];
|
|
107
|
+
for (const [name, value] of form.entries()) {
|
|
108
|
+
if (typeof value === "string") {
|
|
109
|
+
entries.push({
|
|
110
|
+
name,
|
|
111
|
+
value
|
|
112
|
+
});
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
entries.push({
|
|
116
|
+
name,
|
|
117
|
+
value: {
|
|
118
|
+
[NOSAM_FILE_MARKER]: true,
|
|
119
|
+
data: arrayBufferToBase64(await value.arrayBuffer()),
|
|
120
|
+
name: fileNameFromBlob(value) ?? name,
|
|
121
|
+
type: value.type || void 0
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
type: "form",
|
|
127
|
+
entries
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
async function serializeProviderBody(body) {
|
|
131
|
+
if (body === void 0 || body === null) return { type: "none" };
|
|
132
|
+
if (typeof body === "string") return {
|
|
133
|
+
type: "text",
|
|
134
|
+
data: body
|
|
135
|
+
};
|
|
136
|
+
if (body instanceof URLSearchParams) return {
|
|
137
|
+
type: "text",
|
|
138
|
+
data: body.toString(),
|
|
139
|
+
contentType: "application/x-www-form-urlencoded;charset=UTF-8"
|
|
140
|
+
};
|
|
141
|
+
if (body instanceof FormData) return serializeFormData(body);
|
|
142
|
+
if (body instanceof Blob) return {
|
|
143
|
+
type: "base64",
|
|
144
|
+
data: arrayBufferToBase64(await body.arrayBuffer()),
|
|
145
|
+
contentType: body.type || void 0
|
|
146
|
+
};
|
|
147
|
+
if (body instanceof ArrayBuffer) return {
|
|
148
|
+
type: "base64",
|
|
149
|
+
data: arrayBufferToBase64(body)
|
|
150
|
+
};
|
|
151
|
+
if (isBinaryView(body)) return {
|
|
152
|
+
type: "base64",
|
|
153
|
+
data: arrayBufferToBase64(copyBinaryView(body))
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
type: "json",
|
|
157
|
+
value: body
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function headersToRecord(headers) {
|
|
161
|
+
if (!headers) return;
|
|
162
|
+
const result = {};
|
|
163
|
+
const normalized = new Headers(headers);
|
|
164
|
+
for (const [key, value] of normalized.entries()) result[key] = value;
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
async function responseFromResult(result) {
|
|
168
|
+
if (result instanceof Response) return result;
|
|
169
|
+
if (hasResponseMethod(result)) return result.response();
|
|
170
|
+
if (result instanceof Blob) return new Response(result, { headers: result.type ? { "content-type": result.type } : void 0 });
|
|
171
|
+
if (result instanceof ReadableStream) return new Response(result, { headers: { "content-type": "application/octet-stream" } });
|
|
172
|
+
if (result instanceof ArrayBuffer) return new Response(result, { headers: { "content-type": "application/octet-stream" } });
|
|
173
|
+
if (isBinaryView(result)) return new Response(copyBinaryView(result), { headers: { "content-type": "application/octet-stream" } });
|
|
174
|
+
return Response.json(result);
|
|
175
|
+
}
|
|
176
|
+
function imageRunOptions(options) {
|
|
177
|
+
if (typeof options !== "object" || options === null) return;
|
|
178
|
+
const { endpoint: _endpoint, ...runOptions } = options;
|
|
179
|
+
return Object.keys(runOptions).length > 0 ? runOptions : void 0;
|
|
180
|
+
}
|
|
181
|
+
function resolveProviderKey(provider, runtimeEnv, options) {
|
|
182
|
+
const envVar = options?.apiKeyEnv ?? PROVIDER_KEY_MAP[provider];
|
|
183
|
+
if (!envVar) throw new Error(`ai: Unknown provider '${provider}'. Use one of: ${Object.keys(PROVIDER_KEY_MAP).join(", ")}.`);
|
|
184
|
+
const key = runtimeEnv[envVar];
|
|
185
|
+
if (typeof key !== "string" || key.length === 0) throw new Error(`ai: Missing ${envVar} secret. Add it as a project secret for provider '${provider}'.`);
|
|
186
|
+
return key;
|
|
187
|
+
}
|
|
188
|
+
function getProxyUrl(runtimeEnv) {
|
|
189
|
+
const custom = runtimeEnv.__NOSAM_PROXY_URL;
|
|
190
|
+
if (typeof custom === "string" && custom.length > 0) return custom.replace(/\/+$/, "") + "/ai";
|
|
191
|
+
throw new Error("ai: No connected platform proxy is available. Run `bwf connect <url>` first.");
|
|
192
|
+
}
|
|
193
|
+
function providerAuthDefaults(provider) {
|
|
194
|
+
return PROVIDER_AUTH_DEFAULTS[provider] ?? {
|
|
195
|
+
header: "authorization",
|
|
196
|
+
prefix: "Bearer "
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function gatewayEndpointUrl(baseUrl, endpoint) {
|
|
200
|
+
return `${baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl}/${endpoint.startsWith("/") ? endpoint.slice(1) : endpoint}`;
|
|
201
|
+
}
|
|
202
|
+
function isUnsafeProviderPath(path) {
|
|
203
|
+
if (/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(path) || path.includes("\\")) return true;
|
|
204
|
+
const pathname = path.split(/[?#]/, 1)[0] ?? "";
|
|
205
|
+
for (const segment of pathname.split("/")) try {
|
|
206
|
+
if (decodeURIComponent(segment) === "..") return true;
|
|
207
|
+
} catch {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Build a real outgoing HTTP body for the user's own AI Gateway (self-host).
|
|
214
|
+
*
|
|
215
|
+
* Unlike `serializeProviderBody`/`providerRequestBody` (which build the proxy
|
|
216
|
+
* envelope decoded on the proxy side), this emits an actual `BodyInit` +
|
|
217
|
+
* content-type for a direct `fetch` to the gateway.
|
|
218
|
+
*/
|
|
219
|
+
function toDirectBody(body) {
|
|
220
|
+
if (body === void 0 || body === null) return { body: void 0 };
|
|
221
|
+
if (typeof body === "string") return { body };
|
|
222
|
+
if (body instanceof ReadableStream || body instanceof FormData || body instanceof URLSearchParams || body instanceof Blob || body instanceof ArrayBuffer || isBinaryView(body)) return { body };
|
|
223
|
+
return {
|
|
224
|
+
body: JSON.stringify(body),
|
|
225
|
+
contentType: "application/json"
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function resolveBackend() {
|
|
229
|
+
const runtimeEnv = getRawRuntimeEnv();
|
|
230
|
+
const proxy = runtimeEnv.__NOSAM_PROXY;
|
|
231
|
+
if (proxy) return makeServiceBindingBackend(proxy, runtimeEnv);
|
|
232
|
+
const token = runtimeEnv.__NOSAM_TOKEN;
|
|
233
|
+
const projectId = runtimeEnv.__NOSAM_PROJECT_ID;
|
|
234
|
+
if (typeof token === "string" && typeof projectId === "string") return makeHttpBackend(token, projectId, runtimeEnv);
|
|
235
|
+
const aiBindingName = typeof runtimeEnv.__NOSAM_AI_BINDING === "string" ? runtimeEnv.__NOSAM_AI_BINDING : "AI";
|
|
236
|
+
const directAi = runtimeEnv[aiBindingName];
|
|
237
|
+
if (directAi) return makeDirectBackend(directAi, runtimeEnv, runtimeEnv.__NOSAM_AI_GATEWAY);
|
|
238
|
+
throw new Error(`ai: Not available. Configure a Workers AI binding (env.${aiBindingName}) for direct Cloudflare development or deployment, or connect and link a bwf platform.`);
|
|
239
|
+
}
|
|
240
|
+
function unsupported(method) {
|
|
241
|
+
return () => {
|
|
242
|
+
throw new Error(`ai: ai.${method}() is not supported in this environment.`);
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
async function providerRequestBody(provider, path, init, options, runtimeEnv) {
|
|
246
|
+
return {
|
|
247
|
+
provider,
|
|
248
|
+
path,
|
|
249
|
+
method: init?.method,
|
|
250
|
+
headers: headersToRecord(init?.headers),
|
|
251
|
+
body: await serializeProviderBody(init?.body),
|
|
252
|
+
providerKey: resolveProviderKey(provider, runtimeEnv, options),
|
|
253
|
+
apiKeyHeader: options?.apiKeyHeader,
|
|
254
|
+
apiKeyPrefix: options?.apiKeyPrefix
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/** Backend for the bwf platform proxy, reached by service binding or HTTPS. */
|
|
258
|
+
function makeProxyBackend(send, runtimeEnv) {
|
|
259
|
+
async function proxyFetch(action, payload, options = {}) {
|
|
260
|
+
let signal;
|
|
261
|
+
if (typeof payload.options === "object" && payload.options !== null) {
|
|
262
|
+
const { signal: bindingSignal, ...wireOptions } = payload.options;
|
|
263
|
+
signal = bindingSignal;
|
|
264
|
+
payload = {
|
|
265
|
+
...payload,
|
|
266
|
+
options: wireOptions
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const res = await send(action, payload, signal);
|
|
270
|
+
const limit = await limitFromResponse(res, "ai");
|
|
271
|
+
if (limit) throw limit;
|
|
272
|
+
if (options.throwOnError !== false && !res.ok) {
|
|
273
|
+
const text = await res.text();
|
|
274
|
+
throw new Error(`ai: Proxy request failed with ${res.status}: '${text}'.`);
|
|
275
|
+
}
|
|
276
|
+
return res;
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
async run(model, inputs, options) {
|
|
280
|
+
const res = await proxyFetch("run", {
|
|
281
|
+
model,
|
|
282
|
+
inputs,
|
|
283
|
+
options
|
|
284
|
+
});
|
|
285
|
+
if (hasStreamFlag(inputs) && inputs.stream) return res.body;
|
|
286
|
+
return readProxyResult(res);
|
|
287
|
+
},
|
|
288
|
+
async image(model, inputs, options) {
|
|
289
|
+
return proxyFetch("run", {
|
|
290
|
+
model,
|
|
291
|
+
inputs,
|
|
292
|
+
options: imageRunOptions(options)
|
|
293
|
+
});
|
|
294
|
+
},
|
|
295
|
+
async providerFetch(provider, path, init, options) {
|
|
296
|
+
return proxyFetch("provider", await providerRequestBody(provider, path, init, options, runtimeEnv), { throwOnError: false });
|
|
297
|
+
},
|
|
298
|
+
async models(params) {
|
|
299
|
+
return (await proxyFetch("models", { inputs: params })).json();
|
|
300
|
+
},
|
|
301
|
+
async toMarkdown(items, options) {
|
|
302
|
+
return (await proxyFetch("toMarkdown", {
|
|
303
|
+
inputs: items,
|
|
304
|
+
options
|
|
305
|
+
})).json();
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function makeServiceBindingBackend(proxy, runtimeEnv) {
|
|
310
|
+
return makeProxyBackend((action, payload, signal) => proxy.fetch(`https://ai-proxy/ai/${action}`, {
|
|
311
|
+
method: "POST",
|
|
312
|
+
signal,
|
|
313
|
+
headers: { "content-type": "application/json" },
|
|
314
|
+
body: JSON.stringify({
|
|
315
|
+
action,
|
|
316
|
+
...payload,
|
|
317
|
+
projectId: runtimeEnv.__PROJECT_ID,
|
|
318
|
+
aiToken: runtimeEnv.__NOSAM_PROXY_TOKEN
|
|
319
|
+
})
|
|
320
|
+
}), runtimeEnv);
|
|
321
|
+
}
|
|
322
|
+
function makeHttpBackend(token, projectId, runtimeEnv) {
|
|
323
|
+
const base = getProxyUrl(runtimeEnv);
|
|
324
|
+
const headers = {
|
|
325
|
+
"content-type": "application/json",
|
|
326
|
+
authorization: `Bearer ${token}`,
|
|
327
|
+
...cfAccessHeaders(runtimeEnv, base)
|
|
328
|
+
};
|
|
329
|
+
return makeProxyBackend((action, payload, signal) => fetch(`${base}/${action}`, {
|
|
330
|
+
method: "POST",
|
|
331
|
+
signal,
|
|
332
|
+
headers,
|
|
333
|
+
body: JSON.stringify({
|
|
334
|
+
action,
|
|
335
|
+
...payload,
|
|
336
|
+
projectId
|
|
337
|
+
}),
|
|
338
|
+
redirect: "manual"
|
|
339
|
+
}), runtimeEnv);
|
|
340
|
+
}
|
|
341
|
+
function makeDirectBackend(directAi, runtimeEnv, gatewayId) {
|
|
342
|
+
const run = async (model, inputs, options) => {
|
|
343
|
+
const opts = options ?? {};
|
|
344
|
+
const response = await directAi.run(model, inputs, {
|
|
345
|
+
...opts,
|
|
346
|
+
returnRawResponse: true
|
|
347
|
+
});
|
|
348
|
+
if (!(response instanceof Response)) return response;
|
|
349
|
+
const limit = await limitFromResponse(response, "ai");
|
|
350
|
+
if (limit) throw limit;
|
|
351
|
+
if (opts.returnRawResponse || opts.websocket) return response;
|
|
352
|
+
if (!response.ok) throw new Error(`ai: Request failed with ${response.status}: '${await response.text()}'.`);
|
|
353
|
+
return isJsonMediaType(mediaTypeFromContentType(response.headers.get("content-type"))) ? response.json() : response.body;
|
|
354
|
+
};
|
|
355
|
+
return {
|
|
356
|
+
run,
|
|
357
|
+
async image(model, inputs, options) {
|
|
358
|
+
return responseFromResult(await run(model, inputs, imageRunOptions(options)));
|
|
359
|
+
},
|
|
360
|
+
async providerFetch(provider, path, init, options) {
|
|
361
|
+
if (!gatewayId) return Response.json({ error: "ai: ai.provider().fetch() needs an AI Gateway when self-hosting. Set `ai.gateway` in bwf.config.ts." }, { status: 501 });
|
|
362
|
+
if (isUnsafeProviderPath(path)) return Response.json({ error: `ai: provider path '${path}' must be relative.` }, { status: 400 });
|
|
363
|
+
let providerKey;
|
|
364
|
+
try {
|
|
365
|
+
providerKey = resolveProviderKey(provider, runtimeEnv, options);
|
|
366
|
+
} catch (e) {
|
|
367
|
+
return Response.json({ error: e.message }, { status: 400 });
|
|
368
|
+
}
|
|
369
|
+
let baseUrl;
|
|
370
|
+
try {
|
|
371
|
+
baseUrl = await directAi.gateway(gatewayId).getUrl(provider);
|
|
372
|
+
} catch (e) {
|
|
373
|
+
return Response.json({ error: `ai: gateway '${gatewayId}': ${e.message}` }, { status: 502 });
|
|
374
|
+
}
|
|
375
|
+
const { body, contentType } = toDirectBody(init?.body);
|
|
376
|
+
const headers = new Headers(init?.headers);
|
|
377
|
+
const defaults = providerAuthDefaults(provider);
|
|
378
|
+
headers.set(options?.apiKeyHeader ?? defaults.header, `${options?.apiKeyPrefix ?? defaults.prefix}${providerKey}`);
|
|
379
|
+
if (contentType && !headers.has("content-type")) headers.set("content-type", contentType);
|
|
380
|
+
return fetch(gatewayEndpointUrl(baseUrl, path), {
|
|
381
|
+
method: init?.method ?? "POST",
|
|
382
|
+
headers,
|
|
383
|
+
body
|
|
384
|
+
});
|
|
385
|
+
},
|
|
386
|
+
models: directAi.models.bind(directAi),
|
|
387
|
+
toMarkdown: directAi.toMarkdown?.bind(directAi) ?? unsupported("toMarkdown")
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
let _backend;
|
|
391
|
+
function backend() {
|
|
392
|
+
return _backend ??= resolveBackend();
|
|
393
|
+
}
|
|
394
|
+
/** Normalize provider 429 responses and binding quota failures before they reach callers. */
|
|
395
|
+
async function aiOperation(execute, rawStream = false) {
|
|
396
|
+
let value;
|
|
397
|
+
try {
|
|
398
|
+
value = await execute();
|
|
399
|
+
if (value instanceof Response) {
|
|
400
|
+
const limit = await limitFromResponse(value, "ai");
|
|
401
|
+
if (limit) throw limit;
|
|
402
|
+
}
|
|
403
|
+
} catch (error) {
|
|
404
|
+
throw classifyAiLimit(error) ?? error;
|
|
405
|
+
}
|
|
406
|
+
if (value instanceof Response && value.body && value.headers.get("content-type")?.includes("text/event-stream")) return new Response(streamResponse(value.body).body, value);
|
|
407
|
+
if (rawStream && value instanceof ReadableStream) return streamResponse(value).body;
|
|
408
|
+
return value;
|
|
409
|
+
}
|
|
410
|
+
function classifyAiLimit(error) {
|
|
411
|
+
if (error instanceof UsageLimit) return error;
|
|
412
|
+
const e = error;
|
|
413
|
+
return e && (e.status === 429 || e.statusCode === 429 || e.response?.status === 429) ? new UsageLimit({
|
|
414
|
+
resource: "ai",
|
|
415
|
+
reason: "rate_limit",
|
|
416
|
+
message: "AI usage limit exceeded."
|
|
417
|
+
}) : null;
|
|
418
|
+
}
|
|
419
|
+
/** Streaming failures after headers are sent end with an explicit terminal SSE event. */
|
|
420
|
+
function streamResponse(body) {
|
|
421
|
+
const reader = body.getReader();
|
|
422
|
+
return new Response(new ReadableStream({
|
|
423
|
+
async pull(controller) {
|
|
424
|
+
try {
|
|
425
|
+
const chunk = await reader.read();
|
|
426
|
+
if (chunk.done) controller.close();
|
|
427
|
+
else controller.enqueue(chunk.value);
|
|
428
|
+
} catch (error) {
|
|
429
|
+
const limit = classifyAiLimit(error);
|
|
430
|
+
let data = { message: "Generation was interrupted. Please try again." };
|
|
431
|
+
if (limit) data = await limit.response().json();
|
|
432
|
+
controller.enqueue(new TextEncoder().encode(`event: ${limit ? "nosam:limit" : "nosam:error"}\ndata: ${JSON.stringify(data)}\n\n`));
|
|
433
|
+
controller.close();
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
cancel(reason) {
|
|
437
|
+
return reader.cancel(reason);
|
|
438
|
+
}
|
|
439
|
+
}), { headers: {
|
|
440
|
+
"content-type": "text/event-stream",
|
|
441
|
+
"cache-control": "no-cache"
|
|
442
|
+
} });
|
|
443
|
+
}
|
|
444
|
+
const ai = new Proxy({}, { get(_, prop) {
|
|
445
|
+
if (prop === "stream") return (model, inputs, options) => aiOperation(async () => new Response(await backend().run(model, {
|
|
446
|
+
...inputs,
|
|
447
|
+
stream: true
|
|
448
|
+
}, options), { headers: {
|
|
449
|
+
"content-type": "text/event-stream",
|
|
450
|
+
"cache-control": "no-cache"
|
|
451
|
+
} }));
|
|
452
|
+
if (prop === "provider") return (provider, options) => ({ fetch: (path, init) => aiOperation(() => backend().providerFetch(provider, path, init, options)) });
|
|
453
|
+
if (prop === "run" || prop === "image" || prop === "models" || prop === "toMarkdown") return (...args) => aiOperation(() => backend()[prop](...args), prop === "run" && hasStreamFlag(args[1]) && args[1].stream === true);
|
|
454
|
+
} });
|
|
455
|
+
export { ai };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as auth, n as createAuthClient } from "../auth-client-react-CJdeErvM.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as auth, n as createAuthClient } from "../auth-client-DwCdwKbw.mjs";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as BwfAuthConfig, c as InferAuthInstance, d as defineAuth, f as getAuth, h as requireAuth, i as AuthUser, l as InferAuthSession, m as getUser, n as AuthSession, o as BwfAuthConfigContext, p as getSession, r as AuthState, s as BwfAuthTypes, t as AuthInstance, u as authContext } from "../auth-BKsUmWbT.mjs";
|
|
2
|
+
export { AuthInstance, AuthSession, AuthState, AuthUser, BwfAuthConfig, BwfAuthConfigContext, BwfAuthTypes, InferAuthInstance, InferAuthSession, authContext, defineAuth, getAuth, getSession, getUser, requireAuth };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as authContext, n as defineAuth, r as getAuth, i as getSession, a as getUser, o as requireAuth } from "../auth-DkvoW5hB.mjs";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { n as BwfAuthRuntimeApi } from "../better-auth-shared-CsBNvPOU.mjs";
|
|
2
|
+
export declare const resolveBwfAuthState: BwfAuthRuntimeApi["resolveBwfAuthState"];
|
|
3
|
+
export declare const runBwfAuthMiddleware: BwfAuthRuntimeApi["runBwfAuthMiddleware"];
|
|
4
|
+
export declare const handleBwfAuthRequest: BwfAuthRuntimeApi["handleBwfAuthRequest"];
|
|
5
|
+
export declare const runBwfAuthMigrations: BwfAuthRuntimeApi["runBwfAuthMigrations"];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { i as mysqlMigrationRunner, t as applyMySqlAuthMigrations } from "../auth-migrations-DDeifS3v.mjs";
|
|
2
|
+
import { n as resolveConnectionString, t as createBwfAuthRuntime } from "../better-auth-shared-Br6TNaYJ.mjs";
|
|
3
|
+
// src/runtime/better-auth-mysql.ts
|
|
4
|
+
async function applyMigrations(env, migrationSchema) {
|
|
5
|
+
const { createConnection } = await import("mysql2/promise");
|
|
6
|
+
const connection = await createConnection({
|
|
7
|
+
uri: resolveConnectionString(env, "MySQL"),
|
|
8
|
+
disableEval: true
|
|
9
|
+
});
|
|
10
|
+
try {
|
|
11
|
+
await applyMySqlAuthMigrations(mysqlMigrationRunner(connection), migrationSchema);
|
|
12
|
+
} finally {
|
|
13
|
+
await connection.end();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const runtime = createBwfAuthRuntime("mysql", applyMigrations);
|
|
17
|
+
const resolveBwfAuthState = runtime.resolveBwfAuthState;
|
|
18
|
+
const runBwfAuthMiddleware = runtime.runBwfAuthMiddleware;
|
|
19
|
+
const handleBwfAuthRequest = runtime.handleBwfAuthRequest;
|
|
20
|
+
const runBwfAuthMigrations = runtime.runBwfAuthMigrations;
|
|
21
|
+
export { handleBwfAuthRequest, resolveBwfAuthState, runBwfAuthMiddleware, runBwfAuthMigrations };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { n as BwfAuthRuntimeApi } from "../better-auth-shared-CsBNvPOU.mjs";
|
|
2
|
+
export declare const resolveBwfAuthState: BwfAuthRuntimeApi["resolveBwfAuthState"];
|
|
3
|
+
export declare const runBwfAuthMiddleware: BwfAuthRuntimeApi["runBwfAuthMiddleware"];
|
|
4
|
+
export declare const handleBwfAuthRequest: BwfAuthRuntimeApi["handleBwfAuthRequest"];
|
|
5
|
+
export declare const runBwfAuthMigrations: BwfAuthRuntimeApi["runBwfAuthMigrations"];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { a as pgMigrationRunner, n as applyPgAuthMigrations } from "../auth-migrations-DDeifS3v.mjs";
|
|
2
|
+
import { n as resolveConnectionString, t as createBwfAuthRuntime } from "../better-auth-shared-Br6TNaYJ.mjs";
|
|
3
|
+
import { t as disablePgPassFallback } from "../pg-DoyPxa_X.mjs";
|
|
4
|
+
// src/runtime/better-auth-pg.ts
|
|
5
|
+
async function applyMigrations(env, migrationSchema) {
|
|
6
|
+
const { Client } = await import("pg");
|
|
7
|
+
const client = new Client({ connectionString: resolveConnectionString(env, "PostgreSQL") });
|
|
8
|
+
disablePgPassFallback(client);
|
|
9
|
+
await client.connect();
|
|
10
|
+
try {
|
|
11
|
+
await applyPgAuthMigrations(pgMigrationRunner(client), migrationSchema);
|
|
12
|
+
} finally {
|
|
13
|
+
await client.end();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const runtime = createBwfAuthRuntime("postgresql", applyMigrations);
|
|
17
|
+
const resolveBwfAuthState = runtime.resolveBwfAuthState;
|
|
18
|
+
const runBwfAuthMiddleware = runtime.runBwfAuthMiddleware;
|
|
19
|
+
const handleBwfAuthRequest = runtime.handleBwfAuthRequest;
|
|
20
|
+
const runBwfAuthMigrations = runtime.runBwfAuthMigrations;
|
|
21
|
+
export { handleBwfAuthRequest, resolveBwfAuthState, runBwfAuthMiddleware, runBwfAuthMigrations };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { n as BwfAuthRuntimeApi } from "../better-auth-shared-CsBNvPOU.mjs";
|
|
2
|
+
export declare const resolveBwfAuthOptions: BwfAuthRuntimeApi["resolveBwfAuthOptions"];
|
|
3
|
+
export declare const resolveBwfAuthState: BwfAuthRuntimeApi["resolveBwfAuthState"];
|
|
4
|
+
export declare const runBwfAuthMiddleware: BwfAuthRuntimeApi["runBwfAuthMiddleware"];
|
|
5
|
+
export declare const handleBwfAuthRequest: BwfAuthRuntimeApi["handleBwfAuthRequest"];
|
|
6
|
+
export declare const runBwfAuthMigrations: BwfAuthRuntimeApi["runBwfAuthMigrations"];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { r as applySqliteAuthMigrations } from "../auth-migrations-DDeifS3v.mjs";
|
|
2
|
+
import { t as createBwfAuthRuntime } from "../better-auth-shared-Br6TNaYJ.mjs";
|
|
3
|
+
// src/runtime/better-auth.ts
|
|
4
|
+
async function applyMigrations(env, migrationSchema) {
|
|
5
|
+
const database = env.DB;
|
|
6
|
+
if (!database) throw new Error("auth: Better Auth requires the \"DB\" D1 binding for sqlite apps.");
|
|
7
|
+
await applySqliteAuthMigrations({
|
|
8
|
+
async all(sql) {
|
|
9
|
+
return (await database.prepare(sql).all()).results ?? [];
|
|
10
|
+
},
|
|
11
|
+
async run(sql) {
|
|
12
|
+
await database.prepare(sql).run();
|
|
13
|
+
}
|
|
14
|
+
}, migrationSchema);
|
|
15
|
+
}
|
|
16
|
+
const runtime = createBwfAuthRuntime("sqlite", applyMigrations);
|
|
17
|
+
const resolveBwfAuthOptions = runtime.resolveBwfAuthOptions;
|
|
18
|
+
const resolveBwfAuthState = runtime.resolveBwfAuthState;
|
|
19
|
+
const runBwfAuthMiddleware = runtime.runBwfAuthMiddleware;
|
|
20
|
+
const handleBwfAuthRequest = runtime.handleBwfAuthRequest;
|
|
21
|
+
const runBwfAuthMigrations = runtime.runBwfAuthMigrations;
|
|
22
|
+
export { handleBwfAuthRequest, resolveBwfAuthOptions, resolveBwfAuthState, runBwfAuthMiddleware, runBwfAuthMigrations };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { c as FetchError, s as fetch } from "../fetch-CBgyyhzm.mjs";
|
|
2
|
+
import { t as fetchStream } from "../fetch-stream-bUXynOyZ.mjs";
|
|
3
|
+
import { n as createAuthClient, t as auth } from "../auth-client-react-DvQLe5Zb.mjs";
|
|
4
|
+
import { i as AuthUser, n as AuthSession, r as AuthState } from "../auth-BKsUmWbT.mjs";
|
|
5
|
+
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { t as FetchError } from "../fetch-error-DmlRM6e4.mjs";
|
|
2
|
+
import { n as fetch } from "../fetch-tpPiSK10.mjs";
|
|
3
|
+
import { t as fetchStream } from "../fetch-stream-2GUN3YN1.mjs";
|
|
4
|
+
import { n as createAuthClient, t as auth } from "../auth-client-react-CJdeErvM.mjs";
|
|
5
|
+
export { FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { c as FetchError, s as fetch } from "../fetch-CBgyyhzm.mjs";
|
|
2
|
+
import { t as fetchStream } from "../fetch-stream-bUXynOyZ.mjs";
|
|
3
|
+
import { n as createAuthClient, t as auth } from "../auth-client-6-Ft9i9T.mjs";
|
|
4
|
+
import { i as AuthUser, n as AuthSession, r as AuthState } from "../auth-BKsUmWbT.mjs";
|
|
5
|
+
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { t as FetchError } from "../fetch-error-DmlRM6e4.mjs";
|
|
2
|
+
import { n as fetch } from "../fetch-tpPiSK10.mjs";
|
|
3
|
+
import { t as fetchStream } from "../fetch-stream-2GUN3YN1.mjs";
|
|
4
|
+
import { n as createAuthClient, t as auth } from "../auth-client-DwCdwKbw.mjs";
|
|
5
|
+
export { FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DrizzleD1Database, DrizzleD1Database as DrizzleD1Database$1 } from "drizzle-orm/d1";
|
|
2
|
+
import { AnyColumn, SQL, SQLWrapper, and, asc, avg, between, count, desc, eq, exists, gt, gte, ilike, inArray, isNotNull, isNull, like, lt, lte, max, min, ne, not, notBetween, notExists, notInArray, notLike, or, sql, sum } from "drizzle-orm";
|
|
3
|
+
import { BatchItem } from "drizzle-orm/batch";
|
|
4
|
+
/**
|
|
5
|
+
* Create a Drizzle D1 instance from a custom D1 binding.
|
|
6
|
+
* Use this when you have multiple D1 databases or need a non-default binding.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createDb(d1: D1Database, options?: {
|
|
9
|
+
session?: D1SessionConstraint;
|
|
10
|
+
}): DrizzleD1Database$1;
|
|
11
|
+
/**
|
|
12
|
+
* Default Drizzle D1 instance — resolves the `DB` binding from the runtime
|
|
13
|
+
* environment. When the bwf plugin is active, this is replaced with a
|
|
14
|
+
* schema-aware instance via virtual module.
|
|
15
|
+
*/
|
|
16
|
+
export declare const db: DrizzleD1Database$1;
|
|
17
|
+
export { type AnyColumn, type BatchItem, type DrizzleD1Database, type SQL, type SQLWrapper, and, asc, avg, between, count, desc, eq, exists, gt, gte, ilike, inArray, isNotNull, isNull, like, lt, lte, max, min, ne, not, notBetween, notExists, notInArray, notLike, or, sql, sum };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { a as requireRuntimeBinding, r as getRuntimeRequestResource, t as getRuntimeBinding } from "../env-Dl4Wggec.mjs";
|
|
2
|
+
import { drizzle } from "drizzle-orm/d1";
|
|
3
|
+
import { and, asc, avg, between, count, desc, eq, exists, gt, gte, ilike, inArray, isNotNull, isNull, like, lt, lte, max, min, ne, not, notBetween, notExists, notInArray, notLike, or, sql, sum } from "drizzle-orm";
|
|
4
|
+
// src/runtime/db.ts
|
|
5
|
+
/**
|
|
6
|
+
* bwf/db — Drizzle-powered database access.
|
|
7
|
+
*
|
|
8
|
+
* At build time, the bwf plugin intercepts this import and serves a
|
|
9
|
+
* virtual module that auto-wires the D1 binding with the user's schema.
|
|
10
|
+
* This stub exists for the published npm package and type declarations.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Create a Drizzle D1 instance from a custom D1 binding.
|
|
14
|
+
* Use this when you have multiple D1 databases or need a non-default binding.
|
|
15
|
+
*/
|
|
16
|
+
function createDb(d1, options) {
|
|
17
|
+
return drizzle(d1.withSession(options?.session ?? "first-unconstrained"));
|
|
18
|
+
}
|
|
19
|
+
function createPrimaryDb(d1) {
|
|
20
|
+
return drizzle(d1.withSession("first-primary"));
|
|
21
|
+
}
|
|
22
|
+
const requestDbKey = {};
|
|
23
|
+
function requireD1() {
|
|
24
|
+
if (getRuntimeBinding("DB") == null && (getRuntimeBinding("HYPERDRIVE") != null || getRuntimeBinding("DATABASE_URL") != null)) throw new Error("db: Missing Cloudflare binding 'DB'. This app connects through HYPERDRIVE or DATABASE_URL, but its server bundle loaded the D1 client. An installed package that imports bwf/db must be an ES module that lists void in its dependencies or peerDependencies, and the app must list it or reach it through such packages.");
|
|
25
|
+
return requireRuntimeBinding("DB");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Default Drizzle D1 instance — resolves the `DB` binding from the runtime
|
|
29
|
+
* environment. When the bwf plugin is active, this is replaced with a
|
|
30
|
+
* schema-aware instance via virtual module.
|
|
31
|
+
*/
|
|
32
|
+
const db = new Proxy({}, { get(_, prop) {
|
|
33
|
+
const instance = getRuntimeRequestResource(requestDbKey, () => createDb(requireD1()), () => createPrimaryDb(requireD1()));
|
|
34
|
+
return Reflect.get(instance, prop);
|
|
35
|
+
} });
|
|
36
|
+
export { and, asc, avg, between, count, createDb, db, desc, eq, exists, gt, gte, ilike, inArray, isNotNull, isNull, like, lt, lte, max, min, ne, not, notBetween, notExists, notInArray, notLike, or, sql, sum };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "drizzle-arktype";
|