@kong-ui-public/analytics-config-store 2.0.2 → 2.0.3-pr.3967.6b2415fd5.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.
- package/package.json +2 -2
- package/dist/types/components/AnalyticsConfigCheck.vue.d.ts +0 -30
- package/dist/types/components/AnalyticsConfigCheck.vue.d.ts.map +0 -1
- package/dist/types/constants.d.ts +0 -5
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/stores/analytics-config.d.ts +0 -42
- package/dist/types/stores/analytics-config.d.ts.map +0 -1
- package/dist/types/stores/datasource-config.d.ts +0 -117
- package/dist/types/stores/datasource-config.d.ts.map +0 -1
- package/dist/types/stores/index.d.ts +0 -3
- package/dist/types/stores/index.d.ts.map +0 -1
- package/dist/types/stores/tests/setupPiniaTestStore.d.ts +0 -13
- package/dist/types/stores/tests/setupPiniaTestStore.d.ts.map +0 -1
- package/dist/vitals-config-store.es.js +0 -135
- package/dist/vitals-config-store.umd.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/analytics-config-store",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-pr.3967.6b2415fd5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/vitals-config-store.umd.js",
|
|
6
6
|
"module": "./dist/vitals-config-store.es.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@kong-ui-public/analytics-utilities": "^14.2.0",
|
|
24
|
+
"@kong-ui-public/analytics-utilities": "^14.2.1-pr.3967.6b2415fd5.0",
|
|
25
25
|
"pinia": "^4.0.3",
|
|
26
26
|
"vue": "^3.5.43"
|
|
27
27
|
},
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsConfigV2 } from '@kong-ui-public/analytics-utilities';
|
|
2
|
-
export type ConfigStoreState = null | AnalyticsConfigV2;
|
|
3
|
-
export declare const useAnalyticsConfigStore: import("pinia").SetupStoreDefinition<"analytics-config", {
|
|
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
|
-
}>;
|
|
42
|
-
//# sourceMappingURL=analytics-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;;EAwCjC,CAAA"}
|
|
@@ -1,117 +0,0 @@
|
|
|
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").SetupStoreDefinition<"datasource-config", {
|
|
6
|
-
datasourceConfig: import("vue").Ref<{
|
|
7
|
-
name: string;
|
|
8
|
-
showInUI: boolean;
|
|
9
|
-
fields: {
|
|
10
|
-
name: string;
|
|
11
|
-
label: string;
|
|
12
|
-
showInUI: boolean;
|
|
13
|
-
aggregation: boolean;
|
|
14
|
-
group: boolean;
|
|
15
|
-
filter?: {
|
|
16
|
-
valueSource: "ksearch";
|
|
17
|
-
ksearchName: string;
|
|
18
|
-
valueType: string;
|
|
19
|
-
operators: {
|
|
20
|
-
type: "multi-value" | "single-value" | "no-value";
|
|
21
|
-
ops: string[];
|
|
22
|
-
}[];
|
|
23
|
-
preSeededValues?: string[] | undefined;
|
|
24
|
-
allowNewValues?: boolean | undefined;
|
|
25
|
-
valuesNeedTranslation?: boolean | undefined;
|
|
26
|
-
} | {
|
|
27
|
-
valueType: "string";
|
|
28
|
-
operators: {
|
|
29
|
-
type: "multi-value" | "single-value" | "no-value";
|
|
30
|
-
ops: string[];
|
|
31
|
-
}[];
|
|
32
|
-
preSeededValues?: string[] | undefined;
|
|
33
|
-
allowNewValues?: boolean | undefined;
|
|
34
|
-
valuesNeedTranslation?: boolean | undefined;
|
|
35
|
-
} | {
|
|
36
|
-
valueType: "number";
|
|
37
|
-
operators: {
|
|
38
|
-
type: "multi-value" | "single-value" | "no-value";
|
|
39
|
-
ops: string[];
|
|
40
|
-
}[];
|
|
41
|
-
preSeededValues?: string[] | undefined;
|
|
42
|
-
allowNewValues?: boolean | undefined;
|
|
43
|
-
valuesNeedTranslation?: boolean | undefined;
|
|
44
|
-
} | null | undefined;
|
|
45
|
-
metricGroup?: string | undefined;
|
|
46
|
-
supportedDimensions?: string[] | undefined;
|
|
47
|
-
entityAttributes?: string[] | undefined;
|
|
48
|
-
}[];
|
|
49
|
-
timeRangeOptions: string[];
|
|
50
|
-
granularityOptions?: string[] | undefined;
|
|
51
|
-
defaultMetric?: string | undefined;
|
|
52
|
-
}[] | undefined, DatasourceConfig[] | {
|
|
53
|
-
name: string;
|
|
54
|
-
showInUI: boolean;
|
|
55
|
-
fields: {
|
|
56
|
-
name: string;
|
|
57
|
-
label: string;
|
|
58
|
-
showInUI: boolean;
|
|
59
|
-
aggregation: boolean;
|
|
60
|
-
group: boolean;
|
|
61
|
-
filter?: {
|
|
62
|
-
valueSource: "ksearch";
|
|
63
|
-
ksearchName: string;
|
|
64
|
-
valueType: string;
|
|
65
|
-
operators: {
|
|
66
|
-
type: "multi-value" | "single-value" | "no-value";
|
|
67
|
-
ops: string[];
|
|
68
|
-
}[];
|
|
69
|
-
preSeededValues?: string[] | undefined;
|
|
70
|
-
allowNewValues?: boolean | undefined;
|
|
71
|
-
valuesNeedTranslation?: boolean | undefined;
|
|
72
|
-
} | {
|
|
73
|
-
valueType: "string";
|
|
74
|
-
operators: {
|
|
75
|
-
type: "multi-value" | "single-value" | "no-value";
|
|
76
|
-
ops: string[];
|
|
77
|
-
}[];
|
|
78
|
-
preSeededValues?: string[] | undefined;
|
|
79
|
-
allowNewValues?: boolean | undefined;
|
|
80
|
-
valuesNeedTranslation?: boolean | undefined;
|
|
81
|
-
} | {
|
|
82
|
-
valueType: "number";
|
|
83
|
-
operators: {
|
|
84
|
-
type: "multi-value" | "single-value" | "no-value";
|
|
85
|
-
ops: string[];
|
|
86
|
-
}[];
|
|
87
|
-
preSeededValues?: string[] | undefined;
|
|
88
|
-
allowNewValues?: boolean | undefined;
|
|
89
|
-
valuesNeedTranslation?: boolean | undefined;
|
|
90
|
-
} | null | undefined;
|
|
91
|
-
metricGroup?: string | undefined;
|
|
92
|
-
supportedDimensions?: string[] | undefined;
|
|
93
|
-
entityAttributes?: string[] | undefined;
|
|
94
|
-
}[];
|
|
95
|
-
timeRangeOptions: string[];
|
|
96
|
-
granularityOptions?: string[] | undefined;
|
|
97
|
-
defaultMetric?: string | undefined;
|
|
98
|
-
}[] | undefined>;
|
|
99
|
-
datasourceConfigError: import("vue").Ref<Error | null, Error | null>;
|
|
100
|
-
datasourceConfigMap: import("vue").ComputedRef<Record<string, MappedDatasourceConfig>>;
|
|
101
|
-
fieldTranslationMap: import("vue").ComputedRef<Map<string, string>>;
|
|
102
|
-
getFieldDataSources: import("vue").ComputedRef<(fieldName: string) => string[]>;
|
|
103
|
-
isFilterValidForDatasource: import("vue").ComputedRef<({ datasource, filter, }: {
|
|
104
|
-
datasource: string;
|
|
105
|
-
filter: AllFilters;
|
|
106
|
-
}) => boolean>;
|
|
107
|
-
loading: import("vue").ComputedRef<boolean>;
|
|
108
|
-
isReady: () => Promise<void>;
|
|
109
|
-
stripUnknownFilters: import("vue").ComputedRef<({ datasource, filters, queryFields, metrics, }: {
|
|
110
|
-
datasource: string;
|
|
111
|
-
filters: AllFilters[];
|
|
112
|
-
queryFields?: readonly string[];
|
|
113
|
-
/** @deprecated Use queryFields instead. */
|
|
114
|
-
metrics?: readonly string[];
|
|
115
|
-
}) => AllFilters[]>;
|
|
116
|
-
}>;
|
|
117
|
-
//# sourceMappingURL=datasource-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA6Ed,MAAM,KAAG,MAAM,EAAE;oFAejC;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,EAAE,UAAU,CAAA;KACnB,KAAG,OAAO;;mBArEa,OAAO,CAAC,IAAI,CAAC;oGAmGlC;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;EAgDlB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stores/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,135 +0,0 @@
|
|
|
1
|
-
import { ref as h, inject as R, computed as o, watch as b, defineComponent as S, unref as d, renderSlot as E, createCommentVNode as T } from "vue";
|
|
2
|
-
import { defineStore as w, storeToRefs as P } from "pinia";
|
|
3
|
-
const F = 2592e6, I = 2, M = 2e3, U = 10, k = "analytics-query-provider", L = w("analytics-config", () => {
|
|
4
|
-
const n = h(null), l = h(null), p = R(k);
|
|
5
|
-
p ? p.configFn().then((e) => {
|
|
6
|
-
n.value = e;
|
|
7
|
-
}).catch((e) => {
|
|
8
|
-
l.value = e, n.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"), l.value = new Error("No analytics bridge provided"), n.value = {
|
|
13
|
-
analytics: null,
|
|
14
|
-
requests: null
|
|
15
|
-
});
|
|
16
|
-
const a = o(() => {
|
|
17
|
-
const e = n.value?.analytics?.retention_ms;
|
|
18
|
-
return !!e && e >= F;
|
|
19
|
-
}), v = o(() => "7d"), i = o(() => !n.value), y = o(() => !!n.value?.analytics), g = o(() => !!n.value?.analytics?.percentiles), f = () => new Promise((e) => {
|
|
20
|
-
if (!i.value)
|
|
21
|
-
return e();
|
|
22
|
-
const c = b(i, () => {
|
|
23
|
-
i.value || (c(), e());
|
|
24
|
-
});
|
|
25
|
-
}), m = o(
|
|
26
|
-
() => n.value?.ui?.maxParallelRequests ?? I
|
|
27
|
-
), r = o(
|
|
28
|
-
() => n.value?.ui?.requestInterval ?? M
|
|
29
|
-
), t = o(
|
|
30
|
-
() => n.value?.ui?.requestIntervalCap ?? U
|
|
31
|
-
);
|
|
32
|
-
return {
|
|
33
|
-
analyticsConfig: n,
|
|
34
|
-
longRetention: a,
|
|
35
|
-
defaultQueryTimeForOrg: v,
|
|
36
|
-
loading: i,
|
|
37
|
-
analytics: y,
|
|
38
|
-
percentiles: g,
|
|
39
|
-
maxParallelRequests: m,
|
|
40
|
-
requestInterval: r,
|
|
41
|
-
requestIntervalCap: t,
|
|
42
|
-
isReady: f,
|
|
43
|
-
configError: l
|
|
44
|
-
};
|
|
45
|
-
}), N = "analytics-query-provider", $ = w("datasource-config", () => {
|
|
46
|
-
const n = h(void 0), l = h(null), p = R(N);
|
|
47
|
-
p ? p.datasourceConfigFn().then((r) => {
|
|
48
|
-
n.value = r;
|
|
49
|
-
}).catch((r) => {
|
|
50
|
-
l.value = r, n.value = [], console.warn("Error fetching datasource config"), console.warn(r);
|
|
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"), l.value = new Error("No analytics bridge provided"), n.value = []);
|
|
52
|
-
const a = o(() => n.value === void 0), v = async () => new Promise((r) => {
|
|
53
|
-
if (!a.value)
|
|
54
|
-
return r();
|
|
55
|
-
const t = b(() => a.value, (e) => {
|
|
56
|
-
e || (t(), r());
|
|
57
|
-
});
|
|
58
|
-
}), i = o(() => (n.value ?? []).reduce((r, t) => {
|
|
59
|
-
const e = t.fields.reduce((c, u) => (c[u.name] = u, c), {});
|
|
60
|
-
return r[t.name] = {
|
|
61
|
-
...t,
|
|
62
|
-
fieldsMap: e
|
|
63
|
-
}, r;
|
|
64
|
-
}, {})), y = o(() => {
|
|
65
|
-
const r = /* @__PURE__ */ new Map();
|
|
66
|
-
if (!n.value)
|
|
67
|
-
return r;
|
|
68
|
-
for (const t of n.value)
|
|
69
|
-
for (const e of t.fields)
|
|
70
|
-
r.set(e.name, e.label);
|
|
71
|
-
return r;
|
|
72
|
-
}), g = o(() => (r) => a.value ? [] : (n.value ?? []).filter((t) => t.fields.some((e) => e.name === r)).map((t) => t.name)), f = o(() => ({
|
|
73
|
-
datasource: r,
|
|
74
|
-
filter: t
|
|
75
|
-
}) => {
|
|
76
|
-
if (a.value)
|
|
77
|
-
return !0;
|
|
78
|
-
const e = i.value[r];
|
|
79
|
-
if (!e)
|
|
80
|
-
return !0;
|
|
81
|
-
const c = e.fieldsMap[t.field];
|
|
82
|
-
return c?.filter ? c.filter.operators.flatMap((u) => u.ops).includes(t.operator) : !1;
|
|
83
|
-
}), m = o(() => ({
|
|
84
|
-
datasource: r,
|
|
85
|
-
filters: t,
|
|
86
|
-
queryFields: e = void 0,
|
|
87
|
-
metrics: c = void 0
|
|
88
|
-
}) => {
|
|
89
|
-
const u = t.filter((s) => f.value({ datasource: r, filter: s })), q = e ?? c;
|
|
90
|
-
if (!q?.length)
|
|
91
|
-
return u;
|
|
92
|
-
const A = i.value[r];
|
|
93
|
-
if (!A)
|
|
94
|
-
return u;
|
|
95
|
-
const C = q.map((s) => A.fieldsMap[s]).filter((s) => s !== void 0).filter((s) => s.supportedDimensions !== void 0).map((s) => new Set(s.supportedDimensions));
|
|
96
|
-
if (!C.length)
|
|
97
|
-
return u;
|
|
98
|
-
const _ = C.reduce((s, D) => D.intersection(s));
|
|
99
|
-
return u.filter((s) => _.has(s.field));
|
|
100
|
-
});
|
|
101
|
-
return {
|
|
102
|
-
datasourceConfig: n,
|
|
103
|
-
datasourceConfigError: l,
|
|
104
|
-
datasourceConfigMap: i,
|
|
105
|
-
fieldTranslationMap: y,
|
|
106
|
-
getFieldDataSources: g,
|
|
107
|
-
isFilterValidForDatasource: f,
|
|
108
|
-
loading: a,
|
|
109
|
-
isReady: v,
|
|
110
|
-
stripUnknownFilters: m
|
|
111
|
-
};
|
|
112
|
-
}), j = /* @__PURE__ */ S({
|
|
113
|
-
__name: "AnalyticsConfigCheck",
|
|
114
|
-
props: {
|
|
115
|
-
requireAnalytics: { type: Boolean },
|
|
116
|
-
requirePercentiles: { type: Boolean }
|
|
117
|
-
},
|
|
118
|
-
setup(n) {
|
|
119
|
-
const l = n, p = L(), { analytics: a, percentiles: v, configError: i, loading: y } = P(p), g = o(
|
|
120
|
-
() => (l.requireAnalytics ? a.value : !0) && (l.requirePercentiles ? v.value : !0)
|
|
121
|
-
);
|
|
122
|
-
return (f, m) => !d(y) && d(i) ? E(f.$slots, "error", { error: d(i) }, void 0, void 0, 0) : !d(y) && g.value ? E(f.$slots, "default", {
|
|
123
|
-
hasAnalytics: d(a),
|
|
124
|
-
hasPercentiles: d(v)
|
|
125
|
-
}, void 0, void 0, 1) : d(y) ? T("", !0) : E(f.$slots, "fallback", {
|
|
126
|
-
hasAnalytics: d(a),
|
|
127
|
-
hasPercentiles: d(v)
|
|
128
|
-
}, void 0, void 0, 2);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
export {
|
|
132
|
-
j as AnalyticsConfigCheck,
|
|
133
|
-
L as useAnalyticsConfigStore,
|
|
134
|
-
$ as useDatasourceConfigStore
|
|
135
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","vue","pinia"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c["kong-ui-public-vitals-config-store"]={},c.Vue,c.pinia))})(this,(function(c,e,h){"use strict";const v="analytics-query-provider",A=h.defineStore("analytics-config",()=>{const r=e.ref(null),l=e.ref(null),p=e.inject(v);p?p.configFn().then(n=>{r.value=n}).catch(n=>{l.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"),l.value=new Error("No analytics bridge provided"),r.value={analytics:null,requests:null});const s=e.computed(()=>{const n=r.value?.analytics?.retention_ms;return!!n&&n>=2592e6}),m=e.computed(()=>"7d"),a=e.computed(()=>!r.value),y=e.computed(()=>!!r.value?.analytics),g=e.computed(()=>!!r.value?.analytics?.percentiles),f=()=>new Promise(n=>{if(!a.value)return n();const u=e.watch(a,()=>{a.value||(u(),n())})}),E=e.computed(()=>r.value?.ui?.maxParallelRequests??2),t=e.computed(()=>r.value?.ui?.requestInterval??2e3),o=e.computed(()=>r.value?.ui?.requestIntervalCap??10);return{analyticsConfig:r,longRetention:s,defaultQueryTimeForOrg:m,loading:a,analytics:y,percentiles:g,maxParallelRequests:E,requestInterval:t,requestIntervalCap:o,isReady:f,configError:l}}),R="analytics-query-provider",_=h.defineStore("datasource-config",()=>{const r=e.ref(void 0),l=e.ref(null),p=e.inject(R);p?p.datasourceConfigFn().then(t=>{r.value=t}).catch(t=>{l.value=t,r.value=[],console.warn("Error fetching datasource 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"),l.value=new Error("No analytics bridge provided"),r.value=[]);const s=e.computed(()=>r.value===void 0),m=async()=>new Promise(t=>{if(!s.value)return t();const o=e.watch(()=>s.value,n=>{n||(o(),t())})}),a=e.computed(()=>(r.value??[]).reduce((t,o)=>{const n=o.fields.reduce((u,d)=>(u[d.name]=d,u),{});return t[o.name]={...o,fieldsMap:n},t},{})),y=e.computed(()=>{const t=new Map;if(!r.value)return t;for(const o of r.value)for(const n of o.fields)t.set(n.name,n.label);return t}),g=e.computed(()=>t=>s.value?[]:(r.value??[]).filter(o=>o.fields.some(n=>n.name===t)).map(o=>o.name)),f=e.computed(()=>({datasource:t,filter:o})=>{if(s.value)return!0;const n=a.value[t];if(!n)return!0;const u=n.fieldsMap[o.field];return u?.filter?u.filter.operators.flatMap(d=>d.ops).includes(o.operator):!1}),E=e.computed(()=>({datasource:t,filters:o,queryFields:n=void 0,metrics:u=void 0})=>{const d=o.filter(i=>f.value({datasource:t,filter:i})),S=n??u;if(!S?.length)return d;const T=a.value[t];if(!T)return d;const q=S.map(i=>T.fieldsMap[i]).filter(i=>i!==void 0).filter(i=>i.supportedDimensions!==void 0).map(i=>new Set(i.supportedDimensions));if(!q.length)return d;const b=q.reduce((i,D)=>D.intersection(i));return d.filter(i=>b.has(i.field))});return{datasourceConfig:r,datasourceConfigError:l,datasourceConfigMap:a,fieldTranslationMap:y,getFieldDataSources:g,isFilterValidForDatasource:f,loading:s,isReady:m,stripUnknownFilters:E}}),C=e.defineComponent({__name:"AnalyticsConfigCheck",props:{requireAnalytics:{type:Boolean},requirePercentiles:{type:Boolean}},setup(r){const l=r,p=A(),{analytics:s,percentiles:m,configError:a,loading:y}=h.storeToRefs(p),g=e.computed(()=>(l.requireAnalytics?s.value:!0)&&(l.requirePercentiles?m.value:!0));return(f,E)=>!e.unref(y)&&e.unref(a)?e.renderSlot(f.$slots,"error",{error:e.unref(a)},void 0,void 0,0):!e.unref(y)&&g.value?e.renderSlot(f.$slots,"default",{hasAnalytics:e.unref(s),hasPercentiles:e.unref(m)},void 0,void 0,1):e.unref(y)?e.createCommentVNode("",!0):e.renderSlot(f.$slots,"fallback",{hasAnalytics:e.unref(s),hasPercentiles:e.unref(m)},void 0,void 0,2)}});c.AnalyticsConfigCheck=C,c.useAnalyticsConfigStore=A,c.useDatasourceConfigStore=_,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|