@kong-ui-public/analytics-config-store 1.1.21-pr.2603.ce4ebb0cd.0 → 1.1.21-pr.2628.8623a6e01.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/stores/analytics-config.d.ts +4 -1
- package/dist/types/stores/analytics-config.d.ts.map +1 -1
- package/dist/types/stores/plugins/reset-store.d.ts +4 -0
- package/dist/types/stores/plugins/reset-store.d.ts.map +1 -0
- package/dist/types/stores/tests/setupPiniaTestStore.d.ts +13 -0
- package/dist/types/stores/tests/setupPiniaTestStore.d.ts.map +1 -0
- package/dist/vitals-config-store.es.js +35 -30
- package/dist/vitals-config-store.umd.js +1 -1
- package/package.json +2 -2
|
@@ -36,6 +36,7 @@ export declare const useAnalyticsConfigStore: import("pinia").StoreDefinition<"a
|
|
|
36
36
|
maxParallelRequests: import("vue").ComputedRef<number>;
|
|
37
37
|
requestInterval: import("vue").ComputedRef<number>;
|
|
38
38
|
requestIntervalCap: import("vue").ComputedRef<number>;
|
|
39
|
+
isReady: () => Promise<void>;
|
|
39
40
|
}, "analyticsConfig">>, Pick<{
|
|
40
41
|
analyticsConfig: import("vue").Ref<{
|
|
41
42
|
analytics: {
|
|
@@ -72,6 +73,7 @@ export declare const useAnalyticsConfigStore: import("pinia").StoreDefinition<"a
|
|
|
72
73
|
maxParallelRequests: import("vue").ComputedRef<number>;
|
|
73
74
|
requestInterval: import("vue").ComputedRef<number>;
|
|
74
75
|
requestIntervalCap: import("vue").ComputedRef<number>;
|
|
76
|
+
isReady: () => Promise<void>;
|
|
75
77
|
}, "analytics" | "percentiles" | "maxParallelRequests" | "requestInterval" | "requestIntervalCap" | "longRetention" | "defaultQueryTimeForOrg" | "loading">, Pick<{
|
|
76
78
|
analyticsConfig: import("vue").Ref<{
|
|
77
79
|
analytics: {
|
|
@@ -108,5 +110,6 @@ export declare const useAnalyticsConfigStore: import("pinia").StoreDefinition<"a
|
|
|
108
110
|
maxParallelRequests: import("vue").ComputedRef<number>;
|
|
109
111
|
requestInterval: import("vue").ComputedRef<number>;
|
|
110
112
|
requestIntervalCap: import("vue").ComputedRef<number>;
|
|
111
|
-
|
|
113
|
+
isReady: () => Promise<void>;
|
|
114
|
+
}, "isReady">>;
|
|
112
115
|
//# sourceMappingURL=analytics-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-config.d.ts","sourceRoot":"","sources":["../../../src/stores/analytics-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAU7F,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CAAA;AAEvD,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"analytics-config.d.ts","sourceRoot":"","sources":["../../../src/stores/analytics-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAU7F,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CAAA;AAEvD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAyCd,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;cAuCjC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-store.d.ts","sourceRoot":"","sources":["../../../../src/stores/plugins/reset-store.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE;;CAAA,QAI3C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
interface SetupPiniaTestStoreOptions {
|
|
3
|
+
/** Should a Vue app be created and initialized? */
|
|
4
|
+
createVueApp?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Set up the Pinia test store instance for the given runner (Cypress or Vitest).
|
|
8
|
+
* @param {'cy.spy' | 'vi.fn} createSpy The test runner your spec file is using.
|
|
9
|
+
* @param {TestingOptions} config @pinia/testing options https://pinia.vuejs.org/api/@pinia/testing/interfaces/TestingOptions.html
|
|
10
|
+
*/
|
|
11
|
+
export declare const setupPiniaTestStore: (options?: SetupPiniaTestStoreOptions) => App | undefined;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=setupPiniaTestStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupPiniaTestStore.d.ts","sourceRoot":"","sources":["../../../../src/stores/tests/setupPiniaTestStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,UAAU,0BAA0B;IAClC,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,0BAA0B,KAAG,GAAG,GAAG,SAShF,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as g, inject as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
const
|
|
4
|
-
const t = g(null),
|
|
5
|
-
|
|
1
|
+
import { ref as g, inject as h, computed as s, watch as A, defineComponent as q, renderSlot as v, createCommentVNode as E, unref as a } from "vue";
|
|
2
|
+
import { defineStore as _, storeToRefs as R } from "pinia";
|
|
3
|
+
const T = 2592e6, C = 2, P = 2e3, S = 10, b = "analytics-query-provider", I = _("analytics-config", () => {
|
|
4
|
+
const t = g(null), o = h(b);
|
|
5
|
+
o ? o.configFn().then((e) => {
|
|
6
6
|
t.value = e;
|
|
7
7
|
}).catch((e) => {
|
|
8
8
|
console.warn("Error fetching analytics config"), console.warn(e);
|
|
@@ -13,62 +13,67 @@ const _ = 2592e6, R = 2, T = 2e3, C = 10, P = "analytics-query-provider", S = E(
|
|
|
13
13
|
const u = s(() => {
|
|
14
14
|
var n, d;
|
|
15
15
|
const e = (d = (n = t.value) == null ? void 0 : n.analytics) == null ? void 0 : d.retention_ms;
|
|
16
|
-
return !!e && e >=
|
|
17
|
-
}),
|
|
16
|
+
return !!e && e >= T;
|
|
17
|
+
}), i = s(() => "7d"), r = s(() => !t.value), l = s(() => {
|
|
18
18
|
var e;
|
|
19
19
|
return !!((e = t.value) != null && e.analytics);
|
|
20
20
|
}), y = s(() => {
|
|
21
21
|
var e, n;
|
|
22
22
|
return !!((n = (e = t.value) == null ? void 0 : e.analytics) != null && n.percentiles);
|
|
23
|
-
}),
|
|
23
|
+
}), c = () => r.value ? new Promise((e) => {
|
|
24
|
+
const n = A(r, () => {
|
|
25
|
+
r.value || (n(), e());
|
|
26
|
+
});
|
|
27
|
+
}) : Promise.resolve(), p = s(
|
|
24
28
|
() => {
|
|
25
29
|
var e, n;
|
|
26
|
-
return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ??
|
|
30
|
+
return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ?? C;
|
|
27
31
|
}
|
|
28
|
-
),
|
|
32
|
+
), f = s(
|
|
29
33
|
() => {
|
|
30
34
|
var e, n;
|
|
31
|
-
return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ??
|
|
35
|
+
return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ?? P;
|
|
32
36
|
}
|
|
33
|
-
),
|
|
37
|
+
), m = s(
|
|
34
38
|
() => {
|
|
35
39
|
var e, n;
|
|
36
|
-
return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestIntervalCap) ??
|
|
40
|
+
return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestIntervalCap) ?? S;
|
|
37
41
|
}
|
|
38
42
|
);
|
|
39
43
|
return {
|
|
40
44
|
analyticsConfig: t,
|
|
41
45
|
longRetention: u,
|
|
42
|
-
defaultQueryTimeForOrg:
|
|
43
|
-
loading:
|
|
44
|
-
analytics:
|
|
46
|
+
defaultQueryTimeForOrg: i,
|
|
47
|
+
loading: r,
|
|
48
|
+
analytics: l,
|
|
45
49
|
percentiles: y,
|
|
46
|
-
maxParallelRequests:
|
|
47
|
-
requestInterval:
|
|
48
|
-
requestIntervalCap:
|
|
50
|
+
maxParallelRequests: p,
|
|
51
|
+
requestInterval: f,
|
|
52
|
+
requestIntervalCap: m,
|
|
53
|
+
isReady: c
|
|
49
54
|
};
|
|
50
|
-
}),
|
|
55
|
+
}), k = /* @__PURE__ */ q({
|
|
51
56
|
__name: "AnalyticsConfigCheck",
|
|
52
57
|
props: {
|
|
53
58
|
requireAnalytics: { type: Boolean },
|
|
54
59
|
requirePercentiles: { type: Boolean }
|
|
55
60
|
},
|
|
56
61
|
setup(t) {
|
|
57
|
-
const
|
|
58
|
-
() => (
|
|
62
|
+
const o = t, u = I(), { analytics: i, percentiles: r, loading: l } = R(u), y = s(
|
|
63
|
+
() => (o.requireAnalytics ? i.value : !0) && (o.requirePercentiles ? r.value : !0)
|
|
59
64
|
);
|
|
60
|
-
return (
|
|
65
|
+
return (c, p) => !a(l) && y.value ? v(c.$slots, "default", {
|
|
61
66
|
key: 0,
|
|
62
|
-
hasAnalytics: a(
|
|
63
|
-
hasPercentiles: a(
|
|
64
|
-
}) : a(
|
|
67
|
+
hasAnalytics: a(i),
|
|
68
|
+
hasPercentiles: a(r)
|
|
69
|
+
}) : a(l) ? E("", !0) : v(c.$slots, "fallback", {
|
|
65
70
|
key: 1,
|
|
66
|
-
hasAnalytics: a(
|
|
67
|
-
hasPercentiles: a(
|
|
71
|
+
hasAnalytics: a(i),
|
|
72
|
+
hasPercentiles: a(r)
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
75
|
});
|
|
71
76
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
k as AnalyticsConfigCheck,
|
|
78
|
+
I as useAnalyticsConfigStore
|
|
74
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r["kong-ui-public-vitals-config-store"]={},r.Vue,r.pinia))})(this,function(r,e,p){"use strict";const E="analytics-query-provider",f=p.defineStore("analytics-config",()=>{const s=e.ref(null),i=e.inject(E);i?i.configFn().then(n=>{s.value=n}).catch(n=>{console.warn("Error fetching analytics config"),console.warn(n)}):(console.warn("Analytics components require a query bridge supplied via provide / inject."),console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"),console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements"),s.value={analytics:null,requests:null});const u=e.computed(()=>{var t,A;const n=(A=(t=s.value)==null?void 0:t.analytics)==null?void 0:A.retention_ms;return!!n&&n>=2592e6}),a=e.computed(()=>"7d"),o=e.computed(()=>!s.value),c=e.computed(()=>{var n;return!!((n=s.value)!=null&&n.analytics)}),d=e.computed(()=>{var n,t;return!!((t=(n=s.value)==null?void 0:n.analytics)!=null&&t.percentiles)}),l=()=>o.value?new Promise(n=>{const t=e.watch(o,()=>{o.value||(t(),n())})}):Promise.resolve(),y=e.computed(()=>{var n,t;return((t=(n=s.value)==null?void 0:n.ui)==null?void 0:t.maxParallelRequests)??2}),T=e.computed(()=>{var n,t;return((t=(n=s.value)==null?void 0:n.ui)==null?void 0:t.requestInterval)??2e3}),_=e.computed(()=>{var n,t;return((t=(n=s.value)==null?void 0:n.ui)==null?void 0:t.requestIntervalCap)??10});return{analyticsConfig:s,longRetention:u,defaultQueryTimeForOrg:a,loading:o,analytics:c,percentiles:d,maxParallelRequests:y,requestInterval:T,requestIntervalCap:_,isReady:l}}),m=e.defineComponent({__name:"AnalyticsConfigCheck",props:{requireAnalytics:{type:Boolean},requirePercentiles:{type:Boolean}},setup(s){const i=s,u=f(),{analytics:a,percentiles:o,loading:c}=p.storeToRefs(u),d=e.computed(()=>(i.requireAnalytics?a.value:!0)&&(i.requirePercentiles?o.value:!0));return(l,y)=>!e.unref(c)&&d.value?e.renderSlot(l.$slots,"default",{key:0,hasAnalytics:e.unref(a),hasPercentiles:e.unref(o)}):e.unref(c)?e.createCommentVNode("",!0):e.renderSlot(l.$slots,"fallback",{key:1,hasAnalytics:e.unref(a),hasPercentiles:e.unref(o)})}});r.AnalyticsConfigCheck=m,r.useAnalyticsConfigStore=f,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/analytics-config-store",
|
|
3
|
-
"version": "1.1.21-pr.
|
|
3
|
+
"version": "1.1.21-pr.2628.8623a6e01.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/vitals-config-store.umd.js",
|
|
6
6
|
"module": "./dist/vitals-config-store.es.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"pinia": ">= 2.1.7 < 3",
|
|
25
25
|
"vue": "^3.5.22",
|
|
26
|
-
"@kong-ui-public/analytics-utilities": "^12.1.
|
|
26
|
+
"@kong-ui-public/analytics-utilities": "^12.1.3"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|