@langchain/core 1.1.1 → 1.1.3

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.
Files changed (233) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/agents.d.cts +0 -2
  3. package/dist/agents.d.ts +0 -2
  4. package/dist/callbacks/base.d.cts +22 -60
  5. package/dist/callbacks/base.d.ts +22 -60
  6. package/dist/callbacks/dispatch/index.d.cts +1 -3
  7. package/dist/callbacks/dispatch/index.d.ts +1 -3
  8. package/dist/callbacks/dispatch/web.d.cts +1 -3
  9. package/dist/callbacks/dispatch/web.d.ts +1 -3
  10. package/dist/callbacks/manager.d.cts +2 -12
  11. package/dist/callbacks/manager.d.ts +2 -12
  12. package/dist/chat_history.cjs +1 -1
  13. package/dist/chat_history.d.cts +0 -1
  14. package/dist/chat_history.d.ts +0 -1
  15. package/dist/chat_history.js +1 -1
  16. package/dist/document_loaders/langsmith.d.cts +0 -3
  17. package/dist/document_loaders/langsmith.d.ts +0 -3
  18. package/dist/documents/document.d.cts +3 -12
  19. package/dist/documents/document.d.ts +3 -12
  20. package/dist/example_selectors/length_based.d.cts +1 -1
  21. package/dist/example_selectors/length_based.d.ts +1 -1
  22. package/dist/indexing/base.d.cts +0 -1
  23. package/dist/indexing/base.d.ts +0 -1
  24. package/dist/indexing/record_manager.d.cts +0 -1
  25. package/dist/indexing/record_manager.d.ts +0 -1
  26. package/dist/language_models/base.d.cts +8 -38
  27. package/dist/language_models/base.d.ts +8 -38
  28. package/dist/language_models/chat_models.cjs +1 -1
  29. package/dist/language_models/chat_models.d.cts +6 -33
  30. package/dist/language_models/chat_models.d.ts +6 -33
  31. package/dist/language_models/chat_models.js +1 -1
  32. package/dist/language_models/llms.d.cts +0 -6
  33. package/dist/language_models/llms.d.ts +0 -6
  34. package/dist/load/import_type.d.cts +0 -1
  35. package/dist/load/import_type.d.ts +0 -1
  36. package/dist/load/map_keys.cjs +4 -5
  37. package/dist/load/map_keys.cjs.map +1 -1
  38. package/dist/load/map_keys.d.cts +0 -1
  39. package/dist/load/map_keys.d.ts +0 -1
  40. package/dist/load/map_keys.js +3 -3
  41. package/dist/load/map_keys.js.map +1 -1
  42. package/dist/load/serializable.d.cts +0 -1
  43. package/dist/load/serializable.d.ts +0 -1
  44. package/dist/memory.d.cts +0 -3
  45. package/dist/memory.d.ts +0 -3
  46. package/dist/messages/ai.cjs +6 -48
  47. package/dist/messages/ai.cjs.map +1 -1
  48. package/dist/messages/ai.js +6 -48
  49. package/dist/messages/ai.js.map +1 -1
  50. package/dist/messages/base.cjs +3 -2
  51. package/dist/messages/base.cjs.map +1 -1
  52. package/dist/messages/base.d.cts +1 -13
  53. package/dist/messages/base.d.ts +1 -13
  54. package/dist/messages/base.js +3 -2
  55. package/dist/messages/base.js.map +1 -1
  56. package/dist/messages/content/data.d.cts +2 -7
  57. package/dist/messages/content/data.d.ts +2 -7
  58. package/dist/messages/content/index.d.cts +1 -4
  59. package/dist/messages/content/index.d.ts +1 -4
  60. package/dist/messages/content/multimodal.d.cts +0 -1
  61. package/dist/messages/content/multimodal.d.ts +0 -1
  62. package/dist/messages/content/tools.d.cts +0 -1
  63. package/dist/messages/content/tools.d.ts +0 -1
  64. package/dist/messages/index.cjs +4 -2
  65. package/dist/messages/index.d.cts +2 -2
  66. package/dist/messages/index.d.ts +2 -2
  67. package/dist/messages/index.js +5 -4
  68. package/dist/messages/tool.d.cts +2 -9
  69. package/dist/messages/tool.d.ts +2 -9
  70. package/dist/messages/transformers.cjs +2 -2
  71. package/dist/messages/transformers.d.cts +0 -3
  72. package/dist/messages/transformers.d.ts +0 -3
  73. package/dist/messages/transformers.js +2 -2
  74. package/dist/messages/utils.cjs +77 -4
  75. package/dist/messages/utils.cjs.map +1 -1
  76. package/dist/messages/utils.d.cts +35 -7
  77. package/dist/messages/utils.d.ts +35 -7
  78. package/dist/messages/utils.js +77 -5
  79. package/dist/messages/utils.js.map +1 -1
  80. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs +169 -0
  81. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.cjs.map +1 -0
  82. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js +168 -0
  83. package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.js.map +1 -0
  84. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs +122 -0
  85. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.cjs.map +1 -0
  86. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js +121 -0
  87. package/dist/node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js.map +1 -0
  88. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs +18 -0
  89. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.cjs.map +1 -0
  90. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js +17 -0
  91. package/dist/node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js.map +1 -0
  92. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.cjs +27 -0
  93. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.cjs.map +1 -0
  94. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js +26 -0
  95. package/dist/node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js.map +1 -0
  96. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.cjs +141 -0
  97. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.cjs.map +1 -0
  98. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js +141 -0
  99. package/dist/node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js.map +1 -0
  100. package/dist/output_parsers/json.cjs.map +1 -1
  101. package/dist/output_parsers/json.d.cts +1 -5
  102. package/dist/output_parsers/json.d.ts +1 -5
  103. package/dist/output_parsers/json.js.map +1 -1
  104. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +2 -6
  105. package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +2 -6
  106. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +10 -34
  107. package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +10 -34
  108. package/dist/output_parsers/transform.d.cts +0 -1
  109. package/dist/output_parsers/transform.d.ts +0 -1
  110. package/dist/outputs.d.cts +0 -6
  111. package/dist/outputs.d.ts +0 -6
  112. package/dist/prompts/base.d.cts +2 -10
  113. package/dist/prompts/base.d.ts +2 -10
  114. package/dist/prompts/chat.cjs +2 -2
  115. package/dist/prompts/chat.d.cts +13 -51
  116. package/dist/prompts/chat.d.ts +13 -51
  117. package/dist/prompts/chat.js +2 -2
  118. package/dist/prompts/few_shot.d.cts +1 -5
  119. package/dist/prompts/few_shot.d.ts +1 -5
  120. package/dist/prompts/image.d.cts +2 -10
  121. package/dist/prompts/image.d.ts +2 -10
  122. package/dist/prompts/prompt.d.cts +4 -15
  123. package/dist/prompts/prompt.d.ts +4 -16
  124. package/dist/prompts/serde.d.cts +0 -1
  125. package/dist/prompts/serde.d.ts +0 -1
  126. package/dist/prompts/string.d.cts +1 -5
  127. package/dist/prompts/string.d.ts +1 -5
  128. package/dist/prompts/structured.d.cts +3 -16
  129. package/dist/prompts/structured.d.ts +3 -16
  130. package/dist/retrievers/document_compressors/index.d.cts +0 -1
  131. package/dist/retrievers/document_compressors/index.d.ts +0 -1
  132. package/dist/retrievers/index.d.cts +2 -6
  133. package/dist/retrievers/index.d.ts +2 -6
  134. package/dist/runnables/base.cjs +7 -7
  135. package/dist/runnables/base.cjs.map +1 -1
  136. package/dist/runnables/base.d.cts +12 -64
  137. package/dist/runnables/base.d.ts +12 -64
  138. package/dist/runnables/base.js +1 -1
  139. package/dist/runnables/branch.d.cts +0 -2
  140. package/dist/runnables/branch.d.ts +0 -2
  141. package/dist/runnables/config.d.cts +0 -1
  142. package/dist/runnables/config.d.ts +0 -1
  143. package/dist/runnables/graph.d.cts +1 -5
  144. package/dist/runnables/graph.d.ts +1 -5
  145. package/dist/runnables/graph_mermaid.cjs +2 -1
  146. package/dist/runnables/graph_mermaid.cjs.map +1 -1
  147. package/dist/runnables/graph_mermaid.js +3 -1
  148. package/dist/runnables/graph_mermaid.js.map +1 -1
  149. package/dist/runnables/history.cjs +1 -1
  150. package/dist/runnables/history.d.cts +4 -12
  151. package/dist/runnables/history.d.ts +4 -12
  152. package/dist/runnables/history.js +1 -1
  153. package/dist/runnables/passthrough.d.cts +0 -2
  154. package/dist/runnables/passthrough.d.ts +0 -2
  155. package/dist/runnables/router.d.cts +0 -1
  156. package/dist/runnables/router.d.ts +0 -1
  157. package/dist/runnables/types.d.cts +2 -9
  158. package/dist/runnables/types.d.ts +2 -9
  159. package/dist/runnables/utils.cjs +5 -0
  160. package/dist/runnables/utils.cjs.map +1 -1
  161. package/dist/runnables/utils.js +5 -1
  162. package/dist/runnables/utils.js.map +1 -1
  163. package/dist/singletons/async_local_storage/context.d.cts +0 -2
  164. package/dist/singletons/async_local_storage/context.d.ts +0 -2
  165. package/dist/singletons/async_local_storage/globals.d.cts +0 -1
  166. package/dist/singletons/async_local_storage/globals.d.ts +0 -1
  167. package/dist/singletons/callbacks.cjs.map +1 -1
  168. package/dist/singletons/callbacks.js.map +1 -1
  169. package/dist/stores.d.cts +0 -1
  170. package/dist/stores.d.ts +0 -1
  171. package/dist/structured_query/utils.d.cts +1 -4
  172. package/dist/structured_query/utils.d.ts +1 -4
  173. package/dist/tools/index.d.cts +1 -6
  174. package/dist/tools/index.d.ts +1 -6
  175. package/dist/tools/types.d.cts +3 -13
  176. package/dist/tools/types.d.ts +3 -13
  177. package/dist/tracers/base.d.cts +1 -20
  178. package/dist/tracers/base.d.ts +1 -20
  179. package/dist/tracers/console.cjs +3 -3
  180. package/dist/tracers/console.cjs.map +1 -1
  181. package/dist/tracers/console.d.cts +0 -2
  182. package/dist/tracers/console.d.ts +0 -2
  183. package/dist/tracers/console.js +3 -3
  184. package/dist/tracers/console.js.map +1 -1
  185. package/dist/tracers/event_stream.d.cts +0 -4
  186. package/dist/tracers/event_stream.d.ts +0 -4
  187. package/dist/tracers/log_stream.d.cts +0 -6
  188. package/dist/tracers/log_stream.d.ts +0 -6
  189. package/dist/types/_internal.d.cts +0 -3
  190. package/dist/types/_internal.d.ts +0 -3
  191. package/dist/types/type-utils.d.cts +0 -2
  192. package/dist/types/type-utils.d.ts +0 -2
  193. package/dist/utils/async_caller.cjs +2 -7
  194. package/dist/utils/async_caller.cjs.map +1 -1
  195. package/dist/utils/async_caller.d.cts +0 -3
  196. package/dist/utils/async_caller.d.ts +0 -3
  197. package/dist/utils/async_caller.js +1 -6
  198. package/dist/utils/async_caller.js.map +1 -1
  199. package/dist/utils/env.d.cts +0 -4
  200. package/dist/utils/env.d.ts +0 -4
  201. package/dist/utils/event_source_parse.d.cts +1 -4
  202. package/dist/utils/event_source_parse.d.ts +1 -4
  203. package/dist/utils/function_calling.d.cts +1 -3
  204. package/dist/utils/function_calling.d.ts +1 -3
  205. package/dist/utils/json.cjs +182 -22
  206. package/dist/utils/json.cjs.map +1 -1
  207. package/dist/utils/json.d.cts +1 -3
  208. package/dist/utils/json.d.ts +1 -3
  209. package/dist/utils/json.js +182 -22
  210. package/dist/utils/json.js.map +1 -1
  211. package/dist/utils/stream.d.cts +1 -13
  212. package/dist/utils/stream.d.ts +1 -13
  213. package/dist/utils/testing/chat_models.d.cts +3 -11
  214. package/dist/utils/testing/chat_models.d.ts +3 -11
  215. package/dist/utils/testing/message_history.cjs +1 -1
  216. package/dist/utils/testing/message_history.js +1 -1
  217. package/dist/utils/testing/retrievers.d.cts +1 -3
  218. package/dist/utils/testing/retrievers.d.ts +1 -3
  219. package/dist/utils/testing/vectorstores.d.cts +0 -1
  220. package/dist/utils/testing/vectorstores.d.ts +0 -1
  221. package/dist/utils/types/index.cjs +4 -0
  222. package/dist/utils/types/index.d.cts +2 -4
  223. package/dist/utils/types/index.d.ts +2 -4
  224. package/dist/utils/types/index.js +4 -2
  225. package/dist/utils/types/zod.cjs +24 -0
  226. package/dist/utils/types/zod.cjs.map +1 -1
  227. package/dist/utils/types/zod.d.cts +4 -4
  228. package/dist/utils/types/zod.d.ts +4 -4
  229. package/dist/utils/types/zod.js +23 -1
  230. package/dist/utils/types/zod.js.map +1 -1
  231. package/dist/vectorstores.d.cts +5 -17
  232. package/dist/vectorstores.d.ts +5 -17
  233. package/package.json +6 -6
@@ -0,0 +1,121 @@
1
+ //#region ../../node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js
2
+ const UPPERCASE = /[\p{Lu}]/u;
3
+ const LOWERCASE = /[\p{Ll}]/u;
4
+ const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/u;
5
+ const SEPARATORS = /[_.\- ]+/;
6
+ const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
7
+ const LEADING_SEPARATORS = /* @__PURE__ */ new RegExp("^" + SEPARATORS.source);
8
+ const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
9
+ const NUMBERS_AND_IDENTIFIER = new RegExp(String.raw`\d+` + IDENTIFIER.source, "gu");
10
+ const preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase$1) => {
11
+ let isLastCharLower = false;
12
+ let isLastCharUpper = false;
13
+ let isLastLastCharUpper = false;
14
+ let isLastLastCharPreserved = false;
15
+ for (let index = 0; index < string.length; index++) {
16
+ const character = string[index];
17
+ isLastLastCharPreserved = index > 2 ? string[index - 3] === "-" : true;
18
+ if (isLastCharLower && UPPERCASE.test(character)) {
19
+ string = string.slice(0, index) + "-" + string.slice(index);
20
+ isLastCharLower = false;
21
+ isLastLastCharUpper = isLastCharUpper;
22
+ isLastCharUpper = true;
23
+ index++;
24
+ } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase$1)) {
25
+ string = string.slice(0, index - 1) + "-" + string.slice(index - 1);
26
+ isLastLastCharUpper = isLastCharUpper;
27
+ isLastCharUpper = false;
28
+ isLastCharLower = true;
29
+ } else {
30
+ isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
31
+ isLastLastCharUpper = isLastCharUpper;
32
+ isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
33
+ }
34
+ }
35
+ return string;
36
+ };
37
+ const preserveConsecutiveUppercase = (input, toLowerCase) => input.replace(LEADING_CAPITAL, (match) => toLowerCase(match));
38
+ const processWithCasePreservation = (input, toLowerCase, preserveConsecutiveUppercase$1) => {
39
+ let result = "";
40
+ let previousWasNumber = false;
41
+ let previousWasUppercase = false;
42
+ const characters = [...input];
43
+ for (let index = 0; index < characters.length; index++) {
44
+ const character = characters[index];
45
+ const isUpperCase = UPPERCASE.test(character);
46
+ const nextCharIsUpperCase = index + 1 < characters.length && UPPERCASE.test(characters[index + 1]);
47
+ if (previousWasNumber && /[\p{Alpha}]/u.test(character)) {
48
+ result += character;
49
+ previousWasNumber = false;
50
+ previousWasUppercase = isUpperCase;
51
+ } else if (preserveConsecutiveUppercase$1 && isUpperCase && (previousWasUppercase || nextCharIsUpperCase)) {
52
+ result += character;
53
+ previousWasUppercase = true;
54
+ } else if (/\d/.test(character)) {
55
+ result += character;
56
+ previousWasNumber = true;
57
+ previousWasUppercase = false;
58
+ } else if (SEPARATORS.test(character)) {
59
+ result += character;
60
+ previousWasUppercase = false;
61
+ } else {
62
+ result += toLowerCase(character);
63
+ previousWasNumber = false;
64
+ previousWasUppercase = false;
65
+ }
66
+ }
67
+ return result;
68
+ };
69
+ /**
70
+ Core post-processing:
71
+ - Collapses separators and uppercases the following identifier character.
72
+ - Optionally uppercases the identifier following a numeric sequence.
73
+
74
+ Two-pass strategy prevents conflicts:
75
+ 1. NUMBERS_AND_IDENTIFIER: handles digit-to-letter transitions
76
+ 2. SEPARATORS_AND_IDENTIFIER: handles separator-to-identifier transitions
77
+
78
+ Example: "b2b_registration" with capitalizeAfterNumber: true
79
+ - Pass 1: "2b" matches, next char is "_" (separator), so don't capitalize → "b2b_registration"
80
+ - Pass 2: "_r" matches, replace with "R" → "b2bRegistration"
81
+ */
82
+ const postProcess = (input, toUpperCase, { capitalizeAfterNumber }) => {
83
+ const transformNumericIdentifier = capitalizeAfterNumber ? (match, identifier, offset, string) => {
84
+ const nextCharacter = string.charAt(offset + match.length);
85
+ if (SEPARATORS.test(nextCharacter)) return match;
86
+ return identifier ? match.slice(0, -identifier.length) + toUpperCase(identifier) : match;
87
+ } : (match) => match;
88
+ return input.replaceAll(NUMBERS_AND_IDENTIFIER, transformNumericIdentifier).replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
89
+ };
90
+ function camelCase(input, options) {
91
+ if (!(typeof input === "string" || Array.isArray(input))) throw new TypeError("Expected the input to be `string | string[]`");
92
+ options = {
93
+ pascalCase: false,
94
+ preserveConsecutiveUppercase: false,
95
+ capitalizeAfterNumber: true,
96
+ ...options
97
+ };
98
+ if (Array.isArray(input)) input = input.map((element) => element.trim()).filter((element) => element.length > 0).join("-");
99
+ else input = input.trim();
100
+ if (input.length === 0) return "";
101
+ const leadingPrefix = input.match(/^[_$]*/)[0];
102
+ input = input.slice(leadingPrefix.length);
103
+ if (input.length === 0) return leadingPrefix;
104
+ const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
105
+ const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
106
+ if (input.length === 1) {
107
+ if (SEPARATORS.test(input)) return leadingPrefix;
108
+ return leadingPrefix + (options.pascalCase ? toUpperCase(input) : toLowerCase(input));
109
+ }
110
+ const hasUpperCase = input !== toLowerCase(input);
111
+ if (hasUpperCase) input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
112
+ input = input.replace(LEADING_SEPARATORS, "");
113
+ if (options.capitalizeAfterNumber) input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
114
+ else input = processWithCasePreservation(input, toLowerCase, options.preserveConsecutiveUppercase);
115
+ if (options.pascalCase && input.length > 0) input = toUpperCase(input[0]) + input.slice(1);
116
+ return leadingPrefix + postProcess(input, toUpperCase, options);
117
+ }
118
+
119
+ //#endregion
120
+ export { camelCase };
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["preserveConsecutiveUppercase"],"sources":["../../../../../../../../node_modules/.pnpm/camelcase@9.0.0/node_modules/camelcase/index.js"],"sourcesContent":["const UPPERCASE = /[\\p{Lu}]/u;\nconst LOWERCASE = /[\\p{Ll}]/u;\nconst LEADING_CAPITAL = /^[\\p{Lu}](?![\\p{Lu}])/u;\nconst SEPARATORS = /[_.\\- ]+/;\n\n// The |$ alternative allows matching at end-of-string, capturing empty string\n// This enables NUMBERS_AND_IDENTIFIER to match digits at string end (e.g., \"test123\")\nconst IDENTIFIER = /([\\p{Alpha}\\p{N}_]|$)/u;\n\nconst LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);\nconst SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');\nconst NUMBERS_AND_IDENTIFIER = new RegExp(String.raw`\\d+` + IDENTIFIER.source, 'gu');\n\nconst preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {\n\tlet isLastCharLower = false;\n\tlet isLastCharUpper = false;\n\tlet isLastLastCharUpper = false;\n\tlet isLastLastCharPreserved = false;\n\n\tfor (let index = 0; index < string.length; index++) {\n\t\tconst character = string[index];\n\n\t\t// Was the character 3 positions back inserted as a separator?\n\t\t// Prevents excessive separators by checking if we recently inserted one\n\t\t// index - 3 accounts for: current character, inserted separator, previous character\n\t\t// Default true for early positions activates the preserveConsecutiveUppercase guard\n\t\tisLastLastCharPreserved = index > 2 ? string[index - 3] === '-' : true;\n\n\t\tif (isLastCharLower && UPPERCASE.test(character)) {\n\t\t\t// FooBar → Foo-Bar (insert separator before uppercase)\n\t\t\tstring = string.slice(0, index) + '-' + string.slice(index);\n\t\t\tisLastCharLower = false;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = true;\n\t\t\tindex++;\n\t\t} else if (\n\t\t\tisLastCharUpper\n\t\t\t&& isLastLastCharUpper\n\t\t\t&& LOWERCASE.test(character)\n\t\t\t&& (!isLastLastCharPreserved || preserveConsecutiveUppercase)\n\t\t) {\n\t\t\t// FOOBar → FOO-Bar\n\t\t\tstring = string.slice(0, index - 1) + '-' + string.slice(index - 1);\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = false;\n\t\t\tisLastCharLower = true;\n\t\t} else {\n\t\t\tisLastCharLower\n\t\t\t\t= toLowerCase(character) === character\n\t\t\t\t\t&& toUpperCase(character) !== character;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper\n\t\t\t\t= toUpperCase(character) === character\n\t\t\t\t\t&& toLowerCase(character) !== character;\n\t\t}\n\t}\n\n\treturn string;\n};\n\nconst preserveConsecutiveUppercase = (input, toLowerCase) => input.replace(LEADING_CAPITAL, match => toLowerCase(match));\n\nconst processWithCasePreservation = (input, toLowerCase, preserveConsecutiveUppercase) => {\n\tlet result = '';\n\tlet previousWasNumber = false;\n\tlet previousWasUppercase = false;\n\n\t// Convert input to array for lookahead capability\n\tconst characters = [...input];\n\n\tfor (let index = 0; index < characters.length; index++) {\n\t\tconst character = characters[index];\n\t\tconst isUpperCase = UPPERCASE.test(character);\n\t\tconst nextCharIsUpperCase = index + 1 < characters.length && UPPERCASE.test(characters[index + 1]);\n\n\t\tif (previousWasNumber && /[\\p{Alpha}]/u.test(character)) {\n\t\t\t// Letter after number - preserve original case\n\t\t\tresult += character;\n\t\t\tpreviousWasNumber = false;\n\t\t\tpreviousWasUppercase = isUpperCase;\n\t\t} else if (preserveConsecutiveUppercase && isUpperCase && (previousWasUppercase || nextCharIsUpperCase)) {\n\t\t\t// Part of consecutive uppercase sequence when preserveConsecutiveUppercase is true - keep it\n\t\t\tresult += character;\n\t\t\tpreviousWasUppercase = true;\n\t\t} else if (/\\d/.test(character)) {\n\t\t\t// Number - keep as-is and track it\n\t\t\tresult += character;\n\t\t\tpreviousWasNumber = true;\n\t\t\tpreviousWasUppercase = false;\n\t\t} else if (SEPARATORS.test(character)) {\n\t\t\t// Separator - keep as-is and maintain previousWasNumber state\n\t\t\tresult += character;\n\t\t\tpreviousWasUppercase = false;\n\t\t} else {\n\t\t\t// Regular character - lowercase it\n\t\t\tresult += toLowerCase(character);\n\t\t\tpreviousWasNumber = false;\n\t\t\tpreviousWasUppercase = false;\n\t\t}\n\t}\n\n\treturn result;\n};\n\n/**\nCore post-processing:\n- Collapses separators and uppercases the following identifier character.\n- Optionally uppercases the identifier following a numeric sequence.\n\nTwo-pass strategy prevents conflicts:\n1. NUMBERS_AND_IDENTIFIER: handles digit-to-letter transitions\n2. SEPARATORS_AND_IDENTIFIER: handles separator-to-identifier transitions\n\nExample: \"b2b_registration\" with capitalizeAfterNumber: true\n- Pass 1: \"2b\" matches, next char is \"_\" (separator), so don't capitalize → \"b2b_registration\"\n- Pass 2: \"_r\" matches, replace with \"R\" → \"b2bRegistration\"\n*/\nconst postProcess = (input, toUpperCase, {capitalizeAfterNumber}) => {\n\tconst transformNumericIdentifier = capitalizeAfterNumber\n\t\t? (match, identifier, offset, string) => {\n\t\t\tconst nextCharacter = string.charAt(offset + match.length);\n\n\t\t\t// If the numeric+identifier run is immediately followed by a separator,\n\t\t\t// treat it as a continued token and do not force a new word.\n\t\t\tif (SEPARATORS.test(nextCharacter)) {\n\t\t\t\treturn match;\n\t\t\t}\n\n\t\t\t// Only uppercase the identifier part (not the digits) for efficiency\n\t\t\treturn identifier ? match.slice(0, -identifier.length) + toUpperCase(identifier) : match;\n\t\t}\n\t\t// When false: numbers do not create a word boundary.\n\t\t: match => match;\n\n\treturn input\n\t\t.replaceAll(NUMBERS_AND_IDENTIFIER, transformNumericIdentifier)\n\t\t.replaceAll(\n\t\t\tSEPARATORS_AND_IDENTIFIER,\n\t\t\t(_, identifier) => toUpperCase(identifier),\n\t\t);\n};\n\nexport default function camelCase(input, options) {\n\tif (!(typeof input === 'string' || Array.isArray(input))) {\n\t\tthrow new TypeError('Expected the input to be `string | string[]`');\n\t}\n\n\toptions = {\n\t\tpascalCase: false,\n\t\tpreserveConsecutiveUppercase: false,\n\t\tcapitalizeAfterNumber: true,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(input)) {\n\t\tinput = input\n\t\t\t.map(element => element.trim())\n\t\t\t.filter(element => element.length > 0)\n\t\t\t.join('-');\n\t} else {\n\t\tinput = input.trim();\n\t}\n\n\tif (input.length === 0) {\n\t\treturn '';\n\t}\n\n\t// Preserve leading _ and $ as they have semantic meaning\n\tconst leadingPrefix = input.match(/^[_$]*/)[0];\n\tinput = input.slice(leadingPrefix.length);\n\n\tif (input.length === 0) {\n\t\treturn leadingPrefix;\n\t}\n\n\tconst toLowerCase = options.locale === false\n\t\t? string => string.toLowerCase()\n\t\t: string => string.toLocaleLowerCase(options.locale);\n\n\tconst toUpperCase = options.locale === false\n\t\t? string => string.toUpperCase()\n\t\t: string => string.toLocaleUpperCase(options.locale);\n\n\tif (input.length === 1) {\n\t\tif (SEPARATORS.test(input)) {\n\t\t\treturn leadingPrefix;\n\t\t}\n\n\t\treturn leadingPrefix + (options.pascalCase\n\t\t\t? toUpperCase(input)\n\t\t\t: toLowerCase(input));\n\t}\n\n\tconst hasUpperCase = input !== toLowerCase(input);\n\n\tif (hasUpperCase) {\n\t\tinput = preserveCamelCase(\n\t\t\tinput,\n\t\t\ttoLowerCase,\n\t\t\ttoUpperCase,\n\t\t\toptions.preserveConsecutiveUppercase,\n\t\t);\n\t}\n\n\t// Strip leading separators eagerly so they do not affect word detection\n\tinput = input.replace(LEADING_SEPARATORS, '');\n\n\t// Normalize base casing while preserving intended consecutive uppers\n\tif (options.capitalizeAfterNumber) {\n\t\t// Standard behavior - lowercase everything (or preserve consecutive uppercase)\n\t\tinput = options.preserveConsecutiveUppercase\n\t\t\t? preserveConsecutiveUppercase(input, toLowerCase)\n\t\t\t: toLowerCase(input);\n\t} else {\n\t\t// Preserve case after numbers (processWithCasePreservation handles preserveConsecutiveUppercase internally)\n\t\tinput = processWithCasePreservation(input, toLowerCase, options.preserveConsecutiveUppercase);\n\t}\n\n\tif (options.pascalCase && input.length > 0) {\n\t\tinput = toUpperCase(input[0]) + input.slice(1);\n\t}\n\n\treturn leadingPrefix + postProcess(input, toUpperCase, options);\n}\n"],"x_google_ignoreList":[0],"mappings":";AAAA,MAAM,YAAY;AAClB,MAAM,YAAY;AAClB,MAAM,kBAAkB;AACxB,MAAM,aAAa;AAInB,MAAM,aAAa;AAEnB,MAAM,qCAAqB,IAAI,OAAO,MAAM,WAAW;AACvD,MAAM,4BAA4B,IAAI,OAAO,WAAW,SAAS,WAAW,QAAQ;AACpF,MAAM,yBAAyB,IAAI,OAAO,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,QAAQ;AAE/E,MAAM,oBAAoB,CAAC,QAAQ,aAAa,aAAaA,mCAAiC;CAC7F,IAAI,kBAAkB;CACtB,IAAI,kBAAkB;CACtB,IAAI,sBAAsB;CAC1B,IAAI,0BAA0B;AAE9B,MAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS;EACnD,MAAM,YAAY,OAAO;EAMzB,0BAA0B,QAAQ,IAAI,OAAO,QAAQ,OAAO,MAAM;AAElE,MAAI,mBAAmB,UAAU,KAAK,UAAU,EAAE;GAEjD,SAAS,OAAO,MAAM,GAAG,MAAM,GAAG,MAAM,OAAO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GAClB,YAAY,MAAM;CACrB;CAED,MAAM,eAAe,UAAU,YAAY,MAAM;AAEjD,KAAI,cACH,QAAQ,kBACP,OACA,aACA,aACA,QAAQ,6BACR;CAIF,QAAQ,MAAM,QAAQ,oBAAoB,GAAG;AAG7C,KAAI,QAAQ,uBAEX,QAAQ,QAAQ,+BACb,6BAA6B,OAAO,YAAY,GAChD,YAAY,MAAM;MAGrB,QAAQ,4BAA4B,OAAO,aAAa,QAAQ,6BAA6B;AAG9F,KAAI,QAAQ,cAAc,MAAM,SAAS,GACxC,QAAQ,YAAY,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE;AAG/C,QAAO,gBAAgB,YAAY,OAAO,aAAa,QAAQ;AAC/D"}
@@ -0,0 +1,18 @@
1
+
2
+ //#region ../../node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js
3
+ const handlePreserveConsecutiveUppercase = (decamelized, separator) => {
4
+ decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => $0.toLowerCase());
5
+ return decamelized.replace(/(?<!\p{Uppercase_Letter})(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => $1 + separator + $2.toLowerCase());
6
+ };
7
+ function decamelize(text, { separator = "_", preserveConsecutiveUppercase = false } = {}) {
8
+ if (!(typeof text === "string" && typeof separator === "string")) throw new TypeError("The `text` and `separator` arguments should be of type `string`");
9
+ if (text.length < 2) return preserveConsecutiveUppercase ? text : text.toLowerCase();
10
+ const replacement = `$1${separator}$2`;
11
+ const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
12
+ if (preserveConsecutiveUppercase) return handlePreserveConsecutiveUppercase(decamelized, separator);
13
+ return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
14
+ }
15
+
16
+ //#endregion
17
+ exports.decamelize = decamelize;
18
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../../../../../../../node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js"],"sourcesContent":["const handlePreserveConsecutiveUppercase = (decamelized, separator) => {\n\t// Lowercase all single uppercase characters. As we\n\t// want to preserve uppercase sequences, we cannot\n\t// simply lowercase the separated string at the end.\n\t// `data_For_USACounties` → `data_for_USACounties`\n\tdecamelized = decamelized.replace(\n\t\t/((?<![\\p{Uppercase_Letter}\\d])[\\p{Uppercase_Letter}\\d](?![\\p{Uppercase_Letter}\\d]))/gu,\n\t\t$0 => $0.toLowerCase(),\n\t);\n\n\t// Remaining uppercase sequences will be separated from lowercase sequences.\n\t// `data_For_USACounties` → `data_for_USA_counties`\n\t// We anchor at the start of an uppercase run to avoid excessive backtracking on\n\t// long all-uppercase substrings followed by a non-lowercase character.\n\treturn decamelized.replace(\n\t\t/(?<!\\p{Uppercase_Letter})(\\p{Uppercase_Letter}+)(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)/gu,\n\t\t(_, $1, $2) => $1 + separator + $2.toLowerCase(),\n\t);\n};\n\nexport default function decamelize(\n\ttext,\n\t{\n\t\tseparator = '_',\n\t\tpreserveConsecutiveUppercase = false,\n\t} = {},\n) {\n\tif (!(typeof text === 'string' && typeof separator === 'string')) {\n\t\tthrow new TypeError(\n\t\t\t'The `text` and `separator` arguments should be of type `string`',\n\t\t);\n\t}\n\n\t// Checking the second character is done later on. Therefore process shorter strings here.\n\tif (text.length < 2) {\n\t\treturn preserveConsecutiveUppercase ? text : text.toLowerCase();\n\t}\n\n\tconst replacement = `$1${separator}$2`;\n\n\t// Split lowercase sequences followed by uppercase character.\n\t// `dataForUSACounties` → `data_For_USACounties`\n\t// `myURLstring → `my_URLstring`\n\tconst decamelized = text.replace(\n\t\t/([\\p{Lowercase_Letter}\\d])(\\p{Uppercase_Letter})/gu,\n\t\treplacement,\n\t);\n\n\tif (preserveConsecutiveUppercase) {\n\t\treturn handlePreserveConsecutiveUppercase(decamelized, separator);\n\t}\n\n\t// Split multiple uppercase characters followed by one or more lowercase characters.\n\t// `my_URLstring` → `my_ur_lstring`\n\treturn decamelized\n\t\t.replace(\n\t\t\t/(\\p{Uppercase_Letter})(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)/gu,\n\t\t\treplacement,\n\t\t)\n\t\t.toLowerCase();\n}\n"],"x_google_ignoreList":[0],"mappings":";;AAAA,MAAM,qCAAqC,CAAC,aAAa,cAAc;CAKtE,cAAc,YAAY,QACzB,yFACA,QAAM,GAAG,aAAa,CACtB;AAMD,QAAO,YAAY,QAClB,iGACA,CAAC,GAAG,IAAI,OAAO,KAAK,YAAY,GAAG,aAAa,CAChD;AACD;AAED,SAAwB,WACvB,MACA,EACC,YAAY,KACZ,+BAA+B,OAC/B,GAAG,CAAE,GACL;AACD,KAAI,EAAE,OAAO,SAAS,YAAY,OAAO,cAAc,UACtD,OAAM,IAAI,UACT;AAKF,KAAI,KAAK,SAAS,EACjB,QAAO,+BAA+B,OAAO,KAAK,aAAa;CAGhE,MAAM,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC;CAKtC,MAAM,cAAc,KAAK,QACxB,sDACA,YACA;AAED,KAAI,6BACH,QAAO,mCAAmC,aAAa,UAAU;AAKlE,QAAO,YACL,QACA,uEACA,YACA,CACA,aAAa;AACf"}
@@ -0,0 +1,17 @@
1
+ //#region ../../node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js
2
+ const handlePreserveConsecutiveUppercase = (decamelized, separator) => {
3
+ decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => $0.toLowerCase());
4
+ return decamelized.replace(/(?<!\p{Uppercase_Letter})(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => $1 + separator + $2.toLowerCase());
5
+ };
6
+ function decamelize(text, { separator = "_", preserveConsecutiveUppercase = false } = {}) {
7
+ if (!(typeof text === "string" && typeof separator === "string")) throw new TypeError("The `text` and `separator` arguments should be of type `string`");
8
+ if (text.length < 2) return preserveConsecutiveUppercase ? text : text.toLowerCase();
9
+ const replacement = `$1${separator}$2`;
10
+ const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
11
+ if (preserveConsecutiveUppercase) return handlePreserveConsecutiveUppercase(decamelized, separator);
12
+ return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
13
+ }
14
+
15
+ //#endregion
16
+ export { decamelize };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../../node_modules/.pnpm/decamelize@6.0.1/node_modules/decamelize/index.js"],"sourcesContent":["const handlePreserveConsecutiveUppercase = (decamelized, separator) => {\n\t// Lowercase all single uppercase characters. As we\n\t// want to preserve uppercase sequences, we cannot\n\t// simply lowercase the separated string at the end.\n\t// `data_For_USACounties` → `data_for_USACounties`\n\tdecamelized = decamelized.replace(\n\t\t/((?<![\\p{Uppercase_Letter}\\d])[\\p{Uppercase_Letter}\\d](?![\\p{Uppercase_Letter}\\d]))/gu,\n\t\t$0 => $0.toLowerCase(),\n\t);\n\n\t// Remaining uppercase sequences will be separated from lowercase sequences.\n\t// `data_For_USACounties` → `data_for_USA_counties`\n\t// We anchor at the start of an uppercase run to avoid excessive backtracking on\n\t// long all-uppercase substrings followed by a non-lowercase character.\n\treturn decamelized.replace(\n\t\t/(?<!\\p{Uppercase_Letter})(\\p{Uppercase_Letter}+)(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)/gu,\n\t\t(_, $1, $2) => $1 + separator + $2.toLowerCase(),\n\t);\n};\n\nexport default function decamelize(\n\ttext,\n\t{\n\t\tseparator = '_',\n\t\tpreserveConsecutiveUppercase = false,\n\t} = {},\n) {\n\tif (!(typeof text === 'string' && typeof separator === 'string')) {\n\t\tthrow new TypeError(\n\t\t\t'The `text` and `separator` arguments should be of type `string`',\n\t\t);\n\t}\n\n\t// Checking the second character is done later on. Therefore process shorter strings here.\n\tif (text.length < 2) {\n\t\treturn preserveConsecutiveUppercase ? text : text.toLowerCase();\n\t}\n\n\tconst replacement = `$1${separator}$2`;\n\n\t// Split lowercase sequences followed by uppercase character.\n\t// `dataForUSACounties` → `data_For_USACounties`\n\t// `myURLstring → `my_URLstring`\n\tconst decamelized = text.replace(\n\t\t/([\\p{Lowercase_Letter}\\d])(\\p{Uppercase_Letter})/gu,\n\t\treplacement,\n\t);\n\n\tif (preserveConsecutiveUppercase) {\n\t\treturn handlePreserveConsecutiveUppercase(decamelized, separator);\n\t}\n\n\t// Split multiple uppercase characters followed by one or more lowercase characters.\n\t// `my_URLstring` → `my_ur_lstring`\n\treturn decamelized\n\t\t.replace(\n\t\t\t/(\\p{Uppercase_Letter})(\\p{Uppercase_Letter}\\p{Lowercase_Letter}+)/gu,\n\t\t\treplacement,\n\t\t)\n\t\t.toLowerCase();\n}\n"],"x_google_ignoreList":[0],"mappings":";AAAA,MAAM,qCAAqC,CAAC,aAAa,cAAc;CAKtE,cAAc,YAAY,QACzB,yFACA,QAAM,GAAG,aAAa,CACtB;AAMD,QAAO,YAAY,QAClB,iGACA,CAAC,GAAG,IAAI,OAAO,KAAK,YAAY,GAAG,aAAa,CAChD;AACD;AAED,SAAwB,WACvB,MACA,EACC,YAAY,KACZ,+BAA+B,OAC/B,GAAG,CAAE,GACL;AACD,KAAI,EAAE,OAAO,SAAS,YAAY,OAAO,cAAc,UACtD,OAAM,IAAI,UACT;AAKF,KAAI,KAAK,SAAS,EACjB,QAAO,+BAA+B,OAAO,KAAK,aAAa;CAGhE,MAAM,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC;CAKtC,MAAM,cAAc,KAAK,QACxB,sDACA,YACA;AAED,KAAI,6BACH,QAAO,mCAAmC,aAAa,UAAU;AAKlE,QAAO,YACL,QACA,uEACA,YACA,CACA,aAAa;AACf"}
@@ -0,0 +1,27 @@
1
+
2
+ //#region ../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js
3
+ const objectToString = Object.prototype.toString;
4
+ const isError = (value) => objectToString.call(value) === "[object Error]";
5
+ const errorMessages = new Set([
6
+ "network error",
7
+ "Failed to fetch",
8
+ "NetworkError when attempting to fetch resource.",
9
+ "The Internet connection appears to be offline.",
10
+ "Network request failed",
11
+ "fetch failed",
12
+ "terminated",
13
+ " A network error occurred.",
14
+ "Network connection lost"
15
+ ]);
16
+ function isNetworkError(error) {
17
+ const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
18
+ if (!isValid) return false;
19
+ const { message, stack } = error;
20
+ if (message === "Load failed") return stack === void 0 || "__sentry_captured__" in error;
21
+ if (message.startsWith("error sending request for url")) return true;
22
+ return errorMessages.has(message);
23
+ }
24
+
25
+ //#endregion
26
+ exports.isNetworkError = isNetworkError;
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../../../../../../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js"],"sourcesContent":["const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'Failed to fetch', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n\t' A network error occurred.', // Bun (WebKit)\n\t'Network connection lost', // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\tconst {message, stack} = error;\n\n\t// Safari 17+ has generic message but no stack for network errors\n\tif (message === 'Load failed') {\n\t\treturn stack === undefined\n\t\t\t// Sentry adds its own stack trace to the fetch error, so also check for that\n\t\t\t|| '__sentry_captured__' in error;\n\t}\n\n\t// Deno network errors start with specific text\n\tif (message.startsWith('error sending request for url')) {\n\t\treturn true;\n\t}\n\n\t// Standard network error messages\n\treturn errorMessages.has(message);\n}\n"],"x_google_ignoreList":[0],"mappings":";;AAAA,MAAM,iBAAiB,OAAO,UAAU;AAExC,MAAM,UAAU,WAAS,eAAe,KAAK,MAAM,KAAK;AAExD,MAAM,gBAAgB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACA;AAED,SAAwB,eAAe,OAAO;CAC7C,MAAM,UAAU,SACZ,QAAQ,MAAM,IACd,MAAM,SAAS,eACf,OAAO,MAAM,YAAY;AAE7B,KAAI,CAAC,QACJ,QAAO;CAGR,MAAM,EAAC,SAAS,OAAM,GAAG;AAGzB,KAAI,YAAY,cACf,QAAO,UAAU,UAEb,yBAAyB;AAI9B,KAAI,QAAQ,WAAW,gCAAgC,CACtD,QAAO;AAIR,QAAO,cAAc,IAAI,QAAQ;AACjC"}
@@ -0,0 +1,26 @@
1
+ //#region ../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js
2
+ const objectToString = Object.prototype.toString;
3
+ const isError = (value) => objectToString.call(value) === "[object Error]";
4
+ const errorMessages = new Set([
5
+ "network error",
6
+ "Failed to fetch",
7
+ "NetworkError when attempting to fetch resource.",
8
+ "The Internet connection appears to be offline.",
9
+ "Network request failed",
10
+ "fetch failed",
11
+ "terminated",
12
+ " A network error occurred.",
13
+ "Network connection lost"
14
+ ]);
15
+ function isNetworkError(error) {
16
+ const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
17
+ if (!isValid) return false;
18
+ const { message, stack } = error;
19
+ if (message === "Load failed") return stack === void 0 || "__sentry_captured__" in error;
20
+ if (message.startsWith("error sending request for url")) return true;
21
+ return errorMessages.has(message);
22
+ }
23
+
24
+ //#endregion
25
+ export { isNetworkError };
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js"],"sourcesContent":["const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'Failed to fetch', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n\t' A network error occurred.', // Bun (WebKit)\n\t'Network connection lost', // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\tconst {message, stack} = error;\n\n\t// Safari 17+ has generic message but no stack for network errors\n\tif (message === 'Load failed') {\n\t\treturn stack === undefined\n\t\t\t// Sentry adds its own stack trace to the fetch error, so also check for that\n\t\t\t|| '__sentry_captured__' in error;\n\t}\n\n\t// Deno network errors start with specific text\n\tif (message.startsWith('error sending request for url')) {\n\t\treturn true;\n\t}\n\n\t// Standard network error messages\n\treturn errorMessages.has(message);\n}\n"],"x_google_ignoreList":[0],"mappings":";AAAA,MAAM,iBAAiB,OAAO,UAAU;AAExC,MAAM,UAAU,WAAS,eAAe,KAAK,MAAM,KAAK;AAExD,MAAM,gBAAgB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACA;AAED,SAAwB,eAAe,OAAO;CAC7C,MAAM,UAAU,SACZ,QAAQ,MAAM,IACd,MAAM,SAAS,eACf,OAAO,MAAM,YAAY;AAE7B,KAAI,CAAC,QACJ,QAAO;CAGR,MAAM,EAAC,SAAS,OAAM,GAAG;AAGzB,KAAI,YAAY,cACf,QAAO,UAAU,UAEb,yBAAyB;AAI9B,KAAI,QAAQ,WAAW,gCAAgC,CACtD,QAAO;AAIR,QAAO,cAAc,IAAI,QAAQ;AACjC"}
@@ -0,0 +1,141 @@
1
+ const require_index = require('../../../is-network-error@1.3.0/node_modules/is-network-error/index.cjs');
2
+
3
+ //#region ../../node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js
4
+ function validateRetries(retries) {
5
+ if (typeof retries === "number") {
6
+ if (retries < 0) throw new TypeError("Expected `retries` to be a non-negative number.");
7
+ if (Number.isNaN(retries)) throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.");
8
+ } else if (retries !== void 0) throw new TypeError("Expected `retries` to be a number or Infinity.");
9
+ }
10
+ function validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {
11
+ if (value === void 0) return;
12
+ if (typeof value !== "number" || Number.isNaN(value)) throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
13
+ if (!allowInfinity && !Number.isFinite(value)) throw new TypeError(`Expected \`${name}\` to be a finite number.`);
14
+ if (value < min) throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
15
+ }
16
+ var AbortError = class extends Error {
17
+ constructor(message) {
18
+ super();
19
+ if (message instanceof Error) {
20
+ this.originalError = message;
21
+ ({message} = message);
22
+ } else {
23
+ this.originalError = new Error(message);
24
+ this.originalError.stack = this.stack;
25
+ }
26
+ this.name = "AbortError";
27
+ this.message = message;
28
+ }
29
+ };
30
+ function calculateDelay(retriesConsumed, options) {
31
+ const attempt = Math.max(1, retriesConsumed + 1);
32
+ const random = options.randomize ? Math.random() + 1 : 1;
33
+ let timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
34
+ timeout = Math.min(timeout, options.maxTimeout);
35
+ return timeout;
36
+ }
37
+ function calculateRemainingTime(start, max) {
38
+ if (!Number.isFinite(max)) return max;
39
+ return max - (performance.now() - start);
40
+ }
41
+ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTime, options }) {
42
+ const normalizedError = error instanceof Error ? error : /* @__PURE__ */ new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
43
+ if (normalizedError instanceof AbortError) throw normalizedError.originalError;
44
+ const retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;
45
+ const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
46
+ const context = Object.freeze({
47
+ error: normalizedError,
48
+ attemptNumber,
49
+ retriesLeft,
50
+ retriesConsumed
51
+ });
52
+ await options.onFailedAttempt(context);
53
+ if (calculateRemainingTime(startTime, maxRetryTime) <= 0) throw normalizedError;
54
+ const consumeRetry = await options.shouldConsumeRetry(context);
55
+ const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
56
+ if (remainingTime <= 0 || retriesLeft <= 0) throw normalizedError;
57
+ if (normalizedError instanceof TypeError && !require_index.isNetworkError(normalizedError)) {
58
+ if (consumeRetry) throw normalizedError;
59
+ options.signal?.throwIfAborted();
60
+ return false;
61
+ }
62
+ if (!await options.shouldRetry(context)) throw normalizedError;
63
+ if (!consumeRetry) {
64
+ options.signal?.throwIfAborted();
65
+ return false;
66
+ }
67
+ const delayTime = calculateDelay(retriesConsumed, options);
68
+ const finalDelay = Math.min(delayTime, remainingTime);
69
+ if (finalDelay > 0) await new Promise((resolve, reject) => {
70
+ const onAbort = () => {
71
+ clearTimeout(timeoutToken);
72
+ options.signal?.removeEventListener("abort", onAbort);
73
+ reject(options.signal.reason);
74
+ };
75
+ const timeoutToken = setTimeout(() => {
76
+ options.signal?.removeEventListener("abort", onAbort);
77
+ resolve();
78
+ }, finalDelay);
79
+ if (options.unref) timeoutToken.unref?.();
80
+ options.signal?.addEventListener("abort", onAbort, { once: true });
81
+ });
82
+ options.signal?.throwIfAborted();
83
+ return true;
84
+ }
85
+ async function pRetry(input, options = {}) {
86
+ options = { ...options };
87
+ validateRetries(options.retries);
88
+ if (Object.hasOwn(options, "forever")) throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
89
+ options.retries ??= 10;
90
+ options.factor ??= 2;
91
+ options.minTimeout ??= 1e3;
92
+ options.maxTimeout ??= Number.POSITIVE_INFINITY;
93
+ options.maxRetryTime ??= Number.POSITIVE_INFINITY;
94
+ options.randomize ??= false;
95
+ options.onFailedAttempt ??= () => {};
96
+ options.shouldRetry ??= () => true;
97
+ options.shouldConsumeRetry ??= () => true;
98
+ validateNumberOption("factor", options.factor, {
99
+ min: 0,
100
+ allowInfinity: false
101
+ });
102
+ validateNumberOption("minTimeout", options.minTimeout, {
103
+ min: 0,
104
+ allowInfinity: false
105
+ });
106
+ validateNumberOption("maxTimeout", options.maxTimeout, {
107
+ min: 0,
108
+ allowInfinity: true
109
+ });
110
+ validateNumberOption("maxRetryTime", options.maxRetryTime, {
111
+ min: 0,
112
+ allowInfinity: true
113
+ });
114
+ if (!(options.factor > 0)) options.factor = 1;
115
+ options.signal?.throwIfAborted();
116
+ let attemptNumber = 0;
117
+ let retriesConsumed = 0;
118
+ const startTime = performance.now();
119
+ while (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {
120
+ attemptNumber++;
121
+ try {
122
+ options.signal?.throwIfAborted();
123
+ const result = await input(attemptNumber);
124
+ options.signal?.throwIfAborted();
125
+ return result;
126
+ } catch (error) {
127
+ if (await onAttemptFailure({
128
+ error,
129
+ attemptNumber,
130
+ retriesConsumed,
131
+ startTime,
132
+ options
133
+ })) retriesConsumed++;
134
+ }
135
+ }
136
+ throw new Error("Retry attempts exhausted without throwing an error.");
137
+ }
138
+
139
+ //#endregion
140
+ exports.pRetry = pRetry;
141
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["isNetworkError"],"sources":["../../../../../../../../node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js"],"sourcesContent":["import isNetworkError from 'is-network-error';\n\nfunction validateRetries(retries) {\n\tif (typeof retries === 'number') {\n\t\tif (retries < 0) {\n\t\t\tthrow new TypeError('Expected `retries` to be a non-negative number.');\n\t\t}\n\n\t\tif (Number.isNaN(retries)) {\n\t\t\tthrow new TypeError('Expected `retries` to be a valid number or Infinity, got NaN.');\n\t\t}\n\t} else if (retries !== undefined) {\n\t\tthrow new TypeError('Expected `retries` to be a number or Infinity.');\n\t}\n}\n\nfunction validateNumberOption(name, value, {min = 0, allowInfinity = false} = {}) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || Number.isNaN(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a number${allowInfinity ? ' or Infinity' : ''}.`);\n\t}\n\n\tif (!allowInfinity && !Number.isFinite(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a finite number.`);\n\t}\n\n\tif (value < min) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be \\u2265 ${min}.`);\n\t}\n}\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nfunction calculateDelay(retriesConsumed, options) {\n\tconst attempt = Math.max(1, retriesConsumed + 1);\n\tconst random = options.randomize ? (Math.random() + 1) : 1;\n\n\tlet timeout = Math.round(random * options.minTimeout * (options.factor ** (attempt - 1)));\n\ttimeout = Math.min(timeout, options.maxTimeout);\n\n\treturn timeout;\n}\n\nfunction calculateRemainingTime(start, max) {\n\tif (!Number.isFinite(max)) {\n\t\treturn max;\n\t}\n\n\treturn max - (performance.now() - start);\n}\n\nasync function onAttemptFailure({error, attemptNumber, retriesConsumed, startTime, options}) {\n\tconst normalizedError = error instanceof Error\n\t\t? error\n\t\t: new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\n\tif (normalizedError instanceof AbortError) {\n\t\tthrow normalizedError.originalError;\n\t}\n\n\tconst retriesLeft = Number.isFinite(options.retries)\n\t\t? Math.max(0, options.retries - retriesConsumed)\n\t\t: options.retries;\n\n\tconst maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;\n\n\tconst context = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t});\n\n\tawait options.onFailedAttempt(context);\n\n\tif (calculateRemainingTime(startTime, maxRetryTime) <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst consumeRetry = await options.shouldConsumeRetry(context);\n\n\tconst remainingTime = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTime <= 0 || retriesLeft <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {\n\t\tif (consumeRetry) {\n\t\t\tthrow normalizedError;\n\t\t}\n\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tif (!await options.shouldRetry(context)) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!consumeRetry) {\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tconst delayTime = calculateDelay(retriesConsumed, options);\n\tconst finalDelay = Math.min(delayTime, remainingTime);\n\n\tif (finalDelay > 0) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tconst onAbort = () => {\n\t\t\t\tclearTimeout(timeoutToken);\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\treject(options.signal.reason);\n\t\t\t};\n\n\t\t\tconst timeoutToken = setTimeout(() => {\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\tresolve();\n\t\t\t}, finalDelay);\n\n\t\t\tif (options.unref) {\n\t\t\t\ttimeoutToken.unref?.();\n\t\t\t}\n\n\t\t\toptions.signal?.addEventListener('abort', onAbort, {once: true});\n\t\t});\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\treturn true;\n}\n\nexport default async function pRetry(input, options = {}) {\n\toptions = {...options};\n\n\tvalidateRetries(options.retries);\n\n\tif (Object.hasOwn(options, 'forever')) {\n\t\tthrow new Error('The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.');\n\t}\n\n\toptions.retries ??= 10;\n\toptions.factor ??= 2;\n\toptions.minTimeout ??= 1000;\n\toptions.maxTimeout ??= Number.POSITIVE_INFINITY;\n\toptions.maxRetryTime ??= Number.POSITIVE_INFINITY;\n\toptions.randomize ??= false;\n\toptions.onFailedAttempt ??= () => {};\n\toptions.shouldRetry ??= () => true;\n\toptions.shouldConsumeRetry ??= () => true;\n\n\t// Validate numeric options and normalize edge cases\n\tvalidateNumberOption('factor', options.factor, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('minTimeout', options.minTimeout, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('maxTimeout', options.maxTimeout, {min: 0, allowInfinity: true});\n\tvalidateNumberOption('maxRetryTime', options.maxRetryTime, {min: 0, allowInfinity: true});\n\n\t// Treat non-positive factor as 1 to avoid zero backoff or negative behavior\n\tif (!(options.factor > 0)) {\n\t\toptions.factor = 1;\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tlet attemptNumber = 0;\n\tlet retriesConsumed = 0;\n\tconst startTime = performance.now();\n\n\twhile (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {\n\t\tattemptNumber++;\n\n\t\ttry {\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\tconst result = await input(attemptNumber);\n\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (await onAttemptFailure({\n\t\t\t\terror,\n\t\t\t\tattemptNumber,\n\t\t\t\tretriesConsumed,\n\t\t\t\tstartTime,\n\t\t\t\toptions,\n\t\t\t})) {\n\t\t\t\tretriesConsumed++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Should not reach here, but in case it does, throw an error\n\tthrow new Error('Retry attempts exhausted without throwing an error.');\n}\n\nexport function makeRetriable(function_, options) {\n\treturn function (...arguments_) {\n\t\treturn pRetry(() => function_.apply(this, arguments_), options);\n\t};\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AAEA,SAAS,gBAAgB,SAAS;AACjC,KAAI,OAAO,YAAY,UAAU;AAChC,MAAI,UAAU,EACb,OAAM,IAAI,UAAU;AAGrB,MAAI,OAAO,MAAM,QAAQ,CACxB,OAAM,IAAI,UAAU;CAErB,WAAU,YAAY,OACtB,OAAM,IAAI,UAAU;AAErB;AAED,SAAS,qBAAqB,MAAM,OAAO,EAAC,MAAM,GAAG,gBAAgB,OAAM,GAAG,CAAE,GAAE;AACjF,KAAI,UAAU,OACb;AAGD,KAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CACnD,OAAM,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,iBAAiB,EAAE,gBAAgB,iBAAiB,GAAG,CAAC,CAAC;AAGjG,KAAI,CAAC,iBAAiB,CAAC,OAAO,SAAS,MAAM,CAC5C,OAAM,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,yBAAyB,CAAC;AAGlE,KAAI,QAAQ,IACX,OAAM,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,gBAAgB,EAAE,IAAI,CAAC,CAAC;AAEhE;AAED,IAAa,aAAb,cAAgC,MAAM;CACrC,YAAY,SAAS;EACpB,OAAO;AAEP,MAAI,mBAAmB,OAAO;GAC7B,KAAK,gBAAgB;IACpB,CAAC,QAAQ,GAAG;EACb,OAAM;GACN,KAAK,gBAAgB,IAAI,MAAM;GAC/B,KAAK,cAAc,QAAQ,KAAK;EAChC;EAED,KAAK,OAAO;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,cAAc;EAAC,KAAK;EAAG,eAAe;CAAK,EAAC;AAGzF,KAAI,EAAE,QAAQ,SAAS,IACtB,QAAQ,SAAS;CAGlB,QAAQ,QAAQ,gBAAgB;CAEhC,IAAI,gBAAgB;CACpB,IAAI,kBAAkB;CACtB,MAAM,YAAY,YAAY,KAAK;AAEnC,QAAO,OAAO,SAAS,QAAQ,QAAQ,GAAG,mBAAmB,QAAQ,UAAU,MAAM;EACpF;AAEA,MAAI;GACH,QAAQ,QAAQ,gBAAgB;GAEhC,MAAM,SAAS,MAAM,MAAM,cAAc;GAEzC,QAAQ,QAAQ,gBAAgB;AAEhC,UAAO;EACP,SAAQ,OAAO;AACf,OAAI,MAAM,iBAAiB;IAC1B;IACA;IACA;IACA;IACA;GACA,EAAC,EACD;EAED;CACD;AAGD,OAAM,IAAI,MAAM;AAChB"}
@@ -0,0 +1,141 @@
1
+ import { isNetworkError } from "../../../is-network-error@1.3.0/node_modules/is-network-error/index.js";
2
+
3
+ //#region ../../node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js
4
+ function validateRetries(retries) {
5
+ if (typeof retries === "number") {
6
+ if (retries < 0) throw new TypeError("Expected `retries` to be a non-negative number.");
7
+ if (Number.isNaN(retries)) throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.");
8
+ } else if (retries !== void 0) throw new TypeError("Expected `retries` to be a number or Infinity.");
9
+ }
10
+ function validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {
11
+ if (value === void 0) return;
12
+ if (typeof value !== "number" || Number.isNaN(value)) throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
13
+ if (!allowInfinity && !Number.isFinite(value)) throw new TypeError(`Expected \`${name}\` to be a finite number.`);
14
+ if (value < min) throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
15
+ }
16
+ var AbortError = class extends Error {
17
+ constructor(message) {
18
+ super();
19
+ if (message instanceof Error) {
20
+ this.originalError = message;
21
+ ({message} = message);
22
+ } else {
23
+ this.originalError = new Error(message);
24
+ this.originalError.stack = this.stack;
25
+ }
26
+ this.name = "AbortError";
27
+ this.message = message;
28
+ }
29
+ };
30
+ function calculateDelay(retriesConsumed, options) {
31
+ const attempt = Math.max(1, retriesConsumed + 1);
32
+ const random = options.randomize ? Math.random() + 1 : 1;
33
+ let timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
34
+ timeout = Math.min(timeout, options.maxTimeout);
35
+ return timeout;
36
+ }
37
+ function calculateRemainingTime(start, max) {
38
+ if (!Number.isFinite(max)) return max;
39
+ return max - (performance.now() - start);
40
+ }
41
+ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTime, options }) {
42
+ const normalizedError = error instanceof Error ? error : /* @__PURE__ */ new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
43
+ if (normalizedError instanceof AbortError) throw normalizedError.originalError;
44
+ const retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;
45
+ const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
46
+ const context = Object.freeze({
47
+ error: normalizedError,
48
+ attemptNumber,
49
+ retriesLeft,
50
+ retriesConsumed
51
+ });
52
+ await options.onFailedAttempt(context);
53
+ if (calculateRemainingTime(startTime, maxRetryTime) <= 0) throw normalizedError;
54
+ const consumeRetry = await options.shouldConsumeRetry(context);
55
+ const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
56
+ if (remainingTime <= 0 || retriesLeft <= 0) throw normalizedError;
57
+ if (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {
58
+ if (consumeRetry) throw normalizedError;
59
+ options.signal?.throwIfAborted();
60
+ return false;
61
+ }
62
+ if (!await options.shouldRetry(context)) throw normalizedError;
63
+ if (!consumeRetry) {
64
+ options.signal?.throwIfAborted();
65
+ return false;
66
+ }
67
+ const delayTime = calculateDelay(retriesConsumed, options);
68
+ const finalDelay = Math.min(delayTime, remainingTime);
69
+ if (finalDelay > 0) await new Promise((resolve, reject) => {
70
+ const onAbort = () => {
71
+ clearTimeout(timeoutToken);
72
+ options.signal?.removeEventListener("abort", onAbort);
73
+ reject(options.signal.reason);
74
+ };
75
+ const timeoutToken = setTimeout(() => {
76
+ options.signal?.removeEventListener("abort", onAbort);
77
+ resolve();
78
+ }, finalDelay);
79
+ if (options.unref) timeoutToken.unref?.();
80
+ options.signal?.addEventListener("abort", onAbort, { once: true });
81
+ });
82
+ options.signal?.throwIfAborted();
83
+ return true;
84
+ }
85
+ async function pRetry(input, options = {}) {
86
+ options = { ...options };
87
+ validateRetries(options.retries);
88
+ if (Object.hasOwn(options, "forever")) throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
89
+ options.retries ??= 10;
90
+ options.factor ??= 2;
91
+ options.minTimeout ??= 1e3;
92
+ options.maxTimeout ??= Number.POSITIVE_INFINITY;
93
+ options.maxRetryTime ??= Number.POSITIVE_INFINITY;
94
+ options.randomize ??= false;
95
+ options.onFailedAttempt ??= () => {};
96
+ options.shouldRetry ??= () => true;
97
+ options.shouldConsumeRetry ??= () => true;
98
+ validateNumberOption("factor", options.factor, {
99
+ min: 0,
100
+ allowInfinity: false
101
+ });
102
+ validateNumberOption("minTimeout", options.minTimeout, {
103
+ min: 0,
104
+ allowInfinity: false
105
+ });
106
+ validateNumberOption("maxTimeout", options.maxTimeout, {
107
+ min: 0,
108
+ allowInfinity: true
109
+ });
110
+ validateNumberOption("maxRetryTime", options.maxRetryTime, {
111
+ min: 0,
112
+ allowInfinity: true
113
+ });
114
+ if (!(options.factor > 0)) options.factor = 1;
115
+ options.signal?.throwIfAborted();
116
+ let attemptNumber = 0;
117
+ let retriesConsumed = 0;
118
+ const startTime = performance.now();
119
+ while (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {
120
+ attemptNumber++;
121
+ try {
122
+ options.signal?.throwIfAborted();
123
+ const result = await input(attemptNumber);
124
+ options.signal?.throwIfAborted();
125
+ return result;
126
+ } catch (error) {
127
+ if (await onAttemptFailure({
128
+ error,
129
+ attemptNumber,
130
+ retriesConsumed,
131
+ startTime,
132
+ options
133
+ })) retriesConsumed++;
134
+ }
135
+ }
136
+ throw new Error("Retry attempts exhausted without throwing an error.");
137
+ }
138
+
139
+ //#endregion
140
+ export { pRetry };
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../../node_modules/.pnpm/p-retry@7.1.0/node_modules/p-retry/index.js"],"sourcesContent":["import isNetworkError from 'is-network-error';\n\nfunction validateRetries(retries) {\n\tif (typeof retries === 'number') {\n\t\tif (retries < 0) {\n\t\t\tthrow new TypeError('Expected `retries` to be a non-negative number.');\n\t\t}\n\n\t\tif (Number.isNaN(retries)) {\n\t\t\tthrow new TypeError('Expected `retries` to be a valid number or Infinity, got NaN.');\n\t\t}\n\t} else if (retries !== undefined) {\n\t\tthrow new TypeError('Expected `retries` to be a number or Infinity.');\n\t}\n}\n\nfunction validateNumberOption(name, value, {min = 0, allowInfinity = false} = {}) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || Number.isNaN(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a number${allowInfinity ? ' or Infinity' : ''}.`);\n\t}\n\n\tif (!allowInfinity && !Number.isFinite(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a finite number.`);\n\t}\n\n\tif (value < min) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be \\u2265 ${min}.`);\n\t}\n}\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nfunction calculateDelay(retriesConsumed, options) {\n\tconst attempt = Math.max(1, retriesConsumed + 1);\n\tconst random = options.randomize ? (Math.random() + 1) : 1;\n\n\tlet timeout = Math.round(random * options.minTimeout * (options.factor ** (attempt - 1)));\n\ttimeout = Math.min(timeout, options.maxTimeout);\n\n\treturn timeout;\n}\n\nfunction calculateRemainingTime(start, max) {\n\tif (!Number.isFinite(max)) {\n\t\treturn max;\n\t}\n\n\treturn max - (performance.now() - start);\n}\n\nasync function onAttemptFailure({error, attemptNumber, retriesConsumed, startTime, options}) {\n\tconst normalizedError = error instanceof Error\n\t\t? error\n\t\t: new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\n\tif (normalizedError instanceof AbortError) {\n\t\tthrow normalizedError.originalError;\n\t}\n\n\tconst retriesLeft = Number.isFinite(options.retries)\n\t\t? Math.max(0, options.retries - retriesConsumed)\n\t\t: options.retries;\n\n\tconst maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;\n\n\tconst context = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t});\n\n\tawait options.onFailedAttempt(context);\n\n\tif (calculateRemainingTime(startTime, maxRetryTime) <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst consumeRetry = await options.shouldConsumeRetry(context);\n\n\tconst remainingTime = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTime <= 0 || retriesLeft <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {\n\t\tif (consumeRetry) {\n\t\t\tthrow normalizedError;\n\t\t}\n\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tif (!await options.shouldRetry(context)) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!consumeRetry) {\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tconst delayTime = calculateDelay(retriesConsumed, options);\n\tconst finalDelay = Math.min(delayTime, remainingTime);\n\n\tif (finalDelay > 0) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tconst onAbort = () => {\n\t\t\t\tclearTimeout(timeoutToken);\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\treject(options.signal.reason);\n\t\t\t};\n\n\t\t\tconst timeoutToken = setTimeout(() => {\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\tresolve();\n\t\t\t}, finalDelay);\n\n\t\t\tif (options.unref) {\n\t\t\t\ttimeoutToken.unref?.();\n\t\t\t}\n\n\t\t\toptions.signal?.addEventListener('abort', onAbort, {once: true});\n\t\t});\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\treturn true;\n}\n\nexport default async function pRetry(input, options = {}) {\n\toptions = {...options};\n\n\tvalidateRetries(options.retries);\n\n\tif (Object.hasOwn(options, 'forever')) {\n\t\tthrow new Error('The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.');\n\t}\n\n\toptions.retries ??= 10;\n\toptions.factor ??= 2;\n\toptions.minTimeout ??= 1000;\n\toptions.maxTimeout ??= Number.POSITIVE_INFINITY;\n\toptions.maxRetryTime ??= Number.POSITIVE_INFINITY;\n\toptions.randomize ??= false;\n\toptions.onFailedAttempt ??= () => {};\n\toptions.shouldRetry ??= () => true;\n\toptions.shouldConsumeRetry ??= () => true;\n\n\t// Validate numeric options and normalize edge cases\n\tvalidateNumberOption('factor', options.factor, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('minTimeout', options.minTimeout, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('maxTimeout', options.maxTimeout, {min: 0, allowInfinity: true});\n\tvalidateNumberOption('maxRetryTime', options.maxRetryTime, {min: 0, allowInfinity: true});\n\n\t// Treat non-positive factor as 1 to avoid zero backoff or negative behavior\n\tif (!(options.factor > 0)) {\n\t\toptions.factor = 1;\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tlet attemptNumber = 0;\n\tlet retriesConsumed = 0;\n\tconst startTime = performance.now();\n\n\twhile (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {\n\t\tattemptNumber++;\n\n\t\ttry {\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\tconst result = await input(attemptNumber);\n\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (await onAttemptFailure({\n\t\t\t\terror,\n\t\t\t\tattemptNumber,\n\t\t\t\tretriesConsumed,\n\t\t\t\tstartTime,\n\t\t\t\toptions,\n\t\t\t})) {\n\t\t\t\tretriesConsumed++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Should not reach here, but in case it does, throw an error\n\tthrow new Error('Retry attempts exhausted without throwing an error.');\n}\n\nexport function makeRetriable(function_, options) {\n\treturn function (...arguments_) {\n\t\treturn pRetry(() => function_.apply(this, arguments_), options);\n\t};\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AAEA,SAAS,gBAAgB,SAAS;AACjC,KAAI,OAAO,YAAY,UAAU;AAChC,MAAI,UAAU,EACb,OAAM,IAAI,UAAU;AAGrB,MAAI,OAAO,MAAM,QAAQ,CACxB,OAAM,IAAI,UAAU;CAErB,WAAU,YAAY,OACtB,OAAM,IAAI,UAAU;AAErB;AAED,SAAS,qBAAqB,MAAM,OAAO,EAAC,MAAM,GAAG,gBAAgB,OAAM,GAAG,CAAE,GAAE;AACjF,KAAI,UAAU,OACb;AAGD,KAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CACnD,OAAM,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,iBAAiB,EAAE,gBAAgB,iBAAiB,GAAG,CAAC,CAAC;AAGjG,KAAI,CAAC,iBAAiB,CAAC,OAAO,SAAS,MAAM,CAC5C,OAAM,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,yBAAyB,CAAC;AAGlE,KAAI,QAAQ,IACX,OAAM,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,gBAAgB,EAAE,IAAI,CAAC,CAA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GrC,qBAAqB,UAAU,QAAQ,QAAQ;EAAC,KAAK;EAAG,eAAe;CAAM,EAAC;CAC9E,qBAAqB,cAAc,QAAQ,YAAY;EAAC,KAAK;EAAG,eAAe;CAAM,EAAC;CACtF,qBAAqB,cAAc,QAAQ,YAAY;EAAC,KAAK;EAAG,eAAe;CAAK,EAAC;CACrF,qBAAqB,gBAAgB,QAAQ,cAAc;EAAC,KAAK;EAAG,eAAe;CAAK,EAAC;AAGzF,KAAI,EAAE,QAAQ,SAAS,IACtB,QAAQ,SAAS;CAGlB,QAAQ,QAAQ,gBAAgB;CAEhC,IAAI,gBAAgB;CACpB,IAAI,kBAAkB;CACtB,MAAM,YAAY,YAAY,KAAK;AAEnC,QAAO,OAAO,SAAS,QAAQ,QAAQ,GAAG,mBAAmB,QAAQ,UAAU,MAAM;EACpF;AAEA,MAAI;GACH,QAAQ,QAAQ,gBAAgB;GAEhC,MAAM,SAAS,MAAM,MAAM,cAAc;GAEzC,QAAQ,QAAQ,gBAAgB;AAEhC,UAAO;EACP,SAAQ,OAAO;AACf,OAAI,MAAM,iBAAiB;IAC1B;IACA;IACA;IACA;IACA;GACA,EAAC,EACD;EAED;CACD;AAGD,OAAM,IAAI,MAAM;AAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"json.cjs","names":["BaseCumulativeTransformOutputParser","first: T","second: T","prev: unknown | undefined","next: unknown","compare","generations: ChatGeneration[] | Generation[]","parseJsonMarkdown","text: string"],"sources":["../../src/output_parsers/json.ts"],"sourcesContent":["import { BaseCumulativeTransformOutputParser } from \"./transform.js\";\nimport { Operation, compare } from \"../utils/json_patch.js\";\nimport { ChatGeneration, Generation } from \"../outputs.js\";\nimport { parseJsonMarkdown, parsePartialJson } from \"../utils/json.js\";\n\n/**\n * Class for parsing the output of an LLM into a JSON object.\n */\nexport class JsonOutputParser<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Record<string, any> = Record<string, any>\n> extends BaseCumulativeTransformOutputParser<T> {\n static lc_name() {\n return \"JsonOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\"];\n\n lc_serializable = true;\n\n /** @internal */\n override _concatOutputChunks<T>(first: T, second: T): T {\n if (this.diff) {\n return super._concatOutputChunks(first, second);\n }\n return second;\n }\n\n protected _diff(\n prev: unknown | undefined,\n next: unknown\n ): Operation[] | undefined {\n if (!next) {\n return undefined;\n }\n if (!prev) {\n return [{ op: \"replace\", path: \"\", value: next }];\n }\n return compare(prev, next);\n }\n\n // This should actually return Partial<T>, but there's no way\n // to specify emitted chunks as instances separate from the main output type.\n async parsePartialResult(\n generations: ChatGeneration[] | Generation[]\n ): Promise<T | undefined> {\n return parseJsonMarkdown(generations[0].text);\n }\n\n async parse(text: string): Promise<T> {\n return parseJsonMarkdown(text, JSON.parse);\n }\n\n getFormatInstructions(): string {\n return \"\";\n }\n}\n\nexport { parsePartialJson, parseJsonMarkdown };\n"],"mappings":";;;;;;;;;AAQA,IAAa,mBAAb,cAGUA,sDAAuC;CAC/C,OAAO,UAAU;AACf,SAAO;CACR;CAED,eAAe,CAAC,kBAAkB,gBAAiB;CAEnD,kBAAkB;;CAGlB,AAAS,oBAAuBC,OAAUC,QAAc;AACtD,MAAI,KAAK,KACP,QAAO,MAAM,oBAAoB,OAAO,OAAO;AAEjD,SAAO;CACR;CAED,AAAU,MACRC,MACAC,MACyB;AACzB,MAAI,CAAC,KACH,QAAO;AAET,MAAI,CAAC,KACH,QAAO,CAAC;GAAE,IAAI;GAAW,MAAM;GAAI,OAAO;EAAM,CAAC;AAEnD,SAAOC,uBAAQ,MAAM,KAAK;CAC3B;CAID,MAAM,mBACJC,aACwB;AACxB,SAAOC,+BAAkB,YAAY,GAAG,KAAK;CAC9C;CAED,MAAM,MAAMC,MAA0B;AACpC,SAAOD,+BAAkB,MAAM,KAAK,MAAM;CAC3C;CAED,wBAAgC;AAC9B,SAAO;CACR;AACF"}
1
+ {"version":3,"file":"json.cjs","names":["BaseCumulativeTransformOutputParser","first: T","second: T","prev: unknown | undefined","next: unknown","compare","generations: ChatGeneration[] | Generation[]","parseJsonMarkdown","text: string"],"sources":["../../src/output_parsers/json.ts"],"sourcesContent":["import { BaseCumulativeTransformOutputParser } from \"./transform.js\";\nimport { Operation, compare } from \"../utils/json_patch.js\";\nimport { ChatGeneration, Generation } from \"../outputs.js\";\nimport { parseJsonMarkdown, parsePartialJson } from \"../utils/json.js\";\n\n/**\n * Class for parsing the output of an LLM into a JSON object.\n */\nexport class JsonOutputParser<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Record<string, any> = Record<string, any>\n> extends BaseCumulativeTransformOutputParser<T> {\n static lc_name() {\n return \"JsonOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\"];\n\n lc_serializable = true;\n\n /** @internal */\n override _concatOutputChunks<T>(first: T, second: T): T {\n if (this.diff) {\n return super._concatOutputChunks(first, second);\n }\n return second;\n }\n\n protected _diff(\n prev: unknown | undefined,\n next: unknown\n ): Operation[] | undefined {\n if (!next) {\n return undefined;\n }\n if (!prev) {\n return [{ op: \"replace\", path: \"\", value: next }];\n }\n return compare(prev, next);\n }\n\n // This should actually return Partial<T>, but there's no way\n // to specify emitted chunks as instances separate from the main output type.\n async parsePartialResult(\n generations: ChatGeneration[] | Generation[]\n ): Promise<T | undefined> {\n return parseJsonMarkdown(generations[0].text) as T | undefined;\n }\n\n async parse(text: string): Promise<T> {\n return parseJsonMarkdown(text, JSON.parse) as T;\n }\n\n getFormatInstructions(): string {\n return \"\";\n }\n}\n\nexport { parsePartialJson, parseJsonMarkdown };\n"],"mappings":";;;;;;;;;AAQA,IAAa,mBAAb,cAGUA,sDAAuC;CAC/C,OAAO,UAAU;AACf,SAAO;CACR;CAED,eAAe,CAAC,kBAAkB,gBAAiB;CAEnD,kBAAkB;;CAGlB,AAAS,oBAAuBC,OAAUC,QAAc;AACtD,MAAI,KAAK,KACP,QAAO,MAAM,oBAAoB,OAAO,OAAO;AAEjD,SAAO;CACR;CAED,AAAU,MACRC,MACAC,MACyB;AACzB,MAAI,CAAC,KACH,QAAO;AAET,MAAI,CAAC,KACH,QAAO,CAAC;GAAE,IAAI;GAAW,MAAM;GAAI,OAAO;EAAM,CAAC;AAEnD,SAAOC,uBAAQ,MAAM,KAAK;CAC3B;CAID,MAAM,mBACJC,aACwB;AACxB,SAAOC,+BAAkB,YAAY,GAAG,KAAK;CAC9C;CAED,MAAM,MAAMC,MAA0B;AACpC,SAAOD,+BAAkB,MAAM,KAAK,MAAM;CAC3C;CAED,wBAAgC;AAC9B,SAAO;CACR;AACF"}