@kong-ui-public/analytics-config-store 1.1.21-pr.2628.8623a6e01.0 → 1.2.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/components/AnalyticsConfigCheck.vue.d.ts +7 -3
- package/dist/types/components/AnalyticsConfigCheck.vue.d.ts.map +1 -1
- 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/tests/setupPiniaTestStore.d.ts.map +1 -1
- package/dist/vitals-config-store.es.js +54 -45
- package/dist/vitals-config-store.umd.js +1 -1
- package/package.json +1 -1
- package/dist/types/stores/plugins/reset-store.d.ts +0 -4
- package/dist/types/stores/plugins/reset-store.d.ts.map +0 -1
|
@@ -3,16 +3,20 @@ type __VLS_Props = {
|
|
|
3
3
|
requirePercentiles?: boolean;
|
|
4
4
|
};
|
|
5
5
|
declare var __VLS_1: {
|
|
6
|
+
error: Error;
|
|
7
|
+
}, __VLS_3: {
|
|
6
8
|
hasAnalytics: boolean;
|
|
7
9
|
hasPercentiles: boolean;
|
|
8
|
-
},
|
|
10
|
+
}, __VLS_5: {
|
|
9
11
|
hasAnalytics: boolean;
|
|
10
12
|
hasPercentiles: boolean;
|
|
11
13
|
};
|
|
12
14
|
type __VLS_Slots = {} & {
|
|
13
|
-
|
|
15
|
+
error?: (props: typeof __VLS_1) => any;
|
|
16
|
+
} & {
|
|
17
|
+
default?: (props: typeof __VLS_3) => any;
|
|
14
18
|
} & {
|
|
15
|
-
fallback?: (props: typeof
|
|
19
|
+
fallback?: (props: typeof __VLS_5) => any;
|
|
16
20
|
};
|
|
17
21
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
22
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsConfigCheck.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AnalyticsConfigCheck.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnalyticsConfigCheck.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AnalyticsConfigCheck.vue"],"names":[],"mappings":"AA2CA,KAAK,WAAW,GAAG;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAC;AAmDF,QAAA,IAAI,OAAO;;CAAU,EAAE,OAAO;;;CAAU,EAAE,OAAO;;;CAAW,CAAE;AAC9D,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAsBhD,QAAA,MAAM,eAAe,oSAInB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAE1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -37,7 +37,8 @@ export declare const useAnalyticsConfigStore: import("pinia").StoreDefinition<"a
|
|
|
37
37
|
requestInterval: import("vue").ComputedRef<number>;
|
|
38
38
|
requestIntervalCap: import("vue").ComputedRef<number>;
|
|
39
39
|
isReady: () => Promise<void>;
|
|
40
|
-
|
|
40
|
+
configError: import("vue").Ref<Error | null, Error | null>;
|
|
41
|
+
}, "analyticsConfig" | "configError">>, Pick<{
|
|
41
42
|
analyticsConfig: import("vue").Ref<{
|
|
42
43
|
analytics: {
|
|
43
44
|
percentiles: boolean;
|
|
@@ -74,6 +75,7 @@ export declare const useAnalyticsConfigStore: import("pinia").StoreDefinition<"a
|
|
|
74
75
|
requestInterval: import("vue").ComputedRef<number>;
|
|
75
76
|
requestIntervalCap: import("vue").ComputedRef<number>;
|
|
76
77
|
isReady: () => Promise<void>;
|
|
78
|
+
configError: import("vue").Ref<Error | null, Error | null>;
|
|
77
79
|
}, "analytics" | "percentiles" | "maxParallelRequests" | "requestInterval" | "requestIntervalCap" | "longRetention" | "defaultQueryTimeForOrg" | "loading">, Pick<{
|
|
78
80
|
analyticsConfig: import("vue").Ref<{
|
|
79
81
|
analytics: {
|
|
@@ -111,5 +113,6 @@ export declare const useAnalyticsConfigStore: import("pinia").StoreDefinition<"a
|
|
|
111
113
|
requestInterval: import("vue").ComputedRef<number>;
|
|
112
114
|
requestIntervalCap: import("vue").ComputedRef<number>;
|
|
113
115
|
isReady: () => Promise<void>;
|
|
116
|
+
configError: import("vue").Ref<Error | null, Error | null>;
|
|
114
117
|
}, "isReady">>;
|
|
115
118
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgDd,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;;cAwCjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupPiniaTestStore.d.ts","sourceRoot":"","sources":["../../../../src/stores/tests/setupPiniaTestStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setupPiniaTestStore.d.ts","sourceRoot":"","sources":["../../../../src/stores/tests/setupPiniaTestStore.ts"],"names":[],"mappings":"AAEA,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,79 +1,88 @@
|
|
|
1
|
-
import { ref as g, inject as h, computed as s, watch as
|
|
2
|
-
import { defineStore as _, storeToRefs as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ref as g, inject as h, computed as s, watch as q, defineComponent as A, renderSlot as d, createCommentVNode as R, unref as t } from "vue";
|
|
2
|
+
import { defineStore as _, storeToRefs as T } from "pinia";
|
|
3
|
+
const C = 2592e6, P = 2, b = 2e3, S = 10, w = "analytics-query-provider", I = _("analytics-config", () => {
|
|
4
|
+
const r = g(null), o = g(null), y = h(w);
|
|
5
|
+
y ? y.configFn().then((e) => {
|
|
6
|
+
r.value = e;
|
|
7
7
|
}).catch((e) => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
o.value = e, r.value = {
|
|
9
|
+
analytics: null,
|
|
10
|
+
requests: null
|
|
11
|
+
}, console.warn("Error fetching analytics config"), console.warn(e);
|
|
12
|
+
}) : (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"), o.value = new Error("No analytics bridge provided"), r.value = {
|
|
10
13
|
analytics: null,
|
|
11
14
|
requests: null
|
|
12
15
|
});
|
|
13
|
-
const
|
|
14
|
-
var n,
|
|
15
|
-
const e = (
|
|
16
|
-
return !!e && e >=
|
|
17
|
-
}), i = s(() => "7d"),
|
|
16
|
+
const l = s(() => {
|
|
17
|
+
var n, f;
|
|
18
|
+
const e = (f = (n = r.value) == null ? void 0 : n.analytics) == null ? void 0 : f.retention_ms;
|
|
19
|
+
return !!e && e >= C;
|
|
20
|
+
}), i = s(() => "7d"), a = s(() => !r.value), c = s(() => {
|
|
18
21
|
var e;
|
|
19
|
-
return !!((e =
|
|
20
|
-
}),
|
|
22
|
+
return !!((e = r.value) != null && e.analytics);
|
|
23
|
+
}), p = s(() => {
|
|
21
24
|
var e, n;
|
|
22
|
-
return !!((n = (e =
|
|
23
|
-
}),
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
return !!((n = (e = r.value) == null ? void 0 : e.analytics) != null && n.percentiles);
|
|
26
|
+
}), u = () => new Promise((e) => {
|
|
27
|
+
if (!a.value)
|
|
28
|
+
return Promise.resolve();
|
|
29
|
+
const n = q(a, () => {
|
|
30
|
+
a.value || (n(), e());
|
|
26
31
|
});
|
|
27
|
-
})
|
|
32
|
+
}), v = s(
|
|
28
33
|
() => {
|
|
29
34
|
var e, n;
|
|
30
|
-
return ((n = (e =
|
|
35
|
+
return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ?? P;
|
|
31
36
|
}
|
|
32
|
-
),
|
|
37
|
+
), m = s(
|
|
33
38
|
() => {
|
|
34
39
|
var e, n;
|
|
35
|
-
return ((n = (e =
|
|
40
|
+
return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ?? b;
|
|
36
41
|
}
|
|
37
|
-
),
|
|
42
|
+
), E = s(
|
|
38
43
|
() => {
|
|
39
44
|
var e, n;
|
|
40
|
-
return ((n = (e =
|
|
45
|
+
return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestIntervalCap) ?? S;
|
|
41
46
|
}
|
|
42
47
|
);
|
|
43
48
|
return {
|
|
44
|
-
analyticsConfig:
|
|
45
|
-
longRetention:
|
|
49
|
+
analyticsConfig: r,
|
|
50
|
+
longRetention: l,
|
|
46
51
|
defaultQueryTimeForOrg: i,
|
|
47
|
-
loading:
|
|
48
|
-
analytics:
|
|
49
|
-
percentiles:
|
|
50
|
-
maxParallelRequests:
|
|
51
|
-
requestInterval:
|
|
52
|
-
requestIntervalCap:
|
|
53
|
-
isReady:
|
|
52
|
+
loading: a,
|
|
53
|
+
analytics: c,
|
|
54
|
+
percentiles: p,
|
|
55
|
+
maxParallelRequests: v,
|
|
56
|
+
requestInterval: m,
|
|
57
|
+
requestIntervalCap: E,
|
|
58
|
+
isReady: u,
|
|
59
|
+
configError: o
|
|
54
60
|
};
|
|
55
|
-
}),
|
|
61
|
+
}), U = /* @__PURE__ */ A({
|
|
56
62
|
__name: "AnalyticsConfigCheck",
|
|
57
63
|
props: {
|
|
58
64
|
requireAnalytics: { type: Boolean },
|
|
59
65
|
requirePercentiles: { type: Boolean }
|
|
60
66
|
},
|
|
61
|
-
setup(
|
|
62
|
-
const o =
|
|
63
|
-
() => (o.requireAnalytics ?
|
|
67
|
+
setup(r) {
|
|
68
|
+
const o = r, y = I(), { analytics: l, percentiles: i, configError: a, loading: c } = T(y), p = s(
|
|
69
|
+
() => (o.requireAnalytics ? l.value : !0) && (o.requirePercentiles ? i.value : !0)
|
|
64
70
|
);
|
|
65
|
-
return (
|
|
71
|
+
return (u, v) => !t(c) && t(a) ? d(u.$slots, "error", {
|
|
66
72
|
key: 0,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}) : a(l) ? E("", !0) : v(c.$slots, "fallback", {
|
|
73
|
+
error: t(a)
|
|
74
|
+
}) : !t(c) && p.value ? d(u.$slots, "default", {
|
|
70
75
|
key: 1,
|
|
71
|
-
hasAnalytics:
|
|
72
|
-
hasPercentiles:
|
|
76
|
+
hasAnalytics: t(l),
|
|
77
|
+
hasPercentiles: t(i)
|
|
78
|
+
}) : t(c) ? R("", !0) : d(u.$slots, "fallback", {
|
|
79
|
+
key: 2,
|
|
80
|
+
hasAnalytics: t(l),
|
|
81
|
+
hasPercentiles: t(i)
|
|
73
82
|
});
|
|
74
83
|
}
|
|
75
84
|
});
|
|
76
85
|
export {
|
|
77
|
-
|
|
86
|
+
U as AnalyticsConfigCheck,
|
|
78
87
|
I as useAnalyticsConfigStore
|
|
79
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o["kong-ui-public-vitals-config-store"]={},o.Vue,o.pinia))})(this,function(o,e,p){"use strict";const m="analytics-query-provider",y=p.defineStore("analytics-config",()=>{const r=e.ref(null),i=e.ref(null),d=e.inject(m);d?d.configFn().then(n=>{r.value=n}).catch(n=>{i.value=n,r.value={analytics:null,requests:null},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"),i.value=new Error("No analytics bridge provided"),r.value={analytics:null,requests:null});const a=e.computed(()=>{var t,A;const n=(A=(t=r.value)==null?void 0:t.analytics)==null?void 0:A.retention_ms;return!!n&&n>=2592e6}),c=e.computed(()=>"7d"),s=e.computed(()=>!r.value),l=e.computed(()=>{var n;return!!((n=r.value)!=null&&n.analytics)}),f=e.computed(()=>{var n,t;return!!((t=(n=r.value)==null?void 0:n.analytics)!=null&&t.percentiles)}),u=()=>new Promise(n=>{if(!s.value)return Promise.resolve();const t=e.watch(s,()=>{s.value||(t(),n())})}),E=e.computed(()=>{var n,t;return((t=(n=r.value)==null?void 0:n.ui)==null?void 0:t.maxParallelRequests)??2}),g=e.computed(()=>{var n,t;return((t=(n=r.value)==null?void 0:n.ui)==null?void 0:t.requestInterval)??2e3}),_=e.computed(()=>{var n,t;return((t=(n=r.value)==null?void 0:n.ui)==null?void 0:t.requestIntervalCap)??10});return{analyticsConfig:r,longRetention:a,defaultQueryTimeForOrg:c,loading:s,analytics:l,percentiles:f,maxParallelRequests:E,requestInterval:g,requestIntervalCap:_,isReady:u,configError:i}}),T=e.defineComponent({__name:"AnalyticsConfigCheck",props:{requireAnalytics:{type:Boolean},requirePercentiles:{type:Boolean}},setup(r){const i=r,d=y(),{analytics:a,percentiles:c,configError:s,loading:l}=p.storeToRefs(d),f=e.computed(()=>(i.requireAnalytics?a.value:!0)&&(i.requirePercentiles?c.value:!0));return(u,E)=>!e.unref(l)&&e.unref(s)?e.renderSlot(u.$slots,"error",{key:0,error:e.unref(s)}):!e.unref(l)&&f.value?e.renderSlot(u.$slots,"default",{key:1,hasAnalytics:e.unref(a),hasPercentiles:e.unref(c)}):e.unref(l)?e.createCommentVNode("",!0):e.renderSlot(u.$slots,"fallback",{key:2,hasAnalytics:e.unref(a),hasPercentiles:e.unref(c)})}});o.AnalyticsConfigCheck=T,o.useAnalyticsConfigStore=y,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
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"}
|