@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.
@@ -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
- }, never>>;
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6DlC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAyCd,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;cAuCjC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export default function resetStore({ store }: {
2
+ store: any;
3
+ }): void;
4
+ //# sourceMappingURL=reset-store.d.ts.map
@@ -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 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) => {
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
- }), o = s(() => "7d"), l = s(() => !t.value), c = s(() => {
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
- }), i = s(
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) ?? R;
30
+ return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ?? C;
27
31
  }
28
- ), p = s(
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) ?? T;
35
+ return ((n = (e = t.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ?? P;
32
36
  }
33
- ), v = s(
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) ?? C;
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: o,
43
- loading: l,
44
- analytics: c,
46
+ defaultQueryTimeForOrg: i,
47
+ loading: r,
48
+ analytics: l,
45
49
  percentiles: y,
46
- maxParallelRequests: i,
47
- requestInterval: p,
48
- requestIntervalCap: v
50
+ maxParallelRequests: p,
51
+ requestInterval: f,
52
+ requestIntervalCap: m,
53
+ isReady: c
49
54
  };
50
- }), L = /* @__PURE__ */ A({
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 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)
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 (i, p) => !a(c) && y.value ? f(i.$slots, "default", {
65
+ return (c, p) => !a(l) && y.value ? v(c.$slots, "default", {
61
66
  key: 0,
62
- hasAnalytics: a(o),
63
- hasPercentiles: a(l)
64
- }) : a(c) ? q("", !0) : f(i.$slots, "fallback", {
67
+ hasAnalytics: a(i),
68
+ hasPercentiles: a(r)
69
+ }) : a(l) ? E("", !0) : v(c.$slots, "fallback", {
65
70
  key: 1,
66
- hasAnalytics: a(o),
67
- hasPercentiles: a(l)
71
+ hasAnalytics: a(i),
72
+ hasPercentiles: a(r)
68
73
  });
69
74
  }
70
75
  });
71
76
  export {
72
- L as AnalyticsConfigCheck,
73
- S as useAnalyticsConfigStore
77
+ k as AnalyticsConfigCheck,
78
+ I as useAnalyticsConfigStore
74
79
  };
@@ -1 +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"})});
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.2603.ce4ebb0cd.0",
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.4-pr.2603.ce4ebb0cd.0"
26
+ "@kong-ui-public/analytics-utilities": "^12.1.3"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",