acomm-core-lib 2.6.2

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 (1444) hide show
  1. package/README.md +75 -0
  2. package/dist/package.json +125 -0
  3. package/dist/src/app.controller.d.ts +8 -0
  4. package/dist/src/app.controller.js +69 -0
  5. package/dist/src/app.controller.js.map +1 -0
  6. package/dist/src/app.module.d.ts +2 -0
  7. package/dist/src/app.module.js +151 -0
  8. package/dist/src/app.module.js.map +1 -0
  9. package/dist/src/app.service.d.ts +5 -0
  10. package/dist/src/app.service.js +30 -0
  11. package/dist/src/app.service.js.map +1 -0
  12. package/dist/src/app_cluster.service.d.ts +3 -0
  13. package/dist/src/app_cluster.service.js +64 -0
  14. package/dist/src/app_cluster.service.js.map +1 -0
  15. package/dist/src/core/activity_log/activity_log.enum.d.ts +31 -0
  16. package/dist/src/core/activity_log/activity_log.enum.js +38 -0
  17. package/dist/src/core/activity_log/activity_log.enum.js.map +1 -0
  18. package/dist/src/core/activity_log/activity_log.layout.d.ts +2 -0
  19. package/dist/src/core/activity_log/activity_log.layout.js +331 -0
  20. package/dist/src/core/activity_log/activity_log.layout.js.map +1 -0
  21. package/dist/src/core/activity_log/activity_log.module.d.ts +2 -0
  22. package/dist/src/core/activity_log/activity_log.module.js +39 -0
  23. package/dist/src/core/activity_log/activity_log.module.js.map +1 -0
  24. package/dist/src/core/activity_log/activity_log.schema.d.ts +24 -0
  25. package/dist/src/core/activity_log/activity_log.schema.js +117 -0
  26. package/dist/src/core/activity_log/activity_log.schema.js.map +1 -0
  27. package/dist/src/core/activity_log/activity_log.service.d.ts +14 -0
  28. package/dist/src/core/activity_log/activity_log.service.js +58 -0
  29. package/dist/src/core/activity_log/activity_log.service.js.map +1 -0
  30. package/dist/src/core/address/address.enum.d.ts +8 -0
  31. package/dist/src/core/address/address.enum.js +13 -0
  32. package/dist/src/core/address/address.enum.js.map +1 -0
  33. package/dist/src/core/address/address.layout.d.ts +7 -0
  34. package/dist/src/core/address/address.layout.js +1297 -0
  35. package/dist/src/core/address/address.layout.js.map +1 -0
  36. package/dist/src/core/address/address.module.d.ts +2 -0
  37. package/dist/src/core/address/address.module.js +87 -0
  38. package/dist/src/core/address/address.module.js.map +1 -0
  39. package/dist/src/core/address/address.schema.d.ts +69 -0
  40. package/dist/src/core/address/address.schema.js +267 -0
  41. package/dist/src/core/address/address.schema.js.map +1 -0
  42. package/dist/src/core/address/address.service.d.ts +49 -0
  43. package/dist/src/core/address/address.service.js +171 -0
  44. package/dist/src/core/address/address.service.js.map +1 -0
  45. package/dist/src/core/address/data/country.json +1484 -0
  46. package/dist/src/core/address/data/time_zone.json +1702 -0
  47. package/dist/src/core/api_key/api_key.constant.d.ts +29 -0
  48. package/dist/src/core/api_key/api_key.constant.js +34 -0
  49. package/dist/src/core/api_key/api_key.constant.js.map +1 -0
  50. package/dist/src/core/api_key/api_key.controller.d.ts +8 -0
  51. package/dist/src/core/api_key/api_key.controller.js +60 -0
  52. package/dist/src/core/api_key/api_key.controller.js.map +1 -0
  53. package/dist/src/core/api_key/api_key.enum.d.ts +5 -0
  54. package/dist/src/core/api_key/api_key.enum.js +10 -0
  55. package/dist/src/core/api_key/api_key.enum.js.map +1 -0
  56. package/dist/src/core/api_key/api_key.layout.d.ts +2 -0
  57. package/dist/src/core/api_key/api_key.layout.js +1133 -0
  58. package/dist/src/core/api_key/api_key.layout.js.map +1 -0
  59. package/dist/src/core/api_key/api_key.module.d.ts +2 -0
  60. package/dist/src/core/api_key/api_key.module.js +40 -0
  61. package/dist/src/core/api_key/api_key.module.js.map +1 -0
  62. package/dist/src/core/api_key/api_key.schema.d.ts +42 -0
  63. package/dist/src/core/api_key/api_key.schema.js +189 -0
  64. package/dist/src/core/api_key/api_key.schema.js.map +1 -0
  65. package/dist/src/core/api_key/api_key.service.d.ts +23 -0
  66. package/dist/src/core/api_key/api_key.service.js +278 -0
  67. package/dist/src/core/api_key/api_key.service.js.map +1 -0
  68. package/dist/src/core/attachment/attachment.config.d.ts +4 -0
  69. package/dist/src/core/attachment/attachment.config.js +8 -0
  70. package/dist/src/core/attachment/attachment.config.js.map +1 -0
  71. package/dist/src/core/attachment/attachment.controller.d.ts +15 -0
  72. package/dist/src/core/attachment/attachment.controller.js +141 -0
  73. package/dist/src/core/attachment/attachment.controller.js.map +1 -0
  74. package/dist/src/core/attachment/attachment.enum.d.ts +22 -0
  75. package/dist/src/core/attachment/attachment.enum.js +28 -0
  76. package/dist/src/core/attachment/attachment.enum.js.map +1 -0
  77. package/dist/src/core/attachment/attachment.layout.d.ts +2 -0
  78. package/dist/src/core/attachment/attachment.layout.js +100 -0
  79. package/dist/src/core/attachment/attachment.layout.js.map +1 -0
  80. package/dist/src/core/attachment/attachment.module.d.ts +2 -0
  81. package/dist/src/core/attachment/attachment.module.js +42 -0
  82. package/dist/src/core/attachment/attachment.module.js.map +1 -0
  83. package/dist/src/core/attachment/attachment.schema.d.ts +26 -0
  84. package/dist/src/core/attachment/attachment.schema.js +131 -0
  85. package/dist/src/core/attachment/attachment.schema.js.map +1 -0
  86. package/dist/src/core/attachment/attachment.service.d.ts +38 -0
  87. package/dist/src/core/attachment/attachment.service.js +417 -0
  88. package/dist/src/core/attachment/attachment.service.js.map +1 -0
  89. package/dist/src/core/attachment/providers/local.provider.d.ts +14 -0
  90. package/dist/src/core/attachment/providers/local.provider.js +71 -0
  91. package/dist/src/core/attachment/providers/local.provider.js.map +1 -0
  92. package/dist/src/core/attachment/providers/provider.base.d.ts +6 -0
  93. package/dist/src/core/attachment/providers/provider.base.js +16 -0
  94. package/dist/src/core/attachment/providers/provider.base.js.map +1 -0
  95. package/dist/src/core/attachment/providers/provider.interface.d.ts +5 -0
  96. package/dist/src/core/attachment/providers/provider.interface.js +3 -0
  97. package/dist/src/core/attachment/providers/provider.interface.js.map +1 -0
  98. package/dist/src/core/audit_log/audit_log.enum.d.ts +48 -0
  99. package/dist/src/core/audit_log/audit_log.enum.js +54 -0
  100. package/dist/src/core/audit_log/audit_log.enum.js.map +1 -0
  101. package/dist/src/core/audit_log/audit_log.layout.d.ts +2 -0
  102. package/dist/src/core/audit_log/audit_log.layout.js +372 -0
  103. package/dist/src/core/audit_log/audit_log.layout.js.map +1 -0
  104. package/dist/src/core/audit_log/audit_log.module.d.ts +2 -0
  105. package/dist/src/core/audit_log/audit_log.module.js +39 -0
  106. package/dist/src/core/audit_log/audit_log.module.js.map +1 -0
  107. package/dist/src/core/audit_log/audit_log.schema.d.ts +14 -0
  108. package/dist/src/core/audit_log/audit_log.schema.js +67 -0
  109. package/dist/src/core/audit_log/audit_log.schema.js.map +1 -0
  110. package/dist/src/core/audit_log/audit_log.service.d.ts +14 -0
  111. package/dist/src/core/audit_log/audit_log.service.js +68 -0
  112. package/dist/src/core/audit_log/audit_log.service.js.map +1 -0
  113. package/dist/src/core/auth/auth.controller.d.ts +22 -0
  114. package/dist/src/core/auth/auth.controller.js +266 -0
  115. package/dist/src/core/auth/auth.controller.js.map +1 -0
  116. package/dist/src/core/auth/auth.module.d.ts +2 -0
  117. package/dist/src/core/auth/auth.module.js +37 -0
  118. package/dist/src/core/auth/auth.module.js.map +1 -0
  119. package/dist/src/core/auth/auth.service.d.ts +87 -0
  120. package/dist/src/core/auth/auth.service.js +930 -0
  121. package/dist/src/core/auth/auth.service.js.map +1 -0
  122. package/dist/src/core/auth/constants.d.ts +7 -0
  123. package/dist/src/core/auth/constants.js +9 -0
  124. package/dist/src/core/auth/constants.js.map +1 -0
  125. package/dist/src/core/auth/guards/basic.guard.d.ts +1 -0
  126. package/dist/src/core/auth/guards/basic.guard.js +7 -0
  127. package/dist/src/core/auth/guards/basic.guard.js.map +1 -0
  128. package/dist/src/core/auth/guards/jwt_auth.guard.d.ts +19 -0
  129. package/dist/src/core/auth/guards/jwt_auth.guard.js +526 -0
  130. package/dist/src/core/auth/guards/jwt_auth.guard.js.map +1 -0
  131. package/dist/src/core/auth/guards/public.guard.d.ts +1 -0
  132. package/dist/src/core/auth/guards/public.guard.js +7 -0
  133. package/dist/src/core/auth/guards/public.guard.js.map +1 -0
  134. package/dist/src/core/auth/providers/auth_local.provider.d.ts +13 -0
  135. package/dist/src/core/auth/providers/auth_local.provider.js +75 -0
  136. package/dist/src/core/auth/providers/auth_local.provider.js.map +1 -0
  137. package/dist/src/core/auth/providers/auth_otp.provider.d.ts +13 -0
  138. package/dist/src/core/auth/providers/auth_otp.provider.js +77 -0
  139. package/dist/src/core/auth/providers/auth_otp.provider.js.map +1 -0
  140. package/dist/src/core/auth/providers/auth_provider.interface.d.ts +12 -0
  141. package/dist/src/core/auth/providers/auth_provider.interface.js +3 -0
  142. package/dist/src/core/auth/providers/auth_provider.interface.js.map +1 -0
  143. package/dist/src/core/auth/providers/base_auth.provider.d.ts +7 -0
  144. package/dist/src/core/auth/providers/base_auth.provider.js +25 -0
  145. package/dist/src/core/auth/providers/base_auth.provider.js.map +1 -0
  146. package/dist/src/core/auth/strategies/jwt.strategy.d.ts +6 -0
  147. package/dist/src/core/auth/strategies/jwt.strategy.js +37 -0
  148. package/dist/src/core/auth/strategies/jwt.strategy.js.map +1 -0
  149. package/dist/src/core/cache/cache.controller.d.ts +13 -0
  150. package/dist/src/core/cache/cache.controller.js +67 -0
  151. package/dist/src/core/cache/cache.controller.js.map +1 -0
  152. package/dist/src/core/cache/cache.decorator.d.ts +1 -0
  153. package/dist/src/core/cache/cache.decorator.js +7 -0
  154. package/dist/src/core/cache/cache.decorator.js.map +1 -0
  155. package/dist/src/core/cache/cache.interceptor.d.ts +8 -0
  156. package/dist/src/core/cache/cache.interceptor.js +57 -0
  157. package/dist/src/core/cache/cache.interceptor.js.map +1 -0
  158. package/dist/src/core/cache/cache.module.d.ts +2 -0
  159. package/dist/src/core/cache/cache.module.js +29 -0
  160. package/dist/src/core/cache/cache.module.js.map +1 -0
  161. package/dist/src/core/cache/cache.service.d.ts +15 -0
  162. package/dist/src/core/cache/cache.service.js +60 -0
  163. package/dist/src/core/cache/cache.service.js.map +1 -0
  164. package/dist/src/core/cache/cache.utils.d.ts +12 -0
  165. package/dist/src/core/cache/cache.utils.js +116 -0
  166. package/dist/src/core/cache/cache.utils.js.map +1 -0
  167. package/dist/src/core/comment_data/comment_data.controller.d.ts +8 -0
  168. package/dist/src/core/comment_data/comment_data.controller.js +56 -0
  169. package/dist/src/core/comment_data/comment_data.controller.js.map +1 -0
  170. package/dist/src/core/comment_data/comment_data.layout.d.ts +2 -0
  171. package/dist/src/core/comment_data/comment_data.layout.js +274 -0
  172. package/dist/src/core/comment_data/comment_data.layout.js.map +1 -0
  173. package/dist/src/core/comment_data/comment_data.module.d.ts +2 -0
  174. package/dist/src/core/comment_data/comment_data.module.js +40 -0
  175. package/dist/src/core/comment_data/comment_data.module.js.map +1 -0
  176. package/dist/src/core/comment_data/comment_data.schema.d.ts +13 -0
  177. package/dist/src/core/comment_data/comment_data.schema.js +53 -0
  178. package/dist/src/core/comment_data/comment_data.schema.js.map +1 -0
  179. package/dist/src/core/comment_data/comment_data.service.d.ts +15 -0
  180. package/dist/src/core/comment_data/comment_data.service.js +63 -0
  181. package/dist/src/core/comment_data/comment_data.service.js.map +1 -0
  182. package/dist/src/core/common/base/base.controller.d.ts +42 -0
  183. package/dist/src/core/common/base/base.controller.js +440 -0
  184. package/dist/src/core/common/base/base.controller.js.map +1 -0
  185. package/dist/src/core/common/base/base.schema.d.ts +12 -0
  186. package/dist/src/core/common/base/base.schema.js +61 -0
  187. package/dist/src/core/common/base/base.schema.js.map +1 -0
  188. package/dist/src/core/common/base/base.service.d.ts +87 -0
  189. package/dist/src/core/common/base/base.service.js +1218 -0
  190. package/dist/src/core/common/base/base.service.js.map +1 -0
  191. package/dist/src/core/common/base/base_external_data_source.provider.d.ts +18 -0
  192. package/dist/src/core/common/base/base_external_data_source.provider.js +50 -0
  193. package/dist/src/core/common/base/base_external_data_source.provider.js.map +1 -0
  194. package/dist/src/core/common/base/base_log.controller.d.ts +7 -0
  195. package/dist/src/core/common/base/base_log.controller.js +35 -0
  196. package/dist/src/core/common/base/base_log.controller.js.map +1 -0
  197. package/dist/src/core/common/base/base_log.service.d.ts +13 -0
  198. package/dist/src/core/common/base/base_log.service.js +142 -0
  199. package/dist/src/core/common/base/base_log.service.js.map +1 -0
  200. package/dist/src/core/common/base/base_module.controller.d.ts +9 -0
  201. package/dist/src/core/common/base/base_module.controller.js +63 -0
  202. package/dist/src/core/common/base/base_module.controller.js.map +1 -0
  203. package/dist/src/core/common/base/base_module.service.d.ts +20 -0
  204. package/dist/src/core/common/base/base_module.service.js +56 -0
  205. package/dist/src/core/common/base/base_module.service.js.map +1 -0
  206. package/dist/src/core/common/constants.d.ts +57 -0
  207. package/dist/src/core/common/constants.js +98 -0
  208. package/dist/src/core/common/constants.js.map +1 -0
  209. package/dist/src/core/common/decorator/safe_params.decorator.d.ts +1 -0
  210. package/dist/src/core/common/decorator/safe_params.decorator.js +11 -0
  211. package/dist/src/core/common/decorator/safe_params.decorator.js.map +1 -0
  212. package/dist/src/core/common/dto/search_query.dto.d.ts +6 -0
  213. package/dist/src/core/common/dto/search_query.dto.js +7 -0
  214. package/dist/src/core/common/dto/search_query.dto.js.map +1 -0
  215. package/dist/src/core/common/dto/search_result.dto.d.ts +7 -0
  216. package/dist/src/core/common/dto/search_result.dto.js +7 -0
  217. package/dist/src/core/common/dto/search_result.dto.js.map +1 -0
  218. package/dist/src/core/common/filter/all_exception.filter.d.ts +4 -0
  219. package/dist/src/core/common/filter/all_exception.filter.js +31 -0
  220. package/dist/src/core/common/filter/all_exception.filter.js.map +1 -0
  221. package/dist/src/core/common/function/andConditions.d.ts +12 -0
  222. package/dist/src/core/common/function/andConditions.js +17 -0
  223. package/dist/src/core/common/function/andConditions.js.map +1 -0
  224. package/dist/src/core/common/function/autoGenerateO2M.d.ts +14 -0
  225. package/dist/src/core/common/function/autoGenerateO2M.js +57 -0
  226. package/dist/src/core/common/function/autoGenerateO2M.js.map +1 -0
  227. package/dist/src/core/common/function/cleanData.d.ts +9 -0
  228. package/dist/src/core/common/function/cleanData.js +23 -0
  229. package/dist/src/core/common/function/cleanData.js.map +1 -0
  230. package/dist/src/core/common/function/convertArrayObjToField.d.ts +17 -0
  231. package/dist/src/core/common/function/convertArrayObjToField.js +23 -0
  232. package/dist/src/core/common/function/convertArrayObjToField.js.map +1 -0
  233. package/dist/src/core/common/function/convertArrayToO2M.d.ts +13 -0
  234. package/dist/src/core/common/function/convertArrayToO2M.js +23 -0
  235. package/dist/src/core/common/function/convertArrayToO2M.js.map +1 -0
  236. package/dist/src/core/common/function/convertArrayToOption.d.ts +12 -0
  237. package/dist/src/core/common/function/convertArrayToOption.js +34 -0
  238. package/dist/src/core/common/function/convertArrayToOption.js.map +1 -0
  239. package/dist/src/core/common/function/convertAttributeArray.d.ts +12 -0
  240. package/dist/src/core/common/function/convertAttributeArray.js +29 -0
  241. package/dist/src/core/common/function/convertAttributeArray.js.map +1 -0
  242. package/dist/src/core/common/function/convertDate.d.ts +17 -0
  243. package/dist/src/core/common/function/convertDate.js +39 -0
  244. package/dist/src/core/common/function/convertDate.js.map +1 -0
  245. package/dist/src/core/common/function/convertImage.d.ts +17 -0
  246. package/dist/src/core/common/function/convertImage.js +18 -0
  247. package/dist/src/core/common/function/convertImage.js.map +1 -0
  248. package/dist/src/core/common/function/convertJSONAttrToO2M.d.ts +14 -0
  249. package/dist/src/core/common/function/convertJSONAttrToO2M.js +79 -0
  250. package/dist/src/core/common/function/convertJSONAttrToO2M.js.map +1 -0
  251. package/dist/src/core/common/function/convertStringDate.d.ts +12 -0
  252. package/dist/src/core/common/function/convertStringDate.js +23 -0
  253. package/dist/src/core/common/function/convertStringDate.js.map +1 -0
  254. package/dist/src/core/common/function/convertTime.d.ts +12 -0
  255. package/dist/src/core/common/function/convertTime.js +41 -0
  256. package/dist/src/core/common/function/convertTime.js.map +1 -0
  257. package/dist/src/core/common/function/convertTimestampToDate.d.ts +13 -0
  258. package/dist/src/core/common/function/convertTimestampToDate.js +14 -0
  259. package/dist/src/core/common/function/convertTimestampToDate.js.map +1 -0
  260. package/dist/src/core/common/function/convertToJSONStructure.d.ts +12 -0
  261. package/dist/src/core/common/function/convertToJSONStructure.js +23 -0
  262. package/dist/src/core/common/function/convertToJSONStructure.js.map +1 -0
  263. package/dist/src/core/common/function/convertXMLArray.d.ts +12 -0
  264. package/dist/src/core/common/function/convertXMLArray.js +81 -0
  265. package/dist/src/core/common/function/convertXMLArray.js.map +1 -0
  266. package/dist/src/core/common/function/convertXMLObject.d.ts +12 -0
  267. package/dist/src/core/common/function/convertXMLObject.js +62 -0
  268. package/dist/src/core/common/function/convertXMLObject.js.map +1 -0
  269. package/dist/src/core/common/function/currency.d.ts +12 -0
  270. package/dist/src/core/common/function/currency.js +49 -0
  271. package/dist/src/core/common/function/currency.js.map +1 -0
  272. package/dist/src/core/common/function/currentDate.d.ts +12 -0
  273. package/dist/src/core/common/function/currentDate.js +34 -0
  274. package/dist/src/core/common/function/currentDate.js.map +1 -0
  275. package/dist/src/core/common/function/customSplit.d.ts +12 -0
  276. package/dist/src/core/common/function/customSplit.js +21 -0
  277. package/dist/src/core/common/function/customSplit.js.map +1 -0
  278. package/dist/src/core/common/function/dateIso.d.ts +13 -0
  279. package/dist/src/core/common/function/dateIso.js +19 -0
  280. package/dist/src/core/common/function/dateIso.js.map +1 -0
  281. package/dist/src/core/common/function/defaultType.json +23 -0
  282. package/dist/src/core/common/function/findData.d.ts +12 -0
  283. package/dist/src/core/common/function/findData.js +33 -0
  284. package/dist/src/core/common/function/findData.js.map +1 -0
  285. package/dist/src/core/common/function/findKeyValueArray.d.ts +12 -0
  286. package/dist/src/core/common/function/findKeyValueArray.js +29 -0
  287. package/dist/src/core/common/function/findKeyValueArray.js.map +1 -0
  288. package/dist/src/core/common/function/formatDate.d.ts +12 -0
  289. package/dist/src/core/common/function/formatDate.js +34 -0
  290. package/dist/src/core/common/function/formatDate.js.map +1 -0
  291. package/dist/src/core/common/function/freeStyle.d.ts +9 -0
  292. package/dist/src/core/common/function/freeStyle.js +13 -0
  293. package/dist/src/core/common/function/freeStyle.js.map +1 -0
  294. package/dist/src/core/common/function/generateBarcode.d.ts +17 -0
  295. package/dist/src/core/common/function/generateBarcode.js +34 -0
  296. package/dist/src/core/common/function/generateBarcode.js.map +1 -0
  297. package/dist/src/core/common/function/generateFilters.d.ts +12 -0
  298. package/dist/src/core/common/function/generateFilters.js +18 -0
  299. package/dist/src/core/common/function/generateFilters.js.map +1 -0
  300. package/dist/src/core/common/function/generateUUID.d.ts +9 -0
  301. package/dist/src/core/common/function/generateUUID.js +14 -0
  302. package/dist/src/core/common/function/generateUUID.js.map +1 -0
  303. package/dist/src/core/common/function/get.d.ts +17 -0
  304. package/dist/src/core/common/function/get.js +28 -0
  305. package/dist/src/core/common/function/get.js.map +1 -0
  306. package/dist/src/core/common/function/getCompany.d.ts +14 -0
  307. package/dist/src/core/common/function/getCompany.js +26 -0
  308. package/dist/src/core/common/function/getCompany.js.map +1 -0
  309. package/dist/src/core/common/function/getCurrentCollapseData.d.ts +13 -0
  310. package/dist/src/core/common/function/getCurrentCollapseData.js +22 -0
  311. package/dist/src/core/common/function/getCurrentCollapseData.js.map +1 -0
  312. package/dist/src/core/common/function/getCurrentDate.d.ts +12 -0
  313. package/dist/src/core/common/function/getCurrentDate.js +16 -0
  314. package/dist/src/core/common/function/getCurrentDate.js.map +1 -0
  315. package/dist/src/core/common/function/getCurrentFilters.d.ts +9 -0
  316. package/dist/src/core/common/function/getCurrentFilters.js +14 -0
  317. package/dist/src/core/common/function/getCurrentFilters.js.map +1 -0
  318. package/dist/src/core/common/function/getCurrentForm.d.ts +12 -0
  319. package/dist/src/core/common/function/getCurrentForm.js +18 -0
  320. package/dist/src/core/common/function/getCurrentForm.js.map +1 -0
  321. package/dist/src/core/common/function/getCurrentId.d.ts +9 -0
  322. package/dist/src/core/common/function/getCurrentId.js +14 -0
  323. package/dist/src/core/common/function/getCurrentId.js.map +1 -0
  324. package/dist/src/core/common/function/getCurrentIndexData.d.ts +12 -0
  325. package/dist/src/core/common/function/getCurrentIndexData.js +18 -0
  326. package/dist/src/core/common/function/getCurrentIndexData.js.map +1 -0
  327. package/dist/src/core/common/function/getDocument.d.ts +13 -0
  328. package/dist/src/core/common/function/getDocument.js +16 -0
  329. package/dist/src/core/common/function/getDocument.js.map +1 -0
  330. package/dist/src/core/common/function/getEndExportdate.d.ts +17 -0
  331. package/dist/src/core/common/function/getEndExportdate.js +32 -0
  332. package/dist/src/core/common/function/getEndExportdate.js.map +1 -0
  333. package/dist/src/core/common/function/getEntityId.d.ts +12 -0
  334. package/dist/src/core/common/function/getEntityId.js +15 -0
  335. package/dist/src/core/common/function/getEntityId.js.map +1 -0
  336. package/dist/src/core/common/function/getEntityRecord.d.ts +12 -0
  337. package/dist/src/core/common/function/getEntityRecord.js +42 -0
  338. package/dist/src/core/common/function/getEntityRecord.js.map +1 -0
  339. package/dist/src/core/common/function/getErrors.d.ts +12 -0
  340. package/dist/src/core/common/function/getErrors.js +17 -0
  341. package/dist/src/core/common/function/getErrors.js.map +1 -0
  342. package/dist/src/core/common/function/getGlobalSetting.d.ts +12 -0
  343. package/dist/src/core/common/function/getGlobalSetting.js +21 -0
  344. package/dist/src/core/common/function/getGlobalSetting.js.map +1 -0
  345. package/dist/src/core/common/function/getHeaders.d.ts +13 -0
  346. package/dist/src/core/common/function/getHeaders.js +28 -0
  347. package/dist/src/core/common/function/getHeaders.js.map +1 -0
  348. package/dist/src/core/common/function/getJSONData.d.ts +13 -0
  349. package/dist/src/core/common/function/getJSONData.js +17 -0
  350. package/dist/src/core/common/function/getJSONData.js.map +1 -0
  351. package/dist/src/core/common/function/getJSONKeys.d.ts +17 -0
  352. package/dist/src/core/common/function/getJSONKeys.js +24 -0
  353. package/dist/src/core/common/function/getJSONKeys.js.map +1 -0
  354. package/dist/src/core/common/function/getMimeType.d.ts +12 -0
  355. package/dist/src/core/common/function/getMimeType.js +20 -0
  356. package/dist/src/core/common/function/getMimeType.js.map +1 -0
  357. package/dist/src/core/common/function/getNameFromUrl.d.ts +12 -0
  358. package/dist/src/core/common/function/getNameFromUrl.js +19 -0
  359. package/dist/src/core/common/function/getNameFromUrl.js.map +1 -0
  360. package/dist/src/core/common/function/getObjectData.d.ts +12 -0
  361. package/dist/src/core/common/function/getObjectData.js +27 -0
  362. package/dist/src/core/common/function/getObjectData.js.map +1 -0
  363. package/dist/src/core/common/function/getOptionFromApi.d.ts +17 -0
  364. package/dist/src/core/common/function/getOptionFromApi.js +24 -0
  365. package/dist/src/core/common/function/getOptionFromApi.js.map +1 -0
  366. package/dist/src/core/common/function/getOptions.d.ts +12 -0
  367. package/dist/src/core/common/function/getOptions.js +18 -0
  368. package/dist/src/core/common/function/getOptions.js.map +1 -0
  369. package/dist/src/core/common/function/getOriginalData.d.ts +17 -0
  370. package/dist/src/core/common/function/getOriginalData.js +18 -0
  371. package/dist/src/core/common/function/getOriginalData.js.map +1 -0
  372. package/dist/src/core/common/function/getParentData.d.ts +13 -0
  373. package/dist/src/core/common/function/getParentData.js +14 -0
  374. package/dist/src/core/common/function/getParentData.js.map +1 -0
  375. package/dist/src/core/common/function/getProfile.d.ts +13 -0
  376. package/dist/src/core/common/function/getProfile.js +30 -0
  377. package/dist/src/core/common/function/getProfile.js.map +1 -0
  378. package/dist/src/core/common/function/getProfileImage.d.ts +9 -0
  379. package/dist/src/core/common/function/getProfileImage.js +20 -0
  380. package/dist/src/core/common/function/getProfileImage.js.map +1 -0
  381. package/dist/src/core/common/function/getRawData.d.ts +12 -0
  382. package/dist/src/core/common/function/getRawData.js +17 -0
  383. package/dist/src/core/common/function/getRawData.js.map +1 -0
  384. package/dist/src/core/common/function/getRequestData.d.ts +11 -0
  385. package/dist/src/core/common/function/getRequestData.js +16 -0
  386. package/dist/src/core/common/function/getRequestData.js.map +1 -0
  387. package/dist/src/core/common/function/getRequestStatus.d.ts +9 -0
  388. package/dist/src/core/common/function/getRequestStatus.js +14 -0
  389. package/dist/src/core/common/function/getRequestStatus.js.map +1 -0
  390. package/dist/src/core/common/function/getResponse.d.ts +12 -0
  391. package/dist/src/core/common/function/getResponse.js +17 -0
  392. package/dist/src/core/common/function/getResponse.js.map +1 -0
  393. package/dist/src/core/common/function/getResult.d.ts +12 -0
  394. package/dist/src/core/common/function/getResult.js +17 -0
  395. package/dist/src/core/common/function/getResult.js.map +1 -0
  396. package/dist/src/core/common/function/getRunningNumber.d.ts +12 -0
  397. package/dist/src/core/common/function/getRunningNumber.js +19 -0
  398. package/dist/src/core/common/function/getRunningNumber.js.map +1 -0
  399. package/dist/src/core/common/function/getSetting.d.ts +12 -0
  400. package/dist/src/core/common/function/getSetting.js +17 -0
  401. package/dist/src/core/common/function/getSetting.js.map +1 -0
  402. package/dist/src/core/common/function/getStartExportdate.d.ts +17 -0
  403. package/dist/src/core/common/function/getStartExportdate.js +34 -0
  404. package/dist/src/core/common/function/getStartExportdate.js.map +1 -0
  405. package/dist/src/core/common/function/getTableColumn.d.ts +13 -0
  406. package/dist/src/core/common/function/getTableColumn.js +57 -0
  407. package/dist/src/core/common/function/getTableColumn.js.map +1 -0
  408. package/dist/src/core/common/function/getTimeLogs.d.ts +12 -0
  409. package/dist/src/core/common/function/getTimeLogs.js +17 -0
  410. package/dist/src/core/common/function/getTimeLogs.js.map +1 -0
  411. package/dist/src/core/common/function/hideString.d.ts +12 -0
  412. package/dist/src/core/common/function/hideString.js +27 -0
  413. package/dist/src/core/common/function/hideString.js.map +1 -0
  414. package/dist/src/core/common/function/ifConditions.d.ts +12 -0
  415. package/dist/src/core/common/function/ifConditions.js +27 -0
  416. package/dist/src/core/common/function/ifConditions.js.map +1 -0
  417. package/dist/src/core/common/function/isEmpty.d.ts +12 -0
  418. package/dist/src/core/common/function/isEmpty.js +18 -0
  419. package/dist/src/core/common/function/isEmpty.js.map +1 -0
  420. package/dist/src/core/common/function/jsonArray.d.ts +12 -0
  421. package/dist/src/core/common/function/jsonArray.js +22 -0
  422. package/dist/src/core/common/function/jsonArray.js.map +1 -0
  423. package/dist/src/core/common/function/last.d.ts +17 -0
  424. package/dist/src/core/common/function/last.js +25 -0
  425. package/dist/src/core/common/function/last.js.map +1 -0
  426. package/dist/src/core/common/function/leftString.d.ts +12 -0
  427. package/dist/src/core/common/function/leftString.js +20 -0
  428. package/dist/src/core/common/function/leftString.js.map +1 -0
  429. package/dist/src/core/common/function/length.d.ts +13 -0
  430. package/dist/src/core/common/function/length.js +21 -0
  431. package/dist/src/core/common/function/length.js.map +1 -0
  432. package/dist/src/core/common/function/mapping.d.ts +1185 -0
  433. package/dist/src/core/common/function/mapping.js +206 -0
  434. package/dist/src/core/common/function/mapping.js.map +1 -0
  435. package/dist/src/core/common/function/multiply.d.ts +13 -0
  436. package/dist/src/core/common/function/multiply.js +17 -0
  437. package/dist/src/core/common/function/multiply.js.map +1 -0
  438. package/dist/src/core/common/function/negativeValue.d.ts +13 -0
  439. package/dist/src/core/common/function/negativeValue.js +23 -0
  440. package/dist/src/core/common/function/negativeValue.js.map +1 -0
  441. package/dist/src/core/common/function/notConditions.d.ts +12 -0
  442. package/dist/src/core/common/function/notConditions.js +17 -0
  443. package/dist/src/core/common/function/notConditions.js.map +1 -0
  444. package/dist/src/core/common/function/numberInWord.d.ts +17 -0
  445. package/dist/src/core/common/function/numberInWord.js +34 -0
  446. package/dist/src/core/common/function/numberInWord.js.map +1 -0
  447. package/dist/src/core/common/function/objectId.d.ts +13 -0
  448. package/dist/src/core/common/function/objectId.js +16 -0
  449. package/dist/src/core/common/function/objectId.js.map +1 -0
  450. package/dist/src/core/common/function/orConditions.d.ts +12 -0
  451. package/dist/src/core/common/function/orConditions.js +17 -0
  452. package/dist/src/core/common/function/orConditions.js.map +1 -0
  453. package/dist/src/core/common/function/padStart.d.ts +17 -0
  454. package/dist/src/core/common/function/padStart.js +18 -0
  455. package/dist/src/core/common/function/padStart.js.map +1 -0
  456. package/dist/src/core/common/function/random.d.ts +12 -0
  457. package/dist/src/core/common/function/random.js +29 -0
  458. package/dist/src/core/common/function/random.js.map +1 -0
  459. package/dist/src/core/common/function/randomBytes.d.ts +12 -0
  460. package/dist/src/core/common/function/randomBytes.js +17 -0
  461. package/dist/src/core/common/function/randomBytes.js.map +1 -0
  462. package/dist/src/core/common/function/replaceString.d.ts +12 -0
  463. package/dist/src/core/common/function/replaceString.js +22 -0
  464. package/dist/src/core/common/function/replaceString.js.map +1 -0
  465. package/dist/src/core/common/function/rightString.d.ts +12 -0
  466. package/dist/src/core/common/function/rightString.js +20 -0
  467. package/dist/src/core/common/function/rightString.js.map +1 -0
  468. package/dist/src/core/common/function/round.d.ts +12 -0
  469. package/dist/src/core/common/function/round.js +23 -0
  470. package/dist/src/core/common/function/round.js.map +1 -0
  471. package/dist/src/core/common/function/runningNumber.d.ts +12 -0
  472. package/dist/src/core/common/function/runningNumber.js +26 -0
  473. package/dist/src/core/common/function/runningNumber.js.map +1 -0
  474. package/dist/src/core/common/function/subString.d.ts +12 -0
  475. package/dist/src/core/common/function/subString.js +19 -0
  476. package/dist/src/core/common/function/subString.js.map +1 -0
  477. package/dist/src/core/common/function/sumBy.d.ts +13 -0
  478. package/dist/src/core/common/function/sumBy.js +24 -0
  479. package/dist/src/core/common/function/sumBy.js.map +1 -0
  480. package/dist/src/core/common/function/sumData.d.ts +13 -0
  481. package/dist/src/core/common/function/sumData.js +28 -0
  482. package/dist/src/core/common/function/sumData.js.map +1 -0
  483. package/dist/src/core/common/function/sumIf.d.ts +13 -0
  484. package/dist/src/core/common/function/sumIf.js +26 -0
  485. package/dist/src/core/common/function/sumIf.js.map +1 -0
  486. package/dist/src/core/common/function/sumValue.d.ts +12 -0
  487. package/dist/src/core/common/function/sumValue.js +26 -0
  488. package/dist/src/core/common/function/sumValue.js.map +1 -0
  489. package/dist/src/core/common/function/toBoolean.d.ts +12 -0
  490. package/dist/src/core/common/function/toBoolean.js +23 -0
  491. package/dist/src/core/common/function/toBoolean.js.map +1 -0
  492. package/dist/src/core/common/function/toCamelCase.d.ts +13 -0
  493. package/dist/src/core/common/function/toCamelCase.js +16 -0
  494. package/dist/src/core/common/function/toCamelCase.js.map +1 -0
  495. package/dist/src/core/common/function/toFloat.d.ts +17 -0
  496. package/dist/src/core/common/function/toFloat.js +25 -0
  497. package/dist/src/core/common/function/toFloat.js.map +1 -0
  498. package/dist/src/core/common/function/toInt.d.ts +12 -0
  499. package/dist/src/core/common/function/toInt.js +20 -0
  500. package/dist/src/core/common/function/toInt.js.map +1 -0
  501. package/dist/src/core/common/function/toJson.d.ts +13 -0
  502. package/dist/src/core/common/function/toJson.js +16 -0
  503. package/dist/src/core/common/function/toJson.js.map +1 -0
  504. package/dist/src/core/common/function/toLowerCase.d.ts +13 -0
  505. package/dist/src/core/common/function/toLowerCase.js +16 -0
  506. package/dist/src/core/common/function/toLowerCase.js.map +1 -0
  507. package/dist/src/core/common/function/toPascalCase.d.ts +13 -0
  508. package/dist/src/core/common/function/toPascalCase.js +16 -0
  509. package/dist/src/core/common/function/toPascalCase.js.map +1 -0
  510. package/dist/src/core/common/function/toSnakeCase.d.ts +13 -0
  511. package/dist/src/core/common/function/toSnakeCase.js +16 -0
  512. package/dist/src/core/common/function/toSnakeCase.js.map +1 -0
  513. package/dist/src/core/common/function/toString.d.ts +12 -0
  514. package/dist/src/core/common/function/toString.js +25 -0
  515. package/dist/src/core/common/function/toString.js.map +1 -0
  516. package/dist/src/core/common/function/toUpperCase.d.ts +13 -0
  517. package/dist/src/core/common/function/toUpperCase.js +16 -0
  518. package/dist/src/core/common/function/toUpperCase.js.map +1 -0
  519. package/dist/src/core/common/function/translateOption.d.ts +17 -0
  520. package/dist/src/core/common/function/translateOption.js +55 -0
  521. package/dist/src/core/common/function/translateOption.js.map +1 -0
  522. package/dist/src/core/common/function/uploadImageFromUrl.d.ts +13 -0
  523. package/dist/src/core/common/function/uploadImageFromUrl.js +18 -0
  524. package/dist/src/core/common/function/uploadImageFromUrl.js.map +1 -0
  525. package/dist/src/core/common/interceptors/external.interceptor.d.ts +9 -0
  526. package/dist/src/core/common/interceptors/external.interceptor.js +113 -0
  527. package/dist/src/core/common/interceptors/external.interceptor.js.map +1 -0
  528. package/dist/src/core/common/interceptors/filter.interceptor.d.ts +8 -0
  529. package/dist/src/core/common/interceptors/filter.interceptor.js +192 -0
  530. package/dist/src/core/common/interceptors/filter.interceptor.js.map +1 -0
  531. package/dist/src/core/common/interface/external_data_source.interface.d.ts +16 -0
  532. package/dist/src/core/common/interface/external_data_source.interface.js +3 -0
  533. package/dist/src/core/common/interface/external_data_source.interface.js.map +1 -0
  534. package/dist/src/core/common/interface/module_setting.interface.d.ts +6 -0
  535. package/dist/src/core/common/interface/module_setting.interface.js +3 -0
  536. package/dist/src/core/common/interface/module_setting.interface.js.map +1 -0
  537. package/dist/src/core/common/utils/attachment.d.ts +5 -0
  538. package/dist/src/core/common/utils/attachment.js +50 -0
  539. package/dist/src/core/common/utils/attachment.js.map +1 -0
  540. package/dist/src/core/common/utils/authenticator.d.ts +5 -0
  541. package/dist/src/core/common/utils/authenticator.js +30 -0
  542. package/dist/src/core/common/utils/authenticator.js.map +1 -0
  543. package/dist/src/core/common/utils/build_search.d.ts +11 -0
  544. package/dist/src/core/common/utils/build_search.js +459 -0
  545. package/dist/src/core/common/utils/build_search.js.map +1 -0
  546. package/dist/src/core/common/utils/bull_queue.d.ts +24 -0
  547. package/dist/src/core/common/utils/bull_queue.js +156 -0
  548. package/dist/src/core/common/utils/bull_queue.js.map +1 -0
  549. package/dist/src/core/common/utils/chart.d.ts +12 -0
  550. package/dist/src/core/common/utils/chart.js +201 -0
  551. package/dist/src/core/common/utils/chart.js.map +1 -0
  552. package/dist/src/core/common/utils/common.d.ts +4 -0
  553. package/dist/src/core/common/utils/common.js +56 -0
  554. package/dist/src/core/common/utils/common.js.map +1 -0
  555. package/dist/src/core/common/utils/date.d.ts +7 -0
  556. package/dist/src/core/common/utils/date.js +97 -0
  557. package/dist/src/core/common/utils/date.js.map +1 -0
  558. package/dist/src/core/common/utils/decimal2Json.d.ts +4 -0
  559. package/dist/src/core/common/utils/decimal2Json.js +131 -0
  560. package/dist/src/core/common/utils/decimal2Json.js.map +1 -0
  561. package/dist/src/core/common/utils/diff.d.ts +3 -0
  562. package/dist/src/core/common/utils/diff.js +81 -0
  563. package/dist/src/core/common/utils/diff.js.map +1 -0
  564. package/dist/src/core/common/utils/entity.d.ts +13 -0
  565. package/dist/src/core/common/utils/entity.js +119 -0
  566. package/dist/src/core/common/utils/entity.js.map +1 -0
  567. package/dist/src/core/common/utils/eval.d.ts +3 -0
  568. package/dist/src/core/common/utils/eval.js +30 -0
  569. package/dist/src/core/common/utils/eval.js.map +1 -0
  570. package/dist/src/core/common/utils/example.d.ts +3 -0
  571. package/dist/src/core/common/utils/example.js +152 -0
  572. package/dist/src/core/common/utils/example.js.map +1 -0
  573. package/dist/src/core/common/utils/executions.d.ts +3 -0
  574. package/dist/src/core/common/utils/executions.js +73 -0
  575. package/dist/src/core/common/utils/executions.js.map +1 -0
  576. package/dist/src/core/common/utils/external_data.d.ts +2 -0
  577. package/dist/src/core/common/utils/external_data.js +20 -0
  578. package/dist/src/core/common/utils/external_data.js.map +1 -0
  579. package/dist/src/core/common/utils/external_module.d.ts +12 -0
  580. package/dist/src/core/common/utils/external_module.js +203 -0
  581. package/dist/src/core/common/utils/external_module.js.map +1 -0
  582. package/dist/src/core/common/utils/file.d.ts +6 -0
  583. package/dist/src/core/common/utils/file.js +80 -0
  584. package/dist/src/core/common/utils/file.js.map +1 -0
  585. package/dist/src/core/common/utils/form.d.ts +4 -0
  586. package/dist/src/core/common/utils/form.js +21 -0
  587. package/dist/src/core/common/utils/form.js.map +1 -0
  588. package/dist/src/core/common/utils/func.d.ts +17 -0
  589. package/dist/src/core/common/utils/func.js +314 -0
  590. package/dist/src/core/common/utils/func.js.map +1 -0
  591. package/dist/src/core/common/utils/global.d.ts +6 -0
  592. package/dist/src/core/common/utils/global.js +72 -0
  593. package/dist/src/core/common/utils/global.js.map +1 -0
  594. package/dist/src/core/common/utils/hook.d.ts +5 -0
  595. package/dist/src/core/common/utils/hook.js +188 -0
  596. package/dist/src/core/common/utils/hook.js.map +1 -0
  597. package/dist/src/core/common/utils/initial.d.ts +4 -0
  598. package/dist/src/core/common/utils/initial.js +318 -0
  599. package/dist/src/core/common/utils/initial.js.map +1 -0
  600. package/dist/src/core/common/utils/layout.d.ts +7 -0
  601. package/dist/src/core/common/utils/layout.js +160 -0
  602. package/dist/src/core/common/utils/layout.js.map +1 -0
  603. package/dist/src/core/common/utils/masking.d.ts +3 -0
  604. package/dist/src/core/common/utils/masking.js +55 -0
  605. package/dist/src/core/common/utils/masking.js.map +1 -0
  606. package/dist/src/core/common/utils/math.d.ts +2 -0
  607. package/dist/src/core/common/utils/math.js +8 -0
  608. package/dist/src/core/common/utils/math.js.map +1 -0
  609. package/dist/src/core/common/utils/media.d.ts +70 -0
  610. package/dist/src/core/common/utils/media.js +90 -0
  611. package/dist/src/core/common/utils/media.js.map +1 -0
  612. package/dist/src/core/common/utils/mongo.d.ts +4 -0
  613. package/dist/src/core/common/utils/mongo.js +891 -0
  614. package/dist/src/core/common/utils/mongo.js.map +1 -0
  615. package/dist/src/core/common/utils/mongoose.d.ts +2 -0
  616. package/dist/src/core/common/utils/mongoose.js +152 -0
  617. package/dist/src/core/common/utils/mongoose.js.map +1 -0
  618. package/dist/src/core/common/utils/ocr.d.ts +1 -0
  619. package/dist/src/core/common/utils/ocr.js +35 -0
  620. package/dist/src/core/common/utils/ocr.js.map +1 -0
  621. package/dist/src/core/common/utils/otp.d.ts +16 -0
  622. package/dist/src/core/common/utils/otp.js +103 -0
  623. package/dist/src/core/common/utils/otp.js.map +1 -0
  624. package/dist/src/core/common/utils/permission.d.ts +5 -0
  625. package/dist/src/core/common/utils/permission.js +122 -0
  626. package/dist/src/core/common/utils/permission.js.map +1 -0
  627. package/dist/src/core/common/utils/random.d.ts +2 -0
  628. package/dist/src/core/common/utils/random.js +14 -0
  629. package/dist/src/core/common/utils/random.js.map +1 -0
  630. package/dist/src/core/common/utils/recaptcha.d.ts +1 -0
  631. package/dist/src/core/common/utils/recaptcha.js +21 -0
  632. package/dist/src/core/common/utils/recaptcha.js.map +1 -0
  633. package/dist/src/core/common/utils/redis.d.ts +31 -0
  634. package/dist/src/core/common/utils/redis.js +261 -0
  635. package/dist/src/core/common/utils/redis.js.map +1 -0
  636. package/dist/src/core/common/utils/regex.d.ts +1 -0
  637. package/dist/src/core/common/utils/regex.js +8 -0
  638. package/dist/src/core/common/utils/regex.js.map +1 -0
  639. package/dist/src/core/common/utils/replace.d.ts +5 -0
  640. package/dist/src/core/common/utils/replace.js +84 -0
  641. package/dist/src/core/common/utils/replace.js.map +1 -0
  642. package/dist/src/core/common/utils/request.d.ts +5 -0
  643. package/dist/src/core/common/utils/request.js +82 -0
  644. package/dist/src/core/common/utils/request.js.map +1 -0
  645. package/dist/src/core/common/utils/retry.d.ts +1 -0
  646. package/dist/src/core/common/utils/retry.js +30 -0
  647. package/dist/src/core/common/utils/retry.js.map +1 -0
  648. package/dist/src/core/common/utils/rewrite_url.d.ts +4 -0
  649. package/dist/src/core/common/utils/rewrite_url.js +18 -0
  650. package/dist/src/core/common/utils/rewrite_url.js.map +1 -0
  651. package/dist/src/core/common/utils/running.d.ts +1 -0
  652. package/dist/src/core/common/utils/running.js +46 -0
  653. package/dist/src/core/common/utils/running.js.map +1 -0
  654. package/dist/src/core/common/utils/schedule.d.ts +1 -0
  655. package/dist/src/core/common/utils/schedule.js +15 -0
  656. package/dist/src/core/common/utils/schedule.js.map +1 -0
  657. package/dist/src/core/common/utils/schema.d.ts +65 -0
  658. package/dist/src/core/common/utils/schema.js +2629 -0
  659. package/dist/src/core/common/utils/schema.js.map +1 -0
  660. package/dist/src/core/common/utils/sleep.d.ts +2 -0
  661. package/dist/src/core/common/utils/sleep.js +8 -0
  662. package/dist/src/core/common/utils/sleep.js.map +1 -0
  663. package/dist/src/core/common/utils/template.d.ts +2 -0
  664. package/dist/src/core/common/utils/template.js +169 -0
  665. package/dist/src/core/common/utils/template.js.map +1 -0
  666. package/dist/src/core/common/utils/text_search.d.ts +27 -0
  667. package/dist/src/core/common/utils/text_search.js +237 -0
  668. package/dist/src/core/common/utils/text_search.js.map +1 -0
  669. package/dist/src/core/common/utils/time.d.ts +1 -0
  670. package/dist/src/core/common/utils/time.js +17 -0
  671. package/dist/src/core/common/utils/time.js.map +1 -0
  672. package/dist/src/core/common/utils/token.d.ts +5 -0
  673. package/dist/src/core/common/utils/token.js +13 -0
  674. package/dist/src/core/common/utils/token.js.map +1 -0
  675. package/dist/src/core/common/utils/transform.d.ts +8 -0
  676. package/dist/src/core/common/utils/transform.js +409 -0
  677. package/dist/src/core/common/utils/transform.js.map +1 -0
  678. package/dist/src/core/common/utils/translate.d.ts +5 -0
  679. package/dist/src/core/common/utils/translate.js +73 -0
  680. package/dist/src/core/common/utils/translate.js.map +1 -0
  681. package/dist/src/core/common/utils/validate.d.ts +6 -0
  682. package/dist/src/core/common/utils/validate.js +323 -0
  683. package/dist/src/core/common/utils/validate.js.map +1 -0
  684. package/dist/src/core/company/company.constant.d.ts +9 -0
  685. package/dist/src/core/company/company.constant.js +13 -0
  686. package/dist/src/core/company/company.constant.js.map +1 -0
  687. package/dist/src/core/company/company.layout.d.ts +2 -0
  688. package/dist/src/core/company/company.layout.js +507 -0
  689. package/dist/src/core/company/company.layout.js.map +1 -0
  690. package/dist/src/core/company/company.module.d.ts +2 -0
  691. package/dist/src/core/company/company.module.js +40 -0
  692. package/dist/src/core/company/company.module.js.map +1 -0
  693. package/dist/src/core/company/company.schema.d.ts +25 -0
  694. package/dist/src/core/company/company.schema.js +137 -0
  695. package/dist/src/core/company/company.schema.js.map +1 -0
  696. package/dist/src/core/company/company.service.d.ts +22 -0
  697. package/dist/src/core/company/company.service.js +140 -0
  698. package/dist/src/core/company/company.service.js.map +1 -0
  699. package/dist/src/core/config/attachment.d.ts +15 -0
  700. package/dist/src/core/config/attachment.js +35 -0
  701. package/dist/src/core/config/attachment.js.map +1 -0
  702. package/dist/src/core/config/auth.d.ts +4 -0
  703. package/dist/src/core/config/auth.js +6 -0
  704. package/dist/src/core/config/auth.js.map +1 -0
  705. package/dist/src/core/config/cache.d.ts +5 -0
  706. package/dist/src/core/config/cache.js +7 -0
  707. package/dist/src/core/config/cache.js.map +1 -0
  708. package/dist/src/core/config/mongodb.d.ts +4 -0
  709. package/dist/src/core/config/mongodb.js +6 -0
  710. package/dist/src/core/config/mongodb.js.map +1 -0
  711. package/dist/src/core/config/queue.d.ts +4 -0
  712. package/dist/src/core/config/queue.js +6 -0
  713. package/dist/src/core/config/queue.js.map +1 -0
  714. package/dist/src/core/config/schedule_action.d.ts +5 -0
  715. package/dist/src/core/config/schedule_action.js +7 -0
  716. package/dist/src/core/config/schedule_action.js.map +1 -0
  717. package/dist/src/core/core.controller.d.ts +51 -0
  718. package/dist/src/core/core.controller.js +555 -0
  719. package/dist/src/core/core.controller.js.map +1 -0
  720. package/dist/src/core/core.module.d.ts +2 -0
  721. package/dist/src/core/core.module.js +101 -0
  722. package/dist/src/core/core.module.js.map +1 -0
  723. package/dist/src/core/core.service.d.ts +121 -0
  724. package/dist/src/core/core.service.js +716 -0
  725. package/dist/src/core/core.service.js.map +1 -0
  726. package/dist/src/core/currency/currency.layout.d.ts +2 -0
  727. package/dist/src/core/currency/currency.layout.js +194 -0
  728. package/dist/src/core/currency/currency.layout.js.map +1 -0
  729. package/dist/src/core/currency/currency.module.d.ts +2 -0
  730. package/dist/src/core/currency/currency.module.js +38 -0
  731. package/dist/src/core/currency/currency.module.js.map +1 -0
  732. package/dist/src/core/currency/currency.schema.d.ts +9 -0
  733. package/dist/src/core/currency/currency.schema.js +30 -0
  734. package/dist/src/core/currency/currency.schema.js.map +1 -0
  735. package/dist/src/core/currency/currency.service.d.ts +13 -0
  736. package/dist/src/core/currency/currency.service.js +55 -0
  737. package/dist/src/core/currency/currency.service.js.map +1 -0
  738. package/dist/src/core/currency/data/currency.json +646 -0
  739. package/dist/src/core/custom_function/custom_function.controller.d.ts +7 -0
  740. package/dist/src/core/custom_function/custom_function.controller.js +50 -0
  741. package/dist/src/core/custom_function/custom_function.controller.js.map +1 -0
  742. package/dist/src/core/custom_function/custom_function.enum.d.ts +22 -0
  743. package/dist/src/core/custom_function/custom_function.enum.js +28 -0
  744. package/dist/src/core/custom_function/custom_function.enum.js.map +1 -0
  745. package/dist/src/core/custom_function/custom_function.layout.d.ts +2 -0
  746. package/dist/src/core/custom_function/custom_function.layout.js +521 -0
  747. package/dist/src/core/custom_function/custom_function.layout.js.map +1 -0
  748. package/dist/src/core/custom_function/custom_function.module.d.ts +2 -0
  749. package/dist/src/core/custom_function/custom_function.module.js +41 -0
  750. package/dist/src/core/custom_function/custom_function.module.js.map +1 -0
  751. package/dist/src/core/custom_function/custom_function.schema.d.ts +15 -0
  752. package/dist/src/core/custom_function/custom_function.schema.js +68 -0
  753. package/dist/src/core/custom_function/custom_function.schema.js.map +1 -0
  754. package/dist/src/core/custom_function/custom_function.service.d.ts +18 -0
  755. package/dist/src/core/custom_function/custom_function.service.js +116 -0
  756. package/dist/src/core/custom_function/custom_function.service.js.map +1 -0
  757. package/dist/src/core/database/database.constant.d.ts +35 -0
  758. package/dist/src/core/database/database.constant.js +218 -0
  759. package/dist/src/core/database/database.constant.js.map +1 -0
  760. package/dist/src/core/database/database.controller.d.ts +8 -0
  761. package/dist/src/core/database/database.controller.js +56 -0
  762. package/dist/src/core/database/database.controller.js.map +1 -0
  763. package/dist/src/core/database/database.module.d.ts +2 -0
  764. package/dist/src/core/database/database.module.js +24 -0
  765. package/dist/src/core/database/database.module.js.map +1 -0
  766. package/dist/src/core/database/database.service.d.ts +13 -0
  767. package/dist/src/core/database/database.service.js +184 -0
  768. package/dist/src/core/database/database.service.js.map +1 -0
  769. package/dist/src/core/deploy/deploy.action.d.ts +3 -0
  770. package/dist/src/core/deploy/deploy.action.js +82 -0
  771. package/dist/src/core/deploy/deploy.action.js.map +1 -0
  772. package/dist/src/core/deploy/deploy.controller.d.ts +7 -0
  773. package/dist/src/core/deploy/deploy.controller.js +53 -0
  774. package/dist/src/core/deploy/deploy.controller.js.map +1 -0
  775. package/dist/src/core/deploy/deploy.enum.d.ts +5 -0
  776. package/dist/src/core/deploy/deploy.enum.js +10 -0
  777. package/dist/src/core/deploy/deploy.enum.js.map +1 -0
  778. package/dist/src/core/deploy/deploy.layout.d.ts +4 -0
  779. package/dist/src/core/deploy/deploy.layout.js +1110 -0
  780. package/dist/src/core/deploy/deploy.layout.js.map +1 -0
  781. package/dist/src/core/deploy/deploy.module.d.ts +2 -0
  782. package/dist/src/core/deploy/deploy.module.js +57 -0
  783. package/dist/src/core/deploy/deploy.module.js.map +1 -0
  784. package/dist/src/core/deploy/deploy.schema.d.ts +28 -0
  785. package/dist/src/core/deploy/deploy.schema.js +111 -0
  786. package/dist/src/core/deploy/deploy.schema.js.map +1 -0
  787. package/dist/src/core/deploy/deploy.service.d.ts +38 -0
  788. package/dist/src/core/deploy/deploy.service.js +557 -0
  789. package/dist/src/core/deploy/deploy.service.js.map +1 -0
  790. package/dist/src/core/deploy/log/deploy_log.schema.d.ts +20 -0
  791. package/dist/src/core/deploy/log/deploy_log.schema.js +90 -0
  792. package/dist/src/core/deploy/log/deploy_log.schema.js.map +1 -0
  793. package/dist/src/core/deploy/log/deploy_log.service.d.ts +12 -0
  794. package/dist/src/core/deploy/log/deploy_log.service.js +44 -0
  795. package/dist/src/core/deploy/log/deploy_log.service.js.map +1 -0
  796. package/dist/src/core/entities/entities.controller.d.ts +69 -0
  797. package/dist/src/core/entities/entities.controller.js +801 -0
  798. package/dist/src/core/entities/entities.controller.js.map +1 -0
  799. package/dist/src/core/entities/entities.module.d.ts +2 -0
  800. package/dist/src/core/entities/entities.module.js +38 -0
  801. package/dist/src/core/entities/entities.module.js.map +1 -0
  802. package/dist/src/core/entities/entities.service.d.ts +71 -0
  803. package/dist/src/core/entities/entities.service.js +2271 -0
  804. package/dist/src/core/entities/entities.service.js.map +1 -0
  805. package/dist/src/core/entities/entity.enum.d.ts +33 -0
  806. package/dist/src/core/entities/entity.enum.js +44 -0
  807. package/dist/src/core/entities/entity.enum.js.map +1 -0
  808. package/dist/src/core/entities/entity.schema.d.ts +357 -0
  809. package/dist/src/core/entities/entity.schema.js +1460 -0
  810. package/dist/src/core/entities/entity.schema.js.map +1 -0
  811. package/dist/src/core/entities/provider/data_permission.base.d.ts +4 -0
  812. package/dist/src/core/entities/provider/data_permission.base.js +10 -0
  813. package/dist/src/core/entities/provider/data_permission.base.js.map +1 -0
  814. package/dist/src/core/entities/provider/data_permission.interface.d.ts +3 -0
  815. package/dist/src/core/entities/provider/data_permission.interface.js +3 -0
  816. package/dist/src/core/entities/provider/data_permission.interface.js.map +1 -0
  817. package/dist/src/core/execution_log/execution_log.enum.d.ts +4 -0
  818. package/dist/src/core/execution_log/execution_log.enum.js +9 -0
  819. package/dist/src/core/execution_log/execution_log.enum.js.map +1 -0
  820. package/dist/src/core/execution_log/execution_log.layout.d.ts +2 -0
  821. package/dist/src/core/execution_log/execution_log.layout.js +226 -0
  822. package/dist/src/core/execution_log/execution_log.layout.js.map +1 -0
  823. package/dist/src/core/execution_log/execution_log.module.d.ts +2 -0
  824. package/dist/src/core/execution_log/execution_log.module.js +39 -0
  825. package/dist/src/core/execution_log/execution_log.module.js.map +1 -0
  826. package/dist/src/core/execution_log/execution_log.schema.d.ts +13 -0
  827. package/dist/src/core/execution_log/execution_log.schema.js +58 -0
  828. package/dist/src/core/execution_log/execution_log.schema.js.map +1 -0
  829. package/dist/src/core/execution_log/execution_log.service.d.ts +12 -0
  830. package/dist/src/core/execution_log/execution_log.service.js +47 -0
  831. package/dist/src/core/execution_log/execution_log.service.js.map +1 -0
  832. package/dist/src/core/external_provider/external_provider.controller.d.ts +6 -0
  833. package/dist/src/core/external_provider/external_provider.controller.js +41 -0
  834. package/dist/src/core/external_provider/external_provider.controller.js.map +1 -0
  835. package/dist/src/core/external_provider/external_provider.module.d.ts +2 -0
  836. package/dist/src/core/external_provider/external_provider.module.js +29 -0
  837. package/dist/src/core/external_provider/external_provider.module.js.map +1 -0
  838. package/dist/src/core/external_provider/external_provider.service.d.ts +18 -0
  839. package/dist/src/core/external_provider/external_provider.service.js +32 -0
  840. package/dist/src/core/external_provider/external_provider.service.js.map +1 -0
  841. package/dist/src/core/guards/csrf.guard.d.ts +9 -0
  842. package/dist/src/core/guards/csrf.guard.js +57 -0
  843. package/dist/src/core/guards/csrf.guard.js.map +1 -0
  844. package/dist/src/core/import_export/import_export.controller.d.ts +28 -0
  845. package/dist/src/core/import_export/import_export.controller.js +201 -0
  846. package/dist/src/core/import_export/import_export.controller.js.map +1 -0
  847. package/dist/src/core/import_export/import_export.enum.d.ts +24 -0
  848. package/dist/src/core/import_export/import_export.enum.js +32 -0
  849. package/dist/src/core/import_export/import_export.enum.js.map +1 -0
  850. package/dist/src/core/import_export/import_export.hook.d.ts +16 -0
  851. package/dist/src/core/import_export/import_export.hook.js +24 -0
  852. package/dist/src/core/import_export/import_export.hook.js.map +1 -0
  853. package/dist/src/core/import_export/import_export.layout.d.ts +2 -0
  854. package/dist/src/core/import_export/import_export.layout.js +2059 -0
  855. package/dist/src/core/import_export/import_export.layout.js.map +1 -0
  856. package/dist/src/core/import_export/import_export.module.d.ts +2 -0
  857. package/dist/src/core/import_export/import_export.module.js +51 -0
  858. package/dist/src/core/import_export/import_export.module.js.map +1 -0
  859. package/dist/src/core/import_export/import_export.schema.d.ts +40 -0
  860. package/dist/src/core/import_export/import_export.schema.js +175 -0
  861. package/dist/src/core/import_export/import_export.schema.js.map +1 -0
  862. package/dist/src/core/import_export/import_export.service.d.ts +94 -0
  863. package/dist/src/core/import_export/import_export.service.js +2723 -0
  864. package/dist/src/core/import_export/import_export.service.js.map +1 -0
  865. package/dist/src/core/import_export/import_export.utils.d.ts +3 -0
  866. package/dist/src/core/import_export/import_export.utils.js +21 -0
  867. package/dist/src/core/import_export/import_export.utils.js.map +1 -0
  868. package/dist/src/core/import_export/log/import_export_log.layout.d.ts +2 -0
  869. package/dist/src/core/import_export/log/import_export_log.layout.js +423 -0
  870. package/dist/src/core/import_export/log/import_export_log.layout.js.map +1 -0
  871. package/dist/src/core/import_export/log/import_export_log.schema.d.ts +23 -0
  872. package/dist/src/core/import_export/log/import_export_log.schema.js +131 -0
  873. package/dist/src/core/import_export/log/import_export_log.schema.js.map +1 -0
  874. package/dist/src/core/import_export/log/import_export_log.service.d.ts +12 -0
  875. package/dist/src/core/import_export/log/import_export_log.service.js +49 -0
  876. package/dist/src/core/import_export/log/import_export_log.service.js.map +1 -0
  877. package/dist/src/core/import_export/provider/export.provider.d.ts +8 -0
  878. package/dist/src/core/import_export/provider/export.provider.js +244 -0
  879. package/dist/src/core/import_export/provider/export.provider.js.map +1 -0
  880. package/dist/src/core/import_export/provider/import.provider.d.ts +8 -0
  881. package/dist/src/core/import_export/provider/import.provider.js +238 -0
  882. package/dist/src/core/import_export/provider/import.provider.js.map +1 -0
  883. package/dist/src/core/import_export/provider/provider.base.d.ts +8 -0
  884. package/dist/src/core/import_export/provider/provider.base.js +19 -0
  885. package/dist/src/core/import_export/provider/provider.base.js.map +1 -0
  886. package/dist/src/core/import_export/provider/provider.interface.d.ts +6 -0
  887. package/dist/src/core/import_export/provider/provider.interface.js +3 -0
  888. package/dist/src/core/import_export/provider/provider.interface.js.map +1 -0
  889. package/dist/src/core/index.d.ts +271 -0
  890. package/dist/src/core/index.js +668 -0
  891. package/dist/src/core/index.js.map +1 -0
  892. package/dist/src/core/language/langauge.constant.d.ts +9 -0
  893. package/dist/src/core/language/langauge.constant.js +13 -0
  894. package/dist/src/core/language/langauge.constant.js.map +1 -0
  895. package/dist/src/core/language/langauge.enum.d.ts +4 -0
  896. package/dist/src/core/language/langauge.enum.js +9 -0
  897. package/dist/src/core/language/langauge.enum.js.map +1 -0
  898. package/dist/src/core/language/language.controller.d.ts +6 -0
  899. package/dist/src/core/language/language.controller.js +36 -0
  900. package/dist/src/core/language/language.controller.js.map +1 -0
  901. package/dist/src/core/language/language.hook.d.ts +13 -0
  902. package/dist/src/core/language/language.hook.js +36 -0
  903. package/dist/src/core/language/language.hook.js.map +1 -0
  904. package/dist/src/core/language/language.layout.d.ts +2 -0
  905. package/dist/src/core/language/language.layout.js +299 -0
  906. package/dist/src/core/language/language.layout.js.map +1 -0
  907. package/dist/src/core/language/language.module.d.ts +2 -0
  908. package/dist/src/core/language/language.module.js +42 -0
  909. package/dist/src/core/language/language.module.js.map +1 -0
  910. package/dist/src/core/language/language.schema.d.ts +13 -0
  911. package/dist/src/core/language/language.schema.js +57 -0
  912. package/dist/src/core/language/language.schema.js.map +1 -0
  913. package/dist/src/core/language/language.service.d.ts +14 -0
  914. package/dist/src/core/language/language.service.js +76 -0
  915. package/dist/src/core/language/language.service.js.map +1 -0
  916. package/dist/src/core/layout/chart_widget/chart_widget.controller.d.ts +7 -0
  917. package/dist/src/core/layout/chart_widget/chart_widget.controller.js +54 -0
  918. package/dist/src/core/layout/chart_widget/chart_widget.controller.js.map +1 -0
  919. package/dist/src/core/layout/chart_widget/chart_widget.service.d.ts +36 -0
  920. package/dist/src/core/layout/chart_widget/chart_widget.service.js +1355 -0
  921. package/dist/src/core/layout/chart_widget/chart_widget.service.js.map +1 -0
  922. package/dist/src/core/layout/layout.constant.d.ts +17 -0
  923. package/dist/src/core/layout/layout.constant.js +23 -0
  924. package/dist/src/core/layout/layout.constant.js.map +1 -0
  925. package/dist/src/core/layout/layout.module.d.ts +2 -0
  926. package/dist/src/core/layout/layout.module.js +43 -0
  927. package/dist/src/core/layout/layout.module.js.map +1 -0
  928. package/dist/src/core/layout/share_widget/share_widget.layout.d.ts +2 -0
  929. package/dist/src/core/layout/share_widget/share_widget.layout.js +5 -0
  930. package/dist/src/core/layout/share_widget/share_widget.layout.js.map +1 -0
  931. package/dist/src/core/layout/share_widget/share_widget.schema.d.ts +14 -0
  932. package/dist/src/core/layout/share_widget/share_widget.schema.js +80 -0
  933. package/dist/src/core/layout/share_widget/share_widget.schema.js.map +1 -0
  934. package/dist/src/core/layout/share_widget/share_widget.service.d.ts +19 -0
  935. package/dist/src/core/layout/share_widget/share_widget.service.js +110 -0
  936. package/dist/src/core/layout/share_widget/share_widget.service.js.map +1 -0
  937. package/dist/src/core/mail/log/mail_log.layout.d.ts +2 -0
  938. package/dist/src/core/mail/log/mail_log.layout.js +697 -0
  939. package/dist/src/core/mail/log/mail_log.layout.js.map +1 -0
  940. package/dist/src/core/mail/log/mail_log.schema.d.ts +21 -0
  941. package/dist/src/core/mail/log/mail_log.schema.js +94 -0
  942. package/dist/src/core/mail/log/mail_log.schema.js.map +1 -0
  943. package/dist/src/core/mail/log/mail_log.service.d.ts +12 -0
  944. package/dist/src/core/mail/log/mail_log.service.js +49 -0
  945. package/dist/src/core/mail/log/mail_log.service.js.map +1 -0
  946. package/dist/src/core/mail/mail.controller.d.ts +7 -0
  947. package/dist/src/core/mail/mail.controller.js +50 -0
  948. package/dist/src/core/mail/mail.controller.js.map +1 -0
  949. package/dist/src/core/mail/mail.custom_actions.d.ts +27 -0
  950. package/dist/src/core/mail/mail.custom_actions.js +35 -0
  951. package/dist/src/core/mail/mail.custom_actions.js.map +1 -0
  952. package/dist/src/core/mail/mail.enum.d.ts +3 -0
  953. package/dist/src/core/mail/mail.enum.js +8 -0
  954. package/dist/src/core/mail/mail.enum.js.map +1 -0
  955. package/dist/src/core/mail/mail.hook.d.ts +15 -0
  956. package/dist/src/core/mail/mail.hook.js +23 -0
  957. package/dist/src/core/mail/mail.hook.js.map +1 -0
  958. package/dist/src/core/mail/mail.layout.d.ts +2 -0
  959. package/dist/src/core/mail/mail.layout.js +653 -0
  960. package/dist/src/core/mail/mail.layout.js.map +1 -0
  961. package/dist/src/core/mail/mail.module.d.ts +2 -0
  962. package/dist/src/core/mail/mail.module.js +50 -0
  963. package/dist/src/core/mail/mail.module.js.map +1 -0
  964. package/dist/src/core/mail/mail.schema.d.ts +24 -0
  965. package/dist/src/core/mail/mail.schema.js +106 -0
  966. package/dist/src/core/mail/mail.schema.js.map +1 -0
  967. package/dist/src/core/mail/mail.service.d.ts +19 -0
  968. package/dist/src/core/mail/mail.service.js +193 -0
  969. package/dist/src/core/mail/mail.service.js.map +1 -0
  970. package/dist/src/core/map_location/map_location.layout.d.ts +2 -0
  971. package/dist/src/core/map_location/map_location.layout.js +102 -0
  972. package/dist/src/core/map_location/map_location.layout.js.map +1 -0
  973. package/dist/src/core/map_location/map_location.schema.d.ts +10 -0
  974. package/dist/src/core/map_location/map_location.schema.js +46 -0
  975. package/dist/src/core/map_location/map_location.schema.js.map +1 -0
  976. package/dist/src/core/map_location/map_location.service.d.ts +12 -0
  977. package/dist/src/core/map_location/map_location.service.js +44 -0
  978. package/dist/src/core/map_location/map_location.service.js.map +1 -0
  979. package/dist/src/core/map_location/map_locatioon.module.d.ts +2 -0
  980. package/dist/src/core/map_location/map_locatioon.module.js +38 -0
  981. package/dist/src/core/map_location/map_locatioon.module.js.map +1 -0
  982. package/dist/src/core/middlewares/request.middleware.d.ts +2 -0
  983. package/dist/src/core/middlewares/request.middleware.js +11 -0
  984. package/dist/src/core/middlewares/request.middleware.js.map +1 -0
  985. package/dist/src/core/notification/log/log.layout.d.ts +2 -0
  986. package/dist/src/core/notification/log/log.layout.js +19 -0
  987. package/dist/src/core/notification/log/log.layout.js.map +1 -0
  988. package/dist/src/core/notification/log/log.schema.d.ts +23 -0
  989. package/dist/src/core/notification/log/log.schema.js +94 -0
  990. package/dist/src/core/notification/log/log.schema.js.map +1 -0
  991. package/dist/src/core/notification/log/log.service.d.ts +12 -0
  992. package/dist/src/core/notification/log/log.service.js +45 -0
  993. package/dist/src/core/notification/log/log.service.js.map +1 -0
  994. package/dist/src/core/notification/message/message.controller.d.ts +6 -0
  995. package/dist/src/core/notification/message/message.controller.js +36 -0
  996. package/dist/src/core/notification/message/message.controller.js.map +1 -0
  997. package/dist/src/core/notification/message/message.custom_action.d.ts +15 -0
  998. package/dist/src/core/notification/message/message.custom_action.js +21 -0
  999. package/dist/src/core/notification/message/message.custom_action.js.map +1 -0
  1000. package/dist/src/core/notification/message/message.layout.d.ts +2 -0
  1001. package/dist/src/core/notification/message/message.layout.js +732 -0
  1002. package/dist/src/core/notification/message/message.layout.js.map +1 -0
  1003. package/dist/src/core/notification/message/message.schema.d.ts +22 -0
  1004. package/dist/src/core/notification/message/message.schema.js +97 -0
  1005. package/dist/src/core/notification/message/message.schema.js.map +1 -0
  1006. package/dist/src/core/notification/message/message.service.d.ts +23 -0
  1007. package/dist/src/core/notification/message/message.service.js +203 -0
  1008. package/dist/src/core/notification/message/message.service.js.map +1 -0
  1009. package/dist/src/core/notification/message/message.workflow.d.ts +2 -0
  1010. package/dist/src/core/notification/message/message.workflow.js +455 -0
  1011. package/dist/src/core/notification/message/message.workflow.js.map +1 -0
  1012. package/dist/src/core/notification/message_queue/message_queue.controller.d.ts +6 -0
  1013. package/dist/src/core/notification/message_queue/message_queue.controller.js +36 -0
  1014. package/dist/src/core/notification/message_queue/message_queue.controller.js.map +1 -0
  1015. package/dist/src/core/notification/message_queue/message_queue.layout.d.ts +2 -0
  1016. package/dist/src/core/notification/message_queue/message_queue.layout.js +5 -0
  1017. package/dist/src/core/notification/message_queue/message_queue.layout.js.map +1 -0
  1018. package/dist/src/core/notification/message_queue/message_queue.schema.d.ts +17 -0
  1019. package/dist/src/core/notification/message_queue/message_queue.schema.js +63 -0
  1020. package/dist/src/core/notification/message_queue/message_queue.schema.js.map +1 -0
  1021. package/dist/src/core/notification/message_queue/message_queue.service.d.ts +16 -0
  1022. package/dist/src/core/notification/message_queue/message_queue.service.js +151 -0
  1023. package/dist/src/core/notification/message_queue/message_queue.service.js.map +1 -0
  1024. package/dist/src/core/notification/notification.constant.d.ts +8 -0
  1025. package/dist/src/core/notification/notification.constant.js +13 -0
  1026. package/dist/src/core/notification/notification.constant.js.map +1 -0
  1027. package/dist/src/core/notification/notification.module.d.ts +2 -0
  1028. package/dist/src/core/notification/notification.module.js +85 -0
  1029. package/dist/src/core/notification/notification.module.js.map +1 -0
  1030. package/dist/src/core/notification/subscription /subscription.controller.d.ts +7 -0
  1031. package/dist/src/core/notification/subscription /subscription.controller.js +51 -0
  1032. package/dist/src/core/notification/subscription /subscription.controller.js.map +1 -0
  1033. package/dist/src/core/notification/subscription /subscription.layout.d.ts +2 -0
  1034. package/dist/src/core/notification/subscription /subscription.layout.js +5 -0
  1035. package/dist/src/core/notification/subscription /subscription.layout.js.map +1 -0
  1036. package/dist/src/core/notification/subscription /subscription.schema.d.ts +11 -0
  1037. package/dist/src/core/notification/subscription /subscription.schema.js +48 -0
  1038. package/dist/src/core/notification/subscription /subscription.schema.js.map +1 -0
  1039. package/dist/src/core/notification/subscription /subscription.service.d.ts +14 -0
  1040. package/dist/src/core/notification/subscription /subscription.service.js +82 -0
  1041. package/dist/src/core/notification/subscription /subscription.service.js.map +1 -0
  1042. package/dist/src/core/pipeline/job/job.controller.d.ts +8 -0
  1043. package/dist/src/core/pipeline/job/job.controller.js +59 -0
  1044. package/dist/src/core/pipeline/job/job.controller.js.map +1 -0
  1045. package/dist/src/core/pipeline/job/job.layout.d.ts +2 -0
  1046. package/dist/src/core/pipeline/job/job.layout.js +5 -0
  1047. package/dist/src/core/pipeline/job/job.layout.js.map +1 -0
  1048. package/dist/src/core/pipeline/job/job.schema.d.ts +16 -0
  1049. package/dist/src/core/pipeline/job/job.schema.js +80 -0
  1050. package/dist/src/core/pipeline/job/job.schema.js.map +1 -0
  1051. package/dist/src/core/pipeline/job/job.service.d.ts +21 -0
  1052. package/dist/src/core/pipeline/job/job.service.js +259 -0
  1053. package/dist/src/core/pipeline/job/job.service.js.map +1 -0
  1054. package/dist/src/core/pipeline/log/log.layout.d.ts +2 -0
  1055. package/dist/src/core/pipeline/log/log.layout.js +276 -0
  1056. package/dist/src/core/pipeline/log/log.layout.js.map +1 -0
  1057. package/dist/src/core/pipeline/log/log.schema.d.ts +20 -0
  1058. package/dist/src/core/pipeline/log/log.schema.js +93 -0
  1059. package/dist/src/core/pipeline/log/log.schema.js.map +1 -0
  1060. package/dist/src/core/pipeline/log/log.service.d.ts +12 -0
  1061. package/dist/src/core/pipeline/log/log.service.js +48 -0
  1062. package/dist/src/core/pipeline/log/log.service.js.map +1 -0
  1063. package/dist/src/core/pipeline/pipeline.controller.d.ts +6 -0
  1064. package/dist/src/core/pipeline/pipeline.controller.js +41 -0
  1065. package/dist/src/core/pipeline/pipeline.controller.js.map +1 -0
  1066. package/dist/src/core/pipeline/pipeline.dto.d.ts +5 -0
  1067. package/dist/src/core/pipeline/pipeline.dto.js +7 -0
  1068. package/dist/src/core/pipeline/pipeline.dto.js.map +1 -0
  1069. package/dist/src/core/pipeline/pipeline.enum.d.ts +16 -0
  1070. package/dist/src/core/pipeline/pipeline.enum.js +23 -0
  1071. package/dist/src/core/pipeline/pipeline.enum.js.map +1 -0
  1072. package/dist/src/core/pipeline/pipeline.layout.d.ts +2 -0
  1073. package/dist/src/core/pipeline/pipeline.layout.js +625 -0
  1074. package/dist/src/core/pipeline/pipeline.layout.js.map +1 -0
  1075. package/dist/src/core/pipeline/pipeline.module.d.ts +2 -0
  1076. package/dist/src/core/pipeline/pipeline.module.js +59 -0
  1077. package/dist/src/core/pipeline/pipeline.module.js.map +1 -0
  1078. package/dist/src/core/pipeline/pipeline.schema.d.ts +11 -0
  1079. package/dist/src/core/pipeline/pipeline.schema.js +39 -0
  1080. package/dist/src/core/pipeline/pipeline.schema.js.map +1 -0
  1081. package/dist/src/core/pipeline/pipeline.service.d.ts +21 -0
  1082. package/dist/src/core/pipeline/pipeline.service.js +282 -0
  1083. package/dist/src/core/pipeline/pipeline.service.js.map +1 -0
  1084. package/dist/src/core/pipeline/pipeline.utils.d.ts +1 -0
  1085. package/dist/src/core/pipeline/pipeline.utils.js +30 -0
  1086. package/dist/src/core/pipeline/pipeline.utils.js.map +1 -0
  1087. package/dist/src/core/pipeline/provider/base_pipeline.provider.d.ts +8 -0
  1088. package/dist/src/core/pipeline/provider/base_pipeline.provider.js +16 -0
  1089. package/dist/src/core/pipeline/provider/base_pipeline.provider.js.map +1 -0
  1090. package/dist/src/core/pipeline/provider/pipeline.interface.d.ts +6 -0
  1091. package/dist/src/core/pipeline/provider/pipeline.interface.js +3 -0
  1092. package/dist/src/core/pipeline/provider/pipeline.interface.js.map +1 -0
  1093. package/dist/src/core/queue/queue.controller.d.ts +21 -0
  1094. package/dist/src/core/queue/queue.controller.js +99 -0
  1095. package/dist/src/core/queue/queue.controller.js.map +1 -0
  1096. package/dist/src/core/queue/queue.module.d.ts +4 -0
  1097. package/dist/src/core/queue/queue.module.js +200 -0
  1098. package/dist/src/core/queue/queue.module.js.map +1 -0
  1099. package/dist/src/core/queue/queue.processor.d.ts +46 -0
  1100. package/dist/src/core/queue/queue.processor.js +461 -0
  1101. package/dist/src/core/queue/queue.processor.js.map +1 -0
  1102. package/dist/src/core/queue/queue.service.d.ts +19 -0
  1103. package/dist/src/core/queue/queue.service.js +73 -0
  1104. package/dist/src/core/queue/queue.service.js.map +1 -0
  1105. package/dist/src/core/reason/reason.layout.d.ts +4 -0
  1106. package/dist/src/core/reason/reason.layout.js +579 -0
  1107. package/dist/src/core/reason/reason.layout.js.map +1 -0
  1108. package/dist/src/core/reason/reason.module.d.ts +2 -0
  1109. package/dist/src/core/reason/reason.module.js +52 -0
  1110. package/dist/src/core/reason/reason.module.js.map +1 -0
  1111. package/dist/src/core/reason/reason.schema.d.ts +31 -0
  1112. package/dist/src/core/reason/reason.schema.js +119 -0
  1113. package/dist/src/core/reason/reason.schema.js.map +1 -0
  1114. package/dist/src/core/reason/reason.service.d.ts +26 -0
  1115. package/dist/src/core/reason/reason.service.js +82 -0
  1116. package/dist/src/core/reason/reason.service.js.map +1 -0
  1117. package/dist/src/core/redis/redis.constant.d.ts +2 -0
  1118. package/dist/src/core/redis/redis.constant.js +6 -0
  1119. package/dist/src/core/redis/redis.constant.js.map +1 -0
  1120. package/dist/src/core/redis/redis.controller.d.ts +9 -0
  1121. package/dist/src/core/redis/redis.controller.js +72 -0
  1122. package/dist/src/core/redis/redis.controller.js.map +1 -0
  1123. package/dist/src/core/redis/redis.module.d.ts +2 -0
  1124. package/dist/src/core/redis/redis.module.js +24 -0
  1125. package/dist/src/core/redis/redis.module.js.map +1 -0
  1126. package/dist/src/core/redis/redis.service.d.ts +12 -0
  1127. package/dist/src/core/redis/redis.service.js +145 -0
  1128. package/dist/src/core/redis/redis.service.js.map +1 -0
  1129. package/dist/src/core/rewrite_url/provider/provider.base.d.ts +7 -0
  1130. package/dist/src/core/rewrite_url/provider/provider.base.js +12 -0
  1131. package/dist/src/core/rewrite_url/provider/provider.base.js.map +1 -0
  1132. package/dist/src/core/rewrite_url/provider/provider.interface.d.ts +9 -0
  1133. package/dist/src/core/rewrite_url/provider/provider.interface.js +3 -0
  1134. package/dist/src/core/rewrite_url/provider/provider.interface.js.map +1 -0
  1135. package/dist/src/core/rewrite_url/rewrite_url.constant.d.ts +1 -0
  1136. package/dist/src/core/rewrite_url/rewrite_url.constant.js +5 -0
  1137. package/dist/src/core/rewrite_url/rewrite_url.constant.js.map +1 -0
  1138. package/dist/src/core/rewrite_url/rewrite_url.controller.d.ts +7 -0
  1139. package/dist/src/core/rewrite_url/rewrite_url.controller.js +52 -0
  1140. package/dist/src/core/rewrite_url/rewrite_url.controller.js.map +1 -0
  1141. package/dist/src/core/rewrite_url/rewrite_url.module.d.ts +2 -0
  1142. package/dist/src/core/rewrite_url/rewrite_url.module.js +26 -0
  1143. package/dist/src/core/rewrite_url/rewrite_url.module.js.map +1 -0
  1144. package/dist/src/core/rewrite_url/rewrite_url.service.d.ts +10 -0
  1145. package/dist/src/core/rewrite_url/rewrite_url.service.js +103 -0
  1146. package/dist/src/core/rewrite_url/rewrite_url.service.js.map +1 -0
  1147. package/dist/src/core/schedule_action/log/schedule_log.layout.d.ts +2 -0
  1148. package/dist/src/core/schedule_action/log/schedule_log.layout.js +458 -0
  1149. package/dist/src/core/schedule_action/log/schedule_log.layout.js.map +1 -0
  1150. package/dist/src/core/schedule_action/log/schedule_log.schema.d.ts +15 -0
  1151. package/dist/src/core/schedule_action/log/schedule_log.schema.js +70 -0
  1152. package/dist/src/core/schedule_action/log/schedule_log.schema.js.map +1 -0
  1153. package/dist/src/core/schedule_action/log/schedule_log.service.d.ts +12 -0
  1154. package/dist/src/core/schedule_action/log/schedule_log.service.js +49 -0
  1155. package/dist/src/core/schedule_action/log/schedule_log.service.js.map +1 -0
  1156. package/dist/src/core/schedule_action/schedule_action.controller.d.ts +14 -0
  1157. package/dist/src/core/schedule_action/schedule_action.controller.js +103 -0
  1158. package/dist/src/core/schedule_action/schedule_action.controller.js.map +1 -0
  1159. package/dist/src/core/schedule_action/schedule_action.enum.d.ts +12 -0
  1160. package/dist/src/core/schedule_action/schedule_action.enum.js +19 -0
  1161. package/dist/src/core/schedule_action/schedule_action.enum.js.map +1 -0
  1162. package/dist/src/core/schedule_action/schedule_action.hook.d.ts +11 -0
  1163. package/dist/src/core/schedule_action/schedule_action.hook.js +19 -0
  1164. package/dist/src/core/schedule_action/schedule_action.hook.js.map +1 -0
  1165. package/dist/src/core/schedule_action/schedule_action.layout.d.ts +2 -0
  1166. package/dist/src/core/schedule_action/schedule_action.layout.js +615 -0
  1167. package/dist/src/core/schedule_action/schedule_action.layout.js.map +1 -0
  1168. package/dist/src/core/schedule_action/schedule_action.module.d.ts +2 -0
  1169. package/dist/src/core/schedule_action/schedule_action.module.js +65 -0
  1170. package/dist/src/core/schedule_action/schedule_action.module.js.map +1 -0
  1171. package/dist/src/core/schedule_action/schedule_action.schema.d.ts +30 -0
  1172. package/dist/src/core/schedule_action/schedule_action.schema.js +139 -0
  1173. package/dist/src/core/schedule_action/schedule_action.schema.js.map +1 -0
  1174. package/dist/src/core/schedule_action/schedule_action.service.d.ts +30 -0
  1175. package/dist/src/core/schedule_action/schedule_action.service.js +319 -0
  1176. package/dist/src/core/schedule_action/schedule_action.service.js.map +1 -0
  1177. package/dist/src/core/schedule_action/schedule_action_cron.service.d.ts +17 -0
  1178. package/dist/src/core/schedule_action/schedule_action_cron.service.js +222 -0
  1179. package/dist/src/core/schedule_action/schedule_action_cron.service.js.map +1 -0
  1180. package/dist/src/core/search_text/reindex_search_text/reindex_search_text.schema.d.ts +11 -0
  1181. package/dist/src/core/search_text/reindex_search_text/reindex_search_text.schema.js +40 -0
  1182. package/dist/src/core/search_text/reindex_search_text/reindex_search_text.schema.js.map +1 -0
  1183. package/dist/src/core/search_text/reindex_search_text/reindex_search_text.service.d.ts +14 -0
  1184. package/dist/src/core/search_text/reindex_search_text/reindex_search_text.service.js +74 -0
  1185. package/dist/src/core/search_text/reindex_search_text/reindex_search_text.service.js.map +1 -0
  1186. package/dist/src/core/search_text/search_text.controller.d.ts +8 -0
  1187. package/dist/src/core/search_text/search_text.controller.js +57 -0
  1188. package/dist/src/core/search_text/search_text.controller.js.map +1 -0
  1189. package/dist/src/core/search_text/search_text.module.d.ts +2 -0
  1190. package/dist/src/core/search_text/search_text.module.js +51 -0
  1191. package/dist/src/core/search_text/search_text.module.js.map +1 -0
  1192. package/dist/src/core/search_text/search_text.schema.d.ts +10 -0
  1193. package/dist/src/core/search_text/search_text.schema.js +38 -0
  1194. package/dist/src/core/search_text/search_text.schema.js.map +1 -0
  1195. package/dist/src/core/search_text/search_text.service.d.ts +30 -0
  1196. package/dist/src/core/search_text/search_text.service.js +295 -0
  1197. package/dist/src/core/search_text/search_text.service.js.map +1 -0
  1198. package/dist/src/core/setting/dto/auth_setting.dto.d.ts +43 -0
  1199. package/dist/src/core/setting/dto/auth_setting.dto.js +151 -0
  1200. package/dist/src/core/setting/dto/auth_setting.dto.js.map +1 -0
  1201. package/dist/src/core/setting/dto/es_setting.dto.d.ts +3 -0
  1202. package/dist/src/core/setting/dto/es_setting.dto.js +21 -0
  1203. package/dist/src/core/setting/dto/es_setting.dto.js.map +1 -0
  1204. package/dist/src/core/setting/dto/general_setting.dto.d.ts +10 -0
  1205. package/dist/src/core/setting/dto/general_setting.dto.js +49 -0
  1206. package/dist/src/core/setting/dto/general_setting.dto.js.map +1 -0
  1207. package/dist/src/core/setting/dto/layout_setting.dto.d.ts +5 -0
  1208. package/dist/src/core/setting/dto/layout_setting.dto.js +29 -0
  1209. package/dist/src/core/setting/dto/layout_setting.dto.js.map +1 -0
  1210. package/dist/src/core/setting/dto/log_setting.dto.d.ts +17 -0
  1211. package/dist/src/core/setting/dto/log_setting.dto.js +57 -0
  1212. package/dist/src/core/setting/dto/log_setting.dto.js.map +1 -0
  1213. package/dist/src/core/setting/dto/login_method.dto.d.ts +4 -0
  1214. package/dist/src/core/setting/dto/login_method.dto.js +25 -0
  1215. package/dist/src/core/setting/dto/login_method.dto.js.map +1 -0
  1216. package/dist/src/core/setting/dto/media_setting.dto.d.ts +29 -0
  1217. package/dist/src/core/setting/dto/media_setting.dto.js +43 -0
  1218. package/dist/src/core/setting/dto/media_setting.dto.js.map +1 -0
  1219. package/dist/src/core/setting/dto/menu_setting.dto.d.ts +17 -0
  1220. package/dist/src/core/setting/dto/menu_setting.dto.js +76 -0
  1221. package/dist/src/core/setting/dto/menu_setting.dto.js.map +1 -0
  1222. package/dist/src/core/setting/dto/queue_setting.dto.d.ts +3 -0
  1223. package/dist/src/core/setting/dto/queue_setting.dto.js +21 -0
  1224. package/dist/src/core/setting/dto/queue_setting.dto.js.map +1 -0
  1225. package/dist/src/core/setting/dto/schedule_setting.dto.d.ts +5 -0
  1226. package/dist/src/core/setting/dto/schedule_setting.dto.js +29 -0
  1227. package/dist/src/core/setting/dto/schedule_setting.dto.js.map +1 -0
  1228. package/dist/src/core/setting/dto/swagger_setting.dto.d.ts +5 -0
  1229. package/dist/src/core/setting/dto/swagger_setting.dto.js +29 -0
  1230. package/dist/src/core/setting/dto/swagger_setting.dto.js.map +1 -0
  1231. package/dist/src/core/setting/setting.constant.d.ts +309 -0
  1232. package/dist/src/core/setting/setting.constant.js +650 -0
  1233. package/dist/src/core/setting/setting.constant.js.map +1 -0
  1234. package/dist/src/core/setting/setting.controller.d.ts +54 -0
  1235. package/dist/src/core/setting/setting.controller.js +487 -0
  1236. package/dist/src/core/setting/setting.controller.js.map +1 -0
  1237. package/dist/src/core/setting/setting.module.d.ts +2 -0
  1238. package/dist/src/core/setting/setting.module.js +40 -0
  1239. package/dist/src/core/setting/setting.module.js.map +1 -0
  1240. package/dist/src/core/setting/setting.schema.d.ts +10 -0
  1241. package/dist/src/core/setting/setting.schema.js +35 -0
  1242. package/dist/src/core/setting/setting.schema.js.map +1 -0
  1243. package/dist/src/core/setting/setting.service.d.ts +76 -0
  1244. package/dist/src/core/setting/setting.service.js +1378 -0
  1245. package/dist/src/core/setting/setting.service.js.map +1 -0
  1246. package/dist/src/core/shortly/shortly.constant.d.ts +5 -0
  1247. package/dist/src/core/shortly/shortly.constant.js +10 -0
  1248. package/dist/src/core/shortly/shortly.constant.js.map +1 -0
  1249. package/dist/src/core/shortly/shortly.module.d.ts +2 -0
  1250. package/dist/src/core/shortly/shortly.module.js +42 -0
  1251. package/dist/src/core/shortly/shortly.module.js.map +1 -0
  1252. package/dist/src/core/shortly/url/url.controller.d.ts +6 -0
  1253. package/dist/src/core/shortly/url/url.controller.js +41 -0
  1254. package/dist/src/core/shortly/url/url.controller.js.map +1 -0
  1255. package/dist/src/core/shortly/url/url.layout.d.ts +2 -0
  1256. package/dist/src/core/shortly/url/url.layout.js +486 -0
  1257. package/dist/src/core/shortly/url/url.layout.js.map +1 -0
  1258. package/dist/src/core/shortly/url/url.schema.d.ts +15 -0
  1259. package/dist/src/core/shortly/url/url.schema.js +69 -0
  1260. package/dist/src/core/shortly/url/url.schema.js.map +1 -0
  1261. package/dist/src/core/shortly/url/url.service.d.ts +16 -0
  1262. package/dist/src/core/shortly/url/url.service.js +108 -0
  1263. package/dist/src/core/shortly/url/url.service.js.map +1 -0
  1264. package/dist/src/core/sms/log/sms_log.layout.d.ts +2 -0
  1265. package/dist/src/core/sms/log/sms_log.layout.js +668 -0
  1266. package/dist/src/core/sms/log/sms_log.layout.js.map +1 -0
  1267. package/dist/src/core/sms/log/sms_log.schema.d.ts +27 -0
  1268. package/dist/src/core/sms/log/sms_log.schema.js +115 -0
  1269. package/dist/src/core/sms/log/sms_log.schema.js.map +1 -0
  1270. package/dist/src/core/sms/log/sms_log.service.d.ts +14 -0
  1271. package/dist/src/core/sms/log/sms_log.service.js +70 -0
  1272. package/dist/src/core/sms/log/sms_log.service.js.map +1 -0
  1273. package/dist/src/core/sms/sms.controller.d.ts +6 -0
  1274. package/dist/src/core/sms/sms.controller.js +41 -0
  1275. package/dist/src/core/sms/sms.controller.js.map +1 -0
  1276. package/dist/src/core/sms/sms.enum.d.ts +12 -0
  1277. package/dist/src/core/sms/sms.enum.js +19 -0
  1278. package/dist/src/core/sms/sms.enum.js.map +1 -0
  1279. package/dist/src/core/sms/sms.layout.d.ts +2 -0
  1280. package/dist/src/core/sms/sms.layout.js +766 -0
  1281. package/dist/src/core/sms/sms.layout.js.map +1 -0
  1282. package/dist/src/core/sms/sms.module.d.ts +2 -0
  1283. package/dist/src/core/sms/sms.module.js +49 -0
  1284. package/dist/src/core/sms/sms.module.js.map +1 -0
  1285. package/dist/src/core/sms/sms.schema.d.ts +24 -0
  1286. package/dist/src/core/sms/sms.schema.js +107 -0
  1287. package/dist/src/core/sms/sms.schema.js.map +1 -0
  1288. package/dist/src/core/sms/sms.service.d.ts +16 -0
  1289. package/dist/src/core/sms/sms.service.js +272 -0
  1290. package/dist/src/core/sms/sms.service.js.map +1 -0
  1291. package/dist/src/core/template/data/templates.json +192 -0
  1292. package/dist/src/core/template/log/print_log.enum.d.ts +5 -0
  1293. package/dist/src/core/template/log/print_log.enum.js +10 -0
  1294. package/dist/src/core/template/log/print_log.enum.js.map +1 -0
  1295. package/dist/src/core/template/log/print_log.layout.d.ts +2 -0
  1296. package/dist/src/core/template/log/print_log.layout.js +483 -0
  1297. package/dist/src/core/template/log/print_log.layout.js.map +1 -0
  1298. package/dist/src/core/template/log/print_log.schema.d.ts +18 -0
  1299. package/dist/src/core/template/log/print_log.schema.js +104 -0
  1300. package/dist/src/core/template/log/print_log.schema.js.map +1 -0
  1301. package/dist/src/core/template/log/print_log.service.d.ts +12 -0
  1302. package/dist/src/core/template/log/print_log.service.js +49 -0
  1303. package/dist/src/core/template/log/print_log.service.js.map +1 -0
  1304. package/dist/src/core/template/provider/base_template.provider.d.ts +9 -0
  1305. package/dist/src/core/template/provider/base_template.provider.js +22 -0
  1306. package/dist/src/core/template/provider/base_template.provider.js.map +1 -0
  1307. package/dist/src/core/template/provider/email.provider.d.ts +8 -0
  1308. package/dist/src/core/template/provider/email.provider.js +155 -0
  1309. package/dist/src/core/template/provider/email.provider.js.map +1 -0
  1310. package/dist/src/core/template/provider/sms.provider.d.ts +8 -0
  1311. package/dist/src/core/template/provider/sms.provider.js +93 -0
  1312. package/dist/src/core/template/provider/sms.provider.js.map +1 -0
  1313. package/dist/src/core/template/provider/template.interface.d.ts +7 -0
  1314. package/dist/src/core/template/provider/template.interface.js +3 -0
  1315. package/dist/src/core/template/provider/template.interface.js.map +1 -0
  1316. package/dist/src/core/template/provider/template_email.provider.d.ts +8 -0
  1317. package/dist/src/core/template/provider/template_email.provider.js +472 -0
  1318. package/dist/src/core/template/provider/template_email.provider.js.map +1 -0
  1319. package/dist/src/core/template/provider/template_print.provider.d.ts +9 -0
  1320. package/dist/src/core/template/provider/template_print.provider.js +1114 -0
  1321. package/dist/src/core/template/provider/template_print.provider.js.map +1 -0
  1322. package/dist/src/core/template/provider/template_sms.provider.d.ts +8 -0
  1323. package/dist/src/core/template/provider/template_sms.provider.js +453 -0
  1324. package/dist/src/core/template/provider/template_sms.provider.js.map +1 -0
  1325. package/dist/src/core/template/template.controller.d.ts +15 -0
  1326. package/dist/src/core/template/template.controller.js +140 -0
  1327. package/dist/src/core/template/template.controller.js.map +1 -0
  1328. package/dist/src/core/template/template.enum.d.ts +34 -0
  1329. package/dist/src/core/template/template.enum.js +43 -0
  1330. package/dist/src/core/template/template.enum.js.map +1 -0
  1331. package/dist/src/core/template/template.hook.d.ts +18 -0
  1332. package/dist/src/core/template/template.hook.js +26 -0
  1333. package/dist/src/core/template/template.hook.js.map +1 -0
  1334. package/dist/src/core/template/template.layout.d.ts +2 -0
  1335. package/dist/src/core/template/template.layout.js +399 -0
  1336. package/dist/src/core/template/template.layout.js.map +1 -0
  1337. package/dist/src/core/template/template.module.d.ts +2 -0
  1338. package/dist/src/core/template/template.module.js +49 -0
  1339. package/dist/src/core/template/template.module.js.map +1 -0
  1340. package/dist/src/core/template/template.schema.d.ts +57 -0
  1341. package/dist/src/core/template/template.schema.js +265 -0
  1342. package/dist/src/core/template/template.schema.js.map +1 -0
  1343. package/dist/src/core/template/template.service.d.ts +49 -0
  1344. package/dist/src/core/template/template.service.js +900 -0
  1345. package/dist/src/core/template/template.service.js.map +1 -0
  1346. package/dist/src/core/template/template.utils.d.ts +25 -0
  1347. package/dist/src/core/template/template.utils.js +292 -0
  1348. package/dist/src/core/template/template.utils.js.map +1 -0
  1349. package/dist/src/core/translate/translate.controller.d.ts +8 -0
  1350. package/dist/src/core/translate/translate.controller.js +74 -0
  1351. package/dist/src/core/translate/translate.controller.js.map +1 -0
  1352. package/dist/src/core/translate/translate.enum.d.ts +5 -0
  1353. package/dist/src/core/translate/translate.enum.js +10 -0
  1354. package/dist/src/core/translate/translate.enum.js.map +1 -0
  1355. package/dist/src/core/translate/translate.hook.d.ts +13 -0
  1356. package/dist/src/core/translate/translate.hook.js +21 -0
  1357. package/dist/src/core/translate/translate.hook.js.map +1 -0
  1358. package/dist/src/core/translate/translate.json +2011 -0
  1359. package/dist/src/core/translate/translate.layout.d.ts +2 -0
  1360. package/dist/src/core/translate/translate.layout.js +95 -0
  1361. package/dist/src/core/translate/translate.layout.js.map +1 -0
  1362. package/dist/src/core/translate/translate.module.d.ts +2 -0
  1363. package/dist/src/core/translate/translate.module.js +42 -0
  1364. package/dist/src/core/translate/translate.module.js.map +1 -0
  1365. package/dist/src/core/translate/translate.schema.d.ts +16 -0
  1366. package/dist/src/core/translate/translate.schema.js +76 -0
  1367. package/dist/src/core/translate/translate.schema.js.map +1 -0
  1368. package/dist/src/core/translate/translate.service.d.ts +17 -0
  1369. package/dist/src/core/translate/translate.service.js +139 -0
  1370. package/dist/src/core/translate/translate.service.js.map +1 -0
  1371. package/dist/src/core/users/user.config.d.ts +4 -0
  1372. package/dist/src/core/users/user.config.js +8 -0
  1373. package/dist/src/core/users/user.config.js.map +1 -0
  1374. package/dist/src/core/users/user.constant.d.ts +4 -0
  1375. package/dist/src/core/users/user.constant.js +36 -0
  1376. package/dist/src/core/users/user.constant.js.map +1 -0
  1377. package/dist/src/core/users/user.controller.d.ts +33 -0
  1378. package/dist/src/core/users/user.controller.js +292 -0
  1379. package/dist/src/core/users/user.controller.js.map +1 -0
  1380. package/dist/src/core/users/user.enum.d.ts +40 -0
  1381. package/dist/src/core/users/user.enum.js +48 -0
  1382. package/dist/src/core/users/user.enum.js.map +1 -0
  1383. package/dist/src/core/users/user.hook.d.ts +25 -0
  1384. package/dist/src/core/users/user.hook.js +36 -0
  1385. package/dist/src/core/users/user.hook.js.map +1 -0
  1386. package/dist/src/core/users/user.layout.d.ts +4 -0
  1387. package/dist/src/core/users/user.layout.js +2333 -0
  1388. package/dist/src/core/users/user.layout.js.map +1 -0
  1389. package/dist/src/core/users/user.module.d.ts +2 -0
  1390. package/dist/src/core/users/user.module.js +77 -0
  1391. package/dist/src/core/users/user.module.js.map +1 -0
  1392. package/dist/src/core/users/user.permission.d.ts +2 -0
  1393. package/dist/src/core/users/user.permission.js +10 -0
  1394. package/dist/src/core/users/user.permission.js.map +1 -0
  1395. package/dist/src/core/users/user.schema.d.ts +73 -0
  1396. package/dist/src/core/users/user.schema.js +316 -0
  1397. package/dist/src/core/users/user.schema.js.map +1 -0
  1398. package/dist/src/core/users/user.service.d.ts +100 -0
  1399. package/dist/src/core/users/user.service.js +1551 -0
  1400. package/dist/src/core/users/user.service.js.map +1 -0
  1401. package/dist/src/core/version_data/version_data.module.d.ts +2 -0
  1402. package/dist/src/core/version_data/version_data.module.js +38 -0
  1403. package/dist/src/core/version_data/version_data.module.js.map +1 -0
  1404. package/dist/src/core/version_data/version_data.schema.d.ts +13 -0
  1405. package/dist/src/core/version_data/version_data.schema.js +55 -0
  1406. package/dist/src/core/version_data/version_data.schema.js.map +1 -0
  1407. package/dist/src/core/version_data/version_data.service.d.ts +12 -0
  1408. package/dist/src/core/version_data/version_data.service.js +43 -0
  1409. package/dist/src/core/version_data/version_data.service.js.map +1 -0
  1410. package/dist/src/core/widget/widget.controller.d.ts +6 -0
  1411. package/dist/src/core/widget/widget.controller.js +42 -0
  1412. package/dist/src/core/widget/widget.controller.js.map +1 -0
  1413. package/dist/src/core/widget/widget.enum.d.ts +19 -0
  1414. package/dist/src/core/widget/widget.enum.js +25 -0
  1415. package/dist/src/core/widget/widget.enum.js.map +1 -0
  1416. package/dist/src/core/widget/widget.module.d.ts +2 -0
  1417. package/dist/src/core/widget/widget.module.js +40 -0
  1418. package/dist/src/core/widget/widget.module.js.map +1 -0
  1419. package/dist/src/core/widget/widget.schema.d.ts +21 -0
  1420. package/dist/src/core/widget/widget.schema.js +94 -0
  1421. package/dist/src/core/widget/widget.schema.js.map +1 -0
  1422. package/dist/src/core/widget/widget.service.d.ts +15 -0
  1423. package/dist/src/core/widget/widget.service.js +370 -0
  1424. package/dist/src/core/widget/widget.service.js.map +1 -0
  1425. package/dist/src/index.d.ts +1 -0
  1426. package/dist/src/index.js +5 -0
  1427. package/dist/src/index.js.map +1 -0
  1428. package/dist/src/main.d.ts +1 -0
  1429. package/dist/src/main.js +235 -0
  1430. package/dist/src/main.js.map +1 -0
  1431. package/dist/src/modules/index.d.ts +1 -0
  1432. package/dist/src/modules/index.js +6 -0
  1433. package/dist/src/modules/index.js.map +1 -0
  1434. package/dist/src/modules/modules.d.ts +3 -0
  1435. package/dist/src/modules/modules.js +8 -0
  1436. package/dist/src/modules/modules.js.map +1 -0
  1437. package/dist/src/private.controller.d.ts +6 -0
  1438. package/dist/src/private.controller.js +44 -0
  1439. package/dist/src/private.controller.js.map +1 -0
  1440. package/dist/tsconfig.build.tsbuildinfo +1 -0
  1441. package/dist/typings/node/index.d.ts +4 -0
  1442. package/dist/typings/node/index.js +1 -0
  1443. package/dist/typings/node/index.js.map +1 -0
  1444. package/package.json +116 -0
@@ -0,0 +1,2271 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var EntitiesService_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.EntitiesService = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ const _ = require("lodash");
19
+ const axios_1 = require("axios");
20
+ const uuid_1 = require("uuid");
21
+ const crypto = require("crypto");
22
+ const mongoose_1 = require("@nestjs/mongoose");
23
+ const mongoose = require("mongoose");
24
+ const entity_schema_1 = require("./entity.schema");
25
+ const dotenv = require("dotenv");
26
+ const build_search_1 = require("../common/utils/build_search");
27
+ const schema_1 = require("../common/utils/schema");
28
+ const activity_log_enum_1 = require("../activity_log/activity_log.enum");
29
+ const entity_enum_1 = require("./entity.enum");
30
+ const permission_1 = require("../common/utils/permission");
31
+ const decimal2Json_1 = require("../common/utils/decimal2Json");
32
+ const constants_1 = require("../common/constants");
33
+ const layout_1 = require("../common/utils/layout");
34
+ const translate_1 = require("../common/utils/translate");
35
+ const executions_1 = require("../common/utils/executions");
36
+ const entity_1 = require("../common/utils/entity");
37
+ const redis_1 = require("../common/utils/redis");
38
+ const hook_1 = require("../common/utils/hook");
39
+ const example_1 = require("../common/utils/example");
40
+ const diff_1 = require("../common/utils/diff");
41
+ const mongoose_2 = require("../common/utils/mongoose");
42
+ const nestjs_cls_1 = require("nestjs-cls");
43
+ const transform_1 = require("../common/utils/transform");
44
+ const external_data_1 = require("../common/utils/external_data");
45
+ const masking_1 = require("../common/utils/masking");
46
+ const retry_1 = require("../common/utils/retry");
47
+ const text_search_1 = require("../common/utils/text_search");
48
+ const external_module_1 = require("../common/utils/external_module");
49
+ dotenv.config();
50
+ mongoose.connect(process.env.MONGODB_URI);
51
+ const MAX_HOOK_LOOP = 10;
52
+ const MAX_SEARCH_IDS_SIZE = 100000;
53
+ const TTL = 3000;
54
+ const ACTION_TYPE_STATIC = "static";
55
+ const ACTION_TYPE_INTERNAL = "internal";
56
+ const ACTION_TYPE_EXTERNAL = "external";
57
+ const ACTION_TYPE_REST = "rest";
58
+ const FIELD_TYPE_STRING = "string";
59
+ const FIELD_TYPE_BOOLEAN = "boolean";
60
+ const FIELD_TYPE_NUMBER = "number";
61
+ const FIELD_TYPE_DATE = "date";
62
+ const FIELD_TYPE_ENCRYPT = "encrypt";
63
+ const FIELD_TYPE_EMAIL = "email";
64
+ const FIELD_TYPE_OPTIONS = "options";
65
+ const FIELD_TYPE_RELATED = "related";
66
+ const FIELD_TYPE_IMAGE = "image";
67
+ const FIELD_TYPE_FILE = "file";
68
+ const FIELD_TYPE_RELATED_TYPE_O2O = "one2one";
69
+ const FIELD_TYPE_RELATED_TYPE_O2M = "one2many";
70
+ const FIELD_TYPE_MAP_LOCATION = "map";
71
+ const FIELD_TYPE_JSON = "json";
72
+ const RESERVED_SYSTEM_ENTITIES = [];
73
+ const db = mongoose.connection.getClient().db();
74
+ const DEFAULT_FIELDS = [
75
+ {
76
+ name: "id",
77
+ system: true,
78
+ type: "string",
79
+ required: true
80
+ },
81
+ {
82
+ name: "system",
83
+ system: true,
84
+ type: "boolean",
85
+ required: true
86
+ },
87
+ {
88
+ name: "createdAt",
89
+ system: true,
90
+ type: "date",
91
+ type_date: "datetime"
92
+ },
93
+ {
94
+ name: "updatedAt",
95
+ system: true,
96
+ type: "date",
97
+ type_date: "datetime"
98
+ },
99
+ {
100
+ name: "_translates",
101
+ system: true,
102
+ type: "json",
103
+ json_type: "standard"
104
+ },
105
+ {
106
+ name: "_search_text",
107
+ system: true,
108
+ type: "string"
109
+ }
110
+ ];
111
+ const CHECK_FIELDS = [
112
+ {
113
+ name: "_translates",
114
+ system: true,
115
+ type: "json",
116
+ json_type: "standard"
117
+ },
118
+ {
119
+ name: "_search_text",
120
+ system: true,
121
+ type: "string"
122
+ }
123
+ ];
124
+ const DEFAULT_ACTIONS = [
125
+ {
126
+ name: "create",
127
+ method: entity_enum_1.ActionMethodEntity.post
128
+ },
129
+ {
130
+ name: "update",
131
+ method: entity_enum_1.ActionMethodEntity.put
132
+ },
133
+ {
134
+ name: "delete",
135
+ method: entity_enum_1.ActionMethodEntity.delete
136
+ },
137
+ {
138
+ name: "generate_data",
139
+ method: entity_enum_1.ActionMethodEntity.patch
140
+ }
141
+ ];
142
+ const DEFAULT_LAYOUTS = {
143
+ name: "Default Layout",
144
+ code: "default",
145
+ type: [entity_enum_1.EntityLayoutType.standard],
146
+ detail: {
147
+ title: {
148
+ format: ""
149
+ },
150
+ blocks: []
151
+ }
152
+ };
153
+ let EntitiesService = EntitiesService_1 = class EntitiesService {
154
+ constructor(cls, model) {
155
+ this.cls = cls;
156
+ this.model = model;
157
+ }
158
+ _getCurrentProfile() {
159
+ const request = this.cls.get("request");
160
+ return _.get(request, "profile", {});
161
+ }
162
+ _getCurrentApiKey() {
163
+ const request = this.cls.get("request");
164
+ return _.get(request, "api_key", {});
165
+ }
166
+ _getCurrentPermissions() {
167
+ const request = this.cls.get("request");
168
+ if (_.isUndefined(request)) {
169
+ return [{ entity: "*" }];
170
+ }
171
+ return _.get(request, "permissions", []);
172
+ }
173
+ _getCurrentRole() {
174
+ const request = this.cls.get("request");
175
+ return _.get(request, "roles", []);
176
+ }
177
+ _getCurrentHeaders(isClone = false) {
178
+ const request = this.cls.get("request");
179
+ if (isClone) {
180
+ return _.cloneDeep(_.get(request, "headers", {}));
181
+ }
182
+ else {
183
+ return _.get(request, "headers", {});
184
+ }
185
+ }
186
+ _getCurrentBody() {
187
+ const request = this.cls.get("request");
188
+ return _.get(request, "body", {});
189
+ }
190
+ _isInternal() {
191
+ const request = this.cls.get("request");
192
+ return (0, permission_1.isInternal)(request);
193
+ }
194
+ _getFieldSchema(field) {
195
+ let schema = undefined;
196
+ switch (field.type) {
197
+ case FIELD_TYPE_STRING:
198
+ case FIELD_TYPE_EMAIL:
199
+ schema = { type: String };
200
+ break;
201
+ case FIELD_TYPE_BOOLEAN:
202
+ schema = { type: Boolean };
203
+ break;
204
+ case FIELD_TYPE_NUMBER:
205
+ if (field.decimal_length === 0) {
206
+ schema = { type: Number };
207
+ }
208
+ else {
209
+ schema = { type: mongoose.SchemaTypes.Decimal128 };
210
+ }
211
+ break;
212
+ case FIELD_TYPE_DATE:
213
+ schema = {
214
+ type: (field === null || field === void 0 ? void 0 : field.multiple)
215
+ ? mongoose.SchemaTypes.Mixed
216
+ : field.type_date === "time"
217
+ ? String
218
+ : Date
219
+ };
220
+ break;
221
+ case FIELD_TYPE_OPTIONS:
222
+ schema = { type: [String] };
223
+ break;
224
+ case FIELD_TYPE_RELATED:
225
+ if (field.related_type === FIELD_TYPE_RELATED_TYPE_O2O) {
226
+ schema = {
227
+ type: mongoose.SchemaTypes.ObjectId,
228
+ ref: field.related_ref
229
+ };
230
+ }
231
+ else {
232
+ schema = [
233
+ {
234
+ type: mongoose.SchemaTypes.ObjectId,
235
+ ref: field.related_ref
236
+ }
237
+ ];
238
+ }
239
+ break;
240
+ case FIELD_TYPE_IMAGE:
241
+ case FIELD_TYPE_FILE:
242
+ schema = [
243
+ {
244
+ type: mongoose.SchemaTypes.ObjectId,
245
+ ref: "attachment"
246
+ }
247
+ ];
248
+ break;
249
+ case FIELD_TYPE_MAP_LOCATION:
250
+ schema = [
251
+ {
252
+ type: mongoose.SchemaTypes.ObjectId,
253
+ ref: "map_location"
254
+ }
255
+ ];
256
+ break;
257
+ case FIELD_TYPE_JSON:
258
+ case FIELD_TYPE_ENCRYPT:
259
+ schema = { type: mongoose.SchemaTypes.Mixed };
260
+ break;
261
+ }
262
+ return schema;
263
+ }
264
+ _getFieldEntity(field) {
265
+ var _a, _b, _c, _d;
266
+ const schema = { name: field.path, system: true };
267
+ if (["createdAt", "updatedAt"].includes(field.path)) {
268
+ schema.type = FIELD_TYPE_DATE;
269
+ schema.type_date = "datetime";
270
+ }
271
+ else if (field.instance === "Array" &&
272
+ _.get(field, "options.type[0].ref")) {
273
+ if (_.get(field, "options.type[0].image")) {
274
+ schema.type = FIELD_TYPE_IMAGE;
275
+ }
276
+ else if (_.get(field, "options.type[0].file")) {
277
+ schema.type = FIELD_TYPE_FILE;
278
+ }
279
+ else if (_.get(field, "options.type[0].map")) {
280
+ schema.type = FIELD_TYPE_MAP_LOCATION;
281
+ }
282
+ else if (field.options.type[0].ref) {
283
+ schema.type = FIELD_TYPE_RELATED;
284
+ schema.related_type = FIELD_TYPE_RELATED_TYPE_O2M;
285
+ schema.related_ref = field.options.type[0].ref;
286
+ }
287
+ if (field.options.type[0].required) {
288
+ schema.required = field.options.type[0].required;
289
+ }
290
+ if (field.options.type[0].default) {
291
+ schema.default = field.options.type[0].default;
292
+ }
293
+ if (field.options.type[0].max_value) {
294
+ schema.max_value = field.options.type[0].max_value;
295
+ }
296
+ if (field.options.type[0].min_value) {
297
+ schema.min_value = field.options.type[0].min_value;
298
+ }
299
+ if (field.options.type[0].allow_create_update) {
300
+ schema.allow_create_update = field.options.type[0].allow_create_update;
301
+ }
302
+ if (field.options.type[0].list_type) {
303
+ schema.list_type = field.options.type[0].list_type;
304
+ }
305
+ if (field.options.type[0].full_list_field) {
306
+ schema.full_list_field = field.options.type[0].full_list_field;
307
+ }
308
+ if (field.options.type[0].full_list_editable_field) {
309
+ schema.full_list_editable_field =
310
+ field.options.type[0].full_list_editable_field;
311
+ }
312
+ if (field.options.type[0].width) {
313
+ schema.width = field.options.type[0].width;
314
+ }
315
+ if (field.options.type[0].height) {
316
+ schema.height = field.options.type[0].height;
317
+ }
318
+ if (field.options.type[0].max_size_checked) {
319
+ schema.max_size_checked = field.options.type[0].max_size_checked;
320
+ }
321
+ if (field.options.type[0].multiple) {
322
+ schema.multiple = field.options.type[0].multiple;
323
+ }
324
+ if (field.options.type[0].external_url) {
325
+ schema.external_url = field.options.type[0].external_url;
326
+ }
327
+ if (field.options.type[0].sortable) {
328
+ schema.sortable = field.options.type[0].sortable;
329
+ }
330
+ if (field.options.type[0].entities_title) {
331
+ schema.entities_title = field.options.type[0].entities_title;
332
+ }
333
+ if (field.options.type[0].allow_type) {
334
+ schema.allow_type = field.options.type[0].allow_type;
335
+ }
336
+ if (field.options.type[0].allow_translate) {
337
+ schema.allow_translate = field.options.type[0].allow_translate;
338
+ }
339
+ if (field.options.type[0].is_public) {
340
+ schema.is_public = field.options.type[0].is_public;
341
+ }
342
+ if (_.has(field.options.type[0], "allow_search")) {
343
+ schema.allow_search = field.options.type[0].allow_search;
344
+ }
345
+ }
346
+ else {
347
+ if (field.instance === "String") {
348
+ if (field.options.type_date === "time") {
349
+ schema.type = FIELD_TYPE_DATE;
350
+ schema.type_date = field.options.type_date;
351
+ }
352
+ else if (field.options.encrypt) {
353
+ schema.type = FIELD_TYPE_ENCRYPT;
354
+ }
355
+ else if (field.options.email) {
356
+ schema.type = FIELD_TYPE_EMAIL;
357
+ }
358
+ else {
359
+ schema.type = FIELD_TYPE_STRING;
360
+ schema.description_line =
361
+ field.options.description_line || "single_line";
362
+ }
363
+ if (field.options.sensitive && field.options.masking_format) {
364
+ schema.mask_checked = true;
365
+ schema.mask_type = ["email", "phone"].includes(field.options.masking_format)
366
+ ? field.options.masking_format
367
+ : "custom";
368
+ schema.mask_custom = ["email", "phone"].includes(field.options.masking_format)
369
+ ? null
370
+ : field.options.masking_format;
371
+ }
372
+ if (_.has(field.options, "allow_search")) {
373
+ schema.allow_search = field.options.allow_search;
374
+ }
375
+ }
376
+ else if (field.instance === "Number") {
377
+ schema.type = FIELD_TYPE_NUMBER;
378
+ schema.decimal_length = 0;
379
+ }
380
+ else if (field.instance === "Date") {
381
+ schema.type = FIELD_TYPE_DATE;
382
+ schema.type_date = field.options.type_date || "date";
383
+ }
384
+ else if (field.instance === "Decimal128") {
385
+ schema.type = FIELD_TYPE_NUMBER;
386
+ schema.decimal_length = (_a = field.options.decimal_length) !== null && _a !== void 0 ? _a : 2;
387
+ }
388
+ else if (field.instance === "Boolean") {
389
+ schema.type = FIELD_TYPE_BOOLEAN;
390
+ }
391
+ else if (field.instance === "Mixed" && !field.options.encrypt) {
392
+ schema.type = FIELD_TYPE_JSON;
393
+ schema.json_type = field.options.json_type || "standard";
394
+ schema.external_storage = field.options.external_storage || false;
395
+ }
396
+ else if (field.instance === "Mixed" && field.options.encrypt) {
397
+ schema.type = FIELD_TYPE_ENCRYPT;
398
+ schema.encrypt_type = ((_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.encrypt_type) || 'one_way';
399
+ if (field.options.use_mask) {
400
+ schema.use_mask = true;
401
+ schema.use_mask_prefix = ((_c = field.options) === null || _c === void 0 ? void 0 : _c.mask_prefix_length) || 0;
402
+ schema.use_mask_suffix = ((_d = field.options) === null || _d === void 0 ? void 0 : _d.mask_suffix_length) || 0;
403
+ }
404
+ }
405
+ else if (field.instance === "ObjectID" && field.options.ref) {
406
+ if (field.options.image) {
407
+ schema.type = FIELD_TYPE_IMAGE;
408
+ schema.multiple = field.options.multiple;
409
+ schema.external_url = field.options.external_url;
410
+ }
411
+ else {
412
+ schema.type = FIELD_TYPE_RELATED;
413
+ schema.related_type = FIELD_TYPE_RELATED_TYPE_O2O;
414
+ schema.related_ref = field.options.ref;
415
+ schema.entities_title = field.options.entities_title;
416
+ }
417
+ }
418
+ if (field.instance === "Array" && field.options.fields_options_type) {
419
+ schema.type = FIELD_TYPE_OPTIONS;
420
+ schema.fields_options_type = field.options.fields_options_type;
421
+ schema.values = field.options.values || [];
422
+ schema.multiple =
423
+ schema.fields_options_type === "tags" ||
424
+ field.options.multiple ||
425
+ false;
426
+ if (_.has(field.options, "allow_search")) {
427
+ schema.allow_search = field.options.allow_search;
428
+ }
429
+ }
430
+ if (field.options.required) {
431
+ schema.required = field.options.required;
432
+ }
433
+ if (field.options.is_unique) {
434
+ schema.unique = field.options.is_unique;
435
+ }
436
+ if (field.options.default) {
437
+ schema.default = field.options.default;
438
+ }
439
+ if (field.options.max_value) {
440
+ schema.max_value = field.options.max_value;
441
+ }
442
+ if (field.options.min_value) {
443
+ schema.min_value = field.options.min_value;
444
+ }
445
+ if (field.options.allow_create_update) {
446
+ schema.allow_create_update = field.options.allow_create_update;
447
+ }
448
+ if (field.options.show_comma) {
449
+ schema.show_comma = true;
450
+ }
451
+ if (field.options.multi_line) {
452
+ schema.multi_line = field.options.multi_line;
453
+ }
454
+ if (field.options.max_size_checked) {
455
+ schema.max_size_checked = field.options.max_size_checked;
456
+ }
457
+ if (field.options.max_size) {
458
+ schema.max_size = field.options.max_size;
459
+ }
460
+ if (field.options.prefix) {
461
+ schema.prefix = field.options.prefix;
462
+ }
463
+ if (field.options.suffix) {
464
+ schema.suffix = field.options.suffix;
465
+ }
466
+ if (field.options.allow_translate) {
467
+ schema.allow_translate = field.options.allow_translate;
468
+ }
469
+ if (field.options.is_public) {
470
+ schema.is_public = field.options.is_public;
471
+ }
472
+ if (field.options.log) {
473
+ schema.log = field.options.log;
474
+ }
475
+ if (_.has(field.options, "allow_search")) {
476
+ schema.allow_search = field.options.allow_search;
477
+ }
478
+ }
479
+ return schema;
480
+ }
481
+ async _setGenerateDataRedis(ref_id, percent, errorMsg) {
482
+ if (ref_id) {
483
+ const data = {
484
+ ref_id,
485
+ percent,
486
+ finish: percent >= 100 || percent < 0,
487
+ status: percent >= 100 ? "success" : percent < 0 ? "failed" : "processing"
488
+ };
489
+ if (errorMsg) {
490
+ data["error_message"] = errorMsg;
491
+ }
492
+ await redis_1.redisCache.set(ref_id, data, TTL);
493
+ }
494
+ }
495
+ async refreshCustomSchema(entity, deleted = false) {
496
+ if (deleted) {
497
+ await (0, schema_1.removeEntity)(entity.name);
498
+ return true;
499
+ }
500
+ entity.deep_search_text = true;
501
+ entity.allow_print = true;
502
+ entity.allow_manual_import_export = true;
503
+ let existsEntity = undefined;
504
+ try {
505
+ existsEntity = await (0, schema_1.loadEntity)(entity.name, true);
506
+ }
507
+ catch (e) { }
508
+ if (existsEntity) {
509
+ const SYSTEM_FIELDS = [
510
+ "system",
511
+ "updatedAt",
512
+ "createdAt",
513
+ "_translates",
514
+ "_search_text"
515
+ ];
516
+ const dbSchema = await (0, schema_1.loadSchema)(entity.name);
517
+ const model = mongoose.model(entity.name, dbSchema);
518
+ const existsFields = Object.keys(dbSchema.paths);
519
+ for (const field of entity.fields) {
520
+ if (existsFields.includes(field.name))
521
+ continue;
522
+ await (0, mongoose_2.addSchemaField)(model, field.name, this._getFieldSchema(field));
523
+ }
524
+ const newFields = _.map(entity.fields, f => f.name);
525
+ for (const field of existsFields) {
526
+ if (field.startsWith("_") ||
527
+ SYSTEM_FIELDS.includes(field) ||
528
+ newFields.includes(field))
529
+ continue;
530
+ await (0, mongoose_2.removeSchemaField)(model, field);
531
+ }
532
+ await this._createSearchTextIndex(model, entity);
533
+ await (0, schema_1.refreshEntity)(entity.name, { entity, schema: model.schema });
534
+ }
535
+ else {
536
+ for (const field of CHECK_FIELDS) {
537
+ const isExists = entity.fields.find(i => i.name === field.name);
538
+ if (!isExists) {
539
+ await this.model.findByIdAndUpdate(entity.id, {
540
+ $push: { fields: field }
541
+ });
542
+ entity.fields.push(field);
543
+ }
544
+ }
545
+ const schema = {};
546
+ for (const field of entity.fields) {
547
+ schema[field.name] = this._getFieldSchema(field);
548
+ }
549
+ const dbSchema = new mongoose.Schema(schema, {
550
+ strict: false,
551
+ timestamps: true
552
+ });
553
+ await (0, schema_1.refreshEntity)(entity.name, { entity, schema: dbSchema });
554
+ }
555
+ return true;
556
+ }
557
+ async refreshSystemSchema(service, model, doc, schema, options) {
558
+ const entity = {
559
+ id: "",
560
+ name: `${_.isEmpty(service.prefix)
561
+ ? _.snakeCase(doc.name)
562
+ : service.prefix + "_" + _.snakeCase(doc.name)}`,
563
+ system: true,
564
+ deep_search_text: true,
565
+ fields: [],
566
+ layouts: [DEFAULT_LAYOUTS],
567
+ hooks: [],
568
+ workflows: {},
569
+ custom_actions: [],
570
+ external_source: {},
571
+ data_permissions: {}
572
+ };
573
+ const { hooks, layouts, custom_actions, actions, workflow, external_source, data_permissions, deep_search_text } = options || {};
574
+ let existsEntity = undefined;
575
+ try {
576
+ existsEntity = await (0, schema_1.loadEntity)(entity.name, true);
577
+ }
578
+ catch (e) { }
579
+ if (!existsEntity) {
580
+ entity.fields.push({
581
+ name: "id",
582
+ system: true,
583
+ type: "string",
584
+ required: true
585
+ });
586
+ for (const key of Object.keys(schema.paths)) {
587
+ if (key.startsWith("_"))
588
+ continue;
589
+ const fieldSchema = this._getFieldEntity(schema.paths[key]);
590
+ entity.fields.push(fieldSchema);
591
+ }
592
+ if (!_.isEmpty(layouts)) {
593
+ entity.layouts = layouts;
594
+ }
595
+ entity.actions = _.concat(DEFAULT_ACTIONS, actions || []);
596
+ entity.custom_actions = _.map(custom_actions || [], a => (Object.assign(Object.assign({}, a), { system: true, enabled: true })));
597
+ }
598
+ entity.keep_activity_log = _.isUndefined(_.get(options, "keep_activity_log"))
599
+ ? true
600
+ : options.keep_activity_log;
601
+ entity.hooks = _.map(hooks, h => {
602
+ return Object.assign(Object.assign({}, h), { system: true, enabled: true });
603
+ });
604
+ entity.external_source = external_source || { type: "none" };
605
+ entity.data_permissions = data_permissions;
606
+ if (!_.isUndefined(deep_search_text)) {
607
+ entity.deep_search_text = deep_search_text;
608
+ }
609
+ let schemaData = await this.model.findOne({
610
+ name: entity.name,
611
+ system: true
612
+ });
613
+ if (!schemaData) {
614
+ entity.display_name = _.upperFirst(entity.name);
615
+ entity.type = "data";
616
+ entity.allow_print = true;
617
+ entity.allow_manual_import_export = true;
618
+ entity.workflows = workflow;
619
+ const dataModel = new this.model(entity);
620
+ schemaData = await dataModel.save();
621
+ entity.id = schemaData._id.toString();
622
+ entity.type = schemaData.type;
623
+ }
624
+ else {
625
+ entity.id = schemaData.id;
626
+ entity.type = schemaData.type;
627
+ entity.versioning = schemaData.versioning || false;
628
+ if (_.isEmpty(entity.fields)) {
629
+ entity.fields = schemaData.fields.filter(f => f.system);
630
+ }
631
+ if (schemaData.layouts) {
632
+ entity.layouts = schemaData.layouts;
633
+ for (const layout of (layouts || []).filter(i => i.config_key)) {
634
+ const layoutIdx = entity.layouts.findIndex(i => i.code === layout.code);
635
+ if (layoutIdx < 0)
636
+ continue;
637
+ entity.layouts[layoutIdx]["config_key"] = layout.config_key;
638
+ }
639
+ }
640
+ if (_.isEmpty(entity.hooks)) {
641
+ entity.hooks = schemaData.hooks.filter(h => h.system && h.code);
642
+ }
643
+ else {
644
+ entity.hooks = _.unionBy(entity.hooks, schemaData.hooks, "code");
645
+ }
646
+ if (_.isEmpty(entity.custom_actions)) {
647
+ entity.custom_actions = _.get(schemaData, "custom_actions", []).filter(a => a.system);
648
+ }
649
+ if (!_.isEmpty(schemaData.workflows)) {
650
+ entity.workflows = schemaData.workflows;
651
+ }
652
+ else if (!_.isEmpty(workflow)) {
653
+ entity.workflows = workflow;
654
+ }
655
+ for (const field of entity.fields) {
656
+ const exitstField = schemaData.fields.find(f => f.name === field.name);
657
+ if (field.type === FIELD_TYPE_OPTIONS &&
658
+ field.fields_options_type !== "tags") {
659
+ field.values = _.uniq([
660
+ ..._.get(exitstField, "values", []),
661
+ ...field.values
662
+ ]);
663
+ }
664
+ }
665
+ const customFields = schemaData.fields.filter(f => !f.system);
666
+ for (const field of Object.keys(model.schema.paths)) {
667
+ if (field.startsWith("_")) {
668
+ continue;
669
+ }
670
+ const foundInSystem = entity.fields.find(f => f.name === field);
671
+ const foundInCustom = customFields.find(f => f.name === field);
672
+ if (!foundInSystem && !foundInCustom) {
673
+ await (0, mongoose_2.removeSchemaField)(model, field);
674
+ }
675
+ }
676
+ for (const field of customFields) {
677
+ if (!Object.keys(model.schema.paths).includes(field.name)) {
678
+ await (0, mongoose_2.addSchemaField)(model, field.name, this._getFieldSchema(field));
679
+ }
680
+ }
681
+ for (const field of CHECK_FIELDS) {
682
+ const isExists = entity.fields.find(i => i.name === field.name);
683
+ if (!isExists) {
684
+ entity.fields.push(field);
685
+ }
686
+ }
687
+ entity.fields = _.unionBy(entity.fields, customFields, "name").sort((a, b) => {
688
+ const x = a.system ? 1 : 0;
689
+ const y = b.system ? 1 : 0;
690
+ const z = a.name < b.name ? -1 : 1;
691
+ return y - x || z;
692
+ });
693
+ entity.hooks = _.concat(entity.hooks, schemaData.hooks.filter(h => !h.system));
694
+ for (const ca of _.get(schemaData, "custom_actions", [])) {
695
+ const fca = entity.custom_actions.find(c => c.code === ca.code);
696
+ if (!fca)
697
+ continue;
698
+ fca.permissions = ca.permissions;
699
+ }
700
+ entity.custom_actions = _.concat(entity.custom_actions, _.get(schemaData, "custom_actions", []).filter(a => !a.system));
701
+ entity.data_permissions = schemaData.data_permissions;
702
+ entity.allow_print = true;
703
+ entity.allow_manual_import_export = true;
704
+ if (["import_export", "template"].includes(entity.name)) {
705
+ entity.allow_print = false;
706
+ entity.allow_manual_import_export = false;
707
+ }
708
+ await this.model.findOneAndUpdate({ _id: schemaData._id.toString() }, entity, { new: true });
709
+ for (const field of schemaData.fields.filter(f => !f.system)) {
710
+ await (0, mongoose_2.addSchemaField)(model, field.name, this._getFieldSchema(field));
711
+ }
712
+ }
713
+ if ((0, text_search_1.checkAllowAddSearchText)(entity.name)) {
714
+ await this._createSearchTextIndex(model, entity);
715
+ }
716
+ await (0, schema_1.refreshEntity)(entity.name, { entity, schema });
717
+ return model;
718
+ }
719
+ async _createSearchTextIndex(model, entity) {
720
+ const isAtlas = constants_1.CONST.ATLAS_MODE;
721
+ if (isAtlas) {
722
+ const collection = model.collection;
723
+ try {
724
+ const existingIndexes = await db
725
+ .collection(collection.collectionName)
726
+ .aggregate([{ $listSearchIndexes: {} }])
727
+ .toArray();
728
+ const indexExists = existingIndexes.some(index => index.name === "search_text_idx");
729
+ if (indexExists)
730
+ return;
731
+ const indexDefinition = {
732
+ name: "search_text_idx",
733
+ definition: {
734
+ mappings: {
735
+ dynamic: false,
736
+ fields: {
737
+ _search_text: {
738
+ type: "string",
739
+ analyzer: "pipe_split_analyzer",
740
+ multi: {
741
+ codeAnalyzer: {
742
+ type: "string",
743
+ analyzer: "code_analyzer"
744
+ }
745
+ }
746
+ }
747
+ }
748
+ },
749
+ analyzers: [
750
+ {
751
+ name: "pipe_split_analyzer",
752
+ tokenizer: {
753
+ type: "regexSplit",
754
+ pattern: "\\|"
755
+ },
756
+ tokenFilters: [
757
+ {
758
+ type: "lowercase"
759
+ },
760
+ {
761
+ type: "asciiFolding"
762
+ }
763
+ ]
764
+ },
765
+ {
766
+ name: "code_analyzer",
767
+ tokenizer: {
768
+ type: "keyword"
769
+ },
770
+ tokenFilters: [
771
+ {
772
+ type: "lowercase"
773
+ },
774
+ {
775
+ type: "asciiFolding"
776
+ }
777
+ ]
778
+ }
779
+ ]
780
+ }
781
+ };
782
+ const command = {
783
+ createSearchIndexes: model.collection.collectionName,
784
+ indexes: [indexDefinition]
785
+ };
786
+ await db.command(command);
787
+ }
788
+ catch (error) {
789
+ const errorMsg = error.message || "";
790
+ const isExpectedError = errorMsg.includes("already exists") ||
791
+ errorMsg.includes("not a function") ||
792
+ errorMsg.includes("duplicate");
793
+ if (!isExpectedError) {
794
+ console.error("Atlas Search index operation failed:", errorMsg);
795
+ }
796
+ }
797
+ }
798
+ else {
799
+ const listIndexes = await model.listIndexes();
800
+ const hasSearchIndex = listIndexes.some((idx) => {
801
+ return (idx.name && idx.name.includes("search_text_idx_1"));
802
+ });
803
+ if (!hasSearchIndex) {
804
+ try {
805
+ await model.collection.createIndex({ _search_text: 1 }, { name: "search_text_idx_1" });
806
+ }
807
+ catch (error) {
808
+ console.error("Failed to create search text index:", error);
809
+ }
810
+ }
811
+ }
812
+ }
813
+ async reloadSchema(entity, deleted = false, ignore = false) {
814
+ try {
815
+ const http = axios_1.default.create();
816
+ if (entity.system) {
817
+ const result = await http.get(`${constants_1.CONST.INTERNAL_DOMAIN}/${entity.name}/init`);
818
+ common_1.Logger.log(`${result.data}`, "EntitiesService#reloadSchema");
819
+ }
820
+ else {
821
+ await this.refreshCustomSchema(entity, deleted);
822
+ }
823
+ }
824
+ catch (e) {
825
+ console.log(e);
826
+ throw e;
827
+ }
828
+ }
829
+ async init() {
830
+ this.refreshSystemSchema(EntitiesService_1, this.model, entity_schema_1.Entity, entity_schema_1.EntitySchema);
831
+ const entities = await this.model.find({ system: false }).exec();
832
+ for (const entity of entities) {
833
+ this.refreshCustomSchema(entity);
834
+ }
835
+ return true;
836
+ }
837
+ async initData() {
838
+ for (const entity of constants_1.CONST.INIT_ENTITY_DATA) {
839
+ await (0, schema_1.callInternalService)(entity, "get", "init_data");
840
+ console.log(`${entity} initial data successfully.`);
841
+ }
842
+ }
843
+ async initRefresh() {
844
+ const entityAdjust = [];
845
+ for (const adjust of constants_1.CONST.INIT_REFRESH_ENTITY_STACK) {
846
+ let entity = entityAdjust.find(e => e.entity_name === adjust.entity);
847
+ if (!entity) {
848
+ entity = await (0, schema_1.loadEntity)(adjust.entity);
849
+ entityAdjust.push({
850
+ entity_name: adjust.entity,
851
+ entity_id: entity.id,
852
+ fields: entity.fields,
853
+ layouts: entity.layouts,
854
+ hooks: entity.hooks,
855
+ custom_actions: entity.custom_actions
856
+ });
857
+ entity = entityAdjust.find(e => e.entity_name === adjust.entity);
858
+ }
859
+ switch (adjust.action) {
860
+ case "add_field":
861
+ const fidx = _.findIndex(entity.fields, f => f.name === adjust.data.name);
862
+ fidx === -1
863
+ ? entity.fields.push(adjust.data)
864
+ : (entity.fields[fidx] = adjust.data);
865
+ break;
866
+ case "add_hook":
867
+ const hidx = _.findIndex(entity.hooks, f => f.code === adjust.data.code);
868
+ hidx === -1
869
+ ? entity.hooks.push(adjust.data)
870
+ : (entity.hooks[hidx] = adjust.data);
871
+ break;
872
+ case "add_custom_action":
873
+ const cidx = _.findIndex(entity.custom_actions, f => f.code === adjust.data.code);
874
+ cidx === -1
875
+ ? entity.custom_actions.push(adjust.data)
876
+ : (entity.custom_actions[cidx] = adjust.data);
877
+ break;
878
+ case "add_layout":
879
+ const lidx = _.findIndex(entity.layouts, f => f.code === adjust.data.code);
880
+ lidx === -1
881
+ ? entity.layouts.push(adjust.data)
882
+ : (entity.layouts[lidx] = adjust.data);
883
+ break;
884
+ }
885
+ }
886
+ if (_.isEmpty(entityAdjust)) {
887
+ return true;
888
+ }
889
+ for (const p of entityAdjust) {
890
+ await this.model.findOneAndUpdate({ _id: p.entity_id }, {
891
+ fields: p.fields,
892
+ hooks: p.hooks,
893
+ layouts: p.layouts,
894
+ custom_actions: p.custom_actions
895
+ });
896
+ const entity = await (0, schema_1.loadEntity)(p.entity_name);
897
+ entity.fields = p.fields;
898
+ entity.hooks = p.hooks;
899
+ entity.layouts = p.layouts;
900
+ entity.custom_actions = p.custom_actions;
901
+ const schema = await (0, schema_1.loadSchema)(p.entity_name);
902
+ await (0, schema_1.refreshEntity)(entity.name, { entity, schema });
903
+ }
904
+ }
905
+ async initCustomEntity(entityName) {
906
+ const entity = await this.schemaFindOne(entityName);
907
+ if (entity) {
908
+ await this.refreshCustomSchema(entity);
909
+ }
910
+ return true;
911
+ }
912
+ actionTypes() {
913
+ return [ACTION_TYPE_STATIC, ACTION_TYPE_INTERNAL, ACTION_TYPE_EXTERNAL];
914
+ }
915
+ fieldTypes() {
916
+ return [
917
+ FIELD_TYPE_STRING,
918
+ FIELD_TYPE_NUMBER,
919
+ FIELD_TYPE_DATE,
920
+ FIELD_TYPE_BOOLEAN,
921
+ FIELD_TYPE_ENCRYPT,
922
+ FIELD_TYPE_RELATED,
923
+ FIELD_TYPE_IMAGE
924
+ ];
925
+ }
926
+ async schemaCreate(dto) {
927
+ (0, permission_1.checkPermission)("entity", "create", this._getCurrentPermissions());
928
+ dto.system = false;
929
+ dto.keep_activity_log = true;
930
+ dto.actions = !_.isEmpty(dto.actions) ? dto.actions : DEFAULT_ACTIONS;
931
+ dto.fields = _.concat(dto.fields, DEFAULT_FIELDS);
932
+ dto.layouts = !_.isEmpty(dto.layouts)
933
+ ? dto.layouts
934
+ : [DEFAULT_LAYOUTS];
935
+ const dataModel = new this.model(dto);
936
+ const result = await dataModel.save();
937
+ await this.reloadSchema(result);
938
+ await (0, schema_1.callInternalService)("translate", "get", "generate");
939
+ await (0, schema_1.callInternalService)("user_role", "get", "reload_system");
940
+ await (0, schema_1.callInternalService)("user_role", "get", "refresh");
941
+ await (0, schema_1.callInternalService)("user_role", "patch", "update_layout");
942
+ return result;
943
+ }
944
+ async schemaUpdate(id, dto) {
945
+ const startTime = new Date();
946
+ (0, permission_1.checkPermission)("entity", "create", this._getCurrentPermissions());
947
+ dto.actions = DEFAULT_ACTIONS;
948
+ const entityData = await (0, schema_1.loadEntity)("entity");
949
+ const oldData = await (0, retry_1.autoRetry)(async () => {
950
+ return await this.model.findById(id);
951
+ }, 2, 1000);
952
+ if (!_.isEmpty(dto.fields) && !oldData.fields.find(f => f.name == "id")) {
953
+ dto.fields = [
954
+ {
955
+ name: "id",
956
+ system: true,
957
+ type: "string",
958
+ required: true
959
+ },
960
+ ...dto.fields
961
+ ];
962
+ }
963
+ const result = await this.model.findOneAndUpdate({ _id: id }, dto, {
964
+ new: true
965
+ });
966
+ const endTime = new Date();
967
+ const diff = (0, diff_1.getDiffData)(dto, oldData);
968
+ if (entityData.keep_activity_log && !_.isEmpty(diff)) {
969
+ (0, schema_1.addActivityLog)(entityData, this.cls.get("request"), result, activity_log_enum_1.ActivityLogType.activity, activity_log_enum_1.ActivityLogAction.updated, activity_log_enum_1.ActivityLogStatus.successfully, startTime, endTime, `Update ${diff.join(",")} successfully`, "", (0, diff_1.filterDiffData)(result, diff), (0, diff_1.filterDiffData)(oldData, diff));
970
+ }
971
+ await this.reloadSchema(result);
972
+ return result;
973
+ }
974
+ async schemaDelete(id) {
975
+ (0, permission_1.checkPermission)("entity", "create", this._getCurrentPermissions());
976
+ const entity = await this.model.findOne({ _id: id });
977
+ const result = await this.model.deleteOne({ _id: id });
978
+ await this.reloadSchema(entity, true);
979
+ await (0, schema_1.callInternalService)("user_role", "get", "reload_system");
980
+ await (0, schema_1.callInternalService)("user_role", "get", "refresh");
981
+ await (0, schema_1.callInternalService)("user_role", "patch", "update_layout");
982
+ return entity;
983
+ }
984
+ async schemaSearch(keywords, filters, page, page_size, sort) {
985
+ (0, permission_1.checkPermission)("entity", "view", this._getCurrentPermissions());
986
+ const query = await (0, build_search_1.buildQuery)(keywords, filters, {
987
+ name: "entity",
988
+ layouts: [
989
+ {
990
+ code: "default",
991
+ list: {
992
+ columns: [
993
+ {
994
+ field: "name",
995
+ allow_search: true
996
+ },
997
+ {
998
+ field: "display_name",
999
+ allow_search: true
1000
+ }
1001
+ ]
1002
+ }
1003
+ }
1004
+ ]
1005
+ }, this._getCurrentProfile(), this._getCurrentPermissions(), this._getCurrentApiKey(), undefined, true);
1006
+ query["name"] = { $nin: RESERVED_SYSTEM_ENTITIES };
1007
+ const currentPage = ((page || 1) - 1) * (page_size || 10);
1008
+ sort = _.isEmpty(sort) ? "-system,display_name,name" : `-system,${sort}`;
1009
+ const result = await this.model
1010
+ .find(query)
1011
+ .sort((0, build_search_1.buildSort)(sort))
1012
+ .skip(currentPage)
1013
+ .select("-__v")
1014
+ .limit(page_size)
1015
+ .exec();
1016
+ const total = await this.model.countDocuments(query).exec();
1017
+ return {
1018
+ page,
1019
+ page_size,
1020
+ total,
1021
+ total_page: Math.ceil(total / page_size),
1022
+ rows: result
1023
+ };
1024
+ }
1025
+ async schemaRelatedSearch(entityName, maxDeep, fields) {
1026
+ (0, permission_1.checkPermission)("entity", "view", this._getCurrentPermissions());
1027
+ maxDeep = Math.min(maxDeep, 3);
1028
+ const pickFields = fields ? fields.split(",") : [];
1029
+ const request = this.cls.get("request");
1030
+ const systemAdminRole = _.get(request, "profile.roles", []).find(i => i.code === "system_admin");
1031
+ const entitiesName = await (0, entity_1.listRelatedFields)(entityName, maxDeep, 2);
1032
+ const entities = [];
1033
+ common_1.Logger.log(`before load releate entity`, "schemaRelatedSearch");
1034
+ for (const name of entitiesName) {
1035
+ const entity = await (0, schema_1.loadEntity)(name);
1036
+ if (!systemAdminRole && name === "user_role") {
1037
+ const defaultLayout = _.get(entity, "layouts", []).find(l => l.code === "default");
1038
+ const blockTabs = _.get(defaultLayout, "detail.blocks", []).find(b => b.type === "tabs");
1039
+ blockTabs.tabs.splice(0, 1);
1040
+ }
1041
+ entities.push(pickFields.length ? _.pick(entity, pickFields) : entity);
1042
+ }
1043
+ common_1.Logger.log(`after load releate entity`, "schemaRelatedSearch");
1044
+ return entities.filter(i => i);
1045
+ }
1046
+ async schemaFind(keywords, filters, sort) {
1047
+ const result = await this.schemaSearch(keywords, filters, 1, 1, sort);
1048
+ if (result.total === 0) {
1049
+ return {};
1050
+ }
1051
+ return result.rows[0];
1052
+ }
1053
+ async schemaFindWithLayout(layoutCode, keywords, filters, sort) {
1054
+ const schema = await this.schemaFind(keywords, filters, sort);
1055
+ if (schema.layouts) {
1056
+ schema.layouts = [
1057
+ ...schema.layouts.filter(i => i.code === layoutCode),
1058
+ ...schema.layouts.filter(i => i.code !== layoutCode)
1059
+ ];
1060
+ }
1061
+ const request = this.cls.get("request");
1062
+ schema["related_schema"] = await (0, schema_1.listRelateSchema)(schema);
1063
+ if (schema["layouts"][0]) {
1064
+ schema["layouts"][0] = (0, layout_1.removeRestrictField)(schema["layouts"][0], _.get(request, "profile", {}));
1065
+ }
1066
+ return schema;
1067
+ }
1068
+ async schemaFindOne(id) {
1069
+ (0, permission_1.checkPermission)("entity", "view", this._getCurrentPermissions());
1070
+ let result = await (0, retry_1.autoRetry)(async () => {
1071
+ return await this.model.findOne({ name: id }).exec();
1072
+ }, 2, 1000);
1073
+ if (!result && mongoose.Types.ObjectId.isValid(id)) {
1074
+ result = await this.model.findById(id).exec();
1075
+ }
1076
+ if (!result) {
1077
+ return {};
1078
+ }
1079
+ const request = this.cls.get("request");
1080
+ const systemAdminRole = _.get(request, "profile.roles", []).find(i => i.code === "system_admin");
1081
+ if (!systemAdminRole && result.name === "user_role") {
1082
+ const defaultLayout = _.get(result, "layouts", []).find(l => l.code === "default");
1083
+ const blockTabs = _.get(defaultLayout, "detail.blocks", []).find(b => b.type === "tabs");
1084
+ blockTabs.tabs.splice(0, 1);
1085
+ }
1086
+ return result;
1087
+ }
1088
+ async schemaFindOneWithLayout(layoutCode, id) {
1089
+ const schema = await this.schemaFindOne(id);
1090
+ if (schema.layouts) {
1091
+ schema.layouts = [
1092
+ ...schema.layouts.filter(i => i.code === layoutCode),
1093
+ ...schema.layouts.filter(i => i.code !== layoutCode)
1094
+ ];
1095
+ }
1096
+ const request = this.cls.get("request");
1097
+ schema["related_schema"] = await (0, schema_1.listRelateSchema)(schema);
1098
+ if (schema["layouts"][0]) {
1099
+ schema["layouts"][0] = (0, layout_1.removeRestrictField)(schema["layouts"][0], _.get(request, "profile", {}));
1100
+ }
1101
+ const systemAdminRole = _.get(request, "profile.roles", []).find(i => i.code === "system_admin");
1102
+ if (schema.name === "user_role" &&
1103
+ layoutCode === "default" &&
1104
+ !systemAdminRole) {
1105
+ const defaultLayout = _.get(schema, "layouts", []).find(l => l.code === "default");
1106
+ const blockTabs = _.get(defaultLayout, "detail.blocks", []).find(b => b.type === "tabs");
1107
+ blockTabs.tabs.splice(0, 1);
1108
+ }
1109
+ return schema;
1110
+ }
1111
+ async search(name, keywords, filters, page, page_size, sort, grouping, noTranslate, fields) {
1112
+ var _a, _b;
1113
+ if (!name) {
1114
+ throw new common_1.HttpException("Entity name is missing", 409);
1115
+ }
1116
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions());
1117
+ if (name === "entity") {
1118
+ return this.schemaSearch(keywords, filters, page, page_size, sort);
1119
+ }
1120
+ const request = this.cls.get("request");
1121
+ const profile = _.get(request, "profile");
1122
+ const entity = await (0, schema_1.loadEntity)(name);
1123
+ const schema = await (0, schema_1.loadSchema)(name);
1124
+ keywords = (0, text_search_1.modifyKeywords)(keywords);
1125
+ let query = await (0, build_search_1.buildQuery)(keywords, filters, entity, this._getCurrentProfile(), this._getCurrentPermissions(), this._getCurrentApiKey());
1126
+ const needMask = _.get(request, "headers._need_mask");
1127
+ query = await (0, build_search_1.buildDataPermissionQuery)(query, profile, name);
1128
+ const currentPage = ((page || 1) - 1) * (page_size || 10);
1129
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1130
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1131
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1132
+ if (isExternal) {
1133
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "find", [query, page, page_size, sort, fields], {
1134
+ externalDataSource: {
1135
+ name: entity.name,
1136
+ fields: entity.fields,
1137
+ external_source: entity.external_source
1138
+ }
1139
+ });
1140
+ return res;
1141
+ }
1142
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1143
+ return provider.find(query, page, page_size, sort, fields);
1144
+ }
1145
+ const result = {
1146
+ page,
1147
+ page_size,
1148
+ total: 0,
1149
+ total_page: 0,
1150
+ rows: []
1151
+ };
1152
+ query = await (0, build_search_1.buildAggregateQuery)(keywords, query, fields, name);
1153
+ if (_.isEmpty(grouping)) {
1154
+ let resultQuery = [];
1155
+ let total = 0;
1156
+ const aggregate = await (0, schema_1.buildAggregate)(query, name, fields, currentPage, page_size, sort);
1157
+ resultQuery = await this.aggregate(name, {
1158
+ query: aggregate
1159
+ });
1160
+ const count = await this.aggregate(name, {
1161
+ query: (0, schema_1.buildAggregateCount)(query)
1162
+ });
1163
+ total = _.get(count, "0.count", 0);
1164
+ (0, decimal2Json_1.decimal2Json)(resultQuery);
1165
+ resultQuery.map(r => (r["id"] = r._id.toString()));
1166
+ resultQuery = await (0, schema_1.transformShareWidget)(name, resultQuery);
1167
+ resultQuery = await (0, schema_1.transformJsonFields)(name, resultQuery, _.get(this.cls.get("request"), "headers", {}));
1168
+ if (!noTranslate) {
1169
+ const request = this.cls.get("request");
1170
+ resultQuery = await Promise.all(resultQuery.map(async (i) => await (0, translate_1.translateData)(i, name, _.get(request, "headers.accept-language"))));
1171
+ }
1172
+ resultQuery = (0, decimal2Json_1.imageComponent)(resultQuery);
1173
+ result.total = total;
1174
+ result.total_page = Math.ceil(total / page_size);
1175
+ result.rows = resultQuery;
1176
+ }
1177
+ else {
1178
+ const aggrTotalQuery = (0, build_search_1.buildGroupingTotalRecQuery)(fields, grouping, query, sort);
1179
+ const resultTotal = await this.aggregate(name, {
1180
+ query: aggrTotalQuery
1181
+ });
1182
+ result.total = ((_b = resultTotal[0]) === null || _b === void 0 ? void 0 : _b.total) || 0;
1183
+ result.total_page = Math.ceil(result.total / page_size);
1184
+ const aggrQuery = (0, build_search_1.buildGroupingDataQuery)(fields, grouping, query, sort, currentPage, page_size);
1185
+ const resultQuery = await this.aggregate(name, { query: aggrQuery });
1186
+ result.rows = resultQuery;
1187
+ }
1188
+ if (!this._isInternal || needMask) {
1189
+ for (const row of result.rows) {
1190
+ for (const field of entity.fields) {
1191
+ if (field.name in row && _.get(field, "mask_checked")) {
1192
+ row[field.name] = (0, masking_1.masking)(row[field.name], _.get(field, "mask_type"), _.get(field, "mask_custom"));
1193
+ }
1194
+ }
1195
+ }
1196
+ }
1197
+ for (let i = 0; i < result.rows.length; i++) {
1198
+ result.rows[i] = (0, schema_1.hashEncryptFields)(entity, result.rows[i]);
1199
+ }
1200
+ return result;
1201
+ }
1202
+ async searchIds(name, keywords, filters, page, page_size, sort) {
1203
+ var _a;
1204
+ const safeNamePattern = /^[\p{L}\p{N}_\-\s]+$/u;
1205
+ if (!safeNamePattern.test(name)) {
1206
+ throw new Error("Invalid entity name");
1207
+ }
1208
+ if (!_.isEmpty(keywords) && !safeNamePattern.test(keywords)) {
1209
+ throw new Error("Invalid keywords");
1210
+ }
1211
+ const sanitizedName = String(name);
1212
+ const sanitizedKeywords = _.isEmpty(keywords) ? keywords : String(keywords);
1213
+ const sanitizedFilters = _.isEmpty(filters) ? filters : JSON.parse(JSON.stringify(filters));
1214
+ const sanitizedSort = _.isEmpty(sort) ? sort : String(sort);
1215
+ page_size = Math.min(page_size, MAX_SEARCH_IDS_SIZE);
1216
+ (0, permission_1.checkPermission)(sanitizedName, "view", this._getCurrentPermissions());
1217
+ const entity = await (0, schema_1.loadEntity)(sanitizedName);
1218
+ const schema = await (0, schema_1.loadSchema)(sanitizedName);
1219
+ const Model = mongoose.model(sanitizedName, schema);
1220
+ const request = this.cls.get("request");
1221
+ const profile = _.get(request, "profile");
1222
+ let query = await (0, build_search_1.buildQuery)(sanitizedKeywords, sanitizedFilters, entity, this._getCurrentProfile(), this._getCurrentPermissions(), this._getCurrentApiKey());
1223
+ query = await (0, build_search_1.buildDataPermissionQuery)(query, profile, sanitizedName);
1224
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1225
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1226
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1227
+ if (isExternal) {
1228
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "searchIds", [query, page, page_size, sort], {
1229
+ externalDataSource: {
1230
+ name: entity.name,
1231
+ fields: entity.fields,
1232
+ external_source: entity.external_source
1233
+ }
1234
+ });
1235
+ return res;
1236
+ }
1237
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1238
+ return provider.searchIds(query, page, page_size, sanitizedSort);
1239
+ }
1240
+ const currentPage = ((page || 1) - 1) * (page_size || 10);
1241
+ let doc = Model.find(query);
1242
+ doc = doc
1243
+ .sort((0, build_search_1.buildSort)(sanitizedSort))
1244
+ .skip(currentPage)
1245
+ .select("_id")
1246
+ .limit(page_size);
1247
+ const result = await doc.exec();
1248
+ return result.map(i => `${i._id}`);
1249
+ }
1250
+ async searchWithLayout(name, layoutCode, keywords, filters, page, page_size, sort, grouping, isDetail) {
1251
+ var _a, _b;
1252
+ const entity = await (0, schema_1.loadEntity)(name);
1253
+ const request = this.cls.get("request");
1254
+ const profile = _.get(request, "profile");
1255
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions(), entity.layouts.find(l => l.code === layoutCode), this._getCurrentRole());
1256
+ if (name === "entity") {
1257
+ return this.schemaSearch(keywords, filters, page, page_size, sort);
1258
+ }
1259
+ const schema = await (0, schema_1.loadSchema)(name);
1260
+ const Model = mongoose.model(name, schema);
1261
+ keywords = (0, text_search_1.modifyKeywords)(keywords);
1262
+ let query = await (0, build_search_1.buildQuery)(keywords, filters, entity, this._getCurrentProfile(), this._getCurrentPermissions(), this._getCurrentApiKey(), layoutCode);
1263
+ const currentPage = ((page || 1) - 1) * (page_size || 10);
1264
+ const view = entity.layouts.find(i => i.code === layoutCode);
1265
+ if (!view) {
1266
+ throw new Error("Invalid view code");
1267
+ }
1268
+ query = await (0, build_search_1.buildDataPermissionQuery)(query, profile, name);
1269
+ const fields = isDetail
1270
+ ? (0, layout_1.flatDetailLayout)(entity, view, entity.fields)
1271
+ : (0, layout_1.flatListLayout)(view, entity.fields);
1272
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1273
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1274
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1275
+ if (isExternal) {
1276
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "find", [query, page, page_size, sort, fields], {
1277
+ externalDataSource: {
1278
+ name: entity.name,
1279
+ fields: entity.fields,
1280
+ external_source: entity.external_source
1281
+ }
1282
+ });
1283
+ return res;
1284
+ }
1285
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1286
+ return provider.find(query, page, page_size, sort, fields);
1287
+ }
1288
+ query = await (0, build_search_1.buildAggregateQuery)(keywords, query, fields, name);
1289
+ const result = {
1290
+ page,
1291
+ page_size,
1292
+ total: 0,
1293
+ total_page: 0,
1294
+ rows: []
1295
+ };
1296
+ if (_.isEmpty(grouping)) {
1297
+ let resultQuery = [];
1298
+ let total = 0;
1299
+ const aggregate = await (0, schema_1.buildAggregate)(query, name, fields, currentPage, page_size, sort);
1300
+ resultQuery = await this.aggregate(name, { query: aggregate });
1301
+ const count = await this.aggregate(name, {
1302
+ query: (0, schema_1.buildAggregateCount)(query)
1303
+ });
1304
+ total = _.get(count, "0.count", 0);
1305
+ (0, decimal2Json_1.decimal2Json)(resultQuery);
1306
+ resultQuery.map(r => (r["id"] = r._id.toString()));
1307
+ resultQuery = (0, decimal2Json_1.imageComponent)(resultQuery);
1308
+ resultQuery = await (0, schema_1.transformShareWidget)(name, resultQuery);
1309
+ resultQuery = await (0, schema_1.transformJsonFields)(name, resultQuery, _.get(this.cls.get("request"), "headers", {}));
1310
+ resultQuery = await Promise.all(resultQuery.map(async (i) => await (0, translate_1.translateData)(i, name, _.get(request, "headers.accept-language"))));
1311
+ result.total = total;
1312
+ result.total_page = Math.ceil(total / page_size);
1313
+ result.rows = resultQuery;
1314
+ }
1315
+ else {
1316
+ const aggrTotalQuery = (0, build_search_1.buildGroupingTotalRecQuery)(fields, grouping, query, sort);
1317
+ const resultTotal = await this.aggregate(name, {
1318
+ query: aggrTotalQuery
1319
+ });
1320
+ result.total = ((_b = resultTotal[0]) === null || _b === void 0 ? void 0 : _b.total) || 0;
1321
+ result.total_page = Math.ceil(result.total / page_size);
1322
+ const aggrQuery = (0, build_search_1.buildGroupingDataQuery)(fields, grouping, query, sort, currentPage, page_size);
1323
+ const resultQuery = await this.aggregate(name, { query: aggrQuery });
1324
+ result.rows = resultQuery;
1325
+ }
1326
+ for (const row of result.rows) {
1327
+ }
1328
+ for (let i = 0; i < result.rows.length; i++) {
1329
+ const row = result.rows[i];
1330
+ result.rows[i] = (0, schema_1.hashEncryptFields)(entity, result.rows[i]);
1331
+ for (const field of fields) {
1332
+ if (field.name in row && _.get(field, "mask_checked")) {
1333
+ row[field.name] = (0, masking_1.masking)(row[field.name], _.get(field, "mask_type"), _.get(field, "mask_custom"));
1334
+ }
1335
+ }
1336
+ }
1337
+ return result;
1338
+ }
1339
+ async find(name, keywords, filters, sort, noTranslate, fields) {
1340
+ const result = await this.search(name, keywords, filters, 1, 1, sort, undefined, noTranslate, fields);
1341
+ if (result.total === 0) {
1342
+ return {};
1343
+ }
1344
+ result.rows[0]["id"] = result.rows[0]._id.toString();
1345
+ return result.rows[0];
1346
+ }
1347
+ async findWithLayout(name, layoutCode, keywords, filters, sort) {
1348
+ const result = await this.searchWithLayout(name, layoutCode, keywords, filters, 1, 1, sort, undefined, true);
1349
+ return _.get(result, "rows.0", {});
1350
+ }
1351
+ async findOne(name, id, fields, ignoreEncrypt) {
1352
+ var _a;
1353
+ try {
1354
+ const request = this.cls.get("request");
1355
+ const profile = _.get(request, "profile");
1356
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions());
1357
+ const entity = await (0, schema_1.loadEntity)(name);
1358
+ const schema = await (0, schema_1.loadSchema)(name);
1359
+ const canEdit = (0, permission_1.checkPermissionEdit)(name, this._getCurrentPermissions());
1360
+ const SAFE_NAME_PATTERN = /^[\p{L}\p{N}_\-\s]+$/u;
1361
+ if (!SAFE_NAME_PATTERN.test(name)) {
1362
+ throw new Error('Invalid entity name');
1363
+ }
1364
+ const Model = mongoose.model(name, schema);
1365
+ let query = { _id: id };
1366
+ query = await (0, build_search_1.buildDataPermissionQuery)(query, profile, name);
1367
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1368
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1369
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1370
+ return provider.findOne(query, undefined, fields);
1371
+ }
1372
+ let doc = Model.findOne(query);
1373
+ (0, schema_1.buildSelect)(doc, fields);
1374
+ await (0, schema_1.buildPopulate)(doc, name, fields);
1375
+ let result = await (await doc.exec()).toJSON();
1376
+ (0, decimal2Json_1.decimal2Json)(result);
1377
+ if (!_.isEmpty(result)) {
1378
+ result["id"] = result._id.toString();
1379
+ }
1380
+ result = (0, decimal2Json_1.imageComponent)(result);
1381
+ _.set(result, "_allow_print", true);
1382
+ result = await (0, schema_1.transformShareWidget)(name, result);
1383
+ result = await (0, schema_1.transformJsonFields)(name, result, _.get(this.cls.get("request"), "headers", {}));
1384
+ if (!canEdit) {
1385
+ for (const field of entity.fields) {
1386
+ if (field.name in result && _.get(field, "mask_checked")) {
1387
+ result[field.name] = (0, masking_1.masking)(result[field.name], _.get(field, "mask_type"), _.get(field, "mask_custom"));
1388
+ }
1389
+ }
1390
+ }
1391
+ for (const field of entity.fields) {
1392
+ if (_.isEmpty(result))
1393
+ continue;
1394
+ if (field.name in result &&
1395
+ field.type === "options" &&
1396
+ !field.multiple) {
1397
+ result[field.name] = _.isEmpty(result[field.name])
1398
+ ? undefined
1399
+ : result[field.name][0];
1400
+ }
1401
+ }
1402
+ if (!ignoreEncrypt) {
1403
+ result = await (0, schema_1.hashEncryptFields)(entity, result);
1404
+ }
1405
+ return await (0, translate_1.translateData)(result, name, _.get(request, "headers.accept-language"));
1406
+ }
1407
+ catch (e) {
1408
+ throw e;
1409
+ }
1410
+ }
1411
+ async findOneWithLayout(name, layoutCode, id, noTranslate) {
1412
+ if (!mongoose.Types.ObjectId.isValid(id)) {
1413
+ throw new Error("Invalid ID format");
1414
+ }
1415
+ const safeNamePattern = /^[\p{L}\p{N}_\-\s]+$/u;
1416
+ if (!safeNamePattern.test(name)) {
1417
+ throw new Error("Invalid entity name");
1418
+ }
1419
+ const entity = await (0, schema_1.loadEntity)(name);
1420
+ const request = this.cls.get("request");
1421
+ const profile = _.get(request, "profile");
1422
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions(), entity.layouts.find(l => l.code === layoutCode), this._getCurrentRole());
1423
+ const schema = await (0, schema_1.loadSchema)(name);
1424
+ let query = { _id: id };
1425
+ query = await (0, build_search_1.buildDataPermissionQuery)(query, profile, name);
1426
+ const Model = mongoose.model(name, schema);
1427
+ let doc = Model.findOne(query);
1428
+ const layout = entity.layouts.find(i => i.code === layoutCode);
1429
+ if (!layout) {
1430
+ throw new Error("Invalid view code");
1431
+ }
1432
+ const fields = (0, layout_1.flatDetailLayout)(entity, layout, entity.fields);
1433
+ await (0, schema_1.buildPopulateWithLayout)(doc, fields, true);
1434
+ let result = await (await doc
1435
+ .select((0, layout_1.generateSelectFields)(entity.fields, fields, true, [
1436
+ _.get(entity, "workflows.field")
1437
+ ]))
1438
+ .exec()).toJSON();
1439
+ (0, decimal2Json_1.decimal2Json)(result);
1440
+ if (!_.isEmpty(result)) {
1441
+ result["id"] = result._id.toString();
1442
+ }
1443
+ result = (0, decimal2Json_1.imageComponent)(result);
1444
+ _.set(result, "_allow_print", true);
1445
+ result = await (0, schema_1.transformShareWidget)(name, result);
1446
+ result = await (0, schema_1.transformJsonFields)(name, result, _.get(this.cls.get("request"), "headers", {}));
1447
+ const canEdit = (0, permission_1.checkPermissionEdit)(name, this._getCurrentPermissions());
1448
+ if (!canEdit) {
1449
+ for (const field of fields) {
1450
+ if (field.name in result && _.get(field, "mask_checked")) {
1451
+ result[field.name] = (0, masking_1.masking)(result[field.name], _.get(field, "mask_type"), _.get(field, "mask_custom"));
1452
+ }
1453
+ }
1454
+ }
1455
+ for (const field of fields) {
1456
+ if (_.isEmpty(result))
1457
+ continue;
1458
+ if (field.name in result && field.type === "options" && !field.multiple) {
1459
+ result[field.name] = _.isEmpty(result[field.name])
1460
+ ? undefined
1461
+ : result[field.name][0];
1462
+ }
1463
+ }
1464
+ result = await (0, schema_1.hashEncryptFields)(entity, result);
1465
+ return noTranslate
1466
+ ? result
1467
+ : await (0, translate_1.translateData)(result, name, _.get(request, "headers.accept-language"));
1468
+ }
1469
+ async aggregate(name, query) {
1470
+ const request = this.cls.get("request");
1471
+ const profile = _.get(request, "profile");
1472
+ const entity = await (0, schema_1.loadEntity)(name);
1473
+ const schema = await (0, schema_1.loadSchema)(name);
1474
+ const Model = mongoose.model(name, schema);
1475
+ const q = _.isString(query) ? JSON.parse(query) : query;
1476
+ const qq = (0, build_search_1.queryDateFormat)(q);
1477
+ if (qq.query) {
1478
+ const permissionQuery = await (0, build_search_1.buildDataPermissionQuery)({}, profile, name);
1479
+ !_.isEmpty(permissionQuery) &&
1480
+ qq.query.unshift({
1481
+ $match: permissionQuery
1482
+ });
1483
+ }
1484
+ const result = await Model.aggregate(qq.query);
1485
+ (0, decimal2Json_1.decimal2Json)(result);
1486
+ return result;
1487
+ }
1488
+ async decryptField(name, id, field) {
1489
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions());
1490
+ const entity = await (0, schema_1.loadEntity)(name);
1491
+ const schema = await (0, schema_1.loadSchema)(name);
1492
+ const fieldData = (entity.fields || [])
1493
+ .find(i => i.name == field);
1494
+ if ((fieldData === null || fieldData === void 0 ? void 0 : fieldData.encrypt_type) !== 'two_way')
1495
+ return { res: '' };
1496
+ const Model = mongoose.model(name, schema);
1497
+ let doc = (await Model.findOne({ _id: id })).toJSON();
1498
+ if (!_.get(doc, `${field}.value`))
1499
+ return { res: '' };
1500
+ const iv = Buffer.alloc(16);
1501
+ const secretKey = crypto.createHash('sha256').update(`${field}${schema_1.SALTRANDOMKEY}`).digest('hex').substring(0, 64);
1502
+ const decipher = crypto.createDecipheriv('aes-256-cbc', Buffer.from(secretKey, 'hex'), iv);
1503
+ const decrypted = Buffer.concat([decipher.update(_.get(doc, `${field}.value`), 'hex'), decipher.final()]).toString();
1504
+ return {
1505
+ res: decrypted
1506
+ };
1507
+ }
1508
+ async count(name, filters, keywords) {
1509
+ var _a;
1510
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions());
1511
+ const entity = await (0, schema_1.loadEntity)(name);
1512
+ const schema = await (0, schema_1.loadSchema)(name);
1513
+ const request = this.cls.get("request");
1514
+ const profile = _.get(request, "profile");
1515
+ keywords = (0, text_search_1.modifyKeywords)(keywords);
1516
+ const Model = mongoose.model(name, schema);
1517
+ let query = await (0, build_search_1.buildQuery)(keywords, filters, entity, this._getCurrentProfile(), this._getCurrentPermissions(), this._getCurrentApiKey());
1518
+ query = await (0, build_search_1.buildDataPermissionQuery)(query, profile, name);
1519
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1520
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1521
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1522
+ if (isExternal) {
1523
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "count", [query], {
1524
+ externalDataSource: {
1525
+ name: entity.name,
1526
+ fields: entity.fields,
1527
+ external_source: entity.external_source
1528
+ }
1529
+ });
1530
+ return res;
1531
+ }
1532
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1533
+ return provider.count(query);
1534
+ }
1535
+ const aggregate = await (0, build_search_1.buildAggregateQuery)(keywords, query, entity.fields, name);
1536
+ const aggregateResult = await this.aggregate(name, {
1537
+ query: (0, schema_1.buildAggregateCount)(aggregate)
1538
+ });
1539
+ return _.get(aggregateResult, "0.count", 0);
1540
+ }
1541
+ async create(name, dto) {
1542
+ var _a;
1543
+ const request = this.cls.get("request");
1544
+ (0, permission_1.checkPermission)(name, "create", this._getCurrentPermissions());
1545
+ const schema = await (0, schema_1.loadSchema)(name);
1546
+ const entity = await (0, schema_1.loadEntity)(name);
1547
+ const Model = mongoose.model(name, schema);
1548
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1549
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1550
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1551
+ if (isExternal) {
1552
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "create", [dto], {
1553
+ externalDataSource: {
1554
+ name: entity.name,
1555
+ fields: entity.fields,
1556
+ external_source: entity.external_source
1557
+ }
1558
+ });
1559
+ return res;
1560
+ }
1561
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1562
+ return provider.create(dto);
1563
+ }
1564
+ await (0, hook_1.executeHooks)(entity, "create", "before", request, dto);
1565
+ const uniqueQuery = (0, build_search_1.buildUniqueQuery)(entity, dto);
1566
+ if (!_.isEmpty(uniqueQuery)) {
1567
+ const countUnique = await Model.countDocuments(uniqueQuery)
1568
+ .lean()
1569
+ .exec();
1570
+ if (countUnique > 0) {
1571
+ throw new common_1.HttpException("duplicate_unique_key", 500);
1572
+ }
1573
+ }
1574
+ if (_.get(entity, "workflows.field") &&
1575
+ _.get(entity, "workflows.first_status")) {
1576
+ if (!this._isInternal() || _.isEmpty(dto[`${entity.workflows.field}`])) {
1577
+ dto[`${entity.workflows.field}`] = entity.workflows.first_status || "";
1578
+ }
1579
+ }
1580
+ if (_.get(request, "headers.use_own_single")) {
1581
+ dto = await (0, schema_1.saveRelatedFields)(entity, _.get(request, "headers"), dto);
1582
+ }
1583
+ else {
1584
+ dto = await (0, schema_1.saveRelatedFieldsV2)(entity, _.get(request, "headers"), dto);
1585
+ }
1586
+ dto = await (0, schema_1.saveMapFields)(entity, _.get(request, "headers"), dto);
1587
+ dto = await (0, schema_1.saveImageAndFileComponent)(entity, dto);
1588
+ dto = await (0, schema_1.saveShareWidget)(entity, dto);
1589
+ dto = await (0, schema_1.saveJsonFields)(entity, dto);
1590
+ dto = await (0, schema_1.saveEncryptFields)(entity, dto);
1591
+ const imageFields = (0, schema_1.listFieldByType)(dto, entity, "image");
1592
+ const fileFields = (0, schema_1.listFieldByType)(dto, entity, "file");
1593
+ const reasons = _.isArray(dto["_reasons"]) ? dto["_reasons"] : [];
1594
+ delete dto["_reasons"];
1595
+ for (const field of imageFields) {
1596
+ _.set(dto, `${field.name}`, undefined);
1597
+ }
1598
+ for (const field of fileFields) {
1599
+ _.set(dto, `${field.name}`, undefined);
1600
+ }
1601
+ dto = await (0, schema_1.cleanUpSaveData)(entity, dto);
1602
+ const dataModel = new Model(dto);
1603
+ const afterSave = (await dataModel.save()).toObject();
1604
+ const saveImageRes = await (0, schema_1.saveImageFields)(imageFields, _.get(request, "headers"), afterSave, name, false);
1605
+ await (0, schema_1.saveFileFields)(fileFields, _.get(request, "headers"), afterSave, name);
1606
+ await (0, schema_1.hashPasswordFields)(entity, afterSave);
1607
+ await (0, schema_1.saveReasons)(entity, `${afterSave._id}`, reasons);
1608
+ const query = { _id: afterSave._id };
1609
+ await Model.findOneAndUpdate(query, Object.assign(Object.assign({}, afterSave), saveImageRes), { new: true });
1610
+ let result = await (0, retry_1.autoRetry)(async () => {
1611
+ return await this.findOne(name, afterSave._id.toString(), undefined, true);
1612
+ }, 2, 1000);
1613
+ result = JSON.parse(JSON.stringify(result));
1614
+ if (!_.get(request, "headers.ignore_auto_workflow")) {
1615
+ result = await (0, schema_1.autoWorkflow)(result, entity, reasons, request);
1616
+ }
1617
+ if (entity.keep_activity_log) {
1618
+ (0, schema_1.addActivityLog)(entity, request, result, activity_log_enum_1.ActivityLogType.activity, activity_log_enum_1.ActivityLogAction.created, activity_log_enum_1.ActivityLogStatus.successfully);
1619
+ }
1620
+ await (0, hook_1.executeHooks)(entity, "create", "after", request, result);
1621
+ if ((0, text_search_1.checkAllowAddSearchText)(name)) {
1622
+ const searchTextData = await (0, text_search_1.getSearchTextIndexObject)(entity, result);
1623
+ const searchEncrypt = (0, text_search_1.getSearchEncryptIndex)(entity, result);
1624
+ if (!_.isEmpty(searchTextData) || !_.isEmpty(searchEncrypt)) {
1625
+ const updateData = searchTextData[0];
1626
+ const supportDeepSearch = _.get(entity, "deep_search_text", true);
1627
+ await Model.updateOne({ _id: updateData.id }, {
1628
+ $set: {
1629
+ _search_text: updateData.textTerm,
1630
+ _search_encrypt: searchEncrypt,
1631
+ _need_refresh: supportDeepSearch
1632
+ }
1633
+ }, { upsert: true });
1634
+ await (0, schema_1.callInternalService)("search_text", "post", "execute", { type: "mark_need_refresh", data: { entity: name, searchTextData: updateData, dataId: result._id } });
1635
+ }
1636
+ }
1637
+ result = (0, schema_1.hashEncryptFields)(entity, result);
1638
+ return result;
1639
+ }
1640
+ async update(name, id, dto) {
1641
+ var _a;
1642
+ const request = this.cls.get("request");
1643
+ (0, permission_1.checkPermission)(name, "edit", this._getCurrentPermissions());
1644
+ const schema = await (0, schema_1.loadSchema)(name);
1645
+ const entity = await (0, schema_1.loadEntity)(name);
1646
+ const Model = mongoose.model(name, schema);
1647
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1648
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1649
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1650
+ if (isExternal) {
1651
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "update", [id, dto], {
1652
+ externalDataSource: {
1653
+ name: entity.name,
1654
+ fields: entity.fields,
1655
+ external_source: entity.external_source
1656
+ }
1657
+ });
1658
+ return res;
1659
+ }
1660
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1661
+ return provider.update(id, dto);
1662
+ }
1663
+ const olddata = await (0, retry_1.autoRetry)(async () => {
1664
+ return await this.findOne(name, id);
1665
+ }, 2, 1000);
1666
+ const uniqueQuery = (0, build_search_1.buildUniqueQuery)(entity, Object.assign({ id }, dto));
1667
+ if (!_.isEmpty(uniqueQuery)) {
1668
+ const uniqueIds = await this.searchIds(name, "", uniqueQuery, 1, 100);
1669
+ if (!_.isEmpty(uniqueIds) && !uniqueIds.includes(id)) {
1670
+ throw new common_1.HttpException("duplicate_unique_key", 500);
1671
+ }
1672
+ }
1673
+ await (0, hook_1.executeHooks)(entity, "update", "before", request, Object.assign(Object.assign(Object.assign({}, olddata), dto), { _old_data: _.cloneDeep(olddata) }));
1674
+ if (!this._isInternal() && _.get(entity, "workflows.field")) {
1675
+ delete dto[`${entity.workflows.field}`];
1676
+ const existsStatus = _.get(entity, "workflows.blocks", []).find(i => i.status === _.get(olddata, `${entity.workflows.field}`));
1677
+ if (existsStatus && !existsStatus.allow_update) {
1678
+ throw new Error("Current status is not allow to update");
1679
+ }
1680
+ }
1681
+ const imageFields = (0, schema_1.listFieldByType)(dto, entity, "image");
1682
+ const fileFields = (0, schema_1.listFieldByType)(dto, entity, "file");
1683
+ if (entity.versioning) {
1684
+ dto.__v = await (0, schema_1.addVersionData)(entity, id, _.get(olddata, "__v", 0));
1685
+ }
1686
+ if (_.get(request, "headers.use_own_single")) {
1687
+ dto = await (0, schema_1.saveRelatedFields)(entity, _.get(request, "headers"), dto, olddata);
1688
+ }
1689
+ else {
1690
+ dto = await (0, schema_1.saveRelatedFieldsV2)(entity, _.get(request, "headers"), dto, olddata);
1691
+ }
1692
+ dto = await (0, schema_1.saveMapFields)(entity, _.get(request, "headers"), dto, olddata);
1693
+ dto = await (0, schema_1.saveImageAndFileComponent)(entity, dto);
1694
+ dto = await (0, schema_1.saveShareWidget)(entity, dto);
1695
+ dto = await (0, schema_1.saveJsonFields)(entity, dto, olddata);
1696
+ dto = await (0, schema_1.saveEncryptFields)(entity, dto, olddata);
1697
+ const reasons = _.isArray(dto["_reasons"]) ? dto["_reasons"] : [];
1698
+ delete dto["_reasons"];
1699
+ for (const field of imageFields) {
1700
+ _.set(dto, `${field.name}`, undefined);
1701
+ }
1702
+ for (const field of fileFields) {
1703
+ _.set(dto, `${field.name}`, undefined);
1704
+ }
1705
+ dto = await (0, schema_1.cleanUpSaveData)(entity, dto);
1706
+ const afterSave = (await Model.findOneAndUpdate({ _id: id }, dto, { new: true })).toObject();
1707
+ const saveImageRes = await (0, schema_1.saveImageFields)(imageFields, _.get(request, "headers"), afterSave, name, false);
1708
+ await (0, schema_1.saveFileFields)(fileFields, _.get(request, "headers"), afterSave, name);
1709
+ await (0, schema_1.hashPasswordFields)(entity, afterSave);
1710
+ await (0, schema_1.saveReasons)(entity, `${afterSave._id}`, reasons);
1711
+ const query = { _id: afterSave._id };
1712
+ await Model.findOneAndUpdate(query, Object.assign(Object.assign({}, afterSave), saveImageRes), { new: true });
1713
+ let result = await (0, retry_1.autoRetry)(async () => {
1714
+ return await this.findOne(name, afterSave._id.toString(), undefined, true);
1715
+ }, 2, 1000);
1716
+ result = JSON.parse(JSON.stringify(result));
1717
+ if (!_.get(request, "headers.ignore_auto_workflow")) {
1718
+ result = await (0, schema_1.autoWorkflow)(result, entity, reasons, request);
1719
+ }
1720
+ if (entity.keep_activity_log) {
1721
+ (0, schema_1.addActivityLog)(entity, request, result, activity_log_enum_1.ActivityLogType.activity, activity_log_enum_1.ActivityLogAction.updated, activity_log_enum_1.ActivityLogStatus.successfully, undefined, undefined, "Update successfully", "", result, olddata);
1722
+ }
1723
+ await (0, hook_1.executeHooks)(entity, "update", "after", request, Object.assign(Object.assign({}, result), { _old_data: _.cloneDeep(olddata) }));
1724
+ if ((0, text_search_1.checkAllowAddSearchText)(name)) {
1725
+ const searchTextData = await (0, text_search_1.getSearchTextIndexObject)(entity, result);
1726
+ const searchEncrypt = (0, text_search_1.getSearchEncryptIndex)(entity, result);
1727
+ if (!_.isEmpty(searchTextData) || !_.isEmpty(searchEncrypt)) {
1728
+ const updateData = searchTextData[0];
1729
+ const supportDeepSearch = _.get(entity, "deep_search_text", true);
1730
+ await Model.updateOne({ _id: updateData.id }, {
1731
+ $set: {
1732
+ _search_text: updateData.textTerm,
1733
+ _search_encrypt: searchEncrypt,
1734
+ _need_refresh: supportDeepSearch
1735
+ }
1736
+ }, { upsert: true });
1737
+ await (0, schema_1.callInternalService)("search_text", "post", "execute", { type: "mark_need_refresh", data: { entity: name, searchTextData: updateData, dataId: result._id } });
1738
+ }
1739
+ }
1740
+ result = (0, schema_1.hashEncryptFields)(entity, result);
1741
+ return result;
1742
+ }
1743
+ async delete(name, id) {
1744
+ var _a;
1745
+ if (!mongoose.Types.ObjectId.isValid(id)) {
1746
+ throw new Error('Invalid ID format');
1747
+ }
1748
+ const safeNamePattern = /^[\p{L}\p{N}_\-\s]+$/u;
1749
+ if (!safeNamePattern.test(name)) {
1750
+ throw new Error("Invalid entity name");
1751
+ }
1752
+ const request = this.cls.get("request");
1753
+ (0, permission_1.checkPermission)(name, "create", this._getCurrentPermissions());
1754
+ const schema = await (0, schema_1.loadSchema)(name);
1755
+ const entity = await (0, schema_1.loadEntity)(name);
1756
+ const Model = mongoose.model(name, schema);
1757
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1758
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1759
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1760
+ if (isExternal) {
1761
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "delete", [id], {
1762
+ externalDataSource: {
1763
+ name: entity.name,
1764
+ fields: entity.fields,
1765
+ external_source: entity.external_source
1766
+ }
1767
+ });
1768
+ return res;
1769
+ }
1770
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1771
+ return provider.delete(id);
1772
+ }
1773
+ let olddata = await (0, retry_1.autoRetry)(async () => {
1774
+ return await this.findOne(name, id);
1775
+ }, 2, 1000);
1776
+ olddata = JSON.parse(JSON.stringify(olddata));
1777
+ const hookData = Object.assign(Object.assign({}, olddata), { _old_data: _.cloneDeep(olddata) });
1778
+ await (0, hook_1.executeHooks)(entity, "delete", "before", request, hookData);
1779
+ const result = await Model.deleteOne({ _id: id });
1780
+ if (entity.keep_activity_log) {
1781
+ (0, schema_1.addActivityLog)(entity, request, result, activity_log_enum_1.ActivityLogType.activity, activity_log_enum_1.ActivityLogAction.deleted, activity_log_enum_1.ActivityLogStatus.successfully);
1782
+ }
1783
+ (0, schema_1.callMarkDeletedInternal)(name, [id]);
1784
+ await (0, hook_1.executeHooks)(entity, "delete", "after", request, hookData);
1785
+ return result;
1786
+ }
1787
+ async deleteMany(name, filter) {
1788
+ var _a;
1789
+ (0, permission_1.checkPermission)(name, "create", this._getCurrentPermissions());
1790
+ const entity = await (0, schema_1.loadEntity)(name);
1791
+ if (_.isEmtpy(filter)) {
1792
+ throw new Error("Delete many filter is required.");
1793
+ }
1794
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1795
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1796
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1797
+ if (isExternal) {
1798
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "deleteMany", [filter], {
1799
+ externalDataSource: {
1800
+ name: entity.name,
1801
+ fields: entity.fields,
1802
+ external_source: entity.external_source
1803
+ }
1804
+ });
1805
+ return res;
1806
+ }
1807
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1808
+ return provider.deleteMany(filter);
1809
+ }
1810
+ const schema = await (0, schema_1.loadSchema)(name);
1811
+ const Model = mongoose.model(name, schema);
1812
+ await Model.deleteMany(filter);
1813
+ return true;
1814
+ }
1815
+ async bulkCreate(name, data) {
1816
+ var _a;
1817
+ const request = this.cls.get("request");
1818
+ (0, permission_1.checkPermission)(name, "create", this._getCurrentPermissions());
1819
+ const schema = await (0, schema_1.loadSchema)(name);
1820
+ const entity = await (0, schema_1.loadEntity)(name);
1821
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1822
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1823
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1824
+ if (isExternal) {
1825
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "bulkCreate", [data], {
1826
+ externalDataSource: {
1827
+ name: entity.name,
1828
+ fields: entity.fields,
1829
+ external_source: entity.external_source
1830
+ }
1831
+ });
1832
+ return res;
1833
+ }
1834
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1835
+ return provider.bulkCreate(data);
1836
+ }
1837
+ const bulkData = [];
1838
+ for (const d of data) {
1839
+ bulkData.push({
1840
+ insertOne: { document: Object.assign(Object.assign({}, d), { createdAt: new Date() }) }
1841
+ });
1842
+ }
1843
+ const Model = mongoose.model(name, schema);
1844
+ const result = await Model.bulkWrite(bulkData);
1845
+ const ids = Object.values(result.insertedIds).map(i => `${i}`);
1846
+ if (entity.keep_activity_log) {
1847
+ (0, schema_1.addActivityLog)(entity, request, result, activity_log_enum_1.ActivityLogType.activity, activity_log_enum_1.ActivityLogAction.created, activity_log_enum_1.ActivityLogStatus.successfully);
1848
+ }
1849
+ if ((0, text_search_1.checkAllowAddSearchText)(name)) {
1850
+ await this._bulkUpdateSearchText(name, ids);
1851
+ }
1852
+ return ids;
1853
+ }
1854
+ async bulkUpdate(name, data) {
1855
+ var _a;
1856
+ const request = this.cls.get("request");
1857
+ (0, permission_1.checkPermission)(name, "edit", this._getCurrentPermissions());
1858
+ const schema = await (0, schema_1.loadSchema)(name);
1859
+ const entity = await (0, schema_1.loadEntity)(name);
1860
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1861
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1862
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1863
+ if (isExternal) {
1864
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "bulkUpdate", [data], {
1865
+ externalDataSource: {
1866
+ name: entity.name,
1867
+ fields: entity.fields,
1868
+ external_source: entity.external_source
1869
+ }
1870
+ });
1871
+ return res;
1872
+ }
1873
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1874
+ return provider.bulkUpdate(data);
1875
+ }
1876
+ const bulkData = [];
1877
+ for (const d of data) {
1878
+ const updateData = _.cloneDeep(d);
1879
+ delete updateData._id;
1880
+ delete updateData.id;
1881
+ bulkData.push({
1882
+ updateOne: {
1883
+ filter: { _id: d.id || d._id },
1884
+ update: Object.assign(Object.assign({}, updateData), { updatedAt: new Date() })
1885
+ }
1886
+ });
1887
+ }
1888
+ const Model = mongoose.model(name, schema);
1889
+ const result = await Model.bulkWrite(bulkData);
1890
+ if (entity.keep_activity_log) {
1891
+ (0, schema_1.addActivityLog)(entity, request, result, activity_log_enum_1.ActivityLogType.activity, activity_log_enum_1.ActivityLogAction.updated, activity_log_enum_1.ActivityLogStatus.successfully);
1892
+ }
1893
+ const ids = data.map(i => i.id || i._id);
1894
+ if ((0, text_search_1.checkAllowAddSearchText)(name)) {
1895
+ await this._bulkUpdateSearchText(name, ids);
1896
+ }
1897
+ return ids;
1898
+ }
1899
+ async bulkDelete(name, ids) {
1900
+ var _a;
1901
+ const request = this.cls.get("request");
1902
+ (0, permission_1.checkPermission)(name, "create", this._getCurrentPermissions());
1903
+ const schema = await (0, schema_1.loadSchema)(name);
1904
+ const entity = await (0, schema_1.loadEntity)(name);
1905
+ const externalSourceProvider = (_a = entity === null || entity === void 0 ? void 0 : entity.external_source) === null || _a === void 0 ? void 0 : _a.type;
1906
+ if (externalSourceProvider && externalSourceProvider !== "none") {
1907
+ const isExternal = (0, external_module_1.isExternalModule)(entity.name);
1908
+ if (isExternal) {
1909
+ const res = await (0, external_module_1.callExecuteExternalProviderModule)(entity.name, externalSourceProvider, "bulkDelete", [ids], {
1910
+ externalDataSource: {
1911
+ name: entity.name,
1912
+ fields: entity.fields,
1913
+ external_source: entity.external_source
1914
+ }
1915
+ });
1916
+ return res;
1917
+ }
1918
+ const provider = await (0, external_data_1.getExternalDataProvider)(entity, externalSourceProvider);
1919
+ return provider.bulkDelete(ids);
1920
+ }
1921
+ const bulkData = [];
1922
+ for (const id of ids) {
1923
+ bulkData.push({ deleteOne: { filter: { _id: id } } });
1924
+ }
1925
+ const Model = mongoose.model(name, schema);
1926
+ const result = await Model.bulkWrite(bulkData);
1927
+ if (entity.keep_activity_log) {
1928
+ (0, schema_1.addActivityLog)(entity, request, result, activity_log_enum_1.ActivityLogType.activity, activity_log_enum_1.ActivityLogAction.deleted, activity_log_enum_1.ActivityLogStatus.successfully);
1929
+ }
1930
+ (0, schema_1.callMarkDeletedInternal)(name, ids);
1931
+ return ids;
1932
+ }
1933
+ async prepareGenerateData(name, data) {
1934
+ if (_.isEmpty(data)) {
1935
+ throw new Error("Please filters data before generate");
1936
+ }
1937
+ const refId = `GENERATE_DATA_${(0, uuid_1.v4)()}`;
1938
+ await this._setGenerateDataRedis(refId, 0);
1939
+ await (0, schema_1.callAddQueueInternal)("queue", "generate_data", Object.assign(Object.assign({}, data), { ref_id: refId, entity: name }));
1940
+ return {
1941
+ ref_id: refId,
1942
+ finish: false,
1943
+ percent: 0,
1944
+ status: "processing"
1945
+ };
1946
+ }
1947
+ async generateData(name, data) {
1948
+ common_1.Logger.log(`Generate report for ${name} entity`, "generateData");
1949
+ return false;
1950
+ }
1951
+ async progressGenerateData(ref_id) {
1952
+ const data = await redis_1.redisCache.get(ref_id);
1953
+ if (!data) {
1954
+ throw new Error("Invalid reference id");
1955
+ }
1956
+ return data;
1957
+ }
1958
+ async approve(name, id, data) {
1959
+ if (!mongoose.Types.ObjectId.isValid(id)) {
1960
+ throw new Error('Invalid ID format');
1961
+ }
1962
+ let sanitizedId;
1963
+ try {
1964
+ sanitizedId = new mongoose.Types.ObjectId(id);
1965
+ }
1966
+ catch (error) {
1967
+ throw new Error('Invalid ID format');
1968
+ }
1969
+ const safeNamePattern = /^[\p{L}\p{N}_\-\s]+$/u;
1970
+ if (!safeNamePattern.test(name)) {
1971
+ throw new Error("Invalid entity name");
1972
+ }
1973
+ const sanitizedName = String(name);
1974
+ const request = this.cls.get("request");
1975
+ (0, permission_1.checkPermission)(sanitizedName, "edit", this._getCurrentPermissions());
1976
+ const schema = await (0, schema_1.loadSchema)(sanitizedName);
1977
+ const entity = await (0, schema_1.loadEntity)(sanitizedName);
1978
+ if (!_.get(entity, "workflows.field")) {
1979
+ throw new Error(`This entity didn't support workflow`);
1980
+ }
1981
+ const olddata = JSON.parse(JSON.stringify(await this.findOne(sanitizedName, sanitizedId.toString())));
1982
+ const currentState = _.get(olddata, `${entity.workflows.field}`);
1983
+ const targetState = data["state"];
1984
+ const isExists = entity.workflows.flows.find(i => i.from === currentState && i.to === targetState);
1985
+ if (!isExists) {
1986
+ throw new Error("This flow is not available for this entity");
1987
+ }
1988
+ const entityUser = await (0, schema_1.loadEntity)("user");
1989
+ const profile = _.get(request, "profile", {});
1990
+ const checkWorkflow = await (0, permission_1.checkWorkflowCondition)(entity, isExists, olddata, profile, entityUser);
1991
+ if (!checkWorkflow) {
1992
+ throw new Error("Action permission denied");
1993
+ }
1994
+ if (isExists.date_tracking_field) {
1995
+ olddata[isExists.date_tracking_field] = new Date();
1996
+ }
1997
+ if (isExists.email_template &&
1998
+ _.get(isExists, "email_receiver.length") > 0) {
1999
+ await (0, schema_1.callInternalService)("template", "patch", `send`, {
2000
+ code: isExists.email_template,
2001
+ data: Object.assign({ to: isExists.email_receiver }, olddata)
2002
+ });
2003
+ }
2004
+ olddata[`${entity.workflows.field}`] = [data.state];
2005
+ const reasons = [];
2006
+ if (data["reason"]) {
2007
+ reasons.push({
2008
+ id: data["reason"]["id"],
2009
+ value: data["reason"]["value"],
2010
+ comment: data["reason"]["comment"]
2011
+ });
2012
+ }
2013
+ if (data["is_auto"] &&
2014
+ isExists.required_reason &&
2015
+ isExists.reason_ref &&
2016
+ !_.isEmpty(isExists.default_reason)) {
2017
+ const reason = await (0, schema_1.callGetInternalService)("reason_master", `${isExists.reason_ref}`);
2018
+ reasons.push({
2019
+ id: isExists.reason_ref,
2020
+ value: isExists.default_reason
2021
+ .map(i => {
2022
+ const exist = reason["options"].find(j => j._id === i);
2023
+ return exist ? { name: exist.name, code: exist.code } : null;
2024
+ })
2025
+ .filter(i => i),
2026
+ comment: isExists.default_reason_comment
2027
+ });
2028
+ }
2029
+ const Model = mongoose.model(name, schema);
2030
+ let result = await Model.findOneAndUpdate({ _id: id }, (0, entity_1.removeRelatedFields)(olddata, entity), {
2031
+ new: true
2032
+ });
2033
+ result = await (0, retry_1.autoRetry)(async () => {
2034
+ return await this.findOne(name, result._id.toString());
2035
+ }, 2, 1000);
2036
+ result = JSON.parse(JSON.stringify(result));
2037
+ const workflowMessage = (0, schema_1.getWorkflowLogMessage)(entity, request, currentState, targetState);
2038
+ if (entity.keep_activity_log) {
2039
+ await (0, schema_1.addActivityLog)(entity, request, result, activity_log_enum_1.ActivityLogType.workflow, activity_log_enum_1.ActivityLogAction.approved, activity_log_enum_1.ActivityLogStatus.successfully, new Date(), new Date(), _.get(workflowMessage, "message", ""), _.get(workflowMessage, "description", ""));
2040
+ }
2041
+ reasons.length > 0 && (await (0, schema_1.saveReasons)(entity, id, reasons));
2042
+ if (_.get(isExists, "executions.length")) {
2043
+ for (const ex of isExists["executions"].filter(i => i.enabled)) {
2044
+ try {
2045
+ await (0, executions_1.internalExecution)(ex, result, entity);
2046
+ }
2047
+ catch (e) {
2048
+ common_1.Logger.error(e);
2049
+ }
2050
+ }
2051
+ }
2052
+ let autoFlow;
2053
+ const flows = _.get(entity, "workflows.flows", []);
2054
+ for (const i of flows) {
2055
+ if (i.is_auto && i.from === _.get(data, `${entity.workflows.field}`)) {
2056
+ const checkWork = await (0, permission_1.checkWorkflowCondition)(entity, i, data, { _system: true }, entityUser);
2057
+ if (checkWork) {
2058
+ autoFlow = checkWork;
2059
+ break;
2060
+ }
2061
+ }
2062
+ }
2063
+ await (0, hook_1.executeHooks)(entity, "workflow", "after", {
2064
+ headers: this._getCurrentHeaders(),
2065
+ body: this._getCurrentBody(),
2066
+ profile: this._getCurrentProfile()
2067
+ }, result);
2068
+ return autoFlow
2069
+ ? await this.approve(name, id, {
2070
+ state: autoFlow === null || autoFlow === void 0 ? void 0 : autoFlow.to,
2071
+ is_auto: true
2072
+ })
2073
+ : result;
2074
+ }
2075
+ async workflowActions(name, id) {
2076
+ const request = this.cls.get("request");
2077
+ (0, permission_1.checkPermission)(name, "edit", this._getCurrentPermissions());
2078
+ const entity = await (0, schema_1.loadEntity)(name);
2079
+ if (!_.get(entity, "workflows.field")) {
2080
+ return [];
2081
+ }
2082
+ const schema = await (0, schema_1.loadSchema)(name);
2083
+ const data = await this.findOne(name, id);
2084
+ const currentStatus = _.get(data, entity.workflows.field);
2085
+ const schemaUser = await (0, schema_1.loadSchema)("user");
2086
+ let actions;
2087
+ const flows = _.get(entity, "workflows.flows", []);
2088
+ for (const i of flows) {
2089
+ if (!i.is_auto && i.from === currentStatus && i.to !== "end_node") {
2090
+ const checkWork = await (0, permission_1.checkWorkflowCondition)(schema, i, data, _.get(request, "profile", {}), schemaUser);
2091
+ if (checkWork) {
2092
+ actions = checkWork;
2093
+ break;
2094
+ }
2095
+ }
2096
+ }
2097
+ return actions || {};
2098
+ }
2099
+ async executeWorkflowAction(name, id, body) {
2100
+ return true;
2101
+ }
2102
+ async dataWithLocale(name, layout, id, locale) {
2103
+ const data = await this.findOneWithLayout(name, layout, id, true);
2104
+ const languages = await (0, schema_1.getSetting)("data_languages");
2105
+ const isDefault = _.get(languages.find(i => i.code === locale), "default_data_translate");
2106
+ if (isDefault) {
2107
+ delete data["_translates"];
2108
+ return data;
2109
+ }
2110
+ const entity = await (0, schema_1.loadEntity)(name);
2111
+ const translateFields = entity.fields.filter(i => i.allow_translate);
2112
+ const result = {};
2113
+ for (const field of translateFields) {
2114
+ result[field.name] =
2115
+ _.get(data, `_translates.${locale}.${field.name}`) ||
2116
+ _.get(data, field.name);
2117
+ }
2118
+ return result;
2119
+ }
2120
+ async findWithLocale(name, locale, keywords, filters, sort) {
2121
+ const data = await this.find(name, keywords, filters, sort, true);
2122
+ const languages = await (0, schema_1.getSetting)("data_languages");
2123
+ const isDefault = _.get(languages.find(i => i.code === locale), "default_data_translate");
2124
+ if (isDefault) {
2125
+ delete data["_translates"];
2126
+ return data;
2127
+ }
2128
+ const entity = await (0, schema_1.loadEntity)(name);
2129
+ const translateFields = entity.fields.filter(i => i.allow_translate);
2130
+ const result = {};
2131
+ for (const field of translateFields) {
2132
+ result[field.name] =
2133
+ _.get(data, `_translates.${locale}.${field.name}`) ||
2134
+ _.get(data, field.name);
2135
+ }
2136
+ return result;
2137
+ }
2138
+ async setDataLocale(name, id, locale, data) {
2139
+ const safeNamePattern = /^[\p{L}\p{N}_\-\s]+$/u;
2140
+ if (!safeNamePattern.test(name)) {
2141
+ throw new Error("Invalid entity name");
2142
+ }
2143
+ if (!mongoose.Types.ObjectId.isValid(id)) {
2144
+ throw new Error("Invalid ID format");
2145
+ }
2146
+ let sanitizedId;
2147
+ const sanitizedName = String(name);
2148
+ try {
2149
+ sanitizedId = new mongoose.Types.ObjectId(id);
2150
+ }
2151
+ catch (error) {
2152
+ throw new Error("Invalid ID format");
2153
+ }
2154
+ (0, permission_1.checkPermission)(sanitizedName, "edit", this._getCurrentPermissions());
2155
+ const schema = await (0, schema_1.loadSchema)(sanitizedName);
2156
+ const Model = mongoose.model(sanitizedName, schema);
2157
+ const record = await Model.findById(sanitizedId);
2158
+ if (_.isEmpty(record)) {
2159
+ throw new common_1.NotFoundException('Record not found');
2160
+ }
2161
+ const translates = _.get(record, "_translates") || {};
2162
+ _.set(translates, locale, data);
2163
+ const result = await Model.findByIdAndUpdate(id, {
2164
+ _translates: translates
2165
+ });
2166
+ return result;
2167
+ }
2168
+ async exampleOutputMapping(name, data) {
2169
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions());
2170
+ const result = await (0, example_1.generateExample)(data);
2171
+ return result;
2172
+ }
2173
+ async searchText(name, data) {
2174
+ (0, permission_1.checkPermission)(name, "view", this._getCurrentPermissions());
2175
+ const { mapping, filters, keywords } = data;
2176
+ const entityName = _.get(mapping, "destination.entity_name");
2177
+ const resultData = await (0, schema_1.callFindInternalService)(entityName, keywords, filters, "", "");
2178
+ const entity = await (0, schema_1.loadEntity)(entityName);
2179
+ const revert = !_.isEmpty(_.get(mapping, "source.entity_name"));
2180
+ const result = await (0, transform_1.transform)(entity, resultData, mapping.mapping, "main", undefined, revert, true, "transform");
2181
+ for (const field in result) {
2182
+ if (_.isUndefined(result[field]) ||
2183
+ result[field] === "undefined" ||
2184
+ (_.isObject(result[field]) && _.isEmpty(result[field]))) {
2185
+ result[field] = null;
2186
+ }
2187
+ }
2188
+ return result;
2189
+ }
2190
+ async listViewCodes(name) {
2191
+ const entity = await (0, schema_1.loadEntity)(name);
2192
+ return entity.layouts.map(l => l.code);
2193
+ }
2194
+ async importValidate(entityName, id, code, data, dataText, originalData, filename) {
2195
+ return data;
2196
+ }
2197
+ async syncEntityTerm(name) {
2198
+ const entity = await (0, schema_1.loadEntity)(name);
2199
+ if (_.isEmpty(entity))
2200
+ throw new Error("Invalid Entity");
2201
+ await (0, text_search_1.lockSyncTermText)(name);
2202
+ await (0, schema_1.callAddQueueInternal)("queue", "search_text", {
2203
+ type: "sync_search_text",
2204
+ entity: name
2205
+ });
2206
+ return true;
2207
+ }
2208
+ async _bulkUpdateSearchText(name, ids) {
2209
+ if (_.isEmpty(ids))
2210
+ return;
2211
+ try {
2212
+ const entity = await (0, schema_1.loadEntity)(name);
2213
+ if (!entity)
2214
+ return;
2215
+ const Model = mongoose.model(name);
2216
+ const supportDeepSearch = _.get(entity, "deep_search_text", true);
2217
+ if (!entity)
2218
+ return;
2219
+ let hasMore = true;
2220
+ let page = 1;
2221
+ const pageSize = 200;
2222
+ const fields = supportDeepSearch
2223
+ ? `*,${entity.fields
2224
+ .filter(field => field.type === "related")
2225
+ .map(field => `${field.name}.*`)
2226
+ .join(",")}`
2227
+ : "*";
2228
+ while (hasMore) {
2229
+ const listResult = await (0, schema_1.callListInternalService)(name, "", {
2230
+ _id: {
2231
+ $in: ids
2232
+ }
2233
+ }, "", fields, page, pageSize);
2234
+ const rows = _.get(listResult, "rows", []);
2235
+ if (rows.length === 0) {
2236
+ hasMore = false;
2237
+ break;
2238
+ }
2239
+ const searchTextData = await (0, text_search_1.getSearchTextIndexObject)(entity, rows);
2240
+ const bulkUpdate = searchTextData.map(record => ({
2241
+ updateOne: {
2242
+ filter: {
2243
+ _id: record.id
2244
+ },
2245
+ update: {
2246
+ $set: {
2247
+ _search_text: record.textTerm,
2248
+ _need_refresh: supportDeepSearch
2249
+ }
2250
+ },
2251
+ upsert: false
2252
+ }
2253
+ }));
2254
+ await (0, schema_1.callInternalService)("search_text", "post", "execute", { type: "mark_need_refresh", data: { entity: name, searchTextData: searchTextData, dataId: ids } });
2255
+ await Model.bulkWrite(bulkUpdate);
2256
+ page++;
2257
+ if (rows.length < pageSize) {
2258
+ hasMore = false;
2259
+ }
2260
+ }
2261
+ }
2262
+ catch (error) { }
2263
+ }
2264
+ };
2265
+ exports.EntitiesService = EntitiesService;
2266
+ exports.EntitiesService = EntitiesService = EntitiesService_1 = __decorate([
2267
+ (0, common_1.Injectable)(),
2268
+ __param(1, (0, mongoose_1.InjectModel)("entity")),
2269
+ __metadata("design:paramtypes", [nestjs_cls_1.ClsService, mongoose.Model])
2270
+ ], EntitiesService);
2271
+ //# sourceMappingURL=entities.service.js.map