@fedify/fedify 2.5.0-dev.2664 → 2.5.0-dev.2710

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 (266) hide show
  1. package/dist/compat/mod.d.cts +1 -1
  2. package/dist/compat/mod.d.ts +1 -1
  3. package/dist/{context-xrqq4Hrq.d.ts → context-CuLvR1Os.d.ts} +2 -2
  4. package/dist/{context-C1NqcIct.d.cts → context-apq0IBg2.d.cts} +2 -2
  5. package/dist/federation/mod.cjs +1 -1
  6. package/dist/federation/mod.d.cts +3 -3
  7. package/dist/federation/mod.d.ts +3 -3
  8. package/dist/federation/mod.js +1 -1
  9. package/dist/{federation-FbwcnRHg.cjs → federation-JvzYDx0P.cjs} +5 -5
  10. package/dist/{http-DbvOPsFZ.cjs → http-BG5cDmTS.cjs} +1 -1
  11. package/dist/{http-CWn0K5jD.js → http-MUf125Jc.js} +1 -1
  12. package/dist/{key-dwwAg5bA.d.ts → key-BZw-YiK5.d.ts} +2 -2
  13. package/dist/{key-DlHT4R6k.d.cts → key-D5fbQkKM.d.cts} +2 -2
  14. package/dist/{kv-cache-B-fOrhb-.cjs → kv-cache-A2po7h0_.cjs} +1 -1
  15. package/dist/{kv-cache-BC837EqC.js → kv-cache-CbWc1BZA.js} +1 -1
  16. package/dist/{ld-CWVpo_NM.d.cts → ld-DEi9ERHf.d.cts} +1 -1
  17. package/dist/{ld-o4LnhCYY.d.ts → ld-DlC78ioJ.d.ts} +1 -1
  18. package/dist/{middleware-n2UrG62B.js → middleware-DzzdJ7Wz.js} +5 -5
  19. package/dist/{mod-D22ZsiKi.d.ts → mod-BJRtsw7l.d.ts} +1 -1
  20. package/dist/{mod-C1nT74IG.d.cts → mod-BamwZjJx.d.cts} +1 -1
  21. package/dist/{mod-DO0epJGH.d.ts → mod-BkTi19dI.d.ts} +1 -1
  22. package/dist/{mod-CQC9xlLZ.d.ts → mod-CMtF0VVy.d.ts} +1 -1
  23. package/dist/{mod-YvA4Rk8J.d.cts → mod-D2Z9MiCm.d.cts} +1 -1
  24. package/dist/{mod-TwiQgEf3.d.cts → mod-DB2NOzQF.d.cts} +1 -1
  25. package/dist/mod.cjs +4 -4
  26. package/dist/mod.d.cts +6 -6
  27. package/dist/mod.d.ts +6 -6
  28. package/dist/mod.js +4 -4
  29. package/dist/{portable-collection-DQhIkX5a.js → portable-collection-CAer9RWN.js} +1 -1
  30. package/dist/{portable-collection-DseoiPPj.cjs → portable-collection-d8w7TCn9.cjs} +1 -1
  31. package/dist/sig/mod.cjs +2 -2
  32. package/dist/sig/mod.d.cts +3 -3
  33. package/dist/sig/mod.d.ts +3 -3
  34. package/dist/sig/mod.js +2 -2
  35. package/dist/utils/mod.cjs +1 -1
  36. package/dist/utils/mod.d.cts +1 -1
  37. package/dist/utils/mod.d.ts +1 -1
  38. package/dist/utils/mod.js +1 -1
  39. package/package.json +22 -9
  40. package/skills/fedify/SKILL.md +10 -0
  41. package/dist/accept-CPVqki78.mjs +0 -145
  42. package/dist/activity-listener-CELFAodc.mjs +0 -44
  43. package/dist/assert-D1Eafmd_.mjs +0 -23
  44. package/dist/assert_equals-Z6IcEbWU.mjs +0 -987
  45. package/dist/assert_exists-cffSpJ7X.mjs +0 -28
  46. package/dist/assert_false-CPdRnc3E.mjs +0 -23
  47. package/dist/assert_greater_or_equal-BlafOF4-.mjs +0 -31
  48. package/dist/assert_instance_of-mrXWWNY-.mjs +0 -37
  49. package/dist/assert_not_equals-CpPK2t89.mjs +0 -30
  50. package/dist/assert_rejects-CTptdYck.mjs +0 -39
  51. package/dist/assert_strict_equals-CYvBmkpC.mjs +0 -42
  52. package/dist/assert_throws-BYITOvPO.mjs +0 -74
  53. package/dist/assertion_error-B-cx0fFA.mjs +0 -31
  54. package/dist/audience-CHQ-FlLD.mjs +0 -95
  55. package/dist/builder-CGJ-NXcZ.mjs +0 -911
  56. package/dist/circuit-breaker-XJ53md4S.mjs +0 -544
  57. package/dist/circuit-breaker-test-utils-DW6YC_Pe.mjs +0 -14
  58. package/dist/client-5SIFzW3q.mjs +0 -441
  59. package/dist/codec-C6rTrpIp.mjs +0 -147
  60. package/dist/collection-CnnP1UAv.mjs +0 -44
  61. package/dist/compat/outgoing-jsonld.test.d.mts +0 -2
  62. package/dist/compat/outgoing-jsonld.test.mjs +0 -257
  63. package/dist/compat/public-audience.test.d.mts +0 -2
  64. package/dist/compat/public-audience.test.mjs +0 -187
  65. package/dist/compat/secured-document.test.d.mts +0 -2
  66. package/dist/compat/secured-document.test.mjs +0 -58
  67. package/dist/compat/transformers.test.d.mts +0 -2
  68. package/dist/compat/transformers.test.mjs +0 -62
  69. package/dist/compound-proof-CnzwOddk.mjs +0 -1019
  70. package/dist/context-LgGFFSz7.mjs +0 -146
  71. package/dist/deno-eoFpPk7W.mjs +0 -8
  72. package/dist/dist-_geWsuaI.mjs +0 -189
  73. package/dist/docloader-DwkipyL1.mjs +0 -136
  74. package/dist/esm-BHXXx4Wx.mjs +0 -1233
  75. package/dist/exporter-DVG68ozH.mjs +0 -263
  76. package/dist/federation/audience.test.d.mts +0 -2
  77. package/dist/federation/audience.test.mjs +0 -130
  78. package/dist/federation/builder.test.d.mts +0 -2
  79. package/dist/federation/builder.test.mjs +0 -396
  80. package/dist/federation/circuit-breaker.test.d.mts +0 -2
  81. package/dist/federation/circuit-breaker.test.mjs +0 -1277
  82. package/dist/federation/collection.test.d.mts +0 -2
  83. package/dist/federation/collection.test.mjs +0 -21
  84. package/dist/federation/compound-fanout.test.d.mts +0 -2
  85. package/dist/federation/compound-fanout.test.mjs +0 -231
  86. package/dist/federation/handler-compound-proof.test.d.mts +0 -2
  87. package/dist/federation/handler-compound-proof.test.mjs +0 -384
  88. package/dist/federation/handler.test.d.mts +0 -2
  89. package/dist/federation/handler.test.mjs +0 -5445
  90. package/dist/federation/hashlink-media.test.d.mts +0 -2
  91. package/dist/federation/hashlink-media.test.mjs +0 -422
  92. package/dist/federation/idempotency.test.d.mts +0 -2
  93. package/dist/federation/idempotency.test.mjs +0 -207
  94. package/dist/federation/inbox-actorless.test.d.mts +0 -2
  95. package/dist/federation/inbox-actorless.test.mjs +0 -522
  96. package/dist/federation/inbox-authentication.test.d.mts +0 -2
  97. package/dist/federation/inbox-authentication.test.mjs +0 -220
  98. package/dist/federation/inbox-report.test.d.mts +0 -2
  99. package/dist/federation/inbox-report.test.mjs +0 -719
  100. package/dist/federation/inbox-view.test.d.mts +0 -2
  101. package/dist/federation/inbox-view.test.mjs +0 -369
  102. package/dist/federation/inbox.test.d.mts +0 -2
  103. package/dist/federation/inbox.test.mjs +0 -139
  104. package/dist/federation/keycache.test.d.mts +0 -2
  105. package/dist/federation/keycache.test.mjs +0 -337
  106. package/dist/federation/kv.test.d.mts +0 -2
  107. package/dist/federation/kv.test.mjs +0 -88
  108. package/dist/federation/metrics.test.d.mts +0 -2
  109. package/dist/federation/metrics.test.mjs +0 -634
  110. package/dist/federation/middleware.test.d.mts +0 -2
  111. package/dist/federation/middleware.test.mjs +0 -9314
  112. package/dist/federation/mq.test.d.mts +0 -2
  113. package/dist/federation/mq.test.mjs +0 -591
  114. package/dist/federation/negotiation.test.d.mts +0 -2
  115. package/dist/federation/negotiation.test.mjs +0 -18
  116. package/dist/federation/outbound-body.test.d.mts +0 -2
  117. package/dist/federation/outbound-body.test.mjs +0 -149
  118. package/dist/federation/outbound-capture.test.d.mts +0 -2
  119. package/dist/federation/outbound-capture.test.mjs +0 -394
  120. package/dist/federation/outbound-dispatch.test.d.mts +0 -2
  121. package/dist/federation/outbound-dispatch.test.mjs +0 -368
  122. package/dist/federation/outbound-document.test.d.mts +0 -2
  123. package/dist/federation/outbound-document.test.mjs +0 -171
  124. package/dist/federation/outbound-provenance.test.d.mts +0 -2
  125. package/dist/federation/outbound-provenance.test.mjs +0 -543
  126. package/dist/federation/outbound-report.test.d.mts +0 -2
  127. package/dist/federation/outbound-report.test.mjs +0 -5475
  128. package/dist/federation/outbound-workers.test.d.mts +0 -2
  129. package/dist/federation/outbound-workers.test.mjs +0 -64
  130. package/dist/federation/outbound-workflow.test.d.mts +0 -2
  131. package/dist/federation/outbound-workflow.test.mjs +0 -154
  132. package/dist/federation/outgoing-proof.test.d.mts +0 -2
  133. package/dist/federation/outgoing-proof.test.mjs +0 -933
  134. package/dist/federation/portable-actor.test.d.mts +0 -2
  135. package/dist/federation/portable-actor.test.mjs +0 -496
  136. package/dist/federation/portable-chain.test.d.mts +0 -2
  137. package/dist/federation/portable-chain.test.mjs +0 -370
  138. package/dist/federation/portable-collection.test.d.mts +0 -2
  139. package/dist/federation/portable-collection.test.mjs +0 -832
  140. package/dist/federation/portable-delivery.test.d.mts +0 -2
  141. package/dist/federation/portable-delivery.test.mjs +0 -845
  142. package/dist/federation/portable-gateway-keys.test.d.mts +0 -2
  143. package/dist/federation/portable-gateway-keys.test.mjs +0 -692
  144. package/dist/federation/portable-inbox.test.d.mts +0 -2
  145. package/dist/federation/portable-inbox.test.mjs +0 -1960
  146. package/dist/federation/portable-parse-uri.test.d.mts +0 -2
  147. package/dist/federation/portable-parse-uri.test.mjs +0 -348
  148. package/dist/federation/portable-route-activity.test.d.mts +0 -2
  149. package/dist/federation/portable-route-activity.test.mjs +0 -259
  150. package/dist/federation/portable.test.d.mts +0 -2
  151. package/dist/federation/portable.test.mjs +0 -1072
  152. package/dist/federation/retry.test.d.mts +0 -2
  153. package/dist/federation/retry.test.mjs +0 -42
  154. package/dist/federation/router.test.d.mts +0 -2
  155. package/dist/federation/router.test.mjs +0 -123
  156. package/dist/federation/send.test.d.mts +0 -2
  157. package/dist/federation/send.test.mjs +0 -1421
  158. package/dist/federation/tasks/codec.test.d.mts +0 -2
  159. package/dist/federation/tasks/codec.test.mjs +0 -302
  160. package/dist/federation/tasks/enqueue.test.d.mts +0 -2
  161. package/dist/federation/tasks/enqueue.test.mjs +0 -1095
  162. package/dist/federation/tasks/tasks.test.d.mts +0 -2
  163. package/dist/federation/tasks/tasks.test.mjs +0 -1229
  164. package/dist/federation/temporal.test.d.mts +0 -2
  165. package/dist/federation/temporal.test.mjs +0 -71
  166. package/dist/federation/webfinger.test.d.mts +0 -2
  167. package/dist/federation/webfinger.test.mjs +0 -944
  168. package/dist/http-l1zKGCll.mjs +0 -1449
  169. package/dist/inbox-CWX3EBTO.mjs +0 -399
  170. package/dist/inbox-authentication-CgonVRkg.mjs +0 -198
  171. package/dist/inbox-view-DkPCF71K.mjs +0 -385
  172. package/dist/key-owner-evidence-APB6NpSk.mjs +0 -108
  173. package/dist/keycache-N2opu4-3.mjs +0 -221
  174. package/dist/keys-DIJNHW-Y.mjs +0 -120
  175. package/dist/kv-DBRWVx3Q.mjs +0 -104
  176. package/dist/kv-DCHkaJ9-.mjs +0 -92
  177. package/dist/kv-cache-8eJh4Xum.mjs +0 -121
  178. package/dist/ld-Cdt8qD-r.mjs +0 -1752
  179. package/dist/map-local-context-conflict-DOYEEJ3u.mjs +0 -204
  180. package/dist/map-local-create-note-B0SeXJms.mjs +0 -214
  181. package/dist/metrics-BnfvSPj9.mjs +0 -818
  182. package/dist/middleware-CwnXJze2.mjs +0 -5
  183. package/dist/middleware-D_W_LdJN.mjs +0 -9971
  184. package/dist/mq-eF96QxUT.mjs +0 -288
  185. package/dist/negotiation-BAKO9nih.mjs +0 -96
  186. package/dist/nodeinfo/client.test.d.mts +0 -2
  187. package/dist/nodeinfo/client.test.mjs +0 -1364
  188. package/dist/nodeinfo/handler.test.d.mts +0 -2
  189. package/dist/nodeinfo/handler.test.mjs +0 -94
  190. package/dist/nodeinfo/types.test.d.mts +0 -2
  191. package/dist/nodeinfo/types.test.mjs +0 -192
  192. package/dist/otel/exporter.test.d.mts +0 -2
  193. package/dist/otel/exporter.test.mjs +0 -887
  194. package/dist/outbound-body-CckPA5gc.mjs +0 -83
  195. package/dist/outbound-capture-DVgnRzlf.mjs +0 -184
  196. package/dist/outbound-document-BMgwLXTY.mjs +0 -179
  197. package/dist/outgoing-jsonld-4IJqPYos.mjs +0 -205
  198. package/dist/owner-DukEQnv3.mjs +0 -267
  199. package/dist/portable-collection-OHaqa11n.mjs +0 -418
  200. package/dist/portable-key-BkOLJxVz.mjs +0 -549
  201. package/dist/portable-key-id-Ca30-hOa.mjs +0 -248
  202. package/dist/proof-Y7omSVvc.mjs +0 -1420
  203. package/dist/public-audience--klBIOk1.mjs +0 -197
  204. package/dist/retry-zX5xw5e0.mjs +0 -34
  205. package/dist/router-u5O5KCQr.mjs +0 -156
  206. package/dist/secured-document-CxzZZ9nL.mjs +0 -35
  207. package/dist/send-ccQynabr.mjs +0 -710
  208. package/dist/sig/accept.test.d.mts +0 -2
  209. package/dist/sig/accept.test.mjs +0 -416
  210. package/dist/sig/compound-proof-discovery.test.d.mts +0 -2
  211. package/dist/sig/compound-proof-discovery.test.mjs +0 -331
  212. package/dist/sig/compound-proof-producer.test.d.mts +0 -2
  213. package/dist/sig/compound-proof-producer.test.mjs +0 -107
  214. package/dist/sig/compound-proof-verification.test.d.mts +0 -2
  215. package/dist/sig/compound-proof-verification.test.mjs +0 -1017
  216. package/dist/sig/compound-proof.test.d.mts +0 -2
  217. package/dist/sig/compound-proof.test.mjs +0 -411
  218. package/dist/sig/http.test.d.mts +0 -2
  219. package/dist/sig/http.test.mjs +0 -3328
  220. package/dist/sig/key-owner-evidence.test.d.mts +0 -2
  221. package/dist/sig/key-owner-evidence.test.mjs +0 -100
  222. package/dist/sig/key.test.d.mts +0 -2
  223. package/dist/sig/key.test.mjs +0 -1250
  224. package/dist/sig/ld.test.d.mts +0 -2
  225. package/dist/sig/ld.test.mjs +0 -1044
  226. package/dist/sig/mitra-receive-interop.test.d.mts +0 -2
  227. package/dist/sig/mitra-receive-interop.test.mjs +0 -260
  228. package/dist/sig/mitra-send-interop.test.d.mts +0 -2
  229. package/dist/sig/mitra-send-interop.test.mjs +0 -461
  230. package/dist/sig/owner.test.d.mts +0 -2
  231. package/dist/sig/owner.test.mjs +0 -202
  232. package/dist/sig/portable-collection.test.d.mts +0 -2
  233. package/dist/sig/portable-collection.test.mjs +0 -697
  234. package/dist/sig/portable-interop.test.d.mts +0 -2
  235. package/dist/sig/portable-interop.test.mjs +0 -156
  236. package/dist/sig/portable-key-id.test.d.mts +0 -2
  237. package/dist/sig/portable-key-id.test.mjs +0 -67
  238. package/dist/sig/portable-key.test.d.mts +0 -2
  239. package/dist/sig/portable-key.test.mjs +0 -1438
  240. package/dist/sig/proof.test.d.mts +0 -2
  241. package/dist/sig/proof.test.mjs +0 -2638
  242. package/dist/sig/tootik-request-interop.test.d.mts +0 -2
  243. package/dist/sig/tootik-request-interop.test.mjs +0 -190
  244. package/dist/sig/tootik-send-interop.test.d.mts +0 -2
  245. package/dist/sig/tootik-send-interop.test.mjs +0 -331
  246. package/dist/sig/verification.test.d.mts +0 -2
  247. package/dist/sig/verification.test.mjs +0 -310
  248. package/dist/std__assert-DvMDRPes.mjs +0 -8
  249. package/dist/tasks-BCUmQbbz.mjs +0 -77
  250. package/dist/temporal-f_K4lAVR.mjs +0 -95
  251. package/dist/testing/context.test.d.mts +0 -2
  252. package/dist/testing/context.test.mjs +0 -19
  253. package/dist/testing/kv.test.d.mts +0 -2
  254. package/dist/testing/kv.test.mjs +0 -101
  255. package/dist/testing/mod.d.mts +0 -6099
  256. package/dist/testing/mod.mjs +0 -9
  257. package/dist/testing-vrnD5Uaa.mjs +0 -8
  258. package/dist/types-DE_LV1JB.mjs +0 -46
  259. package/dist/utils/docloader.test.d.mts +0 -2
  260. package/dist/utils/docloader.test.mjs +0 -1076
  261. package/dist/utils/kv-cache.test.d.mts +0 -2
  262. package/dist/utils/kv-cache.test.mjs +0 -261
  263. package/dist/verification-C3954hQh.mjs +0 -5
  264. package/dist/verification-Dpfcw8ml.mjs +0 -105
  265. package/dist/vocab/cjs.test.d.mts +0 -2
  266. package/dist/vocab/cjs.test.mjs +0 -27
@@ -1,1233 +0,0 @@
1
- import "temporal-polyfill";
2
- import "urlpattern-polyfill";
3
- globalThis.addEventListener = () => {};
4
- import "node:module";
5
- //#region \0rolldown/runtime.js
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
- //#endregion
28
- //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
29
- var import_glob_to_regexp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
30
- module.exports = function(glob, opts) {
31
- if (typeof glob !== "string") throw new TypeError("Expected a string");
32
- var str = String(glob);
33
- var reStr = "";
34
- var extended = opts ? !!opts.extended : false;
35
- var globstar = opts ? !!opts.globstar : false;
36
- var inGroup = false;
37
- var flags = opts && typeof opts.flags === "string" ? opts.flags : "";
38
- var c;
39
- for (var i = 0, len = str.length; i < len; i++) {
40
- c = str[i];
41
- switch (c) {
42
- case "/":
43
- case "$":
44
- case "^":
45
- case "+":
46
- case ".":
47
- case "(":
48
- case ")":
49
- case "=":
50
- case "!":
51
- case "|":
52
- reStr += "\\" + c;
53
- break;
54
- case "?": if (extended) {
55
- reStr += ".";
56
- break;
57
- }
58
- case "[":
59
- case "]": if (extended) {
60
- reStr += c;
61
- break;
62
- }
63
- case "{": if (extended) {
64
- inGroup = true;
65
- reStr += "(";
66
- break;
67
- }
68
- case "}": if (extended) {
69
- inGroup = false;
70
- reStr += ")";
71
- break;
72
- }
73
- case ",":
74
- if (inGroup) {
75
- reStr += "|";
76
- break;
77
- }
78
- reStr += "\\" + c;
79
- break;
80
- case "*":
81
- var prevChar = str[i - 1];
82
- var starCount = 1;
83
- while (str[i + 1] === "*") {
84
- starCount++;
85
- i++;
86
- }
87
- var nextChar = str[i + 1];
88
- if (!globstar) reStr += ".*";
89
- else if (starCount > 1 && (prevChar === "/" || prevChar === void 0) && (nextChar === "/" || nextChar === void 0)) {
90
- reStr += "((?:[^/]*(?:/|$))*)";
91
- i++;
92
- } else reStr += "([^/]*)";
93
- break;
94
- default: reStr += c;
95
- }
96
- }
97
- if (!flags || !~flags.indexOf("g")) reStr = "^" + reStr + "$";
98
- return new RegExp(reStr, flags);
99
- };
100
- })))(), 1);
101
- /**
102
- * @param {string|RegExp} input The route pattern
103
- * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
104
- */
105
- function parse(input, loose) {
106
- if (input instanceof RegExp) return {
107
- keys: false,
108
- pattern: input
109
- };
110
- var c, o, tmp, ext, keys = [], pattern = "", arr = input.split("/");
111
- arr[0] || arr.shift();
112
- while (tmp = arr.shift()) {
113
- c = tmp[0];
114
- if (c === "*") {
115
- keys.push(c);
116
- pattern += tmp[1] === "?" ? "(?:/(.*))?" : "/(.*)";
117
- } else if (c === ":") {
118
- o = tmp.indexOf("?", 1);
119
- ext = tmp.indexOf(".", 1);
120
- keys.push(tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length));
121
- pattern += !!~o && !~ext ? "(?:/([^/]+?))?" : "/([^/]+?)";
122
- if (!!~ext) pattern += (!!~o ? "?" : "") + "\\" + tmp.substring(ext);
123
- } else pattern += "/" + tmp;
124
- }
125
- return {
126
- keys,
127
- pattern: new RegExp("^" + pattern + (loose ? "(?=$|/)" : "/?$"), "i")
128
- };
129
- }
130
- //#endregion
131
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/TypeDescriptor.js
132
- const valueTypes = /* @__PURE__ */ new Set([
133
- "boolean",
134
- "number",
135
- "null",
136
- "string",
137
- "undefined"
138
- ]);
139
- const referenceTypes = /* @__PURE__ */ new Set([
140
- "array",
141
- "function",
142
- "object",
143
- "symbol"
144
- ]);
145
- const detectableTypes = /* @__PURE__ */ new Set([
146
- "boolean",
147
- "function",
148
- "number",
149
- "string",
150
- "symbol"
151
- ]);
152
- const typeConstructors = /* @__PURE__ */ new Set([
153
- Boolean,
154
- Number,
155
- String
156
- ]);
157
- var TypeDescriptor = class TypeDescriptor {
158
- constructor(value) {
159
- this.name = TypeDescriptor.of(value);
160
- this.isValueType = TypeDescriptor.isValueType(value);
161
- this.isReferenceType = TypeDescriptor.isReferenceType(value);
162
- this.isArray = TypeDescriptor.isArray(value);
163
- this.isBoolean = TypeDescriptor.isBoolean(value);
164
- this.isFunction = TypeDescriptor.isFunction(value);
165
- this.isNull = TypeDescriptor.isNull(value);
166
- this.isNumber = TypeDescriptor.isNumber(value);
167
- this.isObject = TypeDescriptor.isObject(value);
168
- this.isString = TypeDescriptor.isString(value);
169
- this.isSymbol = TypeDescriptor.isSymbol(value);
170
- this.isUndefined = TypeDescriptor.isUndefined(value);
171
- }
172
- static of(value) {
173
- if (value === null) return "null";
174
- if (value === void 0) return "undefined";
175
- const detectedType = typeof value;
176
- if (detectableTypes.has(detectedType)) return detectedType;
177
- if (detectedType === "object") {
178
- if (Array.isArray(value)) return "array";
179
- if (typeConstructors.has(value.constructor)) return value.constructor.name.toLowerCase();
180
- return detectedType;
181
- }
182
- throw new Error("Failed due to an unknown type.");
183
- }
184
- static from(value) {
185
- return new TypeDescriptor(value);
186
- }
187
- static isValueType(value) {
188
- return valueTypes.has(TypeDescriptor.of(value));
189
- }
190
- static isReferenceType(value) {
191
- return referenceTypes.has(TypeDescriptor.of(value));
192
- }
193
- static isArray(value) {
194
- return TypeDescriptor.of(value) === "array";
195
- }
196
- static isBoolean(value) {
197
- return TypeDescriptor.of(value) === "boolean";
198
- }
199
- static isFunction(value) {
200
- return TypeDescriptor.of(value) === "function";
201
- }
202
- static isNull(value) {
203
- return TypeDescriptor.of(value) === "null";
204
- }
205
- static isNumber(value) {
206
- return TypeDescriptor.of(value) === "number";
207
- }
208
- static isObject(value) {
209
- return TypeDescriptor.of(value) === "object";
210
- }
211
- static isString(value) {
212
- return TypeDescriptor.of(value) === "string";
213
- }
214
- static isSymbol(value) {
215
- return TypeDescriptor.of(value) === "symbol";
216
- }
217
- static isUndefined(value) {
218
- return TypeDescriptor.of(value) === "undefined";
219
- }
220
- };
221
- //#endregion
222
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/IsSubsetOf.js
223
- const allowedTypes = /* @__PURE__ */ new Set([
224
- "array",
225
- "object",
226
- "function",
227
- "null"
228
- ]);
229
- const isSubsetOf = function(subset, superset, visited = []) {
230
- const subsetType = TypeDescriptor.of(subset);
231
- const supersetType = TypeDescriptor.of(superset);
232
- if (!allowedTypes.has(subsetType)) throw new Error(`Type '${subsetType}' is not supported.`);
233
- if (!allowedTypes.has(supersetType)) throw new Error(`Type '${supersetType}' is not supported.`);
234
- if (TypeDescriptor.isFunction(subset)) {
235
- if (!TypeDescriptor.isFunction(superset)) throw new Error(`Types '${subsetType}' and '${supersetType}' do not match.`);
236
- return subset.toString() === superset.toString();
237
- }
238
- if (TypeDescriptor.isArray(subset)) {
239
- if (!TypeDescriptor.isArray(superset)) throw new Error(`Types '${subsetType}' and '${supersetType}' do not match.`);
240
- if (subset.length > superset.length) return false;
241
- for (const subsetItem of subset) {
242
- const subsetItemType = TypeDescriptor.of(subsetItem);
243
- let isItemInSuperset;
244
- switch (subsetItemType) {
245
- case "array":
246
- case "object":
247
- case "function":
248
- if (visited.includes(subsetItem)) continue;
249
- visited.push(subsetItem);
250
- isItemInSuperset = superset.some((supersetItem) => {
251
- try {
252
- return isSubsetOf(subsetItem, supersetItem, visited);
253
- } catch {
254
- return false;
255
- }
256
- });
257
- break;
258
- default: isItemInSuperset = superset.includes(subsetItem);
259
- }
260
- if (!isItemInSuperset) return false;
261
- }
262
- return true;
263
- }
264
- if (TypeDescriptor.isObject(subset)) {
265
- if (!TypeDescriptor.isObject(superset) || TypeDescriptor.isArray(superset)) throw new Error(`Types '${subsetType}' and '${supersetType}' do not match.`);
266
- if (Object.keys(subset).length > Object.keys(superset).length) return false;
267
- for (const [subsetKey, subsetValue] of Object.entries(subset)) {
268
- const supersetValue = superset[subsetKey];
269
- switch (TypeDescriptor.of(subsetValue)) {
270
- case "array":
271
- case "object":
272
- case "function":
273
- if (visited.includes(subsetValue)) continue;
274
- visited.push(subsetValue);
275
- try {
276
- if (!isSubsetOf(subsetValue, supersetValue, visited)) return false;
277
- } catch {
278
- return false;
279
- }
280
- break;
281
- default: if (subsetValue !== supersetValue) return false;
282
- }
283
- }
284
- return true;
285
- }
286
- if (TypeDescriptor.isNull(subset)) {
287
- if (!TypeDescriptor.isNull(superset)) throw new Error(`Types '${subsetType}' and '${supersetType}' do not match.`);
288
- return true;
289
- }
290
- throw new Error("Invalid operation.");
291
- };
292
- isSubsetOf.structural = function(subset, superset, visited = []) {
293
- if (!TypeDescriptor.isObject(subset)) throw new Error(`Type '${TypeDescriptor.of(subset)}' is not supported.`);
294
- if (!TypeDescriptor.isObject(superset)) throw new Error(`Type '${TypeDescriptor.of(superset)}' is not supported.`);
295
- for (const [subsetKey, subsetValue] of Object.entries(subset)) {
296
- if (superset[subsetKey] === void 0) return false;
297
- const subsetValueType = TypeDescriptor.of(subsetValue);
298
- const supersetValue = superset[subsetKey];
299
- if (subsetValueType === "object") {
300
- if (visited.includes(subsetValue)) continue;
301
- visited.push(subsetValue);
302
- try {
303
- if (!isSubsetOf.structural(subsetValue, supersetValue, visited)) return false;
304
- } catch {
305
- return false;
306
- }
307
- }
308
- }
309
- return true;
310
- };
311
- //#endregion
312
- //#region ../../node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.mjs
313
- var has = Object.prototype.hasOwnProperty;
314
- function find(iter, tar, key) {
315
- for (key of iter.keys()) if (dequal(key, tar)) return key;
316
- }
317
- function dequal(foo, bar) {
318
- var ctor, len, tmp;
319
- if (foo === bar) return true;
320
- if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
321
- if (ctor === Date) return foo.getTime() === bar.getTime();
322
- if (ctor === RegExp) return foo.toString() === bar.toString();
323
- if (ctor === Array) {
324
- if ((len = foo.length) === bar.length) while (len-- && dequal(foo[len], bar[len]));
325
- return len === -1;
326
- }
327
- if (ctor === Set) {
328
- if (foo.size !== bar.size) return false;
329
- for (len of foo) {
330
- tmp = len;
331
- if (tmp && typeof tmp === "object") {
332
- tmp = find(bar, tmp);
333
- if (!tmp) return false;
334
- }
335
- if (!bar.has(tmp)) return false;
336
- }
337
- return true;
338
- }
339
- if (ctor === Map) {
340
- if (foo.size !== bar.size) return false;
341
- for (len of foo) {
342
- tmp = len[0];
343
- if (tmp && typeof tmp === "object") {
344
- tmp = find(bar, tmp);
345
- if (!tmp) return false;
346
- }
347
- if (!dequal(len[1], bar.get(tmp))) return false;
348
- }
349
- return true;
350
- }
351
- if (ctor === ArrayBuffer) {
352
- foo = new Uint8Array(foo);
353
- bar = new Uint8Array(bar);
354
- } else if (ctor === DataView) {
355
- if ((len = foo.byteLength) === bar.byteLength) while (len-- && foo.getInt8(len) === bar.getInt8(len));
356
- return len === -1;
357
- }
358
- if (ArrayBuffer.isView(foo)) {
359
- if ((len = foo.byteLength) === bar.byteLength) while (len-- && foo[len] === bar[len]);
360
- return len === -1;
361
- }
362
- if (!ctor || typeof foo === "object") {
363
- len = 0;
364
- for (ctor in foo) {
365
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
366
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
367
- }
368
- return Object.keys(bar).length === len;
369
- }
370
- }
371
- return foo !== foo && bar !== bar;
372
- }
373
- //#endregion
374
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/RequestUtils.js
375
- const absoluteUrlRX = /* @__PURE__ */ new RegExp("^[a-z]+://|^data:", "i");
376
- const protocolRelativeUrlRX = /* @__PURE__ */ new RegExp("^//", "i");
377
- function hasCredentialsInUrl(url) {
378
- const urlObject = new URL(url, !absoluteUrlRX.test(url) ? "http://dummy" : void 0);
379
- return Boolean(urlObject.username || urlObject.password);
380
- }
381
- function normalizeUrl(url, allowRelativeUrls) {
382
- if (url instanceof URL) return url.href;
383
- const primitiveUrl = String(url).valueOf();
384
- if (absoluteUrlRX.test(primitiveUrl)) return new URL(primitiveUrl).href;
385
- if (protocolRelativeUrlRX.test(primitiveUrl)) return new URL(primitiveUrl, "http://dummy").href.replace(/^[a-z]+:/, "");
386
- if ("location" in globalThis) if (primitiveUrl.startsWith("/")) return `${globalThis.location.origin}${primitiveUrl}`;
387
- else return `${globalThis.location.href}/${primitiveUrl}`;
388
- else if (allowRelativeUrls) {
389
- const urlInstance = new URL(primitiveUrl, "http://dummy");
390
- return urlInstance.pathname + urlInstance.search;
391
- } else throw new Error("Relative urls are not support by default in node.js tests. Either use a utility such as jsdom to define globalThis.location or set `fetchMock.config.allowRelativeUrls = true`");
392
- }
393
- function createCallLogFromUrlAndOptions(url, options) {
394
- const pendingPromises = [];
395
- if (typeof url === "string" || url instanceof String || url instanceof URL) {
396
- const normalizedUrl = normalizeUrl(url, true);
397
- const derivedOptions = options ? { ...options } : {};
398
- if (derivedOptions.headers) derivedOptions.headers = normalizeHeaders(derivedOptions.headers);
399
- derivedOptions.method = derivedOptions.method ? derivedOptions.method.toLowerCase() : "get";
400
- return {
401
- args: [url, options],
402
- url: normalizedUrl,
403
- queryParams: new URLSearchParams(getQuery(normalizedUrl)),
404
- options: derivedOptions,
405
- signal: derivedOptions.signal,
406
- pendingPromises
407
- };
408
- }
409
- if (typeof url === "object") throw new TypeError("fetch-mock: Unrecognised Request object. Read the Config and Installation sections of the docs");
410
- else throw new TypeError("fetch-mock: Invalid arguments passed to fetch");
411
- }
412
- async function createCallLogFromRequest(request, options) {
413
- const pendingPromises = [];
414
- const derivedOptions = { method: request.method };
415
- try {
416
- try {
417
- derivedOptions.body = await request.clone().formData();
418
- } catch {
419
- derivedOptions.body = await request.clone().text();
420
- }
421
- } catch {}
422
- if (request.headers) derivedOptions.headers = normalizeHeaders(request.headers);
423
- const url = normalizeUrl(request.url, true);
424
- return {
425
- args: [request, options],
426
- url,
427
- queryParams: new URLSearchParams(getQuery(url)),
428
- options: Object.assign(derivedOptions, options || {}),
429
- request,
430
- signal: options && options.signal || request.signal,
431
- pendingPromises
432
- };
433
- }
434
- function getPath(url) {
435
- return (absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy")).pathname;
436
- }
437
- function getHost(url) {
438
- if (absoluteUrlRX.test(url)) return new URL(url).host;
439
- else if ("location" in globalThis) return globalThis.location.host;
440
- return null;
441
- }
442
- function getQuery(url) {
443
- const u = absoluteUrlRX.test(url) ? new URL(url) : new URL(url, "http://dummy");
444
- return u.search ? u.search.substr(1) : "";
445
- }
446
- function normalizeHeaders(headers) {
447
- let entries;
448
- if (headers instanceof Headers) entries = [...headers.entries()];
449
- else if (Array.isArray(headers)) entries = headers;
450
- else entries = Object.entries(headers);
451
- return Object.fromEntries(entries.map(([key, val]) => [key.toLowerCase(), String(val).valueOf()]));
452
- }
453
- //#endregion
454
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Matchers.js
455
- const isUrlMatcher = (matcher) => matcher instanceof RegExp || typeof matcher === "string" || typeof matcher === "object" && "href" in matcher;
456
- const isFunctionMatcher = (matcher) => typeof matcher === "function";
457
- const stringMatchers = {
458
- begin: (targetString) => ({ url }) => url.startsWith(targetString),
459
- end: (targetString) => ({ url }) => url.endsWith(targetString),
460
- include: (targetString) => ({ url }) => url.includes(targetString),
461
- glob: (targetString) => {
462
- const urlRX = (0, import_glob_to_regexp.default)(targetString);
463
- return ({ url }) => urlRX.test(url);
464
- },
465
- express: (targetString) => {
466
- const urlRX = parse(targetString);
467
- return (callLog) => {
468
- const vals = urlRX.pattern.exec(getPath(callLog.url));
469
- if (!vals) {
470
- callLog.expressParams = {};
471
- return false;
472
- }
473
- vals.shift();
474
- callLog.expressParams = urlRX.keys.reduce((map, paramName, i) => vals[i] ? Object.assign(map, { [paramName]: vals[i] }) : map, {});
475
- return true;
476
- };
477
- },
478
- path: (targetString) => {
479
- const dotlessTargetString = getPath(targetString);
480
- return ({ url }) => {
481
- const path = getPath(url);
482
- return path === targetString || path === dotlessTargetString;
483
- };
484
- },
485
- host: (targetString) => {
486
- return ({ url }) => targetString === getHost(url);
487
- }
488
- };
489
- const getHeaderMatcher = ({ headers: expectedHeaders }) => {
490
- if (!expectedHeaders) return;
491
- const expectation = normalizeHeaders(expectedHeaders);
492
- return ({ options: { headers = {} } }) => {
493
- const lowerCaseHeaders = normalizeHeaders(headers);
494
- return Object.keys(expectation).every((headerName) => lowerCaseHeaders[headerName] === expectation[headerName]);
495
- };
496
- };
497
- const getMissingHeaderMatcher = ({ missingHeaders: expectedMissingHeaders }) => {
498
- if (!expectedMissingHeaders) return;
499
- const expectation = expectedMissingHeaders.map((header) => header.toLowerCase());
500
- return ({ options: { headers = {} } }) => {
501
- const lowerCaseHeaders = normalizeHeaders(headers);
502
- return expectation.every((headerName) => !(headerName in lowerCaseHeaders));
503
- };
504
- };
505
- const getMethodMatcher = ({ method: expectedMethod }) => {
506
- if (!expectedMethod) return;
507
- return ({ options: { method } = {} }) => {
508
- return expectedMethod === (method ? method.toLowerCase() : "get");
509
- };
510
- };
511
- const getQueryParamsMatcher = ({ query: passedQuery }) => {
512
- if (!passedQuery) return;
513
- const expectedQuery = new URLSearchParams();
514
- for (const [key, value] of Object.entries(passedQuery)) if (Array.isArray(value)) for (const item of value) expectedQuery.append(key, typeof item === "object" || typeof item === "undefined" ? "" : item.toString());
515
- else expectedQuery.append(key, typeof value === "object" || typeof value === "undefined" ? "" : value.toString());
516
- const keys = Array.from(expectedQuery.keys());
517
- return ({ queryParams }) => {
518
- return keys.every((key) => {
519
- const expectedValues = expectedQuery.getAll(key).sort();
520
- const actualValues = queryParams.getAll(key).sort();
521
- if (expectedValues.length !== actualValues.length) return false;
522
- if (Array.isArray(passedQuery[key])) return expectedValues.every((expected, index) => expected === actualValues[index]);
523
- return dequal(actualValues, expectedValues);
524
- });
525
- };
526
- };
527
- const getExpressParamsMatcher = ({ params: expectedParams, url }) => {
528
- if (!expectedParams) return;
529
- if (!(typeof url === "string" && /express:/.test(url))) throw new Error("fetch-mock: matching on params is only possible when using an express: matcher");
530
- const expectedKeys = Object.keys(expectedParams);
531
- return ({ expressParams = {} }) => {
532
- return expectedKeys.every((key) => expressParams[key] === expectedParams[key]);
533
- };
534
- };
535
- const formDataToObject = (formData) => {
536
- const fields = [...formData];
537
- const result = {};
538
- fields.forEach(([key, value]) => {
539
- result[key] = result[key] || [];
540
- result[key].push(value);
541
- });
542
- return result;
543
- };
544
- const getBodyMatcher = (route) => {
545
- let { body: expectedBody } = route;
546
- let expectedBodyType = "json";
547
- if (!expectedBody) return;
548
- if (expectedBody instanceof FormData) {
549
- expectedBodyType = "formData";
550
- expectedBody = formDataToObject(expectedBody);
551
- }
552
- return ({ options: { body, method = "get" } }) => {
553
- if (["get", "head"].includes(method.toLowerCase())) return false;
554
- let sentBody;
555
- try {
556
- if (typeof body === "string") {
557
- sentBody = JSON.parse(body);
558
- if (expectedBodyType !== "json") return false;
559
- }
560
- } catch {}
561
- if (body instanceof FormData) {
562
- if (expectedBodyType !== "formData") return false;
563
- sentBody = formDataToObject(body);
564
- }
565
- return sentBody && (route.matchPartialBody ? isSubsetOf(expectedBody, sentBody) : dequal(expectedBody, sentBody));
566
- };
567
- };
568
- const getFunctionMatcher = ({ matcherFunction }) => matcherFunction;
569
- const getRegexpMatcher = (regexp) => ({ url }) => regexp.test(url);
570
- const getFullUrlMatcher = (route, matcherUrl, query) => {
571
- const expectedUrl = normalizeUrl(matcherUrl, route.allowRelativeUrls);
572
- if (route.url === matcherUrl) route.url = expectedUrl;
573
- return ({ url }) => {
574
- if (query && expectedUrl.indexOf("?")) return getPath(url) === getPath(expectedUrl);
575
- return normalizeUrl(url, true) === expectedUrl;
576
- };
577
- };
578
- const getUrlMatcher = (route) => {
579
- const { url: matcherUrl, query } = route;
580
- if (matcherUrl === "*") return () => true;
581
- if (matcherUrl instanceof RegExp) return getRegexpMatcher(matcherUrl);
582
- if (matcherUrl instanceof URL) {
583
- if (matcherUrl.href) return getFullUrlMatcher(route, matcherUrl.href, query);
584
- }
585
- if (typeof matcherUrl === "string") {
586
- for (const shorthand in stringMatchers) if (matcherUrl.indexOf(`${shorthand}:`) === 0) {
587
- const urlFragment = matcherUrl.replace(new RegExp(`^${shorthand}:`), "");
588
- return stringMatchers[shorthand](urlFragment);
589
- }
590
- return getFullUrlMatcher(route, matcherUrl, query);
591
- }
592
- if (typeof matcherUrl === "object") {
593
- const matchers = Object.entries(matcherUrl).map(([key, pattern]) => {
594
- if (key === "regexp") return getRegexpMatcher(pattern);
595
- else if (key in stringMatchers) return stringMatchers[key](pattern);
596
- else throw new Error(`unrecognised url matching pattern: ${key}`);
597
- });
598
- return (route) => matchers.every((matcher) => matcher(route));
599
- }
600
- };
601
- const builtInMatchers = [
602
- {
603
- name: "url",
604
- matcher: getUrlMatcher
605
- },
606
- {
607
- name: "query",
608
- matcher: getQueryParamsMatcher
609
- },
610
- {
611
- name: "method",
612
- matcher: getMethodMatcher
613
- },
614
- {
615
- name: "headers",
616
- matcher: getHeaderMatcher
617
- },
618
- {
619
- name: "missingHeaders",
620
- matcher: getMissingHeaderMatcher
621
- },
622
- {
623
- name: "params",
624
- matcher: getExpressParamsMatcher
625
- },
626
- {
627
- name: "body",
628
- matcher: getBodyMatcher,
629
- usesBody: true
630
- },
631
- {
632
- name: "matcherFunction",
633
- matcher: getFunctionMatcher
634
- }
635
- ];
636
- //#endregion
637
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/StatusTextMap.js
638
- const statusTextMap = {
639
- 100: "Continue",
640
- 101: "Switching Protocols",
641
- 102: "Processing",
642
- 200: "OK",
643
- 201: "Created",
644
- 202: "Accepted",
645
- 203: "Non-Authoritative Information",
646
- 204: "No Content",
647
- 205: "Reset Content",
648
- 206: "Partial Content",
649
- 207: "Multi-Status",
650
- 208: "Already Reported",
651
- 226: "IM Used",
652
- 300: "Multiple Choices",
653
- 301: "Moved Permanently",
654
- 302: "Found",
655
- 303: "See Other",
656
- 304: "Not Modified",
657
- 305: "Use Proxy",
658
- 307: "Temporary Redirect",
659
- 308: "Permanent Redirect",
660
- 400: "Bad Request",
661
- 401: "Unauthorized",
662
- 402: "Payment Required",
663
- 403: "Forbidden",
664
- 404: "Not Found",
665
- 405: "Method Not Allowed",
666
- 406: "Not Acceptable",
667
- 407: "Proxy Authentication Required",
668
- 408: "Request Timeout",
669
- 409: "Conflict",
670
- 410: "Gone",
671
- 411: "Length Required",
672
- 412: "Precondition Failed",
673
- 413: "Payload Too Large",
674
- 414: "URI Too Long",
675
- 415: "Unsupported Media Type",
676
- 416: "Range Not Satisfiable",
677
- 417: "Expectation Failed",
678
- 418: "I'm a teapot",
679
- 421: "Misdirected Request",
680
- 422: "Unprocessable Entity",
681
- 423: "Locked",
682
- 424: "Failed Dependency",
683
- 425: "Unordered Collection",
684
- 426: "Upgrade Required",
685
- 428: "Precondition Required",
686
- 429: "Too Many Requests",
687
- 431: "Request Header Fields Too Large",
688
- 451: "Unavailable For Legal Reasons",
689
- 500: "Internal Server Error",
690
- 501: "Not Implemented",
691
- 502: "Bad Gateway",
692
- 503: "Service Unavailable",
693
- 504: "Gateway Timeout",
694
- 505: "HTTP Version Not Supported",
695
- 506: "Variant Also Negotiates",
696
- 507: "Insufficient Storage",
697
- 508: "Loop Detected",
698
- 509: "Bandwidth Limit Exceeded",
699
- 510: "Not Extended",
700
- 511: "Network Authentication Required"
701
- };
702
- //#endregion
703
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Route.js
704
- var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
705
- if (kind === "m") throw new TypeError("Private method is not writable");
706
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
707
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
708
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
709
- };
710
- var __classPrivateFieldGet = function(receiver, state, kind, f) {
711
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
712
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
713
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
714
- };
715
- var _Route_instances;
716
- var _a;
717
- var _Route_responseSubscriptions;
718
- var _Route_validate;
719
- var _Route_sanitize;
720
- var _Route_generateMatcher;
721
- var _Route_limit;
722
- var _Route_delayResponse;
723
- var RouteConfigWrapper = class {
724
- constructor(config) {
725
- Object.assign(this, config);
726
- }
727
- };
728
- function isBodyInit(body) {
729
- return body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || body instanceof DataView || body instanceof FormData || body instanceof ReadableStream || body instanceof URLSearchParams || body instanceof String || typeof body === "string" || body === null;
730
- }
731
- function sanitizeStatus(status) {
732
- if (status === 0) return 200;
733
- if (!status) return 200;
734
- if (typeof status === "number" && parseInt(String(status), 10) !== status && status >= 200 || status < 600) return status;
735
- throw new TypeError(`fetch-mock: Invalid status ${status} passed on response object.
736
- To respond with a JSON object that has status as a property assign the object to body
737
- e.g. {"body": {"status: "registered"}}`);
738
- }
739
- var Route = class {
740
- constructor(config) {
741
- _Route_instances.add(this);
742
- _Route_responseSubscriptions.set(this, void 0);
743
- this.init(config);
744
- }
745
- init(config) {
746
- this.config = config;
747
- __classPrivateFieldSet(this, _Route_responseSubscriptions, [], "f");
748
- __classPrivateFieldGet(this, _Route_instances, "m", _Route_sanitize).call(this);
749
- __classPrivateFieldGet(this, _Route_instances, "m", _Route_validate).call(this);
750
- __classPrivateFieldGet(this, _Route_instances, "m", _Route_generateMatcher).call(this);
751
- __classPrivateFieldGet(this, _Route_instances, "m", _Route_limit).call(this);
752
- __classPrivateFieldGet(this, _Route_instances, "m", _Route_delayResponse).call(this);
753
- }
754
- reset() {}
755
- waitFor(awaitedRoutes) {
756
- const { response } = this.config;
757
- this.config.response = Promise.all(awaitedRoutes.map((awaitedRoute) => new Promise((res) => awaitedRoute.onRespond(() => {
758
- res(void 0);
759
- })))).then(() => response);
760
- }
761
- onRespond(func) {
762
- __classPrivateFieldGet(this, _Route_responseSubscriptions, "f").push(func);
763
- }
764
- constructResponse(responseInput) {
765
- const responseOptions = this.constructResponseOptions(responseInput);
766
- const body = this.constructResponseBody(responseInput, responseOptions);
767
- const responsePackage = {
768
- response: new this.config.Response(body, responseOptions),
769
- responseOptions,
770
- responseInput
771
- };
772
- __classPrivateFieldGet(this, _Route_responseSubscriptions, "f").forEach((func) => func());
773
- return responsePackage;
774
- }
775
- constructResponseOptions(responseInput) {
776
- const options = responseInput.options || {};
777
- options.status = sanitizeStatus(responseInput.status);
778
- options.statusText = statusTextMap[options.status];
779
- options.headers = new this.config.Headers(responseInput.headers);
780
- return options;
781
- }
782
- constructResponseBody(responseInput, responseOptions) {
783
- let body = responseInput.body;
784
- if (!isBodyInit(body)) if (typeof body === "undefined") body = null;
785
- else if (typeof body === "object") {
786
- body = JSON.stringify(body);
787
- if (!responseOptions.headers.has("Content-Type")) responseOptions.headers.set("Content-Type", "application/json");
788
- } else throw new TypeError("Invalid body provided to construct response");
789
- if (this.config.includeContentLength && !responseOptions.headers.has("Content-Length") && !(body instanceof ReadableStream) && !(body instanceof FormData)) {
790
- let length = 0;
791
- if (body instanceof Blob) length = body.size;
792
- else if (body instanceof ArrayBuffer || ArrayBuffer.isView(body) || body instanceof DataView) length = body.byteLength;
793
- else if (body instanceof URLSearchParams) length = body.toString().length;
794
- else if (typeof body === "string" || body instanceof String) length = body.length;
795
- responseOptions.headers.set("Content-Length", length.toString());
796
- }
797
- return body;
798
- }
799
- static defineMatcher(matcher) {
800
- _a.registeredMatchers.push(matcher);
801
- }
802
- };
803
- _a = Route, _Route_responseSubscriptions = /* @__PURE__ */ new WeakMap(), _Route_instances = /* @__PURE__ */ new WeakSet(), _Route_validate = function _Route_validate() {
804
- if (["matched", "unmatched"].includes(this.config.name)) throw new Error(`fetch-mock: Routes cannot use the reserved name \`${this.config.name}\``);
805
- if (!("response" in this.config)) throw new Error("fetch-mock: Each route must define a response");
806
- if (!_a.registeredMatchers.some(({ name }) => name in this.config)) throw new Error("fetch-mock: Each route must specify some criteria for matching calls to fetch. To match all calls use '*'");
807
- }, _Route_sanitize = function _Route_sanitize() {
808
- if (this.config.method) this.config.method = this.config.method.toLowerCase();
809
- }, _Route_generateMatcher = function _Route_generateMatcher() {
810
- const activeMatchers = _a.registeredMatchers.filter(({ name }) => name in this.config).map(({ matcher, usesBody }) => ({
811
- matcher: matcher(this.config),
812
- usesBody
813
- }));
814
- this.config.usesBody = activeMatchers.some(({ usesBody }) => usesBody);
815
- this.matcher = (normalizedRequest) => activeMatchers.every(({ matcher }) => matcher(normalizedRequest));
816
- }, _Route_limit = function _Route_limit() {
817
- if (!this.config.repeat) return;
818
- const originalMatcher = this.matcher;
819
- let timesLeft = this.config.repeat;
820
- this.matcher = (callLog) => {
821
- if (timesLeft && originalMatcher(callLog)) {
822
- timesLeft--;
823
- return true;
824
- }
825
- };
826
- this.reset = () => {
827
- timesLeft = this.config.repeat;
828
- };
829
- }, _Route_delayResponse = function _Route_delayResponse() {
830
- if (this.config.delay) {
831
- const { response } = this.config;
832
- this.config.response = () => {
833
- return new Promise((res) => setTimeout(() => res(response), this.config.delay));
834
- };
835
- }
836
- };
837
- Route.registeredMatchers = [];
838
- builtInMatchers.forEach(Route.defineMatcher);
839
- //#endregion
840
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Router.js
841
- const responseConfigProps = [
842
- "body",
843
- "headers",
844
- "throws",
845
- "status",
846
- "redirectUrl"
847
- ];
848
- function nameToOptions(options) {
849
- return typeof options === "string" ? { name: options } : options;
850
- }
851
- function isPromise(response) {
852
- return typeof response.then === "function";
853
- }
854
- function normalizeResponseInput(responseInput) {
855
- if (typeof responseInput === "number") return { status: responseInput };
856
- else if (typeof responseInput === "string" || shouldSendAsObject(responseInput)) return { body: responseInput };
857
- return responseInput;
858
- }
859
- function shouldSendAsObject(responseInput) {
860
- if (responseConfigProps.some((prop) => prop in responseInput)) {
861
- if (Object.keys(responseInput).every((key) => responseConfigProps.includes(key))) return false;
862
- return true;
863
- }
864
- return true;
865
- }
866
- function throwSpecExceptions({ url, options: { headers, method, body } }) {
867
- if (headers) Object.entries(headers).forEach(([key]) => {
868
- if (/\s/.test(key)) throw new TypeError("Invalid name");
869
- });
870
- if (hasCredentialsInUrl(url)) throw new TypeError(`Request cannot be constructed from a URL that includes credentials: ${url}`);
871
- if (["get", "head"].includes(method) && body) throw new TypeError("Request with GET/HEAD method cannot have body.");
872
- }
873
- const resolveUntilResponseConfig = async (callLog) => {
874
- let response = callLog.route.config.response;
875
- while (true) if (typeof response === "function") response = response(callLog);
876
- else if (isPromise(response)) response = await response;
877
- else return response;
878
- };
879
- var Router = class {
880
- constructor(fetchMockConfig, { routes, fallbackRoute } = {}) {
881
- this.config = fetchMockConfig;
882
- this.routes = routes || [];
883
- this.fallbackRoute = fallbackRoute;
884
- }
885
- needsToReadBody(request) {
886
- return Boolean(request && this.routes.some((route) => route.config.usesBody));
887
- }
888
- execute(callLog) {
889
- throwSpecExceptions(callLog);
890
- return new Promise(async (resolve, reject) => {
891
- const { url, options, request, pendingPromises } = callLog;
892
- let eventListenerAbortController;
893
- if (callLog.signal) {
894
- const abort = () => {
895
- const error = new DOMException("The operation was aborted.", "AbortError");
896
- const requestBody = request?.body || options?.body;
897
- if (requestBody instanceof ReadableStream) if (requestBody.locked) console.warn("fetch-mock: Locked request body can't be cancelled");
898
- else requestBody.cancel(error);
899
- if (callLog?.response?.body) if (callLog.response.body.locked) console.warn("fetch-mock: Locked response body can't be cancelled");
900
- else callLog.response.body.cancel(error);
901
- reject(error);
902
- };
903
- if (callLog.signal.aborted) abort();
904
- eventListenerAbortController = new AbortController();
905
- callLog.signal.addEventListener("abort", abort, {
906
- once: true,
907
- signal: eventListenerAbortController.signal
908
- });
909
- }
910
- if (this.needsToReadBody(request)) options.body = await options.body;
911
- const route = (this.fallbackRoute ? [...this.routes, this.fallbackRoute] : this.routes).find((route) => route.matcher(callLog));
912
- if (route) try {
913
- callLog.route = route;
914
- const { response, responseOptions, responseInput } = await this.generateResponse(callLog);
915
- const observableResponse = this.createObservableResponse(response, responseOptions, responseInput, url, pendingPromises);
916
- callLog.response = response;
917
- resolve(observableResponse);
918
- } catch (err) {
919
- reject(err);
920
- } finally {
921
- eventListenerAbortController?.abort();
922
- }
923
- else reject(/* @__PURE__ */ new Error(`fetch-mock: No response or fallback rule to cover ${options && options.method || "GET"} to ${url}`));
924
- });
925
- }
926
- async generateResponse(callLog) {
927
- const responseInput = await resolveUntilResponseConfig(callLog);
928
- if (responseInput instanceof Response) return {
929
- response: responseInput.clone(),
930
- responseOptions: {},
931
- responseInput: {}
932
- };
933
- const responseConfig = normalizeResponseInput(responseInput);
934
- if (responseConfig.throws) throw responseConfig.throws;
935
- return callLog.route.constructResponse(responseConfig);
936
- }
937
- createObservableResponse(response, responseConfig, responseInput, responseUrl, pendingPromises) {
938
- return new Proxy(response, { get: (originalResponse, name) => {
939
- if (responseInput.redirectUrl) {
940
- if (name === "url") return responseInput.redirectUrl;
941
- if (name === "redirected") return true;
942
- } else {
943
- if (name === "url") return responseUrl;
944
- if (name === "redirected") return false;
945
- }
946
- if (responseInput.status === 0) {
947
- if (name === "status") return 0;
948
- if (name === "statusText") return "";
949
- }
950
- if (typeof response[name] === "function") return new Proxy(response[name], { apply: (func, thisArg, args) => {
951
- const result = func.apply(response, args);
952
- if (result.then) pendingPromises.push(result.catch(() => void 0));
953
- return result;
954
- } });
955
- return originalResponse[name];
956
- } });
957
- }
958
- addRoute(matcher, response, nameOrOptions) {
959
- const config = {};
960
- if (matcher instanceof RouteConfigWrapper) Object.assign(config, matcher);
961
- if (isUrlMatcher(matcher)) config.url = matcher;
962
- else if (isFunctionMatcher(matcher)) config.matcherFunction = matcher;
963
- else Object.assign(config, matcher);
964
- if (typeof response !== "undefined") config.response = response;
965
- if (nameOrOptions) Object.assign(config, typeof nameOrOptions === "string" ? nameToOptions(nameOrOptions) : nameOrOptions);
966
- const route = new Route({
967
- ...this.config,
968
- ...config
969
- });
970
- if (route.config.name && this.routes.some(({ config: { name: existingName } }) => route.config.name === existingName)) throw new Error("fetch-mock: Adding route with same name as existing route.");
971
- if (route.config.waitFor) {
972
- const routeNamesToWaitFor = Array.isArray(route.config.waitFor) ? route.config.waitFor : [route.config.waitFor];
973
- const routesToAwait = [];
974
- routeNamesToWaitFor.forEach((routeName) => {
975
- const routeToAwait = this.routes.find(({ config: { name: existingName } }) => routeName === existingName);
976
- if (routeToAwait) routesToAwait.push(routeToAwait);
977
- else throw new Error(`Cannot wait for route \`${routeName}\`: route of that name does not exist`);
978
- });
979
- route.waitFor(routesToAwait);
980
- }
981
- this.routes.push(route);
982
- }
983
- setFallback(response) {
984
- if (this.fallbackRoute) console.warn("calling fetchMock.catch() twice - are you sure you want to overwrite the previous fallback response");
985
- this.fallbackRoute = new Route({
986
- matcherFunction: () => true,
987
- response: response || "ok",
988
- ...this.config
989
- });
990
- this.fallbackRoute.config.isFallback = true;
991
- }
992
- removeRoutes({ names, includeSticky, includeFallback } = {}) {
993
- includeFallback = includeFallback ?? true;
994
- this.routes = this.routes.filter(({ config: { sticky, name } }) => {
995
- if (sticky && !includeSticky) return true;
996
- if (!names) return false;
997
- return !names.includes(name);
998
- });
999
- if (includeFallback) delete this.fallbackRoute;
1000
- }
1001
- modifyRoute(routeName, options) {
1002
- const route = this.routes.find(({ config: { name } }) => name === routeName);
1003
- if (!route) throw new Error(`Cannot call modifyRoute() on route \`${routeName}\`: route of that name not found`);
1004
- if (route.config.sticky) throw new Error(`Cannot call modifyRoute() on route \`${routeName}\`: route is sticky and cannot be modified`);
1005
- if ("name" in options) throw new Error(`Cannot rename the route \`${routeName}\` as \`${options.name}\`: renaming routes is not supported`);
1006
- if ("sticky" in options) throw new Error(`Altering the stickiness of route \`${routeName}\` is not supported`);
1007
- const newConfig = {
1008
- ...route.config,
1009
- ...options
1010
- };
1011
- Object.entries(options).forEach(([key, value]) => {
1012
- if (value === null) delete newConfig[key];
1013
- });
1014
- route.init(newConfig);
1015
- }
1016
- };
1017
- //#endregion
1018
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/CallHistory.js
1019
- const isName = (filter) => typeof filter === "string" && /^[\da-zA-Z-]+$/.test(filter) && !["matched", "unmatched"].includes(filter);
1020
- const isMatchedOrUnmatched = (filter) => typeof filter === "boolean" || ["matched", "unmatched"].includes(filter);
1021
- var CallHistory = class {
1022
- constructor(config, router) {
1023
- this.callLogs = [];
1024
- this.config = config;
1025
- this.router = router;
1026
- }
1027
- recordCall(callLog) {
1028
- this.callLogs.push(callLog);
1029
- }
1030
- clear() {
1031
- this.callLogs.forEach(({ route }) => {
1032
- if (route) route.reset();
1033
- });
1034
- this.callLogs = [];
1035
- }
1036
- async flush(waitForResponseMethods) {
1037
- const queuedPromises = this.callLogs.flatMap((call) => call.pendingPromises);
1038
- await Promise.allSettled(queuedPromises);
1039
- if (waitForResponseMethods) {
1040
- await Promise.resolve();
1041
- await this.flush();
1042
- }
1043
- }
1044
- calls(filter, options) {
1045
- let calls = [...this.callLogs];
1046
- if (typeof filter === "undefined" && !options) return calls;
1047
- if (isMatchedOrUnmatched(filter)) {
1048
- if ([true, "matched"].includes(filter)) calls = calls.filter(({ route }) => !route?.config || !route.config.isFallback);
1049
- else if ([false, "unmatched"].includes(filter)) calls = calls.filter(({ route }) => Boolean(route?.config && route.config.isFallback));
1050
- if (!options) return calls;
1051
- } else if (isName(filter)) {
1052
- calls = calls.filter(({ route }) => route?.config?.name === filter);
1053
- if (!options) return calls;
1054
- } else if (isUrlMatcher(filter)) options = {
1055
- url: filter,
1056
- ...options || {}
1057
- };
1058
- else options = {
1059
- ...filter,
1060
- ...options || {}
1061
- };
1062
- const { matcher } = new Route({
1063
- response: "ok",
1064
- ...options
1065
- });
1066
- calls = calls.filter(({ url, options }) => {
1067
- return matcher(createCallLogFromUrlAndOptions(url, options));
1068
- });
1069
- return calls;
1070
- }
1071
- called(filter, options) {
1072
- return Boolean(this.calls(filter, options).length);
1073
- }
1074
- lastCall(filter, options) {
1075
- return this.calls(filter, options).pop();
1076
- }
1077
- done(routeNames) {
1078
- let routesToCheck = this.router.routes;
1079
- if (routeNames) {
1080
- routeNames = Array.isArray(routeNames) ? routeNames : [routeNames];
1081
- routesToCheck = this.router.routes.filter(({ config: { name } }) => routeNames.includes(name));
1082
- }
1083
- return routesToCheck.map((route) => {
1084
- const calls = this.callLogs.filter(({ route: routeApplied }) => routeApplied === route);
1085
- if (!calls.length) {
1086
- console.warn(`Warning: ${route.config.name} not called`);
1087
- return false;
1088
- }
1089
- const expectedTimes = route.config.repeat;
1090
- if (!expectedTimes) return true;
1091
- const actualTimes = calls.length;
1092
- if (expectedTimes > actualTimes) {
1093
- console.warn(`Warning: ${route.config.name} only called ${actualTimes} times, but ${expectedTimes} expected`);
1094
- return false;
1095
- }
1096
- return true;
1097
- }).every((isDone) => isDone);
1098
- }
1099
- };
1100
- //#endregion
1101
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/FetchMock.js
1102
- const defaultFetchMockConfig = {
1103
- includeContentLength: true,
1104
- matchPartialBody: false,
1105
- Request: globalThis.Request,
1106
- Response: globalThis.Response,
1107
- Headers: globalThis.Headers,
1108
- fetch: globalThis.fetch
1109
- };
1110
- const defineShorthand = (shorthandOptions) => {
1111
- function shorthand(matcher, response, options) {
1112
- return this.route(matcher, response, Object.assign(options || {}, shorthandOptions));
1113
- }
1114
- return shorthand;
1115
- };
1116
- const defineGreedyShorthand = (shorthandOptions) => {
1117
- return function(response, options) {
1118
- return this.route("*", response, Object.assign(options || {}, shorthandOptions));
1119
- };
1120
- };
1121
- //#endregion
1122
- //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/index.js
1123
- var esm_default = new class FetchMock {
1124
- constructor(config, router) {
1125
- this.sticky = defineShorthand({ sticky: true });
1126
- this.once = defineShorthand({ repeat: 1 });
1127
- this.any = defineGreedyShorthand({});
1128
- this.anyOnce = defineGreedyShorthand({ repeat: 1 });
1129
- this.get = defineShorthand({ method: "get" });
1130
- this.getOnce = defineShorthand({
1131
- method: "get",
1132
- repeat: 1
1133
- });
1134
- this.post = defineShorthand({ method: "post" });
1135
- this.postOnce = defineShorthand({
1136
- method: "post",
1137
- repeat: 1
1138
- });
1139
- this.put = defineShorthand({ method: "put" });
1140
- this.putOnce = defineShorthand({
1141
- method: "put",
1142
- repeat: 1
1143
- });
1144
- this.delete = defineShorthand({ method: "delete" });
1145
- this.deleteOnce = defineShorthand({
1146
- method: "delete",
1147
- repeat: 1
1148
- });
1149
- this.head = defineShorthand({ method: "head" });
1150
- this.headOnce = defineShorthand({
1151
- method: "head",
1152
- repeat: 1
1153
- });
1154
- this.patch = defineShorthand({ method: "patch" });
1155
- this.patchOnce = defineShorthand({
1156
- method: "patch",
1157
- repeat: 1
1158
- });
1159
- this.config = config;
1160
- this.router = new Router(this.config, {
1161
- routes: router ? [...router.routes] : [],
1162
- fallbackRoute: router ? router.fallbackRoute : null
1163
- });
1164
- this.callHistory = new CallHistory(this.config, this.router);
1165
- this.fetchHandler = this.fetchHandler.bind(this);
1166
- Object.assign(this.fetchHandler, { fetchMock: this });
1167
- }
1168
- createInstance() {
1169
- return new FetchMock({ ...this.config }, this.router);
1170
- }
1171
- async fetchHandler(requestInput, requestInit) {
1172
- let callLog;
1173
- if (requestInput instanceof this.config.Request) callLog = await createCallLogFromRequest(requestInput, requestInit);
1174
- else callLog = createCallLogFromUrlAndOptions(requestInput, requestInit);
1175
- this.callHistory.recordCall(callLog);
1176
- const responsePromise = this.router.execute(callLog);
1177
- callLog.pendingPromises.push(responsePromise);
1178
- return responsePromise;
1179
- }
1180
- route(matcher, response, options) {
1181
- this.router.addRoute(matcher, response, options);
1182
- return this;
1183
- }
1184
- catch(response) {
1185
- this.router.setFallback(response);
1186
- return this;
1187
- }
1188
- defineMatcher(matcher) {
1189
- Route.defineMatcher(matcher);
1190
- }
1191
- removeRoutes(options) {
1192
- this.router.removeRoutes(options);
1193
- return this;
1194
- }
1195
- removeRoute(routeName) {
1196
- this.router.removeRoutes({ names: [routeName] });
1197
- return this;
1198
- }
1199
- modifyRoute(routeName, options) {
1200
- this.router.modifyRoute(routeName, options);
1201
- return this;
1202
- }
1203
- clearHistory() {
1204
- this.callHistory.clear();
1205
- return this;
1206
- }
1207
- mockGlobal() {
1208
- globalThis.fetch = this.fetchHandler;
1209
- return this;
1210
- }
1211
- unmockGlobal() {
1212
- globalThis.fetch = this.config.fetch;
1213
- return this;
1214
- }
1215
- hardReset(options) {
1216
- this.clearHistory();
1217
- this.removeRoutes(options);
1218
- this.unmockGlobal();
1219
- return this;
1220
- }
1221
- spy(matcher, name) {
1222
- const boundFetch = this.config.fetch.bind(globalThis);
1223
- if (matcher) this.route(matcher, ({ args }) => boundFetch(...args), name);
1224
- else this.catch(({ args }) => boundFetch(...args));
1225
- return this;
1226
- }
1227
- spyGlobal() {
1228
- this.mockGlobal();
1229
- return this.spy();
1230
- }
1231
- }({ ...defaultFetchMockConfig });
1232
- //#endregion
1233
- export { esm_default as t };