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