@kong-ui-public/analytics-config-store 1.3.28-pr.3470.87bb970d7.0 → 1.3.28
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 +30 -0
- package/dist/types/components/AnalyticsConfigCheck.vue.d.ts.map +1 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/stores/analytics-config.d.ts +118 -0
- package/dist/types/stores/analytics-config.d.ts.map +1 -0
- package/dist/types/stores/datasource-config.d.ts +318 -0
- package/dist/types/stores/datasource-config.d.ts.map +1 -0
- package/dist/types/stores/index.d.ts +3 -0
- package/dist/types/stores/index.d.ts.map +1 -0
- package/dist/types/stores/tests/setupPiniaTestStore.d.ts +13 -0
- package/dist/types/stores/tests/setupPiniaTestStore.d.ts.map +1 -0
- package/dist/vitals-config-store.es.js +146 -0
- package/dist/vitals-config-store.umd.js +1 -0
- package/package.json +2 -2
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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,318 @@
|
|
|
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
|
+
}[];
|
|
47
|
+
timeRangeOptions: string[];
|
|
48
|
+
granularityOptions?: string[] | undefined;
|
|
49
|
+
defaultMetric?: string | undefined;
|
|
50
|
+
}[] | undefined, DatasourceConfig[] | {
|
|
51
|
+
name: string;
|
|
52
|
+
showInUI: boolean;
|
|
53
|
+
fields: {
|
|
54
|
+
name: string;
|
|
55
|
+
showInUI: boolean;
|
|
56
|
+
aggregation: boolean;
|
|
57
|
+
group: boolean;
|
|
58
|
+
filter?: {
|
|
59
|
+
valueSource: "ksearch";
|
|
60
|
+
ksearchName: string;
|
|
61
|
+
valueType: string;
|
|
62
|
+
operators: {
|
|
63
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
64
|
+
ops: string[];
|
|
65
|
+
}[];
|
|
66
|
+
preSeededValues?: string[] | undefined;
|
|
67
|
+
allowNewValues?: boolean | undefined;
|
|
68
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
69
|
+
} | {
|
|
70
|
+
valueType: "string";
|
|
71
|
+
operators: {
|
|
72
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
73
|
+
ops: string[];
|
|
74
|
+
}[];
|
|
75
|
+
preSeededValues?: string[] | undefined;
|
|
76
|
+
allowNewValues?: boolean | undefined;
|
|
77
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
78
|
+
} | {
|
|
79
|
+
valueType: "number";
|
|
80
|
+
operators: {
|
|
81
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
82
|
+
ops: string[];
|
|
83
|
+
}[];
|
|
84
|
+
preSeededValues?: string[] | undefined;
|
|
85
|
+
allowNewValues?: boolean | undefined;
|
|
86
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
87
|
+
} | null | undefined;
|
|
88
|
+
metricGroup?: string | undefined;
|
|
89
|
+
supportedDimensions?: string[] | undefined;
|
|
90
|
+
}[];
|
|
91
|
+
timeRangeOptions: string[];
|
|
92
|
+
granularityOptions?: string[] | undefined;
|
|
93
|
+
defaultMetric?: string | undefined;
|
|
94
|
+
}[] | undefined>;
|
|
95
|
+
datasourceConfigError: import("vue").Ref<Error | null, Error | null>;
|
|
96
|
+
datasourceConfigMap: import("vue").ComputedRef<Record<string, MappedDatasourceConfig>>;
|
|
97
|
+
getFieldDataSources: import("vue").ComputedRef<(fieldName: string) => string[]>;
|
|
98
|
+
isFilterValidForDatasource: import("vue").ComputedRef<({ datasource, filter, }: {
|
|
99
|
+
datasource: string;
|
|
100
|
+
filter: AllFilters;
|
|
101
|
+
}) => boolean>;
|
|
102
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
103
|
+
isReady: () => Promise<void>;
|
|
104
|
+
stripUnknownFilters: import("vue").ComputedRef<({ datasource, filters, metrics, }: {
|
|
105
|
+
datasource: string;
|
|
106
|
+
filters: AllFilters[];
|
|
107
|
+
metrics?: readonly string[];
|
|
108
|
+
}) => AllFilters[]>;
|
|
109
|
+
}, "datasourceConfig" | "datasourceConfigError">, Pick<{
|
|
110
|
+
datasourceConfig: import("vue").Ref<{
|
|
111
|
+
name: string;
|
|
112
|
+
showInUI: boolean;
|
|
113
|
+
fields: {
|
|
114
|
+
name: string;
|
|
115
|
+
showInUI: boolean;
|
|
116
|
+
aggregation: boolean;
|
|
117
|
+
group: boolean;
|
|
118
|
+
filter?: {
|
|
119
|
+
valueSource: "ksearch";
|
|
120
|
+
ksearchName: string;
|
|
121
|
+
valueType: string;
|
|
122
|
+
operators: {
|
|
123
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
124
|
+
ops: string[];
|
|
125
|
+
}[];
|
|
126
|
+
preSeededValues?: string[] | undefined;
|
|
127
|
+
allowNewValues?: boolean | undefined;
|
|
128
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
129
|
+
} | {
|
|
130
|
+
valueType: "string";
|
|
131
|
+
operators: {
|
|
132
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
133
|
+
ops: string[];
|
|
134
|
+
}[];
|
|
135
|
+
preSeededValues?: string[] | undefined;
|
|
136
|
+
allowNewValues?: boolean | undefined;
|
|
137
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
138
|
+
} | {
|
|
139
|
+
valueType: "number";
|
|
140
|
+
operators: {
|
|
141
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
142
|
+
ops: string[];
|
|
143
|
+
}[];
|
|
144
|
+
preSeededValues?: string[] | undefined;
|
|
145
|
+
allowNewValues?: boolean | undefined;
|
|
146
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
147
|
+
} | null | undefined;
|
|
148
|
+
metricGroup?: string | undefined;
|
|
149
|
+
supportedDimensions?: string[] | undefined;
|
|
150
|
+
}[];
|
|
151
|
+
timeRangeOptions: string[];
|
|
152
|
+
granularityOptions?: string[] | undefined;
|
|
153
|
+
defaultMetric?: string | undefined;
|
|
154
|
+
}[] | undefined, DatasourceConfig[] | {
|
|
155
|
+
name: string;
|
|
156
|
+
showInUI: boolean;
|
|
157
|
+
fields: {
|
|
158
|
+
name: string;
|
|
159
|
+
showInUI: boolean;
|
|
160
|
+
aggregation: boolean;
|
|
161
|
+
group: boolean;
|
|
162
|
+
filter?: {
|
|
163
|
+
valueSource: "ksearch";
|
|
164
|
+
ksearchName: string;
|
|
165
|
+
valueType: string;
|
|
166
|
+
operators: {
|
|
167
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
168
|
+
ops: string[];
|
|
169
|
+
}[];
|
|
170
|
+
preSeededValues?: string[] | undefined;
|
|
171
|
+
allowNewValues?: boolean | undefined;
|
|
172
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
173
|
+
} | {
|
|
174
|
+
valueType: "string";
|
|
175
|
+
operators: {
|
|
176
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
177
|
+
ops: string[];
|
|
178
|
+
}[];
|
|
179
|
+
preSeededValues?: string[] | undefined;
|
|
180
|
+
allowNewValues?: boolean | undefined;
|
|
181
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
valueType: "number";
|
|
184
|
+
operators: {
|
|
185
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
186
|
+
ops: string[];
|
|
187
|
+
}[];
|
|
188
|
+
preSeededValues?: string[] | undefined;
|
|
189
|
+
allowNewValues?: boolean | undefined;
|
|
190
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
191
|
+
} | null | undefined;
|
|
192
|
+
metricGroup?: string | undefined;
|
|
193
|
+
supportedDimensions?: string[] | undefined;
|
|
194
|
+
}[];
|
|
195
|
+
timeRangeOptions: string[];
|
|
196
|
+
granularityOptions?: string[] | undefined;
|
|
197
|
+
defaultMetric?: string | undefined;
|
|
198
|
+
}[] | undefined>;
|
|
199
|
+
datasourceConfigError: import("vue").Ref<Error | null, Error | null>;
|
|
200
|
+
datasourceConfigMap: import("vue").ComputedRef<Record<string, MappedDatasourceConfig>>;
|
|
201
|
+
getFieldDataSources: import("vue").ComputedRef<(fieldName: string) => string[]>;
|
|
202
|
+
isFilterValidForDatasource: import("vue").ComputedRef<({ datasource, filter, }: {
|
|
203
|
+
datasource: string;
|
|
204
|
+
filter: AllFilters;
|
|
205
|
+
}) => boolean>;
|
|
206
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
207
|
+
isReady: () => Promise<void>;
|
|
208
|
+
stripUnknownFilters: import("vue").ComputedRef<({ datasource, filters, metrics, }: {
|
|
209
|
+
datasource: string;
|
|
210
|
+
filters: AllFilters[];
|
|
211
|
+
metrics?: readonly string[];
|
|
212
|
+
}) => AllFilters[]>;
|
|
213
|
+
}, "loading" | "datasourceConfigMap" | "getFieldDataSources" | "isFilterValidForDatasource" | "stripUnknownFilters">, Pick<{
|
|
214
|
+
datasourceConfig: import("vue").Ref<{
|
|
215
|
+
name: string;
|
|
216
|
+
showInUI: boolean;
|
|
217
|
+
fields: {
|
|
218
|
+
name: string;
|
|
219
|
+
showInUI: boolean;
|
|
220
|
+
aggregation: boolean;
|
|
221
|
+
group: boolean;
|
|
222
|
+
filter?: {
|
|
223
|
+
valueSource: "ksearch";
|
|
224
|
+
ksearchName: string;
|
|
225
|
+
valueType: string;
|
|
226
|
+
operators: {
|
|
227
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
228
|
+
ops: string[];
|
|
229
|
+
}[];
|
|
230
|
+
preSeededValues?: string[] | undefined;
|
|
231
|
+
allowNewValues?: boolean | undefined;
|
|
232
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
233
|
+
} | {
|
|
234
|
+
valueType: "string";
|
|
235
|
+
operators: {
|
|
236
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
237
|
+
ops: string[];
|
|
238
|
+
}[];
|
|
239
|
+
preSeededValues?: string[] | undefined;
|
|
240
|
+
allowNewValues?: boolean | undefined;
|
|
241
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
242
|
+
} | {
|
|
243
|
+
valueType: "number";
|
|
244
|
+
operators: {
|
|
245
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
246
|
+
ops: string[];
|
|
247
|
+
}[];
|
|
248
|
+
preSeededValues?: string[] | undefined;
|
|
249
|
+
allowNewValues?: boolean | undefined;
|
|
250
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
251
|
+
} | null | undefined;
|
|
252
|
+
metricGroup?: string | undefined;
|
|
253
|
+
supportedDimensions?: string[] | undefined;
|
|
254
|
+
}[];
|
|
255
|
+
timeRangeOptions: string[];
|
|
256
|
+
granularityOptions?: string[] | undefined;
|
|
257
|
+
defaultMetric?: string | undefined;
|
|
258
|
+
}[] | undefined, DatasourceConfig[] | {
|
|
259
|
+
name: string;
|
|
260
|
+
showInUI: boolean;
|
|
261
|
+
fields: {
|
|
262
|
+
name: string;
|
|
263
|
+
showInUI: boolean;
|
|
264
|
+
aggregation: boolean;
|
|
265
|
+
group: boolean;
|
|
266
|
+
filter?: {
|
|
267
|
+
valueSource: "ksearch";
|
|
268
|
+
ksearchName: string;
|
|
269
|
+
valueType: string;
|
|
270
|
+
operators: {
|
|
271
|
+
type: "multi-value" | "single-value" | "no-value";
|
|
272
|
+
ops: string[];
|
|
273
|
+
}[];
|
|
274
|
+
preSeededValues?: string[] | undefined;
|
|
275
|
+
allowNewValues?: boolean | undefined;
|
|
276
|
+
valuesNeedTranslation?: boolean | undefined;
|
|
277
|
+
} | {
|
|
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: "number";
|
|
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
|
+
} | null | undefined;
|
|
296
|
+
metricGroup?: string | undefined;
|
|
297
|
+
supportedDimensions?: string[] | undefined;
|
|
298
|
+
}[];
|
|
299
|
+
timeRangeOptions: string[];
|
|
300
|
+
granularityOptions?: string[] | undefined;
|
|
301
|
+
defaultMetric?: string | undefined;
|
|
302
|
+
}[] | undefined>;
|
|
303
|
+
datasourceConfigError: import("vue").Ref<Error | null, Error | null>;
|
|
304
|
+
datasourceConfigMap: import("vue").ComputedRef<Record<string, MappedDatasourceConfig>>;
|
|
305
|
+
getFieldDataSources: import("vue").ComputedRef<(fieldName: string) => string[]>;
|
|
306
|
+
isFilterValidForDatasource: import("vue").ComputedRef<({ datasource, filter, }: {
|
|
307
|
+
datasource: string;
|
|
308
|
+
filter: AllFilters;
|
|
309
|
+
}) => boolean>;
|
|
310
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
311
|
+
isReady: () => Promise<void>;
|
|
312
|
+
stripUnknownFilters: import("vue").ComputedRef<({ datasource, filters, metrics, }: {
|
|
313
|
+
datasource: string;
|
|
314
|
+
filters: AllFilters[];
|
|
315
|
+
metrics?: readonly string[];
|
|
316
|
+
}) => AllFilters[]>;
|
|
317
|
+
}, "isReady">>;
|
|
318
|
+
//# 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;uFA+ElC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAC5B,KAAG,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAnDG,MAAM,KAAG,MAAM,EAAE;oFAejC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,EAAE,UAAU,CAAA;KACnB,KAAG,OAAO;;mBAlDa,OAAO,CAAC,IAAI,CAAC;uFA+ElC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAC5B,KAAG,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAnDG,MAAM,KAAG,MAAM,EAAE;oFAejC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,EAAE,UAAU,CAAA;KACnB,KAAG,OAAO;;mBAlDa,OAAO,CAAC,IAAI,CAAC;uFA+ElC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAC5B,KAAG,UAAU,EAAE;cA6ClB,CAAA"}
|
|
@@ -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,146 @@
|
|
|
1
|
+
import { ref as m, inject as A, computed as a, watch as C, defineComponent as _, unref as d, renderSlot as E, createCommentVNode as D } from "vue";
|
|
2
|
+
import { defineStore as R, storeToRefs as S } from "pinia";
|
|
3
|
+
const T = 2592e6, P = 2, F = 2e3, k = 10, I = "analytics-query-provider", M = R("analytics-config", () => {
|
|
4
|
+
const r = m(null), c = m(null), p = A(I);
|
|
5
|
+
p ? p.configFn().then((e) => {
|
|
6
|
+
r.value = e;
|
|
7
|
+
}).catch((e) => {
|
|
8
|
+
c.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"), c.value = new Error("No analytics bridge provided"), r.value = {
|
|
13
|
+
analytics: null,
|
|
14
|
+
requests: null
|
|
15
|
+
});
|
|
16
|
+
const l = a(() => {
|
|
17
|
+
var n, h;
|
|
18
|
+
const e = (h = (n = r.value) == null ? void 0 : n.analytics) == null ? void 0 : h.retention_ms;
|
|
19
|
+
return !!e && e >= T;
|
|
20
|
+
}), f = a(() => "7d"), u = a(() => !r.value), y = a(() => {
|
|
21
|
+
var e;
|
|
22
|
+
return !!((e = r.value) != null && e.analytics);
|
|
23
|
+
}), g = a(() => {
|
|
24
|
+
var e, n;
|
|
25
|
+
return !!((n = (e = r.value) == null ? void 0 : e.analytics) != null && n.percentiles);
|
|
26
|
+
}), v = () => new Promise((e) => {
|
|
27
|
+
if (!u.value)
|
|
28
|
+
return e();
|
|
29
|
+
const n = C(u, () => {
|
|
30
|
+
u.value || (n(), e());
|
|
31
|
+
});
|
|
32
|
+
}), t = a(
|
|
33
|
+
() => {
|
|
34
|
+
var e, n;
|
|
35
|
+
return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.maxParallelRequests) ?? P;
|
|
36
|
+
}
|
|
37
|
+
), o = a(
|
|
38
|
+
() => {
|
|
39
|
+
var e, n;
|
|
40
|
+
return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestInterval) ?? F;
|
|
41
|
+
}
|
|
42
|
+
), s = a(
|
|
43
|
+
() => {
|
|
44
|
+
var e, n;
|
|
45
|
+
return ((n = (e = r.value) == null ? void 0 : e.ui) == null ? void 0 : n.requestIntervalCap) ?? k;
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
return {
|
|
49
|
+
analyticsConfig: r,
|
|
50
|
+
longRetention: l,
|
|
51
|
+
defaultQueryTimeForOrg: f,
|
|
52
|
+
loading: u,
|
|
53
|
+
analytics: y,
|
|
54
|
+
percentiles: g,
|
|
55
|
+
maxParallelRequests: t,
|
|
56
|
+
requestInterval: o,
|
|
57
|
+
requestIntervalCap: s,
|
|
58
|
+
isReady: v,
|
|
59
|
+
configError: c
|
|
60
|
+
};
|
|
61
|
+
}), U = "analytics-query-provider", V = R("datasource-config", () => {
|
|
62
|
+
const r = m(void 0), c = m(null), p = A(U);
|
|
63
|
+
p ? p.datasourceConfigFn().then((t) => {
|
|
64
|
+
r.value = t;
|
|
65
|
+
}).catch((t) => {
|
|
66
|
+
c.value = t, r.value = [], console.warn("Error fetching datasource config"), console.warn(t);
|
|
67
|
+
}) : (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"), c.value = new Error("No analytics bridge provided"), r.value = []);
|
|
68
|
+
const l = a(() => r.value === void 0), f = async () => new Promise((t) => {
|
|
69
|
+
if (!l.value)
|
|
70
|
+
return t();
|
|
71
|
+
const o = C(() => l.value, (s) => {
|
|
72
|
+
s || (o(), t());
|
|
73
|
+
});
|
|
74
|
+
}), u = a(() => (r.value ?? []).reduce((t, o) => {
|
|
75
|
+
const s = o.fields.reduce((e, n) => (e[n.name] = n, e), {});
|
|
76
|
+
return t[o.name] = {
|
|
77
|
+
...o,
|
|
78
|
+
fieldsMap: s
|
|
79
|
+
}, t;
|
|
80
|
+
}, {})), y = a(() => (t) => l.value ? [] : (r.value ?? []).filter((o) => o.fields.some((s) => s.name === t)).map((o) => o.name)), g = a(() => ({
|
|
81
|
+
datasource: t,
|
|
82
|
+
filter: o
|
|
83
|
+
}) => {
|
|
84
|
+
if (l.value)
|
|
85
|
+
return !0;
|
|
86
|
+
const s = u.value[t];
|
|
87
|
+
if (!s)
|
|
88
|
+
return !0;
|
|
89
|
+
const e = s.fieldsMap[o.field];
|
|
90
|
+
return e != null && e.filter ? e.filter.operators.flatMap((n) => n.ops).includes(o.operator) : !1;
|
|
91
|
+
}), v = a(() => ({
|
|
92
|
+
datasource: t,
|
|
93
|
+
filters: o,
|
|
94
|
+
metrics: s = void 0
|
|
95
|
+
}) => {
|
|
96
|
+
const e = o.filter((i) => g.value({ datasource: t, filter: i }));
|
|
97
|
+
if (!(s != null && s.length))
|
|
98
|
+
return e;
|
|
99
|
+
const n = u.value[t];
|
|
100
|
+
if (!n)
|
|
101
|
+
return e;
|
|
102
|
+
const q = s.map((i) => n.fieldsMap[i]).filter((i) => i !== void 0).filter((i) => i.supportedDimensions !== void 0).map((i) => new Set(i.supportedDimensions));
|
|
103
|
+
if (!q.length)
|
|
104
|
+
return e;
|
|
105
|
+
const b = q.reduce((i, w) => w.intersection(i));
|
|
106
|
+
return e.filter((i) => b.has(i.field));
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
datasourceConfig: r,
|
|
110
|
+
datasourceConfigError: c,
|
|
111
|
+
datasourceConfigMap: u,
|
|
112
|
+
getFieldDataSources: y,
|
|
113
|
+
isFilterValidForDatasource: g,
|
|
114
|
+
loading: l,
|
|
115
|
+
isReady: f,
|
|
116
|
+
stripUnknownFilters: v
|
|
117
|
+
};
|
|
118
|
+
}), B = /* @__PURE__ */ _({
|
|
119
|
+
__name: "AnalyticsConfigCheck",
|
|
120
|
+
props: {
|
|
121
|
+
requireAnalytics: { type: Boolean },
|
|
122
|
+
requirePercentiles: { type: Boolean }
|
|
123
|
+
},
|
|
124
|
+
setup(r) {
|
|
125
|
+
const c = r, p = M(), { analytics: l, percentiles: f, configError: u, loading: y } = S(p), g = a(
|
|
126
|
+
() => (c.requireAnalytics ? l.value : !0) && (c.requirePercentiles ? f.value : !0)
|
|
127
|
+
);
|
|
128
|
+
return (v, t) => !d(y) && d(u) ? E(v.$slots, "error", {
|
|
129
|
+
key: 0,
|
|
130
|
+
error: d(u)
|
|
131
|
+
}) : !d(y) && g.value ? E(v.$slots, "default", {
|
|
132
|
+
key: 1,
|
|
133
|
+
hasAnalytics: d(l),
|
|
134
|
+
hasPercentiles: d(f)
|
|
135
|
+
}) : d(y) ? D("", !0) : E(v.$slots, "fallback", {
|
|
136
|
+
key: 2,
|
|
137
|
+
hasAnalytics: d(l),
|
|
138
|
+
hasPercentiles: d(f)
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
export {
|
|
143
|
+
B as AnalyticsConfigCheck,
|
|
144
|
+
M as useAnalyticsConfigStore,
|
|
145
|
+
V as useDatasourceConfigStore
|
|
146
|
+
};
|
|
@@ -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 q="analytics-query-provider",A=E.defineStore("analytics-config",()=>{const t=e.ref(null),d=e.ref(null),f=e.inject(q);f?f.configFn().then(n=>{t.value=n}).catch(n=>{d.value=n,t.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"),d.value=new Error("No analytics bridge provided"),t.value={analytics:null,requests:null});const c=e.computed(()=>{var r,h;const n=(h=(r=t.value)==null?void 0:r.analytics)==null?void 0:h.retention_ms;return!!n&&n>=2592e6}),p=e.computed(()=>"7d"),l=e.computed(()=>!t.value),y=e.computed(()=>{var n;return!!((n=t.value)!=null&&n.analytics)}),g=e.computed(()=>{var n,r;return!!((r=(n=t.value)==null?void 0:n.analytics)!=null&&r.percentiles)}),m=()=>new Promise(n=>{if(!l.value)return n();const r=e.watch(l,()=>{l.value||(r(),n())})}),o=e.computed(()=>{var n,r;return((r=(n=t.value)==null?void 0:n.ui)==null?void 0:r.maxParallelRequests)??2}),s=e.computed(()=>{var n,r;return((r=(n=t.value)==null?void 0:n.ui)==null?void 0:r.requestInterval)??2e3}),i=e.computed(()=>{var n,r;return((r=(n=t.value)==null?void 0:n.ui)==null?void 0:r.requestIntervalCap)??10});return{analyticsConfig:t,longRetention:c,defaultQueryTimeForOrg:p,loading:l,analytics:y,percentiles:g,maxParallelRequests:o,requestInterval:s,requestIntervalCap:i,isReady:m,configError:d}}),R="analytics-query-provider",T=E.defineStore("datasource-config",()=>{const t=e.ref(void 0),d=e.ref(null),f=e.inject(R);f?f.datasourceConfigFn().then(o=>{t.value=o}).catch(o=>{d.value=o,t.value=[],console.warn("Error fetching datasource config"),console.warn(o)}):(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"),t.value=[]);const c=e.computed(()=>t.value===void 0),p=async()=>new Promise(o=>{if(!c.value)return o();const s=e.watch(()=>c.value,i=>{i||(s(),o())})}),l=e.computed(()=>(t.value??[]).reduce((o,s)=>{const i=s.fields.reduce((n,r)=>(n[r.name]=r,n),{});return o[s.name]={...s,fieldsMap:i},o},{})),y=e.computed(()=>o=>c.value?[]:(t.value??[]).filter(s=>s.fields.some(i=>i.name===o)).map(s=>s.name)),g=e.computed(()=>({datasource:o,filter:s})=>{if(c.value)return!0;const i=l.value[o];if(!i)return!0;const n=i.fieldsMap[s.field];return n!=null&&n.filter?n.filter.operators.flatMap(r=>r.ops).includes(s.operator):!1}),m=e.computed(()=>({datasource:o,filters:s,metrics:i=void 0})=>{const n=s.filter(a=>g.value({datasource:o,filter:a}));if(!(i!=null&&i.length))return n;const r=l.value[o];if(!r)return n;const S=i.map(a=>r.fieldsMap[a]).filter(a=>a!==void 0).filter(a=>a.supportedDimensions!==void 0).map(a=>new Set(a.supportedDimensions));if(!S.length)return n;const C=S.reduce((a,D)=>D.intersection(a));return n.filter(a=>C.has(a.field))});return{datasourceConfig:t,datasourceConfigError:d,datasourceConfigMap:l,getFieldDataSources:y,isFilterValidForDatasource:g,loading:c,isReady:p,stripUnknownFilters:m}}),_=e.defineComponent({__name:"AnalyticsConfigCheck",props:{requireAnalytics:{type:Boolean},requirePercentiles:{type:Boolean}},setup(t){const d=t,f=A(),{analytics:c,percentiles:p,configError:l,loading:y}=E.storeToRefs(f),g=e.computed(()=>(d.requireAnalytics?c.value:!0)&&(d.requirePercentiles?p.value:!0));return(m,o)=>!e.unref(y)&&e.unref(l)?e.renderSlot(m.$slots,"error",{key:0,error:e.unref(l)}):!e.unref(y)&&g.value?e.renderSlot(m.$slots,"default",{key:1,hasAnalytics:e.unref(c),hasPercentiles:e.unref(p)}):e.unref(y)?e.createCommentVNode("",!0):e.renderSlot(m.$slots,"fallback",{key:2,hasAnalytics:e.unref(c),hasPercentiles:e.unref(p)})}});u.AnalyticsConfigCheck=_,u.useAnalyticsConfigStore=A,u.useDatasourceConfigStore=T,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.3.28
|
|
3
|
+
"version": "1.3.28",
|
|
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.19.2
|
|
26
|
+
"@kong-ui-public/analytics-utilities": "^12.19.2"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|