@kong-ui-public/analytics-metric-provider 11.0.4-pr.2673.6e2178c96.0 → 11.0.4-pr.2700.3163dc49f.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.
Files changed (50) hide show
  1. package/dist/style.css +1 -0
  2. package/dist/types/components/MetricCardContainer.vue.d.ts +91 -0
  3. package/dist/types/components/MetricCardContainer.vue.d.ts.map +1 -0
  4. package/dist/types/components/MetricsConsumer.vue.d.ts +34 -0
  5. package/dist/types/components/MetricsConsumer.vue.d.ts.map +1 -0
  6. package/dist/types/components/MetricsProvider.vue.d.ts +48 -0
  7. package/dist/types/components/MetricsProvider.vue.d.ts.map +1 -0
  8. package/dist/types/components/MetricsTestHarness.vue.d.ts +26 -0
  9. package/dist/types/components/MetricsTestHarness.vue.d.ts.map +1 -0
  10. package/dist/types/components/display/MetricCardLoadingSkeleton.vue.d.ts +3 -0
  11. package/dist/types/components/display/MetricCardLoadingSkeleton.vue.d.ts.map +1 -0
  12. package/dist/types/components/display/MetricsCard.vue.d.ts +397 -0
  13. package/dist/types/components/display/MetricsCard.vue.d.ts.map +1 -0
  14. package/dist/types/components/metricsProviderUtil.d.ts +35 -0
  15. package/dist/types/components/metricsProviderUtil.d.ts.map +1 -0
  16. package/dist/types/composables/index.d.ts +12 -0
  17. package/dist/types/composables/index.d.ts.map +1 -0
  18. package/dist/types/composables/useI18n.d.ts +9 -0
  19. package/dist/types/composables/useI18n.d.ts.map +1 -0
  20. package/dist/types/composables/useMetricCardBuilder.d.ts +20 -0
  21. package/dist/types/composables/useMetricCardBuilder.d.ts.map +1 -0
  22. package/dist/types/composables/useMetricFetcher.d.ts +19 -0
  23. package/dist/types/composables/useMetricFetcher.d.ts.map +1 -0
  24. package/dist/types/composables/useRequest.d.ts +12 -0
  25. package/dist/types/composables/useRequest.d.ts.map +1 -0
  26. package/dist/types/constants.d.ts +7 -0
  27. package/dist/types/constants.d.ts.map +1 -0
  28. package/dist/types/enums/index.d.ts +3 -0
  29. package/dist/types/enums/index.d.ts.map +1 -0
  30. package/dist/types/enums/metric-card-size.enum.d.ts +7 -0
  31. package/dist/types/enums/metric-card-size.enum.d.ts.map +1 -0
  32. package/dist/types/enums/metric-card-type.enum.d.ts +7 -0
  33. package/dist/types/enums/metric-card-type.enum.d.ts.map +1 -0
  34. package/dist/types/index.d.ts +8 -0
  35. package/dist/types/index.d.ts.map +1 -0
  36. package/dist/types/mockExploreResponse.d.ts +12 -0
  37. package/dist/types/mockExploreResponse.d.ts.map +1 -0
  38. package/dist/types/types/fetcher-types.d.ts +16 -0
  39. package/dist/types/types/fetcher-types.d.ts.map +1 -0
  40. package/dist/types/types/index.d.ts +3 -0
  41. package/dist/types/types/index.d.ts.map +1 -0
  42. package/dist/types/types/metric-card.d.ts +36 -0
  43. package/dist/types/types/metric-card.d.ts.map +1 -0
  44. package/dist/types/utilities/index.d.ts +2 -0
  45. package/dist/types/utilities/index.d.ts.map +1 -0
  46. package/dist/types/utilities/trend-display.d.ts +24 -0
  47. package/dist/types/utilities/trend-display.d.ts.map +1 -0
  48. package/dist/vitals-metric-provider.es.js +1211 -0
  49. package/dist/vitals-metric-provider.umd.js +1 -0
  50. package/package.json +7 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metricsProviderUtil.d.ts","sourceRoot":"","sources":["../../../src/components/metricsProviderUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,qCAAqC,CAAA;AAI5C,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAEpE,UAAU,YAAY;IACpB,IAAI,EAAE;QACJ,OAAO,EAAE,aAAa,CAAA;QACtB,OAAO,EAAE,aAAa,CAAA;KACvB,CAAA;IACD,cAAc,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,WAAW,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACpC,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;IACvB,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAC/B;AAED,eAAO,MAAM,oBAAoB,EAAqC,YAAY,CAAC,YAAY,CAAC,CAAA;AAEhG,UAAU,cAAc;IACtB,UAAU,EAAE,GAAG,CAAC,eAAe,CAAC,CAAA;IAChC,SAAS,CAAC,EAAE,2BAA2B,CAAA;IACvC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAAA;IACrD,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACxB,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,CAAA;IAC3B,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;IACnC,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC5B;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,cAAc;;;CAmGtD,CAAA"}
@@ -0,0 +1,12 @@
1
+ import useI18n from './useI18n';
2
+ import useMetricCardBuilder from './useMetricCardBuilder';
3
+ import useMetricFetcher from './useMetricFetcher';
4
+ import useRequest from './useRequest';
5
+ declare const _default: {
6
+ useI18n: typeof useI18n;
7
+ useMetricCardBuilder: typeof useMetricCardBuilder;
8
+ useMetricFetcher: typeof useMetricFetcher;
9
+ useRequest: typeof useRequest;
10
+ };
11
+ export default _default;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,oBAAoB,MAAM,wBAAwB,CAAA;AACzD,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,UAAU,MAAM,cAAc,CAAA;;;;;;;AAGrC,wBAKC"}
@@ -0,0 +1,9 @@
1
+ import { createI18n, i18nTComponent } from '@kong-ui-public/i18n';
2
+ import english from '../locales/en.json';
3
+ interface UseI18nReturn {
4
+ i18n: ReturnType<typeof createI18n<typeof english>>;
5
+ i18nT: ReturnType<typeof i18nTComponent<typeof english>>;
6
+ }
7
+ export default function useI18n(): UseI18nReturn;
8
+ export {};
9
+ //# sourceMappingURL=useI18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../src/composables/useI18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAExC,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,IAAI,aAAa,CAO/C"}
@@ -0,0 +1,20 @@
1
+ import type { MetricCardDef } from '../types';
2
+ import type { MetricCardType } from '../enums';
3
+ import type { Ref } from 'vue';
4
+ import type { ChronologicalMappedMetrics } from './useMetricFetcher';
5
+ import { DEFAULT_KEY } from './useMetricFetcher';
6
+ export interface BuilderOptions {
7
+ cardType: MetricCardType;
8
+ title: Ref<string>;
9
+ description?: string;
10
+ record: Ref<ChronologicalMappedMetrics>;
11
+ hasError: Ref<boolean>;
12
+ lookupKey?: string;
13
+ sumGroupedValues?: string[];
14
+ increaseIsBad?: boolean;
15
+ formatValueFn?: (rawValue: number) => string;
16
+ trendRange?: Ref<string>;
17
+ }
18
+ export declare const sumValues: (recordValue: ChronologicalMappedMetrics, period: "current" | "previous", dimensionLookupKey?: string | typeof DEFAULT_KEY, sumGroupedValues?: string[]) => number;
19
+ export default function useMetricCardBuilder(opts: BuilderOptions): Ref<MetricCardDef>;
20
+ //# sourceMappingURL=useMetricCardBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMetricCardBuilder.d.ts","sourceRoot":"","sources":["../../../src/composables/useMetricCardBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,cAAc,CAAA;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,GAAG,CAAC,0BAA0B,CAAC,CAAA;IACvC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IAC5C,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACzB;AAED,eAAO,MAAM,SAAS,GAAI,aAAa,0BAA0B,EAAE,QAAQ,SAAS,GAAG,UAAU,EAAE,qBAAoB,MAAM,GAAG,OAAO,WAAyB,EAAE,mBAAmB,MAAM,EAAE,WAY5L,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,GAAG,CAAC,aAAa,CAAC,CAyCrF"}
@@ -0,0 +1,19 @@
1
+ import type { Ref } from 'vue';
2
+ import type { ExploreResultV4 } from '@kong-ui-public/analytics-utilities';
3
+ import type { MetricFetcherOptions } from '../types';
4
+ export declare const DEFAULT_KEY: unique symbol;
5
+ export type MappedMetrics = Record<string | typeof DEFAULT_KEY, Record<string | typeof DEFAULT_KEY, number>>;
6
+ export interface ChronologicalMappedMetrics {
7
+ current: MappedMetrics;
8
+ previous: MappedMetrics;
9
+ }
10
+ export interface FetcherResult {
11
+ isLoading: Ref<boolean>;
12
+ hasError: Ref<boolean>;
13
+ raw: Ref<ExploreResultV4 | undefined>;
14
+ mapped: Ref<ChronologicalMappedMetrics>;
15
+ trendRange: Ref<string>;
16
+ }
17
+ export declare function buildDeltaMapping(result: ExploreResultV4, withTrend: boolean): ChronologicalMappedMetrics;
18
+ export default function useMetricFetcher(opts: MetricFetcherOptions): FetcherResult;
19
+ //# sourceMappingURL=useMetricFetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMetricFetcher.d.ts","sourceRoot":"","sources":["../../../src/composables/useMetricFetcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAKpD,eAAO,MAAM,WAAW,eAAoB,CAAA;AAC5C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,GAAG,OAAO,WAAW,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;AAM5G,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,aAAa,CAAA;IACtB,QAAQ,EAAE,aAAa,CAAA;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACvB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACtB,GAAG,EAAE,GAAG,CAAC,eAAe,GAAG,SAAS,CAAC,CAAA;IACrC,MAAM,EAAE,GAAG,CAAC,0BAA0B,CAAC,CAAA;IACvC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACxB;AASD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,GAAG,0BAA0B,CAiDzG;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,aAAa,CAuGlF"}
@@ -0,0 +1,12 @@
1
+ import type { IConfig } from 'swrv';
2
+ import type { IKey, fetcherFn } from 'swrv/dist/types';
3
+ export default function useRequest<Data = unknown, Error = {
4
+ message: string;
5
+ }>(key: IKey, fn?: fetcherFn<Data>, config?: IConfig): {
6
+ data: import("vue").ComputedRef<Data | undefined>;
7
+ response: import("vue").Ref<Data | undefined, Data | undefined>;
8
+ error: import("vue").Ref<Error | undefined, Error | undefined>;
9
+ isValidating: import("vue").Ref<boolean, boolean>;
10
+ revalidate: (data?: fetcherFn<Data> | undefined, opts?: import("swrv/dist/types").revalidateOptions) => Promise<void>;
11
+ };
12
+ //# sourceMappingURL=useRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRequest.d.ts","sourceRoot":"","sources":["../../../src/composables/useRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGtD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,IAAI,GAAG,OAAO,EAAE,KAAK,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAC5E,GAAG,EAAE,IAAI,EACT,EAAE,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,EACpB,MAAM,CAAC,EAAE,OAAO;;;;;;EAyBjB"}
@@ -0,0 +1,7 @@
1
+ export declare const MAX_ANALYTICS_REQUEST_RETRIES = 2;
2
+ export declare const ALL_STATUS_CODE_GROUPS: string[];
3
+ export declare const STATUS_CODES_FAILED: string[];
4
+ export declare const STATUS_CODES_SUCCESS: string[];
5
+ export declare const DEFAULT_REFRESH_INTERVAL: number;
6
+ export declare const INJECT_QUERY_PROVIDER = "analytics-query-provider";
7
+ //# 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,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,sBAAsB,UAAsC,CAAA;AACzE,eAAO,MAAM,mBAAmB,UAAiB,CAAA;AACjD,eAAO,MAAM,oBAAoB,UAAwB,CAAA;AACzD,eAAO,MAAM,wBAAwB,QAAY,CAAA;AACjD,eAAO,MAAM,qBAAqB,6BAA6B,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './metric-card-type.enum';
2
+ export * from './metric-card-size.enum';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enums/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA"}
@@ -0,0 +1,7 @@
1
+ export declare enum MetricCardSize {
2
+ Small = "sm",
3
+ Medium = "md",
4
+ Large = "lg",
5
+ ExtraLarge = "xl"
6
+ }
7
+ //# sourceMappingURL=metric-card-size.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metric-card-size.enum.d.ts","sourceRoot":"","sources":["../../../src/enums/metric-card-size.enum.ts"],"names":[],"mappings":"AACA,oBAAY,cAAc;IACxB,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,UAAU,OAAO;CAClB"}
@@ -0,0 +1,7 @@
1
+ export declare enum MetricCardType {
2
+ GENERIC_COUNT = "GenericCount",
3
+ TRAFFIC = "Traffic",
4
+ ERROR_RATE = "ErrorRate",
5
+ LATENCY = "Latency"
6
+ }
7
+ //# sourceMappingURL=metric-card-type.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metric-card-type.enum.d.ts","sourceRoot":"","sources":["../../../src/enums/metric-card-type.enum.ts"],"names":[],"mappings":"AACA,oBAAY,cAAc;IACxB,aAAa,iBAAiB;IAC9B,OAAO,YAAY;IACnB,UAAU,cAAc;IACxB,OAAO,YAAY;CACpB"}
@@ -0,0 +1,8 @@
1
+ import MetricsProvider from './components/MetricsProvider.vue';
2
+ import MetricsConsumer from './components/MetricsConsumer.vue';
3
+ import { mockExploreResponseFromCypress, mockExploreResponse } from './mockExploreResponse';
4
+ export { MetricsProvider, MetricsConsumer, mockExploreResponseFromCypress, mockExploreResponse, };
5
+ export * from './types';
6
+ export * from './enums';
7
+ export * from './constants';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,kCAAkC,CAAA;AAC9D,OAAO,eAAe,MAAM,kCAAkC,CAAA;AAC9D,OAAO,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3F,OAAO,EACL,eAAe,EACf,eAAe,EACf,8BAA8B,EAC9B,mBAAmB,GACpB,CAAA;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { CyHttpMessages } from 'cypress/types/net-stubbing';
2
+ import type { AbsoluteTimeRangeV4, ExploreQuery, ExploreResultV4 } from '@kong-ui-public/analytics-utilities';
3
+ export declare const addDays: (date: Date, amount: number) => Date;
4
+ export interface MockOptions {
5
+ dimensionNames?: string[];
6
+ injectErrors?: 'latency' | 'traffic' | 'all';
7
+ deterministic?: boolean;
8
+ timeRange?: AbsoluteTimeRangeV4;
9
+ }
10
+ export declare const mockExploreResponseFromCypress: (req: CyHttpMessages.IncomingHttpRequest, opts?: MockOptions) => void;
11
+ export declare const mockExploreResponse: (body: ExploreQuery, opts?: MockOptions) => ExploreResultV4;
12
+ //# sourceMappingURL=mockExploreResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockExploreResponse.d.ts","sourceRoot":"","sources":["../../src/mockExploreResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE,OAAO,KAAK,EACV,mBAAmB,EAEnB,YAAY,EACZ,eAAe,EAGhB,MAAM,qCAAqC,CAAA;AAK5C,eAAO,MAAM,OAAO,GAAI,MAAM,IAAI,EAAE,QAAQ,MAAM,SAIjD,CAAA;AACD,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,YAAY,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,CAAA;IAC5C,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,mBAAmB,CAAA;CAChC;AAED,eAAO,MAAM,8BAA8B,GACzC,KAAK,cAAc,CAAC,mBAAmB,EACvC,OAAO,WAAW,SAQnB,CAAA;AAQD,eAAO,MAAM,mBAAmB,GAC9B,MAAM,YAAY,EAClB,OAAO,WAAW,KA+Gb,eACN,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { ExploreAggregations, QueryableExploreDimensions, AnalyticsBridge, QueryDatasource, ExploreFilterAll, TimeRangeV4 } from '@kong-ui-public/analytics-utilities';
2
+ import type { Ref } from 'vue';
3
+ export interface MetricFetcherOptions {
4
+ datasource: Ref<QueryDatasource>;
5
+ metrics: Ref<ExploreAggregations[]>;
6
+ dimensions?: QueryableExploreDimensions[];
7
+ filter: Ref<ExploreFilterAll[] | undefined>;
8
+ timeRange: Ref<TimeRangeV4>;
9
+ refreshInterval: number;
10
+ withTrend: Ref<boolean>;
11
+ queryReady: Ref<boolean>;
12
+ queryFn: AnalyticsBridge['queryFn'];
13
+ abortController?: AbortController;
14
+ refreshCounter: Ref<number>;
15
+ }
16
+ //# sourceMappingURL=fetcher-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher-types.d.ts","sourceRoot":"","sources":["../../../src/types/fetcher-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAAE,0BAA0B,EAAE,eAAe,EAAE,eAAe,EACjF,gBAAgB,EAChB,WAAW,EACZ,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,GAAG,CAAC,eAAe,CAAC,CAAA;IAChC,OAAO,EAAE,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACnC,UAAU,CAAC,EAAE,0BAA0B,EAAE,CAAA;IACzC,MAAM,EAAE,GAAG,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAAA;IAC3C,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACvB,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACxB,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;IACnC,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC5B"}
@@ -0,0 +1,3 @@
1
+ export * from './fetcher-types';
2
+ export * from './metric-card';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAGA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,36 @@
1
+ import type { MetricCardType, MetricCardSize } from '../enums';
2
+ import type { KongIcon as GenericIcon } from '@kong/icons';
3
+ import type { HeaderTag } from '@kong/kongponents';
4
+ export interface MetricCardDef {
5
+ cardType?: MetricCardType;
6
+ currentValue: number;
7
+ previousValue: number;
8
+ increaseIsBad: boolean;
9
+ formatValueFn?: (rawValue: number) => string;
10
+ formatChangeFn?: (rawValue: number) => string;
11
+ description?: string;
12
+ title?: string;
13
+ titleTag?: HeaderTag;
14
+ hasError?: boolean;
15
+ tooltip?: string;
16
+ trendRange?: string;
17
+ }
18
+ export interface MetricCardDisplayValue {
19
+ metricValue: string;
20
+ metricChange: string;
21
+ changePolarity: number;
22
+ trendIcon?: typeof GenericIcon;
23
+ cardSize?: MetricCardSize;
24
+ hasContainerTitle?: boolean;
25
+ }
26
+ export interface MetricCardContainerOptions {
27
+ cards: MetricCardDef[];
28
+ fallbackDisplayText: string;
29
+ hasTrendAccess: boolean;
30
+ loading: boolean;
31
+ cardSize?: MetricCardSize;
32
+ containerTitle?: string;
33
+ containerDescription?: string;
34
+ errorMessage?: string;
35
+ }
36
+ //# sourceMappingURL=metric-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metric-card.d.ts","sourceRoot":"","sources":["../../../src/types/metric-card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9D,OAAO,KAAK,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IAC5C,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAA;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,WAAW,CAAA;IAC9B,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,cAAc,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
@@ -0,0 +1,2 @@
1
+ export * from './trend-display';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { IndeterminateSmallIcon as GenericIcon } from '@kong/icons';
2
+ export declare const DECIMAL_DISPLAY = 2;
3
+ export declare const DECIMAL_ROUNDING_PRECISION: number;
4
+ /**
5
+ * Beneficial increase (eg: Traffic) is considered good.
6
+ * Detrimental increase (eg: Error traffic) is considered bad, and behave in the opposite manner.
7
+ * @param {number} delta - A numeric representation of week-to-week change
8
+ * @param {Boolean} thisIsBad - Flag to determine whether change is beneficial or detrimental
9
+ * @returns {string}
10
+ */
11
+ export declare const changePolarity: (delta: number, hasTrendAccess: boolean, thisIsBad?: boolean) => number;
12
+ /**
13
+ * Determines the trend value to be displayed by the metric card
14
+ * @param {number} delta The change amount during the given time period. Assumed to be a percentage; e.g., delta = 0.1 will be rendered as '10.00%'.
15
+ * @param {Boolean} hasTrendAccess Whether the user's Tier allows it
16
+ * @returns {string}
17
+ */
18
+ export declare const metricChange: (delta: number, hasTrendAccess: boolean, fallback: string) => string;
19
+ export declare const calculateChange: (curr: number, prev: number) => number;
20
+ /**
21
+ * Determines whether to display an upward or downward trend, or no change
22
+ */
23
+ export declare const defineIcon: (polarity: number, thisIsBad?: boolean) => typeof GenericIcon;
24
+ //# sourceMappingURL=trend-display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trend-display.d.ts","sourceRoot":"","sources":["../../../src/utilities/trend-display.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,sBAAsB,IAAI,WAAW,EACtC,MAAM,aAAa,CAAA;AAGpB,eAAO,MAAM,eAAe,IAAI,CAAA;AAGhC,eAAO,MAAM,0BAA0B,QAAsB,CAAA;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,EAAE,gBAAgB,OAAO,EAAE,YAAU,OAAe,KAAG,MAalG,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,gBAAgB,OAAO,EAAE,UAAU,MAAM,KAAG,MAIvF,CAAA;AAGD,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,WAOzD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,EAAE,YAAW,OAAe,KAAG,OAAO,WAUhF,CAAA"}