@kong-ui-public/analytics-config-store 1.1.18-pr.2582.06c0bb66d.0 → 1.1.18

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.
@@ -0,0 +1,25 @@
1
+ type __VLS_Props = {
2
+ requireAnalytics?: boolean;
3
+ requirePercentiles?: boolean;
4
+ };
5
+ declare var __VLS_1: {
6
+ hasAnalytics: boolean;
7
+ hasPercentiles: boolean;
8
+ }, __VLS_3: {
9
+ hasAnalytics: boolean;
10
+ hasPercentiles: boolean;
11
+ };
12
+ type __VLS_Slots = {} & {
13
+ default?: (props: typeof __VLS_1) => any;
14
+ } & {
15
+ fallback?: (props: typeof __VLS_3) => any;
16
+ };
17
+ 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
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
25
+ //# sourceMappingURL=AnalyticsConfigCheck.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsConfigCheck.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AnalyticsConfigCheck.vue"],"names":[],"mappings":"AAsCA,KAAK,WAAW,GAAG;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAC;AA0CF,QAAA,IAAI,OAAO;;;CAAU,EAAE,OAAO;;;CAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;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;AAqBhD,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"}
@@ -0,0 +1,5 @@
1
+ export declare const THIRTY_DAYS_MS = 2592000000;
2
+ export declare const DEFAULT_MAX_PARALLEL_REQUESTS = 2;
3
+ export declare const DEFAULT_REQUEST_INTERVAL = 2000;
4
+ export declare const DEFAULT_REQUEST_INTERVAL_CAP = 10;
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,aAAa,CAAA;AAExC,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAC5C,eAAO,MAAM,4BAA4B,KAAK,CAAA"}
@@ -0,0 +1,4 @@
1
+ import AnalyticsConfigCheck from './components/AnalyticsConfigCheck.vue';
2
+ export { AnalyticsConfigCheck };
3
+ export * from './stores';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,uCAAuC,CAAA;AAExE,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAC/B,cAAc,UAAU,CAAA"}
@@ -0,0 +1,112 @@
1
+ import type { AnalyticsConfigV2 } from '@kong-ui-public/analytics-utilities';
2
+ export type ConfigStoreState = null | AnalyticsConfigV2;
3
+ export declare const useAnalyticsConfigStore: import("pinia").StoreDefinition<"analytics-config", import("pinia")._UnwrapAll<Pick<{
4
+ analyticsConfig: import("vue").Ref<{
5
+ analytics: {
6
+ percentiles: boolean;
7
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
8
+ } | null;
9
+ requests: {
10
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
11
+ } | null;
12
+ ui?: {
13
+ maxParallelRequests?: number | undefined;
14
+ requestInterval?: number | undefined;
15
+ requestIntervalCap?: number | undefined;
16
+ } | undefined;
17
+ } | null, ConfigStoreState | {
18
+ analytics: {
19
+ percentiles: boolean;
20
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
21
+ } | null;
22
+ requests: {
23
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
24
+ } | null;
25
+ ui?: {
26
+ maxParallelRequests?: number | undefined;
27
+ requestInterval?: number | undefined;
28
+ requestIntervalCap?: number | undefined;
29
+ } | undefined;
30
+ }>;
31
+ longRetention: import("vue").ComputedRef<boolean>;
32
+ defaultQueryTimeForOrg: import("vue").ComputedRef<"7d">;
33
+ loading: import("vue").ComputedRef<boolean>;
34
+ analytics: import("vue").ComputedRef<boolean>;
35
+ percentiles: import("vue").ComputedRef<boolean>;
36
+ maxParallelRequests: import("vue").ComputedRef<number>;
37
+ requestInterval: import("vue").ComputedRef<number>;
38
+ requestIntervalCap: import("vue").ComputedRef<number>;
39
+ }, "analyticsConfig">>, Pick<{
40
+ analyticsConfig: import("vue").Ref<{
41
+ analytics: {
42
+ percentiles: boolean;
43
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
44
+ } | null;
45
+ requests: {
46
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
47
+ } | null;
48
+ ui?: {
49
+ maxParallelRequests?: number | undefined;
50
+ requestInterval?: number | undefined;
51
+ requestIntervalCap?: number | undefined;
52
+ } | undefined;
53
+ } | null, ConfigStoreState | {
54
+ analytics: {
55
+ percentiles: boolean;
56
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
57
+ } | null;
58
+ requests: {
59
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
60
+ } | null;
61
+ ui?: {
62
+ maxParallelRequests?: number | undefined;
63
+ requestInterval?: number | undefined;
64
+ requestIntervalCap?: number | undefined;
65
+ } | undefined;
66
+ }>;
67
+ longRetention: import("vue").ComputedRef<boolean>;
68
+ defaultQueryTimeForOrg: import("vue").ComputedRef<"7d">;
69
+ loading: import("vue").ComputedRef<boolean>;
70
+ analytics: import("vue").ComputedRef<boolean>;
71
+ percentiles: import("vue").ComputedRef<boolean>;
72
+ maxParallelRequests: import("vue").ComputedRef<number>;
73
+ requestInterval: import("vue").ComputedRef<number>;
74
+ requestIntervalCap: import("vue").ComputedRef<number>;
75
+ }, "analytics" | "percentiles" | "maxParallelRequests" | "requestInterval" | "requestIntervalCap" | "longRetention" | "defaultQueryTimeForOrg" | "loading">, Pick<{
76
+ analyticsConfig: import("vue").Ref<{
77
+ analytics: {
78
+ percentiles: boolean;
79
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
80
+ } | null;
81
+ requests: {
82
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
83
+ } | null;
84
+ ui?: {
85
+ maxParallelRequests?: number | undefined;
86
+ requestInterval?: number | undefined;
87
+ requestIntervalCap?: number | undefined;
88
+ } | undefined;
89
+ } | null, ConfigStoreState | {
90
+ analytics: {
91
+ percentiles: boolean;
92
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
93
+ } | null;
94
+ requests: {
95
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
96
+ } | null;
97
+ ui?: {
98
+ maxParallelRequests?: number | undefined;
99
+ requestInterval?: number | undefined;
100
+ requestIntervalCap?: number | undefined;
101
+ } | undefined;
102
+ }>;
103
+ longRetention: import("vue").ComputedRef<boolean>;
104
+ defaultQueryTimeForOrg: import("vue").ComputedRef<"7d">;
105
+ loading: import("vue").ComputedRef<boolean>;
106
+ analytics: import("vue").ComputedRef<boolean>;
107
+ percentiles: import("vue").ComputedRef<boolean>;
108
+ maxParallelRequests: import("vue").ComputedRef<number>;
109
+ requestInterval: import("vue").ComputedRef<number>;
110
+ requestIntervalCap: import("vue").ComputedRef<number>;
111
+ }, never>>;
112
+ //# sourceMappingURL=analytics-config.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6DlC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './analytics-config';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stores/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,74 @@
1
+ import { ref as g, inject as m, computed as s, defineComponent as A, renderSlot as f, createCommentVNode as q, unref as a } from "vue";
2
+ import { defineStore as E, storeToRefs as h } from "pinia";
3
+ const _ = 2592e6, R = 2, T = 2e3, C = 10, P = "analytics-query-provider", S = E("analytics-config", () => {
4
+ const t = g(null), r = m(P);
5
+ r ? r.configFn().then((e) => {
6
+ t.value = e;
7
+ }).catch((e) => {
8
+ console.warn("Error fetching analytics config"), console.warn(e);
9
+ }) : (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"), t.value = {
10
+ analytics: null,
11
+ requests: null
12
+ });
13
+ const u = s(() => {
14
+ var n, d;
15
+ const e = (d = (n = t.value) == null ? void 0 : n.analytics) == null ? void 0 : d.retention_ms;
16
+ return !!e && e >= _;
17
+ }), o = s(() => "7d"), l = s(() => !t.value), c = s(() => {
18
+ var e;
19
+ return !!((e = t.value) != null && e.analytics);
20
+ }), y = s(() => {
21
+ var e, n;
22
+ return !!((n = (e = t.value) == null ? void 0 : e.analytics) != null && n.percentiles);
23
+ }), i = s(
24
+ () => {
25
+ var e, n;
26
+ return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ?? R;
27
+ }
28
+ ), p = s(
29
+ () => {
30
+ var e, n;
31
+ return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ?? T;
32
+ }
33
+ ), v = s(
34
+ () => {
35
+ var e, n;
36
+ return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestIntervalCap) ?? C;
37
+ }
38
+ );
39
+ return {
40
+ analyticsConfig: t,
41
+ longRetention: u,
42
+ defaultQueryTimeForOrg: o,
43
+ loading: l,
44
+ analytics: c,
45
+ percentiles: y,
46
+ maxParallelRequests: i,
47
+ requestInterval: p,
48
+ requestIntervalCap: v
49
+ };
50
+ }), L = /* @__PURE__ */ A({
51
+ __name: "AnalyticsConfigCheck",
52
+ props: {
53
+ requireAnalytics: { type: Boolean },
54
+ requirePercentiles: { type: Boolean }
55
+ },
56
+ setup(t) {
57
+ const r = t, u = S(), { analytics: o, percentiles: l, loading: c } = h(u), y = s(
58
+ () => (r.requireAnalytics ? o.value : !0) && (r.requirePercentiles ? l.value : !0)
59
+ );
60
+ return (i, p) => !a(c) && y.value ? f(i.$slots, "default", {
61
+ key: 0,
62
+ hasAnalytics: a(o),
63
+ hasPercentiles: a(l)
64
+ }) : a(c) ? q("", !0) : f(i.$slots, "fallback", {
65
+ key: 1,
66
+ hasAnalytics: a(o),
67
+ hasPercentiles: a(l)
68
+ });
69
+ }
70
+ });
71
+ export {
72
+ L as AnalyticsConfigCheck,
73
+ S as useAnalyticsConfigStore
74
+ };
@@ -0,0 +1 @@
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 E="analytics-query-provider",f=p.defineStore("analytics-config",()=>{const s=e.ref(null),r=e.inject(E);r?r.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}),i=e.computed(()=>"7d"),a=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=e.computed(()=>{var n,t;return((t=(n=s.value)==null?void 0:n.ui)==null?void 0:t.maxParallelRequests)??2}),y=e.computed(()=>{var n,t;return((t=(n=s.value)==null?void 0:n.ui)==null?void 0:t.requestInterval)??2e3}),T=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:i,loading:a,analytics:c,percentiles:d,maxParallelRequests:l,requestInterval:y,requestIntervalCap:T}}),m=e.defineComponent({__name:"AnalyticsConfigCheck",props:{requireAnalytics:{type:Boolean},requirePercentiles:{type:Boolean}},setup(s){const r=s,u=f(),{analytics:i,percentiles:a,loading:c}=p.storeToRefs(u),d=e.computed(()=>(r.requireAnalytics?i.value:!0)&&(r.requirePercentiles?a.value:!0));return(l,y)=>!e.unref(c)&&d.value?e.renderSlot(l.$slots,"default",{key:0,hasAnalytics:e.unref(i),hasPercentiles:e.unref(a)}):e.unref(c)?e.createCommentVNode("",!0):e.renderSlot(l.$slots,"fallback",{key:1,hasAnalytics:e.unref(i),hasPercentiles:e.unref(a)})}});o.AnalyticsConfigCheck=m,o.useAnalyticsConfigStore=f,Object.defineProperty(o,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.18-pr.2582.06c0bb66d.0",
3
+ "version": "1.1.18",
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.13",
26
- "@kong-ui-public/analytics-utilities": "^12.1.1-pr.2582.06c0bb66d.0"
26
+ "@kong-ui-public/analytics-utilities": "^12.1.1"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",