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,2629 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveReasons = exports.listRelateSchema = exports.buildPopulateWithLayout = exports.buildPopulate = exports.buildSelect = exports.getEntityDefaultValues = exports.removeEntity = exports.refreshEntity = exports.loadSchema = exports.existsEntity = exports.loadEntity = exports.callMarkDeletedInternal = exports.uploadAttachmentInternal = exports.setSetting = exports.getSetting = exports.createReasonData = exports.addVersionData = exports.saveEncryptFields = exports.hashEncryptFields = exports.hashPasswordFields = exports.transformJsonFields = exports.saveJsonFields = exports.transformShareWidget = exports.saveShareWidget = exports.saveFileFields = exports.saveImageFields = exports.mapEntity = exports.saveMapFields = exports.addActivityLog = exports.saveRelatedFieldsV2 = exports.saveRelatedFields = exports.listFieldByType = exports.callUploadInternal = exports.callInternalModuleSetting = exports.callAddQueueInternal = exports.callUpdateSchemaInternal = exports.callBulkCreateInternalService = exports.callBulkUpdateInternalService = exports.callBulkDeleteInternalService = exports.callApproveInternalService = exports.callDeleteInternalService = exports.callSaveInternalService = exports.callUpdateInternalService = exports.callCreateInternalService = exports.callCountInternalService = exports.callFindInternalService = exports.callListInternalService = exports.callGetInternalService = exports.callInternalService = exports.SALTRANDOMKEY = void 0;
4
+ exports.buildAggregateCount = exports.buildAggregate = exports.hasRelationFilter = exports.prepareHeader = exports.callUploadImageInternal = exports.saveImageAndFileComponent = exports.setModuleSetting = exports.getModuleSetting = exports.getWorkflowLogMessage = exports.cleanUpSaveData = exports.callListIdsInternalService = exports.autoWorkflow = void 0;
5
+ const _ = require("lodash");
6
+ const qs = require("qs");
7
+ const mongoose = require("mongoose");
8
+ const axios_1 = require("axios");
9
+ const dotenv = require("dotenv");
10
+ const bson_1 = require("bson");
11
+ const crypto = require("crypto");
12
+ const flat_1 = require("flat");
13
+ const common_1 = require("@nestjs/common");
14
+ const constants_1 = require("../constants");
15
+ const layout_1 = require("./layout");
16
+ const permission_1 = require("./permission");
17
+ const activity_log_enum_1 = require("../../activity_log/activity_log.enum");
18
+ const attachment_1 = require("./attachment");
19
+ const executions_1 = require("./executions");
20
+ const sleep_1 = require("./sleep");
21
+ const redis_1 = require("./redis");
22
+ const hook_1 = require("./hook");
23
+ const build_search_1 = require("./build_search");
24
+ const entity_1 = require("./entity");
25
+ const request_1 = require("./request");
26
+ const masking_1 = require("./masking");
27
+ const IGNORE_COMPARE_FIELDS = ["id", "_id", "__v", "createdAt", "updatedAt"];
28
+ let _http;
29
+ const CACHE_DEFAULT_FIELDS = [];
30
+ const CACHE_POPULATE_FIELDS = [];
31
+ exports.SALTRANDOMKEY = "#GISMGISDDFF#";
32
+ const MAX_LOAD_ENTITY_ITERATION = 2;
33
+ const REGEX_KEEP_POPULATE_FORMAT = /^_keepPopulate\(([^)]+)\)$/;
34
+ dotenv.config();
35
+ const http = axios_1.default.create();
36
+ mongoose.connect(process.env.MONGODB_URI);
37
+ if (process.env.MONGODB_URI.includes(".mongodb.net")) {
38
+ constants_1.CONST.ATLAS_MODE = true;
39
+ }
40
+ const prepareHeader = (headers) => {
41
+ if (!headers)
42
+ return headers;
43
+ delete headers["content-length"];
44
+ return headers;
45
+ };
46
+ exports.prepareHeader = prepareHeader;
47
+ const _loadEntity = async (name, first = false, iteration = 0) => {
48
+ if (_.isEmpty(name)) {
49
+ throw new Error("Entity name cannot empty.");
50
+ }
51
+ if (name === "entities") {
52
+ name = "entity";
53
+ }
54
+ const cache = constants_1.CONST.SCHEMAS_STACK[name];
55
+ if (cache) {
56
+ return cache.entity;
57
+ }
58
+ if (constants_1.CONST.IGNORE_ENTITY.includes(name)) {
59
+ common_1.Logger.log(`Ignore thiis ${name} entity`);
60
+ return { system: true };
61
+ }
62
+ if (![...Object.keys(constants_1.CONST.SCHEMAS_STACK), "user_filter"].includes(name)) {
63
+ return undefined;
64
+ }
65
+ if (first) {
66
+ throw new Error(`Entity ${name} doesn't exists`);
67
+ }
68
+ const headers = {};
69
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(name, headers);
70
+ try {
71
+ await http.get(`${baseDomain}/${name === "entity" ? "entities" : name}/init`, { headers });
72
+ }
73
+ catch (e) {
74
+ if (name === "entity") {
75
+ await http.get(`${baseDomain}/entities/init`, { headers });
76
+ }
77
+ }
78
+ if (iteration > MAX_LOAD_ENTITY_ITERATION) {
79
+ return undefined;
80
+ }
81
+ await (0, sleep_1.sleep)(1000);
82
+ return _loadEntity(name, first, iteration + 1);
83
+ };
84
+ exports.loadEntity = _loadEntity;
85
+ const _existsEntity = (name) => {
86
+ if (_.isEmpty(name)) {
87
+ throw new Error("Entity name cannot empty.");
88
+ }
89
+ if (name === "entities") {
90
+ return true;
91
+ }
92
+ return !_.isEmpty(constants_1.CONST.SCHEMAS_STACK[name]);
93
+ };
94
+ exports.existsEntity = _existsEntity;
95
+ const _loadSchema = async (name, first = false) => {
96
+ if (_.isEmpty(name)) {
97
+ throw new Error("Entity name cannot empty.");
98
+ }
99
+ if (name === "entities") {
100
+ name = "entity";
101
+ }
102
+ const cache = constants_1.CONST.SCHEMAS_STACK[name];
103
+ if (cache) {
104
+ return cache.schema;
105
+ }
106
+ if (first) {
107
+ throw new Error(`Schema ${name} doesn't exists`);
108
+ }
109
+ const headers = {};
110
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(name, headers);
111
+ try {
112
+ await http.get(`${baseDomain}/${name === "entity" ? "entities" : name}/init`, { headers });
113
+ }
114
+ catch (e) {
115
+ await http.get(`${baseDomain}/entities/init`, { headers });
116
+ }
117
+ await (0, sleep_1.sleep)(1000);
118
+ return _loadSchema(name);
119
+ };
120
+ exports.loadSchema = _loadSchema;
121
+ const _refreshEntity = async (name, data) => {
122
+ if (name === "entities") {
123
+ name = "entity";
124
+ }
125
+ data.entity._id = data.entity.id;
126
+ constants_1.CONST.SCHEMAS_STACK[name] = data;
127
+ mongoose.model(name, data.schema);
128
+ const doc = {
129
+ event: constants_1.ENTITY_REFRESH,
130
+ _system: constants_1.CONST.SYSTEM_NAME,
131
+ _unique: constants_1.CONST.UNIQUE,
132
+ data: { name, data }
133
+ };
134
+ const buff = (0, bson_1.serialize)(doc);
135
+ const message = buff.toString("base64");
136
+ redis_1.redisPublisher.publish(constants_1.EVENT_TRIGGER, message);
137
+ return true;
138
+ };
139
+ exports.refreshEntity = _refreshEntity;
140
+ const _removeEntity = async (name) => {
141
+ delete constants_1.CONST.SCHEMAS_STACK[name];
142
+ const doc = {
143
+ event: constants_1.ENTITY_DELETE,
144
+ _system: constants_1.CONST.SYSTEM_NAME,
145
+ _unique: constants_1.CONST.UNIQUE,
146
+ data: { name }
147
+ };
148
+ const buff = (0, bson_1.serialize)(doc);
149
+ const message = buff.toString("base64");
150
+ redis_1.redisPublisher.publish(constants_1.EVENT_TRIGGER, message);
151
+ return true;
152
+ };
153
+ exports.removeEntity = _removeEntity;
154
+ const getEntityDefaultValues = (entity) => {
155
+ const result = {};
156
+ for (const field of entity.fields) {
157
+ if (field.default) {
158
+ result[field.name] = field.default;
159
+ }
160
+ }
161
+ return result;
162
+ };
163
+ exports.getEntityDefaultValues = getEntityDefaultValues;
164
+ const callListInternalService = async (modelName, keywoards = "", filters = {}, sort = "", fields = "", page = 1, page_size = 10000, headers = {}) => {
165
+ try {
166
+ const entity = await _loadEntity(modelName);
167
+ if (!_http) {
168
+ _http = axios_1.default.create({
169
+ maxContentLength: Infinity,
170
+ maxBodyLength: Infinity
171
+ });
172
+ }
173
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
174
+ const res = await _http.get(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}?keywords=${keywoards}&filters=${encodeURIComponent(_.isString(filters)
175
+ ? filters
176
+ : qs.stringify(filters, { strictNullHandling: true }))}&page=${page}&page_size=${page_size}&sort=${sort}&fields=${fields}`, { headers });
177
+ return res.data;
178
+ }
179
+ catch (e) {
180
+ console.log(e);
181
+ throw new Error(_.get(e, "response.data.message") || _.get(e, "message"));
182
+ }
183
+ };
184
+ exports.callListInternalService = callListInternalService;
185
+ const callListIdsInternalService = async (modelName, keywoards = "", filters = {}, page = 1, page_size = 10000, sort = "", headers = {}) => {
186
+ try {
187
+ const entity = await _loadEntity(modelName);
188
+ if (!_http) {
189
+ _http = axios_1.default.create({
190
+ maxContentLength: Infinity,
191
+ maxBodyLength: Infinity
192
+ });
193
+ }
194
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
195
+ const res = await _http.get(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/ids?keywords=${keywoards}&filters=${encodeURIComponent(_.isString(filters)
196
+ ? filters
197
+ : qs.stringify(filters, { strictNullHandling: true }))}&page=${page}&page_size=${page_size}&sort=${sort}`, { headers });
198
+ return res.data;
199
+ }
200
+ catch (e) {
201
+ console.log(e);
202
+ throw new Error(_.get(e, "response.data.message") || _.get(e, "message"));
203
+ }
204
+ };
205
+ exports.callListIdsInternalService = callListIdsInternalService;
206
+ const callFindInternalService = async (modelName, keywoards = "", filters = {}, sort = "", fields = "", headers = {}) => {
207
+ try {
208
+ const entity = await _loadEntity(modelName);
209
+ if (!_http) {
210
+ _http = axios_1.default.create({
211
+ maxContentLength: Infinity,
212
+ maxBodyLength: Infinity
213
+ });
214
+ }
215
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
216
+ const res = await _http.get(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/find?keywords=${keywoards}&filters=${encodeURIComponent(_.isString(filters)
217
+ ? filters
218
+ : qs.stringify(filters, { strictNullHandling: true }))}&sort=${sort}&fields=${fields}`, { headers });
219
+ return res.data;
220
+ }
221
+ catch (e) {
222
+ console.log(e);
223
+ throw new Error(_.get(e, "response.data.message") || _.get(e, "message"));
224
+ }
225
+ };
226
+ exports.callFindInternalService = callFindInternalService;
227
+ const callGetInternalService = async (modelName, id, query, headers = {}) => {
228
+ try {
229
+ const entity = await _loadEntity(modelName);
230
+ if (!_http) {
231
+ _http = axios_1.default.create({
232
+ maxContentLength: Infinity,
233
+ maxBodyLength: Infinity
234
+ });
235
+ }
236
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
237
+ const res = await _http.get(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/${id}${query || ""}`, { headers });
238
+ return res.data;
239
+ }
240
+ catch (e) {
241
+ console.log(e);
242
+ throw new Error(_.get(e, "response.data.message") || _.get(e, "message"));
243
+ }
244
+ };
245
+ exports.callGetInternalService = callGetInternalService;
246
+ const callCreateInternalService = async (modelName, data, reqHeaders, ignoreActivityLog) => {
247
+ try {
248
+ const entity = await _loadEntity(modelName);
249
+ if (!_http) {
250
+ _http = axios_1.default.create({
251
+ maxContentLength: Infinity,
252
+ maxBodyLength: Infinity
253
+ });
254
+ }
255
+ const headers = _.cloneDeep(reqHeaders || {});
256
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
257
+ headers["ignore_activity_log"] = _.isUndefined(ignoreActivityLog)
258
+ ? false
259
+ : ignoreActivityLog;
260
+ delete headers["content-length"];
261
+ const res = await _http.post(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}`, data, {
262
+ headers,
263
+ maxBodyLength: Infinity,
264
+ maxContentLength: Infinity
265
+ });
266
+ return res.data;
267
+ }
268
+ catch (e) {
269
+ throw new Error(_.get(e, "response.data.message", e.message));
270
+ }
271
+ };
272
+ exports.callCreateInternalService = callCreateInternalService;
273
+ const callUpdateInternalService = async (modelName, data, reqHeaders, ignoreActivityLog) => {
274
+ try {
275
+ const entity = await _loadEntity(modelName);
276
+ if (!_http) {
277
+ _http = axios_1.default.create({
278
+ maxContentLength: Infinity,
279
+ maxBodyLength: Infinity
280
+ });
281
+ }
282
+ const id = data.id;
283
+ delete data.id;
284
+ const headers = _.cloneDeep(reqHeaders || {});
285
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
286
+ headers["ignore_activity_log"] = _.isUndefined(ignoreActivityLog)
287
+ ? false
288
+ : ignoreActivityLog;
289
+ delete headers["content-length"];
290
+ const res = await _http.put(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/${id}`, data, {
291
+ headers,
292
+ maxBodyLength: Infinity,
293
+ maxContentLength: Infinity
294
+ });
295
+ data.id = res.data._id;
296
+ return res.data;
297
+ }
298
+ catch (e) {
299
+ throw new Error(_.get(e, "response.data.message", e.message));
300
+ }
301
+ };
302
+ exports.callUpdateInternalService = callUpdateInternalService;
303
+ const callSaveInternalService = async (modelName, data, reqHeaders, ignoreActivityLog) => {
304
+ try {
305
+ const entity = await _loadEntity(modelName);
306
+ const uniqQuery = (0, build_search_1.buildUniqueQuery)(entity, data, true);
307
+ if (_.isEmpty(uniqQuery)) {
308
+ return callCreateInternalService(entity.name, data, reqHeaders, ignoreActivityLog);
309
+ }
310
+ const found = await callFindInternalService(entity.name, "", uniqQuery);
311
+ if (_.isEmpty(found)) {
312
+ return callCreateInternalService(entity.name, data, reqHeaders, ignoreActivityLog);
313
+ }
314
+ else {
315
+ data = await (0, entity_1.combineRelatedFields)(data, found, entity);
316
+ data.id = found.id || found._id;
317
+ return callUpdateInternalService(entity.name, data, reqHeaders, ignoreActivityLog);
318
+ }
319
+ }
320
+ catch (e) {
321
+ throw new Error(_.get(e, "response.data.message", e.message));
322
+ }
323
+ };
324
+ exports.callSaveInternalService = callSaveInternalService;
325
+ const callDeleteInternalService = async (modelName, id, reqHeaders, ignoreActivityLog) => {
326
+ try {
327
+ const entity = await _loadEntity(modelName);
328
+ if (!_http) {
329
+ _http = axios_1.default.create({
330
+ maxContentLength: Infinity,
331
+ maxBodyLength: Infinity
332
+ });
333
+ }
334
+ const headers = _.cloneDeep(reqHeaders || {});
335
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
336
+ headers["ignore_activity_log"] = _.isUndefined(ignoreActivityLog)
337
+ ? false
338
+ : ignoreActivityLog;
339
+ headers["Content-Length"] = "0";
340
+ const res = await _http.delete(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/${id}`, { headers });
341
+ return res.data;
342
+ }
343
+ catch (e) {
344
+ throw new Error(_.get(e, "response.data.message", e.message));
345
+ }
346
+ };
347
+ exports.callDeleteInternalService = callDeleteInternalService;
348
+ const callApproveInternalService = async (modelName, data, reqHeaders, ignoreActivityLog) => {
349
+ try {
350
+ const entity = await _loadEntity(modelName);
351
+ if (!_http) {
352
+ _http = axios_1.default.create({
353
+ maxContentLength: Infinity,
354
+ maxBodyLength: Infinity
355
+ });
356
+ }
357
+ const id = data.id;
358
+ delete data.id;
359
+ const headers = _.cloneDeep(reqHeaders || {});
360
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
361
+ headers["ignore_activity_log"] = _.isUndefined(ignoreActivityLog)
362
+ ? false
363
+ : ignoreActivityLog;
364
+ delete headers["content-length"];
365
+ const res = await _http.put(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/${id}/approve`, data, {
366
+ headers,
367
+ maxBodyLength: Infinity,
368
+ maxContentLength: Infinity
369
+ });
370
+ data.id = res.data._id;
371
+ return res.data;
372
+ }
373
+ catch (e) {
374
+ throw new Error(_.get(e, "response.data.message", e.message));
375
+ }
376
+ };
377
+ exports.callApproveInternalService = callApproveInternalService;
378
+ const callBulkDeleteInternalService = async (modelName, ids, reqHeaders) => {
379
+ try {
380
+ const entity = await _loadEntity(modelName);
381
+ if (!_http) {
382
+ _http = axios_1.default.create({
383
+ maxContentLength: Infinity,
384
+ maxBodyLength: Infinity
385
+ });
386
+ }
387
+ const headers = _.cloneDeep(reqHeaders || {});
388
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
389
+ headers["ignore_activity_log"] = true;
390
+ delete headers["content-length"];
391
+ const res = await _http.post(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/bulk_delete`, { ids }, { headers });
392
+ return res.data;
393
+ }
394
+ catch (e) {
395
+ throw new Error(_.get(e, "response.data.message", e.message));
396
+ }
397
+ };
398
+ exports.callBulkDeleteInternalService = callBulkDeleteInternalService;
399
+ const callBulkUpdateInternalService = async (modelName, data, reqHeaders) => {
400
+ try {
401
+ const entity = await _loadEntity(modelName);
402
+ if (!_http) {
403
+ _http = axios_1.default.create({
404
+ maxContentLength: Infinity,
405
+ maxBodyLength: Infinity
406
+ });
407
+ }
408
+ const headers = _.cloneDeep(reqHeaders || {});
409
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
410
+ headers["ignore_activity_log"] = true;
411
+ delete headers["content-length"];
412
+ const res = await _http.post(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/bulk_update`, { data }, { headers });
413
+ return res.data;
414
+ }
415
+ catch (e) {
416
+ throw new Error(_.get(e, "response.data.message", e.message));
417
+ }
418
+ };
419
+ exports.callBulkUpdateInternalService = callBulkUpdateInternalService;
420
+ const callBulkCreateInternalService = async (modelName, data, reqHeaders) => {
421
+ try {
422
+ const entity = await _loadEntity(modelName);
423
+ if (!_http) {
424
+ _http = axios_1.default.create({
425
+ maxContentLength: Infinity,
426
+ maxBodyLength: Infinity
427
+ });
428
+ }
429
+ const headers = _.cloneDeep(reqHeaders || {});
430
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
431
+ headers["ignore_activity_log"] = true;
432
+ delete headers["content-length"];
433
+ const res = await _http.post(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/bulk_create`, { data }, { headers });
434
+ return res.data;
435
+ }
436
+ catch (e) {
437
+ throw new Error(_.get(e, "response.data.message", e.message));
438
+ }
439
+ };
440
+ exports.callBulkCreateInternalService = callBulkCreateInternalService;
441
+ const callCountInternalService = async (modelName, keywords = "", filters = {}, headers = {}) => {
442
+ try {
443
+ const entity = await _loadEntity(modelName);
444
+ if (!_http) {
445
+ _http = axios_1.default.create({
446
+ maxContentLength: Infinity,
447
+ maxBodyLength: Infinity
448
+ });
449
+ }
450
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, headers);
451
+ const res = await _http.get(`${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/count?keywords=${keywords}&filters=${encodeURIComponent(_.isString(filters)
452
+ ? filters
453
+ : qs.stringify(filters, { strictNullHandling: true }))}`, { headers });
454
+ return res.data;
455
+ }
456
+ catch (e) {
457
+ console.log(e);
458
+ throw new Error(_.get(e, "response.data.message") || _.get(e, "message"));
459
+ }
460
+ };
461
+ exports.callCountInternalService = callCountInternalService;
462
+ const _callUploadImageInternal = async (data, reqHeaders) => {
463
+ try {
464
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)("attachment", reqHeaders);
465
+ if (!_http) {
466
+ _http = axios_1.default.create({
467
+ maxContentLength: Infinity,
468
+ maxBodyLength: Infinity
469
+ });
470
+ }
471
+ const headers = _.cloneDeep(reqHeaders);
472
+ prepareHeader(headers);
473
+ const res = await _http.post(`${baseDomain}/attachment/upload`, data, {
474
+ headers,
475
+ maxContentLength: 100000000,
476
+ maxBodyLength: 100000000
477
+ });
478
+ return res.data;
479
+ }
480
+ catch (e) {
481
+ throw new Error(_.get(e, "response.data.message", e.message));
482
+ }
483
+ };
484
+ exports.callUploadImageInternal = _callUploadImageInternal;
485
+ const callMarkDeletedInternal = async (entity, ids, reqHeaders) => {
486
+ try {
487
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)("attachment", reqHeaders);
488
+ if (!_http) {
489
+ _http = axios_1.default.create({
490
+ maxContentLength: Infinity,
491
+ maxBodyLength: Infinity
492
+ });
493
+ }
494
+ const headers = _.cloneDeep(reqHeaders || {});
495
+ delete headers["content-length"];
496
+ const res = await _http.post(`${baseDomain}/attachment/mark_delete`, { entity, ids }, { headers });
497
+ return res.data;
498
+ }
499
+ catch (e) {
500
+ throw new Error(_.get(e, "response.data.message", e.message));
501
+ }
502
+ };
503
+ exports.callMarkDeletedInternal = callMarkDeletedInternal;
504
+ const callInternalService = async (modelName, method, action, body, reqHeaders, system, errData) => {
505
+ try {
506
+ const rawEntity = await _loadEntity(modelName);
507
+ const entity = _.cloneDeep(rawEntity);
508
+ if (system) {
509
+ _.set(entity, "system", system);
510
+ }
511
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(modelName, reqHeaders);
512
+ if (!_http) {
513
+ _http = axios_1.default.create({
514
+ maxContentLength: Infinity,
515
+ maxBodyLength: Infinity
516
+ });
517
+ }
518
+ const headers = _.cloneDeep(reqHeaders || {});
519
+ if (!body) {
520
+ body = {};
521
+ }
522
+ const url = `${baseDomain}/${entity.system ? "" : "entities/"}${modelName}/${action}`;
523
+ delete headers["content-length"];
524
+ let res;
525
+ switch (method.toLowerCase()) {
526
+ case "get":
527
+ res = await _http.get(url, { headers });
528
+ break;
529
+ case "post":
530
+ res = await _http.post(url, body, { headers });
531
+ break;
532
+ case "put":
533
+ res = await _http.put(url, body, { headers });
534
+ break;
535
+ case "patch":
536
+ res = await _http.patch(url, body, { headers });
537
+ break;
538
+ case "delete":
539
+ headers["Content-Length"] = "0";
540
+ res = await _http.delete(url, { headers });
541
+ break;
542
+ }
543
+ return res.data;
544
+ }
545
+ catch (e) {
546
+ if (errData) {
547
+ throw new Error(JSON.stringify({
548
+ request_body: body,
549
+ error: e.response.data
550
+ }));
551
+ }
552
+ throw new Error(_.get(e, "response.data.message", e.message));
553
+ }
554
+ };
555
+ exports.callInternalService = callInternalService;
556
+ const callInternalModuleSetting = async (moduleCode, method, action, body, reqHeaders) => {
557
+ try {
558
+ if (!_http) {
559
+ _http = axios_1.default.create({
560
+ maxContentLength: Infinity,
561
+ maxBodyLength: Infinity
562
+ });
563
+ }
564
+ const headers = _.cloneDeep(reqHeaders || {});
565
+ if (!body) {
566
+ body = {};
567
+ }
568
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)(moduleCode, reqHeaders);
569
+ const url = `${baseDomain}/${_.isEmpty(moduleCode) ? "" : moduleCode + "/"}${action}`;
570
+ delete headers["content-length"];
571
+ let res;
572
+ switch (method.toLowerCase()) {
573
+ case "get":
574
+ res = await _http.get(url, { headers });
575
+ break;
576
+ case "post":
577
+ res = await _http.post(url, body, { headers });
578
+ break;
579
+ case "put":
580
+ res = await _http.put(url, body, { headers });
581
+ break;
582
+ case "patch":
583
+ res = await _http.patch(url, body, { headers });
584
+ }
585
+ return res.data;
586
+ }
587
+ catch (e) {
588
+ throw new Error(_.get(e, "response.data.message", e.message));
589
+ }
590
+ };
591
+ exports.callInternalModuleSetting = callInternalModuleSetting;
592
+ const callUpdateSchemaInternal = async (entityId, body, reqHeaders) => {
593
+ try {
594
+ if (!_http) {
595
+ _http = axios_1.default.create({
596
+ maxContentLength: Infinity,
597
+ maxBodyLength: Infinity
598
+ });
599
+ }
600
+ const headers = _.cloneDeep(reqHeaders || {});
601
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)("entity", reqHeaders);
602
+ headers["ignore_activity_log"] = true;
603
+ delete headers["content-length"];
604
+ const res = await _http.put(`${baseDomain}/entities/schema/${entityId}`, body, { headers });
605
+ return res.data;
606
+ }
607
+ catch (e) {
608
+ throw new Error(e.repsonse.data.message);
609
+ }
610
+ };
611
+ exports.callUpdateSchemaInternal = callUpdateSchemaInternal;
612
+ const callAddQueueInternal = async (moduleName, queueName, body, reqHeaders) => {
613
+ try {
614
+ if (!_http) {
615
+ _http = axios_1.default.create({
616
+ maxContentLength: Infinity,
617
+ maxBodyLength: Infinity
618
+ });
619
+ }
620
+ if (moduleName !== "queue") {
621
+ queueName = `${moduleName}_${queueName}`;
622
+ }
623
+ const headers = _.cloneDeep(reqHeaders || {});
624
+ headers["ignore_activity_log"] = true;
625
+ delete headers["content-length"];
626
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)("queue", reqHeaders);
627
+ const res = await _http.post(`${baseDomain}/queue/add/${queueName}`, body, { headers });
628
+ }
629
+ catch (e) {
630
+ throw new Error(_.get(e, "response.data.message", e.message));
631
+ }
632
+ };
633
+ exports.callAddQueueInternal = callAddQueueInternal;
634
+ const uploadAttachmentInternal = async (data, filename, path, reqHeaders, isPublic) => {
635
+ try {
636
+ if (!_http) {
637
+ _http = axios_1.default.create({
638
+ maxContentLength: Infinity,
639
+ maxBodyLength: Infinity
640
+ });
641
+ }
642
+ const headers = _.cloneDeep(reqHeaders || {});
643
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)("attachment", headers);
644
+ headers["ignore_activity_log"] = true;
645
+ delete headers["content-length"];
646
+ const res = await _http.post(`${baseDomain}/attachment/upload`, { data, path, name: filename, field_type: "file", is_public: isPublic }, { headers });
647
+ return res.data;
648
+ }
649
+ catch (e) {
650
+ throw new Error(_.get(e, "response.data.message", e.message));
651
+ }
652
+ };
653
+ exports.uploadAttachmentInternal = uploadAttachmentInternal;
654
+ const callUploadInternal = async (data, reqHeaders) => {
655
+ try {
656
+ if (!_http) {
657
+ _http = axios_1.default.create({
658
+ maxContentLength: Infinity,
659
+ maxBodyLength: Infinity
660
+ });
661
+ }
662
+ const headers = _.cloneDeep(reqHeaders || {});
663
+ const baseDomain = (0, request_1.getBaseUrlWithHeaders)("attachment", headers);
664
+ headers["ignore_activity_log"] = true;
665
+ delete headers["content-length"];
666
+ const res = await _http.post(`${baseDomain}/attachment/upload`, data, { headers });
667
+ return res.data;
668
+ }
669
+ catch (e) {
670
+ throw new Error(_.get(e, "response.data.message", e.message));
671
+ }
672
+ };
673
+ exports.callUploadInternal = callUploadInternal;
674
+ const listFieldByType = (data, entity, type, extra) => {
675
+ const result = [];
676
+ for (const field of entity.fields) {
677
+ if (field.name.startsWith("_"))
678
+ continue;
679
+ if (_.isEmpty(data))
680
+ continue;
681
+ if (field.type === type) {
682
+ result.push({
683
+ name: field.name,
684
+ data: _.cloneDeep(data[field.name]),
685
+ options: _.omit(field, "name")
686
+ });
687
+ }
688
+ }
689
+ if (extra) {
690
+ const componentImage = _.get(data, `${extra}`, []);
691
+ if (!_.isEmpty(componentImage)) {
692
+ for (const component of componentImage) {
693
+ const name = _.get(component, "key", "");
694
+ const exists = result.find(i => i.name === name);
695
+ if (exists)
696
+ continue;
697
+ if (component === null || component === void 0 ? void 0 : component.notSaveAttachment)
698
+ continue;
699
+ const newData = _.get(data, `${name}`);
700
+ result.push({
701
+ name: name,
702
+ data: _.cloneDeep(newData),
703
+ options: _.omit(component, "key"),
704
+ _is_component: true
705
+ });
706
+ }
707
+ }
708
+ }
709
+ return result;
710
+ };
711
+ exports.listFieldByType = listFieldByType;
712
+ const saveRelatedFields = async (entity, reqHeaders, newData, oldData) => {
713
+ const relatedFields = listFieldByType(newData, entity, "related");
714
+ for (const field of relatedFields) {
715
+ const ignoreSaveRelated = _.get(reqHeaders, "ignore_save_related");
716
+ if (!ignoreSaveRelated &&
717
+ (_.get(field, "options.allow_create_update", false) ||
718
+ _.get(field, "options.list_type") === "full_list_editable")) {
719
+ if (_.get(field, "options.related_type") === "one2one" && field.data) {
720
+ let id = field.data.id || field.data._id;
721
+ delete field.data.id;
722
+ delete field.data._id;
723
+ if (_.get(oldData, field.name) &&
724
+ id &&
725
+ !_.isEqual(_.omit(field.data, IGNORE_COMPARE_FIELDS), _.omit(oldData[field.name], IGNORE_COMPARE_FIELDS))) {
726
+ field.data["id"] = id;
727
+ await callUpdateInternalService(field.options.related_ref, field.data, reqHeaders);
728
+ }
729
+ if (!id) {
730
+ const res = await callCreateInternalService(field.options.related_ref, field.data, reqHeaders);
731
+ id = res._id;
732
+ }
733
+ newData[field.name] = id;
734
+ }
735
+ if (_.get(field, "options.related_type") === "one2many" && field.data) {
736
+ const ids = [];
737
+ for (const data of field.data || []) {
738
+ const isExists = _.get(oldData, field.name, [])
739
+ .filter(j => j)
740
+ .find(j => `${j._id || j.id}` === `${data._id || data.id}`);
741
+ let id = data._id || data.id;
742
+ if (id && !isExists) {
743
+ ids.push(id);
744
+ continue;
745
+ }
746
+ if (isExists &&
747
+ !_.isEqual(_.omit(data, IGNORE_COMPARE_FIELDS), _.omit(isExists, IGNORE_COMPARE_FIELDS))) {
748
+ data["id"] = id;
749
+ delete data["_id"];
750
+ await callUpdateInternalService(field.options.related_ref, data, reqHeaders);
751
+ }
752
+ if (!isExists) {
753
+ const res = await callCreateInternalService(field.options.related_ref, data, reqHeaders);
754
+ id = res._id;
755
+ }
756
+ ids.push(id);
757
+ }
758
+ newData[field.name] = ids;
759
+ const removedList = _.get(oldData, field.name, [])
760
+ .filter(i => i)
761
+ .filter(i => {
762
+ const isExists = (field.data || [])
763
+ .filter(j => j)
764
+ .find(j => `${j._id || j.id}` === `${i._id || i.id}`);
765
+ return !isExists;
766
+ });
767
+ removedList.length > 0 &&
768
+ (await callBulkDeleteInternalService(field.options.related_ref, removedList, reqHeaders));
769
+ }
770
+ }
771
+ else {
772
+ if (_.get(field, "options.related_type") === "one2one" && field.data) {
773
+ newData[field.name] = _.isEmpty(newData[field.name])
774
+ ? undefined
775
+ : newData[field.name]._id ||
776
+ newData[field.name].id ||
777
+ newData[field.name];
778
+ }
779
+ if (_.get(field, "options.related_type") === "one2many" && field.data) {
780
+ newData[field.name] = field.data.map(d => d._id || d.id || d);
781
+ }
782
+ }
783
+ }
784
+ delete newData["_new_type"];
785
+ return newData;
786
+ };
787
+ exports.saveRelatedFields = saveRelatedFields;
788
+ const saveRelatedFieldsV2 = async (entity, reqHeaders, newData, oldData) => {
789
+ const relatedFields = listFieldByType(newData, entity, "related");
790
+ for (const field of relatedFields) {
791
+ const ignoreSaveRelated = _.get(reqHeaders, "ignore_save_related");
792
+ if (!ignoreSaveRelated &&
793
+ (_.get(field, "options.allow_create_update", false) ||
794
+ _.get(field, "options.list_type") === "full_list_editable")) {
795
+ if (_.get(field, "options.related_type") === "one2one" && field.data) {
796
+ let id = field.data.id || field.data._id;
797
+ delete field.data.id;
798
+ delete field.data._id;
799
+ if (_.get(oldData, field.name) &&
800
+ id &&
801
+ !_.isEqual(_.omit(field.data, IGNORE_COMPARE_FIELDS), _.omit(oldData[field.name], IGNORE_COMPARE_FIELDS))) {
802
+ field.data["id"] = id;
803
+ await callUpdateInternalService(field.options.related_ref, field.data, reqHeaders);
804
+ }
805
+ if (!id) {
806
+ const res = await callCreateInternalService(field.options.related_ref, field.data, reqHeaders);
807
+ id = res._id;
808
+ }
809
+ newData[field.name] = id;
810
+ }
811
+ if (_.get(field, "options.related_type") === "one2many" && field.data) {
812
+ let ids = [];
813
+ const updateList = [];
814
+ const createList = [];
815
+ for (const data of field.data || []) {
816
+ const isExists = _.get(oldData, field.name, [])
817
+ .filter(j => j)
818
+ .find(j => `${j._id || j.id}` === `${data._id || data.id}`);
819
+ let id = data._id || data.id;
820
+ if (id && !isExists) {
821
+ ids.push(id);
822
+ continue;
823
+ }
824
+ const relateEntity = await _loadEntity(field.options.related_ref);
825
+ if (isExists &&
826
+ !_.isEqual(_.omit(data, IGNORE_COMPARE_FIELDS), _.omit(isExists, IGNORE_COMPARE_FIELDS))) {
827
+ const dataWithRelate = await saveRelatedFieldsV2(relateEntity, reqHeaders, data, isExists);
828
+ updateList.push(dataWithRelate);
829
+ }
830
+ if (!isExists) {
831
+ const dataWithRelate = await saveRelatedFieldsV2(relateEntity, reqHeaders, data);
832
+ createList.push(dataWithRelate);
833
+ }
834
+ if (id) {
835
+ ids.push(id);
836
+ }
837
+ }
838
+ if (!_.isEmpty(updateList)) {
839
+ await callBulkUpdateInternalService(field.options.related_ref, updateList, reqHeaders);
840
+ }
841
+ if (!_.isEmpty(createList)) {
842
+ const resIds = await callBulkCreateInternalService(field.options.related_ref, createList, reqHeaders);
843
+ ids = [...ids, ...resIds];
844
+ }
845
+ newData[field.name] = ids;
846
+ const removedList = _.get(oldData, field.name, [])
847
+ .filter(i => i)
848
+ .filter(i => {
849
+ const isExists = (field.data || [])
850
+ .filter(j => j)
851
+ .find(j => `${j._id || j.id}` === `${i._id || i.id}`);
852
+ return !isExists;
853
+ });
854
+ removedList.length > 0 &&
855
+ (await callBulkDeleteInternalService(field.options.related_ref, removedList, reqHeaders));
856
+ }
857
+ }
858
+ else {
859
+ if (_.get(field, "options.related_type") === "one2one" && field.data) {
860
+ newData[field.name] = _.isEmpty(newData[field.name])
861
+ ? undefined
862
+ : newData[field.name]._id ||
863
+ newData[field.name].id ||
864
+ newData[field.name];
865
+ }
866
+ if (_.get(field, "options.related_type") === "one2many" && field.data) {
867
+ newData[field.name] = field.data.map(d => d._id || d.id || d);
868
+ }
869
+ }
870
+ }
871
+ delete newData["_new_type"];
872
+ return newData;
873
+ };
874
+ exports.saveRelatedFieldsV2 = saveRelatedFieldsV2;
875
+ const saveMapFields = async (entity, reqHeaders, newData, oldData) => {
876
+ const mapFields = listFieldByType(newData, entity, "map");
877
+ for (const field of mapFields) {
878
+ if (!field.data) {
879
+ continue;
880
+ }
881
+ const isMultiple = _.get(field, "options.multiple");
882
+ if (!isMultiple) {
883
+ _.set(field, "options.max_checked", true);
884
+ _.set(field, "options.max", 1);
885
+ }
886
+ const images = _.get(field, "options.max_checked") && _.get(field, "options.max") > 0
887
+ ? field.data.splice(0, field["options"]["max"])
888
+ : field.data;
889
+ newData[field.name] = await Promise.all(images.map(async (i) => {
890
+ const res = await callCreateInternalService("map_location", _.omit(i, ["_id", "id"]), reqHeaders);
891
+ return res._id;
892
+ }));
893
+ if (_.get(oldData, field.name)) {
894
+ await callBulkDeleteInternalService("map_location", oldData[field.name], reqHeaders);
895
+ }
896
+ }
897
+ return newData;
898
+ };
899
+ exports.saveMapFields = saveMapFields;
900
+ const transformImageComponents = async (data) => {
901
+ const nData = _.cloneDeep(data);
902
+ _.set(nData, "_original", true);
903
+ _.set(nData, "attachment_id", nData === null || nData === void 0 ? void 0 : nData._id);
904
+ delete nData["_id"];
905
+ return nData;
906
+ };
907
+ const saveImageFields = async (fields, reqHeaders, data, entity, system) => {
908
+ let deleted = [], updated = [];
909
+ const result = {};
910
+ for (const field of fields) {
911
+ const oldDatas = _.get(data, `${field.name}`, []);
912
+ const oldData = _.cloneDeep(oldDatas || []);
913
+ if (!_.isArray(field.data))
914
+ continue;
915
+ const isMultiple = _.get(field, "options.multiple");
916
+ const isComponent = _.get(field, "_is_component", false);
917
+ if (isMultiple) {
918
+ _.set(result, `${field.name}`, []);
919
+ for (const img of _.get(field, "data") || []) {
920
+ if ((!_.get(field, "options.external_url") &&
921
+ _.get(img, "upload_data")) ||
922
+ (_.get(field, "options.external_url") && _.get(img, "upload_url"))) {
923
+ const imgData = _.get(field, "options.external_url")
924
+ ? _.get(img, "upload_url")
925
+ : _.get(img, "upload_data");
926
+ const res = await _callUploadImageInternal({
927
+ path: `${entity}/${data._id}/${field.name}`,
928
+ data: imgData,
929
+ resize: true,
930
+ entity_id: `${data._id}`,
931
+ entity,
932
+ field: field.name,
933
+ name: img.name,
934
+ field_type: "image",
935
+ max_size: "image",
936
+ limit_size: _.get(field, "options.max_size_checked"),
937
+ limit_file_size: _.get(field, "options.max_size"),
938
+ is_public: _.get(field, "options.is_public", false),
939
+ _return_original: isComponent
940
+ }, reqHeaders);
941
+ if (isComponent) {
942
+ const transformDataImage = await transformImageComponents(res);
943
+ let value = _.get(data, `${field.name}`, []);
944
+ delete data[`${field.name}`];
945
+ if (!_.isArray(value))
946
+ value = [];
947
+ value.push(transformDataImage);
948
+ _.set(data, `${field.name}`, value);
949
+ }
950
+ else {
951
+ result[field.name].push(res);
952
+ }
953
+ }
954
+ else {
955
+ if (isComponent) {
956
+ if (!_.isEmpty(img)) {
957
+ let value = _.get(data, `${field.name}`, []);
958
+ delete data[`${field.name}`];
959
+ if (!_.isArray(value))
960
+ value = [];
961
+ value.push(img);
962
+ _.set(data, `${field.name}`, value);
963
+ }
964
+ }
965
+ else {
966
+ result[field.name].push(img);
967
+ }
968
+ }
969
+ }
970
+ }
971
+ else {
972
+ if (_.get(field, "data.0.remove")) {
973
+ if (/\./g.test(field.name)) {
974
+ _.unset(data, `${field.name}`);
975
+ }
976
+ else {
977
+ data[field.name] = null;
978
+ }
979
+ }
980
+ if ((!_.get(field, "options.external_url") &&
981
+ _.get(field, "data.0.upload_data")) ||
982
+ (_.get(field, "options.external_url") &&
983
+ _.get(field, "data.0.upload_url"))) {
984
+ const res = await _callUploadImageInternal({
985
+ path: `${entity}/${data._id}/${field.name}`,
986
+ data: _.get(field, "options.external_url")
987
+ ? field.data[0].upload_url
988
+ : field.data[0].upload_data,
989
+ resize: true,
990
+ entity_id: data._id,
991
+ entity,
992
+ field: field.name,
993
+ name: field.data[0].name,
994
+ field_type: "image",
995
+ limit_size: _.get(field, "options.max_size_checked"),
996
+ limit_file_size: _.get(field, "options.max_size"),
997
+ is_public: _.get(field, "options.is_public", false),
998
+ _return_original: isComponent
999
+ }, reqHeaders);
1000
+ if (isComponent) {
1001
+ delete data[`${field.name}`];
1002
+ const transformDataImage = await transformImageComponents(res);
1003
+ _.set(result, `${field.name}`, [transformDataImage]);
1004
+ }
1005
+ else {
1006
+ result[field.name] = [(res === null || res === void 0 ? void 0 : res._id) || res];
1007
+ }
1008
+ }
1009
+ if (_.get(field, "data.0._id") && !isComponent) {
1010
+ data[field.name] = [{ _id: field.data[0]._id }];
1011
+ result[field.name] = [field.data[0]._id];
1012
+ }
1013
+ }
1014
+ if (_.isArray(field.data)) {
1015
+ const dataNew = _.get(result, `${field.name}`, []);
1016
+ const diff = (0, attachment_1.diffData)(oldData || [], dataNew || []);
1017
+ deleted = [...deleted, ...diff.deleted];
1018
+ updated = [...updated, ...diff.need_update];
1019
+ }
1020
+ }
1021
+ if (deleted.length > 0 || updated.length > 0) {
1022
+ try {
1023
+ await callInternalService("attachment", "patch", "bulk_action", {
1024
+ deleted,
1025
+ updated
1026
+ });
1027
+ }
1028
+ catch (e) { }
1029
+ }
1030
+ return result;
1031
+ };
1032
+ exports.saveImageFields = saveImageFields;
1033
+ const saveFileFields = async (fields, reqHeaders, data, entity) => {
1034
+ let deleted = [], updated = [];
1035
+ for (const field of fields) {
1036
+ const oldData = _.cloneDeep(data[field.name] || []);
1037
+ if (!_.isArray(field.data))
1038
+ continue;
1039
+ const isMultiple = _.get(field, "options.multiple", _.get(field, "options.allow_multiple"));
1040
+ const isComponent = _.get(field, "_is_component", false);
1041
+ const pathFile = _.get(field, "options.path_file");
1042
+ if (isMultiple) {
1043
+ data[field.name] = [];
1044
+ for (const file of _.get(field, "data") || []) {
1045
+ if ((!_.get(field, "options.external_url") &&
1046
+ _.get(file, "upload_data")) ||
1047
+ (_.get(field, "options.external_url") && _.get(file, "upload_url"))) {
1048
+ const fileData = _.get(field, "options.external_url")
1049
+ ? _.get(file, "upload_url")
1050
+ : _.get(file, "upload_data");
1051
+ const res = await _callUploadImageInternal({
1052
+ path: pathFile ? pathFile : `${entity}/${data._id}/${field.name}`,
1053
+ data: fileData,
1054
+ entity_id: `${data._id}`,
1055
+ entity,
1056
+ field: field.name,
1057
+ name: file.name,
1058
+ field_type: "file",
1059
+ file_extention: _.get(field, "options.allow_type", _.get(field, "options.allow_extensions")),
1060
+ limit_size: _.get(field, "options.max_size_checked"),
1061
+ limit_file_size: _.get(field, "options.max_size", _.get(field, "options.max_file_size")),
1062
+ is_public: _.get(field, "options.is_public", false),
1063
+ _return_original: isComponent
1064
+ }, reqHeaders);
1065
+ if (isComponent) {
1066
+ const dataFile = await transformImageComponents(res);
1067
+ let value = _.get(data, `${field.name}`, []);
1068
+ delete data[`${field.name}`];
1069
+ if (!_.isArray(value))
1070
+ value = [];
1071
+ value.push(dataFile);
1072
+ _.set(data, `${field.name}`, value);
1073
+ }
1074
+ else {
1075
+ data[field.name].push(res);
1076
+ }
1077
+ }
1078
+ else {
1079
+ if (isComponent) {
1080
+ if (!_.isEmpty(file)) {
1081
+ let value = _.get(data, `${field.name}`, []);
1082
+ delete data[`${field.name}`];
1083
+ if (!_.isArray(value))
1084
+ value = [];
1085
+ value.push(file);
1086
+ _.set(data, `${field.name}`, value);
1087
+ }
1088
+ }
1089
+ else {
1090
+ data[field.name].push(file);
1091
+ }
1092
+ }
1093
+ }
1094
+ }
1095
+ else {
1096
+ if (_.get(field, "data.0.remove")) {
1097
+ data[field.name] = null;
1098
+ }
1099
+ if ((!_.get(field, "options.external_url") &&
1100
+ _.get(field, "data.0.upload_data")) ||
1101
+ (_.get(field, "options.external_url") &&
1102
+ _.get(field, "data.0.upload_url"))) {
1103
+ const res = await _callUploadImageInternal({
1104
+ path: pathFile ? pathFile : `${entity}/${data._id}/${field.name}`,
1105
+ data: _.get(field, "options.external_url")
1106
+ ? field.data[0].upload_url
1107
+ : field.data[0].upload_data,
1108
+ entity_id: data._id,
1109
+ entity,
1110
+ field: field.name,
1111
+ name: field.data[0].name,
1112
+ field_type: "file",
1113
+ file_extention: _.get(field, "options.allow_type", _.get(field, "options.allow_extensions")),
1114
+ limit_size: _.get(field, "options.max_size_checked"),
1115
+ limit_file_size: _.get(field, "options.max_size", _.get(field, "options.max_file_size")),
1116
+ is_public: _.get(field, "options.is_public", false),
1117
+ _return_original: isComponent
1118
+ }, reqHeaders);
1119
+ ``;
1120
+ if (isComponent) {
1121
+ delete data[`${field.name}`];
1122
+ const dataFile = await transformImageComponents(res);
1123
+ _.set(data, `${field.name}`, [dataFile]);
1124
+ }
1125
+ else {
1126
+ data[field.name] = [res];
1127
+ }
1128
+ }
1129
+ if (_.get(field, "data.0._id")) {
1130
+ data[field.name] = [{ _id: field.data[0]._id }];
1131
+ }
1132
+ }
1133
+ if (_.isArray(field.data)) {
1134
+ const diff = (0, attachment_1.diffData)(oldData || [], data[field.name] || []);
1135
+ deleted = [...deleted, ...diff.deleted];
1136
+ updated = [...updated, ...diff.need_update];
1137
+ }
1138
+ }
1139
+ if (deleted.length > 0 || updated.length > 0) {
1140
+ try {
1141
+ await callInternalService("attachment", "patch", "bulk_action", {
1142
+ deleted,
1143
+ updated
1144
+ });
1145
+ }
1146
+ catch (e) { }
1147
+ }
1148
+ };
1149
+ exports.saveFileFields = saveFileFields;
1150
+ const _uploadImageAndFileComponent = async (options) => {
1151
+ try {
1152
+ const uploadResult = await callInternalService("attachment", "POST", "upload", options);
1153
+ if ((options === null || options === void 0 ? void 0 : options.field_type) === "file") {
1154
+ return {
1155
+ file_url: _.isNil(_.get(uploadResult, "file_url"))
1156
+ ? _.get(uploadResult, "image_url")
1157
+ : _.get(uploadResult, "file_url"),
1158
+ thumbnail_url: _.get(uploadResult, "thumbnail_url"),
1159
+ file_size: _.get(uploadResult, "file_size"),
1160
+ name: _.get(uploadResult, "name"),
1161
+ ext: _.get(uploadResult, "ext"),
1162
+ type: _.get(uploadResult, "type"),
1163
+ idUpload: _.get(uploadResult, "_id")
1164
+ };
1165
+ }
1166
+ return {
1167
+ image_url: _.get(uploadResult, "image_url"),
1168
+ small_url: _.get(uploadResult, "small_url"),
1169
+ thumbnail_url: _.get(uploadResult, "thumbnail_url"),
1170
+ file_size: _.get(uploadResult, "file_size"),
1171
+ name: _.get(uploadResult, "name"),
1172
+ ext: _.get(uploadResult, "ext"),
1173
+ type: _.get(uploadResult, "type"),
1174
+ idUpload: _.get(uploadResult, "_id")
1175
+ };
1176
+ }
1177
+ catch (error) { }
1178
+ return undefined;
1179
+ };
1180
+ const _convertImageAndFileComponent = async (id, keyName, data, entity, level) => {
1181
+ if (_.isEmpty(data) || !data)
1182
+ return data;
1183
+ if (_.isString(data)) {
1184
+ try {
1185
+ data = JSON.parse(data);
1186
+ }
1187
+ catch (error) { }
1188
+ }
1189
+ if (!_.isArray(data) && !_.isPlainObject(data))
1190
+ return data;
1191
+ if (level > 10)
1192
+ return data;
1193
+ const result = _.cloneDeep(data);
1194
+ if (_.isArray(result)) {
1195
+ for (let i = 0; i < result.length; i++) {
1196
+ result[i] = await _convertImageAndFileComponent(id, `${keyName}_${i}`, result[i], entity, level + 1);
1197
+ }
1198
+ return result;
1199
+ }
1200
+ if (_.isPlainObject(result)) {
1201
+ if ((result === null || result === void 0 ? void 0 : result.field_type) && ((result === null || result === void 0 ? void 0 : result.upload_data) || (result === null || result === void 0 ? void 0 : result.upload_url))) {
1202
+ const pathFile = (result === null || result === void 0 ? void 0 : result.path_file) ? `/${result.path_file}` : "";
1203
+ const uploadResult = await _uploadImageAndFileComponent({
1204
+ data: (result === null || result === void 0 ? void 0 : result.upload_data) ? result.upload_data : result === null || result === void 0 ? void 0 : result.upload_url,
1205
+ name: result === null || result === void 0 ? void 0 : result.name,
1206
+ path: `COMPOMENT_FILES/${entity.name}/${id}/${keyName}${pathFile}`,
1207
+ field_type: result === null || result === void 0 ? void 0 : result.field_type,
1208
+ resize: true,
1209
+ entity,
1210
+ is_public: _.get(result, "is_public", false)
1211
+ });
1212
+ return uploadResult;
1213
+ }
1214
+ else {
1215
+ for (const key in result) {
1216
+ result[key] = await _convertImageAndFileComponent(id, `${keyName}_${key}`, result[key], entity, level + 1);
1217
+ }
1218
+ return result;
1219
+ }
1220
+ }
1221
+ };
1222
+ const saveImageAndFileComponent = async (entity, newData) => {
1223
+ const jsonFields = listFieldByType(newData, entity, "json");
1224
+ for (const field of jsonFields) {
1225
+ field.data = field.data || {};
1226
+ const convertData = await _convertImageAndFileComponent(newData.id || newData._id, field.name, field.data, entity, 0);
1227
+ newData[field.name] = convertData;
1228
+ }
1229
+ return newData;
1230
+ };
1231
+ exports.saveImageAndFileComponent = saveImageAndFileComponent;
1232
+ const saveShareWidget = async (entity, newData, useEntityField = true) => {
1233
+ const SHARE_WIDGET_FIELDS = [
1234
+ "type",
1235
+ "key",
1236
+ "css",
1237
+ "stylesheet",
1238
+ "mode",
1239
+ "share_id",
1240
+ "content"
1241
+ ];
1242
+ if (!_.isPlainObject(newData) && !_.isArray(newData)) {
1243
+ return newData;
1244
+ }
1245
+ if (_.isPlainObject(newData) && !useEntityField) {
1246
+ const checkSW = _.difference(SHARE_WIDGET_FIELDS, Object.keys(newData));
1247
+ if (_.isEmpty(checkSW)) {
1248
+ const shareId = newData.share_id;
1249
+ const widget = _.cloneDeep(newData);
1250
+ widget.content = await saveShareWidget(entity, widget.content, false);
1251
+ delete widget["share_id"];
1252
+ await callUpdateInternalService("layout_share_widget", {
1253
+ id: shareId,
1254
+ widget,
1255
+ _ignore_check_permission: true
1256
+ });
1257
+ return { share_id: shareId };
1258
+ }
1259
+ }
1260
+ let jsonFields = [];
1261
+ if (useEntityField) {
1262
+ jsonFields = listFieldByType(newData, entity, "json");
1263
+ }
1264
+ else {
1265
+ jsonFields = _.reduce(Object.keys(newData), (r, v) => {
1266
+ r.push({
1267
+ name: v,
1268
+ data: newData[v]
1269
+ });
1270
+ return r;
1271
+ }, []);
1272
+ }
1273
+ for (const field of jsonFields) {
1274
+ field.data = field.data || {};
1275
+ if (_.isEmpty(field.data))
1276
+ continue;
1277
+ if (!_.isPlainObject(field.data) && !_.isArray(field.data))
1278
+ continue;
1279
+ if (_.isPlainObject(field.data)) {
1280
+ const checkSW = _.difference(SHARE_WIDGET_FIELDS, Object.keys(field.data));
1281
+ if (_.isEmpty(checkSW)) {
1282
+ const shareId = _.get(field, "data.share_id");
1283
+ const widget = _.cloneDeep(field.data);
1284
+ widget.content = await saveShareWidget(entity, widget.content, false);
1285
+ delete widget["share_id"];
1286
+ await callUpdateInternalService("layout_share_widget", {
1287
+ id: shareId,
1288
+ widget,
1289
+ _ignore_check_permission: true
1290
+ });
1291
+ newData[field.name] = { share_id: shareId };
1292
+ }
1293
+ else {
1294
+ newData[field.name] = await saveShareWidget(entity, field.data, false);
1295
+ }
1296
+ }
1297
+ else if (_.isArray(field.data)) {
1298
+ for (const [i, d] of field.data.entries()) {
1299
+ field.data[i] = await saveShareWidget(entity, d, false);
1300
+ }
1301
+ newData[field.name] = field.data;
1302
+ }
1303
+ }
1304
+ return newData;
1305
+ };
1306
+ exports.saveShareWidget = saveShareWidget;
1307
+ const transformShareWidget = async (entityName, data, useEntityField = true) => {
1308
+ if (!_.isPlainObject(data) && !_.isArray(data)) {
1309
+ return data;
1310
+ }
1311
+ let isObject = !_.isArray(data);
1312
+ if (isObject) {
1313
+ data = [data];
1314
+ }
1315
+ for (const d of data) {
1316
+ let jsonFields = [];
1317
+ if (useEntityField) {
1318
+ const entity = await _loadEntity(entityName);
1319
+ jsonFields = listFieldByType(d, entity, "json");
1320
+ }
1321
+ else {
1322
+ if (_.isUndefined(d) || _.isNil(d)) {
1323
+ jsonFields = [];
1324
+ }
1325
+ else {
1326
+ jsonFields = _.reduce(Object.keys(d), (r, v) => {
1327
+ r.push({
1328
+ name: v,
1329
+ data: d[v]
1330
+ });
1331
+ return r;
1332
+ }, []);
1333
+ }
1334
+ }
1335
+ for (const field of jsonFields) {
1336
+ field.data = field.data || {};
1337
+ if (_.isEmpty(field.data))
1338
+ continue;
1339
+ if (!_.isPlainObject(field.data) && !_.isArray(field.data))
1340
+ continue;
1341
+ if (_.isPlainObject(field.data)) {
1342
+ if (Object.keys(field.data).includes("share_id")) {
1343
+ const sw = await callGetInternalService("layout_share_widget", field.data.share_id);
1344
+ if (_.isEmpty(sw))
1345
+ continue;
1346
+ sw.widget.content = await transformShareWidget(entityName, sw.widget.content, false);
1347
+ field.data = Object.assign({ share_id: sw.id }, sw.widget);
1348
+ }
1349
+ else {
1350
+ field.data = await transformShareWidget(entityName, field.data, false);
1351
+ }
1352
+ }
1353
+ else if (_.isArray(field.data)) {
1354
+ for (const [i, v] of field.data.entries()) {
1355
+ field.data[i] = await transformShareWidget(entityName, v, false);
1356
+ }
1357
+ }
1358
+ d[field.name] = field.data;
1359
+ }
1360
+ }
1361
+ return isObject ? data[0] : data;
1362
+ };
1363
+ exports.transformShareWidget = transformShareWidget;
1364
+ const _convertJsonSupportDocDB = (data) => {
1365
+ return (0, flat_1.unflatten)(data);
1366
+ };
1367
+ const saveJsonFields = async (entity, newData, oldData) => {
1368
+ const jsonFields = listFieldByType(newData, entity, "json");
1369
+ for (const field of jsonFields) {
1370
+ if (!_.get(field, "options.external_storage", false) &&
1371
+ !_.get(field, "options.log", false)) {
1372
+ if (process.env.USE_DOCUMENTDB && !_.isUndefined(field.data)) {
1373
+ newData[field.name] = _convertJsonSupportDocDB(field.data);
1374
+ }
1375
+ continue;
1376
+ }
1377
+ const isLog = _.get(field, "options.log", false);
1378
+ if (_.isUndefined(field.data))
1379
+ continue;
1380
+ const uploadData = Buffer.from(_.isString(field.data) ? field.data : JSON.stringify(field.data), "utf8").toString("base64");
1381
+ let fileName = `${field.name}_${new Date().getTime()}${crypto
1382
+ .randomBytes(4)
1383
+ .toString("hex")
1384
+ .toUpperCase()}.json`;
1385
+ if (_.get(oldData, `${field.name}.filename`)) {
1386
+ fileName = _.get(oldData, `${field.name}.filename`);
1387
+ }
1388
+ const filePath = `${isLog ? "LOG_FILES" : "EXTERNAL_FILES"}/${entity.name}`;
1389
+ const uploadResult = await callInternalService("attachment", "POST", "upload", {
1390
+ data: `data:application/json;base64,${uploadData}`,
1391
+ name: fileName,
1392
+ path: filePath,
1393
+ field_type: "file",
1394
+ is_public: false
1395
+ });
1396
+ await callInternalService("attachment", "DELETE", `${uploadResult.id || uploadResult._id}?ignore_delete_file=true`, {}).catch(console.error);
1397
+ newData[field.name] = {
1398
+ filename: fileName,
1399
+ file_url: `${filePath}/${fileName}`
1400
+ };
1401
+ }
1402
+ return newData;
1403
+ };
1404
+ exports.saveJsonFields = saveJsonFields;
1405
+ const transformJsonFields = async (entityName, data, headers) => {
1406
+ const entity = await _loadEntity(entityName);
1407
+ let isObject = !_.isArray(data);
1408
+ if (isObject) {
1409
+ data = [data];
1410
+ }
1411
+ for (const d of data) {
1412
+ const jsonFields = listFieldByType(d, entity, "json");
1413
+ for (const field of jsonFields) {
1414
+ if (!_.get(field, "options.external_storage", false) &&
1415
+ !_.get(field, "options.log", false)) {
1416
+ continue;
1417
+ }
1418
+ if (!_.get(d, `${field.name}.file_url`)) {
1419
+ continue;
1420
+ }
1421
+ const fileUrl = `${constants_1.CONST.INTERNAL_DOMAIN.replace("/api/v1", "")}/private/${d[field.name].file_url}`;
1422
+ try {
1423
+ const _http = axios_1.default.create();
1424
+ prepareHeader(headers);
1425
+ const res = await _http.get(fileUrl, {
1426
+ headers: Object.assign(Object.assign({}, headers), { "Cache-Control": "no-cache" })
1427
+ });
1428
+ d[field.name] = res.data || {};
1429
+ }
1430
+ catch (e) {
1431
+ d[field.name]["ERROR"] = e.message;
1432
+ }
1433
+ }
1434
+ }
1435
+ return isObject ? data[0] : data;
1436
+ };
1437
+ exports.transformJsonFields = transformJsonFields;
1438
+ const hashPasswordFields = async (entity, newData) => {
1439
+ const passFields = listFieldByType(newData, entity, "password");
1440
+ for (const field of passFields) {
1441
+ if (!field.data) {
1442
+ continue;
1443
+ }
1444
+ if (field.data.length > 30) {
1445
+ continue;
1446
+ }
1447
+ if (!newData._id) {
1448
+ continue;
1449
+ }
1450
+ const hash = crypto
1451
+ .createHmac("sha256", `${newData._id.toString()}${exports.SALTRANDOMKEY}`)
1452
+ .update(field.data)
1453
+ .digest("hex");
1454
+ newData[field.name] = hash;
1455
+ }
1456
+ return newData;
1457
+ };
1458
+ exports.hashPasswordFields = hashPasswordFields;
1459
+ const saveEncryptFields = async (entity, newData, oldData) => {
1460
+ var _a, _b, _c, _d;
1461
+ const fields = listFieldByType(newData, entity, 'encrypt');
1462
+ for (const field of fields) {
1463
+ const oldValue = _.isPlainObject(_.get(oldData, field.name))
1464
+ ? _.get(oldData, `${field.name}.value`)
1465
+ : _.get(oldData, `${field.name}`);
1466
+ const oldMask = _.isPlainObject(_.get(oldData, field.name))
1467
+ ? _.get(oldData, `${field.name}.mask`)
1468
+ : _.get(oldData, `${field.name}`);
1469
+ const encryptType = _.get(field, 'options.encrypt_type') || 'one_way';
1470
+ if (field.data && (field.data !== oldValue) && (field.data !== oldMask) && (encryptType == 'one_way')) {
1471
+ const hash = crypto
1472
+ .createHmac("sha256", `${field.name}${exports.SALTRANDOMKEY}`)
1473
+ .update(field.data)
1474
+ .digest("hex");
1475
+ newData[field.name] = {
1476
+ value: hash,
1477
+ mask: (0, masking_1.maskValue)(field.data, (_a = field.options) === null || _a === void 0 ? void 0 : _a.use_mask_prefix, (_b = field.options) === null || _b === void 0 ? void 0 : _b.use_mask_suffix)
1478
+ };
1479
+ }
1480
+ if (field.data && (field.data !== oldValue) && (field.data !== oldMask) && (encryptType == 'two_way')) {
1481
+ const iv = Buffer.alloc(16);
1482
+ const secretKey = crypto.createHash('sha256').update(`${field.name}${exports.SALTRANDOMKEY}`).digest('hex').substring(0, 64);
1483
+ const cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(secretKey, 'hex'), iv);
1484
+ const encrypted = cipher.update(field.data).toString('hex') + cipher.final('hex');
1485
+ newData[field.name] = {
1486
+ value: encrypted,
1487
+ mask: (0, masking_1.maskValue)(field.data, (_c = field.options) === null || _c === void 0 ? void 0 : _c.use_mask_prefix, (_d = field.options) === null || _d === void 0 ? void 0 : _d.use_mask_suffix)
1488
+ };
1489
+ }
1490
+ if (_.isString(newData[field.name])) {
1491
+ delete newData[field.name];
1492
+ }
1493
+ }
1494
+ return newData;
1495
+ };
1496
+ exports.saveEncryptFields = saveEncryptFields;
1497
+ const hashEncryptFields = (entity, newData) => {
1498
+ const fields = listFieldByType(newData, entity, 'encrypt');
1499
+ for (const field of fields) {
1500
+ newData[field.name] = _.isPlainObject(field.data)
1501
+ ? _.get(field, 'data.mask')
1502
+ : _.get(field, 'data');
1503
+ }
1504
+ return newData;
1505
+ };
1506
+ exports.hashEncryptFields = hashEncryptFields;
1507
+ const addActivityLog = async (entity, request, data, type, action, status, start_process_time, end_process_time, message, description, newData, oldData) => {
1508
+ if ((entity.name === "activity_log" ||
1509
+ _.get(request, "headers.ignore_activity_log") === "true") &&
1510
+ type !== activity_log_enum_1.ActivityLogType.workflow) {
1511
+ return true;
1512
+ }
1513
+ if (_.isEmpty(message)) {
1514
+ message = _.get(request, "headers.module")
1515
+ ? `${entity.name} has been ${action} from module ${_.get(request, "headers.module")}`
1516
+ : `${entity.name} has been ${action}`;
1517
+ }
1518
+ if (!start_process_time) {
1519
+ start_process_time = new Date();
1520
+ }
1521
+ if (!end_process_time) {
1522
+ end_process_time = new Date();
1523
+ }
1524
+ const log = {
1525
+ entity: { id: entity.id || entity._id },
1526
+ user: {
1527
+ id: _.get(request, "body._profile.id") || _.get(request, "profile.id")
1528
+ },
1529
+ ip_address: _.get(request, "body._ip") || _.get(request, "ip"),
1530
+ type,
1531
+ action,
1532
+ doc_ref: data.id || data._id,
1533
+ message,
1534
+ description,
1535
+ status,
1536
+ start_process_time,
1537
+ end_process_time
1538
+ };
1539
+ if (action === activity_log_enum_1.ActivityLogAction.updated) {
1540
+ const diff = await getDiffData(newData, oldData, entity.fields);
1541
+ if (diff.length > 0) {
1542
+ log["diff"] = diff;
1543
+ }
1544
+ }
1545
+ await callCreateInternalService("activity_log", log, _.get(request, "headers"));
1546
+ return true;
1547
+ };
1548
+ exports.addActivityLog = addActivityLog;
1549
+ const getDiffData = (newData, oldData, fields) => {
1550
+ const result = [];
1551
+ const __isBlank = val => {
1552
+ return val === undefined || val === null || val === "";
1553
+ };
1554
+ const __normalizeValue = val => {
1555
+ if (_.isPlainObject(val)) {
1556
+ if (typeof val._id === "string")
1557
+ return val._id;
1558
+ if (typeof val.id === "string")
1559
+ return val.id;
1560
+ }
1561
+ return val;
1562
+ };
1563
+ const __walk = (a, b, path = "") => {
1564
+ const normA = __normalizeValue(a);
1565
+ const normB = __normalizeValue(b);
1566
+ if (_.isPlainObject(normA) && _.isPlainObject(normB)) {
1567
+ const keys = new Set([...Object.keys(normA), ...Object.keys(normB)]);
1568
+ for (const key of keys) {
1569
+ const newPath = _.isEmpty(path) ? key : `${path}.${key}`;
1570
+ __walk(normA[key], normB[key], newPath);
1571
+ }
1572
+ return;
1573
+ }
1574
+ if (Array.isArray(normA) && Array.isArray(normB)) {
1575
+ const maxLen = Math.max(normA.length, normB.length);
1576
+ for (let i = 0; i < maxLen; i++) {
1577
+ __walk(normA[i], normB[i], `${path}[${i}]`);
1578
+ }
1579
+ return;
1580
+ }
1581
+ if (!_.isEqual(normA, normB)) {
1582
+ const isAdd = __isBlank(normB);
1583
+ const isRemove = __isBlank(normA);
1584
+ result.push({
1585
+ field: path,
1586
+ action: isAdd ? "add" : isRemove ? "remove" : "edit",
1587
+ old: normB,
1588
+ new: normA
1589
+ });
1590
+ }
1591
+ };
1592
+ __walk(_.omit(newData, ["id", "_id", "createdAt", "updatedAt", "__v"]), _.omit(oldData, ["id", "_id", "createdAt", "updatedAt", "__v"]));
1593
+ return result;
1594
+ };
1595
+ const addVersionData = async (entity, id, version) => {
1596
+ const olddata = await callGetInternalService(entity.name, id);
1597
+ const data = {
1598
+ version,
1599
+ entity,
1600
+ doc_ref: id,
1601
+ version_date: _.get(olddata, "updatedAt", new Date()),
1602
+ data: olddata
1603
+ };
1604
+ await callCreateInternalService("version_data", data);
1605
+ return version + 1;
1606
+ };
1607
+ exports.addVersionData = addVersionData;
1608
+ const createReasonData = async (data) => {
1609
+ if (!_.isArray(data["options"])) {
1610
+ data["options"] = [data["options"]];
1611
+ }
1612
+ await callCreateInternalService("reason_data", data);
1613
+ };
1614
+ exports.createReasonData = createReasonData;
1615
+ const mapEntity = entity => {
1616
+ if (entity === "image") {
1617
+ return "attachment";
1618
+ }
1619
+ if (entity === "map") {
1620
+ return "map_location";
1621
+ }
1622
+ if (entity === "file") {
1623
+ return "attachment";
1624
+ }
1625
+ };
1626
+ exports.mapEntity = mapEntity;
1627
+ const getSetting = async (name, module) => {
1628
+ try {
1629
+ if (!_http) {
1630
+ _http = axios_1.default.create();
1631
+ }
1632
+ const res = await _http.get(`${constants_1.CONST.INTERNAL_DOMAIN}/${_.isEmpty(module) ? "setting" : `${module}_setting`}${_.isEmpty(name) ? "" : `/${name}`}`);
1633
+ return res.data;
1634
+ }
1635
+ catch (e) {
1636
+ throw new Error(_.get(e, "response.data.message", e.message));
1637
+ }
1638
+ };
1639
+ exports.getSetting = getSetting;
1640
+ const setSetting = async (name, data, module) => {
1641
+ try {
1642
+ if (!_http) {
1643
+ _http = axios_1.default.create();
1644
+ }
1645
+ const res = await _http.put(`${constants_1.CONST.INTERNAL_DOMAIN}/${_.isEmpty(module) ? "setting" : `${module}_setting`}${_.isEmpty(name) ? "" : `/${name}`}`, data);
1646
+ return res.data;
1647
+ }
1648
+ catch (e) {
1649
+ throw new Error(_.get(e, "response.data.message", e.message));
1650
+ }
1651
+ };
1652
+ exports.setSetting = setSetting;
1653
+ const getModuleSetting = async (module, layout) => {
1654
+ try {
1655
+ if (!_http) {
1656
+ _http = axios_1.default.create();
1657
+ }
1658
+ const res = await _http.get(`${constants_1.CONST.INTERNAL_DOMAIN}/setting/module/${module}/${layout}`);
1659
+ return res.data;
1660
+ }
1661
+ catch (e) {
1662
+ throw new Error(_.get(e, "response.data.message", e.message));
1663
+ }
1664
+ };
1665
+ exports.getModuleSetting = getModuleSetting;
1666
+ const setModuleSetting = async (module, layout, data) => {
1667
+ try {
1668
+ if (!_http) {
1669
+ _http = axios_1.default.create();
1670
+ }
1671
+ const res = await _http.put(`${constants_1.CONST.INTERNAL_DOMAIN}/setting/module/${module}/${layout}`, data);
1672
+ return res.data;
1673
+ }
1674
+ catch (e) {
1675
+ throw new Error(_.get(e, "response.data.message", e.message));
1676
+ }
1677
+ };
1678
+ exports.setModuleSetting = setModuleSetting;
1679
+ const buildSelect = (doc, fields) => {
1680
+ if (!fields) {
1681
+ return false;
1682
+ }
1683
+ const mainFields = fields.filter(f => f.indexOf(".") === -1);
1684
+ const all = mainFields.find(f => f === "*") ? true : false;
1685
+ if (all) {
1686
+ return true;
1687
+ }
1688
+ const selectFields = _.reduce(mainFields, (r, v, k) => {
1689
+ r.push({ [v]: 1 });
1690
+ return r;
1691
+ }, []);
1692
+ selectFields.push({ __v: 0 });
1693
+ doc = doc.select(mainFields.join(" "));
1694
+ };
1695
+ exports.buildSelect = buildSelect;
1696
+ const getFieldsToPopulate = (availableFields, requestedFields) => {
1697
+ if (!requestedFields || requestedFields.length === 0) {
1698
+ return availableFields;
1699
+ }
1700
+ if (requestedFields.includes("*")) {
1701
+ return availableFields;
1702
+ }
1703
+ const fieldsToPopulate = [];
1704
+ for (const field of availableFields) {
1705
+ let shouldPopulate = false;
1706
+ for (const pattern of requestedFields) {
1707
+ if (REGEX_KEEP_POPULATE_FORMAT.test(pattern)) {
1708
+ const fieldName = pattern.replace(REGEX_KEEP_POPULATE_FORMAT, "$1");
1709
+ shouldPopulate = fieldName === field;
1710
+ }
1711
+ else if (pattern === `${field}.*` || pattern.startsWith(`${field}.`)) {
1712
+ shouldPopulate = true;
1713
+ }
1714
+ if (shouldPopulate)
1715
+ break;
1716
+ }
1717
+ if (shouldPopulate) {
1718
+ fieldsToPopulate.push(field);
1719
+ }
1720
+ }
1721
+ return fieldsToPopulate;
1722
+ };
1723
+ const getCollectionName = (entity) => {
1724
+ try {
1725
+ if (_.isEmpty(entity))
1726
+ return entity;
1727
+ const pluralize = mongoose.pluralize()(entity);
1728
+ return pluralize;
1729
+ }
1730
+ catch (error) {
1731
+ return entity;
1732
+ }
1733
+ };
1734
+ const transformMediaPipeline = (fieldPath) => {
1735
+ const apiDomain = _.get(constants_1.CONST.MEDIA_SETTING, "api_domain");
1736
+ const provideCode = _.get(constants_1.CONST.MEDIA_SETTING, "provider");
1737
+ const providerHost = _.get(constants_1.CONST.MEDIA_SETTING, `host.${provideCode}`, apiDomain);
1738
+ const getMediaUrlExpression = (itemPrefix) => {
1739
+ return {
1740
+ $cond: {
1741
+ if: {
1742
+ $eq: [`${itemPrefix}.provider`, "external"]
1743
+ },
1744
+ then: {
1745
+ $arrayElemAt: [`${itemPrefix}.meta.url`, 0]
1746
+ },
1747
+ else: {
1748
+ $cond: {
1749
+ if: {
1750
+ $eq: [`${itemPrefix}.is_public`, true]
1751
+ },
1752
+ then: {
1753
+ $cond: {
1754
+ if: {
1755
+ $eq: [{ $substrCP: [`${itemPrefix}.name`, 0, 1] }, "/"]
1756
+ },
1757
+ then: {
1758
+ $concat: [
1759
+ providerHost,
1760
+ "/",
1761
+ `${itemPrefix}.path`,
1762
+ `${itemPrefix}.name`
1763
+ ]
1764
+ },
1765
+ else: {
1766
+ $concat: [
1767
+ providerHost,
1768
+ "/",
1769
+ `${itemPrefix}.path`,
1770
+ "/",
1771
+ `${itemPrefix}.name`
1772
+ ]
1773
+ }
1774
+ }
1775
+ },
1776
+ else: {
1777
+ $cond: {
1778
+ if: {
1779
+ $eq: [{ $substrCP: [`${itemPrefix}.name`, 0, 1] }, "/"]
1780
+ },
1781
+ then: {
1782
+ $concat: [
1783
+ apiDomain,
1784
+ "/private/",
1785
+ `${itemPrefix}.path`,
1786
+ `${itemPrefix}.name`
1787
+ ]
1788
+ },
1789
+ else: {
1790
+ $concat: [
1791
+ apiDomain,
1792
+ "/private/",
1793
+ `${itemPrefix}.path`,
1794
+ "/",
1795
+ `${itemPrefix}.name`
1796
+ ]
1797
+ }
1798
+ }
1799
+ }
1800
+ }
1801
+ }
1802
+ }
1803
+ };
1804
+ };
1805
+ const convertDecimalFields = (itemPrefix) => {
1806
+ return {
1807
+ size: {
1808
+ $cond: {
1809
+ if: { $ne: [`${itemPrefix}.size`, null] },
1810
+ then: { $toDouble: `${itemPrefix}.size` },
1811
+ else: `${itemPrefix}.size`
1812
+ }
1813
+ }
1814
+ };
1815
+ };
1816
+ const pipeline = [];
1817
+ const transformMedia = fieldPath
1818
+ ? {
1819
+ $addFields: {
1820
+ [fieldPath]: {
1821
+ $cond: {
1822
+ if: { $ne: [`$${fieldPath}`, null] },
1823
+ then: {
1824
+ $cond: {
1825
+ if: { $eq: [{ $type: `$${fieldPath}` }, "array"] },
1826
+ then: {
1827
+ $map: {
1828
+ input: `$${fieldPath}`,
1829
+ as: "item",
1830
+ in: {
1831
+ $mergeObjects: [
1832
+ "$$item",
1833
+ Object.assign({ image_url: getMediaUrlExpression("$$item"), small_url: getMediaUrlExpression("$$item"), thumbnail_url: getMediaUrlExpression("$$item"), doc_ref: "$$item.entity_id", created_date: "$$item.createdAt", updated_date: "$$item.updatedAt", id: { $toString: "$$item._id" }, type: {
1834
+ $cond: {
1835
+ if: { $isArray: "$$item.type" },
1836
+ then: { $arrayElemAt: ["$$item.type", 0] },
1837
+ else: "$$item.type"
1838
+ }
1839
+ } }, convertDecimalFields("$$item"))
1840
+ ]
1841
+ }
1842
+ }
1843
+ },
1844
+ else: {
1845
+ $mergeObjects: [
1846
+ `$${fieldPath}`,
1847
+ Object.assign({ image_url: getMediaUrlExpression(`$${fieldPath}`), small_url: getMediaUrlExpression(`$${fieldPath}`), thumbnail_url: getMediaUrlExpression(`$${fieldPath}`), doc_ref: `$${fieldPath}.entity_id`, created_date: `$${fieldPath}.createdAt`, updated_date: `$${fieldPath}.updatedAt`, id: { $toString: `$${fieldPath}._id` }, type: {
1848
+ $cond: {
1849
+ if: { $isArray: `$${fieldPath}.type` },
1850
+ then: { $arrayElemAt: [`$${fieldPath}.type`, 0] },
1851
+ else: `$${fieldPath}.type`
1852
+ }
1853
+ } }, convertDecimalFields(`$${fieldPath}`))
1854
+ ]
1855
+ }
1856
+ }
1857
+ },
1858
+ else: `$${fieldPath}`
1859
+ }
1860
+ }
1861
+ }
1862
+ }
1863
+ : {
1864
+ $addFields: {
1865
+ image_url: getMediaUrlExpression("$$ROOT"),
1866
+ small_url: getMediaUrlExpression("$$ROOT"),
1867
+ thumbnail_url: getMediaUrlExpression("$$ROOT"),
1868
+ file_url: getMediaUrlExpression("$$ROOT"),
1869
+ doc_ref: "$entity_id",
1870
+ created_date: "$createdAt",
1871
+ updated_date: "$updatedAt",
1872
+ type: {
1873
+ $cond: {
1874
+ if: { $isArray: "$type" },
1875
+ then: { $arrayElemAt: ["$type", 0] },
1876
+ else: "$type"
1877
+ }
1878
+ },
1879
+ file_size: {
1880
+ $cond: {
1881
+ if: { $ne: [{ $arrayElemAt: ["$meta.size", 0] }, null] },
1882
+ then: { $toDouble: { $arrayElemAt: ["$meta.size", 0] } },
1883
+ else: {
1884
+ $cond: {
1885
+ if: { $ne: ["$size", null] },
1886
+ then: { $toDouble: "$size" },
1887
+ else: "$size"
1888
+ }
1889
+ }
1890
+ }
1891
+ }
1892
+ }
1893
+ };
1894
+ const addVisibleFields = {
1895
+ $addFields: {
1896
+ profile_image: {
1897
+ $map: {
1898
+ input: "$profile_image",
1899
+ as: "img",
1900
+ in: {
1901
+ _id: "$$img._id",
1902
+ image_url: "$$img.image_url",
1903
+ small_url: "$$img.small_url",
1904
+ thumbnail_url: "$$img.thumbnail_url",
1905
+ name: "$$img.name",
1906
+ ext: "$$img.ext",
1907
+ type: "$$img.type",
1908
+ created_date: "$$img.createdAt",
1909
+ updated_date: "$$img.updatedAt",
1910
+ is_deleted: "$$img.is_deleted",
1911
+ entity: "$$img.entity",
1912
+ doc_ref: "$$img.doc_ref",
1913
+ _original: "$$img._original"
1914
+ }
1915
+ }
1916
+ }
1917
+ }
1918
+ };
1919
+ pipeline.push(transformMedia);
1920
+ if (fieldPath) {
1921
+ pipeline.push(addVisibleFields);
1922
+ }
1923
+ return pipeline;
1924
+ };
1925
+ const _normalizeField = (fields, currentPath = "", ignorePaths = []) => {
1926
+ if (_.isEmpty(fields))
1927
+ return [];
1928
+ const normalizedFields = [];
1929
+ for (const field of fields.filter(f => f.type === "options")) {
1930
+ if (_.get(field, "multiple", false) ||
1931
+ _.get(field, "fields_options_type") === "tags")
1932
+ continue;
1933
+ const fieldPath = _.isEmpty(currentPath)
1934
+ ? field.name
1935
+ : `${currentPath}.${field.name}`;
1936
+ if (ignorePaths.includes(fieldPath) || field.name === "ext") {
1937
+ continue;
1938
+ }
1939
+ normalizedFields.push({
1940
+ $addFields: {
1941
+ [fieldPath]: {
1942
+ $cond: [
1943
+ { $isArray: `$${fieldPath}` },
1944
+ { $arrayElemAt: [`$${fieldPath}`, 0] },
1945
+ `$${fieldPath}`
1946
+ ]
1947
+ }
1948
+ }
1949
+ });
1950
+ }
1951
+ return normalizedFields;
1952
+ };
1953
+ const buildNestedLookups = async (pipeline, relateFieldNames, entityName, requestedFieldNames = [], currentPath = "", level = 0, visitedEntities = new Set(), customPopulate = false, originalRequestedFieldNames = [], maxLevel = 1) => {
1954
+ if (level > maxLevel)
1955
+ return;
1956
+ const entity = await _loadEntity(entityName);
1957
+ if (!entity || !entity.fields)
1958
+ return;
1959
+ const relatedFields = ["related", "image", "map", "file"];
1960
+ const needMapEntities = ["image", "map", "file"];
1961
+ const normalizedFields = _normalizeField(entity.fields, currentPath);
1962
+ pipeline.push(...normalizedFields);
1963
+ const availableFieldNames = entity.fields
1964
+ .filter(f => relatedFields.includes(f.type))
1965
+ .map(f => f.name);
1966
+ const fieldsToPopulate = customPopulate && requestedFieldNames.length > 0
1967
+ ? getFieldsToPopulate(availableFieldNames, requestedFieldNames)
1968
+ : availableFieldNames;
1969
+ const relateFields = entity.fields.filter(f => relatedFields.includes(f.type) &&
1970
+ (requestedFieldNames.length === 0 || fieldsToPopulate.includes(f.name)));
1971
+ for (const field of relateFields) {
1972
+ const fieldPath = currentPath ? `${currentPath}.${field.name}` : field.name;
1973
+ const targetEntityPath = `${fieldPath}.${field.related_ref}`;
1974
+ if (!needMapEntities.includes(field.type) &&
1975
+ visitedEntities.has(targetEntityPath)) {
1976
+ continue;
1977
+ }
1978
+ try {
1979
+ relateFieldNames.push(fieldPath);
1980
+ const collectionName = needMapEntities.includes(field.type)
1981
+ ? getCollectionName(mapEntity(field.type))
1982
+ : getCollectionName(field.related_ref);
1983
+ pipeline.push({
1984
+ $lookup: {
1985
+ from: collectionName,
1986
+ localField: fieldPath,
1987
+ foreignField: "_id",
1988
+ as: fieldPath
1989
+ }
1990
+ });
1991
+ const relatedType = field.related_type || _.get(field, "options.related_type");
1992
+ if (relatedType === "one2one") {
1993
+ pipeline.push({
1994
+ $addFields: { [fieldPath]: { $arrayElemAt: [`$${fieldPath}`, 0] } }
1995
+ });
1996
+ }
1997
+ if (needMapEntities.includes(field.type)) {
1998
+ const transformStage = transformMediaPipeline(fieldPath);
1999
+ pipeline.push(...transformStage);
2000
+ continue;
2001
+ }
2002
+ const nestedFieldsForThisField = requestedFieldNames.filter(f => f.startsWith(`${fieldPath}.`) && f !== `${fieldPath}.*`);
2003
+ const hasNestedProjection = nestedFieldsForThisField.length > 0;
2004
+ const nextLevelFields = hasNestedProjection
2005
+ ? nestedFieldsForThisField
2006
+ .map(f => f.substring(fieldPath.length + 1))
2007
+ .map(f => f.split(".")[0])
2008
+ .filter((f, i, arr) => arr.indexOf(f) === i)
2009
+ : [];
2010
+ const directFields = requestedFieldNames
2011
+ .filter(f => !f.includes(".") || f.split(".").length === 1)
2012
+ .filter(f => f !== "*");
2013
+ const nestedFields = [];
2014
+ for (const field of requestedFieldNames) {
2015
+ if (field.includes(".") && !field.endsWith(".*")) {
2016
+ const parts = field.split(".");
2017
+ if (hasNestedProjection) {
2018
+ for (const part of parts) {
2019
+ if (part !== "*") {
2020
+ nestedFields.push(part);
2021
+ }
2022
+ }
2023
+ }
2024
+ else {
2025
+ const lastPart = parts[parts.length - 1];
2026
+ if (lastPart !== "*") {
2027
+ nestedFields.push(lastPart);
2028
+ }
2029
+ }
2030
+ }
2031
+ }
2032
+ const levelSpecificFields = [...directFields, ...nestedFields].filter((f, i, arr) => arr.indexOf(f) === i);
2033
+ const hasWildcard = requestedFieldNames.includes("*") ||
2034
+ requestedFieldNames.some(f => f.endsWith(".*"));
2035
+ let allowedFields = null;
2036
+ if (hasWildcard) {
2037
+ allowedFields = null;
2038
+ }
2039
+ else if (hasNestedProjection || levelSpecificFields.length > 0) {
2040
+ if (hasNestedProjection) {
2041
+ allowedFields = [...nextLevelFields, ...levelSpecificFields];
2042
+ }
2043
+ else {
2044
+ allowedFields = [...levelSpecificFields];
2045
+ }
2046
+ allowedFields = ["_id", ...allowedFields];
2047
+ }
2048
+ if (relatedType === "one2one") {
2049
+ pipeline.push({
2050
+ $addFields: {
2051
+ [fieldPath]: {
2052
+ $cond: [
2053
+ { $ne: [{ $ifNull: [`$${fieldPath}._id`, null] }, null] },
2054
+ allowedFields !== null
2055
+ ? {
2056
+ $mergeObjects: [
2057
+ ...allowedFields.map(field => ({
2058
+ [field]: `$${fieldPath}.${field}`
2059
+ })),
2060
+ { id: { $toString: `$${fieldPath}._id` } }
2061
+ ]
2062
+ }
2063
+ : {
2064
+ $mergeObjects: [
2065
+ `$${fieldPath}`,
2066
+ { id: { $toString: `$${fieldPath}._id` } }
2067
+ ]
2068
+ },
2069
+ null
2070
+ ]
2071
+ }
2072
+ }
2073
+ });
2074
+ pipeline.push({
2075
+ $addFields: {
2076
+ [fieldPath]: {
2077
+ $cond: [
2078
+ { $ne: [`$${fieldPath}`, null] },
2079
+ {
2080
+ $unsetField: { field: "_search_text", input: `$${fieldPath}` }
2081
+ },
2082
+ null
2083
+ ]
2084
+ }
2085
+ }
2086
+ });
2087
+ }
2088
+ else if (relatedType === "one2many") {
2089
+ pipeline.push({
2090
+ $addFields: {
2091
+ [fieldPath]: {
2092
+ $map: {
2093
+ input: `$${fieldPath}`,
2094
+ as: "item",
2095
+ in: allowedFields !== null
2096
+ ? {
2097
+ $mergeObjects: [
2098
+ ...allowedFields.map(field => ({
2099
+ [field]: `$$item.${field}`
2100
+ })),
2101
+ { id: { $toString: "$$item._id" } }
2102
+ ]
2103
+ }
2104
+ : {
2105
+ $mergeObjects: [
2106
+ "$$item",
2107
+ { id: { $toString: "$$item._id" } }
2108
+ ]
2109
+ }
2110
+ }
2111
+ }
2112
+ }
2113
+ });
2114
+ pipeline.push({
2115
+ $addFields: {
2116
+ [fieldPath]: {
2117
+ $map: {
2118
+ input: `$${fieldPath}`,
2119
+ as: "item",
2120
+ in: {
2121
+ $unsetField: { field: "_search_text", input: "$$item" }
2122
+ }
2123
+ }
2124
+ }
2125
+ }
2126
+ });
2127
+ }
2128
+ const currentFieldPrefix = currentPath
2129
+ ? `${currentPath}.${field.name}`
2130
+ : field.name;
2131
+ const hasMoreNestedRelationships = originalRequestedFieldNames.some(f => {
2132
+ if (!f.startsWith(currentFieldPrefix + "."))
2133
+ return false;
2134
+ if (f === `${currentFieldPrefix}.*`)
2135
+ return false;
2136
+ const remaining = f.substring(currentFieldPrefix.length + 1);
2137
+ const result = remaining.includes(".");
2138
+ return result;
2139
+ });
2140
+ if (hasMoreNestedRelationships) {
2141
+ const newVisitedEntities = new Set(visitedEntities);
2142
+ newVisitedEntities.add(targetEntityPath);
2143
+ const subFieldNames = originalRequestedFieldNames
2144
+ .filter(f => f.startsWith(currentFieldPrefix + "."))
2145
+ .map(f => f.substring(currentFieldPrefix.length + 1));
2146
+ const clonedOriginalRequestedFieldNames = _.cloneDeep(originalRequestedFieldNames);
2147
+ await buildNestedLookups(pipeline, relateFieldNames, field.related_ref, subFieldNames, fieldPath, level + 1, newVisitedEntities, customPopulate, clonedOriginalRequestedFieldNames, maxLevel);
2148
+ }
2149
+ }
2150
+ catch (error) {
2151
+ console.error(`Could not load related entity: ${field.related_ref} at level ${level}`);
2152
+ }
2153
+ }
2154
+ };
2155
+ const buildPopulate = async (doc, entityName, fields) => {
2156
+ if (!fields) {
2157
+ const entity = await _loadEntity(entityName);
2158
+ for (const field of entity.fields.filter(f => ["related", "image", "map", "file"].includes(f.type))) {
2159
+ const populate = {
2160
+ path: field.name,
2161
+ model: ["image", "map", "file"].includes(field.type)
2162
+ ? mapEntity(field.type)
2163
+ : field.related_ref,
2164
+ strictPopulate: false
2165
+ };
2166
+ if (["map", "image", "file"].includes(field.type)) {
2167
+ doc = doc.populate(populate);
2168
+ continue;
2169
+ }
2170
+ const subEntity = await _loadEntity(field.related_ref);
2171
+ for (const subField of subEntity.fields.filter(f => ["related", "image", "map", "file"].includes(f.type))) {
2172
+ if (!populate.populate) {
2173
+ populate.populate = [];
2174
+ }
2175
+ populate.populate.push({
2176
+ path: subField.name,
2177
+ model: ["image", "map", "file"].includes(subField.type)
2178
+ ? mapEntity(subField.type)
2179
+ : subField.related_ref,
2180
+ strictPopulate: false
2181
+ });
2182
+ }
2183
+ doc = doc.populate(populate);
2184
+ }
2185
+ return true;
2186
+ }
2187
+ const exists = CACHE_POPULATE_FIELDS.find(f => f.entity === entityName);
2188
+ if (exists) {
2189
+ if (JSON.stringify(exists.fields) === JSON.stringify(fields)) {
2190
+ for (const pop of exists.populate) {
2191
+ doc = doc.populate(pop);
2192
+ }
2193
+ }
2194
+ }
2195
+ const _buildPopulateSubLevel = async (entityName2, selFields) => {
2196
+ const entity = await _loadEntity(entityName2);
2197
+ const populate2 = [];
2198
+ const keys = _.uniq(selFields.map(f => f.substr(0, f.indexOf("."))));
2199
+ for (const k of keys) {
2200
+ const field = entity.fields.find(f => f.name === k);
2201
+ const pop = {
2202
+ path: k,
2203
+ model: ["image", "map", "file"].includes(field.type)
2204
+ ? mapEntity(field.type)
2205
+ : field.related_ref,
2206
+ strictPopulate: false
2207
+ };
2208
+ const allSubProps = _.cloneDeep(selFields)
2209
+ .filter(f => f.indexOf(`${k}.`) === 0)
2210
+ .map(f => f.replace(`${k}.`, ""))
2211
+ .filter(f => f !== "*");
2212
+ if (allSubProps.length === 0) {
2213
+ populate2.push(pop);
2214
+ continue;
2215
+ }
2216
+ const select = allSubProps.filter(f => f.indexOf(".") === -1 && f !== "*");
2217
+ if (select.length > 0) {
2218
+ pop["select"] = select.join(" ");
2219
+ }
2220
+ if (["image", "map", "file"].includes(field.type)) {
2221
+ populate2.push(pop);
2222
+ continue;
2223
+ }
2224
+ const populate = allSubProps.filter(f => f.indexOf(".") !== -1);
2225
+ if (populate.length > 0) {
2226
+ pop["populate"] = await _buildPopulateSubLevel(field.related_ref, populate);
2227
+ }
2228
+ populate2.push(pop);
2229
+ }
2230
+ return populate2;
2231
+ };
2232
+ const populate = await _buildPopulateSubLevel(entityName, fields.filter(f => /(\.)/gi.test(f)));
2233
+ CACHE_POPULATE_FIELDS.push({
2234
+ entity: entityName,
2235
+ fields,
2236
+ populate
2237
+ });
2238
+ for (const pop of populate) {
2239
+ doc = doc.populate(pop);
2240
+ }
2241
+ };
2242
+ exports.buildPopulate = buildPopulate;
2243
+ const buildAggregate = async (aggregate, entityName, fields, page = 1, pageSize = 10000, sort = "") => {
2244
+ let cloneAggregate = _.cloneDeep(aggregate);
2245
+ const customPopulate = _.isArray(fields) && fields.length > 0 && _.isString(fields[0]);
2246
+ if (_.isPlainObject(cloneAggregate)) {
2247
+ cloneAggregate = [cloneAggregate];
2248
+ }
2249
+ let normalizedFields = [];
2250
+ let includedFields = [];
2251
+ let excludedFields = [];
2252
+ if (typeof fields === "string") {
2253
+ const fieldList = fields.split(",").map(name => name.trim());
2254
+ normalizedFields = fieldList.map(name => ({ name }));
2255
+ includedFields = fieldList.filter(f => !f.startsWith("-"));
2256
+ excludedFields = fieldList
2257
+ .filter(f => f.startsWith("-"))
2258
+ .map(f => f.substring(1));
2259
+ }
2260
+ else if (Array.isArray(fields)) {
2261
+ if (fields.length > 0 && typeof fields[0] === "string") {
2262
+ const trimmedFields = fields.map(name => name.trim());
2263
+ normalizedFields = trimmedFields.map(name => ({ name }));
2264
+ includedFields = trimmedFields.filter(f => !f.startsWith("-"));
2265
+ excludedFields = trimmedFields
2266
+ .filter(f => f.startsWith("-"))
2267
+ .map(f => f.substring(1));
2268
+ }
2269
+ else {
2270
+ normalizedFields = fields;
2271
+ }
2272
+ }
2273
+ if (sort) {
2274
+ cloneAggregate.push({
2275
+ $sort: (0, build_search_1.buildSort)(sort)
2276
+ });
2277
+ }
2278
+ if (page > 0) {
2279
+ cloneAggregate.push({
2280
+ $skip: page
2281
+ });
2282
+ }
2283
+ if (pageSize > 0) {
2284
+ cloneAggregate.push({
2285
+ $limit: pageSize
2286
+ });
2287
+ }
2288
+ let project = {};
2289
+ if (!_.isEmpty(normalizedFields)) {
2290
+ const requestedFieldNames = normalizedFields
2291
+ .map(f => { var _a; return (_a = f.name) === null || _a === void 0 ? void 0 : _a.trim(); })
2292
+ .filter(Boolean);
2293
+ if (requestedFieldNames.length > 0) {
2294
+ const entity = await _loadEntity(entityName);
2295
+ const entityFields = entity && entity.fields ? entity.fields.map(f => f.name) : [];
2296
+ const allAvailableFields = [...entityFields];
2297
+ let fieldsToProject;
2298
+ if (includedFields.includes("*")) {
2299
+ fieldsToProject = allAvailableFields;
2300
+ }
2301
+ else if (includedFields.length > 0) {
2302
+ fieldsToProject = allAvailableFields.filter(field => includedFields.some(pattern => pattern === field ||
2303
+ (pattern.endsWith(".*") && field === pattern.slice(0, -2)) ||
2304
+ field.startsWith(pattern.replace(".*", "."))));
2305
+ }
2306
+ else {
2307
+ fieldsToProject = allAvailableFields;
2308
+ }
2309
+ if (excludedFields.length > 0) {
2310
+ fieldsToProject = fieldsToProject.filter(field => !excludedFields.some(pattern => pattern === field ||
2311
+ (pattern.endsWith(".*") && field === pattern.slice(0, -2)) ||
2312
+ field.startsWith(pattern.replace(".*", "."))));
2313
+ }
2314
+ const projectSelected = {
2315
+ $project: Object.assign({ _translates: 1 }, fieldsToProject.reduce((acc, name) => {
2316
+ acc[name] = 1;
2317
+ return acc;
2318
+ }, { _id: 1 }))
2319
+ };
2320
+ const nestedFields = includedFields.filter(f => f.includes("."));
2321
+ const nestedRootFields = [
2322
+ ...new Set(nestedFields.map(f => f.split(".")[0]))
2323
+ ];
2324
+ nestedRootFields.forEach(rootField => {
2325
+ projectSelected.$project[rootField] = 1;
2326
+ });
2327
+ includedFields.forEach(pattern => {
2328
+ if (pattern.includes(".") && pattern.endsWith(".*")) {
2329
+ const rootField = pattern.split(".")[0];
2330
+ if (!excludedFields.includes(rootField)) {
2331
+ projectSelected.$project[rootField] = 1;
2332
+ }
2333
+ }
2334
+ });
2335
+ project = projectSelected;
2336
+ }
2337
+ }
2338
+ const entity = await _loadEntity(entityName);
2339
+ if (entity && entity.fields) {
2340
+ const entityNormalizedFields = _normalizeField(entity.fields, "");
2341
+ cloneAggregate.push(...entityNormalizedFields);
2342
+ const initialVisitedEntities = new Set();
2343
+ initialVisitedEntities.add(entityName);
2344
+ const relateFieldNames = [];
2345
+ let requestedFieldNames = [];
2346
+ if (!_.isEmpty(includedFields)) {
2347
+ const needMapEntities = ["image", "map", "file"];
2348
+ requestedFieldNames = includedFields.map(f => {
2349
+ const fieldDef = entity.fields.find(field => field.name === f);
2350
+ if (fieldDef && needMapEntities.includes(fieldDef.type)) {
2351
+ return `_keepPopulate(${f})`;
2352
+ }
2353
+ return f;
2354
+ });
2355
+ }
2356
+ else {
2357
+ requestedFieldNames = [];
2358
+ }
2359
+ const maxLevel = _.max(requestedFieldNames.map(f => f.split(".").length - 1)) || 1;
2360
+ const originalRequestedFieldNames = _.cloneDeep(requestedFieldNames);
2361
+ await buildNestedLookups(cloneAggregate, relateFieldNames, entityName, requestedFieldNames, "", 0, initialVisitedEntities, customPopulate, originalRequestedFieldNames, maxLevel);
2362
+ if (project && typeof project === "object" && "$project" in project) {
2363
+ const projectStage = project;
2364
+ const filteredRelateFieldNames = relateFieldNames.filter(fieldPath => {
2365
+ return !relateFieldNames.some(otherPath => otherPath !== fieldPath && otherPath.startsWith(fieldPath + "."));
2366
+ });
2367
+ Object.keys(projectStage.$project).forEach(existingField => {
2368
+ const conflictingRelateField = filteredRelateFieldNames.find(relateField => relateField !== existingField &&
2369
+ relateField.startsWith(existingField + "."));
2370
+ if (conflictingRelateField) {
2371
+ delete projectStage.$project[existingField];
2372
+ }
2373
+ });
2374
+ filteredRelateFieldNames.forEach(fieldPath => {
2375
+ const fieldName = fieldPath.split('.')[0];
2376
+ if (!excludedFields.includes(fieldName)) {
2377
+ projectStage.$project[fieldPath] = 1;
2378
+ }
2379
+ });
2380
+ }
2381
+ }
2382
+ if (entityName === "attachment") {
2383
+ const transformStage = transformMediaPipeline("");
2384
+ cloneAggregate.push(...transformStage);
2385
+ project = {
2386
+ $project: {
2387
+ _id: 1,
2388
+ image_url: 1,
2389
+ small_url: 1,
2390
+ thumbnail_url: 1,
2391
+ name: 1,
2392
+ ext: 1,
2393
+ type: 1,
2394
+ created_date: 1,
2395
+ updated_date: 1,
2396
+ is_deleted: 1,
2397
+ entity: 1,
2398
+ doc_ref: 1,
2399
+ _original: 1,
2400
+ file_size: 1
2401
+ }
2402
+ };
2403
+ }
2404
+ if (!_.isEmpty(project)) {
2405
+ cloneAggregate.push(project);
2406
+ }
2407
+ cloneAggregate.push({
2408
+ $addFields: {
2409
+ id: {
2410
+ $toString: "$_id"
2411
+ }
2412
+ }
2413
+ });
2414
+ cloneAggregate.push({
2415
+ $unset: ["_search_text"]
2416
+ });
2417
+ return cloneAggregate;
2418
+ };
2419
+ exports.buildAggregate = buildAggregate;
2420
+ const buildAggregateCount = (pipeline) => {
2421
+ const clonePipeline = _.cloneDeep(pipeline);
2422
+ clonePipeline.push({
2423
+ $group: {
2424
+ _id: null,
2425
+ count: { $sum: 1 }
2426
+ }
2427
+ });
2428
+ return clonePipeline;
2429
+ };
2430
+ exports.buildAggregateCount = buildAggregateCount;
2431
+ const buildPopulateWithLayout = async (doc, fields, isDetail) => {
2432
+ for (const field of fields.filter(f => ["related", "image", "map", "file"].includes(f.type))) {
2433
+ const populate = {
2434
+ path: field.name,
2435
+ model: ["image", "map", "file"].includes(field.type)
2436
+ ? mapEntity(field.type)
2437
+ : field.related_ref,
2438
+ strictPopulate: false
2439
+ };
2440
+ if (["map", "image", "file"].includes(field.type)) {
2441
+ doc = doc.populate(populate);
2442
+ continue;
2443
+ }
2444
+ const subEntity = await _loadEntity(field.related_ref);
2445
+ const subLayout = subEntity.layouts.find(i => i.code === "default");
2446
+ if (!subLayout) {
2447
+ continue;
2448
+ }
2449
+ const subFields = isDetail
2450
+ ? (0, layout_1.flatDetailLayout)(subEntity, subLayout, subEntity.fields)
2451
+ : (0, layout_1.flatListLayout)(subLayout, subEntity.fields);
2452
+ for (const subField of subFields.filter(f => ["related", "image", "map", "file"].includes(f.type))) {
2453
+ if (!populate.populate) {
2454
+ populate.populate = [];
2455
+ }
2456
+ populate.populate.push({
2457
+ path: subField.name,
2458
+ model: ["image", "map", "file"].includes(subField.type)
2459
+ ? mapEntity(subField.type)
2460
+ : subField.related_ref,
2461
+ strictPopulate: false
2462
+ });
2463
+ }
2464
+ doc = doc.populate(populate);
2465
+ }
2466
+ };
2467
+ exports.buildPopulateWithLayout = buildPopulateWithLayout;
2468
+ const hasRelationFilter = (filters, fields) => {
2469
+ if (_.isEmpty(fields))
2470
+ return false;
2471
+ const filterStr = JSON.stringify(filters);
2472
+ const relatedFieldNames = fields
2473
+ .filter(f => f.type === "related")
2474
+ .map(f => f.name);
2475
+ return relatedFieldNames.some(f => filterStr.includes(`"${f}.`));
2476
+ };
2477
+ exports.hasRelationFilter = hasRelationFilter;
2478
+ const listRelateSchema = async (entity) => {
2479
+ const entities = [];
2480
+ if (_.get(entity, "layouts.0.list")) {
2481
+ for (const field of (0, layout_1.flatListLayout)(entity.layouts[0], entity.fields).filter(i => i.type === "related")) {
2482
+ entities.push(field.related_ref);
2483
+ try {
2484
+ const relateEntity = await _loadEntity(field.related_ref);
2485
+ for (const field of relateEntity.fields.filter(i => i.type === "related")) {
2486
+ entities.push(field.related_ref);
2487
+ }
2488
+ }
2489
+ catch (e) { }
2490
+ }
2491
+ }
2492
+ if (_.get(entity, "layouts.0.detail")) {
2493
+ for (const field of (0, layout_1.flatDetailLayout)(entity, entity.layouts[0], entity.fields).filter(i => i.type === "related")) {
2494
+ entities.push(field.related_ref);
2495
+ try {
2496
+ const relateEntity = await _loadEntity(field.related_ref);
2497
+ for (const field of relateEntity.fields.filter(i => i.type === "related")) {
2498
+ entities.push(field.related_ref);
2499
+ }
2500
+ }
2501
+ catch (e) { }
2502
+ }
2503
+ }
2504
+ const uniqueEntitiesName = _.uniq(entities);
2505
+ const uniqueEntities = [];
2506
+ for (const name of uniqueEntitiesName) {
2507
+ const en = await _loadEntity(name);
2508
+ uniqueEntities.push(en);
2509
+ }
2510
+ return uniqueEntities.filter(i => i);
2511
+ };
2512
+ exports.listRelateSchema = listRelateSchema;
2513
+ const saveReasons = async (entity, id, reasons) => {
2514
+ for (const reason of reasons || []) {
2515
+ if (_.isEmpty(reason.value))
2516
+ continue;
2517
+ await createReasonData({
2518
+ entity: {
2519
+ id: entity.id || entity._id
2520
+ },
2521
+ doc_ref: id,
2522
+ reason: {
2523
+ id: reason.id
2524
+ },
2525
+ options: reason.value,
2526
+ comment: reason.comment
2527
+ });
2528
+ }
2529
+ };
2530
+ exports.saveReasons = saveReasons;
2531
+ const autoWorkflow = async (data, entity, reasons, request) => {
2532
+ const startProcessTime = new Date();
2533
+ const field = _.get(entity, "workflows.field");
2534
+ if (!field) {
2535
+ return data;
2536
+ }
2537
+ const schemaUser = await _loadSchema("user");
2538
+ let flow;
2539
+ const flows = _.get(entity, "workflows.flows", []);
2540
+ for (const i of flows) {
2541
+ if (i.is_auto && i.from === _.get(data, `${field}`)) {
2542
+ const checkWork = await (0, permission_1.checkWorkflowCondition)(entity, i, data, { _system: true }, schemaUser);
2543
+ if (checkWork) {
2544
+ flow = _.cloneDeep(i);
2545
+ break;
2546
+ }
2547
+ }
2548
+ }
2549
+ if (!flow) {
2550
+ return data;
2551
+ }
2552
+ data["id"] = data["_id"] || data["id"];
2553
+ const updateData = { id: data["id"] };
2554
+ const currentState = _.cloneDeep(_.get(data, `${field}`));
2555
+ data[field] = [flow.to];
2556
+ updateData[field] = data[field];
2557
+ if (flow.date_tracking_field) {
2558
+ data[flow.date_tracking_field] = new Date();
2559
+ updateData[flow.date_tracking_field] = data[flow.date_tracking_field];
2560
+ }
2561
+ await callBulkUpdateInternalService(_.snakeCase(entity.name), [updateData]);
2562
+ const res = await callGetInternalService(_.snakeCase(entity.name), data["id"]);
2563
+ const workflowMessage = getWorkflowLogMessage(entity, request, currentState, flow.to);
2564
+ addActivityLog(entity, request, { id: data.id }, activity_log_enum_1.ActivityLogType.workflow, activity_log_enum_1.ActivityLogAction.approved, activity_log_enum_1.ActivityLogStatus.successfully, startProcessTime, new Date(), _.get(workflowMessage, "message", ""), _.get(workflowMessage, "description", ""));
2565
+ if (reasons &&
2566
+ flow.required_reason &&
2567
+ flow.reason_ref &&
2568
+ !_.isEmpty(flow.default_reason)) {
2569
+ const reason = await callGetInternalService("reason_master", `${flow.reason_ref}`);
2570
+ reasons.push({
2571
+ id: flow.reason_ref,
2572
+ value: flow.default_reason
2573
+ .map(i => {
2574
+ const exist = reason["options"].find(j => j._id === i);
2575
+ return exist ? { name: exist.name, code: exist.code } : null;
2576
+ })
2577
+ .filter(i => i),
2578
+ comment: flow.default_reason_comment
2579
+ });
2580
+ }
2581
+ if (_.get(flow, "executions.length") > 0) {
2582
+ for (const ex of flow.executions.filter(i => i.enabled)) {
2583
+ try {
2584
+ await (0, executions_1.internalExecution)(ex, res, entity);
2585
+ }
2586
+ catch (e) {
2587
+ common_1.Logger.error(e);
2588
+ }
2589
+ }
2590
+ }
2591
+ await (0, hook_1.executeHooks)(entity, "workflow", "after", {
2592
+ headers: _.get(request, "headers", {}),
2593
+ body: _.get(request, "body", {}),
2594
+ profile: _.get(request, "profile", {})
2595
+ }, res);
2596
+ return await autoWorkflow(res, entity, reasons, request);
2597
+ };
2598
+ exports.autoWorkflow = autoWorkflow;
2599
+ const cleanUpSaveData = async (entity, data) => {
2600
+ delete data.id;
2601
+ delete data._id;
2602
+ for (const key of Object.keys(data)) {
2603
+ if (!_.isArray(data[key]) &&
2604
+ _.isPlainObject(data[key]) &&
2605
+ _.isEmpty(data[key])) {
2606
+ data[key] = undefined;
2607
+ }
2608
+ }
2609
+ const fields = entity.fields.map(f => f.name);
2610
+ return _.pick(data, [...fields, "__v"]);
2611
+ };
2612
+ exports.cleanUpSaveData = cleanUpSaveData;
2613
+ const getWorkflowLogMessage = (entity, request, currentState, targetState) => {
2614
+ const workflowField = entity.fields.find(f => f.name === entity.workflows.field);
2615
+ const lang = _.get(request, "headers.accept-language", "en-US");
2616
+ const workFlowTranslate = _.get(entity, `workflows._translate.${lang}.options_values`, []);
2617
+ const fromIndex = _.get(workflowField, "values", []).findIndex(val => val === currentState);
2618
+ const toIndex = _.get(workflowField, "values", []).findIndex(val => val === targetState);
2619
+ const from = workFlowTranslate[fromIndex] || currentState;
2620
+ const to = workFlowTranslate[toIndex] || targetState;
2621
+ const message = `<span>Changed status to <strong>${to}</strong></span>`;
2622
+ const description = `<span>Changed status from <strong>${from}</strong> to <strong>${to}</strong> </span>`;
2623
+ return {
2624
+ message,
2625
+ description
2626
+ };
2627
+ };
2628
+ exports.getWorkflowLogMessage = getWorkflowLogMessage;
2629
+ //# sourceMappingURL=schema.js.map