@sisense/sdk-ui 2.22.0 → 2.23.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/dist/ai.cjs +17 -17
- package/dist/ai.js +57 -57
- package/dist/analytics-composer/node.cjs +1 -1
- package/dist/analytics-composer/node.js +2177 -1176
- package/dist/analytics-composer.cjs +47 -47
- package/dist/analytics-composer.js +135 -131
- package/dist/dimensions-2t18RSZC.cjs +1 -0
- package/dist/dimensions-C0BmtTH2.js +204 -0
- package/dist/execute-query-CHYTupEo.js +5866 -0
- package/dist/execute-query-DmAyVFF5.cjs +1 -0
- package/dist/{index-kxX21arA.js → index-DCAC0mJe.js} +18 -1
- package/dist/{index-NyouhE_A.cjs → index-Dx6wvLd3.cjs} +1 -1
- package/dist/index.cjs +335 -322
- package/dist/index.js +15230 -15097
- package/dist/index.umd.js +687 -634
- package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/const.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/components/editable-layout/smart-pointer-sensor.d.ts +17 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/get-dashboard-model.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/types.d.ts +24 -2
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/dashboard-model-reducer/utils.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/dashboard-model/use-dashboard-model/use-dashboard-persistence.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/jtd/jtd-types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/hooks/rename-widget/use-widget-renaming.d.ts +34 -0
- package/dist/packages/sdk-ui/src/domains/dashboarding/types.d.ts +23 -1
- package/dist/packages/sdk-ui/src/domains/dashboarding/use-dashboard-theme.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/data-browser/add-filter-popover/add-filter-data-browser.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/data-browser/data-schema-browser/data-schema-browser.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/data-browser/dimensions-browser/types.d.ts +9 -1
- package/dist/packages/sdk-ui/src/domains/formulas/fetch-formula.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/query-execution/core/execute-query.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/query-execution/hooks/use-execute-query-by-widget-id/use-execute-query-by-widget-id.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/query-execution/hooks/use-query-cache/use-query-cache.d.ts +2 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/components/boxplot-chart/boxplot-utils.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/helpers/get-load-data-function.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/helpers/data-loading.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/visualizations/components/chart/restructured-charts/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/change-events.d.ts +73 -0
- package/dist/packages/sdk-ui/src/domains/widgets/components/chart-widget/types.d.ts +12 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/pivot-table-widget/types.d.ts +12 -2
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-dashboard-filters.d.ts +3 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/translate-widget-data-options.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/types.d.ts +1 -1
- package/dist/packages/sdk-ui/src/domains/widgets/components/widget-by-id/utils.d.ts +3 -2
- package/dist/packages/sdk-ui/src/domains/widgets/event-to-delta.d.ts +17 -0
- package/dist/packages/sdk-ui/src/domains/widgets/helpers/header-menu-utils.d.ts +14 -4
- package/dist/packages/sdk-ui/src/domains/widgets/helpers/index.d.ts +1 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-title-renaming.d.ts +27 -0
- package/dist/packages/sdk-ui/src/domains/widgets/hooks/use-widget-header-management.d.ts +28 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-container/widget-container.d.ts +3 -1
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/types.d.ts +31 -0
- package/dist/packages/sdk-ui/src/domains/widgets/shared/widget-header/widget-header.d.ts +3 -1
- package/dist/packages/sdk-ui/src/infra/api/rest-api.d.ts +4 -0
- package/dist/packages/sdk-ui/src/infra/api/types/dashboard-dto.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/app/client-application.d.ts +5 -231
- package/dist/packages/sdk-ui/src/infra/app/helpers.d.ts +16 -0
- package/dist/packages/sdk-ui/src/infra/app/settings/settings.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/app/settings/types/deployment-props.d.ts +3 -0
- package/dist/packages/sdk-ui/src/infra/app/settings/types/features.d.ts +2 -1
- package/dist/packages/sdk-ui/src/infra/app/types.d.ts +236 -0
- package/dist/packages/sdk-ui/src/infra/contexts/sisense-context/sisense-context.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/contexts/theme-provider/theme-context.d.ts +2 -1
- package/dist/packages/sdk-ui/src/infra/decorators/component-decorators/with-tracking/with-tracking.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/decorators/hook-decorators/with-tracking.d.ts +1 -1
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/de-de.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/en-us.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-ar.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/es-es.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/fr-fr.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/it-it.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ja-jp.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ko-kr.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/nl-nl.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/pt-br.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/ru-ru.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/tr-tr.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/__external__/zh-cn.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/en.d.ts +17 -0
- package/dist/packages/sdk-ui/src/infra/translation/resources/index.d.ts +34 -0
- package/dist/packages/sdk-ui/src/modules/ai/use-get-nlq-result.d.ts +1 -0
- package/dist/packages/sdk-ui/src/modules/ai/use-get-query-recommendations.d.ts +1 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/chart/helpers/axis-type-detection.d.ts +17 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/chart/helpers/chart-type-schemas.d.ts +37 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/chart/helpers/index.d.ts +9 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/chart/helpers/translate-data-options.d.ts +9 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/chart/helpers/validate-chart-json.d.ts +19 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/chart/translate-chart-from-json.d.ts +42 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/chart/translate-chart-to-json.d.ts +41 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/dimensions/translate-dimensions-from-json.d.ts +11 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/dimensions/translate-dimensions-to-json.d.ts +22 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{translate-filters-from-json.d.ts → constructs/filters/translate-filters-from-json.d.ts} +2 -2
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{translate-filters-to-json.d.ts → constructs/filters/translate-filters-to-json.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{translate-measures-from-json.d.ts → constructs/measures/translate-measures-from-json.d.ts} +4 -4
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/constructs/measures/translate-measures-to-json.d.ts +22 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/index.d.ts +8 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/pivot-table/helpers/index.d.ts +7 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/pivot-table/helpers/translate-data-options.d.ts +14 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/pivot-table/helpers/validate-pivot-table-json.d.ts +19 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/pivot-table/translate-pivot-table-from-json.d.ts +12 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/pivot-table/translate-pivot-table-to-json.d.ts +12 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/constants.d.ts +8 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{translate-query-from-json.d.ts → query/translate-query-from-json.d.ts} +3 -3
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{translate-query-to-jaql.d.ts → query/translate-query-to-jaql.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{translate-query-to-json.d.ts → query/translate-query-to-json.d.ts} +2 -2
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/adapters.d.ts +19 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/index.d.ts +9 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/translate-axis-from-json.d.ts +24 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/data-options/translate-axis-to-json.d.ts +18 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/custom-formula/process-custom-formula.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/custom-formula/validate-custom-formula.d.ts +13 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/execute-function.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/factory-function-processors.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/factory-function-schemas.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/filter-processors.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/expression/formula-function-schemas.d.ts +25 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/process-arg.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{process-function → shared/expression}/process-node.d.ts +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/attribute-helpers.d.ts +50 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/fuzzy-match.d.ts +16 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/{parse-compose-code.d.ts → shared/utils/parse-compose-code.d.ts} +1 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/schema-index.d.ts +49 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/shared/utils/translation-helpers.d.ts +31 -0
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/types.d.ts +115 -4
- package/dist/packages/sdk-ui/src/modules/analytics-composer/types.d.ts +6 -6
- package/dist/packages/sdk-ui/src/props.d.ts +1 -1
- package/dist/packages/sdk-ui/src/public-api/alpha.d.ts +1 -1
- package/dist/packages/sdk-ui/src/public-api/beta.d.ts +1 -1
- package/dist/packages/sdk-ui/src/public-api/internal.d.ts +8 -6
- package/dist/packages/sdk-ui/src/public-api/public.d.ts +1 -1
- package/dist/packages/sdk-ui/src/public-api/sisense-internal.d.ts +12 -5
- package/dist/packages/sdk-ui/src/shared/components/grouped-items-browser/types.d.ts +7 -1
- package/dist/packages/sdk-ui/src/shared/components/inline-text-editor/inline-text-editor.d.ts +26 -0
- package/dist/packages/sdk-ui/src/shared/components/inline-text-editor/use-blur-on-pointer-down-outside.d.ts +11 -0
- package/dist/packages/sdk-ui/src/shared/components/loading-indicator.d.ts +2 -1
- package/dist/packages/sdk-ui/src/shared/components/quota-notification/quota-notification.d.ts +2 -2
- package/dist/packages/sdk-ui/src/shared/hooks/use-app-settings.d.ts +2 -1
- package/dist/packages/sdk-ui/src/shared/hooks/use-quota-notification.d.ts +4 -4
- package/dist/packages/sdk-ui/src/shared/hooks/use-should-load.d.ts +1 -1
- package/dist/packages/sdk-ui/src/shared/hooks/use-with-change-detection.d.ts +5 -5
- package/dist/packages/sdk-ui/src/types.d.ts +3 -3
- package/dist/{quota-notification-D6oMJal8.js → quota-notification-CVl0isIV.js} +17901 -16770
- package/dist/quota-notification-RAaHp-eO.cjs +713 -0
- package/dist/translations/de-de.cjs +1 -1
- package/dist/translations/de-de.js +19 -2
- package/dist/translations/en-us.cjs +1 -1
- package/dist/translations/en-us.js +1 -1
- package/dist/translations/es-ar.cjs +1 -1
- package/dist/translations/es-ar.js +19 -2
- package/dist/translations/es-es.cjs +1 -1
- package/dist/translations/es-es.js +19 -2
- package/dist/translations/fr-fr.cjs +1 -1
- package/dist/translations/fr-fr.js +19 -2
- package/dist/translations/it-it.cjs +1 -1
- package/dist/translations/it-it.js +19 -2
- package/dist/translations/ja-jp.cjs +1 -1
- package/dist/translations/ja-jp.js +19 -2
- package/dist/translations/ko-kr.cjs +1 -1
- package/dist/translations/ko-kr.js +19 -2
- package/dist/translations/nl-nl.cjs +1 -1
- package/dist/translations/nl-nl.js +19 -2
- package/dist/translations/pt-br.cjs +1 -1
- package/dist/translations/pt-br.js +19 -2
- package/dist/translations/ru-ru.cjs +1 -1
- package/dist/translations/ru-ru.js +19 -2
- package/dist/translations/tr-tr.cjs +1 -1
- package/dist/translations/tr-tr.js +19 -2
- package/dist/translations/zh-cn.cjs +1 -1
- package/dist/translations/zh-cn.js +19 -2
- package/dist/{types-ixSwJkxM.js → types-B96nVbgX.js} +1 -1
- package/dist/{types-CoY6F8Ma.cjs → types-DZ4vWh8j.cjs} +1 -1
- package/dist/{utils-C8YMrOdw.cjs → utils-CgV-jWWQ.cjs} +33 -33
- package/dist/{utils-BP-BglHE.js → utils-ChqSLRbz.js} +3742 -3774
- package/dist/{widget-composer-DI4sHaNe.cjs → widget-composer-Blul90Zb.cjs} +1 -1
- package/dist/{widget-composer-CUUFoCb9.js → widget-composer-Cf_CN3Ux.js} +8 -8
- package/package.json +10 -8
- package/dist/dimensions-BiLyFpCg.js +0 -202
- package/dist/dimensions-X4_igtmO.cjs +0 -1
- package/dist/execute-query-BEeqqDl6.js +0 -5795
- package/dist/execute-query-DJDE0zRU.cjs +0 -1
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/common.d.ts +0 -84
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-dimensions-from-json.d.ts +0 -12
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-dimensions-to-json.d.ts +0 -13
- package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/translate-measures-to-json.d.ts +0 -13
- package/dist/quota-notification-z3dv2KoH.cjs +0 -672
|
@@ -94,6 +94,7 @@ export declare const useGetNlqResultInternal: (params: UseGetNlqResultParams) =>
|
|
|
94
94
|
* ```
|
|
95
95
|
* @returns NLQ load state that contains the status of the execution, the result (data) as WidgetProps
|
|
96
96
|
* @group Generative AI
|
|
97
|
+
*
|
|
97
98
|
* @beta
|
|
98
99
|
*/
|
|
99
100
|
export declare const useGetNlqResult: (params: UseGetNlqResultParams) => UseGetNlqResultState;
|
|
@@ -79,6 +79,7 @@ export declare const useGetQueryRecommendationsInternal: (params: UseGetQueryRec
|
|
|
79
79
|
* ```
|
|
80
80
|
* @returns An array of objects, each containing recommended question text and its corresponding `widgetProps`
|
|
81
81
|
* @group Generative AI
|
|
82
|
+
*
|
|
82
83
|
* @beta
|
|
83
84
|
*/
|
|
84
85
|
export declare const useGetQueryRecommendations: (params: UseGetQueryRecommendationsParams) => UseGetQueryRecommendationsState;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether a dataOptions axis contains dimensions or measures.
|
|
3
|
+
* Uses schema metadata and content-based detection for mixed axes.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import type { DimensionItemJSON, MeasureItemJSON } from '../../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Determines if an axis contains dimensions (vs measures).
|
|
10
|
+
* Uses axis name and type detection to make the determination.
|
|
11
|
+
*
|
|
12
|
+
* @param axisKey - The dataOptions axis key (e.g., 'category', 'value', 'x')
|
|
13
|
+
* @param axisValue - The axis value (dimension or measure item(s))
|
|
14
|
+
* @param chartType - Optional chart type for chart-specific overrides
|
|
15
|
+
* @returns true if the axis contains dimensions, false if measures
|
|
16
|
+
*/
|
|
17
|
+
export declare function isDimensionAxisType(axisKey: string, axisValue: DimensionItemJSON | DimensionItemJSON[] | MeasureItemJSON | MeasureItemJSON[], chartType?: string): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ChartType } from '../../../../../types.js';
|
|
2
|
+
/** Returns a defensive copy of the set of valid chart types. */
|
|
3
|
+
export declare function getValidChartTypes(): Set<string>;
|
|
4
|
+
/** Frozen array of chart types valid for NLQ translation (excludes 'image') */
|
|
5
|
+
export declare const VALID_CHART_TYPES_ARRAY: readonly string[];
|
|
6
|
+
/** Top-level ChartJSON keys */
|
|
7
|
+
export declare const CHART_JSON_TOP_LEVEL_KEYS: readonly ["chartType", "dataOptions", "styleOptions", "filters", "highlights"];
|
|
8
|
+
/** Valid dataOptions axis keys (union of all chart types) */
|
|
9
|
+
export declare const VALID_DATA_OPTIONS_KEYS: Set<string>;
|
|
10
|
+
/** Per-chart-type axes metadata: valid axes and required axes */
|
|
11
|
+
export declare const CHART_TYPE_AXES_METADATA: Record<string, {
|
|
12
|
+
validAxes: Set<string>;
|
|
13
|
+
requiredAxes: string[];
|
|
14
|
+
}>;
|
|
15
|
+
/** Known dimension axes (used for axis type detection) */
|
|
16
|
+
export declare const DIMENSION_AXES: Set<string>;
|
|
17
|
+
/** Known measure axes (used for axis type detection) */
|
|
18
|
+
export declare const MEASURE_AXES: Set<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns valid/required axes metadata for a chart type.
|
|
21
|
+
* Returns defensive copies so callers cannot mutate shared structures.
|
|
22
|
+
*
|
|
23
|
+
* @param chartType - The chart type to look up
|
|
24
|
+
* @returns Metadata (with new Set and array copies) or undefined if chart type is unknown
|
|
25
|
+
*/
|
|
26
|
+
export declare function getChartTypeMetadata(chartType: string): {
|
|
27
|
+
validAxes: Set<string>;
|
|
28
|
+
requiredAxes: readonly string[];
|
|
29
|
+
} | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Type guard: value is a valid ChartType for NLQ translation.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isValidChartType(value: unknown): value is ChartType;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a key is a valid dataOptions axis.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isValidDataOptionsKey(key: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart JSON processing: schema metadata, validation, and translation.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export { CHART_TYPE_AXES_METADATA, DIMENSION_AXES, getChartTypeMetadata, getValidChartTypes, isValidChartType, isValidDataOptionsKey, MEASURE_AXES, VALID_CHART_TYPES_ARRAY, VALID_DATA_OPTIONS_KEYS, } from './chart-type-schemas.js';
|
|
7
|
+
export { isDimensionAxisType } from './axis-type-detection.js';
|
|
8
|
+
export { validateChartJSONStructure } from './validate-chart-json.js';
|
|
9
|
+
export { translateDataOptionsFromJSON } from './translate-data-options.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChartDataOptions } from '../../../../../types.js';
|
|
2
|
+
import { NlqTranslationError } from '../../../types.js';
|
|
3
|
+
import type { DataOptionsJSON, InternalDataSchemaContext } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Translates dataOptions from JSON to CSDK format.
|
|
6
|
+
* Delegates to dimension/measure translators for each axis.
|
|
7
|
+
* Collects errors via collectTranslationErrors; never throws.
|
|
8
|
+
*/
|
|
9
|
+
export declare function translateDataOptionsFromJSON(dataOptionsJSON: DataOptionsJSON | undefined, context: InternalDataSchemaContext, translationErrors: NlqTranslationError[]): ChartDataOptions | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates top-level ChartJSON structure.
|
|
3
|
+
* Detects typos in prop names and invalid chartType values.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import { NlqTranslationError } from '../../../types.js';
|
|
8
|
+
import type { ChartJSON } from '../../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Validates top-level ChartJSON structure.
|
|
11
|
+
* Returns normalized ChartJSON and any structural errors.
|
|
12
|
+
*
|
|
13
|
+
* @param rawInput - Raw input (object) to validate
|
|
14
|
+
* @returns Normalized ChartJSON and array of validation errors
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateChartJSONStructure(rawInput: unknown): {
|
|
17
|
+
normalized: ChartJSON;
|
|
18
|
+
errors: NlqTranslationError[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ChartProps } from '../../../../props.js';
|
|
2
|
+
import { NlqTranslationResult } from '../../types.js';
|
|
3
|
+
import type { ChartInput } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Translates NLQ ChartJSON format to CSDK chart props.
|
|
6
|
+
* Direction: JSON → CSDK
|
|
7
|
+
*
|
|
8
|
+
* Translates chart JSON generated by the NLQ API to CSDK ChartProps object.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* Input:
|
|
12
|
+
* {
|
|
13
|
+
* chartType: 'column',
|
|
14
|
+
* dataOptions: {
|
|
15
|
+
* category: ['DM.Commerce.Date.Years'],
|
|
16
|
+
* value: [
|
|
17
|
+
* { function: 'measureFactory.sum', args: ['DM.Commerce.Revenue', 'Total Revenue'] }
|
|
18
|
+
* ],
|
|
19
|
+
* breakBy: [{ column: 'DM.Commerce.Gender', sortType: 'sortAsc' }]
|
|
20
|
+
* },
|
|
21
|
+
* filters: [
|
|
22
|
+
* { function: 'filterFactory.members', args: ['DM.Commerce.Date.Years', ['2024-01-01T00:00:00']] }
|
|
23
|
+
* ]
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* Output:
|
|
27
|
+
* {
|
|
28
|
+
* chartType: 'column',
|
|
29
|
+
* dataSet: { ... },
|
|
30
|
+
* dataOptions: {
|
|
31
|
+
* category: [Attribute(...), ...],
|
|
32
|
+
* value: [Measure(...), ...],
|
|
33
|
+
* breakBy: [Attribute(...), ...]
|
|
34
|
+
* },
|
|
35
|
+
* filters: [Filter(...), ...]
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* @param input - ChartInput object containing chartJSON and data schema context
|
|
39
|
+
* @returns NlqTranslationResult with ChartProps or errors
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare const translateChartFromJSON: (input: ChartInput) => NlqTranslationResult<ChartProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ChartProps } from '../../../../props.js';
|
|
2
|
+
import { NlqTranslationResult } from '../../types.js';
|
|
3
|
+
import { ChartJSON } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Translates CSDK chart props to NLQ ChartJSON format.
|
|
6
|
+
* Direction: CSDK → JSON
|
|
7
|
+
*
|
|
8
|
+
* Translates CSDK ChartProps object to chart JSON format compatible with NLQ API.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* Input:
|
|
12
|
+
* {
|
|
13
|
+
* chartType: 'column',
|
|
14
|
+
* dataOptions: {
|
|
15
|
+
* category: [Attribute(...)],
|
|
16
|
+
* value: [Measure(...)],
|
|
17
|
+
* breakBy: [Attribute(...)]
|
|
18
|
+
* },
|
|
19
|
+
* filters: [Filter(...)]
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* Output:
|
|
23
|
+
* {
|
|
24
|
+
* chartType: 'column',
|
|
25
|
+
* dataOptions: {
|
|
26
|
+
* category: ['DM.Commerce.Date.Years'],
|
|
27
|
+
* value: [
|
|
28
|
+
* { function: 'measureFactory.sum', args: ['DM.Commerce.Revenue', 'Total Revenue'] }
|
|
29
|
+
* ],
|
|
30
|
+
* breakBy: [{ column: 'DM.Commerce.Gender', sortType: 'sortAsc' }]
|
|
31
|
+
* },
|
|
32
|
+
* filters: [
|
|
33
|
+
* { function: 'filterFactory.members', args: ['DM.Commerce.Date.Years', ['2024-01-01T00:00:00']] }
|
|
34
|
+
* ]
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* @param chartProps - Partial chart props with chartType and dataOptions
|
|
38
|
+
* @returns NlqTranslationResult with ChartJSON or errors
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare const translateChartToJSON: (chartProps: Partial<ChartProps>) => NlqTranslationResult<ChartJSON>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NlqTranslationResult } from '../../../types.js';
|
|
2
|
+
import { DimensionsInput, DimensionTranslationItem } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Translates an array of JSON dimension items (strings or StyledColumnJSON) to enriched format.
|
|
5
|
+
*
|
|
6
|
+
* Direction: JSON → CSDK
|
|
7
|
+
*
|
|
8
|
+
* @param input - DimensionsInput object
|
|
9
|
+
* @returns NlqTranslationResult<DimensionTranslationItem[]>
|
|
10
|
+
*/
|
|
11
|
+
export declare const translateDimensionsFromJSON: (input: DimensionsInput) => NlqTranslationResult<DimensionTranslationItem[]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Attribute, JSONArray } from '@sisense/sdk-data';
|
|
2
|
+
import type { SortDirection } from '@sisense/sdk-data';
|
|
3
|
+
import { NlqTranslationResult } from '../../../types.js';
|
|
4
|
+
/** Runtime StyledColumn: wrapper with column and optional CategoryStyle (from chart dataOptions) */
|
|
5
|
+
type StyledColumn = {
|
|
6
|
+
column: Attribute;
|
|
7
|
+
sortType?: SortDirection;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Translates CSDK Attribute or StyledColumn array to NLQ JSON format (string or StyledColumnJSON array).
|
|
12
|
+
*
|
|
13
|
+
* When an attribute has sort applied (via getSort() or StyledColumn.sortType), or when StyledColumn
|
|
14
|
+
* has other style props (dateFormat, numberFormatConfig, etc.), outputs StyledColumnJSON with all
|
|
15
|
+
* properties; otherwise outputs composeCode string.
|
|
16
|
+
*
|
|
17
|
+
* @param dimensions - Array of CSDK Attribute or StyledColumn objects
|
|
18
|
+
* @returns NlqTranslationResult<JSONArray> - JSON array output for NLQ dimensions
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function translateDimensionsToJSON(dimensions: (Attribute | StyledColumn)[]): NlqTranslationResult<JSONArray>;
|
|
22
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Filter, FilterRelations } from '@sisense/sdk-data';
|
|
2
|
-
import { NlqTranslationResult } from '
|
|
3
|
-
import { FiltersFunctionCallInput, FiltersInput, HighlightsFunctionCallInput, HighlightsInput } from '
|
|
2
|
+
import { NlqTranslationResult } from '../../../types.js';
|
|
3
|
+
import { FiltersFunctionCallInput, FiltersInput, HighlightsFunctionCallInput, HighlightsInput } from '../../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Translate an array of JSON objects to filters
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Filter, FilterRelations, JSONArray } from '@sisense/sdk-data';
|
|
2
|
-
import { NlqTranslationResult } from '
|
|
2
|
+
import { NlqTranslationResult } from '../../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Translates CSDK Filter array or FilterRelations to NLQ JSON format (FunctionCall array).
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Measure } from '@sisense/sdk-data';
|
|
2
|
-
import { NlqTranslationErrorContext, NlqTranslationResult } from '
|
|
3
|
-
import { FunctionCall, InternalDataSchemaContext, MeasuresInput } from '
|
|
2
|
+
import { NlqTranslationErrorContext, NlqTranslationResult } from '../../../types.js';
|
|
3
|
+
import { FunctionCall, InternalDataSchemaContext, MeasuresInput, MeasureTranslationItem } from '../../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Translate a single function call to a measure.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ import { FunctionCall, InternalDataSchemaContext, MeasuresInput } from './types.
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const translateMeasureFromJSONFunctionCall: (functionCall: FunctionCall, context: InternalDataSchemaContext, errorContext: NlqTranslationErrorContext) => NlqTranslationResult<Measure>;
|
|
10
10
|
/**
|
|
11
|
-
* Translates an array of JSON measure items (FunctionCall or StyledMeasureColumnJSON) to
|
|
11
|
+
* Translates an array of JSON measure items (FunctionCall or StyledMeasureColumnJSON) to enriched format.
|
|
12
12
|
*
|
|
13
13
|
* Direction: JSON → CSDK
|
|
14
14
|
*
|
|
@@ -19,4 +19,4 @@ export declare const translateMeasureFromJSONFunctionCall: (functionCall: Functi
|
|
|
19
19
|
* ]
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
export declare const translateMeasuresFromJSON: (input: MeasuresInput) => NlqTranslationResult<
|
|
22
|
+
export declare const translateMeasuresFromJSON: (input: MeasuresInput) => NlqTranslationResult<MeasureTranslationItem[]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSONArray, Measure } from '@sisense/sdk-data';
|
|
2
|
+
import type { SortDirection } from '@sisense/sdk-data';
|
|
3
|
+
import { NlqTranslationResult } from '../../../types.js';
|
|
4
|
+
/** Runtime StyledMeasureColumn: wrapper with column and optional style (from chart dataOptions) */
|
|
5
|
+
type StyledMeasureColumn = {
|
|
6
|
+
column: Measure;
|
|
7
|
+
sortType?: SortDirection;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Translates CSDK Measure or StyledMeasureColumn array to NLQ JSON format (FunctionCall or StyledMeasureColumnJSON array).
|
|
12
|
+
*
|
|
13
|
+
* When a measure has sort applied (via getSort() or StyledMeasureColumn.sortType), or when StyledMeasureColumn
|
|
14
|
+
* has other style props (trend, forecast, numberFormatConfig, etc.), outputs StyledMeasureColumnJSON;
|
|
15
|
+
* otherwise outputs the parsed FunctionCall.
|
|
16
|
+
*
|
|
17
|
+
* @param measures - Array of CSDK Measure or StyledMeasureColumn objects
|
|
18
|
+
* @returns NlqTranslationResult<JSONArray> - JSON array output for NLQ measures
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare function translateMeasuresToJSON(measures: (Measure | StyledMeasureColumn)[]): NlqTranslationResult<JSONArray>;
|
|
22
|
+
export {};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
export * from './translate-query-from-json.js';
|
|
2
|
-
export * from './translate-query-to-json.js';
|
|
3
|
-
export * from './translate-
|
|
1
|
+
export * from './query/translate-query-from-json.js';
|
|
2
|
+
export * from './query/translate-query-to-json.js';
|
|
3
|
+
export * from './chart/translate-chart-from-json.js';
|
|
4
|
+
export * from './chart/translate-chart-to-json.js';
|
|
5
|
+
export * from './pivot-table/translate-pivot-table-from-json.js';
|
|
6
|
+
export * from './pivot-table/translate-pivot-table-to-json.js';
|
|
7
|
+
export * from './query/translate-query-to-jaql.js';
|
|
8
|
+
export type { ChartJSON, DataOptionsJSON, ChartInput, PivotTableJSON, PivotTableDataOptionsJSON, PivotTableInput, } from './types.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translates pivot table dataOptions from JSON to CSDK format.
|
|
3
|
+
* Uses shared translateSingleAxisFromJSON for rows, columns, values.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import type { PivotTableDataOptions } from '../../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
8
|
+
import { NlqTranslationError } from '../../../types.js';
|
|
9
|
+
import type { InternalDataSchemaContext, PivotTableDataOptionsJSON } from '../../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Translates pivot table dataOptions from JSON to CSDK format.
|
|
12
|
+
* Pivot has fixed axes: rows/columns (dimensions), values (measures), grandTotals (passthrough).
|
|
13
|
+
*/
|
|
14
|
+
export declare function translatePivotTableDataOptionsFromJSON(dataOptionsJSON: PivotTableDataOptionsJSON | undefined, context: InternalDataSchemaContext, translationErrors: NlqTranslationError[]): PivotTableDataOptions | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates top-level PivotTableJSON structure.
|
|
3
|
+
* Detects typos in prop names and invalid dataOptions structure.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import { NlqTranslationError } from '../../../types.js';
|
|
8
|
+
import type { PivotTableJSON } from '../../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Validates top-level PivotTableJSON structure.
|
|
11
|
+
* Returns normalized PivotTableJSON and any structural errors.
|
|
12
|
+
*
|
|
13
|
+
* @param rawInput - Raw input (object) to validate
|
|
14
|
+
* @returns Normalized PivotTableJSON and array of validation errors
|
|
15
|
+
*/
|
|
16
|
+
export declare function validatePivotTableJSONStructure(rawInput: unknown): {
|
|
17
|
+
normalized: PivotTableJSON;
|
|
18
|
+
errors: NlqTranslationError[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PivotTableProps } from '../../../../props.js';
|
|
2
|
+
import { NlqTranslationResult } from '../../types.js';
|
|
3
|
+
import type { PivotTableInput } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Translates NLQ PivotTableJSON format to CSDK pivot table props.
|
|
6
|
+
* Direction: JSON → CSDK
|
|
7
|
+
*
|
|
8
|
+
* @param input - PivotTableInput object containing pivotTableJSON and data schema context
|
|
9
|
+
* @returns NlqTranslationResult with PivotTableProps or errors
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const translatePivotTableFromJSON: (input: PivotTableInput) => NlqTranslationResult<PivotTableProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PivotTableProps } from '../../../../props.js';
|
|
2
|
+
import { NlqTranslationResult } from '../../types.js';
|
|
3
|
+
import type { PivotTableJSON } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Translates CSDK pivot table props to NLQ PivotTableJSON format.
|
|
6
|
+
* Direction: CSDK → JSON
|
|
7
|
+
*
|
|
8
|
+
* @param pivotTableProps - Partial pivot table props with dataOptions
|
|
9
|
+
* @returns NlqTranslationResult with PivotTableJSON or errors
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const translatePivotTableToJSON: (pivotTableProps: Partial<PivotTableProps>) => NlqTranslationResult<PivotTableJSON>;
|
package/dist/packages/sdk-ui/src/modules/analytics-composer/nlq-v3-translator/query/constants.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name prefixes for trend and forecast measures in query JSON.
|
|
3
|
+
* Aligns with chart behavior so generated measure names are consistent.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const TREND_PREFIX = "$trend";
|
|
8
|
+
export declare const FORECAST_PREFIX = "$forecast";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseQueryParams } from '
|
|
2
|
-
import { NlqTranslationResult } from '
|
|
3
|
-
import { QueryInput } from '
|
|
1
|
+
import { BaseQueryParams } from '../../../../domains/query-execution/index.js';
|
|
2
|
+
import { NlqTranslationResult } from '../../types.js';
|
|
3
|
+
import { QueryInput } from '../../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Translates NLQ JSON format to CSDK BaseQueryParams object.
|
|
6
6
|
* Direction: JSON → CSDK
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DataSource } from '@sisense/sdk-data';
|
|
2
2
|
import type { JaqlQueryPayload } from '@sisense/sdk-query-client';
|
|
3
|
-
import { BaseQueryParams } from '
|
|
3
|
+
import { BaseQueryParams } from '../../../../domains/query-execution/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Converts BaseQueryParams to JAQL payload
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseQueryParams } from '
|
|
2
|
-
import { NlqResponseJSON, NlqTranslationResult } from '
|
|
1
|
+
import { BaseQueryParams } from '../../../../domains/query-execution/index.js';
|
|
2
|
+
import { NlqResponseJSON, NlqTranslationResult } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Translates CSDK BaseQueryParams to NLQ JSON format.
|
|
5
5
|
* Direction: CSDK → JSON
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Attribute, Measure } from '@sisense/sdk-data';
|
|
2
|
+
import type { JSONArray } from '@sisense/sdk-data';
|
|
3
|
+
import type { StyledColumn, StyledMeasureColumn } from '../../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
4
|
+
import type { NlqTranslationError } from '../../../types.js';
|
|
5
|
+
import type { DimensionItemJSON, DimensionTranslationItem, MeasureItemJSON, MeasureTranslationItem } from '../../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Shared adapters and utilities for data options translation.
|
|
8
|
+
* Used by chart and pivot-table translators.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export type AxisType = 'dimension' | 'measure';
|
|
13
|
+
export declare function adaptDimensionsToStyledColumn(items: DimensionTranslationItem[]): (Attribute | StyledColumn)[];
|
|
14
|
+
export declare function adaptMeasuresToStyledMeasureColumn(items: MeasureTranslationItem[]): (Measure | StyledMeasureColumn)[];
|
|
15
|
+
export declare function toJSONArray(value: DimensionItemJSON | DimensionItemJSON[] | MeasureItemJSON | MeasureItemJSON[]): JSONArray;
|
|
16
|
+
/**
|
|
17
|
+
* Maps inner translation errors to dataOptions axis context.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withAxisContext(axisKey: string): (e: NlqTranslationError) => NlqTranslationError;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared data options translation utilities.
|
|
3
|
+
* Used by chart and pivot-table translators.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export { adaptDimensionsToStyledColumn, adaptMeasuresToStyledMeasureColumn, toJSONArray, withAxisContext, } from './adapters.js';
|
|
8
|
+
export { translateSingleAxisFromJSON, type AxisType, type TranslatedAxis, } from './translate-axis-from-json.js';
|
|
9
|
+
export { translateSingleAxisToJSON } from './translate-axis-to-json.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translates a single data options axis from JSON to CSDK format.
|
|
3
|
+
* Shared by chart and pivot-table translators.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import type { Attribute, Measure } from '@sisense/sdk-data';
|
|
8
|
+
import type { StyledColumn, StyledMeasureColumn } from '../../../../../domains/visualizations/core/chart-data-options/types.js';
|
|
9
|
+
import type { NlqTranslationError } from '../../../types.js';
|
|
10
|
+
import type { InternalDataSchemaContext } from '../../types.js';
|
|
11
|
+
import { type AxisType } from './adapters.js';
|
|
12
|
+
export type { AxisType };
|
|
13
|
+
export type TranslatedAxis = (Attribute | StyledColumn)[] | (Measure | StyledMeasureColumn)[];
|
|
14
|
+
/**
|
|
15
|
+
* Translates a single axis from JSON to CSDK format.
|
|
16
|
+
*
|
|
17
|
+
* @param axisKey - The axis key (e.g. 'category', 'value', 'rows', 'columns')
|
|
18
|
+
* @param axisValue - The axis value (array or single item)
|
|
19
|
+
* @param axisType - Whether the axis contains dimensions or measures
|
|
20
|
+
* @param context - Schema context for translation
|
|
21
|
+
* @param translationErrors - Array to collect errors into
|
|
22
|
+
* @returns Translated array or null if translation failed
|
|
23
|
+
*/
|
|
24
|
+
export declare function translateSingleAxisFromJSON(axisKey: string, axisValue: unknown, axisType: AxisType, context: InternalDataSchemaContext, translationErrors: NlqTranslationError[]): TranslatedAxis | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translates a single data options axis from CSDK to JSON format.
|
|
3
|
+
* Shared by chart and pivot-table translators.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import type { NlqTranslationResult } from '../../../types.js';
|
|
8
|
+
import type { DimensionItemJSON, MeasureItemJSON } from '../../types.js';
|
|
9
|
+
import type { AxisType } from './adapters.js';
|
|
10
|
+
/**
|
|
11
|
+
* Translates a single axis from CSDK to JSON format.
|
|
12
|
+
*
|
|
13
|
+
* @param axisKey - The axis key (for error messages)
|
|
14
|
+
* @param axisValue - The axis value (array or single item)
|
|
15
|
+
* @param axisType - Whether the axis contains dimensions or measures
|
|
16
|
+
* @returns NlqTranslationResult with translated JSON array
|
|
17
|
+
*/
|
|
18
|
+
export declare function translateSingleAxisToJSON(axisKey: string, axisValue: unknown, axisType: AxisType): NlqTranslationResult<DimensionItemJSON[] | MeasureItemJSON[]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SchemaIndex } from '../../utils/schema-index.js';
|
|
1
2
|
export interface FormulaValidationResult {
|
|
2
3
|
isValid: boolean;
|
|
3
4
|
errors: string[];
|
|
@@ -14,7 +15,19 @@ export interface FormulaValidationOptions {
|
|
|
14
15
|
allowEmptyFormula?: boolean;
|
|
15
16
|
/** Custom error message prefix for better context */
|
|
16
17
|
errorPrefix?: string;
|
|
18
|
+
/** When provided, time-diff args are validated as datetime dimensions and level-matched */
|
|
19
|
+
schemaIndex?: SchemaIndex;
|
|
17
20
|
}
|
|
21
|
+
export interface TimeDiffCall {
|
|
22
|
+
functionName: string;
|
|
23
|
+
ref1: string;
|
|
24
|
+
ref2: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Extracts time-diff (or other two-arg bracket) calls from a formula string.
|
|
28
|
+
* Matches FUNC([ref1], [ref2]) for each function name in the set (case-insensitive).
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseTimeDiffCalls(formula: string, functionNames: readonly string[]): TimeDiffCall[];
|
|
18
31
|
/**
|
|
19
32
|
* Validates that all bracket references in a custom formula exist in the provided context
|
|
20
33
|
* and provides helpful error messages for debugging.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Custom processing registry for factory functions that require complex validation
|
|
3
3
|
* and transformation beyond basic argument type checking.
|
|
4
4
|
*/
|
|
5
|
-
import { CustomFunctionProcessor } from '
|
|
5
|
+
import { CustomFunctionProcessor } from '../../types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Registry mapping function paths to their custom processing functions.
|
|
8
8
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Comprehensive schema definitions for validating arguments to measureFactory and filterFactory functions.
|
|
3
3
|
*/
|
|
4
|
-
import { ArgSchema } from '
|
|
4
|
+
import { ArgSchema } from '../../types.js';
|
|
5
5
|
export declare const FACTORY_FUNCTION_SCHEMAS: Record<string, ArgSchema[]>;
|
|
6
6
|
/**
|
|
7
7
|
* Utility functions for working with function schemas
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Category of formula function for validation and translation. */
|
|
2
|
+
export type FormulaFunctionCategory = 'time-diff' | 'aggregative' | 'math' | 'growth' | 'date';
|
|
3
|
+
/** Metadata for a formula function (e.g. DDIFF, SUM). */
|
|
4
|
+
export interface FormulaFunctionMeta {
|
|
5
|
+
category: FormulaFunctionCategory;
|
|
6
|
+
argCount: number;
|
|
7
|
+
/** Required date level for time-diff functions (e.g. DateLevels.Days for DDIFF). */
|
|
8
|
+
requiredDateLevel?: string;
|
|
9
|
+
/** Argument type constraint; 'datetime' means args must be datetime dimensions. */
|
|
10
|
+
argType?: 'datetime';
|
|
11
|
+
}
|
|
12
|
+
/** Registry keyed by formula function name (uppercase). */
|
|
13
|
+
export declare const FORMULA_FUNCTION_SCHEMAS: Record<string, FormulaFunctionMeta>;
|
|
14
|
+
/**
|
|
15
|
+
* Returns formula function names that are time-diff (SDIFF, MNDIFF, HDIFF, DDIFF, MDIFF, QDIFF, YDIFF).
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTimeDiffFormulaFunctions(): readonly string[];
|
|
18
|
+
/**
|
|
19
|
+
* Returns the required date level for a time-diff function, or undefined if not a time-diff function.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRequiredDateLevel(formulaFunctionName: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Returns formula function names for a given category.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getFormulaFunctionsByCategory(category: FormulaFunctionCategory): readonly string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeInput, QueryElement } from '
|
|
1
|
+
import { NodeInput, QueryElement } from '../../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Recursively processes a parsed JSON object to execute filterFactory and measureFactory functions.
|
|
4
4
|
* It includes comprehensive validation based on function schemas.
|