@kong-ui-public/analytics-config-store 1.4.2-pr.3496.e7e265510.0 → 1.4.2

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,30 @@
1
+ type __VLS_Props = {
2
+ requireAnalytics?: boolean;
3
+ requirePercentiles?: boolean;
4
+ };
5
+ declare var __VLS_1: {
6
+ error: Error;
7
+ }, __VLS_3: {
8
+ hasAnalytics: boolean;
9
+ hasPercentiles: boolean;
10
+ }, __VLS_5: {
11
+ hasAnalytics: boolean;
12
+ hasPercentiles: boolean;
13
+ };
14
+ type __VLS_Slots = {} & {
15
+ error?: (props: typeof __VLS_1) => any;
16
+ } & {
17
+ default?: (props: typeof __VLS_3) => any;
18
+ } & {
19
+ fallback?: (props: typeof __VLS_5) => any;
20
+ };
21
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
25
+ type __VLS_WithSlots<T, S> = T & {
26
+ new (): {
27
+ $slots: S;
28
+ };
29
+ };
30
+ //# 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":"AA4CA,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;AAGhD,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,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,118 @@
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", 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
+ isReady: () => Promise<void>;
40
+ configError: import("vue").Ref<Error | null, Error | null>;
41
+ }, "analyticsConfig" | "configError">, Pick<{
42
+ analyticsConfig: import("vue").Ref<{
43
+ analytics: {
44
+ percentiles: boolean;
45
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
46
+ } | null;
47
+ requests: {
48
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
49
+ } | null;
50
+ ui?: {
51
+ maxParallelRequests?: number | undefined;
52
+ requestInterval?: number | undefined;
53
+ requestIntervalCap?: number | undefined;
54
+ } | undefined;
55
+ } | null, ConfigStoreState | {
56
+ analytics: {
57
+ percentiles: boolean;
58
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
59
+ } | null;
60
+ requests: {
61
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
62
+ } | null;
63
+ ui?: {
64
+ maxParallelRequests?: number | undefined;
65
+ requestInterval?: number | undefined;
66
+ requestIntervalCap?: number | undefined;
67
+ } | undefined;
68
+ }>;
69
+ longRetention: import("vue").ComputedRef<boolean>;
70
+ defaultQueryTimeForOrg: import("vue").ComputedRef<"7d">;
71
+ loading: import("vue").ComputedRef<boolean>;
72
+ analytics: import("vue").ComputedRef<boolean>;
73
+ percentiles: import("vue").ComputedRef<boolean>;
74
+ maxParallelRequests: import("vue").ComputedRef<number>;
75
+ requestInterval: import("vue").ComputedRef<number>;
76
+ requestIntervalCap: import("vue").ComputedRef<number>;
77
+ isReady: () => Promise<void>;
78
+ configError: import("vue").Ref<Error | null, Error | null>;
79
+ }, "analytics" | "percentiles" | "maxParallelRequests" | "requestInterval" | "requestIntervalCap" | "longRetention" | "defaultQueryTimeForOrg" | "loading">, Pick<{
80
+ analyticsConfig: import("vue").Ref<{
81
+ analytics: {
82
+ percentiles: boolean;
83
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
84
+ } | null;
85
+ requests: {
86
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
87
+ } | null;
88
+ ui?: {
89
+ maxParallelRequests?: number | undefined;
90
+ requestInterval?: number | undefined;
91
+ requestIntervalCap?: number | undefined;
92
+ } | undefined;
93
+ } | null, ConfigStoreState | {
94
+ analytics: {
95
+ percentiles: boolean;
96
+ retention_ms: import("@kong-ui-public/analytics-utilities").AnalyticsRetentionMs;
97
+ } | null;
98
+ requests: {
99
+ retention_ms: import("@kong-ui-public/analytics-utilities").RequestsRetentionMs;
100
+ } | null;
101
+ ui?: {
102
+ maxParallelRequests?: number | undefined;
103
+ requestInterval?: number | undefined;
104
+ requestIntervalCap?: number | undefined;
105
+ } | undefined;
106
+ }>;
107
+ longRetention: import("vue").ComputedRef<boolean>;
108
+ defaultQueryTimeForOrg: import("vue").ComputedRef<"7d">;
109
+ loading: import("vue").ComputedRef<boolean>;
110
+ analytics: import("vue").ComputedRef<boolean>;
111
+ percentiles: import("vue").ComputedRef<boolean>;
112
+ maxParallelRequests: import("vue").ComputedRef<number>;
113
+ requestInterval: import("vue").ComputedRef<number>;
114
+ requestIntervalCap: import("vue").ComputedRef<number>;
115
+ isReady: () => Promise<void>;
116
+ configError: import("vue").Ref<Error | null, Error | null>;
117
+ }, "isReady">>;
118
+ //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAgDd,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAb,OAAO,CAAC,IAAI,CAAC;;cAwCjC,CAAA"}
@@ -0,0 +1,330 @@
1
+ import type { AllFilters, DatasourceConfig, Field } from '@kong-ui-public/analytics-utilities';
2
+ export type MappedDatasourceConfig = DatasourceConfig & {
3
+ fieldsMap: Record<string, Field>;
4
+ };
5
+ export declare const useDatasourceConfigStore: import("pinia").StoreDefinition<"datasource-config", Pick<{
6
+ datasourceConfig: import("vue").Ref<{
7
+ name: string;
8
+ showInUI: boolean;
9
+ fields: {
10
+ name: string;
11
+ showInUI: boolean;
12
+ aggregation: boolean;
13
+ group: boolean;
14
+ filter?: {
15
+ valueSource: "ksearch";
16
+ ksearchName: string;
17
+ valueType: string;
18
+ operators: {
19
+ type: "multi-value" | "single-value" | "no-value";
20
+ ops: string[];
21
+ }[];
22
+ preSeededValues?: string[] | undefined;
23
+ allowNewValues?: boolean | undefined;
24
+ valuesNeedTranslation?: boolean | undefined;
25
+ } | {
26
+ valueType: "string";
27
+ operators: {
28
+ type: "multi-value" | "single-value" | "no-value";
29
+ ops: string[];
30
+ }[];
31
+ preSeededValues?: string[] | undefined;
32
+ allowNewValues?: boolean | undefined;
33
+ valuesNeedTranslation?: boolean | undefined;
34
+ } | {
35
+ valueType: "number";
36
+ operators: {
37
+ type: "multi-value" | "single-value" | "no-value";
38
+ ops: string[];
39
+ }[];
40
+ preSeededValues?: string[] | undefined;
41
+ allowNewValues?: boolean | undefined;
42
+ valuesNeedTranslation?: boolean | undefined;
43
+ } | null | undefined;
44
+ metricGroup?: string | undefined;
45
+ supportedDimensions?: string[] | undefined;
46
+ entityAttributes?: string[] | undefined;
47
+ }[];
48
+ timeRangeOptions: string[];
49
+ granularityOptions?: string[] | undefined;
50
+ defaultMetric?: string | undefined;
51
+ }[] | undefined, DatasourceConfig[] | {
52
+ name: string;
53
+ showInUI: boolean;
54
+ fields: {
55
+ name: string;
56
+ showInUI: boolean;
57
+ aggregation: boolean;
58
+ group: boolean;
59
+ filter?: {
60
+ valueSource: "ksearch";
61
+ ksearchName: string;
62
+ valueType: string;
63
+ operators: {
64
+ type: "multi-value" | "single-value" | "no-value";
65
+ ops: string[];
66
+ }[];
67
+ preSeededValues?: string[] | undefined;
68
+ allowNewValues?: boolean | undefined;
69
+ valuesNeedTranslation?: boolean | undefined;
70
+ } | {
71
+ valueType: "string";
72
+ operators: {
73
+ type: "multi-value" | "single-value" | "no-value";
74
+ ops: string[];
75
+ }[];
76
+ preSeededValues?: string[] | undefined;
77
+ allowNewValues?: boolean | undefined;
78
+ valuesNeedTranslation?: boolean | undefined;
79
+ } | {
80
+ valueType: "number";
81
+ operators: {
82
+ type: "multi-value" | "single-value" | "no-value";
83
+ ops: string[];
84
+ }[];
85
+ preSeededValues?: string[] | undefined;
86
+ allowNewValues?: boolean | undefined;
87
+ valuesNeedTranslation?: boolean | undefined;
88
+ } | null | undefined;
89
+ metricGroup?: string | undefined;
90
+ supportedDimensions?: string[] | undefined;
91
+ entityAttributes?: string[] | undefined;
92
+ }[];
93
+ timeRangeOptions: string[];
94
+ granularityOptions?: string[] | undefined;
95
+ defaultMetric?: string | undefined;
96
+ }[] | undefined>;
97
+ datasourceConfigError: import("vue").Ref<Error | null, Error | null>;
98
+ datasourceConfigMap: import("vue").ComputedRef<Record<string, MappedDatasourceConfig>>;
99
+ getFieldDataSources: import("vue").ComputedRef<(fieldName: string) => string[]>;
100
+ isFilterValidForDatasource: import("vue").ComputedRef<({ datasource, filter, }: {
101
+ datasource: string;
102
+ filter: AllFilters;
103
+ }) => boolean>;
104
+ loading: import("vue").ComputedRef<boolean>;
105
+ isReady: () => Promise<void>;
106
+ stripUnknownFilters: import("vue").ComputedRef<({ datasource, filters, queryFields, metrics, }: {
107
+ datasource: string;
108
+ filters: AllFilters[];
109
+ queryFields?: readonly string[];
110
+ /** @deprecated Use queryFields instead. */
111
+ metrics?: readonly string[];
112
+ }) => AllFilters[]>;
113
+ }, "datasourceConfig" | "datasourceConfigError">, Pick<{
114
+ datasourceConfig: import("vue").Ref<{
115
+ name: string;
116
+ showInUI: boolean;
117
+ fields: {
118
+ name: string;
119
+ showInUI: boolean;
120
+ aggregation: boolean;
121
+ group: boolean;
122
+ filter?: {
123
+ valueSource: "ksearch";
124
+ ksearchName: string;
125
+ valueType: string;
126
+ operators: {
127
+ type: "multi-value" | "single-value" | "no-value";
128
+ ops: string[];
129
+ }[];
130
+ preSeededValues?: string[] | undefined;
131
+ allowNewValues?: boolean | undefined;
132
+ valuesNeedTranslation?: boolean | undefined;
133
+ } | {
134
+ valueType: "string";
135
+ operators: {
136
+ type: "multi-value" | "single-value" | "no-value";
137
+ ops: string[];
138
+ }[];
139
+ preSeededValues?: string[] | undefined;
140
+ allowNewValues?: boolean | undefined;
141
+ valuesNeedTranslation?: boolean | undefined;
142
+ } | {
143
+ valueType: "number";
144
+ operators: {
145
+ type: "multi-value" | "single-value" | "no-value";
146
+ ops: string[];
147
+ }[];
148
+ preSeededValues?: string[] | undefined;
149
+ allowNewValues?: boolean | undefined;
150
+ valuesNeedTranslation?: boolean | undefined;
151
+ } | null | undefined;
152
+ metricGroup?: string | undefined;
153
+ supportedDimensions?: string[] | undefined;
154
+ entityAttributes?: string[] | undefined;
155
+ }[];
156
+ timeRangeOptions: string[];
157
+ granularityOptions?: string[] | undefined;
158
+ defaultMetric?: string | undefined;
159
+ }[] | undefined, DatasourceConfig[] | {
160
+ name: string;
161
+ showInUI: boolean;
162
+ fields: {
163
+ name: string;
164
+ showInUI: boolean;
165
+ aggregation: boolean;
166
+ group: boolean;
167
+ filter?: {
168
+ valueSource: "ksearch";
169
+ ksearchName: string;
170
+ valueType: string;
171
+ operators: {
172
+ type: "multi-value" | "single-value" | "no-value";
173
+ ops: string[];
174
+ }[];
175
+ preSeededValues?: string[] | undefined;
176
+ allowNewValues?: boolean | undefined;
177
+ valuesNeedTranslation?: boolean | undefined;
178
+ } | {
179
+ valueType: "string";
180
+ operators: {
181
+ type: "multi-value" | "single-value" | "no-value";
182
+ ops: string[];
183
+ }[];
184
+ preSeededValues?: string[] | undefined;
185
+ allowNewValues?: boolean | undefined;
186
+ valuesNeedTranslation?: boolean | undefined;
187
+ } | {
188
+ valueType: "number";
189
+ operators: {
190
+ type: "multi-value" | "single-value" | "no-value";
191
+ ops: string[];
192
+ }[];
193
+ preSeededValues?: string[] | undefined;
194
+ allowNewValues?: boolean | undefined;
195
+ valuesNeedTranslation?: boolean | undefined;
196
+ } | null | undefined;
197
+ metricGroup?: string | undefined;
198
+ supportedDimensions?: string[] | undefined;
199
+ entityAttributes?: string[] | undefined;
200
+ }[];
201
+ timeRangeOptions: string[];
202
+ granularityOptions?: string[] | undefined;
203
+ defaultMetric?: string | undefined;
204
+ }[] | undefined>;
205
+ datasourceConfigError: import("vue").Ref<Error | null, Error | null>;
206
+ datasourceConfigMap: import("vue").ComputedRef<Record<string, MappedDatasourceConfig>>;
207
+ getFieldDataSources: import("vue").ComputedRef<(fieldName: string) => string[]>;
208
+ isFilterValidForDatasource: import("vue").ComputedRef<({ datasource, filter, }: {
209
+ datasource: string;
210
+ filter: AllFilters;
211
+ }) => boolean>;
212
+ loading: import("vue").ComputedRef<boolean>;
213
+ isReady: () => Promise<void>;
214
+ stripUnknownFilters: import("vue").ComputedRef<({ datasource, filters, queryFields, metrics, }: {
215
+ datasource: string;
216
+ filters: AllFilters[];
217
+ queryFields?: readonly string[];
218
+ /** @deprecated Use queryFields instead. */
219
+ metrics?: readonly string[];
220
+ }) => AllFilters[]>;
221
+ }, "loading" | "datasourceConfigMap" | "getFieldDataSources" | "isFilterValidForDatasource" | "stripUnknownFilters">, Pick<{
222
+ datasourceConfig: import("vue").Ref<{
223
+ name: string;
224
+ showInUI: boolean;
225
+ fields: {
226
+ name: string;
227
+ showInUI: boolean;
228
+ aggregation: boolean;
229
+ group: boolean;
230
+ filter?: {
231
+ valueSource: "ksearch";
232
+ ksearchName: string;
233
+ valueType: string;
234
+ operators: {
235
+ type: "multi-value" | "single-value" | "no-value";
236
+ ops: string[];
237
+ }[];
238
+ preSeededValues?: string[] | undefined;
239
+ allowNewValues?: boolean | undefined;
240
+ valuesNeedTranslation?: boolean | undefined;
241
+ } | {
242
+ valueType: "string";
243
+ operators: {
244
+ type: "multi-value" | "single-value" | "no-value";
245
+ ops: string[];
246
+ }[];
247
+ preSeededValues?: string[] | undefined;
248
+ allowNewValues?: boolean | undefined;
249
+ valuesNeedTranslation?: boolean | undefined;
250
+ } | {
251
+ valueType: "number";
252
+ operators: {
253
+ type: "multi-value" | "single-value" | "no-value";
254
+ ops: string[];
255
+ }[];
256
+ preSeededValues?: string[] | undefined;
257
+ allowNewValues?: boolean | undefined;
258
+ valuesNeedTranslation?: boolean | undefined;
259
+ } | null | undefined;
260
+ metricGroup?: string | undefined;
261
+ supportedDimensions?: string[] | undefined;
262
+ entityAttributes?: string[] | undefined;
263
+ }[];
264
+ timeRangeOptions: string[];
265
+ granularityOptions?: string[] | undefined;
266
+ defaultMetric?: string | undefined;
267
+ }[] | undefined, DatasourceConfig[] | {
268
+ name: string;
269
+ showInUI: boolean;
270
+ fields: {
271
+ name: string;
272
+ showInUI: boolean;
273
+ aggregation: boolean;
274
+ group: boolean;
275
+ filter?: {
276
+ valueSource: "ksearch";
277
+ ksearchName: string;
278
+ valueType: string;
279
+ operators: {
280
+ type: "multi-value" | "single-value" | "no-value";
281
+ ops: string[];
282
+ }[];
283
+ preSeededValues?: string[] | undefined;
284
+ allowNewValues?: boolean | undefined;
285
+ valuesNeedTranslation?: boolean | undefined;
286
+ } | {
287
+ valueType: "string";
288
+ operators: {
289
+ type: "multi-value" | "single-value" | "no-value";
290
+ ops: string[];
291
+ }[];
292
+ preSeededValues?: string[] | undefined;
293
+ allowNewValues?: boolean | undefined;
294
+ valuesNeedTranslation?: boolean | undefined;
295
+ } | {
296
+ valueType: "number";
297
+ operators: {
298
+ type: "multi-value" | "single-value" | "no-value";
299
+ ops: string[];
300
+ }[];
301
+ preSeededValues?: string[] | undefined;
302
+ allowNewValues?: boolean | undefined;
303
+ valuesNeedTranslation?: boolean | undefined;
304
+ } | null | undefined;
305
+ metricGroup?: string | undefined;
306
+ supportedDimensions?: string[] | undefined;
307
+ entityAttributes?: string[] | undefined;
308
+ }[];
309
+ timeRangeOptions: string[];
310
+ granularityOptions?: string[] | undefined;
311
+ defaultMetric?: string | undefined;
312
+ }[] | undefined>;
313
+ datasourceConfigError: import("vue").Ref<Error | null, Error | null>;
314
+ datasourceConfigMap: import("vue").ComputedRef<Record<string, MappedDatasourceConfig>>;
315
+ getFieldDataSources: import("vue").ComputedRef<(fieldName: string) => string[]>;
316
+ isFilterValidForDatasource: import("vue").ComputedRef<({ datasource, filter, }: {
317
+ datasource: string;
318
+ filter: AllFilters;
319
+ }) => boolean>;
320
+ loading: import("vue").ComputedRef<boolean>;
321
+ isReady: () => Promise<void>;
322
+ stripUnknownFilters: import("vue").ComputedRef<({ datasource, filters, queryFields, metrics, }: {
323
+ datasource: string;
324
+ filters: AllFilters[];
325
+ queryFields?: readonly string[];
326
+ /** @deprecated Use queryFields instead. */
327
+ metrics?: readonly string[];
328
+ }) => AllFilters[]>;
329
+ }, "isReady">>;
330
+ //# sourceMappingURL=datasource-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datasource-config.d.ts","sourceRoot":"","sources":["../../../src/stores/datasource-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAmB,gBAAgB,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAI/G,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACtD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA0Dd,MAAM,KAAG,MAAM,EAAE;oFAejC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,EAAE,UAAU,CAAA;KACnB,KAAG,OAAO;;mBAlDa,OAAO,CAAC,IAAI,CAAC;oGAgFlC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QAC/B,2CAA2C;QAC3C,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAC5B,KAAG,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAtDG,MAAM,KAAG,MAAM,EAAE;oFAejC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,EAAE,UAAU,CAAA;KACnB,KAAG,OAAO;;mBAlDa,OAAO,CAAC,IAAI,CAAC;oGAgFlC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QAC/B,2CAA2C;QAC3C,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAC5B,KAAG,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAtDG,MAAM,KAAG,MAAM,EAAE;oFAejC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,EAAE,UAAU,CAAA;KACnB,KAAG,OAAO;;mBAlDa,OAAO,CAAC,IAAI,CAAC;oGAgFlC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QAC/B,2CAA2C;QAC3C,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAC5B,KAAG,UAAU,EAAE;cA+ClB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './analytics-config';
2
+ export * from './datasource-config';
3
+ //# 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;AAClC,cAAc,qBAAqB,CAAA"}
@@ -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":"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"}
@@ -0,0 +1,131 @@
1
+ import { ref as m, inject as C, computed as o, watch as R, defineComponent as D, unref as d, renderSlot as h, createCommentVNode as S } from "vue";
2
+ import { defineStore as b, storeToRefs as T } from "pinia";
3
+ const P = 2592e6, F = 2, k = 2e3, I = 10, M = "analytics-query-provider", U = b("analytics-config", () => {
4
+ const e = m(null), u = m(null), p = C(M);
5
+ p ? p.configFn().then((r) => {
6
+ e.value = r;
7
+ }).catch((r) => {
8
+ u.value = r, e.value = {
9
+ analytics: null,
10
+ requests: null
11
+ }, console.warn("Error fetching analytics config"), console.warn(r);
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"), u.value = new Error("No analytics bridge provided"), e.value = {
13
+ analytics: null,
14
+ requests: null
15
+ });
16
+ const i = o(() => {
17
+ const r = e.value?.analytics?.retention_ms;
18
+ return !!r && r >= P;
19
+ }), f = o(() => "7d"), l = o(() => !e.value), y = o(() => !!e.value?.analytics), g = o(() => !!e.value?.analytics?.percentiles), v = () => new Promise((r) => {
20
+ if (!l.value)
21
+ return r();
22
+ const c = R(l, () => {
23
+ l.value || (c(), r());
24
+ });
25
+ }), n = o(
26
+ () => e.value?.ui?.maxParallelRequests ?? F
27
+ ), t = o(
28
+ () => e.value?.ui?.requestInterval ?? k
29
+ ), a = o(
30
+ () => e.value?.ui?.requestIntervalCap ?? I
31
+ );
32
+ return {
33
+ analyticsConfig: e,
34
+ longRetention: i,
35
+ defaultQueryTimeForOrg: f,
36
+ loading: l,
37
+ analytics: y,
38
+ percentiles: g,
39
+ maxParallelRequests: n,
40
+ requestInterval: t,
41
+ requestIntervalCap: a,
42
+ isReady: v,
43
+ configError: u
44
+ };
45
+ }), L = "analytics-query-provider", Y = b("datasource-config", () => {
46
+ const e = m(void 0), u = m(null), p = C(L);
47
+ p ? p.datasourceConfigFn().then((n) => {
48
+ e.value = n;
49
+ }).catch((n) => {
50
+ u.value = n, e.value = [], console.warn("Error fetching datasource config"), console.warn(n);
51
+ }) : (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"), u.value = new Error("No analytics bridge provided"), e.value = []);
52
+ const i = o(() => e.value === void 0), f = async () => new Promise((n) => {
53
+ if (!i.value)
54
+ return n();
55
+ const t = R(() => i.value, (a) => {
56
+ a || (t(), n());
57
+ });
58
+ }), l = o(() => (e.value ?? []).reduce((n, t) => {
59
+ const a = t.fields.reduce((r, c) => (r[c.name] = c, r), {});
60
+ return n[t.name] = {
61
+ ...t,
62
+ fieldsMap: a
63
+ }, n;
64
+ }, {})), y = o(() => (n) => i.value ? [] : (e.value ?? []).filter((t) => t.fields.some((a) => a.name === n)).map((t) => t.name)), g = o(() => ({
65
+ datasource: n,
66
+ filter: t
67
+ }) => {
68
+ if (i.value)
69
+ return !0;
70
+ const a = l.value[n];
71
+ if (!a)
72
+ return !0;
73
+ const r = a.fieldsMap[t.field];
74
+ return r?.filter ? r.filter.operators.flatMap((c) => c.ops).includes(t.operator) : !1;
75
+ }), v = o(() => ({
76
+ datasource: n,
77
+ filters: t,
78
+ queryFields: a = void 0,
79
+ metrics: r = void 0
80
+ }) => {
81
+ const c = t.filter((s) => g.value({ datasource: n, filter: s })), E = a ?? r;
82
+ if (!E?.length)
83
+ return c;
84
+ const q = l.value[n];
85
+ if (!q)
86
+ return c;
87
+ const A = E.map((s) => q.fieldsMap[s]).filter((s) => s !== void 0).filter((s) => s.supportedDimensions !== void 0).map((s) => new Set(s.supportedDimensions));
88
+ if (!A.length)
89
+ return c;
90
+ const w = A.reduce((s, _) => _.intersection(s));
91
+ return c.filter((s) => w.has(s.field));
92
+ });
93
+ return {
94
+ datasourceConfig: e,
95
+ datasourceConfigError: u,
96
+ datasourceConfigMap: l,
97
+ getFieldDataSources: y,
98
+ isFilterValidForDatasource: g,
99
+ loading: i,
100
+ isReady: f,
101
+ stripUnknownFilters: v
102
+ };
103
+ }), $ = /* @__PURE__ */ D({
104
+ __name: "AnalyticsConfigCheck",
105
+ props: {
106
+ requireAnalytics: { type: Boolean },
107
+ requirePercentiles: { type: Boolean }
108
+ },
109
+ setup(e) {
110
+ const u = e, p = U(), { analytics: i, percentiles: f, configError: l, loading: y } = T(p), g = o(
111
+ () => (u.requireAnalytics ? i.value : !0) && (u.requirePercentiles ? f.value : !0)
112
+ );
113
+ return (v, n) => !d(y) && d(l) ? h(v.$slots, "error", {
114
+ key: 0,
115
+ error: d(l)
116
+ }) : !d(y) && g.value ? h(v.$slots, "default", {
117
+ key: 1,
118
+ hasAnalytics: d(i),
119
+ hasPercentiles: d(f)
120
+ }) : d(y) ? S("", !0) : h(v.$slots, "fallback", {
121
+ key: 2,
122
+ hasAnalytics: d(i),
123
+ hasPercentiles: d(f)
124
+ });
125
+ }
126
+ });
127
+ export {
128
+ $ as AnalyticsConfigCheck,
129
+ U as useAnalyticsConfigStore,
130
+ Y as useDatasourceConfigStore
131
+ };
@@ -0,0 +1 @@
1
+ (function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u["kong-ui-public-vitals-config-store"]={},u.Vue,u.pinia))})(this,(function(u,e,E){"use strict";const R="analytics-query-provider",h=E.defineStore("analytics-config",()=>{const n=e.ref(null),d=e.ref(null),f=e.inject(R);f?f.configFn().then(t=>{n.value=t}).catch(t=>{d.value=t,n.value={analytics:null,requests:null},console.warn("Error fetching analytics config"),console.warn(t)}):(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"),d.value=new Error("No analytics bridge provided"),n.value={analytics:null,requests:null});const a=e.computed(()=>{const t=n.value?.analytics?.retention_ms;return!!t&&t>=2592e6}),p=e.computed(()=>"7d"),c=e.computed(()=>!n.value),y=e.computed(()=>!!n.value?.analytics),g=e.computed(()=>!!n.value?.analytics?.percentiles),m=()=>new Promise(t=>{if(!c.value)return t();const l=e.watch(c,()=>{c.value||(l(),t())})}),r=e.computed(()=>n.value?.ui?.maxParallelRequests??2),o=e.computed(()=>n.value?.ui?.requestInterval??2e3),s=e.computed(()=>n.value?.ui?.requestIntervalCap??10);return{analyticsConfig:n,longRetention:a,defaultQueryTimeForOrg:p,loading:c,analytics:y,percentiles:g,maxParallelRequests:r,requestInterval:o,requestIntervalCap:s,isReady:m,configError:d}}),T="analytics-query-provider",_=E.defineStore("datasource-config",()=>{const n=e.ref(void 0),d=e.ref(null),f=e.inject(T);f?f.datasourceConfigFn().then(r=>{n.value=r}).catch(r=>{d.value=r,n.value=[],console.warn("Error fetching datasource config"),console.warn(r)}):(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"),d.value=new Error("No analytics bridge provided"),n.value=[]);const a=e.computed(()=>n.value===void 0),p=async()=>new Promise(r=>{if(!a.value)return r();const o=e.watch(()=>a.value,s=>{s||(o(),r())})}),c=e.computed(()=>(n.value??[]).reduce((r,o)=>{const s=o.fields.reduce((t,l)=>(t[l.name]=l,t),{});return r[o.name]={...o,fieldsMap:s},r},{})),y=e.computed(()=>r=>a.value?[]:(n.value??[]).filter(o=>o.fields.some(s=>s.name===r)).map(o=>o.name)),g=e.computed(()=>({datasource:r,filter:o})=>{if(a.value)return!0;const s=c.value[r];if(!s)return!0;const t=s.fieldsMap[o.field];return t?.filter?t.filter.operators.flatMap(l=>l.ops).includes(o.operator):!1}),m=e.computed(()=>({datasource:r,filters:o,queryFields:s=void 0,metrics:t=void 0})=>{const l=o.filter(i=>g.value({datasource:r,filter:i})),A=s??t;if(!A?.length)return l;const S=c.value[r];if(!S)return l;const q=A.map(i=>S.fieldsMap[i]).filter(i=>i!==void 0).filter(i=>i.supportedDimensions!==void 0).map(i=>new Set(i.supportedDimensions));if(!q.length)return l;const D=q.reduce((i,b)=>b.intersection(i));return l.filter(i=>D.has(i.field))});return{datasourceConfig:n,datasourceConfigError:d,datasourceConfigMap:c,getFieldDataSources:y,isFilterValidForDatasource:g,loading:a,isReady:p,stripUnknownFilters:m}}),C=e.defineComponent({__name:"AnalyticsConfigCheck",props:{requireAnalytics:{type:Boolean},requirePercentiles:{type:Boolean}},setup(n){const d=n,f=h(),{analytics:a,percentiles:p,configError:c,loading:y}=E.storeToRefs(f),g=e.computed(()=>(d.requireAnalytics?a.value:!0)&&(d.requirePercentiles?p.value:!0));return(m,r)=>!e.unref(y)&&e.unref(c)?e.renderSlot(m.$slots,"error",{key:0,error:e.unref(c)}):!e.unref(y)&&g.value?e.renderSlot(m.$slots,"default",{key:1,hasAnalytics:e.unref(a),hasPercentiles:e.unref(p)}):e.unref(y)?e.createCommentVNode("",!0):e.renderSlot(m.$slots,"fallback",{key:2,hasAnalytics:e.unref(a),hasPercentiles:e.unref(p)})}});u.AnalyticsConfigCheck=C,u.useAnalyticsConfigStore=h,u.useDatasourceConfigStore=_,Object.defineProperty(u,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.4.2-pr.3496.e7e265510.0",
3
+ "version": "1.4.2",
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": ">= 3.0.4 < 4",
25
25
  "vue": "^3.5.35",
26
- "@kong-ui-public/analytics-utilities": "^12.23.1-pr.3496.e7e265510.0"
26
+ "@kong-ui-public/analytics-utilities": "^12.23.1"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",