@cyberskill/shared 2.28.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/dist/config/commitlint/index.js +1 -0
  2. package/dist/config/commitlint/index.js.map +1 -0
  3. package/dist/config/config.test.unit.d.ts +1 -0
  4. package/dist/config/config.type.js +1 -0
  5. package/dist/config/config.type.js.map +1 -0
  6. package/dist/config/config.type.test.unit.d.ts +1 -0
  7. package/dist/config/config.util.js +25 -33
  8. package/dist/config/config.util.js.map +1 -0
  9. package/dist/config/env/env.constant.js +1 -0
  10. package/dist/config/env/env.constant.js.map +1 -0
  11. package/dist/config/env/env.util.js +1 -0
  12. package/dist/config/env/env.util.js.map +1 -0
  13. package/dist/config/env/index.js +1 -0
  14. package/dist/config/env/index.js.map +1 -0
  15. package/dist/config/eslint/index.d.ts +4 -0
  16. package/dist/config/eslint/index.js +5 -12
  17. package/dist/config/eslint/index.js.map +1 -0
  18. package/dist/config/graphql-codegen/graphql-codegen.util.js +29 -33
  19. package/dist/config/graphql-codegen/graphql-codegen.util.js.map +1 -0
  20. package/dist/config/graphql-codegen/index.js +1 -0
  21. package/dist/config/graphql-codegen/index.js.map +1 -0
  22. package/dist/config/index.js +1 -0
  23. package/dist/config/index.js.map +1 -0
  24. package/dist/config/lint-staged/index.js +1 -0
  25. package/dist/config/lint-staged/index.js.map +1 -0
  26. package/dist/config/storybook/index.js +1 -0
  27. package/dist/config/storybook/index.js.map +1 -0
  28. package/dist/config/storybook/storybook.main.js +1 -0
  29. package/dist/config/storybook/storybook.main.js.map +1 -0
  30. package/dist/config/storybook/storybook.preview.js +11 -13
  31. package/dist/config/storybook/storybook.preview.js.map +1 -0
  32. package/dist/config/vitest/index.js +1 -0
  33. package/dist/config/vitest/index.js.map +1 -0
  34. package/dist/config/vitest/vitest.e2e.js +2 -1
  35. package/dist/config/vitest/vitest.e2e.js.map +1 -0
  36. package/dist/config/vitest/vitest.unit.js +20 -8
  37. package/dist/config/vitest/vitest.unit.js.map +1 -0
  38. package/dist/constant/common.js +2 -1
  39. package/dist/constant/common.js.map +1 -0
  40. package/dist/constant/constant.test.unit.d.ts +1 -0
  41. package/dist/constant/index.js +1 -0
  42. package/dist/constant/index.js.map +1 -0
  43. package/dist/constant/response-status.js +1 -0
  44. package/dist/constant/response-status.js.map +1 -0
  45. package/dist/node/apollo-server/apollo-server.util.js +22 -48
  46. package/dist/node/apollo-server/apollo-server.util.js.map +1 -0
  47. package/dist/node/apollo-server/index.js +1 -0
  48. package/dist/node/apollo-server/index.js.map +1 -0
  49. package/dist/node/cli/index.js +110 -165
  50. package/dist/node/cli/index.js.map +1 -0
  51. package/dist/node/command/command.test.unit.d.ts +1 -0
  52. package/dist/node/command/command.type.js +1 -0
  53. package/dist/node/command/command.type.js.map +1 -0
  54. package/dist/node/command/command.util.js +142 -169
  55. package/dist/node/command/command.util.js.map +1 -0
  56. package/dist/node/command/index.js +1 -0
  57. package/dist/node/command/index.js.map +1 -0
  58. package/dist/node/express/express.type.d.ts +4 -0
  59. package/dist/node/express/express.util.js +56 -71
  60. package/dist/node/express/express.util.js.map +1 -0
  61. package/dist/node/express/index.js +1 -0
  62. package/dist/node/express/index.js.map +1 -0
  63. package/dist/node/fs/fs.test.unit.d.ts +1 -0
  64. package/dist/node/fs/fs.util.js +46 -60
  65. package/dist/node/fs/fs.util.js.map +1 -0
  66. package/dist/node/fs/index.js +1 -0
  67. package/dist/node/fs/index.js.map +1 -0
  68. package/dist/node/log/index.js +1 -0
  69. package/dist/node/log/index.js.map +1 -0
  70. package/dist/node/log/log.test.unit.d.ts +1 -0
  71. package/dist/node/log/log.type.js +1 -0
  72. package/dist/node/log/log.type.js.map +1 -0
  73. package/dist/node/log/log.util.js +30 -30
  74. package/dist/node/log/log.util.js.map +1 -0
  75. package/dist/node/mongo/index.d.ts +2 -0
  76. package/dist/node/mongo/index.js +21 -12
  77. package/dist/node/mongo/index.js.map +1 -0
  78. package/dist/node/mongo/mongo.constant.js +1 -0
  79. package/dist/node/mongo/mongo.constant.js.map +1 -0
  80. package/dist/node/mongo/mongo.controller.d.ts +5 -315
  81. package/dist/node/mongo/mongo.controller.mongoose.d.ts +234 -0
  82. package/dist/node/mongo/mongo.controller.mongoose.js +468 -0
  83. package/dist/node/mongo/mongo.controller.mongoose.js.map +1 -0
  84. package/dist/node/mongo/mongo.controller.native.d.ts +84 -0
  85. package/dist/node/mongo/mongo.controller.native.js +214 -0
  86. package/dist/node/mongo/mongo.controller.native.js.map +1 -0
  87. package/dist/node/mongo/mongo.dynamic-populate.d.ts +61 -0
  88. package/dist/node/mongo/mongo.dynamic-populate.js +197 -0
  89. package/dist/node/mongo/mongo.dynamic-populate.js.map +1 -0
  90. package/dist/node/mongo/mongo.populate.d.ts +15 -0
  91. package/dist/node/mongo/mongo.populate.js +269 -0
  92. package/dist/node/mongo/mongo.populate.js.map +1 -0
  93. package/dist/node/mongo/mongo.type.js +1 -0
  94. package/dist/node/mongo/mongo.type.js.map +1 -0
  95. package/dist/node/mongo/mongo.util.d.ts +52 -0
  96. package/dist/node/mongo/mongo.util.js +111 -409
  97. package/dist/node/mongo/mongo.util.js.map +1 -0
  98. package/dist/node/package/index.js +1 -0
  99. package/dist/node/package/index.js.map +1 -0
  100. package/dist/node/package/package.test.unit.d.ts +1 -0
  101. package/dist/node/package/package.type.js +1 -0
  102. package/dist/node/package/package.type.js.map +1 -0
  103. package/dist/node/package/package.util.js +197 -226
  104. package/dist/node/package/package.util.js.map +1 -0
  105. package/dist/node/path/index.js +27 -25
  106. package/dist/node/path/index.js.map +1 -0
  107. package/dist/node/path/path.constant.d.ts +2 -0
  108. package/dist/node/path/path.constant.js +131 -150
  109. package/dist/node/path/path.constant.js.map +1 -0
  110. package/dist/node/path/path.util.js +1 -0
  111. package/dist/node/path/path.util.js.map +1 -0
  112. package/dist/node/storage/index.js +1 -0
  113. package/dist/node/storage/index.js.map +1 -0
  114. package/dist/node/storage/storage.constant.js +1 -0
  115. package/dist/node/storage/storage.constant.js.map +1 -0
  116. package/dist/node/storage/storage.util.js +111 -158
  117. package/dist/node/storage/storage.util.js.map +1 -0
  118. package/dist/node/upload/index.js +1 -0
  119. package/dist/node/upload/index.js.map +1 -0
  120. package/dist/node/upload/upload.constant.js +1 -0
  121. package/dist/node/upload/upload.constant.js.map +1 -0
  122. package/dist/node/upload/upload.type.js +1 -0
  123. package/dist/node/upload/upload.type.js.map +1 -0
  124. package/dist/node/upload/upload.util.js +120 -150
  125. package/dist/node/upload/upload.util.js.map +1 -0
  126. package/dist/node/ws/index.d.ts +1 -1
  127. package/dist/node/ws/index.js +2 -1
  128. package/dist/node/ws/index.js.map +1 -0
  129. package/dist/node/ws/ws.util.js +46 -0
  130. package/dist/node/ws/ws.util.js.map +1 -0
  131. package/dist/node_modules/.pnpm/{vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.18_@types_node@25.3.3_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +1 -0
  132. package/dist/node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.3_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js.map +1 -0
  133. package/dist/react/apollo-client/apollo-client.component.js +5 -4
  134. package/dist/react/apollo-client/apollo-client.component.js.map +1 -0
  135. package/dist/react/apollo-client/apollo-client.constant.js +1 -0
  136. package/dist/react/apollo-client/apollo-client.constant.js.map +1 -0
  137. package/dist/react/apollo-client/apollo-client.context.js +1 -0
  138. package/dist/react/apollo-client/apollo-client.context.js.map +1 -0
  139. package/dist/react/apollo-client/apollo-client.module.scss.js +1 -0
  140. package/dist/react/apollo-client/apollo-client.module.scss.js.map +1 -0
  141. package/dist/react/apollo-client/apollo-client.util.js +52 -58
  142. package/dist/react/apollo-client/apollo-client.util.js.map +1 -0
  143. package/dist/react/apollo-client/index.js +1 -0
  144. package/dist/react/apollo-client/index.js.map +1 -0
  145. package/dist/react/apollo-client/links/index.js +1 -0
  146. package/dist/react/apollo-client/links/index.js.map +1 -0
  147. package/dist/react/apollo-client/links/upload.js +72 -74
  148. package/dist/react/apollo-client/links/upload.js.map +1 -0
  149. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +1 -0
  150. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js.map +1 -0
  151. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js +1 -0
  152. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js.map +1 -0
  153. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js +12 -18
  154. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.js.map +1 -0
  155. package/dist/react/apollo-client-nextjs/index.js +1 -0
  156. package/dist/react/apollo-client-nextjs/index.js.map +1 -0
  157. package/dist/react/apollo-error/apollo-error.component.js +62 -23
  158. package/dist/react/apollo-error/apollo-error.component.js.map +1 -0
  159. package/dist/react/apollo-error/apollo-error.context.js +1 -0
  160. package/dist/react/apollo-error/apollo-error.context.js.map +1 -0
  161. package/dist/react/apollo-error/apollo-error.hook.js +1 -0
  162. package/dist/react/apollo-error/apollo-error.hook.js.map +1 -0
  163. package/dist/react/apollo-error/apollo-error.module.scss.js +7 -6
  164. package/dist/react/apollo-error/apollo-error.module.scss.js.map +1 -0
  165. package/dist/react/apollo-error/apollo-error.provider.js +1 -0
  166. package/dist/react/apollo-error/apollo-error.provider.js.map +1 -0
  167. package/dist/react/apollo-error/apollo-error.test.unit.d.ts +1 -0
  168. package/dist/react/apollo-error/apollo-error.util.js +7 -6
  169. package/dist/react/apollo-error/apollo-error.util.js.map +1 -0
  170. package/dist/react/apollo-error/index.js +1 -0
  171. package/dist/react/apollo-error/index.js.map +1 -0
  172. package/dist/react/i18next/i18next.hook.js +1 -0
  173. package/dist/react/i18next/i18next.hook.js.map +1 -0
  174. package/dist/react/i18next/i18next.util.js +1 -0
  175. package/dist/react/i18next/i18next.util.js.map +1 -0
  176. package/dist/react/i18next/index.js +1 -0
  177. package/dist/react/i18next/index.js.map +1 -0
  178. package/dist/react/loading/index.js +1 -0
  179. package/dist/react/loading/index.js.map +1 -0
  180. package/dist/react/loading/loading.component.js +31 -46
  181. package/dist/react/loading/loading.component.js.map +1 -0
  182. package/dist/react/loading/loading.context.js +1 -0
  183. package/dist/react/loading/loading.context.js.map +1 -0
  184. package/dist/react/loading/loading.hook.js +1 -0
  185. package/dist/react/loading/loading.hook.js.map +1 -0
  186. package/dist/react/loading/loading.module.scss.js +1 -0
  187. package/dist/react/loading/loading.module.scss.js.map +1 -0
  188. package/dist/react/loading/loading.provider.js +1 -0
  189. package/dist/react/loading/loading.provider.js.map +1 -0
  190. package/dist/react/log/index.js +1 -0
  191. package/dist/react/log/index.js.map +1 -0
  192. package/dist/react/log/log.util.js +5 -4
  193. package/dist/react/log/log.util.js.map +1 -0
  194. package/dist/react/next-intl/index.js +1 -0
  195. package/dist/react/next-intl/index.js.map +1 -0
  196. package/dist/react/next-intl/next-intl.constant.js +1 -0
  197. package/dist/react/next-intl/next-intl.constant.js.map +1 -0
  198. package/dist/react/next-intl/next-intl.context.js +1 -0
  199. package/dist/react/next-intl/next-intl.context.js.map +1 -0
  200. package/dist/react/next-intl/next-intl.hoc.js +14 -22
  201. package/dist/react/next-intl/next-intl.hoc.js.map +1 -0
  202. package/dist/react/next-intl/next-intl.hook.js +1 -0
  203. package/dist/react/next-intl/next-intl.hook.js.map +1 -0
  204. package/dist/react/next-intl/next-intl.provider.js +8 -7
  205. package/dist/react/next-intl/next-intl.provider.js.map +1 -0
  206. package/dist/react/storage/index.js +1 -0
  207. package/dist/react/storage/index.js.map +1 -0
  208. package/dist/react/storage/storage.hook.js +44 -59
  209. package/dist/react/storage/storage.hook.js.map +1 -0
  210. package/dist/react/storage/storage.test.unit.d.ts +1 -0
  211. package/dist/react/storage/storage.util.js +29 -53
  212. package/dist/react/storage/storage.util.js.map +1 -0
  213. package/dist/react/toast/index.js +1 -0
  214. package/dist/react/toast/index.js.map +1 -0
  215. package/dist/react/userback/index.js +1 -0
  216. package/dist/react/userback/index.js.map +1 -0
  217. package/dist/react/userback/userback.component.js +19 -42
  218. package/dist/react/userback/userback.component.js.map +1 -0
  219. package/dist/style.css +1 -1
  220. package/dist/typescript/common.type.js +1 -0
  221. package/dist/typescript/common.type.js.map +1 -0
  222. package/dist/typescript/index.js +1 -0
  223. package/dist/typescript/index.js.map +1 -0
  224. package/dist/typescript/typescript.test.unit.d.ts +1 -0
  225. package/dist/util/common/common.util.d.ts +2 -0
  226. package/dist/util/common/common.util.js +30 -37
  227. package/dist/util/common/common.util.js.map +1 -0
  228. package/dist/util/common/index.js +1 -0
  229. package/dist/util/common/index.js.map +1 -0
  230. package/dist/util/index.js +11 -9
  231. package/dist/util/index.js.map +1 -0
  232. package/dist/util/object/index.js +1 -0
  233. package/dist/util/object/index.js.map +1 -0
  234. package/dist/util/object/object.util.js +73 -76
  235. package/dist/util/object/object.util.js.map +1 -0
  236. package/dist/util/serializer/index.js +1 -0
  237. package/dist/util/serializer/index.js.map +1 -0
  238. package/dist/util/serializer/serializer.util.js +1 -0
  239. package/dist/util/serializer/serializer.util.js.map +1 -0
  240. package/dist/util/string/index.js +5 -3
  241. package/dist/util/string/index.js.map +1 -0
  242. package/dist/util/string/string.util.d.ts +12 -0
  243. package/dist/util/string/string.util.js +64 -44
  244. package/dist/util/string/string.util.js.map +1 -0
  245. package/dist/util/validate/index.js +1 -0
  246. package/dist/util/validate/index.js.map +1 -0
  247. package/dist/util/validate/validate.util.js +1 -0
  248. package/dist/util/validate/validate.util.js.map +1 -0
  249. package/package.json +76 -96
  250. package/public/tsconfig.base.json +7 -3
  251. package/README.md +0 -470
  252. package/dist/config/commitlint/index.cjs +0 -1
  253. package/dist/config/config.type.cjs +0 -1
  254. package/dist/config/config.util.cjs +0 -1
  255. package/dist/config/env/env.constant.cjs +0 -1
  256. package/dist/config/env/env.util.cjs +0 -1
  257. package/dist/config/env/index.cjs +0 -1
  258. package/dist/config/eslint/index.cjs +0 -1
  259. package/dist/config/graphql-codegen/graphql-codegen.util.cjs +0 -1
  260. package/dist/config/graphql-codegen/index.cjs +0 -1
  261. package/dist/config/index.cjs +0 -1
  262. package/dist/config/lint-staged/index.cjs +0 -1
  263. package/dist/config/storybook/index.cjs +0 -1
  264. package/dist/config/storybook/storybook.main.cjs +0 -1
  265. package/dist/config/storybook/storybook.preview.cjs +0 -1
  266. package/dist/config/vitest/index.cjs +0 -1
  267. package/dist/config/vitest/vitest.e2e.cjs +0 -1
  268. package/dist/config/vitest/vitest.unit.cjs +0 -1
  269. package/dist/constant/common.cjs +0 -1
  270. package/dist/constant/index.cjs +0 -1
  271. package/dist/constant/response-status.cjs +0 -1
  272. package/dist/node/apollo-server/apollo-server.util.cjs +0 -1
  273. package/dist/node/apollo-server/index.cjs +0 -1
  274. package/dist/node/cli/index.cjs +0 -3
  275. package/dist/node/command/command.type.cjs +0 -1
  276. package/dist/node/command/command.util.cjs +0 -2
  277. package/dist/node/command/index.cjs +0 -1
  278. package/dist/node/express/express.util.cjs +0 -1
  279. package/dist/node/express/index.cjs +0 -1
  280. package/dist/node/fs/fs.util.cjs +0 -4
  281. package/dist/node/fs/index.cjs +0 -1
  282. package/dist/node/log/index.cjs +0 -1
  283. package/dist/node/log/log.type.cjs +0 -1
  284. package/dist/node/log/log.util.cjs +0 -1
  285. package/dist/node/mongo/index.cjs +0 -1
  286. package/dist/node/mongo/mongo.constant.cjs +0 -1
  287. package/dist/node/mongo/mongo.controller.cjs +0 -1
  288. package/dist/node/mongo/mongo.controller.js +0 -956
  289. package/dist/node/mongo/mongo.type.cjs +0 -1
  290. package/dist/node/mongo/mongo.util.cjs +0 -2
  291. package/dist/node/package/index.cjs +0 -1
  292. package/dist/node/package/package.type.cjs +0 -1
  293. package/dist/node/package/package.util.cjs +0 -1
  294. package/dist/node/path/index.cjs +0 -1
  295. package/dist/node/path/path.constant.cjs +0 -1
  296. package/dist/node/path/path.util.cjs +0 -1
  297. package/dist/node/storage/index.cjs +0 -1
  298. package/dist/node/storage/storage.constant.cjs +0 -1
  299. package/dist/node/storage/storage.util.cjs +0 -1
  300. package/dist/node/upload/index.cjs +0 -1
  301. package/dist/node/upload/upload.constant.cjs +0 -1
  302. package/dist/node/upload/upload.type.cjs +0 -1
  303. package/dist/node/upload/upload.util.cjs +0 -1
  304. package/dist/node/ws/index.cjs +0 -1
  305. package/dist/node/ws/ts.util.cjs +0 -1
  306. package/dist/node/ws/ts.util.js +0 -68
  307. package/dist/node_modules/.pnpm/vitest@4.0.18_@types_node@25.3.0_jiti@2.6.1_jsdom@28.1.0_@noble_hashes@1.8.0__sass@1.97.3_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.cjs +0 -1
  308. package/dist/react/apollo-client/apollo-client.component.cjs +0 -1
  309. package/dist/react/apollo-client/apollo-client.constant.cjs +0 -1
  310. package/dist/react/apollo-client/apollo-client.context.cjs +0 -1
  311. package/dist/react/apollo-client/apollo-client.module.scss.cjs +0 -1
  312. package/dist/react/apollo-client/apollo-client.util.cjs +0 -1
  313. package/dist/react/apollo-client/index.cjs +0 -1
  314. package/dist/react/apollo-client/links/index.cjs +0 -1
  315. package/dist/react/apollo-client/links/upload.cjs +0 -1
  316. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +0 -1
  317. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs +0 -1
  318. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.cjs +0 -1
  319. package/dist/react/apollo-client-nextjs/index.cjs +0 -1
  320. package/dist/react/apollo-error/apollo-error.component.cjs +0 -1
  321. package/dist/react/apollo-error/apollo-error.context.cjs +0 -1
  322. package/dist/react/apollo-error/apollo-error.hook.cjs +0 -1
  323. package/dist/react/apollo-error/apollo-error.module.scss.cjs +0 -1
  324. package/dist/react/apollo-error/apollo-error.provider.cjs +0 -1
  325. package/dist/react/apollo-error/apollo-error.util.cjs +0 -1
  326. package/dist/react/apollo-error/index.cjs +0 -1
  327. package/dist/react/i18next/i18next.hook.cjs +0 -1
  328. package/dist/react/i18next/i18next.util.cjs +0 -1
  329. package/dist/react/i18next/index.cjs +0 -1
  330. package/dist/react/loading/index.cjs +0 -1
  331. package/dist/react/loading/loading.component.cjs +0 -6
  332. package/dist/react/loading/loading.context.cjs +0 -1
  333. package/dist/react/loading/loading.hook.cjs +0 -1
  334. package/dist/react/loading/loading.module.scss.cjs +0 -1
  335. package/dist/react/loading/loading.provider.cjs +0 -1
  336. package/dist/react/log/index.cjs +0 -1
  337. package/dist/react/log/log.util.cjs +0 -1
  338. package/dist/react/next-intl/index.cjs +0 -1
  339. package/dist/react/next-intl/next-intl.constant.cjs +0 -1
  340. package/dist/react/next-intl/next-intl.context.cjs +0 -1
  341. package/dist/react/next-intl/next-intl.hoc.cjs +0 -1
  342. package/dist/react/next-intl/next-intl.hook.cjs +0 -1
  343. package/dist/react/next-intl/next-intl.provider.cjs +0 -1
  344. package/dist/react/storage/index.cjs +0 -1
  345. package/dist/react/storage/storage.hook.cjs +0 -1
  346. package/dist/react/storage/storage.util.cjs +0 -1
  347. package/dist/react/toast/index.cjs +0 -1
  348. package/dist/react/userback/index.cjs +0 -1
  349. package/dist/react/userback/userback.component.cjs +0 -1
  350. package/dist/typescript/common.type.cjs +0 -1
  351. package/dist/typescript/index.cjs +0 -1
  352. package/dist/util/common/common.util.cjs +0 -1
  353. package/dist/util/common/index.cjs +0 -1
  354. package/dist/util/index.cjs +0 -1
  355. package/dist/util/object/index.cjs +0 -1
  356. package/dist/util/object/object.util.cjs +0 -1
  357. package/dist/util/serializer/index.cjs +0 -1
  358. package/dist/util/serializer/serializer.util.cjs +0 -1
  359. package/dist/util/string/index.cjs +0 -1
  360. package/dist/util/string/string.util.cjs +0 -1
  361. package/dist/util/validate/index.cjs +0 -1
  362. package/dist/util/validate/validate.util.cjs +0 -1
  363. /package/dist/node/ws/{ts.util.d.ts → ws.util.d.ts} +0 -0
@@ -1,39 +1,15 @@
1
- import C from "migrate-mongo";
2
- import k from "mongoose-aggregate-paginate-v2";
3
- import U from "mongoose-paginate-v2";
4
- import { randomUUID as I } from "node:crypto";
5
- import { deepClone as q, getNestedValue as B, setNestedValue as J } from "../../util/object/object.util.js";
6
- import { regexSearchMapper as K } from "../../util/common/common.util.js";
7
- import { writeFileSync as L, addGitIgnoreEntry as H } from "../fs/fs.util.js";
8
- import { PATH as V, MIGRATE_MONGO_CONFIG as z } from "../path/path.constant.js";
9
- import { validate as Q } from "../../util/validate/validate.util.js";
10
- var W = Object.defineProperty, X = Object.defineProperties, Y = Object.getOwnPropertyDescriptors, x = Object.getOwnPropertySymbols, Z = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable, $ = (t, e, i) => e in t ? W(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, M = (t, e) => {
11
- for (var i in e || (e = {}))
12
- Z.call(e, i) && $(t, i, e[i]);
13
- if (x)
14
- for (var i of x(e))
15
- T.call(e, i) && $(t, i, e[i]);
16
- return t;
17
- }, tt = (t, e) => X(t, Y(e)), w = (t, e, i) => new Promise((n, r) => {
18
- var o = (s) => {
19
- try {
20
- y(i.next(s));
21
- } catch (h) {
22
- r(h);
23
- }
24
- }, l = (s) => {
25
- try {
26
- y(i.throw(s));
27
- } catch (h) {
28
- r(h);
29
- }
30
- }, y = (s) => s.done ? n(s.value) : Promise.resolve(s.value).then(o, l);
31
- y((i = i.apply(t, e)).next());
32
- });
33
- function P(t) {
34
- return t === t.toUpperCase() ? t.charAt(0).toUpperCase() + t.slice(1).toLowerCase() : t;
1
+ import m from "mongoose-aggregate-paginate-v2";
2
+ import p from "mongoose-paginate-v2";
3
+ import { randomUUID as f } from "node:crypto";
4
+ import { deepClone as y, getNestedValue as g, setNestedValue as h } from "../../util/object/object.util.js";
5
+ import { regexSearchMapper as w } from "../../util/common/common.util.js";
6
+ import { writeFileSync as S, addGitIgnoreEntry as E } from "../fs/fs.util.js";
7
+ import { PATH as d, MIGRATE_MONGO_CONFIG as R } from "../path/path.constant.js";
8
+ import { validate as x } from "../../util/validate/validate.util.js";
9
+ function I(e) {
10
+ return e === e.toUpperCase() ? e.charAt(0).toUpperCase() + e.slice(1).toLowerCase() : e;
35
11
  }
36
- const A = {
12
+ const l = {
37
13
  /**
38
14
  * Creates generic fields that are commonly used across MongoDB documents.
39
15
  * This function generates standard fields including a UUID, deletion flag, and timestamps
@@ -43,7 +19,7 @@ const A = {
43
19
  */
44
20
  createGenericFields() {
45
21
  return {
46
- id: I(),
22
+ id: f(),
47
23
  isDel: !1,
48
24
  createdAt: /* @__PURE__ */ new Date(),
49
25
  updatedAt: /* @__PURE__ */ new Date()
@@ -57,8 +33,8 @@ const A = {
57
33
  * @param schema - The Mongoose schema to apply plugins to.
58
34
  * @param plugins - An array of plugin functions or false values to filter and apply.
59
35
  */
60
- applyPlugins(t, e) {
61
- e.filter((i) => typeof i == "function").forEach((i) => t.plugin(i));
36
+ applyPlugins(e, r) {
37
+ r.filter((t) => typeof t == "function").forEach((t) => e.plugin(t));
62
38
  },
63
39
  /**
64
40
  * Applies middleware functions to a Mongoose schema.
@@ -67,9 +43,9 @@ const A = {
67
43
  * @param schema - The Mongoose schema to apply middleware to.
68
44
  * @param middlewares - An array of middleware configurations with method, pre, and post functions.
69
45
  */
70
- applyMiddlewares(t, e) {
71
- e.forEach(({ method: i, pre: n, post: r }) => {
72
- i && n && t.pre(i, n), i && r && t.post(i, r);
46
+ applyMiddlewares(e, r) {
47
+ r.forEach(({ method: t, pre: n, post: i }) => {
48
+ t && n && e.pre(t, n), t && i && e.post(t, i);
73
49
  });
74
50
  },
75
51
  /**
@@ -80,10 +56,10 @@ const A = {
80
56
  * @param mongoose - The Mongoose instance to create the schema with.
81
57
  * @returns A Mongoose schema with generic document fields.
82
58
  */
83
- createGenericSchema(t) {
84
- return new t.Schema(
59
+ createGenericSchema(e) {
60
+ return new e.Schema(
85
61
  {
86
- id: { type: String, default: () => I(), unique: !0 },
62
+ id: { type: String, default: () => f(), unique: !0 },
87
63
  isDel: { type: Boolean, default: !1 }
88
64
  },
89
65
  { timestamps: !0 }
@@ -102,34 +78,33 @@ const A = {
102
78
  * @returns A configured Mongoose schema.
103
79
  */
104
80
  createSchema({
105
- mongoose: t,
106
- schema: e,
107
- virtuals: i = [],
81
+ mongoose: e,
82
+ schema: r,
83
+ virtuals: t = [],
108
84
  standalone: n = !1
109
85
  }) {
110
- const r = new t.Schema(e, {
86
+ const i = new e.Schema(r, {
111
87
  toJSON: { virtuals: !0 },
112
88
  // So `res.json()` and other `JSON.stringify()` functions include virtuals
113
89
  toObject: { virtuals: !0 }
114
90
  // So `console.log()` and other functions that use `toObject()` include virtuals
115
91
  });
116
- return i.forEach(({ name: o, options: l, get: y }) => {
117
- if (A.isDynamicVirtual(l)) {
118
- const s = r.statics;
119
- s._dynamicVirtuals || (s._dynamicVirtuals = []), s._dynamicVirtuals.push({
120
- name: o,
121
- options: l
92
+ return t.forEach(({ name: s, options: a, get: o }) => {
93
+ if (l.isDynamicVirtual(a)) {
94
+ const c = i.statics;
95
+ c._dynamicVirtuals || (c._dynamicVirtuals = []), c._dynamicVirtuals.push({
96
+ name: s,
97
+ options: a
122
98
  });
123
- const h = r.virtual(o);
124
- y ? h.get(y) : h.get(function() {
125
- var u;
126
- return ((u = this._populated) == null ? void 0 : u[o]) || (l != null && l.count ? 0 : l != null && l.justOne ? null : []);
99
+ const u = i.virtual(s);
100
+ o ? u.get(o) : u.get(function() {
101
+ return this._populated?.[s] || (a?.count ? 0 : a?.justOne ? null : []);
127
102
  });
128
103
  } else {
129
- const s = r.virtual(o, l);
130
- y && s.get(y);
104
+ const c = i.virtual(s, a);
105
+ o && c.get(o);
131
106
  }
132
- }), n || r.add(A.createGenericSchema(t)), r;
107
+ }), n || i.add(l.createGenericSchema(e)), i;
133
108
  },
134
109
  /**
135
110
  * Creates a Mongoose model with plugins, middleware, and pagination support.
@@ -148,25 +123,25 @@ const A = {
148
123
  * @throws {Error} When the model name is not provided.
149
124
  */
150
125
  createModel({
151
- mongoose: t,
152
- name: e,
153
- schema: i,
126
+ mongoose: e,
127
+ name: r,
128
+ schema: t,
154
129
  virtuals: n = [],
155
- pagination: r = !0,
156
- aggregate: o = !0,
157
- middlewares: l = []
130
+ pagination: i = !0,
131
+ aggregate: s = !0,
132
+ middlewares: a = []
158
133
  }) {
159
- if (!e)
134
+ if (!r)
160
135
  throw new Error("Model name is required.");
161
- if (t.models[e])
162
- return t.models[e];
163
- const y = A.createSchema({ mongoose: t, schema: i, virtuals: n });
164
- (r || o) && A.applyPlugins(y, [
165
- r && U,
166
- o && k
167
- ]), A.applyMiddlewares(y, l);
168
- const s = t.model(e, y);
169
- return n.length > 0 && (s._virtualConfigs = n), s;
136
+ if (e.models[r])
137
+ return e.models[r];
138
+ const o = l.createSchema({ mongoose: e, schema: t, virtuals: n });
139
+ (i || s) && l.applyPlugins(o, [
140
+ i && p,
141
+ s && m
142
+ ]), l.applyMiddlewares(o, a);
143
+ const c = e.model(r, o);
144
+ return n.length > 0 && (c._virtualConfigs = n), c;
170
145
  },
171
146
  /**
172
147
  * Validation utilities for Mongoose schemas.
@@ -181,10 +156,8 @@ const A = {
181
156
  * @returns A validation function that returns true if the field is not empty.
182
157
  */
183
158
  isRequired() {
184
- return function(t) {
185
- return w(this, null, function* () {
186
- return !Q.isEmpty(t);
187
- });
159
+ return async function(e) {
160
+ return !x.isEmpty(e);
188
161
  };
189
162
  },
190
163
  /**
@@ -196,14 +169,12 @@ const A = {
196
169
  * @returns A validation function that returns true if the value is unique across the specified fields.
197
170
  * @throws {Error} When fields is not a non-empty array of strings.
198
171
  */
199
- isUnique(t) {
200
- return function(e) {
201
- return w(this, null, function* () {
202
- if (!Array.isArray(t) || t.length === 0)
203
- throw new Error("Fields must be a non-empty array of strings.");
204
- const i = { $or: t.map((r) => ({ [r]: e })) };
205
- return !(yield this.constructor.exists(i));
206
- });
172
+ isUnique(e) {
173
+ return async function(r) {
174
+ if (!Array.isArray(e) || e.length === 0)
175
+ throw new Error("Fields must be a non-empty array of strings.");
176
+ const t = { $or: e.map((i) => ({ [i]: r })) };
177
+ return !await this.constructor.exists(t);
207
178
  };
208
179
  },
209
180
  /**
@@ -215,19 +186,28 @@ const A = {
215
186
  * @returns A validation function that returns true if the value matches all regex patterns.
216
187
  * @throws {Error} When regexArray is not an array of valid RegExp objects.
217
188
  */
218
- matchesRegex(t) {
219
- return (e) => w(null, null, function* () {
220
- if (!Array.isArray(t) || t.some((i) => !(i instanceof RegExp)))
189
+ matchesRegex(e) {
190
+ return async (r) => {
191
+ if (!Array.isArray(e) || e.some((t) => !(t instanceof RegExp)))
221
192
  throw new Error("regexArray must be an array of valid RegExp objects.");
222
- return t.every((i) => i.test(e));
223
- });
193
+ return e.every((t) => t.test(r));
194
+ };
224
195
  }
225
196
  },
226
197
  /**
227
198
  * Migration utilities for MongoDB.
228
199
  * This object extends the migrate-mongo library with additional configuration utilities.
229
200
  */
230
- migrate: tt(M({}, C), {
201
+ migrate: {
202
+ /**
203
+ * Lazily loads the migrate-mongo module to avoid eager import overhead.
204
+ * Use this to access migrate-mongo methods (up, down, status, create) programmatically.
205
+ *
206
+ * @returns A promise resolving to the migrate-mongo module.
207
+ */
208
+ async getModule() {
209
+ return (await import("migrate-mongo")).default;
210
+ },
231
211
  /**
232
212
  * Sets the migration configuration and updates .gitignore.
233
213
  * This function creates a migration configuration file and ensures it's properly
@@ -235,12 +215,12 @@ const A = {
235
215
  *
236
216
  * @param options - Migration configuration options to write to the config file.
237
217
  */
238
- setConfig: (t) => {
239
- const e = `// This file is automatically generated by the Cyberskill CLI.
240
- module.exports = ${JSON.stringify(t, null, 4)}`;
241
- L(V.MIGRATE_MONGO_CONFIG, e), H(V.GIT_IGNORE, z);
218
+ setConfig: (e) => {
219
+ const r = `// This file is automatically generated by the Cyberskill CLI.
220
+ module.exports = ${JSON.stringify(e, null, 4)}`;
221
+ S(d.MIGRATE_MONGO_CONFIG, r), E(d.GIT_IGNORE, R);
242
222
  }
243
- }),
223
+ },
244
224
  /**
245
225
  * Converts string values in a filter to regex patterns for case-insensitive search.
246
226
  * This function recursively processes a filter object and converts string values in specified fields
@@ -250,23 +230,23 @@ module.exports = ${JSON.stringify(t, null, 4)}`;
250
230
  * @param fields - An array of field names to convert to regex patterns.
251
231
  * @returns A new filter object with string values converted to regex patterns.
252
232
  */
253
- regexify(t, e) {
254
- if (!t)
233
+ regexify(e, r) {
234
+ if (!e)
255
235
  return {};
256
- let i = q(t);
257
- if (!e || e.length === 0)
258
- return i;
259
- for (const n of e) {
260
- const r = n.toString().split("."), o = B(i, r);
261
- if (typeof o == "string" && o.length > 0) {
262
- const l = {
263
- $regex: `.*${K(o)}.*`,
236
+ let t = y(e);
237
+ if (!r || r.length === 0)
238
+ return t;
239
+ for (const n of r) {
240
+ const i = n.toString().split("."), s = g(t, i);
241
+ if (typeof s == "string" && s.length > 0) {
242
+ const a = {
243
+ $regex: `.*${w(s)}.*`,
264
244
  $options: "i"
265
245
  };
266
- i = J(i, r, l);
246
+ t = h(t, i, a);
267
247
  }
268
248
  }
269
- return i;
249
+ return t;
270
250
  },
271
251
  /**
272
252
  * Checks if a virtual options object has a dynamic ref function.
@@ -274,8 +254,8 @@ module.exports = ${JSON.stringify(t, null, 4)}`;
274
254
  * @param options - The virtual options to check.
275
255
  * @returns True if the options contain a dynamic ref function.
276
256
  */
277
- isDynamicVirtual(t) {
278
- return !!(t && typeof t.ref == "function");
257
+ isDynamicVirtual(e) {
258
+ return !!(e && typeof e.ref == "function");
279
259
  },
280
260
  /**
281
261
  * Generic utility function to get new records from the database
@@ -284,15 +264,13 @@ module.exports = ${JSON.stringify(t, null, 4)}`;
284
264
  * @param filterFn - Function to determine if a record already exists
285
265
  * @returns Array of records that don't exist in the database
286
266
  */
287
- getNewRecords(t, e, i) {
288
- return w(this, null, function* () {
289
- const n = yield t.findAll({});
290
- return n.success ? e.filter(
291
- (o) => !n.result.some(
292
- (l) => i(l, o)
293
- )
294
- ) : e;
295
- });
267
+ async getNewRecords(e, r, t) {
268
+ const n = await e.findAll({});
269
+ return n.success ? r.filter(
270
+ (s) => !n.result.some(
271
+ (a) => t(a, s)
272
+ )
273
+ ) : r;
296
274
  },
297
275
  /**
298
276
  * Generic utility function to get existing records that match the filter criteria
@@ -301,293 +279,17 @@ module.exports = ${JSON.stringify(t, null, 4)}`;
301
279
  * @param filterFn - Function to determine if a record exists
302
280
  * @returns Array of existing records that match the filter criteria
303
281
  */
304
- getExistingRecords(t, e, i) {
305
- return w(this, null, function* () {
306
- const n = yield t.findAll({});
307
- return n.success ? n.result.filter(
308
- (o) => e.some(
309
- (l) => i(o, l)
310
- )
311
- ) : [];
312
- });
282
+ async getExistingRecords(e, r, t) {
283
+ const n = await e.findAll({});
284
+ return n.success ? n.result.filter(
285
+ (s) => r.some(
286
+ (a) => t(s, a)
287
+ )
288
+ ) : [];
313
289
  }
314
290
  };
315
- function D(t, e, i, n, r) {
316
- return w(this, null, function* () {
317
- if (!e.length || !i)
318
- return e;
319
- const o = Array.isArray(i) ? i : [i];
320
- for (const l of o)
321
- typeof l == "string" ? yield G(t, e, l, n, r) : l && typeof l == "object" && (yield et(t, e, l, n, r));
322
- return e;
323
- });
324
- }
325
- function G(t, e, i, n, r) {
326
- return w(this, null, function* () {
327
- var o, l, y, s;
328
- const h = i.split(".");
329
- if (h.length < 2) {
330
- for (const m of e)
331
- yield F(t, m, i, n, void 0, r);
332
- return;
333
- }
334
- const u = h[0];
335
- if (!u || u.trim() === "")
336
- return;
337
- const R = h.slice(1).join(".");
338
- for (const m of e) {
339
- const j = m, O = j[u];
340
- if (O && typeof O == "object") {
341
- let c = r;
342
- const a = c;
343
- if (r && r.schema && r.schema.virtuals) {
344
- const f = r.schema.virtuals[u];
345
- if (f && f.options && f.options.ref) {
346
- let b;
347
- if (typeof f.options.ref == "function" ? b = f.options.ref(j) : typeof f.options.ref == "string" && (b = f.options.ref), b) {
348
- const p = P(b);
349
- t.models[p] && (c = t.models[p]);
350
- }
351
- }
352
- }
353
- if (!c) {
354
- const f = (l = (o = r == null ? void 0 : r.schema) == null ? void 0 : o.statics) != null ? l : {}, p = ((r == null ? void 0 : r._virtualConfigs) || f._dynamicVirtuals || []).find((d) => d.name === u);
355
- if (p && p.options && p.options.ref) {
356
- let d;
357
- if (typeof p.options.ref == "function" ? d = p.options.ref(j) : typeof p.options.ref == "string" && (d = p.options.ref), d) {
358
- const g = P(d);
359
- t.models[g] && (c = t.models[g]);
360
- }
361
- }
362
- }
363
- if (c === a) {
364
- const f = (s = (y = r == null ? void 0 : r.schema) == null ? void 0 : y.statics) != null ? s : {}, p = ((r == null ? void 0 : r._virtualConfigs) || f._dynamicVirtuals || []).find((d) => d.name === u);
365
- if (p && p.options && p.options.ref) {
366
- let d;
367
- if (typeof p.options.ref == "function" ? d = p.options.ref(j) : typeof p.options.ref == "string" && (d = p.options.ref), d) {
368
- const g = P(d);
369
- t.models[g] && (c = t.models[g]);
370
- }
371
- }
372
- }
373
- if (Array.isArray(O))
374
- for (const f of O)
375
- f && typeof f == "object" && (yield F(t, f, R, n, u, c));
376
- else O && typeof O == "object" && (yield F(t, O, R, n, u, c));
377
- }
378
- }
379
- });
380
- }
381
- function et(t, e, i, n, r) {
382
- return w(this, null, function* () {
383
- const { path: o, populate: l } = i;
384
- if (!o)
385
- return;
386
- if (!l) {
387
- yield G(t, e, o, n, r);
388
- return;
389
- }
390
- const y = o;
391
- for (const s of e) {
392
- const h = s, u = h[y];
393
- let R = r;
394
- if (r && r.schema && r.schema.virtuals) {
395
- const m = r.schema.virtuals[y];
396
- if (m && m.options && m.options.ref) {
397
- let j;
398
- if (typeof m.options.ref == "function" ? j = m.options.ref(h) : typeof m.options.ref == "string" && (j = m.options.ref), j) {
399
- const O = P(j);
400
- t.models[O] && (R = t.models[O]);
401
- }
402
- }
403
- }
404
- if (!R && typeof u == "object" && u && "entityType" in u) {
405
- const m = P(String(u.entityType));
406
- t.models[m] && (R = t.models[m]);
407
- }
408
- if (u && typeof u == "object")
409
- if (Array.isArray(u))
410
- for (const m of u)
411
- m && typeof m == "object" && (yield D(t, [m], l, n, R));
412
- else u && typeof u == "object" && (yield D(t, [u], l, n, R));
413
- }
414
- });
415
- }
416
- function E(t, e, i, n) {
417
- if (!i || !e || !e.schema)
418
- return;
419
- const r = i.split(".");
420
- let o = e.schema;
421
- for (let l = 0; l < r.length; l++) {
422
- const y = r[l];
423
- if (o && o.virtuals && y) {
424
- const s = o.virtuals[y];
425
- if (s && s.options && s.options.ref) {
426
- let h;
427
- if (typeof s.options.ref == "function" ? h = s.options.ref(n) : typeof s.options.ref == "string" && (h = s.options.ref), h && typeof h == "string") {
428
- if (l === r.length - 1)
429
- return h;
430
- const u = t.models[h];
431
- if (u && u.schema) {
432
- o = u.schema;
433
- continue;
434
- }
435
- }
436
- }
437
- }
438
- if (o && o.paths && y) {
439
- const s = o.paths[y];
440
- if (s && s.schema) {
441
- o = s.schema;
442
- continue;
443
- }
444
- }
445
- return;
446
- }
447
- }
448
- function it(t, e) {
449
- if (e)
450
- for (const i of Object.keys(t.models)) {
451
- const n = t.models[i], r = n == null ? void 0 : n.schema;
452
- if (r && (r.paths && r.paths[e] || r.virtuals && r.virtuals[e]))
453
- return n;
454
- }
455
- }
456
- function rt(t, e) {
457
- const i = (e || "").split(".")[0] || "";
458
- if (i)
459
- for (const n of Object.keys(t.models)) {
460
- const r = t.models[n], o = r == null ? void 0 : r.schema;
461
- if (o && (o.paths && o.paths[i] || o.virtuals && o.virtuals[i]))
462
- return r;
463
- }
464
- }
465
- function F(t, e, i, n, r, o) {
466
- return w(this, null, function* () {
467
- var l, y;
468
- let s = e.__t;
469
- if (!s) {
470
- if (o) {
471
- const c = r ? `${r}.${i}` : i, a = (c || "").split(".")[0] || "";
472
- let f = o;
473
- if (!!!((l = f == null ? void 0 : f.schema) != null && l.paths && f.schema.paths[a] || (y = f == null ? void 0 : f.schema) != null && y.virtuals && f.schema.virtuals[a])) {
474
- const d = rt(t, c);
475
- d && (f = d);
476
- }
477
- const p = E(t, f, c, e);
478
- if (p)
479
- s = p;
480
- else {
481
- const d = (c.includes(".") ? c.split(".").pop() : c) || "";
482
- if (d) {
483
- const g = it(t, d);
484
- if (g) {
485
- const N = E(t, g, c, e);
486
- N && (s = N);
487
- }
488
- }
489
- }
490
- }
491
- if (n && n.length > 0) {
492
- const c = i.split(".").pop() || "", a = n.find((f) => f.name === c);
493
- if (a && a.options.ref) {
494
- let f;
495
- typeof a.options.ref == "function" ? f = a.options.ref(e) : typeof a.options.ref == "string" && (f = a.options.ref), f && typeof f == "string" && (s = f);
496
- }
497
- }
498
- if (!s) {
499
- for (const [c, a] of Object.entries(e))
500
- if (c === "entityType" && typeof a == "string") {
501
- s = a;
502
- break;
503
- }
504
- if (s && t.models[s]) {
505
- const c = t.models[s];
506
- if (c && c.schema) {
507
- const a = c.schema, f = i.split(".").pop() || "", b = (d, g = "root") => {
508
- if (!d || !d.virtuals)
509
- return;
510
- const N = d.virtuals;
511
- for (const _ of Object.keys(N))
512
- if (_ === f) {
513
- const v = N[_];
514
- if (v && v.options && v.options.ref) {
515
- let S;
516
- if (typeof v.options.ref == "function" ? S = v.options.ref(e) : typeof v.options.ref == "string" && (S = v.options.ref), S && typeof S == "string")
517
- return S;
518
- }
519
- }
520
- if (d.paths)
521
- for (const _ of Object.keys(d.paths)) {
522
- const v = d.paths[_];
523
- if (v && v.schema) {
524
- const S = b(v.schema, `${g}.${_}`);
525
- if (S)
526
- return S;
527
- }
528
- }
529
- }, p = b(a);
530
- p && (s = p);
531
- }
532
- }
533
- }
534
- if (!s) {
535
- const c = i.split(".").pop() || "";
536
- if (o && o.schema) {
537
- const a = o.schema, f = (p, d = "root") => {
538
- if (!p || !p.virtuals)
539
- return;
540
- const g = p.virtuals;
541
- for (const N of Object.keys(g))
542
- if (N === c) {
543
- const _ = g[N];
544
- if (_ && _.options && _.options.ref) {
545
- let v;
546
- if (typeof _.options.ref == "function" ? v = _.options.ref(e) : typeof _.options.ref == "string" && (v = _.options.ref), v && typeof v == "string")
547
- return v;
548
- }
549
- }
550
- if (p.paths)
551
- for (const N of Object.keys(p.paths)) {
552
- const _ = p.paths[N];
553
- if (_ && _.schema) {
554
- const v = f(_.schema, `${d}.${N}`);
555
- if (v)
556
- return v;
557
- }
558
- }
559
- }, b = f(a);
560
- b && (s = b);
561
- }
562
- if (!s && o) {
563
- const a = E(t, o, i, e);
564
- a && (s = a);
565
- }
566
- if (!s && n && n.length > 0) {
567
- const a = n.find((f) => f.name === c);
568
- if (a && a.options.ref) {
569
- let f;
570
- typeof a.options.ref == "function" ? f = a.options.ref(e) : typeof a.options.ref == "string" && (f = a.options.ref), f && typeof f == "string" && (s = f);
571
- }
572
- }
573
- }
574
- if (!s) {
575
- const c = i.split(".").pop() || "", a = c ? c.charAt(0).toUpperCase() + c.slice(1) : "";
576
- a && t.models[a] && (s = a);
577
- }
578
- }
579
- const h = t.models[s];
580
- if (!h)
581
- return;
582
- const u = `${i}Id`, R = `${i}Ids`, m = e[u] || e[R] || e[i];
583
- if (!m)
584
- return;
585
- const j = Array.isArray(m) ? m : [m], O = yield h.find({ id: { $in: j } }).lean();
586
- O.length > 0 && (Array.isArray(m) ? e[i] = O : e[i] = O[0]);
587
- });
588
- }
589
291
  export {
590
- D as applyNestedPopulate,
591
- P as convertEnumToModelName,
592
- A as mongo
292
+ I as convertEnumToModelName,
293
+ l as mongo
593
294
  };
295
+ //# sourceMappingURL=mongo.util.js.map