@ozdao/martyrs 0.2.477 → 0.2.479

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 (1711) hide show
  1. package/README.md +17 -10
  2. package/dist/Media-B1ZP3D7B.cjs +1 -0
  3. package/dist/{Media-CecrG6g6.mjs → Media-CKk33U4A.js} +1 -1
  4. package/dist/abac-BuL5pUZ4.js +949 -0
  5. package/dist/abac-XF1JVCLI.cjs +948 -0
  6. package/dist/addUserStatusFields-B8g3DAuZ.js +88 -0
  7. package/dist/addUserStatusFields-DP_0f12s.cjs +104 -0
  8. package/dist/auth.server.cjs +600 -0
  9. package/dist/auth.server.js +546 -709
  10. package/dist/authJwt-DBB51Iql.cjs +73 -0
  11. package/dist/authJwt-DcYNNwcr.js +74 -0
  12. package/dist/builder.cjs +1356 -0
  13. package/dist/builder.js +1193 -1377
  14. package/dist/chats.server.cjs +106 -0
  15. package/dist/chats.server.js +99 -129
  16. package/dist/common.schema-Bw1O5_2Q.js +13 -0
  17. package/dist/common.schema-BzFEVNn3.cjs +12 -0
  18. package/dist/community.server.cjs +840 -0
  19. package/dist/community.server.js +722 -949
  20. package/dist/credentials.schema-C9FB2EyY.js +10 -0
  21. package/dist/credentials.schema-DwhGdrwC.cjs +9 -0
  22. package/dist/engagement.schema-Dh1adRsn.js +24 -0
  23. package/dist/engagement.schema-JADHu8pj.cjs +23 -0
  24. package/dist/events.server.cjs +856 -0
  25. package/dist/events.server.js +713 -916
  26. package/dist/files.server.cjs +275 -0
  27. package/dist/files.server.js +233 -315
  28. package/dist/gallery.server.cjs +270 -0
  29. package/dist/gallery.server.js +245 -311
  30. package/dist/globals.abac-Cm9e8Jdk.cjs +297 -0
  31. package/dist/globals.abac-DBV_kaOq.js +298 -0
  32. package/dist/globals.logger-Bf6rRU7j.js +156 -0
  33. package/dist/globals.logger-CZMgIMlM.cjs +155 -0
  34. package/dist/globals.observer-CDqUjVU5.js +44 -0
  35. package/dist/globals.observer-CV2wCzzh.cjs +43 -0
  36. package/dist/globals.server.cjs +446 -0
  37. package/dist/globals.server.js +376 -399
  38. package/dist/globals.verifier-CWFz5Gh2.js +614 -0
  39. package/dist/globals.verifier-D68mHEBl.cjs +613 -0
  40. package/dist/index-CsJwdsBW.js +170 -0
  41. package/dist/index-YNOkL1mu.cjs +186 -0
  42. package/dist/mailing-C11EYWm-.js +85 -0
  43. package/dist/mailing-q7sR8gCV.cjs +101 -0
  44. package/dist/{main-DmznvhMM.mjs → main-BhAiwmnI.js} +4270 -4674
  45. package/dist/main-C75EcBpE.cjs +11 -0
  46. package/dist/martyrs/src/components/Block/Block.vue.cjs +1 -1
  47. package/dist/martyrs/src/components/Block/Block.vue.js +1 -1
  48. package/dist/martyrs/src/components/Button/Button.vue2.cjs +0 -1
  49. package/dist/martyrs/src/components/Button/Button.vue2.cjs.map +1 -1
  50. package/dist/martyrs/src/components/Button/Button.vue2.js +0 -1
  51. package/dist/martyrs/src/components/Button/Button.vue2.js.map +1 -1
  52. package/dist/martyrs/src/components/Chips/{Chips.vue.cjs → Chips.vue2.cjs} +3 -3
  53. package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +1 -0
  54. package/dist/martyrs/src/components/Chips/{Chips.vue.js → Chips.vue2.js} +3 -3
  55. package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +1 -0
  56. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
  57. package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
  58. package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
  59. package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.js.map +1 -0
  60. package/dist/martyrs/src/components/Feed/Feed.vue.cjs +127 -74
  61. package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
  62. package/dist/martyrs/src/components/Feed/Feed.vue.js +136 -83
  63. package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
  64. package/dist/martyrs/src/components/Field/Field.vue.cjs +20 -22
  65. package/dist/martyrs/src/components/Field/Field.vue.cjs.map +1 -1
  66. package/dist/martyrs/src/components/Field/Field.vue.js +21 -23
  67. package/dist/martyrs/src/components/Field/Field.vue.js.map +1 -1
  68. package/dist/martyrs/src/components/FieldPhone/FieldPhone.vue.cjs.map +1 -1
  69. package/dist/martyrs/src/components/FieldPhone/FieldPhone.vue.js.map +1 -1
  70. package/dist/martyrs/src/components/FieldPhone/all-countries.cjs +245 -1
  71. package/dist/martyrs/src/components/FieldPhone/all-countries.cjs.map +1 -1
  72. package/dist/martyrs/src/components/FieldPhone/all-countries.js +245 -1
  73. package/dist/martyrs/src/components/FieldPhone/all-countries.js.map +1 -1
  74. package/dist/martyrs/src/components/FieldPhone/click-outside.cjs.map +1 -1
  75. package/dist/martyrs/src/components/FieldPhone/click-outside.js.map +1 -1
  76. package/dist/martyrs/src/components/FieldTags/BlockTags.vue.js +2 -2
  77. package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs +451 -176
  78. package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs.map +1 -1
  79. package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js +451 -176
  80. package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js.map +1 -1
  81. package/dist/martyrs/src/components/FieldTags/create-tags.cjs.map +1 -1
  82. package/dist/martyrs/src/components/FieldTags/create-tags.js.map +1 -1
  83. package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.cjs +1 -4
  84. package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.cjs.map +1 -1
  85. package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.js +1 -4
  86. package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.js.map +1 -1
  87. package/dist/martyrs/src/components/Menu/{Menu.vue.cjs → Menu.vue2.cjs} +2 -2
  88. package/dist/martyrs/src/components/Menu/Menu.vue2.cjs.map +1 -0
  89. package/dist/martyrs/src/components/Menu/{Menu.vue.js → Menu.vue2.js} +2 -2
  90. package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +1 -0
  91. package/dist/martyrs/src/components/Popup/Popup.vue2.cjs +27 -5
  92. package/dist/martyrs/src/components/Popup/Popup.vue2.cjs.map +1 -1
  93. package/dist/martyrs/src/components/Popup/Popup.vue2.js +28 -6
  94. package/dist/martyrs/src/components/Popup/Popup.vue2.js.map +1 -1
  95. package/dist/martyrs/src/components/Select/Select.vue.cjs +2 -4
  96. package/dist/martyrs/src/components/Select/Select.vue.cjs.map +1 -1
  97. package/dist/martyrs/src/components/Select/Select.vue.js +2 -4
  98. package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -1
  99. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue2.cjs +639 -0
  100. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue2.cjs.map +1 -0
  101. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue2.js +639 -0
  102. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue2.js.map +1 -0
  103. package/dist/martyrs/src/components/Table/Table.vue.cjs +23 -38
  104. package/dist/martyrs/src/components/Table/Table.vue.cjs.map +1 -1
  105. package/dist/martyrs/src/components/Table/Table.vue.js +24 -39
  106. package/dist/martyrs/src/components/Table/Table.vue.js.map +1 -1
  107. package/dist/martyrs/src/components/Tooltip/{Tooltip.vue.cjs → Tooltip.vue2.cjs} +2 -2
  108. package/dist/martyrs/src/components/Tooltip/Tooltip.vue2.cjs.map +1 -0
  109. package/dist/martyrs/src/components/Tooltip/{Tooltip.vue.js → Tooltip.vue2.js} +2 -2
  110. package/dist/martyrs/src/components/Tooltip/{Tooltip.vue.cjs.map → Tooltip.vue2.js.map} +1 -1
  111. package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs +4 -4
  112. package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.cjs.map +1 -1
  113. package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.js +4 -4
  114. package/dist/martyrs/src/components/UploadImageMultiple/UploadImageMultiple.vue.js.map +1 -1
  115. package/dist/martyrs/src/modules/auth/auth.client.cjs +5 -5
  116. package/dist/martyrs/src/modules/auth/auth.client.cjs.map +1 -1
  117. package/dist/martyrs/src/modules/auth/auth.client.js +5 -5
  118. package/dist/martyrs/src/modules/auth/auth.client.js.map +1 -1
  119. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs.map +1 -1
  120. package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js.map +1 -1
  121. package/dist/martyrs/src/modules/auth/views/components/pages/EnterCode.vue.cjs.map +1 -1
  122. package/dist/martyrs/src/modules/auth/views/components/pages/EnterCode.vue.js.map +1 -1
  123. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs.map +1 -1
  124. package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js.map +1 -1
  125. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs.map +1 -1
  126. package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js.map +1 -1
  127. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +2 -2
  128. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs.map +1 -1
  129. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +2 -2
  130. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js.map +1 -1
  131. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +2 -2
  132. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs.map +1 -1
  133. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +2 -2
  134. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js.map +1 -1
  135. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs.map +1 -1
  136. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js.map +1 -1
  137. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs.map +1 -1
  138. package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js.map +1 -1
  139. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs.map +1 -1
  140. package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js.map +1 -1
  141. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs.map +1 -1
  142. package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js.map +1 -1
  143. package/dist/martyrs/src/modules/auth/views/components/sections/FeaturedUsers.vue.cjs.map +1 -1
  144. package/dist/martyrs/src/modules/auth/views/components/sections/FeaturedUsers.vue.js.map +1 -1
  145. package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.cjs.map +1 -1
  146. package/dist/martyrs/src/modules/auth/views/components/sections/ProfileEditCredentials.vue.js.map +1 -1
  147. package/dist/martyrs/src/modules/auth/views/middlewares/auth.validation.cjs.map +1 -1
  148. package/dist/martyrs/src/modules/auth/views/middlewares/auth.validation.js.map +1 -1
  149. package/dist/martyrs/src/modules/auth/views/middlewares/ownership.validation.cjs.map +1 -1
  150. package/dist/martyrs/src/modules/auth/views/middlewares/ownership.validation.js.map +1 -1
  151. package/dist/martyrs/src/modules/auth/views/router/auth.cjs +87 -98
  152. package/dist/martyrs/src/modules/auth/views/router/auth.cjs.map +1 -1
  153. package/dist/martyrs/src/modules/auth/views/router/auth.js +87 -98
  154. package/dist/martyrs/src/modules/auth/views/router/auth.js.map +1 -1
  155. package/dist/martyrs/src/modules/auth/views/router/users.cjs +105 -106
  156. package/dist/martyrs/src/modules/auth/views/router/users.cjs.map +1 -1
  157. package/dist/martyrs/src/modules/auth/views/router/users.js +105 -106
  158. package/dist/martyrs/src/modules/auth/views/router/users.js.map +1 -1
  159. package/dist/martyrs/src/modules/auth/views/store/auth.cjs +7 -1
  160. package/dist/martyrs/src/modules/auth/views/store/auth.cjs.map +1 -1
  161. package/dist/martyrs/src/modules/auth/views/store/auth.js +7 -1
  162. package/dist/martyrs/src/modules/auth/views/store/auth.js.map +1 -1
  163. package/dist/martyrs/src/modules/auth/views/store/twofa.cjs.map +1 -1
  164. package/dist/martyrs/src/modules/auth/views/store/twofa.js.map +1 -1
  165. package/dist/martyrs/src/modules/auth/views/store/users.cjs +1 -1
  166. package/dist/martyrs/src/modules/auth/views/store/users.cjs.map +1 -1
  167. package/dist/martyrs/src/modules/auth/views/store/users.js +1 -1
  168. package/dist/martyrs/src/modules/auth/views/store/users.js.map +1 -1
  169. package/dist/martyrs/src/modules/auth/views/validations/inputs.validation.cjs.map +1 -1
  170. package/dist/martyrs/src/modules/auth/views/validations/inputs.validation.js.map +1 -1
  171. package/dist/martyrs/src/modules/backoffice/backoffice.client.cjs.map +1 -1
  172. package/dist/martyrs/src/modules/backoffice/backoffice.client.js.map +1 -1
  173. package/dist/martyrs/src/modules/backoffice/components/pages/Dashboard.vue.cjs.map +1 -1
  174. package/dist/martyrs/src/modules/backoffice/components/pages/Dashboard.vue.js.map +1 -1
  175. package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs +1 -1
  176. package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs.map +1 -1
  177. package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js +1 -1
  178. package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js.map +1 -1
  179. package/dist/martyrs/src/modules/backoffice/router/backoffice.cjs +1 -4
  180. package/dist/martyrs/src/modules/backoffice/router/backoffice.cjs.map +1 -1
  181. package/dist/martyrs/src/modules/backoffice/router/backoffice.js +1 -4
  182. package/dist/martyrs/src/modules/backoffice/router/backoffice.js.map +1 -1
  183. package/dist/martyrs/src/modules/chats/chats.client.cjs.map +1 -1
  184. package/dist/martyrs/src/modules/chats/chats.client.js.map +1 -1
  185. package/dist/martyrs/src/modules/chats/store/chat.store.cjs +10 -6
  186. package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
  187. package/dist/martyrs/src/modules/chats/store/chat.store.js +10 -6
  188. package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
  189. package/dist/martyrs/src/modules/community/community.client.cjs +14 -14
  190. package/dist/martyrs/src/modules/community/community.client.cjs.map +1 -1
  191. package/dist/martyrs/src/modules/community/community.client.js +3 -3
  192. package/dist/martyrs/src/modules/community/community.client.js.map +1 -1
  193. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
  194. package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
  195. package/dist/martyrs/src/modules/community/components/blocks/FooterBlogpost.vue.cjs.map +1 -1
  196. package/dist/martyrs/src/modules/community/components/blocks/FooterBlogpost.vue.js.map +1 -1
  197. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs.map +1 -1
  198. package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js.map +1 -1
  199. package/dist/martyrs/src/modules/community/components/pages/Blog.vue.cjs.map +1 -1
  200. package/dist/martyrs/src/modules/community/components/pages/Blog.vue.js.map +1 -1
  201. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +1 -1
  202. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs.map +1 -1
  203. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +1 -1
  204. package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js.map +1 -1
  205. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +16 -10
  206. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs.map +1 -1
  207. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +16 -10
  208. package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js.map +1 -1
  209. package/dist/martyrs/src/modules/community/components/sections/Comment.vue.cjs +2 -2
  210. package/dist/martyrs/src/modules/community/components/sections/Comment.vue.cjs.map +1 -1
  211. package/dist/martyrs/src/modules/community/components/sections/Comment.vue.js +2 -2
  212. package/dist/martyrs/src/modules/community/components/sections/Comment.vue.js.map +1 -1
  213. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  214. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  215. package/dist/martyrs/src/modules/community/router/blogposts.cjs +61 -59
  216. package/dist/martyrs/src/modules/community/router/blogposts.cjs.map +1 -1
  217. package/dist/martyrs/src/modules/community/router/blogposts.js +61 -59
  218. package/dist/martyrs/src/modules/community/router/blogposts.js.map +1 -1
  219. package/dist/martyrs/src/modules/community/store/blogposts.cjs +14 -10
  220. package/dist/martyrs/src/modules/community/store/blogposts.cjs.map +1 -1
  221. package/dist/martyrs/src/modules/community/store/blogposts.js +14 -10
  222. package/dist/martyrs/src/modules/community/store/blogposts.js.map +1 -1
  223. package/dist/martyrs/src/modules/community/store/reactions.cjs.map +1 -1
  224. package/dist/martyrs/src/modules/community/store/reactions.js.map +1 -1
  225. package/dist/martyrs/src/modules/constructor/components/elements/Embed.vue.cjs +5 -3
  226. package/dist/martyrs/src/modules/constructor/components/elements/Embed.vue.cjs.map +1 -1
  227. package/dist/martyrs/src/modules/constructor/components/elements/Embed.vue.js +5 -3
  228. package/dist/martyrs/src/modules/constructor/components/elements/Embed.vue.js.map +1 -1
  229. package/dist/martyrs/src/modules/constructor/components/elements/ImageUpload.vue.cjs.map +1 -1
  230. package/dist/martyrs/src/modules/constructor/components/elements/ImageUpload.vue.js.map +1 -1
  231. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
  232. package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
  233. package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.cjs.map +1 -1
  234. package/dist/martyrs/src/modules/events/components/elements/ButtonCheck.vue.js.map +1 -1
  235. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  236. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.cjs.map +1 -1
  237. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  238. package/dist/martyrs/src/modules/events/components/elements/ButtonJoin.vue.js.map +1 -1
  239. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +12 -6
  240. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs.map +1 -1
  241. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +12 -6
  242. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js.map +1 -1
  243. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs.map +1 -1
  244. package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js.map +1 -1
  245. package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +3 -4
  246. package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs.map +1 -1
  247. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +3 -4
  248. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js.map +1 -1
  249. package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs.map +1 -1
  250. package/dist/martyrs/src/modules/events/components/pages/Events.vue.js.map +1 -1
  251. package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.cjs.map +1 -1
  252. package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.js.map +1 -1
  253. package/dist/martyrs/src/modules/events/components/pages/EventsSearch.vue.cjs.map +1 -1
  254. package/dist/martyrs/src/modules/events/components/pages/EventsSearch.vue.js.map +1 -1
  255. package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.cjs +1 -1
  256. package/dist/martyrs/src/modules/events/components/sections/EventsHot.vue.js +1 -1
  257. package/dist/martyrs/src/modules/events/components/sections/FeaturedEvents.vue.cjs +1 -1
  258. package/dist/martyrs/src/modules/events/components/sections/FeaturedEvents.vue.cjs.map +1 -1
  259. package/dist/martyrs/src/modules/events/components/sections/FeaturedEvents.vue.js +1 -1
  260. package/dist/martyrs/src/modules/events/components/sections/FeaturedEvents.vue.js.map +1 -1
  261. package/dist/martyrs/src/modules/events/events.client.cjs +17 -17
  262. package/dist/martyrs/src/modules/events/events.client.cjs.map +1 -1
  263. package/dist/martyrs/src/modules/events/events.client.js +4 -4
  264. package/dist/martyrs/src/modules/events/events.client.js.map +1 -1
  265. package/dist/martyrs/src/modules/events/router/events.cjs +11 -21
  266. package/dist/martyrs/src/modules/events/router/events.cjs.map +1 -1
  267. package/dist/martyrs/src/modules/events/router/events.js +11 -21
  268. package/dist/martyrs/src/modules/events/router/events.js.map +1 -1
  269. package/dist/martyrs/src/modules/events/store/events.cjs.map +1 -1
  270. package/dist/martyrs/src/modules/events/store/events.js.map +1 -1
  271. package/dist/martyrs/src/modules/events/store/tickets.cjs +3 -1
  272. package/dist/martyrs/src/modules/events/store/tickets.cjs.map +1 -1
  273. package/dist/martyrs/src/modules/events/store/tickets.js +3 -1
  274. package/dist/martyrs/src/modules/events/store/tickets.js.map +1 -1
  275. package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.cjs.map +1 -1
  276. package/dist/martyrs/src/modules/gallery/components/pages/Gallery.vue.js.map +1 -1
  277. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +2 -2
  278. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs.map +1 -1
  279. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
  280. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js.map +1 -1
  281. package/dist/martyrs/src/modules/gallery/gallery.client.cjs.map +1 -1
  282. package/dist/martyrs/src/modules/gallery/gallery.client.js.map +1 -1
  283. package/dist/martyrs/src/modules/gallery/router/gallery.backoffice.router.cjs +17 -17
  284. package/dist/martyrs/src/modules/gallery/router/gallery.backoffice.router.cjs.map +1 -1
  285. package/dist/martyrs/src/modules/gallery/router/gallery.backoffice.router.js +17 -17
  286. package/dist/martyrs/src/modules/gallery/router/gallery.backoffice.router.js.map +1 -1
  287. package/dist/martyrs/src/modules/gallery/router/gallery.router.cjs.map +1 -1
  288. package/dist/martyrs/src/modules/gallery/router/gallery.router.js.map +1 -1
  289. package/dist/martyrs/src/modules/gallery/store/gallery.cjs.map +1 -1
  290. package/dist/martyrs/src/modules/gallery/store/gallery.js.map +1 -1
  291. package/dist/martyrs/src/modules/globals/globals.client.cjs +24 -8
  292. package/dist/martyrs/src/modules/globals/globals.client.cjs.map +1 -1
  293. package/dist/martyrs/src/modules/globals/globals.client.js +22 -6
  294. package/dist/martyrs/src/modules/globals/globals.client.js.map +1 -1
  295. package/dist/martyrs/src/modules/globals/views/classes/globals.store.cjs +9 -7
  296. package/dist/martyrs/src/modules/globals/views/classes/globals.store.cjs.map +1 -1
  297. package/dist/martyrs/src/modules/globals/views/classes/globals.store.js +9 -7
  298. package/dist/martyrs/src/modules/globals/views/classes/globals.store.js.map +1 -1
  299. package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.cjs.map +1 -1
  300. package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.js.map +1 -1
  301. package/dist/martyrs/src/modules/globals/views/classes/store.cjs +2 -2
  302. package/dist/martyrs/src/modules/globals/views/classes/store.cjs.map +1 -1
  303. package/dist/martyrs/src/modules/globals/views/classes/store.js +2 -2
  304. package/dist/martyrs/src/modules/globals/views/classes/store.js.map +1 -1
  305. package/dist/martyrs/src/modules/globals/views/{plugins → components/blocks}/AlertDialog.vue.cjs +1 -1
  306. package/dist/martyrs/src/modules/globals/views/components/blocks/AlertDialog.vue.cjs.map +1 -0
  307. package/dist/martyrs/src/modules/globals/views/{plugins → components/blocks}/AlertDialog.vue.js +1 -1
  308. package/dist/martyrs/src/modules/globals/views/components/blocks/AlertDialog.vue.js.map +1 -0
  309. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockMultiselect.vue.cjs +308 -0
  310. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockMultiselect.vue.cjs.map +1 -0
  311. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockMultiselect.vue.js +308 -0
  312. package/dist/martyrs/src/modules/globals/views/components/blocks/BlockMultiselect.vue.js.map +1 -0
  313. package/dist/martyrs/src/modules/globals/views/components/blocks/Card.vue.cjs +61 -49
  314. package/dist/martyrs/src/modules/globals/views/components/blocks/Card.vue.cjs.map +1 -1
  315. package/dist/martyrs/src/modules/globals/views/components/blocks/Card.vue.js +62 -50
  316. package/dist/martyrs/src/modules/globals/views/components/blocks/Card.vue.js.map +1 -1
  317. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +2 -2
  318. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs.map +1 -1
  319. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +2 -2
  320. package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js.map +1 -1
  321. package/dist/martyrs/src/modules/globals/views/components/elements/ButtonDate.vue.cjs +2 -2
  322. package/dist/martyrs/src/modules/globals/views/components/elements/ButtonDate.vue.cjs.map +1 -1
  323. package/dist/martyrs/src/modules/globals/views/components/elements/ButtonDate.vue.js +2 -2
  324. package/dist/martyrs/src/modules/globals/views/components/elements/ButtonDate.vue.js.map +1 -1
  325. package/dist/martyrs/src/modules/globals/views/components/layouts/App.vue.cjs.map +1 -1
  326. package/dist/martyrs/src/modules/globals/views/components/layouts/App.vue.js.map +1 -1
  327. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +1 -1
  328. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
  329. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +1 -1
  330. package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
  331. package/dist/martyrs/src/modules/globals/views/components/partials/BottomNavigationBar.vue.cjs.map +1 -1
  332. package/dist/martyrs/src/modules/globals/views/components/partials/BottomNavigationBar.vue.js.map +1 -1
  333. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs.map +1 -1
  334. package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js.map +1 -1
  335. package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.cjs.map +1 -1
  336. package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.js.map +1 -1
  337. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +9 -10
  338. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs.map +1 -1
  339. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +9 -10
  340. package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js.map +1 -1
  341. package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.cjs.map +1 -1
  342. package/dist/martyrs/src/modules/globals/views/components/partials/NavigationBar.vue.js.map +1 -1
  343. package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs +1 -1
  344. package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs.map +1 -1
  345. package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js +1 -1
  346. package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js.map +1 -1
  347. package/dist/martyrs/src/modules/globals/views/localization/get-browser-locale.cjs.map +1 -1
  348. package/dist/martyrs/src/modules/globals/views/localization/get-browser-locale.js.map +1 -1
  349. package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs +24 -5
  350. package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs.map +1 -1
  351. package/dist/martyrs/src/modules/globals/views/mixins/mixins.js +24 -5
  352. package/dist/martyrs/src/modules/globals/views/mixins/mixins.js.map +1 -1
  353. package/dist/martyrs/src/modules/globals/views/plugins/alert.plugin.cjs +1 -1
  354. package/dist/martyrs/src/modules/globals/views/plugins/alert.plugin.cjs.map +1 -1
  355. package/dist/martyrs/src/modules/globals/views/plugins/alert.plugin.js +1 -1
  356. package/dist/martyrs/src/modules/globals/views/plugins/alert.plugin.js.map +1 -1
  357. package/dist/martyrs/src/modules/globals/views/plugins/date-picker.plugin.cjs +74 -0
  358. package/dist/martyrs/src/modules/globals/views/plugins/date-picker.plugin.cjs.map +1 -0
  359. package/dist/martyrs/src/modules/globals/views/plugins/date-picker.plugin.js +74 -0
  360. package/dist/martyrs/src/modules/globals/views/plugins/date-picker.plugin.js.map +1 -0
  361. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.cjs +200 -0
  362. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.cjs.map +1 -0
  363. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.js +200 -0
  364. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue.js.map +1 -0
  365. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.cjs +21 -0
  366. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.cjs.map +1 -0
  367. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.js +21 -0
  368. package/dist/martyrs/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.js.map +1 -0
  369. package/dist/martyrs/src/modules/globals/views/router/addRoutes.cjs +1 -4
  370. package/dist/martyrs/src/modules/globals/views/router/addRoutes.cjs.map +1 -1
  371. package/dist/martyrs/src/modules/globals/views/router/addRoutes.js +1 -4
  372. package/dist/martyrs/src/modules/globals/views/router/addRoutes.js.map +1 -1
  373. package/dist/martyrs/src/modules/globals/views/router/scrollBehavior.cjs.map +1 -1
  374. package/dist/martyrs/src/modules/globals/views/router/scrollBehavior.js.map +1 -1
  375. package/dist/martyrs/src/modules/globals/views/store/globals.cjs +4 -14
  376. package/dist/martyrs/src/modules/globals/views/store/globals.cjs.map +1 -1
  377. package/dist/martyrs/src/modules/globals/views/store/globals.js +4 -14
  378. package/dist/martyrs/src/modules/globals/views/store/globals.js.map +1 -1
  379. package/dist/martyrs/src/modules/globals/views/utils/axios-instance.cjs.map +1 -1
  380. package/dist/martyrs/src/modules/globals/views/utils/axios-instance.js.map +1 -1
  381. package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.cjs +2 -2
  382. package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.cjs.map +1 -1
  383. package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.js +2 -2
  384. package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.js.map +1 -1
  385. package/dist/martyrs/src/modules/icons/actions/IconDuplicate.vue.cjs +39 -0
  386. package/dist/martyrs/src/modules/icons/actions/IconDuplicate.vue.cjs.map +1 -0
  387. package/dist/martyrs/src/modules/icons/actions/IconDuplicate.vue.js +39 -0
  388. package/dist/martyrs/src/modules/icons/actions/IconDuplicate.vue.js.map +1 -0
  389. package/dist/martyrs/src/modules/icons/entities/IconDiscount.vue.cjs +57 -0
  390. package/dist/martyrs/src/modules/icons/entities/IconDiscount.vue.cjs.map +1 -0
  391. package/dist/martyrs/src/modules/icons/entities/IconDiscount.vue.js +57 -0
  392. package/dist/martyrs/src/modules/icons/entities/IconDiscount.vue.js.map +1 -0
  393. package/dist/martyrs/src/modules/icons/entities/IconFile.vue.cjs +33 -0
  394. package/dist/martyrs/src/modules/icons/entities/IconFile.vue.cjs.map +1 -0
  395. package/dist/martyrs/src/modules/icons/entities/IconFile.vue.js +33 -0
  396. package/dist/martyrs/src/modules/icons/entities/IconFile.vue.js.map +1 -0
  397. package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.cjs +33 -0
  398. package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.cjs.map +1 -0
  399. package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.js +33 -0
  400. package/dist/martyrs/src/modules/icons/entities/IconMusic.vue.js.map +1 -0
  401. package/dist/martyrs/src/modules/icons/entities/IconSettings.vue.cjs +35 -0
  402. package/dist/martyrs/src/modules/icons/entities/IconSettings.vue.cjs.map +1 -0
  403. package/dist/martyrs/src/modules/icons/entities/IconSettings.vue.js +35 -0
  404. package/dist/martyrs/src/modules/icons/entities/IconSettings.vue.js.map +1 -0
  405. package/dist/martyrs/src/modules/icons/icons.client.cjs +97 -79
  406. package/dist/martyrs/src/modules/icons/icons.client.cjs.map +1 -1
  407. package/dist/martyrs/src/modules/icons/icons.client.js +140 -122
  408. package/dist/martyrs/src/modules/icons/icons.client.js.map +1 -1
  409. package/dist/martyrs/src/modules/icons/logos/Logotype.vue.cjs +25 -0
  410. package/dist/martyrs/src/modules/icons/logos/Logotype.vue.cjs.map +1 -0
  411. package/dist/martyrs/src/modules/icons/logos/Logotype.vue.js +25 -0
  412. package/dist/martyrs/src/modules/icons/logos/Logotype.vue.js.map +1 -0
  413. package/dist/martyrs/src/modules/icons/navigation/IconAttach.vue.cjs +35 -0
  414. package/dist/martyrs/src/modules/icons/navigation/IconAttach.vue.cjs.map +1 -0
  415. package/dist/martyrs/src/modules/icons/navigation/IconAttach.vue.js +35 -0
  416. package/dist/martyrs/src/modules/icons/navigation/IconAttach.vue.js.map +1 -0
  417. package/dist/martyrs/src/modules/icons/navigation/IconCheck.vue.cjs +39 -0
  418. package/dist/martyrs/src/modules/icons/navigation/IconCheck.vue.cjs.map +1 -0
  419. package/dist/martyrs/src/modules/icons/navigation/IconCheck.vue.js +39 -0
  420. package/dist/martyrs/src/modules/icons/navigation/IconCheck.vue.js.map +1 -0
  421. package/dist/martyrs/src/modules/icons/navigation/IconDoubleCheck.vue.cjs +39 -0
  422. package/dist/martyrs/src/modules/icons/navigation/IconDoubleCheck.vue.cjs.map +1 -0
  423. package/dist/martyrs/src/modules/icons/navigation/IconDoubleCheck.vue.js +39 -0
  424. package/dist/martyrs/src/modules/icons/navigation/IconDoubleCheck.vue.js.map +1 -0
  425. package/dist/martyrs/src/modules/icons/navigation/IconHeart.vue.cjs +34 -0
  426. package/dist/martyrs/src/modules/icons/navigation/IconHeart.vue.cjs.map +1 -0
  427. package/dist/martyrs/src/modules/icons/navigation/IconHeart.vue.js +34 -0
  428. package/dist/martyrs/src/modules/icons/navigation/IconHeart.vue.js.map +1 -0
  429. package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.cjs +39 -0
  430. package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.cjs.map +1 -0
  431. package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.js +39 -0
  432. package/dist/martyrs/src/modules/icons/navigation/IconPause.vue.js.map +1 -0
  433. package/dist/martyrs/src/modules/icons/navigation/IconPlay.vue.cjs +31 -0
  434. package/dist/martyrs/src/modules/icons/navigation/IconPlay.vue.cjs.map +1 -0
  435. package/dist/martyrs/src/modules/icons/navigation/IconPlay.vue.js +31 -0
  436. package/dist/martyrs/src/modules/icons/navigation/IconPlay.vue.js.map +1 -0
  437. package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.cjs +39 -0
  438. package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.cjs.map +1 -0
  439. package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.js +39 -0
  440. package/dist/martyrs/src/modules/icons/navigation/IconRefresh.vue.js.map +1 -0
  441. package/dist/martyrs/src/modules/icons/navigation/IconSend.vue.cjs +31 -0
  442. package/dist/martyrs/src/modules/icons/navigation/IconSend.vue.cjs.map +1 -0
  443. package/dist/martyrs/src/modules/icons/navigation/IconSend.vue.js +31 -0
  444. package/dist/martyrs/src/modules/icons/navigation/IconSend.vue.js.map +1 -0
  445. package/dist/martyrs/src/modules/icons/navigation/IconShuffle.vue.cjs +39 -0
  446. package/dist/martyrs/src/modules/icons/navigation/IconShuffle.vue.cjs.map +1 -0
  447. package/dist/martyrs/src/modules/icons/navigation/IconShuffle.vue.js +39 -0
  448. package/dist/martyrs/src/modules/icons/navigation/IconShuffle.vue.js.map +1 -0
  449. package/dist/martyrs/src/modules/icons/navigation/IconVolume.vue.cjs +39 -0
  450. package/dist/martyrs/src/modules/icons/navigation/IconVolume.vue.cjs.map +1 -0
  451. package/dist/martyrs/src/modules/icons/navigation/IconVolume.vue.js +39 -0
  452. package/dist/martyrs/src/modules/icons/navigation/IconVolume.vue.js.map +1 -0
  453. package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.cjs +278 -0
  454. package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.cjs.map +1 -0
  455. package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.js +278 -0
  456. package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.js.map +1 -0
  457. package/dist/martyrs/src/modules/icons/router/icons.router.cjs +33 -0
  458. package/dist/martyrs/src/modules/icons/router/icons.router.cjs.map +1 -0
  459. package/dist/martyrs/src/modules/icons/router/icons.router.js +33 -0
  460. package/dist/martyrs/src/modules/icons/router/icons.router.js.map +1 -0
  461. package/dist/martyrs/src/modules/icons/socials/dribbble.vue.cjs +2 -2
  462. package/dist/martyrs/src/modules/icons/socials/dribbble.vue.js +2 -2
  463. package/dist/martyrs/src/modules/icons/socials/facebook.vue.cjs +2 -2
  464. package/dist/martyrs/src/modules/icons/socials/facebook.vue.js +2 -2
  465. package/dist/martyrs/src/modules/icons/socials/instagram.vue.cjs +2 -2
  466. package/dist/martyrs/src/modules/icons/socials/instagram.vue.js +2 -2
  467. package/dist/martyrs/src/modules/icons/socials/line.vue.cjs +2 -2
  468. package/dist/martyrs/src/modules/icons/socials/line.vue.js +2 -2
  469. package/dist/martyrs/src/modules/icons/socials/linkedin.vue.cjs +2 -2
  470. package/dist/martyrs/src/modules/icons/socials/linkedin.vue.js +2 -2
  471. package/dist/martyrs/src/modules/icons/socials/reddit.vue.cjs +2 -2
  472. package/dist/martyrs/src/modules/icons/socials/reddit.vue.js +2 -2
  473. package/dist/martyrs/src/modules/icons/socials/telegram.vue.cjs +2 -2
  474. package/dist/martyrs/src/modules/icons/socials/telegram.vue.js +2 -2
  475. package/dist/martyrs/src/modules/icons/socials/twitter.vue.cjs +2 -2
  476. package/dist/martyrs/src/modules/icons/socials/twitter.vue.js +2 -2
  477. package/dist/martyrs/src/modules/icons/socials/vk.vue.cjs +2 -2
  478. package/dist/martyrs/src/modules/icons/socials/vk.vue.js +2 -2
  479. package/dist/martyrs/src/modules/icons/socials/youtube.vue.cjs +2 -2
  480. package/dist/martyrs/src/modules/icons/socials/youtube.vue.js +2 -2
  481. package/dist/martyrs/src/modules/landing/landing.client.cjs +12 -12
  482. package/dist/martyrs/src/modules/landing/landing.client.js +22 -22
  483. package/dist/martyrs/src/modules/marketplace/marketplace.client.cjs.map +1 -1
  484. package/dist/martyrs/src/modules/marketplace/marketplace.client.js.map +1 -1
  485. package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs.map +1 -1
  486. package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js.map +1 -1
  487. package/dist/martyrs/src/modules/marketplace/views/components/pages/Catalog.vue.cjs.map +1 -1
  488. package/dist/martyrs/src/modules/marketplace/views/components/pages/Catalog.vue.js.map +1 -1
  489. package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.cjs.map +1 -1
  490. package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.js.map +1 -1
  491. package/dist/martyrs/src/modules/marketplace/views/router/marketplace.router.cjs +0 -1
  492. package/dist/martyrs/src/modules/marketplace/views/router/marketplace.router.cjs.map +1 -1
  493. package/dist/martyrs/src/modules/marketplace/views/router/marketplace.router.js +0 -1
  494. package/dist/martyrs/src/modules/marketplace/views/router/marketplace.router.js.map +1 -1
  495. package/dist/martyrs/src/modules/marketplace/views/store/marketplace.cjs +25 -19
  496. package/dist/martyrs/src/modules/marketplace/views/store/marketplace.cjs.map +1 -1
  497. package/dist/martyrs/src/modules/marketplace/views/store/marketplace.js +25 -19
  498. package/dist/martyrs/src/modules/marketplace/views/store/marketplace.js.map +1 -1
  499. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.cjs +1 -1
  500. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.cjs.map +1 -1
  501. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js +1 -1
  502. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js.map +1 -1
  503. package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.cjs +1 -1
  504. package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.cjs.map +1 -1
  505. package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.js +1 -1
  506. package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.js.map +1 -1
  507. package/dist/martyrs/src/modules/notifications/notifications.client.cjs +18 -27
  508. package/dist/martyrs/src/modules/notifications/notifications.client.cjs.map +1 -1
  509. package/dist/martyrs/src/modules/notifications/notifications.client.js +16 -25
  510. package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
  511. package/dist/martyrs/src/modules/notifications/router/notifications.router.cjs +1 -1
  512. package/dist/martyrs/src/modules/notifications/router/notifications.router.cjs.map +1 -1
  513. package/dist/martyrs/src/modules/notifications/router/notifications.router.js +1 -1
  514. package/dist/martyrs/src/modules/notifications/router/notifications.router.js.map +1 -1
  515. package/dist/martyrs/src/modules/notifications/store/notifications.store.cjs.map +1 -1
  516. package/dist/martyrs/src/modules/notifications/store/notifications.store.js.map +1 -1
  517. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.cjs +1 -1
  518. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.js +1 -1
  519. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +2 -2
  520. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs.map +1 -1
  521. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +2 -2
  522. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js.map +1 -1
  523. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
  524. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
  525. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -3
  526. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs.map +1 -1
  527. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -3
  528. package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js.map +1 -1
  529. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs.map +1 -1
  530. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js.map +1 -1
  531. package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs.map +1 -1
  532. package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js.map +1 -1
  533. package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.cjs.map +1 -1
  534. package/dist/martyrs/src/modules/orders/components/sections/FormAddCustomer.vue.js.map +1 -1
  535. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
  536. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs.map +1 -1
  537. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
  538. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js.map +1 -1
  539. package/dist/martyrs/src/modules/orders/orders.client.cjs +5 -5
  540. package/dist/martyrs/src/modules/orders/orders.client.cjs.map +1 -1
  541. package/dist/martyrs/src/modules/orders/orders.client.js +5 -5
  542. package/dist/martyrs/src/modules/orders/orders.client.js.map +1 -1
  543. package/dist/martyrs/src/modules/orders/router/orders.router.cjs +2 -3
  544. package/dist/martyrs/src/modules/orders/router/orders.router.cjs.map +1 -1
  545. package/dist/martyrs/src/modules/orders/router/orders.router.js +2 -3
  546. package/dist/martyrs/src/modules/orders/router/orders.router.js.map +1 -1
  547. package/dist/martyrs/src/modules/orders/store/applications.cjs.map +1 -1
  548. package/dist/martyrs/src/modules/orders/store/applications.js.map +1 -1
  549. package/dist/martyrs/src/modules/orders/store/customers.store.cjs.map +1 -1
  550. package/dist/martyrs/src/modules/orders/store/customers.store.js.map +1 -1
  551. package/dist/martyrs/src/modules/orders/store/models/customer.cjs.map +1 -1
  552. package/dist/martyrs/src/modules/orders/store/models/customer.js.map +1 -1
  553. package/dist/martyrs/src/modules/orders/store/models/order.cjs.map +1 -1
  554. package/dist/martyrs/src/modules/orders/store/models/order.js.map +1 -1
  555. package/dist/martyrs/src/modules/orders/store/orders.cjs +23 -26
  556. package/dist/martyrs/src/modules/orders/store/orders.cjs.map +1 -1
  557. package/dist/martyrs/src/modules/orders/store/orders.js +23 -26
  558. package/dist/martyrs/src/modules/orders/store/orders.js.map +1 -1
  559. package/dist/martyrs/src/modules/orders/store/shopcart.cjs +94 -47
  560. package/dist/martyrs/src/modules/orders/store/shopcart.cjs.map +1 -1
  561. package/dist/martyrs/src/modules/orders/store/shopcart.js +94 -47
  562. package/dist/martyrs/src/modules/orders/store/shopcart.js.map +1 -1
  563. package/dist/martyrs/src/modules/orders/store/testimonials.cjs.map +1 -1
  564. package/dist/martyrs/src/modules/orders/store/testimonials.js.map +1 -1
  565. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
  566. package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
  567. package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js +16 -16
  568. package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js.map +1 -1
  569. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs.map +1 -1
  570. package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js.map +1 -1
  571. package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs.map +1 -1
  572. package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js.map +1 -1
  573. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs.map +1 -1
  574. package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js.map +1 -1
  575. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +2 -2
  576. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs.map +1 -1
  577. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +2 -2
  578. package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js.map +1 -1
  579. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +5 -5
  580. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
  581. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +5 -5
  582. package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
  583. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +2 -2
  584. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs.map +1 -1
  585. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +2 -2
  586. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js.map +1 -1
  587. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  588. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs.map +1 -1
  589. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +8 -8
  590. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js.map +1 -1
  591. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs.map +1 -1
  592. package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js.map +1 -1
  593. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs +2 -2
  594. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.cjs.map +1 -1
  595. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js +2 -2
  596. package/dist/martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue.js.map +1 -1
  597. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs.map +1 -1
  598. package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js.map +1 -1
  599. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +5 -5
  600. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs.map +1 -1
  601. package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js.map +1 -1
  602. package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.cjs.map +1 -1
  603. package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.js.map +1 -1
  604. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs +225 -0
  605. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs.map +1 -0
  606. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js +225 -0
  607. package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js.map +1 -0
  608. package/dist/martyrs/src/modules/organizations/organizations.client.cjs +28 -28
  609. package/dist/martyrs/src/modules/organizations/organizations.client.cjs.map +1 -1
  610. package/dist/martyrs/src/modules/organizations/organizations.client.js +10 -10
  611. package/dist/martyrs/src/modules/organizations/organizations.client.js.map +1 -1
  612. package/dist/martyrs/src/modules/organizations/router/backoffice.router.cjs +26 -23
  613. package/dist/martyrs/src/modules/organizations/router/backoffice.router.cjs.map +1 -1
  614. package/dist/martyrs/src/modules/organizations/router/backoffice.router.js +26 -23
  615. package/dist/martyrs/src/modules/organizations/router/backoffice.router.js.map +1 -1
  616. package/dist/martyrs/src/modules/organizations/router/departments.router.cjs +27 -23
  617. package/dist/martyrs/src/modules/organizations/router/departments.router.cjs.map +1 -1
  618. package/dist/martyrs/src/modules/organizations/router/departments.router.js +27 -23
  619. package/dist/martyrs/src/modules/organizations/router/departments.router.js.map +1 -1
  620. package/dist/martyrs/src/modules/organizations/router/members.router.cjs +17 -15
  621. package/dist/martyrs/src/modules/organizations/router/members.router.cjs.map +1 -1
  622. package/dist/martyrs/src/modules/organizations/router/members.router.js +17 -15
  623. package/dist/martyrs/src/modules/organizations/router/members.router.js.map +1 -1
  624. package/dist/martyrs/src/modules/organizations/router/organizations.cjs +73 -60
  625. package/dist/martyrs/src/modules/organizations/router/organizations.cjs.map +1 -1
  626. package/dist/martyrs/src/modules/organizations/router/organizations.js +73 -60
  627. package/dist/martyrs/src/modules/organizations/router/organizations.js.map +1 -1
  628. package/dist/martyrs/src/modules/organizations/store/departments.cjs +3 -1
  629. package/dist/martyrs/src/modules/organizations/store/departments.cjs.map +1 -1
  630. package/dist/martyrs/src/modules/organizations/store/departments.js +3 -1
  631. package/dist/martyrs/src/modules/organizations/store/departments.js.map +1 -1
  632. package/dist/martyrs/src/modules/organizations/store/invites.cjs.map +1 -1
  633. package/dist/martyrs/src/modules/organizations/store/invites.js.map +1 -1
  634. package/dist/martyrs/src/modules/organizations/store/memberships.cjs.map +1 -1
  635. package/dist/martyrs/src/modules/organizations/store/memberships.js.map +1 -1
  636. package/dist/martyrs/src/modules/organizations/store/organizations.cjs.map +1 -1
  637. package/dist/martyrs/src/modules/organizations/store/organizations.js.map +1 -1
  638. package/dist/martyrs/src/modules/pages/pages.client.cjs +2 -2
  639. package/dist/martyrs/src/modules/pages/pages.client.cjs.map +1 -1
  640. package/dist/martyrs/src/modules/pages/pages.client.js +2 -2
  641. package/dist/martyrs/src/modules/pages/pages.client.js.map +1 -1
  642. package/dist/martyrs/src/modules/pages/views/components/pages/Page.vue.cjs.map +1 -1
  643. package/dist/martyrs/src/modules/pages/views/components/pages/Page.vue.js.map +1 -1
  644. package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.cjs +1 -1
  645. package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +1 -1
  646. package/dist/martyrs/src/modules/pages/views/components/pages/Pages.vue.cjs.map +1 -1
  647. package/dist/martyrs/src/modules/pages/views/components/pages/Pages.vue.js.map +1 -1
  648. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.cjs.map +1 -1
  649. package/dist/martyrs/src/modules/pages/views/components/partials/SidebarPages.vue.js.map +1 -1
  650. package/dist/martyrs/src/modules/pages/views/router/pages.backoffice.router.cjs +35 -31
  651. package/dist/martyrs/src/modules/pages/views/router/pages.backoffice.router.cjs.map +1 -1
  652. package/dist/martyrs/src/modules/pages/views/router/pages.backoffice.router.js +35 -31
  653. package/dist/martyrs/src/modules/pages/views/router/pages.backoffice.router.js.map +1 -1
  654. package/dist/martyrs/src/modules/pages/views/router/pages.router.cjs +16 -14
  655. package/dist/martyrs/src/modules/pages/views/router/pages.router.cjs.map +1 -1
  656. package/dist/martyrs/src/modules/pages/views/router/pages.router.js +16 -14
  657. package/dist/martyrs/src/modules/pages/views/router/pages.router.js.map +1 -1
  658. package/dist/martyrs/src/modules/pages/views/store/pages.cjs +5 -2
  659. package/dist/martyrs/src/modules/pages/views/store/pages.cjs.map +1 -1
  660. package/dist/martyrs/src/modules/pages/views/store/pages.js +5 -2
  661. package/dist/martyrs/src/modules/pages/views/store/pages.js.map +1 -1
  662. package/dist/martyrs/src/modules/products/components/blocks/CardLeftover.vue.cjs +2 -2
  663. package/dist/martyrs/src/modules/products/components/blocks/CardLeftover.vue.cjs.map +1 -1
  664. package/dist/martyrs/src/modules/products/components/blocks/CardLeftover.vue.js +2 -2
  665. package/dist/martyrs/src/modules/products/components/blocks/CardLeftover.vue.js.map +1 -1
  666. package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.cjs +76 -135
  667. package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.cjs.map +1 -1
  668. package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.js +77 -136
  669. package/dist/martyrs/src/modules/products/components/blocks/CardPosition.vue.js.map +1 -1
  670. package/dist/martyrs/src/modules/products/components/blocks/CardProduct.vue.cjs +4 -4
  671. package/dist/martyrs/src/modules/products/components/blocks/CardProduct.vue.cjs.map +1 -1
  672. package/dist/martyrs/src/modules/products/components/blocks/CardProduct.vue.js +4 -4
  673. package/dist/martyrs/src/modules/products/components/blocks/CardProduct.vue.js.map +1 -1
  674. package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs +128 -0
  675. package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs.map +1 -0
  676. package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js +128 -0
  677. package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js.map +1 -0
  678. package/dist/martyrs/src/modules/products/components/blocks/{ImagesThumbnails.vue.cjs → ProductImages.vue.cjs} +7 -7
  679. package/dist/martyrs/src/modules/products/components/blocks/ProductImages.vue.cjs.map +1 -0
  680. package/dist/martyrs/src/modules/products/components/blocks/{ImagesThumbnails.vue.js → ProductImages.vue.js} +7 -7
  681. package/dist/martyrs/src/modules/products/components/blocks/ProductImages.vue.js.map +1 -0
  682. package/dist/martyrs/src/modules/products/components/blocks/ProductVariants.vue.cjs +141 -0
  683. package/dist/martyrs/src/modules/products/components/blocks/ProductVariants.vue.cjs.map +1 -0
  684. package/dist/martyrs/src/modules/products/components/blocks/ProductVariants.vue.js +141 -0
  685. package/dist/martyrs/src/modules/products/components/blocks/ProductVariants.vue.js.map +1 -0
  686. package/dist/martyrs/src/modules/products/components/{blocks/Images360.vue.cjs → elements/Image360.vue.cjs} +5 -5
  687. package/dist/martyrs/src/modules/products/components/{blocks/Images360.vue.cjs.map → elements/Image360.vue.cjs.map} +1 -1
  688. package/dist/martyrs/src/modules/products/components/{blocks/Images360.vue.js → elements/Image360.vue.js} +5 -5
  689. package/dist/martyrs/src/modules/products/components/{blocks/Images360.vue.js.map → elements/Image360.vue.js.map} +1 -1
  690. package/dist/martyrs/src/modules/products/components/elements/Price.vue.cjs +19 -20
  691. package/dist/martyrs/src/modules/products/components/elements/Price.vue.cjs.map +1 -1
  692. package/dist/martyrs/src/modules/products/components/elements/Price.vue.js +20 -21
  693. package/dist/martyrs/src/modules/products/components/elements/Price.vue.js.map +1 -1
  694. package/dist/martyrs/src/modules/products/components/elements/QuantitySelector.vue.cjs +71 -0
  695. package/dist/martyrs/src/modules/products/components/elements/QuantitySelector.vue.cjs.map +1 -0
  696. package/dist/martyrs/src/modules/products/components/elements/QuantitySelector.vue.js +71 -0
  697. package/dist/martyrs/src/modules/products/components/elements/QuantitySelector.vue.js.map +1 -0
  698. package/dist/martyrs/src/modules/products/components/elements/THC.vue.cjs +6 -6
  699. package/dist/martyrs/src/modules/products/components/elements/THC.vue.js +6 -6
  700. package/dist/martyrs/src/modules/products/components/forms/ColumnSettingsMenu.vue.cjs +73 -0
  701. package/dist/martyrs/src/modules/products/components/forms/ColumnSettingsMenu.vue.cjs.map +1 -0
  702. package/dist/martyrs/src/modules/products/components/forms/ColumnSettingsMenu.vue.js +73 -0
  703. package/dist/martyrs/src/modules/products/components/forms/ColumnSettingsMenu.vue.js.map +1 -0
  704. package/dist/martyrs/src/modules/products/components/forms/ReorderSettingsForm.vue.cjs +101 -0
  705. package/dist/martyrs/src/modules/products/components/forms/ReorderSettingsForm.vue.cjs.map +1 -0
  706. package/dist/martyrs/src/modules/products/components/forms/ReorderSettingsForm.vue.js +101 -0
  707. package/dist/martyrs/src/modules/products/components/forms/ReorderSettingsForm.vue.js.map +1 -0
  708. package/dist/martyrs/src/modules/products/components/forms/StockAuditForm.vue.cjs +135 -0
  709. package/dist/martyrs/src/modules/products/components/forms/StockAuditForm.vue.cjs.map +1 -0
  710. package/dist/martyrs/src/modules/products/components/forms/StockAuditForm.vue.js +135 -0
  711. package/dist/martyrs/src/modules/products/components/forms/StockAuditForm.vue.js.map +1 -0
  712. package/dist/martyrs/src/modules/products/components/forms/StockHistoryView.vue.cjs +148 -0
  713. package/dist/martyrs/src/modules/products/components/forms/StockHistoryView.vue.cjs.map +1 -0
  714. package/dist/martyrs/src/modules/products/components/forms/StockHistoryView.vue.js +148 -0
  715. package/dist/martyrs/src/modules/products/components/forms/StockHistoryView.vue.js.map +1 -0
  716. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +2 -2
  717. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs.map +1 -1
  718. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +2 -2
  719. package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js.map +1 -1
  720. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +6 -6
  721. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
  722. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +6 -6
  723. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
  724. package/dist/martyrs/src/modules/products/components/pages/LeftoverEdit.vue.cjs +345 -0
  725. package/dist/martyrs/src/modules/products/components/pages/LeftoverEdit.vue.cjs.map +1 -0
  726. package/dist/martyrs/src/modules/products/components/pages/LeftoverEdit.vue.js +345 -0
  727. package/dist/martyrs/src/modules/products/components/pages/LeftoverEdit.vue.js.map +1 -0
  728. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.cjs +279 -55
  729. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.cjs.map +1 -1
  730. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js +282 -58
  731. package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js.map +1 -1
  732. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +107 -116
  733. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
  734. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +116 -125
  735. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
  736. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +257 -312
  737. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
  738. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +262 -317
  739. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
  740. package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.cjs +2 -2
  741. package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.cjs.map +1 -1
  742. package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.js +2 -2
  743. package/dist/martyrs/src/modules/products/components/pages/ProductRecommmendation.vue.js.map +1 -1
  744. package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +2 -2
  745. package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
  746. package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +2 -2
  747. package/dist/martyrs/src/modules/products/components/pages/Products.vue.js.map +1 -1
  748. package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.cjs +168 -0
  749. package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.cjs.map +1 -0
  750. package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.js +168 -0
  751. package/dist/martyrs/src/modules/products/components/sections/EditAttributes.vue.js.map +1 -0
  752. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.cjs +319 -0
  753. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.cjs.map +1 -0
  754. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +319 -0
  755. package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js.map +1 -0
  756. package/dist/martyrs/src/modules/products/components/sections/EditIngredients.vue.cjs +140 -0
  757. package/dist/martyrs/src/modules/products/components/sections/EditIngredients.vue.cjs.map +1 -0
  758. package/dist/martyrs/src/modules/products/components/sections/EditIngredients.vue.js +140 -0
  759. package/dist/martyrs/src/modules/products/components/sections/EditIngredients.vue.js.map +1 -0
  760. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs +468 -0
  761. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs.map +1 -0
  762. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +468 -0
  763. package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js.map +1 -0
  764. package/dist/martyrs/src/modules/products/components/sections/FilterProducts.vue.cjs +2 -2
  765. package/dist/martyrs/src/modules/products/components/sections/FilterProducts.vue.cjs.map +1 -1
  766. package/dist/martyrs/src/modules/products/components/sections/FilterProducts.vue.js +2 -2
  767. package/dist/martyrs/src/modules/products/components/sections/FilterProducts.vue.js.map +1 -1
  768. package/dist/martyrs/src/modules/products/components/sections/HeroRecommendation.vue.cjs.map +1 -1
  769. package/dist/martyrs/src/modules/products/components/sections/HeroRecommendation.vue.js.map +1 -1
  770. package/dist/martyrs/src/modules/products/components/sections/PopularProducts.vue.cjs +1 -1
  771. package/dist/martyrs/src/modules/products/components/sections/PopularProducts.vue.cjs.map +1 -1
  772. package/dist/martyrs/src/modules/products/components/sections/PopularProducts.vue.js +1 -1
  773. package/dist/martyrs/src/modules/products/components/sections/PopularProducts.vue.js.map +1 -1
  774. package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.cjs +134 -0
  775. package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.cjs.map +1 -0
  776. package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.js +134 -0
  777. package/dist/martyrs/src/modules/products/components/sections/ProductConfigurator.vue.js.map +1 -0
  778. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +13 -13
  779. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs.map +1 -1
  780. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +13 -13
  781. package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js.map +1 -1
  782. package/dist/martyrs/src/modules/products/products.client.cjs +20 -29
  783. package/dist/martyrs/src/modules/products/products.client.cjs.map +1 -1
  784. package/dist/martyrs/src/modules/products/products.client.js +37 -46
  785. package/dist/martyrs/src/modules/products/products.client.js.map +1 -1
  786. package/dist/martyrs/src/modules/products/router/categories.router.cjs +34 -30
  787. package/dist/martyrs/src/modules/products/router/categories.router.cjs.map +1 -1
  788. package/dist/martyrs/src/modules/products/router/categories.router.js +34 -30
  789. package/dist/martyrs/src/modules/products/router/categories.router.js.map +1 -1
  790. package/dist/martyrs/src/modules/products/router/leftovers.router.cjs +42 -39
  791. package/dist/martyrs/src/modules/products/router/leftovers.router.cjs.map +1 -1
  792. package/dist/martyrs/src/modules/products/router/leftovers.router.js +42 -39
  793. package/dist/martyrs/src/modules/products/router/leftovers.router.js.map +1 -1
  794. package/dist/martyrs/src/modules/products/router/products.router.cjs +0 -1
  795. package/dist/martyrs/src/modules/products/router/products.router.cjs.map +1 -1
  796. package/dist/martyrs/src/modules/products/router/products.router.js +0 -1
  797. package/dist/martyrs/src/modules/products/router/products.router.js.map +1 -1
  798. package/dist/martyrs/src/modules/products/store/categories.cjs +7 -3
  799. package/dist/martyrs/src/modules/products/store/categories.cjs.map +1 -1
  800. package/dist/martyrs/src/modules/products/store/categories.js +7 -3
  801. package/dist/martyrs/src/modules/products/store/categories.js.map +1 -1
  802. package/dist/martyrs/src/modules/products/store/leftovers.cjs +42 -3
  803. package/dist/martyrs/src/modules/products/store/leftovers.cjs.map +1 -1
  804. package/dist/martyrs/src/modules/products/store/leftovers.js +42 -3
  805. package/dist/martyrs/src/modules/products/store/leftovers.js.map +1 -1
  806. package/dist/martyrs/src/modules/products/store/products.cjs +32 -60
  807. package/dist/martyrs/src/modules/products/store/products.cjs.map +1 -1
  808. package/dist/martyrs/src/modules/products/store/products.js +32 -60
  809. package/dist/martyrs/src/modules/products/store/products.js.map +1 -1
  810. package/dist/martyrs/src/modules/products/store/variants.store.cjs +6 -0
  811. package/dist/martyrs/src/modules/products/store/variants.store.cjs.map +1 -0
  812. package/dist/martyrs/src/modules/products/store/variants.store.js +6 -0
  813. package/dist/martyrs/src/modules/products/store/variants.store.js.map +1 -0
  814. package/dist/martyrs/src/modules/rents/rents.client.cjs.map +1 -1
  815. package/dist/martyrs/src/modules/rents/rents.client.js.map +1 -1
  816. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.cjs +1 -2
  817. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.cjs.map +1 -1
  818. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.js +1 -2
  819. package/dist/martyrs/src/modules/rents/views/components/pages/RentsEdit.vue.js.map +1 -1
  820. package/dist/martyrs/src/modules/rents/views/router/rents.router.cjs +3 -11
  821. package/dist/martyrs/src/modules/rents/views/router/rents.router.cjs.map +1 -1
  822. package/dist/martyrs/src/modules/rents/views/router/rents.router.js +3 -11
  823. package/dist/martyrs/src/modules/rents/views/router/rents.router.js.map +1 -1
  824. package/dist/martyrs/src/modules/rents/views/store/rents.store.cjs.map +1 -1
  825. package/dist/martyrs/src/modules/rents/views/store/rents.store.js.map +1 -1
  826. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs.map +1 -1
  827. package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js.map +1 -1
  828. package/dist/martyrs/src/modules/reports/reports.client.cjs.map +1 -1
  829. package/dist/martyrs/src/modules/reports/reports.client.js.map +1 -1
  830. package/dist/martyrs/src/modules/reports/store/reports.cjs +1 -1
  831. package/dist/martyrs/src/modules/reports/store/reports.cjs.map +1 -1
  832. package/dist/martyrs/src/modules/reports/store/reports.js +1 -1
  833. package/dist/martyrs/src/modules/reports/store/reports.js.map +1 -1
  834. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +74 -51
  835. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs.map +1 -1
  836. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +75 -52
  837. package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js.map +1 -1
  838. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
  839. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs.map +1 -1
  840. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
  841. package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js.map +1 -1
  842. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.cjs +1 -1
  843. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.cjs.map +1 -1
  844. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js +1 -1
  845. package/dist/martyrs/src/modules/spots/components/pages/Map.vue.js.map +1 -1
  846. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs.map +1 -1
  847. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js.map +1 -1
  848. package/dist/martyrs/src/modules/spots/router/spots.cjs +3 -9
  849. package/dist/martyrs/src/modules/spots/router/spots.cjs.map +1 -1
  850. package/dist/martyrs/src/modules/spots/router/spots.js +3 -9
  851. package/dist/martyrs/src/modules/spots/router/spots.js.map +1 -1
  852. package/dist/martyrs/src/modules/spots/spots.client.cjs +1 -1
  853. package/dist/martyrs/src/modules/spots/spots.client.cjs.map +1 -1
  854. package/dist/martyrs/src/modules/spots/spots.client.js +1 -1
  855. package/dist/martyrs/src/modules/spots/spots.client.js.map +1 -1
  856. package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
  857. package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
  858. package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +3 -3
  859. package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +3 -3
  860. package/dist/martyrs/src/modules/wallet/views/router/payments.router.cjs +26 -23
  861. package/dist/martyrs/src/modules/wallet/views/router/payments.router.cjs.map +1 -1
  862. package/dist/martyrs/src/modules/wallet/views/router/payments.router.js +26 -23
  863. package/dist/martyrs/src/modules/wallet/views/router/payments.router.js.map +1 -1
  864. package/dist/martyrs/src/modules/wallet/views/store/payments.store.cjs +2 -2
  865. package/dist/martyrs/src/modules/wallet/views/store/payments.store.cjs.map +1 -1
  866. package/dist/martyrs/src/modules/wallet/views/store/payments.store.js +2 -2
  867. package/dist/martyrs/src/modules/wallet/views/store/payments.store.js.map +1 -1
  868. package/dist/martyrs/src/modules/wallet/views/store/wallet.store.cjs +11 -12
  869. package/dist/martyrs/src/modules/wallet/views/store/wallet.store.cjs.map +1 -1
  870. package/dist/martyrs/src/modules/wallet/views/store/wallet.store.js +11 -12
  871. package/dist/martyrs/src/modules/wallet/views/store/wallet.store.js.map +1 -1
  872. package/dist/martyrs.cjs.js +1 -1
  873. package/dist/martyrs.css +1 -1
  874. package/dist/martyrs.es.js +1 -1
  875. package/dist/metadata.schema-CWmcDJN7.js +268 -0
  876. package/dist/metadata.schema-RlxNv46L.cjs +267 -0
  877. package/dist/node_modules/date-fns/_lib/addLeadingZeros.cjs +9 -0
  878. package/dist/node_modules/date-fns/_lib/addLeadingZeros.cjs.map +1 -0
  879. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
  880. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js.map +1 -0
  881. package/dist/node_modules/date-fns/_lib/defaultOptions.cjs +8 -0
  882. package/dist/node_modules/date-fns/_lib/defaultOptions.cjs.map +1 -0
  883. package/dist/node_modules/date-fns/_lib/defaultOptions.js +8 -0
  884. package/dist/node_modules/date-fns/_lib/defaultOptions.js.map +1 -0
  885. package/dist/node_modules/date-fns/_lib/format/formatters.cjs +653 -0
  886. package/dist/node_modules/date-fns/_lib/format/formatters.cjs.map +1 -0
  887. package/dist/node_modules/date-fns/_lib/format/formatters.js +653 -0
  888. package/dist/node_modules/date-fns/_lib/format/formatters.js.map +1 -0
  889. package/dist/node_modules/date-fns/_lib/format/lightFormatters.cjs +63 -0
  890. package/dist/node_modules/date-fns/_lib/format/lightFormatters.cjs.map +1 -0
  891. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +63 -0
  892. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js.map +1 -0
  893. package/dist/node_modules/date-fns/_lib/format/longFormatters.cjs +59 -0
  894. package/dist/node_modules/date-fns/_lib/format/longFormatters.cjs.map +1 -0
  895. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +59 -0
  896. package/dist/node_modules/date-fns/_lib/format/longFormatters.js.map +1 -0
  897. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs +21 -0
  898. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs.map +1 -0
  899. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +21 -0
  900. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js.map +1 -0
  901. package/dist/node_modules/date-fns/_lib/normalizeDates.cjs +12 -0
  902. package/dist/node_modules/date-fns/_lib/normalizeDates.cjs.map +1 -0
  903. package/dist/node_modules/date-fns/_lib/normalizeDates.js +12 -0
  904. package/dist/node_modules/date-fns/_lib/normalizeDates.js.map +1 -0
  905. package/dist/node_modules/date-fns/_lib/protectedTokens.cjs +24 -0
  906. package/dist/node_modules/date-fns/_lib/protectedTokens.cjs.map +1 -0
  907. package/dist/node_modules/date-fns/_lib/protectedTokens.js +24 -0
  908. package/dist/node_modules/date-fns/_lib/protectedTokens.js.map +1 -0
  909. package/dist/node_modules/date-fns/constants.cjs +9 -0
  910. package/dist/node_modules/date-fns/constants.cjs.map +1 -0
  911. package/dist/node_modules/date-fns/constants.js +9 -0
  912. package/dist/node_modules/date-fns/constants.js.map +1 -0
  913. package/dist/node_modules/date-fns/constructFrom.cjs +13 -0
  914. package/dist/node_modules/date-fns/constructFrom.cjs.map +1 -0
  915. package/dist/node_modules/date-fns/constructFrom.js +13 -0
  916. package/dist/node_modules/date-fns/constructFrom.js.map +1 -0
  917. package/dist/node_modules/date-fns/differenceInCalendarDays.cjs +21 -0
  918. package/dist/node_modules/date-fns/differenceInCalendarDays.cjs.map +1 -0
  919. package/dist/node_modules/date-fns/differenceInCalendarDays.js +21 -0
  920. package/dist/node_modules/date-fns/differenceInCalendarDays.js.map +1 -0
  921. package/dist/node_modules/date-fns/format.cjs +80 -0
  922. package/dist/node_modules/date-fns/format.cjs.map +1 -0
  923. package/dist/node_modules/date-fns/format.js +80 -0
  924. package/dist/node_modules/date-fns/format.js.map +1 -0
  925. package/dist/node_modules/date-fns/getDayOfYear.cjs +14 -0
  926. package/dist/node_modules/date-fns/getDayOfYear.cjs.map +1 -0
  927. package/dist/node_modules/date-fns/getDayOfYear.js +14 -0
  928. package/dist/node_modules/date-fns/getDayOfYear.js.map +1 -0
  929. package/dist/node_modules/date-fns/getISOWeek.cjs +14 -0
  930. package/dist/node_modules/date-fns/getISOWeek.cjs.map +1 -0
  931. package/dist/node_modules/date-fns/getISOWeek.js +14 -0
  932. package/dist/node_modules/date-fns/getISOWeek.js.map +1 -0
  933. package/dist/node_modules/date-fns/getISOWeekYear.cjs +27 -0
  934. package/dist/node_modules/date-fns/getISOWeekYear.cjs.map +1 -0
  935. package/dist/node_modules/date-fns/getISOWeekYear.js +27 -0
  936. package/dist/node_modules/date-fns/getISOWeekYear.js.map +1 -0
  937. package/dist/node_modules/date-fns/getWeek.cjs +14 -0
  938. package/dist/node_modules/date-fns/getWeek.cjs.map +1 -0
  939. package/dist/node_modules/date-fns/getWeek.js +14 -0
  940. package/dist/node_modules/date-fns/getWeek.js.map +1 -0
  941. package/dist/node_modules/date-fns/getWeekYear.cjs +31 -0
  942. package/dist/node_modules/date-fns/getWeekYear.cjs.map +1 -0
  943. package/dist/node_modules/date-fns/getWeekYear.js +31 -0
  944. package/dist/node_modules/date-fns/getWeekYear.js.map +1 -0
  945. package/dist/node_modules/date-fns/isDate.cjs +8 -0
  946. package/dist/node_modules/date-fns/isDate.cjs.map +1 -0
  947. package/dist/node_modules/date-fns/isDate.js +8 -0
  948. package/dist/node_modules/date-fns/isDate.js.map +1 -0
  949. package/dist/node_modules/date-fns/isValid.cjs +10 -0
  950. package/dist/node_modules/date-fns/isValid.cjs.map +1 -0
  951. package/dist/node_modules/date-fns/isValid.js +10 -0
  952. package/dist/node_modules/date-fns/isValid.js.map +1 -0
  953. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.cjs +11 -0
  954. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.cjs.map +1 -0
  955. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +11 -0
  956. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js.map +1 -0
  957. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.cjs +21 -0
  958. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.cjs.map +1 -0
  959. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +21 -0
  960. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js.map +1 -0
  961. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.cjs +44 -0
  962. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.cjs.map +1 -0
  963. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +44 -0
  964. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js.map +1 -0
  965. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.cjs +17 -0
  966. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.cjs.map +1 -0
  967. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +17 -0
  968. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js.map +1 -0
  969. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.cjs +86 -0
  970. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.cjs.map +1 -0
  971. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +86 -0
  972. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js.map +1 -0
  973. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.cjs +37 -0
  974. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.cjs.map +1 -0
  975. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +37 -0
  976. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js.map +1 -0
  977. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.cjs +13 -0
  978. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.cjs.map +1 -0
  979. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +13 -0
  980. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js.map +1 -0
  981. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.cjs +165 -0
  982. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.cjs.map +1 -0
  983. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +165 -0
  984. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js.map +1 -0
  985. package/dist/node_modules/date-fns/locale/en-US/_lib/match.cjs +123 -0
  986. package/dist/node_modules/date-fns/locale/en-US/_lib/match.cjs.map +1 -0
  987. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +123 -0
  988. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js.map +1 -0
  989. package/dist/node_modules/date-fns/locale/en-US.cjs +22 -0
  990. package/dist/node_modules/date-fns/locale/en-US.cjs.map +1 -0
  991. package/dist/node_modules/date-fns/locale/en-US.js +22 -0
  992. package/dist/node_modules/date-fns/locale/en-US.js.map +1 -0
  993. package/dist/node_modules/date-fns/startOfDay.cjs +11 -0
  994. package/dist/node_modules/date-fns/startOfDay.cjs.map +1 -0
  995. package/dist/node_modules/date-fns/startOfDay.js +11 -0
  996. package/dist/node_modules/date-fns/startOfDay.js.map +1 -0
  997. package/dist/node_modules/date-fns/startOfISOWeek.cjs +9 -0
  998. package/dist/node_modules/date-fns/startOfISOWeek.cjs.map +1 -0
  999. package/dist/node_modules/date-fns/startOfISOWeek.js +9 -0
  1000. package/dist/node_modules/date-fns/startOfISOWeek.js.map +1 -0
  1001. package/dist/node_modules/date-fns/startOfISOWeekYear.cjs +15 -0
  1002. package/dist/node_modules/date-fns/startOfISOWeekYear.cjs.map +1 -0
  1003. package/dist/node_modules/date-fns/startOfISOWeekYear.js +15 -0
  1004. package/dist/node_modules/date-fns/startOfISOWeekYear.js.map +1 -0
  1005. package/dist/node_modules/date-fns/startOfWeek.cjs +18 -0
  1006. package/dist/node_modules/date-fns/startOfWeek.cjs.map +1 -0
  1007. package/dist/node_modules/date-fns/startOfWeek.js +18 -0
  1008. package/dist/node_modules/date-fns/startOfWeek.js.map +1 -0
  1009. package/dist/node_modules/date-fns/startOfWeekYear.cjs +20 -0
  1010. package/dist/node_modules/date-fns/startOfWeekYear.cjs.map +1 -0
  1011. package/dist/node_modules/date-fns/startOfWeekYear.js +20 -0
  1012. package/dist/node_modules/date-fns/startOfWeekYear.js.map +1 -0
  1013. package/dist/node_modules/date-fns/startOfYear.cjs +12 -0
  1014. package/dist/node_modules/date-fns/startOfYear.cjs.map +1 -0
  1015. package/dist/node_modules/date-fns/startOfYear.js +12 -0
  1016. package/dist/node_modules/date-fns/startOfYear.js.map +1 -0
  1017. package/dist/node_modules/date-fns/toDate.cjs +9 -0
  1018. package/dist/node_modules/date-fns/toDate.cjs.map +1 -0
  1019. package/dist/node_modules/date-fns/toDate.js +9 -0
  1020. package/dist/node_modules/date-fns/toDate.js.map +1 -0
  1021. package/dist/notifications.server.cjs +552 -0
  1022. package/dist/notifications.server.js +511 -621
  1023. package/dist/orders.server.cjs +820 -0
  1024. package/dist/orders.server.js +733 -838
  1025. package/dist/organizations.server.cjs +1493 -0
  1026. package/dist/organizations.server.js +1301 -1414
  1027. package/dist/ownership.schema-CCZX5vfw.js +43 -0
  1028. package/dist/ownership.schema-DCosqOc1.cjs +42 -0
  1029. package/dist/pages.server.cjs +142 -0
  1030. package/dist/pages.server.js +125 -160
  1031. package/dist/products.server.cjs +2635 -0
  1032. package/dist/products.server.js +2528 -1273
  1033. package/dist/profile.schema-DchVS-Jr.js +21 -0
  1034. package/dist/profile.schema-yQuIzngl.cjs +20 -0
  1035. package/dist/queryProcessor-B_X680wC.cjs +332 -0
  1036. package/dist/queryProcessor-CVcLPEnv.js +333 -0
  1037. package/dist/rents.server.cjs +487 -0
  1038. package/dist/rents.server.js +462 -480
  1039. package/dist/reports.server.cjs +133 -0
  1040. package/dist/reports.server.js +97 -150
  1041. package/dist/spots.server.cjs +331 -0
  1042. package/dist/spots.server.js +301 -349
  1043. package/dist/style.css +854 -724
  1044. package/dist/{tickets.controller-zEHIAe_B.js → tickets.controller-D0V0gJCA.cjs} +239 -263
  1045. package/dist/{tickets.controller-BIhfgjNb.mjs → tickets.controller-DQQcjyui.js} +222 -263
  1046. package/dist/wallet.server.cjs +528 -0
  1047. package/dist/wallet.server.js +473 -666
  1048. package/package.json +7 -6
  1049. package/src/builder/builder.js +19 -14
  1050. package/src/builder/modes/spa.dev.js +16 -39
  1051. package/src/builder/modes/spa.prod.js +15 -26
  1052. package/src/builder/modes/ssr.dev.js +123 -107
  1053. package/src/builder/modes/ssr.prod.js +19 -38
  1054. package/src/builder/modes/ssr.rspack.dev.js +70 -66
  1055. package/src/builder/modes/ssr.vite.dev.js +45 -71
  1056. package/src/builder/rspack/index.js +10 -8
  1057. package/src/builder/rspack/rspack.config.api.js +59 -0
  1058. package/src/builder/rspack/rspack.config.base.js +28 -11
  1059. package/src/builder/rspack/{rspack.config.spa.js → rspack.config.spa.client.js} +21 -26
  1060. package/src/builder/rspack/{rspack.config.client.js → rspack.config.ssr.client.js} +9 -13
  1061. package/src/builder/rspack/{rspack.config.ssr.js → rspack.config.ssr.server.js} +22 -10
  1062. package/src/builder/ssr/ssr-render-html.js +13 -12
  1063. package/src/builder/ssr/ssr-transform-webpack-stats.js +37 -25
  1064. package/src/builder/ssr/utils.js +7 -14
  1065. package/src/builder/templates/page.js +2 -2
  1066. package/src/builder/templates/screen.js +2 -2
  1067. package/src/builder/utils/hot-reload.js +1 -1
  1068. package/src/builder/vite/index.js +8 -8
  1069. package/src/builder/vite/vite.config.base.js +37 -47
  1070. package/src/builder/vite/vite.config.client.js +42 -64
  1071. package/src/builder/vite/vite.config.server.js +14 -24
  1072. package/src/builder/vite/vite.config.spa.js +37 -46
  1073. package/src/builder/vite/vite.config.ssr.js +44 -60
  1074. package/src/builder/webpack/index.js +7 -7
  1075. package/src/builder/webpack/webpack.config.base.js +54 -39
  1076. package/src/builder/webpack/webpack.config.client.js +36 -47
  1077. package/src/builder/webpack/webpack.config.server.js +23 -17
  1078. package/src/builder/webpack/webpack.config.spa.js +22 -28
  1079. package/src/builder/webpack/webpack.config.ssr.js +33 -30
  1080. package/src/components/Button/Button.vue +8 -3
  1081. package/src/components/Chips/Chips.vue +1 -1
  1082. package/src/components/Dropdown/Dropdown.vue +1 -1
  1083. package/src/components/Feed/Feed.vue +156 -63
  1084. package/src/components/Field/Field.vue +82 -75
  1085. package/src/components/FieldPhone/FieldPhone.vue +2 -2
  1086. package/src/components/FieldPhone/all-countries.js +247 -3
  1087. package/src/components/FieldPhone/click-outside.js +1 -1
  1088. package/src/components/FieldPhone/utils.js +263 -262
  1089. package/src/components/FieldTags/FieldTags.vue +375 -25
  1090. package/src/components/FieldTags/create-tags.js +15 -15
  1091. package/src/components/FieldTags/vue-tags-input.props.js +2 -9
  1092. package/src/components/Map/LoaderGMaps.js +4 -4
  1093. package/src/components/Popup/Popup.vue +142 -89
  1094. package/src/components/Select/Select.vue +2 -4
  1095. package/src/components/SelectMulti/SelectMulti.vue +911 -656
  1096. package/src/components/Table/Table.vue +21 -64
  1097. package/src/components/UploadImageMultiple/UploadImageMultiple.vue +4 -4
  1098. package/src/components/index.js +10 -10
  1099. package/src/configurator/router/configurator.router.js +10 -8
  1100. package/src/main.js +79 -80
  1101. package/src/modules/auth/auth.client.js +17 -18
  1102. package/src/modules/auth/auth.server.js +32 -42
  1103. package/src/modules/auth/controllers/middlewares/authJwt.js +16 -34
  1104. package/src/modules/auth/controllers/middlewares/authSecret.js +2 -8
  1105. package/src/modules/auth/controllers/middlewares/index.js +15 -10
  1106. package/src/modules/auth/controllers/middlewares/verifyInvites.js +13 -21
  1107. package/src/modules/auth/controllers/middlewares/verifySignUp.js +7 -16
  1108. package/src/modules/auth/controllers/middlewares/verifyUser.js +20 -31
  1109. package/src/modules/auth/controllers/middlewares/visitor.logger.js +10 -23
  1110. package/src/modules/auth/controllers/routes/auth.routes.js +9 -29
  1111. package/src/modules/auth/controllers/routes/twofa.routes.js +6 -23
  1112. package/src/modules/auth/controllers/routes/users.routes.js +8 -39
  1113. package/src/modules/auth/controllers/services/auth.service.js +49 -82
  1114. package/src/modules/auth/controllers/services/twofa.service.js +6 -13
  1115. package/src/modules/auth/controllers/services/users.service.js +31 -70
  1116. package/src/modules/auth/controllers/utils/verifyAppleIdToken.js +47 -54
  1117. package/src/modules/auth/models/request.model.js +5 -9
  1118. package/src/modules/auth/models/role.model.js +3 -7
  1119. package/src/modules/auth/models/user.model.js +39 -41
  1120. package/src/modules/auth/models/visitor.model.js +3 -6
  1121. package/src/modules/auth/views/components/layouts/Auth.vue +1 -1
  1122. package/src/modules/auth/views/components/pages/EnterCode.vue +3 -3
  1123. package/src/modules/auth/views/components/pages/EnterPassword.vue +1 -1
  1124. package/src/modules/auth/views/components/pages/Invite.vue +2 -2
  1125. package/src/modules/auth/views/components/pages/Profile.vue +3 -3
  1126. package/src/modules/auth/views/components/pages/ProfileBlogposts.vue +3 -3
  1127. package/src/modules/auth/views/components/pages/ProfileEdit.vue +3 -3
  1128. package/src/modules/auth/views/components/pages/ResetPassword.vue +3 -3
  1129. package/src/modules/auth/views/components/pages/SignIn.vue +2 -2
  1130. package/src/modules/auth/views/components/pages/SignUp.vue +3 -3
  1131. package/src/modules/auth/views/components/sections/FeaturedUsers.vue +1 -1
  1132. package/src/modules/auth/views/components/sections/ProfileEditCredentials.vue +2 -2
  1133. package/src/modules/auth/views/localization/EnterCode.json +1 -1
  1134. package/src/modules/auth/views/localization/EnterPassword.json +1 -1
  1135. package/src/modules/auth/views/localization/ResetPassword.json +1 -1
  1136. package/src/modules/auth/views/localization/SignUp.json +1 -1
  1137. package/src/modules/auth/views/middlewares/auth.validation.js +16 -29
  1138. package/src/modules/auth/views/middlewares/ownership.validation.js +9 -14
  1139. package/src/modules/auth/views/router/auth.js +66 -77
  1140. package/src/modules/auth/views/router/users.js +87 -89
  1141. package/src/modules/auth/views/store/auth.js +41 -39
  1142. package/src/modules/auth/views/store/twofa.js +44 -42
  1143. package/src/modules/auth/views/store/users.js +22 -26
  1144. package/src/modules/auth/views/validations/inputs.validation.js +53 -59
  1145. package/src/modules/backoffice/backoffice.client.js +8 -8
  1146. package/src/modules/backoffice/components/pages/Dashboard.vue +3 -3
  1147. package/src/modules/backoffice/components/partials/Sidebar.vue +2 -2
  1148. package/src/modules/backoffice/router/backoffice.js +49 -49
  1149. package/src/modules/chats/chats.client.js +9 -9
  1150. package/src/modules/chats/chats.server.js +18 -23
  1151. package/src/modules/chats/controllers/chats.controller.js +8 -15
  1152. package/src/modules/chats/models/chat.model.js +6 -9
  1153. package/src/modules/chats/routes/chats.routes.js +12 -20
  1154. package/src/modules/chats/store/chat.store.js +14 -11
  1155. package/src/modules/community/community.client.js +13 -26
  1156. package/src/modules/community/community.server.js +30 -35
  1157. package/src/modules/community/components/blocks/FooterBlogpost.vue +1 -1
  1158. package/src/modules/community/components/layouts/Community.vue +6 -4
  1159. package/src/modules/community/components/pages/Blog.vue +1 -1
  1160. package/src/modules/community/components/pages/BlogPost.vue +1 -1
  1161. package/src/modules/community/components/pages/CreateBlogPost.vue +5 -5
  1162. package/src/modules/community/components/sections/Comment.vue +2 -2
  1163. package/src/modules/community/components/sections/HotPosts.vue +1 -1
  1164. package/src/modules/community/controllers/blog.controller.js +103 -139
  1165. package/src/modules/community/controllers/comments.controller.js +79 -124
  1166. package/src/modules/community/controllers/reactions.controller.js +32 -59
  1167. package/src/modules/community/controllers/utils/queryProcessor.js +13 -17
  1168. package/src/modules/community/controllers/utils/queryProcessorReactions.js +28 -34
  1169. package/src/modules/community/middlewares/server/index.js +7 -5
  1170. package/src/modules/community/middlewares/server/verifyBlogpost.js +9 -14
  1171. package/src/modules/community/models/blogpost.model.js +33 -34
  1172. package/src/modules/community/models/comment.model.js +48 -50
  1173. package/src/modules/community/models/reaction.model.js +48 -46
  1174. package/src/modules/community/router/blogposts.js +52 -50
  1175. package/src/modules/community/routes/blog.routes.js +15 -49
  1176. package/src/modules/community/routes/comments.routes.js +14 -44
  1177. package/src/modules/community/routes/reactions.routes.js +10 -43
  1178. package/src/modules/community/store/blogposts.js +54 -59
  1179. package/src/modules/community/store/reactions.js +9 -13
  1180. package/src/modules/constructor/components/elements/Embed.vue +3 -3
  1181. package/src/modules/constructor/components/elements/ImageUpload.vue +3 -3
  1182. package/src/modules/core/classes/event.js +48 -0
  1183. package/src/modules/core/classes/memory-tracker.js +1063 -0
  1184. package/src/modules/{globals/views/core → core/classes}/module-manager.js +43 -46
  1185. package/src/modules/{globals/views/core → core/classes}/module.js +52 -53
  1186. package/src/modules/core/model/Adapter.js +17 -0
  1187. package/src/modules/core/model/Adapter.mogodb.js +65 -0
  1188. package/src/modules/core/model/Adapter.postgre.js +127 -0
  1189. package/src/modules/core/model/Model.js +99 -0
  1190. package/src/modules/core/model/Schema.js +70 -0
  1191. package/src/modules/core/model/Validation.js +97 -0
  1192. package/src/modules/events/components/elements/ButtonCheck.vue +1 -1
  1193. package/src/modules/events/components/elements/ButtonJoin.vue +2 -2
  1194. package/src/modules/events/components/pages/EditEvent.vue +5 -5
  1195. package/src/modules/events/components/pages/EditEventTickets.vue +3 -3
  1196. package/src/modules/events/components/pages/Event.vue +1 -2
  1197. package/src/modules/events/components/pages/Events.vue +3 -3
  1198. package/src/modules/events/components/pages/EventsBackoffice.vue +1 -1
  1199. package/src/modules/events/components/pages/EventsSearch.vue +1 -1
  1200. package/src/modules/events/components/sections/EventsHot.vue +1 -1
  1201. package/src/modules/events/components/sections/FeaturedEvents.vue +1 -1
  1202. package/src/modules/events/controllers/events.controller.js +90 -155
  1203. package/src/modules/events/controllers/tickets.controller.js +157 -220
  1204. package/src/modules/events/controllers/utils/queryProcessor.js +117 -123
  1205. package/src/modules/events/controllers/utils/templateEmail.js +6 -7
  1206. package/src/modules/events/controllers/utils/templateTicket.js +6 -7
  1207. package/src/modules/events/events.client.js +22 -28
  1208. package/src/modules/events/events.server.js +25 -32
  1209. package/src/modules/events/middlewares/server/index.js +6 -5
  1210. package/src/modules/events/middlewares/server/verifyEvent.js +29 -31
  1211. package/src/modules/events/models/event.model.js +68 -70
  1212. package/src/modules/events/models/ticket.model.js +55 -55
  1213. package/src/modules/events/router/events.js +28 -38
  1214. package/src/modules/events/routes/events.routes.js +15 -49
  1215. package/src/modules/events/routes/tickets.routes.js +7 -21
  1216. package/src/modules/events/store/events.js +41 -50
  1217. package/src/modules/events/store/tickets.js +11 -14
  1218. package/src/modules/files/controllers/files.controller.js +5 -17
  1219. package/src/modules/files/files.server.js +13 -16
  1220. package/src/modules/files/middlewares/server/index.js +7 -5
  1221. package/src/modules/files/middlewares/server/middlewareBusboy.js +62 -123
  1222. package/src/modules/files/routes/files.routes.js +11 -40
  1223. package/src/modules/gallery/components/pages/Gallery.vue +1 -1
  1224. package/src/modules/gallery/components/sections/BackofficeGallery.vue +3 -3
  1225. package/src/modules/gallery/controllers/gallery.controller.js +27 -58
  1226. package/src/modules/gallery/gallery.client.js +11 -11
  1227. package/src/modules/gallery/gallery.server.js +18 -23
  1228. package/src/modules/gallery/models/photo.model.js +27 -29
  1229. package/src/modules/gallery/router/gallery.backoffice.router.js +14 -14
  1230. package/src/modules/gallery/router/gallery.router.js +2 -2
  1231. package/src/modules/gallery/routes/gallery.routes.js +12 -44
  1232. package/src/modules/gallery/store/gallery.js +3 -3
  1233. package/src/modules/globals/controllers/classes/abac/abac.adapter.express.js +194 -0
  1234. package/src/modules/globals/controllers/classes/abac/abac.adapter.ws.js +84 -0
  1235. package/src/modules/globals/controllers/classes/abac/abac.core.js +220 -0
  1236. package/src/modules/globals/controllers/classes/abac/abac.fields.js +376 -0
  1237. package/src/modules/globals/controllers/classes/abac/abac.js +104 -0
  1238. package/src/modules/globals/controllers/classes/abac/abac.policies.js +226 -0
  1239. package/src/modules/globals/controllers/classes/crud/crud.controller.js +314 -0
  1240. package/src/modules/globals/controllers/classes/crud/crud.core.js +230 -0
  1241. package/src/modules/globals/controllers/classes/crud/crud.events.js +209 -0
  1242. package/src/modules/globals/controllers/classes/crud/crud.js +169 -0
  1243. package/src/modules/globals/controllers/classes/crud/crud.policies.js +256 -0
  1244. package/src/modules/globals/controllers/classes/crud/crud.service.js +285 -0
  1245. package/src/modules/globals/controllers/classes/globals.abac.js +69 -120
  1246. package/src/modules/globals/controllers/classes/globals.cache.js +2 -15
  1247. package/src/modules/globals/controllers/classes/globals.crud.js +15 -43
  1248. package/src/modules/globals/controllers/classes/globals.logger.js +2 -6
  1249. package/src/modules/globals/controllers/classes/globals.observer.js +36 -43
  1250. package/src/modules/globals/controllers/classes/globals.validator.js +62 -88
  1251. package/src/modules/globals/controllers/classes/globals.verifier.js +144 -128
  1252. package/src/modules/globals/controllers/classes/globals.webhook.js +1 -3
  1253. package/src/modules/globals/controllers/classes/globals.websocket.js +29 -89
  1254. package/src/modules/globals/controllers/classes/globals.websocket.ws.js +6 -28
  1255. package/src/modules/globals/controllers/policies/globals.policies.js +33 -50
  1256. package/src/modules/globals/controllers/utils/mailing.js +26 -34
  1257. package/src/modules/globals/controllers/utils/parseCookie.js +2 -5
  1258. package/src/modules/globals/controllers/utils/queryProcessor.js +188 -127
  1259. package/src/modules/globals/controllers/utils/seo-friendly-url.js +195 -48
  1260. package/src/modules/globals/controllers/utils/sitemap.js +14 -20
  1261. package/src/modules/globals/globals.client.js +55 -53
  1262. package/src/modules/globals/globals.server.js +22 -14
  1263. package/src/modules/globals/models/schemas/common.schema.js +4 -4
  1264. package/src/modules/globals/models/schemas/credentials.schema.js +3 -3
  1265. package/src/modules/globals/models/schemas/engagement.schema.js +6 -16
  1266. package/src/modules/globals/models/schemas/metadata.schema.js +16 -20
  1267. package/src/modules/globals/models/schemas/ownership.schema.js +16 -13
  1268. package/src/modules/globals/models/schemas/profile.schema.js +6 -7
  1269. package/src/modules/globals/models/schemas/socials.schema.js +9 -9
  1270. package/src/modules/globals/views/classes/globals.store.js +25 -22
  1271. package/src/modules/globals/views/classes/globals.websocket.js +16 -16
  1272. package/src/modules/globals/views/classes/globals.websocket.ws.js +1 -1
  1273. package/src/modules/globals/views/classes/store.js +18 -19
  1274. package/src/modules/globals/views/components/blocks/BlockMultiselect.vue +364 -0
  1275. package/src/modules/globals/views/components/blocks/Card.vue +75 -46
  1276. package/src/modules/globals/views/components/blocks/CardFooter.vue +1 -1
  1277. package/src/modules/globals/views/components/blocks/CardHeader.vue +0 -1
  1278. package/src/modules/globals/views/components/elements/ButtonDate.vue +2 -2
  1279. package/src/modules/globals/views/components/layouts/App.vue +2 -2
  1280. package/src/modules/globals/views/components/layouts/Client.vue +2 -2
  1281. package/src/modules/globals/views/components/partials/BottomNavigationBar.vue +1 -1
  1282. package/src/modules/globals/views/components/partials/Footer.vue +1 -1
  1283. package/src/modules/globals/views/components/partials/Header.vue +3 -3
  1284. package/src/modules/globals/views/components/partials/LocationSelection.vue +1 -1
  1285. package/src/modules/globals/views/components/partials/Navigation.vue +11 -19
  1286. package/src/modules/globals/views/components/partials/NavigationBar.vue +3 -3
  1287. package/src/modules/globals/views/components/partials/Sidebar.vue +1 -1
  1288. package/src/modules/globals/views/localization/get-browser-locale.js +7 -12
  1289. package/src/modules/globals/views/middlewares/localization.js +3 -6
  1290. package/src/modules/globals/views/mixins/mixins.js +152 -134
  1291. package/src/modules/globals/views/plugins/alert.plugin.js +28 -28
  1292. package/src/modules/globals/views/plugins/date-picker.plugin.js +85 -0
  1293. package/src/modules/globals/views/plugins/store-debugger/StoreDebugger.vue +284 -0
  1294. package/src/modules/globals/views/plugins/store-debugger/store-debugger.plugin.js +24 -0
  1295. package/src/modules/globals/views/router/addRoutes.js +15 -17
  1296. package/src/modules/globals/views/router/scrollBehavior.js +17 -13
  1297. package/src/modules/globals/views/store/globals.js +64 -78
  1298. package/src/modules/globals/views/utils/axios-instance.js +1 -1
  1299. package/src/modules/globals/views/utils/vue-app-renderer.js +23 -26
  1300. package/src/modules/governance/controllers/factories/initiatives.controller.js +23 -29
  1301. package/src/modules/governance/controllers/factories/tasks.controller.js +21 -27
  1302. package/src/modules/governance/controllers/factories/votes.controller.js +17 -21
  1303. package/src/modules/governance/controllers/factories/votings.controller.js +25 -32
  1304. package/src/modules/governance/controllers/routes/initiatives.routes.js +10 -12
  1305. package/src/modules/governance/controllers/routes/tasks.routes.js +10 -12
  1306. package/src/modules/governance/controllers/routes/votes.routes.js +8 -10
  1307. package/src/modules/governance/controllers/routes/votings.routes.js +11 -13
  1308. package/src/modules/governance/governance.client.js +7 -7
  1309. package/src/modules/governance/governance.server.js +36 -39
  1310. package/src/modules/governance/models/initiative.model.js +26 -22
  1311. package/src/modules/governance/models/milestone.model.js +86 -82
  1312. package/src/modules/governance/models/task.model.js +48 -45
  1313. package/src/modules/governance/models/vote.model.js +18 -16
  1314. package/src/modules/governance/models/voting.model.js +23 -19
  1315. package/src/modules/governance/views/router/goverance.router.js +56 -80
  1316. package/src/modules/governance/views/store/initiatives.js +8 -11
  1317. package/src/modules/governance/views/store/projects.js +57 -66
  1318. package/src/modules/governance/views/store/tasks.js +9 -14
  1319. package/src/modules/governance/views/store/votes.js +8 -13
  1320. package/src/modules/governance/views/store/votings.js +7 -11
  1321. package/src/modules/icons/actions/IconDuplicate.vue +17 -0
  1322. package/src/modules/icons/entities/IconDiscount.vue +23 -0
  1323. package/src/modules/icons/entities/IconSettings.vue +32 -0
  1324. package/src/modules/icons/icons.client.js +118 -96
  1325. package/src/modules/icons/pages/IconsPage.vue +300 -0
  1326. package/src/modules/icons/router/icons.router.js +34 -0
  1327. package/src/modules/integrations/integrations.service.js +34 -91
  1328. package/src/modules/integrations/openai/openai.globals.js +116 -0
  1329. package/src/modules/integrations/paypal/controllers/webhooks/paypal.webhook.js +15 -19
  1330. package/src/modules/integrations/stripe/controllers/services/stripe.service.js +241 -285
  1331. package/src/modules/integrations/stripe/controllers/webhooks/stripe.webhook.js +8 -17
  1332. package/src/modules/integrations/tinkoff/controllers/services/tinkoff.service.js +111 -119
  1333. package/src/modules/integrations/tinkoff/models/tinkoff.payment.model.js +12 -13
  1334. package/src/modules/inventory/inventory.server.js +23 -0
  1335. package/src/modules/inventory/models/stock.adjustment.model.js +63 -0
  1336. package/src/modules/inventory/models/stock.availability.model.js +56 -0
  1337. package/src/modules/inventory/models/stock.balance.model.js +43 -0
  1338. package/src/modules/inventory/models/stock.inventory.model.js +38 -0
  1339. package/src/modules/inventory/policies/inventory.policies.js +47 -0
  1340. package/src/modules/inventory/routes/inventory.routes.js +61 -0
  1341. package/src/modules/inventory/services/inventory.crud.js +527 -0
  1342. package/src/modules/inventory/services/inventory.verifier.js +81 -0
  1343. package/src/modules/inventory/store/ inventory.store.js +131 -0
  1344. package/src/modules/inventory/workers/inventory.availability.worker.js +300 -0
  1345. package/src/modules/landing/landing.client.js +16 -16
  1346. package/src/modules/marketplace/marketplace.client.js +12 -13
  1347. package/src/modules/marketplace/views/components/layouts/Marketplace.vue +2 -2
  1348. package/src/modules/marketplace/views/components/pages/Catalog.vue +2 -2
  1349. package/src/modules/marketplace/views/components/sections/SectionMenu.vue +2 -2
  1350. package/src/modules/marketplace/views/router/marketplace.router.js +9 -11
  1351. package/src/modules/marketplace/views/store/marketplace.js +33 -29
  1352. package/src/modules/music/components/cards/ArtistCard.vue +62 -15
  1353. package/src/modules/music/components/lists/ArtistList.vue +267 -12
  1354. package/src/modules/music/components/pages/ArtistDetail.vue +375 -189
  1355. package/src/modules/music/components/pages/ArtistForm.vue +426 -0
  1356. package/src/modules/music/components/pages/ArtistManager.vue +277 -0
  1357. package/src/modules/music/components/pages/MusicLibrary.vue +5 -8
  1358. package/src/modules/music/controllers/album.controller.js +15 -31
  1359. package/src/modules/music/controllers/artist.controller.js +29 -41
  1360. package/src/modules/music/controllers/genre.controller.js +23 -31
  1361. package/src/modules/music/controllers/music.controller.js +28 -57
  1362. package/src/modules/music/controllers/playlist.controller.js +20 -56
  1363. package/src/modules/music/controllers/search.controller.js +37 -62
  1364. package/src/modules/music/controllers/stream.controller.js +16 -32
  1365. package/src/modules/music/models/album.model.js +54 -51
  1366. package/src/modules/music/models/artist.model.js +50 -52
  1367. package/src/modules/music/models/genre.model.js +27 -31
  1368. package/src/modules/music/models/play-history.model.js +41 -42
  1369. package/src/modules/music/models/playlist.model.js +54 -54
  1370. package/src/modules/music/models/track.model.js +65 -69
  1371. package/src/modules/music/music.client.js +55 -52
  1372. package/src/modules/music/music.server.js +62 -77
  1373. package/src/modules/music/policies/music.policies.js +9 -29
  1374. package/src/modules/music/router/music.js +38 -19
  1375. package/src/modules/music/routes/album.routes.js +21 -55
  1376. package/src/modules/music/routes/artist.routes.js +22 -59
  1377. package/src/modules/music/routes/genre.routes.js +21 -53
  1378. package/src/modules/music/routes/music.routes.js +74 -113
  1379. package/src/modules/music/routes/playlist.routes.js +36 -88
  1380. package/src/modules/music/routes/search.routes.js +5 -9
  1381. package/src/modules/music/routes/stream.routes.js +23 -34
  1382. package/src/modules/music/store/albums.js +34 -34
  1383. package/src/modules/music/store/artists.js +31 -28
  1384. package/src/modules/music/store/player.js +71 -73
  1385. package/src/modules/music/store/playlists.js +37 -37
  1386. package/src/modules/music/store/search.js +25 -25
  1387. package/src/modules/music/store/tracks.js +40 -45
  1388. package/src/modules/music/websocket/streaming.handler.js +58 -76
  1389. package/src/modules/notifications/components/elements/NotificationBadge.vue +1 -1
  1390. package/src/modules/notifications/components/sections/NotificationsList.vue +1 -1
  1391. package/src/modules/notifications/controllers/notifications.controller.js +32 -62
  1392. package/src/modules/notifications/middlewares/notifications.abac.js +1 -5
  1393. package/src/modules/notifications/models/notification-log.model.js +8 -5
  1394. package/src/modules/notifications/models/notification-preference.model.js +8 -6
  1395. package/src/modules/notifications/models/notification.model.js +2 -3
  1396. package/src/modules/notifications/models/user-device.model.js +3 -5
  1397. package/src/modules/notifications/notifications.client.js +65 -75
  1398. package/src/modules/notifications/notifications.server.js +31 -44
  1399. package/src/modules/notifications/router/notifications.router.js +8 -8
  1400. package/src/modules/notifications/routes/notifications.routes.js +4 -11
  1401. package/src/modules/notifications/services/apns.service.js +4 -13
  1402. package/src/modules/notifications/services/email.service.js +4 -8
  1403. package/src/modules/notifications/services/fcm.service.js +4 -11
  1404. package/src/modules/notifications/services/notification.service.js +49 -84
  1405. package/src/modules/notifications/services/sms.service.js +4 -7
  1406. package/src/modules/notifications/services/telegram.service.js +4 -7
  1407. package/src/modules/notifications/services/web-push.service.js +14 -23
  1408. package/src/modules/notifications/services/whatsapp.service.js +4 -11
  1409. package/src/modules/notifications/store/notifications.store.js +50 -55
  1410. package/src/modules/orders/components/pages/OrderBackoffice.vue +5 -5
  1411. package/src/modules/orders/components/pages/OrderCreate.vue +6 -6
  1412. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +5 -5
  1413. package/src/modules/orders/components/pages/Orders.vue +2 -2
  1414. package/src/modules/orders/components/partials/ShopCart.vue +3 -3
  1415. package/src/modules/orders/components/sections/FormAddCustomer.vue +5 -5
  1416. package/src/modules/orders/components/sections/FormDelivery.vue +2 -2
  1417. package/src/modules/orders/controllers/applications.controller.js +37 -67
  1418. package/src/modules/orders/controllers/orders.controller.js +96 -155
  1419. package/src/modules/orders/controllers/testimonials.controller.js +22 -31
  1420. package/src/modules/orders/models/application.model.js +25 -24
  1421. package/src/modules/orders/models/customer.model.js +61 -55
  1422. package/src/modules/orders/models/order.model.js +80 -81
  1423. package/src/modules/orders/models/testimonial.model.js +7 -9
  1424. package/src/modules/orders/orders.client.js +24 -26
  1425. package/src/modules/orders/orders.server.js +27 -32
  1426. package/src/modules/orders/router/orders.router.js +21 -22
  1427. package/src/modules/orders/routes/applications.routes.js +10 -40
  1428. package/src/modules/orders/routes/orders.routes.js +8 -19
  1429. package/src/modules/orders/routes/testimonials.routes.js +9 -29
  1430. package/src/modules/orders/store/applications.js +34 -39
  1431. package/src/modules/orders/store/customers.store.js +3 -3
  1432. package/src/modules/orders/store/models/customer.js +5 -5
  1433. package/src/modules/orders/store/models/order.js +4 -4
  1434. package/src/modules/orders/store/orders.js +61 -76
  1435. package/src/modules/orders/store/shopcart.js +150 -98
  1436. package/src/modules/orders/store/testimonials.js +7 -10
  1437. package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +2 -2
  1438. package/src/modules/organizations/components/pages/Department.vue +1 -1
  1439. package/src/modules/organizations/components/pages/DepartmentEdit.vue +3 -3
  1440. package/src/modules/organizations/components/pages/Members.vue +6 -6
  1441. package/src/modules/organizations/components/pages/Organization.vue +9 -9
  1442. package/src/modules/organizations/components/pages/OrganizationBackoffice.vue +2 -2
  1443. package/src/modules/organizations/components/pages/OrganizationCreate.vue +2 -2
  1444. package/src/modules/organizations/components/pages/OrganizationDetails.vue +2 -2
  1445. package/src/modules/organizations/components/pages/OrganizationEdit.vue +3 -3
  1446. package/src/modules/organizations/components/pages/OrganizationPeople.vue +1 -1
  1447. package/src/modules/organizations/components/pages/Organizations.vue +2 -2
  1448. package/src/modules/organizations/components/sections/DetailsTabSection.vue +2 -2
  1449. package/src/modules/organizations/components/sections/MembersAdd.vue +1 -1
  1450. package/src/modules/organizations/components/sections/Organizations.vue +3 -3
  1451. package/src/modules/organizations/components/sections/Publics.vue +3 -3
  1452. package/src/modules/organizations/configs/navigation.organization.config.js +227 -0
  1453. package/src/modules/organizations/controllers/departments.controller.js +11 -22
  1454. package/src/modules/organizations/controllers/invites.controller.js +14 -30
  1455. package/src/modules/organizations/controllers/memberships.controller.js +21 -54
  1456. package/src/modules/organizations/controllers/organizations.controller.js +32 -83
  1457. package/src/modules/organizations/controllers/utils/addMembersQuantity.js +11 -12
  1458. package/src/modules/organizations/controllers/utils/addUserStatusFields.js +31 -41
  1459. package/src/modules/organizations/controllers/utils/lookupConfigs.js +31 -31
  1460. package/src/modules/organizations/controllers/utils/queryProcessor.js +40 -51
  1461. package/src/modules/organizations/controllers/utils/queryProcessorOrganizations.js +124 -147
  1462. package/src/modules/organizations/middlewares/verifyAccesses.js +7 -25
  1463. package/src/modules/organizations/middlewares/verifyAccessesRefactored.js +26 -51
  1464. package/src/modules/organizations/models/department.model.js +58 -59
  1465. package/src/modules/organizations/models/invite.model.js +45 -42
  1466. package/src/modules/organizations/models/membership.model.js +35 -35
  1467. package/src/modules/organizations/models/organization.model.js +65 -80
  1468. package/src/modules/organizations/models/schemas/accesses.schema.js +1 -2
  1469. package/src/modules/organizations/organizations.client.js +45 -46
  1470. package/src/modules/organizations/organizations.server.js +40 -41
  1471. package/src/modules/organizations/policies/organizations.policies.js +193 -85
  1472. package/src/modules/organizations/router/backoffice.router.js +22 -20
  1473. package/src/modules/organizations/router/departments.router.js +27 -23
  1474. package/src/modules/organizations/router/members.router.js +18 -18
  1475. package/src/modules/organizations/router/organizations.js +74 -66
  1476. package/src/modules/organizations/routes/departments.routes.js +9 -20
  1477. package/src/modules/organizations/routes/invites.routes.js +9 -31
  1478. package/src/modules/organizations/routes/memberships.routes.js +7 -23
  1479. package/src/modules/organizations/routes/organizations.routes.js +15 -40
  1480. package/src/modules/organizations/store/departments.js +13 -14
  1481. package/src/modules/organizations/store/invites.js +38 -41
  1482. package/src/modules/organizations/store/memberships.js +21 -26
  1483. package/src/modules/organizations/store/organizations.js +40 -46
  1484. package/src/modules/pages/controllers/factories/pages.factory.js +6 -27
  1485. package/src/modules/pages/controllers/routes/pages.routes.js +7 -23
  1486. package/src/modules/pages/models/page.model.js +22 -20
  1487. package/src/modules/pages/pages.client.js +12 -12
  1488. package/src/modules/pages/pages.server.js +18 -21
  1489. package/src/modules/pages/views/components/pages/Page.vue +1 -1
  1490. package/src/modules/pages/views/components/pages/Pages.vue +1 -1
  1491. package/src/modules/pages/views/components/partials/SidebarPages.vue +1 -1
  1492. package/src/modules/pages/views/router/pages.backoffice.router.js +29 -29
  1493. package/src/modules/pages/views/router/pages.router.js +16 -14
  1494. package/src/modules/pages/views/store/pages.js +12 -11
  1495. package/src/modules/pages/views/store/pages.store.js +3 -3
  1496. package/src/modules/products/components/blocks/CardLeftover.vue +1 -1
  1497. package/src/modules/products/components/blocks/CardPosition.vue +94 -157
  1498. package/src/modules/products/components/blocks/CardProduct.vue +5 -5
  1499. package/src/modules/products/components/blocks/ProductDiscounts.vue +141 -0
  1500. package/src/modules/products/components/blocks/{ImagesThumbnails.vue → ProductImages.vue} +3 -4
  1501. package/src/modules/products/components/blocks/ProductVariants.vue +125 -0
  1502. package/src/modules/products/components/elements/Price.vue +34 -37
  1503. package/src/modules/products/components/elements/QuantitySelector.vue +52 -0
  1504. package/src/modules/products/components/elements/THC.vue +6 -6
  1505. package/src/modules/products/components/forms/ColumnSettingsMenu.vue +80 -0
  1506. package/src/modules/products/components/forms/ReorderSettingsForm.vue +107 -0
  1507. package/src/modules/products/components/forms/StockAuditForm.vue +154 -0
  1508. package/src/modules/products/components/forms/StockHistoryView.vue +134 -0
  1509. package/src/modules/products/components/pages/Categories.vue +5 -5
  1510. package/src/modules/products/components/pages/CategoryEdit.vue +8 -44
  1511. package/src/modules/products/components/pages/LeftoverEdit.vue +360 -0
  1512. package/src/modules/products/components/pages/Leftovers.vue +288 -131
  1513. package/src/modules/products/components/pages/Product.vue +171 -100
  1514. package/src/modules/products/components/pages/ProductEdit.vue +329 -461
  1515. package/src/modules/products/components/pages/ProductRecommmendation.vue +2 -2
  1516. package/src/modules/products/components/pages/Products.vue +7 -7
  1517. package/src/modules/products/components/sections/EditAttributes.vue +154 -0
  1518. package/src/modules/products/components/sections/EditCategories.vue +149 -0
  1519. package/src/modules/products/components/sections/EditDiscounts.vue +308 -0
  1520. package/src/modules/products/components/sections/EditIngredients.vue +130 -0
  1521. package/src/modules/products/components/sections/EditVariants.vue +453 -0
  1522. package/src/modules/products/components/sections/FilterProducts.vue +4 -4
  1523. package/src/modules/products/components/sections/HeroRecommendation.vue +1 -1
  1524. package/src/modules/products/components/sections/PopularProducts.vue +2 -2
  1525. package/src/modules/products/components/sections/ProductConfigurator.vue +131 -0
  1526. package/src/modules/products/components/sections/SectionProduct.vue +17 -17
  1527. package/src/modules/products/controllers/categories.controller.js +45 -143
  1528. package/src/modules/products/controllers/configs/products.lookup.config.js +135 -0
  1529. package/src/modules/products/controllers/leftovers.controller.js +38 -62
  1530. package/src/modules/products/controllers/products.controller.js +103 -364
  1531. package/src/modules/products/controllers/queries/products.queries.js +112 -0
  1532. package/src/modules/products/middlewares/categories.verifier.js +94 -72
  1533. package/src/modules/products/middlewares/variants.verifier.js +226 -0
  1534. package/src/modules/products/models/category.model.js +26 -22
  1535. package/src/modules/products/models/leftover.model.js +61 -44
  1536. package/src/modules/products/models/product.model.js +54 -119
  1537. package/src/modules/products/models/schemas/discount.schema.js +33 -0
  1538. package/src/modules/products/models/schemas/ingredient.schema.js +46 -0
  1539. package/src/modules/products/models/variant.model.js +66 -0
  1540. package/src/modules/products/products.client.js +31 -41
  1541. package/src/modules/products/products.server.js +34 -35
  1542. package/src/modules/products/router/categories.router.js +34 -30
  1543. package/src/modules/products/router/leftovers.router.js +32 -30
  1544. package/src/modules/products/router/products.router.js +18 -21
  1545. package/src/modules/products/routes/categories.routes.js +13 -52
  1546. package/src/modules/products/routes/leftovers.routes.js +9 -27
  1547. package/src/modules/products/routes/products.routes.js +8 -27
  1548. package/src/modules/products/routes/variants.routes.js +102 -0
  1549. package/src/modules/products/store/categories.js +24 -23
  1550. package/src/modules/products/store/leftovers.js +53 -17
  1551. package/src/modules/products/store/products.js +73 -125
  1552. package/src/modules/products/store/variants.store.js +5 -0
  1553. package/src/modules/rents/controllers/routes/rents.routes.js +12 -21
  1554. package/src/modules/rents/controllers/services/rents.services.js +183 -239
  1555. package/src/modules/rents/models/rent.model.js +27 -17
  1556. package/src/modules/rents/rents.client.js +5 -10
  1557. package/src/modules/rents/rents.server.js +15 -21
  1558. package/src/modules/rents/views/components/pages/RentsEdit.vue +2 -2
  1559. package/src/modules/rents/views/router/rents.router.js +11 -20
  1560. package/src/modules/rents/views/store/rents.store.js +33 -33
  1561. package/src/modules/reports/components/sections/FormReport.vue +1 -1
  1562. package/src/modules/reports/controllers/reports.controller.js +17 -26
  1563. package/src/modules/reports/models/report.model.js +39 -56
  1564. package/src/modules/reports/reports.client.js +8 -8
  1565. package/src/modules/reports/reports.server.js +17 -22
  1566. package/src/modules/reports/routes/reports.routes.js +7 -28
  1567. package/src/modules/reports/store/reports.js +15 -17
  1568. package/src/modules/spots/components/blocks/CardSpot.vue +73 -58
  1569. package/src/modules/spots/components/layouts/Spots.vue +3 -3
  1570. package/src/modules/spots/components/pages/Map.vue +3 -3
  1571. package/src/modules/spots/components/pages/SpotEdit.vue +1 -1
  1572. package/src/modules/spots/controllers/queries/getIsOpenNowStage.js +49 -65
  1573. package/src/modules/spots/controllers/spots.controller.js +25 -43
  1574. package/src/modules/spots/models/spot.model.js +45 -52
  1575. package/src/modules/spots/router/spots.js +22 -26
  1576. package/src/modules/spots/routes/spots.routes.js +8 -16
  1577. package/src/modules/spots/spots.client.js +6 -6
  1578. package/src/modules/spots/spots.server.js +17 -20
  1579. package/src/modules/spots/store/spots.js +11 -14
  1580. package/src/modules/wallet/controllers/factories/payments.factory.js +15 -42
  1581. package/src/modules/wallet/controllers/factories/rewards.factory.js +56 -134
  1582. package/src/modules/wallet/controllers/routes/payments.routes.js +45 -80
  1583. package/src/modules/wallet/controllers/routes/rewards.routes.js +10 -50
  1584. package/src/modules/wallet/models/payment.model.js +26 -27
  1585. package/src/modules/wallet/models/reward.model.js +3 -4
  1586. package/src/modules/wallet/models/wallet.model.js +10 -9
  1587. package/src/modules/wallet/views/router/payments.router.js +24 -23
  1588. package/src/modules/wallet/views/store/payments.store.js +6 -6
  1589. package/src/modules/wallet/views/store/wallet.store.js +28 -35
  1590. package/src/modules/wallet/wallet.server.js +25 -27
  1591. package/src/styles/typography.scss +24 -0
  1592. package/dist/Media-DmnrxIEI.js +0 -1
  1593. package/dist/_commonjsHelpers-CUmg6egw.mjs +0 -6
  1594. package/dist/_commonjsHelpers-DHfMLFPC.js +0 -5
  1595. package/dist/addMembersQuantity-DBfuUEx_.mjs +0 -113
  1596. package/dist/addMembersQuantity-DxWjHK1K.js +0 -112
  1597. package/dist/auth.server.mjs +0 -764
  1598. package/dist/authJwt-CELQKF2s.js +0 -82
  1599. package/dist/authJwt-DnXu3BFq.mjs +0 -83
  1600. package/dist/builder.mjs +0 -1502
  1601. package/dist/chats.server.mjs +0 -137
  1602. package/dist/common.schema-C2m3O1XY.mjs +0 -20
  1603. package/dist/common.schema-O0w_rDyC.js +0 -19
  1604. package/dist/community.server.mjs +0 -1068
  1605. package/dist/credentials.schema-BmOPv6FD.js +0 -16
  1606. package/dist/credentials.schema-oOC8B5KL.mjs +0 -17
  1607. package/dist/engagement.schema-DAiXsvh1.js +0 -33
  1608. package/dist/engagement.schema-DnDD7Bn3.mjs +0 -34
  1609. package/dist/events.server.mjs +0 -1060
  1610. package/dist/files.server.mjs +0 -339
  1611. package/dist/gallery.server.mjs +0 -337
  1612. package/dist/globals.abac-Bn-4tbX8.js +0 -303
  1613. package/dist/globals.abac-DZpTRxKR.mjs +0 -304
  1614. package/dist/globals.cache-BT6q3vOf.mjs +0 -140
  1615. package/dist/globals.cache-CwWvNGFQ.js +0 -139
  1616. package/dist/globals.logger-BdjooLaD.js +0 -34
  1617. package/dist/globals.logger-DusiFsxN.mjs +0 -35
  1618. package/dist/globals.server.mjs +0 -453
  1619. package/dist/globals.verifier-BdJxc8-8.mjs +0 -609
  1620. package/dist/globals.verifier-CKYpYfQl.js +0 -608
  1621. package/dist/index-BOmxJQ5W.js +0 -205
  1622. package/dist/index-C_Fw0Umg.mjs +0 -206
  1623. package/dist/mailing-D4kWlk3_.js +0 -93
  1624. package/dist/mailing-DvCT5ijo.mjs +0 -94
  1625. package/dist/main-DxWqDgs1.js +0 -11
  1626. package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +0 -1
  1627. package/dist/martyrs/src/components/Chips/Chips.vue.js.map +0 -1
  1628. package/dist/martyrs/src/components/Dropdown/Dropdown.vue.cjs.map +0 -1
  1629. package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
  1630. package/dist/martyrs/src/components/FieldTags/vue-tags-input.cjs +0 -292
  1631. package/dist/martyrs/src/components/FieldTags/vue-tags-input.cjs.map +0 -1
  1632. package/dist/martyrs/src/components/FieldTags/vue-tags-input.js +0 -292
  1633. package/dist/martyrs/src/components/FieldTags/vue-tags-input.js.map +0 -1
  1634. package/dist/martyrs/src/components/Menu/Menu.vue.cjs.map +0 -1
  1635. package/dist/martyrs/src/components/Menu/Menu.vue.js.map +0 -1
  1636. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.cjs +0 -450
  1637. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.cjs.map +0 -1
  1638. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.js +0 -450
  1639. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.js.map +0 -1
  1640. package/dist/martyrs/src/components/SelectMulti/multiselectMixin.cjs +0 -633
  1641. package/dist/martyrs/src/components/SelectMulti/multiselectMixin.cjs.map +0 -1
  1642. package/dist/martyrs/src/components/SelectMulti/multiselectMixin.js +0 -633
  1643. package/dist/martyrs/src/components/SelectMulti/multiselectMixin.js.map +0 -1
  1644. package/dist/martyrs/src/components/SelectMulti/pointerMixin.cjs +0 -117
  1645. package/dist/martyrs/src/components/SelectMulti/pointerMixin.cjs.map +0 -1
  1646. package/dist/martyrs/src/components/SelectMulti/pointerMixin.js +0 -117
  1647. package/dist/martyrs/src/components/SelectMulti/pointerMixin.js.map +0 -1
  1648. package/dist/martyrs/src/components/Table/TableCell.vue.cjs +0 -59
  1649. package/dist/martyrs/src/components/Table/TableCell.vue.cjs.map +0 -1
  1650. package/dist/martyrs/src/components/Table/TableCell.vue.js +0 -59
  1651. package/dist/martyrs/src/components/Table/TableCell.vue.js.map +0 -1
  1652. package/dist/martyrs/src/components/Tooltip/Tooltip.vue.js.map +0 -1
  1653. package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.cjs.map +0 -1
  1654. package/dist/martyrs/src/modules/globals/views/plugins/AlertDialog.vue.js.map +0 -1
  1655. package/dist/martyrs/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs.map +0 -1
  1656. package/dist/martyrs/src/modules/products/components/blocks/ImagesThumbnails.vue.js.map +0 -1
  1657. package/dist/martyrs/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +0 -65
  1658. package/dist/martyrs/src/modules/products/components/blocks/LeftoverPositions.vue.cjs.map +0 -1
  1659. package/dist/martyrs/src/modules/products/components/blocks/LeftoverPositions.vue.js +0 -65
  1660. package/dist/martyrs/src/modules/products/components/blocks/LeftoverPositions.vue.js.map +0 -1
  1661. package/dist/martyrs/src/modules/products/components/blocks/ListPositions.vue.cjs +0 -49
  1662. package/dist/martyrs/src/modules/products/components/blocks/ListPositions.vue.cjs.map +0 -1
  1663. package/dist/martyrs/src/modules/products/components/blocks/ListPositions.vue.js +0 -49
  1664. package/dist/martyrs/src/modules/products/components/blocks/ListPositions.vue.js.map +0 -1
  1665. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.cjs +0 -237
  1666. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.cjs.map +0 -1
  1667. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.js +0 -237
  1668. package/dist/martyrs/src/modules/products/components/pages/EditLeftover.vue.js.map +0 -1
  1669. package/dist/martyrs/src/modules/products/components/sections/EditModifications.vue.cjs +0 -152
  1670. package/dist/martyrs/src/modules/products/components/sections/EditModifications.vue.cjs.map +0 -1
  1671. package/dist/martyrs/src/modules/products/components/sections/EditModifications.vue.js +0 -152
  1672. package/dist/martyrs/src/modules/products/components/sections/EditModifications.vue.js.map +0 -1
  1673. package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.cjs +0 -120
  1674. package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.cjs.map +0 -1
  1675. package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.js +0 -120
  1676. package/dist/martyrs/src/modules/products/components/sections/EditProductInfo.vue.js.map +0 -1
  1677. package/dist/metadata.schema--tle-GU8.mjs +0 -282
  1678. package/dist/metadata.schema-CUkLXZ2f.js +0 -281
  1679. package/dist/notifications.server.mjs +0 -663
  1680. package/dist/orders.server.mjs +0 -926
  1681. package/dist/organizations.server.mjs +0 -1590
  1682. package/dist/ownership.schema-CNCotD3D.mjs +0 -50
  1683. package/dist/ownership.schema-MxfJlPtq.js +0 -49
  1684. package/dist/pages.server.mjs +0 -178
  1685. package/dist/products.server.mjs +0 -1381
  1686. package/dist/profile.schema-BLSuV_VC.js +0 -27
  1687. package/dist/profile.schema-BRuvQ7QV.mjs +0 -28
  1688. package/dist/queryProcessor-CVKI651_.mjs +0 -314
  1689. package/dist/queryProcessor-DSUqSk3I.js +0 -313
  1690. package/dist/rents.server.mjs +0 -506
  1691. package/dist/reports.server.mjs +0 -187
  1692. package/dist/spots.server.mjs +0 -380
  1693. package/dist/wallet.server.mjs +0 -705
  1694. package/src/builder/rspack/rspack.config.server.js +0 -30
  1695. package/src/components/FieldTags/vue-tags-input.js +0 -424
  1696. package/src/components/SelectMulti/index.js +0 -7
  1697. package/src/components/SelectMulti/multiselectMixin.js +0 -725
  1698. package/src/components/SelectMulti/pointerMixin.js +0 -143
  1699. package/src/modules/globals/views/core/event.js +0 -48
  1700. package/src/modules/icons/logos/LogotypeNunito.vue +0 -12
  1701. package/src/modules/integrations/openai/controllers/openai.controller.js +0 -89
  1702. package/src/modules/products/components/blocks/EditFilters.vue +0 -56
  1703. package/src/modules/products/components/blocks/LeftoverPositions.vue +0 -99
  1704. package/src/modules/products/components/blocks/ListPositions.vue +0 -74
  1705. package/src/modules/products/components/pages/EditLeftover.vue +0 -288
  1706. package/src/modules/products/components/pages/Product.old.vue +0 -201
  1707. package/src/modules/products/components/sections/EditModifications.vue +0 -92
  1708. package/src/modules/products/components/sections/EditProductInfo.vue +0 -106
  1709. package/src/modules/products/controllers/modifications.controller.js +0 -66
  1710. /package/src/modules/globals/views/{plugins → components/blocks}/AlertDialog.vue +0 -0
  1711. /package/src/modules/products/components/{blocks/Images360.vue → elements/Image360.vue} +0 -0
@@ -1,142 +1,832 @@
1
- "use strict";
2
- const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
3
- const ownership_schema = require("./ownership.schema-MxfJlPtq.js");
4
- const common_schema = require("./common.schema-O0w_rDyC.js");
5
- const metadata_schema = require("./metadata.schema-CUkLXZ2f.js");
6
- const engagement_schema = require("./engagement.schema-DAiXsvh1.js");
7
- const require$$0 = require("uuid");
8
- const require$$0$1 = require("mongoose");
9
- require("path");
10
- const require$$3 = require("openai");
11
- const queryProcessor = require("./queryProcessor-DSUqSk3I.js");
12
- const globals_logger = require("./globals.logger-BdjooLaD.js");
13
- const globals_cache = require("./globals.cache-CwWvNGFQ.js");
14
- const globals_verifier = require("./globals.verifier-CKYpYfQl.js");
15
- const authJwt = require("./authJwt-CELQKF2s.js");
16
- const globals_abac = require("./globals.abac-Bn-4tbX8.js");
17
- var product_model;
18
- var hasRequiredProduct_model;
19
- function requireProduct_model() {
20
- if (hasRequiredProduct_model) return product_model;
21
- hasRequiredProduct_model = 1;
22
- const applyOwnershipSchema = ownership_schema.requireOwnership_schema();
23
- product_model = (db) => {
24
- const ProductSchema = new db.mongoose.Schema({
25
- status: {
26
- type: String
27
- },
28
- listing: {
29
- type: String,
30
- enum: ["sale", "rent"]
31
- },
1
+ import { L as Logger, C as Cache } from "./globals.logger-Bf6rRU7j.js";
2
+ import { q as queryProcessorGlobals } from "./queryProcessor-CVcLPEnv.js";
3
+ import OpenAI from "openai";
4
+ import { Types } from "mongoose";
5
+ import { a as applyCommonSchema } from "./common.schema-Bw1O5_2Q.js";
6
+ import { a as applyEngagementSchema } from "./engagement.schema-Dh1adRsn.js";
7
+ import { a as applyMetadataSchema } from "./metadata.schema-CWmcDJN7.js";
8
+ import { a as applyOwnershipSchema } from "./ownership.schema-CCZX5vfw.js";
9
+ import { m as middlewareFactory } from "./authJwt-DcYNNwcr.js";
10
+ import { g as globalsabac } from "./globals.abac-DBV_kaOq.js";
11
+ import { a as Validator, V as Verifier } from "./globals.verifier-CWFz5Gh2.js";
12
+ import { O as Observer } from "./globals.observer-CDqUjVU5.js";
13
+ import { A as ABAC } from "./abac-BuL5pUZ4.js";
14
+ const controllerFactory$2 = (db) => {
15
+ const Category = db.category;
16
+ const logger = new Logger(db);
17
+ const cache = new Cache();
18
+ return {
19
+ async read(req, res) {
20
+ try {
21
+ let { parent, url, search, sortParam, sortOrder, skip, limit, excludeChildren, rootOnly, type } = req.verifiedQuery;
22
+ const cacheKey = JSON.stringify(req.verifiedQuery);
23
+ let cachedResult = await cache.get(cacheKey);
24
+ if (cachedResult) {
25
+ return res.status(200).json(cachedResult);
26
+ }
27
+ const matchStage = {
28
+ ...req.query.status && { status: req.query.status },
29
+ ...url && { url },
30
+ ...search && { name: { $regex: search, $options: "i" } },
31
+ ...parent ? { parent: new db.mongoose.Types.ObjectId(parent) } : {},
32
+ ...rootOnly === "true" && !search ? { parent: null } : {}
33
+ };
34
+ if (type === "platform") {
35
+ matchStage["owner.type"] = "platform";
36
+ } else if (type === "organization" && req.query.organizationId) {
37
+ matchStage["owner.type"] = "organization";
38
+ matchStage["owner.target"] = new db.mongoose.Types.ObjectId(req.query.organizationId);
39
+ }
40
+ if (search) {
41
+ excludeChildren = "true";
42
+ }
43
+ let pipeline = [
44
+ { $match: matchStage },
45
+ queryProcessorGlobals.getCreatorUserLookupStage(),
46
+ queryProcessorGlobals.getCreatorOrganizationLookupStage(),
47
+ // For owner
48
+ queryProcessorGlobals.getOwnerUserLookupStage(),
49
+ queryProcessorGlobals.getOwnerOrganizationLookupStage(),
50
+ queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
51
+ { $sort: { [sortParam]: sortOrder === "asc" ? 1 : -1 } },
52
+ { $skip: Number(skip) },
53
+ { $limit: Number(limit) },
54
+ queryProcessorGlobals.removeTempPropeties()
55
+ ];
56
+ if (excludeChildren !== "true") {
57
+ pipeline.push({
58
+ $graphLookup: {
59
+ from: "categories",
60
+ startWith: "$_id",
61
+ connectFromField: "_id",
62
+ connectToField: "parent",
63
+ as: "allDescendants",
64
+ maxDepth: 10
65
+ }
66
+ });
67
+ }
68
+ const results = await Category.aggregate(pipeline);
69
+ let response;
70
+ if (excludeChildren === "true") {
71
+ response = results;
72
+ } else {
73
+ let allCategories = [];
74
+ results.forEach((doc) => {
75
+ let category = { ...doc };
76
+ delete category.allDescendants;
77
+ allCategories.push(category);
78
+ if (doc.allDescendants && doc.allDescendants.length > 0) {
79
+ allCategories.push(...doc.allDescendants);
80
+ }
81
+ });
82
+ let uniqueCategories = Array.from(new Map(allCategories.map((item) => [item._id.toString(), item])).values());
83
+ let tree = buildAdjacencyTree(uniqueCategories, sortParam, sortOrder);
84
+ if (rootOnly === "true") {
85
+ response = tree;
86
+ } else {
87
+ const requestedCategoryIds = results.map((r) => r._id.toString());
88
+ response = tree.filter((category) => requestedCategoryIds.includes(category._id.toString()));
89
+ }
90
+ }
91
+ let tags = ["categories"];
92
+ if (type === "organization" && req.query.organizationId) {
93
+ tags.push(`organization_${req.query.organizationId}`);
94
+ }
95
+ for (const cat of response) {
96
+ if (cat._id) {
97
+ tags.push(`category_${cat._id}`);
98
+ }
99
+ }
100
+ await cache.setWithTags(cacheKey, response, tags);
101
+ res.status(200).json(response);
102
+ } catch (err) {
103
+ console.log(err);
104
+ logger.error(`Error reading categories: ${err.message}`);
105
+ res.status(500).json({ message: err.message });
106
+ }
107
+ },
108
+ async create(req, res) {
109
+ try {
110
+ const categoryData = req.verifiedBody;
111
+ if (!categoryData.creator && req.userId) {
112
+ categoryData.creator = {
113
+ type: "user",
114
+ target: req.userId
115
+ };
116
+ }
117
+ if (!categoryData.owner) {
118
+ if (req.query.organizationId) {
119
+ categoryData.owner = {
120
+ type: "organization",
121
+ target: req.query.organizationId
122
+ };
123
+ } else {
124
+ categoryData.owner = {
125
+ type: "platform",
126
+ target: null
127
+ };
128
+ }
129
+ }
130
+ const highestOrder = await Category.findOne().sort("-order");
131
+ const order = highestOrder ? highestOrder.order + 1 : 1;
132
+ const category = new Category({
133
+ ...categoryData,
134
+ order
135
+ });
136
+ if (categoryData.parent) {
137
+ const parent = await Category.findByIdAndUpdate(categoryData.parent, { $push: { children: category._id } }, { new: true });
138
+ if (!parent) throw new Error("Parent category not found");
139
+ category.parent = parent._id;
140
+ }
141
+ if (categoryData.children && categoryData.children.length > 0) {
142
+ await Category.updateMany({ _id: { $in: categoryData.children } }, { $set: { parent: category._id } });
143
+ }
144
+ await category.save();
145
+ await cache.delByTags(["categories"]);
146
+ if (category.owner.type === "organization") {
147
+ await cache.delByTag(`organization_${category.owner.target}`);
148
+ }
149
+ logger.info(`Category created: ${category._id}`);
150
+ res.status(201).json(category);
151
+ } catch (err) {
152
+ logger.error(`Error creating category: ${err.message}`);
153
+ res.status(err.message === "Parent category not found" ? 404 : 500).json({ message: err.message });
154
+ }
155
+ },
156
+ async update(req, res) {
157
+ try {
158
+ const category = req.verifiedBody;
159
+ const updatedCategory = await Category.findByIdAndUpdate(category._id, { $set: category }, { new: true }).lean();
160
+ if (!updatedCategory) {
161
+ return res.status(404).json({ message: "Category not found" });
162
+ }
163
+ await cache.delByTag(`category_${category._id}`);
164
+ await cache.delByTags(["categories"]);
165
+ if (updatedCategory.owner && updatedCategory.owner.type === "organization") {
166
+ await cache.delByTag(`organization_${updatedCategory.owner.target}`);
167
+ }
168
+ logger.info(`Category updated: ${category._id}`);
169
+ res.status(200).json(updatedCategory);
170
+ } catch (err) {
171
+ logger.error(`Category update error: ${err.message}`);
172
+ res.status(500).json({ message: "Failed to update category" });
173
+ }
174
+ },
175
+ async updateOrder(req, res) {
176
+ try {
177
+ const { categories } = req.verifiedBody;
178
+ const bulkOps = categories.map((category) => ({
179
+ updateOne: {
180
+ filter: { _id: category._id },
181
+ update: {
182
+ $set: {
183
+ order: category.order,
184
+ parent: category.parent ? new db.mongoose.Types.ObjectId(category.parent) : null
185
+ }
186
+ }
187
+ }
188
+ }));
189
+ await Category.bulkWrite(bulkOps);
190
+ const categoryIds = categories.map((cat) => cat._id);
191
+ const organizationIds = /* @__PURE__ */ new Set();
192
+ const updatedCategories = await Category.find({ _id: { $in: categoryIds } }).lean();
193
+ updatedCategories.forEach((cat) => {
194
+ if (cat.owner && cat.owner.type === "organization") {
195
+ organizationIds.add(cat.owner.target.toString());
196
+ }
197
+ });
198
+ await cache.delByTags(["categories"]);
199
+ for (const catId of categoryIds) {
200
+ await cache.delByTag(`category_${catId}`);
201
+ }
202
+ for (const orgId of organizationIds) {
203
+ await cache.delByTag(`organization_${orgId}`);
204
+ }
205
+ let query = {};
206
+ if (req.query.type === "platform") {
207
+ query = { "owner.type": "platform" };
208
+ } else if (req.query.type === "organization" && req.query.organizationId) {
209
+ query = {
210
+ "owner.type": "organization",
211
+ "owner.target": new db.mongoose.Types.ObjectId(req.query.organizationId)
212
+ };
213
+ }
214
+ const result = await Category.find(query).sort({ order: "asc" }).lean();
215
+ logger.info(`Categories order updated: ${categoryIds.join(", ")}`);
216
+ res.status(200).json(result);
217
+ } catch (err) {
218
+ logger.error(`Category order update error: ${err.message}`);
219
+ res.status(500).json({ message: "Failed to update categories order" });
220
+ }
221
+ },
222
+ async delete(req, res) {
223
+ try {
224
+ const category = req.currentResource;
225
+ let ownerOrgId = null;
226
+ if (category.owner && category.owner.type === "organization") {
227
+ ownerOrgId = category.owner.target;
228
+ }
229
+ const result = await Category.aggregate([
230
+ { $match: { _id: category._id } },
231
+ {
232
+ $graphLookup: {
233
+ from: "categories",
234
+ startWith: "$_id",
235
+ connectFromField: "_id",
236
+ connectToField: "parent",
237
+ as: "descendants"
238
+ }
239
+ },
240
+ {
241
+ $project: { descendants: 1 }
242
+ }
243
+ ]);
244
+ const idsToDelete = [category._id, ...(result[0]?.descendants || []).map(({ _id }) => _id)];
245
+ const categoryIdsTags = idsToDelete.map((id) => `category_${id}`);
246
+ await Category.deleteMany({ _id: { $in: idsToDelete } });
247
+ await cache.delByTags(["categories"]);
248
+ await cache.delByTags(categoryIdsTags);
249
+ if (ownerOrgId) {
250
+ await cache.delByTag(`organization_${ownerOrgId}`);
251
+ }
252
+ logger.info(`Category and its subcategories deleted: ${category.url}`);
253
+ res.status(200).json({ message: "Category and its subcategories deleted successfully" });
254
+ } catch (err) {
255
+ logger.error(`Error deleting category: ${err.message}`);
256
+ res.status(500).json({ message: err.message || "Internal server error" });
257
+ }
258
+ }
259
+ };
260
+ function buildAdjacencyTree(categories, sortParam, sortOrder) {
261
+ const categoryMap = /* @__PURE__ */ new Map();
262
+ categories.forEach((category) => {
263
+ categoryMap.set(category._id.toString(), {
264
+ ...category,
265
+ children: []
266
+ });
267
+ });
268
+ const rootCategories = [];
269
+ categories.forEach((category) => {
270
+ const categoryWithChildren = categoryMap.get(category._id.toString());
271
+ if (category.parent && categoryMap.has(category.parent.toString())) {
272
+ const parentCategory = categoryMap.get(category.parent.toString());
273
+ parentCategory.children.push(categoryWithChildren);
274
+ } else if (!category.parent) {
275
+ rootCategories.push(categoryWithChildren);
276
+ }
277
+ });
278
+ function sortCategories(nodes) {
279
+ if (!nodes || nodes.length === 0) {
280
+ return nodes;
281
+ }
282
+ nodes.sort((a, b) => {
283
+ const valueA = a[sortParam] ?? (sortParam === "order" ? Number.MAX_SAFE_INTEGER : "");
284
+ const valueB = b[sortParam] ?? (sortParam === "order" ? Number.MAX_SAFE_INTEGER : "");
285
+ if (typeof valueA === "number" && typeof valueB === "number") {
286
+ return sortOrder === "asc" ? valueA - valueB : valueB - valueA;
287
+ } else {
288
+ const stringA = String(valueA);
289
+ const stringB = String(valueB);
290
+ return sortOrder === "asc" ? stringA.localeCompare(stringB) : stringB.localeCompare(stringA);
291
+ }
292
+ });
293
+ nodes.forEach((node) => {
294
+ if (node.children && node.children.length > 0) {
295
+ sortCategories(node.children);
296
+ }
297
+ });
298
+ return nodes;
299
+ }
300
+ return sortCategories(rootCategories);
301
+ }
302
+ };
303
+ const controllerFactory$1 = (db) => {
304
+ const Leftover = db.leftover;
305
+ const read = async (req, res) => {
306
+ try {
307
+ let stages = [
308
+ ...queryProcessorGlobals.getSearchOptions(req.query.search, {
309
+ fields: ["positions.name"]
310
+ }),
311
+ ...queryProcessorGlobals.getBasicOptions(req.query),
312
+ // For creator
313
+ queryProcessorGlobals.getCreatorUserLookupStage(),
314
+ queryProcessorGlobals.getCreatorOrganizationLookupStage(),
315
+ // For owner
316
+ queryProcessorGlobals.getOwnerUserLookupStage(),
317
+ queryProcessorGlobals.getOwnerOrganizationLookupStage(),
318
+ queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
319
+ // Pagination
320
+ ...queryProcessorGlobals.getSortingOptions(req.query.sortParam, req.query.sortOrder),
321
+ ...queryProcessorGlobals.getPaginationOptions(req.query.skip, req.query.limit)
322
+ ];
323
+ const leftoveres = await Leftover.aggregate(stages).exec();
324
+ if (!leftoveres) {
325
+ return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
326
+ }
327
+ res.status(200).send(leftoveres);
328
+ } catch (err) {
329
+ console.error(err);
330
+ res.status(500).send({ message: "ERROR_GET_ALL_LEFTOVERES" });
331
+ }
332
+ };
333
+ const create = async (req, res) => {
334
+ try {
335
+ const leftover = await Leftover.create({
336
+ organization: req.body.organization,
337
+ type: req.body.type,
338
+ order: req.body.order,
339
+ comment: req.body.comment,
340
+ positions: req.body.positions,
341
+ creator: req.body.creator,
342
+ owner: req.body.owner
343
+ });
344
+ if (!leftover) {
345
+ return res.status(404).send({ message: "ERROR_CREATING_LEFTOVER" });
346
+ }
347
+ res.status(200).send(leftover);
348
+ } catch (err) {
349
+ console.log(err);
350
+ res.status(500).send({ message: "ERROR_CREATE_LEFTOVER" });
351
+ }
352
+ };
353
+ const get = async (req, res) => {
354
+ try {
355
+ const leftover = await Leftover.findOne({ _id: req.params._id }).exec();
356
+ if (!leftover) {
357
+ return res.status(404).send({ message: "LEFTOVER_NOT_FOUND" });
358
+ }
359
+ res.status(200).send(leftover);
360
+ } catch (err) {
361
+ res.status(500).send({ message: "ERROR_GET_LEFTOVER" });
362
+ }
363
+ };
364
+ const update = async (req, res) => {
365
+ try {
366
+ const leftover = await Leftover.findOneAndUpdate({ _id: req.params._id }, req.body, {
367
+ new: true,
368
+ upsert: true
369
+ }).exec();
370
+ if (!leftover) {
371
+ return res.status(404).send({ message: "LEFTOVER_NOT_FOUND" });
372
+ }
373
+ res.status(200).send(leftover);
374
+ } catch (err) {
375
+ console.log(err);
376
+ res.status(500).send({ message: "ERROR_UPDATING_LEFTOVER" });
377
+ }
378
+ };
379
+ const deleteLeftover = async (req, res) => {
380
+ try {
381
+ const leftover = await Leftover.findOneAndDelete({ _id: req.params._id });
382
+ if (!leftover) {
383
+ return res.status(404).send({ message: "ERROR_DELETING_LEFTOVER" });
384
+ }
385
+ res.status(200).send(leftover);
386
+ } catch (err) {
387
+ res.status(500).send({ message: "ERROR_DELETE_LEFTOVER" });
388
+ }
389
+ };
390
+ return {
391
+ read,
392
+ create,
393
+ get,
394
+ update,
395
+ delete: deleteLeftover
396
+ };
397
+ };
398
+ class OpenAIGlobal {
399
+ constructor() {
400
+ if (OpenAIGlobal.instance) {
401
+ return OpenAIGlobal.instance;
402
+ }
403
+ this.client = new OpenAI({
404
+ organization: process.env.OPENAI_ORG_KEY,
405
+ apiKey: process.env.OPENAI_API_KEY
406
+ });
407
+ this.models = {
408
+ chat: "gpt-3.5-turbo",
409
+ vision: "gpt-4-vision-preview",
410
+ embedding: "text-embedding-ada-002"
411
+ };
412
+ OpenAIGlobal.instance = this;
413
+ }
414
+ /**
415
+ * Generate completions with retry logic for handling JSON parsing errors
416
+ * @param {string} prompt - The prompt text
417
+ * @param {Object} options - Additional options
418
+ * @returns {Promise<Object|string>} - Parsed JSON response or raw content
419
+ */
420
+ async createChatCompletion(prompt, options = {}) {
421
+ const {
422
+ model = this.models.chat,
423
+ maxRetries = 3,
424
+ temperature = 0.7,
425
+ parseJSON = true,
426
+ systemPrompt = ""
427
+ } = options;
428
+ let attempt = 0;
429
+ while (attempt < maxRetries) {
430
+ try {
431
+ const messages = [];
432
+ if (systemPrompt) {
433
+ messages.push({ role: "system", content: systemPrompt });
434
+ }
435
+ messages.push({ role: "user", content: prompt });
436
+ const response = await this.client.chat.completions.create({
437
+ model,
438
+ messages,
439
+ temperature,
440
+ response_format: parseJSON ? { type: "json_object" } : void 0
441
+ });
442
+ const content = response.choices[0].message.content;
443
+ if (parseJSON) {
444
+ return JSON.parse(content);
445
+ }
446
+ return content;
447
+ } catch (err) {
448
+ attempt++;
449
+ if (err instanceof SyntaxError && attempt < maxRetries) {
450
+ console.error(`Invalid JSON in OpenAI response (attempt ${attempt}/${maxRetries}): ${err.message}`);
451
+ } else if (attempt >= maxRetries) {
452
+ console.error(`Max retries (${maxRetries}) reached for OpenAI completion: ${err.message}`);
453
+ throw err;
454
+ } else {
455
+ console.error(`OpenAI API error (attempt ${attempt}/${maxRetries}): ${err.message}`);
456
+ if (err.status === 429) {
457
+ const waitTime = Math.pow(2, attempt) * 1e3;
458
+ await new Promise((resolve) => setTimeout(resolve, waitTime));
459
+ }
460
+ }
461
+ await new Promise((resolve) => setTimeout(resolve, 1e3 * attempt));
462
+ }
463
+ }
464
+ }
465
+ /**
466
+ * Get direct access to OpenAI client instance
467
+ * @returns {OpenAI} - OpenAI client instance
468
+ */
469
+ getClient() {
470
+ return this.client;
471
+ }
472
+ /**
473
+ * Set default model for specific API
474
+ * @param {string} type - API type ('chat', 'vision', 'embedding')
475
+ * @param {string} modelId - Model identifier
476
+ */
477
+ setDefaultModel(type, modelId) {
478
+ if (this.models[type]) {
479
+ this.models[type] = modelId;
480
+ }
481
+ }
482
+ }
483
+ const openaiGlobal = new OpenAIGlobal();
484
+ const ObjectId = Types.ObjectId;
485
+ function getCategoriesFilterStage(categories) {
486
+ if (!categories) return [];
487
+ const categoryIds = categories.split(",").filter(Boolean);
488
+ if (categoryIds.length === 0) return [];
489
+ return [{
490
+ $match: {
32
491
  category: {
33
- type: Array
34
- },
35
- name: {
36
- type: String
37
- },
38
- description: {
39
- type: String
40
- },
41
- information: [{
42
- name: { type: String },
43
- value: { type: String }
44
- }],
45
- images: {
46
- type: Array
47
- },
48
- localization: {
49
- type: Array
50
- },
51
- // ЗАДАЧА: Нужно отрефачить price, перенести его в default variant
52
- price: {
53
- type: Number,
54
- required: true
55
- },
56
- price_cost: {
57
- type: Number,
58
- default: 0
59
- },
60
- price_currency: {
61
- type: String,
62
- default: "$"
63
- },
64
- quantity: {
65
- type: Number,
66
- default: 1
67
- },
68
- unit: {
69
- type: String,
70
- required: true,
71
- default: "pcs"
72
- },
73
- prices: { type: Array },
74
- //
75
- variants: [{
76
- _id: { type: db.mongoose.Schema.Types.ObjectId, auto: true },
77
- name: { type: String },
78
- price: { type: Number },
79
- options: [{
80
- name: { type: String },
81
- value: { type: String }
82
- }],
83
- default: { type: Boolean }
84
- }],
85
- ingredients: [{
86
- _id: {
87
- type: db.mongoose.Schema.Types.ObjectId,
88
- ref: "Product"
89
- },
90
- price: {
91
- type: Number,
92
- required: true,
93
- default: 0,
94
- min: [0, "Price cannot be less than 0"]
492
+ $in: categoryIds.map((id) => new ObjectId(id))
493
+ }
494
+ }
495
+ }];
496
+ }
497
+ function getDeliveryFilterStage(delivery) {
498
+ if (!delivery) return [];
499
+ const deliveryOptions = delivery.split(",").filter(Boolean);
500
+ if (deliveryOptions.length === 0) return [];
501
+ return [{
502
+ $match: {
503
+ delivery: { $in: deliveryOptions }
504
+ }
505
+ }];
506
+ }
507
+ function getAttributeFiltersStage(filtersString) {
508
+ if (!filtersString) return [];
509
+ try {
510
+ const filters = JSON.parse(filtersString);
511
+ if (!Array.isArray(filters) || filters.length === 0) return [];
512
+ const filterConditions = [];
513
+ filters.forEach((filter) => {
514
+ const { parameter, values, caseSensitive = false } = filter;
515
+ if (!values || values.length === 0) return;
516
+ const conditions = values.map((value) => {
517
+ const valueCondition = caseSensitive ? value : { $regex: `^${escapeRegex(value)}$`, $options: "i" };
518
+ return {
519
+ attributes: {
520
+ $elemMatch: {
521
+ name: parameter,
522
+ value: valueCondition
523
+ }
524
+ }
525
+ };
526
+ });
527
+ if (conditions.length > 0) {
528
+ filterConditions.push({ $or: conditions });
529
+ }
530
+ });
531
+ return filterConditions.length > 0 ? [{ $match: { $and: filterConditions } }] : [];
532
+ } catch (error) {
533
+ console.error("Error parsing attribute filters:", error);
534
+ return [];
535
+ }
536
+ }
537
+ function escapeRegex(string) {
538
+ return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
539
+ }
540
+ const queryProcessorProducts = {
541
+ getAttributeFiltersStage,
542
+ getCategoriesFilterStage,
543
+ getDeliveryFilterStage
544
+ };
545
+ const productLookupConfigs = {
546
+ // Лукап для leftover-ов продукта
547
+ leftovers: {
548
+ lookup: {
549
+ from: "leftovers",
550
+ let: { productId: "$_id", ingredientsIds: "$ingredients._id" },
551
+ pipeline: [
552
+ { $unwind: "$positions" },
553
+ {
554
+ $match: {
555
+ $expr: {
556
+ $or: [
557
+ { $eq: ["$positions._id", "$$productId"] },
558
+ { $in: ["$positions._id", { $ifNull: ["$$ingredientsIds", []] }] }
559
+ ]
560
+ }
561
+ }
95
562
  },
96
- quantity: {
97
- type: Number,
98
- required: true,
99
- min: [1, "Quantity cannot be less than 1"]
563
+ {
564
+ $addFields: {
565
+ "positions.quantity": {
566
+ $cond: {
567
+ if: { $eq: ["$type", "stock-in"] },
568
+ then: "$positions.quantity",
569
+ else: { $multiply: ["$positions.quantity", -1] }
570
+ }
571
+ }
572
+ }
100
573
  },
101
- type: {
102
- type: String,
103
- required: true,
104
- default: "g"
574
+ {
575
+ $project: {
576
+ _id: "$positions._id",
577
+ quantity: "$positions.quantity",
578
+ name: "$positions.name"
579
+ }
105
580
  }
106
- }],
107
- quantityDiscount: [{
108
- quantity: {
109
- type: Number,
110
- required: true,
111
- min: [1, "Quantity cannot be less than 1"]
112
- },
113
- discount: {
114
- type: Number,
115
- required: true,
116
- min: [0, "Quantity-based discount cannot be less than 0"],
117
- max: [100, "Quantity-based discount cannot be more than 100"]
581
+ ],
582
+ as: "leftovers"
583
+ },
584
+ additionalStages: [
585
+ // Этап для расчета количеств по ингредиентам
586
+ {
587
+ $addFields: {
588
+ ingredientsQuantities: {
589
+ $cond: {
590
+ if: { $isArray: "$ingredients" },
591
+ then: {
592
+ $map: {
593
+ input: "$ingredients",
594
+ as: "ingredient",
595
+ in: {
596
+ $let: {
597
+ vars: {
598
+ ingredientId: "$$ingredient._id",
599
+ ingredientQuantity: { $ifNull: ["$$ingredient.quantity", 0] }
600
+ },
601
+ in: {
602
+ $divide: [
603
+ {
604
+ $sum: {
605
+ $map: {
606
+ input: "$leftovers",
607
+ as: "leftover",
608
+ in: {
609
+ $cond: {
610
+ if: { $eq: ["$$leftover._id", "$$ingredientId"] },
611
+ then: "$$leftover.quantity",
612
+ else: 0
613
+ }
614
+ }
615
+ }
616
+ }
617
+ },
618
+ {
619
+ $cond: {
620
+ if: { $eq: ["$$ingredientQuantity", 0] },
621
+ then: 1,
622
+ else: "$$ingredientQuantity"
623
+ }
624
+ }
625
+ ]
626
+ }
627
+ }
628
+ }
629
+ }
630
+ },
631
+ else: []
632
+ }
633
+ }
118
634
  }
119
- }]
120
- }, {
121
- timestamps: {
122
- currentTime: () => Date.now()
635
+ },
636
+ // Этап для расчета доступного количества
637
+ {
638
+ $set: {
639
+ available: {
640
+ $cond: {
641
+ if: { $gt: [{ $size: { $ifNull: ["$ingredients", []] } }, 0] },
642
+ then: { $floor: { $min: "$ingredientsQuantities" } },
643
+ else: { $sum: "$leftovers.quantity" }
644
+ }
645
+ }
646
+ }
647
+ }
648
+ ]
649
+ },
650
+ // Лукап для категорий продукта
651
+ categories: {
652
+ lookup: {
653
+ from: "categories",
654
+ localField: "category",
655
+ foreignField: "_id",
656
+ as: "category"
657
+ },
658
+ additionalStages: [
659
+ // Проецируем только нужные поля для каждой категории
660
+ {
661
+ $addFields: {
662
+ category: {
663
+ $map: {
664
+ input: "$category",
665
+ as: "cat",
666
+ in: {
667
+ _id: "$$cat._id",
668
+ name: "$$cat.name",
669
+ description: "$$cat.description",
670
+ url: "$$cat.url"
671
+ }
672
+ }
673
+ }
674
+ }
675
+ }
676
+ ]
677
+ }
678
+ };
679
+ const controllerFactory = (db) => {
680
+ const Product = db.product;
681
+ const Create = async (req, res) => {
682
+ try {
683
+ const productData = {
684
+ ...req.body,
685
+ category: req.body.category?.map((cat) => cat._id) || []
686
+ };
687
+ const product = await new Product(productData).save();
688
+ return res.status(201).json(product);
689
+ } catch (err) {
690
+ console.log(err);
691
+ return res.status(500).json({ message: err.message });
692
+ }
693
+ };
694
+ const Read = async (req, res) => {
695
+ try {
696
+ const requestedLookups = queryProcessorGlobals.getRequestedLookups(req.query);
697
+ const stages = [
698
+ ...queryProcessorGlobals.getBasicOptions(req.query),
699
+ ...queryProcessorGlobals.getSearchOptions(req.query.search, {
700
+ fields: ["name", "description"]
701
+ }),
702
+ ...queryProcessorGlobals.getPriceConditions(req.query.prices),
703
+ ...queryProcessorProducts.getCategoriesFilterStage(req.query.categories),
704
+ ...queryProcessorProducts.getDeliveryFilterStage(req.query.delivery),
705
+ ...queryProcessorProducts.getAttributeFiltersStage(req.query.filters),
706
+ ...queryProcessorGlobals.getLookupStages(requestedLookups, productLookupConfigs),
707
+ queryProcessorGlobals.getCreatorUserLookupStage(),
708
+ queryProcessorGlobals.getCreatorOrganizationLookupStage(),
709
+ queryProcessorGlobals.getOwnerUserLookupStage(),
710
+ queryProcessorGlobals.getOwnerOrganizationLookupStage(),
711
+ queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
712
+ ...queryProcessorGlobals.getSortingOptions(req.query.sortParam, req.query.sortOrder),
713
+ ...queryProcessorGlobals.getPaginationOptions(req.query.skip, req.query.limit),
714
+ // Удаление временных полей
715
+ queryProcessorGlobals.removeTempPropeties(),
716
+ // Дополнительные очистки для leftovers (если был запрошен)
717
+ ...requestedLookups.includes("leftovers") ? [{ $project: { ingredientsQuantities: 0 } }] : []
718
+ ].filter(Boolean);
719
+ const products = await Product.aggregate(stages);
720
+ if (req.query.count) {
721
+ return res.status(200).json({ count: products.length });
722
+ }
723
+ res.status(200).json(products);
724
+ } catch (err) {
725
+ console.error("Error in products Read controller:", err);
726
+ return res.status(500).json({ message: err.message });
727
+ }
728
+ };
729
+ const Update = async (req, res) => {
730
+ try {
731
+ const { _id } = req.params;
732
+ const updateData = {
733
+ name: req.body.name,
734
+ status: req.body.status,
735
+ listing: req.body.listing,
736
+ description: req.body.description,
737
+ category: req.body.category?.map((cat) => cat._id) || [],
738
+ images: req.body.images,
739
+ attributes: req.body.attributes,
740
+ localization: req.body.translations,
741
+ discounts: req.body.discounts
742
+ };
743
+ const updatedProduct = await Product.findOneAndUpdate({ _id }, updateData, { new: true });
744
+ if (!updatedProduct) {
745
+ return res.status(404).send({ message: "Something wrong when updating product." });
746
+ }
747
+ res.status(200).send(updatedProduct);
748
+ } catch (err) {
749
+ res.status(500).send({ message: err.message });
750
+ }
751
+ };
752
+ const Delete = async (req, res) => {
753
+ try {
754
+ const { _id } = req.params;
755
+ const deletedProduct = await Product.findOneAndDelete({ _id });
756
+ if (!deletedProduct) {
757
+ return res.status(404).send({ message: "Product not found for deletion." });
758
+ }
759
+ res.status(200).send(deletedProduct);
760
+ } catch (err) {
761
+ res.status(500).send({ message: err.message });
762
+ }
763
+ };
764
+ const getProductRecommendation = async (req, res) => {
765
+ const { mood } = req.body;
766
+ try {
767
+ const products = await Product.find({
768
+ status: "published"
769
+ }).limit(40);
770
+ if (!products) {
771
+ console.log("no products");
772
+ return res.status(404).send({ message: "Products not found." });
773
+ }
774
+ const productsList = products.map((p) => {
775
+ const info = p.attributes || [];
776
+ const value0 = info[0] ? info[0].value : "";
777
+ const value1 = info[1] ? `(${info[1].value}%)` : "";
778
+ const value2 = info[2] ? `(${info[2].value})` : "";
779
+ return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
780
+ }).join(", ");
781
+ const prompt = `
782
+ 1. When asked how the client wants to feel, they responded "${mood}".
783
+ 2. Here is a list of products in our store: ${productsList}.
784
+ 3. Based on the attributes about the products (strain, THC content) and the user's desires, choose 1 product to recommend to the user.
785
+ 4. The response should be in the language that the user used in mood (${mood}).
786
+ 5. Please format your response as a JSON object '{"_id": "ID of the recommended product (it must correspond to one of the product IDs I sent)", "recommendationText": "Text explaining why this particular product"'. Write only the JSON object without any other text outside of it.
787
+ `;
788
+ const result = await openaiGlobal.createChatCompletion(prompt, {
789
+ model: "gpt-4",
790
+ temperature: 0.8,
791
+ systemPrompt: "You are a product recommendation specialist with expertise in matching customer needs to product attributes."
792
+ });
793
+ const recommendedProduct = await Product.findById(result._id);
794
+ if (!recommendedProduct) {
795
+ console.log(`No product found with _id: ${result._id}`);
796
+ return res.status(404).send({ message: "Recommended product not found." });
797
+ }
798
+ res.status(200).json({ product: recommendedProduct, recommendationText: result.recommendationText });
799
+ } catch (err) {
800
+ console.log(err);
801
+ res.status(500).send({ message: err });
802
+ }
803
+ };
804
+ const getProductsPopular = (req, res) => {
805
+ Product.find({
806
+ status: "published",
807
+ views: { $gt: 10 }
808
+ }).limit(10).exec((err, products) => {
809
+ if (err) {
810
+ return res.status(500).send({ message: err });
811
+ }
812
+ if (!products) {
813
+ return res.status(404).send({ message: "Products not found." });
123
814
  }
815
+ res.status(200).send(products);
124
816
  });
125
- applyOwnershipSchema(ProductSchema, db);
126
- ProductSchema.index({ category: 1 });
127
- ProductSchema.index({ price: 1 });
128
- const Product = db.mongoose.model("Product", ProductSchema);
129
- return Product;
130
817
  };
131
- return product_model;
132
- }
133
- var category_model;
134
- var hasRequiredCategory_model;
135
- function requireCategory_model() {
136
- if (hasRequiredCategory_model) return category_model;
137
- hasRequiredCategory_model = 1;
138
- category_model = (db) => {
139
- const CategorySchema = new db.mongoose.Schema({
818
+ return {
819
+ Create,
820
+ Read,
821
+ Update,
822
+ Delete,
823
+ getProductsPopular,
824
+ getProductRecommendation
825
+ };
826
+ };
827
+ const CategoryModel = (db) => {
828
+ const CategorySchema = new db.mongoose.Schema(
829
+ {
140
830
  name: { type: String, required: true, trim: true },
141
831
  description: { type: String, trim: true },
142
832
  photo: { type: String },
@@ -145,32 +835,23 @@ function requireCategory_model() {
145
835
  parent: { type: db.mongoose.Schema.Types.ObjectId, ref: "Category" },
146
836
  localization: { type: Array },
147
837
  filters: { type: Array }
148
- }, {
838
+ },
839
+ {
149
840
  timestamps: { currentTime: () => Date.now() }
150
- });
151
- common_schema.requireCommon_schema()(CategorySchema, db);
152
- ownership_schema.requireOwnership_schema()(CategorySchema, db);
153
- metadata_schema.requireMetadata_schema()(CategorySchema, db);
154
- engagement_schema.requireEngagement_schema()(CategorySchema, db);
155
- CategorySchema.index({ parent: 1 });
156
- CategorySchema.index({ name: 1 });
157
- const Category = db.mongoose.model("Category", CategorySchema, "categories");
158
- return Category;
159
- };
160
- return category_model;
161
- }
162
- var leftover_model;
163
- var hasRequiredLeftover_model;
164
- function requireLeftover_model() {
165
- if (hasRequiredLeftover_model) return leftover_model;
166
- hasRequiredLeftover_model = 1;
167
- const applyOwnershipSchema = ownership_schema.requireOwnership_schema();
168
- leftover_model = (db) => {
169
- const LeftoverSchema = new db.mongoose.Schema({
170
- organization: {
171
- type: db.mongoose.Schema.Types.ObjectId,
172
- ref: "Organization"
173
- },
841
+ }
842
+ );
843
+ applyCommonSchema(CategorySchema);
844
+ applyOwnershipSchema(CategorySchema, db);
845
+ applyMetadataSchema(CategorySchema);
846
+ applyEngagementSchema(CategorySchema);
847
+ CategorySchema.index({ parent: 1 });
848
+ CategorySchema.index({ name: 1 });
849
+ const Category = db.mongoose.model("Category", CategorySchema, "categories");
850
+ return Category;
851
+ };
852
+ const LeftoverModel = (db) => {
853
+ const LeftoverSchema = new db.mongoose.Schema(
854
+ {
174
855
  type: {
175
856
  type: String,
176
857
  enum: ["stock-in", "stock-out", "write-off"],
@@ -178,1203 +859,1777 @@ function requireLeftover_model() {
178
859
  required: true
179
860
  },
180
861
  order: {
181
- type: String
182
- },
183
- comment: {
184
- type: String
862
+ type: db.mongoose.Schema.Types.ObjectId,
863
+ ref: "Order"
185
864
  },
186
- store: {
187
- type: Object
865
+ storage: {
866
+ type: db.mongoose.Schema.Types.ObjectId,
867
+ ref: "Spot"
188
868
  },
189
869
  positions: [{
190
870
  _id: {
871
+ type: db.mongoose.Schema.Types.ObjectId
872
+ },
873
+ product: {
191
874
  type: db.mongoose.Schema.Types.ObjectId,
192
875
  ref: "Product"
193
876
  },
877
+ variant: {
878
+ _id: {
879
+ type: db.mongoose.Schema.Types.ObjectId
880
+ },
881
+ name: {
882
+ type: String
883
+ },
884
+ attributes: {
885
+ type: Array
886
+ }
887
+ },
888
+ image: {
889
+ type: String
890
+ },
194
891
  name: {
195
892
  type: String
196
893
  },
197
894
  quantity: {
198
895
  type: Number
199
896
  },
200
- price: {
897
+ cost: {
201
898
  type: Number
202
899
  },
203
- type: {
900
+ unit: {
204
901
  type: String
205
902
  }
206
- }]
207
- }, {
903
+ }],
904
+ comment: {
905
+ type: String
906
+ }
907
+ },
908
+ {
208
909
  timestamps: {
209
910
  currentTime: () => Date.now()
210
911
  }
211
- });
212
- applyOwnershipSchema(LeftoverSchema, db);
213
- LeftoverSchema.index({ user: 1, type: 1, target: 1 });
214
- const Leftover = db.mongoose.model("Leftover", LeftoverSchema);
215
- return Leftover;
216
- };
217
- return leftover_model;
218
- }
219
- var products_controller;
220
- var hasRequiredProducts_controller;
221
- function requireProducts_controller() {
222
- if (hasRequiredProducts_controller) return products_controller;
223
- hasRequiredProducts_controller = 1;
224
- const { v1: uuidv1, v4: uuidv4 } = require$$0;
225
- const ObjectId = require$$0$1.Types.ObjectId;
226
- const OpenAI = require$$3;
227
- const openai = new OpenAI({
228
- organization: process.env.OPENAI_ORG_KEY,
229
- apiKey: process.env.OPENAI_API_KEY
230
- });
231
- const queryProcessorGlobals = queryProcessor.requireQueryProcessor();
232
- const controllerFactory = (db) => {
233
- const Product = db.product;
234
- db.modification;
235
- db.leftover;
236
- const Create = async (req, res) => {
237
- try {
238
- const newProduct = new Product(req.body);
239
- const data = await newProduct.save();
240
- res.send(data);
241
- } catch (err) {
242
- console.log(err);
243
- res.status(500).send({ message: err.message });
912
+ }
913
+ );
914
+ applyOwnershipSchema(LeftoverSchema, db);
915
+ LeftoverSchema.index({ storage: 1, order: 1, type: 1 });
916
+ const Leftover = db.mongoose.model("Leftover", LeftoverSchema);
917
+ return Leftover;
918
+ };
919
+ const discountschema = (db) => {
920
+ const DiscountSchema = new db.mongoose.Schema(
921
+ {
922
+ type: {
923
+ type: String,
924
+ enum: ["discount", "special_price"],
925
+ default: "discount",
926
+ required: true
927
+ },
928
+ value: {
929
+ type: Number,
930
+ required: true,
931
+ min: 0
932
+ },
933
+ quantity: {
934
+ type: Number,
935
+ min: 1
936
+ },
937
+ date: {
938
+ start: Date,
939
+ end: Date
940
+ },
941
+ time: {
942
+ start: String,
943
+ // 'HH:mm' формат
944
+ end: String
945
+ },
946
+ name: String,
947
+ description: String
948
+ },
949
+ { _id: false }
950
+ );
951
+ return DiscountSchema;
952
+ };
953
+ const ProductModel = (db) => {
954
+ const DiscountSchema = discountschema(db);
955
+ const ProductSchema = new db.mongoose.Schema({
956
+ listing: {
957
+ type: String,
958
+ enum: ["sale", "rent"]
959
+ },
960
+ sku: {
961
+ type: String,
962
+ trim: true
963
+ },
964
+ category: [{
965
+ type: db.mongoose.Schema.Types.ObjectId,
966
+ ref: "Category"
967
+ }],
968
+ images: {
969
+ type: Array
970
+ },
971
+ name: {
972
+ type: String
973
+ },
974
+ description: {
975
+ type: String
976
+ },
977
+ attributes: [{
978
+ name: { type: String },
979
+ value: { type: String }
980
+ }],
981
+ translations: {
982
+ type: Array
983
+ },
984
+ discounts: [DiscountSchema]
985
+ }, {
986
+ timestamps: {
987
+ currentTime: () => Date.now()
988
+ }
989
+ });
990
+ applyCommonSchema(ProductSchema);
991
+ applyOwnershipSchema(ProductSchema, db);
992
+ ProductSchema.index({ category: 1 });
993
+ ProductSchema.index({ name: "text", description: "text" });
994
+ const Product = db.mongoose.model("Product", ProductSchema);
995
+ return Product;
996
+ };
997
+ const ingredientSchema = (db) => {
998
+ const IngredientSchema = new db.mongoose.Schema({
999
+ _id: {
1000
+ type: db.mongoose.Schema.Types.ObjectId,
1001
+ ref: "Product"
1002
+ },
1003
+ price: {
1004
+ type: Number,
1005
+ required: true,
1006
+ default: 0,
1007
+ min: [0, "Price cannot be less than 0"]
1008
+ },
1009
+ cost: {
1010
+ type: Number,
1011
+ required: true,
1012
+ default: 0,
1013
+ min: [0, "Price cannot be less than 0"]
1014
+ },
1015
+ quantity: {
1016
+ type: Number,
1017
+ required: true,
1018
+ min: [1, "Quantity cannot be less than 1"]
1019
+ },
1020
+ unit: {
1021
+ type: String,
1022
+ required: true,
1023
+ default: "g"
1024
+ },
1025
+ optional: {
1026
+ type: Boolean,
1027
+ default: false,
1028
+ description: "Является ли ингредиент опциональным"
1029
+ },
1030
+ replaceable: {
1031
+ type: Boolean,
1032
+ default: false,
1033
+ description: "Можно ли заменить ингредиент"
1034
+ },
1035
+ alternatives: [{
1036
+ type: db.mongoose.Schema.Types.ObjectId,
1037
+ ref: "Product",
1038
+ description: "Альтернативные продукты для замены"
1039
+ }]
1040
+ });
1041
+ return IngredientSchema;
1042
+ };
1043
+ const VariantModel = (db) => {
1044
+ const IngredientSchema = ingredientSchema(db);
1045
+ const VariantSchema = new db.mongoose.Schema({
1046
+ _id: {
1047
+ type: db.mongoose.Schema.Types.ObjectId,
1048
+ auto: true
1049
+ },
1050
+ product: {
1051
+ type: db.mongoose.Schema.Types.ObjectId,
1052
+ ref: "Product",
1053
+ required: true
1054
+ },
1055
+ sku: {
1056
+ type: String,
1057
+ trim: true
1058
+ },
1059
+ images: {
1060
+ type: Array
1061
+ },
1062
+ name: {
1063
+ type: String
1064
+ },
1065
+ price: {
1066
+ type: Number
1067
+ },
1068
+ cost: {
1069
+ type: Number,
1070
+ default: 0
1071
+ },
1072
+ quantity: {
1073
+ type: Number,
1074
+ default: 1
1075
+ },
1076
+ unit: {
1077
+ type: String,
1078
+ default: "pcs",
1079
+ enum: ["pcs", "g", "kg", "ml", "l", "oz"]
1080
+ },
1081
+ ingredients: [
1082
+ IngredientSchema
1083
+ ],
1084
+ attributes: [{
1085
+ name: { type: String },
1086
+ value: { type: String }
1087
+ }]
1088
+ }, {
1089
+ timestamps: {
1090
+ currentTime: () => Date.now()
1091
+ }
1092
+ });
1093
+ applyCommonSchema(VariantSchema);
1094
+ applyOwnershipSchema(VariantSchema, db);
1095
+ VariantSchema.index({ Variant: 1, name: 1 });
1096
+ const Variant = db.mongoose.model("Variant", VariantSchema);
1097
+ return Variant;
1098
+ };
1099
+ const verifierFactory$1 = function(db) {
1100
+ const queryValidatorConfig = {
1101
+ parent: { rule: "optional", validator: Validator.schema().string() },
1102
+ url: { rule: "optional", validator: Validator.schema().string() },
1103
+ search: { rule: "optional", validator: Validator.schema().string() },
1104
+ sortParam: {
1105
+ rule: "optional",
1106
+ validator: Validator.schema().string().oneOf(["order", "name", "createdAt", "updatedAt"]),
1107
+ default: "order"
1108
+ },
1109
+ sortOrder: {
1110
+ rule: "optional",
1111
+ validator: Validator.schema().string().oneOf(["asc", "desc"]),
1112
+ default: "asc"
1113
+ },
1114
+ skip: { rule: "optional", validator: Validator.schema().number().integer().min(0), default: 0 },
1115
+ limit: {
1116
+ rule: "optional",
1117
+ validator: Validator.schema().number().integer().min(1).max(100),
1118
+ default: 10
1119
+ },
1120
+ excludeChildren: {
1121
+ rule: "optional",
1122
+ validator: Validator.schema().string().oneOf(["true", "false"]),
1123
+ default: "true"
1124
+ },
1125
+ rootOnly: {
1126
+ rule: "optional",
1127
+ validator: Validator.schema().string().oneOf(["true", "false"]),
1128
+ default: "false"
1129
+ },
1130
+ status: {
1131
+ rule: "optional",
1132
+ validator: Validator.schema().string().oneOf(["draft", "internal", "published", "removed"])
1133
+ },
1134
+ type: {
1135
+ rule: "optional",
1136
+ validator: Validator.schema().string().oneOf(["platform", "organization", "all"]),
1137
+ default: "all"
1138
+ },
1139
+ organizationId: { rule: "optional", validator: Validator.schema().string() }
1140
+ };
1141
+ const bodyValidatorConfig = {
1142
+ _id: { rule: "optional", validator: Validator.schema().string() },
1143
+ name: { rule: "optional", validator: Validator.schema().string().required() },
1144
+ description: { rule: "optional", validator: Validator.schema().string() },
1145
+ photo: { rule: "optional", validator: Validator.schema().string() },
1146
+ status: {
1147
+ rule: "optional",
1148
+ validator: Validator.schema().string().oneOf(["draft", "internal", "published", "removed"]),
1149
+ default: "draft"
1150
+ },
1151
+ url: { rule: "optional", validator: Validator.schema().string().required() },
1152
+ parent: { rule: "optional", validator: Validator.schema().oneOfTypes(["string", "null"]) },
1153
+ localization: { rule: "optional" },
1154
+ filters: { rule: "optional" },
1155
+ owner: {
1156
+ rule: "optional",
1157
+ validator: Validator.schema().object({
1158
+ type: Validator.schema().string().oneOf(["platform", "organization"]).required(),
1159
+ target: Validator.schema().string()
1160
+ })
1161
+ },
1162
+ creator: {
1163
+ rule: "optional",
1164
+ validator: Validator.schema().object({
1165
+ type: Validator.schema().string().oneOf(["user", "organization"]).required(),
1166
+ target: Validator.schema().string()
1167
+ })
1168
+ },
1169
+ children: { rule: "optional", validator: Validator.schema().array() },
1170
+ order: { rule: "optional", validator: Validator.schema().number() }
1171
+ };
1172
+ const orderBodyValidatorConfig = {
1173
+ categories: {
1174
+ rule: "optional",
1175
+ validator: Validator.schema().array().required(),
1176
+ default: []
1177
+ }
1178
+ };
1179
+ const deleteBodyValidatorConfig = {
1180
+ url: {
1181
+ rule: "optional",
1182
+ validator: Validator.schema().string().required()
1183
+ }
1184
+ };
1185
+ const queryVerifier = new Verifier(queryValidatorConfig);
1186
+ const bodyVerifier = new Verifier(bodyValidatorConfig);
1187
+ const orderBodyVerifier = new Verifier(orderBodyValidatorConfig);
1188
+ const deleteBodyVerifier = new Verifier(deleteBodyValidatorConfig);
1189
+ return {
1190
+ // Верификация параметров запроса
1191
+ verifyQuery(req, res, next) {
1192
+ const verification = queryVerifier.verify(req.query);
1193
+ console.log("verification is", verification);
1194
+ if (!verification.isValid) {
1195
+ return res.status(400).json({
1196
+ errors: verification.verificationErrors,
1197
+ message: "Invalid query parameters"
1198
+ });
244
1199
  }
245
- };
246
- const Read = async (req, res) => {
247
- console.log(req.query);
1200
+ req.verifiedQuery = verification.verifiedData;
1201
+ next();
1202
+ },
1203
+ // Верификация тела запроса для создания/обновления категории
1204
+ verifyBody(req, res, next) {
1205
+ const verification = bodyVerifier.verify(req.body);
1206
+ if (!verification.isValid) {
1207
+ return res.status(400).json({
1208
+ errors: verification.verificationErrors,
1209
+ message: "Invalid request data"
1210
+ });
1211
+ }
1212
+ req.verifiedBody = verification.verifiedData;
1213
+ next();
1214
+ },
1215
+ // Верификация тела запроса для обновления порядка категорий
1216
+ verifyOrderBody(req, res, next) {
1217
+ const verification = orderBodyVerifier.verify(req.body);
1218
+ if (!verification.isValid) {
1219
+ return res.status(400).json({
1220
+ errors: verification.verificationErrors,
1221
+ message: "Invalid request data"
1222
+ });
1223
+ }
1224
+ req.verifiedBody = verification.verifiedData;
1225
+ next();
1226
+ },
1227
+ // Верификация тела запроса для удаления категории
1228
+ verifyDeleteBody(req, res, next) {
1229
+ const verification = deleteBodyVerifier.verify(req.body);
1230
+ if (!verification.isValid) {
1231
+ return res.status(400).json({
1232
+ errors: verification.verificationErrors,
1233
+ message: "Invalid request data"
1234
+ });
1235
+ }
1236
+ req.verifiedBody = verification.verifiedData;
1237
+ next();
1238
+ },
1239
+ // Проверка на существование категории с тем же URL (для создания)
1240
+ async checkCategoryExistOrNot(req, res, next) {
248
1241
  try {
249
- const query = {};
250
- if (req.query.owner) {
251
- query["owner.target"] = new ObjectId(req.query.owner);
252
- }
253
- if (req.query._id) {
254
- query._id = new ObjectId(req.query._id);
255
- }
256
- if (req.query.status) {
257
- query.status = req.query.status;
258
- }
259
- const categories = req.query.categories?.split(",") || [];
260
- if (categories.length) {
261
- query.category = { $in: categories };
1242
+ if (!req.verifiedBody.url) {
1243
+ return res.status(400).json({ message: "URL is required" });
262
1244
  }
263
- const deliveryOptions = req.query.delivery?.split(",") || [];
264
- if (deliveryOptions.length) {
265
- query.delivery = { $in: deliveryOptions };
266
- }
267
- const search = req.query.search;
268
- if (search) {
269
- const parts = search.split(".");
270
- let regexPattern = "";
271
- if (parts.length === 2) {
272
- regexPattern = parts.map((part) => part.substr(0, part.length - 1) + ".{1}").join("\\.");
273
- } else {
274
- regexPattern = search.substr(0, search.length - 1) + ".{1}";
275
- }
276
- query.name = { $regex: regexPattern, $options: "i" };
277
- }
278
- const prices = req.query.prices?.split(",") || [];
279
- if (prices.length) {
280
- const priceConditions = prices.map((priceRange) => {
281
- if (priceRange.startsWith("<")) {
282
- return { price: { $lt: parseInt(priceRange.slice(1)) } };
283
- }
284
- if (priceRange.startsWith(">")) {
285
- return { price: { $gt: parseInt(priceRange.slice(1)) } };
286
- }
287
- const [min, max] = priceRange.split("-").map(Number);
288
- return { price: { $gte: min, $lte: max } };
1245
+ const existingCategory = await db.category.findOne({ url: req.verifiedBody.url });
1246
+ if (existingCategory) {
1247
+ return res.status(409).json({
1248
+ message: "Category with this URL already exists",
1249
+ category: existingCategory
289
1250
  });
290
- if (priceConditions.length) {
291
- query.$or = priceConditions;
292
- }
293
1251
  }
294
- if (req.query.filters) {
295
- let escapeRegex = function(string) {
296
- return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
297
- };
298
- try {
299
- const filters = JSON.parse(req.query.filters);
300
- filters.forEach((filter) => {
301
- const { parameter, values, caseSensitive = false } = filter;
302
- const conditions = values.map((value) => {
303
- if (caseSensitive) {
304
- return {
305
- "information": {
306
- $elemMatch: {
307
- "name": parameter,
308
- "value": value
309
- }
310
- }
311
- };
312
- } else {
313
- return {
314
- "information": {
315
- $elemMatch: {
316
- "name": parameter,
317
- "value": { $regex: `^${escapeRegex(value)}$`, $options: "i" }
318
- }
319
- }
320
- };
321
- }
322
- });
323
- if (conditions.length > 0) {
324
- if (query.$or) {
325
- if (!query.$and) {
326
- query.$and = [];
327
- }
328
- query.$and.push({ $or: query.$or });
329
- query.$and.push({ $or: conditions });
330
- delete query.$or;
331
- } else {
332
- query.$or = conditions;
333
- }
334
- }
335
- });
336
- } catch (error) {
337
- console.error("Error parsing filters:", error);
338
- }
339
- }
340
- const options = {
341
- skip: parseInt(req.query.skip) || 0,
342
- limit: parseInt(req.query.limit) || 10,
343
- sort: { createdAt: -1 }
344
- };
345
- const aggregationPipeline = [
346
- { $match: query },
347
- { $sort: options.sort },
348
- { $skip: options.skip },
349
- { $limit: options.limit },
350
- {
351
- $lookup: {
352
- from: "leftovers",
353
- let: { productId: "$_id", ingredientsIds: "$ingredients._id" },
354
- pipeline: [
355
- { $unwind: "$positions" },
356
- {
357
- $match: {
358
- $expr: {
359
- $or: [
360
- { $eq: ["$positions._id", "$$productId"] },
361
- { $in: ["$positions._id", { $ifNull: ["$$ingredientsIds", []] }] }
362
- ]
363
- }
364
- }
365
- },
366
- {
367
- "$addFields": {
368
- "positions.quantity": {
369
- $cond: {
370
- if: { $eq: ["$type", "stock-in"] },
371
- then: "$positions.quantity",
372
- else: { $multiply: ["$positions.quantity", -1] }
373
- }
374
- }
375
- }
376
- },
377
- {
378
- "$project": {
379
- _id: "$positions._id",
380
- quantity: "$positions.quantity",
381
- name: "$positions.name"
382
- }
383
- }
384
- ],
385
- as: "leftovers"
386
- }
387
- },
388
- {
389
- $addFields: {
390
- ingredientsQuantities: {
391
- $cond: {
392
- if: { $isArray: "$ingredients" },
393
- then: {
394
- $map: {
395
- input: "$ingredients",
396
- as: "ingredient",
397
- in: {
398
- $let: {
399
- vars: {
400
- ingredientId: "$$ingredient._id",
401
- ingredientQuantity: { $ifNull: ["$$ingredient.quantity", 0] }
402
- },
403
- in: {
404
- $divide: [
405
- {
406
- $sum: {
407
- $map: {
408
- input: "$leftovers",
409
- as: "leftover",
410
- in: {
411
- $cond: {
412
- if: { $eq: ["$$leftover._id", "$$ingredientId"] },
413
- then: "$$leftover.quantity",
414
- else: 0
415
- }
416
- }
417
- }
418
- }
419
- },
420
- {
421
- $cond: {
422
- if: { $eq: ["$$ingredientQuantity", 0] },
423
- then: 1,
424
- else: "$$ingredientQuantity"
425
- }
426
- }
427
- ]
428
- }
429
- }
430
- }
431
- }
432
- },
433
- else: []
434
- }
435
- }
436
- }
437
- },
438
- // For owner
439
- queryProcessorGlobals.getOwnerUserLookupStage(),
440
- queryProcessorGlobals.getOwnerOrganizationLookupStage(),
441
- queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
442
- {
443
- $set: {
444
- available: {
445
- $cond: {
446
- if: { $eq: ["$listing", "rent"] },
447
- then: "$quantity",
448
- else: {
449
- $cond: {
450
- if: { $gt: [{ $size: { $ifNull: ["$ingredients", []] } }, 0] },
451
- then: { $floor: { $min: "$ingredientsQuantities" } },
452
- else: { $sum: "$leftovers.quantity" }
453
- }
454
- }
455
- }
456
- }
457
- }
458
- },
459
- { $unset: ["leftovers", "ingredientsQuantities"] }
460
- ];
461
- const products = await Product.aggregate(aggregationPipeline);
462
- if (req.query.count) {
463
- const count = products.length;
464
- return res.status(200).json({ count });
465
- }
466
- res.status(200).json(products);
467
- } catch (err) {
468
- return res.status(500).json({ message: err.message });
1252
+ next();
1253
+ } catch (error) {
1254
+ res.status(500).json({ message: error.message });
469
1255
  }
470
- };
471
- const Update = async (req, res) => {
1256
+ },
1257
+ // Загрузка категории для проверки ABAC (для обновления и удаления)
1258
+ async loadCategoryForUpdate(req, res, next) {
472
1259
  try {
473
- const { _id } = req.params;
474
- console.log(req.body.ingredients);
475
- const updatedProduct = await Product.findOneAndUpdate(
476
- { _id },
477
- {
478
- name: req.body.name,
479
- status: req.body.status,
480
- listing: req.body.listing,
481
- description: req.body.description,
482
- price: req.body.price,
483
- price_currency: req.body.price_currency,
484
- price_cost: req.body.price_cost,
485
- unit: req.body.unit,
486
- category: req.body.category,
487
- images: req.body.images,
488
- information: req.body.information,
489
- localization: req.body.localization,
490
- quantity: req.body.quantity,
491
- quantityDiscount: req.body.quantityDiscount,
492
- ingredients: req.body.ingredients
493
- },
494
- { new: true }
495
- );
496
- if (!updatedProduct) {
497
- return res.status(404).send({ message: "Something wrong when updating product." });
1260
+ const categoryId = req.verifiedBody._id;
1261
+ if (!categoryId) {
1262
+ return res.status(400).json({ message: "Category ID is required" });
498
1263
  }
499
- res.status(200).send(updatedProduct);
500
- } catch (err) {
501
- res.status(500).send({ message: err.message });
502
- }
503
- };
504
- const Delete = async (req, res) => {
505
- try {
506
- const { _id } = req.params;
507
- const deletedProduct = await Product.findOneAndDelete({ _id });
508
- if (!deletedProduct) {
509
- return res.status(404).send({ message: "Product not found for deletion." });
1264
+ const category = await db.category.findById(categoryId).lean();
1265
+ if (!category) {
1266
+ return res.status(404).json({ message: "Category not found" });
510
1267
  }
511
- res.status(200).send(deletedProduct);
512
- } catch (err) {
513
- res.status(500).send({ message: err.message });
1268
+ req.currentResource = category;
1269
+ next();
1270
+ } catch (error) {
1271
+ res.status(500).json({ message: error.message });
514
1272
  }
515
- };
516
- const getProductRecommendation = async (req, res) => {
517
- const { mood } = req.body;
1273
+ },
1274
+ // Загрузка категории по URL для удаления
1275
+ async loadCategoryForDelete(req, res, next) {
518
1276
  try {
519
- const products = await Product.find({
520
- status: "published"
521
- }).limit(40);
522
- if (!products) {
523
- console.log("no products");
524
- return res.status(404).send({ message: "Products not found." });
1277
+ const url = req.verifiedBody.url;
1278
+ if (!url) {
1279
+ return res.status(400).json({ message: "Category URL is required" });
525
1280
  }
526
- const productsList = products.map((p) => {
527
- const info = p.information || [];
528
- const value0 = info[0] ? info[0].value : "";
529
- const value1 = info[1] ? `(${info[1].value}%)` : "";
530
- const value2 = info[2] ? `(${info[2].value})` : "";
531
- return `${p._id}: ${p.name} (${value0}) ${value1} ${value2}`;
532
- }).join(", ");
533
- const prompt = `
534
- 1. When asked how the client wants to feel, they responded "${mood}".
535
- 2. Here is a list of products in our store: ${productsList}.
536
- 3. Based on the information about the products (strain, THC content) and the user's desires, choose 1 product to recommend to the user.
537
- 4. The response should be in the language that the user used in mood (${mood}).
538
- 5. Please format your response as a JSON object '{"_id": "ID of the recommended product (it must correspond to one of the product IDs I sent)", "recommendationText": "Text explaining why this particular product"'. Write only the JSON object without any other text outside of it.
539
- `;
540
- console.log(prompt);
541
- let response;
542
- let result;
543
- while (true) {
544
- try {
545
- response = await openai.chat.completions.create({
546
- model: "gpt-3.5-turbo",
547
- messages: [{ role: "user", content: prompt }]
548
- });
549
- console.log(response);
550
- result = JSON.parse(response.choices[0].message.content);
551
- break;
552
- } catch (err) {
553
- if (err instanceof SyntaxError) {
554
- console.log("Received invalid JSON, retrying...");
555
- } else {
556
- console.log(err);
557
- res.status(500).send({ message: err });
558
- return;
559
- }
560
- }
1281
+ const category = await db.category.findOne({ url }).lean();
1282
+ if (!category) {
1283
+ return res.status(404).json({ message: "Category not found" });
561
1284
  }
562
- console.log(result._id);
563
- console.log(result.recommendationText);
564
- const recommendedProduct = await Product.findById(result._id);
565
- if (!recommendedProduct) {
566
- console.log(`No product found with _id: ${result._id}`);
567
- return res.status(404).send({ message: "Recommended product not found." });
568
- }
569
- res.status(200).json({ product: recommendedProduct, recommendationText: result.recommendationText });
570
- } catch (err) {
571
- console.log(err);
572
- res.status(500).send({ message: err });
1285
+ req.currentResource = category;
1286
+ next();
1287
+ } catch (error) {
1288
+ res.status(500).json({ message: error.message });
573
1289
  }
1290
+ }
1291
+ };
1292
+ };
1293
+ const { getInstance: getInstance$1 } = globalsabac;
1294
+ const categoriesRoutes = function(app, db) {
1295
+ const jwt = middlewareFactory(db);
1296
+ const verifier = verifierFactory$1(db);
1297
+ const abac = getInstance$1(db);
1298
+ const controller = controllerFactory$2(db);
1299
+ app.get("/api/categories", jwt.verifyToken(true), verifier.verifyQuery, controller.read);
1300
+ app.post("/api/categories/create", jwt.verifyToken(), verifier.verifyBody, verifier.checkCategoryExistOrNot, abac.middleware("category", "create"), controller.create);
1301
+ app.post("/api/categories/update", jwt.verifyToken(), verifier.verifyBody, verifier.loadCategoryForUpdate, abac.middleware("category", "edit"), controller.update);
1302
+ app.post("/api/categories/updateOrder", jwt.verifyToken(), verifier.verifyOrderBody, abac.middleware("category", "edit"), controller.updateOrder);
1303
+ app.post("/api/categories/delete", jwt.verifyToken(), verifier.verifyDeleteBody, verifier.loadCategoryForDelete, abac.middleware("category", "delete"), controller.delete);
1304
+ };
1305
+ const leftoversRoutes = function(app, db) {
1306
+ const controller = controllerFactory$1(db);
1307
+ app.get("/leftovers", controller.read);
1308
+ app.get("/leftovers/:_id", controller.get);
1309
+ app.post("/leftovers/:_id", controller.update);
1310
+ app.post("/leftovers", controller.create);
1311
+ app.delete("/leftovers/:_id", controller.delete);
1312
+ };
1313
+ const productsRoutes = function(app, db, allowedOrigins) {
1314
+ const controller = controllerFactory(db);
1315
+ app.post("/api/products/create", controller.Create);
1316
+ app.get("/api/products/read", controller.Read);
1317
+ app.post("/api/products/:_id", controller.Update);
1318
+ app.delete("/api/products/:_id", controller.Delete);
1319
+ app.post("/api/product/recommended", controller.getProductRecommendation);
1320
+ };
1321
+ class CRUDCore {
1322
+ constructor(crud) {
1323
+ this.crud = crud;
1324
+ this.verifiers = {};
1325
+ this.hooks = {};
1326
+ this.aggregateExtensions = {};
1327
+ this.cacheOptions = {
1328
+ ttl: 300,
1329
+ // 5 минут по умолчанию
1330
+ tags: [crud.modelName],
1331
+ enabled: true
574
1332
  };
575
- const getProductsPopular = (req, res) => {
576
- Product.find({
577
- status: "published",
578
- views: { $gt: 10 }
579
- }).populate("modifications").limit(10).exec((err, products) => {
580
- if (err) {
581
- return res.status(500).send({ message: err });
582
- }
583
- if (!products) {
584
- return res.status(404).send({ message: "Products not found." });
585
- }
586
- res.status(200).send(products);
587
- });
1333
+ this.auth = {
1334
+ read: false,
1335
+ // Публичный доступ к чтению
1336
+ create: true,
1337
+ // Требует авторизацию
1338
+ update: true,
1339
+ // Требует авторизацию
1340
+ delete: true
1341
+ // Требует авторизацию
588
1342
  };
589
- return {
590
- Create,
591
- Read,
592
- Update,
593
- Delete,
594
- getProductsPopular,
595
- getProductRecommendation
1343
+ this.options = {
1344
+ enableEvents: true,
1345
+ enableAudit: false,
1346
+ enableMetrics: false,
1347
+ strictMode: false,
1348
+ serviceKey: process.env.SERVICE_KEY
596
1349
  };
597
- };
598
- products_controller = controllerFactory;
599
- return products_controller;
600
- }
601
- var products_routes;
602
- var hasRequiredProducts_routes;
603
- function requireProducts_routes() {
604
- if (hasRequiredProducts_routes) return products_routes;
605
- hasRequiredProducts_routes = 1;
606
- const controllerFactory = requireProducts_controller();
607
- products_routes = function(app, db, allowedOrigins) {
608
- const controller = controllerFactory(db);
609
- app.post(
610
- "/api/products/create",
611
- controller.Create
612
- );
613
- app.get(
614
- "/api/products/read",
615
- controller.Read
616
- );
617
- app.post(
618
- "/api/products/:_id",
619
- controller.Update
620
- );
621
- app.delete(
622
- "/api/products/:_id",
623
- controller.Delete
624
- );
625
- app.post(
626
- "/api/product/recommended",
627
- controller.getProductRecommendation
628
- );
629
- };
630
- return products_routes;
1350
+ }
1351
+ // Инициализация с опциями
1352
+ init(options = {}) {
1353
+ if (options.auth !== void 0) {
1354
+ if (options.auth === false) {
1355
+ this.auth = false;
1356
+ } else if (options.auth === true) {
1357
+ this.auth = {
1358
+ read: false,
1359
+ create: true,
1360
+ update: true,
1361
+ delete: true
1362
+ };
1363
+ } else if (typeof options.auth === "object") {
1364
+ this.auth = {
1365
+ read: false,
1366
+ create: true,
1367
+ update: true,
1368
+ delete: true,
1369
+ ...options.auth
1370
+ };
1371
+ }
1372
+ }
1373
+ if (options.cache !== void 0) {
1374
+ if (options.cache === false) {
1375
+ this.cacheOptions.enabled = false;
1376
+ } else if (typeof options.cache === "object") {
1377
+ this.setCacheOptions(options.cache);
1378
+ }
1379
+ }
1380
+ if (options.events !== void 0) {
1381
+ if (options.events === false) {
1382
+ this.options.enableEvents = false;
1383
+ } else if (typeof options.events === "object") {
1384
+ Object.assign(this.options, options.events);
1385
+ }
1386
+ }
1387
+ if (options.verifiers) this.initVerifiers(options.verifiers);
1388
+ if (options.hooks) this.initHooks(options.hooks);
1389
+ if (options.middlewares) this.initMiddlewares(options.middlewares);
1390
+ if (options.aggregateExtensions) this.initAggregateExtensions(options.aggregateExtensions);
1391
+ if (options.abac) this.initABAC(options.abac, options.policies, options.fieldsPolicies);
1392
+ if (options.serviceKey !== void 0) {
1393
+ this.options.serviceKey = options.serviceKey;
1394
+ }
1395
+ this.crud.events.init(this.options);
1396
+ if (options.abac) {
1397
+ this.crud.policies.init(options.abac, options.policies, options.fieldsPolicies);
1398
+ }
1399
+ }
1400
+ // Управление auth
1401
+ setAuth(action, required) {
1402
+ if (this.auth === false) {
1403
+ this.auth = {};
1404
+ }
1405
+ this.auth[action] = required;
1406
+ }
1407
+ getAuth(action) {
1408
+ if (this.auth === false) return false;
1409
+ return this.auth[action] ?? true;
1410
+ }
1411
+ isAuthEnabled() {
1412
+ return this.auth !== false;
1413
+ }
1414
+ // Управление верификаторами
1415
+ setVerifier(action, verifier) {
1416
+ this.verifiers[action] = verifier;
1417
+ }
1418
+ getVerifier(action) {
1419
+ return this.verifiers[action];
1420
+ }
1421
+ initVerifiers(verifiers) {
1422
+ Object.entries(verifiers).forEach(([action, verifier]) => {
1423
+ this.setVerifier(action, verifier);
1424
+ });
1425
+ }
1426
+ // Управление хуками
1427
+ addHook(name, handler) {
1428
+ this.hooks[name] = handler;
1429
+ }
1430
+ getHook(name) {
1431
+ return this.hooks[name];
1432
+ }
1433
+ async executeHook(name, ...args) {
1434
+ const hook = this.getHook(name);
1435
+ if (hook) {
1436
+ return await hook(...args);
1437
+ }
1438
+ }
1439
+ initHooks(hooks) {
1440
+ Object.entries(hooks).forEach(([name, handler]) => {
1441
+ this.addHook(name, handler);
1442
+ });
1443
+ }
1444
+ // Управление расширениями агрегации
1445
+ addAggregateExtension(phase, extension) {
1446
+ this.aggregateExtensions[phase] = extension;
1447
+ }
1448
+ getAggregateExtensions() {
1449
+ return this.aggregateExtensions;
1450
+ }
1451
+ initAggregateExtensions(extensions) {
1452
+ Object.entries(extensions).forEach(([phase, extension]) => {
1453
+ this.addAggregateExtension(phase, extension);
1454
+ });
1455
+ }
1456
+ // Управление middleware (делегирует в controller)
1457
+ initMiddlewares(middlewares) {
1458
+ Object.entries(middlewares).forEach(([phase, actions]) => {
1459
+ if (typeof actions === "object") {
1460
+ Object.entries(actions).forEach(([action, mws]) => {
1461
+ const middlewareArray = Array.isArray(mws) ? mws : [mws];
1462
+ middlewareArray.forEach((mw) => {
1463
+ this.crud.controller.addMiddleware(phase, action, mw);
1464
+ });
1465
+ });
1466
+ }
1467
+ });
1468
+ }
1469
+ // Управление ABAC (делегирует в policies)
1470
+ initABAC(abac, policies = {}, fieldsPolicies = null) {
1471
+ if (fieldsPolicies && typeof fieldsPolicies === "function" && abac) {
1472
+ abac.registerFieldsPolicy(this.crud.modelName, fieldsPolicies);
1473
+ }
1474
+ }
1475
+ // Управление кешем
1476
+ getCacheOptions() {
1477
+ return { ...this.cacheOptions };
1478
+ }
1479
+ setCacheOptions(options) {
1480
+ Object.assign(this.cacheOptions, options);
1481
+ if (!this.cacheOptions.tags.includes(this.crud.modelName)) {
1482
+ this.cacheOptions.tags.unshift(this.crud.modelName);
1483
+ }
1484
+ }
1485
+ // Получение опций
1486
+ getOptions() {
1487
+ return { ...this.options };
1488
+ }
1489
+ setOption(key, value) {
1490
+ this.options[key] = value;
1491
+ }
1492
+ // Проверка включенности функций
1493
+ isEventsEnabled() {
1494
+ return this.options.enableEvents;
1495
+ }
1496
+ isCacheEnabled() {
1497
+ return this.cacheOptions.enabled && this.crud.cache !== null;
1498
+ }
1499
+ isAuditEnabled() {
1500
+ return this.options.enableAudit;
1501
+ }
1502
+ isMetricsEnabled() {
1503
+ return this.options.enableMetrics;
1504
+ }
631
1505
  }
632
- var categories_routes = { exports: {} };
633
- var categories_controller;
634
- var hasRequiredCategories_controller;
635
- function requireCategories_controller() {
636
- if (hasRequiredCategories_controller) return categories_controller;
637
- hasRequiredCategories_controller = 1;
638
- const globalsQuery = queryProcessor.requireQueryProcessor();
639
- const Logger = globals_logger.requireGlobals_logger();
640
- const Cache = globals_cache.requireGlobals_cache();
641
- const controllerFactory = (db) => {
642
- const Category = db.category;
643
- const logger = new Logger(db);
644
- const cache = new Cache();
645
- return {
646
- async read(req, res) {
647
- try {
648
- const {
649
- parent,
650
- url,
651
- search,
652
- sortParam,
653
- sortOrder,
654
- skip,
655
- limit,
656
- excludeChildren,
657
- rootOnly,
658
- type
659
- } = req.verifiedQuery;
660
- const cacheKey = JSON.stringify(req.verifiedQuery);
661
- let cachedResult = await cache.get(cacheKey);
662
- if (cachedResult) {
663
- return res.status(200).json(cachedResult);
664
- }
665
- const matchStage = {
666
- ...req.query.status && { status: req.query.status },
667
- ...url && { url },
668
- ...search && { name: { $regex: search, $options: "i" } },
669
- ...parent ? { parent: new db.mongoose.Types.ObjectId(parent) } : {},
670
- ...rootOnly === "true" && !search ? { parent: null } : {}
671
- };
672
- if (type === "platform") {
673
- matchStage["owner.type"] = "platform";
674
- } else if (type === "organization" && req.query.organizationId) {
675
- matchStage["owner.type"] = "organization";
676
- matchStage["owner.target"] = new db.mongoose.Types.ObjectId(req.query.organizationId);
677
- }
678
- if (search) {
679
- excludeChildren = "true";
680
- }
681
- const pipeline = [
682
- { $match: matchStage },
683
- globalsQuery.getCreatorUserLookupStage(),
684
- globalsQuery.getCreatorOrganizationLookupStage(),
685
- // For owner
686
- globalsQuery.getOwnerUserLookupStage(),
687
- globalsQuery.getOwnerOrganizationLookupStage(),
688
- globalsQuery.getAddFieldsCreatorOwnerStage(),
689
- { $sort: { [sortParam]: sortOrder === "asc" ? 1 : -1 } },
690
- { $skip: Number(skip) },
691
- { $limit: Number(limit) },
692
- globalsQuery.removeTempPropeties()
693
- ];
694
- if (excludeChildren !== "true") {
695
- pipeline.push({
696
- $graphLookup: {
697
- from: "categories",
698
- startWith: "$_id",
699
- connectFromField: "_id",
700
- connectToField: "parent",
701
- as: "allDescendants",
702
- maxDepth: 10
703
- }
704
- });
1506
+ class CRUDController {
1507
+ constructor(crud) {
1508
+ this.crud = crud;
1509
+ this.routes = /* @__PURE__ */ new Map();
1510
+ this.middlewares = {
1511
+ before: {},
1512
+ after: {}
1513
+ };
1514
+ this.jwt = middlewareFactory(crud.db);
1515
+ }
1516
+ // Добавление middleware
1517
+ addMiddleware(phase, action, middleware) {
1518
+ if (!["before", "after"].includes(phase)) {
1519
+ throw new Error(`Invalid middleware phase: ${phase}`);
1520
+ }
1521
+ if (!this.middlewares[phase][action]) {
1522
+ this.middlewares[phase][action] = [];
1523
+ }
1524
+ this.middlewares[phase][action].push(middleware);
1525
+ }
1526
+ // Получение middleware для действия
1527
+ getMiddlewares(phase, action) {
1528
+ return this.middlewares[phase][action] || [];
1529
+ }
1530
+ // Регистрация роута
1531
+ registerRoute(method, path, actionName) {
1532
+ const fullPath = `${this.crud.basePath}${path}`;
1533
+ const middlewareStack = [];
1534
+ if (this.crud.core.isAuthEnabled()) {
1535
+ const authRequired = this.crud.core.getAuth(actionName);
1536
+ middlewareStack.push(this.jwt.verifyToken(!authRequired));
1537
+ }
1538
+ const verifierMiddleware = this._createVerifierMiddleware(method, actionName);
1539
+ if (verifierMiddleware) {
1540
+ middlewareStack.push(verifierMiddleware);
1541
+ }
1542
+ middlewareStack.push(...this.getMiddlewares("before", actionName));
1543
+ const abacMiddleware = this.crud.policies.getPoliciesMiddleware(actionName);
1544
+ if (abacMiddleware) {
1545
+ middlewareStack.push(abacMiddleware);
1546
+ }
1547
+ if (["create", "update"].includes(actionName)) {
1548
+ const fieldsMiddleware = this.crud.policies.getFieldsMiddleware(actionName);
1549
+ if (fieldsMiddleware) {
1550
+ middlewareStack.push(fieldsMiddleware);
1551
+ }
1552
+ }
1553
+ const handler = this._createHandler(actionName);
1554
+ const wrappedHandler = this._wrapHandler(handler, actionName);
1555
+ this.crud.app[method](fullPath, ...middlewareStack, wrappedHandler);
1556
+ this.routes.set(`${method.toUpperCase()} ${fullPath}`, {
1557
+ method,
1558
+ path: fullPath,
1559
+ actionName,
1560
+ middlewareStack
1561
+ });
1562
+ return this;
1563
+ }
1564
+ // Регистрация кастомного роута
1565
+ registerCustomRoute(method, path, actionName, handler) {
1566
+ this.crud.service.registerCustomHandler(actionName, handler);
1567
+ return this.registerRoute(method, path, actionName);
1568
+ }
1569
+ // Создание handler для стандартных CRUD операций
1570
+ _createHandler(actionName) {
1571
+ switch (actionName) {
1572
+ case "create":
1573
+ return async (req, res) => {
1574
+ try {
1575
+ const data = req.verified || req.body;
1576
+ const context = this._buildContext(req);
1577
+ const created = await this.crud.service.create(data, context);
1578
+ res.status(201).json(created);
1579
+ } catch (error) {
1580
+ this._handleError(error, res);
705
1581
  }
706
- const results = await Category.aggregate(pipeline);
707
- let response;
708
- if (excludeChildren === "true") {
709
- response = results;
710
- } else {
711
- const allCategories = [];
712
- results.forEach((doc) => {
713
- const category = { ...doc };
714
- delete category.allDescendants;
715
- allCategories.push(category);
716
- if (doc.allDescendants && doc.allDescendants.length > 0) {
717
- allCategories.push(...doc.allDescendants);
718
- }
719
- });
720
- const uniqueCategories = Array.from(
721
- new Map(allCategories.map((item) => [item._id.toString(), item])).values()
722
- );
723
- const tree = buildAdjacencyTree(uniqueCategories, sortParam, sortOrder);
724
- if (rootOnly === "true") {
725
- response = tree;
726
- } else {
727
- const requestedCategoryIds = results.map((r) => r._id.toString());
728
- response = tree.filter(
729
- (category) => requestedCategoryIds.includes(category._id.toString())
730
- );
1582
+ };
1583
+ case "read":
1584
+ return async (req, res) => {
1585
+ try {
1586
+ const query = req.verified || req.query;
1587
+ const context = this._buildContext(req);
1588
+ let data = await this.crud.service.read(query, context);
1589
+ if (this.crud.policies.hasAbac()) {
1590
+ data = await this.crud.policies.filterFieldsForRead(req, data);
731
1591
  }
1592
+ res.json(data);
1593
+ } catch (error) {
1594
+ this._handleError(error, res);
732
1595
  }
733
- const tags = ["categories"];
734
- if (type === "organization" && req.query.organizationId) {
735
- tags.push(`organization_${req.query.organizationId}`);
736
- }
737
- for (const cat of response) {
738
- if (cat._id) {
739
- tags.push(`category_${cat._id}`);
1596
+ };
1597
+ case "update":
1598
+ return async (req, res) => {
1599
+ try {
1600
+ const data = req.verified || req.body;
1601
+ const { _id, ...updateData } = data;
1602
+ if (!_id) {
1603
+ return res.status(400).json({ error: "ID_REQUIRED" });
740
1604
  }
1605
+ const context = this._buildContext(req);
1606
+ const updated = await this.crud.service.update(_id, updateData, context);
1607
+ res.json(updated);
1608
+ } catch (error) {
1609
+ this._handleError(error, res);
741
1610
  }
742
- await cache.setWithTags(cacheKey, response, tags);
743
- res.status(200).json(response);
744
- } catch (err) {
745
- logger.error(`Error reading categories: ${err.message}`);
746
- res.status(500).json({ message: err.message });
747
- }
748
- },
749
- async create(req, res) {
750
- try {
751
- const categoryData = req.verifiedBody;
752
- if (!categoryData.creator && req.userId) {
753
- categoryData.creator = {
754
- type: "user",
755
- target: req.userId
756
- };
757
- }
758
- if (!categoryData.owner) {
759
- if (req.query.organizationId) {
760
- categoryData.owner = {
761
- type: "organization",
762
- target: req.query.organizationId
763
- };
764
- } else {
765
- categoryData.owner = {
766
- type: "platform",
767
- target: null
768
- };
1611
+ };
1612
+ case "delete":
1613
+ return async (req, res) => {
1614
+ try {
1615
+ const data = req.verified || req.query || req.body;
1616
+ const { _id } = data;
1617
+ if (!_id) {
1618
+ return res.status(400).json({ error: "ID_REQUIRED" });
769
1619
  }
1620
+ const context = this._buildContext(req);
1621
+ await this.crud.service.delete(_id, context);
1622
+ res.status(204).send();
1623
+ } catch (error) {
1624
+ this._handleError(error, res);
770
1625
  }
771
- const highestOrder = await Category.findOne().sort("-order");
772
- const order = highestOrder ? highestOrder.order + 1 : 1;
773
- const category = new Category({
774
- ...categoryData,
775
- order
776
- });
777
- if (categoryData.parent) {
778
- const parent = await Category.findByIdAndUpdate(
779
- categoryData.parent,
780
- { $push: { children: category._id } },
781
- { new: true }
782
- );
783
- if (!parent) throw new Error("Parent category not found");
784
- category.parent = parent._id;
785
- }
786
- if (categoryData.children && categoryData.children.length > 0) {
787
- await Category.updateMany(
788
- { _id: { $in: categoryData.children } },
789
- { $set: { parent: category._id } }
790
- );
791
- }
792
- await category.save();
793
- await cache.delByTags(["categories"]);
794
- if (category.owner.type === "organization") {
795
- await cache.delByTag(`organization_${category.owner.target}`);
796
- }
797
- logger.info(`Category created: ${category._id}`);
798
- res.status(201).json(category);
799
- } catch (err) {
800
- logger.error(`Error creating category: ${err.message}`);
801
- res.status(err.message === "Parent category not found" ? 404 : 500).json({ message: err.message });
802
- }
803
- },
804
- async update(req, res) {
805
- try {
806
- const category = req.verifiedBody;
807
- const updatedCategory = await Category.findByIdAndUpdate(
808
- category._id,
809
- { $set: category },
810
- { new: true }
811
- ).lean();
812
- if (!updatedCategory) {
813
- return res.status(404).json({ message: "Category not found" });
814
- }
815
- await cache.delByTag(`category_${category._id}`);
816
- await cache.delByTags(["categories"]);
817
- if (updatedCategory.owner && updatedCategory.owner.type === "organization") {
818
- await cache.delByTag(`organization_${updatedCategory.owner.target}`);
819
- }
820
- logger.info(`Category updated: ${category._id}`);
821
- res.status(200).json(updatedCategory);
822
- } catch (err) {
823
- logger.error(`Category update error: ${err.message}`);
824
- res.status(500).json({ message: "Failed to update category" });
825
- }
826
- },
827
- async updateOrder(req, res) {
828
- try {
829
- const { categories } = req.verifiedBody;
830
- const bulkOps = categories.map((category) => ({
831
- updateOne: {
832
- filter: { _id: category._id },
833
- update: {
834
- $set: {
835
- order: category.order,
836
- parent: category.parent ? new db.mongoose.Types.ObjectId(category.parent) : null
837
- }
838
- }
839
- }
840
- }));
841
- await Category.bulkWrite(bulkOps);
842
- const categoryIds = categories.map((cat) => cat._id);
843
- const organizationIds = /* @__PURE__ */ new Set();
844
- const updatedCategories = await Category.find({ _id: { $in: categoryIds } }).lean();
845
- updatedCategories.forEach((cat) => {
846
- if (cat.owner && cat.owner.type === "organization") {
847
- organizationIds.add(cat.owner.target.toString());
1626
+ };
1627
+ default:
1628
+ return async (req, res) => {
1629
+ try {
1630
+ const customHandler = this.crud.service.getCustomHandler(actionName);
1631
+ if (!customHandler) {
1632
+ return res.status(404).json({ error: "ACTION_NOT_FOUND" });
848
1633
  }
849
- });
850
- await cache.delByTags(["categories"]);
851
- for (const catId of categoryIds) {
852
- await cache.delByTag(`category_${catId}`);
853
- }
854
- for (const orgId of organizationIds) {
855
- await cache.delByTag(`organization_${orgId}`);
856
- }
857
- let query = {};
858
- if (req.query.type === "platform") {
859
- query = { "owner.type": "platform" };
860
- } else if (req.query.type === "organization" && req.query.organizationId) {
861
- query = {
862
- "owner.type": "organization",
863
- "owner.target": new db.mongoose.Types.ObjectId(req.query.organizationId)
864
- };
865
- }
866
- const result = await Category.find(query).sort({ order: "asc" }).lean();
867
- logger.info(`Categories order updated: ${categoryIds.join(", ")}`);
868
- res.status(200).json(result);
869
- } catch (err) {
870
- logger.error(`Category order update error: ${err.message}`);
871
- res.status(500).json({ message: "Failed to update categories order" });
872
- }
873
- },
874
- async delete(req, res) {
875
- try {
876
- const category = req.currentResource;
877
- let ownerOrgId = null;
878
- if (category.owner && category.owner.type === "organization") {
879
- ownerOrgId = category.owner.target;
1634
+ await customHandler.call(this.crud, req, res);
1635
+ } catch (error) {
1636
+ this._handleError(error, res);
880
1637
  }
881
- const result = await Category.aggregate([
882
- { $match: { _id: category._id } },
883
- {
884
- $graphLookup: {
885
- from: "categories",
886
- startWith: "$_id",
887
- connectFromField: "_id",
888
- connectToField: "parent",
889
- as: "descendants"
890
- }
891
- },
892
- {
893
- $project: { descendants: 1 }
894
- }
895
- ]);
896
- const idsToDelete = [category._id, ...(result[0]?.descendants || []).map(({ _id }) => _id)];
897
- const categoryIdsTags = idsToDelete.map((id) => `category_${id}`);
898
- await Category.deleteMany({ _id: { $in: idsToDelete } });
899
- await cache.delByTags(["categories"]);
900
- await cache.delByTags(categoryIdsTags);
901
- if (ownerOrgId) {
902
- await cache.delByTag(`organization_${ownerOrgId}`);
1638
+ };
1639
+ }
1640
+ }
1641
+ // Создание контекста из request
1642
+ _buildContext(req) {
1643
+ return {
1644
+ userId: req.userId,
1645
+ user: req.user,
1646
+ organizationId: req.organizationId,
1647
+ roles: req.roles || [],
1648
+ permissions: req.permissions || [],
1649
+ abacContext: req.abacContext || {},
1650
+ ip: req.ip,
1651
+ userAgent: req.get("user-agent"),
1652
+ isServiceRequest: req.isServiceRequest || false,
1653
+ ...req.context
1654
+ // Дополнительный контекст
1655
+ };
1656
+ }
1657
+ // Обработка ошибок
1658
+ _handleError(error, res) {
1659
+ if (res.headersSent) return;
1660
+ const statusCode = error.statusCode || error.code === "NOT_FOUND" ? 404 : 500;
1661
+ const message = error.message || "Internal Server Error";
1662
+ res.status(statusCode).json({
1663
+ error: message,
1664
+ code: error.code
1665
+ });
1666
+ }
1667
+ // Создание middleware для верификации
1668
+ _createVerifierMiddleware(method, actionName) {
1669
+ const verifier = this.crud.core.getVerifier(actionName);
1670
+ if (!verifier) return null;
1671
+ const verifyTarget = this._getVerificationTarget(method, actionName);
1672
+ if (!verifyTarget) return null;
1673
+ return (req, res, next) => {
1674
+ const data = verifyTarget === "query" ? req.query : req.body;
1675
+ const result = verifier.verify ? verifier.verify(data) : verifier.validate(data);
1676
+ if (!result.isValid) {
1677
+ return res.status(400).json({
1678
+ error: "VALIDATION_ERROR",
1679
+ field: verifyTarget,
1680
+ errors: result.verificationErrors || result.errors
1681
+ });
1682
+ }
1683
+ console.log("verified result", result);
1684
+ req.verified = result.verifiedData || data;
1685
+ next();
1686
+ };
1687
+ }
1688
+ // Определение цели верификации
1689
+ _getVerificationTarget(method, actionName) {
1690
+ if (["create", "update"].includes(actionName)) {
1691
+ return "body";
1692
+ }
1693
+ if (["read", "delete"].includes(actionName)) {
1694
+ return "query";
1695
+ }
1696
+ if (["post", "put", "patch"].includes(method)) {
1697
+ return "body";
1698
+ }
1699
+ if (["get", "delete"].includes(method)) {
1700
+ return "query";
1701
+ }
1702
+ return null;
1703
+ }
1704
+ // Обертка handler для after middleware
1705
+ _wrapHandler(handler, actionName) {
1706
+ return async (req, res, next) => {
1707
+ try {
1708
+ await handler(req, res, next);
1709
+ if (!res.headersSent) {
1710
+ const afterMiddlewares = this.getMiddlewares("after", actionName);
1711
+ for (const mw of afterMiddlewares) {
1712
+ await new Promise((resolve, reject) => {
1713
+ mw(req, res, (err) => err ? reject(err) : resolve());
1714
+ });
903
1715
  }
904
- logger.info(`Category and its subcategories deleted: ${category.url}`);
905
- res.status(200).json({ message: "Category and its subcategories deleted successfully" });
906
- } catch (err) {
907
- logger.error(`Error deleting category: ${err.message}`);
908
- res.status(500).json({ message: err.message || "Internal server error" });
909
1716
  }
1717
+ } catch (error) {
1718
+ next(error);
910
1719
  }
911
1720
  };
912
- function buildAdjacencyTree(categories, sortParam, sortOrder) {
913
- const categoryMap = /* @__PURE__ */ new Map();
914
- categories.forEach((category) => {
915
- categoryMap.set(category._id.toString(), {
916
- ...category,
917
- children: []
1721
+ }
1722
+ // Получение информации о роутах
1723
+ getRoutes() {
1724
+ return Array.from(this.routes.entries()).map(([key, value]) => ({
1725
+ key,
1726
+ ...value
1727
+ }));
1728
+ }
1729
+ // Удаление роута
1730
+ removeRoute(method, path) {
1731
+ const key = `${method.toUpperCase()} ${this.crud.basePath}${path}`;
1732
+ return this.routes.delete(key);
1733
+ }
1734
+ // Проверка существования роута
1735
+ hasRoute(method, path) {
1736
+ const key = `${method.toUpperCase()} ${this.crud.basePath}${path}`;
1737
+ return this.routes.has(key);
1738
+ }
1739
+ }
1740
+ class CRUDService {
1741
+ constructor(crud) {
1742
+ this.crud = crud;
1743
+ this.customHandlers = /* @__PURE__ */ new Map();
1744
+ }
1745
+ // Регистрация кастомного handler
1746
+ registerCustomHandler(name, handler) {
1747
+ this.customHandlers.set(name, handler);
1748
+ }
1749
+ // CREATE операция
1750
+ async create(data, context = {}) {
1751
+ try {
1752
+ const hookData = await this.crud.core.executeHook("beforeCreate", data, context);
1753
+ const finalData = hookData || data;
1754
+ const created = await this.crud.model.create(finalData);
1755
+ if (this.crud.core.isCacheEnabled()) {
1756
+ await this.invalidateCache("create", created);
1757
+ }
1758
+ if (this.crud.core.isEventsEnabled()) {
1759
+ await this.crud.events.emit("created", {
1760
+ document: created,
1761
+ user: context.userId
918
1762
  });
919
- });
920
- const rootCategories = [];
921
- categories.forEach((category) => {
922
- const categoryWithChildren = categoryMap.get(category._id.toString());
923
- if (category.parent && categoryMap.has(category.parent.toString())) {
924
- const parentCategory = categoryMap.get(category.parent.toString());
925
- parentCategory.children.push(categoryWithChildren);
926
- } else if (!category.parent) {
927
- rootCategories.push(categoryWithChildren);
928
- }
929
- });
930
- function sortCategories(nodes) {
931
- if (!nodes || nodes.length === 0) {
932
- return nodes;
1763
+ }
1764
+ await this.crud.core.executeHook("afterCreate", created, context);
1765
+ return created;
1766
+ } catch (error) {
1767
+ console.log(error);
1768
+ await this.crud.events.logError("create", error);
1769
+ throw error;
1770
+ }
1771
+ }
1772
+ // READ операция
1773
+ async read(query = {}, context = {}) {
1774
+ try {
1775
+ await this.crud.core.executeHook("beforeRead", query, context);
1776
+ let data = null;
1777
+ let cacheKey = null;
1778
+ if (this.crud.core.isCacheEnabled()) {
1779
+ cacheKey = this.generateCacheKey("read", query);
1780
+ data = await this.crud.cache.get(cacheKey);
1781
+ }
1782
+ if (!data) {
1783
+ const pipeline = await this.buildAggregationPipeline(query, context);
1784
+ data = await this.crud.model.aggregate(pipeline).exec();
1785
+ if (this.crud.core.isCacheEnabled() && cacheKey) {
1786
+ const cacheOptions = this.crud.core.getCacheOptions();
1787
+ await this.crud.cache.setWithTags(
1788
+ cacheKey,
1789
+ data,
1790
+ [...cacheOptions.tags, `${this.crud.modelName}_list`],
1791
+ cacheOptions.ttl
1792
+ );
933
1793
  }
934
- nodes.sort((a, b) => {
935
- const valueA = a[sortParam] ?? (sortParam === "order" ? Number.MAX_SAFE_INTEGER : "");
936
- const valueB = b[sortParam] ?? (sortParam === "order" ? Number.MAX_SAFE_INTEGER : "");
937
- if (typeof valueA === "number" && typeof valueB === "number") {
938
- return sortOrder === "asc" ? valueA - valueB : valueB - valueA;
939
- } else {
940
- const stringA = String(valueA);
941
- const stringB = String(valueB);
942
- return sortOrder === "asc" ? stringA.localeCompare(stringB) : stringB.localeCompare(stringA);
943
- }
1794
+ }
1795
+ if (this.crud.core.isEventsEnabled()) {
1796
+ await this.crud.events.emitRead(query, data, context.userId);
1797
+ }
1798
+ const hookResult = await this.crud.core.executeHook("afterRead", data, context);
1799
+ return hookResult || data;
1800
+ } catch (error) {
1801
+ console.log(error);
1802
+ await this.crud.events.logError("read", error);
1803
+ throw error;
1804
+ }
1805
+ }
1806
+ // UPDATE операция
1807
+ async update(id, updateData, context = {}) {
1808
+ try {
1809
+ const current = await this.crud.model.findById(id);
1810
+ if (!current) {
1811
+ const error = new Error("NOT_FOUND");
1812
+ error.code = "NOT_FOUND";
1813
+ error.statusCode = 404;
1814
+ throw error;
1815
+ }
1816
+ const hookData = await this.crud.core.executeHook("beforeUpdate", updateData, context, current);
1817
+ const finalData = hookData || updateData;
1818
+ const updated = await this.crud.model.findByIdAndUpdate(
1819
+ id,
1820
+ finalData,
1821
+ { new: true, runValidators: true }
1822
+ );
1823
+ if (this.crud.core.isCacheEnabled()) {
1824
+ await this.invalidateCache("update", updated);
1825
+ }
1826
+ if (this.crud.core.isEventsEnabled()) {
1827
+ await this.crud.events.emit("updated", {
1828
+ document: updated,
1829
+ previousDocument: current,
1830
+ user: context.userId
944
1831
  });
945
- nodes.forEach((node) => {
946
- if (node.children && node.children.length > 0) {
947
- sortCategories(node.children);
948
- }
1832
+ }
1833
+ await this.crud.core.executeHook("afterUpdate", updated, context, current);
1834
+ return updated;
1835
+ } catch (error) {
1836
+ await this.crud.events.logError("update", error);
1837
+ throw error;
1838
+ }
1839
+ }
1840
+ // DELETE операция
1841
+ async delete(id, context = {}) {
1842
+ try {
1843
+ const document = await this.crud.model.findById(id);
1844
+ if (!document) {
1845
+ const error = new Error("NOT_FOUND");
1846
+ error.code = "NOT_FOUND";
1847
+ error.statusCode = 404;
1848
+ throw error;
1849
+ }
1850
+ await this.crud.core.executeHook("beforeDelete", document, context);
1851
+ await this.crud.model.findByIdAndDelete(id);
1852
+ if (this.crud.core.isCacheEnabled()) {
1853
+ await this.invalidateCache("delete", document);
1854
+ }
1855
+ if (this.crud.core.isEventsEnabled()) {
1856
+ await this.crud.events.emit("deleted", {
1857
+ document,
1858
+ user: context.userId
949
1859
  });
950
- return nodes;
951
1860
  }
952
- return sortCategories(rootCategories);
1861
+ await this.crud.core.executeHook("afterDelete", document, context);
1862
+ return document;
1863
+ } catch (error) {
1864
+ await this.crud.events.logError("delete", error);
1865
+ throw error;
953
1866
  }
954
- };
955
- categories_controller = controllerFactory;
956
- return categories_controller;
957
- }
958
- var categories_verifier;
959
- var hasRequiredCategories_verifier;
960
- function requireCategories_verifier() {
961
- if (hasRequiredCategories_verifier) return categories_verifier;
962
- hasRequiredCategories_verifier = 1;
963
- const Verifier = globals_verifier.requireGlobals_verifier();
964
- const Validator = globals_verifier.requireGlobals_validator();
965
- categories_verifier = function(db) {
966
- const queryValidatorConfig = {
967
- parent: { allowed: true, validator: Validator.schema().string() },
968
- url: { allowed: true, validator: Validator.schema().string() },
969
- search: { allowed: true, validator: Validator.schema().string() },
970
- sortParam: { allowed: true, validator: Validator.schema().string().oneOf(["order", "name", "createdAt", "updatedAt"]), default: "order" },
971
- sortOrder: { allowed: true, validator: Validator.schema().string().oneOf(["asc", "desc"]), default: "asc" },
972
- skip: { allowed: true, validator: Validator.schema().number().integer().min(0), default: 0 },
973
- limit: { allowed: true, validator: Validator.schema().number().integer().min(1).max(100), default: 10 },
974
- excludeChildren: { allowed: true, validator: Validator.schema().string().oneOf(["true", "false"]), default: "true" },
975
- rootOnly: { allowed: true, validator: Validator.schema().string().oneOf(["true", "false"]), default: "false" },
976
- status: { allowed: true, validator: Validator.schema().string().oneOf(["draft", "internal", "published", "removed"]) },
977
- type: { allowed: true, validator: Validator.schema().string().oneOf(["platform", "organization", "all"]), default: "all" },
978
- organizationId: { allowed: true, validator: Validator.schema().string() }
979
- };
980
- const bodyValidatorConfig = {
981
- _id: { allowed: true, validator: Validator.schema().string() },
982
- name: { allowed: true, validator: Validator.schema().string().required() },
983
- description: { allowed: true, validator: Validator.schema().string() },
984
- photo: { allowed: true, validator: Validator.schema().string() },
985
- status: { allowed: true, validator: Validator.schema().string().oneOf(["draft", "internal", "published", "removed"]), default: "draft" },
986
- url: { allowed: true, validator: Validator.schema().string().required() },
987
- parent: { allowed: true, validator: Validator.schema().oneOfTypes(["string", "null"]) },
988
- localization: { allowed: true },
989
- filters: { allowed: true },
990
- owner: { allowed: true, validator: Validator.schema().object({
991
- type: Validator.schema().string().oneOf(["platform", "organization"]).required(),
992
- target: Validator.schema().string()
993
- }) },
994
- creator: { allowed: true, validator: Validator.schema().object({
995
- type: Validator.schema().string().oneOf(["user", "organization"]).required(),
996
- target: Validator.schema().string()
997
- }) },
998
- children: { allowed: true, validator: Validator.schema().array() },
999
- order: { allowed: true, validator: Validator.schema().number() }
1000
- };
1001
- const orderBodyValidatorConfig = {
1002
- categories: {
1003
- allowed: true,
1004
- validator: Validator.schema().array().required(),
1005
- default: []
1867
+ }
1868
+ // Получение кастомного handler
1869
+ getCustomHandler(name) {
1870
+ return this.customHandlers.get(name);
1871
+ }
1872
+ // Построение aggregation pipeline
1873
+ async buildAggregationPipeline(query, context) {
1874
+ const stages = [];
1875
+ const extensions = this.crud.core.getAggregateExtensions();
1876
+ if (extensions.before) {
1877
+ stages.push(...await extensions.before(query, context));
1878
+ }
1879
+ stages.push(...queryProcessorGlobals.getBasicOptions(query));
1880
+ if (extensions.middle) {
1881
+ stages.push(...await extensions.middle(query, context));
1882
+ }
1883
+ stages.push(
1884
+ queryProcessorGlobals.getCreatorUserLookupStage(),
1885
+ queryProcessorGlobals.getCreatorOrganizationLookupStage(),
1886
+ queryProcessorGlobals.getOwnerUserLookupStage(),
1887
+ queryProcessorGlobals.getOwnerOrganizationLookupStage(),
1888
+ queryProcessorGlobals.getAddFieldsCreatorOwnerStage()
1889
+ );
1890
+ if (extensions.beforePagination) {
1891
+ stages.push(...await extensions.beforePagination(query, context));
1892
+ }
1893
+ stages.push(
1894
+ ...queryProcessorGlobals.getSortingOptions(query.sortParam, query.sortOrder),
1895
+ ...queryProcessorGlobals.getPaginationOptions(query.skip, query.limit),
1896
+ queryProcessorGlobals.removeTempPropeties()
1897
+ );
1898
+ if (extensions.after) {
1899
+ stages.push(...await extensions.after(query, context));
1900
+ }
1901
+ return stages;
1902
+ }
1903
+ // Управление кешем
1904
+ generateCacheKey(operation, data) {
1905
+ const prefix = `${this.crud.modelName}:${operation}`;
1906
+ if (operation === "read") {
1907
+ return `${prefix}:${JSON.stringify(this._normalizeQuery(data))}`;
1908
+ }
1909
+ return `${prefix}:${Date.now()}`;
1910
+ }
1911
+ _normalizeQuery(query) {
1912
+ const normalized = {};
1913
+ const keys = Object.keys(query).sort();
1914
+ for (const key of keys) {
1915
+ if (query[key] !== void 0 && query[key] !== null && query[key] !== "") {
1916
+ normalized[key] = query[key];
1006
1917
  }
1007
- };
1008
- const deleteBodyValidatorConfig = {
1009
- url: {
1010
- allowed: true,
1011
- validator: Validator.schema().string().required()
1918
+ }
1919
+ return normalized;
1920
+ }
1921
+ async invalidateCache(operation, document) {
1922
+ const cacheOptions = this.crud.core.getCacheOptions();
1923
+ const tags = [...cacheOptions.tags];
1924
+ if (["create", "update", "delete"].includes(operation)) {
1925
+ tags.push(`${this.crud.modelName}_list`);
1926
+ if (document && document._id) {
1927
+ tags.push(`${this.crud.modelName}_${document._id}`);
1012
1928
  }
1929
+ }
1930
+ for (const tag of tags) {
1931
+ await this.crud.cache.delByTags([tag]);
1932
+ }
1933
+ }
1934
+ }
1935
+ class CRUDPolicies {
1936
+ constructor(crud) {
1937
+ this.crud = crud;
1938
+ this.abac = null;
1939
+ this.policyOptions = {};
1940
+ this.defaultPolicies = {};
1941
+ }
1942
+ // Инициализация с ABAC
1943
+ init(abac, policies = {}, fieldPolicies = null) {
1944
+ this.abac = abac;
1945
+ this.defaultPolicies = policies;
1946
+ }
1947
+ // Установка опций для конкретного действия
1948
+ setOptions(action, options) {
1949
+ this.policyOptions[action] = {
1950
+ enabled: options.enabled !== false,
1951
+ policies: options.policies || [],
1952
+ customPolicies: options.customPolicies || {},
1953
+ skipDefaultPolicies: options.skipDefaultPolicies || false,
1954
+ ...options
1013
1955
  };
1014
- const queryVerifier = new Verifier(queryValidatorConfig);
1015
- const bodyVerifier = new Verifier(bodyValidatorConfig);
1016
- const orderBodyVerifier = new Verifier(orderBodyValidatorConfig);
1017
- const deleteBodyVerifier = new Verifier(deleteBodyValidatorConfig);
1018
- return {
1019
- // Верификация параметров запроса
1020
- verifyQuery(req, res, next) {
1021
- const verification = queryVerifier.verify(req.query);
1022
- if (!verification.isValid) {
1023
- return res.status(400).json({
1024
- errors: verification.verificationErrors,
1025
- message: "Invalid query parameters"
1026
- });
1956
+ }
1957
+ // Получение опций для действия
1958
+ getOptions(action) {
1959
+ return this.policyOptions[action] || this.defaultPolicies[action] || {};
1960
+ }
1961
+ // Получение ABAC middleware для действия
1962
+ getPoliciesMiddleware(action) {
1963
+ if (!this.abac) return null;
1964
+ const options = this.getOptions(action);
1965
+ if (options.enabled === false) {
1966
+ return null;
1967
+ }
1968
+ if (options.policies && options.policies.length > 0) {
1969
+ return this.abac.policyMiddleware(
1970
+ options.policies,
1971
+ options.customPolicies || {},
1972
+ {
1973
+ resource: this.crud.modelName,
1974
+ action,
1975
+ skipDefaultPolicies: options.skipDefaultPolicies
1027
1976
  }
1028
- req.verifiedQuery = verification.verifiedData;
1029
- next();
1030
- },
1031
- // Верификация тела запроса для создания/обновления категории
1032
- verifyBody(req, res, next) {
1033
- const verification = bodyVerifier.verify(req.body);
1034
- if (!verification.isValid) {
1035
- return res.status(400).json({
1036
- errors: verification.verificationErrors,
1037
- message: "Invalid request data"
1038
- });
1977
+ );
1978
+ }
1979
+ return this.abac.middleware(this.crud.modelName, action, options);
1980
+ }
1981
+ // Получение middleware для проверки доступа к полям
1982
+ getFieldsMiddleware(action) {
1983
+ if (!this.abac) return null;
1984
+ return async (req, res, next) => {
1985
+ try {
1986
+ const data = req.verified || req.body;
1987
+ const context = {
1988
+ user: req.userId,
1989
+ resource: this.crud.modelName,
1990
+ action,
1991
+ req,
1992
+ data: {
1993
+ ...req.body,
1994
+ ...req.query,
1995
+ params: req.params
1996
+ },
1997
+ params: req.params
1998
+ };
1999
+ if (req.skipFieldPolicies) {
2000
+ console.log("Skipping field policies for admin/moderator");
2001
+ req.verified = data;
2002
+ return next();
1039
2003
  }
1040
- req.verifiedBody = verification.verifiedData;
1041
- next();
1042
- },
1043
- // Верификация тела запроса для обновления порядка категорий
1044
- verifyOrderBody(req, res, next) {
1045
- const verification = orderBodyVerifier.verify(req.body);
1046
- if (!verification.isValid) {
1047
- return res.status(400).json({
1048
- errors: verification.verificationErrors,
1049
- message: "Invalid request data"
2004
+ if (action === "update" && data._id) {
2005
+ try {
2006
+ const current = await this.crud.model.findById(data._id);
2007
+ if (current) {
2008
+ context.currentResource = current;
2009
+ }
2010
+ } catch (err) {
2011
+ }
2012
+ }
2013
+ const fieldsResult = await this.abac.checkFields(
2014
+ context,
2015
+ data,
2016
+ action
2017
+ );
2018
+ if (fieldsResult.denied && fieldsResult.denied.length > 0) {
2019
+ return res.status(403).json({
2020
+ error: "FIELD_ACCESS_DENIED",
2021
+ deniedFields: fieldsResult.denied.map((d) => d.path)
1050
2022
  });
1051
2023
  }
1052
- req.verifiedBody = verification.verifiedData;
1053
- next();
1054
- },
1055
- // Верификация тела запроса для удаления категории
1056
- verifyDeleteBody(req, res, next) {
1057
- const verification = deleteBodyVerifier.verify(req.body);
1058
- if (!verification.isValid) {
2024
+ if (fieldsResult.errors && fieldsResult.errors.length > 0) {
1059
2025
  return res.status(400).json({
1060
- errors: verification.verificationErrors,
1061
- message: "Invalid request data"
2026
+ error: "FIELD_VALIDATION_ERROR",
2027
+ fields: fieldsResult.errors
1062
2028
  });
1063
2029
  }
1064
- req.verifiedBody = verification.verifiedData;
2030
+ req.verified = fieldsResult.transformed || fieldsResult.allowed;
1065
2031
  next();
1066
- },
1067
- // Проверка на существование категории с тем же URL (для создания)
1068
- async checkCategoryExistOrNot(req, res, next) {
1069
- try {
1070
- if (!req.verifiedBody.url) {
1071
- return res.status(400).json({ message: "URL is required" });
1072
- }
1073
- const existingCategory = await db.category.findOne({ url: req.verifiedBody.url });
1074
- if (existingCategory) {
1075
- return res.status(409).json({
1076
- message: "Category with this URL already exists",
1077
- category: existingCategory
1078
- });
1079
- }
1080
- next();
1081
- } catch (error) {
1082
- res.status(500).json({ message: error.message });
1083
- }
1084
- },
1085
- // Загрузка категории для проверки ABAC (для обновления и удаления)
1086
- async loadCategoryForUpdate(req, res, next) {
1087
- try {
1088
- const categoryId = req.verifiedBody._id;
1089
- if (!categoryId) {
1090
- return res.status(400).json({ message: "Category ID is required" });
1091
- }
1092
- const category = await db.category.findById(categoryId).lean();
1093
- if (!category) {
1094
- return res.status(404).json({ message: "Category not found" });
1095
- }
1096
- req.currentResource = category;
1097
- next();
1098
- } catch (error) {
1099
- res.status(500).json({ message: error.message });
1100
- }
1101
- },
1102
- // Загрузка категории по URL для удаления
1103
- async loadCategoryForDelete(req, res, next) {
1104
- try {
1105
- const url = req.verifiedBody.url;
1106
- if (!url) {
1107
- return res.status(400).json({ message: "Category URL is required" });
1108
- }
1109
- const category = await db.category.findOne({ url }).lean();
1110
- if (!category) {
1111
- return res.status(404).json({ message: "Category not found" });
1112
- }
1113
- req.currentResource = category;
1114
- next();
1115
- } catch (error) {
1116
- res.status(500).json({ message: error.message });
1117
- }
2032
+ } catch (error) {
2033
+ next(error);
1118
2034
  }
1119
2035
  };
1120
- };
1121
- return categories_verifier;
1122
- }
1123
- var hasRequiredCategories_routes;
1124
- function requireCategories_routes() {
1125
- if (hasRequiredCategories_routes) return categories_routes.exports;
1126
- hasRequiredCategories_routes = 1;
1127
- const controllerFactory = requireCategories_controller();
1128
- const verifierFactory = requireCategories_verifier();
1129
- const jwtFactory = authJwt.requireAuthJwt();
1130
- const { getInstance } = globals_abac.requireGlobals_abac();
1131
- categories_routes.exports = function(app, db) {
1132
- const jwt = jwtFactory(db);
1133
- const verifier = verifierFactory(db);
1134
- const abac = getInstance(db);
1135
- const controller = controllerFactory(db);
1136
- app.get(
1137
- "/api/categories",
1138
- jwt.verifyToken(true),
1139
- verifier.verifyQuery,
1140
- controller.read
1141
- );
1142
- app.post(
1143
- "/api/categories/create",
1144
- jwt.verifyToken(),
1145
- verifier.verifyBody,
1146
- verifier.checkCategoryExistOrNot,
1147
- abac.middleware("category", "create"),
1148
- controller.create
1149
- );
1150
- app.post(
1151
- "/api/categories/update",
1152
- jwt.verifyToken(),
1153
- verifier.verifyBody,
1154
- verifier.loadCategoryForUpdate,
1155
- abac.middleware("category", "edit"),
1156
- controller.update
1157
- );
1158
- app.post(
1159
- "/api/categories/updateOrder",
1160
- jwt.verifyToken(),
1161
- verifier.verifyOrderBody,
1162
- abac.middleware("category", "edit"),
1163
- controller.updateOrder
1164
- );
1165
- app.post(
1166
- "/api/categories/delete",
1167
- jwt.verifyToken(),
1168
- verifier.verifyDeleteBody,
1169
- verifier.loadCategoryForDelete,
1170
- abac.middleware("category", "delete"),
1171
- controller.delete
1172
- );
1173
- };
1174
- categories_routes.exports.controllerFactory = controllerFactory;
1175
- return categories_routes.exports;
1176
- }
1177
- var leftovers_controller;
1178
- var hasRequiredLeftovers_controller;
1179
- function requireLeftovers_controller() {
1180
- if (hasRequiredLeftovers_controller) return leftovers_controller;
1181
- hasRequiredLeftovers_controller = 1;
1182
- const queryProcessorGlobals = queryProcessor.requireQueryProcessor();
1183
- const controllerFactory = (db) => {
1184
- const Leftover = db.leftover;
1185
- const read = async (req, res) => {
1186
- try {
1187
- let matchConditions = [];
1188
- const search = req.query.search;
1189
- if (search) {
1190
- const parts = search.split(".");
1191
- let regexPattern = "";
1192
- if (parts.length === 2) {
1193
- regexPattern = parts.map((part) => part.substr(0, part.length - 1) + ".{1}").join("\\.");
1194
- } else {
1195
- regexPattern = search.substr(0, search.length - 1) + ".{1}";
1196
- }
1197
- matchConditions.push({
1198
- $or: [
1199
- { "comment": { $regex: regexPattern, $options: "i" } },
1200
- { "positions.name": { $regex: regexPattern, $options: "i" } }
1201
- ]
1202
- });
1203
- }
1204
- const matchStage = matchConditions.length > 0 ? { $match: { $and: matchConditions } } : null;
1205
- let stages = [
1206
- ...queryProcessorGlobals.getBasicOptions(
1207
- req.query
1208
- ),
1209
- // For creator
1210
- queryProcessorGlobals.getCreatorUserLookupStage(),
1211
- queryProcessorGlobals.getCreatorOrganizationLookupStage(),
1212
- // For owner
1213
- queryProcessorGlobals.getOwnerUserLookupStage(),
1214
- queryProcessorGlobals.getOwnerOrganizationLookupStage(),
1215
- queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
1216
- ...matchStage != null ? [matchStage] : [],
1217
- // Pagination
1218
- ...queryProcessorGlobals.getSortingOptions(
1219
- req.query.sortParam,
1220
- req.query.sortOrder
1221
- ),
1222
- ...queryProcessorGlobals.getPaginationOptions(
1223
- req.query.skip,
1224
- req.query.limit
1225
- )
1226
- ];
1227
- const leftoveres = await Leftover.aggregate(stages).exec();
1228
- if (!leftoveres) {
1229
- return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
1230
- }
1231
- res.status(200).send(leftoveres);
1232
- } catch (err) {
1233
- console.error(err);
1234
- res.status(500).send({ message: "ERROR_GET_ALL_LEFTOVERES" });
1235
- }
2036
+ }
2037
+ // Фильтрация полей для чтения (вызывается из controller после получения данных)
2038
+ async filterFieldsForRead(req, data) {
2039
+ if (!this.abac) {
2040
+ return data;
2041
+ }
2042
+ const context = {
2043
+ user: req.userId,
2044
+ resource: this.crud.modelName,
2045
+ action: "read",
2046
+ req,
2047
+ data: {
2048
+ ...req.query,
2049
+ params: req.params
2050
+ },
2051
+ params: req.params
1236
2052
  };
1237
- const create = async (req, res) => {
1238
- try {
1239
- console.log("order is", req.body.order);
1240
- const leftover = await Leftover.create({
1241
- organization: req.body.organization,
1242
- type: req.body.type,
1243
- order: req.body.order,
1244
- comment: req.body.comment,
1245
- positions: req.body.positions,
1246
- creator: req.body.creator,
1247
- owner: req.body.owner
1248
- });
1249
- if (!leftover) {
1250
- return res.status(404).send({ message: "ERROR_CREATING_LEFTOVER" });
1251
- }
1252
- res.status(200).send(leftover);
1253
- } catch (err) {
1254
- console.log(err);
1255
- res.status(500).send({ message: "ERROR_CREATE_LEFTOVER" });
2053
+ if (Array.isArray(data)) {
2054
+ const results = [];
2055
+ for (const doc of data) {
2056
+ const fieldsResult2 = await this.abac.checkFields(
2057
+ { ...context, currentResource: doc },
2058
+ doc,
2059
+ "read"
2060
+ );
2061
+ results.push(fieldsResult2.transformed || fieldsResult2.allowed);
1256
2062
  }
2063
+ return results;
2064
+ }
2065
+ const fieldsResult = await this.abac.checkFields(
2066
+ { ...context, currentResource: data },
2067
+ data,
2068
+ "read"
2069
+ );
2070
+ return fieldsResult.transformed || fieldsResult.allowed;
2071
+ }
2072
+ // Добавление кастомной политики
2073
+ addPolicy(action, policyName, policyFn = null) {
2074
+ if (!this.policyOptions[action]) {
2075
+ this.policyOptions[action] = {
2076
+ enabled: true,
2077
+ policies: [],
2078
+ customPolicies: {}
2079
+ };
2080
+ }
2081
+ if (policyFn) {
2082
+ this.policyOptions[action].customPolicies[policyName] = policyFn;
2083
+ }
2084
+ if (!this.policyOptions[action].policies.includes(policyName)) {
2085
+ this.policyOptions[action].policies.push(policyName);
2086
+ }
2087
+ }
2088
+ // Удаление политики
2089
+ removePolicy(action, policyName) {
2090
+ if (!this.policyOptions[action]) return;
2091
+ const policies = this.policyOptions[action].policies;
2092
+ const index = policies.indexOf(policyName);
2093
+ if (index > -1) {
2094
+ policies.splice(index, 1);
2095
+ }
2096
+ delete this.policyOptions[action].customPolicies[policyName];
2097
+ }
2098
+ // Проверка наличия ABAC
2099
+ hasAbac() {
2100
+ return !!this.abac;
2101
+ }
2102
+ // Получение всех политик для действия
2103
+ getPolicies(action) {
2104
+ const options = this.getOptions(action);
2105
+ return {
2106
+ enabled: options.enabled !== false,
2107
+ policies: options.policies || [],
2108
+ customPolicies: options.customPolicies || {},
2109
+ defaultPolicies: this.defaultPolicies[action] || {}
1257
2110
  };
1258
- const get = async (req, res) => {
1259
- try {
1260
- const leftover = await Leftover.findOne({ _id: req.params._id }).exec();
1261
- if (!leftover) {
1262
- return res.status(404).send({ message: "LEFTOVER_NOT_FOUND" });
1263
- }
1264
- res.status(200).send(leftover);
1265
- } catch (err) {
1266
- res.status(500).send({ message: "ERROR_GET_LEFTOVER" });
2111
+ }
2112
+ // Временное отключение ABAC для действия
2113
+ disableForAction(action) {
2114
+ if (!this.policyOptions[action]) {
2115
+ this.policyOptions[action] = {};
2116
+ }
2117
+ this.policyOptions[action].enabled = false;
2118
+ }
2119
+ // Включение ABAC для действия
2120
+ enableForAction(action) {
2121
+ if (!this.policyOptions[action]) {
2122
+ this.policyOptions[action] = {};
2123
+ }
2124
+ this.policyOptions[action].enabled = true;
2125
+ }
2126
+ // Установка политик по умолчанию для всех действий
2127
+ setDefaultPolicies(policies) {
2128
+ ["create", "read", "update", "delete"].forEach((action) => {
2129
+ if (!this.policyOptions[action]) {
2130
+ this.policyOptions[action] = {};
1267
2131
  }
1268
- };
1269
- const update = async (req, res) => {
1270
- try {
1271
- const leftover = await Leftover.findOneAndUpdate({ _id: req.params._id }, req.body, { new: true, upsert: true }).exec();
1272
- if (!leftover) {
1273
- return res.status(404).send({ message: "LEFTOVER_NOT_FOUND" });
1274
- }
1275
- res.status(200).send(leftover);
1276
- } catch (err) {
1277
- console.log(err);
1278
- res.status(500).send({ message: "ERROR_UPDATING_LEFTOVER" });
2132
+ this.policyOptions[action].policies = [...policies];
2133
+ });
2134
+ }
2135
+ }
2136
+ class CRUDEvents {
2137
+ constructor(crud) {
2138
+ this.crud = crud;
2139
+ this.observer = null;
2140
+ this.logger = null;
2141
+ this.enabled = false;
2142
+ this.options = {};
2143
+ }
2144
+ init(options = {}) {
2145
+ this.enabled = options.enabled !== false;
2146
+ this.options = options;
2147
+ if (this.enabled) {
2148
+ this.observer = options.observer || new Observer();
2149
+ this.logger = options.logger || new Logger(this.crud.db);
2150
+ }
2151
+ }
2152
+ // Отправка события
2153
+ async emit(eventName, data) {
2154
+ if (!this.enabled || !this.observer) return;
2155
+ const fullEventName = `${this.crud.modelName}:${eventName}`;
2156
+ try {
2157
+ await this.observer.notify(fullEventName, {
2158
+ ...data,
2159
+ timestamp: /* @__PURE__ */ new Date(),
2160
+ model: this.crud.modelName
2161
+ });
2162
+ await this.log("info", `Event emitted: ${fullEventName}`, data);
2163
+ } catch (error) {
2164
+ console.error(`Error emitting event ${fullEventName}:`, error);
2165
+ }
2166
+ }
2167
+ // Подписка на событие
2168
+ subscribe(eventName, handler) {
2169
+ if (!this.observer) return null;
2170
+ const fullEventName = `${this.crud.modelName}:${eventName}`;
2171
+ return this.observer.subscribe(fullEventName, handler);
2172
+ }
2173
+ // Отписка от события
2174
+ unsubscribe(eventName, handler) {
2175
+ if (!this.observer) return;
2176
+ const fullEventName = `${this.crud.modelName}:${eventName}`;
2177
+ this.observer.unsubscribe(fullEventName, handler);
2178
+ }
2179
+ // Логирование
2180
+ async log(level, message, data = {}) {
2181
+ if (!this.enabled || !this.logger) return;
2182
+ try {
2183
+ const logData = {
2184
+ model: this.crud.modelName,
2185
+ ...data
2186
+ };
2187
+ switch (level) {
2188
+ case "info":
2189
+ await this.logger.info(message, logData);
2190
+ break;
2191
+ case "warning":
2192
+ await this.logger.warning(message, logData);
2193
+ break;
2194
+ case "error":
2195
+ await this.logger.error(message, logData);
2196
+ break;
2197
+ default:
2198
+ await this.logger.info(message, logData);
1279
2199
  }
1280
- };
1281
- const deleteLeftover = async (req, res) => {
1282
- try {
1283
- const leftover = await Leftover.findOneAndDelete({ _id: req.params._id });
1284
- if (!leftover) {
1285
- return res.status(404).send({ message: "ERROR_DELETING_LEFTOVER" });
2200
+ } catch (error) {
2201
+ console.error("Logging error:", error);
2202
+ }
2203
+ }
2204
+ // Логирование ошибок
2205
+ async logError(operation, error) {
2206
+ await this.log("error", `Error in ${operation} operation`, {
2207
+ operation,
2208
+ error: error.message,
2209
+ stack: error.stack
2210
+ });
2211
+ }
2212
+ // Специализированные методы событий
2213
+ async emitCreate(document, userId) {
2214
+ await this.emit("created", {
2215
+ document,
2216
+ user: userId,
2217
+ action: "create"
2218
+ });
2219
+ }
2220
+ async emitUpdate(document, previousDocument, userId) {
2221
+ await this.emit("updated", {
2222
+ document,
2223
+ previousDocument,
2224
+ user: userId,
2225
+ action: "update",
2226
+ changes: this._getChanges(previousDocument, document)
2227
+ });
2228
+ }
2229
+ async emitDelete(document, userId) {
2230
+ await this.emit("deleted", {
2231
+ document,
2232
+ user: userId,
2233
+ action: "delete"
2234
+ });
2235
+ }
2236
+ async emitRead(query, results, userId) {
2237
+ if (this.options.logReads !== false) {
2238
+ await this.emit("read", {
2239
+ query,
2240
+ resultCount: Array.isArray(results) ? results.length : 1,
2241
+ user: userId,
2242
+ action: "read"
2243
+ });
2244
+ }
2245
+ }
2246
+ // Вспомогательные методы
2247
+ _getChanges(oldDoc, newDoc) {
2248
+ const changes = {};
2249
+ if (!oldDoc || !newDoc) return changes;
2250
+ for (const key in newDoc) {
2251
+ if (newDoc.hasOwnProperty(key)) {
2252
+ const oldVal = oldDoc[key];
2253
+ const newVal = newDoc[key];
2254
+ if (["_id", "__v", "updatedAt"].includes(key)) continue;
2255
+ if (JSON.stringify(oldVal) !== JSON.stringify(newVal)) {
2256
+ changes[key] = {
2257
+ old: oldVal,
2258
+ new: newVal
2259
+ };
1286
2260
  }
1287
- res.status(200).send(leftover);
1288
- } catch (err) {
1289
- res.status(500).send({ message: "ERROR_DELETE_LEFTOVER" });
1290
2261
  }
2262
+ }
2263
+ return changes;
2264
+ }
2265
+ // Аудит действий
2266
+ async audit(action, data) {
2267
+ if (!this.options.enableAudit) return;
2268
+ const auditData = {
2269
+ action,
2270
+ model: this.crud.modelName,
2271
+ timestamp: /* @__PURE__ */ new Date(),
2272
+ ...data
1291
2273
  };
1292
- return {
1293
- read,
1294
- create,
1295
- get,
1296
- update,
1297
- delete: deleteLeftover
1298
- };
1299
- };
1300
- leftovers_controller = controllerFactory;
1301
- return leftovers_controller;
2274
+ await this.emit("audit", auditData);
2275
+ await this.log("info", `Audit: ${action}`, auditData);
2276
+ }
2277
+ // Метрики
2278
+ async recordMetric(metric, value = 1) {
2279
+ if (!this.options.enableMetrics) return;
2280
+ await this.emit("metric", {
2281
+ metric,
2282
+ value,
2283
+ model: this.crud.modelName,
2284
+ timestamp: /* @__PURE__ */ new Date()
2285
+ });
2286
+ }
2287
+ // Проверка включены ли события
2288
+ isEnabled() {
2289
+ return this.enabled;
2290
+ }
2291
+ // Временное отключение событий
2292
+ disable() {
2293
+ this.enabled = false;
2294
+ }
2295
+ // Включение событий
2296
+ enable() {
2297
+ if (this.observer && this.logger) {
2298
+ this.enabled = true;
2299
+ }
2300
+ }
1302
2301
  }
1303
- var leftovers_routes;
1304
- var hasRequiredLeftovers_routes;
1305
- function requireLeftovers_routes() {
1306
- if (hasRequiredLeftovers_routes) return leftovers_routes;
1307
- hasRequiredLeftovers_routes = 1;
1308
- const controllerFactory = requireLeftovers_controller();
1309
- leftovers_routes = function(app, db) {
1310
- const controller = controllerFactory(db);
1311
- app.get(
1312
- "/leftovers",
1313
- controller.read
1314
- );
1315
- app.get(
1316
- "/leftovers/:_id",
1317
- controller.get
1318
- );
1319
- app.post(
1320
- "/leftovers/:_id",
1321
- controller.update
1322
- );
1323
- app.post(
1324
- "/leftovers",
1325
- controller.create
1326
- );
1327
- app.delete(
1328
- "/leftovers/:_id",
1329
- controller.delete
1330
- );
1331
- };
1332
- return leftovers_routes;
2302
+ class CRUD {
2303
+ constructor(options = {}) {
2304
+ const {
2305
+ app,
2306
+ db,
2307
+ model,
2308
+ basePath,
2309
+ modelName = model?.modelName || "resource",
2310
+ cache,
2311
+ logger,
2312
+ ...otherOptions
2313
+ } = options;
2314
+ this.app = app;
2315
+ this.db = db;
2316
+ this.model = model;
2317
+ this.basePath = basePath;
2318
+ this.modelName = modelName;
2319
+ this.cache = cache !== false ? cache instanceof Cache ? cache : new Cache() : null;
2320
+ this.logger = logger || new Logger(db);
2321
+ this.initModules(otherOptions);
2322
+ this.core.init(otherOptions);
2323
+ if (!otherOptions.disableDefaultRoutes) {
2324
+ this.registerDefaultRoutes();
2325
+ }
2326
+ }
2327
+ initModules(options) {
2328
+ this.core = new CRUDCore(this);
2329
+ this.service = new CRUDService(this);
2330
+ this.controller = new CRUDController(this);
2331
+ this.policies = new CRUDPolicies(this);
2332
+ this.events = new CRUDEvents(this);
2333
+ }
2334
+ // Регистрация дефолтных CRUD роутов
2335
+ registerDefaultRoutes() {
2336
+ this.controller.registerRoute("post", "/create", "create");
2337
+ this.controller.registerRoute("get", "/read", "read");
2338
+ this.controller.registerRoute("put", "/update", "update");
2339
+ this.controller.registerRoute("delete", "/delete", "delete");
2340
+ }
2341
+ // API методы для конфигурации
2342
+ setVerifier(action, verifier) {
2343
+ this.core.setVerifier(action, verifier);
2344
+ return this;
2345
+ }
2346
+ addHook(name, handler) {
2347
+ this.core.addHook(name, handler);
2348
+ return this;
2349
+ }
2350
+ addMiddleware(phase, action, middleware) {
2351
+ this.controller.addMiddleware(phase, action, middleware);
2352
+ return this;
2353
+ }
2354
+ addAbac(action, options = {}) {
2355
+ this.policies.setOptions(action, options);
2356
+ return this;
2357
+ }
2358
+ addAggregateExtension(phase, extension) {
2359
+ this.core.addAggregateExtension(phase, extension);
2360
+ return this;
2361
+ }
2362
+ // Управление авторизацией
2363
+ setAuth(action, required) {
2364
+ this.core.setAuth(action, required);
2365
+ return this;
2366
+ }
2367
+ // Добавление кастомного действия
2368
+ addAction(name, config) {
2369
+ const {
2370
+ method = "post",
2371
+ path = `/${name}`,
2372
+ handler,
2373
+ verifier,
2374
+ middlewares = { before: [], after: [] },
2375
+ abac = {},
2376
+ hooks = {},
2377
+ auth = true
2378
+ // По умолчанию требует авторизацию
2379
+ } = config;
2380
+ if (verifier) this.setVerifier(name, verifier);
2381
+ if (abac) this.addAbac(name, abac);
2382
+ if (auth !== void 0) this.setAuth(name, auth);
2383
+ if (middlewares.before) {
2384
+ const beforeMiddlewares = Array.isArray(middlewares.before) ? middlewares.before : [middlewares.before];
2385
+ beforeMiddlewares.forEach((mw) => this.addMiddleware("before", name, mw));
2386
+ }
2387
+ if (middlewares.after) {
2388
+ const afterMiddlewares = Array.isArray(middlewares.after) ? middlewares.after : [middlewares.after];
2389
+ afterMiddlewares.forEach((mw) => this.addMiddleware("after", name, mw));
2390
+ }
2391
+ Object.entries(hooks).forEach(([hookName, hookFn]) => {
2392
+ this.addHook(hookName, hookFn);
2393
+ });
2394
+ if (handler) {
2395
+ this.controller.registerCustomRoute(method, path, name, handler);
2396
+ } else {
2397
+ this.controller.registerRoute(method, path, name);
2398
+ }
2399
+ return this;
2400
+ }
2401
+ // Получение конфигурации кеша
2402
+ getCacheOptions() {
2403
+ return this.core.getCacheOptions();
2404
+ }
2405
+ // Установка опций кеша
2406
+ setCacheOptions(options) {
2407
+ this.core.setCacheOptions(options);
2408
+ return this;
2409
+ }
1333
2410
  }
1334
- var products_server$1;
1335
- var hasRequiredProducts_server;
1336
- function requireProducts_server() {
1337
- if (hasRequiredProducts_server) return products_server$1;
1338
- hasRequiredProducts_server = 1;
1339
- const ProductModel = requireProduct_model();
1340
- const CategoryModel = requireCategory_model();
1341
- const LeftoverModel = requireLeftover_model();
1342
- const productsRoutes = requireProducts_routes();
1343
- const categoriesRoutes = requireCategories_routes();
1344
- const leftoversRoutes = requireLeftovers_routes();
1345
- const ProductController = requireProducts_controller();
1346
- const CategoryController = requireCategories_controller();
1347
- const LeftoverController = requireLeftovers_controller();
1348
- function initializeProduct(app, db, origins, publicPath) {
1349
- db.product = ProductModel(db);
1350
- db.category = CategoryModel(db);
1351
- db.leftover = LeftoverModel(db);
1352
- if (app) {
1353
- productsRoutes(app, db, origins, publicPath);
1354
- categoriesRoutes(app, db, origins, publicPath);
1355
- leftoversRoutes(app, db, origins, publicPath);
1356
- }
1357
- }
1358
- products_server$1 = {
1359
- initialize: initializeProduct,
1360
- models: {
1361
- ProductModel,
1362
- CategoryModel,
1363
- LeftoverModel
1364
- },
1365
- routes: {
1366
- productsRoutes,
1367
- categoriesRoutes,
1368
- leftoversRoutes
1369
- },
1370
- controllers: {
1371
- ProductController,
1372
- CategoryController,
1373
- LeftoverController
2411
+ const verifierFactory = function(db) {
2412
+ const createVerifier = new Verifier({
2413
+ name: {
2414
+ rule: "required",
2415
+ validator: Validator.schema().string().required("Variant name is required").min(2, "Name must be at least 2 characters").max(100, "Name must not exceed 100 characters")
2416
+ },
2417
+ sku: {
2418
+ rule: "optional",
2419
+ validator: Validator.schema().string().pattern(/^[A-Za-z0-9-_]+$/, "SKU can only contain letters, numbers, hyphens and underscores").max(50)
2420
+ },
2421
+ price: {
2422
+ rule: "required",
2423
+ validator: Validator.schema().number().required("Price is required").min(0, "Price cannot be negative")
2424
+ },
2425
+ cost: {
2426
+ rule: "optional",
2427
+ default: 0,
2428
+ validator: Validator.schema().number().min(0, "Cost cannot be negative")
2429
+ },
2430
+ quantity: {
2431
+ rule: "optional",
2432
+ default: 1,
2433
+ validator: Validator.schema().integer().min(0, "Quantity cannot be negative")
2434
+ },
2435
+ unit: {
2436
+ rule: "optional",
2437
+ default: "pcs",
2438
+ validator: Validator.schema().string().oneOf(["pcs", "g", "kg", "ml", "l", "oz"], "Invalid unit")
2439
+ },
2440
+ images: {
2441
+ rule: "optional",
2442
+ validator: Validator.schema().array().items(Validator.schema().string())
2443
+ },
2444
+ ingredients: {
2445
+ rule: "optional",
2446
+ validator: Validator.schema().array().items(
2447
+ Validator.schema().object({
2448
+ name: Validator.schema().string().required(),
2449
+ quantity: Validator.schema().number().min(0),
2450
+ unit: Validator.schema().string()
2451
+ })
2452
+ )
2453
+ },
2454
+ attributes: {
2455
+ rule: "optional",
2456
+ validator: Validator.schema().array().items(
2457
+ Validator.schema().object({
2458
+ name: Validator.schema().string().required(),
2459
+ value: Validator.schema().string().required()
2460
+ })
2461
+ )
2462
+ },
2463
+ owner: {
2464
+ rule: "required",
2465
+ validator: Validator.schema().object({
2466
+ type: Validator.schema().string().oneOf(["user", "organization"]),
2467
+ target: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/)
2468
+ })
2469
+ }
2470
+ });
2471
+ const updateVerifier = new Verifier({
2472
+ _id: {
2473
+ rule: "required",
2474
+ validator: Validator.schema().string().required("Variant ID is required").pattern(/^[0-9a-fA-F]{24}$/, "Invalid ID format")
2475
+ },
2476
+ name: {
2477
+ rule: "optional",
2478
+ validator: Validator.schema().string().min(2, "Name must be at least 2 characters").max(100, "Name must not exceed 100 characters")
2479
+ },
2480
+ sku: {
2481
+ rule: "optional",
2482
+ validator: Validator.schema().string().pattern(/^[A-Za-z0-9-_]+$/, "SKU can only contain letters, numbers, hyphens and underscores").max(50)
2483
+ },
2484
+ price: {
2485
+ rule: "optional",
2486
+ validator: Validator.schema().number().min(0, "Price cannot be negative")
2487
+ },
2488
+ cost: {
2489
+ rule: "optional",
2490
+ validator: Validator.schema().number().min(0, "Cost cannot be negative")
2491
+ },
2492
+ quantity: {
2493
+ rule: "optional",
2494
+ validator: Validator.schema().integer().min(0, "Quantity cannot be negative")
2495
+ },
2496
+ unit: {
2497
+ rule: "optional",
2498
+ validator: Validator.schema().string().oneOf(["pcs", "g", "kg", "ml", "l", "oz"], "Invalid unit")
2499
+ },
2500
+ images: {
2501
+ rule: "optional",
2502
+ validator: Validator.schema().array().items(Validator.schema().string())
2503
+ },
2504
+ ingredients: {
2505
+ rule: "optional",
2506
+ validator: Validator.schema().array().items(
2507
+ Validator.schema().object({
2508
+ name: Validator.schema().string().required(),
2509
+ quantity: Validator.schema().number().min(0),
2510
+ unit: Validator.schema().string()
2511
+ })
2512
+ )
2513
+ },
2514
+ attributes: {
2515
+ rule: "optional",
2516
+ validator: Validator.schema().array().items(
2517
+ Validator.schema().object({
2518
+ name: Validator.schema().string().required(),
2519
+ value: Validator.schema().string().required()
2520
+ })
2521
+ )
1374
2522
  }
2523
+ });
2524
+ const readVerifier = new Verifier({
2525
+ _id: {
2526
+ rule: "optional",
2527
+ validator: Validator.schema().string().pattern(/^[0-9a-fA-F]{24}$/)
2528
+ },
2529
+ owner: {
2530
+ rule: "optional",
2531
+ validator: Validator.schema().string()
2532
+ },
2533
+ skip: {
2534
+ rule: "optional",
2535
+ default: 0,
2536
+ validator: Validator.schema().integer().min(0)
2537
+ },
2538
+ limit: {
2539
+ rule: "optional",
2540
+ default: 20,
2541
+ validator: Validator.schema().integer().min(1).max(100)
2542
+ },
2543
+ sortParam: {
2544
+ rule: "optional",
2545
+ validator: Validator.schema().string().oneOf(["name", "price", "quantity", "createdAt", "updatedAt"])
2546
+ },
2547
+ sortOrder: {
2548
+ rule: "optional",
2549
+ default: "desc",
2550
+ validator: Validator.schema().string().oneOf(["asc", "desc"])
2551
+ }
2552
+ });
2553
+ const deleteVerifier = new Verifier({
2554
+ _id: {
2555
+ rule: "required",
2556
+ validator: Validator.schema().string().required("Variant ID is required").pattern(/^[0-9a-fA-F]{24}$/)
2557
+ }
2558
+ });
2559
+ return {
2560
+ createVerifier,
2561
+ readVerifier,
2562
+ updateVerifier,
2563
+ deleteVerifier
1375
2564
  };
1376
- return products_server$1;
2565
+ };
2566
+ const { getInstance } = ABAC;
2567
+ function setupVariantsRoutes(app, db) {
2568
+ const abac = getInstance(db);
2569
+ const verifier = verifierFactory();
2570
+ const variantsCRUD = new CRUD({
2571
+ app,
2572
+ db,
2573
+ model: db.variant,
2574
+ modelName: "variant",
2575
+ basePath: "/api/variants",
2576
+ auth: true,
2577
+ verifiers: {
2578
+ create: verifier.createVerifier,
2579
+ read: verifier.readVerifier,
2580
+ update: verifier.updateVerifier,
2581
+ delete: verifier.deleteVerifier
2582
+ },
2583
+ abac,
2584
+ cache: {
2585
+ enabled: true,
2586
+ ttl: 300,
2587
+ tags: ["variant", "inventory"]
2588
+ },
2589
+ events: {
2590
+ enabled: true,
2591
+ logReads: false
2592
+ }
2593
+ });
2594
+ return variantsCRUD;
2595
+ }
2596
+ function initializeProduct(app, db, origins, publicPath) {
2597
+ db.product = ProductModel(db);
2598
+ db.variant = VariantModel(db);
2599
+ db.category = CategoryModel(db);
2600
+ db.leftover = LeftoverModel(db);
2601
+ if (app) {
2602
+ productsRoutes(app, db);
2603
+ categoriesRoutes(app, db);
2604
+ leftoversRoutes(app, db);
2605
+ setupVariantsRoutes(app, db);
2606
+ }
1377
2607
  }
1378
- var products_serverExports = requireProducts_server();
1379
- const products_server = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(products_serverExports);
1380
- module.exports = products_server;
2608
+ const models = {
2609
+ ProductModel,
2610
+ CategoryModel,
2611
+ LeftoverModel
2612
+ };
2613
+ const routes = {
2614
+ productsRoutes,
2615
+ categoriesRoutes,
2616
+ leftoversRoutes
2617
+ };
2618
+ const controllers = {
2619
+ ProductController: controllerFactory,
2620
+ CategoryController: controllerFactory$2,
2621
+ LeftoverController: controllerFactory$1
2622
+ };
2623
+ const products_server = {
2624
+ initialize: initializeProduct,
2625
+ models,
2626
+ routes,
2627
+ controllers
2628
+ };
2629
+ export {
2630
+ controllers,
2631
+ products_server as default,
2632
+ initializeProduct as initialize,
2633
+ models,
2634
+ routes
2635
+ };