orcaq 1.0.26 → 1.0.28
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/-lZvfnzr.js +1 -0
- package/.output/public/_nuxt/ACi_yrrw.js +1 -0
- package/.output/public/_nuxt/AgentWorkspace.67IpTcyl.css +1 -0
- package/.output/public/_nuxt/B-E3EDXq.js +21 -0
- package/.output/public/_nuxt/B-o1cyu1.js +1 -0
- package/.output/public/_nuxt/B-rj9QI0.js +1 -0
- package/.output/public/_nuxt/B0pvfm-W.js +1 -0
- package/.output/public/_nuxt/B3XOCDJg.js +1 -0
- package/.output/public/_nuxt/B7iORLht.js +8 -0
- package/.output/public/_nuxt/B9xm8XSJ.js +1 -0
- package/.output/public/_nuxt/BDPGejuO.js +2 -0
- package/.output/public/_nuxt/BHFnD9yO.js +1 -0
- package/.output/public/_nuxt/BHp-OX9z.js +1 -0
- package/.output/public/_nuxt/BIW9Rd2L.js +1 -0
- package/.output/public/_nuxt/BJdgR-zN.js +1 -0
- package/.output/public/_nuxt/BKltSiU0.js +1 -0
- package/.output/public/_nuxt/BQAF7cM_.js +53 -0
- package/.output/public/_nuxt/BRpeq4XL.js +1 -0
- package/.output/public/_nuxt/BSs5g8DH.js +1 -0
- package/.output/public/_nuxt/BUuSKT2f.js +152 -0
- package/.output/public/_nuxt/BV4_2PzU.js +1 -0
- package/.output/public/_nuxt/BVmBXPoG.js +1 -0
- package/.output/public/_nuxt/BZEKLHO-.js +1 -0
- package/.output/public/_nuxt/BaseCodeEditor.SAr2eD8R.css +1 -0
- package/.output/public/_nuxt/BiOIaWuc.js +1 -0
- package/.output/public/_nuxt/BlWNlw-C.js +15 -0
- package/.output/public/_nuxt/BranJUWp.js +1 -0
- package/.output/public/_nuxt/BsnN2mQb.js +3 -0
- package/.output/public/_nuxt/BwddCgOY.js +1 -0
- package/.output/public/_nuxt/C26aAkUg.js +39 -0
- package/.output/public/_nuxt/CAcIcjka.js +9 -0
- package/.output/public/_nuxt/CO-m0olR.js +2 -0
- package/.output/public/_nuxt/CQNFvXDN.js +1 -0
- package/.output/public/_nuxt/CQQKPHb8.js +225 -0
- package/.output/public/_nuxt/CQr87mff.js +1 -0
- package/.output/public/_nuxt/C__Jz_zH.js +40 -0
- package/.output/public/_nuxt/CbjqLbgu.js +1 -0
- package/.output/public/_nuxt/CfblXyCF.js +1 -0
- package/.output/public/_nuxt/Cqe10li5.js +1 -0
- package/.output/public/_nuxt/CwtNS48a.js +1 -0
- package/.output/public/_nuxt/D4jtSPyP.js +3 -0
- package/.output/public/_nuxt/D8s-WG7x.js +1 -0
- package/.output/public/_nuxt/D9SCXF1G.js +1 -0
- package/.output/public/_nuxt/DAsY4LnG.js +1 -0
- package/.output/public/_nuxt/DM73sEXg.js +1 -0
- package/.output/public/_nuxt/DNmOzKte.js +1 -0
- package/.output/public/_nuxt/DdMwxl0I.js +1 -0
- package/.output/public/_nuxt/DfL_wWxk.js +1 -0
- package/.output/public/_nuxt/DftZZFKd.js +732 -0
- package/.output/public/_nuxt/DgPgl0Vt.js +39 -0
- package/.output/public/_nuxt/DpyvTVPg.js +8 -0
- package/.output/public/_nuxt/Ds4ET3BG.js +72 -0
- package/.output/public/_nuxt/Dwm3kp4S.js +3867 -0
- package/.output/public/_nuxt/DynamicTable.BW0D7NXb.css +1 -0
- package/.output/public/_nuxt/GqcI3eLm.js +67 -0
- package/.output/public/_nuxt/QuickQuery.CJ7tNjo4.css +1 -0
- package/.output/public/_nuxt/S6q6IfIg.js +6 -0
- package/.output/public/_nuxt/SzZsnvJ-.js +2 -0
- package/.output/public/_nuxt/T2yrk5P8.js +1 -0
- package/.output/public/_nuxt/UrLgZoyE.js +9 -0
- package/.output/public/_nuxt/W0T58tNs.js +1 -0
- package/.output/public/_nuxt/WrapperErdDiagram.DsE2QNGr.css +1 -0
- package/.output/public/_nuxt/Yzrsuije.js +1 -0
- package/.output/public/_nuxt/_fileId_.B3PtfMYN.css +1 -0
- package/.output/public/_nuxt/aKVabwds.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/1e32d709-950d-49a3-8d61-1b3385318747.json +1 -0
- package/.output/public/_nuxt/default.DC7ec2JI.css +1 -0
- package/.output/public/_nuxt/entry.Kia9TCip.css +1 -0
- package/.output/public/_nuxt/fuZLfV_i.js +1 -0
- package/.output/public/_nuxt/iDT-eQ46.js +1 -0
- package/.output/public/_nuxt/index.P0q-dO_S.css +1 -0
- package/.output/public/_nuxt/lN7hePE6.js +1 -0
- package/.output/public/_nuxt/logo.BsJ2Dfin.png +0 -0
- package/.output/public/_nuxt/mW-nBTJP.js +1 -0
- package/.output/public/_nuxt/rdXrKZa8.js +68 -0
- package/.output/public/_nuxt/vU5dtBjy.js +1 -0
- package/.output/public/logo-8-bits.svg +4 -0
- package/.output/server/chunks/_/create-adapter.mjs +68 -0
- package/.output/server/chunks/_/create-adapter.mjs.map +1 -0
- package/.output/server/chunks/_/database-error.mjs +53 -0
- package/.output/server/chunks/_/database-error.mjs.map +1 -0
- package/.output/server/chunks/_/database-roles.factory.mjs +737 -0
- package/.output/server/chunks/_/database-roles.factory.mjs.map +1 -0
- package/.output/server/chunks/_/db-connection.mjs +352 -0
- package/.output/server/chunks/_/db-connection.mjs.map +1 -0
- package/.output/server/chunks/_/error.mjs +25 -0
- package/.output/server/chunks/_/error.mjs.map +1 -0
- package/.output/server/chunks/_/functions.factory.mjs +174 -0
- package/.output/server/chunks/_/functions.factory.mjs.map +1 -0
- package/.output/server/chunks/_/instance-insights.factory.mjs +643 -0
- package/.output/server/chunks/_/instance-insights.factory.mjs.map +1 -0
- package/.output/server/chunks/_/metadata.factory.mjs +583 -0
- package/.output/server/chunks/_/metadata.factory.mjs.map +1 -0
- package/.output/server/chunks/_/query.factory.mjs +163 -0
- package/.output/server/chunks/_/query.factory.mjs.map +1 -0
- package/.output/server/chunks/_/tables.factory.mjs +788 -0
- package/.output/server/chunks/_/tables.factory.mjs.map +1 -0
- package/.output/server/chunks/_/views.factory.mjs +227 -0
- package/.output/server/chunks/_/views.factory.mjs.map +1 -0
- package/.output/server/chunks/build/client.manifest.mjs +565 -319
- package/.output/server/chunks/build/client.manifest.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +717 -804
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/ai/agent.mjs +1626 -0
- package/.output/server/chunks/routes/api/ai/agent.mjs.map +1 -0
- package/.output/server/chunks/routes/api/ai/chat.mjs +2 -2
- package/.output/server/chunks/routes/api/database-export/export-database.mjs +16 -5
- package/.output/server/chunks/routes/api/database-export/export-database.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-import/import-database.mjs +31 -5
- package/.output/server/chunks/routes/api/database-import/import-database.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/create-role.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/create-role.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/delete-role.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/delete-role.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-databases-with-permissions.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/get-databases-with-permissions.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-databases.mjs +20 -9
- package/.output/server/chunks/routes/api/database-roles/get-databases.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-permissions.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/get-permissions.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-role-inheritance.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/get-role-inheritance.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-role.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/get-role.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-roles.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/get-roles.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-schema-objects.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/get-schema-objects.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/get-schemas.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/get-schemas.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/grant-bulk-permissions.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/grant-bulk-permissions.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/grant-permission.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/grant-permission.mjs.map +1 -1
- package/.output/server/chunks/routes/api/database-roles/revoke-permission.mjs +13 -7
- package/.output/server/chunks/routes/api/database-roles/revoke-permission.mjs.map +1 -1
- package/.output/server/chunks/routes/api/functions/definition.post.mjs +35 -0
- package/.output/server/chunks/routes/api/functions/definition.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/functions/delete.post.mjs +41 -0
- package/.output/server/chunks/routes/api/functions/delete.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/functions/overview.post.mjs +42 -0
- package/.output/server/chunks/routes/api/functions/overview.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/functions/rename.post.mjs +48 -0
- package/.output/server/chunks/routes/api/functions/rename.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/functions/signature.post.mjs +35 -0
- package/.output/server/chunks/routes/api/functions/signature.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/functions/update.post.mjs +45 -0
- package/.output/server/chunks/routes/api/functions/update.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/cancel-query.post.mjs +55 -0
- package/.output/server/chunks/routes/api/instance-insights/cancel-query.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/configuration.post.mjs +58 -0
- package/.output/server/chunks/routes/api/instance-insights/configuration.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/dashboard.post.mjs +55 -0
- package/.output/server/chunks/routes/api/instance-insights/dashboard.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/drop-slot.post.mjs +55 -0
- package/.output/server/chunks/routes/api/instance-insights/drop-slot.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/replication.post.mjs +55 -0
- package/.output/server/chunks/routes/api/instance-insights/replication.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/state.post.mjs +55 -0
- package/.output/server/chunks/routes/api/instance-insights/state.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/terminate-connection.post.mjs +55 -0
- package/.output/server/chunks/routes/api/instance-insights/terminate-connection.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/instance-insights/toggle-slot-status.post.mjs +60 -0
- package/.output/server/chunks/routes/api/instance-insights/toggle-slot-status.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/managment-connection/health-check.mjs +15 -4
- package/.output/server/chunks/routes/api/managment-connection/health-check.mjs.map +1 -1
- package/.output/server/chunks/routes/api/metadata/erd.post.mjs +34 -0
- package/.output/server/chunks/routes/api/metadata/erd.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/metadata/meta-data.post.mjs +36 -0
- package/.output/server/chunks/routes/api/metadata/meta-data.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/metadata/reverse-schemas.post.mjs +35 -0
- package/.output/server/chunks/routes/api/metadata/reverse-schemas.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/metrics/monitor.post.mjs +103 -0
- package/.output/server/chunks/routes/api/metrics/monitor.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/query/execute.post.mjs +46 -0
- package/.output/server/chunks/routes/api/query/execute.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/query/raw-execute-stream.post.mjs +44 -0
- package/.output/server/chunks/routes/api/query/raw-execute-stream.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/query/raw-execute.post.mjs +48 -0
- package/.output/server/chunks/routes/api/query/raw-execute.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/bulk-delete.post.mjs +49 -0
- package/.output/server/chunks/routes/api/tables/bulk-delete.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/bulk-update.post.mjs +50 -0
- package/.output/server/chunks/routes/api/tables/bulk-update.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/ddl.post.mjs +32 -0
- package/.output/server/chunks/routes/api/tables/ddl.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/export.post.mjs +47 -0
- package/.output/server/chunks/routes/api/tables/export.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/indexes.post.mjs +32 -0
- package/.output/server/chunks/routes/api/tables/indexes.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/meta.post.mjs +39 -0
- package/.output/server/chunks/routes/api/tables/meta.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/overview.post.mjs +32 -0
- package/.output/server/chunks/routes/api/tables/overview.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/rls.post.mjs +36 -0
- package/.output/server/chunks/routes/api/tables/rls.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/rules.post.mjs +32 -0
- package/.output/server/chunks/routes/api/tables/rules.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/size.post.mjs +32 -0
- package/.output/server/chunks/routes/api/tables/size.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/structure.post.mjs +32 -0
- package/.output/server/chunks/routes/api/tables/structure.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/triggers.post.mjs +32 -0
- package/.output/server/chunks/routes/api/tables/triggers.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/views/definition.post.mjs +27 -0
- package/.output/server/chunks/routes/api/views/definition.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/views/dependencies.post.mjs +27 -0
- package/.output/server/chunks/routes/api/views/dependencies.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/views/explain.post.mjs +29 -0
- package/.output/server/chunks/routes/api/views/explain.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/views/indexes.post.mjs +27 -0
- package/.output/server/chunks/routes/api/views/indexes.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/views/meta.post.mjs +27 -0
- package/.output/server/chunks/routes/api/views/meta.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/views/overview.post.mjs +27 -0
- package/.output/server/chunks/routes/api/views/overview.post.mjs.map +1 -0
- package/.output/server/chunks/routes/renderer.mjs +4 -4
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs +1 -1
- package/.output/server/index.mjs +3 -3
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.19/dist/index.mjs +2756 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.19/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.19/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.19/package.json +81 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.4/dist/index.mjs +2549 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.4/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.4/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider-utils@4.0.4/package.json +75 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider@3.0.2/dist/index.mjs +377 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider@3.0.2/package.json +57 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider@3.0.8/dist/index.mjs +404 -0
- package/.output/server/node_modules/.nitro/@ai-sdk/provider@3.0.8/package.json +63 -0
- package/.output/server/node_modules/.nitro/debug@4.3.4/node_modules/ms/index.js +162 -0
- package/.output/server/node_modules/.nitro/debug@4.3.4/node_modules/ms/package.json +37 -0
- package/.output/server/node_modules/.nitro/debug@4.3.4/package.json +59 -0
- package/.output/server/node_modules/.nitro/debug@4.3.4/src/browser.js +269 -0
- package/.output/server/node_modules/.nitro/debug@4.3.4/src/common.js +274 -0
- package/.output/server/node_modules/.nitro/debug@4.3.4/src/index.js +10 -0
- package/.output/server/node_modules/.nitro/debug@4.3.4/src/node.js +263 -0
- package/.output/server/node_modules/.nitro/debug@4.4.0/node_modules/ms/index.js +162 -0
- package/.output/server/node_modules/.nitro/debug@4.4.0/node_modules/ms/package.json +38 -0
- package/.output/server/node_modules/.nitro/debug@4.4.0/package.json +65 -0
- package/.output/server/node_modules/.nitro/debug@4.4.0/src/browser.js +272 -0
- package/.output/server/node_modules/.nitro/debug@4.4.0/src/common.js +292 -0
- package/.output/server/node_modules/.nitro/debug@4.4.0/src/index.js +10 -0
- package/.output/server/node_modules/.nitro/debug@4.4.0/src/node.js +263 -0
- package/.output/server/node_modules/.nitro/ms@2.1.2/index.js +162 -0
- package/.output/server/node_modules/.nitro/ms@2.1.2/package.json +37 -0
- package/.output/server/node_modules/.nitro/ms@2.1.3/index.js +162 -0
- package/.output/server/node_modules/.nitro/ms@2.1.3/package.json +38 -0
- package/.output/server/node_modules/.nitro/pg-connection-string@2.6.2/index.js +112 -0
- package/.output/server/node_modules/.nitro/pg-connection-string@2.6.2/package.json +40 -0
- package/.output/server/node_modules/.nitro/pg-connection-string@2.7.0/index.js +112 -0
- package/.output/server/node_modules/.nitro/pg-connection-string@2.7.0/package.json +40 -0
- package/.output/server/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2549 -0
- package/.output/server/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider-utils/package.json +75 -0
- package/.output/server/node_modules/@ai-sdk/gateway/dist/index.mjs +539 -82
- package/.output/server/node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2756 -0
- package/.output/server/node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider-utils/package.json +81 -0
- package/.output/server/node_modules/@ai-sdk/gateway/package.json +16 -5
- package/.output/server/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2549 -0
- package/.output/server/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider-utils/package.json +75 -0
- package/.output/server/node_modules/@ai-sdk/openai/dist/index.mjs +1498 -961
- package/.output/server/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2756 -0
- package/.output/server/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider-utils/package.json +81 -0
- package/.output/server/node_modules/@ai-sdk/openai/package.json +14 -5
- package/.output/server/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2549 -0
- package/.output/server/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider-utils/package.json +75 -0
- package/.output/server/node_modules/@ai-sdk/provider/dist/index.mjs +32 -5
- package/.output/server/node_modules/@ai-sdk/provider/package.json +7 -1
- package/.output/server/node_modules/@ai-sdk/provider-utils/dist/index.mjs +231 -24
- package/.output/server/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/@ai-sdk/provider-utils/package.json +8 -2
- package/.output/server/node_modules/@ai-sdk/xai/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/xai/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/xai/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2549 -0
- package/.output/server/node_modules/@ai-sdk/xai/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
- package/.output/server/node_modules/@ai-sdk/xai/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +57 -0
- package/.output/server/node_modules/@ai-sdk/xai/node_modules/@ai-sdk/provider-utils/package.json +75 -0
- package/.output/server/node_modules/@iconify/utils/node_modules/debug/node_modules/ms/index.js +162 -0
- package/.output/server/node_modules/@iconify/utils/node_modules/debug/node_modules/ms/package.json +38 -0
- package/.output/server/node_modules/@iconify/utils/node_modules/debug/package.json +65 -0
- package/.output/server/node_modules/@iconify/utils/node_modules/debug/src/browser.js +272 -0
- package/.output/server/node_modules/@iconify/utils/node_modules/debug/src/common.js +292 -0
- package/.output/server/node_modules/@iconify/utils/node_modules/debug/src/index.js +10 -0
- package/.output/server/node_modules/@iconify/utils/node_modules/debug/src/node.js +263 -0
- package/.output/server/node_modules/@openrouter/ai-sdk-provider/dist/index.mjs +4656 -0
- package/.output/server/node_modules/@openrouter/ai-sdk-provider/package.json +82 -0
- package/.output/server/node_modules/ag-grid-community/dist/package/main.esm.mjs +50065 -0
- package/.output/server/node_modules/ag-grid-community/package.json +113 -0
- package/.output/server/node_modules/ai/dist/index.mjs +2069 -918
- package/.output/server/node_modules/ai/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/ai/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/ai/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2756 -0
- package/.output/server/node_modules/ai/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.mjs +404 -0
- package/.output/server/node_modules/ai/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +63 -0
- package/.output/server/node_modules/ai/node_modules/@ai-sdk/provider-utils/package.json +81 -0
- package/.output/server/node_modules/ai/package.json +15 -6
- package/.output/server/node_modules/asn1/lib/ber/errors.js +13 -0
- package/.output/server/node_modules/asn1/lib/ber/index.js +27 -0
- package/.output/server/node_modules/asn1/lib/ber/reader.js +262 -0
- package/.output/server/node_modules/asn1/lib/ber/types.js +36 -0
- package/.output/server/node_modules/asn1/lib/ber/writer.js +317 -0
- package/.output/server/node_modules/asn1/lib/index.js +20 -0
- package/.output/server/node_modules/asn1/package.json +31 -0
- package/.output/server/node_modules/bcrypt-pbkdf/index.js +556 -0
- package/.output/server/node_modules/bcrypt-pbkdf/package.json +15 -0
- package/.output/server/node_modules/colorette/index.cjs +218 -0
- package/.output/server/node_modules/colorette/package.json +39 -0
- package/.output/server/node_modules/debug/node_modules/ms/index.js +162 -0
- package/.output/server/node_modules/debug/node_modules/ms/package.json +38 -0
- package/.output/server/node_modules/file-saver/dist/FileSaver.min.js +3 -0
- package/.output/server/node_modules/file-saver/package.json +40 -0
- package/.output/server/node_modules/get-package-type/async.cjs +52 -0
- package/.output/server/node_modules/get-package-type/cache.cjs +3 -0
- package/.output/server/node_modules/get-package-type/index.cjs +7 -0
- package/.output/server/node_modules/get-package-type/is-node-modules.cjs +15 -0
- package/.output/server/node_modules/get-package-type/package.json +35 -0
- package/.output/server/node_modules/get-package-type/sync.cjs +42 -0
- package/.output/server/node_modules/knex/knex.js +23 -0
- package/.output/server/node_modules/knex/knex.mjs +11 -0
- package/.output/server/node_modules/knex/lib/builder-interface-augmenter.js +120 -0
- package/.output/server/node_modules/knex/lib/client.js +495 -0
- package/.output/server/node_modules/knex/lib/constants.js +61 -0
- package/.output/server/node_modules/knex/lib/dialects/better-sqlite3/index.js +77 -0
- package/.output/server/node_modules/knex/lib/dialects/cockroachdb/crdb-columncompiler.js +14 -0
- package/.output/server/node_modules/knex/lib/dialects/cockroachdb/crdb-querybuilder.js +11 -0
- package/.output/server/node_modules/knex/lib/dialects/cockroachdb/crdb-querycompiler.js +122 -0
- package/.output/server/node_modules/knex/lib/dialects/cockroachdb/crdb-tablecompiler.js +37 -0
- package/.output/server/node_modules/knex/lib/dialects/cockroachdb/crdb-viewcompiler.js +15 -0
- package/.output/server/node_modules/knex/lib/dialects/cockroachdb/index.js +86 -0
- package/.output/server/node_modules/knex/lib/dialects/index.js +34 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/index.js +500 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/mssql-formatter.js +34 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/query/mssql-querycompiler.js +601 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/schema/mssql-columncompiler.js +185 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/schema/mssql-compiler.js +91 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/schema/mssql-tablecompiler.js +378 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/schema/mssql-viewcompiler.js +55 -0
- package/.output/server/node_modules/knex/lib/dialects/mssql/transaction.js +176 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/index.js +206 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/query/mysql-querybuilder.js +14 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/query/mysql-querycompiler.js +292 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/schema/mysql-columncompiler.js +193 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/schema/mysql-compiler.js +60 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/schema/mysql-tablecompiler.js +405 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/schema/mysql-viewbuilder.js +21 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/schema/mysql-viewcompiler.js +15 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql/transaction.js +46 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql2/index.js +53 -0
- package/.output/server/node_modules/knex/lib/dialects/mysql2/transaction.js +44 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/index.js +92 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/query/oracle-querycompiler.js +343 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/schema/internal/incrementUtils.js +22 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/schema/internal/trigger.js +155 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/schema/oracle-columnbuilder.js +17 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/schema/oracle-columncompiler.js +126 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/schema/oracle-compiler.js +124 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/schema/oracle-tablecompiler.js +197 -0
- package/.output/server/node_modules/knex/lib/dialects/oracle/utils.js +106 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/index.js +381 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/query/oracledb-querycompiler.js +481 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/schema/oracledb-columncompiler.js +61 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/schema/oracledb-tablecompiler.js +19 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/schema/oracledb-viewbuilder.js +13 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/schema/oracledb-viewcompiler.js +19 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/transaction.js +98 -0
- package/.output/server/node_modules/knex/lib/dialects/oracledb/utils.js +208 -0
- package/.output/server/node_modules/knex/lib/dialects/pgnative/index.js +60 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/execution/pg-transaction.js +19 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/index.js +361 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/query/pg-querybuilder.js +43 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/query/pg-querycompiler.js +400 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/schema/pg-columncompiler.js +156 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/schema/pg-compiler.js +138 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/schema/pg-tablecompiler.js +304 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/schema/pg-viewbuilder.js +21 -0
- package/.output/server/node_modules/knex/lib/dialects/postgres/schema/pg-viewcompiler.js +35 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/index.js +86 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/query/redshift-querycompiler.js +163 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/schema/redshift-columnbuilder.js +22 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/schema/redshift-columncompiler.js +67 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/schema/redshift-compiler.js +14 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/schema/redshift-tablecompiler.js +122 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/schema/redshift-viewcompiler.js +11 -0
- package/.output/server/node_modules/knex/lib/dialects/redshift/transaction.js +32 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/execution/sqlite-transaction.js +25 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/index.js +250 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/query/sqlite-querybuilder.js +33 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/query/sqlite-querycompiler.js +334 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/ddl.js +400 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/internal/compiler.js +327 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/internal/parser-combinator.js +161 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/internal/parser.js +638 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/internal/sqlite-ddl-operations.js +41 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/internal/tokenizer.js +38 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/internal/utils.js +12 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/sqlite-columncompiler.js +50 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/sqlite-compiler.js +80 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/sqlite-tablecompiler.js +347 -0
- package/.output/server/node_modules/knex/lib/dialects/sqlite3/schema/sqlite-viewcompiler.js +40 -0
- package/.output/server/node_modules/knex/lib/execution/batch-insert.js +51 -0
- package/.output/server/node_modules/knex/lib/execution/internal/delay.js +6 -0
- package/.output/server/node_modules/knex/lib/execution/internal/ensure-connection-callback.js +41 -0
- package/.output/server/node_modules/knex/lib/execution/internal/query-executioner.js +62 -0
- package/.output/server/node_modules/knex/lib/execution/runner.js +325 -0
- package/.output/server/node_modules/knex/lib/execution/transaction.js +413 -0
- package/.output/server/node_modules/knex/lib/formatter/formatterUtils.js +42 -0
- package/.output/server/node_modules/knex/lib/formatter/rawFormatter.js +84 -0
- package/.output/server/node_modules/knex/lib/formatter/wrappingFormatter.js +250 -0
- package/.output/server/node_modules/knex/lib/formatter.js +25 -0
- package/.output/server/node_modules/knex/lib/index.js +3 -0
- package/.output/server/node_modules/knex/lib/knex-builder/FunctionHelper.js +80 -0
- package/.output/server/node_modules/knex/lib/knex-builder/Knex.js +59 -0
- package/.output/server/node_modules/knex/lib/knex-builder/internal/config-resolver.js +57 -0
- package/.output/server/node_modules/knex/lib/knex-builder/internal/parse-connection.js +87 -0
- package/.output/server/node_modules/knex/lib/knex-builder/make-knex.js +345 -0
- package/.output/server/node_modules/knex/lib/logger.js +76 -0
- package/.output/server/node_modules/knex/lib/migrations/common/MigrationsLoader.js +36 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/MigrationGenerator.js +84 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/Migrator.js +599 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/migration-list-resolver.js +33 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/migrator-configuration-merger.js +58 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/sources/fs-migrations.js +74 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/cjs.stub +15 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/coffee.stub +13 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/eg.stub +14 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/js-schema.stub +22 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/js.stub +22 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/knexfile-coffee.stub +34 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/knexfile-eg.stub +43 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/knexfile-js.stub +47 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/knexfile-ls.stub +35 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/knexfile-ts.stub +47 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/ls.stub +14 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/mjs.stub +23 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/ts-schema.stub +21 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/stub/ts.stub +21 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/table-creator.js +77 -0
- package/.output/server/node_modules/knex/lib/migrations/migrate/table-resolver.js +27 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/Seeder.js +137 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/seeder-configuration-merger.js +60 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/sources/fs-seeds.js +65 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/stub/coffee.stub +9 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/stub/eg.stub +11 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/stub/js.stub +13 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/stub/ls.stub +11 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/stub/mjs.stub +12 -0
- package/.output/server/node_modules/knex/lib/migrations/seed/stub/ts.stub +13 -0
- package/.output/server/node_modules/knex/lib/migrations/util/fs.js +86 -0
- package/.output/server/node_modules/knex/lib/migrations/util/import-file.js +12 -0
- package/.output/server/node_modules/knex/lib/migrations/util/is-module-type.js +9 -0
- package/.output/server/node_modules/knex/lib/migrations/util/template.js +52 -0
- package/.output/server/node_modules/knex/lib/migrations/util/timestamp.js +14 -0
- package/.output/server/node_modules/knex/lib/query/analytic.js +52 -0
- package/.output/server/node_modules/knex/lib/query/constants.js +15 -0
- package/.output/server/node_modules/knex/lib/query/joinclause.js +270 -0
- package/.output/server/node_modules/knex/lib/query/method-constants.js +136 -0
- package/.output/server/node_modules/knex/lib/query/querybuilder.js +1793 -0
- package/.output/server/node_modules/knex/lib/query/querycompiler.js +1591 -0
- package/.output/server/node_modules/knex/lib/raw.js +139 -0
- package/.output/server/node_modules/knex/lib/ref.js +39 -0
- package/.output/server/node_modules/knex/lib/schema/builder.js +115 -0
- package/.output/server/node_modules/knex/lib/schema/columnbuilder.js +146 -0
- package/.output/server/node_modules/knex/lib/schema/columncompiler.js +307 -0
- package/.output/server/node_modules/knex/lib/schema/compiler.js +187 -0
- package/.output/server/node_modules/knex/lib/schema/internal/helpers.js +55 -0
- package/.output/server/node_modules/knex/lib/schema/tablebuilder.js +376 -0
- package/.output/server/node_modules/knex/lib/schema/tablecompiler.js +439 -0
- package/.output/server/node_modules/knex/lib/schema/viewbuilder.js +92 -0
- package/.output/server/node_modules/knex/lib/schema/viewcompiler.js +138 -0
- package/.output/server/node_modules/knex/lib/util/finally-mixin.js +13 -0
- package/.output/server/node_modules/knex/lib/util/helpers.js +95 -0
- package/.output/server/node_modules/knex/lib/util/is.js +32 -0
- package/.output/server/node_modules/knex/lib/util/nanoid.js +40 -0
- package/.output/server/node_modules/knex/lib/util/noop.js +1 -0
- package/.output/server/node_modules/knex/lib/util/save-async-stack.js +14 -0
- package/.output/server/node_modules/knex/lib/util/security.js +26 -0
- package/.output/server/node_modules/knex/lib/util/string.js +190 -0
- package/.output/server/node_modules/knex/lib/util/timeout.js +29 -0
- package/.output/server/node_modules/knex/node_modules/debug/node_modules/ms/index.js +162 -0
- package/.output/server/node_modules/knex/node_modules/debug/node_modules/ms/package.json +37 -0
- package/.output/server/node_modules/knex/node_modules/debug/package.json +59 -0
- package/.output/server/node_modules/knex/node_modules/debug/src/browser.js +269 -0
- package/.output/server/node_modules/knex/node_modules/debug/src/common.js +274 -0
- package/.output/server/node_modules/knex/node_modules/debug/src/index.js +10 -0
- package/.output/server/node_modules/knex/node_modules/debug/src/node.js +263 -0
- package/.output/server/node_modules/knex/node_modules/pg-connection-string/index.js +112 -0
- package/.output/server/node_modules/knex/node_modules/pg-connection-string/package.json +40 -0
- package/.output/server/node_modules/knex/package.json +267 -0
- package/.output/server/node_modules/lodash/_DataView.js +7 -0
- package/.output/server/node_modules/lodash/_Hash.js +32 -0
- package/.output/server/node_modules/lodash/_ListCache.js +32 -0
- package/.output/server/node_modules/lodash/_Map.js +7 -0
- package/.output/server/node_modules/lodash/_MapCache.js +32 -0
- package/.output/server/node_modules/lodash/_Promise.js +7 -0
- package/.output/server/node_modules/lodash/_Set.js +7 -0
- package/.output/server/node_modules/lodash/_SetCache.js +27 -0
- package/.output/server/node_modules/lodash/_Stack.js +27 -0
- package/.output/server/node_modules/lodash/_Symbol.js +6 -0
- package/.output/server/node_modules/lodash/_Uint8Array.js +6 -0
- package/.output/server/node_modules/lodash/_WeakMap.js +7 -0
- package/.output/server/node_modules/lodash/_apply.js +21 -0
- package/.output/server/node_modules/lodash/_arrayAggregator.js +22 -0
- package/.output/server/node_modules/lodash/_arrayEach.js +22 -0
- package/.output/server/node_modules/lodash/_arrayFilter.js +25 -0
- package/.output/server/node_modules/lodash/_arrayIncludes.js +17 -0
- package/.output/server/node_modules/lodash/_arrayIncludesWith.js +22 -0
- package/.output/server/node_modules/lodash/_arrayLikeKeys.js +49 -0
- package/.output/server/node_modules/lodash/_arrayMap.js +21 -0
- package/.output/server/node_modules/lodash/_arrayPush.js +20 -0
- package/.output/server/node_modules/lodash/_arrayReduce.js +26 -0
- package/.output/server/node_modules/lodash/_arraySome.js +23 -0
- package/.output/server/node_modules/lodash/_asciiToArray.js +12 -0
- package/.output/server/node_modules/lodash/_assignMergeValue.js +20 -0
- package/.output/server/node_modules/lodash/_assignValue.js +28 -0
- package/.output/server/node_modules/lodash/_assocIndexOf.js +21 -0
- package/.output/server/node_modules/lodash/_baseAggregator.js +21 -0
- package/.output/server/node_modules/lodash/_baseAssign.js +17 -0
- package/.output/server/node_modules/lodash/_baseAssignIn.js +17 -0
- package/.output/server/node_modules/lodash/_baseAssignValue.js +25 -0
- package/.output/server/node_modules/lodash/_baseClone.js +166 -0
- package/.output/server/node_modules/lodash/_baseCreate.js +30 -0
- package/.output/server/node_modules/lodash/_baseDelay.js +21 -0
- package/.output/server/node_modules/lodash/_baseDifference.js +67 -0
- package/.output/server/node_modules/lodash/_baseEach.js +14 -0
- package/.output/server/node_modules/lodash/_baseExtremum.js +32 -0
- package/.output/server/node_modules/lodash/_baseFilter.js +21 -0
- package/.output/server/node_modules/lodash/_baseFindIndex.js +24 -0
- package/.output/server/node_modules/lodash/_baseFlatten.js +38 -0
- package/.output/server/node_modules/lodash/_baseFor.js +16 -0
- package/.output/server/node_modules/lodash/_baseForOwn.js +16 -0
- package/.output/server/node_modules/lodash/_baseGet.js +24 -0
- package/.output/server/node_modules/lodash/_baseGetAllKeys.js +20 -0
- package/.output/server/node_modules/lodash/_baseGetTag.js +28 -0
- package/.output/server/node_modules/lodash/_baseGt.js +14 -0
- package/.output/server/node_modules/lodash/_baseHas.js +19 -0
- package/.output/server/node_modules/lodash/_baseHasIn.js +13 -0
- package/.output/server/node_modules/lodash/_baseIndexOf.js +20 -0
- package/.output/server/node_modules/lodash/_baseIsArguments.js +18 -0
- package/.output/server/node_modules/lodash/_baseIsEqual.js +28 -0
- package/.output/server/node_modules/lodash/_baseIsEqualDeep.js +83 -0
- package/.output/server/node_modules/lodash/_baseIsMap.js +18 -0
- package/.output/server/node_modules/lodash/_baseIsMatch.js +62 -0
- package/.output/server/node_modules/lodash/_baseIsNaN.js +12 -0
- package/.output/server/node_modules/lodash/_baseIsNative.js +47 -0
- package/.output/server/node_modules/lodash/_baseIsSet.js +18 -0
- package/.output/server/node_modules/lodash/_baseIsTypedArray.js +60 -0
- package/.output/server/node_modules/lodash/_baseIteratee.js +31 -0
- package/.output/server/node_modules/lodash/_baseKeys.js +30 -0
- package/.output/server/node_modules/lodash/_baseKeysIn.js +33 -0
- package/.output/server/node_modules/lodash/_baseMap.js +22 -0
- package/.output/server/node_modules/lodash/_baseMatches.js +22 -0
- package/.output/server/node_modules/lodash/_baseMatchesProperty.js +33 -0
- package/.output/server/node_modules/lodash/_baseMerge.js +42 -0
- package/.output/server/node_modules/lodash/_baseMergeDeep.js +94 -0
- package/.output/server/node_modules/lodash/_baseOrderBy.js +49 -0
- package/.output/server/node_modules/lodash/_basePickBy.js +30 -0
- package/.output/server/node_modules/lodash/_baseProperty.js +14 -0
- package/.output/server/node_modules/lodash/_basePropertyDeep.js +16 -0
- package/.output/server/node_modules/lodash/_basePropertyOf.js +14 -0
- package/.output/server/node_modules/lodash/_baseReduce.js +23 -0
- package/.output/server/node_modules/lodash/_baseRest.js +17 -0
- package/.output/server/node_modules/lodash/_baseSet.js +51 -0
- package/.output/server/node_modules/lodash/_baseSetToString.js +22 -0
- package/.output/server/node_modules/lodash/_baseSlice.js +31 -0
- package/.output/server/node_modules/lodash/_baseSome.js +22 -0
- package/.output/server/node_modules/lodash/_baseSortBy.js +21 -0
- package/.output/server/node_modules/lodash/_baseTimes.js +20 -0
- package/.output/server/node_modules/lodash/_baseToString.js +37 -0
- package/.output/server/node_modules/lodash/_baseTrim.js +19 -0
- package/.output/server/node_modules/lodash/_baseUnary.js +14 -0
- package/.output/server/node_modules/lodash/_baseUniq.js +72 -0
- package/.output/server/node_modules/lodash/_baseValues.js +19 -0
- package/.output/server/node_modules/lodash/_cacheHas.js +13 -0
- package/.output/server/node_modules/lodash/_castFunction.js +14 -0
- package/.output/server/node_modules/lodash/_castPath.js +21 -0
- package/.output/server/node_modules/lodash/_cloneArrayBuffer.js +16 -0
- package/.output/server/node_modules/lodash/_cloneBuffer.js +35 -0
- package/.output/server/node_modules/lodash/_cloneDataView.js +16 -0
- package/.output/server/node_modules/lodash/_cloneRegExp.js +17 -0
- package/.output/server/node_modules/lodash/_cloneSymbol.js +18 -0
- package/.output/server/node_modules/lodash/_cloneTypedArray.js +16 -0
- package/.output/server/node_modules/lodash/_compareAscending.js +41 -0
- package/.output/server/node_modules/lodash/_compareMultiple.js +44 -0
- package/.output/server/node_modules/lodash/_copyArray.js +20 -0
- package/.output/server/node_modules/lodash/_copyObject.js +40 -0
- package/.output/server/node_modules/lodash/_copySymbols.js +16 -0
- package/.output/server/node_modules/lodash/_copySymbolsIn.js +16 -0
- package/.output/server/node_modules/lodash/_coreJsData.js +6 -0
- package/.output/server/node_modules/lodash/_createAggregator.js +23 -0
- package/.output/server/node_modules/lodash/_createAssigner.js +37 -0
- package/.output/server/node_modules/lodash/_createBaseEach.js +32 -0
- package/.output/server/node_modules/lodash/_createBaseFor.js +25 -0
- package/.output/server/node_modules/lodash/_createSet.js +19 -0
- package/.output/server/node_modules/lodash/_customDefaultsAssignIn.js +29 -0
- package/.output/server/node_modules/lodash/_defineProperty.js +11 -0
- package/.output/server/node_modules/lodash/_equalArrays.js +84 -0
- package/.output/server/node_modules/lodash/_equalByTag.js +112 -0
- package/.output/server/node_modules/lodash/_equalObjects.js +90 -0
- package/.output/server/node_modules/lodash/_escapeHtmlChar.js +21 -0
- package/.output/server/node_modules/lodash/_escapeStringChar.js +22 -0
- package/.output/server/node_modules/lodash/_freeGlobal.js +4 -0
- package/.output/server/node_modules/lodash/_getAllKeys.js +16 -0
- package/.output/server/node_modules/lodash/_getAllKeysIn.js +17 -0
- package/.output/server/node_modules/lodash/_getMapData.js +18 -0
- package/.output/server/node_modules/lodash/_getMatchData.js +24 -0
- package/.output/server/node_modules/lodash/_getNative.js +17 -0
- package/.output/server/node_modules/lodash/_getPrototype.js +6 -0
- package/.output/server/node_modules/lodash/_getRawTag.js +46 -0
- package/.output/server/node_modules/lodash/_getSymbols.js +30 -0
- package/.output/server/node_modules/lodash/_getSymbolsIn.js +25 -0
- package/.output/server/node_modules/lodash/_getTag.js +58 -0
- package/.output/server/node_modules/lodash/_getValue.js +13 -0
- package/.output/server/node_modules/lodash/_hasPath.js +39 -0
- package/.output/server/node_modules/lodash/_hasUnicode.js +26 -0
- package/.output/server/node_modules/lodash/_hashClear.js +15 -0
- package/.output/server/node_modules/lodash/_hashDelete.js +17 -0
- package/.output/server/node_modules/lodash/_hashGet.js +30 -0
- package/.output/server/node_modules/lodash/_hashHas.js +23 -0
- package/.output/server/node_modules/lodash/_hashSet.js +23 -0
- package/.output/server/node_modules/lodash/_initCloneArray.js +26 -0
- package/.output/server/node_modules/lodash/_initCloneByTag.js +77 -0
- package/.output/server/node_modules/lodash/_initCloneObject.js +18 -0
- package/.output/server/node_modules/lodash/_isFlattenable.js +20 -0
- package/.output/server/node_modules/lodash/_isIndex.js +25 -0
- package/.output/server/node_modules/lodash/_isIterateeCall.js +30 -0
- package/.output/server/node_modules/lodash/_isKey.js +29 -0
- package/.output/server/node_modules/lodash/_isKeyable.js +15 -0
- package/.output/server/node_modules/lodash/_isMasked.js +20 -0
- package/.output/server/node_modules/lodash/_isPrototype.js +18 -0
- package/.output/server/node_modules/lodash/_isStrictComparable.js +15 -0
- package/.output/server/node_modules/lodash/_iteratorToArray.js +18 -0
- package/.output/server/node_modules/lodash/_listCacheClear.js +13 -0
- package/.output/server/node_modules/lodash/_listCacheDelete.js +35 -0
- package/.output/server/node_modules/lodash/_listCacheGet.js +19 -0
- package/.output/server/node_modules/lodash/_listCacheHas.js +16 -0
- package/.output/server/node_modules/lodash/_listCacheSet.js +26 -0
- package/.output/server/node_modules/lodash/_mapCacheClear.js +21 -0
- package/.output/server/node_modules/lodash/_mapCacheDelete.js +18 -0
- package/.output/server/node_modules/lodash/_mapCacheGet.js +16 -0
- package/.output/server/node_modules/lodash/_mapCacheHas.js +16 -0
- package/.output/server/node_modules/lodash/_mapCacheSet.js +22 -0
- package/.output/server/node_modules/lodash/_mapToArray.js +18 -0
- package/.output/server/node_modules/lodash/_matchesStrictComparable.js +20 -0
- package/.output/server/node_modules/lodash/_memoizeCapped.js +26 -0
- package/.output/server/node_modules/lodash/_nativeCreate.js +6 -0
- package/.output/server/node_modules/lodash/_nativeKeys.js +6 -0
- package/.output/server/node_modules/lodash/_nativeKeysIn.js +20 -0
- package/.output/server/node_modules/lodash/_nodeUtil.js +30 -0
- package/.output/server/node_modules/lodash/_objectToString.js +22 -0
- package/.output/server/node_modules/lodash/_overArg.js +15 -0
- package/.output/server/node_modules/lodash/_overRest.js +36 -0
- package/.output/server/node_modules/lodash/_reEscape.js +4 -0
- package/.output/server/node_modules/lodash/_reEvaluate.js +4 -0
- package/.output/server/node_modules/lodash/_reInterpolate.js +4 -0
- package/.output/server/node_modules/lodash/_root.js +9 -0
- package/.output/server/node_modules/lodash/_safeGet.js +21 -0
- package/.output/server/node_modules/lodash/_setCacheAdd.js +19 -0
- package/.output/server/node_modules/lodash/_setCacheHas.js +14 -0
- package/.output/server/node_modules/lodash/_setToArray.js +18 -0
- package/.output/server/node_modules/lodash/_setToString.js +14 -0
- package/.output/server/node_modules/lodash/_shortOut.js +37 -0
- package/.output/server/node_modules/lodash/_stackClear.js +15 -0
- package/.output/server/node_modules/lodash/_stackDelete.js +18 -0
- package/.output/server/node_modules/lodash/_stackGet.js +14 -0
- package/.output/server/node_modules/lodash/_stackHas.js +14 -0
- package/.output/server/node_modules/lodash/_stackSet.js +34 -0
- package/.output/server/node_modules/lodash/_strictIndexOf.js +23 -0
- package/.output/server/node_modules/lodash/_stringToArray.js +18 -0
- package/.output/server/node_modules/lodash/_stringToPath.js +27 -0
- package/.output/server/node_modules/lodash/_toKey.js +21 -0
- package/.output/server/node_modules/lodash/_toSource.js +26 -0
- package/.output/server/node_modules/lodash/_trimmedEndIndex.js +19 -0
- package/.output/server/node_modules/lodash/_unicodeToArray.js +40 -0
- package/.output/server/node_modules/lodash/assign.js +58 -0
- package/.output/server/node_modules/lodash/assignIn.js +40 -0
- package/.output/server/node_modules/lodash/assignInWith.js +38 -0
- package/.output/server/node_modules/lodash/attempt.js +35 -0
- package/.output/server/node_modules/lodash/chunk.js +50 -0
- package/.output/server/node_modules/lodash/clone.js +36 -0
- package/.output/server/node_modules/lodash/cloneDeep.js +29 -0
- package/.output/server/node_modules/lodash/compact.js +31 -0
- package/.output/server/node_modules/lodash/constant.js +26 -0
- package/.output/server/node_modules/lodash/defaults.js +64 -0
- package/.output/server/node_modules/lodash/defer.js +26 -0
- package/.output/server/node_modules/lodash/differenceWith.js +40 -0
- package/.output/server/node_modules/lodash/each.js +1 -0
- package/.output/server/node_modules/lodash/eq.js +37 -0
- package/.output/server/node_modules/lodash/escape.js +43 -0
- package/.output/server/node_modules/lodash/extend.js +1 -0
- package/.output/server/node_modules/lodash/filter.js +52 -0
- package/.output/server/node_modules/lodash/first.js +1 -0
- package/.output/server/node_modules/lodash/flatten.js +22 -0
- package/.output/server/node_modules/lodash/forEach.js +41 -0
- package/.output/server/node_modules/lodash/get.js +33 -0
- package/.output/server/node_modules/lodash/groupBy.js +41 -0
- package/.output/server/node_modules/lodash/has.js +35 -0
- package/.output/server/node_modules/lodash/hasIn.js +34 -0
- package/.output/server/node_modules/lodash/head.js +23 -0
- package/.output/server/node_modules/lodash/identity.js +21 -0
- package/.output/server/node_modules/lodash/includes.js +53 -0
- package/.output/server/node_modules/lodash/indexOf.js +42 -0
- package/.output/server/node_modules/lodash/isArguments.js +36 -0
- package/.output/server/node_modules/lodash/isArray.js +26 -0
- package/.output/server/node_modules/lodash/isArrayLike.js +33 -0
- package/.output/server/node_modules/lodash/isArrayLikeObject.js +33 -0
- package/.output/server/node_modules/lodash/isBuffer.js +38 -0
- package/.output/server/node_modules/lodash/isEmpty.js +77 -0
- package/.output/server/node_modules/lodash/isError.js +36 -0
- package/.output/server/node_modules/lodash/isFunction.js +37 -0
- package/.output/server/node_modules/lodash/isLength.js +35 -0
- package/.output/server/node_modules/lodash/isMap.js +27 -0
- package/.output/server/node_modules/lodash/isNil.js +25 -0
- package/.output/server/node_modules/lodash/isObject.js +31 -0
- package/.output/server/node_modules/lodash/isObjectLike.js +29 -0
- package/.output/server/node_modules/lodash/isPlainObject.js +62 -0
- package/.output/server/node_modules/lodash/isSet.js +27 -0
- package/.output/server/node_modules/lodash/isString.js +30 -0
- package/.output/server/node_modules/lodash/isSymbol.js +29 -0
- package/.output/server/node_modules/lodash/isTypedArray.js +27 -0
- package/.output/server/node_modules/lodash/keys.js +37 -0
- package/.output/server/node_modules/lodash/keysIn.js +32 -0
- package/.output/server/node_modules/lodash/last.js +20 -0
- package/.output/server/node_modules/lodash/map.js +53 -0
- package/.output/server/node_modules/lodash/max.js +29 -0
- package/.output/server/node_modules/lodash/memoize.js +73 -0
- package/.output/server/node_modules/lodash/merge.js +39 -0
- package/.output/server/node_modules/lodash/negate.js +40 -0
- package/.output/server/node_modules/lodash/noop.js +17 -0
- package/.output/server/node_modules/lodash/omitBy.js +29 -0
- package/.output/server/node_modules/lodash/package.json +19 -0
- package/.output/server/node_modules/lodash/pickBy.js +37 -0
- package/.output/server/node_modules/lodash/property.js +32 -0
- package/.output/server/node_modules/lodash/reduce.js +51 -0
- package/.output/server/node_modules/lodash/reject.js +46 -0
- package/.output/server/node_modules/lodash/some.js +51 -0
- package/.output/server/node_modules/lodash/sortBy.js +48 -0
- package/.output/server/node_modules/lodash/stubArray.js +23 -0
- package/.output/server/node_modules/lodash/stubFalse.js +18 -0
- package/.output/server/node_modules/lodash/tail.js +22 -0
- package/.output/server/node_modules/lodash/template.js +272 -0
- package/.output/server/node_modules/lodash/templateSettings.js +67 -0
- package/.output/server/node_modules/lodash/toArray.js +58 -0
- package/.output/server/node_modules/lodash/toFinite.js +42 -0
- package/.output/server/node_modules/lodash/toInteger.js +36 -0
- package/.output/server/node_modules/lodash/toNumber.js +64 -0
- package/.output/server/node_modules/lodash/toPlainObject.js +32 -0
- package/.output/server/node_modules/lodash/toString.js +28 -0
- package/.output/server/node_modules/lodash/transform.js +65 -0
- package/.output/server/node_modules/lodash/uniq.js +25 -0
- package/.output/server/node_modules/lodash/uniqueId.js +28 -0
- package/.output/server/node_modules/lodash/values.js +34 -0
- package/.output/server/node_modules/papaparse/package.json +58 -0
- package/.output/server/node_modules/papaparse/papaparse.js +1945 -0
- package/.output/server/node_modules/pg/node_modules/pg-connection-string/index.js +112 -0
- package/.output/server/node_modules/pg/node_modules/pg-connection-string/package.json +40 -0
- package/.output/server/node_modules/safer-buffer/package.json +34 -0
- package/.output/server/node_modules/safer-buffer/safer.js +77 -0
- package/.output/server/node_modules/ssh2/lib/Channel.js +295 -0
- package/.output/server/node_modules/ssh2/lib/agent.js +1123 -0
- package/.output/server/node_modules/ssh2/lib/client.js +2176 -0
- package/.output/server/node_modules/ssh2/lib/http-agents.js +84 -0
- package/.output/server/node_modules/ssh2/lib/index.js +44 -0
- package/.output/server/node_modules/ssh2/lib/keygen.js +582 -0
- package/.output/server/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
- package/.output/server/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
- package/.output/server/node_modules/ssh2/lib/protocol/constants.js +356 -0
- package/.output/server/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
- package/.output/server/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
- package/.output/server/node_modules/ssh2/lib/protocol/handlers.js +16 -0
- package/.output/server/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
- package/.output/server/node_modules/ssh2/lib/protocol/kex.js +1908 -0
- package/.output/server/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
- package/.output/server/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
- package/.output/server/node_modules/ssh2/lib/protocol/utils.js +356 -0
- package/.output/server/node_modules/ssh2/lib/protocol/zlib.js +255 -0
- package/.output/server/node_modules/ssh2/lib/server.js +1380 -0
- package/.output/server/node_modules/ssh2/lib/utils.js +336 -0
- package/.output/server/node_modules/ssh2/package.json +49 -0
- package/.output/server/node_modules/ssh2/util/pagent.exe +0 -0
- package/.output/server/node_modules/tarn/dist/PendingOperation.js +48 -0
- package/.output/server/node_modules/tarn/dist/Pool.js +516 -0
- package/.output/server/node_modules/tarn/dist/PromiseInspection.js +21 -0
- package/.output/server/node_modules/tarn/dist/Resource.js +19 -0
- package/.output/server/node_modules/tarn/dist/TimeoutError.js +5 -0
- package/.output/server/node_modules/tarn/dist/tarn.js +10 -0
- package/.output/server/node_modules/tarn/dist/utils.js +60 -0
- package/.output/server/node_modules/tarn/package.json +66 -0
- package/.output/server/node_modules/tweetnacl/nacl-fast.js +2388 -0
- package/.output/server/node_modules/tweetnacl/package.json +58 -0
- package/.output/server/package.json +20 -35
- package/package.json +1 -1
- package/.output/public/_nuxt/AKIL8y6B.js +0 -1
- package/.output/public/_nuxt/B5vWsFeq.js +0 -160
- package/.output/public/_nuxt/B7OaQ1wH.js +0 -8
- package/.output/public/_nuxt/BG-9_o0s.js +0 -3
- package/.output/public/_nuxt/BHnp06h8.js +0 -1
- package/.output/public/_nuxt/BKxFOGv6.js +0 -1
- package/.output/public/_nuxt/BNIRlgC1.js +0 -1
- package/.output/public/_nuxt/BNdHe5KI.js +0 -1
- package/.output/public/_nuxt/BQANhp-y.js +0 -1
- package/.output/public/_nuxt/BUYy1lWT.js +0 -215
- package/.output/public/_nuxt/Ber6tLDb.js +0 -1
- package/.output/public/_nuxt/BgEovngA.js +0 -1
- package/.output/public/_nuxt/BhgYrVrc.js +0 -6
- package/.output/public/_nuxt/BmnOz39b.js +0 -2
- package/.output/public/_nuxt/BuKJVBv4.js +0 -1
- package/.output/public/_nuxt/BxMjn94S.js +0 -4
- package/.output/public/_nuxt/C1dxTB9p.js +0 -39
- package/.output/public/_nuxt/C4mc67xO.js +0 -31
- package/.output/public/_nuxt/CAOPafml.js +0 -1
- package/.output/public/_nuxt/CPxn9ATh.js +0 -1
- package/.output/public/_nuxt/CQ_P7x7z.js +0 -3
- package/.output/public/_nuxt/CS9PCQVw.js +0 -6
- package/.output/public/_nuxt/CdEjcJco.js +0 -1
- package/.output/public/_nuxt/CeQk_zaG.js +0 -3867
- package/.output/public/_nuxt/CijEBUIh.js +0 -9
- package/.output/public/_nuxt/Cn-07UHL.js +0 -1
- package/.output/public/_nuxt/D4_A4fm4.js +0 -1
- package/.output/public/_nuxt/DAs4584G.js +0 -72
- package/.output/public/_nuxt/DBO1CAN4.js +0 -1
- package/.output/public/_nuxt/DF7Phtj8.js +0 -39
- package/.output/public/_nuxt/DMMO4O3Y.js +0 -1
- package/.output/public/_nuxt/DP-hoxaC.js +0 -1
- package/.output/public/_nuxt/DREcM-oC.js +0 -20
- package/.output/public/_nuxt/DX-rdvVh.js +0 -28
- package/.output/public/_nuxt/DXei3mDv.js +0 -1
- package/.output/public/_nuxt/DZcRPyDc.js +0 -26
- package/.output/public/_nuxt/D_QjJZ_n.js +0 -1
- package/.output/public/_nuxt/Dj2IVxO7.js +0 -1
- package/.output/public/_nuxt/DmMeuvwr.js +0 -1
- package/.output/public/_nuxt/DqlhGxxN.js +0 -32
- package/.output/public/_nuxt/DynamicTable.DJeANwbG.css +0 -1
- package/.output/public/_nuxt/GmXmO94-.js +0 -1
- package/.output/public/_nuxt/HPyUOgdi.js +0 -1
- package/.output/public/_nuxt/MdxV8r4v.js +0 -1
- package/.output/public/_nuxt/Mp6jDt1I.js +0 -1
- package/.output/public/_nuxt/QuickQuery.h4epNPla.css +0 -1
- package/.output/public/_nuxt/WrapperErdDiagram.DeMTjOwN.css +0 -1
- package/.output/public/_nuxt/Zvfofmwe.js +0 -1
- package/.output/public/_nuxt/_fileId_.BHiWIaF7.css +0 -1
- package/.output/public/_nuxt/builds/meta/db42d692-1628-4dd8-9442-d7621bdd9ac6.json +0 -1
- package/.output/public/_nuxt/cQYBDqKG.js +0 -1
- package/.output/public/_nuxt/default.BfdyU-m9.css +0 -1
- package/.output/public/_nuxt/entry.0UG0MnUy.css +0 -1
- package/.output/public/_nuxt/fIC3FurW.js +0 -1
- package/.output/public/_nuxt/index.BHg08rtV.css +0 -1
- package/.output/public/_nuxt/n9bD6NrC.js +0 -2
- package/.output/public/_nuxt/ykQL1ia3.js +0 -271
- package/.output/public/_nuxt/zD3bTrJp.js +0 -1
- package/.output/server/chunks/routes/api/database-roles/adapters/postgres.adapter.mjs +0 -700
- package/.output/server/chunks/routes/api/database-roles/adapters/postgres.adapter.mjs.map +0 -1
- package/.output/server/chunks/routes/api/database-roles/adapters/types.mjs +0 -2
- package/.output/server/chunks/routes/api/database-roles/adapters/types.mjs.map +0 -1
- package/.output/server/chunks/routes/api/database-roles/index.mjs +0 -39
- package/.output/server/chunks/routes/api/database-roles/index.mjs.map +0 -1
- package/.output/server/chunks/routes/api/delete-function.mjs +0 -65
- package/.output/server/chunks/routes/api/delete-function.mjs.map +0 -1
- package/.output/server/chunks/routes/api/execute-bulk-delete.mjs +0 -100
- package/.output/server/chunks/routes/api/execute-bulk-delete.mjs.map +0 -1
- package/.output/server/chunks/routes/api/execute-bulk-update.mjs +0 -105
- package/.output/server/chunks/routes/api/execute-bulk-update.mjs.map +0 -1
- package/.output/server/chunks/routes/api/execute.mjs +0 -47
- package/.output/server/chunks/routes/api/execute.mjs.map +0 -1
- package/.output/server/chunks/routes/api/export-table-data.mjs +0 -229
- package/.output/server/chunks/routes/api/export-table-data.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-function-signature.mjs +0 -96
- package/.output/server/chunks/routes/api/get-function-signature.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-one-function.mjs +0 -34
- package/.output/server/chunks/routes/api/get-one-function.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-one-table.mjs +0 -180
- package/.output/server/chunks/routes/api/get-one-table.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-over-view-function.mjs +0 -41
- package/.output/server/chunks/routes/api/get-over-view-function.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-over-view-tables.mjs +0 -53
- package/.output/server/chunks/routes/api/get-over-view-tables.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-over-view-views.mjs +0 -44
- package/.output/server/chunks/routes/api/get-over-view-views.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-reverse-table-schemas.mjs +0 -123
- package/.output/server/chunks/routes/api/get-reverse-table-schemas.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-schema-meta-data.mjs +0 -220
- package/.output/server/chunks/routes/api/get-schema-meta-data.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-table-ddl.mjs +0 -185
- package/.output/server/chunks/routes/api/get-table-ddl.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-table-size.mjs +0 -49
- package/.output/server/chunks/routes/api/get-table-size.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-table-structure.mjs +0 -111
- package/.output/server/chunks/routes/api/get-table-structure.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-tables.mjs +0 -287
- package/.output/server/chunks/routes/api/get-tables.mjs.map +0 -1
- package/.output/server/chunks/routes/api/get-view-definition.mjs +0 -57
- package/.output/server/chunks/routes/api/get-view-definition.mjs.map +0 -1
- package/.output/server/chunks/routes/api/getMetricMonitor.mjs +0 -46
- package/.output/server/chunks/routes/api/getMetricMonitor.mjs.map +0 -1
- package/.output/server/chunks/routes/api/raw-execute.mjs +0 -47
- package/.output/server/chunks/routes/api/raw-execute.mjs.map +0 -1
- package/.output/server/chunks/routes/api/rename-function.mjs +0 -77
- package/.output/server/chunks/routes/api/rename-function.mjs.map +0 -1
- package/.output/server/chunks/routes/api/update-function.mjs +0 -65
- package/.output/server/chunks/routes/api/update-function.mjs.map +0 -1
- package/.output/server/node_modules/@ioredis/commands/built/commands.json +0 -2447
- package/.output/server/node_modules/@ioredis/commands/built/index.js +0 -208
- package/.output/server/node_modules/@ioredis/commands/package.json +0 -52
- package/.output/server/node_modules/@sqltools/formatter/lib/core/Formatter.js +0 -234
- package/.output/server/node_modules/@sqltools/formatter/lib/core/Indentation.js +0 -42
- package/.output/server/node_modules/@sqltools/formatter/lib/core/InlineBlock.js +0 -60
- package/.output/server/node_modules/@sqltools/formatter/lib/core/Params.js +0 -21
- package/.output/server/node_modules/@sqltools/formatter/lib/core/Tokenizer.js +0 -272
- package/.output/server/node_modules/@sqltools/formatter/lib/core/escapeRegExp.js +0 -10
- package/.output/server/node_modules/@sqltools/formatter/lib/core/last.js +0 -7
- package/.output/server/node_modules/@sqltools/formatter/lib/core/types.js +0 -22
- package/.output/server/node_modules/@sqltools/formatter/lib/languages/Db2Formatter.js +0 -585
- package/.output/server/node_modules/@sqltools/formatter/lib/languages/N1qlFormatter.js +0 -257
- package/.output/server/node_modules/@sqltools/formatter/lib/languages/PlSqlFormatter.js +0 -459
- package/.output/server/node_modules/@sqltools/formatter/lib/languages/StandardSqlFormatter.js +0 -369
- package/.output/server/node_modules/@sqltools/formatter/lib/languages/utils/abstract.js +0 -23
- package/.output/server/node_modules/@sqltools/formatter/lib/sqlFormatter.js +0 -34
- package/.output/server/node_modules/@sqltools/formatter/package.json +0 -59
- package/.output/server/node_modules/ansis/index.js +0 -1
- package/.output/server/node_modules/ansis/package.json +0 -28
- package/.output/server/node_modules/app-root-path/index.js +0 -4
- package/.output/server/node_modules/app-root-path/lib/app-root-path.js +0 -30
- package/.output/server/node_modules/app-root-path/lib/resolve.js +0 -128
- package/.output/server/node_modules/app-root-path/package.json +0 -66
- package/.output/server/node_modules/balanced-match/index.js +0 -62
- package/.output/server/node_modules/balanced-match/package.json +0 -48
- package/.output/server/node_modules/brace-expansion/index.js +0 -203
- package/.output/server/node_modules/brace-expansion/package.json +0 -46
- package/.output/server/node_modules/cluster-key-slot/lib/index.js +0 -166
- package/.output/server/node_modules/cluster-key-slot/package.json +0 -56
- package/.output/server/node_modules/dedent/dist/dedent.js +0 -73
- package/.output/server/node_modules/dedent/package.json +0 -119
- package/.output/server/node_modules/denque/index.js +0 -481
- package/.output/server/node_modules/denque/package.json +0 -58
- package/.output/server/node_modules/dotenv/lib/main.js +0 -361
- package/.output/server/node_modules/dotenv/package.json +0 -61
- package/.output/server/node_modules/glob/dist/commonjs/glob.js +0 -247
- package/.output/server/node_modules/glob/dist/commonjs/has-magic.js +0 -27
- package/.output/server/node_modules/glob/dist/commonjs/ignore.js +0 -119
- package/.output/server/node_modules/glob/dist/commonjs/index.js +0 -68
- package/.output/server/node_modules/glob/dist/commonjs/package.json +0 -3
- package/.output/server/node_modules/glob/dist/commonjs/pattern.js +0 -219
- package/.output/server/node_modules/glob/dist/commonjs/processor.js +0 -301
- package/.output/server/node_modules/glob/dist/commonjs/walker.js +0 -387
- package/.output/server/node_modules/glob/package.json +0 -99
- package/.output/server/node_modules/inherits/inherits.js +0 -9
- package/.output/server/node_modules/inherits/inherits_browser.js +0 -27
- package/.output/server/node_modules/inherits/package.json +0 -29
- package/.output/server/node_modules/ioredis/built/Command.js +0 -349
- package/.output/server/node_modules/ioredis/built/DataHandler.js +0 -220
- package/.output/server/node_modules/ioredis/built/Pipeline.js +0 -334
- package/.output/server/node_modules/ioredis/built/Redis.js +0 -697
- package/.output/server/node_modules/ioredis/built/ScanStream.js +0 -51
- package/.output/server/node_modules/ioredis/built/Script.js +0 -62
- package/.output/server/node_modules/ioredis/built/SubscriptionSet.js +0 -41
- package/.output/server/node_modules/ioredis/built/autoPipelining.js +0 -159
- package/.output/server/node_modules/ioredis/built/cluster/ClusterOptions.js +0 -22
- package/.output/server/node_modules/ioredis/built/cluster/ClusterSubscriber.js +0 -202
- package/.output/server/node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js +0 -224
- package/.output/server/node_modules/ioredis/built/cluster/ConnectionPool.js +0 -154
- package/.output/server/node_modules/ioredis/built/cluster/DelayQueue.js +0 -53
- package/.output/server/node_modules/ioredis/built/cluster/index.js +0 -862
- package/.output/server/node_modules/ioredis/built/cluster/util.js +0 -100
- package/.output/server/node_modules/ioredis/built/connectors/AbstractConnector.js +0 -26
- package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js +0 -45
- package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js +0 -37
- package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/index.js +0 -305
- package/.output/server/node_modules/ioredis/built/connectors/StandaloneConnector.js +0 -69
- package/.output/server/node_modules/ioredis/built/connectors/index.js +0 -7
- package/.output/server/node_modules/ioredis/built/constants/TLSProfiles.js +0 -149
- package/.output/server/node_modules/ioredis/built/errors/ClusterAllFailedError.js +0 -15
- package/.output/server/node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js +0 -14
- package/.output/server/node_modules/ioredis/built/errors/index.js +0 -5
- package/.output/server/node_modules/ioredis/built/index.js +0 -62
- package/.output/server/node_modules/ioredis/built/redis/RedisOptions.js +0 -55
- package/.output/server/node_modules/ioredis/built/redis/event_handler.js +0 -292
- package/.output/server/node_modules/ioredis/built/transaction.js +0 -93
- package/.output/server/node_modules/ioredis/built/utils/Commander.js +0 -117
- package/.output/server/node_modules/ioredis/built/utils/applyMixin.js +0 -8
- package/.output/server/node_modules/ioredis/built/utils/debug.js +0 -95
- package/.output/server/node_modules/ioredis/built/utils/index.js +0 -297
- package/.output/server/node_modules/ioredis/built/utils/lodash.js +0 -9
- package/.output/server/node_modules/ioredis/package.json +0 -100
- package/.output/server/node_modules/lodash.defaults/index.js +0 -668
- package/.output/server/node_modules/lodash.defaults/package.json +0 -19
- package/.output/server/node_modules/lodash.isarguments/index.js +0 -229
- package/.output/server/node_modules/lodash.isarguments/package.json +0 -19
- package/.output/server/node_modules/lru-cache/dist/commonjs/index.js +0 -1546
- package/.output/server/node_modules/lru-cache/dist/commonjs/package.json +0 -3
- package/.output/server/node_modules/lru-cache/package.json +0 -116
- package/.output/server/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +0 -14
- package/.output/server/node_modules/minimatch/dist/commonjs/ast.js +0 -592
- package/.output/server/node_modules/minimatch/dist/commonjs/brace-expressions.js +0 -152
- package/.output/server/node_modules/minimatch/dist/commonjs/escape.js +0 -22
- package/.output/server/node_modules/minimatch/dist/commonjs/index.js +0 -1017
- package/.output/server/node_modules/minimatch/dist/commonjs/package.json +0 -3
- package/.output/server/node_modules/minimatch/dist/commonjs/unescape.js +0 -24
- package/.output/server/node_modules/minimatch/package.json +0 -82
- package/.output/server/node_modules/minipass/dist/commonjs/index.js +0 -1028
- package/.output/server/node_modules/minipass/dist/commonjs/package.json +0 -3
- package/.output/server/node_modules/minipass/package.json +0 -82
- package/.output/server/node_modules/path-scurry/dist/commonjs/index.js +0 -2014
- package/.output/server/node_modules/path-scurry/dist/commonjs/package.json +0 -3
- package/.output/server/node_modules/path-scurry/package.json +0 -89
- package/.output/server/node_modules/redis-errors/index.js +0 -7
- package/.output/server/node_modules/redis-errors/lib/modern.js +0 -59
- package/.output/server/node_modules/redis-errors/lib/old.js +0 -119
- package/.output/server/node_modules/redis-errors/package.json +0 -41
- package/.output/server/node_modules/redis-parser/index.js +0 -3
- package/.output/server/node_modules/redis-parser/lib/parser.js +0 -552
- package/.output/server/node_modules/redis-parser/package.json +0 -53
- package/.output/server/node_modules/reflect-metadata/Reflect.js +0 -1415
- package/.output/server/node_modules/reflect-metadata/package.json +0 -68
- package/.output/server/node_modules/safe-buffer/index.js +0 -65
- package/.output/server/node_modules/safe-buffer/package.json +0 -51
- package/.output/server/node_modules/sha.js/hash.js +0 -81
- package/.output/server/node_modules/sha.js/index.js +0 -15
- package/.output/server/node_modules/sha.js/package.json +0 -30
- package/.output/server/node_modules/sha.js/sha.js +0 -94
- package/.output/server/node_modules/sha.js/sha1.js +0 -99
- package/.output/server/node_modules/sha.js/sha224.js +0 -53
- package/.output/server/node_modules/sha.js/sha256.js +0 -135
- package/.output/server/node_modules/sha.js/sha384.js +0 -57
- package/.output/server/node_modules/sha.js/sha512.js +0 -260
- package/.output/server/node_modules/sql-highlight/lib/escapeHtml.js +0 -59
- package/.output/server/node_modules/sql-highlight/lib/index.js +0 -85
- package/.output/server/node_modules/sql-highlight/lib/keywords.js +0 -145
- package/.output/server/node_modules/sql-highlight/package.json +0 -49
- package/.output/server/node_modules/standard-as-callback/built/index.js +0 -41
- package/.output/server/node_modules/standard-as-callback/built/utils.js +0 -23
- package/.output/server/node_modules/standard-as-callback/package.json +0 -40
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/.output/server/node_modules/typeorm/cache/DbQueryResultCache.js +0 -264
- package/.output/server/node_modules/typeorm/cache/QueryResultCacheFactory.js +0 -42
- package/.output/server/node_modules/typeorm/cache/RedisQueryResultCache.js +0 -197
- package/.output/server/node_modules/typeorm/common/DeepPartial.js +0 -4
- package/.output/server/node_modules/typeorm/common/EntityTarget.js +0 -4
- package/.output/server/node_modules/typeorm/common/MixedList.js +0 -4
- package/.output/server/node_modules/typeorm/common/ObjectLiteral.js +0 -4
- package/.output/server/node_modules/typeorm/common/ObjectType.js +0 -4
- package/.output/server/node_modules/typeorm/common/RelationType.js +0 -4
- package/.output/server/node_modules/typeorm/connection/Connection.js +0 -16
- package/.output/server/node_modules/typeorm/connection/ConnectionManager.js +0 -66
- package/.output/server/node_modules/typeorm/connection/ConnectionMetadataBuilder.js +0 -74
- package/.output/server/node_modules/typeorm/connection/ConnectionOptionsReader.js +0 -198
- package/.output/server/node_modules/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js +0 -111
- package/.output/server/node_modules/typeorm/container.js +0 -60
- package/.output/server/node_modules/typeorm/data-source/DataSource.js +0 -517
- package/.output/server/node_modules/typeorm/decorator/Check.js +0 -27
- package/.output/server/node_modules/typeorm/decorator/EntityRepository.js +0 -21
- package/.output/server/node_modules/typeorm/decorator/Exclusion.js +0 -27
- package/.output/server/node_modules/typeorm/decorator/ForeignKey.js +0 -44
- package/.output/server/node_modules/typeorm/decorator/Generated.js +0 -24
- package/.output/server/node_modules/typeorm/decorator/Index.js +0 -56
- package/.output/server/node_modules/typeorm/decorator/Unique.js +0 -50
- package/.output/server/node_modules/typeorm/decorator/columns/Column.js +0 -78
- package/.output/server/node_modules/typeorm/decorator/columns/CreateDateColumn.js +0 -21
- package/.output/server/node_modules/typeorm/decorator/columns/DeleteDateColumn.js +0 -20
- package/.output/server/node_modules/typeorm/decorator/columns/ObjectIdColumn.js +0 -27
- package/.output/server/node_modules/typeorm/decorator/columns/PrimaryColumn.js +0 -63
- package/.output/server/node_modules/typeorm/decorator/columns/PrimaryGeneratedColumn.js +0 -59
- package/.output/server/node_modules/typeorm/decorator/columns/UpdateDateColumn.js +0 -20
- package/.output/server/node_modules/typeorm/decorator/columns/VersionColumn.js +0 -21
- package/.output/server/node_modules/typeorm/decorator/columns/ViewColumn.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/columns/VirtualColumn.js +0 -49
- package/.output/server/node_modules/typeorm/decorator/entity/ChildEntity.js +0 -25
- package/.output/server/node_modules/typeorm/decorator/entity/Entity.js +0 -31
- package/.output/server/node_modules/typeorm/decorator/entity/TableInheritance.js +0 -22
- package/.output/server/node_modules/typeorm/decorator/entity-view/ViewEntity.js +0 -32
- package/.output/server/node_modules/typeorm/decorator/listeners/AfterInsert.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/AfterLoad.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/AfterRecover.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/AfterRemove.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/AfterSoftRemove.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/AfterUpdate.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/BeforeInsert.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/BeforeRecover.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/BeforeRemove.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/BeforeSoftRemove.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/BeforeUpdate.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/listeners/EventSubscriber.js +0 -17
- package/.output/server/node_modules/typeorm/decorator/options/ColumnOptions.js +0 -4
- package/.output/server/node_modules/typeorm/decorator/options/EntityOptions.js +0 -4
- package/.output/server/node_modules/typeorm/decorator/options/IndexOptions.js +0 -4
- package/.output/server/node_modules/typeorm/decorator/options/JoinColumnOptions.js +0 -4
- package/.output/server/node_modules/typeorm/decorator/options/JoinTableOptions.js +0 -4
- package/.output/server/node_modules/typeorm/decorator/options/RelationOptions.js +0 -4
- package/.output/server/node_modules/typeorm/decorator/options/ValueTransformer.js +0 -4
- package/.output/server/node_modules/typeorm/decorator/relations/JoinColumn.js +0 -27
- package/.output/server/node_modules/typeorm/decorator/relations/JoinTable.js +0 -34
- package/.output/server/node_modules/typeorm/decorator/relations/ManyToMany.js +0 -46
- package/.output/server/node_modules/typeorm/decorator/relations/ManyToOne.js +0 -46
- package/.output/server/node_modules/typeorm/decorator/relations/OneToMany.js +0 -37
- package/.output/server/node_modules/typeorm/decorator/relations/OneToOne.js +0 -45
- package/.output/server/node_modules/typeorm/decorator/relations/RelationCount.js +0 -23
- package/.output/server/node_modules/typeorm/decorator/relations/RelationId.js +0 -22
- package/.output/server/node_modules/typeorm/decorator/tree/Tree.js +0 -21
- package/.output/server/node_modules/typeorm/decorator/tree/TreeChildren.js +0 -34
- package/.output/server/node_modules/typeorm/decorator/tree/TreeLevelColumn.js +0 -19
- package/.output/server/node_modules/typeorm/decorator/tree/TreeParent.js +0 -33
- package/.output/server/node_modules/typeorm/driver/DriverFactory.js +0 -98
- package/.output/server/node_modules/typeorm/driver/DriverUtils.js +0 -228
- package/.output/server/node_modules/typeorm/driver/Query.js +0 -16
- package/.output/server/node_modules/typeorm/driver/SqlInMemory.js +0 -15
- package/.output/server/node_modules/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js +0 -847
- package/.output/server/node_modules/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js +0 -1709
- package/.output/server/node_modules/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js +0 -103
- package/.output/server/node_modules/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js +0 -146
- package/.output/server/node_modules/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js +0 -153
- package/.output/server/node_modules/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js +0 -126
- package/.output/server/node_modules/typeorm/driver/capacitor/CapacitorDriver.js +0 -78
- package/.output/server/node_modules/typeorm/driver/capacitor/CapacitorQueryRunner.js +0 -98
- package/.output/server/node_modules/typeorm/driver/cockroachdb/CockroachDriver.js +0 -885
- package/.output/server/node_modules/typeorm/driver/cockroachdb/CockroachQueryRunner.js +0 -2453
- package/.output/server/node_modules/typeorm/driver/cordova/CordovaDriver.js +0 -76
- package/.output/server/node_modules/typeorm/driver/cordova/CordovaQueryRunner.js +0 -170
- package/.output/server/node_modules/typeorm/driver/expo/ExpoDriver.js +0 -29
- package/.output/server/node_modules/typeorm/driver/expo/ExpoDriverFactory.js +0 -22
- package/.output/server/node_modules/typeorm/driver/expo/ExpoQueryRunner.js +0 -65
- package/.output/server/node_modules/typeorm/driver/expo/legacy/ExpoLegacyDriver.js +0 -75
- package/.output/server/node_modules/typeorm/driver/expo/legacy/ExpoLegacyQueryRunner.js +0 -169
- package/.output/server/node_modules/typeorm/driver/mongodb/MongoDriver.js +0 -404
- package/.output/server/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js +0 -701
- package/.output/server/node_modules/typeorm/driver/mongodb/bson.typings.js +0 -5
- package/.output/server/node_modules/typeorm/driver/mongodb/typings.js +0 -23
- package/.output/server/node_modules/typeorm/driver/mysql/MysqlDriver.js +0 -1105
- package/.output/server/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js +0 -2139
- package/.output/server/node_modules/typeorm/driver/nativescript/NativescriptDriver.js +0 -94
- package/.output/server/node_modules/typeorm/driver/nativescript/NativescriptQueryRunner.js +0 -92
- package/.output/server/node_modules/typeorm/driver/oracle/OracleDriver.js +0 -869
- package/.output/server/node_modules/typeorm/driver/oracle/OracleQueryRunner.js +0 -1884
- package/.output/server/node_modules/typeorm/driver/postgres/PostgresDriver.js +0 -1259
- package/.output/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js +0 -2729
- package/.output/server/node_modules/typeorm/driver/react-native/ReactNativeDriver.js +0 -728
- package/.output/server/node_modules/typeorm/driver/react-native/ReactNativeQueryRunner.js +0 -107
- package/.output/server/node_modules/typeorm/driver/sap/SapDriver.js +0 -681
- package/.output/server/node_modules/typeorm/driver/sap/SapQueryRunner.js +0 -2054
- package/.output/server/node_modules/typeorm/driver/spanner/SpannerDriver.js +0 -613
- package/.output/server/node_modules/typeorm/driver/spanner/SpannerQueryRunner.js +0 -1464
- package/.output/server/node_modules/typeorm/driver/sqlite/SqliteDriver.js +0 -174
- package/.output/server/node_modules/typeorm/driver/sqlite/SqliteQueryRunner.js +0 -124
- package/.output/server/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js +0 -695
- package/.output/server/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +0 -1511
- package/.output/server/node_modules/typeorm/driver/sqljs/SqljsDriver.js +0 -250
- package/.output/server/node_modules/typeorm/driver/sqljs/SqljsQueryRunner.js +0 -123
- package/.output/server/node_modules/typeorm/driver/sqlserver/MssqlParameter.js +0 -23
- package/.output/server/node_modules/typeorm/driver/sqlserver/SqlServerDriver.js +0 -922
- package/.output/server/node_modules/typeorm/driver/sqlserver/SqlServerQueryRunner.js +0 -2484
- package/.output/server/node_modules/typeorm/driver/types/DatabaseType.js +0 -4
- package/.output/server/node_modules/typeorm/driver/types/GeoJsonTypes.js +0 -4
- package/.output/server/node_modules/typeorm/driver/types/MetadataTableType.js +0 -11
- package/.output/server/node_modules/typeorm/driver/types/ReplicationMode.js +0 -4
- package/.output/server/node_modules/typeorm/entity-manager/EntityManager.js +0 -853
- package/.output/server/node_modules/typeorm/entity-manager/EntityManagerFactory.js +0 -24
- package/.output/server/node_modules/typeorm/entity-manager/MongoEntityManager.js +0 -668
- package/.output/server/node_modules/typeorm/entity-manager/SqljsEntityManager.js +0 -44
- package/.output/server/node_modules/typeorm/entity-schema/EntitySchema.js +0 -15
- package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js +0 -8
- package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaEmbeddedError.js +0 -18
- package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaOptions.js +0 -11
- package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaTransformer.js +0 -333
- package/.output/server/node_modules/typeorm/error/AlreadyHasActiveConnectionError.js +0 -16
- package/.output/server/node_modules/typeorm/error/CannotAttachTreeChildrenEntityError.js +0 -16
- package/.output/server/node_modules/typeorm/error/CannotConnectAlreadyConnectedError.js +0 -15
- package/.output/server/node_modules/typeorm/error/CannotCreateEntityIdMapError.js +0 -21
- package/.output/server/node_modules/typeorm/error/CannotDetermineEntityError.js +0 -16
- package/.output/server/node_modules/typeorm/error/CannotExecuteNotConnectedError.js +0 -15
- package/.output/server/node_modules/typeorm/error/CannotGetEntityManagerNotConnectedError.js +0 -15
- package/.output/server/node_modules/typeorm/error/CannotReflectMethodParameterTypeError.js +0 -18
- package/.output/server/node_modules/typeorm/error/CircularRelationsError.js +0 -16
- package/.output/server/node_modules/typeorm/error/ColumnTypeUndefinedError.js +0 -19
- package/.output/server/node_modules/typeorm/error/ConnectionIsNotSetError.js +0 -15
- package/.output/server/node_modules/typeorm/error/ConnectionNotFoundError.js +0 -15
- package/.output/server/node_modules/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js +0 -18
- package/.output/server/node_modules/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js +0 -18
- package/.output/server/node_modules/typeorm/error/CustomRepositoryNotFoundError.js +0 -18
- package/.output/server/node_modules/typeorm/error/DataTypeNotSupportedError.js +0 -14
- package/.output/server/node_modules/typeorm/error/DriverOptionNotSetError.js +0 -16
- package/.output/server/node_modules/typeorm/error/DriverPackageNotInstalledError.js +0 -16
- package/.output/server/node_modules/typeorm/error/EntityMetadataNotFoundError.js +0 -29
- package/.output/server/node_modules/typeorm/error/EntityNotFoundError.js +0 -42
- package/.output/server/node_modules/typeorm/error/EntityPropertyNotFoundError.js +0 -17
- package/.output/server/node_modules/typeorm/error/FindRelationsNotFoundError.js +0 -23
- package/.output/server/node_modules/typeorm/error/ForbiddenTransactionModeOverrideError.js +0 -16
- package/.output/server/node_modules/typeorm/error/InitializedRelationError.js +0 -20
- package/.output/server/node_modules/typeorm/error/InsertValuesMissingError.js +0 -16
- package/.output/server/node_modules/typeorm/error/LimitOnUpdateNotSupportedError.js +0 -15
- package/.output/server/node_modules/typeorm/error/LockNotSupportedOnGivenDriverError.js +0 -15
- package/.output/server/node_modules/typeorm/error/MetadataAlreadyExistsError.js +0 -18
- package/.output/server/node_modules/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js +0 -16
- package/.output/server/node_modules/typeorm/error/MissingDeleteDateColumnError.js +0 -12
- package/.output/server/node_modules/typeorm/error/MissingDriverError.js +0 -16
- package/.output/server/node_modules/typeorm/error/MissingJoinColumnError.js +0 -23
- package/.output/server/node_modules/typeorm/error/MissingJoinTableError.js +0 -23
- package/.output/server/node_modules/typeorm/error/MissingPrimaryColumnError.js +0 -13
- package/.output/server/node_modules/typeorm/error/MustBeEntityError.js +0 -15
- package/.output/server/node_modules/typeorm/error/NestedSetMultipleRootError.js +0 -12
- package/.output/server/node_modules/typeorm/error/NoConnectionForRepositoryError.js +0 -16
- package/.output/server/node_modules/typeorm/error/NoConnectionOptionError.js +0 -16
- package/.output/server/node_modules/typeorm/error/NoNeedToReleaseEntityManagerError.js +0 -17
- package/.output/server/node_modules/typeorm/error/NoVersionOrUpdateDateColumnError.js +0 -15
- package/.output/server/node_modules/typeorm/error/OffsetWithoutLimitNotSupportedError.js +0 -17
- package/.output/server/node_modules/typeorm/error/OptimisticLockCanNotBeUsedError.js +0 -15
- package/.output/server/node_modules/typeorm/error/OptimisticLockVersionMismatchError.js +0 -15
- package/.output/server/node_modules/typeorm/error/PersistedEntityNotFoundError.js +0 -15
- package/.output/server/node_modules/typeorm/error/PessimisticLockTransactionRequiredError.js +0 -15
- package/.output/server/node_modules/typeorm/error/PrimaryColumnCannotBeNullableError.js +0 -13
- package/.output/server/node_modules/typeorm/error/QueryFailedError.js +0 -30
- package/.output/server/node_modules/typeorm/error/QueryRunnerAlreadyReleasedError.js +0 -12
- package/.output/server/node_modules/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js +0 -16
- package/.output/server/node_modules/typeorm/error/RepositoryNotTreeError.js +0 -32
- package/.output/server/node_modules/typeorm/error/ReturningStatementNotSupportedError.js +0 -16
- package/.output/server/node_modules/typeorm/error/SubjectRemovedAndUpdatedError.js +0 -16
- package/.output/server/node_modules/typeorm/error/SubjectWithoutIdentifierError.js +0 -17
- package/.output/server/node_modules/typeorm/error/TransactionAlreadyStartedError.js +0 -15
- package/.output/server/node_modules/typeorm/error/TransactionNotStartedError.js +0 -15
- package/.output/server/node_modules/typeorm/error/TreeRepositoryNotSupportedError.js +0 -12
- package/.output/server/node_modules/typeorm/error/TypeORMError.js +0 -23
- package/.output/server/node_modules/typeorm/error/UpdateValuesMissingError.js +0 -12
- package/.output/server/node_modules/typeorm/error/UsingJoinColumnIsNotAllowedError.js +0 -13
- package/.output/server/node_modules/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +0 -14
- package/.output/server/node_modules/typeorm/error/UsingJoinTableIsNotAllowedError.js +0 -14
- package/.output/server/node_modules/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js +0 -14
- package/.output/server/node_modules/typeorm/error/index.js +0 -66
- package/.output/server/node_modules/typeorm/find-options/EqualOperator.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/FindManyOptions.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/FindOneOptions.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/FindOperator.js +0 -96
- package/.output/server/node_modules/typeorm/find-options/FindOperatorType.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/FindOptionsOrder.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/FindOptionsRelations.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/FindOptionsSelect.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/FindOptionsUtils.js +0 -350
- package/.output/server/node_modules/typeorm/find-options/FindOptionsWhere.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/FindTreeOptions.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/JoinOptions.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/OrderByCondition.js +0 -4
- package/.output/server/node_modules/typeorm/find-options/operator/And.js +0 -9
- package/.output/server/node_modules/typeorm/find-options/operator/Any.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/ArrayContainedBy.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/ArrayContains.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/ArrayOverlap.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/Between.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/Equal.js +0 -17
- package/.output/server/node_modules/typeorm/find-options/operator/ILike.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/In.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/IsNull.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/JsonContains.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/LessThan.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/LessThanOrEqual.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/Like.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/MoreThan.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/MoreThanOrEqual.js +0 -13
- package/.output/server/node_modules/typeorm/find-options/operator/Not.js +0 -14
- package/.output/server/node_modules/typeorm/find-options/operator/Or.js +0 -9
- package/.output/server/node_modules/typeorm/find-options/operator/Raw.js +0 -12
- package/.output/server/node_modules/typeorm/globals.js +0 -182
- package/.output/server/node_modules/typeorm/index.js +0 -196
- package/.output/server/node_modules/typeorm/index.mjs +0 -422
- package/.output/server/node_modules/typeorm/logger/AbstractLogger.js +0 -238
- package/.output/server/node_modules/typeorm/logger/AdvancedConsoleLogger.js +0 -56
- package/.output/server/node_modules/typeorm/logger/DebugLogger.js +0 -78
- package/.output/server/node_modules/typeorm/logger/FileLogger.js +0 -88
- package/.output/server/node_modules/typeorm/logger/FormattedConsoleLogger.js +0 -59
- package/.output/server/node_modules/typeorm/logger/Logger.js +0 -4
- package/.output/server/node_modules/typeorm/logger/LoggerFactory.js +0 -39
- package/.output/server/node_modules/typeorm/logger/LoggerOptions.js +0 -4
- package/.output/server/node_modules/typeorm/logger/SimpleConsoleLogger.js +0 -57
- package/.output/server/node_modules/typeorm/metadata/CheckMetadata.js +0 -35
- package/.output/server/node_modules/typeorm/metadata/ColumnMetadata.js +0 -618
- package/.output/server/node_modules/typeorm/metadata/EmbeddedMetadata.js +0 -224
- package/.output/server/node_modules/typeorm/metadata/EntityListenerMetadata.js +0 -77
- package/.output/server/node_modules/typeorm/metadata/EntityMetadata.js +0 -692
- package/.output/server/node_modules/typeorm/metadata/ExclusionMetadata.js +0 -35
- package/.output/server/node_modules/typeorm/metadata/ForeignKeyMetadata.js +0 -57
- package/.output/server/node_modules/typeorm/metadata/IndexMetadata.js +0 -144
- package/.output/server/node_modules/typeorm/metadata/RelationCountMetadata.js +0 -39
- package/.output/server/node_modules/typeorm/metadata/RelationIdMetadata.js +0 -62
- package/.output/server/node_modules/typeorm/metadata/RelationMetadata.js +0 -440
- package/.output/server/node_modules/typeorm/metadata/UniqueMetadata.js +0 -101
- package/.output/server/node_modules/typeorm/metadata/types/EventListenerTypes.js +0 -22
- package/.output/server/node_modules/typeorm/metadata-args/MetadataArgsStorage.js +0 -236
- package/.output/server/node_modules/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +0 -145
- package/.output/server/node_modules/typeorm/metadata-builder/EntityMetadataBuilder.js +0 -838
- package/.output/server/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js +0 -258
- package/.output/server/node_modules/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js +0 -287
- package/.output/server/node_modules/typeorm/metadata-builder/MetadataUtils.js +0 -44
- package/.output/server/node_modules/typeorm/metadata-builder/RelationJoinColumnBuilder.js +0 -185
- package/.output/server/node_modules/typeorm/migration/Migration.js +0 -21
- package/.output/server/node_modules/typeorm/migration/MigrationExecutor.js +0 -534
- package/.output/server/node_modules/typeorm/naming-strategy/DefaultNamingStrategy.js +0 -145
- package/.output/server/node_modules/typeorm/naming-strategy/LegacyOracleNamingStrategy.js +0 -50
- package/.output/server/node_modules/typeorm/package.json +0 -268
- package/.output/server/node_modules/typeorm/persistence/EntityPersistExecutor.js +0 -170
- package/.output/server/node_modules/typeorm/persistence/Subject.js +0 -239
- package/.output/server/node_modules/typeorm/persistence/SubjectChangedColumnsComputer.js +0 -216
- package/.output/server/node_modules/typeorm/persistence/SubjectDatabaseEntityLoader.js +0 -135
- package/.output/server/node_modules/typeorm/persistence/SubjectExecutor.js +0 -760
- package/.output/server/node_modules/typeorm/persistence/SubjectTopologicalSorter.js +0 -174
- package/.output/server/node_modules/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js +0 -107
- package/.output/server/node_modules/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js +0 -218
- package/.output/server/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js +0 -181
- package/.output/server/node_modules/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +0 -155
- package/.output/server/node_modules/typeorm/persistence/tree/ClosureSubjectExecutor.js +0 -241
- package/.output/server/node_modules/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js +0 -125
- package/.output/server/node_modules/typeorm/persistence/tree/NestedSetSubjectExecutor.js +0 -271
- package/.output/server/node_modules/typeorm/platform/PlatformTools.js +0 -243
- package/.output/server/node_modules/typeorm/query-builder/Alias.js +0 -29
- package/.output/server/node_modules/typeorm/query-builder/Brackets.js +0 -19
- package/.output/server/node_modules/typeorm/query-builder/DeleteQueryBuilder.js +0 -200
- package/.output/server/node_modules/typeorm/query-builder/InsertQueryBuilder.js +0 -745
- package/.output/server/node_modules/typeorm/query-builder/JoinAttribute.js +0 -175
- package/.output/server/node_modules/typeorm/query-builder/NotBrackets.js +0 -17
- package/.output/server/node_modules/typeorm/query-builder/QueryBuilder.js +0 -1139
- package/.output/server/node_modules/typeorm/query-builder/QueryBuilderUtils.js +0 -32
- package/.output/server/node_modules/typeorm/query-builder/QueryExpressionMap.js +0 -328
- package/.output/server/node_modules/typeorm/query-builder/RelationIdLoader.js +0 -503
- package/.output/server/node_modules/typeorm/query-builder/RelationLoader.js +0 -283
- package/.output/server/node_modules/typeorm/query-builder/RelationQueryBuilder.js +0 -155
- package/.output/server/node_modules/typeorm/query-builder/RelationRemover.js +0 -143
- package/.output/server/node_modules/typeorm/query-builder/RelationUpdater.js +0 -152
- package/.output/server/node_modules/typeorm/query-builder/ReturningResultsEntityUpdator.js +0 -176
- package/.output/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js +0 -2656
- package/.output/server/node_modules/typeorm/query-builder/SoftDeleteQueryBuilder.js +0 -368
- package/.output/server/node_modules/typeorm/query-builder/UpdateQueryBuilder.js +0 -498
- package/.output/server/node_modules/typeorm/query-builder/index.js +0 -20
- package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountAttribute.js +0 -80
- package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountLoader.js +0 -168
- package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js +0 -55
- package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdAttribute.js +0 -88
- package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdLoader.js +0 -275
- package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js +0 -55
- package/.output/server/node_modules/typeorm/query-builder/result/DeleteResult.js +0 -17
- package/.output/server/node_modules/typeorm/query-builder/result/InsertResult.js +0 -28
- package/.output/server/node_modules/typeorm/query-builder/result/UpdateResult.js +0 -29
- package/.output/server/node_modules/typeorm/query-builder/transformer/DocumentToEntityTransformer.js +0 -196
- package/.output/server/node_modules/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +0 -112
- package/.output/server/node_modules/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js +0 -92
- package/.output/server/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js +0 -447
- package/.output/server/node_modules/typeorm/query-runner/BaseQueryRunner.js +0 -454
- package/.output/server/node_modules/typeorm/query-runner/QueryLock.js +0 -28
- package/.output/server/node_modules/typeorm/query-runner/QueryResult.js +0 -17
- package/.output/server/node_modules/typeorm/repository/AbstractRepository.js +0 -92
- package/.output/server/node_modules/typeorm/repository/BaseEntity.js +0 -328
- package/.output/server/node_modules/typeorm/repository/MongoRepository.js +0 -305
- package/.output/server/node_modules/typeorm/repository/RemoveOptions.js +0 -4
- package/.output/server/node_modules/typeorm/repository/Repository.js +0 -379
- package/.output/server/node_modules/typeorm/repository/SaveOptions.js +0 -4
- package/.output/server/node_modules/typeorm/repository/TreeRepository.js +0 -255
- package/.output/server/node_modules/typeorm/schema-builder/MongoSchemaBuilder.js +0 -66
- package/.output/server/node_modules/typeorm/schema-builder/RdbmsSchemaBuilder.js +0 -929
- package/.output/server/node_modules/typeorm/schema-builder/options/TableCheckOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/options/TableColumnOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/options/TableExclusionOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/options/TableForeignKeyOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/options/TableIndexOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/options/TableOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/options/TableUniqueOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/options/ViewOptions.js +0 -4
- package/.output/server/node_modules/typeorm/schema-builder/table/Table.js +0 -296
- package/.output/server/node_modules/typeorm/schema-builder/table/TableCheck.js +0 -49
- package/.output/server/node_modules/typeorm/schema-builder/table/TableColumn.js +0 -117
- package/.output/server/node_modules/typeorm/schema-builder/table/TableExclusion.js +0 -43
- package/.output/server/node_modules/typeorm/schema-builder/table/TableForeignKey.js +0 -72
- package/.output/server/node_modules/typeorm/schema-builder/table/TableIndex.js +0 -68
- package/.output/server/node_modules/typeorm/schema-builder/table/TableUnique.js +0 -50
- package/.output/server/node_modules/typeorm/schema-builder/util/TableUtils.js +0 -41
- package/.output/server/node_modules/typeorm/schema-builder/util/ViewUtils.js +0 -27
- package/.output/server/node_modules/typeorm/schema-builder/view/View.js +0 -71
- package/.output/server/node_modules/typeorm/subscriber/Broadcaster.js +0 -660
- package/.output/server/node_modules/typeorm/subscriber/BroadcasterResult.js +0 -30
- package/.output/server/node_modules/typeorm/subscriber/event/QueryEvent.js +0 -4
- package/.output/server/node_modules/typeorm/util/ApplyValueTransformers.js +0 -25
- package/.output/server/node_modules/typeorm/util/DateUtils.js +0 -229
- package/.output/server/node_modules/typeorm/util/DepGraph.js +0 -230
- package/.output/server/node_modules/typeorm/util/DirectoryExportedClassesLoader.js +0 -65
- package/.output/server/node_modules/typeorm/util/ImportUtils.js +0 -66
- package/.output/server/node_modules/typeorm/util/InstanceChecker.js +0 -104
- package/.output/server/node_modules/typeorm/util/ObjectUtils.js +0 -49
- package/.output/server/node_modules/typeorm/util/OrmUtils.js +0 -443
- package/.output/server/node_modules/typeorm/util/PathUtils.js +0 -33
- package/.output/server/node_modules/typeorm/util/RandomGenerator.js +0 -154
- package/.output/server/node_modules/typeorm/util/SqlTagUtils.js +0 -43
- package/.output/server/node_modules/typeorm/util/StringUtils.js +0 -113
- package/.output/server/node_modules/typeorm/util/TreeRepositoryUtils.js +0 -67
- package/.output/server/node_modules/typeorm/util/VersionUtils.js +0 -27
- package/.output/server/node_modules/typeorm/util/escapeRegExp.js +0 -10
- package/.output/server/node_modules/uuid/dist/cjs/index.js +0 -31
- package/.output/server/node_modules/uuid/dist/cjs/max.js +0 -3
- package/.output/server/node_modules/uuid/dist/cjs/md5.js +0 -13
- package/.output/server/node_modules/uuid/dist/cjs/native.js +0 -4
- package/.output/server/node_modules/uuid/dist/cjs/nil.js +0 -3
- package/.output/server/node_modules/uuid/dist/cjs/package.json +0 -1
- package/.output/server/node_modules/uuid/dist/cjs/parse.js +0 -11
- package/.output/server/node_modules/uuid/dist/cjs/regex.js +0 -3
- package/.output/server/node_modules/uuid/dist/cjs/rng.js +0 -13
- package/.output/server/node_modules/uuid/dist/cjs/sha1.js +0 -13
- package/.output/server/node_modules/uuid/dist/cjs/stringify.js +0 -39
- package/.output/server/node_modules/uuid/dist/cjs/v1.js +0 -87
- package/.output/server/node_modules/uuid/dist/cjs/v1ToV6.js +0 -13
- package/.output/server/node_modules/uuid/dist/cjs/v3.js +0 -14
- package/.output/server/node_modules/uuid/dist/cjs/v35.js +0 -41
- package/.output/server/node_modules/uuid/dist/cjs/v4.js +0 -29
- package/.output/server/node_modules/uuid/dist/cjs/v5.js +0 -14
- package/.output/server/node_modules/uuid/dist/cjs/v6.js +0 -19
- package/.output/server/node_modules/uuid/dist/cjs/v6ToV1.js +0 -13
- package/.output/server/node_modules/uuid/dist/cjs/v7.js +0 -69
- package/.output/server/node_modules/uuid/dist/cjs/validate.js +0 -7
- package/.output/server/node_modules/uuid/dist/cjs/version.js +0 -10
- package/.output/server/node_modules/uuid/package.json +0 -132
|
@@ -0,0 +1,4656 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
36
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
37
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
38
|
+
|
|
39
|
+
// node_modules/.pnpm/@ai-sdk+provider@3.0.0/node_modules/@ai-sdk/provider/dist/index.mjs
|
|
40
|
+
var marker = "vercel.ai.error";
|
|
41
|
+
var symbol = Symbol.for(marker);
|
|
42
|
+
var _a;
|
|
43
|
+
var _b;
|
|
44
|
+
var AISDKError = class _AISDKError extends (_b = Error, _a = symbol, _b) {
|
|
45
|
+
/**
|
|
46
|
+
* Creates an AI SDK Error.
|
|
47
|
+
*
|
|
48
|
+
* @param {Object} params - The parameters for creating the error.
|
|
49
|
+
* @param {string} params.name - The name of the error.
|
|
50
|
+
* @param {string} params.message - The error message.
|
|
51
|
+
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
52
|
+
*/
|
|
53
|
+
constructor({
|
|
54
|
+
name: name142,
|
|
55
|
+
message,
|
|
56
|
+
cause
|
|
57
|
+
}) {
|
|
58
|
+
super(message);
|
|
59
|
+
this[_a] = true;
|
|
60
|
+
this.name = name142;
|
|
61
|
+
this.cause = cause;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if the given error is an AI SDK Error.
|
|
65
|
+
* @param {unknown} error - The error to check.
|
|
66
|
+
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
67
|
+
*/
|
|
68
|
+
static isInstance(error) {
|
|
69
|
+
return _AISDKError.hasMarker(error, marker);
|
|
70
|
+
}
|
|
71
|
+
static hasMarker(error, marker152) {
|
|
72
|
+
const markerSymbol = Symbol.for(marker152);
|
|
73
|
+
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var name = "AI_APICallError";
|
|
77
|
+
var marker2 = `vercel.ai.error.${name}`;
|
|
78
|
+
var symbol2 = Symbol.for(marker2);
|
|
79
|
+
var _a2;
|
|
80
|
+
var _b2;
|
|
81
|
+
var APICallError = class extends (_b2 = AISDKError, _a2 = symbol2, _b2) {
|
|
82
|
+
constructor({
|
|
83
|
+
message,
|
|
84
|
+
url,
|
|
85
|
+
requestBodyValues,
|
|
86
|
+
statusCode,
|
|
87
|
+
responseHeaders,
|
|
88
|
+
responseBody,
|
|
89
|
+
cause,
|
|
90
|
+
isRetryable = statusCode != null && (statusCode === 408 || // request timeout
|
|
91
|
+
statusCode === 409 || // conflict
|
|
92
|
+
statusCode === 429 || // too many requests
|
|
93
|
+
statusCode >= 500),
|
|
94
|
+
// server error
|
|
95
|
+
data
|
|
96
|
+
}) {
|
|
97
|
+
super({ name, message, cause });
|
|
98
|
+
this[_a2] = true;
|
|
99
|
+
this.url = url;
|
|
100
|
+
this.requestBodyValues = requestBodyValues;
|
|
101
|
+
this.statusCode = statusCode;
|
|
102
|
+
this.responseHeaders = responseHeaders;
|
|
103
|
+
this.responseBody = responseBody;
|
|
104
|
+
this.isRetryable = isRetryable;
|
|
105
|
+
this.data = data;
|
|
106
|
+
}
|
|
107
|
+
static isInstance(error) {
|
|
108
|
+
return AISDKError.hasMarker(error, marker2);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var name2 = "AI_EmptyResponseBodyError";
|
|
112
|
+
var marker3 = `vercel.ai.error.${name2}`;
|
|
113
|
+
var symbol3 = Symbol.for(marker3);
|
|
114
|
+
var _a3;
|
|
115
|
+
var _b3;
|
|
116
|
+
var EmptyResponseBodyError = class extends (_b3 = AISDKError, _a3 = symbol3, _b3) {
|
|
117
|
+
// used in isInstance
|
|
118
|
+
constructor({ message = "Empty response body" } = {}) {
|
|
119
|
+
super({ name: name2, message });
|
|
120
|
+
this[_a3] = true;
|
|
121
|
+
}
|
|
122
|
+
static isInstance(error) {
|
|
123
|
+
return AISDKError.hasMarker(error, marker3);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
function getErrorMessage(error) {
|
|
127
|
+
if (error == null) {
|
|
128
|
+
return "unknown error";
|
|
129
|
+
}
|
|
130
|
+
if (typeof error === "string") {
|
|
131
|
+
return error;
|
|
132
|
+
}
|
|
133
|
+
if (error instanceof Error) {
|
|
134
|
+
return error.message;
|
|
135
|
+
}
|
|
136
|
+
return JSON.stringify(error);
|
|
137
|
+
}
|
|
138
|
+
var name3 = "AI_InvalidArgumentError";
|
|
139
|
+
var marker4 = `vercel.ai.error.${name3}`;
|
|
140
|
+
var symbol4 = Symbol.for(marker4);
|
|
141
|
+
var _a4;
|
|
142
|
+
var _b4;
|
|
143
|
+
var InvalidArgumentError = class extends (_b4 = AISDKError, _a4 = symbol4, _b4) {
|
|
144
|
+
constructor({
|
|
145
|
+
message,
|
|
146
|
+
cause,
|
|
147
|
+
argument
|
|
148
|
+
}) {
|
|
149
|
+
super({ name: name3, message, cause });
|
|
150
|
+
this[_a4] = true;
|
|
151
|
+
this.argument = argument;
|
|
152
|
+
}
|
|
153
|
+
static isInstance(error) {
|
|
154
|
+
return AISDKError.hasMarker(error, marker4);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var name4 = "AI_InvalidPromptError";
|
|
158
|
+
var marker5 = `vercel.ai.error.${name4}`;
|
|
159
|
+
var symbol5 = Symbol.for(marker5);
|
|
160
|
+
var _a5;
|
|
161
|
+
var _b5;
|
|
162
|
+
var InvalidPromptError = class extends (_b5 = AISDKError, _a5 = symbol5, _b5) {
|
|
163
|
+
constructor({
|
|
164
|
+
prompt,
|
|
165
|
+
message,
|
|
166
|
+
cause
|
|
167
|
+
}) {
|
|
168
|
+
super({ name: name4, message: `Invalid prompt: ${message}`, cause });
|
|
169
|
+
this[_a5] = true;
|
|
170
|
+
this.prompt = prompt;
|
|
171
|
+
}
|
|
172
|
+
static isInstance(error) {
|
|
173
|
+
return AISDKError.hasMarker(error, marker5);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
var name5 = "AI_InvalidResponseDataError";
|
|
177
|
+
var marker6 = `vercel.ai.error.${name5}`;
|
|
178
|
+
var symbol6 = Symbol.for(marker6);
|
|
179
|
+
var _a6;
|
|
180
|
+
var _b6;
|
|
181
|
+
var InvalidResponseDataError = class extends (_b6 = AISDKError, _a6 = symbol6, _b6) {
|
|
182
|
+
constructor({
|
|
183
|
+
data,
|
|
184
|
+
message = `Invalid response data: ${JSON.stringify(data)}.`
|
|
185
|
+
}) {
|
|
186
|
+
super({ name: name5, message });
|
|
187
|
+
this[_a6] = true;
|
|
188
|
+
this.data = data;
|
|
189
|
+
}
|
|
190
|
+
static isInstance(error) {
|
|
191
|
+
return AISDKError.hasMarker(error, marker6);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var name6 = "AI_JSONParseError";
|
|
195
|
+
var marker7 = `vercel.ai.error.${name6}`;
|
|
196
|
+
var symbol7 = Symbol.for(marker7);
|
|
197
|
+
var _a7;
|
|
198
|
+
var _b7;
|
|
199
|
+
var JSONParseError = class extends (_b7 = AISDKError, _a7 = symbol7, _b7) {
|
|
200
|
+
constructor({ text, cause }) {
|
|
201
|
+
super({
|
|
202
|
+
name: name6,
|
|
203
|
+
message: `JSON parsing failed: Text: ${text}.
|
|
204
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
205
|
+
cause
|
|
206
|
+
});
|
|
207
|
+
this[_a7] = true;
|
|
208
|
+
this.text = text;
|
|
209
|
+
}
|
|
210
|
+
static isInstance(error) {
|
|
211
|
+
return AISDKError.hasMarker(error, marker7);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var name7 = "AI_LoadAPIKeyError";
|
|
215
|
+
var marker8 = `vercel.ai.error.${name7}`;
|
|
216
|
+
var symbol8 = Symbol.for(marker8);
|
|
217
|
+
var _a8;
|
|
218
|
+
var _b8;
|
|
219
|
+
var LoadAPIKeyError = class extends (_b8 = AISDKError, _a8 = symbol8, _b8) {
|
|
220
|
+
// used in isInstance
|
|
221
|
+
constructor({ message }) {
|
|
222
|
+
super({ name: name7, message });
|
|
223
|
+
this[_a8] = true;
|
|
224
|
+
}
|
|
225
|
+
static isInstance(error) {
|
|
226
|
+
return AISDKError.hasMarker(error, marker8);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var name8 = "AI_LoadSettingError";
|
|
230
|
+
var marker9 = `vercel.ai.error.${name8}`;
|
|
231
|
+
var symbol9 = Symbol.for(marker9);
|
|
232
|
+
var _a9;
|
|
233
|
+
var _b9;
|
|
234
|
+
var LoadSettingError = class extends (_b9 = AISDKError, _a9 = symbol9, _b9) {
|
|
235
|
+
// used in isInstance
|
|
236
|
+
constructor({ message }) {
|
|
237
|
+
super({ name: name8, message });
|
|
238
|
+
this[_a9] = true;
|
|
239
|
+
}
|
|
240
|
+
static isInstance(error) {
|
|
241
|
+
return AISDKError.hasMarker(error, marker9);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
var name9 = "AI_NoContentGeneratedError";
|
|
245
|
+
var marker10 = `vercel.ai.error.${name9}`;
|
|
246
|
+
var symbol10 = Symbol.for(marker10);
|
|
247
|
+
var _a10;
|
|
248
|
+
var _b10;
|
|
249
|
+
var NoContentGeneratedError = class extends (_b10 = AISDKError, _a10 = symbol10, _b10) {
|
|
250
|
+
// used in isInstance
|
|
251
|
+
constructor({
|
|
252
|
+
message = "No content generated."
|
|
253
|
+
} = {}) {
|
|
254
|
+
super({ name: name9, message });
|
|
255
|
+
this[_a10] = true;
|
|
256
|
+
}
|
|
257
|
+
static isInstance(error) {
|
|
258
|
+
return AISDKError.hasMarker(error, marker10);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var name10 = "AI_NoSuchModelError";
|
|
262
|
+
var marker11 = `vercel.ai.error.${name10}`;
|
|
263
|
+
var symbol11 = Symbol.for(marker11);
|
|
264
|
+
var _a11;
|
|
265
|
+
var _b11;
|
|
266
|
+
var NoSuchModelError = class extends (_b11 = AISDKError, _a11 = symbol11, _b11) {
|
|
267
|
+
constructor({
|
|
268
|
+
errorName = name10,
|
|
269
|
+
modelId,
|
|
270
|
+
modelType,
|
|
271
|
+
message = `No such ${modelType}: ${modelId}`
|
|
272
|
+
}) {
|
|
273
|
+
super({ name: errorName, message });
|
|
274
|
+
this[_a11] = true;
|
|
275
|
+
this.modelId = modelId;
|
|
276
|
+
this.modelType = modelType;
|
|
277
|
+
}
|
|
278
|
+
static isInstance(error) {
|
|
279
|
+
return AISDKError.hasMarker(error, marker11);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
var name11 = "AI_TooManyEmbeddingValuesForCallError";
|
|
283
|
+
var marker12 = `vercel.ai.error.${name11}`;
|
|
284
|
+
var symbol12 = Symbol.for(marker12);
|
|
285
|
+
var _a12;
|
|
286
|
+
var _b12;
|
|
287
|
+
var TooManyEmbeddingValuesForCallError = class extends (_b12 = AISDKError, _a12 = symbol12, _b12) {
|
|
288
|
+
constructor(options) {
|
|
289
|
+
super({
|
|
290
|
+
name: name11,
|
|
291
|
+
message: `Too many values for a single embedding call. The ${options.provider} model "${options.modelId}" can only embed up to ${options.maxEmbeddingsPerCall} values per call, but ${options.values.length} values were provided.`
|
|
292
|
+
});
|
|
293
|
+
this[_a12] = true;
|
|
294
|
+
this.provider = options.provider;
|
|
295
|
+
this.modelId = options.modelId;
|
|
296
|
+
this.maxEmbeddingsPerCall = options.maxEmbeddingsPerCall;
|
|
297
|
+
this.values = options.values;
|
|
298
|
+
}
|
|
299
|
+
static isInstance(error) {
|
|
300
|
+
return AISDKError.hasMarker(error, marker12);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
var name12 = "AI_TypeValidationError";
|
|
304
|
+
var marker13 = `vercel.ai.error.${name12}`;
|
|
305
|
+
var symbol13 = Symbol.for(marker13);
|
|
306
|
+
var _a13;
|
|
307
|
+
var _b13;
|
|
308
|
+
var TypeValidationError = class _TypeValidationError extends (_b13 = AISDKError, _a13 = symbol13, _b13) {
|
|
309
|
+
constructor({ value, cause }) {
|
|
310
|
+
super({
|
|
311
|
+
name: name12,
|
|
312
|
+
message: `Type validation failed: Value: ${JSON.stringify(value)}.
|
|
313
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
314
|
+
cause
|
|
315
|
+
});
|
|
316
|
+
this[_a13] = true;
|
|
317
|
+
this.value = value;
|
|
318
|
+
}
|
|
319
|
+
static isInstance(error) {
|
|
320
|
+
return AISDKError.hasMarker(error, marker13);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Wraps an error into a TypeValidationError.
|
|
324
|
+
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
325
|
+
* Otherwise, it creates a new TypeValidationError.
|
|
326
|
+
*
|
|
327
|
+
* @param {Object} params - The parameters for wrapping the error.
|
|
328
|
+
* @param {unknown} params.value - The value that failed validation.
|
|
329
|
+
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
330
|
+
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
331
|
+
*/
|
|
332
|
+
static wrap({
|
|
333
|
+
value,
|
|
334
|
+
cause
|
|
335
|
+
}) {
|
|
336
|
+
return _TypeValidationError.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError({ value, cause });
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
var name13 = "AI_UnsupportedFunctionalityError";
|
|
340
|
+
var marker14 = `vercel.ai.error.${name13}`;
|
|
341
|
+
var symbol14 = Symbol.for(marker14);
|
|
342
|
+
var _a14;
|
|
343
|
+
var _b14;
|
|
344
|
+
var UnsupportedFunctionalityError = class extends (_b14 = AISDKError, _a14 = symbol14, _b14) {
|
|
345
|
+
constructor({
|
|
346
|
+
functionality,
|
|
347
|
+
message = `'${functionality}' functionality not supported.`
|
|
348
|
+
}) {
|
|
349
|
+
super({ name: name13, message });
|
|
350
|
+
this[_a14] = true;
|
|
351
|
+
this.functionality = functionality;
|
|
352
|
+
}
|
|
353
|
+
static isInstance(error) {
|
|
354
|
+
return AISDKError.hasMarker(error, marker14);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
// node_modules/.pnpm/@ai-sdk+provider-utils@4.0.1_zod@4.3.5/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
359
|
+
import * as z4 from "zod/v4";
|
|
360
|
+
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
|
|
361
|
+
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
362
|
+
import {
|
|
363
|
+
ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2
|
|
364
|
+
} from "zod/v3";
|
|
365
|
+
|
|
366
|
+
// node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/index.js
|
|
367
|
+
var ParseError = class extends Error {
|
|
368
|
+
constructor(message, options) {
|
|
369
|
+
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
function noop(_arg) {
|
|
373
|
+
}
|
|
374
|
+
function createParser(callbacks) {
|
|
375
|
+
if (typeof callbacks == "function")
|
|
376
|
+
throw new TypeError(
|
|
377
|
+
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
378
|
+
);
|
|
379
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
380
|
+
let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
|
|
381
|
+
function feed(newChunk) {
|
|
382
|
+
const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
|
|
383
|
+
for (const line of complete)
|
|
384
|
+
parseLine(line);
|
|
385
|
+
incompleteLine = incomplete, isFirstChunk = false;
|
|
386
|
+
}
|
|
387
|
+
function parseLine(line) {
|
|
388
|
+
if (line === "") {
|
|
389
|
+
dispatchEvent();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (line.startsWith(":")) {
|
|
393
|
+
onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const fieldSeparatorIndex = line.indexOf(":");
|
|
397
|
+
if (fieldSeparatorIndex !== -1) {
|
|
398
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
399
|
+
processField(field, value, line);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
processField(line, "", line);
|
|
403
|
+
}
|
|
404
|
+
function processField(field, value, line) {
|
|
405
|
+
switch (field) {
|
|
406
|
+
case "event":
|
|
407
|
+
eventType = value;
|
|
408
|
+
break;
|
|
409
|
+
case "data":
|
|
410
|
+
data = `${data}${value}
|
|
411
|
+
`;
|
|
412
|
+
break;
|
|
413
|
+
case "id":
|
|
414
|
+
id = value.includes("\0") ? void 0 : value;
|
|
415
|
+
break;
|
|
416
|
+
case "retry":
|
|
417
|
+
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
418
|
+
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
419
|
+
type: "invalid-retry",
|
|
420
|
+
value,
|
|
421
|
+
line
|
|
422
|
+
})
|
|
423
|
+
);
|
|
424
|
+
break;
|
|
425
|
+
default:
|
|
426
|
+
onError(
|
|
427
|
+
new ParseError(
|
|
428
|
+
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
429
|
+
{ type: "unknown-field", field, value, line }
|
|
430
|
+
)
|
|
431
|
+
);
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function dispatchEvent() {
|
|
436
|
+
data.length > 0 && onEvent({
|
|
437
|
+
id,
|
|
438
|
+
event: eventType || void 0,
|
|
439
|
+
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
440
|
+
// then remove the last character from the data buffer.
|
|
441
|
+
data: data.endsWith(`
|
|
442
|
+
`) ? data.slice(0, -1) : data
|
|
443
|
+
}), id = void 0, data = "", eventType = "";
|
|
444
|
+
}
|
|
445
|
+
function reset(options = {}) {
|
|
446
|
+
incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
|
|
447
|
+
}
|
|
448
|
+
return { feed, reset };
|
|
449
|
+
}
|
|
450
|
+
function splitLines(chunk) {
|
|
451
|
+
const lines = [];
|
|
452
|
+
let incompleteLine = "", searchIndex = 0;
|
|
453
|
+
for (; searchIndex < chunk.length; ) {
|
|
454
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
455
|
+
`, searchIndex);
|
|
456
|
+
let lineEnd = -1;
|
|
457
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
458
|
+
incompleteLine = chunk.slice(searchIndex);
|
|
459
|
+
break;
|
|
460
|
+
} else {
|
|
461
|
+
const line = chunk.slice(searchIndex, lineEnd);
|
|
462
|
+
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
463
|
+
` && searchIndex++;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return [lines, incompleteLine];
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/stream.js
|
|
470
|
+
var EventSourceParserStream = class extends TransformStream {
|
|
471
|
+
constructor({ onError, onRetry, onComment } = {}) {
|
|
472
|
+
let parser;
|
|
473
|
+
super({
|
|
474
|
+
start(controller) {
|
|
475
|
+
parser = createParser({
|
|
476
|
+
onEvent: (event) => {
|
|
477
|
+
controller.enqueue(event);
|
|
478
|
+
},
|
|
479
|
+
onError(error) {
|
|
480
|
+
onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
|
|
481
|
+
},
|
|
482
|
+
onRetry,
|
|
483
|
+
onComment
|
|
484
|
+
});
|
|
485
|
+
},
|
|
486
|
+
transform(chunk) {
|
|
487
|
+
parser.feed(chunk);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
// node_modules/.pnpm/@ai-sdk+provider-utils@4.0.1_zod@4.3.5/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
494
|
+
function combineHeaders(...headers) {
|
|
495
|
+
return headers.reduce(
|
|
496
|
+
(combinedHeaders, currentHeaders) => __spreadValues(__spreadValues({}, combinedHeaders), currentHeaders != null ? currentHeaders : {}),
|
|
497
|
+
{}
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
function extractResponseHeaders(response) {
|
|
501
|
+
return Object.fromEntries([...response.headers]);
|
|
502
|
+
}
|
|
503
|
+
var { btoa, atob } = globalThis;
|
|
504
|
+
function convertUint8ArrayToBase64(array) {
|
|
505
|
+
let latin1string = "";
|
|
506
|
+
for (let i = 0; i < array.length; i++) {
|
|
507
|
+
latin1string += String.fromCodePoint(array[i]);
|
|
508
|
+
}
|
|
509
|
+
return btoa(latin1string);
|
|
510
|
+
}
|
|
511
|
+
var name14 = "AI_DownloadError";
|
|
512
|
+
var marker15 = `vercel.ai.error.${name14}`;
|
|
513
|
+
var symbol15 = Symbol.for(marker15);
|
|
514
|
+
var _a15;
|
|
515
|
+
var _b15;
|
|
516
|
+
var DownloadError = class extends (_b15 = AISDKError, _a15 = symbol15, _b15) {
|
|
517
|
+
constructor({
|
|
518
|
+
url,
|
|
519
|
+
statusCode,
|
|
520
|
+
statusText,
|
|
521
|
+
cause,
|
|
522
|
+
message = cause == null ? `Failed to download ${url}: ${statusCode} ${statusText}` : `Failed to download ${url}: ${cause}`
|
|
523
|
+
}) {
|
|
524
|
+
super({ name: name14, message, cause });
|
|
525
|
+
this[_a15] = true;
|
|
526
|
+
this.url = url;
|
|
527
|
+
this.statusCode = statusCode;
|
|
528
|
+
this.statusText = statusText;
|
|
529
|
+
}
|
|
530
|
+
static isInstance(error) {
|
|
531
|
+
return AISDKError.hasMarker(error, marker15);
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
var createIdGenerator = ({
|
|
535
|
+
prefix,
|
|
536
|
+
size = 16,
|
|
537
|
+
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
538
|
+
separator = "-"
|
|
539
|
+
} = {}) => {
|
|
540
|
+
const generator = () => {
|
|
541
|
+
const alphabetLength = alphabet.length;
|
|
542
|
+
const chars = new Array(size);
|
|
543
|
+
for (let i = 0; i < size; i++) {
|
|
544
|
+
chars[i] = alphabet[Math.random() * alphabetLength | 0];
|
|
545
|
+
}
|
|
546
|
+
return chars.join("");
|
|
547
|
+
};
|
|
548
|
+
if (prefix == null) {
|
|
549
|
+
return generator;
|
|
550
|
+
}
|
|
551
|
+
if (alphabet.includes(separator)) {
|
|
552
|
+
throw new InvalidArgumentError({
|
|
553
|
+
argument: "separator",
|
|
554
|
+
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
return () => `${prefix}${separator}${generator()}`;
|
|
558
|
+
};
|
|
559
|
+
var generateId = createIdGenerator();
|
|
560
|
+
function isAbortError(error) {
|
|
561
|
+
return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
|
|
562
|
+
error.name === "TimeoutError");
|
|
563
|
+
}
|
|
564
|
+
var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
|
|
565
|
+
function handleFetchError({
|
|
566
|
+
error,
|
|
567
|
+
url,
|
|
568
|
+
requestBodyValues
|
|
569
|
+
}) {
|
|
570
|
+
if (isAbortError(error)) {
|
|
571
|
+
return error;
|
|
572
|
+
}
|
|
573
|
+
if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
|
|
574
|
+
const cause = error.cause;
|
|
575
|
+
if (cause != null) {
|
|
576
|
+
return new APICallError({
|
|
577
|
+
message: `Cannot connect to API: ${cause.message}`,
|
|
578
|
+
cause,
|
|
579
|
+
url,
|
|
580
|
+
requestBodyValues,
|
|
581
|
+
isRetryable: true
|
|
582
|
+
// retry when network error
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return error;
|
|
587
|
+
}
|
|
588
|
+
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
589
|
+
var _a22, _b22, _c;
|
|
590
|
+
if (globalThisAny.window) {
|
|
591
|
+
return `runtime/browser`;
|
|
592
|
+
}
|
|
593
|
+
if ((_a22 = globalThisAny.navigator) == null ? void 0 : _a22.userAgent) {
|
|
594
|
+
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
595
|
+
}
|
|
596
|
+
if ((_c = (_b22 = globalThisAny.process) == null ? void 0 : _b22.versions) == null ? void 0 : _c.node) {
|
|
597
|
+
return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
|
|
598
|
+
}
|
|
599
|
+
if (globalThisAny.EdgeRuntime) {
|
|
600
|
+
return `runtime/vercel-edge`;
|
|
601
|
+
}
|
|
602
|
+
return "runtime/unknown";
|
|
603
|
+
}
|
|
604
|
+
function normalizeHeaders(headers) {
|
|
605
|
+
if (headers == null) {
|
|
606
|
+
return {};
|
|
607
|
+
}
|
|
608
|
+
const normalized = {};
|
|
609
|
+
if (headers instanceof Headers) {
|
|
610
|
+
headers.forEach((value, key) => {
|
|
611
|
+
normalized[key.toLowerCase()] = value;
|
|
612
|
+
});
|
|
613
|
+
} else {
|
|
614
|
+
if (!Array.isArray(headers)) {
|
|
615
|
+
headers = Object.entries(headers);
|
|
616
|
+
}
|
|
617
|
+
for (const [key, value] of headers) {
|
|
618
|
+
if (value != null) {
|
|
619
|
+
normalized[key.toLowerCase()] = value;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return normalized;
|
|
624
|
+
}
|
|
625
|
+
function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
626
|
+
const normalizedHeaders = new Headers(normalizeHeaders(headers));
|
|
627
|
+
const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
|
|
628
|
+
normalizedHeaders.set(
|
|
629
|
+
"user-agent",
|
|
630
|
+
[currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" ")
|
|
631
|
+
);
|
|
632
|
+
return Object.fromEntries(normalizedHeaders.entries());
|
|
633
|
+
}
|
|
634
|
+
var VERSION = true ? "4.0.1" : "0.0.0-test";
|
|
635
|
+
function loadApiKey({
|
|
636
|
+
apiKey,
|
|
637
|
+
environmentVariableName,
|
|
638
|
+
apiKeyParameterName = "apiKey",
|
|
639
|
+
description
|
|
640
|
+
}) {
|
|
641
|
+
if (typeof apiKey === "string") {
|
|
642
|
+
return apiKey;
|
|
643
|
+
}
|
|
644
|
+
if (apiKey != null) {
|
|
645
|
+
throw new LoadAPIKeyError({
|
|
646
|
+
message: `${description} API key must be a string.`
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
if (typeof process === "undefined") {
|
|
650
|
+
throw new LoadAPIKeyError({
|
|
651
|
+
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
apiKey = process.env[environmentVariableName];
|
|
655
|
+
if (apiKey == null) {
|
|
656
|
+
throw new LoadAPIKeyError({
|
|
657
|
+
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
if (typeof apiKey !== "string") {
|
|
661
|
+
throw new LoadAPIKeyError({
|
|
662
|
+
message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
return apiKey;
|
|
666
|
+
}
|
|
667
|
+
var suspectProtoRx = /"__proto__"\s*:/;
|
|
668
|
+
var suspectConstructorRx = /"constructor"\s*:/;
|
|
669
|
+
function _parse(text) {
|
|
670
|
+
const obj = JSON.parse(text);
|
|
671
|
+
if (obj === null || typeof obj !== "object") {
|
|
672
|
+
return obj;
|
|
673
|
+
}
|
|
674
|
+
if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
|
|
675
|
+
return obj;
|
|
676
|
+
}
|
|
677
|
+
return filter(obj);
|
|
678
|
+
}
|
|
679
|
+
function filter(obj) {
|
|
680
|
+
let next = [obj];
|
|
681
|
+
while (next.length) {
|
|
682
|
+
const nodes = next;
|
|
683
|
+
next = [];
|
|
684
|
+
for (const node of nodes) {
|
|
685
|
+
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
686
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
687
|
+
}
|
|
688
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
689
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
690
|
+
}
|
|
691
|
+
for (const key in node) {
|
|
692
|
+
const value = node[key];
|
|
693
|
+
if (value && typeof value === "object") {
|
|
694
|
+
next.push(value);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return obj;
|
|
700
|
+
}
|
|
701
|
+
function secureJsonParse(text) {
|
|
702
|
+
const { stackTraceLimit } = Error;
|
|
703
|
+
try {
|
|
704
|
+
Error.stackTraceLimit = 0;
|
|
705
|
+
} catch (e) {
|
|
706
|
+
return _parse(text);
|
|
707
|
+
}
|
|
708
|
+
try {
|
|
709
|
+
return _parse(text);
|
|
710
|
+
} finally {
|
|
711
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
|
|
715
|
+
if (jsonSchema2.type === "object") {
|
|
716
|
+
jsonSchema2.additionalProperties = false;
|
|
717
|
+
const properties = jsonSchema2.properties;
|
|
718
|
+
if (properties != null) {
|
|
719
|
+
for (const property in properties) {
|
|
720
|
+
properties[property] = addAdditionalPropertiesToJsonSchema(
|
|
721
|
+
properties[property]
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
if (jsonSchema2.type === "array" && jsonSchema2.items != null) {
|
|
727
|
+
if (Array.isArray(jsonSchema2.items)) {
|
|
728
|
+
jsonSchema2.items = jsonSchema2.items.map(
|
|
729
|
+
(item) => addAdditionalPropertiesToJsonSchema(item)
|
|
730
|
+
);
|
|
731
|
+
} else {
|
|
732
|
+
jsonSchema2.items = addAdditionalPropertiesToJsonSchema(
|
|
733
|
+
jsonSchema2.items
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return jsonSchema2;
|
|
738
|
+
}
|
|
739
|
+
var ignoreOverride = Symbol(
|
|
740
|
+
"Let zodToJsonSchema decide on which parser to use"
|
|
741
|
+
);
|
|
742
|
+
var defaultOptions = {
|
|
743
|
+
name: void 0,
|
|
744
|
+
$refStrategy: "root",
|
|
745
|
+
basePath: ["#"],
|
|
746
|
+
effectStrategy: "input",
|
|
747
|
+
pipeStrategy: "all",
|
|
748
|
+
dateStrategy: "format:date-time",
|
|
749
|
+
mapStrategy: "entries",
|
|
750
|
+
removeAdditionalStrategy: "passthrough",
|
|
751
|
+
allowedAdditionalProperties: true,
|
|
752
|
+
rejectedAdditionalProperties: false,
|
|
753
|
+
definitionPath: "definitions",
|
|
754
|
+
strictUnions: false,
|
|
755
|
+
definitions: {},
|
|
756
|
+
errorMessages: false,
|
|
757
|
+
patternStrategy: "escape",
|
|
758
|
+
applyRegexFlags: false,
|
|
759
|
+
emailStrategy: "format:email",
|
|
760
|
+
base64Strategy: "contentEncoding:base64",
|
|
761
|
+
nameStrategy: "ref"
|
|
762
|
+
};
|
|
763
|
+
var getDefaultOptions = (options) => typeof options === "string" ? __spreadProps(__spreadValues({}, defaultOptions), {
|
|
764
|
+
name: options
|
|
765
|
+
}) : __spreadValues(__spreadValues({}, defaultOptions), options);
|
|
766
|
+
function parseAnyDef() {
|
|
767
|
+
return {};
|
|
768
|
+
}
|
|
769
|
+
function parseArrayDef(def, refs) {
|
|
770
|
+
var _a22, _b22, _c;
|
|
771
|
+
const res = {
|
|
772
|
+
type: "array"
|
|
773
|
+
};
|
|
774
|
+
if (((_a22 = def.type) == null ? void 0 : _a22._def) && ((_c = (_b22 = def.type) == null ? void 0 : _b22._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
|
|
775
|
+
res.items = parseDef(def.type._def, __spreadProps(__spreadValues({}, refs), {
|
|
776
|
+
currentPath: [...refs.currentPath, "items"]
|
|
777
|
+
}));
|
|
778
|
+
}
|
|
779
|
+
if (def.minLength) {
|
|
780
|
+
res.minItems = def.minLength.value;
|
|
781
|
+
}
|
|
782
|
+
if (def.maxLength) {
|
|
783
|
+
res.maxItems = def.maxLength.value;
|
|
784
|
+
}
|
|
785
|
+
if (def.exactLength) {
|
|
786
|
+
res.minItems = def.exactLength.value;
|
|
787
|
+
res.maxItems = def.exactLength.value;
|
|
788
|
+
}
|
|
789
|
+
return res;
|
|
790
|
+
}
|
|
791
|
+
function parseBigintDef(def) {
|
|
792
|
+
const res = {
|
|
793
|
+
type: "integer",
|
|
794
|
+
format: "int64"
|
|
795
|
+
};
|
|
796
|
+
if (!def.checks) return res;
|
|
797
|
+
for (const check of def.checks) {
|
|
798
|
+
switch (check.kind) {
|
|
799
|
+
case "min":
|
|
800
|
+
if (check.inclusive) {
|
|
801
|
+
res.minimum = check.value;
|
|
802
|
+
} else {
|
|
803
|
+
res.exclusiveMinimum = check.value;
|
|
804
|
+
}
|
|
805
|
+
break;
|
|
806
|
+
case "max":
|
|
807
|
+
if (check.inclusive) {
|
|
808
|
+
res.maximum = check.value;
|
|
809
|
+
} else {
|
|
810
|
+
res.exclusiveMaximum = check.value;
|
|
811
|
+
}
|
|
812
|
+
break;
|
|
813
|
+
case "multipleOf":
|
|
814
|
+
res.multipleOf = check.value;
|
|
815
|
+
break;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
return res;
|
|
819
|
+
}
|
|
820
|
+
function parseBooleanDef() {
|
|
821
|
+
return { type: "boolean" };
|
|
822
|
+
}
|
|
823
|
+
function parseBrandedDef(_def, refs) {
|
|
824
|
+
return parseDef(_def.type._def, refs);
|
|
825
|
+
}
|
|
826
|
+
var parseCatchDef = (def, refs) => {
|
|
827
|
+
return parseDef(def.innerType._def, refs);
|
|
828
|
+
};
|
|
829
|
+
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
830
|
+
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
831
|
+
if (Array.isArray(strategy)) {
|
|
832
|
+
return {
|
|
833
|
+
anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
switch (strategy) {
|
|
837
|
+
case "string":
|
|
838
|
+
case "format:date-time":
|
|
839
|
+
return {
|
|
840
|
+
type: "string",
|
|
841
|
+
format: "date-time"
|
|
842
|
+
};
|
|
843
|
+
case "format:date":
|
|
844
|
+
return {
|
|
845
|
+
type: "string",
|
|
846
|
+
format: "date"
|
|
847
|
+
};
|
|
848
|
+
case "integer":
|
|
849
|
+
return integerDateParser(def);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
var integerDateParser = (def) => {
|
|
853
|
+
const res = {
|
|
854
|
+
type: "integer",
|
|
855
|
+
format: "unix-time"
|
|
856
|
+
};
|
|
857
|
+
for (const check of def.checks) {
|
|
858
|
+
switch (check.kind) {
|
|
859
|
+
case "min":
|
|
860
|
+
res.minimum = check.value;
|
|
861
|
+
break;
|
|
862
|
+
case "max":
|
|
863
|
+
res.maximum = check.value;
|
|
864
|
+
break;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return res;
|
|
868
|
+
};
|
|
869
|
+
function parseDefaultDef(_def, refs) {
|
|
870
|
+
return __spreadProps(__spreadValues({}, parseDef(_def.innerType._def, refs)), {
|
|
871
|
+
default: _def.defaultValue()
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
function parseEffectsDef(_def, refs) {
|
|
875
|
+
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef();
|
|
876
|
+
}
|
|
877
|
+
function parseEnumDef(def) {
|
|
878
|
+
return {
|
|
879
|
+
type: "string",
|
|
880
|
+
enum: Array.from(def.values)
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
var isJsonSchema7AllOfType = (type) => {
|
|
884
|
+
if ("type" in type && type.type === "string") return false;
|
|
885
|
+
return "allOf" in type;
|
|
886
|
+
};
|
|
887
|
+
function parseIntersectionDef(def, refs) {
|
|
888
|
+
const allOf = [
|
|
889
|
+
parseDef(def.left._def, __spreadProps(__spreadValues({}, refs), {
|
|
890
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
891
|
+
})),
|
|
892
|
+
parseDef(def.right._def, __spreadProps(__spreadValues({}, refs), {
|
|
893
|
+
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
894
|
+
}))
|
|
895
|
+
].filter((x) => !!x);
|
|
896
|
+
const mergedAllOf = [];
|
|
897
|
+
allOf.forEach((schema) => {
|
|
898
|
+
if (isJsonSchema7AllOfType(schema)) {
|
|
899
|
+
mergedAllOf.push(...schema.allOf);
|
|
900
|
+
} else {
|
|
901
|
+
let nestedSchema = schema;
|
|
902
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
903
|
+
const _a16 = schema, { additionalProperties } = _a16, rest = __objRest(_a16, ["additionalProperties"]);
|
|
904
|
+
nestedSchema = rest;
|
|
905
|
+
}
|
|
906
|
+
mergedAllOf.push(nestedSchema);
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
|
|
910
|
+
}
|
|
911
|
+
function parseLiteralDef(def) {
|
|
912
|
+
const parsedType = typeof def.value;
|
|
913
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
914
|
+
return {
|
|
915
|
+
type: Array.isArray(def.value) ? "array" : "object"
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
return {
|
|
919
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
920
|
+
const: def.value
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
var emojiRegex = void 0;
|
|
924
|
+
var zodPatterns = {
|
|
925
|
+
/**
|
|
926
|
+
* `c` was changed to `[cC]` to replicate /i flag
|
|
927
|
+
*/
|
|
928
|
+
cuid: /^[cC][^\s-]{8,}$/,
|
|
929
|
+
cuid2: /^[0-9a-z]+$/,
|
|
930
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
931
|
+
/**
|
|
932
|
+
* `a-z` was added to replicate /i flag
|
|
933
|
+
*/
|
|
934
|
+
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
935
|
+
/**
|
|
936
|
+
* Constructed a valid Unicode RegExp
|
|
937
|
+
*
|
|
938
|
+
* Lazily instantiate since this type of regex isn't supported
|
|
939
|
+
* in all envs (e.g. React Native).
|
|
940
|
+
*
|
|
941
|
+
* See:
|
|
942
|
+
* https://github.com/colinhacks/zod/issues/2433
|
|
943
|
+
* Fix in Zod:
|
|
944
|
+
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
945
|
+
*/
|
|
946
|
+
emoji: () => {
|
|
947
|
+
if (emojiRegex === void 0) {
|
|
948
|
+
emojiRegex = RegExp(
|
|
949
|
+
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
|
|
950
|
+
"u"
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
return emojiRegex;
|
|
954
|
+
},
|
|
955
|
+
/**
|
|
956
|
+
* Unused
|
|
957
|
+
*/
|
|
958
|
+
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
959
|
+
/**
|
|
960
|
+
* Unused
|
|
961
|
+
*/
|
|
962
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
963
|
+
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
964
|
+
/**
|
|
965
|
+
* Unused
|
|
966
|
+
*/
|
|
967
|
+
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
|
|
968
|
+
ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
969
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
970
|
+
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
971
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
972
|
+
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
973
|
+
};
|
|
974
|
+
function parseStringDef(def, refs) {
|
|
975
|
+
const res = {
|
|
976
|
+
type: "string"
|
|
977
|
+
};
|
|
978
|
+
if (def.checks) {
|
|
979
|
+
for (const check of def.checks) {
|
|
980
|
+
switch (check.kind) {
|
|
981
|
+
case "min":
|
|
982
|
+
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
983
|
+
break;
|
|
984
|
+
case "max":
|
|
985
|
+
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
986
|
+
break;
|
|
987
|
+
case "email":
|
|
988
|
+
switch (refs.emailStrategy) {
|
|
989
|
+
case "format:email":
|
|
990
|
+
addFormat(res, "email", check.message, refs);
|
|
991
|
+
break;
|
|
992
|
+
case "format:idn-email":
|
|
993
|
+
addFormat(res, "idn-email", check.message, refs);
|
|
994
|
+
break;
|
|
995
|
+
case "pattern:zod":
|
|
996
|
+
addPattern(res, zodPatterns.email, check.message, refs);
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
break;
|
|
1000
|
+
case "url":
|
|
1001
|
+
addFormat(res, "uri", check.message, refs);
|
|
1002
|
+
break;
|
|
1003
|
+
case "uuid":
|
|
1004
|
+
addFormat(res, "uuid", check.message, refs);
|
|
1005
|
+
break;
|
|
1006
|
+
case "regex":
|
|
1007
|
+
addPattern(res, check.regex, check.message, refs);
|
|
1008
|
+
break;
|
|
1009
|
+
case "cuid":
|
|
1010
|
+
addPattern(res, zodPatterns.cuid, check.message, refs);
|
|
1011
|
+
break;
|
|
1012
|
+
case "cuid2":
|
|
1013
|
+
addPattern(res, zodPatterns.cuid2, check.message, refs);
|
|
1014
|
+
break;
|
|
1015
|
+
case "startsWith":
|
|
1016
|
+
addPattern(
|
|
1017
|
+
res,
|
|
1018
|
+
RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`),
|
|
1019
|
+
check.message,
|
|
1020
|
+
refs
|
|
1021
|
+
);
|
|
1022
|
+
break;
|
|
1023
|
+
case "endsWith":
|
|
1024
|
+
addPattern(
|
|
1025
|
+
res,
|
|
1026
|
+
RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`),
|
|
1027
|
+
check.message,
|
|
1028
|
+
refs
|
|
1029
|
+
);
|
|
1030
|
+
break;
|
|
1031
|
+
case "datetime":
|
|
1032
|
+
addFormat(res, "date-time", check.message, refs);
|
|
1033
|
+
break;
|
|
1034
|
+
case "date":
|
|
1035
|
+
addFormat(res, "date", check.message, refs);
|
|
1036
|
+
break;
|
|
1037
|
+
case "time":
|
|
1038
|
+
addFormat(res, "time", check.message, refs);
|
|
1039
|
+
break;
|
|
1040
|
+
case "duration":
|
|
1041
|
+
addFormat(res, "duration", check.message, refs);
|
|
1042
|
+
break;
|
|
1043
|
+
case "length":
|
|
1044
|
+
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
1045
|
+
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
1046
|
+
break;
|
|
1047
|
+
case "includes": {
|
|
1048
|
+
addPattern(
|
|
1049
|
+
res,
|
|
1050
|
+
RegExp(escapeLiteralCheckValue(check.value, refs)),
|
|
1051
|
+
check.message,
|
|
1052
|
+
refs
|
|
1053
|
+
);
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
case "ip": {
|
|
1057
|
+
if (check.version !== "v6") {
|
|
1058
|
+
addFormat(res, "ipv4", check.message, refs);
|
|
1059
|
+
}
|
|
1060
|
+
if (check.version !== "v4") {
|
|
1061
|
+
addFormat(res, "ipv6", check.message, refs);
|
|
1062
|
+
}
|
|
1063
|
+
break;
|
|
1064
|
+
}
|
|
1065
|
+
case "base64url":
|
|
1066
|
+
addPattern(res, zodPatterns.base64url, check.message, refs);
|
|
1067
|
+
break;
|
|
1068
|
+
case "jwt":
|
|
1069
|
+
addPattern(res, zodPatterns.jwt, check.message, refs);
|
|
1070
|
+
break;
|
|
1071
|
+
case "cidr": {
|
|
1072
|
+
if (check.version !== "v6") {
|
|
1073
|
+
addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
1074
|
+
}
|
|
1075
|
+
if (check.version !== "v4") {
|
|
1076
|
+
addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
1077
|
+
}
|
|
1078
|
+
break;
|
|
1079
|
+
}
|
|
1080
|
+
case "emoji":
|
|
1081
|
+
addPattern(res, zodPatterns.emoji(), check.message, refs);
|
|
1082
|
+
break;
|
|
1083
|
+
case "ulid": {
|
|
1084
|
+
addPattern(res, zodPatterns.ulid, check.message, refs);
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
case "base64": {
|
|
1088
|
+
switch (refs.base64Strategy) {
|
|
1089
|
+
case "format:binary": {
|
|
1090
|
+
addFormat(res, "binary", check.message, refs);
|
|
1091
|
+
break;
|
|
1092
|
+
}
|
|
1093
|
+
case "contentEncoding:base64": {
|
|
1094
|
+
res.contentEncoding = "base64";
|
|
1095
|
+
break;
|
|
1096
|
+
}
|
|
1097
|
+
case "pattern:zod": {
|
|
1098
|
+
addPattern(res, zodPatterns.base64, check.message, refs);
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
break;
|
|
1103
|
+
}
|
|
1104
|
+
case "nanoid": {
|
|
1105
|
+
addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
1106
|
+
}
|
|
1107
|
+
case "toLowerCase":
|
|
1108
|
+
case "toUpperCase":
|
|
1109
|
+
case "trim":
|
|
1110
|
+
break;
|
|
1111
|
+
default:
|
|
1112
|
+
/* @__PURE__ */ ((_) => {
|
|
1113
|
+
})(check);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return res;
|
|
1118
|
+
}
|
|
1119
|
+
function escapeLiteralCheckValue(literal, refs) {
|
|
1120
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
|
|
1121
|
+
}
|
|
1122
|
+
var ALPHA_NUMERIC = new Set(
|
|
1123
|
+
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
1124
|
+
);
|
|
1125
|
+
function escapeNonAlphaNumeric(source) {
|
|
1126
|
+
let result = "";
|
|
1127
|
+
for (let i = 0; i < source.length; i++) {
|
|
1128
|
+
if (!ALPHA_NUMERIC.has(source[i])) {
|
|
1129
|
+
result += "\\";
|
|
1130
|
+
}
|
|
1131
|
+
result += source[i];
|
|
1132
|
+
}
|
|
1133
|
+
return result;
|
|
1134
|
+
}
|
|
1135
|
+
function addFormat(schema, value, message, refs) {
|
|
1136
|
+
var _a22;
|
|
1137
|
+
if (schema.format || ((_a22 = schema.anyOf) == null ? void 0 : _a22.some((x) => x.format))) {
|
|
1138
|
+
if (!schema.anyOf) {
|
|
1139
|
+
schema.anyOf = [];
|
|
1140
|
+
}
|
|
1141
|
+
if (schema.format) {
|
|
1142
|
+
schema.anyOf.push({
|
|
1143
|
+
format: schema.format
|
|
1144
|
+
});
|
|
1145
|
+
delete schema.format;
|
|
1146
|
+
}
|
|
1147
|
+
schema.anyOf.push(__spreadValues({
|
|
1148
|
+
format: value
|
|
1149
|
+
}, message && refs.errorMessages && { errorMessage: { format: message } }));
|
|
1150
|
+
} else {
|
|
1151
|
+
schema.format = value;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
function addPattern(schema, regex, message, refs) {
|
|
1155
|
+
var _a22;
|
|
1156
|
+
if (schema.pattern || ((_a22 = schema.allOf) == null ? void 0 : _a22.some((x) => x.pattern))) {
|
|
1157
|
+
if (!schema.allOf) {
|
|
1158
|
+
schema.allOf = [];
|
|
1159
|
+
}
|
|
1160
|
+
if (schema.pattern) {
|
|
1161
|
+
schema.allOf.push({
|
|
1162
|
+
pattern: schema.pattern
|
|
1163
|
+
});
|
|
1164
|
+
delete schema.pattern;
|
|
1165
|
+
}
|
|
1166
|
+
schema.allOf.push(__spreadValues({
|
|
1167
|
+
pattern: stringifyRegExpWithFlags(regex, refs)
|
|
1168
|
+
}, message && refs.errorMessages && { errorMessage: { pattern: message } }));
|
|
1169
|
+
} else {
|
|
1170
|
+
schema.pattern = stringifyRegExpWithFlags(regex, refs);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
function stringifyRegExpWithFlags(regex, refs) {
|
|
1174
|
+
var _a22;
|
|
1175
|
+
if (!refs.applyRegexFlags || !regex.flags) {
|
|
1176
|
+
return regex.source;
|
|
1177
|
+
}
|
|
1178
|
+
const flags = {
|
|
1179
|
+
i: regex.flags.includes("i"),
|
|
1180
|
+
// Case-insensitive
|
|
1181
|
+
m: regex.flags.includes("m"),
|
|
1182
|
+
// `^` and `$` matches adjacent to newline characters
|
|
1183
|
+
s: regex.flags.includes("s")
|
|
1184
|
+
// `.` matches newlines
|
|
1185
|
+
};
|
|
1186
|
+
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
1187
|
+
let pattern = "";
|
|
1188
|
+
let isEscaped = false;
|
|
1189
|
+
let inCharGroup = false;
|
|
1190
|
+
let inCharRange = false;
|
|
1191
|
+
for (let i = 0; i < source.length; i++) {
|
|
1192
|
+
if (isEscaped) {
|
|
1193
|
+
pattern += source[i];
|
|
1194
|
+
isEscaped = false;
|
|
1195
|
+
continue;
|
|
1196
|
+
}
|
|
1197
|
+
if (flags.i) {
|
|
1198
|
+
if (inCharGroup) {
|
|
1199
|
+
if (source[i].match(/[a-z]/)) {
|
|
1200
|
+
if (inCharRange) {
|
|
1201
|
+
pattern += source[i];
|
|
1202
|
+
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
1203
|
+
inCharRange = false;
|
|
1204
|
+
} else if (source[i + 1] === "-" && ((_a22 = source[i + 2]) == null ? void 0 : _a22.match(/[a-z]/))) {
|
|
1205
|
+
pattern += source[i];
|
|
1206
|
+
inCharRange = true;
|
|
1207
|
+
} else {
|
|
1208
|
+
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
1209
|
+
}
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1212
|
+
} else if (source[i].match(/[a-z]/)) {
|
|
1213
|
+
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
1214
|
+
continue;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
if (flags.m) {
|
|
1218
|
+
if (source[i] === "^") {
|
|
1219
|
+
pattern += `(^|(?<=[\r
|
|
1220
|
+
]))`;
|
|
1221
|
+
continue;
|
|
1222
|
+
} else if (source[i] === "$") {
|
|
1223
|
+
pattern += `($|(?=[\r
|
|
1224
|
+
]))`;
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
if (flags.s && source[i] === ".") {
|
|
1229
|
+
pattern += inCharGroup ? `${source[i]}\r
|
|
1230
|
+
` : `[${source[i]}\r
|
|
1231
|
+
]`;
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
pattern += source[i];
|
|
1235
|
+
if (source[i] === "\\") {
|
|
1236
|
+
isEscaped = true;
|
|
1237
|
+
} else if (inCharGroup && source[i] === "]") {
|
|
1238
|
+
inCharGroup = false;
|
|
1239
|
+
} else if (!inCharGroup && source[i] === "[") {
|
|
1240
|
+
inCharGroup = true;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
try {
|
|
1244
|
+
new RegExp(pattern);
|
|
1245
|
+
} catch (e) {
|
|
1246
|
+
console.warn(
|
|
1247
|
+
`Could not convert regex pattern at ${refs.currentPath.join(
|
|
1248
|
+
"/"
|
|
1249
|
+
)} to a flag-independent form! Falling back to the flag-ignorant source`
|
|
1250
|
+
);
|
|
1251
|
+
return regex.source;
|
|
1252
|
+
}
|
|
1253
|
+
return pattern;
|
|
1254
|
+
}
|
|
1255
|
+
function parseRecordDef(def, refs) {
|
|
1256
|
+
var _a22, _b22, _c, _d, _e, _f;
|
|
1257
|
+
const schema = {
|
|
1258
|
+
type: "object",
|
|
1259
|
+
additionalProperties: (_a22 = parseDef(def.valueType._def, __spreadProps(__spreadValues({}, refs), {
|
|
1260
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
1261
|
+
}))) != null ? _a22 : refs.allowedAdditionalProperties
|
|
1262
|
+
};
|
|
1263
|
+
if (((_b22 = def.keyType) == null ? void 0 : _b22._def.typeName) === ZodFirstPartyTypeKind2.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
1264
|
+
const _a16 = parseStringDef(def.keyType._def, refs), { type } = _a16, keyType = __objRest(_a16, ["type"]);
|
|
1265
|
+
return __spreadProps(__spreadValues({}, schema), {
|
|
1266
|
+
propertyNames: keyType
|
|
1267
|
+
});
|
|
1268
|
+
} else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === ZodFirstPartyTypeKind2.ZodEnum) {
|
|
1269
|
+
return __spreadProps(__spreadValues({}, schema), {
|
|
1270
|
+
propertyNames: {
|
|
1271
|
+
enum: def.keyType._def.values
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
} else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === ZodFirstPartyTypeKind2.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind2.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
|
|
1275
|
+
const _b16 = parseBrandedDef(
|
|
1276
|
+
def.keyType._def,
|
|
1277
|
+
refs
|
|
1278
|
+
), { type } = _b16, keyType = __objRest(_b16, ["type"]);
|
|
1279
|
+
return __spreadProps(__spreadValues({}, schema), {
|
|
1280
|
+
propertyNames: keyType
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
return schema;
|
|
1284
|
+
}
|
|
1285
|
+
function parseMapDef(def, refs) {
|
|
1286
|
+
if (refs.mapStrategy === "record") {
|
|
1287
|
+
return parseRecordDef(def, refs);
|
|
1288
|
+
}
|
|
1289
|
+
const keys = parseDef(def.keyType._def, __spreadProps(__spreadValues({}, refs), {
|
|
1290
|
+
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
1291
|
+
})) || parseAnyDef();
|
|
1292
|
+
const values = parseDef(def.valueType._def, __spreadProps(__spreadValues({}, refs), {
|
|
1293
|
+
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
1294
|
+
})) || parseAnyDef();
|
|
1295
|
+
return {
|
|
1296
|
+
type: "array",
|
|
1297
|
+
maxItems: 125,
|
|
1298
|
+
items: {
|
|
1299
|
+
type: "array",
|
|
1300
|
+
items: [keys, values],
|
|
1301
|
+
minItems: 2,
|
|
1302
|
+
maxItems: 2
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
function parseNativeEnumDef(def) {
|
|
1307
|
+
const object = def.values;
|
|
1308
|
+
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
1309
|
+
return typeof object[object[key]] !== "number";
|
|
1310
|
+
});
|
|
1311
|
+
const actualValues = actualKeys.map((key) => object[key]);
|
|
1312
|
+
const parsedTypes = Array.from(
|
|
1313
|
+
new Set(actualValues.map((values) => typeof values))
|
|
1314
|
+
);
|
|
1315
|
+
return {
|
|
1316
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
1317
|
+
enum: actualValues
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function parseNeverDef() {
|
|
1321
|
+
return { not: parseAnyDef() };
|
|
1322
|
+
}
|
|
1323
|
+
function parseNullDef() {
|
|
1324
|
+
return {
|
|
1325
|
+
type: "null"
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1328
|
+
var primitiveMappings = {
|
|
1329
|
+
ZodString: "string",
|
|
1330
|
+
ZodNumber: "number",
|
|
1331
|
+
ZodBigInt: "integer",
|
|
1332
|
+
ZodBoolean: "boolean",
|
|
1333
|
+
ZodNull: "null"
|
|
1334
|
+
};
|
|
1335
|
+
function parseUnionDef(def, refs) {
|
|
1336
|
+
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
1337
|
+
if (options.every(
|
|
1338
|
+
(x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length)
|
|
1339
|
+
)) {
|
|
1340
|
+
const types = options.reduce((types2, x) => {
|
|
1341
|
+
const type = primitiveMappings[x._def.typeName];
|
|
1342
|
+
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
1343
|
+
}, []);
|
|
1344
|
+
return {
|
|
1345
|
+
type: types.length > 1 ? types : types[0]
|
|
1346
|
+
};
|
|
1347
|
+
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
1348
|
+
const types = options.reduce(
|
|
1349
|
+
(acc, x) => {
|
|
1350
|
+
const type = typeof x._def.value;
|
|
1351
|
+
switch (type) {
|
|
1352
|
+
case "string":
|
|
1353
|
+
case "number":
|
|
1354
|
+
case "boolean":
|
|
1355
|
+
return [...acc, type];
|
|
1356
|
+
case "bigint":
|
|
1357
|
+
return [...acc, "integer"];
|
|
1358
|
+
case "object":
|
|
1359
|
+
if (x._def.value === null) return [...acc, "null"];
|
|
1360
|
+
case "symbol":
|
|
1361
|
+
case "undefined":
|
|
1362
|
+
case "function":
|
|
1363
|
+
default:
|
|
1364
|
+
return acc;
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
[]
|
|
1368
|
+
);
|
|
1369
|
+
if (types.length === options.length) {
|
|
1370
|
+
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
1371
|
+
return {
|
|
1372
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
1373
|
+
enum: options.reduce(
|
|
1374
|
+
(acc, x) => {
|
|
1375
|
+
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
1376
|
+
},
|
|
1377
|
+
[]
|
|
1378
|
+
)
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
1382
|
+
return {
|
|
1383
|
+
type: "string",
|
|
1384
|
+
enum: options.reduce(
|
|
1385
|
+
(acc, x) => [
|
|
1386
|
+
...acc,
|
|
1387
|
+
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
1388
|
+
],
|
|
1389
|
+
[]
|
|
1390
|
+
)
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
return asAnyOf(def, refs);
|
|
1394
|
+
}
|
|
1395
|
+
var asAnyOf = (def, refs) => {
|
|
1396
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
1397
|
+
(x, i) => parseDef(x._def, __spreadProps(__spreadValues({}, refs), {
|
|
1398
|
+
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
1399
|
+
}))
|
|
1400
|
+
).filter(
|
|
1401
|
+
(x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0)
|
|
1402
|
+
);
|
|
1403
|
+
return anyOf.length ? { anyOf } : void 0;
|
|
1404
|
+
};
|
|
1405
|
+
function parseNullableDef(def, refs) {
|
|
1406
|
+
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
|
|
1407
|
+
def.innerType._def.typeName
|
|
1408
|
+
) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
1409
|
+
return {
|
|
1410
|
+
type: [
|
|
1411
|
+
primitiveMappings[def.innerType._def.typeName],
|
|
1412
|
+
"null"
|
|
1413
|
+
]
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
const base = parseDef(def.innerType._def, __spreadProps(__spreadValues({}, refs), {
|
|
1417
|
+
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
1418
|
+
}));
|
|
1419
|
+
return base && { anyOf: [base, { type: "null" }] };
|
|
1420
|
+
}
|
|
1421
|
+
function parseNumberDef(def) {
|
|
1422
|
+
const res = {
|
|
1423
|
+
type: "number"
|
|
1424
|
+
};
|
|
1425
|
+
if (!def.checks) return res;
|
|
1426
|
+
for (const check of def.checks) {
|
|
1427
|
+
switch (check.kind) {
|
|
1428
|
+
case "int":
|
|
1429
|
+
res.type = "integer";
|
|
1430
|
+
break;
|
|
1431
|
+
case "min":
|
|
1432
|
+
if (check.inclusive) {
|
|
1433
|
+
res.minimum = check.value;
|
|
1434
|
+
} else {
|
|
1435
|
+
res.exclusiveMinimum = check.value;
|
|
1436
|
+
}
|
|
1437
|
+
break;
|
|
1438
|
+
case "max":
|
|
1439
|
+
if (check.inclusive) {
|
|
1440
|
+
res.maximum = check.value;
|
|
1441
|
+
} else {
|
|
1442
|
+
res.exclusiveMaximum = check.value;
|
|
1443
|
+
}
|
|
1444
|
+
break;
|
|
1445
|
+
case "multipleOf":
|
|
1446
|
+
res.multipleOf = check.value;
|
|
1447
|
+
break;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return res;
|
|
1451
|
+
}
|
|
1452
|
+
function parseObjectDef(def, refs) {
|
|
1453
|
+
const result = {
|
|
1454
|
+
type: "object",
|
|
1455
|
+
properties: {}
|
|
1456
|
+
};
|
|
1457
|
+
const required = [];
|
|
1458
|
+
const shape = def.shape();
|
|
1459
|
+
for (const propName in shape) {
|
|
1460
|
+
let propDef = shape[propName];
|
|
1461
|
+
if (propDef === void 0 || propDef._def === void 0) {
|
|
1462
|
+
continue;
|
|
1463
|
+
}
|
|
1464
|
+
const propOptional = safeIsOptional(propDef);
|
|
1465
|
+
const parsedDef = parseDef(propDef._def, __spreadProps(__spreadValues({}, refs), {
|
|
1466
|
+
currentPath: [...refs.currentPath, "properties", propName],
|
|
1467
|
+
propertyPath: [...refs.currentPath, "properties", propName]
|
|
1468
|
+
}));
|
|
1469
|
+
if (parsedDef === void 0) {
|
|
1470
|
+
continue;
|
|
1471
|
+
}
|
|
1472
|
+
result.properties[propName] = parsedDef;
|
|
1473
|
+
if (!propOptional) {
|
|
1474
|
+
required.push(propName);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
if (required.length) {
|
|
1478
|
+
result.required = required;
|
|
1479
|
+
}
|
|
1480
|
+
const additionalProperties = decideAdditionalProperties(def, refs);
|
|
1481
|
+
if (additionalProperties !== void 0) {
|
|
1482
|
+
result.additionalProperties = additionalProperties;
|
|
1483
|
+
}
|
|
1484
|
+
return result;
|
|
1485
|
+
}
|
|
1486
|
+
function decideAdditionalProperties(def, refs) {
|
|
1487
|
+
if (def.catchall._def.typeName !== "ZodNever") {
|
|
1488
|
+
return parseDef(def.catchall._def, __spreadProps(__spreadValues({}, refs), {
|
|
1489
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
1490
|
+
}));
|
|
1491
|
+
}
|
|
1492
|
+
switch (def.unknownKeys) {
|
|
1493
|
+
case "passthrough":
|
|
1494
|
+
return refs.allowedAdditionalProperties;
|
|
1495
|
+
case "strict":
|
|
1496
|
+
return refs.rejectedAdditionalProperties;
|
|
1497
|
+
case "strip":
|
|
1498
|
+
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
function safeIsOptional(schema) {
|
|
1502
|
+
try {
|
|
1503
|
+
return schema.isOptional();
|
|
1504
|
+
} catch (e) {
|
|
1505
|
+
return true;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
var parseOptionalDef = (def, refs) => {
|
|
1509
|
+
var _a22;
|
|
1510
|
+
if (refs.currentPath.toString() === ((_a22 = refs.propertyPath) == null ? void 0 : _a22.toString())) {
|
|
1511
|
+
return parseDef(def.innerType._def, refs);
|
|
1512
|
+
}
|
|
1513
|
+
const innerSchema = parseDef(def.innerType._def, __spreadProps(__spreadValues({}, refs), {
|
|
1514
|
+
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
1515
|
+
}));
|
|
1516
|
+
return innerSchema ? { anyOf: [{ not: parseAnyDef() }, innerSchema] } : parseAnyDef();
|
|
1517
|
+
};
|
|
1518
|
+
var parsePipelineDef = (def, refs) => {
|
|
1519
|
+
if (refs.pipeStrategy === "input") {
|
|
1520
|
+
return parseDef(def.in._def, refs);
|
|
1521
|
+
} else if (refs.pipeStrategy === "output") {
|
|
1522
|
+
return parseDef(def.out._def, refs);
|
|
1523
|
+
}
|
|
1524
|
+
const a = parseDef(def.in._def, __spreadProps(__spreadValues({}, refs), {
|
|
1525
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
1526
|
+
}));
|
|
1527
|
+
const b = parseDef(def.out._def, __spreadProps(__spreadValues({}, refs), {
|
|
1528
|
+
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
1529
|
+
}));
|
|
1530
|
+
return {
|
|
1531
|
+
allOf: [a, b].filter((x) => x !== void 0)
|
|
1532
|
+
};
|
|
1533
|
+
};
|
|
1534
|
+
function parsePromiseDef(def, refs) {
|
|
1535
|
+
return parseDef(def.type._def, refs);
|
|
1536
|
+
}
|
|
1537
|
+
function parseSetDef(def, refs) {
|
|
1538
|
+
const items = parseDef(def.valueType._def, __spreadProps(__spreadValues({}, refs), {
|
|
1539
|
+
currentPath: [...refs.currentPath, "items"]
|
|
1540
|
+
}));
|
|
1541
|
+
const schema = {
|
|
1542
|
+
type: "array",
|
|
1543
|
+
uniqueItems: true,
|
|
1544
|
+
items
|
|
1545
|
+
};
|
|
1546
|
+
if (def.minSize) {
|
|
1547
|
+
schema.minItems = def.minSize.value;
|
|
1548
|
+
}
|
|
1549
|
+
if (def.maxSize) {
|
|
1550
|
+
schema.maxItems = def.maxSize.value;
|
|
1551
|
+
}
|
|
1552
|
+
return schema;
|
|
1553
|
+
}
|
|
1554
|
+
function parseTupleDef(def, refs) {
|
|
1555
|
+
if (def.rest) {
|
|
1556
|
+
return {
|
|
1557
|
+
type: "array",
|
|
1558
|
+
minItems: def.items.length,
|
|
1559
|
+
items: def.items.map(
|
|
1560
|
+
(x, i) => parseDef(x._def, __spreadProps(__spreadValues({}, refs), {
|
|
1561
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1562
|
+
}))
|
|
1563
|
+
).reduce(
|
|
1564
|
+
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
1565
|
+
[]
|
|
1566
|
+
),
|
|
1567
|
+
additionalItems: parseDef(def.rest._def, __spreadProps(__spreadValues({}, refs), {
|
|
1568
|
+
currentPath: [...refs.currentPath, "additionalItems"]
|
|
1569
|
+
}))
|
|
1570
|
+
};
|
|
1571
|
+
} else {
|
|
1572
|
+
return {
|
|
1573
|
+
type: "array",
|
|
1574
|
+
minItems: def.items.length,
|
|
1575
|
+
maxItems: def.items.length,
|
|
1576
|
+
items: def.items.map(
|
|
1577
|
+
(x, i) => parseDef(x._def, __spreadProps(__spreadValues({}, refs), {
|
|
1578
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
1579
|
+
}))
|
|
1580
|
+
).reduce(
|
|
1581
|
+
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
1582
|
+
[]
|
|
1583
|
+
)
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
function parseUndefinedDef() {
|
|
1588
|
+
return {
|
|
1589
|
+
not: parseAnyDef()
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
function parseUnknownDef() {
|
|
1593
|
+
return parseAnyDef();
|
|
1594
|
+
}
|
|
1595
|
+
var parseReadonlyDef = (def, refs) => {
|
|
1596
|
+
return parseDef(def.innerType._def, refs);
|
|
1597
|
+
};
|
|
1598
|
+
var selectParser = (def, typeName, refs) => {
|
|
1599
|
+
switch (typeName) {
|
|
1600
|
+
case ZodFirstPartyTypeKind3.ZodString:
|
|
1601
|
+
return parseStringDef(def, refs);
|
|
1602
|
+
case ZodFirstPartyTypeKind3.ZodNumber:
|
|
1603
|
+
return parseNumberDef(def);
|
|
1604
|
+
case ZodFirstPartyTypeKind3.ZodObject:
|
|
1605
|
+
return parseObjectDef(def, refs);
|
|
1606
|
+
case ZodFirstPartyTypeKind3.ZodBigInt:
|
|
1607
|
+
return parseBigintDef(def);
|
|
1608
|
+
case ZodFirstPartyTypeKind3.ZodBoolean:
|
|
1609
|
+
return parseBooleanDef();
|
|
1610
|
+
case ZodFirstPartyTypeKind3.ZodDate:
|
|
1611
|
+
return parseDateDef(def, refs);
|
|
1612
|
+
case ZodFirstPartyTypeKind3.ZodUndefined:
|
|
1613
|
+
return parseUndefinedDef();
|
|
1614
|
+
case ZodFirstPartyTypeKind3.ZodNull:
|
|
1615
|
+
return parseNullDef();
|
|
1616
|
+
case ZodFirstPartyTypeKind3.ZodArray:
|
|
1617
|
+
return parseArrayDef(def, refs);
|
|
1618
|
+
case ZodFirstPartyTypeKind3.ZodUnion:
|
|
1619
|
+
case ZodFirstPartyTypeKind3.ZodDiscriminatedUnion:
|
|
1620
|
+
return parseUnionDef(def, refs);
|
|
1621
|
+
case ZodFirstPartyTypeKind3.ZodIntersection:
|
|
1622
|
+
return parseIntersectionDef(def, refs);
|
|
1623
|
+
case ZodFirstPartyTypeKind3.ZodTuple:
|
|
1624
|
+
return parseTupleDef(def, refs);
|
|
1625
|
+
case ZodFirstPartyTypeKind3.ZodRecord:
|
|
1626
|
+
return parseRecordDef(def, refs);
|
|
1627
|
+
case ZodFirstPartyTypeKind3.ZodLiteral:
|
|
1628
|
+
return parseLiteralDef(def);
|
|
1629
|
+
case ZodFirstPartyTypeKind3.ZodEnum:
|
|
1630
|
+
return parseEnumDef(def);
|
|
1631
|
+
case ZodFirstPartyTypeKind3.ZodNativeEnum:
|
|
1632
|
+
return parseNativeEnumDef(def);
|
|
1633
|
+
case ZodFirstPartyTypeKind3.ZodNullable:
|
|
1634
|
+
return parseNullableDef(def, refs);
|
|
1635
|
+
case ZodFirstPartyTypeKind3.ZodOptional:
|
|
1636
|
+
return parseOptionalDef(def, refs);
|
|
1637
|
+
case ZodFirstPartyTypeKind3.ZodMap:
|
|
1638
|
+
return parseMapDef(def, refs);
|
|
1639
|
+
case ZodFirstPartyTypeKind3.ZodSet:
|
|
1640
|
+
return parseSetDef(def, refs);
|
|
1641
|
+
case ZodFirstPartyTypeKind3.ZodLazy:
|
|
1642
|
+
return () => def.getter()._def;
|
|
1643
|
+
case ZodFirstPartyTypeKind3.ZodPromise:
|
|
1644
|
+
return parsePromiseDef(def, refs);
|
|
1645
|
+
case ZodFirstPartyTypeKind3.ZodNaN:
|
|
1646
|
+
case ZodFirstPartyTypeKind3.ZodNever:
|
|
1647
|
+
return parseNeverDef();
|
|
1648
|
+
case ZodFirstPartyTypeKind3.ZodEffects:
|
|
1649
|
+
return parseEffectsDef(def, refs);
|
|
1650
|
+
case ZodFirstPartyTypeKind3.ZodAny:
|
|
1651
|
+
return parseAnyDef();
|
|
1652
|
+
case ZodFirstPartyTypeKind3.ZodUnknown:
|
|
1653
|
+
return parseUnknownDef();
|
|
1654
|
+
case ZodFirstPartyTypeKind3.ZodDefault:
|
|
1655
|
+
return parseDefaultDef(def, refs);
|
|
1656
|
+
case ZodFirstPartyTypeKind3.ZodBranded:
|
|
1657
|
+
return parseBrandedDef(def, refs);
|
|
1658
|
+
case ZodFirstPartyTypeKind3.ZodReadonly:
|
|
1659
|
+
return parseReadonlyDef(def, refs);
|
|
1660
|
+
case ZodFirstPartyTypeKind3.ZodCatch:
|
|
1661
|
+
return parseCatchDef(def, refs);
|
|
1662
|
+
case ZodFirstPartyTypeKind3.ZodPipeline:
|
|
1663
|
+
return parsePipelineDef(def, refs);
|
|
1664
|
+
case ZodFirstPartyTypeKind3.ZodFunction:
|
|
1665
|
+
case ZodFirstPartyTypeKind3.ZodVoid:
|
|
1666
|
+
case ZodFirstPartyTypeKind3.ZodSymbol:
|
|
1667
|
+
return void 0;
|
|
1668
|
+
default:
|
|
1669
|
+
return /* @__PURE__ */ ((_) => void 0)(typeName);
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
var getRelativePath = (pathA, pathB) => {
|
|
1673
|
+
let i = 0;
|
|
1674
|
+
for (; i < pathA.length && i < pathB.length; i++) {
|
|
1675
|
+
if (pathA[i] !== pathB[i]) break;
|
|
1676
|
+
}
|
|
1677
|
+
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
1678
|
+
};
|
|
1679
|
+
function parseDef(def, refs, forceResolution = false) {
|
|
1680
|
+
var _a22;
|
|
1681
|
+
const seenItem = refs.seen.get(def);
|
|
1682
|
+
if (refs.override) {
|
|
1683
|
+
const overrideResult = (_a22 = refs.override) == null ? void 0 : _a22.call(
|
|
1684
|
+
refs,
|
|
1685
|
+
def,
|
|
1686
|
+
refs,
|
|
1687
|
+
seenItem,
|
|
1688
|
+
forceResolution
|
|
1689
|
+
);
|
|
1690
|
+
if (overrideResult !== ignoreOverride) {
|
|
1691
|
+
return overrideResult;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
if (seenItem && !forceResolution) {
|
|
1695
|
+
const seenSchema = get$ref(seenItem, refs);
|
|
1696
|
+
if (seenSchema !== void 0) {
|
|
1697
|
+
return seenSchema;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
1701
|
+
refs.seen.set(def, newItem);
|
|
1702
|
+
const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
1703
|
+
const jsonSchema2 = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
1704
|
+
if (jsonSchema2) {
|
|
1705
|
+
addMeta(def, refs, jsonSchema2);
|
|
1706
|
+
}
|
|
1707
|
+
if (refs.postProcess) {
|
|
1708
|
+
const postProcessResult = refs.postProcess(jsonSchema2, def, refs);
|
|
1709
|
+
newItem.jsonSchema = jsonSchema2;
|
|
1710
|
+
return postProcessResult;
|
|
1711
|
+
}
|
|
1712
|
+
newItem.jsonSchema = jsonSchema2;
|
|
1713
|
+
return jsonSchema2;
|
|
1714
|
+
}
|
|
1715
|
+
var get$ref = (item, refs) => {
|
|
1716
|
+
switch (refs.$refStrategy) {
|
|
1717
|
+
case "root":
|
|
1718
|
+
return { $ref: item.path.join("/") };
|
|
1719
|
+
case "relative":
|
|
1720
|
+
return { $ref: getRelativePath(refs.currentPath, item.path) };
|
|
1721
|
+
case "none":
|
|
1722
|
+
case "seen": {
|
|
1723
|
+
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
1724
|
+
console.warn(
|
|
1725
|
+
`Recursive reference detected at ${refs.currentPath.join(
|
|
1726
|
+
"/"
|
|
1727
|
+
)}! Defaulting to any`
|
|
1728
|
+
);
|
|
1729
|
+
return parseAnyDef();
|
|
1730
|
+
}
|
|
1731
|
+
return refs.$refStrategy === "seen" ? parseAnyDef() : void 0;
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
var addMeta = (def, refs, jsonSchema2) => {
|
|
1736
|
+
if (def.description) {
|
|
1737
|
+
jsonSchema2.description = def.description;
|
|
1738
|
+
}
|
|
1739
|
+
return jsonSchema2;
|
|
1740
|
+
};
|
|
1741
|
+
var getRefs = (options) => {
|
|
1742
|
+
const _options = getDefaultOptions(options);
|
|
1743
|
+
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
1744
|
+
return __spreadProps(__spreadValues({}, _options), {
|
|
1745
|
+
currentPath,
|
|
1746
|
+
propertyPath: void 0,
|
|
1747
|
+
seen: new Map(
|
|
1748
|
+
Object.entries(_options.definitions).map(([name22, def]) => [
|
|
1749
|
+
def._def,
|
|
1750
|
+
{
|
|
1751
|
+
def: def._def,
|
|
1752
|
+
path: [..._options.basePath, _options.definitionPath, name22],
|
|
1753
|
+
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
1754
|
+
jsonSchema: void 0
|
|
1755
|
+
}
|
|
1756
|
+
])
|
|
1757
|
+
)
|
|
1758
|
+
});
|
|
1759
|
+
};
|
|
1760
|
+
var zod3ToJsonSchema = (schema, options) => {
|
|
1761
|
+
var _a22;
|
|
1762
|
+
const refs = getRefs(options);
|
|
1763
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
1764
|
+
(acc, [name32, schema2]) => {
|
|
1765
|
+
var _a32;
|
|
1766
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
1767
|
+
[name32]: (_a32 = parseDef(
|
|
1768
|
+
schema2._def,
|
|
1769
|
+
__spreadProps(__spreadValues({}, refs), {
|
|
1770
|
+
currentPath: [...refs.basePath, refs.definitionPath, name32]
|
|
1771
|
+
}),
|
|
1772
|
+
true
|
|
1773
|
+
)) != null ? _a32 : parseAnyDef()
|
|
1774
|
+
});
|
|
1775
|
+
},
|
|
1776
|
+
{}
|
|
1777
|
+
) : void 0;
|
|
1778
|
+
const name22 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
1779
|
+
const main = (_a22 = parseDef(
|
|
1780
|
+
schema._def,
|
|
1781
|
+
name22 === void 0 ? refs : __spreadProps(__spreadValues({}, refs), {
|
|
1782
|
+
currentPath: [...refs.basePath, refs.definitionPath, name22]
|
|
1783
|
+
}),
|
|
1784
|
+
false
|
|
1785
|
+
)) != null ? _a22 : parseAnyDef();
|
|
1786
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
1787
|
+
if (title !== void 0) {
|
|
1788
|
+
main.title = title;
|
|
1789
|
+
}
|
|
1790
|
+
const combined = name22 === void 0 ? definitions ? __spreadProps(__spreadValues({}, main), {
|
|
1791
|
+
[refs.definitionPath]: definitions
|
|
1792
|
+
}) : main : {
|
|
1793
|
+
$ref: [
|
|
1794
|
+
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
1795
|
+
refs.definitionPath,
|
|
1796
|
+
name22
|
|
1797
|
+
].join("/"),
|
|
1798
|
+
[refs.definitionPath]: __spreadProps(__spreadValues({}, definitions), {
|
|
1799
|
+
[name22]: main
|
|
1800
|
+
})
|
|
1801
|
+
};
|
|
1802
|
+
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
1803
|
+
return combined;
|
|
1804
|
+
};
|
|
1805
|
+
var schemaSymbol = Symbol.for("vercel.ai.schema");
|
|
1806
|
+
function jsonSchema(jsonSchema2, {
|
|
1807
|
+
validate
|
|
1808
|
+
} = {}) {
|
|
1809
|
+
return {
|
|
1810
|
+
[schemaSymbol]: true,
|
|
1811
|
+
_type: void 0,
|
|
1812
|
+
// should never be used directly
|
|
1813
|
+
get jsonSchema() {
|
|
1814
|
+
if (typeof jsonSchema2 === "function") {
|
|
1815
|
+
jsonSchema2 = jsonSchema2();
|
|
1816
|
+
}
|
|
1817
|
+
return jsonSchema2;
|
|
1818
|
+
},
|
|
1819
|
+
validate
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
function isSchema(value) {
|
|
1823
|
+
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
|
|
1824
|
+
}
|
|
1825
|
+
function asSchema(schema) {
|
|
1826
|
+
return schema == null ? jsonSchema({ properties: {}, additionalProperties: false }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
|
|
1827
|
+
}
|
|
1828
|
+
function standardSchema(standardSchema2) {
|
|
1829
|
+
return jsonSchema(
|
|
1830
|
+
() => standardSchema2["~standard"].jsonSchema.input({
|
|
1831
|
+
target: "draft-07"
|
|
1832
|
+
}),
|
|
1833
|
+
{
|
|
1834
|
+
validate: async (value) => {
|
|
1835
|
+
const result = await standardSchema2["~standard"].validate(value);
|
|
1836
|
+
return "value" in result ? { success: true, value: result.value } : {
|
|
1837
|
+
success: false,
|
|
1838
|
+
error: new TypeValidationError({
|
|
1839
|
+
value,
|
|
1840
|
+
cause: result.issues
|
|
1841
|
+
})
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
function zod3Schema(zodSchema2, options) {
|
|
1848
|
+
var _a22;
|
|
1849
|
+
const useReferences = (_a22 = options == null ? void 0 : options.useReferences) != null ? _a22 : false;
|
|
1850
|
+
return jsonSchema(
|
|
1851
|
+
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
1852
|
+
() => zod3ToJsonSchema(zodSchema2, {
|
|
1853
|
+
$refStrategy: useReferences ? "root" : "none"
|
|
1854
|
+
}),
|
|
1855
|
+
{
|
|
1856
|
+
validate: async (value) => {
|
|
1857
|
+
const result = await zodSchema2.safeParseAsync(value);
|
|
1858
|
+
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
);
|
|
1862
|
+
}
|
|
1863
|
+
function zod4Schema(zodSchema2, options) {
|
|
1864
|
+
var _a22;
|
|
1865
|
+
const useReferences = (_a22 = options == null ? void 0 : options.useReferences) != null ? _a22 : false;
|
|
1866
|
+
return jsonSchema(
|
|
1867
|
+
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
1868
|
+
() => addAdditionalPropertiesToJsonSchema(
|
|
1869
|
+
z4.toJSONSchema(zodSchema2, {
|
|
1870
|
+
target: "draft-7",
|
|
1871
|
+
io: "input",
|
|
1872
|
+
reused: useReferences ? "ref" : "inline"
|
|
1873
|
+
})
|
|
1874
|
+
),
|
|
1875
|
+
{
|
|
1876
|
+
validate: async (value) => {
|
|
1877
|
+
const result = await z4.safeParseAsync(zodSchema2, value);
|
|
1878
|
+
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
);
|
|
1882
|
+
}
|
|
1883
|
+
function isZod4Schema(zodSchema2) {
|
|
1884
|
+
return "_zod" in zodSchema2;
|
|
1885
|
+
}
|
|
1886
|
+
function zodSchema(zodSchema2, options) {
|
|
1887
|
+
if (isZod4Schema(zodSchema2)) {
|
|
1888
|
+
return zod4Schema(zodSchema2, options);
|
|
1889
|
+
} else {
|
|
1890
|
+
return zod3Schema(zodSchema2, options);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
async function validateTypes({
|
|
1894
|
+
value,
|
|
1895
|
+
schema
|
|
1896
|
+
}) {
|
|
1897
|
+
const result = await safeValidateTypes({ value, schema });
|
|
1898
|
+
if (!result.success) {
|
|
1899
|
+
throw TypeValidationError.wrap({ value, cause: result.error });
|
|
1900
|
+
}
|
|
1901
|
+
return result.value;
|
|
1902
|
+
}
|
|
1903
|
+
async function safeValidateTypes({
|
|
1904
|
+
value,
|
|
1905
|
+
schema
|
|
1906
|
+
}) {
|
|
1907
|
+
const actualSchema = asSchema(schema);
|
|
1908
|
+
try {
|
|
1909
|
+
if (actualSchema.validate == null) {
|
|
1910
|
+
return { success: true, value, rawValue: value };
|
|
1911
|
+
}
|
|
1912
|
+
const result = await actualSchema.validate(value);
|
|
1913
|
+
if (result.success) {
|
|
1914
|
+
return { success: true, value: result.value, rawValue: value };
|
|
1915
|
+
}
|
|
1916
|
+
return {
|
|
1917
|
+
success: false,
|
|
1918
|
+
error: TypeValidationError.wrap({ value, cause: result.error }),
|
|
1919
|
+
rawValue: value
|
|
1920
|
+
};
|
|
1921
|
+
} catch (error) {
|
|
1922
|
+
return {
|
|
1923
|
+
success: false,
|
|
1924
|
+
error: TypeValidationError.wrap({ value, cause: error }),
|
|
1925
|
+
rawValue: value
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
async function parseJSON({
|
|
1930
|
+
text,
|
|
1931
|
+
schema
|
|
1932
|
+
}) {
|
|
1933
|
+
try {
|
|
1934
|
+
const value = secureJsonParse(text);
|
|
1935
|
+
if (schema == null) {
|
|
1936
|
+
return value;
|
|
1937
|
+
}
|
|
1938
|
+
return validateTypes({ value, schema });
|
|
1939
|
+
} catch (error) {
|
|
1940
|
+
if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
|
|
1941
|
+
throw error;
|
|
1942
|
+
}
|
|
1943
|
+
throw new JSONParseError({ text, cause: error });
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
async function safeParseJSON({
|
|
1947
|
+
text,
|
|
1948
|
+
schema
|
|
1949
|
+
}) {
|
|
1950
|
+
try {
|
|
1951
|
+
const value = secureJsonParse(text);
|
|
1952
|
+
if (schema == null) {
|
|
1953
|
+
return { success: true, value, rawValue: value };
|
|
1954
|
+
}
|
|
1955
|
+
return await safeValidateTypes({ value, schema });
|
|
1956
|
+
} catch (error) {
|
|
1957
|
+
return {
|
|
1958
|
+
success: false,
|
|
1959
|
+
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text, cause: error }),
|
|
1960
|
+
rawValue: void 0
|
|
1961
|
+
};
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
function isParsableJson(input) {
|
|
1965
|
+
try {
|
|
1966
|
+
secureJsonParse(input);
|
|
1967
|
+
return true;
|
|
1968
|
+
} catch (e) {
|
|
1969
|
+
return false;
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
function parseJsonEventStream({
|
|
1973
|
+
stream,
|
|
1974
|
+
schema
|
|
1975
|
+
}) {
|
|
1976
|
+
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
|
|
1977
|
+
new TransformStream({
|
|
1978
|
+
async transform({ data }, controller) {
|
|
1979
|
+
if (data === "[DONE]") {
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
controller.enqueue(await safeParseJSON({ text: data, schema }));
|
|
1983
|
+
}
|
|
1984
|
+
})
|
|
1985
|
+
);
|
|
1986
|
+
}
|
|
1987
|
+
var getOriginalFetch2 = () => globalThis.fetch;
|
|
1988
|
+
var postJsonToApi = async ({
|
|
1989
|
+
url,
|
|
1990
|
+
headers,
|
|
1991
|
+
body,
|
|
1992
|
+
failedResponseHandler,
|
|
1993
|
+
successfulResponseHandler,
|
|
1994
|
+
abortSignal,
|
|
1995
|
+
fetch: fetch2
|
|
1996
|
+
}) => postToApi({
|
|
1997
|
+
url,
|
|
1998
|
+
headers: __spreadValues({
|
|
1999
|
+
"Content-Type": "application/json"
|
|
2000
|
+
}, headers),
|
|
2001
|
+
body: {
|
|
2002
|
+
content: JSON.stringify(body),
|
|
2003
|
+
values: body
|
|
2004
|
+
},
|
|
2005
|
+
failedResponseHandler,
|
|
2006
|
+
successfulResponseHandler,
|
|
2007
|
+
abortSignal,
|
|
2008
|
+
fetch: fetch2
|
|
2009
|
+
});
|
|
2010
|
+
var postToApi = async ({
|
|
2011
|
+
url,
|
|
2012
|
+
headers = {},
|
|
2013
|
+
body,
|
|
2014
|
+
successfulResponseHandler,
|
|
2015
|
+
failedResponseHandler,
|
|
2016
|
+
abortSignal,
|
|
2017
|
+
fetch: fetch2 = getOriginalFetch2()
|
|
2018
|
+
}) => {
|
|
2019
|
+
try {
|
|
2020
|
+
const response = await fetch2(url, {
|
|
2021
|
+
method: "POST",
|
|
2022
|
+
headers: withUserAgentSuffix(
|
|
2023
|
+
headers,
|
|
2024
|
+
`ai-sdk/provider-utils/${VERSION}`,
|
|
2025
|
+
getRuntimeEnvironmentUserAgent()
|
|
2026
|
+
),
|
|
2027
|
+
body: body.content,
|
|
2028
|
+
signal: abortSignal
|
|
2029
|
+
});
|
|
2030
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2031
|
+
if (!response.ok) {
|
|
2032
|
+
let errorInformation;
|
|
2033
|
+
try {
|
|
2034
|
+
errorInformation = await failedResponseHandler({
|
|
2035
|
+
response,
|
|
2036
|
+
url,
|
|
2037
|
+
requestBodyValues: body.values
|
|
2038
|
+
});
|
|
2039
|
+
} catch (error) {
|
|
2040
|
+
if (isAbortError(error) || APICallError.isInstance(error)) {
|
|
2041
|
+
throw error;
|
|
2042
|
+
}
|
|
2043
|
+
throw new APICallError({
|
|
2044
|
+
message: "Failed to process error response",
|
|
2045
|
+
cause: error,
|
|
2046
|
+
statusCode: response.status,
|
|
2047
|
+
url,
|
|
2048
|
+
responseHeaders,
|
|
2049
|
+
requestBodyValues: body.values
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
throw errorInformation.value;
|
|
2053
|
+
}
|
|
2054
|
+
try {
|
|
2055
|
+
return await successfulResponseHandler({
|
|
2056
|
+
response,
|
|
2057
|
+
url,
|
|
2058
|
+
requestBodyValues: body.values
|
|
2059
|
+
});
|
|
2060
|
+
} catch (error) {
|
|
2061
|
+
if (error instanceof Error) {
|
|
2062
|
+
if (isAbortError(error) || APICallError.isInstance(error)) {
|
|
2063
|
+
throw error;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
throw new APICallError({
|
|
2067
|
+
message: "Failed to process successful response",
|
|
2068
|
+
cause: error,
|
|
2069
|
+
statusCode: response.status,
|
|
2070
|
+
url,
|
|
2071
|
+
responseHeaders,
|
|
2072
|
+
requestBodyValues: body.values
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
} catch (error) {
|
|
2076
|
+
throw handleFetchError({ error, url, requestBodyValues: body.values });
|
|
2077
|
+
}
|
|
2078
|
+
};
|
|
2079
|
+
var createJsonErrorResponseHandler = ({
|
|
2080
|
+
errorSchema,
|
|
2081
|
+
errorToMessage,
|
|
2082
|
+
isRetryable
|
|
2083
|
+
}) => async ({ response, url, requestBodyValues }) => {
|
|
2084
|
+
const responseBody = await response.text();
|
|
2085
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2086
|
+
if (responseBody.trim() === "") {
|
|
2087
|
+
return {
|
|
2088
|
+
responseHeaders,
|
|
2089
|
+
value: new APICallError({
|
|
2090
|
+
message: response.statusText,
|
|
2091
|
+
url,
|
|
2092
|
+
requestBodyValues,
|
|
2093
|
+
statusCode: response.status,
|
|
2094
|
+
responseHeaders,
|
|
2095
|
+
responseBody,
|
|
2096
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response)
|
|
2097
|
+
})
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
try {
|
|
2101
|
+
const parsedError = await parseJSON({
|
|
2102
|
+
text: responseBody,
|
|
2103
|
+
schema: errorSchema
|
|
2104
|
+
});
|
|
2105
|
+
return {
|
|
2106
|
+
responseHeaders,
|
|
2107
|
+
value: new APICallError({
|
|
2108
|
+
message: errorToMessage(parsedError),
|
|
2109
|
+
url,
|
|
2110
|
+
requestBodyValues,
|
|
2111
|
+
statusCode: response.status,
|
|
2112
|
+
responseHeaders,
|
|
2113
|
+
responseBody,
|
|
2114
|
+
data: parsedError,
|
|
2115
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
|
|
2116
|
+
})
|
|
2117
|
+
};
|
|
2118
|
+
} catch (parseError) {
|
|
2119
|
+
return {
|
|
2120
|
+
responseHeaders,
|
|
2121
|
+
value: new APICallError({
|
|
2122
|
+
message: response.statusText,
|
|
2123
|
+
url,
|
|
2124
|
+
requestBodyValues,
|
|
2125
|
+
statusCode: response.status,
|
|
2126
|
+
responseHeaders,
|
|
2127
|
+
responseBody,
|
|
2128
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response)
|
|
2129
|
+
})
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
};
|
|
2133
|
+
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
2134
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2135
|
+
if (response.body == null) {
|
|
2136
|
+
throw new EmptyResponseBodyError({});
|
|
2137
|
+
}
|
|
2138
|
+
return {
|
|
2139
|
+
responseHeaders,
|
|
2140
|
+
value: parseJsonEventStream({
|
|
2141
|
+
stream: response.body,
|
|
2142
|
+
schema: chunkSchema
|
|
2143
|
+
})
|
|
2144
|
+
};
|
|
2145
|
+
};
|
|
2146
|
+
var createJsonResponseHandler = (responseSchema) => async ({ response, url, requestBodyValues }) => {
|
|
2147
|
+
const responseBody = await response.text();
|
|
2148
|
+
const parsedResult = await safeParseJSON({
|
|
2149
|
+
text: responseBody,
|
|
2150
|
+
schema: responseSchema
|
|
2151
|
+
});
|
|
2152
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2153
|
+
if (!parsedResult.success) {
|
|
2154
|
+
throw new APICallError({
|
|
2155
|
+
message: "Invalid JSON response",
|
|
2156
|
+
cause: parsedResult.error,
|
|
2157
|
+
statusCode: response.status,
|
|
2158
|
+
responseHeaders,
|
|
2159
|
+
responseBody,
|
|
2160
|
+
url,
|
|
2161
|
+
requestBodyValues
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
return {
|
|
2165
|
+
responseHeaders,
|
|
2166
|
+
value: parsedResult.value,
|
|
2167
|
+
rawValue: parsedResult.rawValue
|
|
2168
|
+
};
|
|
2169
|
+
};
|
|
2170
|
+
function withoutTrailingSlash(url) {
|
|
2171
|
+
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
// src/schemas/reasoning-details.ts
|
|
2175
|
+
import { z } from "zod/v4";
|
|
2176
|
+
|
|
2177
|
+
// src/utils/type-guards.ts
|
|
2178
|
+
function isDefinedOrNotNull(value) {
|
|
2179
|
+
return value !== null && value !== void 0;
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
// src/schemas/format.ts
|
|
2183
|
+
var ReasoningFormat = /* @__PURE__ */ ((ReasoningFormat2) => {
|
|
2184
|
+
ReasoningFormat2["Unknown"] = "unknown";
|
|
2185
|
+
ReasoningFormat2["OpenAIResponsesV1"] = "openai-responses-v1";
|
|
2186
|
+
ReasoningFormat2["XAIResponsesV1"] = "xai-responses-v1";
|
|
2187
|
+
ReasoningFormat2["AnthropicClaudeV1"] = "anthropic-claude-v1";
|
|
2188
|
+
ReasoningFormat2["GoogleGeminiV1"] = "google-gemini-v1";
|
|
2189
|
+
return ReasoningFormat2;
|
|
2190
|
+
})(ReasoningFormat || {});
|
|
2191
|
+
|
|
2192
|
+
// src/schemas/reasoning-details.ts
|
|
2193
|
+
var CommonReasoningDetailSchema = z.object({
|
|
2194
|
+
id: z.string().nullish(),
|
|
2195
|
+
format: z.enum(ReasoningFormat).nullish(),
|
|
2196
|
+
index: z.number().optional()
|
|
2197
|
+
}).loose();
|
|
2198
|
+
var ReasoningDetailSummarySchema = z.object({
|
|
2199
|
+
type: z.literal("reasoning.summary" /* Summary */),
|
|
2200
|
+
summary: z.string()
|
|
2201
|
+
}).extend(CommonReasoningDetailSchema.shape);
|
|
2202
|
+
var ReasoningDetailEncryptedSchema = z.object({
|
|
2203
|
+
type: z.literal("reasoning.encrypted" /* Encrypted */),
|
|
2204
|
+
data: z.string()
|
|
2205
|
+
}).extend(CommonReasoningDetailSchema.shape);
|
|
2206
|
+
var ReasoningDetailTextSchema = z.object({
|
|
2207
|
+
type: z.literal("reasoning.text" /* Text */),
|
|
2208
|
+
text: z.string().nullish(),
|
|
2209
|
+
signature: z.string().nullish()
|
|
2210
|
+
}).extend(CommonReasoningDetailSchema.shape);
|
|
2211
|
+
var ReasoningDetailUnionSchema = z.union([
|
|
2212
|
+
ReasoningDetailSummarySchema,
|
|
2213
|
+
ReasoningDetailEncryptedSchema,
|
|
2214
|
+
ReasoningDetailTextSchema
|
|
2215
|
+
]);
|
|
2216
|
+
var ReasoningDetailsWithUnknownSchema = z.union([
|
|
2217
|
+
ReasoningDetailUnionSchema,
|
|
2218
|
+
z.unknown().transform(() => null)
|
|
2219
|
+
]);
|
|
2220
|
+
var ReasoningDetailArraySchema = z.array(ReasoningDetailsWithUnknownSchema).transform((d) => d.filter((d2) => !!d2));
|
|
2221
|
+
var OutputUnionToReasoningDetailsSchema = z.union([
|
|
2222
|
+
z.object({
|
|
2223
|
+
delta: z.object({
|
|
2224
|
+
reasoning_details: z.array(ReasoningDetailsWithUnknownSchema)
|
|
2225
|
+
})
|
|
2226
|
+
}).transform(
|
|
2227
|
+
(data) => data.delta.reasoning_details.filter(isDefinedOrNotNull)
|
|
2228
|
+
),
|
|
2229
|
+
z.object({
|
|
2230
|
+
message: z.object({
|
|
2231
|
+
reasoning_details: z.array(ReasoningDetailsWithUnknownSchema)
|
|
2232
|
+
})
|
|
2233
|
+
}).transform(
|
|
2234
|
+
(data) => data.message.reasoning_details.filter(isDefinedOrNotNull)
|
|
2235
|
+
),
|
|
2236
|
+
z.object({
|
|
2237
|
+
text: z.string(),
|
|
2238
|
+
reasoning_details: z.array(ReasoningDetailsWithUnknownSchema)
|
|
2239
|
+
}).transform((data) => data.reasoning_details.filter(isDefinedOrNotNull))
|
|
2240
|
+
]);
|
|
2241
|
+
|
|
2242
|
+
// src/schemas/error-response.ts
|
|
2243
|
+
import { z as z2 } from "zod/v4";
|
|
2244
|
+
var OpenRouterErrorResponseSchema = z2.object({
|
|
2245
|
+
error: z2.object({
|
|
2246
|
+
code: z2.union([z2.string(), z2.number()]).nullable().optional().default(null),
|
|
2247
|
+
message: z2.string(),
|
|
2248
|
+
type: z2.string().nullable().optional().default(null),
|
|
2249
|
+
param: z2.any().nullable().optional().default(null)
|
|
2250
|
+
}).passthrough()
|
|
2251
|
+
}).passthrough();
|
|
2252
|
+
function extractErrorMessage(data) {
|
|
2253
|
+
const error = data.error;
|
|
2254
|
+
const metadata = error.metadata;
|
|
2255
|
+
if (!metadata) {
|
|
2256
|
+
return data.error.message;
|
|
2257
|
+
}
|
|
2258
|
+
const parts = [];
|
|
2259
|
+
if (typeof metadata.provider_name === "string" && metadata.provider_name) {
|
|
2260
|
+
parts.push(`[${metadata.provider_name}]`);
|
|
2261
|
+
}
|
|
2262
|
+
const raw = metadata.raw;
|
|
2263
|
+
const rawMessage = extractRawMessage(raw);
|
|
2264
|
+
if (rawMessage && rawMessage !== data.error.message) {
|
|
2265
|
+
parts.push(rawMessage);
|
|
2266
|
+
} else {
|
|
2267
|
+
parts.push(data.error.message);
|
|
2268
|
+
}
|
|
2269
|
+
return parts.join(" ");
|
|
2270
|
+
}
|
|
2271
|
+
function extractRawMessage(raw) {
|
|
2272
|
+
if (typeof raw === "string") {
|
|
2273
|
+
try {
|
|
2274
|
+
const parsed = JSON.parse(raw);
|
|
2275
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
2276
|
+
return extractRawMessage(parsed);
|
|
2277
|
+
}
|
|
2278
|
+
return raw;
|
|
2279
|
+
} catch (e) {
|
|
2280
|
+
return raw;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
if (typeof raw !== "object" || raw === null) {
|
|
2284
|
+
return void 0;
|
|
2285
|
+
}
|
|
2286
|
+
const obj = raw;
|
|
2287
|
+
for (const field of ["message", "error", "detail", "details", "msg"]) {
|
|
2288
|
+
const value = obj[field];
|
|
2289
|
+
if (typeof value === "string" && value.length > 0) {
|
|
2290
|
+
return value;
|
|
2291
|
+
}
|
|
2292
|
+
if (typeof value === "object" && value !== null) {
|
|
2293
|
+
const nested = extractRawMessage(value);
|
|
2294
|
+
if (nested) {
|
|
2295
|
+
return nested;
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
return void 0;
|
|
2300
|
+
}
|
|
2301
|
+
var openrouterFailedResponseHandler = createJsonErrorResponseHandler({
|
|
2302
|
+
errorSchema: OpenRouterErrorResponseSchema,
|
|
2303
|
+
errorToMessage: extractErrorMessage
|
|
2304
|
+
});
|
|
2305
|
+
|
|
2306
|
+
// src/schemas/provider-metadata.ts
|
|
2307
|
+
import { z as z3 } from "zod/v4";
|
|
2308
|
+
var FileAnnotationSchema = z3.object({
|
|
2309
|
+
type: z3.literal("file"),
|
|
2310
|
+
file: z3.object({
|
|
2311
|
+
hash: z3.string(),
|
|
2312
|
+
name: z3.string(),
|
|
2313
|
+
content: z3.array(
|
|
2314
|
+
z3.object({
|
|
2315
|
+
type: z3.string(),
|
|
2316
|
+
text: z3.string().optional()
|
|
2317
|
+
}).catchall(z3.any())
|
|
2318
|
+
).optional()
|
|
2319
|
+
}).catchall(z3.any())
|
|
2320
|
+
}).catchall(z3.any());
|
|
2321
|
+
var OpenRouterProviderMetadataSchema = z3.object({
|
|
2322
|
+
provider: z3.string(),
|
|
2323
|
+
reasoning_details: z3.array(ReasoningDetailUnionSchema).optional(),
|
|
2324
|
+
annotations: z3.array(FileAnnotationSchema).optional(),
|
|
2325
|
+
usage: z3.object({
|
|
2326
|
+
promptTokens: z3.number(),
|
|
2327
|
+
promptTokensDetails: z3.object({
|
|
2328
|
+
cachedTokens: z3.number()
|
|
2329
|
+
}).catchall(z3.any()).optional(),
|
|
2330
|
+
completionTokens: z3.number(),
|
|
2331
|
+
completionTokensDetails: z3.object({
|
|
2332
|
+
reasoningTokens: z3.number()
|
|
2333
|
+
}).catchall(z3.any()).optional(),
|
|
2334
|
+
totalTokens: z3.number(),
|
|
2335
|
+
cost: z3.number().optional(),
|
|
2336
|
+
costDetails: z3.object({
|
|
2337
|
+
upstreamInferenceCost: z3.number()
|
|
2338
|
+
}).catchall(z3.any()).optional()
|
|
2339
|
+
}).catchall(z3.any())
|
|
2340
|
+
}).catchall(z3.any());
|
|
2341
|
+
var OpenRouterProviderOptionsSchema = z3.object({
|
|
2342
|
+
openrouter: z3.object({
|
|
2343
|
+
reasoning_details: z3.array(ReasoningDetailUnionSchema).optional(),
|
|
2344
|
+
annotations: z3.array(FileAnnotationSchema).optional()
|
|
2345
|
+
}).optional()
|
|
2346
|
+
}).optional();
|
|
2347
|
+
|
|
2348
|
+
// src/utils/compute-token-usage.ts
|
|
2349
|
+
function computeTokenUsage(usage) {
|
|
2350
|
+
var _a16, _b16, _c, _d, _e, _f, _g, _h;
|
|
2351
|
+
const promptTokens = (_a16 = usage.prompt_tokens) != null ? _a16 : 0;
|
|
2352
|
+
const completionTokens = (_b16 = usage.completion_tokens) != null ? _b16 : 0;
|
|
2353
|
+
const cacheReadTokens = (_d = (_c = usage.prompt_tokens_details) == null ? void 0 : _c.cached_tokens) != null ? _d : 0;
|
|
2354
|
+
const cacheWriteTokens = (_f = (_e = usage.prompt_tokens_details) == null ? void 0 : _e.cache_write_tokens) != null ? _f : void 0;
|
|
2355
|
+
const reasoningTokens = (_h = (_g = usage.completion_tokens_details) == null ? void 0 : _g.reasoning_tokens) != null ? _h : 0;
|
|
2356
|
+
return {
|
|
2357
|
+
inputTokens: {
|
|
2358
|
+
total: promptTokens,
|
|
2359
|
+
noCache: promptTokens - cacheReadTokens,
|
|
2360
|
+
cacheRead: cacheReadTokens,
|
|
2361
|
+
cacheWrite: cacheWriteTokens
|
|
2362
|
+
},
|
|
2363
|
+
outputTokens: {
|
|
2364
|
+
total: completionTokens,
|
|
2365
|
+
text: completionTokens - reasoningTokens,
|
|
2366
|
+
reasoning: reasoningTokens
|
|
2367
|
+
},
|
|
2368
|
+
raw: usage
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
function emptyUsage() {
|
|
2372
|
+
return {
|
|
2373
|
+
inputTokens: {
|
|
2374
|
+
total: 0,
|
|
2375
|
+
noCache: void 0,
|
|
2376
|
+
cacheRead: void 0,
|
|
2377
|
+
cacheWrite: void 0
|
|
2378
|
+
},
|
|
2379
|
+
outputTokens: {
|
|
2380
|
+
total: 0,
|
|
2381
|
+
text: void 0,
|
|
2382
|
+
reasoning: void 0
|
|
2383
|
+
},
|
|
2384
|
+
raw: void 0
|
|
2385
|
+
};
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
// src/utils/map-finish-reason.ts
|
|
2389
|
+
function mapToUnified(finishReason) {
|
|
2390
|
+
switch (finishReason) {
|
|
2391
|
+
case "stop":
|
|
2392
|
+
return "stop";
|
|
2393
|
+
case "length":
|
|
2394
|
+
return "length";
|
|
2395
|
+
case "content_filter":
|
|
2396
|
+
return "content-filter";
|
|
2397
|
+
case "function_call":
|
|
2398
|
+
case "tool_calls":
|
|
2399
|
+
return "tool-calls";
|
|
2400
|
+
default:
|
|
2401
|
+
return "other";
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
function mapOpenRouterFinishReason(finishReason) {
|
|
2405
|
+
return {
|
|
2406
|
+
unified: mapToUnified(finishReason),
|
|
2407
|
+
raw: finishReason != null ? finishReason : void 0
|
|
2408
|
+
};
|
|
2409
|
+
}
|
|
2410
|
+
function createFinishReason(unified, raw) {
|
|
2411
|
+
return { unified, raw };
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
// src/utils/reasoning-details-duplicate-tracker.ts
|
|
2415
|
+
var _seenKeys;
|
|
2416
|
+
var ReasoningDetailsDuplicateTracker = class {
|
|
2417
|
+
constructor() {
|
|
2418
|
+
__privateAdd(this, _seenKeys, /* @__PURE__ */ new Set());
|
|
2419
|
+
}
|
|
2420
|
+
/**
|
|
2421
|
+
* Attempts to track a detail.
|
|
2422
|
+
* Returns true if this is a NEW detail (not seen before and has valid key),
|
|
2423
|
+
* false if it was skipped (no valid key) or already seen (duplicate).
|
|
2424
|
+
*/
|
|
2425
|
+
upsert(detail) {
|
|
2426
|
+
const key = this.getCanonicalKey(detail);
|
|
2427
|
+
if (key === null) {
|
|
2428
|
+
return false;
|
|
2429
|
+
}
|
|
2430
|
+
if (__privateGet(this, _seenKeys).has(key)) {
|
|
2431
|
+
return false;
|
|
2432
|
+
}
|
|
2433
|
+
__privateGet(this, _seenKeys).add(key);
|
|
2434
|
+
return true;
|
|
2435
|
+
}
|
|
2436
|
+
getCanonicalKey(detail) {
|
|
2437
|
+
switch (detail.type) {
|
|
2438
|
+
case "reasoning.summary" /* Summary */:
|
|
2439
|
+
return detail.summary;
|
|
2440
|
+
case "reasoning.encrypted" /* Encrypted */:
|
|
2441
|
+
if (detail.id) {
|
|
2442
|
+
return detail.id;
|
|
2443
|
+
}
|
|
2444
|
+
return detail.data;
|
|
2445
|
+
case "reasoning.text" /* Text */: {
|
|
2446
|
+
if (detail.text) {
|
|
2447
|
+
return detail.text;
|
|
2448
|
+
}
|
|
2449
|
+
if (detail.signature) {
|
|
2450
|
+
return detail.signature;
|
|
2451
|
+
}
|
|
2452
|
+
return null;
|
|
2453
|
+
}
|
|
2454
|
+
default: {
|
|
2455
|
+
return null;
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
};
|
|
2460
|
+
_seenKeys = new WeakMap();
|
|
2461
|
+
|
|
2462
|
+
// src/types/openrouter-chat-completions-input.ts
|
|
2463
|
+
var OPENROUTER_AUDIO_FORMATS = [
|
|
2464
|
+
"wav",
|
|
2465
|
+
"mp3",
|
|
2466
|
+
"aiff",
|
|
2467
|
+
"aac",
|
|
2468
|
+
"ogg",
|
|
2469
|
+
"flac",
|
|
2470
|
+
"m4a",
|
|
2471
|
+
"pcm16",
|
|
2472
|
+
"pcm24"
|
|
2473
|
+
];
|
|
2474
|
+
|
|
2475
|
+
// src/chat/is-url.ts
|
|
2476
|
+
function isUrl({
|
|
2477
|
+
url,
|
|
2478
|
+
protocols
|
|
2479
|
+
}) {
|
|
2480
|
+
try {
|
|
2481
|
+
const urlObj = new URL(url);
|
|
2482
|
+
return protocols.has(urlObj.protocol);
|
|
2483
|
+
} catch (_) {
|
|
2484
|
+
return false;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
// src/chat/file-url-utils.ts
|
|
2489
|
+
function buildFileDataUrl({
|
|
2490
|
+
data,
|
|
2491
|
+
mediaType,
|
|
2492
|
+
defaultMediaType
|
|
2493
|
+
}) {
|
|
2494
|
+
if (data instanceof Uint8Array) {
|
|
2495
|
+
const base64 = convertUint8ArrayToBase64(data);
|
|
2496
|
+
return `data:${mediaType != null ? mediaType : defaultMediaType};base64,${base64}`;
|
|
2497
|
+
}
|
|
2498
|
+
const stringData = data.toString();
|
|
2499
|
+
if (isUrl({
|
|
2500
|
+
url: stringData,
|
|
2501
|
+
protocols: /* @__PURE__ */ new Set(["http:", "https:"])
|
|
2502
|
+
})) {
|
|
2503
|
+
return stringData;
|
|
2504
|
+
}
|
|
2505
|
+
return stringData.startsWith("data:") ? stringData : `data:${mediaType != null ? mediaType : defaultMediaType};base64,${stringData}`;
|
|
2506
|
+
}
|
|
2507
|
+
function getFileUrl({
|
|
2508
|
+
part,
|
|
2509
|
+
defaultMediaType
|
|
2510
|
+
}) {
|
|
2511
|
+
const data = part.data instanceof URL ? part.data.toString() : part.data;
|
|
2512
|
+
return buildFileDataUrl({
|
|
2513
|
+
data,
|
|
2514
|
+
mediaType: part.mediaType,
|
|
2515
|
+
defaultMediaType
|
|
2516
|
+
});
|
|
2517
|
+
}
|
|
2518
|
+
function getMediaType(dataUrl, defaultMediaType) {
|
|
2519
|
+
var _a16;
|
|
2520
|
+
const match = dataUrl.match(/^data:([^;]+)/);
|
|
2521
|
+
return match ? (_a16 = match[1]) != null ? _a16 : defaultMediaType : defaultMediaType;
|
|
2522
|
+
}
|
|
2523
|
+
function getBase64FromDataUrl(dataUrl) {
|
|
2524
|
+
const match = dataUrl.match(/^data:[^;]*;base64,(.+)$/);
|
|
2525
|
+
return match ? match[1] : dataUrl;
|
|
2526
|
+
}
|
|
2527
|
+
var MIME_TO_FORMAT = {
|
|
2528
|
+
// MP3 variants
|
|
2529
|
+
mpeg: "mp3",
|
|
2530
|
+
mp3: "mp3",
|
|
2531
|
+
// WAV variants
|
|
2532
|
+
"x-wav": "wav",
|
|
2533
|
+
wave: "wav",
|
|
2534
|
+
wav: "wav",
|
|
2535
|
+
// OGG variants
|
|
2536
|
+
ogg: "ogg",
|
|
2537
|
+
vorbis: "ogg",
|
|
2538
|
+
// AAC variants
|
|
2539
|
+
aac: "aac",
|
|
2540
|
+
"x-aac": "aac",
|
|
2541
|
+
// M4A variants
|
|
2542
|
+
m4a: "m4a",
|
|
2543
|
+
"x-m4a": "m4a",
|
|
2544
|
+
mp4: "m4a",
|
|
2545
|
+
// AIFF variants
|
|
2546
|
+
aiff: "aiff",
|
|
2547
|
+
"x-aiff": "aiff",
|
|
2548
|
+
// FLAC
|
|
2549
|
+
flac: "flac",
|
|
2550
|
+
"x-flac": "flac",
|
|
2551
|
+
// PCM variants
|
|
2552
|
+
pcm16: "pcm16",
|
|
2553
|
+
pcm24: "pcm24"
|
|
2554
|
+
};
|
|
2555
|
+
function getInputAudioData(part) {
|
|
2556
|
+
const fileData = getFileUrl({
|
|
2557
|
+
part,
|
|
2558
|
+
defaultMediaType: "audio/mpeg"
|
|
2559
|
+
});
|
|
2560
|
+
if (isUrl({
|
|
2561
|
+
url: fileData,
|
|
2562
|
+
protocols: /* @__PURE__ */ new Set(["http:", "https:"])
|
|
2563
|
+
})) {
|
|
2564
|
+
throw new Error(
|
|
2565
|
+
`Audio files cannot be provided as URLs.
|
|
2566
|
+
|
|
2567
|
+
OpenRouter requires audio to be base64-encoded. Please:
|
|
2568
|
+
1. Download the audio file locally
|
|
2569
|
+
2. Read it as a Buffer or Uint8Array
|
|
2570
|
+
3. Pass it as the data parameter
|
|
2571
|
+
|
|
2572
|
+
The AI SDK will automatically handle base64 encoding.
|
|
2573
|
+
|
|
2574
|
+
Learn more: https://openrouter.ai/docs/features/multimodal/audio`
|
|
2575
|
+
);
|
|
2576
|
+
}
|
|
2577
|
+
const data = getBase64FromDataUrl(fileData);
|
|
2578
|
+
const mediaType = part.mediaType || "audio/mpeg";
|
|
2579
|
+
const rawFormat = mediaType.replace("audio/", "");
|
|
2580
|
+
const format = MIME_TO_FORMAT[rawFormat];
|
|
2581
|
+
if (format === void 0) {
|
|
2582
|
+
const supportedList = OPENROUTER_AUDIO_FORMATS.join(", ");
|
|
2583
|
+
throw new Error(
|
|
2584
|
+
`Unsupported audio format: "${mediaType}"
|
|
2585
|
+
|
|
2586
|
+
OpenRouter supports the following audio formats: ${supportedList}
|
|
2587
|
+
|
|
2588
|
+
Learn more: https://openrouter.ai/docs/features/multimodal/audio`
|
|
2589
|
+
);
|
|
2590
|
+
}
|
|
2591
|
+
return { data, format };
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
// src/chat/convert-to-openrouter-chat-messages.ts
|
|
2595
|
+
function getCacheControl(providerMetadata) {
|
|
2596
|
+
var _a16, _b16, _c;
|
|
2597
|
+
const anthropic = providerMetadata == null ? void 0 : providerMetadata.anthropic;
|
|
2598
|
+
const openrouter2 = providerMetadata == null ? void 0 : providerMetadata.openrouter;
|
|
2599
|
+
return (_c = (_b16 = (_a16 = openrouter2 == null ? void 0 : openrouter2.cacheControl) != null ? _a16 : openrouter2 == null ? void 0 : openrouter2.cache_control) != null ? _b16 : anthropic == null ? void 0 : anthropic.cacheControl) != null ? _c : anthropic == null ? void 0 : anthropic.cache_control;
|
|
2600
|
+
}
|
|
2601
|
+
function convertToOpenRouterChatMessages(prompt) {
|
|
2602
|
+
var _a16, _b16, _c, _d, _e, _f, _g, _h;
|
|
2603
|
+
const messages = [];
|
|
2604
|
+
const reasoningDetailsTracker = new ReasoningDetailsDuplicateTracker();
|
|
2605
|
+
for (const { role, content, providerOptions } of prompt) {
|
|
2606
|
+
switch (role) {
|
|
2607
|
+
case "system": {
|
|
2608
|
+
const cacheControl = getCacheControl(providerOptions);
|
|
2609
|
+
messages.push({
|
|
2610
|
+
role: "system",
|
|
2611
|
+
content: [
|
|
2612
|
+
__spreadValues({
|
|
2613
|
+
type: "text",
|
|
2614
|
+
text: content
|
|
2615
|
+
}, cacheControl && { cache_control: cacheControl })
|
|
2616
|
+
]
|
|
2617
|
+
});
|
|
2618
|
+
break;
|
|
2619
|
+
}
|
|
2620
|
+
case "user": {
|
|
2621
|
+
if (content.length === 1 && ((_a16 = content[0]) == null ? void 0 : _a16.type) === "text") {
|
|
2622
|
+
const cacheControl = (_b16 = getCacheControl(providerOptions)) != null ? _b16 : getCacheControl(content[0].providerOptions);
|
|
2623
|
+
const contentWithCacheControl = cacheControl ? [
|
|
2624
|
+
{
|
|
2625
|
+
type: "text",
|
|
2626
|
+
text: content[0].text,
|
|
2627
|
+
cache_control: cacheControl
|
|
2628
|
+
}
|
|
2629
|
+
] : content[0].text;
|
|
2630
|
+
messages.push({
|
|
2631
|
+
role: "user",
|
|
2632
|
+
content: contentWithCacheControl
|
|
2633
|
+
});
|
|
2634
|
+
break;
|
|
2635
|
+
}
|
|
2636
|
+
const messageCacheControl = getCacheControl(providerOptions);
|
|
2637
|
+
let lastTextPartIndex = -1;
|
|
2638
|
+
for (let i = content.length - 1; i >= 0; i--) {
|
|
2639
|
+
if (((_c = content[i]) == null ? void 0 : _c.type) === "text") {
|
|
2640
|
+
lastTextPartIndex = i;
|
|
2641
|
+
break;
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
const contentParts = content.map(
|
|
2645
|
+
(part, index) => {
|
|
2646
|
+
var _a17, _b17, _c2, _d2, _e2, _f2;
|
|
2647
|
+
const isLastTextPart = part.type === "text" && index === lastTextPartIndex;
|
|
2648
|
+
const partCacheControl = getCacheControl(part.providerOptions);
|
|
2649
|
+
const cacheControl = part.type === "text" ? partCacheControl != null ? partCacheControl : isLastTextPart ? messageCacheControl : void 0 : partCacheControl;
|
|
2650
|
+
switch (part.type) {
|
|
2651
|
+
case "text":
|
|
2652
|
+
return __spreadValues({
|
|
2653
|
+
type: "text",
|
|
2654
|
+
text: part.text
|
|
2655
|
+
}, cacheControl && { cache_control: cacheControl });
|
|
2656
|
+
case "file": {
|
|
2657
|
+
if ((_a17 = part.mediaType) == null ? void 0 : _a17.startsWith("image/")) {
|
|
2658
|
+
const url = getFileUrl({
|
|
2659
|
+
part,
|
|
2660
|
+
defaultMediaType: "image/jpeg"
|
|
2661
|
+
});
|
|
2662
|
+
return __spreadValues({
|
|
2663
|
+
type: "image_url",
|
|
2664
|
+
image_url: {
|
|
2665
|
+
url
|
|
2666
|
+
}
|
|
2667
|
+
}, cacheControl && { cache_control: cacheControl });
|
|
2668
|
+
}
|
|
2669
|
+
if ((_b17 = part.mediaType) == null ? void 0 : _b17.startsWith("audio/")) {
|
|
2670
|
+
return __spreadValues({
|
|
2671
|
+
type: "input_audio",
|
|
2672
|
+
input_audio: getInputAudioData(part)
|
|
2673
|
+
}, cacheControl && { cache_control: cacheControl });
|
|
2674
|
+
}
|
|
2675
|
+
const fileName = String(
|
|
2676
|
+
(_f2 = (_e2 = (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2.openrouter) == null ? void 0 : _d2.filename) != null ? _e2 : part.filename) != null ? _f2 : ""
|
|
2677
|
+
);
|
|
2678
|
+
const fileData = getFileUrl({
|
|
2679
|
+
part,
|
|
2680
|
+
defaultMediaType: "application/pdf"
|
|
2681
|
+
});
|
|
2682
|
+
if (isUrl({
|
|
2683
|
+
url: fileData,
|
|
2684
|
+
protocols: /* @__PURE__ */ new Set(["http:", "https:"])
|
|
2685
|
+
})) {
|
|
2686
|
+
return {
|
|
2687
|
+
type: "file",
|
|
2688
|
+
file: {
|
|
2689
|
+
filename: fileName,
|
|
2690
|
+
file_data: fileData
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
2693
|
+
}
|
|
2694
|
+
return __spreadValues({
|
|
2695
|
+
type: "file",
|
|
2696
|
+
file: {
|
|
2697
|
+
filename: fileName,
|
|
2698
|
+
file_data: fileData
|
|
2699
|
+
}
|
|
2700
|
+
}, cacheControl && { cache_control: cacheControl });
|
|
2701
|
+
}
|
|
2702
|
+
default: {
|
|
2703
|
+
return __spreadValues({
|
|
2704
|
+
type: "text",
|
|
2705
|
+
text: ""
|
|
2706
|
+
}, cacheControl && { cache_control: cacheControl });
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
);
|
|
2711
|
+
messages.push({
|
|
2712
|
+
role: "user",
|
|
2713
|
+
content: contentParts
|
|
2714
|
+
});
|
|
2715
|
+
break;
|
|
2716
|
+
}
|
|
2717
|
+
case "assistant": {
|
|
2718
|
+
let text = "";
|
|
2719
|
+
let reasoning = "";
|
|
2720
|
+
const toolCalls = [];
|
|
2721
|
+
for (const part of content) {
|
|
2722
|
+
switch (part.type) {
|
|
2723
|
+
case "text": {
|
|
2724
|
+
text += part.text;
|
|
2725
|
+
break;
|
|
2726
|
+
}
|
|
2727
|
+
case "tool-call": {
|
|
2728
|
+
toolCalls.push({
|
|
2729
|
+
id: part.toolCallId,
|
|
2730
|
+
type: "function",
|
|
2731
|
+
function: {
|
|
2732
|
+
name: part.toolName,
|
|
2733
|
+
arguments: JSON.stringify(part.input)
|
|
2734
|
+
}
|
|
2735
|
+
});
|
|
2736
|
+
break;
|
|
2737
|
+
}
|
|
2738
|
+
case "reasoning": {
|
|
2739
|
+
reasoning += part.text;
|
|
2740
|
+
break;
|
|
2741
|
+
}
|
|
2742
|
+
case "file":
|
|
2743
|
+
break;
|
|
2744
|
+
default: {
|
|
2745
|
+
break;
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
const parsedProviderOptions = OpenRouterProviderOptionsSchema.safeParse(providerOptions);
|
|
2750
|
+
const messageReasoningDetails = parsedProviderOptions.success ? (_e = (_d = parsedProviderOptions.data) == null ? void 0 : _d.openrouter) == null ? void 0 : _e.reasoning_details : void 0;
|
|
2751
|
+
const messageAnnotations = parsedProviderOptions.success ? (_g = (_f = parsedProviderOptions.data) == null ? void 0 : _f.openrouter) == null ? void 0 : _g.annotations : void 0;
|
|
2752
|
+
const candidateReasoningDetails = messageReasoningDetails && Array.isArray(messageReasoningDetails) && messageReasoningDetails.length > 0 ? messageReasoningDetails : findFirstReasoningDetails(content);
|
|
2753
|
+
let finalReasoningDetails;
|
|
2754
|
+
if (candidateReasoningDetails && candidateReasoningDetails.length > 0) {
|
|
2755
|
+
const uniqueDetails = [];
|
|
2756
|
+
for (const detail of candidateReasoningDetails) {
|
|
2757
|
+
if (reasoningDetailsTracker.upsert(detail)) {
|
|
2758
|
+
uniqueDetails.push(detail);
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
finalReasoningDetails = uniqueDetails.length > 0 ? uniqueDetails : void 0;
|
|
2762
|
+
}
|
|
2763
|
+
messages.push({
|
|
2764
|
+
role: "assistant",
|
|
2765
|
+
content: text,
|
|
2766
|
+
tool_calls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
2767
|
+
reasoning: reasoning || void 0,
|
|
2768
|
+
reasoning_details: finalReasoningDetails,
|
|
2769
|
+
annotations: messageAnnotations,
|
|
2770
|
+
cache_control: getCacheControl(providerOptions)
|
|
2771
|
+
});
|
|
2772
|
+
break;
|
|
2773
|
+
}
|
|
2774
|
+
case "tool": {
|
|
2775
|
+
for (const toolResponse of content) {
|
|
2776
|
+
if (toolResponse.type === "tool-approval-response") {
|
|
2777
|
+
continue;
|
|
2778
|
+
}
|
|
2779
|
+
const content2 = getToolResultContent(toolResponse);
|
|
2780
|
+
messages.push({
|
|
2781
|
+
role: "tool",
|
|
2782
|
+
tool_call_id: toolResponse.toolCallId,
|
|
2783
|
+
content: content2,
|
|
2784
|
+
cache_control: (_h = getCacheControl(providerOptions)) != null ? _h : getCacheControl(toolResponse.providerOptions)
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
break;
|
|
2788
|
+
}
|
|
2789
|
+
default: {
|
|
2790
|
+
break;
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
return messages;
|
|
2795
|
+
}
|
|
2796
|
+
function getToolResultContent(input) {
|
|
2797
|
+
var _a16;
|
|
2798
|
+
switch (input.output.type) {
|
|
2799
|
+
case "text":
|
|
2800
|
+
case "error-text":
|
|
2801
|
+
return input.output.value;
|
|
2802
|
+
case "json":
|
|
2803
|
+
case "error-json":
|
|
2804
|
+
case "content":
|
|
2805
|
+
return JSON.stringify(input.output.value);
|
|
2806
|
+
case "execution-denied":
|
|
2807
|
+
return (_a16 = input.output.reason) != null ? _a16 : "Tool execution denied";
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
function findFirstReasoningDetails(content) {
|
|
2811
|
+
var _a16, _b16, _c;
|
|
2812
|
+
for (const part of content) {
|
|
2813
|
+
if (part.type === "tool-call") {
|
|
2814
|
+
const openrouter2 = (_a16 = part.providerOptions) == null ? void 0 : _a16.openrouter;
|
|
2815
|
+
const details = openrouter2 == null ? void 0 : openrouter2.reasoning_details;
|
|
2816
|
+
if (Array.isArray(details) && details.length > 0) {
|
|
2817
|
+
return details;
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
for (const part of content) {
|
|
2822
|
+
if (part.type === "reasoning") {
|
|
2823
|
+
const parsed = OpenRouterProviderOptionsSchema.safeParse(
|
|
2824
|
+
part.providerOptions
|
|
2825
|
+
);
|
|
2826
|
+
if (parsed.success && ((_c = (_b16 = parsed.data) == null ? void 0 : _b16.openrouter) == null ? void 0 : _c.reasoning_details) && parsed.data.openrouter.reasoning_details.length > 0) {
|
|
2827
|
+
return parsed.data.openrouter.reasoning_details;
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
return void 0;
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
// src/chat/get-tool-choice.ts
|
|
2835
|
+
import { z as z5 } from "zod/v4";
|
|
2836
|
+
var ChatCompletionToolChoiceSchema = z5.union([
|
|
2837
|
+
z5.literal("auto"),
|
|
2838
|
+
z5.literal("none"),
|
|
2839
|
+
z5.literal("required"),
|
|
2840
|
+
z5.object({
|
|
2841
|
+
type: z5.literal("function"),
|
|
2842
|
+
function: z5.object({
|
|
2843
|
+
name: z5.string()
|
|
2844
|
+
})
|
|
2845
|
+
})
|
|
2846
|
+
]);
|
|
2847
|
+
function getChatCompletionToolChoice(toolChoice) {
|
|
2848
|
+
switch (toolChoice.type) {
|
|
2849
|
+
case "auto":
|
|
2850
|
+
case "none":
|
|
2851
|
+
case "required":
|
|
2852
|
+
return toolChoice.type;
|
|
2853
|
+
case "tool": {
|
|
2854
|
+
return {
|
|
2855
|
+
type: "function",
|
|
2856
|
+
function: { name: toolChoice.toolName }
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
default: {
|
|
2860
|
+
toolChoice;
|
|
2861
|
+
throw new InvalidArgumentError({
|
|
2862
|
+
argument: "toolChoice",
|
|
2863
|
+
message: `Invalid tool choice type: ${JSON.stringify(toolChoice)}`
|
|
2864
|
+
});
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
// src/chat/schemas.ts
|
|
2870
|
+
import { z as z7 } from "zod/v4";
|
|
2871
|
+
|
|
2872
|
+
// src/schemas/image.ts
|
|
2873
|
+
import { z as z6 } from "zod/v4";
|
|
2874
|
+
var ImageResponseSchema = z6.object({
|
|
2875
|
+
type: z6.literal("image_url"),
|
|
2876
|
+
image_url: z6.object({
|
|
2877
|
+
url: z6.string()
|
|
2878
|
+
}).passthrough()
|
|
2879
|
+
}).passthrough();
|
|
2880
|
+
var ImageResponseWithUnknownSchema = z6.union([
|
|
2881
|
+
ImageResponseSchema,
|
|
2882
|
+
z6.unknown().transform(() => null)
|
|
2883
|
+
]);
|
|
2884
|
+
var ImageResponseArraySchema = z6.array(ImageResponseWithUnknownSchema).transform((d) => d.filter((d2) => !!d2));
|
|
2885
|
+
|
|
2886
|
+
// src/chat/schemas.ts
|
|
2887
|
+
var OpenRouterChatCompletionBaseResponseSchema = z7.object({
|
|
2888
|
+
id: z7.string().optional(),
|
|
2889
|
+
model: z7.string().optional(),
|
|
2890
|
+
provider: z7.string().optional(),
|
|
2891
|
+
usage: z7.object({
|
|
2892
|
+
prompt_tokens: z7.number(),
|
|
2893
|
+
prompt_tokens_details: z7.object({
|
|
2894
|
+
cached_tokens: z7.number(),
|
|
2895
|
+
cache_write_tokens: z7.number().nullish()
|
|
2896
|
+
}).passthrough().nullish(),
|
|
2897
|
+
completion_tokens: z7.number(),
|
|
2898
|
+
completion_tokens_details: z7.object({
|
|
2899
|
+
reasoning_tokens: z7.number()
|
|
2900
|
+
}).passthrough().nullish(),
|
|
2901
|
+
total_tokens: z7.number(),
|
|
2902
|
+
cost: z7.number().optional(),
|
|
2903
|
+
cost_details: z7.object({
|
|
2904
|
+
upstream_inference_cost: z7.number().nullish()
|
|
2905
|
+
}).passthrough().nullish()
|
|
2906
|
+
}).passthrough().nullish()
|
|
2907
|
+
}).passthrough();
|
|
2908
|
+
var OpenRouterNonStreamChatCompletionResponseSchema = z7.union([
|
|
2909
|
+
// Success response with choices
|
|
2910
|
+
OpenRouterChatCompletionBaseResponseSchema.extend({
|
|
2911
|
+
choices: z7.array(
|
|
2912
|
+
z7.object({
|
|
2913
|
+
message: z7.object({
|
|
2914
|
+
role: z7.literal("assistant"),
|
|
2915
|
+
content: z7.string().nullable().optional(),
|
|
2916
|
+
reasoning: z7.string().nullable().optional(),
|
|
2917
|
+
reasoning_details: ReasoningDetailArraySchema.nullish(),
|
|
2918
|
+
images: ImageResponseArraySchema.nullish(),
|
|
2919
|
+
tool_calls: z7.array(
|
|
2920
|
+
z7.object({
|
|
2921
|
+
id: z7.string().optional().nullable(),
|
|
2922
|
+
type: z7.literal("function"),
|
|
2923
|
+
function: z7.object({
|
|
2924
|
+
name: z7.string(),
|
|
2925
|
+
arguments: z7.string().optional()
|
|
2926
|
+
}).passthrough()
|
|
2927
|
+
}).passthrough()
|
|
2928
|
+
).optional(),
|
|
2929
|
+
annotations: z7.array(
|
|
2930
|
+
z7.union([
|
|
2931
|
+
// URL citation from web search
|
|
2932
|
+
// title, start_index, end_index are optional as some upstream providers may omit them
|
|
2933
|
+
z7.object({
|
|
2934
|
+
type: z7.literal("url_citation"),
|
|
2935
|
+
url_citation: z7.object({
|
|
2936
|
+
url: z7.string(),
|
|
2937
|
+
title: z7.string().optional(),
|
|
2938
|
+
start_index: z7.number().optional(),
|
|
2939
|
+
end_index: z7.number().optional(),
|
|
2940
|
+
content: z7.string().optional()
|
|
2941
|
+
}).passthrough()
|
|
2942
|
+
}).passthrough(),
|
|
2943
|
+
// File annotation from FileParserPlugin (old format)
|
|
2944
|
+
z7.object({
|
|
2945
|
+
type: z7.literal("file_annotation"),
|
|
2946
|
+
file_annotation: z7.object({
|
|
2947
|
+
file_id: z7.string(),
|
|
2948
|
+
quote: z7.string().optional()
|
|
2949
|
+
}).passthrough()
|
|
2950
|
+
}).passthrough(),
|
|
2951
|
+
// File annotation from FileParserPlugin (new format)
|
|
2952
|
+
z7.object({
|
|
2953
|
+
type: z7.literal("file"),
|
|
2954
|
+
file: z7.object({
|
|
2955
|
+
hash: z7.string(),
|
|
2956
|
+
name: z7.string(),
|
|
2957
|
+
content: z7.array(
|
|
2958
|
+
z7.object({
|
|
2959
|
+
type: z7.string(),
|
|
2960
|
+
text: z7.string().optional()
|
|
2961
|
+
}).passthrough()
|
|
2962
|
+
).optional()
|
|
2963
|
+
}).passthrough()
|
|
2964
|
+
}).passthrough()
|
|
2965
|
+
])
|
|
2966
|
+
).nullish()
|
|
2967
|
+
}).passthrough(),
|
|
2968
|
+
index: z7.number().nullish(),
|
|
2969
|
+
logprobs: z7.object({
|
|
2970
|
+
content: z7.array(
|
|
2971
|
+
z7.object({
|
|
2972
|
+
token: z7.string(),
|
|
2973
|
+
logprob: z7.number(),
|
|
2974
|
+
top_logprobs: z7.array(
|
|
2975
|
+
z7.object({
|
|
2976
|
+
token: z7.string(),
|
|
2977
|
+
logprob: z7.number()
|
|
2978
|
+
}).passthrough()
|
|
2979
|
+
)
|
|
2980
|
+
}).passthrough()
|
|
2981
|
+
).nullable()
|
|
2982
|
+
}).passthrough().nullable().optional(),
|
|
2983
|
+
finish_reason: z7.string().optional().nullable()
|
|
2984
|
+
}).passthrough()
|
|
2985
|
+
)
|
|
2986
|
+
}),
|
|
2987
|
+
// Error response (HTTP 200 with error payload)
|
|
2988
|
+
OpenRouterErrorResponseSchema.extend({
|
|
2989
|
+
user_id: z7.string().optional()
|
|
2990
|
+
})
|
|
2991
|
+
]);
|
|
2992
|
+
var OpenRouterStreamChatCompletionChunkSchema = z7.union([
|
|
2993
|
+
OpenRouterChatCompletionBaseResponseSchema.extend({
|
|
2994
|
+
choices: z7.array(
|
|
2995
|
+
z7.object({
|
|
2996
|
+
delta: z7.object({
|
|
2997
|
+
role: z7.enum(["assistant"]).optional(),
|
|
2998
|
+
content: z7.string().nullish(),
|
|
2999
|
+
reasoning: z7.string().nullish().optional(),
|
|
3000
|
+
reasoning_details: ReasoningDetailArraySchema.nullish(),
|
|
3001
|
+
images: ImageResponseArraySchema.nullish(),
|
|
3002
|
+
tool_calls: z7.array(
|
|
3003
|
+
z7.object({
|
|
3004
|
+
index: z7.number().nullish(),
|
|
3005
|
+
id: z7.string().nullish(),
|
|
3006
|
+
type: z7.literal("function").optional(),
|
|
3007
|
+
function: z7.object({
|
|
3008
|
+
name: z7.string().nullish(),
|
|
3009
|
+
arguments: z7.string().nullish()
|
|
3010
|
+
}).passthrough()
|
|
3011
|
+
}).passthrough()
|
|
3012
|
+
).nullish(),
|
|
3013
|
+
annotations: z7.array(
|
|
3014
|
+
z7.union([
|
|
3015
|
+
// URL citation from web search
|
|
3016
|
+
// title, start_index, end_index are optional as some upstream providers may omit them
|
|
3017
|
+
z7.object({
|
|
3018
|
+
type: z7.literal("url_citation"),
|
|
3019
|
+
url_citation: z7.object({
|
|
3020
|
+
url: z7.string(),
|
|
3021
|
+
title: z7.string().optional(),
|
|
3022
|
+
start_index: z7.number().optional(),
|
|
3023
|
+
end_index: z7.number().optional(),
|
|
3024
|
+
content: z7.string().optional()
|
|
3025
|
+
}).passthrough()
|
|
3026
|
+
}).passthrough(),
|
|
3027
|
+
// File annotation from FileParserPlugin (old format)
|
|
3028
|
+
z7.object({
|
|
3029
|
+
type: z7.literal("file_annotation"),
|
|
3030
|
+
file_annotation: z7.object({
|
|
3031
|
+
file_id: z7.string(),
|
|
3032
|
+
quote: z7.string().optional()
|
|
3033
|
+
}).passthrough()
|
|
3034
|
+
}).passthrough(),
|
|
3035
|
+
// File annotation from FileParserPlugin (new format)
|
|
3036
|
+
z7.object({
|
|
3037
|
+
type: z7.literal("file"),
|
|
3038
|
+
file: z7.object({
|
|
3039
|
+
hash: z7.string(),
|
|
3040
|
+
name: z7.string(),
|
|
3041
|
+
content: z7.array(
|
|
3042
|
+
z7.object({
|
|
3043
|
+
type: z7.string(),
|
|
3044
|
+
text: z7.string().optional()
|
|
3045
|
+
}).passthrough()
|
|
3046
|
+
).optional()
|
|
3047
|
+
}).passthrough()
|
|
3048
|
+
}).passthrough()
|
|
3049
|
+
])
|
|
3050
|
+
).nullish()
|
|
3051
|
+
}).passthrough().nullish(),
|
|
3052
|
+
logprobs: z7.object({
|
|
3053
|
+
content: z7.array(
|
|
3054
|
+
z7.object({
|
|
3055
|
+
token: z7.string(),
|
|
3056
|
+
logprob: z7.number(),
|
|
3057
|
+
top_logprobs: z7.array(
|
|
3058
|
+
z7.object({
|
|
3059
|
+
token: z7.string(),
|
|
3060
|
+
logprob: z7.number()
|
|
3061
|
+
}).passthrough()
|
|
3062
|
+
)
|
|
3063
|
+
}).passthrough()
|
|
3064
|
+
).nullable()
|
|
3065
|
+
}).passthrough().nullish(),
|
|
3066
|
+
finish_reason: z7.string().nullable().optional(),
|
|
3067
|
+
index: z7.number().nullish()
|
|
3068
|
+
}).passthrough()
|
|
3069
|
+
)
|
|
3070
|
+
}),
|
|
3071
|
+
OpenRouterErrorResponseSchema
|
|
3072
|
+
]);
|
|
3073
|
+
|
|
3074
|
+
// src/chat/index.ts
|
|
3075
|
+
var OpenRouterChatLanguageModel = class {
|
|
3076
|
+
constructor(modelId, settings, config) {
|
|
3077
|
+
this.specificationVersion = "v3";
|
|
3078
|
+
this.provider = "openrouter";
|
|
3079
|
+
this.defaultObjectGenerationMode = "tool";
|
|
3080
|
+
this.supportsImageUrls = true;
|
|
3081
|
+
this.supportedUrls = {
|
|
3082
|
+
"image/*": [
|
|
3083
|
+
/^data:image\/[a-zA-Z]+;base64,/,
|
|
3084
|
+
/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)$/i
|
|
3085
|
+
],
|
|
3086
|
+
// 'text/*': [/^data:text\//, /^https?:\/\/.+$/],
|
|
3087
|
+
"application/*": [/^data:application\//, /^https?:\/\/.+$/]
|
|
3088
|
+
};
|
|
3089
|
+
this.modelId = modelId;
|
|
3090
|
+
this.settings = settings;
|
|
3091
|
+
this.config = config;
|
|
3092
|
+
}
|
|
3093
|
+
getArgs({
|
|
3094
|
+
prompt,
|
|
3095
|
+
maxOutputTokens,
|
|
3096
|
+
temperature,
|
|
3097
|
+
topP,
|
|
3098
|
+
frequencyPenalty,
|
|
3099
|
+
presencePenalty,
|
|
3100
|
+
seed,
|
|
3101
|
+
stopSequences,
|
|
3102
|
+
responseFormat,
|
|
3103
|
+
topK,
|
|
3104
|
+
tools,
|
|
3105
|
+
toolChoice
|
|
3106
|
+
}) {
|
|
3107
|
+
var _a16;
|
|
3108
|
+
const baseArgs = __spreadValues(__spreadValues({
|
|
3109
|
+
// model id:
|
|
3110
|
+
model: this.modelId,
|
|
3111
|
+
models: this.settings.models,
|
|
3112
|
+
// model specific settings:
|
|
3113
|
+
logit_bias: this.settings.logitBias,
|
|
3114
|
+
logprobs: this.settings.logprobs === true || typeof this.settings.logprobs === "number" ? true : void 0,
|
|
3115
|
+
top_logprobs: typeof this.settings.logprobs === "number" ? this.settings.logprobs : typeof this.settings.logprobs === "boolean" ? this.settings.logprobs ? 0 : void 0 : void 0,
|
|
3116
|
+
user: this.settings.user,
|
|
3117
|
+
parallel_tool_calls: this.settings.parallelToolCalls,
|
|
3118
|
+
// standardized settings:
|
|
3119
|
+
max_tokens: maxOutputTokens,
|
|
3120
|
+
temperature,
|
|
3121
|
+
top_p: topP,
|
|
3122
|
+
frequency_penalty: frequencyPenalty,
|
|
3123
|
+
presence_penalty: presencePenalty,
|
|
3124
|
+
seed,
|
|
3125
|
+
stop: stopSequences,
|
|
3126
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? responseFormat.schema != null ? {
|
|
3127
|
+
type: "json_schema",
|
|
3128
|
+
json_schema: __spreadValues({
|
|
3129
|
+
schema: responseFormat.schema,
|
|
3130
|
+
strict: true,
|
|
3131
|
+
name: (_a16 = responseFormat.name) != null ? _a16 : "response"
|
|
3132
|
+
}, responseFormat.description && {
|
|
3133
|
+
description: responseFormat.description
|
|
3134
|
+
})
|
|
3135
|
+
} : { type: "json_object" } : void 0,
|
|
3136
|
+
top_k: topK,
|
|
3137
|
+
// messages:
|
|
3138
|
+
messages: convertToOpenRouterChatMessages(prompt),
|
|
3139
|
+
// OpenRouter specific settings:
|
|
3140
|
+
include_reasoning: this.settings.includeReasoning,
|
|
3141
|
+
reasoning: this.settings.reasoning,
|
|
3142
|
+
usage: this.settings.usage,
|
|
3143
|
+
// Web search settings:
|
|
3144
|
+
plugins: this.settings.plugins,
|
|
3145
|
+
web_search_options: this.settings.web_search_options,
|
|
3146
|
+
// Provider routing settings:
|
|
3147
|
+
provider: this.settings.provider,
|
|
3148
|
+
// Debug settings:
|
|
3149
|
+
debug: this.settings.debug
|
|
3150
|
+
}, this.config.extraBody), this.settings.extraBody);
|
|
3151
|
+
if (tools && tools.length > 0) {
|
|
3152
|
+
const mappedTools = tools.filter(
|
|
3153
|
+
(tool) => tool.type === "function"
|
|
3154
|
+
).map((tool) => ({
|
|
3155
|
+
type: "function",
|
|
3156
|
+
function: {
|
|
3157
|
+
name: tool.name,
|
|
3158
|
+
description: tool.description,
|
|
3159
|
+
parameters: tool.inputSchema
|
|
3160
|
+
}
|
|
3161
|
+
}));
|
|
3162
|
+
return __spreadProps(__spreadValues({}, baseArgs), {
|
|
3163
|
+
tools: mappedTools,
|
|
3164
|
+
tool_choice: toolChoice ? getChatCompletionToolChoice(toolChoice) : void 0
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
return baseArgs;
|
|
3168
|
+
}
|
|
3169
|
+
async doGenerate(options) {
|
|
3170
|
+
var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
3171
|
+
const providerOptions = options.providerOptions || {};
|
|
3172
|
+
const openrouterOptions = providerOptions.openrouter || {};
|
|
3173
|
+
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
3174
|
+
const { value: responseValue, responseHeaders } = await postJsonToApi({
|
|
3175
|
+
url: this.config.url({
|
|
3176
|
+
path: "/chat/completions",
|
|
3177
|
+
modelId: this.modelId
|
|
3178
|
+
}),
|
|
3179
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
3180
|
+
body: args,
|
|
3181
|
+
failedResponseHandler: openrouterFailedResponseHandler,
|
|
3182
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
3183
|
+
OpenRouterNonStreamChatCompletionResponseSchema
|
|
3184
|
+
),
|
|
3185
|
+
abortSignal: options.abortSignal,
|
|
3186
|
+
fetch: this.config.fetch
|
|
3187
|
+
});
|
|
3188
|
+
if ("error" in responseValue) {
|
|
3189
|
+
const errorData = responseValue.error;
|
|
3190
|
+
throw new APICallError({
|
|
3191
|
+
message: errorData.message,
|
|
3192
|
+
url: this.config.url({
|
|
3193
|
+
path: "/chat/completions",
|
|
3194
|
+
modelId: this.modelId
|
|
3195
|
+
}),
|
|
3196
|
+
requestBodyValues: args,
|
|
3197
|
+
statusCode: 200,
|
|
3198
|
+
responseHeaders,
|
|
3199
|
+
data: errorData
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
const response = responseValue;
|
|
3203
|
+
const choice = response.choices[0];
|
|
3204
|
+
if (!choice) {
|
|
3205
|
+
throw new NoContentGeneratedError({
|
|
3206
|
+
message: "No choice in response"
|
|
3207
|
+
});
|
|
3208
|
+
}
|
|
3209
|
+
const usageInfo = response.usage ? computeTokenUsage(response.usage) : emptyUsage();
|
|
3210
|
+
const reasoningDetails = (_a16 = choice.message.reasoning_details) != null ? _a16 : [];
|
|
3211
|
+
const reasoning = reasoningDetails.length > 0 ? reasoningDetails.map((detail) => {
|
|
3212
|
+
switch (detail.type) {
|
|
3213
|
+
case "reasoning.text" /* Text */: {
|
|
3214
|
+
if (detail.text) {
|
|
3215
|
+
return {
|
|
3216
|
+
type: "reasoning",
|
|
3217
|
+
text: detail.text,
|
|
3218
|
+
providerMetadata: {
|
|
3219
|
+
openrouter: {
|
|
3220
|
+
reasoning_details: [detail]
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
}
|
|
3225
|
+
break;
|
|
3226
|
+
}
|
|
3227
|
+
case "reasoning.summary" /* Summary */: {
|
|
3228
|
+
if (detail.summary) {
|
|
3229
|
+
return {
|
|
3230
|
+
type: "reasoning",
|
|
3231
|
+
text: detail.summary,
|
|
3232
|
+
providerMetadata: {
|
|
3233
|
+
openrouter: {
|
|
3234
|
+
reasoning_details: [detail]
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
};
|
|
3238
|
+
}
|
|
3239
|
+
break;
|
|
3240
|
+
}
|
|
3241
|
+
case "reasoning.encrypted" /* Encrypted */: {
|
|
3242
|
+
if (detail.data) {
|
|
3243
|
+
return {
|
|
3244
|
+
type: "reasoning",
|
|
3245
|
+
text: "[REDACTED]",
|
|
3246
|
+
providerMetadata: {
|
|
3247
|
+
openrouter: {
|
|
3248
|
+
reasoning_details: [detail]
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
};
|
|
3252
|
+
}
|
|
3253
|
+
break;
|
|
3254
|
+
}
|
|
3255
|
+
default: {
|
|
3256
|
+
detail;
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
return null;
|
|
3260
|
+
}).filter((p) => p !== null) : choice.message.reasoning ? [
|
|
3261
|
+
{
|
|
3262
|
+
type: "reasoning",
|
|
3263
|
+
text: choice.message.reasoning
|
|
3264
|
+
}
|
|
3265
|
+
] : [];
|
|
3266
|
+
const content = [];
|
|
3267
|
+
content.push(...reasoning);
|
|
3268
|
+
if (choice.message.content) {
|
|
3269
|
+
content.push({
|
|
3270
|
+
type: "text",
|
|
3271
|
+
text: choice.message.content
|
|
3272
|
+
});
|
|
3273
|
+
}
|
|
3274
|
+
if (choice.message.tool_calls) {
|
|
3275
|
+
let reasoningDetailsAttachedToToolCall = false;
|
|
3276
|
+
for (const toolCall of choice.message.tool_calls) {
|
|
3277
|
+
content.push({
|
|
3278
|
+
type: "tool-call",
|
|
3279
|
+
toolCallId: (_b16 = toolCall.id) != null ? _b16 : generateId(),
|
|
3280
|
+
toolName: toolCall.function.name,
|
|
3281
|
+
input: (_c = toolCall.function.arguments) != null ? _c : "{}",
|
|
3282
|
+
providerMetadata: !reasoningDetailsAttachedToToolCall ? {
|
|
3283
|
+
openrouter: {
|
|
3284
|
+
reasoning_details: reasoningDetails
|
|
3285
|
+
}
|
|
3286
|
+
} : void 0
|
|
3287
|
+
});
|
|
3288
|
+
reasoningDetailsAttachedToToolCall = true;
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
if (choice.message.images) {
|
|
3292
|
+
for (const image of choice.message.images) {
|
|
3293
|
+
content.push({
|
|
3294
|
+
type: "file",
|
|
3295
|
+
mediaType: getMediaType(image.image_url.url, "image/jpeg"),
|
|
3296
|
+
data: getBase64FromDataUrl(image.image_url.url)
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
if (choice.message.annotations) {
|
|
3301
|
+
for (const annotation of choice.message.annotations) {
|
|
3302
|
+
if (annotation.type === "url_citation") {
|
|
3303
|
+
content.push({
|
|
3304
|
+
type: "source",
|
|
3305
|
+
sourceType: "url",
|
|
3306
|
+
id: annotation.url_citation.url,
|
|
3307
|
+
url: annotation.url_citation.url,
|
|
3308
|
+
title: (_d = annotation.url_citation.title) != null ? _d : "",
|
|
3309
|
+
providerMetadata: {
|
|
3310
|
+
openrouter: {
|
|
3311
|
+
content: (_e = annotation.url_citation.content) != null ? _e : "",
|
|
3312
|
+
startIndex: (_f = annotation.url_citation.start_index) != null ? _f : 0,
|
|
3313
|
+
endIndex: (_g = annotation.url_citation.end_index) != null ? _g : 0
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
const fileAnnotations = (_h = choice.message.annotations) == null ? void 0 : _h.filter(
|
|
3321
|
+
(a) => a.type === "file"
|
|
3322
|
+
);
|
|
3323
|
+
const hasToolCalls = choice.message.tool_calls && choice.message.tool_calls.length > 0;
|
|
3324
|
+
const hasEncryptedReasoning = reasoningDetails.some(
|
|
3325
|
+
(d) => d.type === "reasoning.encrypted" /* Encrypted */ && d.data
|
|
3326
|
+
);
|
|
3327
|
+
const shouldOverrideFinishReason = hasToolCalls && hasEncryptedReasoning && choice.finish_reason === "stop";
|
|
3328
|
+
const effectiveFinishReason = shouldOverrideFinishReason ? createFinishReason("tool-calls", (_i = choice.finish_reason) != null ? _i : void 0) : mapOpenRouterFinishReason(choice.finish_reason);
|
|
3329
|
+
return {
|
|
3330
|
+
content,
|
|
3331
|
+
finishReason: effectiveFinishReason,
|
|
3332
|
+
usage: usageInfo,
|
|
3333
|
+
warnings: [],
|
|
3334
|
+
providerMetadata: {
|
|
3335
|
+
openrouter: OpenRouterProviderMetadataSchema.parse({
|
|
3336
|
+
provider: (_j = response.provider) != null ? _j : "",
|
|
3337
|
+
reasoning_details: (_k = choice.message.reasoning_details) != null ? _k : [],
|
|
3338
|
+
annotations: fileAnnotations && fileAnnotations.length > 0 ? fileAnnotations : void 0,
|
|
3339
|
+
usage: __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
3340
|
+
promptTokens: (_l = usageInfo.inputTokens.total) != null ? _l : 0,
|
|
3341
|
+
completionTokens: (_m = usageInfo.outputTokens.total) != null ? _m : 0,
|
|
3342
|
+
totalTokens: ((_n = usageInfo.inputTokens.total) != null ? _n : 0) + ((_o = usageInfo.outputTokens.total) != null ? _o : 0)
|
|
3343
|
+
}, ((_p = response.usage) == null ? void 0 : _p.cost) != null ? { cost: response.usage.cost } : {}), ((_r = (_q = response.usage) == null ? void 0 : _q.prompt_tokens_details) == null ? void 0 : _r.cached_tokens) != null ? {
|
|
3344
|
+
promptTokensDetails: {
|
|
3345
|
+
cachedTokens: response.usage.prompt_tokens_details.cached_tokens
|
|
3346
|
+
}
|
|
3347
|
+
} : {}), ((_t = (_s = response.usage) == null ? void 0 : _s.completion_tokens_details) == null ? void 0 : _t.reasoning_tokens) != null ? {
|
|
3348
|
+
completionTokensDetails: {
|
|
3349
|
+
reasoningTokens: response.usage.completion_tokens_details.reasoning_tokens
|
|
3350
|
+
}
|
|
3351
|
+
} : {}), ((_v = (_u = response.usage) == null ? void 0 : _u.cost_details) == null ? void 0 : _v.upstream_inference_cost) != null ? {
|
|
3352
|
+
costDetails: {
|
|
3353
|
+
upstreamInferenceCost: response.usage.cost_details.upstream_inference_cost
|
|
3354
|
+
}
|
|
3355
|
+
} : {})
|
|
3356
|
+
})
|
|
3357
|
+
},
|
|
3358
|
+
request: { body: args },
|
|
3359
|
+
response: {
|
|
3360
|
+
id: response.id,
|
|
3361
|
+
modelId: response.model,
|
|
3362
|
+
headers: responseHeaders
|
|
3363
|
+
}
|
|
3364
|
+
};
|
|
3365
|
+
}
|
|
3366
|
+
async doStream(options) {
|
|
3367
|
+
var _a16;
|
|
3368
|
+
const providerOptions = options.providerOptions || {};
|
|
3369
|
+
const openrouterOptions = providerOptions.openrouter || {};
|
|
3370
|
+
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
3371
|
+
const { value: response, responseHeaders } = await postJsonToApi({
|
|
3372
|
+
url: this.config.url({
|
|
3373
|
+
path: "/chat/completions",
|
|
3374
|
+
modelId: this.modelId
|
|
3375
|
+
}),
|
|
3376
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
3377
|
+
body: __spreadProps(__spreadValues({}, args), {
|
|
3378
|
+
stream: true,
|
|
3379
|
+
// only include stream_options when in strict compatibility mode:
|
|
3380
|
+
stream_options: this.config.compatibility === "strict" ? __spreadValues({
|
|
3381
|
+
include_usage: true
|
|
3382
|
+
}, ((_a16 = this.settings.usage) == null ? void 0 : _a16.include) ? { include_usage: true } : {}) : void 0
|
|
3383
|
+
}),
|
|
3384
|
+
failedResponseHandler: openrouterFailedResponseHandler,
|
|
3385
|
+
successfulResponseHandler: createEventSourceResponseHandler(
|
|
3386
|
+
OpenRouterStreamChatCompletionChunkSchema
|
|
3387
|
+
),
|
|
3388
|
+
abortSignal: options.abortSignal,
|
|
3389
|
+
fetch: this.config.fetch
|
|
3390
|
+
});
|
|
3391
|
+
const toolCalls = [];
|
|
3392
|
+
let finishReason = createFinishReason("other");
|
|
3393
|
+
const usage = {
|
|
3394
|
+
inputTokens: {
|
|
3395
|
+
total: void 0,
|
|
3396
|
+
noCache: void 0,
|
|
3397
|
+
cacheRead: void 0,
|
|
3398
|
+
cacheWrite: void 0
|
|
3399
|
+
},
|
|
3400
|
+
outputTokens: {
|
|
3401
|
+
total: void 0,
|
|
3402
|
+
text: void 0,
|
|
3403
|
+
reasoning: void 0
|
|
3404
|
+
},
|
|
3405
|
+
raw: void 0
|
|
3406
|
+
};
|
|
3407
|
+
const openrouterUsage = {};
|
|
3408
|
+
let rawUsage;
|
|
3409
|
+
const accumulatedReasoningDetails = [];
|
|
3410
|
+
let reasoningDetailsAttachedToToolCall = false;
|
|
3411
|
+
const accumulatedFileAnnotations = [];
|
|
3412
|
+
let textStarted = false;
|
|
3413
|
+
let reasoningStarted = false;
|
|
3414
|
+
let textId;
|
|
3415
|
+
let reasoningId;
|
|
3416
|
+
let openrouterResponseId;
|
|
3417
|
+
let provider;
|
|
3418
|
+
return {
|
|
3419
|
+
stream: response.pipeThrough(
|
|
3420
|
+
new TransformStream({
|
|
3421
|
+
transform(chunk, controller) {
|
|
3422
|
+
var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
3423
|
+
if (options.includeRawChunks) {
|
|
3424
|
+
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
3425
|
+
}
|
|
3426
|
+
if (!chunk.success) {
|
|
3427
|
+
finishReason = createFinishReason("error");
|
|
3428
|
+
controller.enqueue({ type: "error", error: chunk.error });
|
|
3429
|
+
return;
|
|
3430
|
+
}
|
|
3431
|
+
const value = chunk.value;
|
|
3432
|
+
if ("error" in value) {
|
|
3433
|
+
finishReason = createFinishReason("error");
|
|
3434
|
+
controller.enqueue({ type: "error", error: value.error });
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
if (value.provider) {
|
|
3438
|
+
provider = value.provider;
|
|
3439
|
+
}
|
|
3440
|
+
if (value.id) {
|
|
3441
|
+
openrouterResponseId = value.id;
|
|
3442
|
+
controller.enqueue({
|
|
3443
|
+
type: "response-metadata",
|
|
3444
|
+
id: value.id
|
|
3445
|
+
});
|
|
3446
|
+
}
|
|
3447
|
+
if (value.model) {
|
|
3448
|
+
controller.enqueue({
|
|
3449
|
+
type: "response-metadata",
|
|
3450
|
+
modelId: value.model
|
|
3451
|
+
});
|
|
3452
|
+
}
|
|
3453
|
+
if (value.usage != null) {
|
|
3454
|
+
const computed = computeTokenUsage(value.usage);
|
|
3455
|
+
Object.assign(usage.inputTokens, computed.inputTokens);
|
|
3456
|
+
Object.assign(usage.outputTokens, computed.outputTokens);
|
|
3457
|
+
rawUsage = value.usage;
|
|
3458
|
+
const promptTokens = (_a17 = value.usage.prompt_tokens) != null ? _a17 : 0;
|
|
3459
|
+
const completionTokens = (_b16 = value.usage.completion_tokens) != null ? _b16 : 0;
|
|
3460
|
+
openrouterUsage.promptTokens = promptTokens;
|
|
3461
|
+
if (value.usage.prompt_tokens_details) {
|
|
3462
|
+
openrouterUsage.promptTokensDetails = {
|
|
3463
|
+
cachedTokens: (_c = value.usage.prompt_tokens_details.cached_tokens) != null ? _c : 0
|
|
3464
|
+
};
|
|
3465
|
+
}
|
|
3466
|
+
openrouterUsage.completionTokens = completionTokens;
|
|
3467
|
+
if (value.usage.completion_tokens_details) {
|
|
3468
|
+
openrouterUsage.completionTokensDetails = {
|
|
3469
|
+
reasoningTokens: (_d = value.usage.completion_tokens_details.reasoning_tokens) != null ? _d : 0
|
|
3470
|
+
};
|
|
3471
|
+
}
|
|
3472
|
+
if (value.usage.cost != null) {
|
|
3473
|
+
openrouterUsage.cost = value.usage.cost;
|
|
3474
|
+
}
|
|
3475
|
+
openrouterUsage.totalTokens = value.usage.total_tokens;
|
|
3476
|
+
const upstreamInferenceCost = (_e = value.usage.cost_details) == null ? void 0 : _e.upstream_inference_cost;
|
|
3477
|
+
if (upstreamInferenceCost != null) {
|
|
3478
|
+
openrouterUsage.costDetails = {
|
|
3479
|
+
upstreamInferenceCost
|
|
3480
|
+
};
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
const choice = value.choices[0];
|
|
3484
|
+
if ((choice == null ? void 0 : choice.finish_reason) != null) {
|
|
3485
|
+
finishReason = mapOpenRouterFinishReason(choice.finish_reason);
|
|
3486
|
+
}
|
|
3487
|
+
if ((choice == null ? void 0 : choice.delta) == null) {
|
|
3488
|
+
return;
|
|
3489
|
+
}
|
|
3490
|
+
const delta = choice.delta;
|
|
3491
|
+
const emitReasoningChunk = (chunkText, providerMetadata) => {
|
|
3492
|
+
if (!reasoningStarted) {
|
|
3493
|
+
reasoningId = openrouterResponseId || generateId();
|
|
3494
|
+
controller.enqueue({
|
|
3495
|
+
providerMetadata,
|
|
3496
|
+
type: "reasoning-start",
|
|
3497
|
+
id: reasoningId
|
|
3498
|
+
});
|
|
3499
|
+
reasoningStarted = true;
|
|
3500
|
+
}
|
|
3501
|
+
controller.enqueue({
|
|
3502
|
+
providerMetadata,
|
|
3503
|
+
type: "reasoning-delta",
|
|
3504
|
+
delta: chunkText,
|
|
3505
|
+
id: reasoningId || generateId()
|
|
3506
|
+
});
|
|
3507
|
+
};
|
|
3508
|
+
if (delta.reasoning_details && delta.reasoning_details.length > 0) {
|
|
3509
|
+
for (const detail of delta.reasoning_details) {
|
|
3510
|
+
if (detail.type === "reasoning.text" /* Text */) {
|
|
3511
|
+
const lastDetail = accumulatedReasoningDetails[accumulatedReasoningDetails.length - 1];
|
|
3512
|
+
if ((lastDetail == null ? void 0 : lastDetail.type) === "reasoning.text" /* Text */) {
|
|
3513
|
+
lastDetail.text = (lastDetail.text || "") + (detail.text || "");
|
|
3514
|
+
lastDetail.signature = lastDetail.signature || detail.signature;
|
|
3515
|
+
lastDetail.format = lastDetail.format || detail.format;
|
|
3516
|
+
} else {
|
|
3517
|
+
accumulatedReasoningDetails.push(__spreadValues({}, detail));
|
|
3518
|
+
}
|
|
3519
|
+
} else {
|
|
3520
|
+
accumulatedReasoningDetails.push(detail);
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
const reasoningMetadata = {
|
|
3524
|
+
openrouter: {
|
|
3525
|
+
reasoning_details: accumulatedReasoningDetails.map((d) => __spreadValues({}, d))
|
|
3526
|
+
}
|
|
3527
|
+
};
|
|
3528
|
+
for (const detail of delta.reasoning_details) {
|
|
3529
|
+
switch (detail.type) {
|
|
3530
|
+
case "reasoning.text" /* Text */: {
|
|
3531
|
+
emitReasoningChunk(detail.text || "", reasoningMetadata);
|
|
3532
|
+
break;
|
|
3533
|
+
}
|
|
3534
|
+
case "reasoning.encrypted" /* Encrypted */: {
|
|
3535
|
+
if (detail.data) {
|
|
3536
|
+
emitReasoningChunk("[REDACTED]", reasoningMetadata);
|
|
3537
|
+
}
|
|
3538
|
+
break;
|
|
3539
|
+
}
|
|
3540
|
+
case "reasoning.summary" /* Summary */: {
|
|
3541
|
+
if (detail.summary) {
|
|
3542
|
+
emitReasoningChunk(detail.summary, reasoningMetadata);
|
|
3543
|
+
}
|
|
3544
|
+
break;
|
|
3545
|
+
}
|
|
3546
|
+
default: {
|
|
3547
|
+
detail;
|
|
3548
|
+
break;
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
}
|
|
3552
|
+
} else if (delta.reasoning) {
|
|
3553
|
+
emitReasoningChunk(delta.reasoning);
|
|
3554
|
+
}
|
|
3555
|
+
if (delta.content) {
|
|
3556
|
+
if (reasoningStarted && !textStarted) {
|
|
3557
|
+
controller.enqueue({
|
|
3558
|
+
type: "reasoning-end",
|
|
3559
|
+
id: reasoningId || generateId(),
|
|
3560
|
+
// Include accumulated reasoning_details so the AI SDK can update
|
|
3561
|
+
// the reasoning part's providerMetadata with the correct signature.
|
|
3562
|
+
// The signature typically arrives in the last reasoning delta,
|
|
3563
|
+
// but reasoning-start only carries the first delta's metadata.
|
|
3564
|
+
providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
|
3565
|
+
openrouter: {
|
|
3566
|
+
reasoning_details: accumulatedReasoningDetails
|
|
3567
|
+
}
|
|
3568
|
+
} : void 0
|
|
3569
|
+
});
|
|
3570
|
+
reasoningStarted = false;
|
|
3571
|
+
}
|
|
3572
|
+
if (!textStarted) {
|
|
3573
|
+
textId = openrouterResponseId || generateId();
|
|
3574
|
+
controller.enqueue({
|
|
3575
|
+
type: "text-start",
|
|
3576
|
+
id: textId
|
|
3577
|
+
});
|
|
3578
|
+
textStarted = true;
|
|
3579
|
+
}
|
|
3580
|
+
controller.enqueue({
|
|
3581
|
+
type: "text-delta",
|
|
3582
|
+
delta: delta.content,
|
|
3583
|
+
id: textId || generateId()
|
|
3584
|
+
});
|
|
3585
|
+
}
|
|
3586
|
+
if (delta.annotations) {
|
|
3587
|
+
for (const annotation of delta.annotations) {
|
|
3588
|
+
if (annotation.type === "url_citation") {
|
|
3589
|
+
controller.enqueue({
|
|
3590
|
+
type: "source",
|
|
3591
|
+
sourceType: "url",
|
|
3592
|
+
id: annotation.url_citation.url,
|
|
3593
|
+
url: annotation.url_citation.url,
|
|
3594
|
+
title: (_f = annotation.url_citation.title) != null ? _f : "",
|
|
3595
|
+
providerMetadata: {
|
|
3596
|
+
openrouter: {
|
|
3597
|
+
content: (_g = annotation.url_citation.content) != null ? _g : "",
|
|
3598
|
+
startIndex: (_h = annotation.url_citation.start_index) != null ? _h : 0,
|
|
3599
|
+
endIndex: (_i = annotation.url_citation.end_index) != null ? _i : 0
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
});
|
|
3603
|
+
} else if (annotation.type === "file") {
|
|
3604
|
+
const file = annotation.file;
|
|
3605
|
+
if (file && typeof file === "object" && "hash" in file && "name" in file) {
|
|
3606
|
+
accumulatedFileAnnotations.push(
|
|
3607
|
+
annotation
|
|
3608
|
+
);
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
if (delta.tool_calls != null) {
|
|
3614
|
+
for (const toolCallDelta of delta.tool_calls) {
|
|
3615
|
+
const index = (_j = toolCallDelta.index) != null ? _j : toolCalls.length - 1;
|
|
3616
|
+
if (toolCalls[index] == null) {
|
|
3617
|
+
if (toolCallDelta.type !== "function") {
|
|
3618
|
+
throw new InvalidResponseDataError({
|
|
3619
|
+
data: toolCallDelta,
|
|
3620
|
+
message: `Expected 'function' type.`
|
|
3621
|
+
});
|
|
3622
|
+
}
|
|
3623
|
+
if (toolCallDelta.id == null) {
|
|
3624
|
+
throw new InvalidResponseDataError({
|
|
3625
|
+
data: toolCallDelta,
|
|
3626
|
+
message: `Expected 'id' to be a string.`
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
if (((_k = toolCallDelta.function) == null ? void 0 : _k.name) == null) {
|
|
3630
|
+
throw new InvalidResponseDataError({
|
|
3631
|
+
data: toolCallDelta,
|
|
3632
|
+
message: `Expected 'function.name' to be a string.`
|
|
3633
|
+
});
|
|
3634
|
+
}
|
|
3635
|
+
toolCalls[index] = {
|
|
3636
|
+
id: toolCallDelta.id,
|
|
3637
|
+
type: "function",
|
|
3638
|
+
function: {
|
|
3639
|
+
name: toolCallDelta.function.name,
|
|
3640
|
+
arguments: (_l = toolCallDelta.function.arguments) != null ? _l : ""
|
|
3641
|
+
},
|
|
3642
|
+
inputStarted: false,
|
|
3643
|
+
sent: false
|
|
3644
|
+
};
|
|
3645
|
+
const toolCall2 = toolCalls[index];
|
|
3646
|
+
if (toolCall2 == null) {
|
|
3647
|
+
throw new InvalidResponseDataError({
|
|
3648
|
+
data: { index, toolCallsLength: toolCalls.length },
|
|
3649
|
+
message: `Tool call at index ${index} is missing after creation.`
|
|
3650
|
+
});
|
|
3651
|
+
}
|
|
3652
|
+
if (((_m = toolCall2.function) == null ? void 0 : _m.name) != null && ((_n = toolCall2.function) == null ? void 0 : _n.arguments) != null && isParsableJson(toolCall2.function.arguments)) {
|
|
3653
|
+
toolCall2.inputStarted = true;
|
|
3654
|
+
controller.enqueue({
|
|
3655
|
+
type: "tool-input-start",
|
|
3656
|
+
id: toolCall2.id,
|
|
3657
|
+
toolName: toolCall2.function.name
|
|
3658
|
+
});
|
|
3659
|
+
controller.enqueue({
|
|
3660
|
+
type: "tool-input-delta",
|
|
3661
|
+
id: toolCall2.id,
|
|
3662
|
+
delta: toolCall2.function.arguments
|
|
3663
|
+
});
|
|
3664
|
+
controller.enqueue({
|
|
3665
|
+
type: "tool-input-end",
|
|
3666
|
+
id: toolCall2.id
|
|
3667
|
+
});
|
|
3668
|
+
controller.enqueue({
|
|
3669
|
+
type: "tool-call",
|
|
3670
|
+
toolCallId: toolCall2.id,
|
|
3671
|
+
toolName: toolCall2.function.name,
|
|
3672
|
+
input: toolCall2.function.arguments,
|
|
3673
|
+
providerMetadata: !reasoningDetailsAttachedToToolCall ? {
|
|
3674
|
+
openrouter: {
|
|
3675
|
+
reasoning_details: accumulatedReasoningDetails
|
|
3676
|
+
}
|
|
3677
|
+
} : void 0
|
|
3678
|
+
});
|
|
3679
|
+
reasoningDetailsAttachedToToolCall = true;
|
|
3680
|
+
toolCall2.sent = true;
|
|
3681
|
+
}
|
|
3682
|
+
continue;
|
|
3683
|
+
}
|
|
3684
|
+
const toolCall = toolCalls[index];
|
|
3685
|
+
if (toolCall == null) {
|
|
3686
|
+
throw new InvalidResponseDataError({
|
|
3687
|
+
data: {
|
|
3688
|
+
index,
|
|
3689
|
+
toolCallsLength: toolCalls.length,
|
|
3690
|
+
toolCallDelta
|
|
3691
|
+
},
|
|
3692
|
+
message: `Tool call at index ${index} is missing during merge.`
|
|
3693
|
+
});
|
|
3694
|
+
}
|
|
3695
|
+
if (!toolCall.inputStarted) {
|
|
3696
|
+
toolCall.inputStarted = true;
|
|
3697
|
+
controller.enqueue({
|
|
3698
|
+
type: "tool-input-start",
|
|
3699
|
+
id: toolCall.id,
|
|
3700
|
+
toolName: toolCall.function.name
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
if (((_o = toolCallDelta.function) == null ? void 0 : _o.arguments) != null) {
|
|
3704
|
+
toolCall.function.arguments += (_q = (_p = toolCallDelta.function) == null ? void 0 : _p.arguments) != null ? _q : "";
|
|
3705
|
+
}
|
|
3706
|
+
controller.enqueue({
|
|
3707
|
+
type: "tool-input-delta",
|
|
3708
|
+
id: toolCall.id,
|
|
3709
|
+
delta: (_r = toolCallDelta.function.arguments) != null ? _r : ""
|
|
3710
|
+
});
|
|
3711
|
+
if (((_s = toolCall.function) == null ? void 0 : _s.name) != null && ((_t = toolCall.function) == null ? void 0 : _t.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
3712
|
+
controller.enqueue({
|
|
3713
|
+
type: "tool-call",
|
|
3714
|
+
toolCallId: (_u = toolCall.id) != null ? _u : generateId(),
|
|
3715
|
+
toolName: toolCall.function.name,
|
|
3716
|
+
input: toolCall.function.arguments,
|
|
3717
|
+
providerMetadata: !reasoningDetailsAttachedToToolCall ? {
|
|
3718
|
+
openrouter: {
|
|
3719
|
+
reasoning_details: accumulatedReasoningDetails
|
|
3720
|
+
}
|
|
3721
|
+
} : void 0
|
|
3722
|
+
});
|
|
3723
|
+
reasoningDetailsAttachedToToolCall = true;
|
|
3724
|
+
toolCall.sent = true;
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
if (delta.images != null) {
|
|
3729
|
+
for (const image of delta.images) {
|
|
3730
|
+
controller.enqueue({
|
|
3731
|
+
type: "file",
|
|
3732
|
+
mediaType: getMediaType(image.image_url.url, "image/jpeg"),
|
|
3733
|
+
data: getBase64FromDataUrl(image.image_url.url)
|
|
3734
|
+
});
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
},
|
|
3738
|
+
flush(controller) {
|
|
3739
|
+
var _a17;
|
|
3740
|
+
const hasToolCalls = toolCalls.length > 0;
|
|
3741
|
+
const hasEncryptedReasoning = accumulatedReasoningDetails.some(
|
|
3742
|
+
(d) => d.type === "reasoning.encrypted" /* Encrypted */ && d.data
|
|
3743
|
+
);
|
|
3744
|
+
if (hasToolCalls && hasEncryptedReasoning && finishReason.unified === "stop") {
|
|
3745
|
+
finishReason = createFinishReason("tool-calls", finishReason.raw);
|
|
3746
|
+
}
|
|
3747
|
+
if (finishReason.unified === "tool-calls") {
|
|
3748
|
+
for (const toolCall of toolCalls) {
|
|
3749
|
+
if (toolCall && !toolCall.sent) {
|
|
3750
|
+
controller.enqueue({
|
|
3751
|
+
type: "tool-call",
|
|
3752
|
+
toolCallId: (_a17 = toolCall.id) != null ? _a17 : generateId(),
|
|
3753
|
+
toolName: toolCall.function.name,
|
|
3754
|
+
// Coerce invalid arguments to an empty JSON object
|
|
3755
|
+
input: isParsableJson(toolCall.function.arguments) ? toolCall.function.arguments : "{}",
|
|
3756
|
+
providerMetadata: !reasoningDetailsAttachedToToolCall ? {
|
|
3757
|
+
openrouter: {
|
|
3758
|
+
reasoning_details: accumulatedReasoningDetails
|
|
3759
|
+
}
|
|
3760
|
+
} : void 0
|
|
3761
|
+
});
|
|
3762
|
+
reasoningDetailsAttachedToToolCall = true;
|
|
3763
|
+
toolCall.sent = true;
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
if (reasoningStarted) {
|
|
3768
|
+
controller.enqueue({
|
|
3769
|
+
type: "reasoning-end",
|
|
3770
|
+
id: reasoningId || generateId(),
|
|
3771
|
+
// Include accumulated reasoning_details so the AI SDK can update
|
|
3772
|
+
// the reasoning part's providerMetadata with the correct signature.
|
|
3773
|
+
providerMetadata: accumulatedReasoningDetails.length > 0 ? {
|
|
3774
|
+
openrouter: {
|
|
3775
|
+
reasoning_details: accumulatedReasoningDetails
|
|
3776
|
+
}
|
|
3777
|
+
} : void 0
|
|
3778
|
+
});
|
|
3779
|
+
}
|
|
3780
|
+
if (textStarted) {
|
|
3781
|
+
controller.enqueue({
|
|
3782
|
+
type: "text-end",
|
|
3783
|
+
id: textId || generateId()
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
const openrouterMetadata = {
|
|
3787
|
+
usage: openrouterUsage
|
|
3788
|
+
};
|
|
3789
|
+
if (provider !== void 0) {
|
|
3790
|
+
openrouterMetadata.provider = provider;
|
|
3791
|
+
}
|
|
3792
|
+
if (accumulatedReasoningDetails.length > 0) {
|
|
3793
|
+
openrouterMetadata.reasoning_details = accumulatedReasoningDetails;
|
|
3794
|
+
}
|
|
3795
|
+
if (accumulatedFileAnnotations.length > 0) {
|
|
3796
|
+
openrouterMetadata.annotations = accumulatedFileAnnotations;
|
|
3797
|
+
}
|
|
3798
|
+
usage.raw = rawUsage;
|
|
3799
|
+
controller.enqueue({
|
|
3800
|
+
type: "finish",
|
|
3801
|
+
finishReason,
|
|
3802
|
+
usage,
|
|
3803
|
+
providerMetadata: {
|
|
3804
|
+
openrouter: openrouterMetadata
|
|
3805
|
+
}
|
|
3806
|
+
});
|
|
3807
|
+
}
|
|
3808
|
+
})
|
|
3809
|
+
),
|
|
3810
|
+
warnings: [],
|
|
3811
|
+
request: { body: args },
|
|
3812
|
+
response: { headers: responseHeaders }
|
|
3813
|
+
};
|
|
3814
|
+
}
|
|
3815
|
+
};
|
|
3816
|
+
|
|
3817
|
+
// src/completion/convert-to-openrouter-completion-prompt.ts
|
|
3818
|
+
function convertToOpenRouterCompletionPrompt({
|
|
3819
|
+
prompt,
|
|
3820
|
+
inputFormat,
|
|
3821
|
+
user = "user",
|
|
3822
|
+
assistant = "assistant"
|
|
3823
|
+
}) {
|
|
3824
|
+
if (inputFormat === "prompt" && prompt.length === 1 && prompt[0] && prompt[0].role === "user" && prompt[0].content.length === 1 && prompt[0].content[0] && prompt[0].content[0].type === "text") {
|
|
3825
|
+
return { prompt: prompt[0].content[0].text };
|
|
3826
|
+
}
|
|
3827
|
+
let text = "";
|
|
3828
|
+
if (prompt[0] && prompt[0].role === "system") {
|
|
3829
|
+
text += `${prompt[0].content}
|
|
3830
|
+
|
|
3831
|
+
`;
|
|
3832
|
+
prompt = prompt.slice(1);
|
|
3833
|
+
}
|
|
3834
|
+
for (const { role, content } of prompt) {
|
|
3835
|
+
switch (role) {
|
|
3836
|
+
case "system": {
|
|
3837
|
+
throw new InvalidPromptError({
|
|
3838
|
+
message: `Unexpected system message in prompt: ${content}`,
|
|
3839
|
+
prompt
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3842
|
+
case "user": {
|
|
3843
|
+
const userMessage = content.map((part) => {
|
|
3844
|
+
switch (part.type) {
|
|
3845
|
+
case "text": {
|
|
3846
|
+
return part.text;
|
|
3847
|
+
}
|
|
3848
|
+
case "file": {
|
|
3849
|
+
throw new UnsupportedFunctionalityError({
|
|
3850
|
+
functionality: "file attachments"
|
|
3851
|
+
});
|
|
3852
|
+
}
|
|
3853
|
+
default: {
|
|
3854
|
+
return "";
|
|
3855
|
+
}
|
|
3856
|
+
}
|
|
3857
|
+
}).join("");
|
|
3858
|
+
text += `${user}:
|
|
3859
|
+
${userMessage}
|
|
3860
|
+
|
|
3861
|
+
`;
|
|
3862
|
+
break;
|
|
3863
|
+
}
|
|
3864
|
+
case "assistant": {
|
|
3865
|
+
const assistantMessage = content.map(
|
|
3866
|
+
(part) => {
|
|
3867
|
+
switch (part.type) {
|
|
3868
|
+
case "text": {
|
|
3869
|
+
return part.text;
|
|
3870
|
+
}
|
|
3871
|
+
case "tool-call": {
|
|
3872
|
+
throw new UnsupportedFunctionalityError({
|
|
3873
|
+
functionality: "tool-call messages"
|
|
3874
|
+
});
|
|
3875
|
+
}
|
|
3876
|
+
case "tool-result": {
|
|
3877
|
+
throw new UnsupportedFunctionalityError({
|
|
3878
|
+
functionality: "tool-result messages"
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3881
|
+
case "reasoning": {
|
|
3882
|
+
throw new UnsupportedFunctionalityError({
|
|
3883
|
+
functionality: "reasoning messages"
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
case "file": {
|
|
3887
|
+
throw new UnsupportedFunctionalityError({
|
|
3888
|
+
functionality: "file attachments"
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
default: {
|
|
3892
|
+
return "";
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
).join("");
|
|
3897
|
+
text += `${assistant}:
|
|
3898
|
+
${assistantMessage}
|
|
3899
|
+
|
|
3900
|
+
`;
|
|
3901
|
+
break;
|
|
3902
|
+
}
|
|
3903
|
+
case "tool": {
|
|
3904
|
+
throw new UnsupportedFunctionalityError({
|
|
3905
|
+
functionality: "tool messages"
|
|
3906
|
+
});
|
|
3907
|
+
}
|
|
3908
|
+
default: {
|
|
3909
|
+
break;
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
}
|
|
3913
|
+
text += `${assistant}:
|
|
3914
|
+
`;
|
|
3915
|
+
return {
|
|
3916
|
+
prompt: text
|
|
3917
|
+
};
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3920
|
+
// src/completion/schemas.ts
|
|
3921
|
+
import { z as z8 } from "zod/v4";
|
|
3922
|
+
var OpenRouterCompletionChunkSchema = z8.union([
|
|
3923
|
+
z8.object({
|
|
3924
|
+
id: z8.string().optional(),
|
|
3925
|
+
model: z8.string().optional(),
|
|
3926
|
+
provider: z8.string().optional(),
|
|
3927
|
+
choices: z8.array(
|
|
3928
|
+
z8.object({
|
|
3929
|
+
text: z8.string(),
|
|
3930
|
+
reasoning: z8.string().nullish().optional(),
|
|
3931
|
+
reasoning_details: ReasoningDetailArraySchema.nullish(),
|
|
3932
|
+
finish_reason: z8.string().nullish(),
|
|
3933
|
+
index: z8.number().nullish(),
|
|
3934
|
+
logprobs: z8.object({
|
|
3935
|
+
tokens: z8.array(z8.string()),
|
|
3936
|
+
token_logprobs: z8.array(z8.number()),
|
|
3937
|
+
top_logprobs: z8.array(z8.record(z8.string(), z8.number())).nullable()
|
|
3938
|
+
}).passthrough().nullable().optional()
|
|
3939
|
+
}).passthrough()
|
|
3940
|
+
),
|
|
3941
|
+
usage: z8.object({
|
|
3942
|
+
prompt_tokens: z8.number(),
|
|
3943
|
+
prompt_tokens_details: z8.object({
|
|
3944
|
+
cached_tokens: z8.number(),
|
|
3945
|
+
cache_write_tokens: z8.number().nullish()
|
|
3946
|
+
}).passthrough().nullish(),
|
|
3947
|
+
completion_tokens: z8.number(),
|
|
3948
|
+
completion_tokens_details: z8.object({
|
|
3949
|
+
reasoning_tokens: z8.number()
|
|
3950
|
+
}).passthrough().nullish(),
|
|
3951
|
+
total_tokens: z8.number(),
|
|
3952
|
+
cost: z8.number().optional(),
|
|
3953
|
+
cost_details: z8.object({
|
|
3954
|
+
upstream_inference_cost: z8.number().nullish()
|
|
3955
|
+
}).passthrough().nullish()
|
|
3956
|
+
}).passthrough().nullish()
|
|
3957
|
+
}).passthrough(),
|
|
3958
|
+
OpenRouterErrorResponseSchema
|
|
3959
|
+
]);
|
|
3960
|
+
|
|
3961
|
+
// src/completion/index.ts
|
|
3962
|
+
var OpenRouterCompletionLanguageModel = class {
|
|
3963
|
+
constructor(modelId, settings, config) {
|
|
3964
|
+
this.specificationVersion = "v3";
|
|
3965
|
+
this.provider = "openrouter";
|
|
3966
|
+
this.supportsImageUrls = true;
|
|
3967
|
+
this.supportedUrls = {
|
|
3968
|
+
"image/*": [
|
|
3969
|
+
/^data:image\/[a-zA-Z]+;base64,/,
|
|
3970
|
+
/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)$/i
|
|
3971
|
+
],
|
|
3972
|
+
"text/*": [/^data:text\//, /^https?:\/\/.+$/],
|
|
3973
|
+
"application/*": [/^data:application\//, /^https?:\/\/.+$/]
|
|
3974
|
+
};
|
|
3975
|
+
this.defaultObjectGenerationMode = void 0;
|
|
3976
|
+
this.modelId = modelId;
|
|
3977
|
+
this.settings = settings;
|
|
3978
|
+
this.config = config;
|
|
3979
|
+
}
|
|
3980
|
+
getArgs({
|
|
3981
|
+
prompt,
|
|
3982
|
+
maxOutputTokens,
|
|
3983
|
+
temperature,
|
|
3984
|
+
topP,
|
|
3985
|
+
frequencyPenalty,
|
|
3986
|
+
presencePenalty,
|
|
3987
|
+
seed,
|
|
3988
|
+
responseFormat,
|
|
3989
|
+
topK,
|
|
3990
|
+
stopSequences,
|
|
3991
|
+
tools,
|
|
3992
|
+
toolChoice
|
|
3993
|
+
}) {
|
|
3994
|
+
const { prompt: completionPrompt } = convertToOpenRouterCompletionPrompt({
|
|
3995
|
+
prompt,
|
|
3996
|
+
inputFormat: "prompt"
|
|
3997
|
+
});
|
|
3998
|
+
if (tools == null ? void 0 : tools.length) {
|
|
3999
|
+
throw new UnsupportedFunctionalityError({
|
|
4000
|
+
functionality: "tools"
|
|
4001
|
+
});
|
|
4002
|
+
}
|
|
4003
|
+
if (toolChoice) {
|
|
4004
|
+
throw new UnsupportedFunctionalityError({
|
|
4005
|
+
functionality: "toolChoice"
|
|
4006
|
+
});
|
|
4007
|
+
}
|
|
4008
|
+
return __spreadValues(__spreadValues({
|
|
4009
|
+
// model id:
|
|
4010
|
+
model: this.modelId,
|
|
4011
|
+
models: this.settings.models,
|
|
4012
|
+
// model specific settings:
|
|
4013
|
+
logit_bias: this.settings.logitBias,
|
|
4014
|
+
logprobs: typeof this.settings.logprobs === "number" ? this.settings.logprobs : typeof this.settings.logprobs === "boolean" ? this.settings.logprobs ? 0 : void 0 : void 0,
|
|
4015
|
+
suffix: this.settings.suffix,
|
|
4016
|
+
user: this.settings.user,
|
|
4017
|
+
// standardized settings:
|
|
4018
|
+
max_tokens: maxOutputTokens,
|
|
4019
|
+
temperature,
|
|
4020
|
+
top_p: topP,
|
|
4021
|
+
frequency_penalty: frequencyPenalty,
|
|
4022
|
+
presence_penalty: presencePenalty,
|
|
4023
|
+
seed,
|
|
4024
|
+
stop: stopSequences,
|
|
4025
|
+
response_format: responseFormat,
|
|
4026
|
+
top_k: topK,
|
|
4027
|
+
// prompt:
|
|
4028
|
+
prompt: completionPrompt,
|
|
4029
|
+
// OpenRouter specific settings:
|
|
4030
|
+
include_reasoning: this.settings.includeReasoning,
|
|
4031
|
+
reasoning: this.settings.reasoning
|
|
4032
|
+
}, this.config.extraBody), this.settings.extraBody);
|
|
4033
|
+
}
|
|
4034
|
+
async doGenerate(options) {
|
|
4035
|
+
var _a16, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
4036
|
+
const providerOptions = options.providerOptions || {};
|
|
4037
|
+
const openrouterOptions = providerOptions.openrouter || {};
|
|
4038
|
+
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
4039
|
+
const { value: response, responseHeaders } = await postJsonToApi({
|
|
4040
|
+
url: this.config.url({
|
|
4041
|
+
path: "/completions",
|
|
4042
|
+
modelId: this.modelId
|
|
4043
|
+
}),
|
|
4044
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
4045
|
+
body: args,
|
|
4046
|
+
failedResponseHandler: openrouterFailedResponseHandler,
|
|
4047
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
4048
|
+
OpenRouterCompletionChunkSchema
|
|
4049
|
+
),
|
|
4050
|
+
abortSignal: options.abortSignal,
|
|
4051
|
+
fetch: this.config.fetch
|
|
4052
|
+
});
|
|
4053
|
+
if ("error" in response) {
|
|
4054
|
+
const errorData = response.error;
|
|
4055
|
+
throw new APICallError({
|
|
4056
|
+
message: errorData.message,
|
|
4057
|
+
url: this.config.url({
|
|
4058
|
+
path: "/completions",
|
|
4059
|
+
modelId: this.modelId
|
|
4060
|
+
}),
|
|
4061
|
+
requestBodyValues: args,
|
|
4062
|
+
statusCode: 200,
|
|
4063
|
+
responseHeaders,
|
|
4064
|
+
data: errorData
|
|
4065
|
+
});
|
|
4066
|
+
}
|
|
4067
|
+
const choice = response.choices[0];
|
|
4068
|
+
if (!choice) {
|
|
4069
|
+
throw new NoContentGeneratedError({
|
|
4070
|
+
message: "No choice in OpenRouter completion response"
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
4073
|
+
return {
|
|
4074
|
+
content: [
|
|
4075
|
+
{
|
|
4076
|
+
type: "text",
|
|
4077
|
+
text: (_a16 = choice.text) != null ? _a16 : ""
|
|
4078
|
+
}
|
|
4079
|
+
],
|
|
4080
|
+
finishReason: mapOpenRouterFinishReason(choice.finish_reason),
|
|
4081
|
+
usage: response.usage ? computeTokenUsage(response.usage) : emptyUsage(),
|
|
4082
|
+
warnings: [],
|
|
4083
|
+
providerMetadata: {
|
|
4084
|
+
openrouter: OpenRouterProviderMetadataSchema.parse({
|
|
4085
|
+
provider: (_b16 = response.provider) != null ? _b16 : "",
|
|
4086
|
+
usage: __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
4087
|
+
promptTokens: (_d = (_c = response.usage) == null ? void 0 : _c.prompt_tokens) != null ? _d : 0,
|
|
4088
|
+
completionTokens: (_f = (_e = response.usage) == null ? void 0 : _e.completion_tokens) != null ? _f : 0,
|
|
4089
|
+
totalTokens: ((_h = (_g = response.usage) == null ? void 0 : _g.prompt_tokens) != null ? _h : 0) + ((_j = (_i = response.usage) == null ? void 0 : _i.completion_tokens) != null ? _j : 0)
|
|
4090
|
+
}, ((_k = response.usage) == null ? void 0 : _k.cost) != null ? { cost: response.usage.cost } : {}), ((_m = (_l = response.usage) == null ? void 0 : _l.prompt_tokens_details) == null ? void 0 : _m.cached_tokens) != null ? {
|
|
4091
|
+
promptTokensDetails: {
|
|
4092
|
+
cachedTokens: response.usage.prompt_tokens_details.cached_tokens
|
|
4093
|
+
}
|
|
4094
|
+
} : {}), ((_o = (_n = response.usage) == null ? void 0 : _n.completion_tokens_details) == null ? void 0 : _o.reasoning_tokens) != null ? {
|
|
4095
|
+
completionTokensDetails: {
|
|
4096
|
+
reasoningTokens: response.usage.completion_tokens_details.reasoning_tokens
|
|
4097
|
+
}
|
|
4098
|
+
} : {}), ((_q = (_p = response.usage) == null ? void 0 : _p.cost_details) == null ? void 0 : _q.upstream_inference_cost) != null ? {
|
|
4099
|
+
costDetails: {
|
|
4100
|
+
upstreamInferenceCost: response.usage.cost_details.upstream_inference_cost
|
|
4101
|
+
}
|
|
4102
|
+
} : {})
|
|
4103
|
+
})
|
|
4104
|
+
},
|
|
4105
|
+
response: {
|
|
4106
|
+
headers: responseHeaders
|
|
4107
|
+
}
|
|
4108
|
+
};
|
|
4109
|
+
}
|
|
4110
|
+
async doStream(options) {
|
|
4111
|
+
const providerOptions = options.providerOptions || {};
|
|
4112
|
+
const openrouterOptions = providerOptions.openrouter || {};
|
|
4113
|
+
const args = __spreadValues(__spreadValues({}, this.getArgs(options)), openrouterOptions);
|
|
4114
|
+
const { value: response, responseHeaders } = await postJsonToApi({
|
|
4115
|
+
url: this.config.url({
|
|
4116
|
+
path: "/completions",
|
|
4117
|
+
modelId: this.modelId
|
|
4118
|
+
}),
|
|
4119
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
4120
|
+
body: __spreadProps(__spreadValues({}, args), {
|
|
4121
|
+
stream: true,
|
|
4122
|
+
// only include stream_options when in strict compatibility mode:
|
|
4123
|
+
stream_options: this.config.compatibility === "strict" ? { include_usage: true } : void 0
|
|
4124
|
+
}),
|
|
4125
|
+
failedResponseHandler: openrouterFailedResponseHandler,
|
|
4126
|
+
successfulResponseHandler: createEventSourceResponseHandler(
|
|
4127
|
+
OpenRouterCompletionChunkSchema
|
|
4128
|
+
),
|
|
4129
|
+
abortSignal: options.abortSignal,
|
|
4130
|
+
fetch: this.config.fetch
|
|
4131
|
+
});
|
|
4132
|
+
let finishReason = createFinishReason("other");
|
|
4133
|
+
const usage = {
|
|
4134
|
+
inputTokens: {
|
|
4135
|
+
total: void 0,
|
|
4136
|
+
noCache: void 0,
|
|
4137
|
+
cacheRead: void 0,
|
|
4138
|
+
cacheWrite: void 0
|
|
4139
|
+
},
|
|
4140
|
+
outputTokens: {
|
|
4141
|
+
total: void 0,
|
|
4142
|
+
text: void 0,
|
|
4143
|
+
reasoning: void 0
|
|
4144
|
+
},
|
|
4145
|
+
raw: void 0
|
|
4146
|
+
};
|
|
4147
|
+
const openrouterUsage = {};
|
|
4148
|
+
let provider;
|
|
4149
|
+
let rawUsage;
|
|
4150
|
+
return {
|
|
4151
|
+
stream: response.pipeThrough(
|
|
4152
|
+
new TransformStream({
|
|
4153
|
+
transform(chunk, controller) {
|
|
4154
|
+
var _a16, _b16, _c, _d, _e;
|
|
4155
|
+
if (options.includeRawChunks) {
|
|
4156
|
+
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
4157
|
+
}
|
|
4158
|
+
if (!chunk.success) {
|
|
4159
|
+
finishReason = createFinishReason("error");
|
|
4160
|
+
controller.enqueue({ type: "error", error: chunk.error });
|
|
4161
|
+
return;
|
|
4162
|
+
}
|
|
4163
|
+
const value = chunk.value;
|
|
4164
|
+
if ("error" in value) {
|
|
4165
|
+
finishReason = createFinishReason("error");
|
|
4166
|
+
controller.enqueue({ type: "error", error: value.error });
|
|
4167
|
+
return;
|
|
4168
|
+
}
|
|
4169
|
+
if (value.provider) {
|
|
4170
|
+
provider = value.provider;
|
|
4171
|
+
}
|
|
4172
|
+
if (value.usage != null) {
|
|
4173
|
+
const computed = computeTokenUsage(value.usage);
|
|
4174
|
+
Object.assign(usage.inputTokens, computed.inputTokens);
|
|
4175
|
+
Object.assign(usage.outputTokens, computed.outputTokens);
|
|
4176
|
+
rawUsage = value.usage;
|
|
4177
|
+
const promptTokens = (_a16 = value.usage.prompt_tokens) != null ? _a16 : 0;
|
|
4178
|
+
const completionTokens = (_b16 = value.usage.completion_tokens) != null ? _b16 : 0;
|
|
4179
|
+
openrouterUsage.promptTokens = promptTokens;
|
|
4180
|
+
if (value.usage.prompt_tokens_details) {
|
|
4181
|
+
openrouterUsage.promptTokensDetails = {
|
|
4182
|
+
cachedTokens: (_c = value.usage.prompt_tokens_details.cached_tokens) != null ? _c : 0
|
|
4183
|
+
};
|
|
4184
|
+
}
|
|
4185
|
+
openrouterUsage.completionTokens = completionTokens;
|
|
4186
|
+
if (value.usage.completion_tokens_details) {
|
|
4187
|
+
openrouterUsage.completionTokensDetails = {
|
|
4188
|
+
reasoningTokens: (_d = value.usage.completion_tokens_details.reasoning_tokens) != null ? _d : 0
|
|
4189
|
+
};
|
|
4190
|
+
}
|
|
4191
|
+
if (value.usage.cost != null) {
|
|
4192
|
+
openrouterUsage.cost = value.usage.cost;
|
|
4193
|
+
}
|
|
4194
|
+
openrouterUsage.totalTokens = value.usage.total_tokens;
|
|
4195
|
+
const upstreamInferenceCost = (_e = value.usage.cost_details) == null ? void 0 : _e.upstream_inference_cost;
|
|
4196
|
+
if (upstreamInferenceCost != null) {
|
|
4197
|
+
openrouterUsage.costDetails = {
|
|
4198
|
+
upstreamInferenceCost
|
|
4199
|
+
};
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
const choice = value.choices[0];
|
|
4203
|
+
if ((choice == null ? void 0 : choice.finish_reason) != null) {
|
|
4204
|
+
finishReason = mapOpenRouterFinishReason(choice.finish_reason);
|
|
4205
|
+
}
|
|
4206
|
+
if ((choice == null ? void 0 : choice.text) != null) {
|
|
4207
|
+
controller.enqueue({
|
|
4208
|
+
type: "text-delta",
|
|
4209
|
+
delta: choice.text,
|
|
4210
|
+
id: generateId()
|
|
4211
|
+
});
|
|
4212
|
+
}
|
|
4213
|
+
},
|
|
4214
|
+
flush(controller) {
|
|
4215
|
+
usage.raw = rawUsage;
|
|
4216
|
+
const openrouterMetadata = {
|
|
4217
|
+
usage: openrouterUsage
|
|
4218
|
+
};
|
|
4219
|
+
if (provider !== void 0) {
|
|
4220
|
+
openrouterMetadata.provider = provider;
|
|
4221
|
+
}
|
|
4222
|
+
controller.enqueue({
|
|
4223
|
+
type: "finish",
|
|
4224
|
+
finishReason,
|
|
4225
|
+
usage,
|
|
4226
|
+
providerMetadata: {
|
|
4227
|
+
openrouter: openrouterMetadata
|
|
4228
|
+
}
|
|
4229
|
+
});
|
|
4230
|
+
}
|
|
4231
|
+
})
|
|
4232
|
+
),
|
|
4233
|
+
response: {
|
|
4234
|
+
headers: responseHeaders
|
|
4235
|
+
}
|
|
4236
|
+
};
|
|
4237
|
+
}
|
|
4238
|
+
};
|
|
4239
|
+
|
|
4240
|
+
// src/embedding/schemas.ts
|
|
4241
|
+
import { z as z9 } from "zod/v4";
|
|
4242
|
+
var openrouterEmbeddingUsageSchema = z9.object({
|
|
4243
|
+
prompt_tokens: z9.number(),
|
|
4244
|
+
total_tokens: z9.number(),
|
|
4245
|
+
cost: z9.number().optional()
|
|
4246
|
+
});
|
|
4247
|
+
var openrouterEmbeddingDataSchema = z9.object({
|
|
4248
|
+
object: z9.literal("embedding"),
|
|
4249
|
+
embedding: z9.array(z9.number()),
|
|
4250
|
+
index: z9.number().optional()
|
|
4251
|
+
});
|
|
4252
|
+
var OpenRouterEmbeddingResponseSchema = z9.object({
|
|
4253
|
+
id: z9.string().optional(),
|
|
4254
|
+
object: z9.literal("list"),
|
|
4255
|
+
data: z9.array(openrouterEmbeddingDataSchema),
|
|
4256
|
+
model: z9.string(),
|
|
4257
|
+
provider: z9.string().optional(),
|
|
4258
|
+
usage: openrouterEmbeddingUsageSchema.optional()
|
|
4259
|
+
});
|
|
4260
|
+
|
|
4261
|
+
// src/embedding/index.ts
|
|
4262
|
+
var OpenRouterEmbeddingModel = class {
|
|
4263
|
+
constructor(modelId, settings, config) {
|
|
4264
|
+
this.specificationVersion = "v3";
|
|
4265
|
+
this.provider = "openrouter";
|
|
4266
|
+
this.maxEmbeddingsPerCall = void 0;
|
|
4267
|
+
this.supportsParallelCalls = true;
|
|
4268
|
+
this.modelId = modelId;
|
|
4269
|
+
this.settings = settings;
|
|
4270
|
+
this.config = config;
|
|
4271
|
+
}
|
|
4272
|
+
async doEmbed(options) {
|
|
4273
|
+
var _a16, _b16, _c, _d, _e, _f;
|
|
4274
|
+
const { values, abortSignal, headers } = options;
|
|
4275
|
+
const args = __spreadValues(__spreadValues({
|
|
4276
|
+
model: this.modelId,
|
|
4277
|
+
input: values,
|
|
4278
|
+
user: this.settings.user,
|
|
4279
|
+
provider: this.settings.provider
|
|
4280
|
+
}, this.config.extraBody), this.settings.extraBody);
|
|
4281
|
+
const { value: responseValue, responseHeaders } = await postJsonToApi({
|
|
4282
|
+
url: this.config.url({
|
|
4283
|
+
path: "/embeddings",
|
|
4284
|
+
modelId: this.modelId
|
|
4285
|
+
}),
|
|
4286
|
+
headers: combineHeaders(this.config.headers(), headers),
|
|
4287
|
+
body: args,
|
|
4288
|
+
failedResponseHandler: openrouterFailedResponseHandler,
|
|
4289
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
4290
|
+
OpenRouterEmbeddingResponseSchema
|
|
4291
|
+
),
|
|
4292
|
+
abortSignal,
|
|
4293
|
+
fetch: this.config.fetch
|
|
4294
|
+
});
|
|
4295
|
+
return {
|
|
4296
|
+
embeddings: responseValue.data.map((item) => item.embedding),
|
|
4297
|
+
usage: responseValue.usage ? { tokens: responseValue.usage.prompt_tokens } : void 0,
|
|
4298
|
+
providerMetadata: {
|
|
4299
|
+
openrouter: OpenRouterProviderMetadataSchema.parse({
|
|
4300
|
+
provider: (_a16 = responseValue.provider) != null ? _a16 : "",
|
|
4301
|
+
usage: __spreadValues({
|
|
4302
|
+
promptTokens: (_c = (_b16 = responseValue.usage) == null ? void 0 : _b16.prompt_tokens) != null ? _c : 0,
|
|
4303
|
+
completionTokens: 0,
|
|
4304
|
+
totalTokens: (_e = (_d = responseValue.usage) == null ? void 0 : _d.total_tokens) != null ? _e : 0
|
|
4305
|
+
}, ((_f = responseValue.usage) == null ? void 0 : _f.cost) != null ? { cost: responseValue.usage.cost } : {})
|
|
4306
|
+
})
|
|
4307
|
+
},
|
|
4308
|
+
response: {
|
|
4309
|
+
headers: responseHeaders,
|
|
4310
|
+
body: responseValue
|
|
4311
|
+
},
|
|
4312
|
+
warnings: []
|
|
4313
|
+
};
|
|
4314
|
+
}
|
|
4315
|
+
};
|
|
4316
|
+
|
|
4317
|
+
// src/facade.ts
|
|
4318
|
+
var OpenRouter = class {
|
|
4319
|
+
/**
|
|
4320
|
+
* Creates a new OpenRouter provider instance.
|
|
4321
|
+
*/
|
|
4322
|
+
constructor(options = {}) {
|
|
4323
|
+
var _a16, _b16;
|
|
4324
|
+
this.baseURL = (_b16 = withoutTrailingSlash((_a16 = options.baseURL) != null ? _a16 : options.baseUrl)) != null ? _b16 : "https://openrouter.ai/api/v1";
|
|
4325
|
+
this.apiKey = options.apiKey;
|
|
4326
|
+
this.headers = options.headers;
|
|
4327
|
+
this.api_keys = options.api_keys;
|
|
4328
|
+
}
|
|
4329
|
+
get baseConfig() {
|
|
4330
|
+
return {
|
|
4331
|
+
baseURL: this.baseURL,
|
|
4332
|
+
headers: () => __spreadValues(__spreadValues({
|
|
4333
|
+
Authorization: `Bearer ${loadApiKey({
|
|
4334
|
+
apiKey: this.apiKey,
|
|
4335
|
+
environmentVariableName: "OPENROUTER_API_KEY",
|
|
4336
|
+
description: "OpenRouter"
|
|
4337
|
+
})}`
|
|
4338
|
+
}, this.headers), this.api_keys && Object.keys(this.api_keys).length > 0 && {
|
|
4339
|
+
"X-Provider-API-Keys": JSON.stringify(this.api_keys)
|
|
4340
|
+
})
|
|
4341
|
+
};
|
|
4342
|
+
}
|
|
4343
|
+
chat(modelId, settings = {}) {
|
|
4344
|
+
return new OpenRouterChatLanguageModel(modelId, settings, __spreadProps(__spreadValues({
|
|
4345
|
+
provider: "openrouter.chat"
|
|
4346
|
+
}, this.baseConfig), {
|
|
4347
|
+
compatibility: "strict",
|
|
4348
|
+
url: ({ path }) => `${this.baseURL}${path}`
|
|
4349
|
+
}));
|
|
4350
|
+
}
|
|
4351
|
+
completion(modelId, settings = {}) {
|
|
4352
|
+
return new OpenRouterCompletionLanguageModel(modelId, settings, __spreadProps(__spreadValues({
|
|
4353
|
+
provider: "openrouter.completion"
|
|
4354
|
+
}, this.baseConfig), {
|
|
4355
|
+
compatibility: "strict",
|
|
4356
|
+
url: ({ path }) => `${this.baseURL}${path}`
|
|
4357
|
+
}));
|
|
4358
|
+
}
|
|
4359
|
+
textEmbeddingModel(modelId, settings = {}) {
|
|
4360
|
+
return new OpenRouterEmbeddingModel(modelId, settings, __spreadProps(__spreadValues({
|
|
4361
|
+
provider: "openrouter.embedding"
|
|
4362
|
+
}, this.baseConfig), {
|
|
4363
|
+
url: ({ path }) => `${this.baseURL}${path}`
|
|
4364
|
+
}));
|
|
4365
|
+
}
|
|
4366
|
+
/**
|
|
4367
|
+
* @deprecated Use textEmbeddingModel instead
|
|
4368
|
+
*/
|
|
4369
|
+
embedding(modelId, settings = {}) {
|
|
4370
|
+
return this.textEmbeddingModel(modelId, settings);
|
|
4371
|
+
}
|
|
4372
|
+
};
|
|
4373
|
+
|
|
4374
|
+
// src/image/schemas.ts
|
|
4375
|
+
import { z as z10 } from "zod/v4";
|
|
4376
|
+
var OpenRouterImageResponseSchema = z10.object({
|
|
4377
|
+
id: z10.string().optional(),
|
|
4378
|
+
object: z10.string().optional(),
|
|
4379
|
+
created: z10.number().optional(),
|
|
4380
|
+
model: z10.string(),
|
|
4381
|
+
choices: z10.array(
|
|
4382
|
+
z10.object({
|
|
4383
|
+
index: z10.number(),
|
|
4384
|
+
message: z10.object({
|
|
4385
|
+
role: z10.string(),
|
|
4386
|
+
content: z10.string().nullable().optional(),
|
|
4387
|
+
images: z10.array(
|
|
4388
|
+
z10.object({
|
|
4389
|
+
type: z10.literal("image_url"),
|
|
4390
|
+
image_url: z10.object({
|
|
4391
|
+
url: z10.string()
|
|
4392
|
+
})
|
|
4393
|
+
}).passthrough()
|
|
4394
|
+
).optional()
|
|
4395
|
+
}).passthrough(),
|
|
4396
|
+
finish_reason: z10.string().nullable().optional()
|
|
4397
|
+
}).passthrough()
|
|
4398
|
+
),
|
|
4399
|
+
usage: z10.object({
|
|
4400
|
+
prompt_tokens: z10.number(),
|
|
4401
|
+
completion_tokens: z10.number(),
|
|
4402
|
+
total_tokens: z10.number()
|
|
4403
|
+
}).passthrough().optional()
|
|
4404
|
+
}).passthrough();
|
|
4405
|
+
|
|
4406
|
+
// src/image/index.ts
|
|
4407
|
+
var OpenRouterImageModel = class {
|
|
4408
|
+
constructor(modelId, settings, config) {
|
|
4409
|
+
this.specificationVersion = "v3";
|
|
4410
|
+
this.provider = "openrouter";
|
|
4411
|
+
this.maxImagesPerCall = 1;
|
|
4412
|
+
this.modelId = modelId;
|
|
4413
|
+
this.settings = settings;
|
|
4414
|
+
this.config = config;
|
|
4415
|
+
}
|
|
4416
|
+
async doGenerate(options) {
|
|
4417
|
+
var _a16;
|
|
4418
|
+
const {
|
|
4419
|
+
prompt,
|
|
4420
|
+
n,
|
|
4421
|
+
size,
|
|
4422
|
+
aspectRatio,
|
|
4423
|
+
seed,
|
|
4424
|
+
files,
|
|
4425
|
+
mask,
|
|
4426
|
+
abortSignal,
|
|
4427
|
+
headers,
|
|
4428
|
+
providerOptions
|
|
4429
|
+
} = options;
|
|
4430
|
+
const openrouterOptions = (providerOptions == null ? void 0 : providerOptions.openrouter) || {};
|
|
4431
|
+
const warnings = [];
|
|
4432
|
+
if (mask !== void 0) {
|
|
4433
|
+
throw new UnsupportedFunctionalityError({
|
|
4434
|
+
functionality: "image inpainting (mask parameter)"
|
|
4435
|
+
});
|
|
4436
|
+
}
|
|
4437
|
+
if (n > 1) {
|
|
4438
|
+
warnings.push({
|
|
4439
|
+
type: "unsupported",
|
|
4440
|
+
feature: "n > 1",
|
|
4441
|
+
details: `OpenRouter image generation returns 1 image per call. Requested ${n} images.`
|
|
4442
|
+
});
|
|
4443
|
+
}
|
|
4444
|
+
if (size !== void 0) {
|
|
4445
|
+
warnings.push({
|
|
4446
|
+
type: "unsupported",
|
|
4447
|
+
feature: "size",
|
|
4448
|
+
details: "Use aspectRatio instead. Size parameter is not supported by OpenRouter image generation."
|
|
4449
|
+
});
|
|
4450
|
+
}
|
|
4451
|
+
const imageConfig = aspectRatio !== void 0 ? { aspect_ratio: aspectRatio } : void 0;
|
|
4452
|
+
const hasFiles = files !== void 0 && files.length > 0;
|
|
4453
|
+
const userContent = hasFiles ? [
|
|
4454
|
+
...files.map(
|
|
4455
|
+
(file) => convertImageFileToContentPart(file)
|
|
4456
|
+
),
|
|
4457
|
+
{ type: "text", text: prompt != null ? prompt : "" }
|
|
4458
|
+
] : prompt != null ? prompt : "";
|
|
4459
|
+
const body = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
4460
|
+
model: this.modelId,
|
|
4461
|
+
messages: [
|
|
4462
|
+
{
|
|
4463
|
+
role: "user",
|
|
4464
|
+
content: userContent
|
|
4465
|
+
}
|
|
4466
|
+
],
|
|
4467
|
+
modalities: ["image", "text"]
|
|
4468
|
+
}, imageConfig !== void 0 && { image_config: imageConfig }), seed !== void 0 && { seed }), this.settings.user !== void 0 && { user: this.settings.user }), this.settings.provider !== void 0 && {
|
|
4469
|
+
provider: this.settings.provider
|
|
4470
|
+
}), this.config.extraBody), this.settings.extraBody), openrouterOptions);
|
|
4471
|
+
const { value: responseValue, responseHeaders } = await postJsonToApi({
|
|
4472
|
+
url: this.config.url({
|
|
4473
|
+
path: "/chat/completions",
|
|
4474
|
+
modelId: this.modelId
|
|
4475
|
+
}),
|
|
4476
|
+
headers: combineHeaders(this.config.headers(), headers),
|
|
4477
|
+
body,
|
|
4478
|
+
failedResponseHandler: openrouterFailedResponseHandler,
|
|
4479
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
4480
|
+
OpenRouterImageResponseSchema
|
|
4481
|
+
),
|
|
4482
|
+
abortSignal,
|
|
4483
|
+
fetch: this.config.fetch
|
|
4484
|
+
});
|
|
4485
|
+
const choice = responseValue.choices[0];
|
|
4486
|
+
if (!choice) {
|
|
4487
|
+
throw new NoContentGeneratedError({
|
|
4488
|
+
message: "No choice in response"
|
|
4489
|
+
});
|
|
4490
|
+
}
|
|
4491
|
+
const images = [];
|
|
4492
|
+
if ((_a16 = choice.message) == null ? void 0 : _a16.images) {
|
|
4493
|
+
for (const image of choice.message.images) {
|
|
4494
|
+
const dataUrl = image.image_url.url;
|
|
4495
|
+
images.push(getBase64FromDataUrl(dataUrl));
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
4498
|
+
const usage = responseValue.usage ? {
|
|
4499
|
+
inputTokens: responseValue.usage.prompt_tokens,
|
|
4500
|
+
outputTokens: responseValue.usage.completion_tokens,
|
|
4501
|
+
totalTokens: responseValue.usage.total_tokens
|
|
4502
|
+
} : void 0;
|
|
4503
|
+
return {
|
|
4504
|
+
images,
|
|
4505
|
+
warnings,
|
|
4506
|
+
response: {
|
|
4507
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
4508
|
+
modelId: responseValue.model,
|
|
4509
|
+
headers: responseHeaders
|
|
4510
|
+
},
|
|
4511
|
+
usage
|
|
4512
|
+
};
|
|
4513
|
+
}
|
|
4514
|
+
};
|
|
4515
|
+
var DEFAULT_IMAGE_MEDIA_TYPE = "image/png";
|
|
4516
|
+
function convertImageFileToContentPart(file) {
|
|
4517
|
+
if (file.type === "url") {
|
|
4518
|
+
return {
|
|
4519
|
+
type: "image_url",
|
|
4520
|
+
image_url: { url: file.url }
|
|
4521
|
+
};
|
|
4522
|
+
}
|
|
4523
|
+
const url = buildFileDataUrl({
|
|
4524
|
+
data: file.data,
|
|
4525
|
+
mediaType: file.mediaType,
|
|
4526
|
+
defaultMediaType: DEFAULT_IMAGE_MEDIA_TYPE
|
|
4527
|
+
});
|
|
4528
|
+
return {
|
|
4529
|
+
type: "image_url",
|
|
4530
|
+
image_url: { url }
|
|
4531
|
+
};
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
// src/utils/remove-undefined.ts
|
|
4535
|
+
function removeUndefinedEntries(record) {
|
|
4536
|
+
return Object.fromEntries(
|
|
4537
|
+
Object.entries(record).filter(([, value]) => value != null)
|
|
4538
|
+
);
|
|
4539
|
+
}
|
|
4540
|
+
|
|
4541
|
+
// src/utils/with-user-agent-suffix.ts
|
|
4542
|
+
function normalizeHeaders2(headers) {
|
|
4543
|
+
if (!headers) {
|
|
4544
|
+
return {};
|
|
4545
|
+
}
|
|
4546
|
+
if (headers instanceof Headers) {
|
|
4547
|
+
return Object.fromEntries(headers.entries());
|
|
4548
|
+
}
|
|
4549
|
+
if (Array.isArray(headers)) {
|
|
4550
|
+
return Object.fromEntries(headers);
|
|
4551
|
+
}
|
|
4552
|
+
return headers;
|
|
4553
|
+
}
|
|
4554
|
+
function findHeaderKey(headers, targetKey) {
|
|
4555
|
+
const lowerTarget = targetKey.toLowerCase();
|
|
4556
|
+
return Object.keys(headers).find((key) => key.toLowerCase() === lowerTarget);
|
|
4557
|
+
}
|
|
4558
|
+
function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
|
|
4559
|
+
const normalizedHeaders = normalizeHeaders2(headers);
|
|
4560
|
+
const cleanedHeaders = removeUndefinedEntries(normalizedHeaders);
|
|
4561
|
+
const existingUserAgentKey = findHeaderKey(cleanedHeaders, "user-agent");
|
|
4562
|
+
const existingUserAgentValue = existingUserAgentKey ? cleanedHeaders[existingUserAgentKey] : void 0;
|
|
4563
|
+
const userAgent = (existingUserAgentValue == null ? void 0 : existingUserAgentValue.trim()) ? existingUserAgentValue : userAgentSuffixParts.filter(Boolean).join(" ");
|
|
4564
|
+
const headersWithoutUserAgent = Object.fromEntries(
|
|
4565
|
+
Object.entries(cleanedHeaders).filter(
|
|
4566
|
+
([key]) => key.toLowerCase() !== "user-agent"
|
|
4567
|
+
)
|
|
4568
|
+
);
|
|
4569
|
+
return __spreadProps(__spreadValues({}, headersWithoutUserAgent), {
|
|
4570
|
+
"user-agent": userAgent
|
|
4571
|
+
});
|
|
4572
|
+
}
|
|
4573
|
+
|
|
4574
|
+
// src/version.ts
|
|
4575
|
+
var VERSION2 = false ? "0.0.0-test" : "2.2.5";
|
|
4576
|
+
|
|
4577
|
+
// src/provider.ts
|
|
4578
|
+
function createOpenRouter(options = {}) {
|
|
4579
|
+
var _a16, _b16, _c;
|
|
4580
|
+
const baseURL = (_b16 = withoutTrailingSlash((_a16 = options.baseURL) != null ? _a16 : options.baseUrl)) != null ? _b16 : "https://openrouter.ai/api/v1";
|
|
4581
|
+
const compatibility = (_c = options.compatibility) != null ? _c : "compatible";
|
|
4582
|
+
const getHeaders = () => withUserAgentSuffix2(
|
|
4583
|
+
__spreadValues(__spreadValues({
|
|
4584
|
+
Authorization: `Bearer ${loadApiKey({
|
|
4585
|
+
apiKey: options.apiKey,
|
|
4586
|
+
environmentVariableName: "OPENROUTER_API_KEY",
|
|
4587
|
+
description: "OpenRouter"
|
|
4588
|
+
})}`
|
|
4589
|
+
}, options.headers), options.api_keys && Object.keys(options.api_keys).length > 0 && {
|
|
4590
|
+
"X-Provider-API-Keys": JSON.stringify(options.api_keys)
|
|
4591
|
+
}),
|
|
4592
|
+
`ai-sdk/openrouter/${VERSION2}`
|
|
4593
|
+
);
|
|
4594
|
+
const createChatModel = (modelId, settings = {}) => new OpenRouterChatLanguageModel(modelId, settings, {
|
|
4595
|
+
provider: "openrouter.chat",
|
|
4596
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
4597
|
+
headers: getHeaders,
|
|
4598
|
+
compatibility,
|
|
4599
|
+
fetch: options.fetch,
|
|
4600
|
+
extraBody: options.extraBody
|
|
4601
|
+
});
|
|
4602
|
+
const createCompletionModel = (modelId, settings = {}) => new OpenRouterCompletionLanguageModel(modelId, settings, {
|
|
4603
|
+
provider: "openrouter.completion",
|
|
4604
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
4605
|
+
headers: getHeaders,
|
|
4606
|
+
compatibility,
|
|
4607
|
+
fetch: options.fetch,
|
|
4608
|
+
extraBody: options.extraBody
|
|
4609
|
+
});
|
|
4610
|
+
const createEmbeddingModel = (modelId, settings = {}) => new OpenRouterEmbeddingModel(modelId, settings, {
|
|
4611
|
+
provider: "openrouter.embedding",
|
|
4612
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
4613
|
+
headers: getHeaders,
|
|
4614
|
+
fetch: options.fetch,
|
|
4615
|
+
extraBody: options.extraBody
|
|
4616
|
+
});
|
|
4617
|
+
const createImageModel = (modelId, settings = {}) => new OpenRouterImageModel(modelId, settings, {
|
|
4618
|
+
provider: "openrouter.image",
|
|
4619
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
4620
|
+
headers: getHeaders,
|
|
4621
|
+
fetch: options.fetch,
|
|
4622
|
+
extraBody: options.extraBody
|
|
4623
|
+
});
|
|
4624
|
+
const createLanguageModel = (modelId, settings) => {
|
|
4625
|
+
if (new.target) {
|
|
4626
|
+
throw new Error(
|
|
4627
|
+
"The OpenRouter model function cannot be called with the new keyword."
|
|
4628
|
+
);
|
|
4629
|
+
}
|
|
4630
|
+
if (modelId === "openai/gpt-3.5-turbo-instruct") {
|
|
4631
|
+
return createCompletionModel(
|
|
4632
|
+
modelId,
|
|
4633
|
+
settings
|
|
4634
|
+
);
|
|
4635
|
+
}
|
|
4636
|
+
return createChatModel(modelId, settings);
|
|
4637
|
+
};
|
|
4638
|
+
const provider = (modelId, settings) => createLanguageModel(modelId, settings);
|
|
4639
|
+
provider.languageModel = createLanguageModel;
|
|
4640
|
+
provider.chat = createChatModel;
|
|
4641
|
+
provider.completion = createCompletionModel;
|
|
4642
|
+
provider.textEmbeddingModel = createEmbeddingModel;
|
|
4643
|
+
provider.embedding = createEmbeddingModel;
|
|
4644
|
+
provider.imageModel = createImageModel;
|
|
4645
|
+
return provider;
|
|
4646
|
+
}
|
|
4647
|
+
var openrouter = createOpenRouter({
|
|
4648
|
+
compatibility: "strict"
|
|
4649
|
+
// strict for OpenRouter API
|
|
4650
|
+
});
|
|
4651
|
+
export {
|
|
4652
|
+
OpenRouter,
|
|
4653
|
+
createOpenRouter,
|
|
4654
|
+
openrouter
|
|
4655
|
+
};
|
|
4656
|
+
//# sourceMappingURL=index.mjs.map
|