@infomaximum/widget-sdk 7.0.0-17 → 7.0.0-18

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [7.0.0-18](https://github.com/Infomaximum/widget-sdk/compare/v7.0.0-17...v7.0.0-18) (2026-04-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * внедрены extendWithMeta и omitWithMeta в схемы ([5f9cddd](https://github.com/Infomaximum/widget-sdk/commit/5f9cdddec5a78b38a61f831fde705741a03da243))
11
+ * добавлены утилиты для работы с мета-цепочкой Zod-схем ([949b27d](https://github.com/Infomaximum/widget-sdk/commit/949b27d1e8822976d051caa361c766bceabd7d67))
12
+
5
13
  ## [7.0.0-17](https://github.com/Infomaximum/widget-sdk/compare/v7.0.0-16...v7.0.0-17) (2026-04-15)
6
14
 
7
15
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as zod from 'zod';
2
- import { ZodType, z } from 'zod';
2
+ import { ZodType, z, ZodObject } from 'zod';
3
3
  import * as zod_v4_core from 'zod/v4/core';
4
4
  import * as _infomaximum_bi_formatting from '@infomaximum/bi-formatting';
5
5
  import { EFormatTypes, EFormattingPresets } from '@infomaximum/bi-formatting';
@@ -19737,6 +19737,63 @@ interface ITheme {
19737
19737
  */
19738
19738
  declare const themed: <Value, Theme = ITheme>(scheme: ZodType<Value>, selectThemeValue: (theme: Theme) => Value) => ZodType<Value, unknown, zod_v4_core.$ZodTypeInternals<Value, unknown>>;
19739
19739
 
19740
+ /**
19741
+ * Возвращает родительскую мету схемы, установленную через extendWithMeta / omitWithMeta.
19742
+ * Используй для обхода цепочки наследования схем.
19743
+ */
19744
+ declare function getParentMeta(meta: Record<string, unknown>): Record<string, unknown> | undefined;
19745
+ /**
19746
+ * Расширяет Zod-схему дополнительными полями, сохраняя цепочку наследования мет.
19747
+ *
19748
+ * Мета базовой схемы сохраняется как `parent` в мете расширенной схемы — формируя
19749
+ * иммутабельный связанный список.
19750
+ *
19751
+ * Используй вместо `.extend()` при расширении схем, задекларированных через
19752
+ * `SchemaRegistry.define`, — это обязательное условие корректной работы миграций.
19753
+ *
19754
+ * @example
19755
+ * // Вместо:
19756
+ * DimensionSchema(z).extend({ color: ColorSchema(z) })
19757
+ *
19758
+ * // Используй:
19759
+ * extendWithMeta(DimensionSchema(z), { color: ColorSchema(z) })
19760
+ */
19761
+ declare function extendWithMeta<TShape extends Record<string, any>, TConfig extends {
19762
+ out: Record<string, any>;
19763
+ in: Record<string, any>;
19764
+ }, U extends Record<string, any>>(schema: ZodObject<TShape, TConfig>, extension: U): ZodObject<(keyof TShape & keyof U extends never ? TShape & U : { [K in keyof TShape as K extends keyof U ? never : K]: TShape[K]; } & { [K_1 in keyof U]: U[K_1]; }) extends infer T ? { [k in keyof T]: (keyof TShape & keyof U extends never ? TShape & U : { [K in keyof TShape as K extends keyof U ? never : K]: TShape[K]; } & { [K_1 in keyof U]: U[K_1]; })[k]; } : never, TConfig>;
19765
+ /**
19766
+ * Создаёт Zod-схему с удалёнными полями, сохраняя цепочку наследования мет.
19767
+ *
19768
+ * Мета базовой схемы сохраняется как `parent` в мете результирующей схемы.
19769
+ *
19770
+ * Используй вместо `.omit()` при работе со схемами, задекларированными через
19771
+ * `SchemaRegistry.define`, — это обязательное условие корректной работы миграций.
19772
+ *
19773
+ * @example
19774
+ * // Вместо:
19775
+ * BaseWidgetSettingsSchema(z).omit({ paddings: true })
19776
+ *
19777
+ * // Используй:
19778
+ * omitWithMeta(BaseWidgetSettingsSchema(z), { paddings: true })
19779
+ */
19780
+ declare function omitWithMeta<TShape extends Record<string, any>, TConfig extends {
19781
+ out: Record<string, any>;
19782
+ in: Record<string, any>;
19783
+ }, M extends {
19784
+ [k in keyof TShape]?: true;
19785
+ }>(schema: ZodObject<TShape, TConfig>, keys: M): ZodObject<Omit<TShape, Extract<keyof TShape, keyof M>> extends infer T ? { [k in keyof T]: Omit<TShape, Extract<keyof TShape, keyof M>>[k]; } : never, TConfig>;
19786
+ /**
19787
+ * Проверяет, есть ли в цепочке наследования мет узел, удовлетворяющий предикату.
19788
+ *
19789
+ * Обходит цепочку от текущей меты к корню через ссылки parent, установленные
19790
+ * функциями extendWithMeta / omitWithMeta.
19791
+ *
19792
+ * @example
19793
+ * hasInMetaChain(schema.meta(), (meta) => meta.type === "WidgetDimension")
19794
+ */
19795
+ declare function hasInMetaChain(meta: Record<string, unknown> | undefined, predicate: (meta: Record<string, unknown>) => boolean): boolean;
19796
+
19740
19797
  /**
19741
19798
  * Глобальный реестр версионированных схем (публичный слой, только чтение).
19742
19799
  *
@@ -19771,4 +19828,4 @@ declare global {
19771
19828
  }
19772
19829
  }
19773
19830
 
19774
- export { ActionButtonSchema, ActionDrillDownSchema, ActionGoToURLSchema, ActionOnClickParameterSchema, ActionOpenInSchema, ActionOpenViewSchema, ActionRunScriptSchema, ActionSchema, ActionUpdateVariableSchema, ActionsOnClickSchema, AutoIdentifiedArrayItemSchema, BaseWidgetSettingsSchema, ColorAutoSchema, ColorBaseSchema, ColorByDimensionSchema, ColorDisabledSchema, ColorFormulaSchema, ColorGradientSchema, ColorRuleSchema, ColorSchema, ColorValuesSchema, ColoredValueSchema, ColumnIndicatorValueSchema, DimensionProcessFilterSchema, DimensionValueSchema, DisplayConditionSchema, EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormulaFilterFieldKeys, EHeightMode, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureInnerTemplateNames, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESettingsSchemaMetaKey, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, ExtendedFormulaFilterValueSchema, FormatSchema, FormattingSchema, FormulaFilterValueSchema, FormulaNullableSchema, FormulaSchema, type IActionButton, type IActionDrillDown, type IActionGoToUrl, type IActionOnClickControl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorOptions, type ICollapseRecord, type IColorPickerControl, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlProps, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionAddButtonProps, type IDimensionProcessFilter, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayConditionControl, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IEventsColorControl, type IEventsPickerControl, type IExportColumnOrder, type IFillSettings, type IFilterControl, type IFormattingControl, type IFormattingTemplateControl, type IFormulaControl, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGradient, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IHistoricalSchemaDefinition, type IIndicatorLink, type IInitialSettings, type IInputControl, type IInputMarkdownControl, type IInputNumberControl, type IInputRangeControl, type IInputTemplatedControl, type ILens, type ILifecycleRuntime, type ILifecycleRuntimeFactory, type IMarkdownMeasure, type IMeasureAddButtonProps, type IMigrateContext, type IPanelDescription, type IPanelDescriptionCreator, type IParameterFromAggregation, type IParameterFromColumn, type IParameterFromDynamicList, type IParameterFromEndEvent, type IParameterFromEvent, type IParameterFromFormula, type IParameterFromManualInput, type IParameterFromStartEvent, type IParameterFromStaticList, type IParameterFromVariable, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessFilterPreviewParams, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRadioIconGroupControl, type IRange, type ISchemaContext, type ISchemaFactory, type ISelectBranchOption, type ISelectControl, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISizeControl, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ISwitchControl, type ITagSetControl, type ITheme, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type ITypedFormulaControl, type IVertex, type IViewAction, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDimensionInHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, KeyNullableSchema, MarkdownMeasureSchema, MeasureValueSchema, NameNullableSchema, OuterAggregation, ParameterFromAggregationSchema, ParameterFromColumnSchema, ParameterFromDataModelSchema, ParameterFromDynamicListSchema, ParameterFromEndEventSchema, ParameterFromEventSchema, ParameterFromFormulaSchema, ParameterFromManualInputSchema, ParameterFromStartEventSchema, ParameterFromStaticListSchema, ParameterFromVariableSchema, ProcessIndicatorSchema, ProcessIndicatorValueSchema, RangeSchema, SchemaRegistryReader, SettingsFilterSchema, SortDirectionSchema, SortOrderSchema, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsConfig, type TActionsOnClick, type TAddButton, type TAddButtonProps, type TApiVersion, type TBoundedContentWithIndicator, type TColor, type TColorBase, type TColorRule, type TColumnIndicatorValue, type TConditionalDimensionInHierarchy, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TControlUnion, type TControlsSpecMap, type TCustomAddButtonSelectOption, type TCustomControlFactories, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGradientsSetValue, type TGroupLevelRecord, type THSLTuple, type THintPlacement, type TLaunchActionParams, type TLimitedColor, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TParameterFromDataModel, type TProcessIndicatorValue, type TRGBTuple, type TRecordAccessor, type TSchemaType, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSettingsFilter, type TSettingsOf, type TSortDirection, type TTabsHorizontalAlignment, type TUpdateSelection, type TValuePath, type TVersion, type TViewActionParameter, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetDimensionUnion, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetMeasureData, type TWidgetSortingValue, type TWidgetVariable, type TWidgetsPaletteValue, type TZod, VersionedSchemaFactory, ViewActionParameterSchema, ViewActionSchema, WidgetActionParameterSchema, WidgetActionSchema, WidgetColumnIndicatorSchema, WidgetDimensionHierarchySchema, WidgetDimensionInHierarchySchema, WidgetDimensionSchema, WidgetIndicatorAggregationValueSchema, WidgetIndicatorConversionValueSchema, WidgetIndicatorDurationValueSchema, WidgetIndicatorFormulaValueSchema, WidgetIndicatorSchema, WidgetIndicatorTemplateValueSchema, WidgetIndicatorTimeValueSchema, WidgetMeasureAggregationValueSchema, WidgetMeasureSchema, WidgetPresetSettingsSchema, WidgetSortingIndicatorSchema, WidgetSortingValueSchema, apiVersion, apiVersions, applyIndexToArrayFormula, availableFormatsBySimpleType, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, defaultActionsConfig, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, hexToRgb, inheritDisplayConditionFromHierarchy, interpolateHexColor, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureInnerTemplateFormulas, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, themed, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
19831
+ export { ActionButtonSchema, ActionDrillDownSchema, ActionGoToURLSchema, ActionOnClickParameterSchema, ActionOpenInSchema, ActionOpenViewSchema, ActionRunScriptSchema, ActionSchema, ActionUpdateVariableSchema, ActionsOnClickSchema, AutoIdentifiedArrayItemSchema, BaseWidgetSettingsSchema, ColorAutoSchema, ColorBaseSchema, ColorByDimensionSchema, ColorDisabledSchema, ColorFormulaSchema, ColorGradientSchema, ColorRuleSchema, ColorSchema, ColorValuesSchema, ColoredValueSchema, ColumnIndicatorValueSchema, DimensionProcessFilterSchema, DimensionValueSchema, DisplayConditionSchema, EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormulaFilterFieldKeys, EHeightMode, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureInnerTemplateNames, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESettingsSchemaMetaKey, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, ExtendedFormulaFilterValueSchema, FormatSchema, FormattingSchema, FormulaFilterValueSchema, FormulaNullableSchema, FormulaSchema, type IActionButton, type IActionDrillDown, type IActionGoToUrl, type IActionOnClickControl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorOptions, type ICollapseRecord, type IColorPickerControl, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlProps, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionAddButtonProps, type IDimensionProcessFilter, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayConditionControl, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IEventsColorControl, type IEventsPickerControl, type IExportColumnOrder, type IFillSettings, type IFilterControl, type IFormattingControl, type IFormattingTemplateControl, type IFormulaControl, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGradient, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IHistoricalSchemaDefinition, type IIndicatorLink, type IInitialSettings, type IInputControl, type IInputMarkdownControl, type IInputNumberControl, type IInputRangeControl, type IInputTemplatedControl, type ILens, type ILifecycleRuntime, type ILifecycleRuntimeFactory, type IMarkdownMeasure, type IMeasureAddButtonProps, type IMigrateContext, type IPanelDescription, type IPanelDescriptionCreator, type IParameterFromAggregation, type IParameterFromColumn, type IParameterFromDynamicList, type IParameterFromEndEvent, type IParameterFromEvent, type IParameterFromFormula, type IParameterFromManualInput, type IParameterFromStartEvent, type IParameterFromStaticList, type IParameterFromVariable, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessFilterPreviewParams, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRadioIconGroupControl, type IRange, type ISchemaContext, type ISchemaFactory, type ISelectBranchOption, type ISelectControl, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISizeControl, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ISwitchControl, type ITagSetControl, type ITheme, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type ITypedFormulaControl, type IVertex, type IViewAction, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDimensionInHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, KeyNullableSchema, MarkdownMeasureSchema, MeasureValueSchema, NameNullableSchema, OuterAggregation, ParameterFromAggregationSchema, ParameterFromColumnSchema, ParameterFromDataModelSchema, ParameterFromDynamicListSchema, ParameterFromEndEventSchema, ParameterFromEventSchema, ParameterFromFormulaSchema, ParameterFromManualInputSchema, ParameterFromStartEventSchema, ParameterFromStaticListSchema, ParameterFromVariableSchema, ProcessIndicatorSchema, ProcessIndicatorValueSchema, RangeSchema, SchemaRegistryReader, SettingsFilterSchema, SortDirectionSchema, SortOrderSchema, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsConfig, type TActionsOnClick, type TAddButton, type TAddButtonProps, type TApiVersion, type TBoundedContentWithIndicator, type TColor, type TColorBase, type TColorRule, type TColumnIndicatorValue, type TConditionalDimensionInHierarchy, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TControlUnion, type TControlsSpecMap, type TCustomAddButtonSelectOption, type TCustomControlFactories, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGradientsSetValue, type TGroupLevelRecord, type THSLTuple, type THintPlacement, type TLaunchActionParams, type TLimitedColor, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TParameterFromDataModel, type TProcessIndicatorValue, type TRGBTuple, type TRecordAccessor, type TSchemaType, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSettingsFilter, type TSettingsOf, type TSortDirection, type TTabsHorizontalAlignment, type TUpdateSelection, type TValuePath, type TVersion, type TViewActionParameter, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetDimensionUnion, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetMeasureData, type TWidgetSortingValue, type TWidgetVariable, type TWidgetsPaletteValue, type TZod, VersionedSchemaFactory, ViewActionParameterSchema, ViewActionSchema, WidgetActionParameterSchema, WidgetActionSchema, WidgetColumnIndicatorSchema, WidgetDimensionHierarchySchema, WidgetDimensionInHierarchySchema, WidgetDimensionSchema, WidgetIndicatorAggregationValueSchema, WidgetIndicatorConversionValueSchema, WidgetIndicatorDurationValueSchema, WidgetIndicatorFormulaValueSchema, WidgetIndicatorSchema, WidgetIndicatorTemplateValueSchema, WidgetIndicatorTimeValueSchema, WidgetMeasureAggregationValueSchema, WidgetMeasureSchema, WidgetPresetSettingsSchema, WidgetSortingIndicatorSchema, WidgetSortingValueSchema, apiVersion, apiVersions, applyIndexToArrayFormula, availableFormatsBySimpleType, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, defaultActionsConfig, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, extendWithMeta, fillTemplateSql, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getMeasureFormula, getParentMeta, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, hasInMetaChain, hexToRgb, inheritDisplayConditionFromHierarchy, interpolateHexColor, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureInnerTemplateFormulas, measureTemplateFormulas, omitWithMeta, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, themed, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.esm.js CHANGED
@@ -730,12 +730,84 @@ var FormulaNullableSchema = SchemaRegistry.define({
730
730
  },
731
731
  });
732
732
 
733
+ // NOTE: В будущем можно сделать fluent-обёртку для цепочных вызовов:
734
+ // withMetaDecorator(schema).omit({ field: true }).extend({ newField: z.string() })
735
+ // Это позволит избежать вложенных вызовов omitWithMeta/extendWithMeta.
736
+ var PARENT_META_KEY = "parent";
737
+ /**
738
+ * Возвращает родительскую мету схемы, установленную через extendWithMeta / omitWithMeta.
739
+ * Используй для обхода цепочки наследования схем.
740
+ */
741
+ function getParentMeta(meta) {
742
+ return meta[PARENT_META_KEY];
743
+ }
744
+ function inheritMeta(target, source) {
745
+ var _a;
746
+ var sourceMeta = source.meta();
747
+ return sourceMeta !== undefined ? target.meta((_a = {}, _a[PARENT_META_KEY] = sourceMeta, _a)) : target;
748
+ }
749
+ /**
750
+ * Расширяет Zod-схему дополнительными полями, сохраняя цепочку наследования мет.
751
+ *
752
+ * Мета базовой схемы сохраняется как `parent` в мете расширенной схемы — формируя
753
+ * иммутабельный связанный список.
754
+ *
755
+ * Используй вместо `.extend()` при расширении схем, задекларированных через
756
+ * `SchemaRegistry.define`, — это обязательное условие корректной работы миграций.
757
+ *
758
+ * @example
759
+ * // Вместо:
760
+ * DimensionSchema(z).extend({ color: ColorSchema(z) })
761
+ *
762
+ * // Используй:
763
+ * extendWithMeta(DimensionSchema(z), { color: ColorSchema(z) })
764
+ */
765
+ function extendWithMeta(schema, extension) {
766
+ return inheritMeta(schema.extend(extension), schema);
767
+ }
768
+ /**
769
+ * Создаёт Zod-схему с удалёнными полями, сохраняя цепочку наследования мет.
770
+ *
771
+ * Мета базовой схемы сохраняется как `parent` в мете результирующей схемы.
772
+ *
773
+ * Используй вместо `.omit()` при работе со схемами, задекларированными через
774
+ * `SchemaRegistry.define`, — это обязательное условие корректной работы миграций.
775
+ *
776
+ * @example
777
+ * // Вместо:
778
+ * BaseWidgetSettingsSchema(z).omit({ paddings: true })
779
+ *
780
+ * // Используй:
781
+ * omitWithMeta(BaseWidgetSettingsSchema(z), { paddings: true })
782
+ */
783
+ function omitWithMeta(schema, keys) {
784
+ return inheritMeta(schema.omit(keys), schema);
785
+ }
786
+ /**
787
+ * Проверяет, есть ли в цепочке наследования мет узел, удовлетворяющий предикату.
788
+ *
789
+ * Обходит цепочку от текущей меты к корню через ссылки parent, установленные
790
+ * функциями extendWithMeta / omitWithMeta.
791
+ *
792
+ * @example
793
+ * hasInMetaChain(schema.meta(), (meta) => meta.type === "WidgetDimension")
794
+ */
795
+ function hasInMetaChain(meta, predicate) {
796
+ var current = meta;
797
+ while (current !== undefined) {
798
+ if (predicate(current))
799
+ return true;
800
+ current = getParentMeta(current);
801
+ }
802
+ return false;
803
+ }
804
+
733
805
  var WidgetIndicatorSchema = SchemaRegistry.define({
734
806
  key: "WidgetIndicator",
735
807
  latestVersion: "17",
736
808
  history: {
737
809
  "17": function (z) {
738
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
810
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
739
811
  name: z.string(),
740
812
  });
741
813
  },
@@ -786,7 +858,7 @@ var WidgetColumnIndicatorSchema = SchemaRegistry.define({
786
858
  latestVersion: "17",
787
859
  history: {
788
860
  "17": function (z) {
789
- return WidgetIndicatorSchema.forVersion("17")(z).extend({
861
+ return extendWithMeta(WidgetIndicatorSchema.forVersion("17")(z), {
790
862
  dbDataType: z.string().optional(),
791
863
  format: FormatSchema.forVersion("17")(z).optional(),
792
864
  formatting: FormattingSchema.forVersion("17")(z).optional(),
@@ -841,7 +913,7 @@ var MeasureValueSchema = SchemaRegistry.define({
841
913
  "17": function (z) {
842
914
  return z.discriminatedUnion("mode", [
843
915
  WidgetIndicatorFormulaValueSchema.forVersion("17")(z),
844
- WidgetIndicatorTemplateValueSchema.forVersion("17")(z).extend({
916
+ extendWithMeta(WidgetIndicatorTemplateValueSchema.forVersion("17")(z), {
845
917
  innerTemplateName: z.enum(EMeasureInnerTemplateNames).optional(),
846
918
  }),
847
919
  ]);
@@ -855,7 +927,7 @@ var DimensionValueSchema = SchemaRegistry.define({
855
927
  "17": function (z) {
856
928
  return z.discriminatedUnion("mode", [
857
929
  WidgetIndicatorFormulaValueSchema.forVersion("17")(z),
858
- WidgetIndicatorTemplateValueSchema.forVersion("17")(z).extend({
930
+ extendWithMeta(WidgetIndicatorTemplateValueSchema.forVersion("17")(z), {
859
931
  innerTemplateName: z.never().optional(),
860
932
  }),
861
933
  ]);
@@ -889,7 +961,7 @@ var WidgetMeasureAggregationValueSchema = SchemaRegistry.define({
889
961
  latestVersion: "17",
890
962
  history: {
891
963
  "17": function (z) {
892
- return WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
964
+ return extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
893
965
  outerAggregation: z.enum(EOuterAggregation),
894
966
  });
895
967
  },
@@ -921,11 +993,11 @@ var WidgetDimensionSchema = SchemaRegistry.define({
921
993
  latestVersion: "17",
922
994
  history: {
923
995
  "17": function (z) {
924
- return WidgetColumnIndicatorSchema.forVersion("17")(z).extend({
996
+ return extendWithMeta(WidgetColumnIndicatorSchema.forVersion("17")(z), {
925
997
  value: z
926
998
  .discriminatedUnion("mode", [
927
999
  DimensionValueSchema.forVersion("17")(z),
928
- WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1000
+ extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
929
1001
  innerTemplateName: z.string().optional(),
930
1002
  }),
931
1003
  WidgetIndicatorTimeValueSchema.forVersion("17")(z),
@@ -940,7 +1012,9 @@ var WidgetDimensionInHierarchySchema = SchemaRegistry.define({
940
1012
  key: "WidgetDimensionInHierarchy",
941
1013
  latestVersion: "17",
942
1014
  history: {
943
- "17": function (z) { return WidgetDimensionSchema.forVersion("17")(z).omit({ displayCondition: true }); },
1015
+ "17": function (z) {
1016
+ return omitWithMeta(WidgetDimensionSchema.forVersion("17")(z), { displayCondition: true });
1017
+ },
944
1018
  },
945
1019
  });
946
1020
  var WidgetDimensionHierarchySchema = SchemaRegistry.define({
@@ -948,7 +1022,7 @@ var WidgetDimensionHierarchySchema = SchemaRegistry.define({
948
1022
  latestVersion: "17",
949
1023
  history: {
950
1024
  "17": function (z, dimensionSchema) {
951
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1025
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
952
1026
  name: z.string(),
953
1027
  // Для иерархии является дискриминатором, для него нельзя задавать дефолтное значение.
954
1028
  hierarchyDimensions: z.array(dimensionSchema),
@@ -986,7 +1060,7 @@ var WidgetIndicatorDurationValueSchema = SchemaRegistry.define({
986
1060
  latestVersion: "17",
987
1061
  history: {
988
1062
  "17": function (z) {
989
- return WidgetIndicatorConversionValueSchema.forVersion("17")(z).extend({
1063
+ return extendWithMeta(WidgetIndicatorConversionValueSchema.forVersion("17")(z), {
990
1064
  mode: z.literal(EWidgetIndicatorValueModes.DURATION),
991
1065
  templateName: z.string(),
992
1066
  startEventAppearances: z.enum(EEventAppearances),
@@ -1000,7 +1074,7 @@ var WidgetMeasureSchema = SchemaRegistry.define({
1000
1074
  latestVersion: "17",
1001
1075
  history: {
1002
1076
  "17": function (z) {
1003
- return WidgetColumnIndicatorSchema.forVersion("17")(z).extend({
1077
+ return extendWithMeta(WidgetColumnIndicatorSchema.forVersion("17")(z), {
1004
1078
  value: z
1005
1079
  .discriminatedUnion("mode", [
1006
1080
  MeasureValueSchema.forVersion("17")(z),
@@ -1018,7 +1092,7 @@ var MarkdownMeasureSchema = SchemaRegistry.define({
1018
1092
  latestVersion: "17",
1019
1093
  history: {
1020
1094
  "17": function (z) {
1021
- return WidgetMeasureSchema.forVersion("17")(z).extend({
1095
+ return extendWithMeta(WidgetMeasureSchema.forVersion("17")(z), {
1022
1096
  displaySign: z.enum(EMarkdownDisplayMode).default(EMarkdownDisplayMode.NONE),
1023
1097
  });
1024
1098
  },
@@ -1029,7 +1103,7 @@ var WidgetSortingIndicatorSchema = SchemaRegistry.define({
1029
1103
  latestVersion: "17",
1030
1104
  history: {
1031
1105
  "17": function (z) {
1032
- return WidgetIndicatorSchema.forVersion("17")(z).extend({
1106
+ return extendWithMeta(WidgetIndicatorSchema.forVersion("17")(z), {
1033
1107
  direction: SortDirectionSchema.forVersion("17")(z),
1034
1108
  value: WidgetSortingValueSchema.forVersion("17")(z),
1035
1109
  });
@@ -1060,7 +1134,7 @@ var ProcessIndicatorSchema = SchemaRegistry.define({
1060
1134
  latestVersion: "17",
1061
1135
  history: {
1062
1136
  "17": function (z) {
1063
- return WidgetIndicatorSchema.forVersion("17")(z).extend({
1137
+ return extendWithMeta(WidgetIndicatorSchema.forVersion("17")(z), {
1064
1138
  value: ProcessIndicatorValueSchema.forVersion("17")(z).optional(),
1065
1139
  dbDataType: z.string().optional(),
1066
1140
  format: FormatSchema.forVersion("17")(z).optional(),
@@ -1124,10 +1198,10 @@ var DimensionProcessFilterSchema = SchemaRegistry.define({
1124
1198
  "17": function (z) {
1125
1199
  return z.object({
1126
1200
  value: z.union([
1127
- WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1201
+ extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
1128
1202
  outerAggregation: z.enum(EOuterAggregation),
1129
1203
  }),
1130
- WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1204
+ extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
1131
1205
  innerTemplateName: z.string().optional(),
1132
1206
  }),
1133
1207
  WidgetIndicatorTimeValueSchema.forVersion("17")(z),
@@ -1164,7 +1238,7 @@ var ActionOnClickParameterCommonSchema = SchemaRegistry.define({
1164
1238
  latestVersion: "17",
1165
1239
  history: {
1166
1240
  "17": function (z) {
1167
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1241
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1168
1242
  name: z.string(),
1169
1243
  });
1170
1244
  },
@@ -1355,7 +1429,7 @@ var ActionCommonSchema = SchemaRegistry.define({
1355
1429
  latestVersion: "17",
1356
1430
  history: {
1357
1431
  "17": function (z) {
1358
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1432
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1359
1433
  name: z.string(),
1360
1434
  });
1361
1435
  },
@@ -1366,7 +1440,7 @@ var ActionDrillDownSchema = SchemaRegistry.define({
1366
1440
  latestVersion: "17",
1367
1441
  history: {
1368
1442
  "17": function (z) {
1369
- return ActionCommonSchema.forVersion("17")(z).extend({
1443
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1370
1444
  type: z.literal(EActionTypes.DRILL_DOWN),
1371
1445
  variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1372
1446
  });
@@ -1378,7 +1452,7 @@ var ActionGoToURLSchema = SchemaRegistry.define({
1378
1452
  latestVersion: "17",
1379
1453
  history: {
1380
1454
  "17": function (z) {
1381
- return ActionCommonSchema.forVersion("17")(z).extend({
1455
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1382
1456
  type: z.literal(EActionTypes.OPEN_URL),
1383
1457
  url: z.string(),
1384
1458
  newWindow: z.boolean().default(true),
@@ -1413,7 +1487,7 @@ var ActionRunScriptSchema = SchemaRegistry.define({
1413
1487
  latestVersion: "17",
1414
1488
  history: {
1415
1489
  "17": function (z) {
1416
- return ActionCommonSchema.forVersion("17")(z).extend({
1490
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1417
1491
  type: z.literal(EActionTypes.EXECUTE_SCRIPT),
1418
1492
  parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1419
1493
  scriptKey: z.string(),
@@ -1432,7 +1506,7 @@ var ActionUpdateVariableSchema = SchemaRegistry.define({
1432
1506
  latestVersion: "17",
1433
1507
  history: {
1434
1508
  "17": function (z) {
1435
- return ActionCommonSchema.forVersion("17")(z).extend({
1509
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1436
1510
  type: z.literal(EActionTypes.UPDATE_VARIABLE),
1437
1511
  variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1438
1512
  });
@@ -1473,7 +1547,7 @@ var ActionOpenViewCommonSchema = SchemaRegistry.define({
1473
1547
  latestVersion: "17",
1474
1548
  history: {
1475
1549
  "17": function (z) {
1476
- return ActionCommonSchema.forVersion("17")(z).extend({
1550
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1477
1551
  type: z.literal(EActionTypes.OPEN_VIEW),
1478
1552
  variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1479
1553
  });
@@ -1486,18 +1560,18 @@ var ActionOpenViewSchema = SchemaRegistry.define({
1486
1560
  history: {
1487
1561
  "17": function (z) {
1488
1562
  return z.intersection(z.discriminatedUnion("mode", [
1489
- ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1563
+ extendWithMeta(ActionOpenViewCommonSchema.forVersion("17")(z), {
1490
1564
  mode: z.literal(EViewMode.GENERATED_BY_SCRIPT),
1491
1565
  scriptKey: z.string().optional(),
1492
1566
  parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1493
1567
  displayName: z.string().default(""),
1494
1568
  }),
1495
- ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1569
+ extendWithMeta(ActionOpenViewCommonSchema.forVersion("17")(z), {
1496
1570
  mode: z.literal(EViewMode.EXISTED_VIEW),
1497
1571
  viewKey: z.string().optional(),
1498
1572
  parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1499
1573
  }),
1500
- ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1574
+ extendWithMeta(ActionOpenViewCommonSchema.forVersion("17")(z), {
1501
1575
  mode: z.literal(EViewMode.EMPTY),
1502
1576
  placeholderName: z.string().optional(),
1503
1577
  openIn: z.literal(EViewOpenIn.PLACEHOLDER),
@@ -1526,7 +1600,7 @@ var WidgetActionParameterCommonSchema = SchemaRegistry.define({
1526
1600
  latestVersion: "17",
1527
1601
  history: {
1528
1602
  "17": function (z) {
1529
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1603
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1530
1604
  name: z.string(),
1531
1605
  displayName: z.string().default(""),
1532
1606
  isHidden: z.boolean().default(false),
@@ -1557,7 +1631,7 @@ var WidgetActionSchema = SchemaRegistry.define({
1557
1631
  latestVersion: "17",
1558
1632
  history: {
1559
1633
  "17": function (z) {
1560
- return ActionCommonSchema.forVersion("17")(z).extend({
1634
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1561
1635
  parameters: z.array(WidgetActionParameterSchema.forVersion("17")(z)).default([]),
1562
1636
  type: z.literal(EActionTypes.EXECUTE_SCRIPT),
1563
1637
  scriptKey: z.string(),
@@ -1577,7 +1651,7 @@ var ViewActionParameterSchema = SchemaRegistry.define({
1577
1651
  latestVersion: "17",
1578
1652
  history: {
1579
1653
  "17": function (z) {
1580
- return z.intersection(AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({ name: z.string() }), z.discriminatedUnion("inputMethod", [
1654
+ return z.intersection(extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), { name: z.string() }), z.discriminatedUnion("inputMethod", [
1581
1655
  ParameterFromAggregationSchema.forVersion("17")(z),
1582
1656
  ParameterFromVariableSchema.forVersion("17")(z),
1583
1657
  ]));
@@ -1589,7 +1663,7 @@ var ViewActionSchema = SchemaRegistry.define({
1589
1663
  latestVersion: "17",
1590
1664
  history: {
1591
1665
  "17": function (z) {
1592
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1666
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1593
1667
  name: z.string(),
1594
1668
  buttonType: z.enum(EActionButtonsTypes).default(EActionButtonsTypes.BASE),
1595
1669
  type: z.literal(EActionTypes.EXECUTE_SCRIPT).default(EActionTypes.EXECUTE_SCRIPT),
@@ -1620,7 +1694,7 @@ var ActionButtonSchema = SchemaRegistry.define({
1620
1694
  latestVersion: "17",
1621
1695
  history: {
1622
1696
  "17": function (z) {
1623
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1697
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1624
1698
  name: z.string(),
1625
1699
  onClick: z.array(WidgetActionSchema.forVersion("17")(z)).default([]),
1626
1700
  buttonType: z.enum(EActionButtonsTypes).default(EActionButtonsTypes.BASE),
@@ -3521,4 +3595,4 @@ var themed = function (scheme, selectThemeValue) {
3521
3595
  return scheme.meta((_a = {}, _a[ESettingsSchemaMetaKey.themeValue] = selectThemeValue, _a));
3522
3596
  };
3523
3597
 
3524
- export { ActionButtonSchema, ActionDrillDownSchema, ActionGoToURLSchema, ActionOnClickParameterSchema, ActionOpenInSchema, ActionOpenViewSchema, ActionRunScriptSchema, ActionSchema, ActionUpdateVariableSchema, ActionsOnClickSchema, AutoIdentifiedArrayItemSchema, BaseWidgetSettingsSchema, ColorAutoSchema, ColorBaseSchema, ColorByDimensionSchema, ColorDisabledSchema, ColorFormulaSchema, ColorGradientSchema, ColorRuleSchema, ColorSchema, ColorValuesSchema, ColoredValueSchema, ColumnIndicatorValueSchema, DimensionProcessFilterSchema, DimensionValueSchema, DisplayConditionSchema, EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormulaFilterFieldKeys, EHeightMode, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureInnerTemplateNames, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESettingsSchemaMetaKey, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, ExtendedFormulaFilterValueSchema, FormatSchema, FormattingSchema, FormulaFilterValueSchema, FormulaNullableSchema, FormulaSchema, KeyNullableSchema, MarkdownMeasureSchema, MeasureValueSchema, NameNullableSchema, OuterAggregation, ParameterFromAggregationSchema, ParameterFromColumnSchema, ParameterFromDataModelSchema, ParameterFromDynamicListSchema, ParameterFromEndEventSchema, ParameterFromEventSchema, ParameterFromFormulaSchema, ParameterFromManualInputSchema, ParameterFromStartEventSchema, ParameterFromStaticListSchema, ParameterFromVariableSchema, ProcessIndicatorSchema, ProcessIndicatorValueSchema, RangeSchema, SchemaRegistryReader, SettingsFilterSchema, SortDirectionSchema, SortOrderSchema, VersionedSchemaFactory, ViewActionParameterSchema, ViewActionSchema, WidgetActionParameterSchema, WidgetActionSchema, WidgetColumnIndicatorSchema, WidgetDimensionHierarchySchema, WidgetDimensionInHierarchySchema, WidgetDimensionSchema, WidgetIndicatorAggregationValueSchema, WidgetIndicatorConversionValueSchema, WidgetIndicatorDurationValueSchema, WidgetIndicatorFormulaValueSchema, WidgetIndicatorSchema, WidgetIndicatorTemplateValueSchema, WidgetIndicatorTimeValueSchema, WidgetMeasureAggregationValueSchema, WidgetMeasureSchema, WidgetPresetSettingsSchema, WidgetSortingIndicatorSchema, WidgetSortingValueSchema, apiVersion, apiVersions, applyIndexToArrayFormula, availableFormatsBySimpleType, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, defaultActionsConfig, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, hexToRgb, inheritDisplayConditionFromHierarchy, interpolateHexColor, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureInnerTemplateFormulas, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, themed, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
3598
+ export { ActionButtonSchema, ActionDrillDownSchema, ActionGoToURLSchema, ActionOnClickParameterSchema, ActionOpenInSchema, ActionOpenViewSchema, ActionRunScriptSchema, ActionSchema, ActionUpdateVariableSchema, ActionsOnClickSchema, AutoIdentifiedArrayItemSchema, BaseWidgetSettingsSchema, ColorAutoSchema, ColorBaseSchema, ColorByDimensionSchema, ColorDisabledSchema, ColorFormulaSchema, ColorGradientSchema, ColorRuleSchema, ColorSchema, ColorValuesSchema, ColoredValueSchema, ColumnIndicatorValueSchema, DimensionProcessFilterSchema, DimensionValueSchema, DisplayConditionSchema, EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormulaFilterFieldKeys, EHeightMode, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureInnerTemplateNames, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESettingsSchemaMetaKey, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, ExtendedFormulaFilterValueSchema, FormatSchema, FormattingSchema, FormulaFilterValueSchema, FormulaNullableSchema, FormulaSchema, KeyNullableSchema, MarkdownMeasureSchema, MeasureValueSchema, NameNullableSchema, OuterAggregation, ParameterFromAggregationSchema, ParameterFromColumnSchema, ParameterFromDataModelSchema, ParameterFromDynamicListSchema, ParameterFromEndEventSchema, ParameterFromEventSchema, ParameterFromFormulaSchema, ParameterFromManualInputSchema, ParameterFromStartEventSchema, ParameterFromStaticListSchema, ParameterFromVariableSchema, ProcessIndicatorSchema, ProcessIndicatorValueSchema, RangeSchema, SchemaRegistryReader, SettingsFilterSchema, SortDirectionSchema, SortOrderSchema, VersionedSchemaFactory, ViewActionParameterSchema, ViewActionSchema, WidgetActionParameterSchema, WidgetActionSchema, WidgetColumnIndicatorSchema, WidgetDimensionHierarchySchema, WidgetDimensionInHierarchySchema, WidgetDimensionSchema, WidgetIndicatorAggregationValueSchema, WidgetIndicatorConversionValueSchema, WidgetIndicatorDurationValueSchema, WidgetIndicatorFormulaValueSchema, WidgetIndicatorSchema, WidgetIndicatorTemplateValueSchema, WidgetIndicatorTimeValueSchema, WidgetMeasureAggregationValueSchema, WidgetMeasureSchema, WidgetPresetSettingsSchema, WidgetSortingIndicatorSchema, WidgetSortingValueSchema, apiVersion, apiVersions, applyIndexToArrayFormula, availableFormatsBySimpleType, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, defaultActionsConfig, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, extendWithMeta, fillTemplateSql, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getMeasureFormula, getParentMeta, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, hasInMetaChain, hexToRgb, inheritDisplayConditionFromHierarchy, interpolateHexColor, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureInnerTemplateFormulas, measureTemplateFormulas, omitWithMeta, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, themed, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.js CHANGED
@@ -731,12 +731,84 @@ var FormulaNullableSchema = SchemaRegistry.define({
731
731
  },
732
732
  });
733
733
 
734
+ // NOTE: В будущем можно сделать fluent-обёртку для цепочных вызовов:
735
+ // withMetaDecorator(schema).omit({ field: true }).extend({ newField: z.string() })
736
+ // Это позволит избежать вложенных вызовов omitWithMeta/extendWithMeta.
737
+ var PARENT_META_KEY = "parent";
738
+ /**
739
+ * Возвращает родительскую мету схемы, установленную через extendWithMeta / omitWithMeta.
740
+ * Используй для обхода цепочки наследования схем.
741
+ */
742
+ function getParentMeta(meta) {
743
+ return meta[PARENT_META_KEY];
744
+ }
745
+ function inheritMeta(target, source) {
746
+ var _a;
747
+ var sourceMeta = source.meta();
748
+ return sourceMeta !== undefined ? target.meta((_a = {}, _a[PARENT_META_KEY] = sourceMeta, _a)) : target;
749
+ }
750
+ /**
751
+ * Расширяет Zod-схему дополнительными полями, сохраняя цепочку наследования мет.
752
+ *
753
+ * Мета базовой схемы сохраняется как `parent` в мете расширенной схемы — формируя
754
+ * иммутабельный связанный список.
755
+ *
756
+ * Используй вместо `.extend()` при расширении схем, задекларированных через
757
+ * `SchemaRegistry.define`, — это обязательное условие корректной работы миграций.
758
+ *
759
+ * @example
760
+ * // Вместо:
761
+ * DimensionSchema(z).extend({ color: ColorSchema(z) })
762
+ *
763
+ * // Используй:
764
+ * extendWithMeta(DimensionSchema(z), { color: ColorSchema(z) })
765
+ */
766
+ function extendWithMeta(schema, extension) {
767
+ return inheritMeta(schema.extend(extension), schema);
768
+ }
769
+ /**
770
+ * Создаёт Zod-схему с удалёнными полями, сохраняя цепочку наследования мет.
771
+ *
772
+ * Мета базовой схемы сохраняется как `parent` в мете результирующей схемы.
773
+ *
774
+ * Используй вместо `.omit()` при работе со схемами, задекларированными через
775
+ * `SchemaRegistry.define`, — это обязательное условие корректной работы миграций.
776
+ *
777
+ * @example
778
+ * // Вместо:
779
+ * BaseWidgetSettingsSchema(z).omit({ paddings: true })
780
+ *
781
+ * // Используй:
782
+ * omitWithMeta(BaseWidgetSettingsSchema(z), { paddings: true })
783
+ */
784
+ function omitWithMeta(schema, keys) {
785
+ return inheritMeta(schema.omit(keys), schema);
786
+ }
787
+ /**
788
+ * Проверяет, есть ли в цепочке наследования мет узел, удовлетворяющий предикату.
789
+ *
790
+ * Обходит цепочку от текущей меты к корню через ссылки parent, установленные
791
+ * функциями extendWithMeta / omitWithMeta.
792
+ *
793
+ * @example
794
+ * hasInMetaChain(schema.meta(), (meta) => meta.type === "WidgetDimension")
795
+ */
796
+ function hasInMetaChain(meta, predicate) {
797
+ var current = meta;
798
+ while (current !== undefined) {
799
+ if (predicate(current))
800
+ return true;
801
+ current = getParentMeta(current);
802
+ }
803
+ return false;
804
+ }
805
+
734
806
  var WidgetIndicatorSchema = SchemaRegistry.define({
735
807
  key: "WidgetIndicator",
736
808
  latestVersion: "17",
737
809
  history: {
738
810
  "17": function (z) {
739
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
811
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
740
812
  name: z.string(),
741
813
  });
742
814
  },
@@ -787,7 +859,7 @@ var WidgetColumnIndicatorSchema = SchemaRegistry.define({
787
859
  latestVersion: "17",
788
860
  history: {
789
861
  "17": function (z) {
790
- return WidgetIndicatorSchema.forVersion("17")(z).extend({
862
+ return extendWithMeta(WidgetIndicatorSchema.forVersion("17")(z), {
791
863
  dbDataType: z.string().optional(),
792
864
  format: FormatSchema.forVersion("17")(z).optional(),
793
865
  formatting: FormattingSchema.forVersion("17")(z).optional(),
@@ -842,7 +914,7 @@ var MeasureValueSchema = SchemaRegistry.define({
842
914
  "17": function (z) {
843
915
  return z.discriminatedUnion("mode", [
844
916
  WidgetIndicatorFormulaValueSchema.forVersion("17")(z),
845
- WidgetIndicatorTemplateValueSchema.forVersion("17")(z).extend({
917
+ extendWithMeta(WidgetIndicatorTemplateValueSchema.forVersion("17")(z), {
846
918
  innerTemplateName: z.enum(exports.EMeasureInnerTemplateNames).optional(),
847
919
  }),
848
920
  ]);
@@ -856,7 +928,7 @@ var DimensionValueSchema = SchemaRegistry.define({
856
928
  "17": function (z) {
857
929
  return z.discriminatedUnion("mode", [
858
930
  WidgetIndicatorFormulaValueSchema.forVersion("17")(z),
859
- WidgetIndicatorTemplateValueSchema.forVersion("17")(z).extend({
931
+ extendWithMeta(WidgetIndicatorTemplateValueSchema.forVersion("17")(z), {
860
932
  innerTemplateName: z.never().optional(),
861
933
  }),
862
934
  ]);
@@ -890,7 +962,7 @@ var WidgetMeasureAggregationValueSchema = SchemaRegistry.define({
890
962
  latestVersion: "17",
891
963
  history: {
892
964
  "17": function (z) {
893
- return WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
965
+ return extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
894
966
  outerAggregation: z.enum(exports.EOuterAggregation),
895
967
  });
896
968
  },
@@ -922,11 +994,11 @@ var WidgetDimensionSchema = SchemaRegistry.define({
922
994
  latestVersion: "17",
923
995
  history: {
924
996
  "17": function (z) {
925
- return WidgetColumnIndicatorSchema.forVersion("17")(z).extend({
997
+ return extendWithMeta(WidgetColumnIndicatorSchema.forVersion("17")(z), {
926
998
  value: z
927
999
  .discriminatedUnion("mode", [
928
1000
  DimensionValueSchema.forVersion("17")(z),
929
- WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1001
+ extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
930
1002
  innerTemplateName: z.string().optional(),
931
1003
  }),
932
1004
  WidgetIndicatorTimeValueSchema.forVersion("17")(z),
@@ -941,7 +1013,9 @@ var WidgetDimensionInHierarchySchema = SchemaRegistry.define({
941
1013
  key: "WidgetDimensionInHierarchy",
942
1014
  latestVersion: "17",
943
1015
  history: {
944
- "17": function (z) { return WidgetDimensionSchema.forVersion("17")(z).omit({ displayCondition: true }); },
1016
+ "17": function (z) {
1017
+ return omitWithMeta(WidgetDimensionSchema.forVersion("17")(z), { displayCondition: true });
1018
+ },
945
1019
  },
946
1020
  });
947
1021
  var WidgetDimensionHierarchySchema = SchemaRegistry.define({
@@ -949,7 +1023,7 @@ var WidgetDimensionHierarchySchema = SchemaRegistry.define({
949
1023
  latestVersion: "17",
950
1024
  history: {
951
1025
  "17": function (z, dimensionSchema) {
952
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1026
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
953
1027
  name: z.string(),
954
1028
  // Для иерархии является дискриминатором, для него нельзя задавать дефолтное значение.
955
1029
  hierarchyDimensions: z.array(dimensionSchema),
@@ -987,7 +1061,7 @@ var WidgetIndicatorDurationValueSchema = SchemaRegistry.define({
987
1061
  latestVersion: "17",
988
1062
  history: {
989
1063
  "17": function (z) {
990
- return WidgetIndicatorConversionValueSchema.forVersion("17")(z).extend({
1064
+ return extendWithMeta(WidgetIndicatorConversionValueSchema.forVersion("17")(z), {
991
1065
  mode: z.literal(exports.EWidgetIndicatorValueModes.DURATION),
992
1066
  templateName: z.string(),
993
1067
  startEventAppearances: z.enum(exports.EEventAppearances),
@@ -1001,7 +1075,7 @@ var WidgetMeasureSchema = SchemaRegistry.define({
1001
1075
  latestVersion: "17",
1002
1076
  history: {
1003
1077
  "17": function (z) {
1004
- return WidgetColumnIndicatorSchema.forVersion("17")(z).extend({
1078
+ return extendWithMeta(WidgetColumnIndicatorSchema.forVersion("17")(z), {
1005
1079
  value: z
1006
1080
  .discriminatedUnion("mode", [
1007
1081
  MeasureValueSchema.forVersion("17")(z),
@@ -1019,7 +1093,7 @@ var MarkdownMeasureSchema = SchemaRegistry.define({
1019
1093
  latestVersion: "17",
1020
1094
  history: {
1021
1095
  "17": function (z) {
1022
- return WidgetMeasureSchema.forVersion("17")(z).extend({
1096
+ return extendWithMeta(WidgetMeasureSchema.forVersion("17")(z), {
1023
1097
  displaySign: z.enum(exports.EMarkdownDisplayMode).default(exports.EMarkdownDisplayMode.NONE),
1024
1098
  });
1025
1099
  },
@@ -1030,7 +1104,7 @@ var WidgetSortingIndicatorSchema = SchemaRegistry.define({
1030
1104
  latestVersion: "17",
1031
1105
  history: {
1032
1106
  "17": function (z) {
1033
- return WidgetIndicatorSchema.forVersion("17")(z).extend({
1107
+ return extendWithMeta(WidgetIndicatorSchema.forVersion("17")(z), {
1034
1108
  direction: SortDirectionSchema.forVersion("17")(z),
1035
1109
  value: WidgetSortingValueSchema.forVersion("17")(z),
1036
1110
  });
@@ -1061,7 +1135,7 @@ var ProcessIndicatorSchema = SchemaRegistry.define({
1061
1135
  latestVersion: "17",
1062
1136
  history: {
1063
1137
  "17": function (z) {
1064
- return WidgetIndicatorSchema.forVersion("17")(z).extend({
1138
+ return extendWithMeta(WidgetIndicatorSchema.forVersion("17")(z), {
1065
1139
  value: ProcessIndicatorValueSchema.forVersion("17")(z).optional(),
1066
1140
  dbDataType: z.string().optional(),
1067
1141
  format: FormatSchema.forVersion("17")(z).optional(),
@@ -1125,10 +1199,10 @@ var DimensionProcessFilterSchema = SchemaRegistry.define({
1125
1199
  "17": function (z) {
1126
1200
  return z.object({
1127
1201
  value: z.union([
1128
- WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1202
+ extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
1129
1203
  outerAggregation: z.enum(exports.EOuterAggregation),
1130
1204
  }),
1131
- WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1205
+ extendWithMeta(WidgetIndicatorAggregationValueSchema.forVersion("17")(z), {
1132
1206
  innerTemplateName: z.string().optional(),
1133
1207
  }),
1134
1208
  WidgetIndicatorTimeValueSchema.forVersion("17")(z),
@@ -1165,7 +1239,7 @@ var ActionOnClickParameterCommonSchema = SchemaRegistry.define({
1165
1239
  latestVersion: "17",
1166
1240
  history: {
1167
1241
  "17": function (z) {
1168
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1242
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1169
1243
  name: z.string(),
1170
1244
  });
1171
1245
  },
@@ -1356,7 +1430,7 @@ var ActionCommonSchema = SchemaRegistry.define({
1356
1430
  latestVersion: "17",
1357
1431
  history: {
1358
1432
  "17": function (z) {
1359
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1433
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1360
1434
  name: z.string(),
1361
1435
  });
1362
1436
  },
@@ -1367,7 +1441,7 @@ var ActionDrillDownSchema = SchemaRegistry.define({
1367
1441
  latestVersion: "17",
1368
1442
  history: {
1369
1443
  "17": function (z) {
1370
- return ActionCommonSchema.forVersion("17")(z).extend({
1444
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1371
1445
  type: z.literal(exports.EActionTypes.DRILL_DOWN),
1372
1446
  variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1373
1447
  });
@@ -1379,7 +1453,7 @@ var ActionGoToURLSchema = SchemaRegistry.define({
1379
1453
  latestVersion: "17",
1380
1454
  history: {
1381
1455
  "17": function (z) {
1382
- return ActionCommonSchema.forVersion("17")(z).extend({
1456
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1383
1457
  type: z.literal(exports.EActionTypes.OPEN_URL),
1384
1458
  url: z.string(),
1385
1459
  newWindow: z.boolean().default(true),
@@ -1414,7 +1488,7 @@ var ActionRunScriptSchema = SchemaRegistry.define({
1414
1488
  latestVersion: "17",
1415
1489
  history: {
1416
1490
  "17": function (z) {
1417
- return ActionCommonSchema.forVersion("17")(z).extend({
1491
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1418
1492
  type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT),
1419
1493
  parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1420
1494
  scriptKey: z.string(),
@@ -1433,7 +1507,7 @@ var ActionUpdateVariableSchema = SchemaRegistry.define({
1433
1507
  latestVersion: "17",
1434
1508
  history: {
1435
1509
  "17": function (z) {
1436
- return ActionCommonSchema.forVersion("17")(z).extend({
1510
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1437
1511
  type: z.literal(exports.EActionTypes.UPDATE_VARIABLE),
1438
1512
  variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1439
1513
  });
@@ -1474,7 +1548,7 @@ var ActionOpenViewCommonSchema = SchemaRegistry.define({
1474
1548
  latestVersion: "17",
1475
1549
  history: {
1476
1550
  "17": function (z) {
1477
- return ActionCommonSchema.forVersion("17")(z).extend({
1551
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1478
1552
  type: z.literal(exports.EActionTypes.OPEN_VIEW),
1479
1553
  variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1480
1554
  });
@@ -1487,18 +1561,18 @@ var ActionOpenViewSchema = SchemaRegistry.define({
1487
1561
  history: {
1488
1562
  "17": function (z) {
1489
1563
  return z.intersection(z.discriminatedUnion("mode", [
1490
- ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1564
+ extendWithMeta(ActionOpenViewCommonSchema.forVersion("17")(z), {
1491
1565
  mode: z.literal(exports.EViewMode.GENERATED_BY_SCRIPT),
1492
1566
  scriptKey: z.string().optional(),
1493
1567
  parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1494
1568
  displayName: z.string().default(""),
1495
1569
  }),
1496
- ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1570
+ extendWithMeta(ActionOpenViewCommonSchema.forVersion("17")(z), {
1497
1571
  mode: z.literal(exports.EViewMode.EXISTED_VIEW),
1498
1572
  viewKey: z.string().optional(),
1499
1573
  parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1500
1574
  }),
1501
- ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1575
+ extendWithMeta(ActionOpenViewCommonSchema.forVersion("17")(z), {
1502
1576
  mode: z.literal(exports.EViewMode.EMPTY),
1503
1577
  placeholderName: z.string().optional(),
1504
1578
  openIn: z.literal(exports.EViewOpenIn.PLACEHOLDER),
@@ -1527,7 +1601,7 @@ var WidgetActionParameterCommonSchema = SchemaRegistry.define({
1527
1601
  latestVersion: "17",
1528
1602
  history: {
1529
1603
  "17": function (z) {
1530
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1604
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1531
1605
  name: z.string(),
1532
1606
  displayName: z.string().default(""),
1533
1607
  isHidden: z.boolean().default(false),
@@ -1558,7 +1632,7 @@ var WidgetActionSchema = SchemaRegistry.define({
1558
1632
  latestVersion: "17",
1559
1633
  history: {
1560
1634
  "17": function (z) {
1561
- return ActionCommonSchema.forVersion("17")(z).extend({
1635
+ return extendWithMeta(ActionCommonSchema.forVersion("17")(z), {
1562
1636
  parameters: z.array(WidgetActionParameterSchema.forVersion("17")(z)).default([]),
1563
1637
  type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT),
1564
1638
  scriptKey: z.string(),
@@ -1578,7 +1652,7 @@ var ViewActionParameterSchema = SchemaRegistry.define({
1578
1652
  latestVersion: "17",
1579
1653
  history: {
1580
1654
  "17": function (z) {
1581
- return z.intersection(AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({ name: z.string() }), z.discriminatedUnion("inputMethod", [
1655
+ return z.intersection(extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), { name: z.string() }), z.discriminatedUnion("inputMethod", [
1582
1656
  ParameterFromAggregationSchema.forVersion("17")(z),
1583
1657
  ParameterFromVariableSchema.forVersion("17")(z),
1584
1658
  ]));
@@ -1590,7 +1664,7 @@ var ViewActionSchema = SchemaRegistry.define({
1590
1664
  latestVersion: "17",
1591
1665
  history: {
1592
1666
  "17": function (z) {
1593
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1667
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1594
1668
  name: z.string(),
1595
1669
  buttonType: z.enum(exports.EActionButtonsTypes).default(exports.EActionButtonsTypes.BASE),
1596
1670
  type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT).default(exports.EActionTypes.EXECUTE_SCRIPT),
@@ -1621,7 +1695,7 @@ var ActionButtonSchema = SchemaRegistry.define({
1621
1695
  latestVersion: "17",
1622
1696
  history: {
1623
1697
  "17": function (z) {
1624
- return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1698
+ return extendWithMeta(AutoIdentifiedArrayItemSchema.forVersion("17")(z), {
1625
1699
  name: z.string(),
1626
1700
  onClick: z.array(WidgetActionSchema.forVersion("17")(z)).default([]),
1627
1701
  buttonType: z.enum(exports.EActionButtonsTypes).default(exports.EActionButtonsTypes.BASE),
@@ -3644,6 +3718,7 @@ exports.durationTemplates = durationTemplates;
3644
3718
  exports.escapeCurlyBracketLinkName = escapeCurlyBracketLinkName;
3645
3719
  exports.escapeDoubleQuoteLinkName = escapeDoubleQuoteLinkName;
3646
3720
  exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
3721
+ exports.extendWithMeta = extendWithMeta;
3647
3722
  exports.fillTemplateSql = fillTemplateSql;
3648
3723
  exports.formulaFilterMethods = formulaFilterMethods;
3649
3724
  exports.generateColumnFormula = generateColumnFormula;
@@ -3653,9 +3728,11 @@ exports.getDimensionFormula = getDimensionFormula;
3653
3728
  exports.getDisplayConditionFormula = getDisplayConditionFormula;
3654
3729
  exports.getEventMeasureFormula = getEventMeasureFormula;
3655
3730
  exports.getMeasureFormula = getMeasureFormula;
3731
+ exports.getParentMeta = getParentMeta;
3656
3732
  exports.getProcessDimensionValueFormula = getProcessDimensionValueFormula;
3657
3733
  exports.getRuleColor = getRuleColor;
3658
3734
  exports.getTransitionMeasureFormula = getTransitionMeasureFormula;
3735
+ exports.hasInMetaChain = hasInMetaChain;
3659
3736
  exports.hexToRgb = hexToRgb;
3660
3737
  exports.inheritDisplayConditionFromHierarchy = inheritDisplayConditionFromHierarchy;
3661
3738
  exports.interpolateHexColor = interpolateHexColor;
@@ -3673,6 +3750,7 @@ exports.mapSortingToInputs = mapSortingToInputs;
3673
3750
  exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
3674
3751
  exports.measureInnerTemplateFormulas = measureInnerTemplateFormulas;
3675
3752
  exports.measureTemplateFormulas = measureTemplateFormulas;
3753
+ exports.omitWithMeta = omitWithMeta;
3676
3754
  exports.parseClickHouseType = parseClickHouseType;
3677
3755
  exports.parseIndicatorLink = parseIndicatorLink;
3678
3756
  exports.prepareConversionParams = prepareConversionParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "7.0.0-17",
3
+ "version": "7.0.0-18",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,7 +12,7 @@
12
12
  "sideEffects": false,
13
13
  "scripts": {
14
14
  "build": "rollup -c",
15
- "lint": "tsc --noEmit",
15
+ "lint": "tsc --noEmit && eslint src --ext .ts",
16
16
  "release": "standard-version",
17
17
  "release:rc": "standard-version -p",
18
18
  "release:prev": "node ./scripts/re-release.mjs",
@@ -37,6 +37,9 @@
37
37
  "@rollup/plugin-typescript": "11.1.5",
38
38
  "@types/jest": "^29.5.14",
39
39
  "@types/semver": "^7.7.0",
40
+ "@typescript-eslint/eslint-plugin": "^8",
41
+ "@typescript-eslint/parser": "^8",
42
+ "eslint": "^8",
40
43
  "core-js": "^3.38.0",
41
44
  "jest": "^29.7.0",
42
45
  "prettier": "3.2.5",