aws-sdk-vitest-mock 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,347 +1,461 @@
1
- import { vi as b } from "vitest";
2
- import { readFileSync as R } from "node:fs";
3
- import N from "node:path";
4
- import { Readable as W } from "node:stream";
5
- import { m as Y } from "./matchers-C6AtmwWz.js";
1
+ import { vi as j } from "vitest";
2
+ import { c as F } from "./matchers-DmTtFk31.js";
3
+ import { m as ge } from "./matchers-DmTtFk31.js";
4
+ import { readFileSync as O } from "node:fs";
5
+ import I from "node:path";
6
+ import { Readable as M } from "node:stream";
6
7
  class d extends Error {
7
- constructor(e, s, c, n) {
8
- super(e), this.name = "AwsError", this.code = s, this.statusCode = c, this.retryable = n;
8
+ constructor(t, o, i, n) {
9
+ super(t), this.name = "AwsError", this.code = o, this.statusCode = i, this.retryable = n;
9
10
  }
10
11
  }
11
- const C = (t) => {
12
- const e = t ? `The specified key does not exist. Key: ${t}` : "The specified key does not exist.";
13
- return new d(e, "NoSuchKey", 404, !1);
14
- }, $ = (t) => {
15
- const e = t ? `The specified bucket does not exist. Bucket: ${t}` : "The specified bucket does not exist.";
16
- return new d(e, "NoSuchBucket", 404, !1);
17
- }, D = (t) => {
18
- const e = t ? `Access Denied for resource: ${t}` : "Access Denied";
19
- return new d(e, "AccessDenied", 403, !1);
20
- }, M = (t) => {
21
- const e = t ? `Requested resource not found: ${t}` : "Requested resource not found";
22
- return new d(e, "ResourceNotFoundException", 400, !1);
23
- }, T = () => new d(
12
+ const T = (e) => new d(
13
+ e ? `The specified key does not exist. Key: ${e}` : "The specified key does not exist.",
14
+ "NoSuchKey",
15
+ 404,
16
+ !1
17
+ ), K = (e) => new d(
18
+ e ? `The specified bucket does not exist. Bucket: ${e}` : "The specified bucket does not exist.",
19
+ "NoSuchBucket",
20
+ 404,
21
+ !1
22
+ ), A = (e) => new d(
23
+ e ? `Access Denied for resource: ${e}` : "Access Denied",
24
+ "AccessDenied",
25
+ 403,
26
+ !1
27
+ ), B = (e) => new d(
28
+ e ? `Requested resource not found: ${e}` : "Requested resource not found",
29
+ "ResourceNotFoundException",
30
+ 400,
31
+ !1
32
+ ), J = () => new d(
24
33
  "The conditional request failed",
25
34
  "ConditionalCheckFailedException",
26
35
  400,
27
36
  !1
28
- ), I = () => new d("Rate exceeded", "Throttling", 400, !0), O = () => new d(
37
+ ), _ = () => new d("Rate exceeded", "Throttling", 400, !0), q = () => new d(
29
38
  "We encountered an internal error. Please try again.",
30
39
  "InternalServerError",
31
40
  500,
32
41
  !0
33
- );
34
- function k() {
35
- return {
36
- enabled: !1,
37
- log(t, e) {
38
- this.enabled && (e === void 0 ? console.log(`[aws-sdk-vitest-mock](Debug) ${t}`) : console.log(`[aws-sdk-vitest-mock](Debug) ${t}`, e));
39
- }
40
- };
41
- }
42
- function y(t) {
43
- t.enabled = !0;
44
- }
45
- function w(t) {
46
- t.enabled = !1;
47
- }
48
- function F(t) {
49
- const e = N.resolve(t), s = R(e, "utf8");
50
- return t.endsWith(".json") ? JSON.parse(s) : s;
51
- }
52
- function L(t, e = {}) {
53
- const { pageSize: s = 10, tokenKey: c = "NextToken", itemsKey: n = "Items" } = e;
54
- if (t.length === 0)
42
+ ), z = (e) => {
43
+ try {
44
+ return JSON.stringify(e, void 0, 2);
45
+ } catch {
46
+ return typeof e == "object" && e !== null ? "[Complex Object]" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "[Non-serializable value]";
47
+ }
48
+ }, v = (e, t) => {
49
+ const o = F.magenta("aws-sdk-vitest-mock(debug):");
50
+ if (t === void 0)
51
+ console.log(`${o} ${e}`);
52
+ else {
53
+ const i = z(t);
54
+ console.log(`${o} ${e}
55
+ ${i}`);
56
+ }
57
+ }, L = (e = !1) => ({
58
+ enabled: e,
59
+ explicitlySet: !1,
60
+ log(t, o) {
61
+ this.enabled && v(t, o);
62
+ },
63
+ logDirect(t, o) {
64
+ v(t, o);
65
+ }
66
+ }), w = (e) => {
67
+ e.enabled = !0, e.explicitlySet = !0;
68
+ }, D = (e) => {
69
+ e.enabled = !1, e.explicitlySet = !0;
70
+ }, V = (e) => {
71
+ const t = I.resolve(e), o = O(t, "utf8");
72
+ return e.endsWith(".json") ? JSON.parse(o) : o;
73
+ }, U = (e, t = {}) => {
74
+ const { pageSize: o = 10, tokenKey: i = "NextToken", itemsKey: n = "Items" } = t;
75
+ if (e.length === 0)
55
76
  return [{ [n]: [] }];
56
- const o = [];
57
- for (let r = 0; r < t.length; r += s) {
58
- const u = t.slice(r, r + s), i = r + s < t.length, l = { [n]: u };
59
- if (i) {
60
- const a = l;
61
- a[c] = `token-${r + s}`;
77
+ const s = [];
78
+ for (let r = 0; r < e.length; r += o) {
79
+ const c = e.slice(r, r + o), l = r + o < e.length, u = { [n]: c };
80
+ if (l) {
81
+ const a = u, g = c[c.length - 1];
82
+ a[i] = g;
62
83
  }
63
- o.push(l);
84
+ s.push(u);
64
85
  }
65
- return o;
66
- }
67
- function K() {
68
- return typeof process < "u" && process.versions?.node ? "node" : typeof process < "u" && process.versions?.bun ? "bun" : "browser";
69
- }
70
- function A(t) {
71
- const e = typeof t == "string" ? Buffer.from(t, "utf8") : Buffer.from(t);
72
- let s = !1;
73
- return new W({
86
+ return s;
87
+ }, G = () => typeof process < "u" && process.versions?.node ? "node" : typeof process < "u" && process.versions?.bun ? "bun" : "browser", H = (e) => {
88
+ const t = typeof e == "string" ? Buffer.from(e, "utf8") : Buffer.from(e);
89
+ let o = !1;
90
+ return new M({
74
91
  read() {
75
- s || (this.push(e), this.push(null), s = !0);
92
+ o || (this.push(t), this.push(null), o = !0);
76
93
  }
77
94
  });
78
- }
79
- function B(t) {
80
- let e;
81
- return typeof t == "string" ? e = new TextEncoder().encode(t) : t instanceof Buffer ? e = new Uint8Array(t) : e = t, new ReadableStream({
82
- start(s) {
83
- s.enqueue(e), s.close();
95
+ }, Q = (e) => {
96
+ let t;
97
+ return typeof e == "string" ? t = new TextEncoder().encode(e) : e instanceof Buffer ? t = new Uint8Array(e) : t = e, new ReadableStream({
98
+ start(o) {
99
+ o.enqueue(t), o.close();
84
100
  }
85
101
  });
102
+ }, S = (e) => {
103
+ const t = G();
104
+ return t === "node" || t === "bun" ? H(e) : Q(e);
105
+ };
106
+ let $ = !1;
107
+ function ce(e) {
108
+ $ = e;
86
109
  }
87
- function h(t) {
88
- const e = K();
89
- return e === "node" || e === "bun" ? A(t) : B(t);
110
+ function p(e) {
111
+ return e.explicitlySet ? e.enabled : $;
90
112
  }
91
- function v(t, e) {
92
- return Object.keys(e).every((s) => {
93
- const c = e[s], n = t[s];
94
- return c && typeof c == "object" && !Array.isArray(c) ? typeof n != "object" || n === null ? !1 : v(
113
+ function N(e, t) {
114
+ return Object.keys(t).every((o) => {
115
+ const i = t[o], n = e[o];
116
+ return i && typeof i == "object" && !Array.isArray(i) ? typeof n != "object" || n === null ? !1 : N(
95
117
  n,
96
- c
97
- ) : n === c;
118
+ i
119
+ ) : n === i;
98
120
  });
99
121
  }
100
- function j(t, e) {
101
- if (t === e) return !0;
102
- if (typeof t != "object" || t === null || typeof e != "object" || e === null)
103
- return t === e;
104
- const s = Object.keys(t), c = Object.keys(e);
105
- return s.length !== c.length ? !1 : c.every((n) => {
106
- if (!Object.prototype.hasOwnProperty.call(t, n)) return !1;
107
- const o = t, r = e, u = o[n], i = r[n];
108
- return typeof u == "object" && u !== null && typeof i == "object" && i !== null ? j(u, i) : u === i;
122
+ function x(e, t) {
123
+ if (e === t) return !0;
124
+ if (typeof e != "object" || e === null || typeof t != "object" || t === null)
125
+ return e === t;
126
+ const o = Object.keys(e), i = Object.keys(t);
127
+ return o.length !== i.length ? !1 : i.every((n) => {
128
+ if (!Object.prototype.hasOwnProperty.call(e, n)) return !1;
129
+ const s = e, r = t, c = s[n], l = r[n];
130
+ return typeof c == "object" && c !== null && typeof l == "object" && l !== null ? x(c, l) : c === l;
109
131
  });
110
132
  }
111
- function x(t) {
112
- return async function(e) {
113
- const s = () => this;
114
- t.debugLogger.log(
115
- `Received command: ${e.constructor.name}`,
116
- e.input
133
+ function X(e, t, o) {
134
+ const i = t.map((s, r) => {
135
+ const c = s.matcher ? JSON.stringify(s.matcher, void 0, 2) : "any input", l = s.strict ? " (strict mode)" : "";
136
+ return ` Mock #${r + 1}: ${c}${l}`;
137
+ }).join(`
138
+ `), n = JSON.stringify(o, void 0, 2);
139
+ return new Error(
140
+ `No matching mock found for ${e}.
141
+
142
+ Found ${t.length} mock(s) but none matched the input.
143
+
144
+ Configured mocks:
145
+ ${i}
146
+
147
+ Received input:
148
+ ${n}
149
+
150
+ Tip: Enable debug mode with enableDebug() for detailed matching information.`
151
+ );
152
+ }
153
+ function Y(e, t) {
154
+ const o = JSON.stringify(t, void 0, 2);
155
+ return new Error(
156
+ `No mock configured for command: ${e}.
157
+
158
+ Received input:
159
+ ${o}
160
+
161
+ Did you forget to call mockClient.on(${e})?`
162
+ );
163
+ }
164
+ function Z(e, t) {
165
+ return e.findIndex((o) => o.strict ? o.matcher && x(t, o.matcher) : !o.matcher || N(t, o.matcher));
166
+ }
167
+ function E(e) {
168
+ return async function(t) {
169
+ const o = () => this, i = p(e.debugLogger), n = t.constructor.name;
170
+ i && e.debugLogger.logDirect(
171
+ `Received command: ${n}`,
172
+ t.input
117
173
  );
118
- const c = t.map.get(
119
- e.constructor
174
+ const s = e.map.get(
175
+ t.constructor
120
176
  );
121
- if (c) {
122
- t.debugLogger.log(
123
- `Found ${c.length} mock(s) for ${e.constructor.name}`
124
- );
125
- const n = c.findIndex((o) => o.strict ? o.matcher && j(e.input, o.matcher) : !o.matcher || v(e.input, o.matcher));
126
- if (n === -1)
127
- t.debugLogger.log(
128
- `No matching mock found for ${e.constructor.name}`,
129
- e.input
130
- );
131
- else {
132
- const o = c[n];
133
- if (!o)
134
- throw new Error(`Mock at index ${n} not found`);
135
- return t.debugLogger.log(
136
- `Using mock at index ${n} for ${e.constructor.name}`
137
- ), o.once && (c.splice(n, 1), t.debugLogger.log(
138
- `Removed one-time mock for ${e.constructor.name}`
139
- )), o.handler(
140
- e.input,
141
- s()
142
- );
143
- }
144
- } else
145
- t.debugLogger.log(
146
- `No mocks configured for ${e.constructor.name}`
147
- );
148
- throw new Error(
149
- `No mock configured for command: ${e.constructor.name}`
177
+ if (!s)
178
+ throw i && e.debugLogger.logDirect(
179
+ `No mocks configured for ${n}`
180
+ ), Y(n, t.input);
181
+ i && e.debugLogger.logDirect(
182
+ `Found ${s.length} mock(s) for ${n}`
150
183
  );
184
+ const r = Z(s, t.input);
185
+ if (r === -1)
186
+ throw i && e.debugLogger.logDirect(
187
+ `No matching mock found for ${n}`,
188
+ t.input
189
+ ), X(n, s, t.input);
190
+ const c = s[r];
191
+ if (!c)
192
+ throw new Error(`Mock at index ${r} not found`);
193
+ return i && e.debugLogger.logDirect(
194
+ `Using mock at index ${r} for ${n}`
195
+ ), c.once && (s.splice(r, 1), i && e.debugLogger.logDirect(
196
+ `Removed one-time mock for ${n}`
197
+ )), c.handler(t.input, o());
151
198
  };
152
199
  }
153
- function S(t, e, s, c = {}) {
154
- const n = (r, u) => {
155
- const i = {
156
- matcher: s,
200
+ function C(e, t, o, i = {}) {
201
+ const n = (r, c, l) => {
202
+ const u = {
203
+ matcher: o,
157
204
  handler: r,
158
- once: u,
159
- strict: !!c.strict
160
- }, l = t.map.get(e) ?? [];
161
- if (u) {
162
- const a = l.findIndex((f) => !f.once);
163
- a === -1 ? l.push(i) : l.splice(a, 0, i), t.map.set(
164
- e,
165
- l
205
+ once: c,
206
+ strict: !!i.strict
207
+ }, a = e.map.get(t) ?? [], g = p(e.debugLogger);
208
+ if (c) {
209
+ const f = a.findIndex((h) => !h.once);
210
+ f === -1 ? a.push(u) : a.splice(f, 0, u), e.map.set(
211
+ t,
212
+ a
213
+ ), g && e.debugLogger.logDirect(
214
+ `Configured ${l}Once for ${t.name}`,
215
+ o ? { matcher: o, strict: !!i.strict } : void 0
166
216
  );
167
217
  } else {
168
- const a = l.filter(
169
- (f) => f.once || JSON.stringify(f.matcher) !== JSON.stringify(s)
218
+ const f = a.filter(
219
+ (h) => h.once || JSON.stringify(h.matcher) !== JSON.stringify(o)
170
220
  );
171
- a.push(i), t.map.set(
172
- e,
173
- a
221
+ f.push(u), e.map.set(
222
+ t,
223
+ f
224
+ ), g && e.debugLogger.logDirect(
225
+ `Configured ${l} for ${t.name}`,
226
+ o ? { matcher: o, strict: !!i.strict } : void 0
174
227
  );
175
228
  }
176
- }, o = {
229
+ }, s = {
177
230
  resolves(r) {
178
- return n(() => Promise.resolve(r), !1), o;
231
+ return n(() => Promise.resolve(r), !1, "resolves"), s;
179
232
  },
180
233
  rejects(r) {
181
- return n(() => {
182
- const u = typeof r == "string" ? new Error(r) : r;
183
- return Promise.reject(u);
184
- }, !1), o;
234
+ return n(
235
+ () => {
236
+ const c = typeof r == "string" ? new Error(r) : r;
237
+ return Promise.reject(c);
238
+ },
239
+ !1,
240
+ "rejects"
241
+ ), s;
185
242
  },
186
243
  callsFake(r) {
187
- return n(r, !1), o;
244
+ return n(r, !1, "callsFake"), s;
188
245
  },
189
246
  resolvesOnce(r) {
190
- return n(() => Promise.resolve(r), !0), o;
247
+ return n(() => Promise.resolve(r), !0, "resolves"), s;
191
248
  },
192
249
  rejectsOnce(r) {
193
- return n(() => {
194
- const u = typeof r == "string" ? new Error(r) : r;
195
- return Promise.reject(u);
196
- }, !0), o;
250
+ return n(
251
+ () => {
252
+ const c = typeof r == "string" ? new Error(r) : r;
253
+ return Promise.reject(c);
254
+ },
255
+ !0,
256
+ "rejects"
257
+ ), s;
197
258
  },
198
259
  callsFakeOnce(r) {
199
- return n(r, !0), o;
260
+ return n(r, !0, "callsFake"), s;
200
261
  },
201
262
  resolvesStream(r) {
202
263
  return n(
203
- () => Promise.resolve({ Body: h(r) }),
204
- !1
205
- ), o;
264
+ () => Promise.resolve({ Body: S(r) }),
265
+ !1,
266
+ "resolvesStream"
267
+ ), s;
206
268
  },
207
269
  resolvesStreamOnce(r) {
208
270
  return n(
209
- () => Promise.resolve({ Body: h(r) }),
210
- !0
211
- ), o;
271
+ () => Promise.resolve({ Body: S(r) }),
272
+ !0,
273
+ "resolvesStream"
274
+ ), s;
212
275
  },
213
- resolvesWithDelay(r, u) {
214
- const i = (l) => {
215
- setTimeout(() => l(r), u);
276
+ resolvesWithDelay(r, c) {
277
+ const l = (u) => {
278
+ setTimeout(() => u(r), c);
216
279
  };
217
- return n(() => new Promise(i), !1), o;
280
+ return n(() => new Promise(l), !1, "resolvesWithDelay"), s;
218
281
  },
219
- rejectsWithDelay(r, u) {
220
- const i = typeof r == "string" ? new Error(r) : r, l = (a, f) => {
221
- setTimeout(() => f(i), u);
282
+ rejectsWithDelay(r, c) {
283
+ const l = typeof r == "string" ? new Error(r) : r, u = (a, g) => {
284
+ setTimeout(() => g(l), c);
222
285
  };
223
- return n(() => new Promise(l), !1), o;
286
+ return n(() => new Promise(u), !1, "rejectsWithDelay"), s;
224
287
  },
225
288
  rejectsWithNoSuchKey(r) {
226
- return n(() => Promise.reject(C(r)), !1), o;
289
+ return n(
290
+ () => Promise.reject(T(r)),
291
+ !1,
292
+ "rejectsWithNoSuchKey"
293
+ ), s;
227
294
  },
228
295
  rejectsWithNoSuchBucket(r) {
229
- return n(() => Promise.reject($(r)), !1), o;
296
+ return n(
297
+ () => Promise.reject(K(r)),
298
+ !1,
299
+ "rejectsWithNoSuchBucket"
300
+ ), s;
230
301
  },
231
302
  rejectsWithAccessDenied(r) {
232
- return n(() => Promise.reject(D(r)), !1), o;
303
+ return n(
304
+ () => Promise.reject(A(r)),
305
+ !1,
306
+ "rejectsWithAccessDenied"
307
+ ), s;
233
308
  },
234
309
  rejectsWithResourceNotFound(r) {
235
310
  return n(
236
- () => Promise.reject(M(r)),
237
- !1
238
- ), o;
311
+ () => Promise.reject(B(r)),
312
+ !1,
313
+ "rejectsWithResourceNotFound"
314
+ ), s;
239
315
  },
240
316
  rejectsWithConditionalCheckFailed() {
241
317
  return n(
242
- () => Promise.reject(T()),
243
- !1
244
- ), o;
318
+ () => Promise.reject(J()),
319
+ !1,
320
+ "rejectsWithConditionalCheckFailed"
321
+ ), s;
245
322
  },
246
323
  rejectsWithThrottling() {
247
- return n(() => Promise.reject(I()), !1), o;
324
+ return n(
325
+ () => Promise.reject(_()),
326
+ !1,
327
+ "rejectsWithThrottling"
328
+ ), s;
248
329
  },
249
330
  rejectsWithInternalServerError() {
250
- return n(() => Promise.reject(O()), !1), o;
331
+ return n(
332
+ () => Promise.reject(q()),
333
+ !1,
334
+ "rejectsWithInternalServerError"
335
+ ), s;
251
336
  },
252
- resolvesPaginated(r, u = {}) {
253
- const i = L(r, u);
254
- let l = 0;
255
- return n((a) => {
256
- const f = u.tokenKey || "NextToken", E = u.inputTokenKey || f, p = a[E];
257
- if (p) {
258
- const g = /token-(\d+)/.exec(p);
259
- if (g && g[1]) {
260
- const P = g[1];
261
- l = Math.floor(
262
- Number.parseInt(P, 10) / (u.pageSize || 10)
263
- );
264
- }
265
- } else
266
- l = 0;
267
- const m = (
268
- // eslint-disable-next-line security/detect-object-injection
269
- i[l] || // eslint-disable-next-line unicorn/prefer-at -- TypeScript target doesn't support Array.at() method
270
- i[i.length - 1] || i[0]
271
- );
272
- if (!m)
273
- throw new Error("No paginated responses available");
274
- return l = Math.min(l + 1, i.length - 1), Promise.resolve(m);
275
- }, !1), o;
337
+ resolvesPaginated(r, c = {}) {
338
+ const l = U(r, c);
339
+ let u = 0;
340
+ return e.debugLogger.log(
341
+ `Configured resolvesPaginated for ${t.name}`,
342
+ { pageSize: c.pageSize, itemsCount: r.length }
343
+ ), n(
344
+ (a) => {
345
+ const g = c.tokenKey || "NextToken", f = c.inputTokenKey || g, b = a[f];
346
+ if (b != null) {
347
+ const R = c.itemsKey || "Items";
348
+ let k = 0;
349
+ for (const W of l) {
350
+ const m = W[R];
351
+ if (m && m.length > 0) {
352
+ const P = m[m.length - 1];
353
+ if (JSON.stringify(P) === JSON.stringify(b)) {
354
+ u = k + 1;
355
+ break;
356
+ }
357
+ }
358
+ k++;
359
+ }
360
+ } else
361
+ u = 0;
362
+ const y = (
363
+ // eslint-disable-next-line security/detect-object-injection
364
+ l[u] || // eslint-disable-next-line unicorn/prefer-at -- TypeScript target doesn't support Array.at() method
365
+ l[l.length - 1] || l[0]
366
+ );
367
+ if (!y)
368
+ throw new Error("No paginated responses available");
369
+ return u = Math.min(u + 1, l.length - 1), Promise.resolve(y);
370
+ },
371
+ !1,
372
+ "resolvesPaginated"
373
+ ), s;
276
374
  },
277
375
  resolvesFromFile(r) {
278
- return n(() => {
279
- const u = F(r);
280
- return Promise.resolve(u);
281
- }, !1), o;
376
+ return e.debugLogger.log(
377
+ `Configured resolvesFromFile for ${t.name}`,
378
+ { filePath: r }
379
+ ), n(
380
+ () => {
381
+ const c = V(r);
382
+ return Promise.resolve(c);
383
+ },
384
+ !1,
385
+ "resolvesFromFile"
386
+ ), s;
282
387
  }
283
388
  };
284
- return o;
389
+ return s;
285
390
  }
286
- const G = (t) => {
287
- const e = {
391
+ const ie = (e) => {
392
+ const t = {
288
393
  map: /* @__PURE__ */ new WeakMap(),
289
- debugLogger: k()
290
- }, s = t.prototype, c = b.spyOn(s, "send").mockImplementation(x(e));
394
+ debugLogger: L()
395
+ }, o = e.prototype, i = j.spyOn(o, "send").mockImplementation(E(t));
291
396
  return {
292
397
  client: void 0,
293
- on: (o, r, u) => S(
294
- e,
295
- o,
398
+ on: (s, r, c) => C(
399
+ t,
400
+ s,
296
401
  r,
297
- u
402
+ c
298
403
  ),
299
404
  reset: () => {
300
- c.mockClear(), e.map = /* @__PURE__ */ new WeakMap();
405
+ p(t.debugLogger) && t.debugLogger.logDirect(
406
+ "Clearing call history (mocks preserved)"
407
+ ), i.mockClear();
301
408
  },
302
409
  restore: () => {
303
- c.mockRestore(), e.map = /* @__PURE__ */ new WeakMap();
410
+ p(t.debugLogger) && t.debugLogger.logDirect(
411
+ "Restoring original client behavior and clearing all mocks"
412
+ ), i.mockRestore(), t.map = /* @__PURE__ */ new WeakMap();
304
413
  },
305
- calls: () => c.mock.calls.map((o) => o[0]),
306
- __rawCalls: () => c.mock.calls,
414
+ calls: () => i.mock.calls.map((s) => s[0]),
415
+ __rawCalls: () => i.mock.calls,
307
416
  enableDebug: () => {
308
- y(e.debugLogger);
417
+ w(t.debugLogger);
309
418
  },
310
419
  disableDebug: () => {
311
- w(e.debugLogger);
420
+ D(t.debugLogger);
312
421
  }
313
422
  };
314
- }, H = (t) => {
315
- const e = {
423
+ }, le = (e) => {
424
+ const t = {
316
425
  map: /* @__PURE__ */ new WeakMap(),
317
- debugLogger: k()
318
- }, s = b.spyOn(t, "send").mockImplementation(x(e));
426
+ debugLogger: L()
427
+ }, o = j.spyOn(e, "send").mockImplementation(E(t));
319
428
  return {
320
- client: t,
321
- on: (n, o, r) => S(
322
- e,
429
+ client: e,
430
+ on: (n, s, r) => C(
431
+ t,
323
432
  n,
324
- o,
433
+ s,
325
434
  r
326
435
  ),
327
436
  reset: () => {
328
- s.mockClear(), e.map = /* @__PURE__ */ new WeakMap();
437
+ p(t.debugLogger) && t.debugLogger.logDirect(
438
+ "Clearing call history (mocks preserved) for client instance"
439
+ ), o.mockClear();
329
440
  },
330
441
  restore: () => {
331
- s.mockRestore(), e.map = /* @__PURE__ */ new WeakMap();
442
+ p(t.debugLogger) && t.debugLogger.logDirect(
443
+ "Restoring original client behavior and clearing all mocks for client instance"
444
+ ), o.mockRestore(), t.map = /* @__PURE__ */ new WeakMap();
332
445
  },
333
- calls: () => s.mock.calls.map((n) => n[0]),
334
- __rawCalls: () => s.mock.calls,
446
+ calls: () => o.mock.calls.map((n) => n[0]),
447
+ __rawCalls: () => o.mock.calls,
335
448
  enableDebug: () => {
336
- y(e.debugLogger);
449
+ w(t.debugLogger);
337
450
  },
338
451
  disableDebug: () => {
339
- w(e.debugLogger);
452
+ D(t.debugLogger);
340
453
  }
341
454
  };
342
455
  };
343
456
  export {
344
- Y as matchers,
345
- G as mockClient,
346
- H as mockClientInstance
457
+ ge as matchers,
458
+ ie as mockClient,
459
+ le as mockClientInstance,
460
+ ce as setGlobalDebug
347
461
  };