@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.
@@ -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
- }, __VLS_3: {
10
+ }, __VLS_5: {
9
11
  hasAnalytics: boolean;
10
12
  hasPercentiles: boolean;
11
13
  };
12
14
  type __VLS_Slots = {} & {
13
- default?: (props: typeof __VLS_1) => any;
15
+ error?: (props: typeof __VLS_1) => any;
16
+ } & {
17
+ default?: (props: typeof __VLS_3) => any;
14
18
  } & {
15
- fallback?: (props: typeof __VLS_3) => any;
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":"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"}
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
- }, "analyticsConfig">>, Pick<{
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAyCd,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;cAuCjC,CAAA"}
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":"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
+ {"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 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
- t.value = e;
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
- 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 = {
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 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 >= T;
17
- }), i = s(() => "7d"), r = s(() => !t.value), l = s(() => {
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 = t.value) != null && e.analytics);
20
- }), y = s(() => {
22
+ return !!((e = r.value) != null && e.analytics);
23
+ }), p = s(() => {
21
24
  var e, n;
22
- return !!((n = (e = t.value) == null ? void 0 : e.analytics) != null && n.percentiles);
23
- }), c = () => r.value ? new Promise((e) => {
24
- const n = A(r, () => {
25
- r.value || (n(), e());
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
- }) : Promise.resolve(), p = s(
32
+ }), v = s(
28
33
  () => {
29
34
  var e, n;
30
- return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ?? C;
35
+ return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ?? P;
31
36
  }
32
- ), f = s(
37
+ ), m = s(
33
38
  () => {
34
39
  var e, n;
35
- return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ?? P;
40
+ return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ?? b;
36
41
  }
37
- ), m = s(
42
+ ), E = s(
38
43
  () => {
39
44
  var e, n;
40
- return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestIntervalCap) ?? S;
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: t,
45
- longRetention: u,
49
+ analyticsConfig: r,
50
+ longRetention: l,
46
51
  defaultQueryTimeForOrg: i,
47
- loading: r,
48
- analytics: l,
49
- percentiles: y,
50
- maxParallelRequests: p,
51
- requestInterval: f,
52
- requestIntervalCap: m,
53
- isReady: c
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
- }), k = /* @__PURE__ */ q({
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(t) {
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)
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 (c, p) => !a(l) && y.value ? v(c.$slots, "default", {
71
+ return (u, v) => !t(c) && t(a) ? d(u.$slots, "error", {
66
72
  key: 0,
67
- hasAnalytics: a(i),
68
- hasPercentiles: a(r)
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: a(i),
72
- hasPercentiles: a(r)
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
- k as AnalyticsConfigCheck,
86
+ U as AnalyticsConfigCheck,
78
87
  I as useAnalyticsConfigStore
79
88
  };
@@ -1 +1 @@
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"})});
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/analytics-config-store",
3
- "version": "1.1.21-pr.2628.8623a6e01.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/vitals-config-store.umd.js",
6
6
  "module": "./dist/vitals-config-store.es.js",
@@ -1,4 +0,0 @@
1
- export default function resetStore({ store }: {
2
- store: any;
3
- }): void;
4
- //# sourceMappingURL=reset-store.d.ts.map
@@ -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"}