@biorate/axios 1.156.2 → 2.0.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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "reporterEnabled": "allure-mocha,spec",
3
+ "allureMochaReporterOptions": {
4
+ "resultsDir": "./allure-results"
5
+ }
6
+ }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,395 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 2.0.0 (2026-02-10)
7
+
8
+ ### Bug Fixes
9
+
10
+ - .npmrc ([51785c1](https://github.com/biorate/core/commit/51785c175101225ae3cef838967b401417e68126))
11
+ - root .mocharc .nycrc.json ([236c00d](https://github.com/biorate/core/commit/236c00d3b1db3c4417ab3c07206b812cbcb10000))
12
+ - root .mocharc .nycrc.json ([6e906e9](https://github.com/biorate/core/commit/6e906e962d10360051c97a11df8516784895c3d8))
13
+
14
+ ### Features
15
+
16
+ - **axios:** deps update ([d984439](https://github.com/biorate/core/commit/d984439a2d77c7a0d770b31f22881deab6bd5bcf))
17
+ - **config:** @{} = ${} template added ([744286f](https://github.com/biorate/core/commit/744286f5728828eb4b230d07c7c9872f442da6be))
18
+ - **config:** @{} = ${} template added ([904fe69](https://github.com/biorate/core/commit/904fe698a4e605e9bf381abcbbab5e4d189c5c8b))
19
+ - update "main" value in package.json ([89de1e3](https://github.com/biorate/core/commit/89de1e3203bcd5123587d046c9277a304bbe4008))
20
+
21
+ ## 1.156.2 (2025-09-18)
22
+
23
+ # 1.156.0 (2025-09-18)
24
+
25
+ # 1.149.0 (2025-08-08)
26
+
27
+ ### Features
28
+
29
+ - **axios:** default timeout ([637ef93](https://github.com/biorate/core/commit/637ef93113554350fc4e40aeb72d21330c4c1d5d))
30
+
31
+ # 1.139.0 (2025-07-11)
32
+
33
+ ### Bug Fixes
34
+
35
+ - axios tests and mocha deps ([04e0aba](https://github.com/biorate/core/commit/04e0abaac8e8505f9b8b5db91c7851182f50c0bc))
36
+
37
+ ## 1.138.2 (2025-06-17)
38
+
39
+ ### Bug Fixes
40
+
41
+ - **axios:** validateStatus stub check ([f69bfbb](https://github.com/biorate/core/commit/f69bfbb551c57165e23d3c8bb1fb44b7a754a764))
42
+
43
+ ## 1.138.1 (2025-06-16)
44
+
45
+ ### Bug Fixes
46
+
47
+ - **axios:** validateStatus check ([6cc06ae](https://github.com/biorate/core/commit/6cc06ae37827f1aca68b9124db3185620b6e20b5))
48
+
49
+ # 1.120.0 (2025-04-29)
50
+
51
+ # 1.117.0 (2025-04-21)
52
+
53
+ # 1.116.0 (2025-04-16)
54
+
55
+ ### Features
56
+
57
+ - **axios:** FakeREsponse and error FakeAxiosError in stubs ([1d43f41](https://github.com/biorate/core/commit/1d43f411bf0eacf0e0ebbd9b4c18cdbdf93aaaae))
58
+
59
+ # 1.115.0 (2025-04-15)
60
+
61
+ ### Features
62
+
63
+ - **mocha-stub:** exactly options added ([d695aed](https://github.com/biorate/core/commit/d695aed0dee56d454876f4638adbd75652ba5622))
64
+
65
+ # 1.114.0 (2025-04-15)
66
+
67
+ ### Features
68
+
69
+ - **axios:** options in stubs ([9ee3c4a](https://github.com/biorate/core/commit/9ee3c4acfc8c023371a9fc379e17c280432caae1))
70
+
71
+ # 1.112.0 (2025-04-14)
72
+
73
+ ### Features
74
+
75
+ - **axios:** stub errors ([abda6fb](https://github.com/biorate/core/commit/abda6fb7b0104fba0ef903e3359d2755c83e48f2))
76
+ - **axios:** stub errors ([8583fec](https://github.com/biorate/core/commit/8583fec1a7b8522aef9a9423291c5a6003489c13))
77
+
78
+ # 1.110.0 (2025-03-14)
79
+
80
+ ### Features
81
+
82
+ - **axios:** stubs api added ([b1b2a5b](https://github.com/biorate/core/commit/b1b2a5b47922719f64275482fd3f54f1da39f222))
83
+
84
+ # 1.104.0 (2025-02-28)
85
+
86
+ ### Features
87
+
88
+ - migration to pnpm ([18c83a3](https://github.com/biorate/core/commit/18c83a30319fdfe0d9d2c5ebd94f5fba499e06cd))
89
+
90
+ ## 1.102.1 (2025-02-28)
91
+
92
+ # 1.102.0 (2025-02-28)
93
+
94
+ ### Features
95
+
96
+ - migration to pnpm ([462d120](https://github.com/biorate/core/commit/462d12068108fc6977906f4e379da6917aca42c3))
97
+
98
+ # 1.100.0 (2025-02-26)
99
+
100
+ ## 1.96.2 (2025-01-24)
101
+
102
+ ### Bug Fixes
103
+
104
+ - **axios:** hooks params to optional, interfaces fix ([fc595d9](https://github.com/biorate/core/commit/fc595d90690a499469441c22ab96245f13a948b3))
105
+
106
+ ## 1.96.1 (2025-01-16)
107
+
108
+ ### Bug Fixes
109
+
110
+ - **axios:** params in hooks ([3f3ce6f](https://github.com/biorate/core/commit/3f3ce6f459cdd8cccce996ad74d129a732cdfdb9))
111
+
112
+ # 1.96.0 (2024-12-26)
113
+
114
+ ## 1.95.1 (2024-12-26)
115
+
116
+ # 1.95.0 (2024-12-26)
117
+
118
+ ## 1.93.1 (2024-12-19)
119
+
120
+ # 1.93.0 (2024-12-19)
121
+
122
+ ## 1.91.5 (2024-12-06)
123
+
124
+ ## 1.91.4 (2024-12-06)
125
+
126
+ ## 1.91.3 (2024-12-06)
127
+
128
+ ## 1.91.2 (2024-12-06)
129
+
130
+ ## 1.91.1 (2024-12-06)
131
+
132
+ # 1.91.0 (2024-12-05)
133
+
134
+ # 1.90.0 (2024-12-05)
135
+
136
+ # 1.86.0 (2024-09-05)
137
+
138
+ ### Features
139
+
140
+ - **axios:** defaults added ([64e7016](https://github.com/biorate/core/commit/64e7016e9b9a5e019875f5ed1ab4cc8e9fc3de51))
141
+
142
+ ## 1.76.3 (2024-07-11)
143
+
144
+ ## 1.65.4 (2024-03-26)
145
+
146
+ # 1.59.0 (2024-02-21)
147
+
148
+ ### Bug Fixes
149
+
150
+ - **axios:** deps update + retry disable ([77d00fc](https://github.com/biorate/core/commit/77d00fcacbfe00ee12ab1077c5bf8a59a1893a91))
151
+
152
+ # 1.54.0 (2024-01-11)
153
+
154
+ ## 1.44.1 (2023-11-20)
155
+
156
+ ### Bug Fixes
157
+
158
+ - **axios:** [@ts-ignore](https://github.com/ts-ignore), types conflict ([32d2e92](https://github.com/biorate/core/commit/32d2e92a4b798d3680d110aa106f145f92442018))
159
+
160
+ # 1.44.0 (2023-11-13)
161
+
162
+ ### Features
163
+
164
+ - **axios:** onRetry callback param added ([5b2f2d4](https://github.com/biorate/core/commit/5b2f2d4c79eca93a142cfa3fa6c79d9708289251))
165
+
166
+ ## 1.42.2 (2023-09-07)
167
+
168
+ ## 1.42.1 (2023-09-04)
169
+
170
+ ## 1.38.4 (2023-08-11)
171
+
172
+ ## 1.38.3 (2023-08-10)
173
+
174
+ ## 1.38.2 (2023-08-10)
175
+
176
+ ## 1.38.1 (2023-08-10)
177
+
178
+ ## 1.30.12 (2023-07-18)
179
+
180
+ # 1.29.0 (2023-05-05)
181
+
182
+ ### Bug Fixes
183
+
184
+ - **shutdown-hook:** allSettled startegy ([acc63c9](https://github.com/biorate/core/commit/acc63c9758ea8af95ded947184379b741837d1de))
185
+
186
+ ## 1.28.2 (2023-05-05)
187
+
188
+ ## 1.28.1 (2023-05-05)
189
+
190
+ # 1.28.0 (2023-05-04)
191
+
192
+ ## 1.27.4 (2023-04-20)
193
+
194
+ ### Bug Fixes
195
+
196
+ - **axios:** temp ts-ignore ([4d10679](https://github.com/biorate/core/commit/4d1067976df825188fc1cd9804cb9807cc9abfa5))
197
+
198
+ ## 1.27.3 (2023-04-20)
199
+
200
+ ### Bug Fixes
201
+
202
+ - **axios:** temp ts-ignore ([e3046d5](https://github.com/biorate/core/commit/e3046d5df6d1a1e6862ab7c3ec5541646c1d8b10))
203
+
204
+ ## 1.27.2 (2023-04-20)
205
+
206
+ ### Bug Fixes
207
+
208
+ - deps, types ([fad95c1](https://github.com/biorate/core/commit/fad95c19b0b21205cf7d961b3fe01f3b919ed710))
209
+
210
+ ## 1.27.1 (2023-04-17)
211
+
212
+ # 1.27.0 (2023-04-17)
213
+
214
+ # 1.26.0 (2023-04-14)
215
+
216
+ ## 1.24.8 (2023-02-02)
217
+
218
+ ### Bug Fixes
219
+
220
+ - **axios:** mocks introduced ([7d5ea78](https://github.com/biorate/core/commit/7d5ea7852d5503443f08daf38a7e69089a2cd216))
221
+
222
+ # 1.24.0 (2023-02-01)
223
+
224
+ ## 1.11.7 (2022-10-26)
225
+
226
+ ### Bug Fixes
227
+
228
+ - **axios-prometheus:** prometheus metrics rename ([796ff62](https://github.com/biorate/core/commit/796ff62599151603c5e67636e802445039dcfcb4))
229
+ - **axios,axios-prometheus:** getStartTime method added ([e7d990f](https://github.com/biorate/core/commit/e7d990f36dcf9ac4a4cb1489e6e1ff714ad0a7bb))
230
+
231
+ ## 1.11.4 (2022-09-21)
232
+
233
+ ### Bug Fixes
234
+
235
+ - **axiox-prometheus:** deps update ([d9f3095](https://github.com/biorate/core/commit/d9f3095bf2b436b7555d8b037746dac11c0e4d93))
236
+
237
+ ## 1.11.3 (2022-09-21)
238
+
239
+ ### Bug Fixes
240
+
241
+ - **axiox:** deps update ([900bc49](https://github.com/biorate/core/commit/900bc49792d1cb7338475ed4c68cc368cdefa613))
242
+
243
+ ## 1.11.2 (2022-09-21)
244
+
245
+ ### Bug Fixes
246
+
247
+ - **axios, kafka:** logic fixes ([5b83869](https://github.com/biorate/core/commit/5b8386953ce1d63783f380ca8fc36fb324a963b1))
248
+
249
+ ## 1.11.1 (2022-09-21)
250
+
251
+ ### Bug Fixes
252
+
253
+ - **axios, kafka:** logic fixes ([d48fff0](https://github.com/biorate/core/commit/d48fff0ebc75566b59aff08e17372ac97b595b30))
254
+
255
+ # 1.11.0 (2022-09-21)
256
+
257
+ ### Bug Fixes
258
+
259
+ - **axios, kafka:** logic fixes ([62e3dbe](https://github.com/biorate/core/commit/62e3dbe648bc5493f07361b18764abee7464ef58))
260
+
261
+ ## 1.7.2 (2022-09-08)
262
+
263
+ ### Bug Fixes
264
+
265
+ - **axios:** before / after hooks, startTime ([b7ce8ed](https://github.com/biorate/core/commit/b7ce8eddb7e5c52a919599e9ca148959b246bdc9))
266
+
267
+ # 1.7.0 (2022-09-08)
268
+
269
+ # 1.6.0 (2022-09-08)
270
+
271
+ # 1.5.0 (2022-09-01)
272
+
273
+ ### Features
274
+
275
+ - **vault:** module added ([72309b8](https://github.com/biorate/core/commit/72309b817018dfe2016660f669e6d50790fe0a5e))
276
+
277
+ ## 1.4.1 (2022-08-19)
278
+
279
+ ### Bug Fixes
280
+
281
+ - **axios:** merge properties ([3607f03](https://github.com/biorate/core/commit/3607f03db7acebbe343d701fe3cdd0a5b3d4f68d))
282
+
283
+ # 1.4.0 (2022-08-15)
284
+
285
+ ## 1.2.2 (2022-08-11)
286
+
287
+ # 1.0.0 (2022-07-10)
288
+
289
+ ## 0.30.19 (2022-07-10)
290
+
291
+ ## 0.30.17 (2022-06-24)
292
+
293
+ ### Bug Fixes
294
+
295
+ - **connector, schema-registry:** strict ([5714899](https://github.com/biorate/core/commit/5714899a82ed95b9d252369971ab99982d70b9c3))
296
+
297
+ ## 0.30.16 (2022-06-24)
298
+
299
+ ### Bug Fixes
300
+
301
+ - **axios:** strict ([2b64040](https://github.com/biorate/core/commit/2b64040cbc3df5b27ac26940d99a68ed7d5ccc07))
302
+
303
+ ## 0.30.11 (2022-06-24)
304
+
305
+ ## 0.30.10 (2022-06-24)
306
+
307
+ ## 0.30.9 (2022-06-23)
308
+
309
+ ## 0.30.7 (2022-06-23)
310
+
311
+ ## 0.30.6 (2022-06-23)
312
+
313
+ ## 0.30.5 (2022-06-23)
314
+
315
+ ## 0.30.4 (2022-06-23)
316
+
317
+ ## 0.30.2 (2022-06-22)
318
+
319
+ # 0.30.0 (2022-06-20)
320
+
321
+ ### Bug Fixes
322
+
323
+ - \*.ts into npmignore ([6a6be03](https://github.com/biorate/core/commit/6a6be030a1e8923df4b03d518f08618e759d06fa))
324
+
325
+ ## 0.29.1 (2022-06-20)
326
+
327
+ # 0.29.0 (2022-06-20)
328
+
329
+ ### Bug Fixes
330
+
331
+ - \*.ts into npmignore ([f6e68b3](https://github.com/biorate/core/commit/f6e68b3a2291e7bfa013674db857db7879a26033))
332
+
333
+ # 0.28.0 (2022-05-06)
334
+
335
+ # 0.27.0 (2022-05-06)
336
+
337
+ # 0.26.0 (2022-04-25)
338
+
339
+ # 0.25.0 (2022-04-25)
340
+
341
+ ### Features
342
+
343
+ - **schema-registry:** api fix ([8631389](https://github.com/biorate/core/commit/8631389036e4c0d1f0a9ec0ccab5a0a2800c4dab))
344
+
345
+ ### BREAKING CHANGES
346
+
347
+ - **schema-registry:** api fix according axios fatch interface change
348
+
349
+ # 0.24.0 (2022-04-25)
350
+
351
+ ### Features
352
+
353
+ - **axios:** fetch interface arguments change ([aa190e7](https://github.com/biorate/core/commit/aa190e776071659248e96cf55a278a011ca9822e))
354
+
355
+ ### BREAKING CHANGES
356
+
357
+ - **axios:** fetch interface arguments change
358
+
359
+ # 0.23.0 (2022-04-11)
360
+
361
+ ### Bug Fixes
362
+
363
+ - **axios:** data params merge ([14e239d](https://github.com/biorate/core/commit/14e239d9b459256cfbf83b522080ad34fd5dcb8e))
364
+
365
+ ### Features
366
+
367
+ - **axios:** contract fetch changed ([6c0f589](https://github.com/biorate/core/commit/6c0f589211a7c34b56f9f845762bdd64ed6ac650))
368
+
369
+ # 0.22.0 (2022-04-08)
370
+
371
+ ### Features
372
+
373
+ - **axios:** path params added ([5524f25](https://github.com/biorate/core/commit/5524f255887b9094fae8c52d5e15dee0824f0541))
374
+
375
+ # 0.21.0 (2022-04-08)
376
+
377
+ ### Features
378
+
379
+ - **axios:** catch / finally methods added ([2e14a47](https://github.com/biorate/core/commit/2e14a47b8ae7d570cdbb8911bf13c28788f1af13))
380
+
381
+ # 0.20.0 (2022-04-08)
382
+
383
+ ## 0.19.1 (2022-04-07)
384
+
385
+ ### Bug Fixes
386
+
387
+ - **axios:** index.d.ts ([ad758d3](https://github.com/biorate/core/commit/ad758d32b1601a979f6a6c723a951e4e7b41dfd5))
388
+
389
+ # 0.19.0 (2022-04-07)
390
+
391
+ ### Features
392
+
393
+ - **axios:** module added ([6f4d2bf](https://github.com/biorate/core/commit/6f4d2bf175d491704833273b24ff091ef28a774f))
394
+
6
395
  ## [1.156.2](https://github.com/biorate/core/compare/v1.156.1...v1.156.2) (2025-09-18)
7
396
 
8
397
  **Note:** Version bump only for package @biorate/axios
@@ -1 +1 @@
1
- {"version":3,"file":"fake-response.js","sourceRoot":"","sources":["../../src/fake-response.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IACvB,YACS,IAAO,EACP,MAAc,EACd,UAAkB,EAClB,OAA6B,EAC7B,MAA6B,EAC7B,OAAa;QALb,SAAI,GAAJ,IAAI,CAAG;QACP,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAsB;QAC7B,WAAM,GAAN,MAAM,CAAuB;QAC7B,YAAO,GAAP,OAAO,CAAM;IACnB,CAAC;CACL;AATD,oCASC"}
1
+ {"version":3,"file":"fake-response.js","sourceRoot":"","sources":["../../src/fake-response.ts"],"names":[],"mappings":";;;AAOA,MAAa,YAAY;IAGvB,YACS,IAAO,EACP,MAAc,EACd,UAAkB,EAClB,OAA6D,EAC7D,MAAqC,EACrC,OAAa;QALb,SAAI,GAAJ,IAAI,CAAG;QACP,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAsD;QAC7D,WAAM,GAAN,MAAM,CAA+B;QACrC,YAAO,GAAP,OAAO,CAAM;IACnB,CAAC;CACL;AAXD,oCAWC"}
package/dist/src/index.js CHANGED
@@ -75,9 +75,8 @@ class Axios extends singleton_1.Singleton {
75
75
  }
76
76
  static setMock(instance, result, options) { }
77
77
  static async _fetch(options) {
78
- var _a;
79
78
  const instance = this.instance();
80
- const useMock = (_a = this.mocks.get(this)) === null || _a === void 0 ? void 0 : _a.value;
79
+ const useMock = this.mocks.get(this)?.value;
81
80
  if (useMock) {
82
81
  const mock = this.getMock(instance, options);
83
82
  if (mock)
@@ -89,7 +88,7 @@ class Axios extends singleton_1.Singleton {
89
88
  return result;
90
89
  }
91
90
  async fetch(options) {
92
- const settings = (0, lodash_1.merge)(Object.assign({}, this), options);
91
+ const settings = (0, lodash_1.merge)({ ...this }, options);
93
92
  if (!__classPrivateFieldGet(this, _Axios_client, "f")) {
94
93
  __classPrivateFieldSet(this, _Axios_client, axios_1.default.create(), "f");
95
94
  if (settings.retry)
@@ -99,7 +98,9 @@ class Axios extends singleton_1.Singleton {
99
98
  settings.baseURL = pathToUrl(settings.baseURL, settings.path);
100
99
  if (settings.url && settings.path)
101
100
  settings.url = pathToUrl(settings.url, settings.path);
102
- const params = Object.assign({}, (0, lodash_1.omit)(settings, axiosRetryConfigKeys.concat(axiosExcludeKeys)));
101
+ const params = {
102
+ ...(0, lodash_1.omit)(settings, axiosRetryConfigKeys.concat(axiosExcludeKeys)),
103
+ };
103
104
  await this.before(params);
104
105
  const startTime = this.getStartTime();
105
106
  try {
@@ -123,7 +124,7 @@ class Axios extends singleton_1.Singleton {
123
124
  async catch(e, startTime, params) { }
124
125
  async finally(startTime, params) { }
125
126
  }
127
+ exports.Axios = Axios;
126
128
  _Axios_client = new WeakMap();
127
129
  Axios.mocks = new WeakMap();
128
- exports.Axios = Axios;
129
130
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA2C;AAC3C,iCAA4D;AAC5D,6CAAgC;AAGhC,yCAAyC;AACzC,kDAA+C;AAC/C,mCAAgC;AAGhC,wCAAsB;AACtB,+CAA6B;AAE7B,MAAM,oBAAoB,GAAG;IAC3B,SAAS;IACT,YAAY;IACZ,oBAAoB;IACpB,gBAAgB;IAChB,SAAS;CACV,CAAC;AAEF,MAAM,gBAAgB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, _d, _e;
30
- const status = (_b = params === null || params === void 0 ? void 0 : params.status) !== null && _b !== void 0 ? _b : 200;
31
- const statusText = String((_c = http_status_1.status[status]) !== null && _c !== void 0 ? _c : http_status_1.status[500]);
32
- const response = new fake_response_1.FakeResponse(params.data, status, statusText, (_d = params.headers) !== null && _d !== void 0 ? _d : {}, (_e = params.config) !== null && _e !== void 0 ? _e : {});
29
+ const status = params?.status ?? 200;
30
+ const statusText = String(http_status_1.status[status] ?? http_status_1.status[500]);
31
+ const response = new fake_response_1.FakeResponse(params.data, status, statusText, params.headers ?? {}, params.config ?? {});
33
32
  this.fetch.set(this.Class, this.Class.fetch);
34
33
  this.Class.fetch = async (options) => {
35
- var _b;
36
34
  this.options.push(options);
37
35
  if (!persist)
38
36
  this.unstub();
39
- if ((_b = instance === null || instance === void 0 ? void 0 : instance.validateStatus) === null || _b === void 0 ? void 0 : _b.call(instance, status))
37
+ if (instance?.validateStatus?.(status))
40
38
  return response;
41
39
  if (['4', '5'].includes(String(status)[0]))
42
40
  __classPrivateFieldGet(this, _Stubs_halt, "f").call(this, statusText, status, params, response);
@@ -49,7 +47,7 @@ class Stubs {
49
47
  this.Class.fetch = this.fetch.get(this.Class);
50
48
  }
51
49
  }
50
+ exports.Stubs = Stubs;
52
51
  _a = Stubs, _Stubs_halt = new WeakMap();
53
52
  _Stubs_cache = { value: new WeakMap() };
54
- exports.Stubs = Stubs;
55
53
  //# sourceMappingURL=stubs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stubs.js","sourceRoot":"","sources":["../../src/stubs.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAAmC;AACnC,6CAAiD;AAEjD,uCAAoC;AACpC,mDAA+C;AAE/C,MAAa,KAAK;IAkBT,MAAM,CAAC,GAAG,CAAC,KAAmB;QACnC,IAAI,CAAC,uBAAA,IAAI,wBAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,uBAAA,IAAI,wBAAO,CAAC,GAAG,CAAC,KAAK,EAAE,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