@langchain/langgraph-sdk 1.9.24 → 1.9.26

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 (163) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +2 -0
  2. package/dist/_virtual/_rolldown/runtime.js +24 -0
  3. package/dist/client/base.cjs.map +1 -1
  4. package/dist/client/base.d.cts.map +1 -1
  5. package/dist/client/base.d.ts.map +1 -1
  6. package/dist/client/base.js.map +1 -1
  7. package/dist/client/crons/index.cjs +18 -17
  8. package/dist/client/crons/index.cjs.map +1 -1
  9. package/dist/client/crons/index.d.cts.map +1 -1
  10. package/dist/client/crons/index.d.ts.map +1 -1
  11. package/dist/client/crons/index.js +18 -17
  12. package/dist/client/crons/index.js.map +1 -1
  13. package/dist/client/index.cjs +1 -1
  14. package/dist/client/index.js +1 -1
  15. package/dist/client/stream/index.cjs +1 -1
  16. package/dist/client/stream/index.js +1 -1
  17. package/dist/client/stream/transport/agent-server.cjs +1 -1
  18. package/dist/client/stream/transport/agent-server.js +1 -1
  19. package/dist/client/stream/transport/http.cjs +4 -4
  20. package/dist/client/stream/transport/http.cjs.map +1 -1
  21. package/dist/client/stream/transport/http.d.cts.map +1 -1
  22. package/dist/client/stream/transport/http.d.ts.map +1 -1
  23. package/dist/client/stream/transport/http.js +4 -4
  24. package/dist/client/stream/transport/http.js.map +1 -1
  25. package/dist/client/stream/transport/index.cjs +1 -1
  26. package/dist/client/stream/transport/index.js +1 -1
  27. package/dist/client/stream/transport/types.d.cts +18 -8
  28. package/dist/client/stream/transport/types.d.cts.map +1 -1
  29. package/dist/client/stream/transport/types.d.ts +18 -8
  30. package/dist/client/stream/transport/types.d.ts.map +1 -1
  31. package/dist/client/stream/transport/websocket.cjs +2 -9
  32. package/dist/client/stream/transport/websocket.cjs.map +1 -1
  33. package/dist/client/stream/transport/websocket.d.cts.map +1 -1
  34. package/dist/client/stream/transport/websocket.d.ts.map +1 -1
  35. package/dist/client/stream/transport/websocket.js +3 -9
  36. package/dist/client/stream/transport/websocket.js.map +1 -1
  37. package/dist/client/stream/types.d.cts +9 -6
  38. package/dist/client/stream/types.d.cts.map +1 -1
  39. package/dist/client/stream/types.d.ts +9 -6
  40. package/dist/client/stream/types.d.ts.map +1 -1
  41. package/dist/client/threads/index.cjs +1 -1
  42. package/dist/client/threads/index.cjs.map +1 -1
  43. package/dist/client/threads/index.d.cts.map +1 -1
  44. package/dist/client/threads/index.d.ts.map +1 -1
  45. package/dist/client/threads/index.js +1 -1
  46. package/dist/client/threads/index.js.map +1 -1
  47. package/dist/client.cjs +1 -1
  48. package/dist/client.js +1 -1
  49. package/dist/index.cjs +3 -2
  50. package/dist/index.d.cts +2 -2
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +3 -3
  53. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.cjs +244 -0
  54. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.cjs.map +1 -0
  55. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js +240 -0
  56. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js.map +1 -0
  57. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.cjs +13 -0
  58. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.cjs.map +1 -0
  59. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.js +8 -0
  60. package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.js.map +1 -0
  61. package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.cjs +25 -0
  62. package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.cjs.map +1 -0
  63. package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.js +25 -0
  64. package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.js.map +1 -0
  65. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.cjs +596 -0
  66. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.cjs.map +1 -0
  67. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.js +596 -0
  68. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.js.map +1 -0
  69. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.cjs +18 -0
  70. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.cjs.map +1 -0
  71. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js +18 -0
  72. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js.map +1 -0
  73. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.cjs +41 -0
  74. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.cjs.map +1 -0
  75. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js +41 -0
  76. package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js.map +1 -0
  77. package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.cjs +141 -0
  78. package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.cjs.map +1 -0
  79. package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js +141 -0
  80. package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js.map +1 -0
  81. package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.cjs +63 -0
  82. package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.cjs.map +1 -0
  83. package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js +62 -0
  84. package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js.map +1 -0
  85. package/dist/react/stream.custom.cjs +1 -0
  86. package/dist/react/stream.custom.cjs.map +1 -1
  87. package/dist/react/stream.custom.d.cts.map +1 -1
  88. package/dist/react/stream.custom.d.ts.map +1 -1
  89. package/dist/react/stream.custom.js +1 -0
  90. package/dist/react/stream.custom.js.map +1 -1
  91. package/dist/react/stream.lgp.cjs +1 -0
  92. package/dist/react/stream.lgp.cjs.map +1 -1
  93. package/dist/react/stream.lgp.js +1 -0
  94. package/dist/react/stream.lgp.js.map +1 -1
  95. package/dist/stream/constants.cjs +6 -0
  96. package/dist/stream/constants.cjs.map +1 -1
  97. package/dist/stream/constants.d.cts +6 -1
  98. package/dist/stream/constants.d.cts.map +1 -1
  99. package/dist/stream/constants.d.ts +6 -1
  100. package/dist/stream/constants.d.ts.map +1 -1
  101. package/dist/stream/constants.js +6 -1
  102. package/dist/stream/constants.js.map +1 -1
  103. package/dist/stream/controller.cjs +7 -3
  104. package/dist/stream/controller.cjs.map +1 -1
  105. package/dist/stream/controller.js +7 -3
  106. package/dist/stream/controller.js.map +1 -1
  107. package/dist/stream/discovery/namespace-from-history.cjs +2 -2
  108. package/dist/stream/discovery/namespace-from-history.cjs.map +1 -1
  109. package/dist/stream/discovery/namespace-from-history.js +2 -2
  110. package/dist/stream/discovery/namespace-from-history.js.map +1 -1
  111. package/dist/stream/index.cjs +2 -1
  112. package/dist/stream/index.d.cts +2 -2
  113. package/dist/stream/index.d.ts +2 -2
  114. package/dist/stream/index.js +2 -2
  115. package/dist/stream/projections/values.cjs +2 -1
  116. package/dist/stream/projections/values.cjs.map +1 -1
  117. package/dist/stream/projections/values.d.cts.map +1 -1
  118. package/dist/stream/projections/values.d.ts.map +1 -1
  119. package/dist/stream/projections/values.js +2 -1
  120. package/dist/stream/projections/values.js.map +1 -1
  121. package/dist/stream/types.d.cts +40 -2
  122. package/dist/stream/types.d.cts.map +1 -1
  123. package/dist/stream/types.d.ts +40 -2
  124. package/dist/stream/types.d.ts.map +1 -1
  125. package/dist/types.d.cts +5 -1
  126. package/dist/types.d.cts.map +1 -1
  127. package/dist/types.d.ts +5 -1
  128. package/dist/types.d.ts.map +1 -1
  129. package/dist/ui/manager.cjs +1 -0
  130. package/dist/ui/manager.cjs.map +1 -1
  131. package/dist/ui/manager.d.cts.map +1 -1
  132. package/dist/ui/manager.d.ts.map +1 -1
  133. package/dist/ui/manager.js +1 -0
  134. package/dist/ui/manager.js.map +1 -1
  135. package/dist/ui/messages.cjs +2 -1
  136. package/dist/ui/messages.cjs.map +1 -1
  137. package/dist/ui/messages.d.cts.map +1 -1
  138. package/dist/ui/messages.d.ts.map +1 -1
  139. package/dist/ui/messages.js +2 -1
  140. package/dist/ui/messages.js.map +1 -1
  141. package/dist/ui/orchestrator-custom.cjs +1 -0
  142. package/dist/ui/orchestrator-custom.cjs.map +1 -1
  143. package/dist/ui/orchestrator-custom.d.cts.map +1 -1
  144. package/dist/ui/orchestrator-custom.d.ts.map +1 -1
  145. package/dist/ui/orchestrator-custom.js +1 -0
  146. package/dist/ui/orchestrator-custom.js.map +1 -1
  147. package/dist/utils/async_caller.cjs +14 -8
  148. package/dist/utils/async_caller.cjs.map +1 -1
  149. package/dist/utils/async_caller.d.cts.map +1 -1
  150. package/dist/utils/async_caller.d.ts.map +1 -1
  151. package/dist/utils/async_caller.js +13 -4
  152. package/dist/utils/async_caller.js.map +1 -1
  153. package/dist/utils/reconnect.cjs +18 -0
  154. package/dist/utils/reconnect.cjs.map +1 -0
  155. package/dist/utils/reconnect.js +18 -0
  156. package/dist/utils/reconnect.js.map +1 -0
  157. package/dist/utils/stream.cjs +9 -1
  158. package/dist/utils/stream.cjs.map +1 -1
  159. package/dist/utils/stream.d.cts.map +1 -1
  160. package/dist/utils/stream.d.ts.map +1 -1
  161. package/dist/utils/stream.js +9 -2
  162. package/dist/utils/stream.js.map +1 -1
  163. package/package.json +8 -7
@@ -0,0 +1,18 @@
1
+ //#region ../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js
2
+ function lowerBound(array, value, comparator) {
3
+ let first = 0;
4
+ let count = array.length;
5
+ while (count > 0) {
6
+ const step = Math.trunc(count / 2);
7
+ let it = first + step;
8
+ if (comparator(array[it], value) <= 0) {
9
+ first = ++it;
10
+ count -= step + 1;
11
+ } else count = step;
12
+ }
13
+ return first;
14
+ }
15
+ //#endregion
16
+ exports.default = lowerBound;
17
+
18
+ //# sourceMappingURL=lower-bound.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lower-bound.cjs","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js"],"sourcesContent":["// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nexport default function lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n"],"x_google_ignoreList":[0],"mappings":";AAEA,SAAwB,WAAW,OAAO,OAAO,YAAY;CACzD,IAAI,QAAQ;CACZ,IAAI,QAAQ,MAAM;AAClB,QAAO,QAAQ,GAAG;EACd,MAAM,OAAO,KAAK,MAAM,QAAQ,EAAE;EAClC,IAAI,KAAK,QAAQ;AACjB,MAAI,WAAW,MAAM,KAAK,MAAM,IAAI,GAAG;AACnC,WAAQ,EAAE;AACV,YAAS,OAAO;QAGhB,SAAQ;;AAGhB,QAAO"}
@@ -0,0 +1,18 @@
1
+ //#region ../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js
2
+ function lowerBound(array, value, comparator) {
3
+ let first = 0;
4
+ let count = array.length;
5
+ while (count > 0) {
6
+ const step = Math.trunc(count / 2);
7
+ let it = first + step;
8
+ if (comparator(array[it], value) <= 0) {
9
+ first = ++it;
10
+ count -= step + 1;
11
+ } else count = step;
12
+ }
13
+ return first;
14
+ }
15
+ //#endregion
16
+ export { lowerBound as default };
17
+
18
+ //# sourceMappingURL=lower-bound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lower-bound.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js"],"sourcesContent":["// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nexport default function lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n"],"x_google_ignoreList":[0],"mappings":";AAEA,SAAwB,WAAW,OAAO,OAAO,YAAY;CACzD,IAAI,QAAQ;CACZ,IAAI,QAAQ,MAAM;AAClB,QAAO,QAAQ,GAAG;EACd,MAAM,OAAO,KAAK,MAAM,QAAQ,EAAE;EAClC,IAAI,KAAK,QAAQ;AACjB,MAAI,WAAW,MAAM,KAAK,MAAM,IAAI,GAAG;AACnC,WAAQ,EAAE;AACV,YAAS,OAAO;QAGhB,SAAQ;;AAGhB,QAAO"}
@@ -0,0 +1,41 @@
1
+ const require_lower_bound = require("./lower-bound.cjs");
2
+ //#region ../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js
3
+ var PriorityQueue = class {
4
+ #queue = [];
5
+ enqueue(run, options) {
6
+ const { priority = 0, id } = options ?? {};
7
+ const element = {
8
+ priority,
9
+ id,
10
+ run
11
+ };
12
+ if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {
13
+ this.#queue.push(element);
14
+ return;
15
+ }
16
+ const index = require_lower_bound.default(this.#queue, element, (a, b) => b.priority - a.priority);
17
+ this.#queue.splice(index, 0, element);
18
+ }
19
+ setPriority(id, priority) {
20
+ const index = this.#queue.findIndex((element) => element.id === id);
21
+ if (index === -1) throw new ReferenceError(`No promise function with the id "${id}" exists in the queue.`);
22
+ const [item] = this.#queue.splice(index, 1);
23
+ this.enqueue(item.run, {
24
+ priority,
25
+ id
26
+ });
27
+ }
28
+ dequeue() {
29
+ return this.#queue.shift()?.run;
30
+ }
31
+ filter(options) {
32
+ return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
33
+ }
34
+ get size() {
35
+ return this.#queue.length;
36
+ }
37
+ };
38
+ //#endregion
39
+ exports.default = PriorityQueue;
40
+
41
+ //# sourceMappingURL=priority-queue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priority-queue.cjs","names":["#queue","lowerBound"],"sources":["../../../../../../../../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js"],"sourcesContent":["import lowerBound from './lower-bound.js';\nexport default class PriorityQueue {\n #queue = [];\n enqueue(run, options) {\n const { priority = 0, id, } = options ?? {};\n const element = {\n priority,\n id,\n run,\n };\n if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {\n this.#queue.push(element);\n return;\n }\n const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n setPriority(id, priority) {\n const index = this.#queue.findIndex((element) => element.id === id);\n if (index === -1) {\n throw new ReferenceError(`No promise function with the id \"${id}\" exists in the queue.`);\n }\n const [item] = this.#queue.splice(index, 1);\n this.enqueue(item.run, { priority, id });\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n"],"x_google_ignoreList":[0],"mappings":";;AACA,IAAqB,gBAArB,MAAmC;CAC/B,SAAS,EAAE;CACX,QAAQ,KAAK,SAAS;EAClB,MAAM,EAAE,WAAW,GAAG,OAAQ,WAAW,EAAE;EAC3C,MAAM,UAAU;GACZ;GACA;GACA;GACH;AACD,MAAI,KAAK,SAAS,KAAK,MAAA,MAAY,KAAK,OAAO,GAAG,YAAY,UAAU;AACpE,SAAA,MAAY,KAAK,QAAQ;AACzB;;EAEJ,MAAM,QAAQC,oBAAAA,QAAW,MAAA,OAAa,UAAU,GAAG,MAAM,EAAE,WAAW,EAAE,SAAS;AACjF,QAAA,MAAY,OAAO,OAAO,GAAG,QAAQ;;CAEzC,YAAY,IAAI,UAAU;EACtB,MAAM,QAAQ,MAAA,MAAY,WAAW,YAAY,QAAQ,OAAO,GAAG;AACnE,MAAI,UAAU,GACV,OAAM,IAAI,eAAe,oCAAoC,GAAG,wBAAwB;EAE5F,MAAM,CAAC,QAAQ,MAAA,MAAY,OAAO,OAAO,EAAE;AAC3C,OAAK,QAAQ,KAAK,KAAK;GAAE;GAAU;GAAI,CAAC;;CAE5C,UAAU;AAEN,SADa,MAAA,MAAY,OAAO,EACnB;;CAEjB,OAAO,SAAS;AACZ,SAAO,MAAA,MAAY,QAAQ,YAAY,QAAQ,aAAa,QAAQ,SAAS,CAAC,KAAK,YAAY,QAAQ,IAAI;;CAE/G,IAAI,OAAO;AACP,SAAO,MAAA,MAAY"}
@@ -0,0 +1,41 @@
1
+ import lowerBound from "./lower-bound.js";
2
+ //#region ../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js
3
+ var PriorityQueue = class {
4
+ #queue = [];
5
+ enqueue(run, options) {
6
+ const { priority = 0, id } = options ?? {};
7
+ const element = {
8
+ priority,
9
+ id,
10
+ run
11
+ };
12
+ if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {
13
+ this.#queue.push(element);
14
+ return;
15
+ }
16
+ const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);
17
+ this.#queue.splice(index, 0, element);
18
+ }
19
+ setPriority(id, priority) {
20
+ const index = this.#queue.findIndex((element) => element.id === id);
21
+ if (index === -1) throw new ReferenceError(`No promise function with the id "${id}" exists in the queue.`);
22
+ const [item] = this.#queue.splice(index, 1);
23
+ this.enqueue(item.run, {
24
+ priority,
25
+ id
26
+ });
27
+ }
28
+ dequeue() {
29
+ return this.#queue.shift()?.run;
30
+ }
31
+ filter(options) {
32
+ return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
33
+ }
34
+ get size() {
35
+ return this.#queue.length;
36
+ }
37
+ };
38
+ //#endregion
39
+ export { PriorityQueue as default };
40
+
41
+ //# sourceMappingURL=priority-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"priority-queue.js","names":["#queue"],"sources":["../../../../../../../../../node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js"],"sourcesContent":["import lowerBound from './lower-bound.js';\nexport default class PriorityQueue {\n #queue = [];\n enqueue(run, options) {\n const { priority = 0, id, } = options ?? {};\n const element = {\n priority,\n id,\n run,\n };\n if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {\n this.#queue.push(element);\n return;\n }\n const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n setPriority(id, priority) {\n const index = this.#queue.findIndex((element) => element.id === id);\n if (index === -1) {\n throw new ReferenceError(`No promise function with the id \"${id}\" exists in the queue.`);\n }\n const [item] = this.#queue.splice(index, 1);\n this.enqueue(item.run, { priority, id });\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n"],"x_google_ignoreList":[0],"mappings":";;AACA,IAAqB,gBAArB,MAAmC;CAC/B,SAAS,EAAE;CACX,QAAQ,KAAK,SAAS;EAClB,MAAM,EAAE,WAAW,GAAG,OAAQ,WAAW,EAAE;EAC3C,MAAM,UAAU;GACZ;GACA;GACA;GACH;AACD,MAAI,KAAK,SAAS,KAAK,MAAA,MAAY,KAAK,OAAO,GAAG,YAAY,UAAU;AACpE,SAAA,MAAY,KAAK,QAAQ;AACzB;;EAEJ,MAAM,QAAQ,WAAW,MAAA,OAAa,UAAU,GAAG,MAAM,EAAE,WAAW,EAAE,SAAS;AACjF,QAAA,MAAY,OAAO,OAAO,GAAG,QAAQ;;CAEzC,YAAY,IAAI,UAAU;EACtB,MAAM,QAAQ,MAAA,MAAY,WAAW,YAAY,QAAQ,OAAO,GAAG;AACnE,MAAI,UAAU,GACV,OAAM,IAAI,eAAe,oCAAoC,GAAG,wBAAwB;EAE5F,MAAM,CAAC,QAAQ,MAAA,MAAY,OAAO,OAAO,EAAE;AAC3C,OAAK,QAAQ,KAAK,KAAK;GAAE;GAAU;GAAI,CAAC;;CAE5C,UAAU;AAEN,SADa,MAAA,MAAY,OAAO,EACnB;;CAEjB,OAAO,SAAS;AACZ,SAAO,MAAA,MAAY,QAAQ,YAAY,QAAQ,aAAa,QAAQ,SAAS,CAAC,KAAK,YAAY,QAAQ,IAAI;;CAE/G,IAAI,OAAO;AACP,SAAO,MAAA,MAAY"}
@@ -0,0 +1,141 @@
1
+ const require_index = require("../../../is-network-error@1.3.1/node_modules/is-network-error/index.cjs");
2
+ //#region ../../node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js
3
+ function validateRetries(retries) {
4
+ if (typeof retries === "number") {
5
+ if (retries < 0) throw new TypeError("Expected `retries` to be a non-negative number.");
6
+ if (Number.isNaN(retries)) throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.");
7
+ } else if (retries !== void 0) throw new TypeError("Expected `retries` to be a number or Infinity.");
8
+ }
9
+ function validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {
10
+ if (value === void 0) return;
11
+ if (typeof value !== "number" || Number.isNaN(value)) throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
12
+ if (!allowInfinity && !Number.isFinite(value)) throw new TypeError(`Expected \`${name}\` to be a finite number.`);
13
+ if (value < min) throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
14
+ }
15
+ var AbortError = class extends Error {
16
+ constructor(message) {
17
+ super();
18
+ if (message instanceof Error) {
19
+ this.originalError = message;
20
+ ({message} = message);
21
+ } else {
22
+ this.originalError = new Error(message);
23
+ this.originalError.stack = this.stack;
24
+ }
25
+ this.name = "AbortError";
26
+ this.message = message;
27
+ }
28
+ };
29
+ function calculateDelay(retriesConsumed, options) {
30
+ const attempt = Math.max(1, retriesConsumed + 1);
31
+ const random = options.randomize ? Math.random() + 1 : 1;
32
+ let timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
33
+ timeout = Math.min(timeout, options.maxTimeout);
34
+ return timeout;
35
+ }
36
+ function calculateRemainingTime(start, max) {
37
+ if (!Number.isFinite(max)) return max;
38
+ return max - (performance.now() - start);
39
+ }
40
+ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTime, options }) {
41
+ const normalizedError = error instanceof Error ? error : /* @__PURE__ */ new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
42
+ if (normalizedError instanceof AbortError) throw normalizedError.originalError;
43
+ const retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;
44
+ const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
45
+ const context = Object.freeze({
46
+ error: normalizedError,
47
+ attemptNumber,
48
+ retriesLeft,
49
+ retriesConsumed
50
+ });
51
+ await options.onFailedAttempt(context);
52
+ if (calculateRemainingTime(startTime, maxRetryTime) <= 0) throw normalizedError;
53
+ const consumeRetry = await options.shouldConsumeRetry(context);
54
+ const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
55
+ if (remainingTime <= 0 || retriesLeft <= 0) throw normalizedError;
56
+ if (normalizedError instanceof TypeError && !require_index.default(normalizedError)) {
57
+ if (consumeRetry) throw normalizedError;
58
+ options.signal?.throwIfAborted();
59
+ return false;
60
+ }
61
+ if (!await options.shouldRetry(context)) throw normalizedError;
62
+ if (!consumeRetry) {
63
+ options.signal?.throwIfAborted();
64
+ return false;
65
+ }
66
+ const delayTime = calculateDelay(retriesConsumed, options);
67
+ const finalDelay = Math.min(delayTime, remainingTime);
68
+ options.signal?.throwIfAborted();
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
+ //#endregion
139
+ exports.default = pRetry;
140
+
141
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["isNetworkError"],"sources":["../../../../../../../../node_modules/.pnpm/p-retry@7.1.1/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\toptions.signal?.throwIfAborted();\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,kDAAkD;AAGvE,MAAI,OAAO,MAAM,QAAQ,CACxB,OAAM,IAAI,UAAU,gEAAgE;YAE3E,YAAY,KAAA,EACtB,OAAM,IAAI,UAAU,iDAAiD;;AAIvE,SAAS,qBAAqB,MAAM,OAAO,EAAC,MAAM,GAAG,gBAAgB,UAAS,EAAE,EAAE;AACjF,KAAI,UAAU,KAAA,EACb;AAGD,KAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CACnD,OAAM,IAAI,UAAU,cAAc,KAAK,mBAAmB,gBAAgB,iBAAiB,GAA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,eAAe,OAAO;AAC9B,SAAQ,iBAAiB,OAAO;AAChC,SAAQ,cAAc;AACtB,SAAQ,0BAA0B;AAClC,SAAQ,sBAAsB;AAC9B,SAAQ,6BAA6B;AAGrC,sBAAqB,UAAU,QAAQ,QAAQ;EAAC,KAAK;EAAG,eAAe;EAAM,CAAC;AAC9E,sBAAqB,cAAc,QAAQ,YAAY;EAAC,KAAK;EAAG,eAAe;EAAM,CAAC;AACtF,sBAAqB,cAAc,QAAQ,YAAY;EAAC,KAAK;EAAG,eAAe;EAAK,CAAC;AACrF,sBAAqB,gBAAgB,QAAQ,cAAc;EAAC,KAAK;EAAG,eAAe;EAAK,CAAC;AAGzF,KAAI,EAAE,QAAQ,SAAS,GACtB,SAAQ,SAAS;AAGlB,SAAQ,QAAQ,gBAAgB;CAEhC,IAAI,gBAAgB;CACpB,IAAI,kBAAkB;CACtB,MAAM,YAAY,YAAY,KAAK;AAEnC,QAAO,OAAO,SAAS,QAAQ,QAAQ,GAAG,mBAAmB,QAAQ,UAAU,MAAM;AACpF;AAEA,MAAI;AACH,WAAQ,QAAQ,gBAAgB;GAEhC,MAAM,SAAS,MAAM,MAAM,cAAc;AAEzC,WAAQ,QAAQ,gBAAgB;AAEhC,UAAO;WACC,OAAO;AACf,OAAI,MAAM,iBAAiB;IAC1B;IACA;IACA;IACA;IACA;IACA,CAAC,CACD;;;AAMH,OAAM,IAAI,MAAM,sDAAsD"}
@@ -0,0 +1,141 @@
1
+ import isNetworkError from "../../../is-network-error@1.3.1/node_modules/is-network-error/index.js";
2
+ //#region ../../node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js
3
+ function validateRetries(retries) {
4
+ if (typeof retries === "number") {
5
+ if (retries < 0) throw new TypeError("Expected `retries` to be a non-negative number.");
6
+ if (Number.isNaN(retries)) throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.");
7
+ } else if (retries !== void 0) throw new TypeError("Expected `retries` to be a number or Infinity.");
8
+ }
9
+ function validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {
10
+ if (value === void 0) return;
11
+ if (typeof value !== "number" || Number.isNaN(value)) throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
12
+ if (!allowInfinity && !Number.isFinite(value)) throw new TypeError(`Expected \`${name}\` to be a finite number.`);
13
+ if (value < min) throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
14
+ }
15
+ var AbortError = class extends Error {
16
+ constructor(message) {
17
+ super();
18
+ if (message instanceof Error) {
19
+ this.originalError = message;
20
+ ({message} = message);
21
+ } else {
22
+ this.originalError = new Error(message);
23
+ this.originalError.stack = this.stack;
24
+ }
25
+ this.name = "AbortError";
26
+ this.message = message;
27
+ }
28
+ };
29
+ function calculateDelay(retriesConsumed, options) {
30
+ const attempt = Math.max(1, retriesConsumed + 1);
31
+ const random = options.randomize ? Math.random() + 1 : 1;
32
+ let timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
33
+ timeout = Math.min(timeout, options.maxTimeout);
34
+ return timeout;
35
+ }
36
+ function calculateRemainingTime(start, max) {
37
+ if (!Number.isFinite(max)) return max;
38
+ return max - (performance.now() - start);
39
+ }
40
+ async function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTime, options }) {
41
+ const normalizedError = error instanceof Error ? error : /* @__PURE__ */ new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
42
+ if (normalizedError instanceof AbortError) throw normalizedError.originalError;
43
+ const retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;
44
+ const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
45
+ const context = Object.freeze({
46
+ error: normalizedError,
47
+ attemptNumber,
48
+ retriesLeft,
49
+ retriesConsumed
50
+ });
51
+ await options.onFailedAttempt(context);
52
+ if (calculateRemainingTime(startTime, maxRetryTime) <= 0) throw normalizedError;
53
+ const consumeRetry = await options.shouldConsumeRetry(context);
54
+ const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
55
+ if (remainingTime <= 0 || retriesLeft <= 0) throw normalizedError;
56
+ if (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {
57
+ if (consumeRetry) throw normalizedError;
58
+ options.signal?.throwIfAborted();
59
+ return false;
60
+ }
61
+ if (!await options.shouldRetry(context)) throw normalizedError;
62
+ if (!consumeRetry) {
63
+ options.signal?.throwIfAborted();
64
+ return false;
65
+ }
66
+ const delayTime = calculateDelay(retriesConsumed, options);
67
+ const finalDelay = Math.min(delayTime, remainingTime);
68
+ options.signal?.throwIfAborted();
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
+ //#endregion
139
+ export { pRetry as default };
140
+
141
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../../node_modules/.pnpm/p-retry@7.1.1/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\toptions.signal?.throwIfAborted();\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,kDAAkD;AAGvE,MAAI,OAAO,MAAM,QAAQ,CACxB,OAAM,IAAI,UAAU,gEAAgE;YAE3E,YAAY,KAAA,EACtB,OAAM,IAAI,UAAU,iDAAiD;;AAIvE,SAAS,qBAAqB,MAAM,OAAO,EAAC,M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;AAEtB,iBAAgB,QAAQ,QAAQ;AAEhC,KAAI,OAAO,OAAO,SAAS,UAAU,CACpC,OAAM,IAAI,MAAM,4GAA4G;AAG7H,SAAQ,YAAY;AACpB,SAAQ,WAAW;AACnB,SAAQ,eAAe;AACvB,SAAQ,eAAe,OAAO;AAC9B,SAAQ,iBAAiB,OAAO;AAChC,SAAQ,cAAc;AACtB,SAAQ,0BAA0B;AAClC,SAAQ,sBAAsB;AAC9B,SAAQ,6BAA6B;AAGrC,sBAAqB,UAAU,QAAQ,QAAQ;EAAC,KAAK;EAAG,eAAe;EAAM,CAAC;AAC9E,sBAAqB,cAAc,QAAQ,YAAY;EAAC,KAAK;EAAG,eAAe;EAAM,CAAC;AACtF,sBAAqB,cAAc,QAAQ,YAAY;EAAC,KAAK;EAAG,eAAe;EAAK,CAAC;AACrF,sBAAqB,gBAAgB,QAAQ,cAAc;EAAC,KAAK;EAAG,eAAe;EAAK,CAAC;AAGzF,KAAI,EAAE,QAAQ,SAAS,GACtB,SAAQ,SAAS;AAGlB,SAAQ,QAAQ,gBAAgB;CAEhC,IAAI,gBAAgB;CACpB,IAAI,kBAAkB;CACtB,MAAM,YAAY,YAAY,KAAK;AAEnC,QAAO,OAAO,SAAS,QAAQ,QAAQ,GAAG,mBAAmB,QAAQ,UAAU,MAAM;AACpF;AAEA,MAAI;AACH,WAAQ,QAAQ,gBAAgB;GAEhC,MAAM,SAAS,MAAM,MAAM,cAAc;AAEzC,WAAQ,QAAQ,gBAAgB;AAEhC,UAAO;WACC,OAAO;AACf,OAAI,MAAM,iBAAiB;IAC1B;IACA;IACA;IACA;IACA;IACA,CAAC,CACD;;;AAMH,OAAM,IAAI,MAAM,sDAAsD"}
@@ -0,0 +1,63 @@
1
+ //#region ../../node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js
2
+ var TimeoutError = class TimeoutError extends Error {
3
+ name = "TimeoutError";
4
+ constructor(message, options) {
5
+ super(message, options);
6
+ Error.captureStackTrace?.(this, TimeoutError);
7
+ }
8
+ };
9
+ const getAbortedReason = (signal) => signal.reason ?? new DOMException("This operation was aborted.", "AbortError");
10
+ function pTimeout(promise, options) {
11
+ const { milliseconds, fallback, message, customTimers = {
12
+ setTimeout,
13
+ clearTimeout
14
+ }, signal } = options;
15
+ let timer;
16
+ let abortHandler;
17
+ const cancelablePromise = new Promise((resolve, reject) => {
18
+ if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
19
+ if (signal?.aborted) {
20
+ reject(getAbortedReason(signal));
21
+ return;
22
+ }
23
+ if (signal) {
24
+ abortHandler = () => {
25
+ reject(getAbortedReason(signal));
26
+ };
27
+ signal.addEventListener("abort", abortHandler, { once: true });
28
+ }
29
+ promise.then(resolve, reject);
30
+ if (milliseconds === Number.POSITIVE_INFINITY) return;
31
+ const timeoutError = new TimeoutError();
32
+ timer = customTimers.setTimeout.call(void 0, () => {
33
+ if (fallback) {
34
+ try {
35
+ resolve(fallback());
36
+ } catch (error) {
37
+ reject(error);
38
+ }
39
+ return;
40
+ }
41
+ if (typeof promise.cancel === "function") promise.cancel();
42
+ if (message === false) resolve();
43
+ else if (message instanceof Error) reject(message);
44
+ else {
45
+ timeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;
46
+ reject(timeoutError);
47
+ }
48
+ }, milliseconds);
49
+ }).finally(() => {
50
+ cancelablePromise.clear();
51
+ if (abortHandler && signal) signal.removeEventListener("abort", abortHandler);
52
+ });
53
+ cancelablePromise.clear = () => {
54
+ customTimers.clearTimeout.call(void 0, timer);
55
+ timer = void 0;
56
+ };
57
+ return cancelablePromise;
58
+ }
59
+ //#endregion
60
+ exports.TimeoutError = TimeoutError;
61
+ exports.default = pTimeout;
62
+
63
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../../../../../../../node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js"],"sourcesContent":["export class TimeoutError extends Error {\n\tname = 'TimeoutError';\n\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tError.captureStackTrace?.(this, TimeoutError);\n\t}\n}\n\nconst getAbortedReason = signal => signal.reason ?? new DOMException('This operation was aborted.', 'AbortError');\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t\tsignal,\n\t} = options;\n\n\tlet timer;\n\tlet abortHandler;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (signal?.aborted) {\n\t\t\treject(getAbortedReason(signal));\n\t\t\treturn;\n\t\t}\n\n\t\tif (signal) {\n\t\t\tabortHandler = () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t};\n\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\t// Use .then() instead of async IIFE to preserve stack traces\n\t\t// eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-catch\n\t\tpromise.then(resolve, reject);\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\t});\n\n\t// eslint-disable-next-line promise/prefer-await-to-then\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t\tif (abortHandler && signal) {\n\t\t\tsignal.removeEventListener('abort', abortHandler);\n\t\t}\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAa,eAAb,MAAa,qBAAqB,MAAM;CACvC,OAAO;CAEP,YAAY,SAAS,SAAS;AAC7B,QAAM,SAAS,QAAQ;AACvB,QAAM,oBAAoB,MAAM,aAAa;;;AAI/C,MAAM,oBAAmB,WAAU,OAAO,UAAU,IAAI,aAAa,+BAA+B,aAAa;AAEjH,SAAwB,SAAS,SAAS,SAAS;CAClD,MAAM,EACL,cACA,UACA,SACA,eAAe;EAAC;EAAY;EAAa,EACzC,WACG;CAEJ,IAAI;CACJ,IAAI;CA2DJ,MAAM,oBAzDiB,IAAI,SAAS,SAAS,WAAW;AACvD,MAAI,OAAO,iBAAiB,YAAY,KAAK,KAAK,aAAa,KAAK,EACnE,OAAM,IAAI,UAAU,4DAA4D,aAAa,IAAI;AAGlG,MAAI,QAAQ,SAAS;AACpB,UAAO,iBAAiB,OAAO,CAAC;AAChC;;AAGD,MAAI,QAAQ;AACX,wBAAqB;AACpB,WAAO,iBAAiB,OAAO,CAAC;;AAGjC,UAAO,iBAAiB,SAAS,cAAc,EAAC,MAAM,MAAK,CAAC;;AAK7D,UAAQ,KAAK,SAAS,OAAO;AAE7B,MAAI,iBAAiB,OAAO,kBAC3B;EAID,MAAM,eAAe,IAAI,cAAc;AAGvC,UAAQ,aAAa,WAAW,KAAK,KAAA,SAAiB;AACrD,OAAI,UAAU;AACb,QAAI;AACH,aAAQ,UAAU,CAAC;aACX,OAAO;AACf,YAAO,MAAM;;AAGd;;AAGD,OAAI,OAAO,QAAQ,WAAW,WAC7B,SAAQ,QAAQ;AAGjB,OAAI,YAAY,MACf,UAAS;YACC,mBAAmB,MAC7B,QAAO,QAAQ;QACT;AACN,iBAAa,UAAU,WAAW,2BAA2B,aAAa;AAC1E,WAAO,aAAa;;KAEnB,aAAa;GACf,CAGuC,cAAc;AACtD,oBAAkB,OAAO;AACzB,MAAI,gBAAgB,OACnB,QAAO,oBAAoB,SAAS,aAAa;GAEjD;AAEF,mBAAkB,cAAc;AAE/B,eAAa,aAAa,KAAK,KAAA,GAAW,MAAM;AAChD,UAAQ,KAAA;;AAGT,QAAO"}
@@ -0,0 +1,62 @@
1
+ //#region ../../node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js
2
+ var TimeoutError = class TimeoutError extends Error {
3
+ name = "TimeoutError";
4
+ constructor(message, options) {
5
+ super(message, options);
6
+ Error.captureStackTrace?.(this, TimeoutError);
7
+ }
8
+ };
9
+ const getAbortedReason = (signal) => signal.reason ?? new DOMException("This operation was aborted.", "AbortError");
10
+ function pTimeout(promise, options) {
11
+ const { milliseconds, fallback, message, customTimers = {
12
+ setTimeout,
13
+ clearTimeout
14
+ }, signal } = options;
15
+ let timer;
16
+ let abortHandler;
17
+ const cancelablePromise = new Promise((resolve, reject) => {
18
+ if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
19
+ if (signal?.aborted) {
20
+ reject(getAbortedReason(signal));
21
+ return;
22
+ }
23
+ if (signal) {
24
+ abortHandler = () => {
25
+ reject(getAbortedReason(signal));
26
+ };
27
+ signal.addEventListener("abort", abortHandler, { once: true });
28
+ }
29
+ promise.then(resolve, reject);
30
+ if (milliseconds === Number.POSITIVE_INFINITY) return;
31
+ const timeoutError = new TimeoutError();
32
+ timer = customTimers.setTimeout.call(void 0, () => {
33
+ if (fallback) {
34
+ try {
35
+ resolve(fallback());
36
+ } catch (error) {
37
+ reject(error);
38
+ }
39
+ return;
40
+ }
41
+ if (typeof promise.cancel === "function") promise.cancel();
42
+ if (message === false) resolve();
43
+ else if (message instanceof Error) reject(message);
44
+ else {
45
+ timeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;
46
+ reject(timeoutError);
47
+ }
48
+ }, milliseconds);
49
+ }).finally(() => {
50
+ cancelablePromise.clear();
51
+ if (abortHandler && signal) signal.removeEventListener("abort", abortHandler);
52
+ });
53
+ cancelablePromise.clear = () => {
54
+ customTimers.clearTimeout.call(void 0, timer);
55
+ timer = void 0;
56
+ };
57
+ return cancelablePromise;
58
+ }
59
+ //#endregion
60
+ export { TimeoutError, pTimeout as default };
61
+
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../../../node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js"],"sourcesContent":["export class TimeoutError extends Error {\n\tname = 'TimeoutError';\n\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tError.captureStackTrace?.(this, TimeoutError);\n\t}\n}\n\nconst getAbortedReason = signal => signal.reason ?? new DOMException('This operation was aborted.', 'AbortError');\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t\tsignal,\n\t} = options;\n\n\tlet timer;\n\tlet abortHandler;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (signal?.aborted) {\n\t\t\treject(getAbortedReason(signal));\n\t\t\treturn;\n\t\t}\n\n\t\tif (signal) {\n\t\t\tabortHandler = () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t};\n\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\t// Use .then() instead of async IIFE to preserve stack traces\n\t\t// eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-catch\n\t\tpromise.then(resolve, reject);\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\t});\n\n\t// eslint-disable-next-line promise/prefer-await-to-then\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t\tif (abortHandler && signal) {\n\t\t\tsignal.removeEventListener('abort', abortHandler);\n\t\t}\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\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,cAAc;AAE/B,eAAa,aAAa,KAAK,KAAA,GAAW,MAAM;AAChD,UAAQ,KAAA;;AAGT,QAAO"}
@@ -2,6 +2,7 @@
2
2
  require("../_virtual/_rolldown/runtime.cjs");
3
3
  const require_sse = require("../utils/sse.cjs");
4
4
  const require_stream = require("../utils/stream.cjs");
5
+ require("../stream/constants.cjs");
5
6
  const require_messages = require("../ui/messages.cjs");
6
7
  const require_headless_tools = require("../headless-tools.cjs");
7
8
  const require_interrupts = require("../ui/interrupts.cjs");