@covalenthq/client-sdk 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cjs/index.js +95 -2031
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/services/CovalentClient.d.ts +1 -1
  4. package/dist/cjs/util/ApiHelpers.d.ts +1 -1
  5. package/dist/es/index.js +95 -2031
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/es/services/CovalentClient.d.ts +1 -1
  8. package/dist/es/util/ApiHelpers.d.ts +1 -1
  9. package/dist/esm/index.js +95 -2031
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/services/CovalentClient.d.ts +1 -1
  12. package/dist/esm/util/ApiHelpers.d.ts +1 -1
  13. package/dist/services/BalanceService.js +6 -6
  14. package/dist/services/BalanceService.js.map +1 -1
  15. package/dist/services/BaseService.js +10 -10
  16. package/dist/services/BaseService.js.map +1 -1
  17. package/dist/services/CovalentClient.d.ts +1 -1
  18. package/dist/services/CovalentClient.js +1 -1
  19. package/dist/services/NftService.js +13 -13
  20. package/dist/services/NftService.js.map +1 -1
  21. package/dist/services/PricingService.js +1 -1
  22. package/dist/services/PricingService.js.map +1 -1
  23. package/dist/services/SecurityService.js +2 -2
  24. package/dist/services/SecurityService.js.map +1 -1
  25. package/dist/services/TransactionService.js +17 -17
  26. package/dist/services/TransactionService.js.map +1 -1
  27. package/dist/services/XykService.js +16 -16
  28. package/dist/services/XykService.js.map +1 -1
  29. package/dist/util/ApiHelpers.d.ts +1 -1
  30. package/dist/util/ApiHelpers.js +4 -11
  31. package/dist/util/ApiHelpers.js.map +1 -1
  32. package/dist/util/CalculatePrettyBalance.js.map +1 -1
  33. package/dist/util/backoff.js +2 -2
  34. package/dist/util/backoff.js.map +1 -1
  35. package/dist/util/prettifyCurrency.js.map +1 -1
  36. package/package.json +11 -6
package/dist/es/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import require$$0 from 'os';
2
- import require$$1 from 'tty';
3
1
  import { parseISO } from 'date-fns';
4
2
  import Big from 'big.js';
5
3
 
@@ -16,7 +14,7 @@ class ExponentialBackoff {
16
14
  try {
17
15
  let startTime;
18
16
  if (this._debug) {
19
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
17
+ startTime = new Date();
20
18
  }
21
19
  const response = await fetch(url, {
22
20
  headers: {
@@ -24,1962 +22,34 @@ class ExponentialBackoff {
24
22
  "X-Requested-With": source ? source + " " + "(" + userAgent + ")" : userAgent
25
23
  }
26
24
  });
27
- debugOutput(response.url, response.status ?? 429, startTime);
28
- if (response.status === null || response.status === 429) {
29
- throw new Error(`Received status code: ${response.status ?? 429}`);
30
- }
31
- else {
32
- return response.json();
33
- }
34
- }
35
- catch (error) {
36
- if (error.message.includes(`Received status code: 429`) && this.retryCount < this.maxRetries) {
37
- this.retryCount++;
38
- const delayMs = Math.pow(2, this.retryCount) * BASE_DELAY_MS;
39
- await new Promise((resolve) => setTimeout(resolve, delayMs));
40
- return this.backOff(url, source);
41
- }
42
- return Promise.reject(new Error(`Max retries exceeded: ${this.maxRetries}`));
43
- }
44
- }
45
- // to reset the numAttempts for another request
46
- setNumAttempts(retryCount) {
47
- this.retryCount = retryCount;
48
- }
49
- }
50
-
51
- function getDefaultExportFromCjs (x) {
52
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
53
- }
54
-
55
- var ansiStyles$1 = {exports: {}};
56
-
57
- var colorName;
58
- var hasRequiredColorName;
59
-
60
- function requireColorName () {
61
- if (hasRequiredColorName) return colorName;
62
- hasRequiredColorName = 1;
63
-
64
- colorName = {
65
- "aliceblue": [240, 248, 255],
66
- "antiquewhite": [250, 235, 215],
67
- "aqua": [0, 255, 255],
68
- "aquamarine": [127, 255, 212],
69
- "azure": [240, 255, 255],
70
- "beige": [245, 245, 220],
71
- "bisque": [255, 228, 196],
72
- "black": [0, 0, 0],
73
- "blanchedalmond": [255, 235, 205],
74
- "blue": [0, 0, 255],
75
- "blueviolet": [138, 43, 226],
76
- "brown": [165, 42, 42],
77
- "burlywood": [222, 184, 135],
78
- "cadetblue": [95, 158, 160],
79
- "chartreuse": [127, 255, 0],
80
- "chocolate": [210, 105, 30],
81
- "coral": [255, 127, 80],
82
- "cornflowerblue": [100, 149, 237],
83
- "cornsilk": [255, 248, 220],
84
- "crimson": [220, 20, 60],
85
- "cyan": [0, 255, 255],
86
- "darkblue": [0, 0, 139],
87
- "darkcyan": [0, 139, 139],
88
- "darkgoldenrod": [184, 134, 11],
89
- "darkgray": [169, 169, 169],
90
- "darkgreen": [0, 100, 0],
91
- "darkgrey": [169, 169, 169],
92
- "darkkhaki": [189, 183, 107],
93
- "darkmagenta": [139, 0, 139],
94
- "darkolivegreen": [85, 107, 47],
95
- "darkorange": [255, 140, 0],
96
- "darkorchid": [153, 50, 204],
97
- "darkred": [139, 0, 0],
98
- "darksalmon": [233, 150, 122],
99
- "darkseagreen": [143, 188, 143],
100
- "darkslateblue": [72, 61, 139],
101
- "darkslategray": [47, 79, 79],
102
- "darkslategrey": [47, 79, 79],
103
- "darkturquoise": [0, 206, 209],
104
- "darkviolet": [148, 0, 211],
105
- "deeppink": [255, 20, 147],
106
- "deepskyblue": [0, 191, 255],
107
- "dimgray": [105, 105, 105],
108
- "dimgrey": [105, 105, 105],
109
- "dodgerblue": [30, 144, 255],
110
- "firebrick": [178, 34, 34],
111
- "floralwhite": [255, 250, 240],
112
- "forestgreen": [34, 139, 34],
113
- "fuchsia": [255, 0, 255],
114
- "gainsboro": [220, 220, 220],
115
- "ghostwhite": [248, 248, 255],
116
- "gold": [255, 215, 0],
117
- "goldenrod": [218, 165, 32],
118
- "gray": [128, 128, 128],
119
- "green": [0, 128, 0],
120
- "greenyellow": [173, 255, 47],
121
- "grey": [128, 128, 128],
122
- "honeydew": [240, 255, 240],
123
- "hotpink": [255, 105, 180],
124
- "indianred": [205, 92, 92],
125
- "indigo": [75, 0, 130],
126
- "ivory": [255, 255, 240],
127
- "khaki": [240, 230, 140],
128
- "lavender": [230, 230, 250],
129
- "lavenderblush": [255, 240, 245],
130
- "lawngreen": [124, 252, 0],
131
- "lemonchiffon": [255, 250, 205],
132
- "lightblue": [173, 216, 230],
133
- "lightcoral": [240, 128, 128],
134
- "lightcyan": [224, 255, 255],
135
- "lightgoldenrodyellow": [250, 250, 210],
136
- "lightgray": [211, 211, 211],
137
- "lightgreen": [144, 238, 144],
138
- "lightgrey": [211, 211, 211],
139
- "lightpink": [255, 182, 193],
140
- "lightsalmon": [255, 160, 122],
141
- "lightseagreen": [32, 178, 170],
142
- "lightskyblue": [135, 206, 250],
143
- "lightslategray": [119, 136, 153],
144
- "lightslategrey": [119, 136, 153],
145
- "lightsteelblue": [176, 196, 222],
146
- "lightyellow": [255, 255, 224],
147
- "lime": [0, 255, 0],
148
- "limegreen": [50, 205, 50],
149
- "linen": [250, 240, 230],
150
- "magenta": [255, 0, 255],
151
- "maroon": [128, 0, 0],
152
- "mediumaquamarine": [102, 205, 170],
153
- "mediumblue": [0, 0, 205],
154
- "mediumorchid": [186, 85, 211],
155
- "mediumpurple": [147, 112, 219],
156
- "mediumseagreen": [60, 179, 113],
157
- "mediumslateblue": [123, 104, 238],
158
- "mediumspringgreen": [0, 250, 154],
159
- "mediumturquoise": [72, 209, 204],
160
- "mediumvioletred": [199, 21, 133],
161
- "midnightblue": [25, 25, 112],
162
- "mintcream": [245, 255, 250],
163
- "mistyrose": [255, 228, 225],
164
- "moccasin": [255, 228, 181],
165
- "navajowhite": [255, 222, 173],
166
- "navy": [0, 0, 128],
167
- "oldlace": [253, 245, 230],
168
- "olive": [128, 128, 0],
169
- "olivedrab": [107, 142, 35],
170
- "orange": [255, 165, 0],
171
- "orangered": [255, 69, 0],
172
- "orchid": [218, 112, 214],
173
- "palegoldenrod": [238, 232, 170],
174
- "palegreen": [152, 251, 152],
175
- "paleturquoise": [175, 238, 238],
176
- "palevioletred": [219, 112, 147],
177
- "papayawhip": [255, 239, 213],
178
- "peachpuff": [255, 218, 185],
179
- "peru": [205, 133, 63],
180
- "pink": [255, 192, 203],
181
- "plum": [221, 160, 221],
182
- "powderblue": [176, 224, 230],
183
- "purple": [128, 0, 128],
184
- "rebeccapurple": [102, 51, 153],
185
- "red": [255, 0, 0],
186
- "rosybrown": [188, 143, 143],
187
- "royalblue": [65, 105, 225],
188
- "saddlebrown": [139, 69, 19],
189
- "salmon": [250, 128, 114],
190
- "sandybrown": [244, 164, 96],
191
- "seagreen": [46, 139, 87],
192
- "seashell": [255, 245, 238],
193
- "sienna": [160, 82, 45],
194
- "silver": [192, 192, 192],
195
- "skyblue": [135, 206, 235],
196
- "slateblue": [106, 90, 205],
197
- "slategray": [112, 128, 144],
198
- "slategrey": [112, 128, 144],
199
- "snow": [255, 250, 250],
200
- "springgreen": [0, 255, 127],
201
- "steelblue": [70, 130, 180],
202
- "tan": [210, 180, 140],
203
- "teal": [0, 128, 128],
204
- "thistle": [216, 191, 216],
205
- "tomato": [255, 99, 71],
206
- "turquoise": [64, 224, 208],
207
- "violet": [238, 130, 238],
208
- "wheat": [245, 222, 179],
209
- "white": [255, 255, 255],
210
- "whitesmoke": [245, 245, 245],
211
- "yellow": [255, 255, 0],
212
- "yellowgreen": [154, 205, 50]
213
- };
214
- return colorName;
215
- }
216
-
217
- /* MIT license */
218
-
219
- var conversions;
220
- var hasRequiredConversions;
221
-
222
- function requireConversions () {
223
- if (hasRequiredConversions) return conversions;
224
- hasRequiredConversions = 1;
225
- /* eslint-disable no-mixed-operators */
226
- const cssKeywords = requireColorName();
227
-
228
- // NOTE: conversions should only return primitive values (i.e. arrays, or
229
- // values that give correct `typeof` results).
230
- // do not use box values types (i.e. Number(), String(), etc.)
231
-
232
- const reverseKeywords = {};
233
- for (const key of Object.keys(cssKeywords)) {
234
- reverseKeywords[cssKeywords[key]] = key;
235
- }
236
-
237
- const convert = {
238
- rgb: {channels: 3, labels: 'rgb'},
239
- hsl: {channels: 3, labels: 'hsl'},
240
- hsv: {channels: 3, labels: 'hsv'},
241
- hwb: {channels: 3, labels: 'hwb'},
242
- cmyk: {channels: 4, labels: 'cmyk'},
243
- xyz: {channels: 3, labels: 'xyz'},
244
- lab: {channels: 3, labels: 'lab'},
245
- lch: {channels: 3, labels: 'lch'},
246
- hex: {channels: 1, labels: ['hex']},
247
- keyword: {channels: 1, labels: ['keyword']},
248
- ansi16: {channels: 1, labels: ['ansi16']},
249
- ansi256: {channels: 1, labels: ['ansi256']},
250
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
251
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
252
- gray: {channels: 1, labels: ['gray']}
253
- };
254
-
255
- conversions = convert;
256
-
257
- // Hide .channels and .labels properties
258
- for (const model of Object.keys(convert)) {
259
- if (!('channels' in convert[model])) {
260
- throw new Error('missing channels property: ' + model);
261
- }
262
-
263
- if (!('labels' in convert[model])) {
264
- throw new Error('missing channel labels property: ' + model);
265
- }
266
-
267
- if (convert[model].labels.length !== convert[model].channels) {
268
- throw new Error('channel and label counts mismatch: ' + model);
269
- }
270
-
271
- const {channels, labels} = convert[model];
272
- delete convert[model].channels;
273
- delete convert[model].labels;
274
- Object.defineProperty(convert[model], 'channels', {value: channels});
275
- Object.defineProperty(convert[model], 'labels', {value: labels});
276
- }
277
-
278
- convert.rgb.hsl = function (rgb) {
279
- const r = rgb[0] / 255;
280
- const g = rgb[1] / 255;
281
- const b = rgb[2] / 255;
282
- const min = Math.min(r, g, b);
283
- const max = Math.max(r, g, b);
284
- const delta = max - min;
285
- let h;
286
- let s;
287
-
288
- if (max === min) {
289
- h = 0;
290
- } else if (r === max) {
291
- h = (g - b) / delta;
292
- } else if (g === max) {
293
- h = 2 + (b - r) / delta;
294
- } else if (b === max) {
295
- h = 4 + (r - g) / delta;
296
- }
297
-
298
- h = Math.min(h * 60, 360);
299
-
300
- if (h < 0) {
301
- h += 360;
302
- }
303
-
304
- const l = (min + max) / 2;
305
-
306
- if (max === min) {
307
- s = 0;
308
- } else if (l <= 0.5) {
309
- s = delta / (max + min);
310
- } else {
311
- s = delta / (2 - max - min);
312
- }
313
-
314
- return [h, s * 100, l * 100];
315
- };
316
-
317
- convert.rgb.hsv = function (rgb) {
318
- let rdif;
319
- let gdif;
320
- let bdif;
321
- let h;
322
- let s;
323
-
324
- const r = rgb[0] / 255;
325
- const g = rgb[1] / 255;
326
- const b = rgb[2] / 255;
327
- const v = Math.max(r, g, b);
328
- const diff = v - Math.min(r, g, b);
329
- const diffc = function (c) {
330
- return (v - c) / 6 / diff + 1 / 2;
331
- };
332
-
333
- if (diff === 0) {
334
- h = 0;
335
- s = 0;
336
- } else {
337
- s = diff / v;
338
- rdif = diffc(r);
339
- gdif = diffc(g);
340
- bdif = diffc(b);
341
-
342
- if (r === v) {
343
- h = bdif - gdif;
344
- } else if (g === v) {
345
- h = (1 / 3) + rdif - bdif;
346
- } else if (b === v) {
347
- h = (2 / 3) + gdif - rdif;
348
- }
349
-
350
- if (h < 0) {
351
- h += 1;
352
- } else if (h > 1) {
353
- h -= 1;
354
- }
355
- }
356
-
357
- return [
358
- h * 360,
359
- s * 100,
360
- v * 100
361
- ];
362
- };
363
-
364
- convert.rgb.hwb = function (rgb) {
365
- const r = rgb[0];
366
- const g = rgb[1];
367
- let b = rgb[2];
368
- const h = convert.rgb.hsl(rgb)[0];
369
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
370
-
371
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
372
-
373
- return [h, w * 100, b * 100];
374
- };
375
-
376
- convert.rgb.cmyk = function (rgb) {
377
- const r = rgb[0] / 255;
378
- const g = rgb[1] / 255;
379
- const b = rgb[2] / 255;
380
-
381
- const k = Math.min(1 - r, 1 - g, 1 - b);
382
- const c = (1 - r - k) / (1 - k) || 0;
383
- const m = (1 - g - k) / (1 - k) || 0;
384
- const y = (1 - b - k) / (1 - k) || 0;
385
-
386
- return [c * 100, m * 100, y * 100, k * 100];
387
- };
388
-
389
- function comparativeDistance(x, y) {
390
- /*
391
- See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
392
- */
393
- return (
394
- ((x[0] - y[0]) ** 2) +
395
- ((x[1] - y[1]) ** 2) +
396
- ((x[2] - y[2]) ** 2)
397
- );
398
- }
399
-
400
- convert.rgb.keyword = function (rgb) {
401
- const reversed = reverseKeywords[rgb];
402
- if (reversed) {
403
- return reversed;
404
- }
405
-
406
- let currentClosestDistance = Infinity;
407
- let currentClosestKeyword;
408
-
409
- for (const keyword of Object.keys(cssKeywords)) {
410
- const value = cssKeywords[keyword];
411
-
412
- // Compute comparative distance
413
- const distance = comparativeDistance(rgb, value);
414
-
415
- // Check if its less, if so set as closest
416
- if (distance < currentClosestDistance) {
417
- currentClosestDistance = distance;
418
- currentClosestKeyword = keyword;
419
- }
420
- }
421
-
422
- return currentClosestKeyword;
423
- };
424
-
425
- convert.keyword.rgb = function (keyword) {
426
- return cssKeywords[keyword];
427
- };
428
-
429
- convert.rgb.xyz = function (rgb) {
430
- let r = rgb[0] / 255;
431
- let g = rgb[1] / 255;
432
- let b = rgb[2] / 255;
433
-
434
- // Assume sRGB
435
- r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
436
- g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
437
- b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
438
-
439
- const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
440
- const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
441
- const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
442
-
443
- return [x * 100, y * 100, z * 100];
444
- };
445
-
446
- convert.rgb.lab = function (rgb) {
447
- const xyz = convert.rgb.xyz(rgb);
448
- let x = xyz[0];
449
- let y = xyz[1];
450
- let z = xyz[2];
451
-
452
- x /= 95.047;
453
- y /= 100;
454
- z /= 108.883;
455
-
456
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
457
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
458
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
459
-
460
- const l = (116 * y) - 16;
461
- const a = 500 * (x - y);
462
- const b = 200 * (y - z);
463
-
464
- return [l, a, b];
465
- };
466
-
467
- convert.hsl.rgb = function (hsl) {
468
- const h = hsl[0] / 360;
469
- const s = hsl[1] / 100;
470
- const l = hsl[2] / 100;
471
- let t2;
472
- let t3;
473
- let val;
474
-
475
- if (s === 0) {
476
- val = l * 255;
477
- return [val, val, val];
478
- }
479
-
480
- if (l < 0.5) {
481
- t2 = l * (1 + s);
482
- } else {
483
- t2 = l + s - l * s;
484
- }
485
-
486
- const t1 = 2 * l - t2;
487
-
488
- const rgb = [0, 0, 0];
489
- for (let i = 0; i < 3; i++) {
490
- t3 = h + 1 / 3 * -(i - 1);
491
- if (t3 < 0) {
492
- t3++;
493
- }
494
-
495
- if (t3 > 1) {
496
- t3--;
497
- }
498
-
499
- if (6 * t3 < 1) {
500
- val = t1 + (t2 - t1) * 6 * t3;
501
- } else if (2 * t3 < 1) {
502
- val = t2;
503
- } else if (3 * t3 < 2) {
504
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
505
- } else {
506
- val = t1;
507
- }
508
-
509
- rgb[i] = val * 255;
510
- }
511
-
512
- return rgb;
513
- };
514
-
515
- convert.hsl.hsv = function (hsl) {
516
- const h = hsl[0];
517
- let s = hsl[1] / 100;
518
- let l = hsl[2] / 100;
519
- let smin = s;
520
- const lmin = Math.max(l, 0.01);
521
-
522
- l *= 2;
523
- s *= (l <= 1) ? l : 2 - l;
524
- smin *= lmin <= 1 ? lmin : 2 - lmin;
525
- const v = (l + s) / 2;
526
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
527
-
528
- return [h, sv * 100, v * 100];
529
- };
530
-
531
- convert.hsv.rgb = function (hsv) {
532
- const h = hsv[0] / 60;
533
- const s = hsv[1] / 100;
534
- let v = hsv[2] / 100;
535
- const hi = Math.floor(h) % 6;
536
-
537
- const f = h - Math.floor(h);
538
- const p = 255 * v * (1 - s);
539
- const q = 255 * v * (1 - (s * f));
540
- const t = 255 * v * (1 - (s * (1 - f)));
541
- v *= 255;
542
-
543
- switch (hi) {
544
- case 0:
545
- return [v, t, p];
546
- case 1:
547
- return [q, v, p];
548
- case 2:
549
- return [p, v, t];
550
- case 3:
551
- return [p, q, v];
552
- case 4:
553
- return [t, p, v];
554
- case 5:
555
- return [v, p, q];
556
- }
557
- };
558
-
559
- convert.hsv.hsl = function (hsv) {
560
- const h = hsv[0];
561
- const s = hsv[1] / 100;
562
- const v = hsv[2] / 100;
563
- const vmin = Math.max(v, 0.01);
564
- let sl;
565
- let l;
566
-
567
- l = (2 - s) * v;
568
- const lmin = (2 - s) * vmin;
569
- sl = s * vmin;
570
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
571
- sl = sl || 0;
572
- l /= 2;
573
-
574
- return [h, sl * 100, l * 100];
575
- };
576
-
577
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
578
- convert.hwb.rgb = function (hwb) {
579
- const h = hwb[0] / 360;
580
- let wh = hwb[1] / 100;
581
- let bl = hwb[2] / 100;
582
- const ratio = wh + bl;
583
- let f;
584
-
585
- // Wh + bl cant be > 1
586
- if (ratio > 1) {
587
- wh /= ratio;
588
- bl /= ratio;
589
- }
590
-
591
- const i = Math.floor(6 * h);
592
- const v = 1 - bl;
593
- f = 6 * h - i;
594
-
595
- if ((i & 0x01) !== 0) {
596
- f = 1 - f;
597
- }
598
-
599
- const n = wh + f * (v - wh); // Linear interpolation
600
-
601
- let r;
602
- let g;
603
- let b;
604
- /* eslint-disable max-statements-per-line,no-multi-spaces */
605
- switch (i) {
606
- default:
607
- case 6:
608
- case 0: r = v; g = n; b = wh; break;
609
- case 1: r = n; g = v; b = wh; break;
610
- case 2: r = wh; g = v; b = n; break;
611
- case 3: r = wh; g = n; b = v; break;
612
- case 4: r = n; g = wh; b = v; break;
613
- case 5: r = v; g = wh; b = n; break;
614
- }
615
- /* eslint-enable max-statements-per-line,no-multi-spaces */
616
-
617
- return [r * 255, g * 255, b * 255];
618
- };
619
-
620
- convert.cmyk.rgb = function (cmyk) {
621
- const c = cmyk[0] / 100;
622
- const m = cmyk[1] / 100;
623
- const y = cmyk[2] / 100;
624
- const k = cmyk[3] / 100;
625
-
626
- const r = 1 - Math.min(1, c * (1 - k) + k);
627
- const g = 1 - Math.min(1, m * (1 - k) + k);
628
- const b = 1 - Math.min(1, y * (1 - k) + k);
629
-
630
- return [r * 255, g * 255, b * 255];
631
- };
632
-
633
- convert.xyz.rgb = function (xyz) {
634
- const x = xyz[0] / 100;
635
- const y = xyz[1] / 100;
636
- const z = xyz[2] / 100;
637
- let r;
638
- let g;
639
- let b;
640
-
641
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
642
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
643
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
644
-
645
- // Assume sRGB
646
- r = r > 0.0031308
647
- ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
648
- : r * 12.92;
649
-
650
- g = g > 0.0031308
651
- ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
652
- : g * 12.92;
653
-
654
- b = b > 0.0031308
655
- ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
656
- : b * 12.92;
657
-
658
- r = Math.min(Math.max(0, r), 1);
659
- g = Math.min(Math.max(0, g), 1);
660
- b = Math.min(Math.max(0, b), 1);
661
-
662
- return [r * 255, g * 255, b * 255];
663
- };
664
-
665
- convert.xyz.lab = function (xyz) {
666
- let x = xyz[0];
667
- let y = xyz[1];
668
- let z = xyz[2];
669
-
670
- x /= 95.047;
671
- y /= 100;
672
- z /= 108.883;
673
-
674
- x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
675
- y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
676
- z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
677
-
678
- const l = (116 * y) - 16;
679
- const a = 500 * (x - y);
680
- const b = 200 * (y - z);
681
-
682
- return [l, a, b];
683
- };
684
-
685
- convert.lab.xyz = function (lab) {
686
- const l = lab[0];
687
- const a = lab[1];
688
- const b = lab[2];
689
- let x;
690
- let y;
691
- let z;
692
-
693
- y = (l + 16) / 116;
694
- x = a / 500 + y;
695
- z = y - b / 200;
696
-
697
- const y2 = y ** 3;
698
- const x2 = x ** 3;
699
- const z2 = z ** 3;
700
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
701
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
702
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
703
-
704
- x *= 95.047;
705
- y *= 100;
706
- z *= 108.883;
707
-
708
- return [x, y, z];
709
- };
710
-
711
- convert.lab.lch = function (lab) {
712
- const l = lab[0];
713
- const a = lab[1];
714
- const b = lab[2];
715
- let h;
716
-
717
- const hr = Math.atan2(b, a);
718
- h = hr * 360 / 2 / Math.PI;
719
-
720
- if (h < 0) {
721
- h += 360;
722
- }
723
-
724
- const c = Math.sqrt(a * a + b * b);
725
-
726
- return [l, c, h];
727
- };
728
-
729
- convert.lch.lab = function (lch) {
730
- const l = lch[0];
731
- const c = lch[1];
732
- const h = lch[2];
733
-
734
- const hr = h / 360 * 2 * Math.PI;
735
- const a = c * Math.cos(hr);
736
- const b = c * Math.sin(hr);
737
-
738
- return [l, a, b];
739
- };
740
-
741
- convert.rgb.ansi16 = function (args, saturation = null) {
742
- const [r, g, b] = args;
743
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
744
-
745
- value = Math.round(value / 50);
746
-
747
- if (value === 0) {
748
- return 30;
749
- }
750
-
751
- let ansi = 30
752
- + ((Math.round(b / 255) << 2)
753
- | (Math.round(g / 255) << 1)
754
- | Math.round(r / 255));
755
-
756
- if (value === 2) {
757
- ansi += 60;
758
- }
759
-
760
- return ansi;
761
- };
762
-
763
- convert.hsv.ansi16 = function (args) {
764
- // Optimization here; we already know the value and don't need to get
765
- // it converted for us.
766
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
767
- };
768
-
769
- convert.rgb.ansi256 = function (args) {
770
- const r = args[0];
771
- const g = args[1];
772
- const b = args[2];
773
-
774
- // We use the extended greyscale palette here, with the exception of
775
- // black and white. normal palette only has 4 greyscale shades.
776
- if (r === g && g === b) {
777
- if (r < 8) {
778
- return 16;
779
- }
780
-
781
- if (r > 248) {
782
- return 231;
783
- }
784
-
785
- return Math.round(((r - 8) / 247) * 24) + 232;
786
- }
787
-
788
- const ansi = 16
789
- + (36 * Math.round(r / 255 * 5))
790
- + (6 * Math.round(g / 255 * 5))
791
- + Math.round(b / 255 * 5);
792
-
793
- return ansi;
794
- };
795
-
796
- convert.ansi16.rgb = function (args) {
797
- let color = args % 10;
798
-
799
- // Handle greyscale
800
- if (color === 0 || color === 7) {
801
- if (args > 50) {
802
- color += 3.5;
803
- }
804
-
805
- color = color / 10.5 * 255;
806
-
807
- return [color, color, color];
808
- }
809
-
810
- const mult = (~~(args > 50) + 1) * 0.5;
811
- const r = ((color & 1) * mult) * 255;
812
- const g = (((color >> 1) & 1) * mult) * 255;
813
- const b = (((color >> 2) & 1) * mult) * 255;
814
-
815
- return [r, g, b];
816
- };
817
-
818
- convert.ansi256.rgb = function (args) {
819
- // Handle greyscale
820
- if (args >= 232) {
821
- const c = (args - 232) * 10 + 8;
822
- return [c, c, c];
823
- }
824
-
825
- args -= 16;
826
-
827
- let rem;
828
- const r = Math.floor(args / 36) / 5 * 255;
829
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
830
- const b = (rem % 6) / 5 * 255;
831
-
832
- return [r, g, b];
833
- };
834
-
835
- convert.rgb.hex = function (args) {
836
- const integer = ((Math.round(args[0]) & 0xFF) << 16)
837
- + ((Math.round(args[1]) & 0xFF) << 8)
838
- + (Math.round(args[2]) & 0xFF);
839
-
840
- const string = integer.toString(16).toUpperCase();
841
- return '000000'.substring(string.length) + string;
842
- };
843
-
844
- convert.hex.rgb = function (args) {
845
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
846
- if (!match) {
847
- return [0, 0, 0];
848
- }
849
-
850
- let colorString = match[0];
851
-
852
- if (match[0].length === 3) {
853
- colorString = colorString.split('').map(char => {
854
- return char + char;
855
- }).join('');
856
- }
857
-
858
- const integer = parseInt(colorString, 16);
859
- const r = (integer >> 16) & 0xFF;
860
- const g = (integer >> 8) & 0xFF;
861
- const b = integer & 0xFF;
862
-
863
- return [r, g, b];
864
- };
865
-
866
- convert.rgb.hcg = function (rgb) {
867
- const r = rgb[0] / 255;
868
- const g = rgb[1] / 255;
869
- const b = rgb[2] / 255;
870
- const max = Math.max(Math.max(r, g), b);
871
- const min = Math.min(Math.min(r, g), b);
872
- const chroma = (max - min);
873
- let grayscale;
874
- let hue;
875
-
876
- if (chroma < 1) {
877
- grayscale = min / (1 - chroma);
878
- } else {
879
- grayscale = 0;
880
- }
881
-
882
- if (chroma <= 0) {
883
- hue = 0;
884
- } else
885
- if (max === r) {
886
- hue = ((g - b) / chroma) % 6;
887
- } else
888
- if (max === g) {
889
- hue = 2 + (b - r) / chroma;
890
- } else {
891
- hue = 4 + (r - g) / chroma;
892
- }
893
-
894
- hue /= 6;
895
- hue %= 1;
896
-
897
- return [hue * 360, chroma * 100, grayscale * 100];
898
- };
899
-
900
- convert.hsl.hcg = function (hsl) {
901
- const s = hsl[1] / 100;
902
- const l = hsl[2] / 100;
903
-
904
- const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
905
-
906
- let f = 0;
907
- if (c < 1.0) {
908
- f = (l - 0.5 * c) / (1.0 - c);
909
- }
910
-
911
- return [hsl[0], c * 100, f * 100];
912
- };
913
-
914
- convert.hsv.hcg = function (hsv) {
915
- const s = hsv[1] / 100;
916
- const v = hsv[2] / 100;
917
-
918
- const c = s * v;
919
- let f = 0;
920
-
921
- if (c < 1.0) {
922
- f = (v - c) / (1 - c);
923
- }
924
-
925
- return [hsv[0], c * 100, f * 100];
926
- };
927
-
928
- convert.hcg.rgb = function (hcg) {
929
- const h = hcg[0] / 360;
930
- const c = hcg[1] / 100;
931
- const g = hcg[2] / 100;
932
-
933
- if (c === 0.0) {
934
- return [g * 255, g * 255, g * 255];
935
- }
936
-
937
- const pure = [0, 0, 0];
938
- const hi = (h % 1) * 6;
939
- const v = hi % 1;
940
- const w = 1 - v;
941
- let mg = 0;
942
-
943
- /* eslint-disable max-statements-per-line */
944
- switch (Math.floor(hi)) {
945
- case 0:
946
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
947
- case 1:
948
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
949
- case 2:
950
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
951
- case 3:
952
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
953
- case 4:
954
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
955
- default:
956
- pure[0] = 1; pure[1] = 0; pure[2] = w;
957
- }
958
- /* eslint-enable max-statements-per-line */
959
-
960
- mg = (1.0 - c) * g;
961
-
962
- return [
963
- (c * pure[0] + mg) * 255,
964
- (c * pure[1] + mg) * 255,
965
- (c * pure[2] + mg) * 255
966
- ];
967
- };
968
-
969
- convert.hcg.hsv = function (hcg) {
970
- const c = hcg[1] / 100;
971
- const g = hcg[2] / 100;
972
-
973
- const v = c + g * (1.0 - c);
974
- let f = 0;
975
-
976
- if (v > 0.0) {
977
- f = c / v;
978
- }
979
-
980
- return [hcg[0], f * 100, v * 100];
981
- };
982
-
983
- convert.hcg.hsl = function (hcg) {
984
- const c = hcg[1] / 100;
985
- const g = hcg[2] / 100;
986
-
987
- const l = g * (1.0 - c) + 0.5 * c;
988
- let s = 0;
989
-
990
- if (l > 0.0 && l < 0.5) {
991
- s = c / (2 * l);
992
- } else
993
- if (l >= 0.5 && l < 1.0) {
994
- s = c / (2 * (1 - l));
995
- }
996
-
997
- return [hcg[0], s * 100, l * 100];
998
- };
999
-
1000
- convert.hcg.hwb = function (hcg) {
1001
- const c = hcg[1] / 100;
1002
- const g = hcg[2] / 100;
1003
- const v = c + g * (1.0 - c);
1004
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
1005
- };
1006
-
1007
- convert.hwb.hcg = function (hwb) {
1008
- const w = hwb[1] / 100;
1009
- const b = hwb[2] / 100;
1010
- const v = 1 - b;
1011
- const c = v - w;
1012
- let g = 0;
1013
-
1014
- if (c < 1) {
1015
- g = (v - c) / (1 - c);
1016
- }
1017
-
1018
- return [hwb[0], c * 100, g * 100];
1019
- };
1020
-
1021
- convert.apple.rgb = function (apple) {
1022
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
1023
- };
1024
-
1025
- convert.rgb.apple = function (rgb) {
1026
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
1027
- };
1028
-
1029
- convert.gray.rgb = function (args) {
1030
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1031
- };
1032
-
1033
- convert.gray.hsl = function (args) {
1034
- return [0, 0, args[0]];
1035
- };
1036
-
1037
- convert.gray.hsv = convert.gray.hsl;
1038
-
1039
- convert.gray.hwb = function (gray) {
1040
- return [0, 100, gray[0]];
1041
- };
1042
-
1043
- convert.gray.cmyk = function (gray) {
1044
- return [0, 0, 0, gray[0]];
1045
- };
1046
-
1047
- convert.gray.lab = function (gray) {
1048
- return [gray[0], 0, 0];
1049
- };
1050
-
1051
- convert.gray.hex = function (gray) {
1052
- const val = Math.round(gray[0] / 100 * 255) & 0xFF;
1053
- const integer = (val << 16) + (val << 8) + val;
1054
-
1055
- const string = integer.toString(16).toUpperCase();
1056
- return '000000'.substring(string.length) + string;
1057
- };
1058
-
1059
- convert.rgb.gray = function (rgb) {
1060
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1061
- return [val / 255 * 100];
1062
- };
1063
- return conversions;
1064
- }
1065
-
1066
- var route;
1067
- var hasRequiredRoute;
1068
-
1069
- function requireRoute () {
1070
- if (hasRequiredRoute) return route;
1071
- hasRequiredRoute = 1;
1072
- const conversions = requireConversions();
1073
-
1074
- /*
1075
- This function routes a model to all other models.
1076
-
1077
- all functions that are routed have a property `.conversion` attached
1078
- to the returned synthetic function. This property is an array
1079
- of strings, each with the steps in between the 'from' and 'to'
1080
- color models (inclusive).
1081
-
1082
- conversions that are not possible simply are not included.
1083
- */
1084
-
1085
- function buildGraph() {
1086
- const graph = {};
1087
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1088
- const models = Object.keys(conversions);
1089
-
1090
- for (let len = models.length, i = 0; i < len; i++) {
1091
- graph[models[i]] = {
1092
- // http://jsperf.com/1-vs-infinity
1093
- // micro-opt, but this is simple.
1094
- distance: -1,
1095
- parent: null
1096
- };
1097
- }
1098
-
1099
- return graph;
1100
- }
1101
-
1102
- // https://en.wikipedia.org/wiki/Breadth-first_search
1103
- function deriveBFS(fromModel) {
1104
- const graph = buildGraph();
1105
- const queue = [fromModel]; // Unshift -> queue -> pop
1106
-
1107
- graph[fromModel].distance = 0;
1108
-
1109
- while (queue.length) {
1110
- const current = queue.pop();
1111
- const adjacents = Object.keys(conversions[current]);
1112
-
1113
- for (let len = adjacents.length, i = 0; i < len; i++) {
1114
- const adjacent = adjacents[i];
1115
- const node = graph[adjacent];
1116
-
1117
- if (node.distance === -1) {
1118
- node.distance = graph[current].distance + 1;
1119
- node.parent = current;
1120
- queue.unshift(adjacent);
1121
- }
1122
- }
1123
- }
1124
-
1125
- return graph;
1126
- }
1127
-
1128
- function link(from, to) {
1129
- return function (args) {
1130
- return to(from(args));
1131
- };
1132
- }
1133
-
1134
- function wrapConversion(toModel, graph) {
1135
- const path = [graph[toModel].parent, toModel];
1136
- let fn = conversions[graph[toModel].parent][toModel];
1137
-
1138
- let cur = graph[toModel].parent;
1139
- while (graph[cur].parent) {
1140
- path.unshift(graph[cur].parent);
1141
- fn = link(conversions[graph[cur].parent][cur], fn);
1142
- cur = graph[cur].parent;
1143
- }
1144
-
1145
- fn.conversion = path;
1146
- return fn;
1147
- }
1148
-
1149
- route = function (fromModel) {
1150
- const graph = deriveBFS(fromModel);
1151
- const conversion = {};
1152
-
1153
- const models = Object.keys(graph);
1154
- for (let len = models.length, i = 0; i < len; i++) {
1155
- const toModel = models[i];
1156
- const node = graph[toModel];
1157
-
1158
- if (node.parent === null) {
1159
- // No possible conversion, or this node is the source model.
1160
- continue;
1161
- }
1162
-
1163
- conversion[toModel] = wrapConversion(toModel, graph);
1164
- }
1165
-
1166
- return conversion;
1167
- };
1168
- return route;
1169
- }
1170
-
1171
- var colorConvert;
1172
- var hasRequiredColorConvert;
1173
-
1174
- function requireColorConvert () {
1175
- if (hasRequiredColorConvert) return colorConvert;
1176
- hasRequiredColorConvert = 1;
1177
- const conversions = requireConversions();
1178
- const route = requireRoute();
1179
-
1180
- const convert = {};
1181
-
1182
- const models = Object.keys(conversions);
1183
-
1184
- function wrapRaw(fn) {
1185
- const wrappedFn = function (...args) {
1186
- const arg0 = args[0];
1187
- if (arg0 === undefined || arg0 === null) {
1188
- return arg0;
1189
- }
1190
-
1191
- if (arg0.length > 1) {
1192
- args = arg0;
1193
- }
1194
-
1195
- return fn(args);
1196
- };
1197
-
1198
- // Preserve .conversion property if there is one
1199
- if ('conversion' in fn) {
1200
- wrappedFn.conversion = fn.conversion;
1201
- }
1202
-
1203
- return wrappedFn;
1204
- }
1205
-
1206
- function wrapRounded(fn) {
1207
- const wrappedFn = function (...args) {
1208
- const arg0 = args[0];
1209
-
1210
- if (arg0 === undefined || arg0 === null) {
1211
- return arg0;
1212
- }
1213
-
1214
- if (arg0.length > 1) {
1215
- args = arg0;
1216
- }
1217
-
1218
- const result = fn(args);
1219
-
1220
- // We're assuming the result is an array here.
1221
- // see notice in conversions.js; don't use box types
1222
- // in conversion functions.
1223
- if (typeof result === 'object') {
1224
- for (let len = result.length, i = 0; i < len; i++) {
1225
- result[i] = Math.round(result[i]);
1226
- }
1227
- }
1228
-
1229
- return result;
1230
- };
1231
-
1232
- // Preserve .conversion property if there is one
1233
- if ('conversion' in fn) {
1234
- wrappedFn.conversion = fn.conversion;
1235
- }
1236
-
1237
- return wrappedFn;
1238
- }
1239
-
1240
- models.forEach(fromModel => {
1241
- convert[fromModel] = {};
1242
-
1243
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
1244
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
1245
-
1246
- const routes = route(fromModel);
1247
- const routeModels = Object.keys(routes);
1248
-
1249
- routeModels.forEach(toModel => {
1250
- const fn = routes[toModel];
1251
-
1252
- convert[fromModel][toModel] = wrapRounded(fn);
1253
- convert[fromModel][toModel].raw = wrapRaw(fn);
1254
- });
1255
- });
1256
-
1257
- colorConvert = convert;
1258
- return colorConvert;
1259
- }
1260
-
1261
- ansiStyles$1.exports;
1262
-
1263
- (function (module) {
1264
-
1265
- const wrapAnsi16 = (fn, offset) => (...args) => {
1266
- const code = fn(...args);
1267
- return `\u001B[${code + offset}m`;
1268
- };
1269
-
1270
- const wrapAnsi256 = (fn, offset) => (...args) => {
1271
- const code = fn(...args);
1272
- return `\u001B[${38 + offset};5;${code}m`;
1273
- };
1274
-
1275
- const wrapAnsi16m = (fn, offset) => (...args) => {
1276
- const rgb = fn(...args);
1277
- return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1278
- };
1279
-
1280
- const ansi2ansi = n => n;
1281
- const rgb2rgb = (r, g, b) => [r, g, b];
1282
-
1283
- const setLazyProperty = (object, property, get) => {
1284
- Object.defineProperty(object, property, {
1285
- get: () => {
1286
- const value = get();
1287
-
1288
- Object.defineProperty(object, property, {
1289
- value,
1290
- enumerable: true,
1291
- configurable: true
1292
- });
1293
-
1294
- return value;
1295
- },
1296
- enumerable: true,
1297
- configurable: true
1298
- });
1299
- };
1300
-
1301
- /** @type {typeof import('color-convert')} */
1302
- let colorConvert;
1303
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1304
- if (colorConvert === undefined) {
1305
- colorConvert = requireColorConvert();
1306
- }
1307
-
1308
- const offset = isBackground ? 10 : 0;
1309
- const styles = {};
1310
-
1311
- for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
1312
- const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
1313
- if (sourceSpace === targetSpace) {
1314
- styles[name] = wrap(identity, offset);
1315
- } else if (typeof suite === 'object') {
1316
- styles[name] = wrap(suite[targetSpace], offset);
1317
- }
1318
- }
1319
-
1320
- return styles;
1321
- };
1322
-
1323
- function assembleStyles() {
1324
- const codes = new Map();
1325
- const styles = {
1326
- modifier: {
1327
- reset: [0, 0],
1328
- // 21 isn't widely supported and 22 does the same thing
1329
- bold: [1, 22],
1330
- dim: [2, 22],
1331
- italic: [3, 23],
1332
- underline: [4, 24],
1333
- inverse: [7, 27],
1334
- hidden: [8, 28],
1335
- strikethrough: [9, 29]
1336
- },
1337
- color: {
1338
- black: [30, 39],
1339
- red: [31, 39],
1340
- green: [32, 39],
1341
- yellow: [33, 39],
1342
- blue: [34, 39],
1343
- magenta: [35, 39],
1344
- cyan: [36, 39],
1345
- white: [37, 39],
1346
-
1347
- // Bright color
1348
- blackBright: [90, 39],
1349
- redBright: [91, 39],
1350
- greenBright: [92, 39],
1351
- yellowBright: [93, 39],
1352
- blueBright: [94, 39],
1353
- magentaBright: [95, 39],
1354
- cyanBright: [96, 39],
1355
- whiteBright: [97, 39]
1356
- },
1357
- bgColor: {
1358
- bgBlack: [40, 49],
1359
- bgRed: [41, 49],
1360
- bgGreen: [42, 49],
1361
- bgYellow: [43, 49],
1362
- bgBlue: [44, 49],
1363
- bgMagenta: [45, 49],
1364
- bgCyan: [46, 49],
1365
- bgWhite: [47, 49],
1366
-
1367
- // Bright color
1368
- bgBlackBright: [100, 49],
1369
- bgRedBright: [101, 49],
1370
- bgGreenBright: [102, 49],
1371
- bgYellowBright: [103, 49],
1372
- bgBlueBright: [104, 49],
1373
- bgMagentaBright: [105, 49],
1374
- bgCyanBright: [106, 49],
1375
- bgWhiteBright: [107, 49]
1376
- }
1377
- };
1378
-
1379
- // Alias bright black as gray (and grey)
1380
- styles.color.gray = styles.color.blackBright;
1381
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
1382
- styles.color.grey = styles.color.blackBright;
1383
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
1384
-
1385
- for (const [groupName, group] of Object.entries(styles)) {
1386
- for (const [styleName, style] of Object.entries(group)) {
1387
- styles[styleName] = {
1388
- open: `\u001B[${style[0]}m`,
1389
- close: `\u001B[${style[1]}m`
1390
- };
1391
-
1392
- group[styleName] = styles[styleName];
1393
-
1394
- codes.set(style[0], style[1]);
1395
- }
1396
-
1397
- Object.defineProperty(styles, groupName, {
1398
- value: group,
1399
- enumerable: false
1400
- });
1401
- }
1402
-
1403
- Object.defineProperty(styles, 'codes', {
1404
- value: codes,
1405
- enumerable: false
1406
- });
1407
-
1408
- styles.color.close = '\u001B[39m';
1409
- styles.bgColor.close = '\u001B[49m';
1410
-
1411
- setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
1412
- setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
1413
- setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
1414
- setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
1415
- setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
1416
- setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
1417
-
1418
- return styles;
1419
- }
1420
-
1421
- // Make the export immutable
1422
- Object.defineProperty(module, 'exports', {
1423
- enumerable: true,
1424
- get: assembleStyles
1425
- });
1426
- } (ansiStyles$1));
1427
-
1428
- var ansiStylesExports = ansiStyles$1.exports;
1429
-
1430
- var hasFlag$1 = (flag, argv = process.argv) => {
1431
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
1432
- const position = argv.indexOf(prefix + flag);
1433
- const terminatorPosition = argv.indexOf('--');
1434
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
1435
- };
1436
-
1437
- const os = require$$0;
1438
- const tty = require$$1;
1439
- const hasFlag = hasFlag$1;
1440
-
1441
- const {env} = process;
1442
-
1443
- let forceColor;
1444
- if (hasFlag('no-color') ||
1445
- hasFlag('no-colors') ||
1446
- hasFlag('color=false') ||
1447
- hasFlag('color=never')) {
1448
- forceColor = 0;
1449
- } else if (hasFlag('color') ||
1450
- hasFlag('colors') ||
1451
- hasFlag('color=true') ||
1452
- hasFlag('color=always')) {
1453
- forceColor = 1;
1454
- }
1455
-
1456
- if ('FORCE_COLOR' in env) {
1457
- if (env.FORCE_COLOR === 'true') {
1458
- forceColor = 1;
1459
- } else if (env.FORCE_COLOR === 'false') {
1460
- forceColor = 0;
1461
- } else {
1462
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
1463
- }
1464
- }
1465
-
1466
- function translateLevel(level) {
1467
- if (level === 0) {
1468
- return false;
1469
- }
1470
-
1471
- return {
1472
- level,
1473
- hasBasic: true,
1474
- has256: level >= 2,
1475
- has16m: level >= 3
1476
- };
1477
- }
1478
-
1479
- function supportsColor(haveStream, streamIsTTY) {
1480
- if (forceColor === 0) {
1481
- return 0;
1482
- }
1483
-
1484
- if (hasFlag('color=16m') ||
1485
- hasFlag('color=full') ||
1486
- hasFlag('color=truecolor')) {
1487
- return 3;
1488
- }
1489
-
1490
- if (hasFlag('color=256')) {
1491
- return 2;
1492
- }
1493
-
1494
- if (haveStream && !streamIsTTY && forceColor === undefined) {
1495
- return 0;
1496
- }
1497
-
1498
- const min = forceColor || 0;
1499
-
1500
- if (env.TERM === 'dumb') {
1501
- return min;
1502
- }
1503
-
1504
- if (process.platform === 'win32') {
1505
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
1506
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
1507
- const osRelease = os.release().split('.');
1508
- if (
1509
- Number(osRelease[0]) >= 10 &&
1510
- Number(osRelease[2]) >= 10586
1511
- ) {
1512
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
1513
- }
1514
-
1515
- return 1;
1516
- }
1517
-
1518
- if ('CI' in env) {
1519
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
1520
- return 1;
1521
- }
1522
-
1523
- return min;
1524
- }
1525
-
1526
- if ('TEAMCITY_VERSION' in env) {
1527
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
1528
- }
1529
-
1530
- if (env.COLORTERM === 'truecolor') {
1531
- return 3;
1532
- }
1533
-
1534
- if ('TERM_PROGRAM' in env) {
1535
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
1536
-
1537
- switch (env.TERM_PROGRAM) {
1538
- case 'iTerm.app':
1539
- return version >= 3 ? 3 : 2;
1540
- case 'Apple_Terminal':
1541
- return 2;
1542
- // No default
1543
- }
1544
- }
1545
-
1546
- if (/-256(color)?$/i.test(env.TERM)) {
1547
- return 2;
1548
- }
1549
-
1550
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
1551
- return 1;
1552
- }
1553
-
1554
- if ('COLORTERM' in env) {
1555
- return 1;
1556
- }
1557
-
1558
- return min;
1559
- }
1560
-
1561
- function getSupportLevel(stream) {
1562
- const level = supportsColor(stream, stream && stream.isTTY);
1563
- return translateLevel(level);
1564
- }
1565
-
1566
- var supportsColor_1 = {
1567
- supportsColor: getSupportLevel,
1568
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
1569
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
1570
- };
1571
-
1572
- const stringReplaceAll$1 = (string, substring, replacer) => {
1573
- let index = string.indexOf(substring);
1574
- if (index === -1) {
1575
- return string;
1576
- }
1577
-
1578
- const substringLength = substring.length;
1579
- let endIndex = 0;
1580
- let returnValue = '';
1581
- do {
1582
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
1583
- endIndex = index + substringLength;
1584
- index = string.indexOf(substring, endIndex);
1585
- } while (index !== -1);
1586
-
1587
- returnValue += string.substr(endIndex);
1588
- return returnValue;
1589
- };
1590
-
1591
- const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
1592
- let endIndex = 0;
1593
- let returnValue = '';
1594
- do {
1595
- const gotCR = string[index - 1] === '\r';
1596
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
1597
- endIndex = index + 1;
1598
- index = string.indexOf('\n', endIndex);
1599
- } while (index !== -1);
1600
-
1601
- returnValue += string.substr(endIndex);
1602
- return returnValue;
1603
- };
1604
-
1605
- var util = {
1606
- stringReplaceAll: stringReplaceAll$1,
1607
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
1608
- };
1609
-
1610
- var templates;
1611
- var hasRequiredTemplates;
1612
-
1613
- function requireTemplates () {
1614
- if (hasRequiredTemplates) return templates;
1615
- hasRequiredTemplates = 1;
1616
- const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
1617
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1618
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
1619
- const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
1620
-
1621
- const ESCAPES = new Map([
1622
- ['n', '\n'],
1623
- ['r', '\r'],
1624
- ['t', '\t'],
1625
- ['b', '\b'],
1626
- ['f', '\f'],
1627
- ['v', '\v'],
1628
- ['0', '\0'],
1629
- ['\\', '\\'],
1630
- ['e', '\u001B'],
1631
- ['a', '\u0007']
1632
- ]);
1633
-
1634
- function unescape(c) {
1635
- const u = c[0] === 'u';
1636
- const bracket = c[1] === '{';
1637
-
1638
- if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
1639
- return String.fromCharCode(parseInt(c.slice(1), 16));
1640
- }
1641
-
1642
- if (u && bracket) {
1643
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
1644
- }
1645
-
1646
- return ESCAPES.get(c) || c;
1647
- }
1648
-
1649
- function parseArguments(name, arguments_) {
1650
- const results = [];
1651
- const chunks = arguments_.trim().split(/\s*,\s*/g);
1652
- let matches;
1653
-
1654
- for (const chunk of chunks) {
1655
- const number = Number(chunk);
1656
- if (!Number.isNaN(number)) {
1657
- results.push(number);
1658
- } else if ((matches = chunk.match(STRING_REGEX))) {
1659
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
1660
- } else {
1661
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1662
- }
1663
- }
1664
-
1665
- return results;
1666
- }
1667
-
1668
- function parseStyle(style) {
1669
- STYLE_REGEX.lastIndex = 0;
1670
-
1671
- const results = [];
1672
- let matches;
1673
-
1674
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
1675
- const name = matches[1];
1676
-
1677
- if (matches[2]) {
1678
- const args = parseArguments(name, matches[2]);
1679
- results.push([name].concat(args));
1680
- } else {
1681
- results.push([name]);
1682
- }
1683
- }
1684
-
1685
- return results;
1686
- }
1687
-
1688
- function buildStyle(chalk, styles) {
1689
- const enabled = {};
1690
-
1691
- for (const layer of styles) {
1692
- for (const style of layer.styles) {
1693
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
1694
- }
1695
- }
1696
-
1697
- let current = chalk;
1698
- for (const [styleName, styles] of Object.entries(enabled)) {
1699
- if (!Array.isArray(styles)) {
1700
- continue;
1701
- }
1702
-
1703
- if (!(styleName in current)) {
1704
- throw new Error(`Unknown Chalk style: ${styleName}`);
1705
- }
1706
-
1707
- current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
1708
- }
1709
-
1710
- return current;
1711
- }
1712
-
1713
- templates = (chalk, temporary) => {
1714
- const styles = [];
1715
- const chunks = [];
1716
- let chunk = [];
1717
-
1718
- // eslint-disable-next-line max-params
1719
- temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
1720
- if (escapeCharacter) {
1721
- chunk.push(unescape(escapeCharacter));
1722
- } else if (style) {
1723
- const string = chunk.join('');
1724
- chunk = [];
1725
- chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
1726
- styles.push({inverse, styles: parseStyle(style)});
1727
- } else if (close) {
1728
- if (styles.length === 0) {
1729
- throw new Error('Found extraneous } in Chalk template literal');
1730
- }
1731
-
1732
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
1733
- chunk = [];
1734
- styles.pop();
1735
- } else {
1736
- chunk.push(character);
1737
- }
1738
- });
1739
-
1740
- chunks.push(chunk.join(''));
1741
-
1742
- if (styles.length > 0) {
1743
- const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
1744
- throw new Error(errMessage);
1745
- }
1746
-
1747
- return chunks.join('');
1748
- };
1749
- return templates;
1750
- }
1751
-
1752
- const ansiStyles = ansiStylesExports;
1753
- const {stdout: stdoutColor, stderr: stderrColor} = supportsColor_1;
1754
- const {
1755
- stringReplaceAll,
1756
- stringEncaseCRLFWithFirstIndex
1757
- } = util;
1758
-
1759
- const {isArray} = Array;
1760
-
1761
- // `supportsColor.level` → `ansiStyles.color[name]` mapping
1762
- const levelMapping = [
1763
- 'ansi',
1764
- 'ansi',
1765
- 'ansi256',
1766
- 'ansi16m'
1767
- ];
1768
-
1769
- const styles = Object.create(null);
1770
-
1771
- const applyOptions = (object, options = {}) => {
1772
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
1773
- throw new Error('The `level` option should be an integer from 0 to 3');
1774
- }
1775
-
1776
- // Detect level if not set manually
1777
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
1778
- object.level = options.level === undefined ? colorLevel : options.level;
1779
- };
1780
-
1781
- class ChalkClass {
1782
- constructor(options) {
1783
- // eslint-disable-next-line no-constructor-return
1784
- return chalkFactory(options);
1785
- }
1786
- }
1787
-
1788
- const chalkFactory = options => {
1789
- const chalk = {};
1790
- applyOptions(chalk, options);
1791
-
1792
- chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
1793
-
1794
- Object.setPrototypeOf(chalk, Chalk.prototype);
1795
- Object.setPrototypeOf(chalk.template, chalk);
1796
-
1797
- chalk.template.constructor = () => {
1798
- throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
1799
- };
1800
-
1801
- chalk.template.Instance = ChalkClass;
1802
-
1803
- return chalk.template;
1804
- };
1805
-
1806
- function Chalk(options) {
1807
- return chalkFactory(options);
1808
- }
1809
-
1810
- for (const [styleName, style] of Object.entries(ansiStyles)) {
1811
- styles[styleName] = {
1812
- get() {
1813
- const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
1814
- Object.defineProperty(this, styleName, {value: builder});
1815
- return builder;
1816
- }
1817
- };
1818
- }
1819
-
1820
- styles.visible = {
1821
- get() {
1822
- const builder = createBuilder(this, this._styler, true);
1823
- Object.defineProperty(this, 'visible', {value: builder});
1824
- return builder;
1825
- }
1826
- };
1827
-
1828
- const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
1829
-
1830
- for (const model of usedModels) {
1831
- styles[model] = {
1832
- get() {
1833
- const {level} = this;
1834
- return function (...arguments_) {
1835
- const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
1836
- return createBuilder(this, styler, this._isEmpty);
1837
- };
1838
- }
1839
- };
25
+ debugOutput(response ? response.url : url, response ? response.status : 429, startTime);
26
+ if (response.status === null || response.status === 429) {
27
+ throw new Error(`Received status code: ${response.status ?? 429}`);
28
+ }
29
+ else {
30
+ return response.json();
31
+ }
32
+ }
33
+ catch (error) {
34
+ if (error.message.includes(`Received status code: 429`) && this.retryCount < this.maxRetries) {
35
+ this.retryCount++;
36
+ const delayMs = Math.pow(2, this.retryCount) * BASE_DELAY_MS;
37
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
38
+ return this.backOff(url, source);
39
+ }
40
+ return Promise.reject(new Error(`Max retries exceeded: ${this.maxRetries}`));
41
+ }
42
+ }
43
+ // to reset the numAttempts for another request
44
+ setNumAttempts(retryCount) {
45
+ this.retryCount = retryCount;
46
+ }
1840
47
  }
1841
48
 
1842
- for (const model of usedModels) {
1843
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
1844
- styles[bgModel] = {
1845
- get() {
1846
- const {level} = this;
1847
- return function (...arguments_) {
1848
- const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
1849
- return createBuilder(this, styler, this._isEmpty);
1850
- };
1851
- }
1852
- };
49
+ function getDefaultExportFromCjs (x) {
50
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1853
51
  }
1854
52
 
1855
- const proto = Object.defineProperties(() => {}, {
1856
- ...styles,
1857
- level: {
1858
- enumerable: true,
1859
- get() {
1860
- return this._generator.level;
1861
- },
1862
- set(level) {
1863
- this._generator.level = level;
1864
- }
1865
- }
1866
- });
1867
-
1868
- const createStyler = (open, close, parent) => {
1869
- let openAll;
1870
- let closeAll;
1871
- if (parent === undefined) {
1872
- openAll = open;
1873
- closeAll = close;
1874
- } else {
1875
- openAll = parent.openAll + open;
1876
- closeAll = close + parent.closeAll;
1877
- }
1878
-
1879
- return {
1880
- open,
1881
- close,
1882
- openAll,
1883
- closeAll,
1884
- parent
1885
- };
1886
- };
1887
-
1888
- const createBuilder = (self, _styler, _isEmpty) => {
1889
- const builder = (...arguments_) => {
1890
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
1891
- // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
1892
- return applyStyle(builder, chalkTag(builder, ...arguments_));
1893
- }
1894
-
1895
- // Single argument is hot path, implicit coercion is faster than anything
1896
- // eslint-disable-next-line no-implicit-coercion
1897
- return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
1898
- };
1899
-
1900
- // We alter the prototype because we must return a function, but there is
1901
- // no way to create a function with a different prototype
1902
- Object.setPrototypeOf(builder, proto);
1903
-
1904
- builder._generator = self;
1905
- builder._styler = _styler;
1906
- builder._isEmpty = _isEmpty;
1907
-
1908
- return builder;
1909
- };
1910
-
1911
- const applyStyle = (self, string) => {
1912
- if (self.level <= 0 || !string) {
1913
- return self._isEmpty ? '' : string;
1914
- }
1915
-
1916
- let styler = self._styler;
1917
-
1918
- if (styler === undefined) {
1919
- return string;
1920
- }
1921
-
1922
- const {openAll, closeAll} = styler;
1923
- if (string.indexOf('\u001B') !== -1) {
1924
- while (styler !== undefined) {
1925
- // Replace any instances already present with a re-opening code
1926
- // otherwise only the part of the string until said closing code
1927
- // will be colored, and the rest will simply be 'plain'.
1928
- string = stringReplaceAll(string, styler.close, styler.open);
1929
-
1930
- styler = styler.parent;
1931
- }
1932
- }
1933
-
1934
- // We can move both next actions out of loop, because remaining actions in loop won't have
1935
- // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
1936
- // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
1937
- const lfIndex = string.indexOf('\n');
1938
- if (lfIndex !== -1) {
1939
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
1940
- }
1941
-
1942
- return openAll + string + closeAll;
1943
- };
1944
-
1945
- let template;
1946
- const chalkTag = (chalk, ...strings) => {
1947
- const [firstString] = strings;
1948
-
1949
- if (!isArray(firstString) || !isArray(firstString.raw)) {
1950
- // If chalk() was called by itself or with a string,
1951
- // return the string itself as a string.
1952
- return strings.join(' ');
1953
- }
1954
-
1955
- const arguments_ = strings.slice(1);
1956
- const parts = [firstString.raw[0]];
1957
-
1958
- for (let i = 1; i < firstString.length; i++) {
1959
- parts.push(
1960
- String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
1961
- String(firstString.raw[i])
1962
- );
1963
- }
1964
-
1965
- if (template === undefined) {
1966
- template = requireTemplates();
1967
- }
1968
-
1969
- return template(chalk, parts.join(''));
1970
- };
1971
-
1972
- Object.defineProperties(Chalk.prototype, styles);
1973
-
1974
- const chalk = Chalk(); // eslint-disable-line new-cap
1975
- chalk.supportsColor = stdoutColor;
1976
- chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
1977
- chalk.stderr.supportsColor = stderrColor;
1978
-
1979
- var source = chalk;
1980
-
1981
- var chalk$1 = /*@__PURE__*/getDefaultExportFromCjs(source);
1982
-
1983
53
  class Node {
1984
54
  /// value;
1985
55
  /// next;
@@ -2138,15 +208,9 @@ async function debugOutput(url, responseStatus, startTime) {
2138
208
  if (startTime === undefined) {
2139
209
  return;
2140
210
  }
2141
- if (typeof startTime !== 'number') {
2142
- endTime = process.hrtime(startTime);
2143
- elapsedTime = (endTime[0] * 1000 + endTime[1] / 1e6);
2144
- }
2145
- else {
2146
- endTime = performance.now();
2147
- elapsedTime = endTime - startTime;
2148
- }
2149
- console.log(`${chalk$1.red("[DEBUG]")}` + " |" + ` Request URL: ${chalk$1.yellow(url)}` + " |" + ` Response code: ${responseStatus !== 200 ? chalk$1.red(responseStatus) : chalk$1.green(responseStatus)}` + " |" + ` Response time: ${chalk$1.cyan(elapsedTime.toFixed(2) + "ms")}`);
211
+ endTime = new Date();
212
+ elapsedTime = endTime.getTime() - startTime.getTime();
213
+ console.log("[DEBUG]" + " |" + " Request URL: " + url + " |" + " Response code: " + responseStatus + " |" + " Response time: " + elapsedTime.toFixed(2) + "ms");
2150
214
  }
2151
215
  async function* paginateEndpoint$1(url, apiKey, urlsParams, dataClassConstructor, debug, threadCount, enableRetry, source) {
2152
216
  let hasNext = true;
@@ -2159,7 +223,7 @@ async function* paginateEndpoint$1(url, apiKey, urlsParams, dataClassConstructor
2159
223
  try {
2160
224
  let startTime;
2161
225
  if (debug) {
2162
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
226
+ startTime = new Date();
2163
227
  }
2164
228
  const link = urlsParams.get("page-number") ? `${url}?${urlsParams}` : `${url}?${urlsParams}&page-number=${page_number}`;
2165
229
  response = await LIMIT(() => fetch(urlsParams.get("page-number") ? `${url}?${urlsParams}` : `${url}?${urlsParams}&page-number=${page_number}`, {
@@ -2349,7 +413,7 @@ class SecurityService {
2349
413
  }
2350
414
  let startTime;
2351
415
  if (this.debug) {
2352
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
416
+ startTime = new Date();
2353
417
  }
2354
418
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/approvals/${walletAddress}/?${urlParams}`, {
2355
419
  headers: {
@@ -2422,7 +486,7 @@ class SecurityService {
2422
486
  }
2423
487
  let startTime;
2424
488
  if (this.debug) {
2425
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
489
+ startTime = new Date();
2426
490
  }
2427
491
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/approvals/${walletAddress}/?${urlParams}`, {
2428
492
  headers: {
@@ -2809,7 +873,7 @@ class BalanceService {
2809
873
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_v2/?${urlParams}`;
2810
874
  let startTime;
2811
875
  if (this.debug) {
2812
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
876
+ startTime = new Date();
2813
877
  }
2814
878
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_v2/?${urlParams}`, {
2815
879
  headers: {
@@ -2892,7 +956,7 @@ class BalanceService {
2892
956
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/portfolio_v2/?${urlParams}`;
2893
957
  let startTime;
2894
958
  if (this.debug) {
2895
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
959
+ startTime = new Date();
2896
960
  }
2897
961
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/portfolio_v2/?${urlParams}`, {
2898
962
  headers: {
@@ -3044,7 +1108,7 @@ class BalanceService {
3044
1108
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transfers_v2/?${urlParams}`;
3045
1109
  let startTime;
3046
1110
  if (this.debug) {
3047
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
1111
+ startTime = new Date();
3048
1112
  }
3049
1113
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transfers_v2/?${urlParams}`, {
3050
1114
  headers: {
@@ -3180,7 +1244,7 @@ class BalanceService {
3180
1244
  const url = `https://api.covalenthq.com/v1/${chainName}/tokens/${tokenAddress}/token_holders_v2/?${urlParams}`;
3181
1245
  let startTime;
3182
1246
  if (this.debug) {
3183
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
1247
+ startTime = new Date();
3184
1248
  }
3185
1249
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/tokens/${tokenAddress}/token_holders_v2/?${urlParams}`, {
3186
1250
  headers: {
@@ -3283,7 +1347,7 @@ class BalanceService {
3283
1347
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/historical_balances/?${urlParams}`;
3284
1348
  let startTime;
3285
1349
  if (this.debug) {
3286
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
1350
+ startTime = new Date();
3287
1351
  }
3288
1352
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/historical_balances/?${urlParams}`, {
3289
1353
  headers: {
@@ -3364,7 +1428,7 @@ class BalanceService {
3364
1428
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_native/?${urlParams}`;
3365
1429
  let startTime;
3366
1430
  if (this.debug) {
3367
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
1431
+ startTime = new Date();
3368
1432
  }
3369
1433
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_native/?${urlParams}`, {
3370
1434
  headers: {
@@ -3670,7 +1734,7 @@ class BaseService {
3670
1734
  const url = `https://api.covalenthq.com/v1/${chainName}/block_v2/${blockHeight}/?${urlParams}`;
3671
1735
  let startTime;
3672
1736
  if (this.debug) {
3673
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
1737
+ startTime = new Date();
3674
1738
  }
3675
1739
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/block_v2/${blockHeight}/?${urlParams}`, {
3676
1740
  headers: {
@@ -3744,7 +1808,7 @@ class BaseService {
3744
1808
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/resolve_address/?${urlParams}`;
3745
1809
  let startTime;
3746
1810
  if (this.debug) {
3747
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
1811
+ startTime = new Date();
3748
1812
  }
3749
1813
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/resolve_address/?${urlParams}`, {
3750
1814
  headers: {
@@ -3866,7 +1930,7 @@ class BaseService {
3866
1930
  const url = `https://api.covalenthq.com/v1/${chainName}/block_v2/${startDate}/${endDate}/?${urlParams}`;
3867
1931
  let startTime;
3868
1932
  if (this.debug) {
3869
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
1933
+ startTime = new Date();
3870
1934
  }
3871
1935
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/block_v2/${startDate}/${endDate}/?${urlParams}`, {
3872
1936
  headers: {
@@ -3964,7 +2028,7 @@ class BaseService {
3964
2028
  const url = `https://api.covalenthq.com/v1/${chainName}/events/?${urlParams}`;
3965
2029
  let startTime;
3966
2030
  if (this.debug) {
3967
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
2031
+ startTime = new Date();
3968
2032
  }
3969
2033
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/events/?${urlParams}`, {
3970
2034
  headers: {
@@ -4100,7 +2164,7 @@ class BaseService {
4100
2164
  const url = `https://api.covalenthq.com/v1/${chainName}/events/address/${contractAddress}/?${urlParams}`;
4101
2165
  let startTime;
4102
2166
  if (this.debug) {
4103
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
2167
+ startTime = new Date();
4104
2168
  }
4105
2169
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/events/address/${contractAddress}/?${urlParams}`, {
4106
2170
  headers: {
@@ -4244,7 +2308,7 @@ class BaseService {
4244
2308
  const url = `https://api.covalenthq.com/v1/${chainName}/events/topics/${topicHash}/?${urlParams}`;
4245
2309
  let startTime;
4246
2310
  if (this.debug) {
4247
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
2311
+ startTime = new Date();
4248
2312
  }
4249
2313
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/events/topics/${topicHash}/?${urlParams}`, {
4250
2314
  headers: {
@@ -4315,7 +2379,7 @@ class BaseService {
4315
2379
  }
4316
2380
  let startTime;
4317
2381
  if (this.debug) {
4318
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
2382
+ startTime = new Date();
4319
2383
  }
4320
2384
  const url = `https://api.covalenthq.com/v1/chains/?${urlParams}`;
4321
2385
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/chains/?${urlParams}`, {
@@ -4388,7 +2452,7 @@ class BaseService {
4388
2452
  const url = `https://api.covalenthq.com/v1/chains/status/?${urlParams}`;
4389
2453
  let startTime;
4390
2454
  if (this.debug) {
4391
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
2455
+ startTime = new Date();
4392
2456
  }
4393
2457
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/chains/status/?${urlParams}`, {
4394
2458
  headers: {
@@ -4466,7 +2530,7 @@ class BaseService {
4466
2530
  const url = `https://api.covalenthq.com/v1/address/${walletAddress}/activity/?${urlParams}`;
4467
2531
  let startTime;
4468
2532
  if (this.debug) {
4469
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
2533
+ startTime = new Date();
4470
2534
  }
4471
2535
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/address/${walletAddress}/activity/?${urlParams}`, {
4472
2536
  headers: {
@@ -4543,7 +2607,7 @@ class BaseService {
4543
2607
  const url = `https://api.covalenthq.com/v1/${chainName}/event/${eventType}/gas_prices/?${urlParams}`;
4544
2608
  let startTime;
4545
2609
  if (this.debug) {
4546
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
2610
+ startTime = new Date();
4547
2611
  }
4548
2612
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/event/${eventType}/gas_prices/?${urlParams}`, {
4549
2613
  headers: {
@@ -5002,7 +3066,7 @@ class NftService {
5002
3066
  const url = `https://api.covalenthq.com/v1/${chainName}/nft/collections/?${urlParams}`;
5003
3067
  let startTime;
5004
3068
  if (this.debug) {
5005
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3069
+ startTime = new Date();
5006
3070
  }
5007
3071
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/collections/?${urlParams}`, {
5008
3072
  headers: {
@@ -5089,7 +3153,7 @@ class NftService {
5089
3153
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_nft/?${urlParams}`;
5090
3154
  let startTime;
5091
3155
  if (this.debug) {
5092
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3156
+ startTime = new Date();
5093
3157
  }
5094
3158
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/balances_nft/?${urlParams}`, {
5095
3159
  headers: {
@@ -5241,7 +3305,7 @@ class NftService {
5241
3305
  const url = `https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/?${urlParams}`;
5242
3306
  let startTime;
5243
3307
  if (this.debug) {
5244
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3308
+ startTime = new Date();
5245
3309
  }
5246
3310
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/?${urlParams}`, {
5247
3311
  headers: {
@@ -5325,7 +3389,7 @@ class NftService {
5325
3389
  const url = `https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/${tokenId}/?${urlParams}`;
5326
3390
  let startTime;
5327
3391
  if (this.debug) {
5328
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3392
+ startTime = new Date();
5329
3393
  }
5330
3394
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${contractAddress}/metadata/${tokenId}/?${urlParams}`, {
5331
3395
  headers: {
@@ -5405,7 +3469,7 @@ class NftService {
5405
3469
  const url = `https://api.covalenthq.com/v1/${chainName}/tokens/${contractAddress}/nft_transactions/${tokenId}/?${urlParams}`;
5406
3470
  let startTime;
5407
3471
  if (this.debug) {
5408
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3472
+ startTime = new Date();
5409
3473
  }
5410
3474
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/tokens/${contractAddress}/nft_transactions/${tokenId}/?${urlParams}`, {
5411
3475
  headers: {
@@ -5479,7 +3543,7 @@ class NftService {
5479
3543
  const url = `https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits/?${urlParams}`;
5480
3544
  let startTime;
5481
3545
  if (this.debug) {
5482
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3546
+ startTime = new Date();
5483
3547
  }
5484
3548
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits/?${urlParams}`, {
5485
3549
  headers: {
@@ -5554,7 +3618,7 @@ class NftService {
5554
3618
  const url = `https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits/${trait}/attributes/?${urlParams}`;
5555
3619
  let startTime;
5556
3620
  if (this.debug) {
5557
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3621
+ startTime = new Date();
5558
3622
  }
5559
3623
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits/${trait}/attributes/?${urlParams}`, {
5560
3624
  headers: {
@@ -5628,7 +3692,7 @@ class NftService {
5628
3692
  const url = `https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits_summary/?${urlParams}`;
5629
3693
  let startTime;
5630
3694
  if (this.debug) {
5631
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3695
+ startTime = new Date();
5632
3696
  }
5633
3697
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft/${collectionContract}/traits_summary/?${urlParams}`, {
5634
3698
  headers: {
@@ -5703,7 +3767,7 @@ class NftService {
5703
3767
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/collection/${collectionContract}/?${urlParams}`;
5704
3768
  let startTime;
5705
3769
  if (this.debug) {
5706
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3770
+ startTime = new Date();
5707
3771
  }
5708
3772
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/collection/${collectionContract}/?${urlParams}`, {
5709
3773
  headers: {
@@ -5779,7 +3843,7 @@ class NftService {
5779
3843
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/collection/${collectionContract}/token/${tokenId}/?${urlParams}`;
5780
3844
  let startTime;
5781
3845
  if (this.debug) {
5782
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3846
+ startTime = new Date();
5783
3847
  }
5784
3848
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/collection/${collectionContract}/token/${tokenId}/?${urlParams}`, {
5785
3849
  headers: {
@@ -5862,7 +3926,7 @@ class NftService {
5862
3926
  const url = `https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/sale_count/?${urlParams}`;
5863
3927
  let startTime;
5864
3928
  if (this.debug) {
5865
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
3929
+ startTime = new Date();
5866
3930
  }
5867
3931
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/sale_count/?${urlParams}`, {
5868
3932
  headers: {
@@ -5945,7 +4009,7 @@ class NftService {
5945
4009
  const url = `https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/volume/?${urlParams}`;
5946
4010
  let startTime;
5947
4011
  if (this.debug) {
5948
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4012
+ startTime = new Date();
5949
4013
  }
5950
4014
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/volume/?${urlParams}`, {
5951
4015
  headers: {
@@ -6028,7 +4092,7 @@ class NftService {
6028
4092
  const url = `https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/floor_price/?${urlParams}`;
6029
4093
  let startTime;
6030
4094
  if (this.debug) {
6031
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4095
+ startTime = new Date();
6032
4096
  }
6033
4097
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/nft_market/${contractAddress}/floor_price/?${urlParams}`, {
6034
4098
  headers: {
@@ -6160,7 +4224,7 @@ class PricingService {
6160
4224
  const url = `https://api.covalenthq.com/v1/pricing/historical_by_addresses_v2/${chainName}/${quoteCurrency}/${contractAddress}/?${urlParams}`;
6161
4225
  let startTime;
6162
4226
  if (this.debug) {
6163
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4227
+ startTime = new Date();
6164
4228
  }
6165
4229
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/pricing/historical_by_addresses_v2/${chainName}/${quoteCurrency}/${contractAddress}/?${urlParams}`, {
6166
4230
  headers: {
@@ -6453,7 +4517,7 @@ class RecentTransactionsResponse {
6453
4517
  try {
6454
4518
  let startTime;
6455
4519
  if (this._debug) {
6456
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4520
+ startTime = new Date();
6457
4521
  }
6458
4522
  if (this.links.prev === null) {
6459
4523
  success = true;
@@ -6520,7 +4584,7 @@ class RecentTransactionsResponse {
6520
4584
  try {
6521
4585
  let startTime;
6522
4586
  if (this._debug) {
6523
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4587
+ startTime = new Date();
6524
4588
  }
6525
4589
  if (this.links.next === null) {
6526
4590
  success = true;
@@ -6608,7 +4672,7 @@ class TransactionsBlockPageResponse {
6608
4672
  try {
6609
4673
  let startTime;
6610
4674
  if (this._debug) {
6611
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4675
+ startTime = new Date();
6612
4676
  }
6613
4677
  if (this.links.prev === null) {
6614
4678
  success = true;
@@ -6675,7 +4739,7 @@ class TransactionsBlockPageResponse {
6675
4739
  try {
6676
4740
  let startTime;
6677
4741
  if (this._debug) {
6678
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4742
+ startTime = new Date();
6679
4743
  }
6680
4744
  if (this.links.next === null) {
6681
4745
  success = true;
@@ -6791,7 +4855,7 @@ class TransactionsResponse {
6791
4855
  try {
6792
4856
  let startTime;
6793
4857
  if (this._debug) {
6794
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4858
+ startTime = new Date();
6795
4859
  }
6796
4860
  if (this.links.prev === null) {
6797
4861
  success = true;
@@ -6858,7 +4922,7 @@ class TransactionsResponse {
6858
4922
  try {
6859
4923
  let startTime;
6860
4924
  if (this._debug) {
6861
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
4925
+ startTime = new Date();
6862
4926
  }
6863
4927
  if (this.links.next === null) {
6864
4928
  success = true;
@@ -6944,7 +5008,7 @@ class TransactionsTimeBucketResponse {
6944
5008
  try {
6945
5009
  let startTime;
6946
5010
  if (this._debug) {
6947
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5011
+ startTime = new Date();
6948
5012
  }
6949
5013
  if (this.links.prev === null) {
6950
5014
  success = true;
@@ -7011,7 +5075,7 @@ class TransactionsTimeBucketResponse {
7011
5075
  try {
7012
5076
  let startTime;
7013
5077
  if (this._debug) {
7014
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5078
+ startTime = new Date();
7015
5079
  }
7016
5080
  if (this.links.next === null) {
7017
5081
  success = true;
@@ -7083,7 +5147,7 @@ async function* paginateEndpoint(url, apiKey, urlsParams, debug, threadCount, en
7083
5147
  try {
7084
5148
  let startTime;
7085
5149
  if (debug) {
7086
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5150
+ startTime = new Date();
7087
5151
  }
7088
5152
  response = await LIMIT(() => fetch(`${url}?${urlsParams}`, {
7089
5153
  headers: {
@@ -7190,7 +5254,7 @@ class TransactionService {
7190
5254
  }
7191
5255
  let startTime;
7192
5256
  if (this.debug) {
7193
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5257
+ startTime = new Date();
7194
5258
  }
7195
5259
  const url = `https://api.covalenthq.com/v1/${chainName}/transaction_v2/${txHash}/?${urlParams}`;
7196
5260
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/transaction_v2/${txHash}/?${urlParams}`, {
@@ -7326,7 +5390,7 @@ class TransactionService {
7326
5390
  }
7327
5391
  let startTime;
7328
5392
  if (this.debug) {
7329
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5393
+ startTime = new Date();
7330
5394
  }
7331
5395
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_v3/?${urlParams}`;
7332
5396
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_v3/?${urlParams}`, {
@@ -7413,7 +5477,7 @@ class TransactionService {
7413
5477
  }
7414
5478
  let startTime;
7415
5479
  if (this.debug) {
7416
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5480
+ startTime = new Date();
7417
5481
  }
7418
5482
  const url = `https://api.covalenthq.com/v1/${chainName}/block/${blockHeight}/transactions_v3/?${urlParams}`;
7419
5483
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/block/${blockHeight}/transactions_v3/?${urlParams}`, {
@@ -7487,7 +5551,7 @@ class TransactionService {
7487
5551
  }
7488
5552
  let startTime;
7489
5553
  if (this.debug) {
7490
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5554
+ startTime = new Date();
7491
5555
  }
7492
5556
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_summary/?${urlParams}`;
7493
5557
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_summary/?${urlParams}`, {
@@ -7577,7 +5641,7 @@ class TransactionService {
7577
5641
  }
7578
5642
  let startTime;
7579
5643
  if (this.debug) {
7580
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5644
+ startTime = new Date();
7581
5645
  }
7582
5646
  const url = `https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_v3/page/${page}/?${urlParams}`;
7583
5647
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/address/${walletAddress}/transactions_v3/page/${page}/?${urlParams}`, {
@@ -7663,7 +5727,7 @@ class TransactionService {
7663
5727
  }
7664
5728
  let startTime;
7665
5729
  if (this.debug) {
7666
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5730
+ startTime = new Date();
7667
5731
  }
7668
5732
  const url = `https://api.covalenthq.com/v1/${chainName}/bulk/transactions/${walletAddress}/${timeBucket}/?${urlParams}`;
7669
5733
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/bulk/transactions/${walletAddress}/${timeBucket}/?${urlParams}`, {
@@ -7752,7 +5816,7 @@ class TransactionService {
7752
5816
  const url = `https://api.covalenthq.com/v1/${chainName}/block_hash/${blockHash}/transactions_v3/page/${page}/?${urlParams}`;
7753
5817
  let startTime;
7754
5818
  if (this.debug) {
7755
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5819
+ startTime = new Date();
7756
5820
  }
7757
5821
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/block_hash/${blockHash}/transactions_v3/page/${page}/?${urlParams}`, {
7758
5822
  headers: {
@@ -7839,7 +5903,7 @@ class TransactionService {
7839
5903
  const url = `https://api.covalenthq.com/v1/${chainName}/block_hash/${blockHash}/transactions_v3/?${urlParams}`;
7840
5904
  let startTime;
7841
5905
  if (this.debug) {
7842
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
5906
+ startTime = new Date();
7843
5907
  }
7844
5908
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/block_hash/${blockHash}/transactions_v3/?${urlParams}`, {
7845
5909
  headers: {
@@ -8459,7 +6523,7 @@ class XykService {
8459
6523
  }
8460
6524
  let startTime;
8461
6525
  if (this.debug) {
8462
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
6526
+ startTime = new Date();
8463
6527
  }
8464
6528
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/pools/?${urlParams}`, {
8465
6529
  headers: {
@@ -8533,7 +6597,7 @@ class XykService {
8533
6597
  }
8534
6598
  let startTime;
8535
6599
  if (this.debug) {
8536
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
6600
+ startTime = new Date();
8537
6601
  }
8538
6602
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/address/${poolAddress}/dex_name/?${urlParams}`, {
8539
6603
  headers: {
@@ -8608,7 +6672,7 @@ class XykService {
8608
6672
  }
8609
6673
  let startTime;
8610
6674
  if (this.debug) {
8611
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
6675
+ startTime = new Date();
8612
6676
  }
8613
6677
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/pools/address/${poolAddress}/?${urlParams}`, {
8614
6678
  headers: {
@@ -8696,7 +6760,7 @@ class XykService {
8696
6760
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/tokens/address/${tokenAddress}/pools/page/${page}/?${urlParams}`;
8697
6761
  let startTime;
8698
6762
  if (this.debug) {
8699
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
6763
+ startTime = new Date();
8700
6764
  }
8701
6765
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/tokens/address/${tokenAddress}/pools/page/${page}/?${urlParams}`, {
8702
6766
  headers: {
@@ -8771,7 +6835,7 @@ class XykService {
8771
6835
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/address/${accountAddress}/balances/?${urlParams}`;
8772
6836
  let startTime;
8773
6837
  if (this.debug) {
8774
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
6838
+ startTime = new Date();
8775
6839
  }
8776
6840
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/address/${accountAddress}/balances/?${urlParams}`, {
8777
6841
  headers: {
@@ -8863,7 +6927,7 @@ class XykService {
8863
6927
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/address/${walletAddress}/pools/page/${page}/?${urlParams}`;
8864
6928
  let startTime;
8865
6929
  if (this.debug) {
8866
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
6930
+ startTime = new Date();
8867
6931
  }
8868
6932
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/address/${walletAddress}/pools/page/${page}/?${urlParams}`, {
8869
6933
  headers: {
@@ -8946,7 +7010,7 @@ class XykService {
8946
7010
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/?${urlParams}`;
8947
7011
  let startTime;
8948
7012
  if (this.debug) {
8949
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7013
+ startTime = new Date();
8950
7014
  }
8951
7015
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/?${urlParams}`, {
8952
7016
  headers: {
@@ -9026,7 +7090,7 @@ class XykService {
9026
7090
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/address/${tokenAddress}/view/?${urlParams}`;
9027
7091
  let startTime;
9028
7092
  if (this.debug) {
9029
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7093
+ startTime = new Date();
9030
7094
  }
9031
7095
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/address/${tokenAddress}/view/?${urlParams}`, {
9032
7096
  headers: {
@@ -9098,7 +7162,7 @@ class XykService {
9098
7162
  const url = `https://api.covalenthq.com/v1/xy=k/supported_dexes/?${urlParams}`;
9099
7163
  let startTime;
9100
7164
  if (this.debug) {
9101
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7165
+ startTime = new Date();
9102
7166
  }
9103
7167
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/xy=k/supported_dexes/?${urlParams}`, {
9104
7168
  headers: {
@@ -9182,7 +7246,7 @@ class XykService {
9182
7246
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/address/${tokenAddress}/?${urlParams}`;
9183
7247
  let startTime;
9184
7248
  if (this.debug) {
9185
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7249
+ startTime = new Date();
9186
7250
  }
9187
7251
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/address/${tokenAddress}/?${urlParams}`, {
9188
7252
  headers: {
@@ -9257,7 +7321,7 @@ class XykService {
9257
7321
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/address/${accountAddress}/transactions/?${urlParams}`;
9258
7322
  let startTime;
9259
7323
  if (this.debug) {
9260
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7324
+ startTime = new Date();
9261
7325
  }
9262
7326
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/address/${accountAddress}/transactions/?${urlParams}`, {
9263
7327
  headers: {
@@ -9341,7 +7405,7 @@ class XykService {
9341
7405
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/address/${tokenAddress}/transactions/?${urlParams}`;
9342
7406
  let startTime;
9343
7407
  if (this.debug) {
9344
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7408
+ startTime = new Date();
9345
7409
  }
9346
7410
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/tokens/address/${tokenAddress}/transactions/?${urlParams}`, {
9347
7411
  headers: {
@@ -9425,7 +7489,7 @@ class XykService {
9425
7489
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/pools/address/${poolAddress}/transactions/?${urlParams}`;
9426
7490
  let startTime;
9427
7491
  if (this.debug) {
9428
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7492
+ startTime = new Date();
9429
7493
  }
9430
7494
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/pools/address/${poolAddress}/transactions/?${urlParams}`, {
9431
7495
  headers: {
@@ -9512,7 +7576,7 @@ class XykService {
9512
7576
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/transactions/?${urlParams}`;
9513
7577
  let startTime;
9514
7578
  if (this.debug) {
9515
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7579
+ startTime = new Date();
9516
7580
  }
9517
7581
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/transactions/?${urlParams}`, {
9518
7582
  headers: {
@@ -9586,7 +7650,7 @@ class XykService {
9586
7650
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/ecosystem/?${urlParams}`;
9587
7651
  let startTime;
9588
7652
  if (this.debug) {
9589
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7653
+ startTime = new Date();
9590
7654
  }
9591
7655
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/ecosystem/?${urlParams}`, {
9592
7656
  headers: {
@@ -9660,7 +7724,7 @@ class XykService {
9660
7724
  const url = `https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/health/?${urlParams}`;
9661
7725
  let startTime;
9662
7726
  if (this.debug) {
9663
- startTime = typeof performance !== 'undefined' ? performance.now() : process.hrtime();
7727
+ startTime = new Date();
9664
7728
  }
9665
7729
  response = await this.LIMIT(() => fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/${dexName}/health/?${urlParams}`, {
9666
7730
  headers: {
@@ -9709,7 +7773,7 @@ class XykService {
9709
7773
  }
9710
7774
  }
9711
7775
 
9712
- const userAgent = "com.covalenthq.sdk.typescript/0.8.1";
7776
+ const userAgent = "com.covalenthq.sdk.typescript/0.8.3";
9713
7777
  /**
9714
7778
  * CovalentClient Class
9715
7779
  */