@mastra/server 0.0.0-vector-sources-20250516175436 → 0.0.0-vector-extension-schema-20250922130418
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/CHANGELOG.md +3745 -0
- package/LICENSE.md +11 -42
- package/README.md +0 -5
- package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
- package/dist/chunk-4QCXUEAT.js.map +1 -0
- package/dist/chunk-4RRMWXQ2.js +3522 -0
- package/dist/chunk-4RRMWXQ2.js.map +1 -0
- package/dist/chunk-57HWW2TY.cjs +587 -0
- package/dist/chunk-57HWW2TY.cjs.map +1 -0
- package/dist/chunk-5DP5XZH6.cjs +928 -0
- package/dist/chunk-5DP5XZH6.cjs.map +1 -0
- package/dist/chunk-66YYHFGF.js +761 -0
- package/dist/chunk-66YYHFGF.js.map +1 -0
- package/dist/chunk-6GMFZ5LK.js +2774 -0
- package/dist/chunk-6GMFZ5LK.js.map +1 -0
- package/dist/chunk-743UIDHI.cjs +2013 -0
- package/dist/chunk-743UIDHI.cjs.map +1 -0
- package/dist/chunk-7JYXPDM4.js +15712 -0
- package/dist/chunk-7JYXPDM4.js.map +1 -0
- package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
- package/dist/chunk-7NADHFD2.cjs.map +1 -0
- package/dist/chunk-7QEJ5QG5.js +151 -0
- package/dist/chunk-7QEJ5QG5.js.map +1 -0
- package/dist/chunk-A3AL7EWJ.js +83 -0
- package/dist/chunk-A3AL7EWJ.js.map +1 -0
- package/dist/chunk-AK2FXLLB.cjs +849 -0
- package/dist/chunk-AK2FXLLB.cjs.map +1 -0
- package/dist/{chunk-5SN4U5AC.cjs → chunk-AVEPEUN4.cjs} +115 -138
- package/dist/chunk-AVEPEUN4.cjs.map +1 -0
- package/dist/chunk-CNU4A2XU.js +129 -0
- package/dist/chunk-CNU4A2XU.js.map +1 -0
- package/dist/chunk-CY4TP3FK.js +16 -0
- package/dist/chunk-CY4TP3FK.js.map +1 -0
- package/dist/chunk-EMMSS5I5.cjs +37 -0
- package/dist/chunk-EMMSS5I5.cjs.map +1 -0
- package/dist/chunk-EMNGA4R4.js +845 -0
- package/dist/chunk-EMNGA4R4.js.map +1 -0
- package/dist/chunk-FALVL2VV.cjs +3525 -0
- package/dist/chunk-FALVL2VV.cjs.map +1 -0
- package/dist/chunk-FQNT7PI4.js +937 -0
- package/dist/chunk-FQNT7PI4.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-G4PUALCE.cjs +28 -0
- package/dist/chunk-G4PUALCE.cjs.map +1 -0
- package/dist/chunk-G662L2YZ.js +568 -0
- package/dist/chunk-G662L2YZ.js.map +1 -0
- package/dist/chunk-GDWMF6SB.cjs +133 -0
- package/dist/chunk-GDWMF6SB.cjs.map +1 -0
- package/dist/chunk-GU4EWMZB.cjs +769 -0
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/chunk-GUI3CROV.cjs +159 -0
- package/dist/chunk-GUI3CROV.cjs.map +1 -0
- package/dist/chunk-HJQKWRKQ.cjs +764 -0
- package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
- package/dist/{chunk-YWLUOY3D.cjs → chunk-HVBBFCDH.cjs} +1110 -793
- package/dist/chunk-HVBBFCDH.cjs.map +1 -0
- package/dist/chunk-HZJRQ5L3.cjs +1411 -0
- package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
- package/dist/chunk-IGFMAZZ5.cjs +1150 -0
- package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
- package/dist/chunk-ILESGJ6N.js +524 -0
- package/dist/chunk-ILESGJ6N.js.map +1 -0
- package/dist/chunk-IOQGI4ML.js +931 -0
- package/dist/chunk-IOQGI4ML.js.map +1 -0
- package/dist/chunk-J7BPKKOG.cjs +163 -0
- package/dist/chunk-J7BPKKOG.cjs.map +1 -0
- package/dist/{chunk-HFWCEP5S.js → chunk-JRDEOHAJ.js} +47 -14
- package/dist/chunk-JRDEOHAJ.js.map +1 -0
- package/dist/chunk-KNGXRN26.cjs +335 -0
- package/dist/chunk-KNGXRN26.cjs.map +1 -0
- package/dist/{chunk-OR3CIE2H.js → chunk-KV6VHX4V.js} +29 -7
- package/dist/chunk-KV6VHX4V.js.map +1 -0
- package/dist/chunk-L265APUD.cjs +69 -0
- package/dist/chunk-L265APUD.cjs.map +1 -0
- package/dist/chunk-LF2ZLOFP.js +767 -0
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/chunk-LYPU75T6.js +1147 -0
- package/dist/chunk-LYPU75T6.js.map +1 -0
- package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
- package/dist/chunk-MMROOK5J.js.map +1 -0
- package/dist/chunk-N35YCWQ5.cjs +540 -0
- package/dist/chunk-N35YCWQ5.cjs.map +1 -0
- package/dist/{chunk-LIVAK2DM.js → chunk-N7F33WAD.js} +1083 -794
- package/dist/chunk-N7F33WAD.js.map +1 -0
- package/dist/chunk-NG5IVLEZ.js +1012 -0
- package/dist/chunk-NG5IVLEZ.js.map +1 -0
- package/dist/chunk-NLWACBE7.cjs +128 -0
- package/dist/chunk-NLWACBE7.cjs.map +1 -0
- package/dist/chunk-OGW6HHVI.js +1408 -0
- package/dist/chunk-OGW6HHVI.js.map +1 -0
- package/dist/chunk-OJQOYXHU.cjs +15748 -0
- package/dist/chunk-OJQOYXHU.cjs.map +1 -0
- package/dist/chunk-OZLRIVC4.cjs +588 -0
- package/dist/chunk-OZLRIVC4.cjs.map +1 -0
- package/dist/chunk-P7CIEIJ3.js +925 -0
- package/dist/chunk-P7CIEIJ3.js.map +1 -0
- package/dist/chunk-P7RBMCBE.cjs +934 -0
- package/dist/chunk-P7RBMCBE.cjs.map +1 -0
- package/dist/chunk-PPYGWINI.cjs +2777 -0
- package/dist/chunk-PPYGWINI.cjs.map +1 -0
- package/dist/{chunk-P6SCPDYW.js → chunk-PUYSH3IL.js} +114 -137
- package/dist/chunk-PUYSH3IL.js.map +1 -0
- package/dist/{chunk-MHKNLNAN.cjs → chunk-PWTXZZTR.cjs} +33 -10
- package/dist/chunk-PWTXZZTR.cjs.map +1 -0
- package/dist/chunk-R7NOGUZG.js +65 -0
- package/dist/chunk-R7NOGUZG.js.map +1 -0
- package/dist/chunk-RCHEPTZZ.js +2006 -0
- package/dist/chunk-RCHEPTZZ.js.map +1 -0
- package/dist/chunk-RE4RPXT2.cjs +18 -0
- package/dist/chunk-RE4RPXT2.cjs.map +1 -0
- package/dist/chunk-SIGXR3JT.cjs +1043 -0
- package/dist/chunk-SIGXR3JT.cjs.map +1 -0
- package/dist/chunk-SPLSYTYW.cjs +88 -0
- package/dist/chunk-SPLSYTYW.cjs.map +1 -0
- package/dist/chunk-SQY4T6EJ.js +571 -0
- package/dist/chunk-SQY4T6EJ.js.map +1 -0
- package/dist/{chunk-TJKLBTFB.js → chunk-SYRRSBGL.js} +51 -27
- package/dist/chunk-SYRRSBGL.js.map +1 -0
- package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
- package/dist/chunk-T3TIA3O6.cjs.map +1 -0
- package/dist/{chunk-EJO45KYT.js → chunk-TTHEEIZ3.js} +53 -50
- package/dist/chunk-TTHEEIZ3.js.map +1 -0
- package/dist/chunk-TVSIG4JE.cjs +940 -0
- package/dist/chunk-TVSIG4JE.cjs.map +1 -0
- package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
- package/dist/chunk-WHN4VX55.js.map +1 -0
- package/dist/dist-26HWEQY6.js +3 -0
- package/dist/dist-26HWEQY6.js.map +1 -0
- package/dist/dist-3A5DXB37.cjs +20 -0
- package/dist/dist-3A5DXB37.cjs.map +1 -0
- package/dist/dist-3SJKQJGY.cjs +16 -0
- package/dist/dist-3SJKQJGY.cjs.map +1 -0
- package/dist/dist-4ZQSPE5K.js +3 -0
- package/dist/dist-4ZQSPE5K.js.map +1 -0
- package/dist/dist-5W5QNRTD.js +3 -0
- package/dist/dist-5W5QNRTD.js.map +1 -0
- package/dist/dist-653SRMPL.js +3 -0
- package/dist/dist-653SRMPL.js.map +1 -0
- package/dist/dist-6U6EFC5C.cjs +16 -0
- package/dist/dist-6U6EFC5C.cjs.map +1 -0
- package/dist/dist-7IHNNYMF.cjs +16 -0
- package/dist/dist-7IHNNYMF.cjs.map +1 -0
- package/dist/dist-B5IPRF6W.js +3 -0
- package/dist/dist-B5IPRF6W.js.map +1 -0
- package/dist/dist-EOMYFT4Y.cjs +16 -0
- package/dist/dist-EOMYFT4Y.cjs.map +1 -0
- package/dist/dist-EZZMMMNT.cjs +16 -0
- package/dist/dist-EZZMMMNT.cjs.map +1 -0
- package/dist/dist-F2ET4MNO.cjs +16 -0
- package/dist/dist-F2ET4MNO.cjs.map +1 -0
- package/dist/dist-H64VX6DE.js +3 -0
- package/dist/dist-H64VX6DE.js.map +1 -0
- package/dist/dist-HY7RMLJQ.cjs +16 -0
- package/dist/dist-HY7RMLJQ.cjs.map +1 -0
- package/dist/dist-M6S4P3FJ.js +3 -0
- package/dist/dist-M6S4P3FJ.js.map +1 -0
- package/dist/dist-NR7QSCQT.js +3 -0
- package/dist/dist-NR7QSCQT.js.map +1 -0
- package/dist/dist-QLFMCMCX.js +3 -0
- package/dist/dist-QLFMCMCX.js.map +1 -0
- package/dist/dist-UY46BFRP.js +3 -0
- package/dist/dist-UY46BFRP.js.map +1 -0
- package/dist/dist-WCQDRTIV.cjs +16 -0
- package/dist/dist-WCQDRTIV.cjs.map +1 -0
- package/dist/dist-WKYB3LTJ.cjs +16 -0
- package/dist/dist-WKYB3LTJ.cjs.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server/a2a/protocol.d.ts +8 -0
- package/dist/server/a2a/protocol.d.ts.map +1 -0
- package/dist/server/a2a/store.cjs +25 -0
- package/dist/server/a2a/store.cjs.map +1 -0
- package/dist/server/a2a/store.d.ts +14 -0
- package/dist/server/a2a/store.d.ts.map +1 -0
- package/dist/server/a2a/store.js +23 -0
- package/dist/server/a2a/store.js.map +1 -0
- package/dist/server/a2a/tasks.d.ts +20 -0
- package/dist/server/a2a/tasks.d.ts.map +1 -0
- package/dist/server/handlers/a2a.cjs +13 -11
- package/dist/server/handlers/a2a.cjs.map +1 -0
- package/dist/server/handlers/a2a.d.ts +68 -6
- package/dist/server/handlers/a2a.d.ts.map +1 -0
- package/dist/server/handlers/a2a.js +3 -1
- package/dist/server/handlers/a2a.js.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +68 -0
- package/dist/server/handlers/agent-builder.cjs.map +1 -0
- package/dist/server/handlers/agent-builder.d.ts +88 -0
- package/dist/server/handlers/agent-builder.d.ts.map +1 -0
- package/dist/server/handlers/agent-builder.js +3 -0
- package/dist/server/handlers/agent-builder.js.map +1 -0
- package/dist/server/handlers/agents.cjs +41 -7
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +139 -6
- package/dist/server/handlers/agents.d.ts.map +1 -0
- package/dist/server/handlers/agents.js +3 -1
- package/dist/server/handlers/agents.js.map +1 -0
- package/dist/server/handlers/error.cjs +4 -2
- package/dist/server/handlers/error.cjs.map +1 -0
- package/dist/server/handlers/error.d.ts +2 -1
- package/dist/server/handlers/error.d.ts.map +1 -0
- package/dist/server/handlers/error.js +3 -1
- package/dist/server/handlers/error.js.map +1 -0
- package/dist/server/handlers/legacyWorkflows.cjs +48 -0
- package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
- package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
- package/dist/server/handlers/legacyWorkflows.js +3 -0
- package/dist/server/handlers/legacyWorkflows.js.map +1 -0
- package/dist/server/handlers/logs.cjs +6 -4
- package/dist/server/handlers/logs.cjs.map +1 -0
- package/dist/server/handlers/logs.d.ts +34 -3
- package/dist/server/handlers/logs.d.ts.map +1 -0
- package/dist/server/handlers/logs.js +3 -1
- package/dist/server/handlers/logs.js.map +1 -0
- package/dist/server/handlers/memory.cjs +39 -9
- package/dist/server/handlers/memory.cjs.map +1 -0
- package/dist/server/handlers/memory.d.ts +118 -8
- package/dist/server/handlers/memory.d.ts.map +1 -0
- package/dist/server/handlers/memory.js +3 -1
- package/dist/server/handlers/memory.js.map +1 -0
- package/dist/server/handlers/observability.cjs +16 -0
- package/dist/server/handlers/observability.cjs.map +1 -0
- package/dist/server/handlers/observability.d.ts +23 -0
- package/dist/server/handlers/observability.d.ts.map +1 -0
- package/dist/server/handlers/observability.js +3 -0
- package/dist/server/handlers/observability.js.map +1 -0
- package/dist/server/handlers/scores.cjs +32 -0
- package/dist/server/handlers/scores.cjs.map +1 -0
- package/dist/server/handlers/scores.d.ts +49 -0
- package/dist/server/handlers/scores.d.ts.map +1 -0
- package/dist/server/handlers/scores.js +3 -0
- package/dist/server/handlers/scores.js.map +1 -0
- package/dist/server/handlers/telemetry.cjs +9 -3
- package/dist/server/handlers/telemetry.cjs.map +1 -0
- package/dist/server/handlers/telemetry.d.ts +33 -2
- package/dist/server/handlers/telemetry.d.ts.map +1 -0
- package/dist/server/handlers/telemetry.js +3 -1
- package/dist/server/handlers/telemetry.js.map +1 -0
- package/dist/server/handlers/tools.cjs +11 -5
- package/dist/server/handlers/tools.cjs.map +1 -0
- package/dist/server/handlers/tools.d.ts +25 -4
- package/dist/server/handlers/tools.d.ts.map +1 -0
- package/dist/server/handlers/tools.js +3 -1
- package/dist/server/handlers/tools.js.map +1 -0
- package/dist/server/handlers/utils.cjs +8 -2
- package/dist/server/handlers/utils.cjs.map +1 -0
- package/dist/server/handlers/utils.d.ts +8 -1
- package/dist/server/handlers/utils.d.ts.map +1 -0
- package/dist/server/handlers/utils.js +3 -1
- package/dist/server/handlers/utils.js.map +1 -0
- package/dist/server/handlers/vNextNetwork.cjs +220 -0
- package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
- package/dist/server/handlers/vNextNetwork.d.ts +246 -0
- package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
- package/dist/server/handlers/vNextNetwork.js +213 -0
- package/dist/server/handlers/vNextNetwork.js.map +1 -0
- package/dist/server/handlers/vector.cjs +9 -7
- package/dist/server/handlers/vector.cjs.map +1 -0
- package/dist/server/handlers/vector.d.ts +51 -6
- package/dist/server/handlers/vector.d.ts.map +1 -0
- package/dist/server/handlers/vector.js +3 -1
- package/dist/server/handlers/vector.js.map +1 -0
- package/dist/server/handlers/voice.cjs +10 -4
- package/dist/server/handlers/voice.cjs.map +1 -0
- package/dist/server/handlers/voice.d.ts +41 -3
- package/dist/server/handlers/voice.d.ts.map +1 -0
- package/dist/server/handlers/voice.js +3 -1
- package/dist/server/handlers/voice.js.map +1 -0
- package/dist/server/handlers/workflows.cjs +43 -13
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +82 -10
- package/dist/server/handlers/workflows.d.ts.map +1 -0
- package/dist/server/handlers/workflows.js +3 -1
- package/dist/server/handlers/workflows.js.map +1 -0
- package/dist/server/handlers.cjs +44 -32
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +14 -11
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +15 -11
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/http-exception.d.ts +87 -0
- package/dist/server/http-exception.d.ts.map +1 -0
- package/dist/server/types.d.ts +10 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils.d.ts +44 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/package.json +51 -21
- package/dist/_tsup-dts-rollup.d.cts +0 -816
- package/dist/_tsup-dts-rollup.d.ts +0 -816
- package/dist/chunk-57CJTIPW.cjs +0 -18
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-C7564HUT.js +0 -142
- package/dist/chunk-D4IRYCUI.cjs +0 -235
- package/dist/chunk-DJJIUEL2.js +0 -211
- package/dist/chunk-HWZVAG3H.js +0 -49
- package/dist/chunk-I2B73Y4I.cjs +0 -332
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-MIQYDLLM.js +0 -329
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-OGCNNUHF.cjs +0 -54
- package/dist/chunk-UCTEMO2Q.cjs +0 -341
- package/dist/chunk-VPNDC2DI.cjs +0 -148
- package/dist/chunk-WUC6LSTW.js +0 -227
- package/dist/chunk-Y7UWRW5X.cjs +0 -221
- package/dist/chunk-YBVOQN4M.cjs +0 -94
- package/dist/chunk-ZE5AAC4I.cjs +0 -138
- package/dist/index.d.cts +0 -1
- package/dist/server/handlers/a2a.d.cts +0 -6
- package/dist/server/handlers/agents.d.cts +0 -6
- package/dist/server/handlers/error.d.cts +0 -1
- package/dist/server/handlers/logs.d.cts +0 -3
- package/dist/server/handlers/memory.d.cts +0 -8
- package/dist/server/handlers/network.cjs +0 -22
- package/dist/server/handlers/network.d.cts +0 -4
- package/dist/server/handlers/network.d.ts +0 -4
- package/dist/server/handlers/network.js +0 -1
- package/dist/server/handlers/telemetry.d.cts +0 -2
- package/dist/server/handlers/tools.d.cts +0 -4
- package/dist/server/handlers/utils.d.cts +0 -1
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
- package/dist/server/handlers/vector.d.cts +0 -6
- package/dist/server/handlers/voice.d.cts +0 -3
- package/dist/server/handlers/workflows.d.cts +0 -10
- package/dist/server/handlers.d.cts +0 -11
|
@@ -1,770 +1,422 @@
|
|
|
1
|
-
import { ZodFirstPartyTypeKind
|
|
1
|
+
import { ZodFirstPartyTypeKind } from 'zod';
|
|
2
2
|
|
|
3
|
-
// ../../node_modules/.pnpm
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider@2.0.0/node_modules/@ai-sdk/provider/dist/index.mjs
|
|
4
|
+
var marker = "vercel.ai.error";
|
|
5
|
+
var symbol = Symbol.for(marker);
|
|
6
|
+
var _a;
|
|
7
|
+
var _AISDKError = class _AISDKError2 extends Error {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an AI SDK Error.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} params - The parameters for creating the error.
|
|
12
|
+
* @param {string} params.name - The name of the error.
|
|
13
|
+
* @param {string} params.message - The error message.
|
|
14
|
+
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
15
|
+
*/
|
|
16
|
+
constructor({
|
|
17
|
+
name: name14,
|
|
18
|
+
message,
|
|
19
|
+
cause
|
|
20
|
+
}) {
|
|
21
|
+
super(message);
|
|
22
|
+
this[_a] = true;
|
|
23
|
+
this.name = name14;
|
|
24
|
+
this.cause = cause;
|
|
15
25
|
}
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the given error is an AI SDK Error.
|
|
28
|
+
* @param {unknown} error - The error to check.
|
|
29
|
+
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
30
|
+
*/
|
|
31
|
+
static isInstance(error) {
|
|
32
|
+
return _AISDKError2.hasMarker(error, marker);
|
|
18
33
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
static hasMarker(error, marker15) {
|
|
35
|
+
const markerSymbol = Symbol.for(marker15);
|
|
36
|
+
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
|
|
22
37
|
}
|
|
23
38
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
_a = symbol;
|
|
40
|
+
var AISDKError = _AISDKError;
|
|
41
|
+
var name = "AI_APICallError";
|
|
42
|
+
var marker2 = `vercel.ai.error.${name}`;
|
|
43
|
+
var symbol2 = Symbol.for(marker2);
|
|
44
|
+
var _a2;
|
|
45
|
+
var APICallError = class extends AISDKError {
|
|
46
|
+
constructor({
|
|
47
|
+
message,
|
|
48
|
+
url,
|
|
49
|
+
requestBodyValues,
|
|
50
|
+
statusCode,
|
|
51
|
+
responseHeaders,
|
|
52
|
+
responseBody,
|
|
53
|
+
cause,
|
|
54
|
+
isRetryable = statusCode != null && (statusCode === 408 || // request timeout
|
|
55
|
+
statusCode === 409 || // conflict
|
|
56
|
+
statusCode === 429 || // too many requests
|
|
57
|
+
statusCode >= 500),
|
|
58
|
+
// server error
|
|
59
|
+
data
|
|
60
|
+
}) {
|
|
61
|
+
super({ name, message, cause });
|
|
62
|
+
this[_a2] = true;
|
|
63
|
+
this.url = url;
|
|
64
|
+
this.requestBodyValues = requestBodyValues;
|
|
65
|
+
this.statusCode = statusCode;
|
|
66
|
+
this.responseHeaders = responseHeaders;
|
|
67
|
+
this.responseBody = responseBody;
|
|
68
|
+
this.isRetryable = isRetryable;
|
|
69
|
+
this.data = data;
|
|
70
|
+
}
|
|
71
|
+
static isInstance(error) {
|
|
72
|
+
return AISDKError.hasMarker(error, marker2);
|
|
48
73
|
}
|
|
49
74
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} else {
|
|
64
|
-
super.register(value, options);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
getAllowedProps(value) {
|
|
68
|
-
return this.classToAllowedProps.get(value);
|
|
75
|
+
_a2 = symbol2;
|
|
76
|
+
var name2 = "AI_EmptyResponseBodyError";
|
|
77
|
+
var marker3 = `vercel.ai.error.${name2}`;
|
|
78
|
+
var symbol3 = Symbol.for(marker3);
|
|
79
|
+
var _a3;
|
|
80
|
+
var EmptyResponseBodyError = class extends AISDKError {
|
|
81
|
+
// used in isInstance
|
|
82
|
+
constructor({ message = "Empty response body" } = {}) {
|
|
83
|
+
super({ name: name2, message });
|
|
84
|
+
this[_a3] = true;
|
|
85
|
+
}
|
|
86
|
+
static isInstance(error) {
|
|
87
|
+
return AISDKError.hasMarker(error, marker3);
|
|
69
88
|
}
|
|
70
89
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return Object.values(record);
|
|
76
|
-
}
|
|
77
|
-
const values = [];
|
|
78
|
-
for (const key in record) {
|
|
79
|
-
if (record.hasOwnProperty(key)) {
|
|
80
|
-
values.push(record[key]);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return values;
|
|
84
|
-
}
|
|
85
|
-
function find(record, predicate) {
|
|
86
|
-
const values = valuesOfObj(record);
|
|
87
|
-
if ("find" in values) {
|
|
88
|
-
return values.find(predicate);
|
|
90
|
+
_a3 = symbol3;
|
|
91
|
+
function getErrorMessage(error) {
|
|
92
|
+
if (error == null) {
|
|
93
|
+
return "unknown error";
|
|
89
94
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const value = valuesNotNever[i];
|
|
93
|
-
if (predicate(value)) {
|
|
94
|
-
return value;
|
|
95
|
-
}
|
|
95
|
+
if (typeof error === "string") {
|
|
96
|
+
return error;
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
function forEach(record, run) {
|
|
100
|
-
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
101
|
-
}
|
|
102
|
-
function includes(arr, value) {
|
|
103
|
-
return arr.indexOf(value) !== -1;
|
|
104
|
-
}
|
|
105
|
-
function findArr(record, predicate) {
|
|
106
|
-
for (let i = 0; i < record.length; i++) {
|
|
107
|
-
const value = record[i];
|
|
108
|
-
if (predicate(value)) {
|
|
109
|
-
return value;
|
|
110
|
-
}
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
return error.message;
|
|
111
100
|
}
|
|
112
|
-
return
|
|
101
|
+
return JSON.stringify(error);
|
|
113
102
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
103
|
+
var name3 = "AI_InvalidArgumentError";
|
|
104
|
+
var marker4 = `vercel.ai.error.${name3}`;
|
|
105
|
+
var symbol4 = Symbol.for(marker4);
|
|
106
|
+
var _a4;
|
|
107
|
+
var InvalidArgumentError = class extends AISDKError {
|
|
108
|
+
constructor({
|
|
109
|
+
message,
|
|
110
|
+
cause,
|
|
111
|
+
argument
|
|
112
|
+
}) {
|
|
113
|
+
super({ name: name3, message, cause });
|
|
114
|
+
this[_a4] = true;
|
|
115
|
+
this.argument = argument;
|
|
116
|
+
}
|
|
117
|
+
static isInstance(error) {
|
|
118
|
+
return AISDKError.hasMarker(error, marker4);
|
|
128
119
|
}
|
|
129
120
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
121
|
+
_a4 = symbol4;
|
|
122
|
+
var name4 = "AI_InvalidPromptError";
|
|
123
|
+
var marker5 = `vercel.ai.error.${name4}`;
|
|
124
|
+
var symbol5 = Symbol.for(marker5);
|
|
125
|
+
var _a5;
|
|
126
|
+
var InvalidPromptError = class extends AISDKError {
|
|
127
|
+
constructor({
|
|
128
|
+
prompt,
|
|
129
|
+
message,
|
|
130
|
+
cause
|
|
131
|
+
}) {
|
|
132
|
+
super({ name: name4, message: `Invalid prompt: ${message}`, cause });
|
|
133
|
+
this[_a5] = true;
|
|
134
|
+
this.prompt = prompt;
|
|
135
|
+
}
|
|
136
|
+
static isInstance(error) {
|
|
137
|
+
return AISDKError.hasMarker(error, marker5);
|
|
138
|
+
}
|
|
143
139
|
};
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var isURL = (payload) => payload instanceof URL;
|
|
161
|
-
|
|
162
|
-
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
|
|
163
|
-
var escapeKey = (key) => key.replace(/\./g, "\\.");
|
|
164
|
-
var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
|
|
165
|
-
var parsePath = (string) => {
|
|
166
|
-
const result = [];
|
|
167
|
-
let segment = "";
|
|
168
|
-
for (let i = 0; i < string.length; i++) {
|
|
169
|
-
let char = string.charAt(i);
|
|
170
|
-
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
171
|
-
if (isEscapedDot) {
|
|
172
|
-
segment += ".";
|
|
173
|
-
i++;
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
const isEndOfSegment = char === ".";
|
|
177
|
-
if (isEndOfSegment) {
|
|
178
|
-
result.push(segment);
|
|
179
|
-
segment = "";
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
segment += char;
|
|
140
|
+
_a5 = symbol5;
|
|
141
|
+
var name5 = "AI_InvalidResponseDataError";
|
|
142
|
+
var marker6 = `vercel.ai.error.${name5}`;
|
|
143
|
+
var symbol6 = Symbol.for(marker6);
|
|
144
|
+
var _a6;
|
|
145
|
+
var InvalidResponseDataError = class extends AISDKError {
|
|
146
|
+
constructor({
|
|
147
|
+
data,
|
|
148
|
+
message = `Invalid response data: ${JSON.stringify(data)}.`
|
|
149
|
+
}) {
|
|
150
|
+
super({ name: name5, message });
|
|
151
|
+
this[_a6] = true;
|
|
152
|
+
this.data = data;
|
|
153
|
+
}
|
|
154
|
+
static isInstance(error) {
|
|
155
|
+
return AISDKError.hasMarker(error, marker6);
|
|
183
156
|
}
|
|
184
|
-
const lastSegment = segment;
|
|
185
|
-
result.push(lastSegment);
|
|
186
|
-
return result;
|
|
187
157
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
201
|
-
if (typeof BigInt !== "undefined") {
|
|
202
|
-
return BigInt(v);
|
|
203
|
-
}
|
|
204
|
-
console.error("Please add a BigInt polyfill.");
|
|
205
|
-
return v;
|
|
206
|
-
}),
|
|
207
|
-
simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
|
|
208
|
-
simpleTransformation(isError, "Error", (v, superJson) => {
|
|
209
|
-
const baseError = {
|
|
210
|
-
name: v.name,
|
|
211
|
-
message: v.message
|
|
212
|
-
};
|
|
213
|
-
superJson.allowedErrorProps.forEach((prop) => {
|
|
214
|
-
baseError[prop] = v[prop];
|
|
215
|
-
});
|
|
216
|
-
return baseError;
|
|
217
|
-
}, (v, superJson) => {
|
|
218
|
-
const e = new Error(v.message);
|
|
219
|
-
e.name = v.name;
|
|
220
|
-
e.stack = v.stack;
|
|
221
|
-
superJson.allowedErrorProps.forEach((prop) => {
|
|
222
|
-
e[prop] = v[prop];
|
|
158
|
+
_a6 = symbol6;
|
|
159
|
+
var name6 = "AI_JSONParseError";
|
|
160
|
+
var marker7 = `vercel.ai.error.${name6}`;
|
|
161
|
+
var symbol7 = Symbol.for(marker7);
|
|
162
|
+
var _a7;
|
|
163
|
+
var JSONParseError = class extends AISDKError {
|
|
164
|
+
constructor({ text, cause }) {
|
|
165
|
+
super({
|
|
166
|
+
name: name6,
|
|
167
|
+
message: `JSON parsing failed: Text: ${text}.
|
|
168
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
169
|
+
cause
|
|
223
170
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
227
|
-
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
228
|
-
const flags = regex.slice(regex.lastIndexOf("/") + 1);
|
|
229
|
-
return new RegExp(body, flags);
|
|
230
|
-
}),
|
|
231
|
-
simpleTransformation(
|
|
232
|
-
isSet,
|
|
233
|
-
"set",
|
|
234
|
-
// (sets only exist in es6+)
|
|
235
|
-
// eslint-disable-next-line es5/no-es6-methods
|
|
236
|
-
(v) => [...v.values()],
|
|
237
|
-
(v) => new Set(v)
|
|
238
|
-
),
|
|
239
|
-
simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
|
|
240
|
-
simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
|
|
241
|
-
if (isNaNValue(v)) {
|
|
242
|
-
return "NaN";
|
|
243
|
-
}
|
|
244
|
-
if (v > 0) {
|
|
245
|
-
return "Infinity";
|
|
246
|
-
} else {
|
|
247
|
-
return "-Infinity";
|
|
248
|
-
}
|
|
249
|
-
}, Number),
|
|
250
|
-
simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
|
|
251
|
-
return "-0";
|
|
252
|
-
}, Number),
|
|
253
|
-
simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
|
|
254
|
-
];
|
|
255
|
-
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
256
|
-
return {
|
|
257
|
-
isApplicable,
|
|
258
|
-
annotation,
|
|
259
|
-
transform,
|
|
260
|
-
untransform
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
var symbolRule = compositeTransformation((s, superJson) => {
|
|
264
|
-
if (isSymbol(s)) {
|
|
265
|
-
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
|
|
266
|
-
return isRegistered;
|
|
267
|
-
}
|
|
268
|
-
return false;
|
|
269
|
-
}, (s, superJson) => {
|
|
270
|
-
const identifier = superJson.symbolRegistry.getIdentifier(s);
|
|
271
|
-
return ["symbol", identifier];
|
|
272
|
-
}, (v) => v.description, (_, a, superJson) => {
|
|
273
|
-
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
274
|
-
if (!value) {
|
|
275
|
-
throw new Error("Trying to deserialize unknown symbol");
|
|
276
|
-
}
|
|
277
|
-
return value;
|
|
278
|
-
});
|
|
279
|
-
var constructorToName = [
|
|
280
|
-
Int8Array,
|
|
281
|
-
Uint8Array,
|
|
282
|
-
Int16Array,
|
|
283
|
-
Uint16Array,
|
|
284
|
-
Int32Array,
|
|
285
|
-
Uint32Array,
|
|
286
|
-
Float32Array,
|
|
287
|
-
Float64Array,
|
|
288
|
-
Uint8ClampedArray
|
|
289
|
-
].reduce((obj, ctor) => {
|
|
290
|
-
obj[ctor.name] = ctor;
|
|
291
|
-
return obj;
|
|
292
|
-
}, {});
|
|
293
|
-
var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
|
|
294
|
-
const ctor = constructorToName[a[1]];
|
|
295
|
-
if (!ctor) {
|
|
296
|
-
throw new Error("Trying to deserialize unknown typed array");
|
|
297
|
-
}
|
|
298
|
-
return new ctor(v);
|
|
299
|
-
});
|
|
300
|
-
function isInstanceOfRegisteredClass(potentialClass, superJson) {
|
|
301
|
-
if (potentialClass?.constructor) {
|
|
302
|
-
const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
|
|
303
|
-
return isRegistered;
|
|
304
|
-
}
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
|
|
308
|
-
const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
|
|
309
|
-
return ["class", identifier];
|
|
310
|
-
}, (clazz, superJson) => {
|
|
311
|
-
const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
|
|
312
|
-
if (!allowedProps) {
|
|
313
|
-
return { ...clazz };
|
|
314
|
-
}
|
|
315
|
-
const result = {};
|
|
316
|
-
allowedProps.forEach((prop) => {
|
|
317
|
-
result[prop] = clazz[prop];
|
|
318
|
-
});
|
|
319
|
-
return result;
|
|
320
|
-
}, (v, a, superJson) => {
|
|
321
|
-
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
322
|
-
if (!clazz) {
|
|
323
|
-
throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
324
|
-
}
|
|
325
|
-
return Object.assign(Object.create(clazz.prototype), v);
|
|
326
|
-
});
|
|
327
|
-
var customRule = compositeTransformation((value, superJson) => {
|
|
328
|
-
return !!superJson.customTransformerRegistry.findApplicable(value);
|
|
329
|
-
}, (value, superJson) => {
|
|
330
|
-
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
331
|
-
return ["custom", transformer.name];
|
|
332
|
-
}, (value, superJson) => {
|
|
333
|
-
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
334
|
-
return transformer.serialize(value);
|
|
335
|
-
}, (v, a, superJson) => {
|
|
336
|
-
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
337
|
-
if (!transformer) {
|
|
338
|
-
throw new Error("Trying to deserialize unknown custom value");
|
|
339
|
-
}
|
|
340
|
-
return transformer.deserialize(v);
|
|
341
|
-
});
|
|
342
|
-
var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
|
|
343
|
-
var transformValue = (value, superJson) => {
|
|
344
|
-
const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
|
|
345
|
-
if (applicableCompositeRule) {
|
|
346
|
-
return {
|
|
347
|
-
value: applicableCompositeRule.transform(value, superJson),
|
|
348
|
-
type: applicableCompositeRule.annotation(value, superJson)
|
|
349
|
-
};
|
|
171
|
+
this[_a7] = true;
|
|
172
|
+
this.text = text;
|
|
350
173
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return {
|
|
354
|
-
value: applicableSimpleRule.transform(value, superJson),
|
|
355
|
-
type: applicableSimpleRule.annotation
|
|
356
|
-
};
|
|
174
|
+
static isInstance(error) {
|
|
175
|
+
return AISDKError.hasMarker(error, marker7);
|
|
357
176
|
}
|
|
358
|
-
return void 0;
|
|
359
177
|
};
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
case "typed-array":
|
|
374
|
-
return typedArrayRule.untransform(json, type, superJson);
|
|
375
|
-
default:
|
|
376
|
-
throw new Error("Unknown transformation: " + type);
|
|
377
|
-
}
|
|
378
|
-
} else {
|
|
379
|
-
const transformation = simpleRulesByAnnotation[type];
|
|
380
|
-
if (!transformation) {
|
|
381
|
-
throw new Error("Unknown transformation: " + type);
|
|
382
|
-
}
|
|
383
|
-
return transformation.untransform(json, superJson);
|
|
178
|
+
_a7 = symbol7;
|
|
179
|
+
var name7 = "AI_LoadAPIKeyError";
|
|
180
|
+
var marker8 = `vercel.ai.error.${name7}`;
|
|
181
|
+
var symbol8 = Symbol.for(marker8);
|
|
182
|
+
var _a8;
|
|
183
|
+
var LoadAPIKeyError = class extends AISDKError {
|
|
184
|
+
// used in isInstance
|
|
185
|
+
constructor({ message }) {
|
|
186
|
+
super({ name: name7, message });
|
|
187
|
+
this[_a8] = true;
|
|
188
|
+
}
|
|
189
|
+
static isInstance(error) {
|
|
190
|
+
return AISDKError.hasMarker(error, marker8);
|
|
384
191
|
}
|
|
385
192
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
var
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
if (includes(path, "constructor")) {
|
|
406
|
-
throw new Error("constructor is not allowed as a property");
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
var getDeep = (object, path) => {
|
|
410
|
-
validatePath(path);
|
|
411
|
-
for (let i = 0; i < path.length; i++) {
|
|
412
|
-
const key = path[i];
|
|
413
|
-
if (isSet(object)) {
|
|
414
|
-
object = getNthKey(object, +key);
|
|
415
|
-
} else if (isMap(object)) {
|
|
416
|
-
const row = +key;
|
|
417
|
-
const type = +path[++i] === 0 ? "key" : "value";
|
|
418
|
-
const keyOfRow = getNthKey(object, row);
|
|
419
|
-
switch (type) {
|
|
420
|
-
case "key":
|
|
421
|
-
object = keyOfRow;
|
|
422
|
-
break;
|
|
423
|
-
case "value":
|
|
424
|
-
object = object.get(keyOfRow);
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
} else {
|
|
428
|
-
object = object[key];
|
|
429
|
-
}
|
|
193
|
+
_a8 = symbol8;
|
|
194
|
+
var name10 = "AI_NoSuchModelError";
|
|
195
|
+
var marker11 = `vercel.ai.error.${name10}`;
|
|
196
|
+
var symbol11 = Symbol.for(marker11);
|
|
197
|
+
var _a11;
|
|
198
|
+
var NoSuchModelError = class extends AISDKError {
|
|
199
|
+
constructor({
|
|
200
|
+
errorName = name10,
|
|
201
|
+
modelId,
|
|
202
|
+
modelType,
|
|
203
|
+
message = `No such ${modelType}: ${modelId}`
|
|
204
|
+
}) {
|
|
205
|
+
super({ name: errorName, message });
|
|
206
|
+
this[_a11] = true;
|
|
207
|
+
this.modelId = modelId;
|
|
208
|
+
this.modelType = modelType;
|
|
209
|
+
}
|
|
210
|
+
static isInstance(error) {
|
|
211
|
+
return AISDKError.hasMarker(error, marker11);
|
|
430
212
|
}
|
|
431
|
-
return object;
|
|
432
213
|
};
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
} else if (isMap(parent)) {
|
|
450
|
-
const isEnd = i === path.length - 2;
|
|
451
|
-
if (isEnd) {
|
|
452
|
-
break;
|
|
453
|
-
}
|
|
454
|
-
const row = +key;
|
|
455
|
-
const type = +path[++i] === 0 ? "key" : "value";
|
|
456
|
-
const keyOfRow = getNthKey(parent, row);
|
|
457
|
-
switch (type) {
|
|
458
|
-
case "key":
|
|
459
|
-
parent = keyOfRow;
|
|
460
|
-
break;
|
|
461
|
-
case "value":
|
|
462
|
-
parent = parent.get(keyOfRow);
|
|
463
|
-
break;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
const lastKey = path[path.length - 1];
|
|
468
|
-
if (isArray(parent)) {
|
|
469
|
-
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
470
|
-
} else if (isPlainObject(parent)) {
|
|
471
|
-
parent[lastKey] = mapper(parent[lastKey]);
|
|
472
|
-
}
|
|
473
|
-
if (isSet(parent)) {
|
|
474
|
-
const oldValue = getNthKey(parent, +lastKey);
|
|
475
|
-
const newValue = mapper(oldValue);
|
|
476
|
-
if (oldValue !== newValue) {
|
|
477
|
-
parent.delete(oldValue);
|
|
478
|
-
parent.add(newValue);
|
|
479
|
-
}
|
|
214
|
+
_a11 = symbol11;
|
|
215
|
+
var name11 = "AI_TooManyEmbeddingValuesForCallError";
|
|
216
|
+
var marker12 = `vercel.ai.error.${name11}`;
|
|
217
|
+
var symbol12 = Symbol.for(marker12);
|
|
218
|
+
var _a12;
|
|
219
|
+
var TooManyEmbeddingValuesForCallError = class extends AISDKError {
|
|
220
|
+
constructor(options) {
|
|
221
|
+
super({
|
|
222
|
+
name: name11,
|
|
223
|
+
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.`
|
|
224
|
+
});
|
|
225
|
+
this[_a12] = true;
|
|
226
|
+
this.provider = options.provider;
|
|
227
|
+
this.modelId = options.modelId;
|
|
228
|
+
this.maxEmbeddingsPerCall = options.maxEmbeddingsPerCall;
|
|
229
|
+
this.values = options.values;
|
|
480
230
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
const keyToRow = getNthKey(parent, row);
|
|
484
|
-
const type = +lastKey === 0 ? "key" : "value";
|
|
485
|
-
switch (type) {
|
|
486
|
-
case "key": {
|
|
487
|
-
const newKey = mapper(keyToRow);
|
|
488
|
-
parent.set(newKey, parent.get(keyToRow));
|
|
489
|
-
if (newKey !== keyToRow) {
|
|
490
|
-
parent.delete(keyToRow);
|
|
491
|
-
}
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
case "value": {
|
|
495
|
-
parent.set(keyToRow, mapper(parent.get(keyToRow)));
|
|
496
|
-
break;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
231
|
+
static isInstance(error) {
|
|
232
|
+
return AISDKError.hasMarker(error, marker12);
|
|
499
233
|
}
|
|
500
|
-
return object;
|
|
501
234
|
};
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
forEach(children, (child, key) => {
|
|
515
|
-
traverse(child, walker2, [...origin, ...parsePath(key)]);
|
|
235
|
+
_a12 = symbol12;
|
|
236
|
+
var name12 = "AI_TypeValidationError";
|
|
237
|
+
var marker13 = `vercel.ai.error.${name12}`;
|
|
238
|
+
var symbol13 = Symbol.for(marker13);
|
|
239
|
+
var _a13;
|
|
240
|
+
var _TypeValidationError = class _TypeValidationError2 extends AISDKError {
|
|
241
|
+
constructor({ value, cause }) {
|
|
242
|
+
super({
|
|
243
|
+
name: name12,
|
|
244
|
+
message: `Type validation failed: Value: ${JSON.stringify(value)}.
|
|
245
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
246
|
+
cause
|
|
516
247
|
});
|
|
248
|
+
this[_a13] = true;
|
|
249
|
+
this.value = value;
|
|
517
250
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
function applyValueAnnotations(plain, annotations, superJson) {
|
|
521
|
-
traverse(annotations, (type, path) => {
|
|
522
|
-
plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
|
|
523
|
-
});
|
|
524
|
-
return plain;
|
|
525
|
-
}
|
|
526
|
-
function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
527
|
-
function apply(identicalPaths, path) {
|
|
528
|
-
const object = getDeep(plain, parsePath(path));
|
|
529
|
-
identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
|
|
530
|
-
plain = setDeep(plain, identicalObjectPath, () => object);
|
|
531
|
-
});
|
|
251
|
+
static isInstance(error) {
|
|
252
|
+
return AISDKError.hasMarker(error, marker13);
|
|
532
253
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Wraps an error into a TypeValidationError.
|
|
256
|
+
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
257
|
+
* Otherwise, it creates a new TypeValidationError.
|
|
258
|
+
*
|
|
259
|
+
* @param {Object} params - The parameters for wrapping the error.
|
|
260
|
+
* @param {unknown} params.value - The value that failed validation.
|
|
261
|
+
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
262
|
+
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
263
|
+
*/
|
|
264
|
+
static wrap({
|
|
265
|
+
value,
|
|
266
|
+
cause
|
|
267
|
+
}) {
|
|
268
|
+
return _TypeValidationError2.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError2({ value, cause });
|
|
543
269
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
270
|
+
};
|
|
271
|
+
_a13 = symbol13;
|
|
272
|
+
var TypeValidationError = _TypeValidationError;
|
|
273
|
+
var name13 = "AI_UnsupportedFunctionalityError";
|
|
274
|
+
var marker14 = `vercel.ai.error.${name13}`;
|
|
275
|
+
var symbol14 = Symbol.for(marker14);
|
|
276
|
+
var _a14;
|
|
277
|
+
var UnsupportedFunctionalityError = class extends AISDKError {
|
|
278
|
+
constructor({
|
|
279
|
+
functionality,
|
|
280
|
+
message = `'${functionality}' functionality not supported.`
|
|
281
|
+
}) {
|
|
282
|
+
super({ name: name13, message });
|
|
283
|
+
this[_a14] = true;
|
|
284
|
+
this.functionality = functionality;
|
|
285
|
+
}
|
|
286
|
+
static isInstance(error) {
|
|
287
|
+
return AISDKError.hasMarker(error, marker14);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
_a14 = symbol14;
|
|
291
|
+
|
|
292
|
+
// ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/index.js
|
|
293
|
+
var ParseError = class extends Error {
|
|
294
|
+
constructor(message, options) {
|
|
295
|
+
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
553
296
|
}
|
|
297
|
+
};
|
|
298
|
+
function noop(_arg) {
|
|
554
299
|
}
|
|
555
|
-
function
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
300
|
+
function createParser(callbacks) {
|
|
301
|
+
if (typeof callbacks == "function")
|
|
302
|
+
throw new TypeError(
|
|
303
|
+
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
304
|
+
);
|
|
305
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
306
|
+
let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
|
|
307
|
+
function feed(newChunk) {
|
|
308
|
+
const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
|
|
309
|
+
for (const line of complete)
|
|
310
|
+
parseLine(line);
|
|
311
|
+
incompleteLine = incomplete, isFirstChunk = false;
|
|
312
|
+
}
|
|
313
|
+
function parseLine(line) {
|
|
314
|
+
if (line === "") {
|
|
315
|
+
dispatchEvent();
|
|
560
316
|
return;
|
|
561
317
|
}
|
|
562
|
-
if (
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
const [representativePath, ...identicalPaths] = paths;
|
|
566
|
-
if (representativePath.length === 0) {
|
|
567
|
-
rootEqualityPaths = identicalPaths.map(stringifyPath);
|
|
568
|
-
} else {
|
|
569
|
-
result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
if (rootEqualityPaths) {
|
|
573
|
-
if (isEmptyObject(result)) {
|
|
574
|
-
return [rootEqualityPaths];
|
|
575
|
-
} else {
|
|
576
|
-
return [rootEqualityPaths, result];
|
|
318
|
+
if (line.startsWith(":")) {
|
|
319
|
+
onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
|
|
320
|
+
return;
|
|
577
321
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
const primitive = isPrimitive(object);
|
|
584
|
-
if (!primitive) {
|
|
585
|
-
addIdentity(object, path, identities);
|
|
586
|
-
const seen = seenObjects.get(object);
|
|
587
|
-
if (seen) {
|
|
588
|
-
return dedupe ? {
|
|
589
|
-
transformedValue: null
|
|
590
|
-
} : seen;
|
|
322
|
+
const fieldSeparatorIndex = line.indexOf(":");
|
|
323
|
+
if (fieldSeparatorIndex !== -1) {
|
|
324
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
325
|
+
processField(field, value, line);
|
|
326
|
+
return;
|
|
591
327
|
}
|
|
328
|
+
processField(line, "", line);
|
|
592
329
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
330
|
+
function processField(field, value, line) {
|
|
331
|
+
switch (field) {
|
|
332
|
+
case "event":
|
|
333
|
+
eventType = value;
|
|
334
|
+
break;
|
|
335
|
+
case "data":
|
|
336
|
+
data = `${data}${value}
|
|
337
|
+
`;
|
|
338
|
+
break;
|
|
339
|
+
case "id":
|
|
340
|
+
id = value.includes("\0") ? void 0 : value;
|
|
341
|
+
break;
|
|
342
|
+
case "retry":
|
|
343
|
+
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
344
|
+
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
345
|
+
type: "invalid-retry",
|
|
346
|
+
value,
|
|
347
|
+
line
|
|
348
|
+
})
|
|
349
|
+
);
|
|
350
|
+
break;
|
|
351
|
+
default:
|
|
352
|
+
onError(
|
|
353
|
+
new ParseError(
|
|
354
|
+
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
355
|
+
{ type: "unknown-field", field, value, line }
|
|
356
|
+
)
|
|
357
|
+
);
|
|
358
|
+
break;
|
|
603
359
|
}
|
|
604
|
-
return result2;
|
|
605
360
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
forEach(transformed, (value, index) => {
|
|
616
|
-
if (index === "__proto__" || index === "constructor" || index === "prototype") {
|
|
617
|
-
throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
|
|
618
|
-
}
|
|
619
|
-
const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
|
|
620
|
-
transformedValue[index] = recursiveResult.transformedValue;
|
|
621
|
-
if (isArray(recursiveResult.annotations)) {
|
|
622
|
-
innerAnnotations[index] = recursiveResult.annotations;
|
|
623
|
-
} else if (isPlainObject(recursiveResult.annotations)) {
|
|
624
|
-
forEach(recursiveResult.annotations, (tree, key) => {
|
|
625
|
-
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
const result = isEmptyObject(innerAnnotations) ? {
|
|
630
|
-
transformedValue,
|
|
631
|
-
annotations: !!transformationResult ? [transformationResult.type] : void 0
|
|
632
|
-
} : {
|
|
633
|
-
transformedValue,
|
|
634
|
-
annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
|
|
635
|
-
};
|
|
636
|
-
if (!primitive) {
|
|
637
|
-
seenObjects.set(object, result);
|
|
361
|
+
function dispatchEvent() {
|
|
362
|
+
data.length > 0 && onEvent({
|
|
363
|
+
id,
|
|
364
|
+
event: eventType || void 0,
|
|
365
|
+
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
366
|
+
// then remove the last character from the data buffer.
|
|
367
|
+
data: data.endsWith(`
|
|
368
|
+
`) ? data.slice(0, -1) : data
|
|
369
|
+
}), id = void 0, data = "", eventType = "";
|
|
638
370
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
// ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
643
|
-
function getType2(payload) {
|
|
644
|
-
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
645
|
-
}
|
|
646
|
-
function isArray2(payload) {
|
|
647
|
-
return getType2(payload) === "Array";
|
|
648
|
-
}
|
|
649
|
-
function isPlainObject2(payload) {
|
|
650
|
-
if (getType2(payload) !== "Object")
|
|
651
|
-
return false;
|
|
652
|
-
const prototype = Object.getPrototypeOf(payload);
|
|
653
|
-
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
657
|
-
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
658
|
-
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
659
|
-
if (propType === "enumerable")
|
|
660
|
-
carry[key] = newVal;
|
|
661
|
-
if (includeNonenumerable && propType === "nonenumerable") {
|
|
662
|
-
Object.defineProperty(carry, key, {
|
|
663
|
-
value: newVal,
|
|
664
|
-
enumerable: false,
|
|
665
|
-
writable: true,
|
|
666
|
-
configurable: true
|
|
667
|
-
});
|
|
371
|
+
function reset(options = {}) {
|
|
372
|
+
incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
|
|
668
373
|
}
|
|
374
|
+
return { feed, reset };
|
|
669
375
|
}
|
|
670
|
-
function
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
376
|
+
function splitLines(chunk) {
|
|
377
|
+
const lines = [];
|
|
378
|
+
let incompleteLine = "", searchIndex = 0;
|
|
379
|
+
for (; searchIndex < chunk.length; ) {
|
|
380
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
381
|
+
`, searchIndex);
|
|
382
|
+
let lineEnd = -1;
|
|
383
|
+
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) {
|
|
384
|
+
incompleteLine = chunk.slice(searchIndex);
|
|
385
|
+
break;
|
|
386
|
+
} else {
|
|
387
|
+
const line = chunk.slice(searchIndex, lineEnd);
|
|
388
|
+
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
389
|
+
` && searchIndex++;
|
|
682
390
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
assignProp(carry, key, newVal, target, options.nonenumerable);
|
|
686
|
-
return carry;
|
|
687
|
-
}, {});
|
|
391
|
+
}
|
|
392
|
+
return [lines, incompleteLine];
|
|
688
393
|
}
|
|
689
394
|
|
|
690
|
-
// ../../node_modules/.pnpm/
|
|
691
|
-
var
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
...res.meta,
|
|
711
|
-
values: output.annotations
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
|
|
715
|
-
if (equalityAnnotations) {
|
|
716
|
-
res.meta = {
|
|
717
|
-
...res.meta,
|
|
718
|
-
referentialEqualities: equalityAnnotations
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
return res;
|
|
722
|
-
}
|
|
723
|
-
deserialize(payload) {
|
|
724
|
-
const { json, meta } = payload;
|
|
725
|
-
let result = copy(json);
|
|
726
|
-
if (meta?.values) {
|
|
727
|
-
result = applyValueAnnotations(result, meta.values, this);
|
|
728
|
-
}
|
|
729
|
-
if (meta?.referentialEqualities) {
|
|
730
|
-
result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
|
|
731
|
-
}
|
|
732
|
-
return result;
|
|
733
|
-
}
|
|
734
|
-
stringify(object) {
|
|
735
|
-
return JSON.stringify(this.serialize(object));
|
|
736
|
-
}
|
|
737
|
-
parse(string) {
|
|
738
|
-
return this.deserialize(JSON.parse(string));
|
|
739
|
-
}
|
|
740
|
-
registerClass(v, options) {
|
|
741
|
-
this.classRegistry.register(v, options);
|
|
742
|
-
}
|
|
743
|
-
registerSymbol(v, identifier) {
|
|
744
|
-
this.symbolRegistry.register(v, identifier);
|
|
745
|
-
}
|
|
746
|
-
registerCustom(transformer, name) {
|
|
747
|
-
this.customTransformerRegistry.register({
|
|
748
|
-
name,
|
|
749
|
-
...transformer
|
|
395
|
+
// ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/stream.js
|
|
396
|
+
var EventSourceParserStream = class extends TransformStream {
|
|
397
|
+
constructor({ onError, onRetry, onComment } = {}) {
|
|
398
|
+
let parser;
|
|
399
|
+
super({
|
|
400
|
+
start(controller) {
|
|
401
|
+
parser = createParser({
|
|
402
|
+
onEvent: (event) => {
|
|
403
|
+
controller.enqueue(event);
|
|
404
|
+
},
|
|
405
|
+
onError(error) {
|
|
406
|
+
onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
|
|
407
|
+
},
|
|
408
|
+
onRetry,
|
|
409
|
+
onComment
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
transform(chunk) {
|
|
413
|
+
parser.feed(chunk);
|
|
414
|
+
}
|
|
750
415
|
});
|
|
751
416
|
}
|
|
752
|
-
allowErrorProps(...props) {
|
|
753
|
-
this.allowedErrorProps.push(...props);
|
|
754
|
-
}
|
|
755
417
|
};
|
|
756
|
-
SuperJSON.defaultInstance = new SuperJSON();
|
|
757
|
-
SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
|
|
758
|
-
SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
|
|
759
|
-
SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
|
|
760
|
-
SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
|
|
761
|
-
SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
|
|
762
|
-
SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
|
|
763
|
-
SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
|
|
764
|
-
SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
|
|
765
|
-
var stringify = SuperJSON.stringify;
|
|
766
418
|
|
|
767
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
419
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
768
420
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
769
421
|
var defaultOptions = {
|
|
770
422
|
name: void 0,
|
|
@@ -787,7 +439,8 @@ var defaultOptions = {
|
|
|
787
439
|
applyRegexFlags: false,
|
|
788
440
|
emailStrategy: "format:email",
|
|
789
441
|
base64Strategy: "contentEncoding:base64",
|
|
790
|
-
nameStrategy: "ref"
|
|
442
|
+
nameStrategy: "ref",
|
|
443
|
+
openAiAnyTypeName: "OpenAiAnyType"
|
|
791
444
|
};
|
|
792
445
|
var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
793
446
|
...defaultOptions,
|
|
@@ -797,19 +450,20 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
797
450
|
...options
|
|
798
451
|
};
|
|
799
452
|
|
|
800
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
453
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
801
454
|
var getRefs = (options) => {
|
|
802
455
|
const _options = getDefaultOptions(options);
|
|
803
456
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
804
457
|
return {
|
|
805
458
|
..._options,
|
|
459
|
+
flags: { hasReferencedOpenAiAnyType: false },
|
|
806
460
|
currentPath,
|
|
807
461
|
propertyPath: void 0,
|
|
808
|
-
seen: new Map(Object.entries(_options.definitions).map(([
|
|
462
|
+
seen: new Map(Object.entries(_options.definitions).map(([name14, def]) => [
|
|
809
463
|
def._def,
|
|
810
464
|
{
|
|
811
465
|
def: def._def,
|
|
812
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
466
|
+
path: [..._options.basePath, _options.definitionPath, name14],
|
|
813
467
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
814
468
|
jsonSchema: void 0
|
|
815
469
|
}
|
|
@@ -817,7 +471,7 @@ var getRefs = (options) => {
|
|
|
817
471
|
};
|
|
818
472
|
};
|
|
819
473
|
|
|
820
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
474
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
821
475
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
822
476
|
if (!refs?.errorMessages)
|
|
823
477
|
return;
|
|
@@ -833,9 +487,30 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
833
487
|
addErrorMessage(res, key, errorMessage, refs);
|
|
834
488
|
}
|
|
835
489
|
|
|
836
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
837
|
-
|
|
838
|
-
|
|
490
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
491
|
+
var getRelativePath = (pathA, pathB) => {
|
|
492
|
+
let i = 0;
|
|
493
|
+
for (; i < pathA.length && i < pathB.length; i++) {
|
|
494
|
+
if (pathA[i] !== pathB[i])
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
501
|
+
function parseAnyDef(refs) {
|
|
502
|
+
if (refs.target !== "openAi") {
|
|
503
|
+
return {};
|
|
504
|
+
}
|
|
505
|
+
const anyDefinitionPath = [
|
|
506
|
+
...refs.basePath,
|
|
507
|
+
refs.definitionPath,
|
|
508
|
+
refs.openAiAnyTypeName
|
|
509
|
+
];
|
|
510
|
+
refs.flags.hasReferencedOpenAiAnyType = true;
|
|
511
|
+
return {
|
|
512
|
+
$ref: refs.$refStrategy === "relative" ? getRelativePath(anyDefinitionPath, refs.currentPath) : anyDefinitionPath.join("/")
|
|
513
|
+
};
|
|
839
514
|
}
|
|
840
515
|
function parseArrayDef(def, refs) {
|
|
841
516
|
const res = {
|
|
@@ -860,7 +535,7 @@ function parseArrayDef(def, refs) {
|
|
|
860
535
|
return res;
|
|
861
536
|
}
|
|
862
537
|
|
|
863
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
538
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
864
539
|
function parseBigintDef(def, refs) {
|
|
865
540
|
const res = {
|
|
866
541
|
type: "integer",
|
|
@@ -906,24 +581,24 @@ function parseBigintDef(def, refs) {
|
|
|
906
581
|
return res;
|
|
907
582
|
}
|
|
908
583
|
|
|
909
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
584
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
910
585
|
function parseBooleanDef() {
|
|
911
586
|
return {
|
|
912
587
|
type: "boolean"
|
|
913
588
|
};
|
|
914
589
|
}
|
|
915
590
|
|
|
916
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
591
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
917
592
|
function parseBrandedDef(_def, refs) {
|
|
918
593
|
return parseDef(_def.type._def, refs);
|
|
919
594
|
}
|
|
920
595
|
|
|
921
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
596
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
922
597
|
var parseCatchDef = (def, refs) => {
|
|
923
598
|
return parseDef(def.innerType._def, refs);
|
|
924
599
|
};
|
|
925
600
|
|
|
926
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
601
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
927
602
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
928
603
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
929
604
|
if (Array.isArray(strategy)) {
|
|
@@ -982,7 +657,7 @@ var integerDateParser = (def, refs) => {
|
|
|
982
657
|
return res;
|
|
983
658
|
};
|
|
984
659
|
|
|
985
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
660
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
986
661
|
function parseDefaultDef(_def, refs) {
|
|
987
662
|
return {
|
|
988
663
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -990,12 +665,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
990
665
|
};
|
|
991
666
|
}
|
|
992
667
|
|
|
993
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
668
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
994
669
|
function parseEffectsDef(_def, refs) {
|
|
995
|
-
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) :
|
|
670
|
+
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
996
671
|
}
|
|
997
672
|
|
|
998
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
673
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
999
674
|
function parseEnumDef(def) {
|
|
1000
675
|
return {
|
|
1001
676
|
type: "string",
|
|
@@ -1003,7 +678,7 @@ function parseEnumDef(def) {
|
|
|
1003
678
|
};
|
|
1004
679
|
}
|
|
1005
680
|
|
|
1006
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
681
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
1007
682
|
var isJsonSchema7AllOfType = (type) => {
|
|
1008
683
|
if ("type" in type && type.type === "string")
|
|
1009
684
|
return false;
|
|
@@ -1045,7 +720,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
1045
720
|
} : void 0;
|
|
1046
721
|
}
|
|
1047
722
|
|
|
1048
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
723
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
1049
724
|
function parseLiteralDef(def, refs) {
|
|
1050
725
|
const parsedType = typeof def.value;
|
|
1051
726
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
@@ -1065,7 +740,7 @@ function parseLiteralDef(def, refs) {
|
|
|
1065
740
|
};
|
|
1066
741
|
}
|
|
1067
742
|
|
|
1068
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
743
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
1069
744
|
var emojiRegex = void 0;
|
|
1070
745
|
var zodPatterns = {
|
|
1071
746
|
/**
|
|
@@ -1377,7 +1052,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
1377
1052
|
return pattern;
|
|
1378
1053
|
}
|
|
1379
1054
|
|
|
1380
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1055
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
1381
1056
|
function parseRecordDef(def, refs) {
|
|
1382
1057
|
if (refs.target === "openAi") {
|
|
1383
1058
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -1391,7 +1066,7 @@ function parseRecordDef(def, refs) {
|
|
|
1391
1066
|
[key]: parseDef(def.valueType._def, {
|
|
1392
1067
|
...refs,
|
|
1393
1068
|
currentPath: [...refs.currentPath, "properties", key]
|
|
1394
|
-
}) ??
|
|
1069
|
+
}) ?? parseAnyDef(refs)
|
|
1395
1070
|
}), {}),
|
|
1396
1071
|
additionalProperties: refs.rejectedAdditionalProperties
|
|
1397
1072
|
};
|
|
@@ -1429,7 +1104,7 @@ function parseRecordDef(def, refs) {
|
|
|
1429
1104
|
return schema;
|
|
1430
1105
|
}
|
|
1431
1106
|
|
|
1432
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1107
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
1433
1108
|
function parseMapDef(def, refs) {
|
|
1434
1109
|
if (refs.mapStrategy === "record") {
|
|
1435
1110
|
return parseRecordDef(def, refs);
|
|
@@ -1437,11 +1112,11 @@ function parseMapDef(def, refs) {
|
|
|
1437
1112
|
const keys = parseDef(def.keyType._def, {
|
|
1438
1113
|
...refs,
|
|
1439
1114
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
1440
|
-
}) ||
|
|
1115
|
+
}) || parseAnyDef(refs);
|
|
1441
1116
|
const values = parseDef(def.valueType._def, {
|
|
1442
1117
|
...refs,
|
|
1443
1118
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
1444
|
-
}) ||
|
|
1119
|
+
}) || parseAnyDef(refs);
|
|
1445
1120
|
return {
|
|
1446
1121
|
type: "array",
|
|
1447
1122
|
maxItems: 125,
|
|
@@ -1454,7 +1129,7 @@ function parseMapDef(def, refs) {
|
|
|
1454
1129
|
};
|
|
1455
1130
|
}
|
|
1456
1131
|
|
|
1457
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1132
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
1458
1133
|
function parseNativeEnumDef(def) {
|
|
1459
1134
|
const object = def.values;
|
|
1460
1135
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
@@ -1468,14 +1143,17 @@ function parseNativeEnumDef(def) {
|
|
|
1468
1143
|
};
|
|
1469
1144
|
}
|
|
1470
1145
|
|
|
1471
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1472
|
-
function parseNeverDef() {
|
|
1473
|
-
return {
|
|
1474
|
-
not: {
|
|
1146
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
1147
|
+
function parseNeverDef(refs) {
|
|
1148
|
+
return refs.target === "openAi" ? void 0 : {
|
|
1149
|
+
not: parseAnyDef({
|
|
1150
|
+
...refs,
|
|
1151
|
+
currentPath: [...refs.currentPath, "not"]
|
|
1152
|
+
})
|
|
1475
1153
|
};
|
|
1476
1154
|
}
|
|
1477
1155
|
|
|
1478
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1156
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
1479
1157
|
function parseNullDef(refs) {
|
|
1480
1158
|
return refs.target === "openApi3" ? {
|
|
1481
1159
|
enum: ["null"],
|
|
@@ -1485,7 +1163,7 @@ function parseNullDef(refs) {
|
|
|
1485
1163
|
};
|
|
1486
1164
|
}
|
|
1487
1165
|
|
|
1488
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1166
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
1489
1167
|
var primitiveMappings = {
|
|
1490
1168
|
ZodString: "string",
|
|
1491
1169
|
ZodNumber: "number",
|
|
@@ -1553,7 +1231,7 @@ var asAnyOf = (def, refs) => {
|
|
|
1553
1231
|
return anyOf.length ? { anyOf } : void 0;
|
|
1554
1232
|
};
|
|
1555
1233
|
|
|
1556
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1234
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
1557
1235
|
function parseNullableDef(def, refs) {
|
|
1558
1236
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
1559
1237
|
if (refs.target === "openApi3") {
|
|
@@ -1585,7 +1263,7 @@ function parseNullableDef(def, refs) {
|
|
|
1585
1263
|
return base && { anyOf: [base, { type: "null" }] };
|
|
1586
1264
|
}
|
|
1587
1265
|
|
|
1588
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1266
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
1589
1267
|
function parseNumberDef(def, refs) {
|
|
1590
1268
|
const res = {
|
|
1591
1269
|
type: "number"
|
|
@@ -1633,6 +1311,8 @@ function parseNumberDef(def, refs) {
|
|
|
1633
1311
|
}
|
|
1634
1312
|
return res;
|
|
1635
1313
|
}
|
|
1314
|
+
|
|
1315
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
1636
1316
|
function parseObjectDef(def, refs) {
|
|
1637
1317
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
1638
1318
|
const result = {
|
|
@@ -1648,7 +1328,7 @@ function parseObjectDef(def, refs) {
|
|
|
1648
1328
|
}
|
|
1649
1329
|
let propOptional = safeIsOptional(propDef);
|
|
1650
1330
|
if (propOptional && forceOptionalIntoNullable) {
|
|
1651
|
-
if (propDef
|
|
1331
|
+
if (propDef._def.typeName === "ZodOptional") {
|
|
1652
1332
|
propDef = propDef._def.innerType;
|
|
1653
1333
|
}
|
|
1654
1334
|
if (!propDef.isNullable()) {
|
|
@@ -1702,7 +1382,7 @@ function safeIsOptional(schema) {
|
|
|
1702
1382
|
}
|
|
1703
1383
|
}
|
|
1704
1384
|
|
|
1705
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1385
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
1706
1386
|
var parseOptionalDef = (def, refs) => {
|
|
1707
1387
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
1708
1388
|
return parseDef(def.innerType._def, refs);
|
|
@@ -1714,14 +1394,14 @@ var parseOptionalDef = (def, refs) => {
|
|
|
1714
1394
|
return innerSchema ? {
|
|
1715
1395
|
anyOf: [
|
|
1716
1396
|
{
|
|
1717
|
-
not:
|
|
1397
|
+
not: parseAnyDef(refs)
|
|
1718
1398
|
},
|
|
1719
1399
|
innerSchema
|
|
1720
1400
|
]
|
|
1721
|
-
} :
|
|
1401
|
+
} : parseAnyDef(refs);
|
|
1722
1402
|
};
|
|
1723
1403
|
|
|
1724
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1404
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
1725
1405
|
var parsePipelineDef = (def, refs) => {
|
|
1726
1406
|
if (refs.pipeStrategy === "input") {
|
|
1727
1407
|
return parseDef(def.in._def, refs);
|
|
@@ -1741,12 +1421,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
1741
1421
|
};
|
|
1742
1422
|
};
|
|
1743
1423
|
|
|
1744
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1424
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1745
1425
|
function parsePromiseDef(def, refs) {
|
|
1746
1426
|
return parseDef(def.type._def, refs);
|
|
1747
1427
|
}
|
|
1748
1428
|
|
|
1749
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1429
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
1750
1430
|
function parseSetDef(def, refs) {
|
|
1751
1431
|
const items = parseDef(def.valueType._def, {
|
|
1752
1432
|
...refs,
|
|
@@ -1766,7 +1446,7 @@ function parseSetDef(def, refs) {
|
|
|
1766
1446
|
return schema;
|
|
1767
1447
|
}
|
|
1768
1448
|
|
|
1769
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1449
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
1770
1450
|
function parseTupleDef(def, refs) {
|
|
1771
1451
|
if (def.rest) {
|
|
1772
1452
|
return {
|
|
@@ -1794,24 +1474,24 @@ function parseTupleDef(def, refs) {
|
|
|
1794
1474
|
}
|
|
1795
1475
|
}
|
|
1796
1476
|
|
|
1797
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1798
|
-
function parseUndefinedDef() {
|
|
1477
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
1478
|
+
function parseUndefinedDef(refs) {
|
|
1799
1479
|
return {
|
|
1800
|
-
not:
|
|
1480
|
+
not: parseAnyDef(refs)
|
|
1801
1481
|
};
|
|
1802
1482
|
}
|
|
1803
1483
|
|
|
1804
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1805
|
-
function parseUnknownDef() {
|
|
1806
|
-
return
|
|
1484
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
1485
|
+
function parseUnknownDef(refs) {
|
|
1486
|
+
return parseAnyDef(refs);
|
|
1807
1487
|
}
|
|
1808
1488
|
|
|
1809
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1489
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
1810
1490
|
var parseReadonlyDef = (def, refs) => {
|
|
1811
1491
|
return parseDef(def.innerType._def, refs);
|
|
1812
1492
|
};
|
|
1813
1493
|
|
|
1814
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1494
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
1815
1495
|
var selectParser = (def, typeName, refs) => {
|
|
1816
1496
|
switch (typeName) {
|
|
1817
1497
|
case ZodFirstPartyTypeKind.ZodString:
|
|
@@ -1827,7 +1507,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
1827
1507
|
case ZodFirstPartyTypeKind.ZodDate:
|
|
1828
1508
|
return parseDateDef(def, refs);
|
|
1829
1509
|
case ZodFirstPartyTypeKind.ZodUndefined:
|
|
1830
|
-
return parseUndefinedDef();
|
|
1510
|
+
return parseUndefinedDef(refs);
|
|
1831
1511
|
case ZodFirstPartyTypeKind.ZodNull:
|
|
1832
1512
|
return parseNullDef(refs);
|
|
1833
1513
|
case ZodFirstPartyTypeKind.ZodArray:
|
|
@@ -1861,13 +1541,13 @@ var selectParser = (def, typeName, refs) => {
|
|
|
1861
1541
|
return parsePromiseDef(def, refs);
|
|
1862
1542
|
case ZodFirstPartyTypeKind.ZodNaN:
|
|
1863
1543
|
case ZodFirstPartyTypeKind.ZodNever:
|
|
1864
|
-
return parseNeverDef();
|
|
1544
|
+
return parseNeverDef(refs);
|
|
1865
1545
|
case ZodFirstPartyTypeKind.ZodEffects:
|
|
1866
1546
|
return parseEffectsDef(def, refs);
|
|
1867
1547
|
case ZodFirstPartyTypeKind.ZodAny:
|
|
1868
|
-
return parseAnyDef();
|
|
1548
|
+
return parseAnyDef(refs);
|
|
1869
1549
|
case ZodFirstPartyTypeKind.ZodUnknown:
|
|
1870
|
-
return parseUnknownDef();
|
|
1550
|
+
return parseUnknownDef(refs);
|
|
1871
1551
|
case ZodFirstPartyTypeKind.ZodDefault:
|
|
1872
1552
|
return parseDefaultDef(def, refs);
|
|
1873
1553
|
case ZodFirstPartyTypeKind.ZodBranded:
|
|
@@ -1887,7 +1567,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
1887
1567
|
}
|
|
1888
1568
|
};
|
|
1889
1569
|
|
|
1890
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1570
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
1891
1571
|
function parseDef(def, refs, forceResolution = false) {
|
|
1892
1572
|
const seenItem = refs.seen.get(def);
|
|
1893
1573
|
if (refs.override) {
|
|
@@ -1927,20 +1607,12 @@ var get$ref = (item, refs) => {
|
|
|
1927
1607
|
case "seen": {
|
|
1928
1608
|
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
1929
1609
|
console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
|
|
1930
|
-
return
|
|
1610
|
+
return parseAnyDef(refs);
|
|
1931
1611
|
}
|
|
1932
|
-
return refs.$refStrategy === "seen" ?
|
|
1612
|
+
return refs.$refStrategy === "seen" ? parseAnyDef(refs) : void 0;
|
|
1933
1613
|
}
|
|
1934
1614
|
}
|
|
1935
1615
|
};
|
|
1936
|
-
var getRelativePath = (pathA, pathB) => {
|
|
1937
|
-
let i = 0;
|
|
1938
|
-
for (; i < pathA.length && i < pathB.length; i++) {
|
|
1939
|
-
if (pathA[i] !== pathB[i])
|
|
1940
|
-
break;
|
|
1941
|
-
}
|
|
1942
|
-
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
1943
|
-
};
|
|
1944
1616
|
var addMeta = (def, refs, jsonSchema) => {
|
|
1945
1617
|
if (def.description) {
|
|
1946
1618
|
jsonSchema.description = def.description;
|
|
@@ -1951,37 +1623,55 @@ var addMeta = (def, refs, jsonSchema) => {
|
|
|
1951
1623
|
return jsonSchema;
|
|
1952
1624
|
};
|
|
1953
1625
|
|
|
1954
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1626
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1955
1627
|
var zodToJsonSchema = (schema, options) => {
|
|
1956
1628
|
const refs = getRefs(options);
|
|
1957
|
-
|
|
1629
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name15, schema2]) => ({
|
|
1958
1630
|
...acc,
|
|
1959
|
-
[
|
|
1631
|
+
[name15]: parseDef(schema2._def, {
|
|
1960
1632
|
...refs,
|
|
1961
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1962
|
-
}, true) ??
|
|
1633
|
+
currentPath: [...refs.basePath, refs.definitionPath, name15]
|
|
1634
|
+
}, true) ?? parseAnyDef(refs)
|
|
1963
1635
|
}), {}) : void 0;
|
|
1964
|
-
const
|
|
1965
|
-
const main = parseDef(schema._def,
|
|
1636
|
+
const name14 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
1637
|
+
const main = parseDef(schema._def, name14 === void 0 ? refs : {
|
|
1966
1638
|
...refs,
|
|
1967
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1968
|
-
}, false) ??
|
|
1639
|
+
currentPath: [...refs.basePath, refs.definitionPath, name14]
|
|
1640
|
+
}, false) ?? parseAnyDef(refs);
|
|
1969
1641
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
1970
1642
|
if (title !== void 0) {
|
|
1971
1643
|
main.title = title;
|
|
1972
1644
|
}
|
|
1973
|
-
|
|
1645
|
+
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
1646
|
+
if (!definitions) {
|
|
1647
|
+
definitions = {};
|
|
1648
|
+
}
|
|
1649
|
+
if (!definitions[refs.openAiAnyTypeName]) {
|
|
1650
|
+
definitions[refs.openAiAnyTypeName] = {
|
|
1651
|
+
// Skipping "object" as no properties can be defined and additionalProperties must be "false"
|
|
1652
|
+
type: ["string", "number", "integer", "boolean", "array", "null"],
|
|
1653
|
+
items: {
|
|
1654
|
+
$ref: refs.$refStrategy === "relative" ? "1" : [
|
|
1655
|
+
...refs.basePath,
|
|
1656
|
+
refs.definitionPath,
|
|
1657
|
+
refs.openAiAnyTypeName
|
|
1658
|
+
].join("/")
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
const combined = name14 === void 0 ? definitions ? {
|
|
1974
1664
|
...main,
|
|
1975
1665
|
[refs.definitionPath]: definitions
|
|
1976
1666
|
} : main : {
|
|
1977
1667
|
$ref: [
|
|
1978
1668
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
1979
1669
|
refs.definitionPath,
|
|
1980
|
-
|
|
1670
|
+
name14
|
|
1981
1671
|
].join("/"),
|
|
1982
1672
|
[refs.definitionPath]: {
|
|
1983
1673
|
...definitions,
|
|
1984
|
-
[
|
|
1674
|
+
[name14]: main
|
|
1985
1675
|
}
|
|
1986
1676
|
};
|
|
1987
1677
|
if (refs.target === "jsonSchema7") {
|
|
@@ -1995,7 +1685,606 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
1995
1685
|
return combined;
|
|
1996
1686
|
};
|
|
1997
1687
|
|
|
1998
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.
|
|
1688
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
1999
1689
|
var esm_default = zodToJsonSchema;
|
|
2000
1690
|
|
|
2001
|
-
|
|
1691
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.3_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
1692
|
+
function combineHeaders(...headers) {
|
|
1693
|
+
return headers.reduce(
|
|
1694
|
+
(combinedHeaders, currentHeaders) => ({
|
|
1695
|
+
...combinedHeaders,
|
|
1696
|
+
...currentHeaders != null ? currentHeaders : {}
|
|
1697
|
+
}),
|
|
1698
|
+
{}
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
function extractResponseHeaders(response) {
|
|
1702
|
+
return Object.fromEntries([...response.headers]);
|
|
1703
|
+
}
|
|
1704
|
+
var createIdGenerator = ({
|
|
1705
|
+
prefix,
|
|
1706
|
+
size = 16,
|
|
1707
|
+
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
1708
|
+
separator = "-"
|
|
1709
|
+
} = {}) => {
|
|
1710
|
+
const generator = () => {
|
|
1711
|
+
const alphabetLength = alphabet.length;
|
|
1712
|
+
const chars = new Array(size);
|
|
1713
|
+
for (let i = 0; i < size; i++) {
|
|
1714
|
+
chars[i] = alphabet[Math.random() * alphabetLength | 0];
|
|
1715
|
+
}
|
|
1716
|
+
return chars.join("");
|
|
1717
|
+
};
|
|
1718
|
+
if (prefix == null) {
|
|
1719
|
+
return generator;
|
|
1720
|
+
}
|
|
1721
|
+
if (alphabet.includes(separator)) {
|
|
1722
|
+
throw new InvalidArgumentError({
|
|
1723
|
+
argument: "separator",
|
|
1724
|
+
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
return () => `${prefix}${separator}${generator()}`;
|
|
1728
|
+
};
|
|
1729
|
+
var generateId = createIdGenerator();
|
|
1730
|
+
function isAbortError(error) {
|
|
1731
|
+
return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
|
|
1732
|
+
error.name === "TimeoutError");
|
|
1733
|
+
}
|
|
1734
|
+
var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
|
|
1735
|
+
function handleFetchError({
|
|
1736
|
+
error,
|
|
1737
|
+
url,
|
|
1738
|
+
requestBodyValues
|
|
1739
|
+
}) {
|
|
1740
|
+
if (isAbortError(error)) {
|
|
1741
|
+
return error;
|
|
1742
|
+
}
|
|
1743
|
+
if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
|
|
1744
|
+
const cause = error.cause;
|
|
1745
|
+
if (cause != null) {
|
|
1746
|
+
return new APICallError({
|
|
1747
|
+
message: `Cannot connect to API: ${cause.message}`,
|
|
1748
|
+
cause,
|
|
1749
|
+
url,
|
|
1750
|
+
requestBodyValues,
|
|
1751
|
+
isRetryable: true
|
|
1752
|
+
// retry when network error
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return error;
|
|
1757
|
+
}
|
|
1758
|
+
function removeUndefinedEntries(record) {
|
|
1759
|
+
return Object.fromEntries(
|
|
1760
|
+
Object.entries(record).filter(([_key, value]) => value != null)
|
|
1761
|
+
);
|
|
1762
|
+
}
|
|
1763
|
+
function loadApiKey({
|
|
1764
|
+
apiKey,
|
|
1765
|
+
environmentVariableName,
|
|
1766
|
+
apiKeyParameterName = "apiKey",
|
|
1767
|
+
description
|
|
1768
|
+
}) {
|
|
1769
|
+
if (typeof apiKey === "string") {
|
|
1770
|
+
return apiKey;
|
|
1771
|
+
}
|
|
1772
|
+
if (apiKey != null) {
|
|
1773
|
+
throw new LoadAPIKeyError({
|
|
1774
|
+
message: `${description} API key must be a string.`
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
if (typeof process === "undefined") {
|
|
1778
|
+
throw new LoadAPIKeyError({
|
|
1779
|
+
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
apiKey = process.env[environmentVariableName];
|
|
1783
|
+
if (apiKey == null) {
|
|
1784
|
+
throw new LoadAPIKeyError({
|
|
1785
|
+
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
if (typeof apiKey !== "string") {
|
|
1789
|
+
throw new LoadAPIKeyError({
|
|
1790
|
+
message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
return apiKey;
|
|
1794
|
+
}
|
|
1795
|
+
var suspectProtoRx = /"__proto__"\s*:/;
|
|
1796
|
+
var suspectConstructorRx = /"constructor"\s*:/;
|
|
1797
|
+
function _parse(text) {
|
|
1798
|
+
const obj = JSON.parse(text);
|
|
1799
|
+
if (obj === null || typeof obj !== "object") {
|
|
1800
|
+
return obj;
|
|
1801
|
+
}
|
|
1802
|
+
if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
|
|
1803
|
+
return obj;
|
|
1804
|
+
}
|
|
1805
|
+
return filter(obj);
|
|
1806
|
+
}
|
|
1807
|
+
function filter(obj) {
|
|
1808
|
+
let next = [obj];
|
|
1809
|
+
while (next.length) {
|
|
1810
|
+
const nodes = next;
|
|
1811
|
+
next = [];
|
|
1812
|
+
for (const node of nodes) {
|
|
1813
|
+
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
1814
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1815
|
+
}
|
|
1816
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
1817
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1818
|
+
}
|
|
1819
|
+
for (const key in node) {
|
|
1820
|
+
const value = node[key];
|
|
1821
|
+
if (value && typeof value === "object") {
|
|
1822
|
+
next.push(value);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
return obj;
|
|
1828
|
+
}
|
|
1829
|
+
function secureJsonParse(text) {
|
|
1830
|
+
const { stackTraceLimit } = Error;
|
|
1831
|
+
Error.stackTraceLimit = 0;
|
|
1832
|
+
try {
|
|
1833
|
+
return _parse(text);
|
|
1834
|
+
} finally {
|
|
1835
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
var validatorSymbol = Symbol.for("vercel.ai.validator");
|
|
1839
|
+
function validator(validate) {
|
|
1840
|
+
return { [validatorSymbol]: true, validate };
|
|
1841
|
+
}
|
|
1842
|
+
function isValidator(value) {
|
|
1843
|
+
return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;
|
|
1844
|
+
}
|
|
1845
|
+
function asValidator(value) {
|
|
1846
|
+
return isValidator(value) ? value : standardSchemaValidator(value);
|
|
1847
|
+
}
|
|
1848
|
+
function standardSchemaValidator(standardSchema) {
|
|
1849
|
+
return validator(async (value) => {
|
|
1850
|
+
const result = await standardSchema["~standard"].validate(value);
|
|
1851
|
+
return result.issues == null ? { success: true, value: result.value } : {
|
|
1852
|
+
success: false,
|
|
1853
|
+
error: new TypeValidationError({
|
|
1854
|
+
value,
|
|
1855
|
+
cause: result.issues
|
|
1856
|
+
})
|
|
1857
|
+
};
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
async function validateTypes({
|
|
1861
|
+
value,
|
|
1862
|
+
schema
|
|
1863
|
+
}) {
|
|
1864
|
+
const result = await safeValidateTypes({ value, schema });
|
|
1865
|
+
if (!result.success) {
|
|
1866
|
+
throw TypeValidationError.wrap({ value, cause: result.error });
|
|
1867
|
+
}
|
|
1868
|
+
return result.value;
|
|
1869
|
+
}
|
|
1870
|
+
async function safeValidateTypes({
|
|
1871
|
+
value,
|
|
1872
|
+
schema
|
|
1873
|
+
}) {
|
|
1874
|
+
const validator2 = asValidator(schema);
|
|
1875
|
+
try {
|
|
1876
|
+
if (validator2.validate == null) {
|
|
1877
|
+
return { success: true, value, rawValue: value };
|
|
1878
|
+
}
|
|
1879
|
+
const result = await validator2.validate(value);
|
|
1880
|
+
if (result.success) {
|
|
1881
|
+
return { success: true, value: result.value, rawValue: value };
|
|
1882
|
+
}
|
|
1883
|
+
return {
|
|
1884
|
+
success: false,
|
|
1885
|
+
error: TypeValidationError.wrap({ value, cause: result.error }),
|
|
1886
|
+
rawValue: value
|
|
1887
|
+
};
|
|
1888
|
+
} catch (error) {
|
|
1889
|
+
return {
|
|
1890
|
+
success: false,
|
|
1891
|
+
error: TypeValidationError.wrap({ value, cause: error }),
|
|
1892
|
+
rawValue: value
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
async function parseJSON({
|
|
1897
|
+
text,
|
|
1898
|
+
schema
|
|
1899
|
+
}) {
|
|
1900
|
+
try {
|
|
1901
|
+
const value = secureJsonParse(text);
|
|
1902
|
+
if (schema == null) {
|
|
1903
|
+
return value;
|
|
1904
|
+
}
|
|
1905
|
+
return validateTypes({ value, schema });
|
|
1906
|
+
} catch (error) {
|
|
1907
|
+
if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
|
|
1908
|
+
throw error;
|
|
1909
|
+
}
|
|
1910
|
+
throw new JSONParseError({ text, cause: error });
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
async function safeParseJSON({
|
|
1914
|
+
text,
|
|
1915
|
+
schema
|
|
1916
|
+
}) {
|
|
1917
|
+
try {
|
|
1918
|
+
const value = secureJsonParse(text);
|
|
1919
|
+
if (schema == null) {
|
|
1920
|
+
return { success: true, value, rawValue: value };
|
|
1921
|
+
}
|
|
1922
|
+
return await safeValidateTypes({ value, schema });
|
|
1923
|
+
} catch (error) {
|
|
1924
|
+
return {
|
|
1925
|
+
success: false,
|
|
1926
|
+
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text, cause: error }),
|
|
1927
|
+
rawValue: void 0
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
function isParsableJson(input) {
|
|
1932
|
+
try {
|
|
1933
|
+
secureJsonParse(input);
|
|
1934
|
+
return true;
|
|
1935
|
+
} catch (e) {
|
|
1936
|
+
return false;
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
function parseJsonEventStream({
|
|
1940
|
+
stream,
|
|
1941
|
+
schema
|
|
1942
|
+
}) {
|
|
1943
|
+
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
|
|
1944
|
+
new TransformStream({
|
|
1945
|
+
async transform({ data }, controller) {
|
|
1946
|
+
if (data === "[DONE]") {
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
controller.enqueue(await safeParseJSON({ text: data, schema }));
|
|
1950
|
+
}
|
|
1951
|
+
})
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1954
|
+
async function parseProviderOptions({
|
|
1955
|
+
provider,
|
|
1956
|
+
providerOptions,
|
|
1957
|
+
schema
|
|
1958
|
+
}) {
|
|
1959
|
+
if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
|
|
1960
|
+
return void 0;
|
|
1961
|
+
}
|
|
1962
|
+
const parsedProviderOptions = await safeValidateTypes({
|
|
1963
|
+
value: providerOptions[provider],
|
|
1964
|
+
schema
|
|
1965
|
+
});
|
|
1966
|
+
if (!parsedProviderOptions.success) {
|
|
1967
|
+
throw new InvalidArgumentError({
|
|
1968
|
+
argument: "providerOptions",
|
|
1969
|
+
message: `invalid ${provider} provider options`,
|
|
1970
|
+
cause: parsedProviderOptions.error
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
return parsedProviderOptions.value;
|
|
1974
|
+
}
|
|
1975
|
+
var getOriginalFetch2 = () => globalThis.fetch;
|
|
1976
|
+
var postJsonToApi = async ({
|
|
1977
|
+
url,
|
|
1978
|
+
headers,
|
|
1979
|
+
body,
|
|
1980
|
+
failedResponseHandler,
|
|
1981
|
+
successfulResponseHandler,
|
|
1982
|
+
abortSignal,
|
|
1983
|
+
fetch
|
|
1984
|
+
}) => postToApi({
|
|
1985
|
+
url,
|
|
1986
|
+
headers: {
|
|
1987
|
+
"Content-Type": "application/json",
|
|
1988
|
+
...headers
|
|
1989
|
+
},
|
|
1990
|
+
body: {
|
|
1991
|
+
content: JSON.stringify(body),
|
|
1992
|
+
values: body
|
|
1993
|
+
},
|
|
1994
|
+
failedResponseHandler,
|
|
1995
|
+
successfulResponseHandler,
|
|
1996
|
+
abortSignal,
|
|
1997
|
+
fetch
|
|
1998
|
+
});
|
|
1999
|
+
var postFormDataToApi = async ({
|
|
2000
|
+
url,
|
|
2001
|
+
headers,
|
|
2002
|
+
formData,
|
|
2003
|
+
failedResponseHandler,
|
|
2004
|
+
successfulResponseHandler,
|
|
2005
|
+
abortSignal,
|
|
2006
|
+
fetch
|
|
2007
|
+
}) => postToApi({
|
|
2008
|
+
url,
|
|
2009
|
+
headers,
|
|
2010
|
+
body: {
|
|
2011
|
+
content: formData,
|
|
2012
|
+
values: Object.fromEntries(formData.entries())
|
|
2013
|
+
},
|
|
2014
|
+
failedResponseHandler,
|
|
2015
|
+
successfulResponseHandler,
|
|
2016
|
+
abortSignal,
|
|
2017
|
+
fetch
|
|
2018
|
+
});
|
|
2019
|
+
var postToApi = async ({
|
|
2020
|
+
url,
|
|
2021
|
+
headers = {},
|
|
2022
|
+
body,
|
|
2023
|
+
successfulResponseHandler,
|
|
2024
|
+
failedResponseHandler,
|
|
2025
|
+
abortSignal,
|
|
2026
|
+
fetch = getOriginalFetch2()
|
|
2027
|
+
}) => {
|
|
2028
|
+
try {
|
|
2029
|
+
const response = await fetch(url, {
|
|
2030
|
+
method: "POST",
|
|
2031
|
+
headers: removeUndefinedEntries(headers),
|
|
2032
|
+
body: body.content,
|
|
2033
|
+
signal: abortSignal
|
|
2034
|
+
});
|
|
2035
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2036
|
+
if (!response.ok) {
|
|
2037
|
+
let errorInformation;
|
|
2038
|
+
try {
|
|
2039
|
+
errorInformation = await failedResponseHandler({
|
|
2040
|
+
response,
|
|
2041
|
+
url,
|
|
2042
|
+
requestBodyValues: body.values
|
|
2043
|
+
});
|
|
2044
|
+
} catch (error) {
|
|
2045
|
+
if (isAbortError(error) || APICallError.isInstance(error)) {
|
|
2046
|
+
throw error;
|
|
2047
|
+
}
|
|
2048
|
+
throw new APICallError({
|
|
2049
|
+
message: "Failed to process error response",
|
|
2050
|
+
cause: error,
|
|
2051
|
+
statusCode: response.status,
|
|
2052
|
+
url,
|
|
2053
|
+
responseHeaders,
|
|
2054
|
+
requestBodyValues: body.values
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
throw errorInformation.value;
|
|
2058
|
+
}
|
|
2059
|
+
try {
|
|
2060
|
+
return await successfulResponseHandler({
|
|
2061
|
+
response,
|
|
2062
|
+
url,
|
|
2063
|
+
requestBodyValues: body.values
|
|
2064
|
+
});
|
|
2065
|
+
} catch (error) {
|
|
2066
|
+
if (error instanceof Error) {
|
|
2067
|
+
if (isAbortError(error) || APICallError.isInstance(error)) {
|
|
2068
|
+
throw error;
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
throw new APICallError({
|
|
2072
|
+
message: "Failed to process successful response",
|
|
2073
|
+
cause: error,
|
|
2074
|
+
statusCode: response.status,
|
|
2075
|
+
url,
|
|
2076
|
+
responseHeaders,
|
|
2077
|
+
requestBodyValues: body.values
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
} catch (error) {
|
|
2081
|
+
throw handleFetchError({ error, url, requestBodyValues: body.values });
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
function tool(tool2) {
|
|
2085
|
+
return tool2;
|
|
2086
|
+
}
|
|
2087
|
+
function createProviderDefinedToolFactory({
|
|
2088
|
+
id,
|
|
2089
|
+
name: name14,
|
|
2090
|
+
inputSchema
|
|
2091
|
+
}) {
|
|
2092
|
+
return ({
|
|
2093
|
+
execute,
|
|
2094
|
+
outputSchema,
|
|
2095
|
+
toModelOutput,
|
|
2096
|
+
onInputStart,
|
|
2097
|
+
onInputDelta,
|
|
2098
|
+
onInputAvailable,
|
|
2099
|
+
...args
|
|
2100
|
+
}) => tool({
|
|
2101
|
+
type: "provider-defined",
|
|
2102
|
+
id,
|
|
2103
|
+
name: name14,
|
|
2104
|
+
args,
|
|
2105
|
+
inputSchema,
|
|
2106
|
+
outputSchema,
|
|
2107
|
+
execute,
|
|
2108
|
+
toModelOutput,
|
|
2109
|
+
onInputStart,
|
|
2110
|
+
onInputDelta,
|
|
2111
|
+
onInputAvailable
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
function createProviderDefinedToolFactoryWithOutputSchema({
|
|
2115
|
+
id,
|
|
2116
|
+
name: name14,
|
|
2117
|
+
inputSchema,
|
|
2118
|
+
outputSchema
|
|
2119
|
+
}) {
|
|
2120
|
+
return ({
|
|
2121
|
+
execute,
|
|
2122
|
+
toModelOutput,
|
|
2123
|
+
onInputStart,
|
|
2124
|
+
onInputDelta,
|
|
2125
|
+
onInputAvailable,
|
|
2126
|
+
...args
|
|
2127
|
+
}) => tool({
|
|
2128
|
+
type: "provider-defined",
|
|
2129
|
+
id,
|
|
2130
|
+
name: name14,
|
|
2131
|
+
args,
|
|
2132
|
+
inputSchema,
|
|
2133
|
+
outputSchema,
|
|
2134
|
+
execute,
|
|
2135
|
+
toModelOutput,
|
|
2136
|
+
onInputStart,
|
|
2137
|
+
onInputDelta,
|
|
2138
|
+
onInputAvailable
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
async function resolve(value) {
|
|
2142
|
+
if (typeof value === "function") {
|
|
2143
|
+
value = value();
|
|
2144
|
+
}
|
|
2145
|
+
return Promise.resolve(value);
|
|
2146
|
+
}
|
|
2147
|
+
var createJsonErrorResponseHandler = ({
|
|
2148
|
+
errorSchema,
|
|
2149
|
+
errorToMessage,
|
|
2150
|
+
isRetryable
|
|
2151
|
+
}) => async ({ response, url, requestBodyValues }) => {
|
|
2152
|
+
const responseBody = await response.text();
|
|
2153
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2154
|
+
if (responseBody.trim() === "") {
|
|
2155
|
+
return {
|
|
2156
|
+
responseHeaders,
|
|
2157
|
+
value: new APICallError({
|
|
2158
|
+
message: response.statusText,
|
|
2159
|
+
url,
|
|
2160
|
+
requestBodyValues,
|
|
2161
|
+
statusCode: response.status,
|
|
2162
|
+
responseHeaders,
|
|
2163
|
+
responseBody,
|
|
2164
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response)
|
|
2165
|
+
})
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
try {
|
|
2169
|
+
const parsedError = await parseJSON({
|
|
2170
|
+
text: responseBody,
|
|
2171
|
+
schema: errorSchema
|
|
2172
|
+
});
|
|
2173
|
+
return {
|
|
2174
|
+
responseHeaders,
|
|
2175
|
+
value: new APICallError({
|
|
2176
|
+
message: errorToMessage(parsedError),
|
|
2177
|
+
url,
|
|
2178
|
+
requestBodyValues,
|
|
2179
|
+
statusCode: response.status,
|
|
2180
|
+
responseHeaders,
|
|
2181
|
+
responseBody,
|
|
2182
|
+
data: parsedError,
|
|
2183
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
|
|
2184
|
+
})
|
|
2185
|
+
};
|
|
2186
|
+
} catch (parseError) {
|
|
2187
|
+
return {
|
|
2188
|
+
responseHeaders,
|
|
2189
|
+
value: new APICallError({
|
|
2190
|
+
message: response.statusText,
|
|
2191
|
+
url,
|
|
2192
|
+
requestBodyValues,
|
|
2193
|
+
statusCode: response.status,
|
|
2194
|
+
responseHeaders,
|
|
2195
|
+
responseBody,
|
|
2196
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response)
|
|
2197
|
+
})
|
|
2198
|
+
};
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
2202
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2203
|
+
if (response.body == null) {
|
|
2204
|
+
throw new EmptyResponseBodyError({});
|
|
2205
|
+
}
|
|
2206
|
+
return {
|
|
2207
|
+
responseHeaders,
|
|
2208
|
+
value: parseJsonEventStream({
|
|
2209
|
+
stream: response.body,
|
|
2210
|
+
schema: chunkSchema
|
|
2211
|
+
})
|
|
2212
|
+
};
|
|
2213
|
+
};
|
|
2214
|
+
var createJsonResponseHandler = (responseSchema) => async ({ response, url, requestBodyValues }) => {
|
|
2215
|
+
const responseBody = await response.text();
|
|
2216
|
+
const parsedResult = await safeParseJSON({
|
|
2217
|
+
text: responseBody,
|
|
2218
|
+
schema: responseSchema
|
|
2219
|
+
});
|
|
2220
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2221
|
+
if (!parsedResult.success) {
|
|
2222
|
+
throw new APICallError({
|
|
2223
|
+
message: "Invalid JSON response",
|
|
2224
|
+
cause: parsedResult.error,
|
|
2225
|
+
statusCode: response.status,
|
|
2226
|
+
responseHeaders,
|
|
2227
|
+
responseBody,
|
|
2228
|
+
url,
|
|
2229
|
+
requestBodyValues
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
return {
|
|
2233
|
+
responseHeaders,
|
|
2234
|
+
value: parsedResult.value,
|
|
2235
|
+
rawValue: parsedResult.rawValue
|
|
2236
|
+
};
|
|
2237
|
+
};
|
|
2238
|
+
var createBinaryResponseHandler = () => async ({ response, url, requestBodyValues }) => {
|
|
2239
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2240
|
+
if (!response.body) {
|
|
2241
|
+
throw new APICallError({
|
|
2242
|
+
message: "Response body is empty",
|
|
2243
|
+
url,
|
|
2244
|
+
requestBodyValues,
|
|
2245
|
+
statusCode: response.status,
|
|
2246
|
+
responseHeaders,
|
|
2247
|
+
responseBody: void 0
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
try {
|
|
2251
|
+
const buffer = await response.arrayBuffer();
|
|
2252
|
+
return {
|
|
2253
|
+
responseHeaders,
|
|
2254
|
+
value: new Uint8Array(buffer)
|
|
2255
|
+
};
|
|
2256
|
+
} catch (error) {
|
|
2257
|
+
throw new APICallError({
|
|
2258
|
+
message: "Failed to read response as array buffer",
|
|
2259
|
+
url,
|
|
2260
|
+
requestBodyValues,
|
|
2261
|
+
statusCode: response.status,
|
|
2262
|
+
responseHeaders,
|
|
2263
|
+
responseBody: void 0,
|
|
2264
|
+
cause: error
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
var { btoa, atob } = globalThis;
|
|
2269
|
+
function convertBase64ToUint8Array(base64String) {
|
|
2270
|
+
const base64Url = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
|
2271
|
+
const latin1string = atob(base64Url);
|
|
2272
|
+
return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
|
|
2273
|
+
}
|
|
2274
|
+
function convertUint8ArrayToBase64(array) {
|
|
2275
|
+
let latin1string = "";
|
|
2276
|
+
for (let i = 0; i < array.length; i++) {
|
|
2277
|
+
latin1string += String.fromCodePoint(array[i]);
|
|
2278
|
+
}
|
|
2279
|
+
return btoa(latin1string);
|
|
2280
|
+
}
|
|
2281
|
+
function convertToBase64(value) {
|
|
2282
|
+
return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
|
|
2283
|
+
}
|
|
2284
|
+
function withoutTrailingSlash(url) {
|
|
2285
|
+
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
export { AISDKError, APICallError, EmptyResponseBodyError, EventSourceParserStream, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, JSONParseError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, combineHeaders, convertBase64ToUint8Array, convertToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, esm_default, generateId, isParsableJson, loadApiKey, parseProviderOptions, postFormDataToApi, postJsonToApi, resolve, withoutTrailingSlash };
|
|
2289
|
+
//# sourceMappingURL=chunk-N7F33WAD.js.map
|
|
2290
|
+
//# sourceMappingURL=chunk-N7F33WAD.js.map
|