@creatio-devkit/common 0.806.1 → 0.808.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/esm2020/creatio-devkit-common.mjs +1 -1
  3. package/esm2020/index.mjs +1 -1
  4. package/esm2020/lib/external/functions/aggregation-adapter.mjs +49 -1
  5. package/esm2020/lib/external/functions/date-part-type-adapter.mjs +48 -0
  6. package/esm2020/lib/external/functions/function-type-adapter.mjs +28 -0
  7. package/esm2020/lib/external/functions/index.mjs +4 -1
  8. package/esm2020/lib/external/functions/order-direction-adapter.mjs +28 -0
  9. package/esm2020/lib/external/models/attribute-value-config.mjs +1 -1
  10. package/esm2020/lib/external/models/date-time/grouped-date-value.mjs +1 -1
  11. package/esm2020/lib/external/models/date-time/index.mjs +1 -1
  12. package/esm2020/lib/external/models/file-value.model.mjs +1 -1
  13. package/esm2020/lib/external/models/index.mjs +1 -1
  14. package/esm2020/lib/external/models/model-init-config.mjs +1 -1
  15. package/esm2020/lib/external/utils/date-utils.mjs +29 -0
  16. package/esm2020/lib/external/utils/index.mjs +2 -0
  17. package/esm2020/lib/index.mjs +12 -10
  18. package/esm2020/lib/internal/constants/index.mjs +1 -1
  19. package/esm2020/lib/internal/constants/metadata.const.mjs +1 -1
  20. package/esm2020/lib/internal/decorators/design-time-view-element/design-time-view-element.decorator.mjs +1 -1
  21. package/esm2020/lib/internal/decorators/design-time-view-element/index.mjs +1 -1
  22. package/esm2020/lib/internal/decorators/implement-using-handler-chain/implement-using-handler-chain.decorator.mjs +1 -1
  23. package/esm2020/lib/internal/decorators/implement-using-handler-chain/index.mjs +1 -1
  24. package/esm2020/lib/internal/decorators/index.mjs +1 -2
  25. package/esm2020/lib/internal/decorators/request/index.mjs +1 -1
  26. package/esm2020/lib/internal/decorators/request/request.decorator.mjs +1 -1
  27. package/esm2020/lib/internal/enums/data-schema-attribute-type.enum.mjs +2 -1
  28. package/esm2020/lib/internal/enums/data-source-scope.enum.mjs +1 -1
  29. package/esm2020/lib/internal/enums/default-value-source.enum.mjs +1 -1
  30. package/esm2020/lib/internal/enums/designer-group-type.enum.mjs +1 -1
  31. package/esm2020/lib/internal/enums/handler-source-type.enum.mjs +1 -1
  32. package/esm2020/lib/internal/enums/index.mjs +1 -1
  33. package/esm2020/lib/internal/enums/model-in-page-action.enum.mjs +1 -1
  34. package/esm2020/lib/internal/enums/view-element-group-type.enum.mjs +1 -1
  35. package/esm2020/lib/internal/esq/data-model/index.mjs +1 -1
  36. package/esm2020/lib/internal/esq/data-model/metadata-provider/metadata-provider.mjs +1 -1
  37. package/esm2020/lib/internal/esq/data-model/queries/base-filterable-query.mjs +2 -2
  38. package/esm2020/lib/internal/esq/data-model/queries/base-query.mjs +1 -1
  39. package/esm2020/lib/internal/esq/data-model/queries/delete-query.mjs +1 -1
  40. package/esm2020/lib/internal/esq/data-model/queries/entity-schema-query.mjs +16 -16
  41. package/esm2020/lib/internal/esq/data-model/queries/index.mjs +2 -1
  42. package/esm2020/lib/internal/esq/data-model/queries/insert-query.mjs +3 -3
  43. package/esm2020/lib/internal/esq/data-model/queries/query-operation-type.mjs +1 -1
  44. package/esm2020/lib/internal/esq/data-model/queries/select-localization-query.mjs +7 -0
  45. package/esm2020/lib/internal/esq/data-model/queries/update-query.mjs +3 -3
  46. package/esm2020/lib/internal/esq/index.mjs +1 -1
  47. package/esm2020/lib/internal/model/data-schema/data-schema-attribute-aggregation-config.model.mjs +2 -0
  48. package/esm2020/lib/internal/model/data-schema/data-schema-attribute-function-config.model.mjs +2 -0
  49. package/esm2020/lib/internal/model/data-schema/data-schema-validator-config.model.mjs +2 -0
  50. package/esm2020/lib/internal/model/data-schema/index.mjs +4 -0
  51. package/esm2020/lib/internal/model/data-source-config.mjs +1 -1
  52. package/esm2020/lib/internal/model/index.mjs +2 -3
  53. package/esm2020/lib/internal/models/converter/converter-registry-item.mjs +2 -0
  54. package/esm2020/lib/internal/models/converter/index.mjs +2 -0
  55. package/esm2020/lib/internal/models/default-value-schema.mjs +1 -1
  56. package/esm2020/lib/internal/models/design-time-view-element-registry-item.mjs +1 -1
  57. package/esm2020/lib/internal/models/handler-chain-service-registry-item.mjs +1 -1
  58. package/esm2020/lib/internal/models/index.mjs +3 -2
  59. package/esm2020/lib/internal/models/injection-context/index.mjs +2 -0
  60. package/esm2020/lib/internal/models/injection-context/injection-context.mjs +2 -0
  61. package/esm2020/lib/internal/models/interface-designer-item/base-interface-designer-item-registration-config.mjs +1 -1
  62. package/esm2020/lib/internal/models/interface-designer-item/index.mjs +1 -1
  63. package/esm2020/lib/internal/models/interface-designer-item/interface-designer-item-registration-config.model.mjs +1 -1
  64. package/esm2020/lib/internal/models/interface-designer-item/toolbar-view-element-config.mjs +1 -1
  65. package/esm2020/lib/internal/models/interface-designer-registry-item.mjs +1 -1
  66. package/esm2020/lib/internal/models/internal-interface-designer-item-registration-config.model.mjs +1 -1
  67. package/esm2020/lib/internal/models/remote-build-info.mjs +9 -0
  68. package/esm2020/lib/internal/models/request/index.mjs +1 -1
  69. package/esm2020/lib/internal/models/request/method-invoke-request.mjs +1 -1
  70. package/esm2020/lib/internal/models/request-handler/contexed-handler-scope-config.mjs +2 -0
  71. package/esm2020/lib/internal/models/request-handler/handler-config.mjs +1 -1
  72. package/esm2020/lib/internal/models/request-handler/handler-source.mjs +1 -1
  73. package/esm2020/lib/internal/models/request-handler/index.mjs +2 -1
  74. package/esm2020/lib/internal/models/request-handler/request-handler-factory.mjs +1 -1
  75. package/esm2020/lib/internal/models/request-handler/request-handler-registration-config.model.mjs +1 -1
  76. package/esm2020/lib/internal/models/validator/index.mjs +1 -1
  77. package/esm2020/lib/internal/models/validator/validator-parameters.mjs +1 -1
  78. package/esm2020/lib/internal/models/validator/validator-registry-item.mjs +1 -1
  79. package/esm2020/lib/internal/models/validator/validator-schema-config.model.mjs +1 -1
  80. package/esm2020/lib/internal/models/view-element/angular-view-element-registration-config.model.mjs +1 -1
  81. package/esm2020/lib/internal/models/view-element/index.mjs +1 -1
  82. package/esm2020/lib/internal/models/view-element-registry-item.mjs +1 -1
  83. package/esm2020/lib/internal/services/base-handler-chain.service.mjs +1 -1
  84. package/esm2020/lib/internal/services/base-registry/base-registry.mjs +1 -1
  85. package/esm2020/lib/internal/services/base-registry/index.mjs +1 -1
  86. package/esm2020/lib/internal/services/bootstrap-notifier/bootstrap-notifier.mjs +1 -1
  87. package/esm2020/lib/internal/services/bootstrap-notifier/index.mjs +1 -1
  88. package/esm2020/lib/internal/services/design-time-view-element-registry/design-time-view-element-registry.mjs +1 -1
  89. package/esm2020/lib/internal/services/design-time-view-element-registry/index.mjs +1 -1
  90. package/esm2020/lib/internal/services/element-registration-checker/element-registration-checker.mjs +1 -1
  91. package/esm2020/lib/internal/services/element-registration-checker/index.mjs +1 -1
  92. package/esm2020/lib/internal/services/global-converters-registry/converter-registry.mjs +24 -0
  93. package/esm2020/lib/internal/services/global-converters-registry/index.mjs +2 -2
  94. package/esm2020/lib/internal/services/handler-chain-services-registry/handler-chain-services-registry.mjs +1 -1
  95. package/esm2020/lib/internal/services/handler-chain-services-registry/index.mjs +1 -1
  96. package/esm2020/lib/internal/services/index.mjs +1 -1
  97. package/esm2020/lib/internal/services/interface-designer-item-registry/index.mjs +1 -1
  98. package/esm2020/lib/internal/services/interface-designer-item-registry/interface-designer-item-registry.mjs +1 -1
  99. package/esm2020/lib/internal/services/pkg-topology-registry/index.mjs +1 -1
  100. package/esm2020/lib/internal/services/pkg-topology-registry/pkg-topology-registry.mjs +1 -1
  101. package/esm2020/lib/internal/services/remote-entries-registry/index.mjs +1 -1
  102. package/esm2020/lib/internal/services/remote-entries-registry/remote-entries-registry.mjs +8 -1
  103. package/esm2020/lib/internal/services/request-handler-registry/index.mjs +1 -1
  104. package/esm2020/lib/internal/services/request-handler-registry/request-handler-registry.service.mjs +1 -1
  105. package/esm2020/lib/internal/services/request-registry/index.mjs +1 -1
  106. package/esm2020/lib/internal/services/request-registry/request-registry.service.mjs +1 -1
  107. package/esm2020/lib/internal/services/validator-registry/index.mjs +1 -1
  108. package/esm2020/lib/internal/services/validator-registry/validator-registry.mjs +1 -1
  109. package/esm2020/lib/internal/services/view-element-registry/index.mjs +1 -1
  110. package/esm2020/lib/internal/services/view-element-registry/view-element-registry.mjs +1 -1
  111. package/esm2020/lib/internal/types/index.mjs +3 -0
  112. package/esm2020/lib/internal/types/internal-resolve-dependency-fn.type.mjs +2 -0
  113. package/esm2020/lib/internal/types/localizable-values.type.mjs +2 -0
  114. package/esm2020/lib/internal/utils/component-config-utils.mjs +1 -1
  115. package/esm2020/lib/internal/utils/handlers-order-comparer.mjs +1 -1
  116. package/esm2020/lib/internal/utils/index.mjs +5 -5
  117. package/esm2020/lib/internal/utils/instantiate.mjs +1 -1
  118. package/esm2020/lib/internal/utils/localization-utils.mjs +2 -2
  119. package/esm2020/lib/internal/utils/metadata-utils.mjs +18 -1
  120. package/esm2020/lib/internal/utils/object-deep-keys/index.mjs +1 -1
  121. package/esm2020/lib/internal/utils/object-deep-keys/object-deep-keys.mjs +1 -1
  122. package/esm2020/lib/public/decorators/converter/converter.decorator.mjs +21 -0
  123. package/esm2020/lib/public/decorators/converter/index.mjs +2 -0
  124. package/esm2020/lib/public/decorators/index.mjs +2 -1
  125. package/esm2020/lib/public/decorators/inject/index.mjs +1 -1
  126. package/esm2020/lib/public/decorators/inject/inject.decorator.mjs +1 -1
  127. package/esm2020/lib/public/decorators/input/index.mjs +1 -1
  128. package/esm2020/lib/public/decorators/input/input.decorator.mjs +1 -1
  129. package/esm2020/lib/public/decorators/interface-designer-item/index.mjs +1 -1
  130. package/esm2020/lib/public/decorators/interface-designer-item/interface-designer-item.decorator.mjs +1 -1
  131. package/esm2020/lib/public/decorators/module/index.mjs +1 -1
  132. package/esm2020/lib/public/decorators/module/module.decorator.mjs +1 -1
  133. package/esm2020/lib/public/decorators/output/index.mjs +1 -1
  134. package/esm2020/lib/public/decorators/output/output.decorator.mjs +1 -1
  135. package/esm2020/lib/public/decorators/request-handler/index.mjs +1 -1
  136. package/esm2020/lib/public/decorators/request-handler/request-handler.decorator.mjs +1 -1
  137. package/esm2020/lib/public/decorators/validation-input/index.mjs +1 -1
  138. package/esm2020/lib/public/decorators/validation-input/validation-input.decorator.mjs +1 -1
  139. package/esm2020/lib/public/decorators/validator/index.mjs +1 -1
  140. package/esm2020/lib/public/decorators/validator/validator.decorator.mjs +1 -1
  141. package/esm2020/lib/public/decorators/view-element/index.mjs +1 -1
  142. package/esm2020/lib/public/decorators/view-element/view-element.decorator.mjs +1 -1
  143. package/esm2020/lib/public/enums/aggregation-function.enum.mjs +1 -1
  144. package/esm2020/lib/public/enums/aggregation-type.enum.mjs +1 -1
  145. package/esm2020/lib/public/enums/data-value-type.enum.mjs +2 -1
  146. package/esm2020/lib/public/enums/index.mjs +1 -1
  147. package/esm2020/lib/public/esq/data-model/columns/arithmetic/arithmetic-query-column.mjs +1 -1
  148. package/esm2020/lib/public/esq/data-model/columns/base-query-column.mjs +1 -1
  149. package/esm2020/lib/public/esq/data-model/columns/entity-column/entity-query-column.mjs +1 -1
  150. package/esm2020/lib/public/esq/data-model/columns/functions/aggregation-function-column.mjs +1 -1
  151. package/esm2020/lib/public/esq/data-model/columns/functions/date-part-function-column.mjs +1 -1
  152. package/esm2020/lib/public/esq/data-model/columns/functions/length-function-column.mjs +1 -1
  153. package/esm2020/lib/public/esq/data-model/columns/functions/macros-function-column.mjs +1 -1
  154. package/esm2020/lib/public/esq/data-model/columns/functions/window-function-column.mjs +1 -1
  155. package/esm2020/lib/public/esq/data-model/columns/index.mjs +1 -1
  156. package/esm2020/lib/public/esq/data-model/columns/parameters/parameter-query-column.mjs +1 -1
  157. package/esm2020/lib/public/esq/data-model/columns/sub-queries/aggregation-sub-query-column.mjs +1 -1
  158. package/esm2020/lib/public/esq/data-model/columns/sub-queries/sub-query-column.mjs +1 -1
  159. package/esm2020/lib/public/esq/data-model/enums/aggregation-eval-type.enum.mjs +1 -1
  160. package/esm2020/lib/public/esq/data-model/enums/arithmetic-operation.enum.mjs +1 -1
  161. package/esm2020/lib/public/esq/data-model/enums/comparison-type.enum.mjs +1 -1
  162. package/esm2020/lib/public/esq/data-model/enums/date-part-type.enum.mjs +1 -1
  163. package/esm2020/lib/public/esq/data-model/enums/expression-type.enum.mjs +1 -1
  164. package/esm2020/lib/public/esq/data-model/enums/filter-type.enum.mjs +1 -1
  165. package/esm2020/lib/public/esq/data-model/enums/function-type.enum.mjs +1 -1
  166. package/esm2020/lib/public/esq/data-model/enums/index.mjs +1 -1
  167. package/esm2020/lib/public/esq/data-model/enums/logical-operator-type.enum.mjs +1 -1
  168. package/esm2020/lib/public/esq/data-model/enums/order-direction.enum.mjs +1 -1
  169. package/esm2020/lib/public/esq/data-model/enums/query-macros-type.enum.mjs +1 -1
  170. package/esm2020/lib/public/esq/data-model/expressions/arithmetic/arithmetic-expression.mjs +1 -1
  171. package/esm2020/lib/public/esq/data-model/expressions/arithmetic/index.mjs +1 -1
  172. package/esm2020/lib/public/esq/data-model/expressions/base-expression.mjs +1 -1
  173. package/esm2020/lib/public/esq/data-model/expressions/columns/column-expression.mjs +1 -1
  174. package/esm2020/lib/public/esq/data-model/expressions/columns/index.mjs +1 -1
  175. package/esm2020/lib/public/esq/data-model/expressions/functions/aggregation-function-expression.mjs +2 -2
  176. package/esm2020/lib/public/esq/data-model/expressions/functions/argument-function-expression.mjs +1 -1
  177. package/esm2020/lib/public/esq/data-model/expressions/functions/date-part-function-expression.mjs +2 -2
  178. package/esm2020/lib/public/esq/data-model/expressions/functions/function-expression.mjs +1 -1
  179. package/esm2020/lib/public/esq/data-model/expressions/functions/index.mjs +1 -1
  180. package/esm2020/lib/public/esq/data-model/expressions/functions/length-function-expression.mjs +2 -2
  181. package/esm2020/lib/public/esq/data-model/expressions/functions/macros-function-expression.mjs +2 -2
  182. package/esm2020/lib/public/esq/data-model/expressions/functions/window-function-expression.mjs +2 -2
  183. package/esm2020/lib/public/esq/data-model/expressions/index.mjs +1 -1
  184. package/esm2020/lib/public/esq/data-model/expressions/mocks/expression.mock.mjs +1 -1
  185. package/esm2020/lib/public/esq/data-model/expressions/mocks/index.mjs +1 -1
  186. package/esm2020/lib/public/esq/data-model/expressions/parameters/index.mjs +1 -1
  187. package/esm2020/lib/public/esq/data-model/expressions/parameters/parameter-expression.mjs +7 -1
  188. package/esm2020/lib/public/esq/data-model/expressions/sub-queries/aggregation-sub-query-expression.mjs +1 -1
  189. package/esm2020/lib/public/esq/data-model/expressions/sub-queries/index.mjs +1 -1
  190. package/esm2020/lib/public/esq/data-model/expressions/sub-queries/sub-query-expression.mjs +1 -1
  191. package/esm2020/lib/public/esq/data-model/filters/base-filter.mjs +1 -1
  192. package/esm2020/lib/public/esq/data-model/filters/between-filter.mjs +2 -2
  193. package/esm2020/lib/public/esq/data-model/filters/compare-filter.mjs +2 -2
  194. package/esm2020/lib/public/esq/data-model/filters/exists-filter.mjs +2 -2
  195. package/esm2020/lib/public/esq/data-model/filters/filter-group.mjs +20 -6
  196. package/esm2020/lib/public/esq/data-model/filters/in-filter.mjs +2 -2
  197. package/esm2020/lib/public/esq/data-model/filters/index.mjs +1 -1
  198. package/esm2020/lib/public/esq/data-model/filters/isnull-filter.mjs +2 -2
  199. package/esm2020/lib/public/esq/data-model/filters/mocks/filter.mock.mjs +1 -1
  200. package/esm2020/lib/public/esq/data-model/filters/mocks/index.mjs +1 -1
  201. package/esm2020/lib/public/esq/data-model/filters/single-filter.mjs +1 -1
  202. package/esm2020/lib/public/esq/data-model/index.mjs +1 -1
  203. package/esm2020/lib/public/esq/index.mjs +1 -1
  204. package/esm2020/lib/public/exceptions/argument-empty-exception.mjs +1 -1
  205. package/esm2020/lib/public/exceptions/argument-out-of-range-exception.mjs +1 -1
  206. package/esm2020/lib/public/exceptions/index.mjs +1 -1
  207. package/esm2020/lib/public/exceptions/item-not-found-exception.mjs +1 -1
  208. package/esm2020/lib/public/exceptions/next-handler-already-specified-exception.mjs +1 -1
  209. package/esm2020/lib/public/exceptions/validation-utilities.mjs +1 -1
  210. package/esm2020/lib/public/functions/bootstrap-crt-module-handler-chain-services.mjs +1 -1
  211. package/esm2020/lib/public/functions/bootstrap-crt-module.mjs +35 -6
  212. package/esm2020/lib/public/functions/index.mjs +1 -1
  213. package/esm2020/lib/public/functions/localize.mjs +1 -1
  214. package/esm2020/lib/public/functions/register-angular-view-element.mjs +1 -1
  215. package/esm2020/lib/public/functions/register-view-element.mjs +1 -1
  216. package/esm2020/lib/public/handlers/base-request-handler.mjs +2 -2
  217. package/esm2020/lib/public/handlers/index.mjs +1 -1
  218. package/esm2020/lib/public/models/base-response.model.mjs +1 -1
  219. package/esm2020/lib/public/models/converter/converter-config.mjs +2 -0
  220. package/esm2020/lib/public/models/converter/index.mjs +2 -0
  221. package/esm2020/lib/public/models/converter.model.mjs +1 -1
  222. package/esm2020/lib/public/models/data-source/data-source-insert-result.model.mjs +1 -1
  223. package/esm2020/lib/public/models/data-source/data-source-save-result.model.mjs +1 -1
  224. package/esm2020/lib/public/models/data-source/index.mjs +1 -1
  225. package/esm2020/lib/public/models/entity.model.mjs +1 -1
  226. package/esm2020/lib/public/models/error-info.model.mjs +1 -1
  227. package/esm2020/lib/public/models/image-value.model.mjs +1 -1
  228. package/esm2020/lib/public/models/index.mjs +2 -1
  229. package/esm2020/lib/public/models/input/index.mjs +1 -1
  230. package/esm2020/lib/public/models/input/input-registration-config.model.mjs +1 -1
  231. package/esm2020/lib/public/models/interface-designer-item/index.mjs +1 -1
  232. package/esm2020/lib/public/models/interface-designer-item/interface-designer-item-definition.mjs +1 -1
  233. package/esm2020/lib/public/models/localizable-value.mjs +1 -1
  234. package/esm2020/lib/public/models/lookup-value.model.mjs +1 -1
  235. package/esm2020/lib/public/models/mask-settings.mjs +1 -1
  236. package/esm2020/lib/public/models/module-definition.mjs +1 -1
  237. package/esm2020/lib/public/models/request/base-request-config.mjs +1 -1
  238. package/esm2020/lib/public/models/request/base-request.mjs +1 -1
  239. package/esm2020/lib/public/models/request/data-source-request.mjs +1 -1
  240. package/esm2020/lib/public/models/request/index.mjs +1 -1
  241. package/esm2020/lib/public/models/request/request-registration-config.model.mjs +1 -1
  242. package/esm2020/lib/public/models/request-handler/index.mjs +1 -1
  243. package/esm2020/lib/public/models/request-handler/request-handler-definition.mjs +1 -1
  244. package/esm2020/lib/public/models/request-handler/request-handler.mjs +1 -1
  245. package/esm2020/lib/public/models/validation/base-validator.mjs +1 -1
  246. package/esm2020/lib/public/models/validation/crt-control-state.mjs +1 -1
  247. package/esm2020/lib/public/models/validation/crt-validation-errors.mjs +1 -1
  248. package/esm2020/lib/public/models/validation/crt-validator-fn.mjs +1 -1
  249. package/esm2020/lib/public/models/validation/index.mjs +1 -1
  250. package/esm2020/lib/public/models/validation/validation-info.mjs +1 -1
  251. package/esm2020/lib/public/models/validation/validator-config.mjs +1 -1
  252. package/esm2020/lib/public/models/validation/validator-parameter-values.mjs +1 -1
  253. package/esm2020/lib/public/models/view-element/base-view-element-registration-config.mjs +1 -1
  254. package/esm2020/lib/public/models/view-element/index.mjs +1 -1
  255. package/esm2020/lib/public/models/view-element/view-element-registration-config.mjs +1 -1
  256. package/esm2020/lib/public/models/view-element/view-element-slot-definition.mjs +1 -1
  257. package/esm2020/lib/public/models/view-model-context.mjs +1 -1
  258. package/esm2020/lib/public/services/feature/feature.service.mjs +1 -1
  259. package/esm2020/lib/public/services/feature/index.mjs +1 -1
  260. package/esm2020/lib/public/services/handler-chain/handler-chain.service.mjs +7 -1
  261. package/esm2020/lib/public/services/handler-chain/index.mjs +1 -1
  262. package/esm2020/lib/public/services/handler-chain/internal-handler-chain.mjs +30 -7
  263. package/esm2020/lib/public/services/http-client/http-client.service.mjs +1 -1
  264. package/esm2020/lib/public/services/http-client/http-headers.mjs +1 -1
  265. package/esm2020/lib/public/services/http-client/http-response.mjs +1 -1
  266. package/esm2020/lib/public/services/http-client/index.mjs +1 -1
  267. package/esm2020/lib/public/services/index.mjs +1 -1
  268. package/esm2020/lib/public/services/mask-service/index.mjs +2 -1
  269. package/esm2020/lib/public/services/mask-service/mask.service.mjs +21 -1
  270. package/esm2020/lib/public/services/mask-service/schema-view-mask.request.mjs +22 -0
  271. package/esm2020/lib/public/services/model/data-schema-attribute.mjs +1 -1
  272. package/esm2020/lib/public/services/model/data-schema.mjs +1 -1
  273. package/esm2020/lib/public/services/model/data-source-aggregation-config.mjs +1 -1
  274. package/esm2020/lib/public/services/model/data-source-attribute.mjs +1 -1
  275. package/esm2020/lib/public/services/model/data-source-can-execute-operation.mjs +1 -1
  276. package/esm2020/lib/public/services/model/data-source-function-config.mjs +2 -0
  277. package/esm2020/lib/public/services/model/data-source-paging-config.mjs +1 -1
  278. package/esm2020/lib/public/services/model/data-source-parameter.mjs +1 -1
  279. package/esm2020/lib/public/services/model/data-source-sorting-config.mjs +1 -1
  280. package/esm2020/lib/public/services/model/index.mjs +2 -1
  281. package/esm2020/lib/public/services/model/model-load-options.mjs +1 -1
  282. package/esm2020/lib/public/services/model/model.mjs +1 -1
  283. package/esm2020/lib/public/services/rights/index.mjs +1 -1
  284. package/esm2020/lib/public/services/rights/rights.service.mjs +1 -1
  285. package/esm2020/lib/public/services/sys-settings/index.mjs +1 -1
  286. package/esm2020/lib/public/services/sys-settings/sys-setting.model.mjs +1 -1
  287. package/esm2020/lib/public/services/sys-settings/sys-settings.service.mjs +1 -1
  288. package/esm2020/lib/public/services/sys-values/index.mjs +1 -1
  289. package/esm2020/lib/public/services/sys-values/sys-values.mjs +1 -1
  290. package/esm2020/lib/public/services/sys-values/sys-values.service.mjs +1 -1
  291. package/esm2020/lib/public/types/abstract-type.mjs +1 -1
  292. package/esm2020/lib/public/types/aggregation-eval.type.mjs +2 -0
  293. package/esm2020/lib/public/types/date-part.type.mjs +2 -0
  294. package/esm2020/lib/public/types/entity-column-value.mjs +1 -1
  295. package/esm2020/lib/public/types/function.type.mjs +2 -0
  296. package/esm2020/lib/public/types/guid.type.mjs +2 -2
  297. package/esm2020/lib/public/types/index.mjs +4 -1
  298. package/esm2020/lib/public/types/json-data.type.mjs +1 -1
  299. package/esm2020/lib/public/types/localizable-string.type.mjs +1 -1
  300. package/esm2020/lib/public/types/localize-fn.type.mjs +1 -1
  301. package/esm2020/lib/public/types/resolve-dependency-fn.type.mjs +1 -1
  302. package/esm2020/lib/public/types/sort-direction.type.mjs +1 -1
  303. package/esm2020/lib/public/types/type.mjs +1 -1
  304. package/fesm2015/creatio-devkit-common.mjs +2295 -1949
  305. package/fesm2015/creatio-devkit-common.mjs.map +1 -1
  306. package/fesm2020/creatio-devkit-common.mjs +2292 -1950
  307. package/fesm2020/creatio-devkit-common.mjs.map +1 -1
  308. package/{creatio-devkit-common.d.ts → index.d.ts} +193 -10
  309. package/package.json +9 -7
  310. package/esm2020/lib/internal/decorators/converter/converter.decorator.mjs +0 -11
  311. package/esm2020/lib/internal/decorators/converter/index.mjs +0 -2
  312. package/esm2020/lib/internal/model/data-schema/data-schema-attribute-aggregation-config.mjs +0 -2
  313. package/esm2020/lib/internal/model/data-schema/data-schema-validator-config.mjs +0 -2
  314. package/esm2020/lib/internal/models/remote-entry-info.mjs +0 -2
  315. package/esm2020/lib/internal/services/global-converters-registry/global-converters-registry.service.mjs +0 -23
@@ -1,2159 +1,2238 @@
1
- import 'reflect-metadata';
2
- import { upperFirst, camelCase, isEqual, get, set, cloneDeep } from 'lodash';
3
1
  import { __decorate, __metadata } from 'tslib';
4
2
  import { Exclude, Expose, classToPlain } from 'class-transformer';
3
+ import { upperFirst, camelCase, isEqual, get, set, cloneDeep } from 'lodash';
4
+ import 'reflect-metadata';
5
5
 
6
- /**
7
- * @internal
8
- */
9
- const crtInputPrefix = 'crtInput:';
10
- /**
11
- * @internal
12
- */
13
- const crtOutputPrefix = 'crtOutput:';
14
- /**
15
- * @internal
16
- */
17
- const crtValidationInputPrefix = 'crtValidationInput:';
18
- /**
19
- * @internal
20
- */
21
- const crtInjectPrefix = 'crtInject:';
6
+ var DataValueType;
7
+ (function (DataValueType) {
8
+ DataValueType[DataValueType["Guid"] = 0] = "Guid";
9
+ DataValueType[DataValueType["Text"] = 1] = "Text";
10
+ DataValueType[DataValueType["Integer"] = 4] = "Integer";
11
+ DataValueType[DataValueType["Float"] = 5] = "Float";
12
+ DataValueType[DataValueType["Money"] = 6] = "Money";
13
+ DataValueType[DataValueType["DateTime"] = 7] = "DateTime";
14
+ DataValueType[DataValueType["Date"] = 8] = "Date";
15
+ DataValueType[DataValueType["Time"] = 9] = "Time";
16
+ DataValueType[DataValueType["Lookup"] = 10] = "Lookup";
17
+ DataValueType[DataValueType["Enum"] = 11] = "Enum";
18
+ DataValueType[DataValueType["Boolean"] = 12] = "Boolean";
19
+ DataValueType[DataValueType["Blob"] = 13] = "Blob";
20
+ DataValueType[DataValueType["Image"] = 14] = "Image";
21
+ DataValueType[DataValueType["CUSTOM_OBJECT"] = 15] = "CUSTOM_OBJECT";
22
+ DataValueType[DataValueType["IMAGELOOKUP"] = 16] = "IMAGELOOKUP";
23
+ DataValueType[DataValueType["COLLECTION"] = 17] = "COLLECTION";
24
+ DataValueType[DataValueType["Color"] = 18] = "Color";
25
+ DataValueType[DataValueType["LOCALIZABLE_STRING"] = 19] = "LOCALIZABLE_STRING";
26
+ DataValueType[DataValueType["ENTITY"] = 20] = "ENTITY";
27
+ DataValueType[DataValueType["ENTITY_COLLECTION"] = 21] = "ENTITY_COLLECTION";
28
+ DataValueType[DataValueType["ENTITY_COLUMN_MAPPING_COLLECTION"] = 22] = "ENTITY_COLUMN_MAPPING_COLLECTION";
29
+ DataValueType[DataValueType["HASH_TEXT"] = 23] = "HASH_TEXT";
30
+ DataValueType[DataValueType["SECURE_TEXT"] = 24] = "SECURE_TEXT";
31
+ DataValueType[DataValueType["FILE"] = 25] = "FILE";
32
+ DataValueType[DataValueType["MAPPING"] = 26] = "MAPPING";
33
+ DataValueType[DataValueType["SHORT_TEXT"] = 27] = "SHORT_TEXT";
34
+ DataValueType[DataValueType["MEDIUM_TEXT"] = 28] = "MEDIUM_TEXT";
35
+ DataValueType[DataValueType["MAXSIZE_TEXT"] = 29] = "MAXSIZE_TEXT";
36
+ DataValueType[DataValueType["LONG_TEXT"] = 30] = "LONG_TEXT";
37
+ DataValueType[DataValueType["FLOAT1"] = 31] = "FLOAT1";
38
+ DataValueType[DataValueType["FLOAT2"] = 32] = "FLOAT2";
39
+ DataValueType[DataValueType["FLOAT3"] = 33] = "FLOAT3";
40
+ DataValueType[DataValueType["FLOAT4"] = 34] = "FLOAT4";
41
+ DataValueType[DataValueType["LOCALIZABLE_PARAMETER_VALUES_LIST"] = 35] = "LOCALIZABLE_PARAMETER_VALUES_LIST";
42
+ DataValueType[DataValueType["METADATA_TEXT"] = 36] = "METADATA_TEXT";
43
+ DataValueType[DataValueType["STAGE_INDICATOR"] = 37] = "STAGE_INDICATOR";
44
+ DataValueType[DataValueType["OBJECT_LIST"] = 38] = "OBJECT_LIST";
45
+ DataValueType[DataValueType["COMPOSITE_OBJECT_LIST"] = 39] = "COMPOSITE_OBJECT_LIST";
46
+ DataValueType[DataValueType["FLOAT8"] = 40] = "FLOAT8";
47
+ DataValueType[DataValueType["FILE_LOCATOR"] = 41] = "FILE_LOCATOR";
48
+ DataValueType[DataValueType["PHONE_TEXT"] = 42] = "PHONE_TEXT";
49
+ DataValueType[DataValueType["RICH_TEXT"] = 43] = "RICH_TEXT";
50
+ DataValueType[DataValueType["WEB_TEXT"] = 44] = "WEB_TEXT";
51
+ DataValueType[DataValueType["EMAIL_TEXT"] = 45] = "EMAIL_TEXT";
52
+ })(DataValueType || (DataValueType = {}));
22
53
 
23
- /**
24
- * @public
25
- * @description Creatio platform interacts with input's of user-defined component through CrtInput decorator.
26
- * @param config {@link CrtInputRegistrationConfig}
27
- *
28
- * @example
29
- * export class AppComponent {
30
- * @CrtInput()
31
- * public value!: string;
32
- * }
33
- */
34
- // eslint-disable-next-line @typescript-eslint/naming-convention
35
- function CrtInput(config) {
36
- return function (target, propertyKey) {
37
- if (!config) {
38
- config = {
39
- propertyBindable: false,
40
- };
41
- }
42
- Reflect.defineMetadata(crtInputPrefix + propertyKey.toString(), config, target.constructor);
43
- };
44
- }
54
+ var AggregationType;
55
+ (function (AggregationType) {
56
+ /** Aggregation function type not defined. */
57
+ AggregationType[AggregationType["None"] = 0] = "None";
58
+ /** Aggregation function type not defined. */
59
+ AggregationType[AggregationType["Count"] = 1] = "Count";
60
+ /** Sum of values of all elements. */
61
+ AggregationType[AggregationType["Sum"] = 2] = "Sum";
62
+ /** Average value for all elements. */
63
+ AggregationType[AggregationType["Avg"] = 3] = "Avg";
64
+ /** The minimum value among all elements. */
65
+ AggregationType[AggregationType["Min"] = 4] = "Min";
66
+ /** The maximum value among all elements. */
67
+ AggregationType[AggregationType["Max"] = 5] = "Max";
68
+ /** Top one record from collection. */
69
+ AggregationType[AggregationType["TopOne"] = 6] = "TopOne";
70
+ })(AggregationType || (AggregationType = {}));
45
71
 
46
- /**
47
- * @public
48
- * @description User-defined components could notify Creatio platform about changes through CrtOutput decorator.
49
- * @example
50
- * export class AppComponent {
51
- * @Input()
52
- * @CrtOutput()
53
- * public valueChange;
54
- * }
55
- */
56
- // eslint-disable-next-line @typescript-eslint/naming-convention
57
- function CrtOutput() {
58
- return function (target, propertyKey) {
59
- Reflect.defineMetadata(crtOutputPrefix + propertyKey.toString(), {}, target.constructor);
60
- };
61
- }
72
+ var AggregationFunction;
73
+ (function (AggregationFunction) {
74
+ /** Aggregation function type not defined. */
75
+ AggregationFunction["None"] = "";
76
+ /** Aggregation function type not defined. */
77
+ AggregationFunction["Count"] = "Count";
78
+ /** Sum of values of all elements. */
79
+ AggregationFunction["Sum"] = "Sum";
80
+ /** Average value for all elements. */
81
+ AggregationFunction["Avg"] = "Avg";
82
+ /** The minimum value among all elements. */
83
+ AggregationFunction["Min"] = "Min";
84
+ /** The maximum value among all elements. */
85
+ AggregationFunction["Max"] = "Max";
86
+ /** Top one record from collection. */
87
+ AggregationFunction["TopOne"] = "TopOne";
88
+ })(AggregationFunction || (AggregationFunction = {}));
62
89
 
63
- /**
64
- * @public
65
- * @description User-defined components receive validationInfo changes through CrtValidationInput decorator.
66
- * Make sure you have defined input for every validationInfo input.
67
- * To properly declare validationInfo field:
68
- * 1. Declare input field inside inputs section. For example `value`
69
- * 2. In validationInputs section declare same field which ends with ValidationInfo.
70
- * For previous example `valueValidationInfo`
71
- *
72
- * @example
73
- * export class AppComponent {
74
- * @CrtInput()
75
- public value;
76
- *
77
- * @CrtValidationInput()
78
- * public valueValidationInfo;
79
- * }
80
- */
81
- // eslint-disable-next-line @typescript-eslint/naming-convention
82
- function CrtValidationInput() {
83
- return function (target, propertyKey) {
84
- Reflect.defineMetadata(crtValidationInputPrefix + propertyKey.toString(), {}, target.constructor);
85
- };
86
- }
90
+ var LogicalOperatorType;
91
+ (function (LogicalOperatorType) {
92
+ LogicalOperatorType[LogicalOperatorType["And"] = 0] = "And";
93
+ LogicalOperatorType[LogicalOperatorType["Or"] = 1] = "Or";
94
+ })(LogicalOperatorType || (LogicalOperatorType = {}));
87
95
 
88
- /**
89
- * @internal
90
- */
91
- function checkTypeNameFormat(type, element) {
92
- const typeParts = type.split('.');
93
- if (typeParts.length < 2) {
94
- throw new Error(`Error when register ${type}. Type property should have format "VendorPrefix.${element}"`);
95
- }
96
- }
97
- /**
98
- * @internal
99
- */
100
- function checkTypeNamePascalCase(type) {
101
- const [vendor, typeName] = type.split('.');
102
- const pascalTypeName = toPascalCase(typeName);
103
- if (!vendor || pascalTypeName !== typeName) {
104
- throw new Error(`Error when register ${type}. Type property should have Pascal case, e.g. ${vendor + '.' + pascalTypeName}. ` + 'The first letter of each word in a compound word should be capitalized');
105
- }
106
- }
107
- /**
108
- * @internal
109
- */
110
- function checkCrtTypeNamePascalCase(type) {
111
- const [vendor, typeName] = type.split('.');
112
- const pascalTypeName = toPascalCase(typeName);
113
- if (vendor.toLowerCase() === 'crt' && pascalTypeName !== typeName) {
114
- throw new Error(`Error when register ${type}. Type property should have Pascal case, e.g. ${vendor + '.' + pascalTypeName}. ` + 'The first letter of each word in a compound word should be capitalized');
115
- }
116
- }
117
- /**
118
- * @internal
119
- */
120
- function toPascalCase(source) {
121
- return upperFirst(camelCase(source));
122
- }
123
- /**
124
- * @internal
125
- */
126
- function checkIfTypeRegistered(type, item) {
127
- if (!item) {
128
- throw new Error(`Error when resolve ${type}. Type was not registered.`);
129
- }
130
- }
131
- /**
132
- * @internal
133
- */
134
- function checkOnlyOneRegistration(type, item, map) {
135
- if (map.has(type) && !isEqual(map.get(type), item)) {
136
- throw new Error(`Error when register ${type}. Element with this type has already exist`);
137
- }
138
- }
96
+ var AggregationEvalType;
97
+ (function (AggregationEvalType) {
98
+ /** The scope of the aggregating function is not defined. */
99
+ AggregationEvalType[AggregationEvalType["None"] = 0] = "None";
100
+ /** Applies to all elements. */
101
+ AggregationEvalType[AggregationEvalType["All"] = 1] = "All";
102
+ /** Applies to unique values. */
103
+ AggregationEvalType[AggregationEvalType["Distinct"] = 2] = "Distinct";
104
+ })(AggregationEvalType || (AggregationEvalType = {}));
139
105
 
140
- /**
141
- * @internal
142
- */
143
- class InternalRequestHandlerRegistryType {
144
- static get requestHandlersMap() {
145
- return this._requestHandlersMap;
146
- }
147
- static onAddRequestHandler(handler) {
148
- this._addItemListeners.push(handler);
149
- return () => {
150
- this._addItemListeners.splice(this._addItemListeners.indexOf(handler), 1);
151
- };
152
- }
153
- static onRemoveRequestHandler(handler) {
154
- this._removeItemListeners.push(handler);
155
- return () => {
156
- this._removeItemListeners.splice(this._removeItemListeners.indexOf(handler), 1);
157
- };
158
- }
159
- static addRequestHandler(handlerType, config) {
160
- if (!this._requestHandlersMap.has(handlerType)) {
161
- this._requestHandlersMap.set(handlerType, config);
162
- for (const listener of this._addItemListeners) {
163
- listener(handlerType, config);
164
- }
165
- }
166
- }
167
- static removeRequestHandler(handlerType) {
168
- const config = this._requestHandlersMap.get(handlerType);
169
- if (config) {
170
- this._requestHandlersMap.delete(handlerType);
171
- for (const listener of this._removeItemListeners) {
172
- listener(handlerType, config);
173
- }
174
- }
175
- }
176
- }
177
- InternalRequestHandlerRegistryType._addItemListeners = [];
178
- InternalRequestHandlerRegistryType._removeItemListeners = [];
179
- InternalRequestHandlerRegistryType._requestHandlersMap = new Map();
180
- const global$3 = window;
181
- global$3.creatio ?? (global$3.creatio = {});
182
- if (!global$3.creatio.requestHandlerRegistry) {
183
- Object.defineProperty(global$3.creatio, 'requestHandlerRegistry', {
184
- get: () => InternalRequestHandlerRegistryType,
185
- configurable: false,
186
- });
187
- }
188
- /**
189
- * @internal
190
- */
191
- // eslint-disable-next-line @typescript-eslint/naming-convention
192
- const InternalRequestHandlerRegistry = InternalRequestHandlerRegistryType;
193
- /**
194
- * @internal
195
- */
196
- class RequestHandlerRegistryService {
197
- /**
198
- * Register request handler class.
199
- * @param config Request handler registration config.
200
- * @param type Request handler type.
201
- */
202
- static register(config, type) {
203
- const requestType = config.requestType;
204
- const requestHandlerType = config.type;
205
- if (!requestType) {
206
- throw new Error(`Error when register ${requestHandlerType}. Request type not specified.`);
207
- }
208
- const requestHandlerMapValue = {
209
- instanceType: type,
210
- instanceConfig: config,
211
- };
212
- RequestHandlerRegistryService._internalRegistry.addRequestHandler(requestHandlerType, requestHandlerMapValue);
213
- }
214
- }
215
- RequestHandlerRegistryService._internalRegistry = global$3.creatio.requestHandlerRegistry;
106
+ var ArithmeticOperation;
107
+ (function (ArithmeticOperation) {
108
+ /** Addition. */
109
+ ArithmeticOperation[ArithmeticOperation["Addition"] = 0] = "Addition";
110
+ /** Subtraction. */
111
+ ArithmeticOperation[ArithmeticOperation["Subtraction"] = 1] = "Subtraction";
112
+ /** Multiplication. */
113
+ ArithmeticOperation[ArithmeticOperation["Multiplication"] = 2] = "Multiplication";
114
+ /** Division. */
115
+ ArithmeticOperation[ArithmeticOperation["Division"] = 3] = "Division";
116
+ })(ArithmeticOperation || (ArithmeticOperation = {}));
117
+
118
+ var ComparisonType;
119
+ (function (ComparisonType) {
120
+ ComparisonType[ComparisonType["Between"] = 0] = "Between";
121
+ ComparisonType[ComparisonType["Contain"] = 11] = "Contain";
122
+ ComparisonType[ComparisonType["End_with"] = 13] = "End_with";
123
+ ComparisonType[ComparisonType["Equal"] = 3] = "Equal";
124
+ ComparisonType[ComparisonType["Exists"] = 15] = "Exists";
125
+ ComparisonType[ComparisonType["Greater"] = 7] = "Greater";
126
+ ComparisonType[ComparisonType["Greater_or_equal"] = 8] = "Greater_or_equal";
127
+ ComparisonType[ComparisonType["Is_not_null"] = 2] = "Is_not_null";
128
+ ComparisonType[ComparisonType["Is_null"] = 1] = "Is_null";
129
+ ComparisonType[ComparisonType["Less"] = 5] = "Less";
130
+ ComparisonType[ComparisonType["Less_or_equal"] = 6] = "Less_or_equal";
131
+ ComparisonType[ComparisonType["Not_contain"] = 12] = "Not_contain";
132
+ ComparisonType[ComparisonType["Not_end_with"] = 14] = "Not_end_with";
133
+ ComparisonType[ComparisonType["Not_equal"] = 4] = "Not_equal";
134
+ ComparisonType[ComparisonType["Not_exists"] = 16] = "Not_exists";
135
+ ComparisonType[ComparisonType["Not_start_with"] = 10] = "Not_start_with";
136
+ ComparisonType[ComparisonType["Start_with"] = 9] = "Start_with";
137
+ })(ComparisonType || (ComparisonType = {}));
138
+
139
+ var DatePartType;
140
+ (function (DatePartType) {
141
+ /** Empty value. */
142
+ DatePartType[DatePartType["None"] = 0] = "None";
143
+ /** Day. */
144
+ DatePartType[DatePartType["Day"] = 1] = "Day";
145
+ /** Week. */
146
+ DatePartType[DatePartType["Week"] = 2] = "Week";
147
+ /** Month. */
148
+ DatePartType[DatePartType["Month"] = 3] = "Month";
149
+ /** Year. */
150
+ DatePartType[DatePartType["Year"] = 4] = "Year";
151
+ /** Day of the week. */
152
+ DatePartType[DatePartType["WeekDay"] = 5] = "WeekDay";
153
+ /** Hour. */
154
+ DatePartType[DatePartType["Hour"] = 6] = "Hour";
155
+ /** Minute. */
156
+ DatePartType[DatePartType["HourMinute"] = 7] = "HourMinute";
157
+ })(DatePartType || (DatePartType = {}));
158
+
159
+ var ExpressionType;
160
+ (function (ExpressionType) {
161
+ ExpressionType[ExpressionType["SchemaColumn"] = 0] = "SchemaColumn";
162
+ ExpressionType[ExpressionType["Function"] = 1] = "Function";
163
+ ExpressionType[ExpressionType["Parameter"] = 2] = "Parameter";
164
+ ExpressionType[ExpressionType["SubQuery"] = 3] = "SubQuery";
165
+ ExpressionType[ExpressionType["ArithmeticOperation"] = 4] = "ArithmeticOperation";
166
+ })(ExpressionType || (ExpressionType = {}));
167
+
168
+ var FilterType;
169
+ (function (FilterType) {
170
+ FilterType[FilterType["None"] = 0] = "None";
171
+ FilterType[FilterType["Compare"] = 1] = "Compare";
172
+ FilterType[FilterType["IsNull"] = 2] = "IsNull";
173
+ FilterType[FilterType["Between"] = 3] = "Between";
174
+ FilterType[FilterType["In"] = 4] = "In";
175
+ FilterType[FilterType["Exists"] = 5] = "Exists";
176
+ FilterType[FilterType["FilterGroup"] = 6] = "FilterGroup";
177
+ })(FilterType || (FilterType = {}));
178
+
179
+ var FunctionType;
180
+ (function (FunctionType) {
181
+ FunctionType[FunctionType["None"] = 0] = "None";
182
+ /** Substitution by macro. */
183
+ FunctionType[FunctionType["Macros"] = 1] = "Macros";
184
+ /** Aggregating function. */
185
+ FunctionType[FunctionType["Aggregation"] = 2] = "Aggregation";
186
+ /** Date fragment. */
187
+ FunctionType[FunctionType["DatePart"] = 3] = "DatePart";
188
+ /** The size of the value in bytes, used for binary data. */
189
+ FunctionType[FunctionType["Length"] = 4] = "Length";
190
+ /** Window query function */
191
+ FunctionType[FunctionType["Window"] = 5] = "Window";
192
+ })(FunctionType || (FunctionType = {}));
193
+
194
+ var OrderDirection;
195
+ (function (OrderDirection) {
196
+ OrderDirection[OrderDirection["None"] = 0] = "None";
197
+ OrderDirection[OrderDirection["Asc"] = 1] = "Asc";
198
+ OrderDirection[OrderDirection["Desc"] = 2] = "Desc";
199
+ })(OrderDirection || (OrderDirection = {}));
216
200
 
217
- /**
218
- * @internal
219
- */
220
- class RequestRegistryService {
221
- static get requestsRegistrationInfos() {
222
- return this._requestsRegistrationInfos;
223
- }
224
- /**
225
- * Registers a specified request class.
226
- * @param config Request registration config.
227
- * @param type Request type.
228
- */
229
- static register(config, type) {
230
- const requestType = config.type;
231
- // TODO RND-21723
232
- RequestRegistryService._requestsMap.set(requestType, type);
233
- RequestRegistryService._requestsRegistrationInfos.set(requestType, config);
234
- }
235
- /**
236
- * Creates request instance by specified registered request type.
237
- * @param type Request type.
238
- * @returns The instance of registered request.
239
- */
240
- static get(type) {
241
- const requestInstanceConstructor = RequestRegistryService._requestsMap.get(type);
242
- checkIfTypeRegistered(type, requestInstanceConstructor);
243
- return requestInstanceConstructor && new requestInstanceConstructor();
201
+ var QueryMacrosType;
202
+ (function (QueryMacrosType) {
203
+ /** Macro type not defined. */
204
+ QueryMacrosType[QueryMacrosType["None"] = 0] = "None";
205
+ /** Current user. */
206
+ QueryMacrosType[QueryMacrosType["CurrentUser"] = 1] = "CurrentUser";
207
+ /** Current user contact. */
208
+ QueryMacrosType[QueryMacrosType["CurrentUserContact"] = 2] = "CurrentUserContact";
209
+ /** Yesterday. */
210
+ QueryMacrosType[QueryMacrosType["Yesterday"] = 3] = "Yesterday";
211
+ /** Today. */
212
+ QueryMacrosType[QueryMacrosType["Today"] = 4] = "Today";
213
+ /** Tomorrow. */
214
+ QueryMacrosType[QueryMacrosType["Tomorrow"] = 5] = "Tomorrow";
215
+ /** Previous week. */
216
+ QueryMacrosType[QueryMacrosType["PreviousWeek"] = 6] = "PreviousWeek";
217
+ /** This week. */
218
+ QueryMacrosType[QueryMacrosType["CurrentWeek"] = 7] = "CurrentWeek";
219
+ /** Next week. */
220
+ QueryMacrosType[QueryMacrosType["NextWeek"] = 8] = "NextWeek";
221
+ /** Previous month. */
222
+ QueryMacrosType[QueryMacrosType["PreviousMonth"] = 9] = "PreviousMonth";
223
+ /** Current month. */
224
+ QueryMacrosType[QueryMacrosType["CurrentMonth"] = 10] = "CurrentMonth";
225
+ /** Next month. */
226
+ QueryMacrosType[QueryMacrosType["NextMonth"] = 11] = "NextMonth";
227
+ /** Previous quarter. */
228
+ QueryMacrosType[QueryMacrosType["PreviousQuarter"] = 12] = "PreviousQuarter";
229
+ /** Current quarter. */
230
+ QueryMacrosType[QueryMacrosType["CurrentQuarter"] = 13] = "CurrentQuarter";
231
+ /** Next quarter. */
232
+ QueryMacrosType[QueryMacrosType["NextQuarter"] = 14] = "NextQuarter";
233
+ /** Previous half of the year. */
234
+ QueryMacrosType[QueryMacrosType["PreviousHalfYear"] = 15] = "PreviousHalfYear";
235
+ /** Current half-year. */
236
+ QueryMacrosType[QueryMacrosType["CurrentHalfYear"] = 16] = "CurrentHalfYear";
237
+ /** Next half-year. */
238
+ QueryMacrosType[QueryMacrosType["NextHalfYear"] = 17] = "NextHalfYear";
239
+ /** Last year. */
240
+ QueryMacrosType[QueryMacrosType["PreviousYear"] = 18] = "PreviousYear";
241
+ /** This year. */
242
+ QueryMacrosType[QueryMacrosType["CurrentYear"] = 19] = "CurrentYear";
243
+ /** Previous hour. */
244
+ QueryMacrosType[QueryMacrosType["PreviousHour"] = 20] = "PreviousHour";
245
+ /** Current hour. */
246
+ QueryMacrosType[QueryMacrosType["CurrentHour"] = 21] = "CurrentHour";
247
+ /** Next hour. */
248
+ QueryMacrosType[QueryMacrosType["NextHour"] = 22] = "NextHour";
249
+ /** Next year. */
250
+ QueryMacrosType[QueryMacrosType["NextYear"] = 23] = "NextYear";
251
+ /** Next N Days. */
252
+ QueryMacrosType[QueryMacrosType["NextNDays"] = 24] = "NextNDays";
253
+ /** Previous N days. */
254
+ QueryMacrosType[QueryMacrosType["PreviousNDays"] = 25] = "PreviousNDays";
255
+ /** Next N hours. */
256
+ QueryMacrosType[QueryMacrosType["NextNHours"] = 26] = "NextNHours";
257
+ /** Previous N hours. */
258
+ QueryMacrosType[QueryMacrosType["PreviousNHours"] = 27] = "PreviousNHours";
259
+ /** Primary column. */
260
+ QueryMacrosType[QueryMacrosType["PrimaryColumn"] = 34] = "PrimaryColumn";
261
+ /** Primary displayed column. */
262
+ QueryMacrosType[QueryMacrosType["PrimaryDisplayColumn"] = 35] = "PrimaryDisplayColumn";
263
+ /** Primary image display column. */
264
+ QueryMacrosType[QueryMacrosType["PrimaryImageColumn"] = 36] = "PrimaryImageColumn";
265
+ /** Anniversary today. */
266
+ QueryMacrosType[QueryMacrosType["DayOfYearToday"] = 37] = "DayOfYearToday";
267
+ /** Anniversary on the date computed as today plus days offset. */
268
+ QueryMacrosType[QueryMacrosType["DayOfYearTodayPlusDaysOffset"] = 38] = "DayOfYearTodayPlusDaysOffset";
269
+ /** Anniversary on the next several days. */
270
+ QueryMacrosType[QueryMacrosType["NextNDaysOfYear"] = 39] = "NextNDaysOfYear";
271
+ /** Anniversary on the previous several days. */
272
+ QueryMacrosType[QueryMacrosType["PreviousNDaysOfYear"] = 40] = "PreviousNDaysOfYear";
273
+ /** Primary color display column. */
274
+ QueryMacrosType[QueryMacrosType["PrimaryColorColumn"] = 41] = "PrimaryColorColumn";
275
+ })(QueryMacrosType || (QueryMacrosType = {}));
276
+
277
+ class BaseExpression {
278
+ constructor(config) {
279
+ this.isBlock = false;
280
+ this.isBlock = config?.isBlock;
244
281
  }
245
282
  }
246
- RequestRegistryService._requestsMap = new Map();
247
- RequestRegistryService._requestsRegistrationInfos = new Map();
248
283
 
249
- /**
250
- * @internal
251
- */
252
- class GlobalConvertersRegistryService {
253
- static get(type) {
254
- if (!this._converters.has(type)) {
255
- throw new Error(`'${type}' converter doesn't exist`);
256
- }
257
- return this._converters.get(type);
258
- }
259
- static register(type, ctor) {
260
- checkTypeNameFormat(type, 'ConverterTypeName');
261
- checkCrtTypeNamePascalCase(type);
262
- // TODO RND-21723
263
- this._converters.set(type, new ctor());
284
+ class ArithmeticExpression extends BaseExpression {
285
+ constructor(config) {
286
+ super(config);
287
+ this.expressionType = ExpressionType.ArithmeticOperation;
288
+ this.arithmeticOperation = config?.arithmeticOperation;
289
+ this.leftArithmeticOperand = config?.leftArithmeticOperand.clone();
290
+ this.rightArithmeticOperand = config?.rightArithmeticOperand.clone();
264
291
  }
265
- static clear() {
266
- this._converters.clear();
292
+ clone() {
293
+ return new ArithmeticExpression(this);
267
294
  }
268
295
  }
269
- GlobalConvertersRegistryService._converters = new Map();
270
296
 
271
- const global$2 = window;
272
- /**
273
- * @internal
274
- */
275
- class BaseRegistry {
276
- constructor() {
277
- this.store = {
278
- typeInfos: new Map(),
279
- };
297
+ class ColumnExpression extends BaseExpression {
298
+ constructor(config) {
299
+ super(config);
300
+ this.expressionType = ExpressionType.SchemaColumn;
301
+ this.columnPath = config?.columnPath;
280
302
  }
281
- static get store() {
282
- if (!this._instance) {
283
- let globalInstance = get(global$2, this._prefix + this.registryKey);
284
- if (!globalInstance) {
285
- globalInstance = new this();
286
- set(global$2, this._prefix + this.registryKey, globalInstance);
287
- }
288
- this._instance = globalInstance;
289
- }
290
- return this._instance.store;
303
+ clone() {
304
+ return new ColumnExpression(this);
291
305
  }
292
306
  }
293
- BaseRegistry._prefix = 'creatio.registry.';
294
307
 
295
- /**
296
- * @internal
297
- */
298
- const viewElementRegistryKey = 'ViewElementRegistry';
299
- /**
300
- * @internal
301
- */
302
- class ViewElementRegistry extends BaseRegistry {
303
- static validate(config) {
304
- checkTypeNameFormat(config.type, 'ViewElementTypeName');
305
- checkOnlyOneRegistration(config.type, config, ViewElementRegistry.viewElements);
306
- }
307
- static get viewElements() {
308
- return this.store.typeInfos;
309
- }
310
- static register(config) {
311
- this.viewElements.set(config.type, config);
312
- }
313
- static getFormControlRelatesAttribute(type) {
314
- const config = this.store.typeInfos.get(type);
315
- return (config && 'formControlConfig' in config && config.formControlConfig?.relatesTo) || null;
308
+ class FunctionExpression extends BaseExpression {
309
+ constructor(config) {
310
+ super(config);
311
+ this.expressionType = ExpressionType.Function;
316
312
  }
317
313
  }
318
- ViewElementRegistry.registryKey = viewElementRegistryKey;
319
314
 
320
- /**
321
- * @internal
322
- */
323
- const interfaceDesignerItemRegistryKey = 'InterfaceDesignerItemRegistry';
324
- /**
325
- * @internal
326
- */
327
- class InterfaceDesignerItemRegistry extends BaseRegistry {
328
- static validate(config) {
329
- checkTypeNameFormat(config.type, 'InterfaceDesignerItemTypeName');
330
- checkCrtTypeNamePascalCase(config.type);
331
- checkOnlyOneRegistration(config.type, config, this.interfaceDesignerItemRegistrationInfos);
332
- }
333
- static register(config) {
334
- this.interfaceDesignerItemRegistrationInfos.set(config.type, config);
335
- }
336
- static get interfaceDesignerItemRegistrationInfos() {
337
- return this.store.typeInfos;
338
- }
339
- static get(type) {
340
- return this.interfaceDesignerItemRegistrationInfos.get(type);
315
+ class ArgumentFunctionExpression extends FunctionExpression {
316
+ constructor(config) {
317
+ super(config);
318
+ this.functionArgument = config?.functionArgument.clone();
341
319
  }
342
320
  }
343
- InterfaceDesignerItemRegistry.registryKey = interfaceDesignerItemRegistryKey;
344
321
 
345
- const global$1 = window;
346
- /**
347
- * @internal
348
- */
349
- class BootstrapNotifier {
350
- constructor() {
351
- this._subscribers = new Set();
352
- }
353
- static get instance() {
354
- if (!global$1.__crtModuleBootstrapNotifier) {
355
- global$1.__crtModuleBootstrapNotifier = new BootstrapNotifier();
356
- }
357
- return global$1.__crtModuleBootstrapNotifier;
358
- }
359
- notify(moduleType) {
360
- for (const subscriber of this._subscribers.values()) {
361
- subscriber(moduleType);
362
- }
322
+ class AggregationFunctionExpression extends ArgumentFunctionExpression {
323
+ constructor(config) {
324
+ super(config);
325
+ this.functionType = FunctionType.Aggregation;
326
+ this.aggregationType = config?.aggregationType;
327
+ this.aggregationEvalType = config?.aggregationEvalType;
363
328
  }
364
- subscribe(subscriber) {
365
- this._subscribers.add(subscriber);
366
- return {
367
- unsubscribe: () => this._subscribers.delete(subscriber),
368
- };
329
+ clone() {
330
+ return new AggregationFunctionExpression(this);
369
331
  }
370
332
  }
371
333
 
372
- /**
373
- * @internal
374
- */
375
- class HandlerChainServicesRegistry extends BaseRegistry {
376
- static validate({ requestType }) {
377
- checkTypeNameFormat(requestType, this.registryKey);
378
- checkCrtTypeNamePascalCase(requestType);
379
- this.checkUniqueRequestType(requestType);
334
+ class DatePartFunctionExpression extends ArgumentFunctionExpression {
335
+ constructor(config) {
336
+ super(config);
337
+ this.functionType = FunctionType.DatePart;
338
+ this.datePartType = config?.datePartType;
380
339
  }
381
- static checkUniqueRequestType(requestType) {
382
- if (this.services.get(requestType)) {
383
- throw new Error(`${requestType} already registered`);
384
- }
340
+ clone() {
341
+ return new DatePartFunctionExpression(this);
385
342
  }
386
- static register(config) {
387
- this.validate(config);
388
- this.services.set(config.requestType, config);
343
+ }
344
+
345
+ class LengthFunctionExpression extends ArgumentFunctionExpression {
346
+ constructor(config) {
347
+ super(config);
348
+ this.functionType = FunctionType.Length;
389
349
  }
390
- static get services() {
391
- return this.store.typeInfos;
350
+ clone() {
351
+ return new LengthFunctionExpression(this);
392
352
  }
393
353
  }
394
- HandlerChainServicesRegistry.registryKey = 'HandlerChainServicesRegistry';
395
354
 
396
- /**
397
- * @internal
398
- */
399
- const designTimeViewElementRegistryKey = 'DesignTimeViewElementRegistry';
400
- /**
401
- * @internal
402
- */
403
- class DesignTimeViewElementRegistry extends BaseRegistry {
404
- static validate(config) {
405
- checkTypeNameFormat(config.type, 'DesignTimeViewElementRegistryItemTypeName');
406
- checkCrtTypeNamePascalCase(config.type);
407
- checkOnlyOneRegistration(config.type, config, this.infos);
355
+ class MacrosFunctionExpression extends FunctionExpression {
356
+ constructor(config) {
357
+ super(config);
358
+ this.functionType = FunctionType.Macros;
359
+ this.macrosType = config?.macrosType;
408
360
  }
409
- static register(config) {
410
- this.infos.set(config.type, config);
361
+ clone() {
362
+ return new MacrosFunctionExpression(this);
411
363
  }
412
- static getByOverriddenType(type) {
413
- const item = Array.from(this.infos).find(([_, info]) => info.overrideType === type);
414
- if (item) {
415
- return item[1];
416
- }
417
- return null;
364
+ }
365
+
366
+ class WindowFunctionExpression extends ArgumentFunctionExpression {
367
+ constructor(config) {
368
+ super(config);
369
+ this.functionType = FunctionType.Window;
418
370
  }
419
- static get infos() {
420
- return this.store.typeInfos;
371
+ clone() {
372
+ return new WindowFunctionExpression(this);
421
373
  }
422
374
  }
423
- DesignTimeViewElementRegistry.registryKey = designTimeViewElementRegistryKey;
424
375
 
425
376
  /**
426
377
  * @internal
378
+ * Returns a string represent of date in ISO 8601 without time zone specification(doesn't convert it
379
+ * using local timezone).
380
+ *
381
+ * Example:
382
+ *
383
+ * const date = new Date(2018, 01, 20, 15, 10, 30);
384
+ * const result = toLocalISOString(date);
385
+ * //result: '2018-02-20T15:10:30'
386
+ *
387
+ * @param date Date value.
427
388
  */
428
- class ValidatorMapValue {
389
+ function toLocalISOString(date) {
390
+ if (!(date instanceof Date)) {
391
+ throw new TypeError();
392
+ }
393
+ const timeZoneOffset = date.getTimezoneOffset() * 60000;
394
+ return new Date(date.getTime() - timeZoneOffset).toISOString().slice(0, -1);
429
395
  }
430
396
  /**
431
397
  * @internal
398
+ * Returns encoded date in string value.
399
+ * @param date Date value.
432
400
  */
433
- const validatorRegistryKey = 'ValidatorRegistry';
434
- /**
435
- * @internal
436
- */
437
- class ValidatorRegistry extends BaseRegistry {
438
- static _has(configType, type) {
439
- return ValidatorRegistry.items.has(configType) && ValidatorRegistry.items.get(configType)?.typeRef !== type;
401
+ function encodeDate(date) {
402
+ return `"${toLocalISOString(date)}"`;
403
+ }
404
+
405
+ class ParameterExpression extends BaseExpression {
406
+ constructor(config) {
407
+ super(config);
408
+ this.expressionType = ExpressionType.Parameter;
409
+ const value = config?.value;
410
+ if (value instanceof Date) {
411
+ const cloneDate = new Date();
412
+ cloneDate.setTime(value.getTime());
413
+ this.value = cloneDate;
414
+ }
415
+ else if (!value) {
416
+ this.value = value;
417
+ }
418
+ else {
419
+ this.value = typeof value === 'object' ? { ...value } : value;
420
+ }
421
+ this.dataValueType = config?.dataValueType ?? DataValueType.Text;
440
422
  }
441
- static validate(config) {
442
- checkTypeNameFormat(config.type, 'ValidatorTypeName');
443
- if (ValidatorRegistry._has(config.type, config.typeRef)) {
444
- throw new Error(`Error when register ${config.type}. Element with this type has already exist`);
423
+ get parameter() {
424
+ return {
425
+ dataValueType: this.dataValueType,
426
+ ...this._getParameterValueMetadata(),
427
+ };
428
+ }
429
+ _convertStringToBlobArray(str) {
430
+ const out = [];
431
+ let position = 0;
432
+ for (let i = 0; i < str.length; i++) {
433
+ const code = str.charCodeAt(i);
434
+ if (code < 128) {
435
+ out[position++] = String.fromCharCode(code);
436
+ }
437
+ else if (code < 2048) {
438
+ /* eslint-disable no-bitwise */
439
+ out[position++] = String.fromCharCode((code >> 6) | 192);
440
+ out[position++] = String.fromCharCode((code & 63) | 128);
441
+ }
442
+ else {
443
+ out[position++] = String.fromCharCode((code >> 12) | 224);
444
+ out[position++] = String.fromCharCode(((code >> 6) & 63) | 128);
445
+ out[position++] = String.fromCharCode((code & 63) | 128);
446
+ /* eslint-enable no-bitwise */
447
+ }
445
448
  }
449
+ return out;
446
450
  }
447
- static get items() {
448
- return this.store.typeInfos;
451
+ _getParameterValueMetadata() {
452
+ if (this.dataValueType === DataValueType.Blob) {
453
+ return {
454
+ arrayValue: !this.value ? [] : this._convertStringToBlobArray(this.value),
455
+ };
456
+ }
457
+ else if (this.value instanceof Date) {
458
+ return {
459
+ value: encodeDate(this.value),
460
+ };
461
+ }
462
+ else {
463
+ return {
464
+ value: this.value,
465
+ };
466
+ }
449
467
  }
450
- static register(config) {
451
- this.items.set(config.type, config);
468
+ clone() {
469
+ return new ParameterExpression(this);
452
470
  }
453
471
  }
454
- ValidatorRegistry.registryKey = validatorRegistryKey;
472
+ __decorate([
473
+ Exclude(),
474
+ __metadata("design:type", Object)
475
+ ], ParameterExpression.prototype, "value", void 0);
476
+ __decorate([
477
+ Exclude(),
478
+ __metadata("design:type", Number)
479
+ ], ParameterExpression.prototype, "dataValueType", void 0);
480
+ __decorate([
481
+ Expose(),
482
+ __metadata("design:type", Object),
483
+ __metadata("design:paramtypes", [])
484
+ ], ParameterExpression.prototype, "parameter", null);
455
485
 
456
- /**
457
- * @internal
458
- */
459
- class PkgTopology extends BaseRegistry {
460
- static get items() {
461
- return this.store.typeInfos;
486
+ class SubQueryExpression extends BaseExpression {
487
+ constructor(config) {
488
+ super(config);
489
+ this.expressionType = ExpressionType.SubQuery;
490
+ this.columnPath = config?.columnPath;
491
+ const subFilter = config?.subFilters;
492
+ this.subFilters = typeof subFilter?.clone === 'function' ? subFilter.clone() : subFilter;
493
+ this.subOrderDirection = config.subOrderDirection;
494
+ this.subOrderColumn = config.subOrderColumn;
462
495
  }
463
- static get(pkgName) {
464
- const order = this.items.get(pkgName);
465
- if (order === undefined) {
466
- throw new Error(`Package with name ${pkgName} not found in topology`);
467
- }
468
- return order;
496
+ clone() {
497
+ return new SubQueryExpression(this);
469
498
  }
470
499
  }
471
- PkgTopology.registryKey = 'pkgTopology';
472
500
 
473
- /**
474
- * @internal
475
- */
476
- class RemoteEntriesRegistry extends BaseRegistry {
477
- static get items() {
478
- return this.store.typeInfos;
501
+ class AggregationSubQueryExpression extends SubQueryExpression {
502
+ constructor(config) {
503
+ super(config);
504
+ this.aggregationType = config?.aggregationType;
505
+ }
506
+ clone() {
507
+ return new AggregationSubQueryExpression(this);
479
508
  }
480
509
  }
481
- RemoteEntriesRegistry.registryKey = 'remotes';
482
510
 
483
- /**
484
- * @internal
485
- */
486
- function objectDeepKeys(obj) {
487
- if (obj === null || typeof obj !== 'object') {
488
- return [];
511
+ const EXPRESSION_TYPE_MOCK = -1;
512
+ class ExpressionMock extends BaseExpression {
513
+ constructor(config) {
514
+ super(config || {});
515
+ this.expressionType = EXPRESSION_TYPE_MOCK;
516
+ }
517
+ // eslint-disable-next-line @typescript-eslint/ban-types
518
+ get plainObject() {
519
+ return classToPlain(this, { exposeUnsetFields: false, excludePrefixes: ['_'] });
520
+ }
521
+ clone() {
522
+ return new ExpressionMock(this);
489
523
  }
490
- return Object.keys(obj)
491
- .filter((key) => obj[key] instanceof Object)
492
- .map((key) => objectDeepKeys(obj[key]).map((k) => [key, ...k]))
493
- .reduce((x, y) => [...x, ...y], Object.keys(obj).map((x) => [x]));
494
524
  }
495
525
 
496
- const moduleMetadataKey = 'module';
497
- const viewElementMetadataKey = 'viewElement';
498
- const interfaceDesignerItemMetadataKey = 'interfaceDesignerItem';
499
- const requestHandlerMetadataKey = 'requestHandler';
500
- const designTimeViewElementMetadataKey = 'designTimeViewElement';
501
- const validatorMetadataKey = 'validator';
502
- /**
503
- * @internal
504
- */
505
- function setModuleMetadata(metadata, type) {
506
- Reflect.defineMetadata(moduleMetadataKey, metadata, type);
507
- }
508
- /**
509
- * @internal
510
- */
511
- function getModuleMetadata(type) {
512
- const metadata = Reflect.getMetadata(moduleMetadataKey, type);
513
- if (!metadata) {
514
- throw new Error(`Module metadata was not found on '${type.name}' class`);
526
+ class BaseFilter {
527
+ constructor(filterType) {
528
+ this.isEnabled = true;
529
+ this.trimDateTimeParameterToDate = false;
530
+ this.filterType = filterType;
515
531
  }
516
- return metadata;
517
- }
518
- /**
519
- * @internal
520
- */
521
- function setViewElementMetadata(metadata, type) {
522
- Reflect.defineMetadata(viewElementMetadataKey, metadata, type);
523
532
  }
524
- /**
525
- * @internal
526
- */
527
- function getViewElementMetadata(type) {
528
- const metadata = Reflect.getMetadata(viewElementMetadataKey, type);
529
- if (!metadata) {
530
- throw new Error(`View element metadata was not found on '${type.name}' class`);
533
+
534
+ class FilterMock extends BaseFilter {
535
+ constructor(filterType = FilterType.None) {
536
+ super(filterType);
537
+ }
538
+ // eslint-disable-next-line @typescript-eslint/ban-types
539
+ get plainObject() {
540
+ return classToPlain(this, { exposeUnsetFields: false, excludePrefixes: ['_'] });
541
+ }
542
+ clone() {
543
+ return new FilterMock(this.filterType);
531
544
  }
532
- return metadata;
533
- }
534
- /**
535
- * @internal
536
- */
537
- function setValidatorMetadata(metadata, type) {
538
- Reflect.defineMetadata(validatorMetadataKey, metadata, type);
539
545
  }
540
- /**
541
- * @internal
542
- */
543
- function getValidatorMetadata(type) {
544
- const metadata = Reflect.getOwnMetadata(validatorMetadataKey, type);
545
- if (!metadata) {
546
- throw new Error(`Validator metadata was not found on '${type.name}' class`);
546
+
547
+ class SingleFilter extends BaseFilter {
548
+ constructor(filterType, comparisonType, leftExpression) {
549
+ super(filterType);
550
+ this.comparisonType = comparisonType;
551
+ this.leftExpression = leftExpression.clone();
547
552
  }
548
- return metadata;
549
553
  }
550
- /**
551
- * @internal
552
- */
553
- function setInterfaceDesignerItemMetadata(metadata, type) {
554
- Reflect.defineMetadata(interfaceDesignerItemMetadataKey, metadata, type);
554
+
555
+ class CompareFilter extends SingleFilter {
556
+ constructor(comparisonType, leftExpression, rightExpression) {
557
+ super(FilterType.Compare, comparisonType, leftExpression);
558
+ this.rightExpression = rightExpression.clone();
559
+ }
560
+ clone() {
561
+ return new CompareFilter(this.comparisonType, this.leftExpression, this.rightExpression);
562
+ }
555
563
  }
556
- /**
557
- * @internal
558
- */
559
- function getInterfaceDesignerItemMetadata(type) {
560
- const metadata = Reflect.getOwnMetadata(interfaceDesignerItemMetadataKey, type);
561
- if (!metadata) {
562
- throw new Error(`Interface designer item metadata was not found on '${type.name}' class`);
564
+
565
+ class BetweenFilter extends SingleFilter {
566
+ constructor(leftExpression, rightLessExpression, rightGreaterExpression) {
567
+ super(FilterType.Between, ComparisonType.Between, leftExpression);
568
+ this.rightLessExpression = rightLessExpression.clone();
569
+ this.rightGreaterExpression = rightGreaterExpression.clone();
570
+ }
571
+ clone() {
572
+ return new BetweenFilter(this.leftExpression, this.rightLessExpression, this.rightGreaterExpression);
563
573
  }
564
- return metadata;
565
574
  }
566
- /**
567
- * @internal
568
- */
569
- function setDesignTimeViewElementMetadata(metadata, type) {
570
- Reflect.defineMetadata(designTimeViewElementMetadataKey, metadata, type);
575
+
576
+ class ExistsFilter extends SingleFilter {
577
+ constructor(leftExpression, subFilters, comparisonType = ComparisonType.Exists, isAggregative = true) {
578
+ super(FilterType.Exists, comparisonType, leftExpression);
579
+ this.subFilters = subFilters?.clone();
580
+ this.isAggregative = isAggregative;
581
+ }
582
+ clone() {
583
+ return new ExistsFilter(this.leftExpression, this.subFilters, this.comparisonType, this.isAggregative);
584
+ }
571
585
  }
572
- /**
573
- * @internal
574
- */
575
- function getDesignTimeViewElementMetadata(type) {
576
- const metadata = Reflect.getOwnMetadata(designTimeViewElementMetadataKey, type);
577
- if (!metadata) {
578
- throw new Error(`Design time view element metadata was not found on '${type.name}' class`);
586
+
587
+ class InFilter extends SingleFilter {
588
+ constructor(comparisonType, leftExpression, rightExpressions) {
589
+ super(FilterType.In, comparisonType, leftExpression);
590
+ this.rightExpressions = rightExpressions.map((expression) => expression.clone());
591
+ }
592
+ clone() {
593
+ return new InFilter(this.comparisonType, this.leftExpression, this.rightExpressions);
579
594
  }
580
- return metadata;
581
595
  }
582
- /**
583
- * @internal
584
- */
585
- function hasInterfaceDesignerItemMetadata(type) {
586
- return Reflect.hasOwnMetadata(interfaceDesignerItemMetadataKey, type);
596
+
597
+ class IsNullFilter extends SingleFilter {
598
+ constructor(comparisonType, leftExpression) {
599
+ super(FilterType.IsNull, comparisonType, leftExpression);
600
+ }
601
+ get isNull() {
602
+ return this.comparisonType === ComparisonType.Is_null;
603
+ }
604
+ clone() {
605
+ return new IsNullFilter(this.comparisonType, this.leftExpression);
606
+ }
587
607
  }
608
+ __decorate([
609
+ Expose(),
610
+ __metadata("design:type", Boolean),
611
+ __metadata("design:paramtypes", [])
612
+ ], IsNullFilter.prototype, "isNull", null);
613
+
588
614
  /**
615
+ * Empty Guid constant.
589
616
  * @internal
590
617
  */
591
- function setRequestHandlerMetadata(metadata, type) {
592
- Reflect.defineMetadata(requestHandlerMetadataKey, metadata, type);
593
- }
618
+ const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
594
619
  /**
620
+ * Regular expression for Guid validation.
595
621
  * @internal
596
622
  */
597
- function getRequestHandlerMetadata(type) {
598
- const metadata = Reflect.getMetadata(requestHandlerMetadataKey, type);
599
- if (!metadata) {
600
- throw new Error(`Request handler metadata was not found on '${type.name}' class`);
601
- }
602
- return metadata;
603
- }
623
+ const validator = new RegExp('^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$', 'i');
604
624
  /**
625
+ * Generates guid part.
626
+ * @param length Part length.
605
627
  * @internal
606
628
  */
607
- function getHandlerChainServiceMetadata(typeRef) {
608
- const requestType = Reflect.getMetadata('requestType', typeRef);
609
- if (!requestType) {
610
- throw new Error(`requestType was not found on '${typeRef.name}' class`);
629
+ function generateGuidPart(length) {
630
+ let out = '';
631
+ for (let i = 0; i < length; i++) {
632
+ // eslint-disable-next-line no-bitwise
633
+ out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
611
634
  }
612
- return { requestType, typeRef };
613
- }
614
- /**
615
- * @internal
616
- */
617
- function getCrtInputsMetadata(type) {
618
- const keys = Reflect.getMetadataKeys(type);
619
- const crtInputKeys = keys.filter((x) => x.startsWith(crtInputPrefix));
620
- return Object.fromEntries(crtInputKeys.map((key) => {
621
- const data = Reflect.getMetadata(key, type);
622
- return [key.replace(crtInputPrefix, ''), data];
623
- }));
635
+ return out;
624
636
  }
625
637
  /**
638
+ * Generates new Guid.
626
639
  * @internal
627
640
  */
628
- function getCrtOutputsMetadata(type) {
629
- const keys = Reflect.getMetadataKeys(type);
630
- const crtOutputKeys = keys.filter((x) => x.startsWith(crtOutputPrefix));
631
- return Object.fromEntries(crtOutputKeys.map((key) => {
632
- const data = Reflect.getMetadata(key, type);
633
- return [key.replace(crtOutputPrefix, ''), data];
634
- }));
641
+ function generateGuid() {
642
+ return [
643
+ generateGuidPart(2),
644
+ generateGuidPart(1),
645
+ generateGuidPart(1),
646
+ generateGuidPart(1),
647
+ generateGuidPart(3),
648
+ ].join('-');
635
649
  }
636
650
  /**
651
+ * Checks if value is Guid.
652
+ * @param value Value for check.
637
653
  * @internal
638
654
  */
639
- function getCrtValidationInputsMetadata(type) {
640
- const keys = Reflect.getMetadataKeys(type);
641
- const crtValidationInputKeys = keys.filter((x) => x.startsWith(crtValidationInputPrefix));
642
- return Object.fromEntries(crtValidationInputKeys.map((key) => {
643
- const data = Reflect.getMetadata(key, type);
644
- return [key.replace(crtValidationInputPrefix, ''), data];
645
- }));
655
+ function isGuid(value) {
656
+ return Boolean(value) && validator.test(value);
646
657
  }
647
658
  /**
659
+ * Checks if Guid is empty value or equal to EMPTY_GUID.
660
+ * @param guid Guid for check.
648
661
  * @internal
649
662
  */
650
- function getCrtInjectMetadata(type) {
651
- const keys = Reflect.getOwnMetadataKeys(type);
652
- const crtInjectKeys = keys.filter((x) => x.startsWith(crtInjectPrefix));
653
- return Object.fromEntries(crtInjectKeys.map((key) => {
654
- const index = Number(key.replace(crtInjectPrefix, ''));
655
- const data = Reflect.getMetadata(key, type);
656
- return [index, data];
657
- }));
663
+ function isEmptyGuid(guid) {
664
+ return !guid || guid === EMPTY_GUID;
658
665
  }
666
+
659
667
  /**
660
668
  * @internal
661
669
  */
662
- function getParentType(type) {
663
- const parentProto = type.prototype ? Object.getPrototypeOf(type.prototype) : null;
664
- return parentProto ? parentProto.constructor : null;
670
+ class NextHandlerAlreadySpecifiedException extends Error {
671
+ constructor() {
672
+ super('Next handler already specified');
673
+ }
665
674
  }
666
- /**
667
- * @internal
668
- */
669
- function getTypeDependencies(type) {
670
- const paramTypes = Reflect.getOwnMetadata('design:paramtypes', type);
671
- if (!paramTypes) {
672
- if (type.length > 0) {
673
- throw new Error(`Dependency Injection error. Cannot read dependencies of class '${type.name}'. ` +
674
- `Please make sure class '${type.name}' has decorator and ` +
675
- "'emitDecoratorMetadata' option is enabled in your 'tsconfig.json' file.");
676
- }
677
- const parentType = getParentType(type);
678
- return parentType && parentType !== Object ? getTypeDependencies(parentType) : [];
675
+
676
+ class ArgumentEmptyException extends Error {
677
+ // region Constructors: Public
678
+ constructor(argumentName) {
679
+ super(`Argument with name '${argumentName}' is empty.`);
679
680
  }
680
- const crtInjectMetadata = getCrtInjectMetadata(type);
681
- Object.entries(crtInjectMetadata).forEach(([index, token]) => (paramTypes[index] = token));
682
- return paramTypes;
683
681
  }
684
682
 
685
- /**
686
- * @public
687
- */
688
- class CrtInputRegistrationConfig {
683
+ class ArgumentOutOfRangeException extends Error {
684
+ // region Constructors: Public
685
+ constructor(argumentName) {
686
+ super(`Argument with name '${argumentName}' is out of range.`);
687
+ }
689
688
  }
690
689
 
691
- /**
692
- * @public
693
- * @class BaseRequest
694
- * @describe Base definition of request.
695
- * @template TEvent
696
- */
697
- class BaseRequest {
690
+ class ItemNotFoundException extends Error {
691
+ // region Constructors: Public
692
+ constructor(key) {
693
+ super(`Item with key '${key}' does not exist.`);
694
+ }
698
695
  }
699
696
 
700
- /**
701
- * @public
702
- * @class DataRequest
703
- * @description Definition of data source request.
704
- * @extends {BaseRequest} {@link BaseRequest}
705
- * @property {string} dataSourceName - name of assigned data source.
706
- */
707
- class DataRequest extends BaseRequest {
697
+ class ValidationUtilities {
698
+ // region Methods: Public
699
+ static checkArgumentEmpty(argumentName, argumentValue) {
700
+ if (argumentValue === undefined || argumentValue === null) {
701
+ throw new ArgumentEmptyException(argumentName);
702
+ }
703
+ }
704
+ static checkArrayEmpty(argumentName, argumentValue) {
705
+ ValidationUtilities.checkArgumentEmpty(argumentName, argumentValue);
706
+ if (argumentValue.length === 0) {
707
+ throw new ArgumentEmptyException(argumentName);
708
+ }
709
+ }
710
+ static checkStringIsNotEmpty(argumentName, argumentValue) {
711
+ this.checkArgumentEmpty(argumentName, argumentValue);
712
+ if (argumentValue === '') {
713
+ throw new ArgumentEmptyException(argumentName);
714
+ }
715
+ return argumentValue;
716
+ }
717
+ static checkArgumentOutOfRange(argumentName, argumentValue, range) {
718
+ if (range.begin && argumentValue < range.begin) {
719
+ throw new ArgumentOutOfRangeException(argumentName);
720
+ }
721
+ if (range.end && argumentValue > range.end) {
722
+ throw new ArgumentOutOfRangeException(argumentName);
723
+ }
724
+ }
708
725
  }
709
726
 
710
- /**
711
- * @public
712
- * @description Request payload
713
- * @property {string} request - request name.
714
- * @property {unknown} params - request parameters.
715
- */
716
-
717
- /**
718
- * @public
719
- * @description Abstract Base Validator class for designing custom validators.
720
- * @example
721
- * @CrtValidator({
722
- * type: 'crt.Required',
723
- * })
724
- * export class RequiredValidator extends BaseValidator {
725
- * protected override async = false;
726
- * public validate(controlState: CrtControlState, params?: ValidatorParametersValues): CrtValidationErrors | null {
727
- * Implementation here...
728
- * }
729
- * }
730
- */
731
- class BaseValidator {
732
- /**
733
- * @description getter for async/sync indicator
734
- */
735
- get isAsync() {
736
- return this.async;
727
+ class FilterGroup extends BaseFilter {
728
+ constructor(logicalOperation = LogicalOperatorType.And) {
729
+ super(FilterType.FilterGroup);
730
+ this.filters = new Map();
731
+ this.logicalOperation = logicalOperation;
732
+ }
733
+ get items() {
734
+ return classToPlain(this.filters, {
735
+ exposeUnsetFields: false,
736
+ excludePrefixes: ['_'],
737
+ });
737
738
  }
738
739
  /**
739
- * @description Function used for validation
740
+ * Returns filter item by index.
741
+ * @param index Item index.
742
+ * @returns Filter.
740
743
  */
741
- get validateFn() {
742
- return this.validate.bind(this);
744
+ getItemByIndex(index) {
745
+ return this.items[Object.keys(this.items)[index]];
746
+ }
747
+ addSchemaColumnFilterWithParameter(comparisonType, columnPath, parameterValue) {
748
+ const leftExpression = new ColumnExpression({ columnPath });
749
+ const rightExpression = new ParameterExpression({ value: parameterValue });
750
+ const filter = new CompareFilter(comparisonType, leftExpression, rightExpression);
751
+ this.add(filter);
752
+ }
753
+ addSchemaColumnInFilterWithParameters(comparisonType, columnPath, parameterValues) {
754
+ const leftExpression = new ColumnExpression({ columnPath });
755
+ const expressions = parameterValues.map((singleParameterValue) => new ParameterExpression({
756
+ value: singleParameterValue,
757
+ }));
758
+ const filter = new InFilter(comparisonType, leftExpression, expressions);
759
+ this.add(filter);
760
+ }
761
+ addSchemaColumnIsNullFilter(columnPath) {
762
+ const leftExpression = new ColumnExpression({ columnPath });
763
+ const filter = new IsNullFilter(ComparisonType.Is_null, leftExpression);
764
+ this.add(filter);
765
+ }
766
+ addSchemaColumnIsNotNullFilter(columnPath) {
767
+ const leftExpression = new ColumnExpression({ columnPath });
768
+ const filter = new IsNullFilter(ComparisonType.Is_not_null, leftExpression);
769
+ this.add(filter);
743
770
  }
744
771
  /**
745
- * @internal
772
+ * Creates and adds filter between less value and greater value.
773
+ * @param columnPath Column path.
774
+ * @param lessParamValue Less parameter value.
775
+ * @param greaterParamValue Greater parameter value.
746
776
  */
747
- static [Symbol.hasInstance](instance) {
748
- return instance?.constructor?.['_instanceOfKey'] === BaseValidator._instanceOfKey;
777
+ addSchemaColumnBetweenFilterWithParameters(columnPath, lessParamValue, greaterParamValue) {
778
+ const leftExpression = new ColumnExpression({ columnPath });
779
+ const rightLessExpression = new ParameterExpression({ value: lessParamValue });
780
+ const rightGreaterExpression = new ParameterExpression({ value: greaterParamValue });
781
+ const filter = new BetweenFilter(leftExpression, rightLessExpression, rightGreaterExpression);
782
+ this.add(filter);
783
+ }
784
+ addExistsFilter(columnPath, subFilters) {
785
+ const leftExpression = new ColumnExpression({ columnPath });
786
+ const filter = new ExistsFilter(leftExpression, subFilters);
787
+ this.add(filter);
788
+ }
789
+ addNotExistsFilter(columnPath, subFilters) {
790
+ const leftExpression = new ColumnExpression({ columnPath });
791
+ const filter = new ExistsFilter(leftExpression, subFilters, ComparisonType.Not_exists);
792
+ this.add(filter);
793
+ }
794
+ add(filter, filterKey) {
795
+ ValidationUtilities.checkArgumentEmpty('filter', filter);
796
+ const key = filterKey || generateGuid();
797
+ this.filters.set(key, filter);
798
+ }
799
+ clone() {
800
+ const filterGroup = new FilterGroup(this.logicalOperation);
801
+ this.filters.forEach((filter, filterKey) => {
802
+ filterGroup.filters.set(filterKey, filter.clone());
803
+ });
804
+ return filterGroup;
749
805
  }
750
806
  }
751
- /**
752
- * @internal
753
- * @dontChange
754
- */
755
- BaseValidator._instanceOfKey = 'devkit_BaseValidator';
807
+ __decorate([
808
+ Exclude(),
809
+ __metadata("design:type", Object)
810
+ ], FilterGroup.prototype, "filters", void 0);
811
+ __decorate([
812
+ Expose(),
813
+ __metadata("design:type", Object),
814
+ __metadata("design:paramtypes", [])
815
+ ], FilterGroup.prototype, "items", null);
756
816
 
757
- /**
758
- * @public
759
- */
760
- class LocalizableValue {
761
- constructor(key) {
762
- this.key = key;
817
+ class BaseQueryColumn {
818
+ constructor(expression) {
819
+ this.orderDirection = OrderDirection.None;
820
+ this.orderPosition = -1;
821
+ this.isVisible = true;
822
+ this.expression = expression;
763
823
  }
764
824
  /**
765
- * @internal
825
+ * Adds ordering options.
826
+ * @param orderDirection Direction.
827
+ * @param orderPosition Position.
828
+ * @returns Self.
766
829
  */
767
- static [Symbol.hasInstance](instance) {
768
- return instance?.constructor?.['_instanceOfKey'] === LocalizableValue._instanceOfKey;
830
+ withOrdering(orderDirection, orderPosition) {
831
+ ValidationUtilities.checkArgumentEmpty('orderDirection', orderDirection);
832
+ ValidationUtilities.checkArgumentEmpty('orderPosition', orderPosition);
833
+ ValidationUtilities.checkArgumentOutOfRange('orderPosition', orderPosition, { begin: -1 });
834
+ this.orderDirection = orderDirection;
835
+ this.orderPosition = orderPosition;
836
+ return this;
837
+ }
838
+ /**
839
+ * Adds options.
840
+ * @param options Options.
841
+ * @returns Self.
842
+ */
843
+ withOptions(options) {
844
+ ValidationUtilities.checkArgumentEmpty('options', options);
845
+ this.isVisible = options.isVisible ?? true;
846
+ return this;
847
+ }
848
+ /**
849
+ * Adds caption.
850
+ * @param caption Caption.
851
+ * @returns Self.
852
+ */
853
+ withCaption(caption) {
854
+ ValidationUtilities.checkArgumentEmpty('caption', caption);
855
+ this.caption = caption;
856
+ return this;
769
857
  }
770
858
  }
771
- /**
772
- * @internal
773
- * @dontChange
774
- */
775
- LocalizableValue._instanceOfKey = 'devkit_LocalizableValue';
776
859
 
777
- /**
778
- * @internal
779
- */
780
- function applyLocalizeMetadataFn(obj, localizeMetadata) {
781
- const localizableEntries = objectDeepKeys(obj)
782
- .map((path) => ({ path, value: get(obj, path) }))
783
- .filter(({ value }) => value instanceof LocalizableValue);
784
- if (localizableEntries.length === 0) {
785
- return obj;
786
- }
787
- const localized = cloneDeep(obj);
788
- if (!localizeMetadata) {
789
- console.error("Unable to localize metadata. 'localizeMetadata' bootstrap option was not provided.");
860
+ class ArithmeticQueryColumn extends BaseQueryColumn {
861
+ // region Constructors: Public
862
+ constructor(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand) {
863
+ super(new ArithmeticExpression({ arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand }));
790
864
  }
791
- localizableEntries.forEach(({ path, value }) => {
792
- const localizedValue = localizeMetadata?.(value.key) ?? value.key;
793
- set(localized, path, localizedValue);
794
- });
795
- return localized;
796
865
  }
797
866
 
798
- /**
799
- * @internal
800
- */
801
- function instantiate(type, resolveDependency) {
802
- const deps = getTypeDependencies(type);
803
- if (deps.length > 0) {
804
- if (!resolveDependency) {
805
- throw new Error(`Cannot resolve dependencies for ${type.name}. ` +
806
- "Please provide 'resolveDependency' bootstrap option");
807
- }
808
- const depInstances = deps.map(resolveDependency);
809
- return new type(...depInstances);
867
+ class EntityQueryColumn extends BaseQueryColumn {
868
+ // region Constructors: Public
869
+ constructor(columnPath) {
870
+ super(new ColumnExpression({ columnPath }));
810
871
  }
811
- return new type();
812
872
  }
813
873
 
814
- /**
815
- * @internal
816
- */
817
- var ViewElementGroupType;
818
- (function (ViewElementGroupType) {
819
- ViewElementGroupType["Charts"] = "Charts";
820
- ViewElementGroupType["Components"] = "Components";
821
- ViewElementGroupType["LayoutElements"] = "LayoutElements";
822
- ViewElementGroupType["Inputs"] = "Inputs";
823
- ViewElementGroupType["CustomElements"] = "CustomElements";
824
- })(ViewElementGroupType || (ViewElementGroupType = {}));
874
+ class ParameterQueryColumn extends BaseQueryColumn {
875
+ // region Constructors: Public
876
+ constructor(value, dataValueType) {
877
+ super(new ParameterExpression({ value, dataValueType }));
878
+ }
879
+ }
825
880
 
826
- /**
827
- * @internal
828
- */
829
- var ViewElementDataGroupType;
830
- (function (ViewElementDataGroupType) {
831
- ViewElementDataGroupType["Data"] = "Data";
832
- })(ViewElementDataGroupType || (ViewElementDataGroupType = {}));
833
- /**
834
- * @internal
835
- */
836
- // eslint-disable-next-line @typescript-eslint/naming-convention
837
- const DesignerToolGroupType = { ...ViewElementDataGroupType, ...ViewElementGroupType };
881
+ class AggregationSubQueryColumn extends BaseQueryColumn {
882
+ // region Constructors: Public
883
+ constructor(columnPath, aggregationType, subFilters, subOrderDirection, subOrderColumn) {
884
+ super(new AggregationSubQueryExpression({
885
+ aggregationType,
886
+ columnPath,
887
+ subFilters,
888
+ subOrderDirection,
889
+ subOrderColumn,
890
+ }));
891
+ }
892
+ }
838
893
 
839
- /**
840
- * @internal
841
- */
842
- var DataSourceScope;
843
- (function (DataSourceScope) {
844
- DataSourceScope["ViewElement"] = "viewElement";
845
- DataSourceScope["Page"] = "page";
846
- })(DataSourceScope || (DataSourceScope = {}));
894
+ class SubQueryColumn extends BaseQueryColumn {
895
+ // region Constructors: Public
896
+ constructor(columnPath, subFilters) {
897
+ super(new SubQueryExpression({ columnPath, subFilters }));
898
+ }
899
+ }
847
900
 
848
- /**
849
- * @internal
850
- */
851
- var ModelInPageAction;
852
- (function (ModelInPageAction) {
853
- ModelInPageAction["Edit"] = "edit";
854
- ModelInPageAction["Add"] = "add";
855
- ModelInPageAction["Copy"] = "copy";
856
- })(ModelInPageAction || (ModelInPageAction = {}));
901
+ class AggregationFunctionColumn extends BaseQueryColumn {
902
+ // region Constructors: Public
903
+ constructor(aggregationType, aggregationEvalType, functionArgument) {
904
+ super(new AggregationFunctionExpression({
905
+ aggregationType,
906
+ aggregationEvalType,
907
+ functionArgument,
908
+ }));
909
+ }
910
+ }
857
911
 
858
- /**
859
- * Handler source types in order of call priority.
860
- * @internal
861
- */
862
- var HandlerSourceType;
863
- (function (HandlerSourceType) {
864
- HandlerSourceType[HandlerSourceType["Schema"] = 0] = "Schema";
865
- HandlerSourceType[HandlerSourceType["Remote"] = 1] = "Remote";
866
- HandlerSourceType[HandlerSourceType["Host"] = 2] = "Host";
867
- })(HandlerSourceType || (HandlerSourceType = {}));
912
+ class DatePartFunctionColumn extends BaseQueryColumn {
913
+ // region Constructors: Public
914
+ constructor(datePartType, functionArgument) {
915
+ super(new DatePartFunctionExpression({
916
+ datePartType,
917
+ functionArgument,
918
+ }));
919
+ }
920
+ // endregion
921
+ // region Properties: Public
922
+ get datePartType() {
923
+ return this.expression?.datePartType;
924
+ }
925
+ }
868
926
 
869
- /**
870
- * @internal
871
- */
872
- var DataSchemaAttributeType;
873
- (function (DataSchemaAttributeType) {
874
- DataSchemaAttributeType["OwnAttribute"] = "Own";
875
- DataSchemaAttributeType["ForwardReferenceAttribute"] = "ForwardReference";
876
- DataSchemaAttributeType["BackReferenceAttribute"] = "BackReference";
877
- DataSchemaAttributeType["AggregationAttribute"] = "Aggregation";
878
- })(DataSchemaAttributeType || (DataSchemaAttributeType = {}));
879
- /**
880
- * @internal
881
- */
882
- var DataSchemaAttributeUsageType;
883
- (function (DataSchemaAttributeUsageType) {
884
- DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["General"] = 0] = "General";
885
- DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["Advanced"] = 1] = "Advanced";
886
- DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["None"] = 2] = "None";
887
- })(DataSchemaAttributeUsageType || (DataSchemaAttributeUsageType = {}));
927
+ class LengthFunctionColumn extends BaseQueryColumn {
928
+ // region Constructors: Public
929
+ constructor(functionArgument) {
930
+ super(new LengthFunctionExpression({ functionArgument }));
931
+ }
932
+ }
888
933
 
889
- /**
890
- * @internal
891
- */
892
- var DefaultValueSource;
893
- (function (DefaultValueSource) {
894
- DefaultValueSource[DefaultValueSource["None"] = 0] = "None";
895
- DefaultValueSource[DefaultValueSource["Const"] = 1] = "Const";
896
- DefaultValueSource[DefaultValueSource["Settings"] = 2] = "Settings";
897
- DefaultValueSource[DefaultValueSource["SystemValue"] = 3] = "SystemValue";
898
- DefaultValueSource[DefaultValueSource["Sequence"] = 4] = "Sequence";
899
- })(DefaultValueSource || (DefaultValueSource = {}));
934
+ class MacrosFunctionColumn extends BaseQueryColumn {
935
+ // region Constructors: Public
936
+ constructor(macrosType) {
937
+ super(new MacrosFunctionExpression({ macrosType }));
938
+ }
939
+ }
940
+
941
+ class WindowFunctionColumn extends BaseQueryColumn {
942
+ // region Constructors: Public
943
+ constructor(functionArgument) {
944
+ super(new WindowFunctionExpression({ functionArgument }));
945
+ }
946
+ }
900
947
 
901
948
  /**
902
949
  * @internal
903
950
  */
904
- class HandlersOrderComparer {
905
- constructor(_request) {
906
- this._request = _request;
907
- const scopesOrderEntries = [...(this._request.scopes ?? [])].reverse().map((scope, index) => [scope, index]);
908
- this._scopesOrder = Object.fromEntries(scopesOrderEntries);
909
- }
910
- _getOrderByScopes(handler) {
911
- if (!handler.scopes) {
912
- return Number.MAX_VALUE;
913
- }
914
- const scopesOrder = handler.scopes.filter((s) => s in this._scopesOrder).map((s) => this._scopesOrder[s]);
915
- return Math.min(...scopesOrder);
916
- }
917
- _getOrderByPkgTopology(handler) {
918
- if (handler.source.type === HandlerSourceType.Host) {
919
- return Number.MAX_VALUE;
920
- }
921
- return PkgTopology.get(handler.source.packageName);
922
- }
923
- compare(a, b) {
924
- const aScopeOrder = this._getOrderByScopes(a);
925
- const bScopeOrder = this._getOrderByScopes(b);
926
- let diff = aScopeOrder - bScopeOrder;
927
- if (diff) {
928
- return diff;
929
- }
930
- const aPkgTopologyOrder = this._getOrderByPkgTopology(a);
931
- const bPkgTopologyOrder = this._getOrderByPkgTopology(b);
932
- diff = aPkgTopologyOrder - bPkgTopologyOrder;
933
- if (diff) {
934
- return diff;
935
- }
936
- diff = a.source.type - b.source.type;
937
- return diff;
951
+ function toAggregationType(aggregationFunction) {
952
+ switch (aggregationFunction) {
953
+ case AggregationFunction.Count:
954
+ return AggregationType.Count;
955
+ case AggregationFunction.Sum:
956
+ return AggregationType.Sum;
957
+ case AggregationFunction.Avg:
958
+ return AggregationType.Avg;
959
+ case AggregationFunction.Min:
960
+ return AggregationType.Min;
961
+ case AggregationFunction.Max:
962
+ return AggregationType.Max;
963
+ case AggregationFunction.TopOne:
964
+ return AggregationType.TopOne;
965
+ default:
966
+ return AggregationType.None;
938
967
  }
939
968
  }
940
-
941
969
  /**
942
970
  * @internal
943
971
  */
944
- function isComponentPropertyBindable(viewConfigType, componentProperty) {
945
- const componentConfig = ViewElementRegistry.viewElements.get(viewConfigType);
946
- if (!componentConfig?.inputs) {
947
- return false;
972
+ function toAggregationFunction(aggregationType) {
973
+ switch (aggregationType) {
974
+ case AggregationType.Count:
975
+ return AggregationFunction.Count;
976
+ case AggregationType.Sum:
977
+ return AggregationFunction.Sum;
978
+ case AggregationType.Avg:
979
+ return AggregationFunction.Avg;
980
+ case AggregationType.Min:
981
+ return AggregationFunction.Min;
982
+ case AggregationType.Max:
983
+ return AggregationFunction.Max;
984
+ case AggregationType.TopOne:
985
+ return AggregationFunction.TopOne;
986
+ default:
987
+ return AggregationFunction.None;
948
988
  }
949
- return !!componentConfig?.inputs[componentProperty]?.propertyBindable;
950
989
  }
951
-
952
990
  /**
953
991
  * @internal
954
992
  */
955
- // eslint-disable-next-line @typescript-eslint/naming-convention
956
- function CrtViewElement(config) {
957
- return function (type) {
958
- checkTypeNamePascalCase(config.type);
959
- const inputs = getCrtInputsMetadata(type);
960
- const outputs = getCrtOutputsMetadata(type);
961
- const validationInputs = getCrtValidationInputsMetadata(type);
962
- const baseRegistrationConfig = {
963
- ...config,
964
- inputs,
965
- outputs,
966
- validationInputs,
967
- };
968
- const registrationConfig = 'selector' in config
969
- ? { ...baseRegistrationConfig, selector: config.selector }
970
- : { ...baseRegistrationConfig, typeRef: type };
971
- setViewElementMetadata(registrationConfig, type);
972
- };
993
+ function toAggregationEvalType(aggregationEval) {
994
+ switch (aggregationEval) {
995
+ case 'all':
996
+ return AggregationEvalType.All;
997
+ case 'distinct':
998
+ return AggregationEvalType.Distinct;
999
+ default:
1000
+ return AggregationEvalType.None;
1001
+ }
973
1002
  }
974
-
975
1003
  /**
976
- * @public
977
- * @description CrtModule decorator is a 'container' where user actually setup elements.
978
- * In could contain viewElements, definitions of other CrtModules.
979
- * @param moduleDefinition - {@link ModuleDefinition}
980
- *
981
- * @example
982
- * @CrtModule({
983
- * viewElements: [AppComponent],
984
- * requestHandlers: [SomeRequestHandler],
985
- * validators: [SomeValidator],
986
- * })
987
- * @NgModule({
988
- * declarations: [AppComponent],
989
- * imports: [BrowserModule],
990
- * providers: [],
991
- * })
992
- * export class AppModule {}
1004
+ * @internal
993
1005
  */
994
- function CrtModule(moduleDefinition) {
995
- return (type) => setModuleMetadata(moduleDefinition, type);
1006
+ function toAggregationEval(aggregationEvalType) {
1007
+ switch (aggregationEvalType) {
1008
+ case AggregationEvalType.All:
1009
+ return 'all';
1010
+ case AggregationEvalType.Distinct:
1011
+ return 'distinct';
1012
+ default:
1013
+ return 'none';
1014
+ }
996
1015
  }
997
1016
 
998
- // noinspection ES6PreferShortImport
999
1017
  /**
1000
1018
  * @internal
1001
1019
  */
1002
- // eslint-disable-next-line @typescript-eslint/naming-convention
1003
- function CrtInterfaceDesignerItem(config) {
1004
- function _applyTypeCaption() {
1005
- if (!config.typeCaption && config.toolbarConfig) {
1006
- const toolbarConfig = Array.isArray(config.toolbarConfig)
1007
- ? config.toolbarConfig[0]
1008
- : config.toolbarConfig;
1009
- config.typeCaption = toolbarConfig.caption;
1010
- }
1020
+ function toDatePartType(aggregationFunction) {
1021
+ switch (aggregationFunction) {
1022
+ case 'minute':
1023
+ return DatePartType.HourMinute;
1024
+ case 'hour':
1025
+ return DatePartType.Hour;
1026
+ case 'day':
1027
+ return DatePartType.Day;
1028
+ case 'weekday':
1029
+ return DatePartType.WeekDay;
1030
+ case 'week':
1031
+ return DatePartType.Week;
1032
+ case 'month':
1033
+ return DatePartType.Month;
1034
+ case 'year':
1035
+ return DatePartType.Year;
1036
+ default:
1037
+ return DatePartType.None;
1011
1038
  }
1012
- return function (type) {
1013
- config.typeRef = type;
1014
- config.viewElementGroupType ?? (config.viewElementGroupType = ViewElementGroupType.CustomElements);
1015
- _applyTypeCaption();
1016
- setInterfaceDesignerItemMetadata(config, type);
1017
- };
1018
1039
  }
1019
-
1020
1040
  /**
1021
- * @public
1022
- * @description
1023
- * Constructor parameter decorator.
1024
- * Mark parameter as dependency that should be obtained by token.
1025
- * @param token - token by which the dependency instance will be obtained
1026
- * @example
1027
- * class MyHandler {
1028
- * constructor(@CrtInject(USER_NAME_TOKEN) userName: string) {}
1029
- * }
1041
+ * @internal
1030
1042
  */
1031
- function CrtInject(token) {
1032
- return function (target, paramKey, paramIndex) {
1033
- Reflect.defineMetadata(crtInjectPrefix + paramIndex, token, target);
1034
- };
1043
+ function toDatePart(aggregationType) {
1044
+ switch (aggregationType) {
1045
+ case DatePartType.HourMinute:
1046
+ return 'minute';
1047
+ case DatePartType.Hour:
1048
+ return 'hour';
1049
+ case DatePartType.Day:
1050
+ return 'day';
1051
+ case DatePartType.WeekDay:
1052
+ return 'weekday';
1053
+ case DatePartType.Week:
1054
+ return 'week';
1055
+ case DatePartType.Month:
1056
+ return 'month';
1057
+ case DatePartType.Year:
1058
+ return 'year';
1059
+ default:
1060
+ return 'none';
1061
+ }
1035
1062
  }
1036
1063
 
1037
1064
  /**
1038
1065
  * @internal
1039
1066
  */
1040
- // eslint-disable-next-line @typescript-eslint/naming-convention
1041
- function CrtValidator(config) {
1042
- if (!config) {
1043
- return (type) => { };
1067
+ function toStringFunctionType(functionType) {
1068
+ switch (functionType) {
1069
+ case FunctionType.Aggregation:
1070
+ return 'aggregation';
1071
+ case FunctionType.DatePart:
1072
+ return 'datePart';
1073
+ default:
1074
+ return 'none';
1044
1075
  }
1045
- return function (type) {
1046
- checkTypeNameFormat(config.type, 'ValidatorTypeName');
1047
- const registrationConfig = {
1048
- ...config,
1049
- typeRef: type,
1050
- };
1051
- setValidatorMetadata(registrationConfig, type);
1052
- };
1053
1076
  }
1054
-
1055
1077
  /**
1056
1078
  * @internal
1057
1079
  */
1058
- // eslint-disable-next-line @typescript-eslint/naming-convention
1059
- function CrtRequestHandler(config) {
1060
- if (!config) {
1061
- return (type) => { };
1080
+ function toNumericFunctionType(functionType) {
1081
+ switch (functionType) {
1082
+ case 'aggregation':
1083
+ return FunctionType.Aggregation;
1084
+ case 'datePart':
1085
+ return FunctionType.DatePart;
1086
+ default:
1087
+ return FunctionType.None;
1062
1088
  }
1063
- return function (type) {
1064
- checkTypeNameFormat(config.type, 'RequestHandlerTypeName');
1065
- checkCrtTypeNamePascalCase(config.type);
1066
- setRequestHandlerMetadata(config, type);
1067
- };
1068
1089
  }
1069
1090
 
1070
1091
  /**
1071
1092
  * @internal
1072
1093
  */
1073
- class NextHandlerAlreadySpecifiedException extends Error {
1074
- constructor() {
1075
- super('Next handler already specified');
1094
+ function toOrderDirection(sortDirection) {
1095
+ switch (sortDirection) {
1096
+ case 'asc':
1097
+ return OrderDirection.Asc;
1098
+ case 'desc':
1099
+ return OrderDirection.Desc;
1100
+ default:
1101
+ return OrderDirection.None;
1076
1102
  }
1077
1103
  }
1078
-
1079
- class ArgumentEmptyException extends Error {
1080
- // region Constructors: Public
1081
- constructor(argumentName) {
1082
- super(`Argument with name '${argumentName}' is empty.`);
1104
+ /**
1105
+ * @internal
1106
+ */
1107
+ function toSortDirection(orderDirection) {
1108
+ switch (orderDirection) {
1109
+ case OrderDirection.Asc:
1110
+ return 'asc';
1111
+ case OrderDirection.Desc:
1112
+ return 'desc';
1113
+ default:
1114
+ return 'none';
1083
1115
  }
1084
1116
  }
1085
1117
 
1086
- class ArgumentOutOfRangeException extends Error {
1087
- // region Constructors: Public
1088
- constructor(argumentName) {
1089
- super(`Argument with name '${argumentName}' is out of range.`);
1090
- }
1091
- }
1118
+ /**
1119
+ * @internal
1120
+ */
1121
+ const crtInputPrefix = 'crtInput:';
1122
+ /**
1123
+ * @internal
1124
+ */
1125
+ const crtOutputPrefix = 'crtOutput:';
1126
+ /**
1127
+ * @internal
1128
+ */
1129
+ const crtValidationInputPrefix = 'crtValidationInput:';
1130
+ /**
1131
+ * @internal
1132
+ */
1133
+ const crtInjectPrefix = 'crtInject:';
1092
1134
 
1093
- class ItemNotFoundException extends Error {
1094
- // region Constructors: Public
1095
- constructor(key) {
1096
- super(`Item with key '${key}' does not exist.`);
1135
+ /**
1136
+ * @internal
1137
+ */
1138
+ function objectDeepKeys(obj) {
1139
+ if (obj === null || typeof obj !== 'object') {
1140
+ return [];
1097
1141
  }
1142
+ return Object.keys(obj)
1143
+ .filter((key) => obj[key] instanceof Object)
1144
+ .map((key) => objectDeepKeys(obj[key]).map((k) => [key, ...k]))
1145
+ .reduce((x, y) => [...x, ...y], Object.keys(obj).map((x) => [x]));
1098
1146
  }
1099
1147
 
1100
- class ValidationUtilities {
1101
- // region Methods: Public
1102
- static checkArgumentEmpty(argumentName, argumentValue) {
1103
- if (argumentValue === undefined || argumentValue === null) {
1104
- throw new ArgumentEmptyException(argumentName);
1105
- }
1106
- }
1107
- static checkArrayEmpty(argumentName, argumentValue) {
1108
- ValidationUtilities.checkArgumentEmpty(argumentName, argumentValue);
1109
- if (argumentValue.length === 0) {
1110
- throw new ArgumentEmptyException(argumentName);
1111
- }
1112
- }
1113
- static checkStringIsNotEmpty(argumentName, argumentValue) {
1114
- this.checkArgumentEmpty(argumentName, argumentValue);
1115
- if (argumentValue === '') {
1116
- throw new ArgumentEmptyException(argumentName);
1117
- }
1118
- return argumentValue;
1119
- }
1120
- static checkArgumentOutOfRange(argumentName, argumentValue, range) {
1121
- if (range.begin && argumentValue < range.begin) {
1122
- throw new ArgumentOutOfRangeException(argumentName);
1123
- }
1124
- if (range.end && argumentValue > range.end) {
1125
- throw new ArgumentOutOfRangeException(argumentName);
1126
- }
1148
+ /**
1149
+ * @internal
1150
+ */
1151
+ function checkTypeNameFormat(type, element) {
1152
+ const typeParts = type.split('.');
1153
+ if (typeParts.length < 2) {
1154
+ throw new Error(`Error when register ${type}. Type property should have format "VendorPrefix.${element}"`);
1127
1155
  }
1128
1156
  }
1129
-
1130
1157
  /**
1131
1158
  * @internal
1132
1159
  */
1133
- class InternalHandlerChain {
1134
- constructor() {
1135
- this._handlers = [];
1136
- this._handlersCache = new Map();
1137
- this.handlerChain$ = {
1138
- process: async (request) => {
1139
- const handler = this._getHandler(request);
1140
- return handler?.handle(request);
1141
- },
1142
- register: (info) => {
1143
- this._handlersCache.delete(info.requestType);
1144
- this._handlers.push(info);
1145
- return () => {
1146
- const index = this._handlers.indexOf(info);
1147
- if (index > -1) {
1148
- this._handlers.splice(index, 1);
1149
- this._handlersCache.delete(info.requestType);
1150
- }
1151
- else {
1152
- console.warn(`${info?.requestType} not found to unsubscribe`);
1153
- }
1154
- };
1155
- },
1156
- };
1157
- }
1158
- _getHandler(request) {
1159
- return this._hasCacheHandler(request) ? this._getCacheHandler(request) : this._buildHandlersChain(request);
1160
- }
1161
- _getCacheHandler(request) {
1162
- const map = this._handlersCache.get(request.type);
1163
- const key = this._getCacheScopesKey(request.scopes);
1164
- return map.get(key);
1165
- }
1166
- _hasCacheHandler(request) {
1167
- const map = this._handlersCache.get(request.type);
1168
- const key = this._getCacheScopesKey(request.scopes);
1169
- return map && map.has(key);
1170
- }
1171
- _getCacheScopesKey(scopes) {
1172
- return (scopes || ['']).join('_');
1173
- }
1174
- _setCacheHandler(request, handler) {
1175
- const map = this._handlersCache.has(request.type)
1176
- ? this._handlersCache.get(request.type)
1177
- : new Map();
1178
- const key = this._getCacheScopesKey(request.scopes);
1179
- map.set(key, handler);
1180
- this._handlersCache.set(request.type, map);
1181
- }
1182
- _isRequestHandler(handler) {
1183
- return (typeof handler.handle === 'function' &&
1184
- typeof handler.setNext === 'function');
1185
- }
1186
- _checkHandlerInstanceOf(handler) {
1187
- if (!this._isRequestHandler(handler)) {
1188
- throw new Error('Handler should implement "BaseRequestHandler"');
1189
- }
1190
- }
1191
- _buildHandlersChain(request) {
1192
- const handlers = this._handlers.filter((h) => {
1193
- if (h.requestType !== request.type) {
1194
- return false;
1195
- }
1196
- if (!h.scopes?.length) {
1197
- return true;
1198
- }
1199
- return h.scopes.some((s) => request.scopes?.includes(s));
1200
- });
1201
- const comparer = new HandlersOrderComparer(request);
1202
- handlers.sort((a, b) => comparer.compare(a, b));
1203
- const handlerInstances = handlers.map((handlerConfig) => handlerConfig.createHandler());
1204
- handlerInstances.forEach((handler) => this._checkHandlerInstanceOf(handler));
1205
- this._joinHandlersInChain(handlerInstances);
1206
- const result = handlerInstances[0];
1207
- this._setCacheHandler(request, result);
1208
- return result;
1209
- }
1210
- _joinHandlersInChain(handlers) {
1211
- for (let index = 0; index < handlers.length - 1; index++) {
1212
- try {
1213
- handlers[index].setNext(handlers[index + 1]);
1214
- }
1215
- catch (error) {
1216
- if (error instanceof NextHandlerAlreadySpecifiedException) {
1217
- throw new Error('Handler factory should return new instance of ' +
1218
- 'BaseRequestHandler class or its subclass ' +
1219
- '(next handler should not be specified)');
1220
- }
1221
- throw error;
1222
- }
1223
- }
1160
+ function checkTypeNamePascalCase(type) {
1161
+ const [vendor, typeName] = type.split('.');
1162
+ const pascalTypeName = toPascalCase(typeName);
1163
+ if (!vendor || pascalTypeName !== typeName) {
1164
+ throw new Error(`Error when register ${type}. Type property should have Pascal case, e.g. ${vendor + '.' + pascalTypeName}. ` + 'The first letter of each word in a compound word should be capitalized');
1224
1165
  }
1225
1166
  }
1226
-
1227
- const global = window;
1228
1167
  /**
1229
- * @public
1230
- * @class HandlerChainService
1231
- * @classdesc Service to design handlers in chain.
1168
+ * @internal
1232
1169
  */
1233
- class HandlerChainService {
1234
- constructor() {
1235
- if (!this._chain) {
1236
- this._createGlobalHandlerChain();
1237
- }
1238
- }
1239
- get _chain() {
1240
- return global.handlerChain;
1241
- }
1242
- set _chain(value) {
1243
- global.handlerChain = value;
1244
- }
1245
- static get instance() {
1246
- return HandlerChainService._instance || (HandlerChainService._instance = new HandlerChainService());
1247
- }
1248
- _createGlobalHandlerChain() {
1249
- this._chain = new InternalHandlerChain();
1250
- }
1251
- /**
1252
- * @internal
1253
- */
1254
- register(handlerConfig) {
1255
- return this._chain.handlerChain$.register(handlerConfig);
1170
+ function checkCrtTypeNamePascalCase(type) {
1171
+ const [vendor, typeName] = type.split('.');
1172
+ const pascalTypeName = toPascalCase(typeName);
1173
+ if (vendor.toLowerCase() === 'crt' && pascalTypeName !== typeName) {
1174
+ throw new Error(`Error when register ${type}. Type property should have Pascal case, e.g. ${vendor + '.' + pascalTypeName}. ` + 'The first letter of each word in a compound word should be capitalized');
1256
1175
  }
1257
- /**
1258
- * @description Method to process passed request
1259
- * @param request - {@link BaseRequest}
1260
- * @return `Promise<unknown>`
1261
- */
1262
- process(request) {
1263
- return this._chain.handlerChain$.process(request);
1176
+ }
1177
+ /**
1178
+ * @internal
1179
+ */
1180
+ function toPascalCase(source) {
1181
+ return upperFirst(camelCase(source));
1182
+ }
1183
+ /**
1184
+ * @internal
1185
+ */
1186
+ function checkIfTypeRegistered(type, item) {
1187
+ if (!item) {
1188
+ throw new Error(`Error when resolve ${type}. Type was not registered.`);
1264
1189
  }
1265
1190
  }
1266
-
1267
1191
  /**
1268
1192
  * @internal
1269
1193
  */
1270
- // eslint-disable-next-line @typescript-eslint/naming-convention
1271
- function ImplementUsingHandlerChain(config) {
1272
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1273
- return function (target, method, descriptor) {
1274
- const methodImplementation = function (...args) {
1275
- return HandlerChainService.instance.process({
1276
- type: config?.requestType ? config.requestType : this.requestType,
1277
- method: config?.methodName ? config.methodName : method,
1278
- args,
1279
- });
1194
+ function checkOnlyOneRegistration(type, item, map) {
1195
+ if (map.has(type) && !isEqual(map.get(type), item)) {
1196
+ throw new Error(`Error when register ${type}. Element with this type has already exist`);
1197
+ }
1198
+ }
1199
+
1200
+ /**
1201
+ * @internal
1202
+ */
1203
+ class InternalRequestHandlerRegistryType {
1204
+ static get requestHandlersMap() {
1205
+ return this._requestHandlersMap;
1206
+ }
1207
+ static onAddRequestHandler(handler) {
1208
+ this._addItemListeners.push(handler);
1209
+ return () => {
1210
+ this._addItemListeners.splice(this._addItemListeners.indexOf(handler), 1);
1280
1211
  };
1281
- if (descriptor) {
1282
- descriptor.value = methodImplementation;
1212
+ }
1213
+ static onRemoveRequestHandler(handler) {
1214
+ this._removeItemListeners.push(handler);
1215
+ return () => {
1216
+ this._removeItemListeners.splice(this._removeItemListeners.indexOf(handler), 1);
1217
+ };
1218
+ }
1219
+ static addRequestHandler(handlerType, config) {
1220
+ if (!this._requestHandlersMap.has(handlerType)) {
1221
+ this._requestHandlersMap.set(handlerType, config);
1222
+ for (const listener of this._addItemListeners) {
1223
+ listener(handlerType, config);
1224
+ }
1283
1225
  }
1284
- else {
1285
- target[method] = methodImplementation;
1226
+ }
1227
+ static removeRequestHandler(handlerType) {
1228
+ const config = this._requestHandlersMap.get(handlerType);
1229
+ if (config) {
1230
+ this._requestHandlersMap.delete(handlerType);
1231
+ for (const listener of this._removeItemListeners) {
1232
+ listener(handlerType, config);
1233
+ }
1286
1234
  }
1287
- };
1235
+ }
1236
+ }
1237
+ InternalRequestHandlerRegistryType._addItemListeners = [];
1238
+ InternalRequestHandlerRegistryType._removeItemListeners = [];
1239
+ InternalRequestHandlerRegistryType._requestHandlersMap = new Map();
1240
+ const global$3 = window;
1241
+ global$3.creatio ?? (global$3.creatio = {});
1242
+ if (!global$3.creatio.requestHandlerRegistry) {
1243
+ Object.defineProperty(global$3.creatio, 'requestHandlerRegistry', {
1244
+ get: () => InternalRequestHandlerRegistryType,
1245
+ configurable: false,
1246
+ });
1288
1247
  }
1289
-
1290
1248
  /**
1291
1249
  * @internal
1292
1250
  */
1293
1251
  // eslint-disable-next-line @typescript-eslint/naming-convention
1294
- function CrtConverter(name) {
1295
- return function (type) {
1296
- GlobalConvertersRegistryService.register(name, type);
1297
- };
1298
- }
1299
-
1252
+ const InternalRequestHandlerRegistry = InternalRequestHandlerRegistryType;
1300
1253
  /**
1301
1254
  * @internal
1302
1255
  */
1303
- function CrtDesignTimeViewElement(config) {
1304
- return function (type) {
1305
- const registrationConfig = {
1306
- ...config,
1307
- typeRef: type,
1256
+ class RequestHandlerRegistryService {
1257
+ /**
1258
+ * Register request handler class.
1259
+ * @param config Request handler registration config.
1260
+ * @param type Request handler type.
1261
+ */
1262
+ static register(config, type) {
1263
+ const requestType = config.requestType;
1264
+ const requestHandlerType = config.type;
1265
+ if (!requestType) {
1266
+ throw new Error(`Error when register ${requestHandlerType}. Request type not specified.`);
1267
+ }
1268
+ const requestHandlerMapValue = {
1269
+ instanceType: type,
1270
+ instanceConfig: config,
1308
1271
  };
1309
- setDesignTimeViewElementMetadata(registrationConfig, type);
1310
- };
1272
+ RequestHandlerRegistryService._internalRegistry.addRequestHandler(requestHandlerType, requestHandlerMapValue);
1273
+ }
1311
1274
  }
1275
+ RequestHandlerRegistryService._internalRegistry = global$3.creatio.requestHandlerRegistry;
1312
1276
 
1313
1277
  /**
1314
1278
  * @internal
1315
1279
  */
1316
- // eslint-disable-next-line @typescript-eslint/naming-convention
1317
- function CrtRequest(config) {
1318
- return function (type) {
1319
- checkTypeNameFormat(config.type, 'RequestTypeName');
1320
- checkCrtTypeNamePascalCase(config.type);
1321
- RequestRegistryService.register(config, type);
1322
- };
1323
- }
1324
-
1325
- var DataValueType;
1326
- (function (DataValueType) {
1327
- DataValueType[DataValueType["Guid"] = 0] = "Guid";
1328
- DataValueType[DataValueType["Text"] = 1] = "Text";
1329
- DataValueType[DataValueType["Integer"] = 4] = "Integer";
1330
- DataValueType[DataValueType["Float"] = 5] = "Float";
1331
- DataValueType[DataValueType["Money"] = 6] = "Money";
1332
- DataValueType[DataValueType["DateTime"] = 7] = "DateTime";
1333
- DataValueType[DataValueType["Date"] = 8] = "Date";
1334
- DataValueType[DataValueType["Time"] = 9] = "Time";
1335
- DataValueType[DataValueType["Lookup"] = 10] = "Lookup";
1336
- DataValueType[DataValueType["Enum"] = 11] = "Enum";
1337
- DataValueType[DataValueType["Boolean"] = 12] = "Boolean";
1338
- DataValueType[DataValueType["Blob"] = 13] = "Blob";
1339
- DataValueType[DataValueType["Image"] = 14] = "Image";
1340
- DataValueType[DataValueType["CUSTOM_OBJECT"] = 15] = "CUSTOM_OBJECT";
1341
- DataValueType[DataValueType["IMAGELOOKUP"] = 16] = "IMAGELOOKUP";
1342
- DataValueType[DataValueType["COLLECTION"] = 17] = "COLLECTION";
1343
- DataValueType[DataValueType["Color"] = 18] = "Color";
1344
- DataValueType[DataValueType["LOCALIZABLE_STRING"] = 19] = "LOCALIZABLE_STRING";
1345
- DataValueType[DataValueType["ENTITY"] = 20] = "ENTITY";
1346
- DataValueType[DataValueType["ENTITY_COLLECTION"] = 21] = "ENTITY_COLLECTION";
1347
- DataValueType[DataValueType["ENTITY_COLUMN_MAPPING_COLLECTION"] = 22] = "ENTITY_COLUMN_MAPPING_COLLECTION";
1348
- DataValueType[DataValueType["HASH_TEXT"] = 23] = "HASH_TEXT";
1349
- DataValueType[DataValueType["SECURE_TEXT"] = 24] = "SECURE_TEXT";
1350
- DataValueType[DataValueType["FILE"] = 25] = "FILE";
1351
- DataValueType[DataValueType["MAPPING"] = 26] = "MAPPING";
1352
- DataValueType[DataValueType["SHORT_TEXT"] = 27] = "SHORT_TEXT";
1353
- DataValueType[DataValueType["MEDIUM_TEXT"] = 28] = "MEDIUM_TEXT";
1354
- DataValueType[DataValueType["MAXSIZE_TEXT"] = 29] = "MAXSIZE_TEXT";
1355
- DataValueType[DataValueType["LONG_TEXT"] = 30] = "LONG_TEXT";
1356
- DataValueType[DataValueType["FLOAT1"] = 31] = "FLOAT1";
1357
- DataValueType[DataValueType["FLOAT2"] = 32] = "FLOAT2";
1358
- DataValueType[DataValueType["FLOAT3"] = 33] = "FLOAT3";
1359
- DataValueType[DataValueType["FLOAT4"] = 34] = "FLOAT4";
1360
- DataValueType[DataValueType["LOCALIZABLE_PARAMETER_VALUES_LIST"] = 35] = "LOCALIZABLE_PARAMETER_VALUES_LIST";
1361
- DataValueType[DataValueType["METADATA_TEXT"] = 36] = "METADATA_TEXT";
1362
- DataValueType[DataValueType["STAGE_INDICATOR"] = 37] = "STAGE_INDICATOR";
1363
- DataValueType[DataValueType["OBJECT_LIST"] = 38] = "OBJECT_LIST";
1364
- DataValueType[DataValueType["COMPOSITE_OBJECT_LIST"] = 39] = "COMPOSITE_OBJECT_LIST";
1365
- DataValueType[DataValueType["FLOAT8"] = 40] = "FLOAT8";
1366
- DataValueType[DataValueType["PHONE_TEXT"] = 42] = "PHONE_TEXT";
1367
- DataValueType[DataValueType["RICH_TEXT"] = 43] = "RICH_TEXT";
1368
- DataValueType[DataValueType["WEB_TEXT"] = 44] = "WEB_TEXT";
1369
- DataValueType[DataValueType["EMAIL_TEXT"] = 45] = "EMAIL_TEXT";
1370
- })(DataValueType || (DataValueType = {}));
1371
-
1372
- var AggregationType;
1373
- (function (AggregationType) {
1374
- /** Aggregation function type not defined. */
1375
- AggregationType[AggregationType["None"] = 0] = "None";
1376
- /** Aggregation function type not defined. */
1377
- AggregationType[AggregationType["Count"] = 1] = "Count";
1378
- /** Sum of values of all elements. */
1379
- AggregationType[AggregationType["Sum"] = 2] = "Sum";
1380
- /** Average value for all elements. */
1381
- AggregationType[AggregationType["Avg"] = 3] = "Avg";
1382
- /** The minimum value among all elements. */
1383
- AggregationType[AggregationType["Min"] = 4] = "Min";
1384
- /** The maximum value among all elements. */
1385
- AggregationType[AggregationType["Max"] = 5] = "Max";
1386
- /** Top one record from collection. */
1387
- AggregationType[AggregationType["TopOne"] = 6] = "TopOne";
1388
- })(AggregationType || (AggregationType = {}));
1389
-
1390
- var AggregationFunction;
1391
- (function (AggregationFunction) {
1392
- /** Aggregation function type not defined. */
1393
- AggregationFunction["None"] = "";
1394
- /** Aggregation function type not defined. */
1395
- AggregationFunction["Count"] = "Count";
1396
- /** Sum of values of all elements. */
1397
- AggregationFunction["Sum"] = "Sum";
1398
- /** Average value for all elements. */
1399
- AggregationFunction["Avg"] = "Avg";
1400
- /** The minimum value among all elements. */
1401
- AggregationFunction["Min"] = "Min";
1402
- /** The maximum value among all elements. */
1403
- AggregationFunction["Max"] = "Max";
1404
- /** Top one record from collection. */
1405
- AggregationFunction["TopOne"] = "TopOne";
1406
- })(AggregationFunction || (AggregationFunction = {}));
1407
-
1408
- var LogicalOperatorType;
1409
- (function (LogicalOperatorType) {
1410
- LogicalOperatorType[LogicalOperatorType["And"] = 0] = "And";
1411
- LogicalOperatorType[LogicalOperatorType["Or"] = 1] = "Or";
1412
- })(LogicalOperatorType || (LogicalOperatorType = {}));
1413
-
1414
- var AggregationEvalType;
1415
- (function (AggregationEvalType) {
1416
- /** The scope of the aggregating function is not defined. */
1417
- AggregationEvalType[AggregationEvalType["None"] = 0] = "None";
1418
- /** Applies to all elements. */
1419
- AggregationEvalType[AggregationEvalType["All"] = 1] = "All";
1420
- /** Applies to unique values. */
1421
- AggregationEvalType[AggregationEvalType["Distinct"] = 2] = "Distinct";
1422
- })(AggregationEvalType || (AggregationEvalType = {}));
1423
-
1424
- var ArithmeticOperation;
1425
- (function (ArithmeticOperation) {
1426
- /** Addition. */
1427
- ArithmeticOperation[ArithmeticOperation["Addition"] = 0] = "Addition";
1428
- /** Subtraction. */
1429
- ArithmeticOperation[ArithmeticOperation["Subtraction"] = 1] = "Subtraction";
1430
- /** Multiplication. */
1431
- ArithmeticOperation[ArithmeticOperation["Multiplication"] = 2] = "Multiplication";
1432
- /** Division. */
1433
- ArithmeticOperation[ArithmeticOperation["Division"] = 3] = "Division";
1434
- })(ArithmeticOperation || (ArithmeticOperation = {}));
1435
-
1436
- var ComparisonType;
1437
- (function (ComparisonType) {
1438
- ComparisonType[ComparisonType["Between"] = 0] = "Between";
1439
- ComparisonType[ComparisonType["Contain"] = 11] = "Contain";
1440
- ComparisonType[ComparisonType["End_with"] = 13] = "End_with";
1441
- ComparisonType[ComparisonType["Equal"] = 3] = "Equal";
1442
- ComparisonType[ComparisonType["Exists"] = 15] = "Exists";
1443
- ComparisonType[ComparisonType["Greater"] = 7] = "Greater";
1444
- ComparisonType[ComparisonType["Greater_or_equal"] = 8] = "Greater_or_equal";
1445
- ComparisonType[ComparisonType["Is_not_null"] = 2] = "Is_not_null";
1446
- ComparisonType[ComparisonType["Is_null"] = 1] = "Is_null";
1447
- ComparisonType[ComparisonType["Less"] = 5] = "Less";
1448
- ComparisonType[ComparisonType["Less_or_equal"] = 6] = "Less_or_equal";
1449
- ComparisonType[ComparisonType["Not_contain"] = 12] = "Not_contain";
1450
- ComparisonType[ComparisonType["Not_end_with"] = 14] = "Not_end_with";
1451
- ComparisonType[ComparisonType["Not_equal"] = 4] = "Not_equal";
1452
- ComparisonType[ComparisonType["Not_exists"] = 16] = "Not_exists";
1453
- ComparisonType[ComparisonType["Not_start_with"] = 10] = "Not_start_with";
1454
- ComparisonType[ComparisonType["Start_with"] = 9] = "Start_with";
1455
- })(ComparisonType || (ComparisonType = {}));
1456
-
1457
- var DatePartType;
1458
- (function (DatePartType) {
1459
- /** Empty value. */
1460
- DatePartType[DatePartType["None"] = 0] = "None";
1461
- /** Day. */
1462
- DatePartType[DatePartType["Day"] = 1] = "Day";
1463
- /** Week. */
1464
- DatePartType[DatePartType["Week"] = 2] = "Week";
1465
- /** Month. */
1466
- DatePartType[DatePartType["Month"] = 3] = "Month";
1467
- /** Year. */
1468
- DatePartType[DatePartType["Year"] = 4] = "Year";
1469
- /** Day of the week. */
1470
- DatePartType[DatePartType["WeekDay"] = 5] = "WeekDay";
1471
- /** Hour. */
1472
- DatePartType[DatePartType["Hour"] = 6] = "Hour";
1473
- /** Minute. */
1474
- DatePartType[DatePartType["HourMinute"] = 7] = "HourMinute";
1475
- })(DatePartType || (DatePartType = {}));
1476
-
1477
- var ExpressionType;
1478
- (function (ExpressionType) {
1479
- ExpressionType[ExpressionType["SchemaColumn"] = 0] = "SchemaColumn";
1480
- ExpressionType[ExpressionType["Function"] = 1] = "Function";
1481
- ExpressionType[ExpressionType["Parameter"] = 2] = "Parameter";
1482
- ExpressionType[ExpressionType["SubQuery"] = 3] = "SubQuery";
1483
- ExpressionType[ExpressionType["ArithmeticOperation"] = 4] = "ArithmeticOperation";
1484
- })(ExpressionType || (ExpressionType = {}));
1280
+ class RequestRegistryService {
1281
+ static get requestsRegistrationInfos() {
1282
+ return this._requestsRegistrationInfos;
1283
+ }
1284
+ /**
1285
+ * Registers a specified request class.
1286
+ * @param config Request registration config.
1287
+ * @param type Request type.
1288
+ */
1289
+ static register(config, type) {
1290
+ const requestType = config.type;
1291
+ // TODO RND-21723
1292
+ RequestRegistryService._requestsMap.set(requestType, type);
1293
+ RequestRegistryService._requestsRegistrationInfos.set(requestType, config);
1294
+ }
1295
+ /**
1296
+ * Creates request instance by specified registered request type.
1297
+ * @param type Request type.
1298
+ * @returns The instance of registered request.
1299
+ */
1300
+ static get(type) {
1301
+ const requestInstanceConstructor = RequestRegistryService._requestsMap.get(type);
1302
+ checkIfTypeRegistered(type, requestInstanceConstructor);
1303
+ return requestInstanceConstructor && new requestInstanceConstructor();
1304
+ }
1305
+ }
1306
+ RequestRegistryService._requestsMap = new Map();
1307
+ RequestRegistryService._requestsRegistrationInfos = new Map();
1485
1308
 
1486
- var FilterType;
1487
- (function (FilterType) {
1488
- FilterType[FilterType["None"] = 0] = "None";
1489
- FilterType[FilterType["Compare"] = 1] = "Compare";
1490
- FilterType[FilterType["IsNull"] = 2] = "IsNull";
1491
- FilterType[FilterType["Between"] = 3] = "Between";
1492
- FilterType[FilterType["In"] = 4] = "In";
1493
- FilterType[FilterType["Exists"] = 5] = "Exists";
1494
- FilterType[FilterType["FilterGroup"] = 6] = "FilterGroup";
1495
- })(FilterType || (FilterType = {}));
1309
+ const global$2 = window;
1310
+ /**
1311
+ * @internal
1312
+ */
1313
+ class BaseRegistry {
1314
+ constructor() {
1315
+ this.store = {
1316
+ typeInfos: new Map(),
1317
+ };
1318
+ }
1319
+ static get store() {
1320
+ if (!this._instance) {
1321
+ let globalInstance = get(global$2, this._prefix + this.registryKey);
1322
+ if (!globalInstance) {
1323
+ globalInstance = new this();
1324
+ set(global$2, this._prefix + this.registryKey, globalInstance);
1325
+ }
1326
+ this._instance = globalInstance;
1327
+ }
1328
+ return this._instance.store;
1329
+ }
1330
+ }
1331
+ BaseRegistry._prefix = 'creatio.registry.';
1496
1332
 
1497
- var FunctionType;
1498
- (function (FunctionType) {
1499
- FunctionType[FunctionType["None"] = 0] = "None";
1500
- /** Substitution by macro. */
1501
- FunctionType[FunctionType["Macros"] = 1] = "Macros";
1502
- /** Aggregating function. */
1503
- FunctionType[FunctionType["Aggregation"] = 2] = "Aggregation";
1504
- /** Date fragment. */
1505
- FunctionType[FunctionType["DatePart"] = 3] = "DatePart";
1506
- /** The size of the value in bytes, used for binary data. */
1507
- FunctionType[FunctionType["Length"] = 4] = "Length";
1508
- /** Window query function */
1509
- FunctionType[FunctionType["Window"] = 5] = "Window";
1510
- })(FunctionType || (FunctionType = {}));
1333
+ /**
1334
+ * @internal
1335
+ */
1336
+ class ConverterRegistry extends BaseRegistry {
1337
+ static get(type) {
1338
+ if (!this.store.typeInfos.has(type)) {
1339
+ throw new Error(`'${type}' converter doesn't exist`);
1340
+ }
1341
+ return this.store.typeInfos.get(type);
1342
+ }
1343
+ static register(item) {
1344
+ checkTypeNameFormat(item.type, 'ConverterTypeName');
1345
+ checkCrtTypeNamePascalCase(item.type);
1346
+ // TODO RND-21723
1347
+ this.store.typeInfos.set(item.type, item);
1348
+ }
1349
+ static clear() {
1350
+ this.store.typeInfos.clear();
1351
+ }
1352
+ }
1353
+ ConverterRegistry.registryKey = 'ConverterRegistry';
1511
1354
 
1512
- var OrderDirection;
1513
- (function (OrderDirection) {
1514
- OrderDirection[OrderDirection["None"] = 0] = "None";
1515
- OrderDirection[OrderDirection["Asc"] = 1] = "Asc";
1516
- OrderDirection[OrderDirection["Desc"] = 2] = "Desc";
1517
- })(OrderDirection || (OrderDirection = {}));
1355
+ /**
1356
+ * @internal
1357
+ */
1358
+ const viewElementRegistryKey = 'ViewElementRegistry';
1359
+ /**
1360
+ * @internal
1361
+ */
1362
+ class ViewElementRegistry extends BaseRegistry {
1363
+ static validate(config) {
1364
+ checkTypeNameFormat(config.type, 'ViewElementTypeName');
1365
+ checkOnlyOneRegistration(config.type, config, ViewElementRegistry.viewElements);
1366
+ }
1367
+ static get viewElements() {
1368
+ return this.store.typeInfos;
1369
+ }
1370
+ static register(config) {
1371
+ this.viewElements.set(config.type, config);
1372
+ }
1373
+ static getFormControlRelatesAttribute(type) {
1374
+ const config = this.store.typeInfos.get(type);
1375
+ return (config && 'formControlConfig' in config && config.formControlConfig?.relatesTo) || null;
1376
+ }
1377
+ }
1378
+ ViewElementRegistry.registryKey = viewElementRegistryKey;
1518
1379
 
1519
- var QueryMacrosType;
1520
- (function (QueryMacrosType) {
1521
- /** Macro type not defined. */
1522
- QueryMacrosType[QueryMacrosType["None"] = 0] = "None";
1523
- /** Current user. */
1524
- QueryMacrosType[QueryMacrosType["CurrentUser"] = 1] = "CurrentUser";
1525
- /** Current user contact. */
1526
- QueryMacrosType[QueryMacrosType["CurrentUserContact"] = 2] = "CurrentUserContact";
1527
- /** Yesterday. */
1528
- QueryMacrosType[QueryMacrosType["Yesterday"] = 3] = "Yesterday";
1529
- /** Today. */
1530
- QueryMacrosType[QueryMacrosType["Today"] = 4] = "Today";
1531
- /** Tomorrow. */
1532
- QueryMacrosType[QueryMacrosType["Tomorrow"] = 5] = "Tomorrow";
1533
- /** Previous week. */
1534
- QueryMacrosType[QueryMacrosType["PreviousWeek"] = 6] = "PreviousWeek";
1535
- /** This week. */
1536
- QueryMacrosType[QueryMacrosType["CurrentWeek"] = 7] = "CurrentWeek";
1537
- /** Next week. */
1538
- QueryMacrosType[QueryMacrosType["NextWeek"] = 8] = "NextWeek";
1539
- /** Previous month. */
1540
- QueryMacrosType[QueryMacrosType["PreviousMonth"] = 9] = "PreviousMonth";
1541
- /** Current month. */
1542
- QueryMacrosType[QueryMacrosType["CurrentMonth"] = 10] = "CurrentMonth";
1543
- /** Next month. */
1544
- QueryMacrosType[QueryMacrosType["NextMonth"] = 11] = "NextMonth";
1545
- /** Previous quarter. */
1546
- QueryMacrosType[QueryMacrosType["PreviousQuarter"] = 12] = "PreviousQuarter";
1547
- /** Current quarter. */
1548
- QueryMacrosType[QueryMacrosType["CurrentQuarter"] = 13] = "CurrentQuarter";
1549
- /** Next quarter. */
1550
- QueryMacrosType[QueryMacrosType["NextQuarter"] = 14] = "NextQuarter";
1551
- /** Previous half of the year. */
1552
- QueryMacrosType[QueryMacrosType["PreviousHalfYear"] = 15] = "PreviousHalfYear";
1553
- /** Current half-year. */
1554
- QueryMacrosType[QueryMacrosType["CurrentHalfYear"] = 16] = "CurrentHalfYear";
1555
- /** Next half-year. */
1556
- QueryMacrosType[QueryMacrosType["NextHalfYear"] = 17] = "NextHalfYear";
1557
- /** Last year. */
1558
- QueryMacrosType[QueryMacrosType["PreviousYear"] = 18] = "PreviousYear";
1559
- /** This year. */
1560
- QueryMacrosType[QueryMacrosType["CurrentYear"] = 19] = "CurrentYear";
1561
- /** Previous hour. */
1562
- QueryMacrosType[QueryMacrosType["PreviousHour"] = 20] = "PreviousHour";
1563
- /** Current hour. */
1564
- QueryMacrosType[QueryMacrosType["CurrentHour"] = 21] = "CurrentHour";
1565
- /** Next hour. */
1566
- QueryMacrosType[QueryMacrosType["NextHour"] = 22] = "NextHour";
1567
- /** Next year. */
1568
- QueryMacrosType[QueryMacrosType["NextYear"] = 23] = "NextYear";
1569
- /** Next N Days. */
1570
- QueryMacrosType[QueryMacrosType["NextNDays"] = 24] = "NextNDays";
1571
- /** Previous N days. */
1572
- QueryMacrosType[QueryMacrosType["PreviousNDays"] = 25] = "PreviousNDays";
1573
- /** Next N hours. */
1574
- QueryMacrosType[QueryMacrosType["NextNHours"] = 26] = "NextNHours";
1575
- /** Previous N hours. */
1576
- QueryMacrosType[QueryMacrosType["PreviousNHours"] = 27] = "PreviousNHours";
1577
- /** Primary column. */
1578
- QueryMacrosType[QueryMacrosType["PrimaryColumn"] = 34] = "PrimaryColumn";
1579
- /** Primary displayed column. */
1580
- QueryMacrosType[QueryMacrosType["PrimaryDisplayColumn"] = 35] = "PrimaryDisplayColumn";
1581
- /** Primary image display column. */
1582
- QueryMacrosType[QueryMacrosType["PrimaryImageColumn"] = 36] = "PrimaryImageColumn";
1583
- /** Anniversary today. */
1584
- QueryMacrosType[QueryMacrosType["DayOfYearToday"] = 37] = "DayOfYearToday";
1585
- /** Anniversary on the date computed as today plus days offset. */
1586
- QueryMacrosType[QueryMacrosType["DayOfYearTodayPlusDaysOffset"] = 38] = "DayOfYearTodayPlusDaysOffset";
1587
- /** Anniversary on the next several days. */
1588
- QueryMacrosType[QueryMacrosType["NextNDaysOfYear"] = 39] = "NextNDaysOfYear";
1589
- /** Anniversary on the previous several days. */
1590
- QueryMacrosType[QueryMacrosType["PreviousNDaysOfYear"] = 40] = "PreviousNDaysOfYear";
1591
- /** Primary color display column. */
1592
- QueryMacrosType[QueryMacrosType["PrimaryColorColumn"] = 41] = "PrimaryColorColumn";
1593
- })(QueryMacrosType || (QueryMacrosType = {}));
1380
+ /**
1381
+ * @internal
1382
+ */
1383
+ const interfaceDesignerItemRegistryKey = 'InterfaceDesignerItemRegistry';
1384
+ /**
1385
+ * @internal
1386
+ */
1387
+ class InterfaceDesignerItemRegistry extends BaseRegistry {
1388
+ static validate(config) {
1389
+ checkTypeNameFormat(config.type, 'InterfaceDesignerItemTypeName');
1390
+ checkCrtTypeNamePascalCase(config.type);
1391
+ checkOnlyOneRegistration(config.type, config, this.interfaceDesignerItemRegistrationInfos);
1392
+ }
1393
+ static register(config) {
1394
+ this.interfaceDesignerItemRegistrationInfos.set(config.type, config);
1395
+ }
1396
+ static get interfaceDesignerItemRegistrationInfos() {
1397
+ return this.store.typeInfos;
1398
+ }
1399
+ static get(type) {
1400
+ return this.interfaceDesignerItemRegistrationInfos.get(type);
1401
+ }
1402
+ }
1403
+ InterfaceDesignerItemRegistry.registryKey = interfaceDesignerItemRegistryKey;
1594
1404
 
1595
- class BaseExpression {
1596
- constructor(config) {
1597
- this.isBlock = false;
1598
- this.isBlock = config?.isBlock;
1405
+ const global$1 = window;
1406
+ /**
1407
+ * @internal
1408
+ */
1409
+ class BootstrapNotifier {
1410
+ constructor() {
1411
+ this._subscribers = new Set();
1412
+ }
1413
+ static get instance() {
1414
+ if (!global$1.__crtModuleBootstrapNotifier) {
1415
+ global$1.__crtModuleBootstrapNotifier = new BootstrapNotifier();
1416
+ }
1417
+ return global$1.__crtModuleBootstrapNotifier;
1418
+ }
1419
+ notify(moduleType) {
1420
+ for (const subscriber of this._subscribers.values()) {
1421
+ subscriber(moduleType);
1422
+ }
1423
+ }
1424
+ subscribe(subscriber) {
1425
+ this._subscribers.add(subscriber);
1426
+ return {
1427
+ unsubscribe: () => this._subscribers.delete(subscriber),
1428
+ };
1599
1429
  }
1600
1430
  }
1601
1431
 
1602
- class ArithmeticExpression extends BaseExpression {
1603
- constructor(config) {
1604
- super(config);
1605
- this.expressionType = ExpressionType.ArithmeticOperation;
1606
- this.arithmeticOperation = config?.arithmeticOperation;
1607
- this.leftArithmeticOperand = config?.leftArithmeticOperand.clone();
1608
- this.rightArithmeticOperand = config?.rightArithmeticOperand.clone();
1432
+ /**
1433
+ * @internal
1434
+ */
1435
+ class HandlerChainServicesRegistry extends BaseRegistry {
1436
+ static validate({ requestType }) {
1437
+ checkTypeNameFormat(requestType, this.registryKey);
1438
+ checkCrtTypeNamePascalCase(requestType);
1439
+ this.checkUniqueRequestType(requestType);
1440
+ }
1441
+ static checkUniqueRequestType(requestType) {
1442
+ if (this.services.get(requestType)) {
1443
+ throw new Error(`${requestType} already registered`);
1444
+ }
1609
1445
  }
1610
- clone() {
1611
- return new ArithmeticExpression(this);
1446
+ static register(config) {
1447
+ this.validate(config);
1448
+ this.services.set(config.requestType, config);
1449
+ }
1450
+ static get services() {
1451
+ return this.store.typeInfos;
1612
1452
  }
1613
1453
  }
1454
+ HandlerChainServicesRegistry.registryKey = 'HandlerChainServicesRegistry';
1614
1455
 
1615
- class ColumnExpression extends BaseExpression {
1616
- constructor(config) {
1617
- super(config);
1618
- this.expressionType = ExpressionType.SchemaColumn;
1619
- this.columnPath = config?.columnPath;
1456
+ /**
1457
+ * @internal
1458
+ */
1459
+ const designTimeViewElementRegistryKey = 'DesignTimeViewElementRegistry';
1460
+ /**
1461
+ * @internal
1462
+ */
1463
+ class DesignTimeViewElementRegistry extends BaseRegistry {
1464
+ static validate(config) {
1465
+ checkTypeNameFormat(config.type, 'DesignTimeViewElementRegistryItemTypeName');
1466
+ checkCrtTypeNamePascalCase(config.type);
1467
+ checkOnlyOneRegistration(config.type, config, this.infos);
1620
1468
  }
1621
- clone() {
1622
- return new ColumnExpression(this);
1469
+ static register(config) {
1470
+ this.infos.set(config.type, config);
1623
1471
  }
1624
- }
1625
-
1626
- class FunctionExpression extends BaseExpression {
1627
- constructor(config) {
1628
- super(config);
1629
- this.expressionType = ExpressionType.Function;
1472
+ static getByOverriddenType(type) {
1473
+ const item = Array.from(this.infos).find(([_, info]) => info.overrideType === type);
1474
+ if (item) {
1475
+ return item[1];
1476
+ }
1477
+ return null;
1630
1478
  }
1631
- }
1632
-
1633
- class ArgumentFunctionExpression extends FunctionExpression {
1634
- constructor(config) {
1635
- super(config);
1636
- this.functionArgument = config?.functionArgument.clone();
1479
+ static get infos() {
1480
+ return this.store.typeInfos;
1637
1481
  }
1638
1482
  }
1483
+ DesignTimeViewElementRegistry.registryKey = designTimeViewElementRegistryKey;
1639
1484
 
1640
- class AggregationFunctionExpression extends ArgumentFunctionExpression {
1641
- constructor(config) {
1642
- super(config);
1643
- this.functionType = FunctionType.Aggregation;
1644
- this.aggregationType = config?.aggregationType;
1645
- this.aggregationEvalType = config?.aggregationEvalType;
1485
+ /**
1486
+ * @internal
1487
+ */
1488
+ class ValidatorMapValue {
1489
+ }
1490
+ /**
1491
+ * @internal
1492
+ */
1493
+ const validatorRegistryKey = 'ValidatorRegistry';
1494
+ /**
1495
+ * @internal
1496
+ */
1497
+ class ValidatorRegistry extends BaseRegistry {
1498
+ static _has(configType, type) {
1499
+ return ValidatorRegistry.items.has(configType) && ValidatorRegistry.items.get(configType)?.typeRef !== type;
1646
1500
  }
1647
- clone() {
1648
- return new AggregationFunctionExpression(this);
1501
+ static validate(config) {
1502
+ checkTypeNameFormat(config.type, 'ValidatorTypeName');
1503
+ if (ValidatorRegistry._has(config.type, config.typeRef)) {
1504
+ throw new Error(`Error when register ${config.type}. Element with this type has already exist`);
1505
+ }
1649
1506
  }
1650
- }
1651
-
1652
- class DatePartFunctionExpression extends ArgumentFunctionExpression {
1653
- constructor(config) {
1654
- super(config);
1655
- this.functionType = FunctionType.DatePart;
1656
- this.datePartType = config?.datePartType;
1507
+ static get items() {
1508
+ return this.store.typeInfos;
1657
1509
  }
1658
- clone() {
1659
- return new DatePartFunctionExpression(this);
1510
+ static register(config) {
1511
+ this.items.set(config.type, config);
1660
1512
  }
1661
1513
  }
1514
+ ValidatorRegistry.registryKey = validatorRegistryKey;
1662
1515
 
1663
- class LengthFunctionExpression extends ArgumentFunctionExpression {
1664
- constructor(config) {
1665
- super(config);
1666
- this.functionType = FunctionType.Length;
1516
+ /**
1517
+ * @internal
1518
+ */
1519
+ class PkgTopology extends BaseRegistry {
1520
+ static get items() {
1521
+ return this.store.typeInfos;
1667
1522
  }
1668
- clone() {
1669
- return new LengthFunctionExpression(this);
1523
+ static get(pkgName) {
1524
+ const order = this.items.get(pkgName);
1525
+ if (order === undefined) {
1526
+ throw new Error(`Package with name ${pkgName} not found in topology`);
1527
+ }
1528
+ return order;
1670
1529
  }
1671
1530
  }
1531
+ PkgTopology.registryKey = 'pkgTopology';
1672
1532
 
1673
- class MacrosFunctionExpression extends FunctionExpression {
1674
- constructor(config) {
1675
- super(config);
1676
- this.functionType = FunctionType.Macros;
1677
- this.macrosType = config?.macrosType;
1678
- }
1679
- clone() {
1680
- return new MacrosFunctionExpression(this);
1533
+ /**
1534
+ * @internal
1535
+ * @dontChange
1536
+ */
1537
+ class RemoteEntriesRegistry extends BaseRegistry {
1538
+ /**
1539
+ * @dontChange
1540
+ */
1541
+ static get items() {
1542
+ return this.store.typeInfos;
1681
1543
  }
1682
1544
  }
1545
+ /**
1546
+ * @dontChange
1547
+ */
1548
+ RemoteEntriesRegistry.registryKey = 'remotes';
1683
1549
 
1684
- class WindowFunctionExpression extends ArgumentFunctionExpression {
1685
- constructor(config) {
1686
- super(config);
1687
- this.functionType = FunctionType.Window;
1688
- }
1689
- clone() {
1690
- return new WindowFunctionExpression(this);
1550
+ /**
1551
+ * @internal
1552
+ */
1553
+ function isComponentPropertyBindable(viewConfigType, componentProperty) {
1554
+ const componentConfig = ViewElementRegistry.viewElements.get(viewConfigType);
1555
+ if (!componentConfig?.inputs) {
1556
+ return false;
1691
1557
  }
1558
+ return !!componentConfig?.inputs[componentProperty]?.propertyBindable;
1692
1559
  }
1693
1560
 
1694
- class ParameterExpression extends BaseExpression {
1695
- constructor(config) {
1696
- super(config);
1697
- this.expressionType = ExpressionType.Parameter;
1698
- const value = config?.value;
1699
- if (value instanceof Date) {
1700
- const cloneDate = new Date();
1701
- cloneDate.setTime(value.getTime());
1702
- this.value = cloneDate;
1703
- }
1704
- else if (!value) {
1705
- this.value = value;
1706
- }
1707
- else {
1708
- this.value = typeof value === 'object' ? { ...value } : value;
1709
- }
1710
- this.dataValueType = config?.dataValueType ?? DataValueType.Text;
1561
+ /**
1562
+ * @internal
1563
+ */
1564
+ var ViewElementGroupType;
1565
+ (function (ViewElementGroupType) {
1566
+ ViewElementGroupType["Charts"] = "Charts";
1567
+ ViewElementGroupType["Components"] = "Components";
1568
+ ViewElementGroupType["LayoutElements"] = "LayoutElements";
1569
+ ViewElementGroupType["Inputs"] = "Inputs";
1570
+ ViewElementGroupType["CustomElements"] = "CustomElements";
1571
+ })(ViewElementGroupType || (ViewElementGroupType = {}));
1572
+
1573
+ /**
1574
+ * @internal
1575
+ */
1576
+ var ViewElementDataGroupType;
1577
+ (function (ViewElementDataGroupType) {
1578
+ ViewElementDataGroupType["Data"] = "Data";
1579
+ })(ViewElementDataGroupType || (ViewElementDataGroupType = {}));
1580
+ /**
1581
+ * @internal
1582
+ */
1583
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1584
+ const DesignerToolGroupType = { ...ViewElementDataGroupType, ...ViewElementGroupType };
1585
+
1586
+ /**
1587
+ * @internal
1588
+ */
1589
+ var DataSourceScope;
1590
+ (function (DataSourceScope) {
1591
+ DataSourceScope["ViewElement"] = "viewElement";
1592
+ DataSourceScope["Page"] = "page";
1593
+ })(DataSourceScope || (DataSourceScope = {}));
1594
+
1595
+ /**
1596
+ * @internal
1597
+ */
1598
+ var ModelInPageAction;
1599
+ (function (ModelInPageAction) {
1600
+ ModelInPageAction["Edit"] = "edit";
1601
+ ModelInPageAction["Add"] = "add";
1602
+ ModelInPageAction["Copy"] = "copy";
1603
+ })(ModelInPageAction || (ModelInPageAction = {}));
1604
+
1605
+ /**
1606
+ * Handler source types in order of call priority.
1607
+ * @internal
1608
+ */
1609
+ var HandlerSourceType;
1610
+ (function (HandlerSourceType) {
1611
+ HandlerSourceType[HandlerSourceType["Schema"] = 0] = "Schema";
1612
+ HandlerSourceType[HandlerSourceType["Remote"] = 1] = "Remote";
1613
+ HandlerSourceType[HandlerSourceType["Host"] = 2] = "Host";
1614
+ })(HandlerSourceType || (HandlerSourceType = {}));
1615
+
1616
+ /**
1617
+ * @internal
1618
+ */
1619
+ var DataSchemaAttributeType;
1620
+ (function (DataSchemaAttributeType) {
1621
+ DataSchemaAttributeType["OwnAttribute"] = "Own";
1622
+ DataSchemaAttributeType["ForwardReferenceAttribute"] = "ForwardReference";
1623
+ DataSchemaAttributeType["BackReferenceAttribute"] = "BackReference";
1624
+ DataSchemaAttributeType["AggregationAttribute"] = "Aggregation";
1625
+ DataSchemaAttributeType["FunctionAttribute"] = "Function";
1626
+ })(DataSchemaAttributeType || (DataSchemaAttributeType = {}));
1627
+ /**
1628
+ * @internal
1629
+ */
1630
+ var DataSchemaAttributeUsageType;
1631
+ (function (DataSchemaAttributeUsageType) {
1632
+ DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["General"] = 0] = "General";
1633
+ DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["Advanced"] = 1] = "Advanced";
1634
+ DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["None"] = 2] = "None";
1635
+ })(DataSchemaAttributeUsageType || (DataSchemaAttributeUsageType = {}));
1636
+
1637
+ /**
1638
+ * @internal
1639
+ */
1640
+ var DefaultValueSource;
1641
+ (function (DefaultValueSource) {
1642
+ DefaultValueSource[DefaultValueSource["None"] = 0] = "None";
1643
+ DefaultValueSource[DefaultValueSource["Const"] = 1] = "Const";
1644
+ DefaultValueSource[DefaultValueSource["Settings"] = 2] = "Settings";
1645
+ DefaultValueSource[DefaultValueSource["SystemValue"] = 3] = "SystemValue";
1646
+ DefaultValueSource[DefaultValueSource["Sequence"] = 4] = "Sequence";
1647
+ })(DefaultValueSource || (DefaultValueSource = {}));
1648
+
1649
+ /**
1650
+ * @internal
1651
+ */
1652
+ class HandlersOrderComparer {
1653
+ constructor(_request) {
1654
+ this._request = _request;
1655
+ const scopesOrderEntries = [...(this._request.scopes ?? [])].reverse().map((scope, index) => [scope, index]);
1656
+ this._scopesOrder = Object.fromEntries(scopesOrderEntries);
1711
1657
  }
1712
- get parameter() {
1713
- return {
1714
- dataValueType: this.dataValueType,
1715
- ...this._getParameterValueMetadata(),
1716
- };
1658
+ _getOrderByScopes(handler) {
1659
+ if (!handler.scopes) {
1660
+ return Number.MAX_VALUE;
1661
+ }
1662
+ const scopesOrder = handler.scopes.filter((s) => s in this._scopesOrder).map((s) => this._scopesOrder[s]);
1663
+ return Math.min(...scopesOrder);
1717
1664
  }
1718
- _convertStringToBlobArray(str) {
1719
- const out = [];
1720
- let position = 0;
1721
- for (let i = 0; i < str.length; i++) {
1722
- const code = str.charCodeAt(i);
1723
- if (code < 128) {
1724
- out[position++] = String.fromCharCode(code);
1725
- }
1726
- else if (code < 2048) {
1727
- /* eslint-disable no-bitwise */
1728
- out[position++] = String.fromCharCode((code >> 6) | 192);
1729
- out[position++] = String.fromCharCode((code & 63) | 128);
1730
- }
1731
- else {
1732
- out[position++] = String.fromCharCode((code >> 12) | 224);
1733
- out[position++] = String.fromCharCode(((code >> 6) & 63) | 128);
1734
- out[position++] = String.fromCharCode((code & 63) | 128);
1735
- /* eslint-enable no-bitwise */
1736
- }
1665
+ _getOrderByPkgTopology(handler) {
1666
+ if (handler.source.type === HandlerSourceType.Host) {
1667
+ return Number.MAX_VALUE;
1737
1668
  }
1738
- return out;
1669
+ return PkgTopology.get(handler.source.packageName);
1739
1670
  }
1740
- _getParameterValueMetadata() {
1741
- if (this.dataValueType === DataValueType.Blob) {
1742
- return {
1743
- arrayValue: !this.value ? [] : this._convertStringToBlobArray(this.value),
1744
- };
1671
+ compare(a, b) {
1672
+ const aScopeOrder = this._getOrderByScopes(a);
1673
+ const bScopeOrder = this._getOrderByScopes(b);
1674
+ let diff = aScopeOrder - bScopeOrder;
1675
+ if (diff) {
1676
+ return diff;
1745
1677
  }
1746
- else {
1747
- return {
1748
- value: this.value,
1749
- };
1678
+ const aPkgTopologyOrder = this._getOrderByPkgTopology(a);
1679
+ const bPkgTopologyOrder = this._getOrderByPkgTopology(b);
1680
+ diff = aPkgTopologyOrder - bPkgTopologyOrder;
1681
+ if (diff) {
1682
+ return diff;
1750
1683
  }
1751
- }
1752
- clone() {
1753
- return new ParameterExpression(this);
1684
+ diff = a.source.type - b.source.type;
1685
+ return diff;
1754
1686
  }
1755
1687
  }
1756
- __decorate([
1757
- Exclude(),
1758
- __metadata("design:type", Object)
1759
- ], ParameterExpression.prototype, "value", void 0);
1760
- __decorate([
1761
- Exclude(),
1762
- __metadata("design:type", Number)
1763
- ], ParameterExpression.prototype, "dataValueType", void 0);
1764
- __decorate([
1765
- Expose(),
1766
- __metadata("design:type", Object),
1767
- __metadata("design:paramtypes", [])
1768
- ], ParameterExpression.prototype, "parameter", null);
1769
1688
 
1770
- class SubQueryExpression extends BaseExpression {
1771
- constructor(config) {
1772
- super(config);
1773
- this.expressionType = ExpressionType.SubQuery;
1774
- this.columnPath = config?.columnPath;
1775
- const subFilter = config?.subFilters;
1776
- this.subFilters = typeof subFilter?.clone === 'function' ? subFilter.clone() : subFilter;
1777
- this.subOrderDirection = config.subOrderDirection;
1778
- this.subOrderColumn = config.subOrderColumn;
1779
- }
1780
- clone() {
1781
- return new SubQueryExpression(this);
1782
- }
1689
+ const moduleMetadataKey = 'module';
1690
+ const viewElementMetadataKey = 'viewElement';
1691
+ const interfaceDesignerItemMetadataKey = 'interfaceDesignerItem';
1692
+ const requestHandlerMetadataKey = 'requestHandler';
1693
+ const designTimeViewElementMetadataKey = 'designTimeViewElement';
1694
+ const validatorMetadataKey = 'validator';
1695
+ const converterMetadataKey = 'converter';
1696
+ /**
1697
+ * @internal
1698
+ */
1699
+ function setModuleMetadata(metadata, type) {
1700
+ Reflect.defineMetadata(moduleMetadataKey, metadata, type);
1783
1701
  }
1784
-
1785
- class AggregationSubQueryExpression extends SubQueryExpression {
1786
- constructor(config) {
1787
- super(config);
1788
- this.aggregationType = config?.aggregationType;
1789
- }
1790
- clone() {
1791
- return new AggregationSubQueryExpression(this);
1702
+ /**
1703
+ * @internal
1704
+ */
1705
+ function getModuleMetadata(type) {
1706
+ const metadata = Reflect.getMetadata(moduleMetadataKey, type);
1707
+ if (!metadata) {
1708
+ throw new Error(`Module metadata was not found on '${type.name}' class`);
1792
1709
  }
1710
+ return metadata;
1793
1711
  }
1794
-
1795
- const EXPRESSION_TYPE_MOCK = -1;
1796
- class ExpressionMock extends BaseExpression {
1797
- constructor(config) {
1798
- super(config || {});
1799
- this.expressionType = EXPRESSION_TYPE_MOCK;
1800
- }
1801
- // eslint-disable-next-line @typescript-eslint/ban-types
1802
- get plainObject() {
1803
- return classToPlain(this, { exposeUnsetFields: false, excludePrefixes: ['_'] });
1804
- }
1805
- clone() {
1806
- return new ExpressionMock(this);
1807
- }
1712
+ /**
1713
+ * @internal
1714
+ */
1715
+ function setViewElementMetadata(metadata, type) {
1716
+ Reflect.defineMetadata(viewElementMetadataKey, metadata, type);
1808
1717
  }
1809
-
1810
- class BaseFilter {
1811
- constructor(filterType) {
1812
- this.isEnabled = true;
1813
- this.trimDateTimeParameterToDate = false;
1814
- this.filterType = filterType;
1718
+ /**
1719
+ * @internal
1720
+ */
1721
+ function getViewElementMetadata(type) {
1722
+ const metadata = Reflect.getMetadata(viewElementMetadataKey, type);
1723
+ if (!metadata) {
1724
+ throw new Error(`View element metadata was not found on '${type.name}' class`);
1815
1725
  }
1726
+ return metadata;
1816
1727
  }
1817
-
1818
- class FilterMock extends BaseFilter {
1819
- constructor(filterType = FilterType.None) {
1820
- super(filterType);
1728
+ /**
1729
+ * @internal
1730
+ */
1731
+ function setValidatorMetadata(metadata, type) {
1732
+ Reflect.defineMetadata(validatorMetadataKey, metadata, type);
1733
+ }
1734
+ /**
1735
+ * @internal
1736
+ */
1737
+ function getValidatorMetadata(type) {
1738
+ const metadata = Reflect.getOwnMetadata(validatorMetadataKey, type);
1739
+ if (!metadata) {
1740
+ throw new Error(`Validator metadata was not found on '${type.name}' class`);
1821
1741
  }
1822
- // eslint-disable-next-line @typescript-eslint/ban-types
1823
- get plainObject() {
1824
- return classToPlain(this, { exposeUnsetFields: false, excludePrefixes: ['_'] });
1742
+ return metadata;
1743
+ }
1744
+ /**
1745
+ * @internal
1746
+ */
1747
+ function setConverterMetadata(metadata, type) {
1748
+ Reflect.defineMetadata(converterMetadataKey, metadata, type);
1749
+ }
1750
+ /**
1751
+ * @internal
1752
+ */
1753
+ function getConverterMetadata(type) {
1754
+ const metadata = Reflect.getOwnMetadata(converterMetadataKey, type);
1755
+ if (!metadata) {
1756
+ throw new Error(`Converter metadata was not found on '${type.name}' class`);
1825
1757
  }
1826
- clone() {
1827
- return new FilterMock(this.filterType);
1758
+ return metadata;
1759
+ }
1760
+ /**
1761
+ * @internal
1762
+ */
1763
+ function setInterfaceDesignerItemMetadata(metadata, type) {
1764
+ Reflect.defineMetadata(interfaceDesignerItemMetadataKey, metadata, type);
1765
+ }
1766
+ /**
1767
+ * @internal
1768
+ */
1769
+ function getInterfaceDesignerItemMetadata(type) {
1770
+ const metadata = Reflect.getOwnMetadata(interfaceDesignerItemMetadataKey, type);
1771
+ if (!metadata) {
1772
+ throw new Error(`Interface designer item metadata was not found on '${type.name}' class`);
1828
1773
  }
1774
+ return metadata;
1829
1775
  }
1830
-
1831
- class SingleFilter extends BaseFilter {
1832
- constructor(filterType, comparisonType, leftExpression) {
1833
- super(filterType);
1834
- this.comparisonType = comparisonType;
1835
- this.leftExpression = leftExpression.clone();
1776
+ /**
1777
+ * @internal
1778
+ */
1779
+ function setDesignTimeViewElementMetadata(metadata, type) {
1780
+ Reflect.defineMetadata(designTimeViewElementMetadataKey, metadata, type);
1781
+ }
1782
+ /**
1783
+ * @internal
1784
+ */
1785
+ function getDesignTimeViewElementMetadata(type) {
1786
+ const metadata = Reflect.getOwnMetadata(designTimeViewElementMetadataKey, type);
1787
+ if (!metadata) {
1788
+ throw new Error(`Design time view element metadata was not found on '${type.name}' class`);
1836
1789
  }
1790
+ return metadata;
1837
1791
  }
1838
-
1839
- class CompareFilter extends SingleFilter {
1840
- constructor(comparisonType, leftExpression, rightExpression) {
1841
- super(FilterType.Compare, comparisonType, leftExpression);
1842
- this.rightExpression = rightExpression.clone();
1792
+ /**
1793
+ * @internal
1794
+ */
1795
+ function hasInterfaceDesignerItemMetadata(type) {
1796
+ return Reflect.hasOwnMetadata(interfaceDesignerItemMetadataKey, type);
1797
+ }
1798
+ /**
1799
+ * @internal
1800
+ */
1801
+ function setRequestHandlerMetadata(metadata, type) {
1802
+ Reflect.defineMetadata(requestHandlerMetadataKey, metadata, type);
1803
+ }
1804
+ /**
1805
+ * @internal
1806
+ */
1807
+ function getRequestHandlerMetadata(type) {
1808
+ const metadata = Reflect.getMetadata(requestHandlerMetadataKey, type);
1809
+ if (!metadata) {
1810
+ throw new Error(`Request handler metadata was not found on '${type.name}' class`);
1843
1811
  }
1844
- clone() {
1845
- return new CompareFilter(this.comparisonType, this.leftExpression, this.rightExpression);
1812
+ return metadata;
1813
+ }
1814
+ /**
1815
+ * @internal
1816
+ */
1817
+ function getHandlerChainServiceMetadata(typeRef) {
1818
+ const requestType = Reflect.getMetadata('requestType', typeRef);
1819
+ if (!requestType) {
1820
+ throw new Error(`requestType was not found on '${typeRef.name}' class`);
1846
1821
  }
1822
+ return { requestType, typeRef };
1823
+ }
1824
+ /**
1825
+ * @internal
1826
+ */
1827
+ function getCrtInputsMetadata(type) {
1828
+ const keys = Reflect.getMetadataKeys(type);
1829
+ const crtInputKeys = keys.filter((x) => x.startsWith(crtInputPrefix));
1830
+ return Object.fromEntries(crtInputKeys.map((key) => {
1831
+ const data = Reflect.getMetadata(key, type);
1832
+ return [key.replace(crtInputPrefix, ''), data];
1833
+ }));
1847
1834
  }
1848
-
1849
1835
  /**
1850
- * Empty Guid constant.
1851
1836
  * @internal
1852
1837
  */
1853
- const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
1838
+ function getCrtOutputsMetadata(type) {
1839
+ const keys = Reflect.getMetadataKeys(type);
1840
+ const crtOutputKeys = keys.filter((x) => x.startsWith(crtOutputPrefix));
1841
+ return Object.fromEntries(crtOutputKeys.map((key) => {
1842
+ const data = Reflect.getMetadata(key, type);
1843
+ return [key.replace(crtOutputPrefix, ''), data];
1844
+ }));
1845
+ }
1854
1846
  /**
1855
- * Regular expression for Guid validation.
1856
1847
  * @internal
1857
1848
  */
1858
- const validator = new RegExp('^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$', 'i');
1849
+ function getCrtValidationInputsMetadata(type) {
1850
+ const keys = Reflect.getMetadataKeys(type);
1851
+ const crtValidationInputKeys = keys.filter((x) => x.startsWith(crtValidationInputPrefix));
1852
+ return Object.fromEntries(crtValidationInputKeys.map((key) => {
1853
+ const data = Reflect.getMetadata(key, type);
1854
+ return [key.replace(crtValidationInputPrefix, ''), data];
1855
+ }));
1856
+ }
1859
1857
  /**
1860
- * Generates guid part.
1861
- * @param length Part length.
1862
1858
  * @internal
1863
1859
  */
1864
- function generateGuidPart(length) {
1865
- let out = '';
1866
- for (let i = 0; i < length; i++) {
1867
- // eslint-disable-next-line no-bitwise
1868
- out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
1869
- }
1870
- return out;
1860
+ function getCrtInjectMetadata(type) {
1861
+ const keys = Reflect.getOwnMetadataKeys(type);
1862
+ const crtInjectKeys = keys.filter((x) => x.startsWith(crtInjectPrefix));
1863
+ return Object.fromEntries(crtInjectKeys.map((key) => {
1864
+ const index = Number(key.replace(crtInjectPrefix, ''));
1865
+ const data = Reflect.getMetadata(key, type);
1866
+ return [index, data];
1867
+ }));
1871
1868
  }
1872
1869
  /**
1873
- * Generates new Guid.
1874
1870
  * @internal
1875
1871
  */
1876
- function generateGuid() {
1877
- return [
1878
- generateGuidPart(2),
1879
- generateGuidPart(1),
1880
- generateGuidPart(1),
1881
- generateGuidPart(1),
1882
- generateGuidPart(3),
1883
- ].join('-');
1872
+ function getParentType(type) {
1873
+ const parentProto = type.prototype ? Object.getPrototypeOf(type.prototype) : null;
1874
+ return parentProto ? parentProto.constructor : null;
1884
1875
  }
1885
1876
  /**
1886
- * Checks if value is Guid.
1887
- * @param value Value for check.
1888
1877
  * @internal
1889
1878
  */
1890
- function isGuid(value) {
1891
- return value && validator.test(value);
1879
+ function getTypeDependencies(type) {
1880
+ const paramTypes = Reflect.getOwnMetadata('design:paramtypes', type);
1881
+ if (!paramTypes) {
1882
+ if (type.length > 0) {
1883
+ throw new Error(`Dependency Injection error. Cannot read dependencies of class '${type.name}'. ` +
1884
+ `Please make sure class '${type.name}' has decorator and ` +
1885
+ "'emitDecoratorMetadata' option is enabled in your 'tsconfig.json' file.");
1886
+ }
1887
+ const parentType = getParentType(type);
1888
+ return parentType && parentType !== Object ? getTypeDependencies(parentType) : [];
1889
+ }
1890
+ const crtInjectMetadata = getCrtInjectMetadata(type);
1891
+ Object.entries(crtInjectMetadata).forEach(([index, token]) => (paramTypes[index] = token));
1892
+ return paramTypes;
1892
1893
  }
1894
+
1893
1895
  /**
1894
- * Checks if Guid is empty value or equal to EMPTY_GUID.
1895
- * @param guid Guid for check.
1896
1896
  * @internal
1897
1897
  */
1898
- function isEmptyGuid(guid) {
1899
- return !guid || guid === EMPTY_GUID;
1898
+ function instantiate(type, resolveDependency) {
1899
+ const deps = getTypeDependencies(type);
1900
+ if (deps.length > 0) {
1901
+ if (!resolveDependency) {
1902
+ throw new Error(`Cannot resolve dependencies for ${type.name}. ` +
1903
+ "Please provide 'resolveDependency' bootstrap option");
1904
+ }
1905
+ const depInstances = deps.map(resolveDependency);
1906
+ return new type(...depInstances);
1907
+ }
1908
+ return new type();
1900
1909
  }
1901
1910
 
1902
- class ExistsFilter extends SingleFilter {
1903
- constructor(leftExpression, subFilters, comparisonType = ComparisonType.Exists, isAggregative = true) {
1904
- super(FilterType.Exists, comparisonType, leftExpression);
1905
- this.subFilters = subFilters?.clone();
1906
- this.isAggregative = isAggregative;
1911
+ /**
1912
+ * @public
1913
+ */
1914
+ class CrtInputRegistrationConfig {
1915
+ }
1916
+
1917
+ /**
1918
+ * @public
1919
+ * @class BaseRequest
1920
+ * @describe Base definition of request.
1921
+ * @template TEvent
1922
+ */
1923
+ class BaseRequest {
1924
+ }
1925
+
1926
+ /**
1927
+ * @public
1928
+ * @class DataRequest
1929
+ * @description Definition of data source request.
1930
+ * @extends {BaseRequest} {@link BaseRequest}
1931
+ * @property {string} dataSourceName - name of assigned data source.
1932
+ */
1933
+ class DataRequest extends BaseRequest {
1934
+ }
1935
+
1936
+ /**
1937
+ * @public
1938
+ * @description Request payload
1939
+ * @property {string} request - request name.
1940
+ * @property {unknown} params - request parameters.
1941
+ */
1942
+
1943
+ /**
1944
+ * @public
1945
+ * @description Abstract Base Validator class for designing custom validators.
1946
+ * @example
1947
+ * @CrtValidator({
1948
+ * type: 'crt.Required',
1949
+ * })
1950
+ * export class RequiredValidator extends BaseValidator {
1951
+ * protected override async = false;
1952
+ * public validate(controlState: CrtControlState, params?: ValidatorParametersValues): CrtValidationErrors | null {
1953
+ * Implementation here...
1954
+ * }
1955
+ * }
1956
+ */
1957
+ class BaseValidator {
1958
+ /**
1959
+ * @description getter for async/sync indicator
1960
+ */
1961
+ get isAsync() {
1962
+ return this.async;
1907
1963
  }
1908
- clone() {
1909
- return new ExistsFilter(this.leftExpression, this.subFilters, this.comparisonType, this.isAggregative);
1964
+ /**
1965
+ * @description Function used for validation
1966
+ */
1967
+ get validateFn() {
1968
+ return this.validate.bind(this);
1969
+ }
1970
+ /**
1971
+ * @internal
1972
+ */
1973
+ static [Symbol.hasInstance](instance) {
1974
+ return instance?.constructor?.['_instanceOfKey'] === BaseValidator._instanceOfKey;
1910
1975
  }
1911
1976
  }
1977
+ /**
1978
+ * @internal
1979
+ * @dontChange
1980
+ */
1981
+ BaseValidator._instanceOfKey = 'devkit_BaseValidator';
1912
1982
 
1913
- class InFilter extends SingleFilter {
1914
- constructor(comparisonType, leftExpression, rightExpressions) {
1915
- super(FilterType.In, comparisonType, leftExpression);
1916
- this.rightExpressions = rightExpressions.map((expression) => expression.clone());
1983
+ /**
1984
+ * @public
1985
+ */
1986
+ class LocalizableValue {
1987
+ constructor(key) {
1988
+ this.key = key;
1917
1989
  }
1918
- clone() {
1919
- return new InFilter(this.comparisonType, this.leftExpression, this.rightExpressions);
1990
+ /**
1991
+ * @internal
1992
+ */
1993
+ static [Symbol.hasInstance](instance) {
1994
+ return instance?.constructor?.['_instanceOfKey'] === LocalizableValue._instanceOfKey;
1920
1995
  }
1921
1996
  }
1997
+ /**
1998
+ * @internal
1999
+ * @dontChange
2000
+ */
2001
+ LocalizableValue._instanceOfKey = 'devkit_LocalizableValue';
1922
2002
 
1923
- class IsNullFilter extends SingleFilter {
1924
- constructor(comparisonType, leftExpression) {
1925
- super(FilterType.IsNull, comparisonType, leftExpression);
1926
- }
1927
- get isNull() {
1928
- return this.comparisonType === ComparisonType.Is_null;
2003
+ /**
2004
+ * @internal
2005
+ */
2006
+ function applyLocalizeMetadataFn(obj, localizeMetadata) {
2007
+ const localizableEntries = objectDeepKeys(obj)
2008
+ .map((path) => ({ path, value: get(obj, path) }))
2009
+ .filter(({ value }) => value instanceof LocalizableValue);
2010
+ if (localizableEntries.length === 0) {
2011
+ return obj;
1929
2012
  }
1930
- clone() {
1931
- return new IsNullFilter(this.comparisonType, this.leftExpression);
2013
+ const localized = cloneDeep(obj);
2014
+ if (!localizeMetadata) {
2015
+ console.error("Unable to localize metadata. 'localizeMetadata' bootstrap option was not provided.");
1932
2016
  }
2017
+ localizableEntries.forEach(({ path, value }) => {
2018
+ const localizedValue = localizeMetadata?.(value.key) ?? value.key;
2019
+ set(localized, path, localizedValue);
2020
+ });
2021
+ return localized;
1933
2022
  }
1934
- __decorate([
1935
- Expose(),
1936
- __metadata("design:type", Boolean),
1937
- __metadata("design:paramtypes", [])
1938
- ], IsNullFilter.prototype, "isNull", null);
1939
2023
 
1940
- class FilterGroup extends BaseFilter {
1941
- constructor(logicalOperation = LogicalOperatorType.And) {
1942
- super(FilterType.FilterGroup);
1943
- this.filters = new Map();
1944
- this.logicalOperation = logicalOperation;
2024
+ /**
2025
+ * @internal
2026
+ */
2027
+ class InternalHandlerChain {
2028
+ constructor() {
2029
+ this._handlers = [];
2030
+ this._handlersCache = new Map();
2031
+ this._handlersScopesByContextId = new Map();
2032
+ this.handlerChain$ = {
2033
+ process: async (request) => {
2034
+ const handler = this._getHandler(request);
2035
+ return handler?.handle(request);
2036
+ },
2037
+ register: (info) => {
2038
+ this._handlersCache.delete(info.requestType);
2039
+ this._handlers.push(info);
2040
+ return () => {
2041
+ const index = this._handlers.indexOf(info);
2042
+ if (index > -1) {
2043
+ this._handlers.splice(index, 1);
2044
+ this._handlersCache.delete(info.requestType);
2045
+ }
2046
+ else {
2047
+ console.warn(`${info?.requestType} not found to unsubscribe`);
2048
+ }
2049
+ };
2050
+ },
2051
+ };
1945
2052
  }
1946
- get items() {
1947
- return classToPlain(this.filters, {
1948
- exposeUnsetFields: false,
1949
- excludePrefixes: ['_'],
1950
- });
2053
+ clearContextedHandlersCache(contextId) {
2054
+ const configs = this._handlersScopesByContextId.get(contextId) ?? [];
2055
+ return configs.every(({ requestType, scope }) => this._handlersCache.get(requestType)?.delete(scope));
1951
2056
  }
1952
- /**
1953
- * Returns filter item by index.
1954
- * @param index Item index.
1955
- * @returns Filter.
1956
- */
1957
- getItemByIndex(index) {
1958
- return this.items[Object.keys(this.items)[index]];
2057
+ _getHandler(request) {
2058
+ return this._hasCacheHandler(request) ? this._getCacheHandler(request) : this._buildHandlersChain(request);
1959
2059
  }
1960
- addSchemaColumnFilterWithParameter(comparisonType, columnPath, parameterValue) {
1961
- const leftExpression = new ColumnExpression({ columnPath });
1962
- const rightExpression = new ParameterExpression({ value: parameterValue });
1963
- const filter = new CompareFilter(comparisonType, leftExpression, rightExpression);
1964
- this.add(filter);
2060
+ _getCacheHandler(request) {
2061
+ const map = this._handlersCache.get(request.type);
2062
+ const key = this._getCacheScopesKey(request);
2063
+ return map.get(key);
1965
2064
  }
1966
- addSchemaColumnInFilterWithParameters(comparisonType, columnPath, parameterValues) {
1967
- const leftExpression = new ColumnExpression({ columnPath });
1968
- const expressions = parameterValues.map((singleParameterValue) => new ParameterExpression({
1969
- value: singleParameterValue,
1970
- }));
1971
- const filter = new InFilter(comparisonType, leftExpression, expressions);
1972
- this.add(filter);
2065
+ _hasCacheHandler(request) {
2066
+ const map = this._handlersCache.get(request.type);
2067
+ const key = this._getCacheScopesKey(request);
2068
+ return map && map.has(key);
1973
2069
  }
1974
- addSchemaColumnIsNullFilter(columnPath) {
1975
- const leftExpression = new ColumnExpression({ columnPath });
1976
- const filter = new IsNullFilter(ComparisonType.Is_null, leftExpression);
1977
- this.add(filter);
2070
+ _getCacheScopesKey(request) {
2071
+ const injectionContextKey = this._getInjectionContext(request?.$context)?.id ?? '';
2072
+ return (request.scopes || ['']).join('_').concat(injectionContextKey);
1978
2073
  }
1979
- addSchemaColumnIsNotNullFilter(columnPath) {
1980
- const leftExpression = new ColumnExpression({ columnPath });
1981
- const filter = new IsNullFilter(ComparisonType.Is_not_null, leftExpression);
1982
- this.add(filter);
2074
+ _getInjectionContext(viewModel) {
2075
+ return viewModel?.['_injectionContext'] || (viewModel?.parent && this._getInjectionContext(viewModel.parent));
1983
2076
  }
1984
- addExistsFilter(columnPath, subFilters) {
1985
- const leftExpression = new ColumnExpression({ columnPath });
1986
- const filter = new ExistsFilter(leftExpression, subFilters);
1987
- this.add(filter);
2077
+ _setContextedScopes(request, scope) {
2078
+ const injectionContext = this._getInjectionContext(request?.$context)?.id;
2079
+ const configs = this._handlersScopesByContextId.has(injectionContext)
2080
+ ? this._handlersScopesByContextId.get(injectionContext)
2081
+ : [];
2082
+ configs.push({ requestType: request.type, scope });
2083
+ this._handlersScopesByContextId.set(injectionContext, configs);
1988
2084
  }
1989
- addNotExistsFilter(columnPath, subFilters) {
1990
- const leftExpression = new ColumnExpression({ columnPath });
1991
- const filter = new ExistsFilter(leftExpression, subFilters, ComparisonType.Not_exists);
1992
- this.add(filter);
2085
+ _setCacheHandler(request, handler) {
2086
+ const map = this._handlersCache.has(request.type)
2087
+ ? this._handlersCache.get(request.type)
2088
+ : new Map();
2089
+ const key = this._getCacheScopesKey(request);
2090
+ map.set(key, handler);
2091
+ if (this._getInjectionContext(request?.$context)?.id) {
2092
+ this._setContextedScopes(request, key);
2093
+ }
2094
+ this._handlersCache.set(request.type, map);
1993
2095
  }
1994
- add(filter, filterKey) {
1995
- ValidationUtilities.checkArgumentEmpty('filter', filter);
1996
- const key = filterKey || generateGuid();
1997
- this.filters.set(key, filter);
2096
+ _isRequestHandler(handler) {
2097
+ return (typeof handler.handle === 'function' &&
2098
+ typeof handler.setNext === 'function');
1998
2099
  }
1999
- clone() {
2000
- const filterGroup = new FilterGroup(this.logicalOperation);
2001
- this.filters.forEach((filter, filterKey) => {
2002
- filterGroup.filters.set(filterKey, filter.clone());
2100
+ _checkHandlerInstanceOf(handler) {
2101
+ if (!this._isRequestHandler(handler)) {
2102
+ throw new Error('Handler should implement "BaseRequestHandler"');
2103
+ }
2104
+ }
2105
+ _buildHandlersChain(request) {
2106
+ const handlers = this._handlers.filter((h) => {
2107
+ if (h.requestType !== request.type) {
2108
+ return false;
2109
+ }
2110
+ if (!h.scopes?.length) {
2111
+ return true;
2112
+ }
2113
+ return h.scopes.some((s) => request.scopes?.includes(s));
2003
2114
  });
2004
- return filterGroup;
2115
+ const comparer = new HandlersOrderComparer(request);
2116
+ handlers.sort((a, b) => comparer.compare(a, b));
2117
+ const handlerInstances = handlers.map((handlerConfig) => {
2118
+ const injectionContext = this._getInjectionContext(request?.$context);
2119
+ return handlerConfig.createHandler(injectionContext);
2120
+ });
2121
+ handlerInstances.forEach((handler) => this._checkHandlerInstanceOf(handler));
2122
+ this._joinHandlersInChain(handlerInstances);
2123
+ const result = handlerInstances[0];
2124
+ this._setCacheHandler(request, result);
2125
+ return result;
2126
+ }
2127
+ _joinHandlersInChain(handlers) {
2128
+ for (let index = 0; index < handlers.length - 1; index++) {
2129
+ try {
2130
+ handlers[index].setNext(handlers[index + 1]);
2131
+ }
2132
+ catch (error) {
2133
+ if (error instanceof NextHandlerAlreadySpecifiedException) {
2134
+ throw new Error('Handler factory should return new instance of ' +
2135
+ 'BaseRequestHandler class or its subclass ' +
2136
+ '(next handler should not be specified)');
2137
+ }
2138
+ throw error;
2139
+ }
2140
+ }
2005
2141
  }
2006
2142
  }
2007
- __decorate([
2008
- Exclude(),
2009
- __metadata("design:type", Object)
2010
- ], FilterGroup.prototype, "filters", void 0);
2011
- __decorate([
2012
- Expose(),
2013
- __metadata("design:type", Object),
2014
- __metadata("design:paramtypes", [])
2015
- ], FilterGroup.prototype, "items", null);
2016
2143
 
2017
- class BetweenFilter extends SingleFilter {
2018
- constructor(leftExpression, rightLessExpression, rightGreaterExpression) {
2019
- super(FilterType.Between, ComparisonType.Between, leftExpression);
2020
- this.rightLessExpression = rightLessExpression.clone();
2021
- this.rightGreaterExpression = rightGreaterExpression.clone();
2144
+ const global = window;
2145
+ /**
2146
+ * @public
2147
+ * @class HandlerChainService
2148
+ * @classdesc Service to design handlers in chain.
2149
+ */
2150
+ class HandlerChainService {
2151
+ constructor() {
2152
+ if (!this._chain) {
2153
+ this._createGlobalHandlerChain();
2154
+ }
2022
2155
  }
2023
- clone() {
2024
- return new BetweenFilter(this.leftExpression, this.rightLessExpression, this.rightGreaterExpression);
2156
+ get _chain() {
2157
+ return global.handlerChain;
2025
2158
  }
2026
- }
2027
-
2028
- class BaseQueryColumn {
2029
- constructor(expression) {
2030
- this.orderDirection = OrderDirection.None;
2031
- this.orderPosition = -1;
2032
- this.isVisible = true;
2033
- this.expression = expression;
2159
+ set _chain(value) {
2160
+ global.handlerChain = value;
2161
+ }
2162
+ static get instance() {
2163
+ return HandlerChainService._instance || (HandlerChainService._instance = new HandlerChainService());
2164
+ }
2165
+ _createGlobalHandlerChain() {
2166
+ this._chain = new InternalHandlerChain();
2034
2167
  }
2035
2168
  /**
2036
- * Adds ordering options.
2037
- * @param orderDirection Direction.
2038
- * @param orderPosition Position.
2039
- * @returns Self.
2169
+ * @internal
2040
2170
  */
2041
- withOrdering(orderDirection, orderPosition) {
2042
- ValidationUtilities.checkArgumentEmpty('orderDirection', orderDirection);
2043
- ValidationUtilities.checkArgumentEmpty('orderPosition', orderPosition);
2044
- ValidationUtilities.checkArgumentOutOfRange('orderPosition', orderPosition, { begin: -1 });
2045
- this.orderDirection = orderDirection;
2046
- this.orderPosition = orderPosition;
2047
- return this;
2171
+ clearContextedHandlersCache(contextId) {
2172
+ return this._chain.clearContextedHandlersCache(contextId);
2048
2173
  }
2049
2174
  /**
2050
- * Adds options.
2051
- * @param options Options.
2052
- * @returns Self.
2175
+ * @internal
2053
2176
  */
2054
- withOptions(options) {
2055
- ValidationUtilities.checkArgumentEmpty('options', options);
2056
- this.isVisible = options.isVisible ?? true;
2057
- return this;
2177
+ register(handlerConfig) {
2178
+ return this._chain.handlerChain$.register(handlerConfig);
2058
2179
  }
2059
2180
  /**
2060
- * Adds caption.
2061
- * @param caption Caption.
2062
- * @returns Self.
2181
+ * @description Method to process passed request
2182
+ * @param request - {@link BaseRequest}
2183
+ * @return `Promise<unknown>`
2063
2184
  */
2064
- withCaption(caption) {
2065
- ValidationUtilities.checkArgumentEmpty('caption', caption);
2066
- this.caption = caption;
2067
- return this;
2068
- }
2069
- }
2070
-
2071
- class ArithmeticQueryColumn extends BaseQueryColumn {
2072
- // region Constructors: Public
2073
- constructor(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand) {
2074
- super(new ArithmeticExpression({ arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand }));
2075
- }
2076
- }
2077
-
2078
- class EntityQueryColumn extends BaseQueryColumn {
2079
- // region Constructors: Public
2080
- constructor(columnPath) {
2081
- super(new ColumnExpression({ columnPath }));
2082
- }
2083
- }
2084
-
2085
- class ParameterQueryColumn extends BaseQueryColumn {
2086
- // region Constructors: Public
2087
- constructor(value, dataValueType) {
2088
- super(new ParameterExpression({ value, dataValueType }));
2089
- }
2090
- }
2091
-
2092
- class AggregationSubQueryColumn extends BaseQueryColumn {
2093
- // region Constructors: Public
2094
- constructor(columnPath, aggregationType, subFilters, subOrderDirection, subOrderColumn) {
2095
- super(new AggregationSubQueryExpression({
2096
- aggregationType,
2097
- columnPath,
2098
- subFilters,
2099
- subOrderDirection,
2100
- subOrderColumn,
2101
- }));
2102
- }
2103
- }
2104
-
2105
- class SubQueryColumn extends BaseQueryColumn {
2106
- // region Constructors: Public
2107
- constructor(columnPath, subFilters) {
2108
- super(new SubQueryExpression({ columnPath, subFilters }));
2109
- }
2110
- }
2111
-
2112
- class AggregationFunctionColumn extends BaseQueryColumn {
2113
- // region Constructors: Public
2114
- constructor(aggregationType, aggregationEvalType, functionArgument) {
2115
- super(new AggregationFunctionExpression({
2116
- aggregationType,
2117
- aggregationEvalType,
2118
- functionArgument,
2119
- }));
2120
- }
2121
- }
2122
-
2123
- class DatePartFunctionColumn extends BaseQueryColumn {
2124
- // region Constructors: Public
2125
- constructor(datePartType, functionArgument) {
2126
- super(new DatePartFunctionExpression({
2127
- datePartType,
2128
- functionArgument,
2129
- }));
2130
- }
2131
- // endregion
2132
- // region Properties: Public
2133
- get datePartType() {
2134
- return this.expression?.datePartType;
2185
+ process(request) {
2186
+ return this._chain.handlerChain$.process(request);
2135
2187
  }
2136
2188
  }
2137
2189
 
2138
- class LengthFunctionColumn extends BaseQueryColumn {
2139
- // region Constructors: Public
2140
- constructor(functionArgument) {
2141
- super(new LengthFunctionExpression({ functionArgument }));
2142
- }
2190
+ /**
2191
+ * @internal
2192
+ */
2193
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2194
+ function ImplementUsingHandlerChain(config) {
2195
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2196
+ return function (target, method, descriptor) {
2197
+ const methodImplementation = function (...args) {
2198
+ return HandlerChainService.instance.process({
2199
+ type: config?.requestType ? config.requestType : this.requestType,
2200
+ method: config?.methodName ? config.methodName : method,
2201
+ args,
2202
+ });
2203
+ };
2204
+ if (descriptor) {
2205
+ descriptor.value = methodImplementation;
2206
+ }
2207
+ else {
2208
+ target[method] = methodImplementation;
2209
+ }
2210
+ };
2143
2211
  }
2144
2212
 
2145
- class MacrosFunctionColumn extends BaseQueryColumn {
2146
- // region Constructors: Public
2147
- constructor(macrosType) {
2148
- super(new MacrosFunctionExpression({ macrosType }));
2149
- }
2213
+ /**
2214
+ * @internal
2215
+ */
2216
+ function CrtDesignTimeViewElement(config) {
2217
+ return function (type) {
2218
+ const registrationConfig = {
2219
+ ...config,
2220
+ typeRef: type,
2221
+ };
2222
+ setDesignTimeViewElementMetadata(registrationConfig, type);
2223
+ };
2150
2224
  }
2151
2225
 
2152
- class WindowFunctionColumn extends BaseQueryColumn {
2153
- // region Constructors: Public
2154
- constructor(functionArgument) {
2155
- super(new WindowFunctionExpression({ functionArgument }));
2156
- }
2226
+ /**
2227
+ * @internal
2228
+ */
2229
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2230
+ function CrtRequest(config) {
2231
+ return function (type) {
2232
+ checkTypeNameFormat(config.type, 'RequestTypeName');
2233
+ checkCrtTypeNamePascalCase(config.type);
2234
+ RequestRegistryService.register(config, type);
2235
+ };
2157
2236
  }
2158
2237
 
2159
2238
  /**
@@ -2233,11 +2312,12 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2233
2312
  * Rows count to skip.
2234
2313
  */
2235
2314
  this.rowsOffset = -1;
2315
+ this.useLocalization = true;
2236
2316
  this._getIsPageable = () => this.rowCount > 0 && this.rowsOffset > -1;
2237
2317
  }
2238
2318
  // endregion
2239
2319
  // region Methods: Private
2240
- internalAddColumn(key, column) {
2320
+ _internalAddColumn(key, column) {
2241
2321
  if (!this._columns.has(key)) {
2242
2322
  this._columns.set(key, column);
2243
2323
  }
@@ -2276,13 +2356,12 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2276
2356
  rowCount: this.rowCount,
2277
2357
  rowsOffset: this.rowsOffset,
2278
2358
  isPageable: this._getIsPageable(),
2279
- // TODO: CRM-61150: https://tscore-task/browse/CRM-61150
2280
2359
  conditionalValues: this.conditionalValues ? this.conditionalValues : null,
2281
2360
  isHierarchical: false,
2282
2361
  hierarchicalMaxDepth: 0,
2283
2362
  hierarchicalColumnName: null,
2284
2363
  hierarchicalColumnValue: null,
2285
- useLocalization: true,
2364
+ useLocalization: this.useLocalization,
2286
2365
  useRecordDeactivation: false,
2287
2366
  };
2288
2367
  }
@@ -2293,7 +2372,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2293
2372
  * @returns [BaseQueryColumn] Column instance.
2294
2373
  */
2295
2374
  addColumn(column, columnAlias) {
2296
- this.internalAddColumn(columnAlias, column);
2375
+ this._internalAddColumn(columnAlias, column);
2297
2376
  return column;
2298
2377
  }
2299
2378
  /**
@@ -2305,7 +2384,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2305
2384
  addSchemaColumn(columnPath, columnAlias) {
2306
2385
  ValidationUtilities.checkArgumentEmpty('columnPath', columnPath);
2307
2386
  const column = new EntityQueryColumn(columnPath);
2308
- this.internalAddColumn(columnAlias || columnPath, column);
2387
+ this._internalAddColumn(columnAlias || columnPath, column);
2309
2388
  return column;
2310
2389
  }
2311
2390
  /**
@@ -2318,7 +2397,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2318
2397
  */
2319
2398
  addAggregationSubQueryColumn(columnPath, aggregationType, aggregationConfig, columnAlias) {
2320
2399
  const column = new AggregationSubQueryColumn(columnPath, aggregationType, aggregationConfig.filter, aggregationConfig.sortByDirection, aggregationConfig.sortByColumn);
2321
- this.internalAddColumn(columnAlias || columnPath, column);
2400
+ this._internalAddColumn(columnAlias || columnPath, column);
2322
2401
  return column;
2323
2402
  }
2324
2403
  /**
@@ -2330,7 +2409,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2330
2409
  */
2331
2410
  addParameterColumn(value, dataValueType, columnAlias) {
2332
2411
  const column = new ParameterQueryColumn(value, dataValueType);
2333
- this.internalAddColumn(columnAlias, column);
2412
+ this._internalAddColumn(columnAlias, column);
2334
2413
  return column;
2335
2414
  }
2336
2415
  /**
@@ -2343,7 +2422,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2343
2422
  */
2344
2423
  addArithmeticColumn(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand, columnAlias) {
2345
2424
  const column = new ArithmeticQueryColumn(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand);
2346
- this.internalAddColumn(columnAlias, column);
2425
+ this._internalAddColumn(columnAlias, column);
2347
2426
  return column;
2348
2427
  }
2349
2428
  /**
@@ -2354,7 +2433,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2354
2433
  */
2355
2434
  addMacrosFunctionColumn(queryMacrosType, columnAlias) {
2356
2435
  const column = new MacrosFunctionColumn(queryMacrosType);
2357
- this.internalAddColumn(columnAlias, column);
2436
+ this._internalAddColumn(columnAlias, column);
2358
2437
  return column;
2359
2438
  }
2360
2439
  /**
@@ -2367,7 +2446,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2367
2446
  addDatePartFunctionColumn(columnPath, datePartType, columnAlias) {
2368
2447
  const functionArgument = new ColumnExpression({ columnPath });
2369
2448
  const column = new DatePartFunctionColumn(datePartType, functionArgument);
2370
- this.internalAddColumn(columnAlias, column);
2449
+ this._internalAddColumn(columnAlias, column);
2371
2450
  return column;
2372
2451
  }
2373
2452
  /**
@@ -2381,7 +2460,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2381
2460
  addAggregationFunctionColumn(columnPath, aggregationType, columnAlias, aggregationEvalType = AggregationEvalType.None) {
2382
2461
  const functionArgument = new ColumnExpression({ columnPath });
2383
2462
  const column = new AggregationFunctionColumn(aggregationType, aggregationEvalType, functionArgument);
2384
- this.internalAddColumn(columnAlias, column);
2463
+ this._internalAddColumn(columnAlias, column);
2385
2464
  return column;
2386
2465
  }
2387
2466
  /**
@@ -2393,7 +2472,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2393
2472
  addLengthFunctionColumn(columnPath, columnAlias) {
2394
2473
  const functionArgument = new ColumnExpression({ columnPath });
2395
2474
  const column = new LengthFunctionColumn(functionArgument);
2396
- this.internalAddColumn(columnAlias, column);
2475
+ this._internalAddColumn(columnAlias, column);
2397
2476
  return column;
2398
2477
  }
2399
2478
  /**
@@ -2411,7 +2490,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2411
2490
  functionArgument: new ColumnExpression({ columnPath }),
2412
2491
  });
2413
2492
  const column = new WindowFunctionColumn(functionArgument);
2414
- this.internalAddColumn(columnAlias, column);
2493
+ this._internalAddColumn(columnAlias, column);
2415
2494
  return column;
2416
2495
  }
2417
2496
  }
@@ -2419,70 +2498,304 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2419
2498
  /**
2420
2499
  * @internal
2421
2500
  */
2422
- class InsertQuery extends BaseQuery {
2423
- // endregion
2424
- // region Constructors: Public
2425
- constructor(rootSchemaName) {
2426
- super(QueryOperationType.Insert, rootSchemaName);
2427
- // region Fields: Private
2428
- this._columnValues = new Map();
2501
+ class InsertQuery extends BaseQuery {
2502
+ // endregion
2503
+ // region Constructors: Public
2504
+ constructor(rootSchemaName) {
2505
+ super(QueryOperationType.Insert, rootSchemaName);
2506
+ // region Fields: Private
2507
+ this._columnValues = new Map();
2508
+ }
2509
+ // endregion
2510
+ // region Properties: Public
2511
+ get columnValues() {
2512
+ return {
2513
+ items: classToPlain(this._columnValues),
2514
+ };
2515
+ }
2516
+ // endregion
2517
+ // region Methods: Public
2518
+ addColumn(columnName, columnValue, dataValueType) {
2519
+ ValidationUtilities.checkArgumentEmpty('columnName', columnName);
2520
+ this._columnValues.set(columnName, new ParameterExpression({ value: columnValue, dataValueType }));
2521
+ }
2522
+ }
2523
+ __decorate([
2524
+ Expose(),
2525
+ __metadata("design:type", Object),
2526
+ __metadata("design:paramtypes", [])
2527
+ ], InsertQuery.prototype, "columnValues", null);
2528
+
2529
+ /**
2530
+ * @internal
2531
+ */
2532
+ class UpdateQuery extends BaseFilterableQuery {
2533
+ // endregion
2534
+ // region Constructors: Public
2535
+ constructor(rootSchemaName) {
2536
+ super(QueryOperationType.Update, rootSchemaName);
2537
+ // region Fields: Private
2538
+ this._columnValues = new Map();
2539
+ // endregion
2540
+ // region Fields: Public
2541
+ /**
2542
+ * Flag that indicates whether to force save data.
2543
+ */
2544
+ this.isForceUpdate = false;
2545
+ }
2546
+ // endregion
2547
+ // region Properties: Public
2548
+ get columnValues() {
2549
+ return {
2550
+ items: classToPlain(this._columnValues),
2551
+ };
2552
+ }
2553
+ // endregion
2554
+ // region Methods: Public
2555
+ addColumn(columnName, columnValue, dataValueType) {
2556
+ ValidationUtilities.checkArgumentEmpty('columnName', columnName);
2557
+ this._columnValues.set(columnName, new ParameterExpression({ value: columnValue, dataValueType }));
2558
+ }
2559
+ }
2560
+ __decorate([
2561
+ Expose(),
2562
+ __metadata("design:type", Object),
2563
+ __metadata("design:paramtypes", [])
2564
+ ], UpdateQuery.prototype, "columnValues", null);
2565
+
2566
+ /**
2567
+ * @internal
2568
+ */
2569
+ class SelectLocalizationQuery extends EntitySchemaQuery {
2570
+ }
2571
+
2572
+ /**
2573
+ * @internal
2574
+ */
2575
+ class InterfaceDesignerItemRegistrationConfig {
2576
+ }
2577
+
2578
+ /**
2579
+ * @internal
2580
+ * @class MethodInvokeRequest
2581
+ * @description Definition of invoke method request.
2582
+ * @extends {BaseRequest} {@link BaseRequest}
2583
+ * @property {string} method - method name.
2584
+ * @property {unknown[]} args - arguments passing to the method.
2585
+ */
2586
+ class MethodInvokeRequest extends BaseRequest {
2587
+ }
2588
+
2589
+ /**
2590
+ * @internal
2591
+ */
2592
+ var RemoteEntryType;
2593
+ (function (RemoteEntryType) {
2594
+ RemoteEntryType["Script"] = "script";
2595
+ RemoteEntryType["Module"] = "module";
2596
+ })(RemoteEntryType || (RemoteEntryType = {}));
2597
+
2598
+ /**
2599
+ * @public
2600
+ * @description Creatio platform interacts with input's of user-defined component through CrtInput decorator.
2601
+ * @param config {@link CrtInputRegistrationConfig}
2602
+ *
2603
+ * @example
2604
+ * export class AppComponent {
2605
+ * @CrtInput()
2606
+ * public value!: string;
2607
+ * }
2608
+ */
2609
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2610
+ function CrtInput(config) {
2611
+ return function (target, propertyKey) {
2612
+ if (!config) {
2613
+ config = {
2614
+ propertyBindable: false,
2615
+ };
2616
+ }
2617
+ Reflect.defineMetadata(crtInputPrefix + propertyKey.toString(), config, target.constructor);
2618
+ };
2619
+ }
2620
+
2621
+ /**
2622
+ * @public
2623
+ * @description User-defined components could notify Creatio platform about changes through CrtOutput decorator.
2624
+ * @example
2625
+ * export class AppComponent {
2626
+ * @Input()
2627
+ * @CrtOutput()
2628
+ * public valueChange;
2629
+ * }
2630
+ */
2631
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2632
+ function CrtOutput() {
2633
+ return function (target, propertyKey) {
2634
+ Reflect.defineMetadata(crtOutputPrefix + propertyKey.toString(), {}, target.constructor);
2635
+ };
2636
+ }
2637
+
2638
+ /**
2639
+ * @public
2640
+ * @description User-defined components receive validationInfo changes through CrtValidationInput decorator.
2641
+ * Make sure you have defined input for every validationInfo input.
2642
+ * To properly declare validationInfo field:
2643
+ * 1. Declare input field inside inputs section. For example `value`
2644
+ * 2. In validationInputs section declare same field which ends with ValidationInfo.
2645
+ * For previous example `valueValidationInfo`
2646
+ *
2647
+ * @example
2648
+ * export class AppComponent {
2649
+ * @CrtInput()
2650
+ public value;
2651
+ *
2652
+ * @CrtValidationInput()
2653
+ * public valueValidationInfo;
2654
+ * }
2655
+ */
2656
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2657
+ function CrtValidationInput() {
2658
+ return function (target, propertyKey) {
2659
+ Reflect.defineMetadata(crtValidationInputPrefix + propertyKey.toString(), {}, target.constructor);
2660
+ };
2661
+ }
2662
+
2663
+ /**
2664
+ * @internal
2665
+ */
2666
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2667
+ function CrtViewElement(config) {
2668
+ return function (type) {
2669
+ checkTypeNamePascalCase(config.type);
2670
+ const inputs = getCrtInputsMetadata(type);
2671
+ const outputs = getCrtOutputsMetadata(type);
2672
+ const validationInputs = getCrtValidationInputsMetadata(type);
2673
+ const baseRegistrationConfig = {
2674
+ ...config,
2675
+ inputs,
2676
+ outputs,
2677
+ validationInputs,
2678
+ };
2679
+ const registrationConfig = 'selector' in config
2680
+ ? { ...baseRegistrationConfig, selector: config.selector }
2681
+ : { ...baseRegistrationConfig, typeRef: type };
2682
+ setViewElementMetadata(registrationConfig, type);
2683
+ };
2684
+ }
2685
+
2686
+ /**
2687
+ * @public
2688
+ * @description CrtModule decorator is a 'container' where user actually setup elements.
2689
+ * In could contain viewElements, definitions of other CrtModules.
2690
+ * @param moduleDefinition - {@link ModuleDefinition}
2691
+ *
2692
+ * @example
2693
+ * @CrtModule({
2694
+ * viewElements: [AppComponent],
2695
+ * requestHandlers: [SomeRequestHandler],
2696
+ * validators: [SomeValidator],
2697
+ * })
2698
+ * @NgModule({
2699
+ * declarations: [AppComponent],
2700
+ * imports: [BrowserModule],
2701
+ * providers: [],
2702
+ * })
2703
+ * export class AppModule {}
2704
+ */
2705
+ function CrtModule(moduleDefinition) {
2706
+ return (type) => setModuleMetadata(moduleDefinition, type);
2707
+ }
2708
+
2709
+ // noinspection ES6PreferShortImport
2710
+ /**
2711
+ * @internal
2712
+ */
2713
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2714
+ function CrtInterfaceDesignerItem(config) {
2715
+ function _applyTypeCaption() {
2716
+ if (!config.typeCaption && config.toolbarConfig) {
2717
+ const toolbarConfig = Array.isArray(config.toolbarConfig)
2718
+ ? config.toolbarConfig[0]
2719
+ : config.toolbarConfig;
2720
+ config.typeCaption = toolbarConfig.caption;
2721
+ }
2722
+ }
2723
+ return function (type) {
2724
+ config.typeRef = type;
2725
+ config.viewElementGroupType ?? (config.viewElementGroupType = ViewElementGroupType.CustomElements);
2726
+ _applyTypeCaption();
2727
+ setInterfaceDesignerItemMetadata(config, type);
2728
+ };
2729
+ }
2730
+
2731
+ /**
2732
+ * @public
2733
+ * @description
2734
+ * Constructor parameter decorator.
2735
+ * Mark parameter as dependency that should be obtained by token.
2736
+ * @param token - token by which the dependency instance will be obtained
2737
+ * @example
2738
+ * class MyHandler {
2739
+ * constructor(@CrtInject(USER_NAME_TOKEN) userName: string) {}
2740
+ * }
2741
+ */
2742
+ function CrtInject(token) {
2743
+ return function (target, paramKey, paramIndex) {
2744
+ Reflect.defineMetadata(crtInjectPrefix + paramIndex, token, target);
2745
+ };
2746
+ }
2747
+
2748
+ /**
2749
+ * @internal
2750
+ */
2751
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2752
+ function CrtValidator(config) {
2753
+ if (!config) {
2754
+ return (type) => { };
2429
2755
  }
2430
- // endregion
2431
- // region Properties: Public
2432
- get columnValues() {
2433
- return {
2434
- items: classToPlain(this._columnValues),
2756
+ return function (type) {
2757
+ checkTypeNameFormat(config.type, 'ValidatorTypeName');
2758
+ const registrationConfig = {
2759
+ ...config,
2760
+ typeRef: type,
2435
2761
  };
2762
+ setValidatorMetadata(registrationConfig, type);
2763
+ };
2764
+ }
2765
+
2766
+ /**
2767
+ * @internal
2768
+ */
2769
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2770
+ function CrtRequestHandler(config) {
2771
+ if (!config) {
2772
+ return (type) => { };
2436
2773
  }
2437
- // endregion
2438
- // region Methods: Public
2439
- addColumn(columnName, columnValue, dataValueType) {
2440
- ValidationUtilities.checkArgumentEmpty('columnName', columnName);
2441
- this._columnValues.set(columnName, new ParameterExpression({ value: columnValue, dataValueType }));
2442
- }
2774
+ return function (type) {
2775
+ checkTypeNameFormat(config.type, 'RequestHandlerTypeName');
2776
+ checkCrtTypeNamePascalCase(config.type);
2777
+ setRequestHandlerMetadata(config, type);
2778
+ };
2443
2779
  }
2444
- __decorate([
2445
- Expose(),
2446
- __metadata("design:type", Object),
2447
- __metadata("design:paramtypes", [])
2448
- ], InsertQuery.prototype, "columnValues", null);
2449
2780
 
2450
2781
  /**
2451
2782
  * @internal
2452
2783
  */
2453
- class UpdateQuery extends BaseFilterableQuery {
2454
- // endregion
2455
- // region Constructors: Public
2456
- constructor(rootSchemaName) {
2457
- super(QueryOperationType.Update, rootSchemaName);
2458
- // region Fields: Private
2459
- this._columnValues = new Map();
2460
- // endregion
2461
- // region Fields: Public
2462
- /**
2463
- * Flag that indicates whether to force save data.
2464
- */
2465
- this.isForceUpdate = false;
2784
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2785
+ function CrtConverter(config) {
2786
+ if (!config) {
2787
+ return (type) => { };
2466
2788
  }
2467
- // endregion
2468
- // region Properties: Public
2469
- get columnValues() {
2470
- return {
2471
- items: classToPlain(this._columnValues),
2789
+ return function (typeRef) {
2790
+ const type = typeof config === 'string' ? config : config.type;
2791
+ checkTypeNameFormat(type, 'converterTypeName');
2792
+ const registrationConfig = {
2793
+ type: type,
2794
+ typeRef: typeRef,
2472
2795
  };
2473
- }
2474
- // endregion
2475
- // region Methods: Public
2476
- addColumn(columnName, columnValue, dataValueType) {
2477
- ValidationUtilities.checkArgumentEmpty('columnName', columnName);
2478
- this._columnValues.set(columnName, new ParameterExpression({ value: columnValue, dataValueType }));
2479
- }
2796
+ setConverterMetadata(registrationConfig, typeRef);
2797
+ };
2480
2798
  }
2481
- __decorate([
2482
- Expose(),
2483
- __metadata("design:type", Object),
2484
- __metadata("design:paramtypes", [])
2485
- ], UpdateQuery.prototype, "columnValues", null);
2486
2799
 
2487
2800
  /**
2488
2801
  * @public
@@ -2578,14 +2891,35 @@ function registerValidators(types, options) {
2578
2891
  const metadata = getValidatorMetadata(type);
2579
2892
  const registrationConfig = {
2580
2893
  ...metadata,
2581
- instantiate: function () {
2582
- return instantiate(this.typeRef, options?.resolveDependency);
2894
+ instantiate: function (injectionContext) {
2895
+ const resolveDependency = options?.resolveDependency
2896
+ ? (token) => options.resolveDependency(token, injectionContext)
2897
+ : null;
2898
+ return instantiate(type, resolveDependency);
2583
2899
  },
2584
2900
  };
2585
2901
  ValidatorRegistry.validate(registrationConfig);
2586
2902
  ValidatorRegistry.register(registrationConfig);
2587
2903
  });
2588
2904
  }
2905
+ /**
2906
+ * @internal
2907
+ */
2908
+ function registerConverters(types, options) {
2909
+ resistantForEach(types, (type) => {
2910
+ const metadata = getConverterMetadata(type);
2911
+ const registrationConfig = {
2912
+ ...metadata,
2913
+ instantiate: function (injectionContext) {
2914
+ const resolveDependency = options?.resolveDependency
2915
+ ? (token) => options.resolveDependency(token, injectionContext)
2916
+ : null;
2917
+ return instantiate(type, resolveDependency);
2918
+ },
2919
+ };
2920
+ ConverterRegistry.register(registrationConfig);
2921
+ });
2922
+ }
2589
2923
  /**
2590
2924
  * @internal
2591
2925
  */
@@ -2597,7 +2931,12 @@ function registerRequestHandlers(types, options, remoteName) {
2597
2931
  resistantForEach(types, (type) => {
2598
2932
  const metadata = getRequestHandlerMetadata(type);
2599
2933
  let registrationConfig;
2600
- const createHandler = () => instantiate(type, options?.resolveDependency);
2934
+ const createHandler = (injectionContext) => {
2935
+ const resolveDependency = options?.resolveDependency
2936
+ ? (token) => options.resolveDependency(token, injectionContext)
2937
+ : null;
2938
+ return instantiate(type, resolveDependency);
2939
+ };
2601
2940
  if (options.moduleType === 'host') {
2602
2941
  registrationConfig = {
2603
2942
  ...metadata,
@@ -2638,6 +2977,9 @@ function _bootstrapCrtModule(name, type, options) {
2638
2977
  if (moduleDefinition.validators) {
2639
2978
  registerValidators(moduleDefinition.validators, options);
2640
2979
  }
2980
+ if (moduleDefinition.converters) {
2981
+ registerConverters(moduleDefinition.converters, options);
2982
+ }
2641
2983
  moduleDefinition.includes?.forEach((t) => _bootstrapCrtModule(name, t, options));
2642
2984
  }
2643
2985
  catch (error) {
@@ -2720,6 +3062,41 @@ function bootstrapCrtModuleHandlerChainServices(type) {
2720
3062
  _bootstrapCrtModuleHandlerChainServices(type);
2721
3063
  }
2722
3064
 
3065
+ /**
3066
+ * @public
3067
+ * @abstract
3068
+ * @classdesc Class for designing request handlers.
3069
+ */
3070
+ class BaseRequestHandler {
3071
+ constructor() {
3072
+ this.handlerChain = HandlerChainService.instance;
3073
+ }
3074
+ get next() {
3075
+ return this._next;
3076
+ }
3077
+ /**
3078
+ * @internal
3079
+ */
3080
+ static [Symbol.hasInstance](instance) {
3081
+ return instance?.constructor?.['_instanceOfKey'] === BaseRequestHandler._instanceOfKey;
3082
+ }
3083
+ /**
3084
+ * @description Method to set request handler to handler chain.
3085
+ * @param next - link for next request handler - {@link RequestHandler}
3086
+ */
3087
+ setNext(next) {
3088
+ if (this._next) {
3089
+ throw new NextHandlerAlreadySpecifiedException();
3090
+ }
3091
+ this._next = next;
3092
+ }
3093
+ }
3094
+ /**
3095
+ * @internal
3096
+ * @dontChange
3097
+ */
3098
+ BaseRequestHandler._instanceOfKey = 'devkit_BaseRequestHandler';
3099
+
2723
3100
  class BaseHandlerChainService {
2724
3101
  }
2725
3102
 
@@ -2915,6 +3292,27 @@ __decorate([
2915
3292
  __metadata("design:returntype", Object)
2916
3293
  ], HttpClientService.prototype, "patch", null);
2917
3294
 
3295
+ /**
3296
+ * @internal
3297
+ */
3298
+ var SchemaViewMaskRequestAction;
3299
+ (function (SchemaViewMaskRequestAction) {
3300
+ SchemaViewMaskRequestAction["AddTask"] = "addTask";
3301
+ SchemaViewMaskRequestAction["RemoveTask"] = "removeTask";
3302
+ })(SchemaViewMaskRequestAction || (SchemaViewMaskRequestAction = {}));
3303
+ /**
3304
+ * @internal
3305
+ */
3306
+ class SchemaViewMaskRequest extends BaseRequest {
3307
+ constructor(action, taskName, $context) {
3308
+ super();
3309
+ this.action = action;
3310
+ this.taskName = taskName;
3311
+ this.$context = $context;
3312
+ this.type = 'crt.SchemaViewMaskRequest';
3313
+ }
3314
+ }
3315
+
2918
3316
  /**
2919
3317
  * @public
2920
3318
  * @classdesc Service to working with mask using handler chain
@@ -2928,6 +3326,24 @@ class MaskService extends BaseHandlerChainService {
2928
3326
  */
2929
3327
  this.requestType = 'crt.MaskService';
2930
3328
  }
3329
+ /**
3330
+ * @internal
3331
+ * @param taskName
3332
+ * @param context
3333
+ */
3334
+ async showMask(taskName, context) {
3335
+ const request = new SchemaViewMaskRequest(SchemaViewMaskRequestAction.AddTask, taskName, context);
3336
+ await HandlerChainService.instance.process(request);
3337
+ }
3338
+ /**
3339
+ * @internal
3340
+ * @param taskName
3341
+ * @param context
3342
+ */
3343
+ async hideMask(taskName, context) {
3344
+ const request = new SchemaViewMaskRequest(SchemaViewMaskRequestAction.RemoveTask, taskName, context);
3345
+ await HandlerChainService.instance.process(request);
3346
+ }
2931
3347
  }
2932
3348
  __decorate([
2933
3349
  ImplementUsingHandlerChain(),
@@ -3012,83 +3428,9 @@ var ModelParameterType;
3012
3428
  ModelParameterType["Never"] = "never";
3013
3429
  })(ModelParameterType || (ModelParameterType = {}));
3014
3430
 
3015
- /**
3016
- * @public
3017
- * @abstract
3018
- * @classdesc Class for designing request handlers.
3019
- */
3020
- class BaseRequestHandler {
3021
- constructor() {
3022
- this.handlerChain = HandlerChainService.instance;
3023
- }
3024
- get next() {
3025
- return this._next;
3026
- }
3027
- /**
3028
- * @internal
3029
- */
3030
- static [Symbol.hasInstance](instance) {
3031
- return instance?.constructor?.['_instanceOfKey'] === BaseRequestHandler._instanceOfKey;
3032
- }
3033
- /**
3034
- * @description Method to set request handler to handler chain.
3035
- * @param next - link for next request handler - {@link RequestHandler}
3036
- */
3037
- setNext(next) {
3038
- if (this._next) {
3039
- throw new NextHandlerAlreadySpecifiedException();
3040
- }
3041
- this._next = next;
3042
- }
3043
- }
3044
- /**
3045
- * @internal
3046
- * @dontChange
3047
- */
3048
- BaseRequestHandler._instanceOfKey = 'devkit_BaseRequestHandler';
3049
-
3050
- /**
3051
- * @internal
3052
- */
3053
- class InterfaceDesignerItemRegistrationConfig {
3054
- }
3055
-
3056
- /**
3057
- * @internal
3058
- * @class MethodInvokeRequest
3059
- * @description Definition of invoke method request.
3060
- * @extends {BaseRequest} {@link BaseRequest}
3061
- * @property {string} method - method name.
3062
- * @property {unknown[]} args - arguments passing to the method.
3063
- */
3064
- class MethodInvokeRequest extends BaseRequest {
3065
- }
3066
-
3067
- /**
3068
- * @internal
3069
- */
3070
- function toAggregationType(aggregationFunction) {
3071
- switch (aggregationFunction) {
3072
- case AggregationFunction.Count:
3073
- return AggregationType.Count;
3074
- case AggregationFunction.Sum:
3075
- return AggregationType.Sum;
3076
- case AggregationFunction.Avg:
3077
- return AggregationType.Avg;
3078
- case AggregationFunction.Min:
3079
- return AggregationType.Min;
3080
- case AggregationFunction.Max:
3081
- return AggregationType.Max;
3082
- case AggregationFunction.TopOne:
3083
- return AggregationType.TopOne;
3084
- default:
3085
- return AggregationType.None;
3086
- }
3087
- }
3088
-
3089
3431
  /**
3090
3432
  * Generated bundle index. Do not edit.
3091
3433
  */
3092
3434
 
3093
- export { AggregationEvalType, AggregationFunction, AggregationFunctionColumn, AggregationFunctionExpression, AggregationSubQueryColumn, AggregationSubQueryExpression, AggregationType, ArgumentEmptyException, ArgumentFunctionExpression, ArgumentOutOfRangeException, ArithmeticExpression, ArithmeticOperation, ArithmeticQueryColumn, BaseExpression, BaseFilter, BaseFilterableQuery, BaseQuery, BaseQueryColumn, BaseRegistry, BaseRequest, BaseRequestHandler, BaseValidator, BetweenFilter, BootstrapNotifier, ColumnExpression, CompareFilter, ComparisonType, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, DataRequest, DataSchemaAttributeType, DataSchemaAttributeUsageType, DataSourceScope, DataValueType, DatePartFunctionColumn, DatePartFunctionExpression, DatePartType, DefaultValueSource, DeleteQuery, DesignTimeViewElementRegistry, DesignerToolGroupType, EMPTY_GUID, EXPRESSION_TYPE_MOCK, EntityQueryColumn, EntitySchemaQuery, ExistsFilter, ExpressionMock, ExpressionType, FeatureService, FilterGroup, FilterMock, FilterType, FunctionExpression, FunctionType, GlobalConvertersRegistryService, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InFilter, InsertQuery, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, IsNullFilter, ItemNotFoundException, LengthFunctionColumn, LengthFunctionExpression, LocalizableValue, LogicalOperatorType, MacrosFunctionColumn, MacrosFunctionExpression, MaskService, MethodInvokeRequest, Model, ModelInPageAction, ModelParameterType, NextHandlerAlreadySpecifiedException, OrderDirection, ParameterExpression, ParameterQueryColumn, PkgTopology, QueryMacrosType, QueryOperationType, RemoteEntriesRegistry, RequestHandlerRegistryService, RequestRegistryService, RightsService, SingleFilter, SubQueryColumn, SubQueryExpression, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, UpdateQuery, ValidationUtilities, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementRegistry, WindowFunctionColumn, WindowFunctionExpression, _bootstrapCrtModule, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, designTimeViewElementRegistryKey, generateGuid, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDesignTimeViewElementMetadata, getHandlerChainServiceMetadata, getInterfaceDesignerItemMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegistryKey, isComponentPropertyBindable, isEmptyGuid, isGuid, localize, objectDeepKeys, registerAngularViewElement, registerViewElement, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationType, toPascalCase, validatorRegistryKey, viewElementRegistryKey };
3435
+ export { AggregationEvalType, AggregationFunction, AggregationFunctionColumn, AggregationFunctionExpression, AggregationSubQueryColumn, AggregationSubQueryExpression, AggregationType, ArgumentEmptyException, ArgumentFunctionExpression, ArgumentOutOfRangeException, ArithmeticExpression, ArithmeticOperation, ArithmeticQueryColumn, BaseExpression, BaseFilter, BaseFilterableQuery, BaseQuery, BaseQueryColumn, BaseRegistry, BaseRequest, BaseRequestHandler, BaseValidator, BetweenFilter, BootstrapNotifier, ColumnExpression, CompareFilter, ComparisonType, ConverterRegistry, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, DataRequest, DataSchemaAttributeType, DataSchemaAttributeUsageType, DataSourceScope, DataValueType, DatePartFunctionColumn, DatePartFunctionExpression, DatePartType, DefaultValueSource, DeleteQuery, DesignTimeViewElementRegistry, DesignerToolGroupType, EMPTY_GUID, EXPRESSION_TYPE_MOCK, EntityQueryColumn, EntitySchemaQuery, ExistsFilter, ExpressionMock, ExpressionType, FeatureService, FilterGroup, FilterMock, FilterType, FunctionExpression, FunctionType, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InFilter, InsertQuery, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, IsNullFilter, ItemNotFoundException, LengthFunctionColumn, LengthFunctionExpression, LocalizableValue, LogicalOperatorType, MacrosFunctionColumn, MacrosFunctionExpression, MaskService, MethodInvokeRequest, Model, ModelInPageAction, ModelParameterType, NextHandlerAlreadySpecifiedException, OrderDirection, ParameterExpression, ParameterQueryColumn, PkgTopology, QueryMacrosType, QueryOperationType, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, SchemaViewMaskRequest, SchemaViewMaskRequestAction, SelectLocalizationQuery, SingleFilter, SubQueryColumn, SubQueryExpression, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, UpdateQuery, ValidationUtilities, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementRegistry, WindowFunctionColumn, WindowFunctionExpression, _bootstrapCrtModule, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, designTimeViewElementRegistryKey, encodeDate, generateGuid, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDesignTimeViewElementMetadata, getHandlerChainServiceMetadata, getInterfaceDesignerItemMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegistryKey, isComponentPropertyBindable, isEmptyGuid, isGuid, localize, objectDeepKeys, registerAngularViewElement, registerViewElement, setConverterMetadata, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toLocalISOString, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, validatorRegistryKey, viewElementRegistryKey };
3094
3436
  //# sourceMappingURL=creatio-devkit-common.mjs.map