@creatio-devkit/common 0.807.0 → 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 (313) hide show
  1. package/CHANGELOG.md +3 -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 +1 -1
  5. package/esm2020/lib/external/functions/date-part-type-adapter.mjs +1 -1
  6. package/esm2020/lib/external/functions/function-type-adapter.mjs +1 -1
  7. package/esm2020/lib/external/functions/index.mjs +1 -1
  8. package/esm2020/lib/external/functions/order-direction-adapter.mjs +1 -1
  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 -11
  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 +1 -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 +14 -15
  41. package/esm2020/lib/internal/esq/data-model/queries/index.mjs +1 -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 +1 -1
  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 +1 -1
  48. package/esm2020/lib/internal/model/data-schema/data-schema-attribute-function-config.model.mjs +1 -1
  49. package/esm2020/lib/internal/model/data-schema/data-schema-validator-config.model.mjs +1 -1
  50. package/esm2020/lib/internal/model/data-schema/index.mjs +1 -1
  51. package/esm2020/lib/internal/model/data-source-config.mjs +1 -1
  52. package/esm2020/lib/internal/model/index.mjs +1 -1
  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 +2 -1
  112. package/esm2020/lib/internal/types/internal-resolve-dependency-fn.type.mjs +2 -0
  113. package/esm2020/lib/internal/types/localizable-values.type.mjs +1 -1
  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 +1 -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 +1 -1
  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 +1 -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 +1 -1
  293. package/esm2020/lib/public/types/date-part.type.mjs +1 -1
  294. package/esm2020/lib/public/types/entity-column-value.mjs +1 -1
  295. package/esm2020/lib/public/types/function.type.mjs +1 -1
  296. package/esm2020/lib/public/types/guid.type.mjs +1 -1
  297. package/esm2020/lib/public/types/index.mjs +1 -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 +2220 -2031
  305. package/fesm2015/creatio-devkit-common.mjs.map +1 -1
  306. package/fesm2020/creatio-devkit-common.mjs +2213 -2028
  307. package/fesm2020/creatio-devkit-common.mjs.map +1 -1
  308. package/index.d.ts +88 -7
  309. package/package.json +3 -3
  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/models/remote-entry-info.mjs +0 -2
  313. package/esm2020/lib/internal/services/global-converters-registry/global-converters-registry.service.mjs +0 -23
@@ -1,2161 +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}"`);
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 = {}));
105
+
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 = {}));
200
+
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;
95
281
  }
96
282
  }
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');
283
+
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();
105
291
  }
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');
292
+ clone() {
293
+ return new ArithmeticExpression(this);
115
294
  }
116
295
  }
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.`);
296
+
297
+ class ColumnExpression extends BaseExpression {
298
+ constructor(config) {
299
+ super(config);
300
+ this.expressionType = ExpressionType.SchemaColumn;
301
+ this.columnPath = config?.columnPath;
129
302
  }
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`);
303
+ clone() {
304
+ return new ColumnExpression(this);
137
305
  }
138
306
  }
139
307
 
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
- }
308
+ class FunctionExpression extends BaseExpression {
309
+ constructor(config) {
310
+ super(config);
311
+ this.expressionType = ExpressionType.Function;
175
312
  }
176
313
  }
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);
314
+
315
+ class ArgumentFunctionExpression extends FunctionExpression {
316
+ constructor(config) {
317
+ super(config);
318
+ this.functionArgument = config?.functionArgument.clone();
213
319
  }
214
320
  }
215
- RequestHandlerRegistryService._internalRegistry = global$3.creatio.requestHandlerRegistry;
216
321
 
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);
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;
234
328
  }
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();
329
+ clone() {
330
+ return new AggregationFunctionExpression(this);
244
331
  }
245
332
  }
246
- RequestRegistryService._requestsMap = new Map();
247
- RequestRegistryService._requestsRegistrationInfos = new Map();
248
333
 
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());
334
+ class DatePartFunctionExpression extends ArgumentFunctionExpression {
335
+ constructor(config) {
336
+ super(config);
337
+ this.functionType = FunctionType.DatePart;
338
+ this.datePartType = config?.datePartType;
264
339
  }
265
- static clear() {
266
- this._converters.clear();
340
+ clone() {
341
+ return new DatePartFunctionExpression(this);
267
342
  }
268
343
  }
269
- GlobalConvertersRegistryService._converters = new Map();
270
344
 
271
- const global$2 = window;
272
- /**
273
- * @internal
274
- */
275
- class BaseRegistry {
276
- constructor() {
277
- this.store = {
278
- typeInfos: new Map(),
279
- };
345
+ class LengthFunctionExpression extends ArgumentFunctionExpression {
346
+ constructor(config) {
347
+ super(config);
348
+ this.functionType = FunctionType.Length;
280
349
  }
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;
350
+ clone() {
351
+ return new LengthFunctionExpression(this);
291
352
  }
292
353
  }
293
- BaseRegistry._prefix = 'creatio.registry.';
294
354
 
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);
355
+ class MacrosFunctionExpression extends FunctionExpression {
356
+ constructor(config) {
357
+ super(config);
358
+ this.functionType = FunctionType.Macros;
359
+ this.macrosType = config?.macrosType;
306
360
  }
307
- static get viewElements() {
308
- return this.store.typeInfos;
361
+ clone() {
362
+ return new MacrosFunctionExpression(this);
309
363
  }
310
- static register(config) {
311
- this.viewElements.set(config.type, config);
364
+ }
365
+
366
+ class WindowFunctionExpression extends ArgumentFunctionExpression {
367
+ constructor(config) {
368
+ super(config);
369
+ this.functionType = FunctionType.Window;
312
370
  }
313
- static getFormControlRelatesAttribute(type) {
314
- const config = this.store.typeInfos.get(type);
315
- return (config && 'formControlConfig' in config && config.formControlConfig?.relatesTo) || null;
371
+ clone() {
372
+ return new WindowFunctionExpression(this);
316
373
  }
317
374
  }
318
- ViewElementRegistry.registryKey = viewElementRegistryKey;
319
375
 
320
376
  /**
321
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.
322
388
  */
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);
389
+ function toLocalISOString(date) {
390
+ if (!(date instanceof Date)) {
391
+ throw new TypeError();
341
392
  }
393
+ const timeZoneOffset = date.getTimezoneOffset() * 60000;
394
+ return new Date(date.getTime() - timeZoneOffset).toISOString().slice(0, -1);
342
395
  }
343
- InterfaceDesignerItemRegistry.registryKey = interfaceDesignerItemRegistryKey;
344
-
345
- const global$1 = window;
346
396
  /**
347
397
  * @internal
398
+ * Returns encoded date in string value.
399
+ * @param date Date value.
348
400
  */
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();
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;
356
414
  }
357
- return global$1.__crtModuleBootstrapNotifier;
358
- }
359
- notify(moduleType) {
360
- for (const subscriber of this._subscribers.values()) {
361
- subscriber(moduleType);
415
+ else if (!value) {
416
+ this.value = value;
362
417
  }
418
+ else {
419
+ this.value = typeof value === 'object' ? { ...value } : value;
420
+ }
421
+ this.dataValueType = config?.dataValueType ?? DataValueType.Text;
363
422
  }
364
- subscribe(subscriber) {
365
- this._subscribers.add(subscriber);
423
+ get parameter() {
366
424
  return {
367
- unsubscribe: () => this._subscribers.delete(subscriber),
425
+ dataValueType: this.dataValueType,
426
+ ...this._getParameterValueMetadata(),
368
427
  };
369
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
+ }
448
+ }
449
+ return out;
450
+ }
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
+ }
467
+ }
468
+ clone() {
469
+ return new ParameterExpression(this);
470
+ }
370
471
  }
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);
371
485
 
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);
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;
380
495
  }
381
- static checkUniqueRequestType(requestType) {
382
- if (this.services.get(requestType)) {
383
- throw new Error(`${requestType} already registered`);
384
- }
496
+ clone() {
497
+ return new SubQueryExpression(this);
385
498
  }
386
- static register(config) {
387
- this.validate(config);
388
- this.services.set(config.requestType, config);
499
+ }
500
+
501
+ class AggregationSubQueryExpression extends SubQueryExpression {
502
+ constructor(config) {
503
+ super(config);
504
+ this.aggregationType = config?.aggregationType;
389
505
  }
390
- static get services() {
391
- return this.store.typeInfos;
506
+ clone() {
507
+ return new AggregationSubQueryExpression(this);
392
508
  }
393
509
  }
394
- HandlerChainServicesRegistry.registryKey = 'HandlerChainServicesRegistry';
395
510
 
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);
408
- }
409
- static register(config) {
410
- this.infos.set(config.type, config);
511
+ const EXPRESSION_TYPE_MOCK = -1;
512
+ class ExpressionMock extends BaseExpression {
513
+ constructor(config) {
514
+ super(config || {});
515
+ this.expressionType = EXPRESSION_TYPE_MOCK;
411
516
  }
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;
517
+ // eslint-disable-next-line @typescript-eslint/ban-types
518
+ get plainObject() {
519
+ return classToPlain(this, { exposeUnsetFields: false, excludePrefixes: ['_'] });
418
520
  }
419
- static get infos() {
420
- return this.store.typeInfos;
521
+ clone() {
522
+ return new ExpressionMock(this);
421
523
  }
422
524
  }
423
- DesignTimeViewElementRegistry.registryKey = designTimeViewElementRegistryKey;
424
525
 
425
- /**
426
- * @internal
427
- */
428
- class ValidatorMapValue {
429
- }
430
- /**
431
- * @internal
432
- */
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;
526
+ class BaseFilter {
527
+ constructor(filterType) {
528
+ this.isEnabled = true;
529
+ this.trimDateTimeParameterToDate = false;
530
+ this.filterType = filterType;
440
531
  }
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`);
445
- }
532
+ }
533
+
534
+ class FilterMock extends BaseFilter {
535
+ constructor(filterType = FilterType.None) {
536
+ super(filterType);
446
537
  }
447
- static get items() {
448
- return this.store.typeInfos;
538
+ // eslint-disable-next-line @typescript-eslint/ban-types
539
+ get plainObject() {
540
+ return classToPlain(this, { exposeUnsetFields: false, excludePrefixes: ['_'] });
449
541
  }
450
- static register(config) {
451
- this.items.set(config.type, config);
542
+ clone() {
543
+ return new FilterMock(this.filterType);
452
544
  }
453
545
  }
454
- ValidatorRegistry.registryKey = validatorRegistryKey;
455
546
 
456
- /**
457
- * @internal
458
- */
459
- class PkgTopology extends BaseRegistry {
460
- static get items() {
461
- return this.store.typeInfos;
462
- }
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;
547
+ class SingleFilter extends BaseFilter {
548
+ constructor(filterType, comparisonType, leftExpression) {
549
+ super(filterType);
550
+ this.comparisonType = comparisonType;
551
+ this.leftExpression = leftExpression.clone();
469
552
  }
470
553
  }
471
- PkgTopology.registryKey = 'pkgTopology';
472
554
 
473
- /**
474
- * @internal
475
- */
476
- class RemoteEntriesRegistry extends BaseRegistry {
477
- static get items() {
478
- return this.store.typeInfos;
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);
479
562
  }
480
563
  }
481
- RemoteEntriesRegistry.registryKey = 'remotes';
482
564
 
483
- /**
484
- * @internal
485
- */
486
- function objectDeepKeys(obj) {
487
- if (obj === null || typeof obj !== 'object') {
488
- return [];
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);
489
573
  }
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
574
  }
495
575
 
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`);
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;
515
581
  }
516
- return metadata;
517
- }
518
- /**
519
- * @internal
520
- */
521
- function setViewElementMetadata(metadata, type) {
522
- Reflect.defineMetadata(viewElementMetadataKey, metadata, type);
523
- }
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`);
582
+ clone() {
583
+ return new ExistsFilter(this.leftExpression, this.subFilters, this.comparisonType, this.isAggregative);
531
584
  }
532
- return metadata;
533
- }
534
- /**
535
- * @internal
536
- */
537
- function setValidatorMetadata(metadata, type) {
538
- Reflect.defineMetadata(validatorMetadataKey, metadata, type);
539
585
  }
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`);
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());
547
591
  }
548
- return metadata;
549
- }
550
- /**
551
- * @internal
552
- */
553
- function setInterfaceDesignerItemMetadata(metadata, type) {
554
- Reflect.defineMetadata(interfaceDesignerItemMetadataKey, metadata, type);
555
- }
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`);
592
+ clone() {
593
+ return new InFilter(this.comparisonType, this.leftExpression, this.rightExpressions);
563
594
  }
564
- return metadata;
565
- }
566
- /**
567
- * @internal
568
- */
569
- function setDesignTimeViewElementMetadata(metadata, type) {
570
- Reflect.defineMetadata(designTimeViewElementMetadataKey, metadata, type);
571
595
  }
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`);
596
+
597
+ class IsNullFilter extends SingleFilter {
598
+ constructor(comparisonType, leftExpression) {
599
+ super(FilterType.IsNull, comparisonType, leftExpression);
579
600
  }
580
- return metadata;
581
- }
582
- /**
583
- * @internal
584
- */
585
- function hasInterfaceDesignerItemMetadata(type) {
586
- return Reflect.hasOwnMetadata(interfaceDesignerItemMetadataKey, type);
587
- }
588
- /**
589
- * @internal
590
- */
591
- function setRequestHandlerMetadata(metadata, type) {
592
- Reflect.defineMetadata(requestHandlerMetadataKey, metadata, type);
593
- }
594
- /**
595
- * @internal
596
- */
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
+ get isNull() {
602
+ return this.comparisonType === ComparisonType.Is_null;
603
+ }
604
+ clone() {
605
+ return new IsNullFilter(this.comparisonType, this.leftExpression);
601
606
  }
602
- return metadata;
603
607
  }
608
+ __decorate([
609
+ Expose(),
610
+ __metadata("design:type", Boolean),
611
+ __metadata("design:paramtypes", [])
612
+ ], IsNullFilter.prototype, "isNull", null);
613
+
604
614
  /**
615
+ * Empty Guid constant.
605
616
  * @internal
606
617
  */
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`);
611
- }
612
- return { requestType, typeRef };
613
- }
618
+ const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
614
619
  /**
620
+ * Regular expression for Guid validation.
615
621
  * @internal
616
622
  */
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
- }));
624
- }
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');
625
624
  /**
625
+ * Generates guid part.
626
+ * @param length Part length.
626
627
  * @internal
627
628
  */
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
- }));
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);
634
+ }
635
+ return out;
635
636
  }
636
637
  /**
638
+ * Generates new Guid.
637
639
  * @internal
638
640
  */
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
- }));
641
+ function generateGuid() {
642
+ return [
643
+ generateGuidPart(2),
644
+ generateGuidPart(1),
645
+ generateGuidPart(1),
646
+ generateGuidPart(1),
647
+ generateGuidPart(3),
648
+ ].join('-');
646
649
  }
647
650
  /**
651
+ * Checks if value is Guid.
652
+ * @param value Value for check.
648
653
  * @internal
649
654
  */
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
- }));
655
+ function isGuid(value) {
656
+ return Boolean(value) && validator.test(value);
658
657
  }
659
658
  /**
659
+ * Checks if Guid is empty value or equal to EMPTY_GUID.
660
+ * @param guid Guid for check.
660
661
  * @internal
661
662
  */
662
- function getParentType(type) {
663
- const parentProto = type.prototype ? Object.getPrototypeOf(type.prototype) : null;
664
- return parentProto ? parentProto.constructor : null;
663
+ function isEmptyGuid(guid) {
664
+ return !guid || guid === EMPTY_GUID;
665
665
  }
666
+
666
667
  /**
667
668
  * @internal
668
669
  */
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) : [];
670
+ class NextHandlerAlreadySpecifiedException extends Error {
671
+ constructor() {
672
+ super('Next handler already specified');
679
673
  }
680
- const crtInjectMetadata = getCrtInjectMetadata(type);
681
- Object.entries(crtInjectMetadata).forEach(([index, token]) => (paramTypes[index] = token));
682
- return paramTypes;
683
674
  }
684
675
 
685
- /**
686
- * @public
687
- */
688
- class CrtInputRegistrationConfig {
676
+ class ArgumentEmptyException extends Error {
677
+ // region Constructors: Public
678
+ constructor(argumentName) {
679
+ super(`Argument with name '${argumentName}' is empty.`);
680
+ }
689
681
  }
690
682
 
691
- /**
692
- * @public
693
- * @class BaseRequest
694
- * @describe Base definition of request.
695
- * @template TEvent
696
- */
697
- class BaseRequest {
683
+ class ArgumentOutOfRangeException extends Error {
684
+ // region Constructors: Public
685
+ constructor(argumentName) {
686
+ super(`Argument with name '${argumentName}' is out of range.`);
687
+ }
698
688
  }
699
689
 
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 {
690
+ class ItemNotFoundException extends Error {
691
+ // region Constructors: Public
692
+ constructor(key) {
693
+ super(`Item with key '${key}' does not exist.`);
694
+ }
708
695
  }
709
696
 
710
- /**
711
- * @public
712
- * @description Request payload
713
- * @property {string} request - request name.
714
- * @property {unknown} params - request parameters.
715
- */
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
+ }
725
+ }
716
726
 
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 {
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
+ });
738
+ }
739
+ /**
740
+ * Returns filter item by index.
741
+ * @param index Item index.
742
+ * @returns Filter.
743
+ */
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);
770
+ }
771
+ /**
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.
776
+ */
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;
805
+ }
806
+ }
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);
816
+
817
+ class BaseQueryColumn {
818
+ constructor(expression) {
819
+ this.orderDirection = OrderDirection.None;
820
+ this.orderPosition = -1;
821
+ this.isVisible = true;
822
+ this.expression = expression;
823
+ }
732
824
  /**
733
- * @description getter for async/sync indicator
825
+ * Adds ordering options.
826
+ * @param orderDirection Direction.
827
+ * @param orderPosition Position.
828
+ * @returns Self.
734
829
  */
735
- get isAsync() {
736
- return this.async;
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;
737
837
  }
738
838
  /**
739
- * @description Function used for validation
839
+ * Adds options.
840
+ * @param options Options.
841
+ * @returns Self.
740
842
  */
741
- get validateFn() {
742
- return this.validate.bind(this);
843
+ withOptions(options) {
844
+ ValidationUtilities.checkArgumentEmpty('options', options);
845
+ this.isVisible = options.isVisible ?? true;
846
+ return this;
743
847
  }
744
848
  /**
745
- * @internal
849
+ * Adds caption.
850
+ * @param caption Caption.
851
+ * @returns Self.
746
852
  */
747
- static [Symbol.hasInstance](instance) {
748
- return instance?.constructor?.['_instanceOfKey'] === BaseValidator._instanceOfKey;
853
+ withCaption(caption) {
854
+ ValidationUtilities.checkArgumentEmpty('caption', caption);
855
+ this.caption = caption;
856
+ return this;
749
857
  }
750
858
  }
751
- /**
752
- * @internal
753
- * @dontChange
754
- */
755
- BaseValidator._instanceOfKey = 'devkit_BaseValidator';
756
859
 
757
- /**
758
- * @public
759
- */
760
- class LocalizableValue {
761
- constructor(key) {
762
- this.key = key;
860
+ class ArithmeticQueryColumn extends BaseQueryColumn {
861
+ // region Constructors: Public
862
+ constructor(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand) {
863
+ super(new ArithmeticExpression({ arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand }));
763
864
  }
764
- /**
765
- * @internal
766
- */
767
- static [Symbol.hasInstance](instance) {
768
- return instance?.constructor?.['_instanceOfKey'] === LocalizableValue._instanceOfKey;
865
+ }
866
+
867
+ class EntityQueryColumn extends BaseQueryColumn {
868
+ // region Constructors: Public
869
+ constructor(columnPath) {
870
+ super(new ColumnExpression({ columnPath }));
769
871
  }
770
872
  }
771
- /**
772
- * @internal
773
- * @dontChange
774
- */
775
- LocalizableValue._instanceOfKey = 'devkit_LocalizableValue';
776
873
 
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;
874
+ class ParameterQueryColumn extends BaseQueryColumn {
875
+ // region Constructors: Public
876
+ constructor(value, dataValueType) {
877
+ super(new ParameterExpression({ value, dataValueType }));
786
878
  }
787
- const localized = cloneDeep(obj);
788
- if (!localizeMetadata) {
789
- console.error("Unable to localize metadata. 'localizeMetadata' bootstrap option was not provided.");
879
+ }
880
+
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
+ }));
790
891
  }
791
- localizableEntries.forEach(({ path, value }) => {
792
- const localizedValue = localizeMetadata?.(value.key) ?? value.key;
793
- set(localized, path, localizedValue);
794
- });
795
- return localized;
796
892
  }
797
893
 
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);
894
+ class SubQueryColumn extends BaseQueryColumn {
895
+ // region Constructors: Public
896
+ constructor(columnPath, subFilters) {
897
+ super(new SubQueryExpression({ columnPath, subFilters }));
810
898
  }
811
- return new type();
812
899
  }
813
900
 
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 = {}));
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
+ }
911
+
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
+ }
926
+
927
+ class LengthFunctionColumn extends BaseQueryColumn {
928
+ // region Constructors: Public
929
+ constructor(functionArgument) {
930
+ super(new LengthFunctionExpression({ functionArgument }));
931
+ }
932
+ }
933
+
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
+ }
825
947
 
826
948
  /**
827
949
  * @internal
828
950
  */
829
- var ViewElementDataGroupType;
830
- (function (ViewElementDataGroupType) {
831
- ViewElementDataGroupType["Data"] = "Data";
832
- })(ViewElementDataGroupType || (ViewElementDataGroupType = {}));
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;
967
+ }
968
+ }
833
969
  /**
834
970
  * @internal
835
971
  */
836
- // eslint-disable-next-line @typescript-eslint/naming-convention
837
- const DesignerToolGroupType = { ...ViewElementDataGroupType, ...ViewElementGroupType };
838
-
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;
988
+ }
989
+ }
839
990
  /**
840
991
  * @internal
841
992
  */
842
- var DataSourceScope;
843
- (function (DataSourceScope) {
844
- DataSourceScope["ViewElement"] = "viewElement";
845
- DataSourceScope["Page"] = "page";
846
- })(DataSourceScope || (DataSourceScope = {}));
847
-
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
+ }
1002
+ }
848
1003
  /**
849
1004
  * @internal
850
1005
  */
851
- var ModelInPageAction;
852
- (function (ModelInPageAction) {
853
- ModelInPageAction["Edit"] = "edit";
854
- ModelInPageAction["Add"] = "add";
855
- ModelInPageAction["Copy"] = "copy";
856
- })(ModelInPageAction || (ModelInPageAction = {}));
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
+ }
1015
+ }
857
1016
 
858
1017
  /**
859
- * Handler source types in order of call priority.
860
1018
  * @internal
861
1019
  */
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 = {}));
868
-
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;
1038
+ }
1039
+ }
869
1040
  /**
870
1041
  * @internal
871
1042
  */
872
- var DataSchemaAttributeType;
873
- (function (DataSchemaAttributeType) {
874
- DataSchemaAttributeType["OwnAttribute"] = "Own";
875
- DataSchemaAttributeType["ForwardReferenceAttribute"] = "ForwardReference";
876
- DataSchemaAttributeType["BackReferenceAttribute"] = "BackReference";
877
- DataSchemaAttributeType["AggregationAttribute"] = "Aggregation";
878
- DataSchemaAttributeType["FunctionAttribute"] = "Function";
879
- })(DataSchemaAttributeType || (DataSchemaAttributeType = {}));
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
+ }
1062
+ }
1063
+
880
1064
  /**
881
1065
  * @internal
882
1066
  */
883
- var DataSchemaAttributeUsageType;
884
- (function (DataSchemaAttributeUsageType) {
885
- DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["General"] = 0] = "General";
886
- DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["Advanced"] = 1] = "Advanced";
887
- DataSchemaAttributeUsageType[DataSchemaAttributeUsageType["None"] = 2] = "None";
888
- })(DataSchemaAttributeUsageType || (DataSchemaAttributeUsageType = {}));
889
-
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';
1075
+ }
1076
+ }
890
1077
  /**
891
1078
  * @internal
892
1079
  */
893
- var DefaultValueSource;
894
- (function (DefaultValueSource) {
895
- DefaultValueSource[DefaultValueSource["None"] = 0] = "None";
896
- DefaultValueSource[DefaultValueSource["Const"] = 1] = "Const";
897
- DefaultValueSource[DefaultValueSource["Settings"] = 2] = "Settings";
898
- DefaultValueSource[DefaultValueSource["SystemValue"] = 3] = "SystemValue";
899
- DefaultValueSource[DefaultValueSource["Sequence"] = 4] = "Sequence";
900
- })(DefaultValueSource || (DefaultValueSource = {}));
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;
1088
+ }
1089
+ }
901
1090
 
902
1091
  /**
903
1092
  * @internal
904
1093
  */
905
- class HandlersOrderComparer {
906
- constructor(_request) {
907
- this._request = _request;
908
- const scopesOrderEntries = [...(this._request.scopes ?? [])].reverse().map((scope, index) => [scope, index]);
909
- this._scopesOrder = Object.fromEntries(scopesOrderEntries);
910
- }
911
- _getOrderByScopes(handler) {
912
- if (!handler.scopes) {
913
- return Number.MAX_VALUE;
914
- }
915
- const scopesOrder = handler.scopes.filter((s) => s in this._scopesOrder).map((s) => this._scopesOrder[s]);
916
- return Math.min(...scopesOrder);
917
- }
918
- _getOrderByPkgTopology(handler) {
919
- if (handler.source.type === HandlerSourceType.Host) {
920
- return Number.MAX_VALUE;
921
- }
922
- return PkgTopology.get(handler.source.packageName);
923
- }
924
- compare(a, b) {
925
- const aScopeOrder = this._getOrderByScopes(a);
926
- const bScopeOrder = this._getOrderByScopes(b);
927
- let diff = aScopeOrder - bScopeOrder;
928
- if (diff) {
929
- return diff;
930
- }
931
- const aPkgTopologyOrder = this._getOrderByPkgTopology(a);
932
- const bPkgTopologyOrder = this._getOrderByPkgTopology(b);
933
- diff = aPkgTopologyOrder - bPkgTopologyOrder;
934
- if (diff) {
935
- return diff;
936
- }
937
- diff = a.source.type - b.source.type;
938
- return diff;
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;
939
1102
  }
940
1103
  }
941
-
942
1104
  /**
943
1105
  * @internal
944
1106
  */
945
- function isComponentPropertyBindable(viewConfigType, componentProperty) {
946
- const componentConfig = ViewElementRegistry.viewElements.get(viewConfigType);
947
- if (!componentConfig?.inputs) {
948
- return false;
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';
949
1115
  }
950
- return !!componentConfig?.inputs[componentProperty]?.propertyBindable;
951
1116
  }
952
1117
 
953
1118
  /**
954
1119
  * @internal
955
1120
  */
956
- // eslint-disable-next-line @typescript-eslint/naming-convention
957
- function CrtViewElement(config) {
958
- return function (type) {
959
- checkTypeNamePascalCase(config.type);
960
- const inputs = getCrtInputsMetadata(type);
961
- const outputs = getCrtOutputsMetadata(type);
962
- const validationInputs = getCrtValidationInputsMetadata(type);
963
- const baseRegistrationConfig = {
964
- ...config,
965
- inputs,
966
- outputs,
967
- validationInputs,
968
- };
969
- const registrationConfig = 'selector' in config
970
- ? { ...baseRegistrationConfig, selector: config.selector }
971
- : { ...baseRegistrationConfig, typeRef: type };
972
- setViewElementMetadata(registrationConfig, type);
973
- };
974
- }
975
-
1121
+ const crtInputPrefix = 'crtInput:';
976
1122
  /**
977
- * @public
978
- * @description CrtModule decorator is a 'container' where user actually setup elements.
979
- * In could contain viewElements, definitions of other CrtModules.
980
- * @param moduleDefinition - {@link ModuleDefinition}
981
- *
982
- * @example
983
- * @CrtModule({
984
- * viewElements: [AppComponent],
985
- * requestHandlers: [SomeRequestHandler],
986
- * validators: [SomeValidator],
987
- * })
988
- * @NgModule({
989
- * declarations: [AppComponent],
990
- * imports: [BrowserModule],
991
- * providers: [],
992
- * })
993
- * export class AppModule {}
1123
+ * @internal
994
1124
  */
995
- function CrtModule(moduleDefinition) {
996
- return (type) => setModuleMetadata(moduleDefinition, type);
997
- }
998
-
999
- // noinspection ES6PreferShortImport
1125
+ const crtOutputPrefix = 'crtOutput:';
1000
1126
  /**
1001
1127
  * @internal
1002
1128
  */
1003
- // eslint-disable-next-line @typescript-eslint/naming-convention
1004
- function CrtInterfaceDesignerItem(config) {
1005
- function _applyTypeCaption() {
1006
- if (!config.typeCaption && config.toolbarConfig) {
1007
- const toolbarConfig = Array.isArray(config.toolbarConfig)
1008
- ? config.toolbarConfig[0]
1009
- : config.toolbarConfig;
1010
- config.typeCaption = toolbarConfig.caption;
1011
- }
1012
- }
1013
- return function (type) {
1014
- config.typeRef = type;
1015
- config.viewElementGroupType ?? (config.viewElementGroupType = ViewElementGroupType.CustomElements);
1016
- _applyTypeCaption();
1017
- setInterfaceDesignerItemMetadata(config, type);
1018
- };
1019
- }
1020
-
1129
+ const crtValidationInputPrefix = 'crtValidationInput:';
1021
1130
  /**
1022
- * @public
1023
- * @description
1024
- * Constructor parameter decorator.
1025
- * Mark parameter as dependency that should be obtained by token.
1026
- * @param token - token by which the dependency instance will be obtained
1027
- * @example
1028
- * class MyHandler {
1029
- * constructor(@CrtInject(USER_NAME_TOKEN) userName: string) {}
1030
- * }
1131
+ * @internal
1031
1132
  */
1032
- function CrtInject(token) {
1033
- return function (target, paramKey, paramIndex) {
1034
- Reflect.defineMetadata(crtInjectPrefix + paramIndex, token, target);
1035
- };
1036
- }
1133
+ const crtInjectPrefix = 'crtInject:';
1037
1134
 
1038
1135
  /**
1039
1136
  * @internal
1040
1137
  */
1041
- // eslint-disable-next-line @typescript-eslint/naming-convention
1042
- function CrtValidator(config) {
1043
- if (!config) {
1044
- return (type) => { };
1138
+ function objectDeepKeys(obj) {
1139
+ if (obj === null || typeof obj !== 'object') {
1140
+ return [];
1045
1141
  }
1046
- return function (type) {
1047
- checkTypeNameFormat(config.type, 'ValidatorTypeName');
1048
- const registrationConfig = {
1049
- ...config,
1050
- typeRef: type,
1051
- };
1052
- setValidatorMetadata(registrationConfig, type);
1053
- };
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]));
1054
1146
  }
1055
1147
 
1056
1148
  /**
1057
1149
  * @internal
1058
1150
  */
1059
- // eslint-disable-next-line @typescript-eslint/naming-convention
1060
- function CrtRequestHandler(config) {
1061
- if (!config) {
1062
- return (type) => { };
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}"`);
1063
1155
  }
1064
- return function (type) {
1065
- checkTypeNameFormat(config.type, 'RequestHandlerTypeName');
1066
- checkCrtTypeNamePascalCase(config.type);
1067
- setRequestHandlerMetadata(config, type);
1068
- };
1069
1156
  }
1070
-
1071
1157
  /**
1072
1158
  * @internal
1073
1159
  */
1074
- class NextHandlerAlreadySpecifiedException extends Error {
1075
- constructor() {
1076
- super('Next handler already specified');
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');
1077
1165
  }
1078
1166
  }
1079
-
1080
- class ArgumentEmptyException extends Error {
1081
- // region Constructors: Public
1082
- constructor(argumentName) {
1083
- super(`Argument with name '${argumentName}' is empty.`);
1167
+ /**
1168
+ * @internal
1169
+ */
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');
1084
1175
  }
1085
1176
  }
1086
-
1087
- class ArgumentOutOfRangeException extends Error {
1088
- // region Constructors: Public
1089
- constructor(argumentName) {
1090
- super(`Argument with name '${argumentName}' is out of range.`);
1091
- }
1177
+ /**
1178
+ * @internal
1179
+ */
1180
+ function toPascalCase(source) {
1181
+ return upperFirst(camelCase(source));
1092
1182
  }
1093
-
1094
- class ItemNotFoundException extends Error {
1095
- // region Constructors: Public
1096
- constructor(key) {
1097
- super(`Item with key '${key}' does not exist.`);
1183
+ /**
1184
+ * @internal
1185
+ */
1186
+ function checkIfTypeRegistered(type, item) {
1187
+ if (!item) {
1188
+ throw new Error(`Error when resolve ${type}. Type was not registered.`);
1098
1189
  }
1099
1190
  }
1100
-
1101
- class ValidationUtilities {
1102
- // region Methods: Public
1103
- static checkArgumentEmpty(argumentName, argumentValue) {
1104
- if (argumentValue === undefined || argumentValue === null) {
1105
- throw new ArgumentEmptyException(argumentName);
1106
- }
1107
- }
1108
- static checkArrayEmpty(argumentName, argumentValue) {
1109
- ValidationUtilities.checkArgumentEmpty(argumentName, argumentValue);
1110
- if (argumentValue.length === 0) {
1111
- throw new ArgumentEmptyException(argumentName);
1112
- }
1113
- }
1114
- static checkStringIsNotEmpty(argumentName, argumentValue) {
1115
- this.checkArgumentEmpty(argumentName, argumentValue);
1116
- if (argumentValue === '') {
1117
- throw new ArgumentEmptyException(argumentName);
1118
- }
1119
- return argumentValue;
1120
- }
1121
- static checkArgumentOutOfRange(argumentName, argumentValue, range) {
1122
- if (range.begin && argumentValue < range.begin) {
1123
- throw new ArgumentOutOfRangeException(argumentName);
1124
- }
1125
- if (range.end && argumentValue > range.end) {
1126
- throw new ArgumentOutOfRangeException(argumentName);
1127
- }
1191
+ /**
1192
+ * @internal
1193
+ */
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`);
1128
1197
  }
1129
1198
  }
1130
1199
 
1131
1200
  /**
1132
1201
  * @internal
1133
1202
  */
1134
- class InternalHandlerChain {
1135
- constructor() {
1136
- this._handlers = [];
1137
- this._handlersCache = new Map();
1138
- this.handlerChain$ = {
1139
- process: async (request) => {
1140
- const handler = this._getHandler(request);
1141
- return handler?.handle(request);
1142
- },
1143
- register: (info) => {
1144
- this._handlersCache.delete(info.requestType);
1145
- this._handlers.push(info);
1146
- return () => {
1147
- const index = this._handlers.indexOf(info);
1148
- if (index > -1) {
1149
- this._handlers.splice(index, 1);
1150
- this._handlersCache.delete(info.requestType);
1151
- }
1152
- else {
1153
- console.warn(`${info?.requestType} not found to unsubscribe`);
1154
- }
1155
- };
1156
- },
1157
- };
1158
- }
1159
- _getHandler(request) {
1160
- return this._hasCacheHandler(request) ? this._getCacheHandler(request) : this._buildHandlersChain(request);
1161
- }
1162
- _getCacheHandler(request) {
1163
- const map = this._handlersCache.get(request.type);
1164
- const key = this._getCacheScopesKey(request.scopes);
1165
- return map.get(key);
1166
- }
1167
- _hasCacheHandler(request) {
1168
- const map = this._handlersCache.get(request.type);
1169
- const key = this._getCacheScopesKey(request.scopes);
1170
- return map && map.has(key);
1171
- }
1172
- _getCacheScopesKey(scopes) {
1173
- return (scopes || ['']).join('_');
1174
- }
1175
- _setCacheHandler(request, handler) {
1176
- const map = this._handlersCache.has(request.type)
1177
- ? this._handlersCache.get(request.type)
1178
- : new Map();
1179
- const key = this._getCacheScopesKey(request.scopes);
1180
- map.set(key, handler);
1181
- this._handlersCache.set(request.type, map);
1182
- }
1183
- _isRequestHandler(handler) {
1184
- return (typeof handler.handle === 'function' &&
1185
- typeof handler.setNext === 'function');
1203
+ class InternalRequestHandlerRegistryType {
1204
+ static get requestHandlersMap() {
1205
+ return this._requestHandlersMap;
1186
1206
  }
1187
- _checkHandlerInstanceOf(handler) {
1188
- if (!this._isRequestHandler(handler)) {
1189
- throw new Error('Handler should implement "BaseRequestHandler"');
1190
- }
1207
+ static onAddRequestHandler(handler) {
1208
+ this._addItemListeners.push(handler);
1209
+ return () => {
1210
+ this._addItemListeners.splice(this._addItemListeners.indexOf(handler), 1);
1211
+ };
1191
1212
  }
1192
- _buildHandlersChain(request) {
1193
- const handlers = this._handlers.filter((h) => {
1194
- if (h.requestType !== request.type) {
1195
- return false;
1196
- }
1197
- if (!h.scopes?.length) {
1198
- return true;
1199
- }
1200
- return h.scopes.some((s) => request.scopes?.includes(s));
1201
- });
1202
- const comparer = new HandlersOrderComparer(request);
1203
- handlers.sort((a, b) => comparer.compare(a, b));
1204
- const handlerInstances = handlers.map((handlerConfig) => handlerConfig.createHandler());
1205
- handlerInstances.forEach((handler) => this._checkHandlerInstanceOf(handler));
1206
- this._joinHandlersInChain(handlerInstances);
1207
- const result = handlerInstances[0];
1208
- this._setCacheHandler(request, result);
1209
- return result;
1213
+ static onRemoveRequestHandler(handler) {
1214
+ this._removeItemListeners.push(handler);
1215
+ return () => {
1216
+ this._removeItemListeners.splice(this._removeItemListeners.indexOf(handler), 1);
1217
+ };
1210
1218
  }
1211
- _joinHandlersInChain(handlers) {
1212
- for (let index = 0; index < handlers.length - 1; index++) {
1213
- try {
1214
- handlers[index].setNext(handlers[index + 1]);
1215
- }
1216
- catch (error) {
1217
- if (error instanceof NextHandlerAlreadySpecifiedException) {
1218
- throw new Error('Handler factory should return new instance of ' +
1219
- 'BaseRequestHandler class or its subclass ' +
1220
- '(next handler should not be specified)');
1221
- }
1222
- throw error;
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);
1223
1224
  }
1224
1225
  }
1225
1226
  }
1226
- }
1227
-
1228
- const global = window;
1229
- /**
1230
- * @public
1231
- * @class HandlerChainService
1232
- * @classdesc Service to design handlers in chain.
1233
- */
1234
- class HandlerChainService {
1235
- constructor() {
1236
- if (!this._chain) {
1237
- this._createGlobalHandlerChain();
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
+ }
1238
1234
  }
1239
1235
  }
1240
- get _chain() {
1241
- return global.handlerChain;
1242
- }
1243
- set _chain(value) {
1244
- global.handlerChain = value;
1245
- }
1246
- static get instance() {
1247
- return HandlerChainService._instance || (HandlerChainService._instance = new HandlerChainService());
1248
- }
1249
- _createGlobalHandlerChain() {
1250
- this._chain = new InternalHandlerChain();
1251
- }
1252
- /**
1253
- * @internal
1254
- */
1255
- register(handlerConfig) {
1256
- return this._chain.handlerChain$.register(handlerConfig);
1257
- }
1258
- /**
1259
- * @description Method to process passed request
1260
- * @param request - {@link BaseRequest}
1261
- * @return `Promise<unknown>`
1262
- */
1263
- process(request) {
1264
- return this._chain.handlerChain$.process(request);
1265
- }
1266
1236
  }
1267
-
1268
- /**
1269
- * @internal
1270
- */
1271
- // eslint-disable-next-line @typescript-eslint/naming-convention
1272
- function ImplementUsingHandlerChain(config) {
1273
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1274
- return function (target, method, descriptor) {
1275
- const methodImplementation = function (...args) {
1276
- return HandlerChainService.instance.process({
1277
- type: config?.requestType ? config.requestType : this.requestType,
1278
- method: config?.methodName ? config.methodName : method,
1279
- args,
1280
- });
1281
- };
1282
- if (descriptor) {
1283
- descriptor.value = methodImplementation;
1284
- }
1285
- else {
1286
- target[method] = methodImplementation;
1287
- }
1288
- };
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
+ });
1289
1247
  }
1290
-
1291
1248
  /**
1292
1249
  * @internal
1293
1250
  */
1294
1251
  // eslint-disable-next-line @typescript-eslint/naming-convention
1295
- function CrtConverter(name) {
1296
- return function (type) {
1297
- GlobalConvertersRegistryService.register(name, type);
1298
- };
1299
- }
1300
-
1252
+ const InternalRequestHandlerRegistry = InternalRequestHandlerRegistryType;
1301
1253
  /**
1302
1254
  * @internal
1303
1255
  */
1304
- function CrtDesignTimeViewElement(config) {
1305
- return function (type) {
1306
- const registrationConfig = {
1307
- ...config,
1308
- 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,
1309
1271
  };
1310
- setDesignTimeViewElementMetadata(registrationConfig, type);
1311
- };
1272
+ RequestHandlerRegistryService._internalRegistry.addRequestHandler(requestHandlerType, requestHandlerMapValue);
1273
+ }
1312
1274
  }
1275
+ RequestHandlerRegistryService._internalRegistry = global$3.creatio.requestHandlerRegistry;
1313
1276
 
1314
1277
  /**
1315
1278
  * @internal
1316
1279
  */
1317
- // eslint-disable-next-line @typescript-eslint/naming-convention
1318
- function CrtRequest(config) {
1319
- return function (type) {
1320
- checkTypeNameFormat(config.type, 'RequestTypeName');
1321
- checkCrtTypeNamePascalCase(config.type);
1322
- RequestRegistryService.register(config, type);
1323
- };
1324
- }
1325
-
1326
- var DataValueType;
1327
- (function (DataValueType) {
1328
- DataValueType[DataValueType["Guid"] = 0] = "Guid";
1329
- DataValueType[DataValueType["Text"] = 1] = "Text";
1330
- DataValueType[DataValueType["Integer"] = 4] = "Integer";
1331
- DataValueType[DataValueType["Float"] = 5] = "Float";
1332
- DataValueType[DataValueType["Money"] = 6] = "Money";
1333
- DataValueType[DataValueType["DateTime"] = 7] = "DateTime";
1334
- DataValueType[DataValueType["Date"] = 8] = "Date";
1335
- DataValueType[DataValueType["Time"] = 9] = "Time";
1336
- DataValueType[DataValueType["Lookup"] = 10] = "Lookup";
1337
- DataValueType[DataValueType["Enum"] = 11] = "Enum";
1338
- DataValueType[DataValueType["Boolean"] = 12] = "Boolean";
1339
- DataValueType[DataValueType["Blob"] = 13] = "Blob";
1340
- DataValueType[DataValueType["Image"] = 14] = "Image";
1341
- DataValueType[DataValueType["CUSTOM_OBJECT"] = 15] = "CUSTOM_OBJECT";
1342
- DataValueType[DataValueType["IMAGELOOKUP"] = 16] = "IMAGELOOKUP";
1343
- DataValueType[DataValueType["COLLECTION"] = 17] = "COLLECTION";
1344
- DataValueType[DataValueType["Color"] = 18] = "Color";
1345
- DataValueType[DataValueType["LOCALIZABLE_STRING"] = 19] = "LOCALIZABLE_STRING";
1346
- DataValueType[DataValueType["ENTITY"] = 20] = "ENTITY";
1347
- DataValueType[DataValueType["ENTITY_COLLECTION"] = 21] = "ENTITY_COLLECTION";
1348
- DataValueType[DataValueType["ENTITY_COLUMN_MAPPING_COLLECTION"] = 22] = "ENTITY_COLUMN_MAPPING_COLLECTION";
1349
- DataValueType[DataValueType["HASH_TEXT"] = 23] = "HASH_TEXT";
1350
- DataValueType[DataValueType["SECURE_TEXT"] = 24] = "SECURE_TEXT";
1351
- DataValueType[DataValueType["FILE"] = 25] = "FILE";
1352
- DataValueType[DataValueType["MAPPING"] = 26] = "MAPPING";
1353
- DataValueType[DataValueType["SHORT_TEXT"] = 27] = "SHORT_TEXT";
1354
- DataValueType[DataValueType["MEDIUM_TEXT"] = 28] = "MEDIUM_TEXT";
1355
- DataValueType[DataValueType["MAXSIZE_TEXT"] = 29] = "MAXSIZE_TEXT";
1356
- DataValueType[DataValueType["LONG_TEXT"] = 30] = "LONG_TEXT";
1357
- DataValueType[DataValueType["FLOAT1"] = 31] = "FLOAT1";
1358
- DataValueType[DataValueType["FLOAT2"] = 32] = "FLOAT2";
1359
- DataValueType[DataValueType["FLOAT3"] = 33] = "FLOAT3";
1360
- DataValueType[DataValueType["FLOAT4"] = 34] = "FLOAT4";
1361
- DataValueType[DataValueType["LOCALIZABLE_PARAMETER_VALUES_LIST"] = 35] = "LOCALIZABLE_PARAMETER_VALUES_LIST";
1362
- DataValueType[DataValueType["METADATA_TEXT"] = 36] = "METADATA_TEXT";
1363
- DataValueType[DataValueType["STAGE_INDICATOR"] = 37] = "STAGE_INDICATOR";
1364
- DataValueType[DataValueType["OBJECT_LIST"] = 38] = "OBJECT_LIST";
1365
- DataValueType[DataValueType["COMPOSITE_OBJECT_LIST"] = 39] = "COMPOSITE_OBJECT_LIST";
1366
- DataValueType[DataValueType["FLOAT8"] = 40] = "FLOAT8";
1367
- DataValueType[DataValueType["FILE_LOCATOR"] = 41] = "FILE_LOCATOR";
1368
- DataValueType[DataValueType["PHONE_TEXT"] = 42] = "PHONE_TEXT";
1369
- DataValueType[DataValueType["RICH_TEXT"] = 43] = "RICH_TEXT";
1370
- DataValueType[DataValueType["WEB_TEXT"] = 44] = "WEB_TEXT";
1371
- DataValueType[DataValueType["EMAIL_TEXT"] = 45] = "EMAIL_TEXT";
1372
- })(DataValueType || (DataValueType = {}));
1373
-
1374
- var AggregationType;
1375
- (function (AggregationType) {
1376
- /** Aggregation function type not defined. */
1377
- AggregationType[AggregationType["None"] = 0] = "None";
1378
- /** Aggregation function type not defined. */
1379
- AggregationType[AggregationType["Count"] = 1] = "Count";
1380
- /** Sum of values of all elements. */
1381
- AggregationType[AggregationType["Sum"] = 2] = "Sum";
1382
- /** Average value for all elements. */
1383
- AggregationType[AggregationType["Avg"] = 3] = "Avg";
1384
- /** The minimum value among all elements. */
1385
- AggregationType[AggregationType["Min"] = 4] = "Min";
1386
- /** The maximum value among all elements. */
1387
- AggregationType[AggregationType["Max"] = 5] = "Max";
1388
- /** Top one record from collection. */
1389
- AggregationType[AggregationType["TopOne"] = 6] = "TopOne";
1390
- })(AggregationType || (AggregationType = {}));
1391
-
1392
- var AggregationFunction;
1393
- (function (AggregationFunction) {
1394
- /** Aggregation function type not defined. */
1395
- AggregationFunction["None"] = "";
1396
- /** Aggregation function type not defined. */
1397
- AggregationFunction["Count"] = "Count";
1398
- /** Sum of values of all elements. */
1399
- AggregationFunction["Sum"] = "Sum";
1400
- /** Average value for all elements. */
1401
- AggregationFunction["Avg"] = "Avg";
1402
- /** The minimum value among all elements. */
1403
- AggregationFunction["Min"] = "Min";
1404
- /** The maximum value among all elements. */
1405
- AggregationFunction["Max"] = "Max";
1406
- /** Top one record from collection. */
1407
- AggregationFunction["TopOne"] = "TopOne";
1408
- })(AggregationFunction || (AggregationFunction = {}));
1409
-
1410
- var LogicalOperatorType;
1411
- (function (LogicalOperatorType) {
1412
- LogicalOperatorType[LogicalOperatorType["And"] = 0] = "And";
1413
- LogicalOperatorType[LogicalOperatorType["Or"] = 1] = "Or";
1414
- })(LogicalOperatorType || (LogicalOperatorType = {}));
1415
-
1416
- var AggregationEvalType;
1417
- (function (AggregationEvalType) {
1418
- /** The scope of the aggregating function is not defined. */
1419
- AggregationEvalType[AggregationEvalType["None"] = 0] = "None";
1420
- /** Applies to all elements. */
1421
- AggregationEvalType[AggregationEvalType["All"] = 1] = "All";
1422
- /** Applies to unique values. */
1423
- AggregationEvalType[AggregationEvalType["Distinct"] = 2] = "Distinct";
1424
- })(AggregationEvalType || (AggregationEvalType = {}));
1425
-
1426
- var ArithmeticOperation;
1427
- (function (ArithmeticOperation) {
1428
- /** Addition. */
1429
- ArithmeticOperation[ArithmeticOperation["Addition"] = 0] = "Addition";
1430
- /** Subtraction. */
1431
- ArithmeticOperation[ArithmeticOperation["Subtraction"] = 1] = "Subtraction";
1432
- /** Multiplication. */
1433
- ArithmeticOperation[ArithmeticOperation["Multiplication"] = 2] = "Multiplication";
1434
- /** Division. */
1435
- ArithmeticOperation[ArithmeticOperation["Division"] = 3] = "Division";
1436
- })(ArithmeticOperation || (ArithmeticOperation = {}));
1437
-
1438
- var ComparisonType;
1439
- (function (ComparisonType) {
1440
- ComparisonType[ComparisonType["Between"] = 0] = "Between";
1441
- ComparisonType[ComparisonType["Contain"] = 11] = "Contain";
1442
- ComparisonType[ComparisonType["End_with"] = 13] = "End_with";
1443
- ComparisonType[ComparisonType["Equal"] = 3] = "Equal";
1444
- ComparisonType[ComparisonType["Exists"] = 15] = "Exists";
1445
- ComparisonType[ComparisonType["Greater"] = 7] = "Greater";
1446
- ComparisonType[ComparisonType["Greater_or_equal"] = 8] = "Greater_or_equal";
1447
- ComparisonType[ComparisonType["Is_not_null"] = 2] = "Is_not_null";
1448
- ComparisonType[ComparisonType["Is_null"] = 1] = "Is_null";
1449
- ComparisonType[ComparisonType["Less"] = 5] = "Less";
1450
- ComparisonType[ComparisonType["Less_or_equal"] = 6] = "Less_or_equal";
1451
- ComparisonType[ComparisonType["Not_contain"] = 12] = "Not_contain";
1452
- ComparisonType[ComparisonType["Not_end_with"] = 14] = "Not_end_with";
1453
- ComparisonType[ComparisonType["Not_equal"] = 4] = "Not_equal";
1454
- ComparisonType[ComparisonType["Not_exists"] = 16] = "Not_exists";
1455
- ComparisonType[ComparisonType["Not_start_with"] = 10] = "Not_start_with";
1456
- ComparisonType[ComparisonType["Start_with"] = 9] = "Start_with";
1457
- })(ComparisonType || (ComparisonType = {}));
1458
-
1459
- var DatePartType;
1460
- (function (DatePartType) {
1461
- /** Empty value. */
1462
- DatePartType[DatePartType["None"] = 0] = "None";
1463
- /** Day. */
1464
- DatePartType[DatePartType["Day"] = 1] = "Day";
1465
- /** Week. */
1466
- DatePartType[DatePartType["Week"] = 2] = "Week";
1467
- /** Month. */
1468
- DatePartType[DatePartType["Month"] = 3] = "Month";
1469
- /** Year. */
1470
- DatePartType[DatePartType["Year"] = 4] = "Year";
1471
- /** Day of the week. */
1472
- DatePartType[DatePartType["WeekDay"] = 5] = "WeekDay";
1473
- /** Hour. */
1474
- DatePartType[DatePartType["Hour"] = 6] = "Hour";
1475
- /** Minute. */
1476
- DatePartType[DatePartType["HourMinute"] = 7] = "HourMinute";
1477
- })(DatePartType || (DatePartType = {}));
1478
-
1479
- var ExpressionType;
1480
- (function (ExpressionType) {
1481
- ExpressionType[ExpressionType["SchemaColumn"] = 0] = "SchemaColumn";
1482
- ExpressionType[ExpressionType["Function"] = 1] = "Function";
1483
- ExpressionType[ExpressionType["Parameter"] = 2] = "Parameter";
1484
- ExpressionType[ExpressionType["SubQuery"] = 3] = "SubQuery";
1485
- ExpressionType[ExpressionType["ArithmeticOperation"] = 4] = "ArithmeticOperation";
1486
- })(ExpressionType || (ExpressionType = {}));
1487
-
1488
- var FilterType;
1489
- (function (FilterType) {
1490
- FilterType[FilterType["None"] = 0] = "None";
1491
- FilterType[FilterType["Compare"] = 1] = "Compare";
1492
- FilterType[FilterType["IsNull"] = 2] = "IsNull";
1493
- FilterType[FilterType["Between"] = 3] = "Between";
1494
- FilterType[FilterType["In"] = 4] = "In";
1495
- FilterType[FilterType["Exists"] = 5] = "Exists";
1496
- FilterType[FilterType["FilterGroup"] = 6] = "FilterGroup";
1497
- })(FilterType || (FilterType = {}));
1498
-
1499
- var FunctionType;
1500
- (function (FunctionType) {
1501
- FunctionType[FunctionType["None"] = 0] = "None";
1502
- /** Substitution by macro. */
1503
- FunctionType[FunctionType["Macros"] = 1] = "Macros";
1504
- /** Aggregating function. */
1505
- FunctionType[FunctionType["Aggregation"] = 2] = "Aggregation";
1506
- /** Date fragment. */
1507
- FunctionType[FunctionType["DatePart"] = 3] = "DatePart";
1508
- /** The size of the value in bytes, used for binary data. */
1509
- FunctionType[FunctionType["Length"] = 4] = "Length";
1510
- /** Window query function */
1511
- FunctionType[FunctionType["Window"] = 5] = "Window";
1512
- })(FunctionType || (FunctionType = {}));
1513
-
1514
- var OrderDirection;
1515
- (function (OrderDirection) {
1516
- OrderDirection[OrderDirection["None"] = 0] = "None";
1517
- OrderDirection[OrderDirection["Asc"] = 1] = "Asc";
1518
- OrderDirection[OrderDirection["Desc"] = 2] = "Desc";
1519
- })(OrderDirection || (OrderDirection = {}));
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();
1520
1308
 
1521
- var QueryMacrosType;
1522
- (function (QueryMacrosType) {
1523
- /** Macro type not defined. */
1524
- QueryMacrosType[QueryMacrosType["None"] = 0] = "None";
1525
- /** Current user. */
1526
- QueryMacrosType[QueryMacrosType["CurrentUser"] = 1] = "CurrentUser";
1527
- /** Current user contact. */
1528
- QueryMacrosType[QueryMacrosType["CurrentUserContact"] = 2] = "CurrentUserContact";
1529
- /** Yesterday. */
1530
- QueryMacrosType[QueryMacrosType["Yesterday"] = 3] = "Yesterday";
1531
- /** Today. */
1532
- QueryMacrosType[QueryMacrosType["Today"] = 4] = "Today";
1533
- /** Tomorrow. */
1534
- QueryMacrosType[QueryMacrosType["Tomorrow"] = 5] = "Tomorrow";
1535
- /** Previous week. */
1536
- QueryMacrosType[QueryMacrosType["PreviousWeek"] = 6] = "PreviousWeek";
1537
- /** This week. */
1538
- QueryMacrosType[QueryMacrosType["CurrentWeek"] = 7] = "CurrentWeek";
1539
- /** Next week. */
1540
- QueryMacrosType[QueryMacrosType["NextWeek"] = 8] = "NextWeek";
1541
- /** Previous month. */
1542
- QueryMacrosType[QueryMacrosType["PreviousMonth"] = 9] = "PreviousMonth";
1543
- /** Current month. */
1544
- QueryMacrosType[QueryMacrosType["CurrentMonth"] = 10] = "CurrentMonth";
1545
- /** Next month. */
1546
- QueryMacrosType[QueryMacrosType["NextMonth"] = 11] = "NextMonth";
1547
- /** Previous quarter. */
1548
- QueryMacrosType[QueryMacrosType["PreviousQuarter"] = 12] = "PreviousQuarter";
1549
- /** Current quarter. */
1550
- QueryMacrosType[QueryMacrosType["CurrentQuarter"] = 13] = "CurrentQuarter";
1551
- /** Next quarter. */
1552
- QueryMacrosType[QueryMacrosType["NextQuarter"] = 14] = "NextQuarter";
1553
- /** Previous half of the year. */
1554
- QueryMacrosType[QueryMacrosType["PreviousHalfYear"] = 15] = "PreviousHalfYear";
1555
- /** Current half-year. */
1556
- QueryMacrosType[QueryMacrosType["CurrentHalfYear"] = 16] = "CurrentHalfYear";
1557
- /** Next half-year. */
1558
- QueryMacrosType[QueryMacrosType["NextHalfYear"] = 17] = "NextHalfYear";
1559
- /** Last year. */
1560
- QueryMacrosType[QueryMacrosType["PreviousYear"] = 18] = "PreviousYear";
1561
- /** This year. */
1562
- QueryMacrosType[QueryMacrosType["CurrentYear"] = 19] = "CurrentYear";
1563
- /** Previous hour. */
1564
- QueryMacrosType[QueryMacrosType["PreviousHour"] = 20] = "PreviousHour";
1565
- /** Current hour. */
1566
- QueryMacrosType[QueryMacrosType["CurrentHour"] = 21] = "CurrentHour";
1567
- /** Next hour. */
1568
- QueryMacrosType[QueryMacrosType["NextHour"] = 22] = "NextHour";
1569
- /** Next year. */
1570
- QueryMacrosType[QueryMacrosType["NextYear"] = 23] = "NextYear";
1571
- /** Next N Days. */
1572
- QueryMacrosType[QueryMacrosType["NextNDays"] = 24] = "NextNDays";
1573
- /** Previous N days. */
1574
- QueryMacrosType[QueryMacrosType["PreviousNDays"] = 25] = "PreviousNDays";
1575
- /** Next N hours. */
1576
- QueryMacrosType[QueryMacrosType["NextNHours"] = 26] = "NextNHours";
1577
- /** Previous N hours. */
1578
- QueryMacrosType[QueryMacrosType["PreviousNHours"] = 27] = "PreviousNHours";
1579
- /** Primary column. */
1580
- QueryMacrosType[QueryMacrosType["PrimaryColumn"] = 34] = "PrimaryColumn";
1581
- /** Primary displayed column. */
1582
- QueryMacrosType[QueryMacrosType["PrimaryDisplayColumn"] = 35] = "PrimaryDisplayColumn";
1583
- /** Primary image display column. */
1584
- QueryMacrosType[QueryMacrosType["PrimaryImageColumn"] = 36] = "PrimaryImageColumn";
1585
- /** Anniversary today. */
1586
- QueryMacrosType[QueryMacrosType["DayOfYearToday"] = 37] = "DayOfYearToday";
1587
- /** Anniversary on the date computed as today plus days offset. */
1588
- QueryMacrosType[QueryMacrosType["DayOfYearTodayPlusDaysOffset"] = 38] = "DayOfYearTodayPlusDaysOffset";
1589
- /** Anniversary on the next several days. */
1590
- QueryMacrosType[QueryMacrosType["NextNDaysOfYear"] = 39] = "NextNDaysOfYear";
1591
- /** Anniversary on the previous several days. */
1592
- QueryMacrosType[QueryMacrosType["PreviousNDaysOfYear"] = 40] = "PreviousNDaysOfYear";
1593
- /** Primary color display column. */
1594
- QueryMacrosType[QueryMacrosType["PrimaryColorColumn"] = 41] = "PrimaryColorColumn";
1595
- })(QueryMacrosType || (QueryMacrosType = {}));
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.';
1596
1332
 
1597
- class BaseExpression {
1598
- constructor(config) {
1599
- this.isBlock = false;
1600
- this.isBlock = config?.isBlock;
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();
1601
1351
  }
1602
1352
  }
1353
+ ConverterRegistry.registryKey = 'ConverterRegistry';
1603
1354
 
1604
- class ArithmeticExpression extends BaseExpression {
1605
- constructor(config) {
1606
- super(config);
1607
- this.expressionType = ExpressionType.ArithmeticOperation;
1608
- this.arithmeticOperation = config?.arithmeticOperation;
1609
- this.leftArithmeticOperand = config?.leftArithmeticOperand.clone();
1610
- this.rightArithmeticOperand = config?.rightArithmeticOperand.clone();
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);
1611
1366
  }
1612
- clone() {
1613
- return new ArithmeticExpression(this);
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;
1614
1376
  }
1615
1377
  }
1378
+ ViewElementRegistry.registryKey = viewElementRegistryKey;
1616
1379
 
1617
- class ColumnExpression extends BaseExpression {
1618
- constructor(config) {
1619
- super(config);
1620
- this.expressionType = ExpressionType.SchemaColumn;
1621
- this.columnPath = config?.columnPath;
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);
1622
1392
  }
1623
- clone() {
1624
- return new ColumnExpression(this);
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);
1625
1401
  }
1626
1402
  }
1403
+ InterfaceDesignerItemRegistry.registryKey = interfaceDesignerItemRegistryKey;
1627
1404
 
1628
- class FunctionExpression extends BaseExpression {
1629
- constructor(config) {
1630
- super(config);
1631
- this.expressionType = ExpressionType.Function;
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
+ };
1632
1429
  }
1633
1430
  }
1634
1431
 
1635
- class ArgumentFunctionExpression extends FunctionExpression {
1636
- constructor(config) {
1637
- super(config);
1638
- this.functionArgument = config?.functionArgument.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
+ }
1445
+ }
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;
1639
1452
  }
1640
1453
  }
1454
+ HandlerChainServicesRegistry.registryKey = 'HandlerChainServicesRegistry';
1641
1455
 
1642
- class AggregationFunctionExpression extends ArgumentFunctionExpression {
1643
- constructor(config) {
1644
- super(config);
1645
- this.functionType = FunctionType.Aggregation;
1646
- this.aggregationType = config?.aggregationType;
1647
- this.aggregationEvalType = config?.aggregationEvalType;
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);
1468
+ }
1469
+ static register(config) {
1470
+ this.infos.set(config.type, config);
1471
+ }
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;
1648
1478
  }
1649
- clone() {
1650
- return new AggregationFunctionExpression(this);
1479
+ static get infos() {
1480
+ return this.store.typeInfos;
1651
1481
  }
1652
1482
  }
1483
+ DesignTimeViewElementRegistry.registryKey = designTimeViewElementRegistryKey;
1653
1484
 
1654
- class DatePartFunctionExpression extends ArgumentFunctionExpression {
1655
- constructor(config) {
1656
- super(config);
1657
- this.functionType = FunctionType.DatePart;
1658
- this.datePartType = config?.datePartType;
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;
1659
1500
  }
1660
- clone() {
1661
- return new DatePartFunctionExpression(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
+ }
1662
1506
  }
1663
- }
1664
-
1665
- class LengthFunctionExpression extends ArgumentFunctionExpression {
1666
- constructor(config) {
1667
- super(config);
1668
- this.functionType = FunctionType.Length;
1507
+ static get items() {
1508
+ return this.store.typeInfos;
1669
1509
  }
1670
- clone() {
1671
- return new LengthFunctionExpression(this);
1510
+ static register(config) {
1511
+ this.items.set(config.type, config);
1672
1512
  }
1673
1513
  }
1514
+ ValidatorRegistry.registryKey = validatorRegistryKey;
1674
1515
 
1675
- class MacrosFunctionExpression extends FunctionExpression {
1676
- constructor(config) {
1677
- super(config);
1678
- this.functionType = FunctionType.Macros;
1679
- this.macrosType = config?.macrosType;
1516
+ /**
1517
+ * @internal
1518
+ */
1519
+ class PkgTopology extends BaseRegistry {
1520
+ static get items() {
1521
+ return this.store.typeInfos;
1680
1522
  }
1681
- clone() {
1682
- return new MacrosFunctionExpression(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;
1683
1529
  }
1684
1530
  }
1531
+ PkgTopology.registryKey = 'pkgTopology';
1685
1532
 
1686
- class WindowFunctionExpression extends ArgumentFunctionExpression {
1687
- constructor(config) {
1688
- super(config);
1689
- this.functionType = FunctionType.Window;
1533
+ /**
1534
+ * @internal
1535
+ * @dontChange
1536
+ */
1537
+ class RemoteEntriesRegistry extends BaseRegistry {
1538
+ /**
1539
+ * @dontChange
1540
+ */
1541
+ static get items() {
1542
+ return this.store.typeInfos;
1690
1543
  }
1691
- clone() {
1692
- return new WindowFunctionExpression(this);
1544
+ }
1545
+ /**
1546
+ * @dontChange
1547
+ */
1548
+ RemoteEntriesRegistry.registryKey = 'remotes';
1549
+
1550
+ /**
1551
+ * @internal
1552
+ */
1553
+ function isComponentPropertyBindable(viewConfigType, componentProperty) {
1554
+ const componentConfig = ViewElementRegistry.viewElements.get(viewConfigType);
1555
+ if (!componentConfig?.inputs) {
1556
+ return false;
1693
1557
  }
1558
+ return !!componentConfig?.inputs[componentProperty]?.propertyBindable;
1694
1559
  }
1695
1560
 
1696
- class ParameterExpression extends BaseExpression {
1697
- constructor(config) {
1698
- super(config);
1699
- this.expressionType = ExpressionType.Parameter;
1700
- const value = config?.value;
1701
- if (value instanceof Date) {
1702
- const cloneDate = new Date();
1703
- cloneDate.setTime(value.getTime());
1704
- this.value = cloneDate;
1705
- }
1706
- else if (!value) {
1707
- this.value = value;
1708
- }
1709
- else {
1710
- this.value = typeof value === 'object' ? { ...value } : value;
1711
- }
1712
- 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);
1713
1657
  }
1714
- get parameter() {
1715
- return {
1716
- dataValueType: this.dataValueType,
1717
- ...this._getParameterValueMetadata(),
1718
- };
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);
1719
1664
  }
1720
- _convertStringToBlobArray(str) {
1721
- const out = [];
1722
- let position = 0;
1723
- for (let i = 0; i < str.length; i++) {
1724
- const code = str.charCodeAt(i);
1725
- if (code < 128) {
1726
- out[position++] = String.fromCharCode(code);
1727
- }
1728
- else if (code < 2048) {
1729
- /* eslint-disable no-bitwise */
1730
- out[position++] = String.fromCharCode((code >> 6) | 192);
1731
- out[position++] = String.fromCharCode((code & 63) | 128);
1732
- }
1733
- else {
1734
- out[position++] = String.fromCharCode((code >> 12) | 224);
1735
- out[position++] = String.fromCharCode(((code >> 6) & 63) | 128);
1736
- out[position++] = String.fromCharCode((code & 63) | 128);
1737
- /* eslint-enable no-bitwise */
1738
- }
1665
+ _getOrderByPkgTopology(handler) {
1666
+ if (handler.source.type === HandlerSourceType.Host) {
1667
+ return Number.MAX_VALUE;
1739
1668
  }
1740
- return out;
1669
+ return PkgTopology.get(handler.source.packageName);
1741
1670
  }
1742
- _getParameterValueMetadata() {
1743
- if (this.dataValueType === DataValueType.Blob) {
1744
- return {
1745
- arrayValue: !this.value ? [] : this._convertStringToBlobArray(this.value),
1746
- };
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;
1747
1677
  }
1748
- else {
1749
- return {
1750
- value: this.value,
1751
- };
1678
+ const aPkgTopologyOrder = this._getOrderByPkgTopology(a);
1679
+ const bPkgTopologyOrder = this._getOrderByPkgTopology(b);
1680
+ diff = aPkgTopologyOrder - bPkgTopologyOrder;
1681
+ if (diff) {
1682
+ return diff;
1752
1683
  }
1753
- }
1754
- clone() {
1755
- return new ParameterExpression(this);
1684
+ diff = a.source.type - b.source.type;
1685
+ return diff;
1756
1686
  }
1757
1687
  }
1758
- __decorate([
1759
- Exclude(),
1760
- __metadata("design:type", Object)
1761
- ], ParameterExpression.prototype, "value", void 0);
1762
- __decorate([
1763
- Exclude(),
1764
- __metadata("design:type", Number)
1765
- ], ParameterExpression.prototype, "dataValueType", void 0);
1766
- __decorate([
1767
- Expose(),
1768
- __metadata("design:type", Object),
1769
- __metadata("design:paramtypes", [])
1770
- ], ParameterExpression.prototype, "parameter", null);
1771
1688
 
1772
- class SubQueryExpression extends BaseExpression {
1773
- constructor(config) {
1774
- super(config);
1775
- this.expressionType = ExpressionType.SubQuery;
1776
- this.columnPath = config?.columnPath;
1777
- const subFilter = config?.subFilters;
1778
- this.subFilters = typeof subFilter?.clone === 'function' ? subFilter.clone() : subFilter;
1779
- this.subOrderDirection = config.subOrderDirection;
1780
- this.subOrderColumn = config.subOrderColumn;
1781
- }
1782
- clone() {
1783
- return new SubQueryExpression(this);
1784
- }
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);
1785
1701
  }
1786
-
1787
- class AggregationSubQueryExpression extends SubQueryExpression {
1788
- constructor(config) {
1789
- super(config);
1790
- this.aggregationType = config?.aggregationType;
1791
- }
1792
- clone() {
1793
- 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`);
1794
1709
  }
1710
+ return metadata;
1795
1711
  }
1796
-
1797
- const EXPRESSION_TYPE_MOCK = -1;
1798
- class ExpressionMock extends BaseExpression {
1799
- constructor(config) {
1800
- super(config || {});
1801
- this.expressionType = EXPRESSION_TYPE_MOCK;
1802
- }
1803
- // eslint-disable-next-line @typescript-eslint/ban-types
1804
- get plainObject() {
1805
- return classToPlain(this, { exposeUnsetFields: false, excludePrefixes: ['_'] });
1806
- }
1807
- clone() {
1808
- return new ExpressionMock(this);
1809
- }
1712
+ /**
1713
+ * @internal
1714
+ */
1715
+ function setViewElementMetadata(metadata, type) {
1716
+ Reflect.defineMetadata(viewElementMetadataKey, metadata, type);
1810
1717
  }
1811
-
1812
- class BaseFilter {
1813
- constructor(filterType) {
1814
- this.isEnabled = true;
1815
- this.trimDateTimeParameterToDate = false;
1816
- 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`);
1817
1725
  }
1726
+ return metadata;
1818
1727
  }
1819
-
1820
- class FilterMock extends BaseFilter {
1821
- constructor(filterType = FilterType.None) {
1822
- 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`);
1823
1741
  }
1824
- // eslint-disable-next-line @typescript-eslint/ban-types
1825
- get plainObject() {
1826
- 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`);
1827
1757
  }
1828
- clone() {
1829
- 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`);
1830
1773
  }
1774
+ return metadata;
1831
1775
  }
1832
-
1833
- class SingleFilter extends BaseFilter {
1834
- constructor(filterType, comparisonType, leftExpression) {
1835
- super(filterType);
1836
- this.comparisonType = comparisonType;
1837
- 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`);
1838
1789
  }
1790
+ return metadata;
1839
1791
  }
1840
-
1841
- class CompareFilter extends SingleFilter {
1842
- constructor(comparisonType, leftExpression, rightExpression) {
1843
- super(FilterType.Compare, comparisonType, leftExpression);
1844
- 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`);
1845
1811
  }
1846
- clone() {
1847
- 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`);
1848
1821
  }
1822
+ return { requestType, typeRef };
1849
1823
  }
1850
-
1851
1824
  /**
1852
- * Empty Guid constant.
1853
1825
  * @internal
1854
1826
  */
1855
- const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
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
+ }));
1834
+ }
1835
+ /**
1836
+ * @internal
1837
+ */
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
+ }
1846
+ /**
1847
+ * @internal
1848
+ */
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
+ }
1857
+ /**
1858
+ * @internal
1859
+ */
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
+ }));
1868
+ }
1869
+ /**
1870
+ * @internal
1871
+ */
1872
+ function getParentType(type) {
1873
+ const parentProto = type.prototype ? Object.getPrototypeOf(type.prototype) : null;
1874
+ return parentProto ? parentProto.constructor : null;
1875
+ }
1856
1876
  /**
1857
- * Regular expression for Guid validation.
1858
1877
  * @internal
1859
1878
  */
1860
- 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');
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;
1893
+ }
1894
+
1861
1895
  /**
1862
- * Generates guid part.
1863
- * @param length Part length.
1864
1896
  * @internal
1865
1897
  */
1866
- function generateGuidPart(length) {
1867
- let out = '';
1868
- for (let i = 0; i < length; i++) {
1869
- // eslint-disable-next-line no-bitwise
1870
- out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
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);
1871
1907
  }
1872
- return out;
1908
+ return new type();
1873
1909
  }
1910
+
1874
1911
  /**
1875
- * Generates new Guid.
1876
- * @internal
1912
+ * @public
1877
1913
  */
1878
- function generateGuid() {
1879
- return [
1880
- generateGuidPart(2),
1881
- generateGuidPart(1),
1882
- generateGuidPart(1),
1883
- generateGuidPart(1),
1884
- generateGuidPart(3),
1885
- ].join('-');
1914
+ class CrtInputRegistrationConfig {
1886
1915
  }
1916
+
1887
1917
  /**
1888
- * Checks if value is Guid.
1889
- * @param value Value for check.
1890
- * @internal
1918
+ * @public
1919
+ * @class BaseRequest
1920
+ * @describe Base definition of request.
1921
+ * @template TEvent
1891
1922
  */
1892
- function isGuid(value) {
1893
- return Boolean(value) && validator.test(value);
1923
+ class BaseRequest {
1894
1924
  }
1925
+
1895
1926
  /**
1896
- * Checks if Guid is empty value or equal to EMPTY_GUID.
1897
- * @param guid Guid for check.
1898
- * @internal
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.
1899
1932
  */
1900
- function isEmptyGuid(guid) {
1901
- return !guid || guid === EMPTY_GUID;
1933
+ class DataRequest extends BaseRequest {
1902
1934
  }
1903
1935
 
1904
- class ExistsFilter extends SingleFilter {
1905
- constructor(leftExpression, subFilters, comparisonType = ComparisonType.Exists, isAggregative = true) {
1906
- super(FilterType.Exists, comparisonType, leftExpression);
1907
- this.subFilters = subFilters?.clone();
1908
- this.isAggregative = isAggregative;
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;
1909
1963
  }
1910
- clone() {
1911
- 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;
1912
1975
  }
1913
1976
  }
1977
+ /**
1978
+ * @internal
1979
+ * @dontChange
1980
+ */
1981
+ BaseValidator._instanceOfKey = 'devkit_BaseValidator';
1914
1982
 
1915
- class InFilter extends SingleFilter {
1916
- constructor(comparisonType, leftExpression, rightExpressions) {
1917
- super(FilterType.In, comparisonType, leftExpression);
1918
- this.rightExpressions = rightExpressions.map((expression) => expression.clone());
1983
+ /**
1984
+ * @public
1985
+ */
1986
+ class LocalizableValue {
1987
+ constructor(key) {
1988
+ this.key = key;
1919
1989
  }
1920
- clone() {
1921
- 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;
1922
1995
  }
1923
1996
  }
1997
+ /**
1998
+ * @internal
1999
+ * @dontChange
2000
+ */
2001
+ LocalizableValue._instanceOfKey = 'devkit_LocalizableValue';
1924
2002
 
1925
- class IsNullFilter extends SingleFilter {
1926
- constructor(comparisonType, leftExpression) {
1927
- super(FilterType.IsNull, comparisonType, leftExpression);
1928
- }
1929
- get isNull() {
1930
- 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;
1931
2012
  }
1932
- clone() {
1933
- 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.");
1934
2016
  }
2017
+ localizableEntries.forEach(({ path, value }) => {
2018
+ const localizedValue = localizeMetadata?.(value.key) ?? value.key;
2019
+ set(localized, path, localizedValue);
2020
+ });
2021
+ return localized;
1935
2022
  }
1936
- __decorate([
1937
- Expose(),
1938
- __metadata("design:type", Boolean),
1939
- __metadata("design:paramtypes", [])
1940
- ], IsNullFilter.prototype, "isNull", null);
1941
2023
 
1942
- class FilterGroup extends BaseFilter {
1943
- constructor(logicalOperation = LogicalOperatorType.And) {
1944
- super(FilterType.FilterGroup);
1945
- this.filters = new Map();
1946
- 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
+ };
1947
2052
  }
1948
- get items() {
1949
- return classToPlain(this.filters, {
1950
- exposeUnsetFields: false,
1951
- excludePrefixes: ['_'],
1952
- });
2053
+ clearContextedHandlersCache(contextId) {
2054
+ const configs = this._handlersScopesByContextId.get(contextId) ?? [];
2055
+ return configs.every(({ requestType, scope }) => this._handlersCache.get(requestType)?.delete(scope));
1953
2056
  }
1954
- /**
1955
- * Returns filter item by index.
1956
- * @param index Item index.
1957
- * @returns Filter.
1958
- */
1959
- getItemByIndex(index) {
1960
- return this.items[Object.keys(this.items)[index]];
2057
+ _getHandler(request) {
2058
+ return this._hasCacheHandler(request) ? this._getCacheHandler(request) : this._buildHandlersChain(request);
1961
2059
  }
1962
- addSchemaColumnFilterWithParameter(comparisonType, columnPath, parameterValue) {
1963
- const leftExpression = new ColumnExpression({ columnPath });
1964
- const rightExpression = new ParameterExpression({ value: parameterValue });
1965
- const filter = new CompareFilter(comparisonType, leftExpression, rightExpression);
1966
- 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);
1967
2064
  }
1968
- addSchemaColumnInFilterWithParameters(comparisonType, columnPath, parameterValues) {
1969
- const leftExpression = new ColumnExpression({ columnPath });
1970
- const expressions = parameterValues.map((singleParameterValue) => new ParameterExpression({
1971
- value: singleParameterValue,
1972
- }));
1973
- const filter = new InFilter(comparisonType, leftExpression, expressions);
1974
- 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);
1975
2069
  }
1976
- addSchemaColumnIsNullFilter(columnPath) {
1977
- const leftExpression = new ColumnExpression({ columnPath });
1978
- const filter = new IsNullFilter(ComparisonType.Is_null, leftExpression);
1979
- this.add(filter);
2070
+ _getCacheScopesKey(request) {
2071
+ const injectionContextKey = this._getInjectionContext(request?.$context)?.id ?? '';
2072
+ return (request.scopes || ['']).join('_').concat(injectionContextKey);
1980
2073
  }
1981
- addSchemaColumnIsNotNullFilter(columnPath) {
1982
- const leftExpression = new ColumnExpression({ columnPath });
1983
- const filter = new IsNullFilter(ComparisonType.Is_not_null, leftExpression);
1984
- this.add(filter);
2074
+ _getInjectionContext(viewModel) {
2075
+ return viewModel?.['_injectionContext'] || (viewModel?.parent && this._getInjectionContext(viewModel.parent));
1985
2076
  }
1986
- addExistsFilter(columnPath, subFilters) {
1987
- const leftExpression = new ColumnExpression({ columnPath });
1988
- const filter = new ExistsFilter(leftExpression, subFilters);
1989
- 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);
2084
+ }
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);
1990
2095
  }
1991
- addNotExistsFilter(columnPath, subFilters) {
1992
- const leftExpression = new ColumnExpression({ columnPath });
1993
- const filter = new ExistsFilter(leftExpression, subFilters, ComparisonType.Not_exists);
1994
- this.add(filter);
2096
+ _isRequestHandler(handler) {
2097
+ return (typeof handler.handle === 'function' &&
2098
+ typeof handler.setNext === 'function');
1995
2099
  }
1996
- add(filter, filterKey) {
1997
- ValidationUtilities.checkArgumentEmpty('filter', filter);
1998
- const key = filterKey || generateGuid();
1999
- this.filters.set(key, filter);
2100
+ _checkHandlerInstanceOf(handler) {
2101
+ if (!this._isRequestHandler(handler)) {
2102
+ throw new Error('Handler should implement "BaseRequestHandler"');
2103
+ }
2000
2104
  }
2001
- clone() {
2002
- const filterGroup = new FilterGroup(this.logicalOperation);
2003
- this.filters.forEach((filter, filterKey) => {
2004
- filterGroup.filters.set(filterKey, filter.clone());
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));
2005
2114
  });
2006
- 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
+ }
2007
2141
  }
2008
2142
  }
2009
- __decorate([
2010
- Exclude(),
2011
- __metadata("design:type", Object)
2012
- ], FilterGroup.prototype, "filters", void 0);
2013
- __decorate([
2014
- Expose(),
2015
- __metadata("design:type", Object),
2016
- __metadata("design:paramtypes", [])
2017
- ], FilterGroup.prototype, "items", null);
2018
2143
 
2019
- class BetweenFilter extends SingleFilter {
2020
- constructor(leftExpression, rightLessExpression, rightGreaterExpression) {
2021
- super(FilterType.Between, ComparisonType.Between, leftExpression);
2022
- this.rightLessExpression = rightLessExpression.clone();
2023
- 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
+ }
2024
2155
  }
2025
- clone() {
2026
- return new BetweenFilter(this.leftExpression, this.rightLessExpression, this.rightGreaterExpression);
2156
+ get _chain() {
2157
+ return global.handlerChain;
2027
2158
  }
2028
- }
2029
-
2030
- class BaseQueryColumn {
2031
- constructor(expression) {
2032
- this.orderDirection = OrderDirection.None;
2033
- this.orderPosition = -1;
2034
- this.isVisible = true;
2035
- 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();
2036
2167
  }
2037
2168
  /**
2038
- * Adds ordering options.
2039
- * @param orderDirection Direction.
2040
- * @param orderPosition Position.
2041
- * @returns Self.
2169
+ * @internal
2042
2170
  */
2043
- withOrdering(orderDirection, orderPosition) {
2044
- ValidationUtilities.checkArgumentEmpty('orderDirection', orderDirection);
2045
- ValidationUtilities.checkArgumentEmpty('orderPosition', orderPosition);
2046
- ValidationUtilities.checkArgumentOutOfRange('orderPosition', orderPosition, { begin: -1 });
2047
- this.orderDirection = orderDirection;
2048
- this.orderPosition = orderPosition;
2049
- return this;
2171
+ clearContextedHandlersCache(contextId) {
2172
+ return this._chain.clearContextedHandlersCache(contextId);
2050
2173
  }
2051
2174
  /**
2052
- * Adds options.
2053
- * @param options Options.
2054
- * @returns Self.
2175
+ * @internal
2055
2176
  */
2056
- withOptions(options) {
2057
- ValidationUtilities.checkArgumentEmpty('options', options);
2058
- this.isVisible = options.isVisible ?? true;
2059
- return this;
2177
+ register(handlerConfig) {
2178
+ return this._chain.handlerChain$.register(handlerConfig);
2060
2179
  }
2061
2180
  /**
2062
- * Adds caption.
2063
- * @param caption Caption.
2064
- * @returns Self.
2181
+ * @description Method to process passed request
2182
+ * @param request - {@link BaseRequest}
2183
+ * @return `Promise<unknown>`
2065
2184
  */
2066
- withCaption(caption) {
2067
- ValidationUtilities.checkArgumentEmpty('caption', caption);
2068
- this.caption = caption;
2069
- return this;
2070
- }
2071
- }
2072
-
2073
- class ArithmeticQueryColumn extends BaseQueryColumn {
2074
- // region Constructors: Public
2075
- constructor(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand) {
2076
- super(new ArithmeticExpression({ arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand }));
2077
- }
2078
- }
2079
-
2080
- class EntityQueryColumn extends BaseQueryColumn {
2081
- // region Constructors: Public
2082
- constructor(columnPath) {
2083
- super(new ColumnExpression({ columnPath }));
2084
- }
2085
- }
2086
-
2087
- class ParameterQueryColumn extends BaseQueryColumn {
2088
- // region Constructors: Public
2089
- constructor(value, dataValueType) {
2090
- super(new ParameterExpression({ value, dataValueType }));
2091
- }
2092
- }
2093
-
2094
- class AggregationSubQueryColumn extends BaseQueryColumn {
2095
- // region Constructors: Public
2096
- constructor(columnPath, aggregationType, subFilters, subOrderDirection, subOrderColumn) {
2097
- super(new AggregationSubQueryExpression({
2098
- aggregationType,
2099
- columnPath,
2100
- subFilters,
2101
- subOrderDirection,
2102
- subOrderColumn,
2103
- }));
2104
- }
2105
- }
2106
-
2107
- class SubQueryColumn extends BaseQueryColumn {
2108
- // region Constructors: Public
2109
- constructor(columnPath, subFilters) {
2110
- super(new SubQueryExpression({ columnPath, subFilters }));
2111
- }
2112
- }
2113
-
2114
- class AggregationFunctionColumn extends BaseQueryColumn {
2115
- // region Constructors: Public
2116
- constructor(aggregationType, aggregationEvalType, functionArgument) {
2117
- super(new AggregationFunctionExpression({
2118
- aggregationType,
2119
- aggregationEvalType,
2120
- functionArgument,
2121
- }));
2122
- }
2123
- }
2124
-
2125
- class DatePartFunctionColumn extends BaseQueryColumn {
2126
- // region Constructors: Public
2127
- constructor(datePartType, functionArgument) {
2128
- super(new DatePartFunctionExpression({
2129
- datePartType,
2130
- functionArgument,
2131
- }));
2132
- }
2133
- // endregion
2134
- // region Properties: Public
2135
- get datePartType() {
2136
- return this.expression?.datePartType;
2185
+ process(request) {
2186
+ return this._chain.handlerChain$.process(request);
2137
2187
  }
2138
2188
  }
2139
2189
 
2140
- class LengthFunctionColumn extends BaseQueryColumn {
2141
- // region Constructors: Public
2142
- constructor(functionArgument) {
2143
- super(new LengthFunctionExpression({ functionArgument }));
2144
- }
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
+ };
2145
2211
  }
2146
2212
 
2147
- class MacrosFunctionColumn extends BaseQueryColumn {
2148
- // region Constructors: Public
2149
- constructor(macrosType) {
2150
- super(new MacrosFunctionExpression({ macrosType }));
2151
- }
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
+ };
2152
2224
  }
2153
2225
 
2154
- class WindowFunctionColumn extends BaseQueryColumn {
2155
- // region Constructors: Public
2156
- constructor(functionArgument) {
2157
- super(new WindowFunctionExpression({ functionArgument }));
2158
- }
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
+ };
2159
2236
  }
2160
2237
 
2161
2238
  /**
@@ -2240,7 +2317,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2240
2317
  }
2241
2318
  // endregion
2242
2319
  // region Methods: Private
2243
- internalAddColumn(key, column) {
2320
+ _internalAddColumn(key, column) {
2244
2321
  if (!this._columns.has(key)) {
2245
2322
  this._columns.set(key, column);
2246
2323
  }
@@ -2279,7 +2356,6 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2279
2356
  rowCount: this.rowCount,
2280
2357
  rowsOffset: this.rowsOffset,
2281
2358
  isPageable: this._getIsPageable(),
2282
- // TODO: CRM-61150: https://tscore-task/browse/CRM-61150
2283
2359
  conditionalValues: this.conditionalValues ? this.conditionalValues : null,
2284
2360
  isHierarchical: false,
2285
2361
  hierarchicalMaxDepth: 0,
@@ -2296,7 +2372,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2296
2372
  * @returns [BaseQueryColumn] Column instance.
2297
2373
  */
2298
2374
  addColumn(column, columnAlias) {
2299
- this.internalAddColumn(columnAlias, column);
2375
+ this._internalAddColumn(columnAlias, column);
2300
2376
  return column;
2301
2377
  }
2302
2378
  /**
@@ -2308,7 +2384,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2308
2384
  addSchemaColumn(columnPath, columnAlias) {
2309
2385
  ValidationUtilities.checkArgumentEmpty('columnPath', columnPath);
2310
2386
  const column = new EntityQueryColumn(columnPath);
2311
- this.internalAddColumn(columnAlias || columnPath, column);
2387
+ this._internalAddColumn(columnAlias || columnPath, column);
2312
2388
  return column;
2313
2389
  }
2314
2390
  /**
@@ -2321,7 +2397,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2321
2397
  */
2322
2398
  addAggregationSubQueryColumn(columnPath, aggregationType, aggregationConfig, columnAlias) {
2323
2399
  const column = new AggregationSubQueryColumn(columnPath, aggregationType, aggregationConfig.filter, aggregationConfig.sortByDirection, aggregationConfig.sortByColumn);
2324
- this.internalAddColumn(columnAlias || columnPath, column);
2400
+ this._internalAddColumn(columnAlias || columnPath, column);
2325
2401
  return column;
2326
2402
  }
2327
2403
  /**
@@ -2333,7 +2409,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2333
2409
  */
2334
2410
  addParameterColumn(value, dataValueType, columnAlias) {
2335
2411
  const column = new ParameterQueryColumn(value, dataValueType);
2336
- this.internalAddColumn(columnAlias, column);
2412
+ this._internalAddColumn(columnAlias, column);
2337
2413
  return column;
2338
2414
  }
2339
2415
  /**
@@ -2346,7 +2422,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2346
2422
  */
2347
2423
  addArithmeticColumn(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand, columnAlias) {
2348
2424
  const column = new ArithmeticQueryColumn(arithmeticOperation, leftArithmeticOperand, rightArithmeticOperand);
2349
- this.internalAddColumn(columnAlias, column);
2425
+ this._internalAddColumn(columnAlias, column);
2350
2426
  return column;
2351
2427
  }
2352
2428
  /**
@@ -2357,7 +2433,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2357
2433
  */
2358
2434
  addMacrosFunctionColumn(queryMacrosType, columnAlias) {
2359
2435
  const column = new MacrosFunctionColumn(queryMacrosType);
2360
- this.internalAddColumn(columnAlias, column);
2436
+ this._internalAddColumn(columnAlias, column);
2361
2437
  return column;
2362
2438
  }
2363
2439
  /**
@@ -2370,7 +2446,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2370
2446
  addDatePartFunctionColumn(columnPath, datePartType, columnAlias) {
2371
2447
  const functionArgument = new ColumnExpression({ columnPath });
2372
2448
  const column = new DatePartFunctionColumn(datePartType, functionArgument);
2373
- this.internalAddColumn(columnAlias, column);
2449
+ this._internalAddColumn(columnAlias, column);
2374
2450
  return column;
2375
2451
  }
2376
2452
  /**
@@ -2384,7 +2460,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2384
2460
  addAggregationFunctionColumn(columnPath, aggregationType, columnAlias, aggregationEvalType = AggregationEvalType.None) {
2385
2461
  const functionArgument = new ColumnExpression({ columnPath });
2386
2462
  const column = new AggregationFunctionColumn(aggregationType, aggregationEvalType, functionArgument);
2387
- this.internalAddColumn(columnAlias, column);
2463
+ this._internalAddColumn(columnAlias, column);
2388
2464
  return column;
2389
2465
  }
2390
2466
  /**
@@ -2396,7 +2472,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2396
2472
  addLengthFunctionColumn(columnPath, columnAlias) {
2397
2473
  const functionArgument = new ColumnExpression({ columnPath });
2398
2474
  const column = new LengthFunctionColumn(functionArgument);
2399
- this.internalAddColumn(columnAlias, column);
2475
+ this._internalAddColumn(columnAlias, column);
2400
2476
  return column;
2401
2477
  }
2402
2478
  /**
@@ -2414,7 +2490,7 @@ class EntitySchemaQuery extends BaseFilterableQuery {
2414
2490
  functionArgument: new ColumnExpression({ columnPath }),
2415
2491
  });
2416
2492
  const column = new WindowFunctionColumn(functionArgument);
2417
- this.internalAddColumn(columnAlias, column);
2493
+ this._internalAddColumn(columnAlias, column);
2418
2494
  return column;
2419
2495
  }
2420
2496
  }
@@ -2493,6 +2569,234 @@ __decorate([
2493
2569
  class SelectLocalizationQuery extends EntitySchemaQuery {
2494
2570
  }
2495
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) => { };
2755
+ }
2756
+ return function (type) {
2757
+ checkTypeNameFormat(config.type, 'ValidatorTypeName');
2758
+ const registrationConfig = {
2759
+ ...config,
2760
+ typeRef: type,
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) => { };
2773
+ }
2774
+ return function (type) {
2775
+ checkTypeNameFormat(config.type, 'RequestHandlerTypeName');
2776
+ checkCrtTypeNamePascalCase(config.type);
2777
+ setRequestHandlerMetadata(config, type);
2778
+ };
2779
+ }
2780
+
2781
+ /**
2782
+ * @internal
2783
+ */
2784
+ // eslint-disable-next-line @typescript-eslint/naming-convention
2785
+ function CrtConverter(config) {
2786
+ if (!config) {
2787
+ return (type) => { };
2788
+ }
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,
2795
+ };
2796
+ setConverterMetadata(registrationConfig, typeRef);
2797
+ };
2798
+ }
2799
+
2496
2800
  /**
2497
2801
  * @public
2498
2802
  * @description Function allows to register user-defined component as view element in Creatio platform.
@@ -2587,14 +2891,35 @@ function registerValidators(types, options) {
2587
2891
  const metadata = getValidatorMetadata(type);
2588
2892
  const registrationConfig = {
2589
2893
  ...metadata,
2590
- instantiate: function () {
2591
- 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);
2592
2899
  },
2593
2900
  };
2594
2901
  ValidatorRegistry.validate(registrationConfig);
2595
2902
  ValidatorRegistry.register(registrationConfig);
2596
2903
  });
2597
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
+ }
2598
2923
  /**
2599
2924
  * @internal
2600
2925
  */
@@ -2606,7 +2931,12 @@ function registerRequestHandlers(types, options, remoteName) {
2606
2931
  resistantForEach(types, (type) => {
2607
2932
  const metadata = getRequestHandlerMetadata(type);
2608
2933
  let registrationConfig;
2609
- 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
+ };
2610
2940
  if (options.moduleType === 'host') {
2611
2941
  registrationConfig = {
2612
2942
  ...metadata,
@@ -2647,6 +2977,9 @@ function _bootstrapCrtModule(name, type, options) {
2647
2977
  if (moduleDefinition.validators) {
2648
2978
  registerValidators(moduleDefinition.validators, options);
2649
2979
  }
2980
+ if (moduleDefinition.converters) {
2981
+ registerConverters(moduleDefinition.converters, options);
2982
+ }
2650
2983
  moduleDefinition.includes?.forEach((t) => _bootstrapCrtModule(name, t, options));
2651
2984
  }
2652
2985
  catch (error) {
@@ -2720,14 +3053,49 @@ function _bootstrapCrtModuleHandlerChainServices(type) {
2720
3053
  if (moduleDefinition.handlerChainServices) {
2721
3054
  registerHandlerChainServices(moduleDefinition.handlerChainServices);
2722
3055
  }
2723
- moduleDefinition.includes?.forEach((t) => _bootstrapCrtModuleHandlerChainServices(t));
3056
+ moduleDefinition.includes?.forEach((t) => _bootstrapCrtModuleHandlerChainServices(t));
3057
+ }
3058
+ /**
3059
+ * @internal
3060
+ */
3061
+ function bootstrapCrtModuleHandlerChainServices(type) {
3062
+ _bootstrapCrtModuleHandlerChainServices(type);
3063
+ }
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
+ }
2724
3093
  }
2725
3094
  /**
2726
3095
  * @internal
3096
+ * @dontChange
2727
3097
  */
2728
- function bootstrapCrtModuleHandlerChainServices(type) {
2729
- _bootstrapCrtModuleHandlerChainServices(type);
2730
- }
3098
+ BaseRequestHandler._instanceOfKey = 'devkit_BaseRequestHandler';
2731
3099
 
2732
3100
  class BaseHandlerChainService {
2733
3101
  }
@@ -2924,6 +3292,27 @@ __decorate([
2924
3292
  __metadata("design:returntype", Object)
2925
3293
  ], HttpClientService.prototype, "patch", null);
2926
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
+
2927
3316
  /**
2928
3317
  * @public
2929
3318
  * @classdesc Service to working with mask using handler chain
@@ -2937,6 +3326,24 @@ class MaskService extends BaseHandlerChainService {
2937
3326
  */
2938
3327
  this.requestType = 'crt.MaskService';
2939
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
+ }
2940
3347
  }
2941
3348
  __decorate([
2942
3349
  ImplementUsingHandlerChain(),
@@ -3021,231 +3428,9 @@ var ModelParameterType;
3021
3428
  ModelParameterType["Never"] = "never";
3022
3429
  })(ModelParameterType || (ModelParameterType = {}));
3023
3430
 
3024
- /**
3025
- * @public
3026
- * @abstract
3027
- * @classdesc Class for designing request handlers.
3028
- */
3029
- class BaseRequestHandler {
3030
- constructor() {
3031
- this.handlerChain = HandlerChainService.instance;
3032
- }
3033
- get next() {
3034
- return this._next;
3035
- }
3036
- /**
3037
- * @internal
3038
- */
3039
- static [Symbol.hasInstance](instance) {
3040
- return instance?.constructor?.['_instanceOfKey'] === BaseRequestHandler._instanceOfKey;
3041
- }
3042
- /**
3043
- * @description Method to set request handler to handler chain.
3044
- * @param next - link for next request handler - {@link RequestHandler}
3045
- */
3046
- setNext(next) {
3047
- if (this._next) {
3048
- throw new NextHandlerAlreadySpecifiedException();
3049
- }
3050
- this._next = next;
3051
- }
3052
- }
3053
- /**
3054
- * @internal
3055
- * @dontChange
3056
- */
3057
- BaseRequestHandler._instanceOfKey = 'devkit_BaseRequestHandler';
3058
-
3059
- /**
3060
- * @internal
3061
- */
3062
- class InterfaceDesignerItemRegistrationConfig {
3063
- }
3064
-
3065
- /**
3066
- * @internal
3067
- * @class MethodInvokeRequest
3068
- * @description Definition of invoke method request.
3069
- * @extends {BaseRequest} {@link BaseRequest}
3070
- * @property {string} method - method name.
3071
- * @property {unknown[]} args - arguments passing to the method.
3072
- */
3073
- class MethodInvokeRequest extends BaseRequest {
3074
- }
3075
-
3076
- /**
3077
- * @internal
3078
- */
3079
- function toAggregationType(aggregationFunction) {
3080
- switch (aggregationFunction) {
3081
- case AggregationFunction.Count:
3082
- return AggregationType.Count;
3083
- case AggregationFunction.Sum:
3084
- return AggregationType.Sum;
3085
- case AggregationFunction.Avg:
3086
- return AggregationType.Avg;
3087
- case AggregationFunction.Min:
3088
- return AggregationType.Min;
3089
- case AggregationFunction.Max:
3090
- return AggregationType.Max;
3091
- case AggregationFunction.TopOne:
3092
- return AggregationType.TopOne;
3093
- default:
3094
- return AggregationType.None;
3095
- }
3096
- }
3097
- /**
3098
- * @internal
3099
- */
3100
- function toAggregationFunction(aggregationType) {
3101
- switch (aggregationType) {
3102
- case AggregationType.Count:
3103
- return AggregationFunction.Count;
3104
- case AggregationType.Sum:
3105
- return AggregationFunction.Sum;
3106
- case AggregationType.Avg:
3107
- return AggregationFunction.Avg;
3108
- case AggregationType.Min:
3109
- return AggregationFunction.Min;
3110
- case AggregationType.Max:
3111
- return AggregationFunction.Max;
3112
- case AggregationType.TopOne:
3113
- return AggregationFunction.TopOne;
3114
- default:
3115
- return AggregationFunction.None;
3116
- }
3117
- }
3118
- /**
3119
- * @internal
3120
- */
3121
- function toAggregationEvalType(aggregationEval) {
3122
- switch (aggregationEval) {
3123
- case 'all':
3124
- return AggregationEvalType.All;
3125
- case 'distinct':
3126
- return AggregationEvalType.Distinct;
3127
- default:
3128
- return AggregationEvalType.None;
3129
- }
3130
- }
3131
- /**
3132
- * @internal
3133
- */
3134
- function toAggregationEval(aggregationEvalType) {
3135
- switch (aggregationEvalType) {
3136
- case AggregationEvalType.All:
3137
- return 'all';
3138
- case AggregationEvalType.Distinct:
3139
- return 'distinct';
3140
- default:
3141
- return 'none';
3142
- }
3143
- }
3144
-
3145
- /**
3146
- * @internal
3147
- */
3148
- function toDatePartType(aggregationFunction) {
3149
- switch (aggregationFunction) {
3150
- case 'minute':
3151
- return DatePartType.HourMinute;
3152
- case 'hour':
3153
- return DatePartType.Hour;
3154
- case 'day':
3155
- return DatePartType.Day;
3156
- case 'weekday':
3157
- return DatePartType.WeekDay;
3158
- case 'week':
3159
- return DatePartType.Week;
3160
- case 'month':
3161
- return DatePartType.Month;
3162
- case 'year':
3163
- return DatePartType.Year;
3164
- default:
3165
- return DatePartType.None;
3166
- }
3167
- }
3168
- /**
3169
- * @internal
3170
- */
3171
- function toDatePart(aggregationType) {
3172
- switch (aggregationType) {
3173
- case DatePartType.HourMinute:
3174
- return 'minute';
3175
- case DatePartType.Hour:
3176
- return 'hour';
3177
- case DatePartType.Day:
3178
- return 'day';
3179
- case DatePartType.WeekDay:
3180
- return 'weekday';
3181
- case DatePartType.Week:
3182
- return 'week';
3183
- case DatePartType.Month:
3184
- return 'month';
3185
- case DatePartType.Year:
3186
- return 'year';
3187
- default:
3188
- return 'none';
3189
- }
3190
- }
3191
-
3192
- /**
3193
- * @internal
3194
- */
3195
- function toStringFunctionType(functionType) {
3196
- switch (functionType) {
3197
- case FunctionType.Aggregation:
3198
- return 'aggregation';
3199
- case FunctionType.DatePart:
3200
- return 'datePart';
3201
- default:
3202
- return 'none';
3203
- }
3204
- }
3205
- /**
3206
- * @internal
3207
- */
3208
- function toNumericFunctionType(functionType) {
3209
- switch (functionType) {
3210
- case 'aggregation':
3211
- return FunctionType.Aggregation;
3212
- case 'datePart':
3213
- return FunctionType.DatePart;
3214
- default:
3215
- return FunctionType.None;
3216
- }
3217
- }
3218
-
3219
- /**
3220
- * @internal
3221
- */
3222
- function toOrderDirection(sortDirection) {
3223
- switch (sortDirection) {
3224
- case 'asc':
3225
- return OrderDirection.Asc;
3226
- case 'desc':
3227
- return OrderDirection.Desc;
3228
- default:
3229
- return OrderDirection.None;
3230
- }
3231
- }
3232
- /**
3233
- * @internal
3234
- */
3235
- function toSortDirection(orderDirection) {
3236
- switch (orderDirection) {
3237
- case OrderDirection.Asc:
3238
- return 'asc';
3239
- case OrderDirection.Desc:
3240
- return 'desc';
3241
- default:
3242
- return 'none';
3243
- }
3244
- }
3245
-
3246
3431
  /**
3247
3432
  * Generated bundle index. Do not edit.
3248
3433
  */
3249
3434
 
3250
- 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, 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, 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, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, 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 };
3251
3436
  //# sourceMappingURL=creatio-devkit-common.mjs.map