@kong-ui-public/analytics-utilities 5.9.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/timeframes.d.ts.map +1 -1
- package/dist/vitals-utilities.cjs +1 -1
- package/dist/vitals-utilities.cjs.map +1 -1
- package/dist/vitals-utilities.es.js +31 -29
- package/dist/vitals-utilities.es.js.map +1 -1
- package/dist/vitals-utilities.umd.js +1 -1
- package/dist/vitals-utilities.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ const jn = [
|
|
|
35
35
|
"daily",
|
|
36
36
|
"weekly",
|
|
37
37
|
"trend"
|
|
38
|
-
], I = (e) => e.filter((t) => t !== "time"),
|
|
38
|
+
], I = (e) => e.filter((t) => t !== "time"), Oe = [
|
|
39
39
|
"api_product",
|
|
40
40
|
"api_product_version",
|
|
41
41
|
"control_plane",
|
|
@@ -46,13 +46,13 @@ const jn = [
|
|
|
46
46
|
"status_code",
|
|
47
47
|
"status_code_grouped",
|
|
48
48
|
"time"
|
|
49
|
-
], Ge = I(
|
|
49
|
+
], Ge = I(Oe), Le = [
|
|
50
50
|
"active_services",
|
|
51
51
|
"request_count",
|
|
52
52
|
"request_per_minute",
|
|
53
53
|
"response_latency_average"
|
|
54
54
|
], qe = [
|
|
55
|
-
...
|
|
55
|
+
...Oe,
|
|
56
56
|
"application",
|
|
57
57
|
"consumer",
|
|
58
58
|
"country_code",
|
|
@@ -172,7 +172,7 @@ const jn = [
|
|
|
172
172
|
basic: new Set(Ge),
|
|
173
173
|
advanced: new Set(Ue),
|
|
174
174
|
ai: new Set(Ae)
|
|
175
|
-
}, cr = (e, t) => t.filter((n) => je[e].has(n.dimension)),
|
|
175
|
+
}, cr = (e, t) => t.filter((n) => je[e].has(n.dimension)), be = 6048e5, Ze = 864e5, Qe = 60, Be = 3600, te = Symbol.for("constructDateFrom");
|
|
176
176
|
function D(e, t) {
|
|
177
177
|
return typeof e == "function" ? e(t) : e && typeof e == "object" && te in e ? e[te](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
|
|
178
178
|
}
|
|
@@ -546,9 +546,9 @@ function R(e) {
|
|
|
546
546
|
const r = n.width, a = r && e.matchPatterns[r] || e.matchPatterns[e.defaultMatchWidth], i = t.match(a);
|
|
547
547
|
if (!i)
|
|
548
548
|
return null;
|
|
549
|
-
const s = i[0], o = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], u = Array.isArray(o) ?
|
|
549
|
+
const s = i[0], o = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], u = Array.isArray(o) ? bt(o, (d) => d.test(s)) : (
|
|
550
550
|
// [TODO] -- I challenge you to fix the type
|
|
551
|
-
|
|
551
|
+
Ot(o, (d) => d.test(s))
|
|
552
552
|
);
|
|
553
553
|
let l;
|
|
554
554
|
l = e.valueCallback ? e.valueCallback(u) : u, l = n.valueCallback ? (
|
|
@@ -559,12 +559,12 @@ function R(e) {
|
|
|
559
559
|
return { value: l, rest: c };
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function Ot(e, t) {
|
|
563
563
|
for (const n in e)
|
|
564
564
|
if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n]))
|
|
565
565
|
return n;
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function bt(e, t) {
|
|
568
568
|
for (let n = 0; n < e.length; n++)
|
|
569
569
|
if (t(e[n]))
|
|
570
570
|
return n;
|
|
@@ -703,11 +703,11 @@ function Gt(e, t) {
|
|
|
703
703
|
}
|
|
704
704
|
function Lt(e, t) {
|
|
705
705
|
const n = y(e, t == null ? void 0 : t.in), r = +F(n) - +nt(n);
|
|
706
|
-
return Math.round(r /
|
|
706
|
+
return Math.round(r / be) + 1;
|
|
707
707
|
}
|
|
708
708
|
function ve(e, t) {
|
|
709
|
-
var c, d,
|
|
710
|
-
const n = y(e, t == null ? void 0 : t.in), r = n.getFullYear(), a = W(), i = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((d = (c = t == null ? void 0 : t.locale) == null ? void 0 : c.options) == null ? void 0 : d.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((M = (
|
|
709
|
+
var c, d, O, M;
|
|
710
|
+
const n = y(e, t == null ? void 0 : t.in), r = n.getFullYear(), a = W(), i = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((d = (c = t == null ? void 0 : t.locale) == null ? void 0 : c.options) == null ? void 0 : d.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((M = (O = a.locale) == null ? void 0 : O.options) == null ? void 0 : M.firstWeekContainsDate) ?? 1, s = D((t == null ? void 0 : t.in) || e, 0);
|
|
711
711
|
s.setFullYear(r + 1, 0, i), s.setHours(0, 0, 0, 0);
|
|
712
712
|
const o = p(s, t), u = D((t == null ? void 0 : t.in) || e, 0);
|
|
713
713
|
u.setFullYear(r, 0, i), u.setHours(0, 0, 0, 0);
|
|
@@ -721,7 +721,7 @@ function qt(e, t) {
|
|
|
721
721
|
}
|
|
722
722
|
function Ut(e, t) {
|
|
723
723
|
const n = y(e, t == null ? void 0 : t.in), r = +p(n, t) - +qt(n, t);
|
|
724
|
-
return Math.round(r /
|
|
724
|
+
return Math.round(r / be) + 1;
|
|
725
725
|
}
|
|
726
726
|
function f(e, t) {
|
|
727
727
|
const n = e < 0 ? "-" : "", r = Math.abs(e).toString().padStart(t, "0");
|
|
@@ -1353,8 +1353,8 @@ function Bt(e, t, n) {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
const Jt = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Kt = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, en = /^'([^]*?)'?$/, tn = /''/g, nn = /[a-zA-Z]/;
|
|
1355
1355
|
function Se(e, t, n) {
|
|
1356
|
-
var c, d,
|
|
1357
|
-
const r = W(), a = (n == null ? void 0 : n.locale) ?? r.locale ?? Ct, i = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((d = (c = n == null ? void 0 : n.locale) == null ? void 0 : c.options) == null ? void 0 : d.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((M = (
|
|
1356
|
+
var c, d, O, M, b, S, K, ee;
|
|
1357
|
+
const r = W(), a = (n == null ? void 0 : n.locale) ?? r.locale ?? Ct, i = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((d = (c = n == null ? void 0 : n.locale) == null ? void 0 : c.options) == null ? void 0 : d.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((M = (O = r.locale) == null ? void 0 : O.options) == null ? void 0 : M.firstWeekContainsDate) ?? 1, s = (n == null ? void 0 : n.weekStartsOn) ?? ((S = (b = n == null ? void 0 : n.locale) == null ? void 0 : b.options) == null ? void 0 : S.weekStartsOn) ?? r.weekStartsOn ?? ((ee = (K = r.locale) == null ? void 0 : K.options) == null ? void 0 : ee.weekStartsOn) ?? 0, o = y(e, n == null ? void 0 : n.in);
|
|
1358
1358
|
if (!at(o))
|
|
1359
1359
|
throw new RangeError("Invalid time value");
|
|
1360
1360
|
let u = t.match(Kt).map((_) => {
|
|
@@ -1569,7 +1569,7 @@ function Mn(e) {
|
|
|
1569
1569
|
return !1;
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
const
|
|
1572
|
+
const On = 60 * 1e3, bn = {
|
|
1573
1573
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
1574
1574
|
X: function(e, t, n) {
|
|
1575
1575
|
const r = V(n.timeZone, e);
|
|
@@ -1629,7 +1629,7 @@ const bn = 60 * 1e3, On = {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
};
|
|
1631
1631
|
function V(e, t) {
|
|
1632
|
-
const n = e ? H(e, t, !0) /
|
|
1632
|
+
const n = e ? H(e, t, !0) / On : (t == null ? void 0 : t.getTimezoneOffset()) ?? 0;
|
|
1633
1633
|
if (Number.isNaN(n))
|
|
1634
1634
|
throw new RangeError("Invalid time zone specified: " + e);
|
|
1635
1635
|
return n;
|
|
@@ -1839,7 +1839,7 @@ function In(e, t, n = {}) {
|
|
|
1839
1839
|
t = r.reduce(function(i, s) {
|
|
1840
1840
|
if (s[0] === "'")
|
|
1841
1841
|
return i;
|
|
1842
|
-
const o = i.indexOf(s), u = i[o - 1] === "'", l = i.replace(s, "'" +
|
|
1842
|
+
const o = i.indexOf(s), u = i[o - 1] === "'", l = i.replace(s, "'" + bn[s[0]](a, s, n) + "'");
|
|
1843
1843
|
return u ? l.substring(0, o - 1) + l.substring(o + 1) : l;
|
|
1844
1844
|
}, t);
|
|
1845
1845
|
}
|
|
@@ -2234,7 +2234,8 @@ const An = /* @__PURE__ */ new Map([
|
|
|
2234
2234
|
defaultResponseGranularity: "daily",
|
|
2235
2235
|
dataGranularity: "daily",
|
|
2236
2236
|
isRelative: !1,
|
|
2237
|
-
allowedTiers: ["plus", "enterprise"]
|
|
2237
|
+
allowedTiers: ["plus", "enterprise"],
|
|
2238
|
+
allowedGranularitiesOverride: ["thirtyMinutely", "hourly", "twoHourly", "twelveHourly", "daily"]
|
|
2238
2239
|
})
|
|
2239
2240
|
],
|
|
2240
2241
|
[
|
|
@@ -2263,7 +2264,8 @@ const An = /* @__PURE__ */ new Map([
|
|
|
2263
2264
|
defaultResponseGranularity: "daily",
|
|
2264
2265
|
dataGranularity: "daily",
|
|
2265
2266
|
isRelative: !1,
|
|
2266
|
-
allowedTiers: ["plus", "enterprise"]
|
|
2267
|
+
allowedTiers: ["plus", "enterprise"],
|
|
2268
|
+
allowedGranularitiesOverride: ["thirtyMinutely", "hourly", "twoHourly", "twelveHourly", "daily"]
|
|
2267
2269
|
})
|
|
2268
2270
|
],
|
|
2269
2271
|
[
|
|
@@ -2336,17 +2338,17 @@ const Tr = (e, t) => {
|
|
|
2336
2338
|
for (let c = a; c <= i; c += 60 * 60 * 1e3)
|
|
2337
2339
|
if (t)
|
|
2338
2340
|
for (const d in t)
|
|
2339
|
-
t[d].forEach((
|
|
2341
|
+
t[d].forEach((O) => {
|
|
2340
2342
|
o += r.next(50, 500);
|
|
2341
2343
|
const M = {
|
|
2342
|
-
[d]:
|
|
2344
|
+
[d]: O,
|
|
2343
2345
|
[e.name]: o
|
|
2344
|
-
},
|
|
2346
|
+
}, b = {
|
|
2345
2347
|
version: "1.0",
|
|
2346
2348
|
timestamp: new Date(c).toISOString(),
|
|
2347
2349
|
event: M
|
|
2348
2350
|
};
|
|
2349
|
-
s.push(
|
|
2351
|
+
s.push(b);
|
|
2350
2352
|
});
|
|
2351
2353
|
else {
|
|
2352
2354
|
o += r.next(50, 500);
|
|
@@ -2418,8 +2420,8 @@ const Tr = (e, t) => {
|
|
|
2418
2420
|
}, Mr = (e, t) => {
|
|
2419
2421
|
const n = Math.floor(Math.random() * 9991) + 10, r = new J(n), a = Date.now() - 6 * 60 * 60 * 1e3, i = Date.now(), s = new Date((a + i) / 2).toISOString(), o = [];
|
|
2420
2422
|
if (t) {
|
|
2421
|
-
const c = Object.keys(t), d = Object.values(t),
|
|
2422
|
-
if (
|
|
2423
|
+
const c = Object.keys(t), d = Object.values(t), O = (M, b) => {
|
|
2424
|
+
if (b === c.length) {
|
|
2423
2425
|
e.forEach((S) => {
|
|
2424
2426
|
M[S.name] = r.next(50, 500);
|
|
2425
2427
|
}), o.push({
|
|
@@ -2429,11 +2431,11 @@ const Tr = (e, t) => {
|
|
|
2429
2431
|
});
|
|
2430
2432
|
return;
|
|
2431
2433
|
}
|
|
2432
|
-
d[
|
|
2433
|
-
|
|
2434
|
+
d[b].forEach((S) => {
|
|
2435
|
+
O({ ...M, [c[b]]: S }, b + 1);
|
|
2434
2436
|
});
|
|
2435
2437
|
};
|
|
2436
|
-
|
|
2438
|
+
O({}, 0);
|
|
2437
2439
|
} else {
|
|
2438
2440
|
const c = {};
|
|
2439
2441
|
e.forEach((d) => {
|
|
@@ -2509,7 +2511,7 @@ export {
|
|
|
2509
2511
|
mr as msToGranularity,
|
|
2510
2512
|
ur as queryDatasources,
|
|
2511
2513
|
ze as queryableAiExploreDimensions,
|
|
2512
|
-
|
|
2514
|
+
Oe as queryableBasicExploreDimensions,
|
|
2513
2515
|
qe as queryableExploreDimensions,
|
|
2514
2516
|
Xe as queryableRequestDimensions,
|
|
2515
2517
|
Ve as queryableRequestMetrics,
|