@ozdao/martyrs 0.2.518 → 0.2.520
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.
- package/dist/_virtual/index.cjs +4 -4
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +4 -4
- package/dist/_virtual/index2.js +4 -4
- package/dist/{abac-Cf_9lCSh.js → abac-CnJsrv8S.js} +3 -3
- package/dist/{abac-6LjoG9u-.cjs → abac-DOyUjhee.cjs} +3 -3
- package/dist/builder.cjs +27 -25
- package/dist/builder.js +27 -25
- package/dist/chats.server.cjs +198 -1
- package/dist/chats.server.js +198 -1
- package/dist/{crud-sE7GLPbj.js → crud-BIFl1W1i.js} +6 -6
- package/dist/{crud-JN_LFj01.cjs → crud-CC6k6yY5.cjs} +6 -6
- package/dist/{globals.logger-CZMgIMlM.cjs → globals.logger-BuW7JHMY.cjs} +63 -53
- package/dist/{globals.logger-Bf6rRU7j.js → globals.logger-VRHh-WUW.js} +63 -53
- package/dist/{globals.observer-CV2wCzzh.cjs → globals.observer-C_FYclgV.cjs} +36 -1
- package/dist/{globals.observer-CDqUjVU5.js → globals.observer-MZsqaE6F.js} +36 -1
- package/dist/globals.server.cjs +1 -1
- package/dist/globals.server.js +1 -1
- package/dist/inventory.server.cjs +276 -376
- package/dist/inventory.server.js +276 -376
- package/dist/main-BM3GslOO.cjs +11 -0
- package/dist/{main-wmEhGVvD.js → main-Qcn7YlTx.js} +1834 -1830
- package/dist/martyrs/src/components/Address/{Address.vue2.cjs → Address.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Address/{Address.vue2.js.map → Address.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Address/{Address.vue2.js → Address.vue.js} +2 -2
- package/dist/martyrs/src/components/Address/Address.vue.js.map +1 -0
- package/dist/martyrs/src/components/Button/Button.vue.cjs +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.js +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.js.map +1 -1
- package/dist/martyrs/src/components/Chips/{Chips.vue.cjs → Chips.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Chips/{Chips.vue.js → Chips.vue2.js} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs.map → Dropdown.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs +0 -93
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js +1 -94
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs +93 -0
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js +94 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -3
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -3
- package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.js +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.js.map +1 -1
- package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.cjs → LocationMarker.vue.cjs} +2 -2
- package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.js.map → LocationMarker.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.js → LocationMarker.vue.js} +2 -2
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue.js.map +1 -0
- package/dist/martyrs/src/components/Select/{Select.vue2.cjs → Select.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Select/{Select.vue2.js.map → Select.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Select/{Select.vue2.js → Select.vue.js} +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -0
- package/dist/martyrs/src/modules/auth/views/components/blocks/CardUser.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/blocks/CardUser.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +4 -4
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +41 -51
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +59 -69
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.cjs +11 -13
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.js +11 -13
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs +10 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.js +10 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.js.map +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs +6 -0
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js +6 -0
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.cjs +27 -11
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.js +28 -12
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs +62 -0
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js +63 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs +60 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js +60 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs +3 -3
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js +3 -3
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +2 -2
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +2 -2
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.cjs +50 -368
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.js +53 -371
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +2 -3
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +2 -3
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs +2 -2
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.js +2 -2
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.js.map +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +3 -3
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs +16 -3
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js +17 -4
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs +7 -0
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.js +7 -0
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.js.map +1 -1
- package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.cjs +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs +67 -43
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js +68 -44
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.cjs +22 -7
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js +23 -8
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.cjs +47 -32
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.js +48 -33
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs +47 -26
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js +48 -27
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.cjs +42 -52
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.js +43 -53
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs +18 -18
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js +3 -3
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/store/{ inventory.store.cjs → inventory.store.cjs} +46 -2
- package/dist/martyrs/src/modules/inventory/store/inventory.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/inventory/store/{ inventory.store.js → inventory.store.js} +46 -2
- package/dist/martyrs/src/modules/inventory/store/inventory.store.js.map +1 -0
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs +180 -19
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js +181 -20
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js.map +1 -1
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.js +1 -1
- package/dist/martyrs/src/modules/music/router/music.cjs +1 -2
- package/dist/martyrs/src/modules/music/router/music.cjs.map +1 -1
- package/dist/martyrs/src/modules/music/router/music.js +1 -2
- package/dist/martyrs/src/modules/music/router/music.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +3 -4
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +3 -4
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/orders.client.cjs +2 -2
- package/dist/martyrs/src/modules/orders/orders.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/orders.client.js +2 -2
- package/dist/martyrs/src/modules/orders/orders.client.js.map +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.cjs +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.js +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +2 -24
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js +5 -27
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.cjs +4 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js +4 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +3 -3
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +3 -3
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.cjs +195 -0
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.js +195 -0
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.cjs +402 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js +402 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.cjs +86 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js +86 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs +10 -10
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js +11 -11
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +279 -191
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +285 -197
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +7 -7
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +7 -7
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +3 -3
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.cjs +4 -4
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.js +4 -4
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs +42 -41
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js +53 -52
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/organizations.client.cjs +23 -16
- package/dist/martyrs/src/modules/organizations/organizations.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/organizations.client.js +35 -28
- package/dist/martyrs/src/modules/organizations/organizations.client.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/router/departments.router.cjs +0 -18
- package/dist/martyrs/src/modules/organizations/router/departments.router.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/router/departments.router.js +0 -18
- package/dist/martyrs/src/modules/organizations/router/departments.router.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/store/departments.store.cjs +6 -0
- package/dist/martyrs/src/modules/organizations/store/departments.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/departments.store.js +6 -0
- package/dist/martyrs/src/modules/organizations/store/departments.store.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.cjs +6 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.js +6 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.cjs +20 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.js +20 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.js.map +1 -0
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +3 -4
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +3 -4
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +2 -2
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.js +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +3 -3
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +3 -3
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +3 -3
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +3 -3
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.cjs +60 -272
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.js +62 -274
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +4 -4
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +4 -4
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/music.server.cjs +9 -9
- package/dist/music.server.js +9 -9
- package/dist/notifications.server.cjs +0 -24
- package/dist/notifications.server.js +0 -24
- package/dist/orders.server.cjs +3 -6
- package/dist/orders.server.js +3 -6
- package/dist/organizations.server.cjs +119 -43
- package/dist/organizations.server.js +119 -43
- package/dist/products.server.cjs +5 -5
- package/dist/products.server.js +5 -5
- package/dist/rents.server.cjs +3 -3
- package/dist/rents.server.js +3 -3
- package/dist/style.css +16 -17
- package/dist/wallet.server.cjs +2 -2
- package/dist/wallet.server.js +2 -2
- package/dist/{web-B5wZTKbK.cjs → web-B0cfxzgu.cjs} +1 -1
- package/dist/{web-520xCgXy.js → web-DVR8m2fm.js} +1 -1
- package/package.json +1 -1
- package/src/builder/modes/ssr.rspack.dev.js +20 -12
- package/src/builder/rspack/rspack.config.base.js +16 -15
- package/src/components/Button/Button.vue +1 -1
- package/src/components/Feed/Feed.old.vue +0 -1
- package/src/components/Feed/Feed.vue +1 -31
- package/src/components/Loader/Loader.vue +1 -1
- package/src/modules/auth/FIXES.md +61 -0
- package/src/modules/auth/PROMT.md +33 -0
- package/src/modules/auth/auth.server.js +1 -0
- package/src/modules/auth/views/components/blocks/CardUser.vue +2 -2
- package/src/modules/auth/views/components/layouts/Auth.vue +1 -1
- package/src/modules/auth/views/components/pages/Invite.vue +2 -2
- package/src/modules/auth/views/components/pages/Profile.vue +33 -48
- package/src/modules/auth/views/components/sections/SliderFeatures.vue +5 -7
- package/src/modules/auth/views/store/auth.js +16 -1
- package/src/modules/auth//320/220/320/240/320/245/320/230/320/242/320/225/320/232/320/242/320/243/320/240/320/220.md +445 -0
- package/src/modules/backoffice/components/partials/Sidebar.vue +6 -0
- package/src/modules/chats/CLAUDE.md +137 -0
- package/src/modules/chats/components/blocks/ChatMessage.vue +12 -0
- package/src/modules/chats/components/sections/ChatWindow.vue +84 -2
- package/src/modules/chats/controllers/chats.controller.js +187 -0
- package/src/modules/chats/models/chat.model.js +21 -0
- package/src/modules/chats/routes/chats.routes.js +46 -0
- package/src/modules/chats/store/chat.store.js +67 -0
- package/src/modules/community/components/layouts/Community.vue +2 -2
- package/src/modules/community/components/pages/Posts.vue +3 -328
- package/src/modules/events/components/pages/EditEventTickets.vue +1 -1
- package/src/modules/events/components/pages/Events.vue +2 -2
- package/src/modules/globals/controllers/classes/globals.cache.js +64 -55
- package/src/modules/globals/controllers/classes/globals.logger.js +40 -4
- package/src/modules/globals/controllers/classes/globals.observer.js +54 -4
- package/src/modules/globals/views/components/partials/Header.vue +1 -1
- package/src/modules/globals/views/components/partials/Sidebar.vue +17 -13
- package/src/modules/globals/views/mixins/mixins.js +7 -0
- package/src/modules/inventory/CLAUDE.md +330 -0
- package/src/modules/inventory/PROMT.md +25 -0
- package/src/modules/inventory/components/forms/AdjustmentForm.vue +53 -36
- package/src/modules/inventory/components/forms/ColumnSettingsMenu.vue +11 -6
- package/src/modules/inventory/components/forms/HistoryView.vue +21 -9
- package/src/modules/inventory/components/forms/StockAlertsForm.vue +33 -22
- package/src/modules/inventory/components/pages/Inventory.vue +40 -40
- package/src/modules/inventory/components/pages/InventoryEdit.vue +1 -1
- package/src/modules/inventory/docs/01-intro.md +126 -0
- package/src/modules/inventory/docs/02-architecture.md +266 -0
- package/src/modules/inventory/docs/03-components-and-relationships.md +338 -0
- package/src/modules/inventory/docs/04-business-logic-and-algorithms.md +376 -0
- package/src/modules/inventory/docs/05-api-specification.md +356 -0
- package/src/modules/inventory/docs/06-access-control.md +320 -0
- package/src/modules/inventory/inventory.server.js +6 -2
- package/src/modules/inventory/{services → middlewares}/inventory.verifier.js +5 -16
- package/src/modules/inventory/models/stock.availability.model.js +20 -7
- package/src/modules/inventory/routes/inventory.routes.js +14 -17
- package/src/modules/inventory/services/adjustment.service.js +137 -0
- package/src/modules/inventory/services/audit.service.js +160 -0
- package/src/modules/inventory/services/availability.service.js +323 -0
- package/src/modules/inventory/services/inventory.helpers.old.js +217 -0
- package/src/modules/inventory/store/{ inventory.store.js → inventory.store.js} +0 -14
- package/src/modules/inventory/workers/inventory.availability.worker.js +29 -30
- package/src/modules/marketplace/views/components/layouts/Marketplace.vue +160 -8
- package/src/modules/notifications/controllers/notifications.controller.js +0 -6
- package/src/modules/notifications/services/notification.service.js +1 -17
- package/src/modules/notifications/services/web-push.service.js +0 -2
- package/src/modules/orders/components/blocks/CardOrderBackoffice.vue +2 -2
- package/src/modules/orders/components/blocks/CardOrderVar1.vue +1 -1
- package/src/modules/orders/controllers/orders.controller.js +2 -4
- package/src/modules/orders/orders.client.js +2 -2
- package/src/modules/orders/router/customers.router.js +1 -1
- package/src/modules/organizations/CLAUDE.md +259 -0
- package/src/modules/organizations/components/blocks/CardDepartment.vue +1 -22
- package/src/modules/organizations/components/blocks/Socials.vue +1 -1
- package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +3 -3
- package/src/modules/organizations/components/forms/AddExistingMembersForm.vue +191 -0
- package/src/modules/organizations/components/forms/DepartmentForm.vue +390 -0
- package/src/modules/organizations/components/forms/InviteForm.vue +81 -0
- package/src/modules/organizations/components/pages/Department.vue +10 -10
- package/src/modules/organizations/components/pages/DepartmentEdit.vue +8 -8
- package/src/modules/organizations/components/pages/Members.vue +265 -171
- package/src/modules/organizations/components/pages/Organization.new.vue +172 -183
- package/src/modules/organizations/components/pages/Organization.vue +6 -6
- package/src/modules/organizations/components/pages/OrganizationEdit.vue +1 -1
- package/src/modules/organizations/components/pages/Organizations.vue +1 -1
- package/src/modules/organizations/components/sections/Organizations.vue +2 -2
- package/src/modules/organizations/components/sections/Publics.vue +4 -4
- package/src/modules/organizations/configs/navigation.organization.config.js +40 -39
- package/src/modules/organizations/controllers/departments.controller.js +53 -34
- package/src/modules/organizations/controllers/invites.controller.js +44 -5
- package/src/modules/organizations/controllers/memberships.controller.js +43 -4
- package/src/modules/organizations/organizations.client.js +24 -15
- package/src/modules/organizations/router/departments.router.js +0 -18
- package/src/modules/organizations/routes/departments.routes.js +6 -8
- package/src/modules/organizations/routes/invites.routes.js +6 -4
- package/src/modules/organizations/routes/memberships.routes.js +6 -5
- package/src/modules/organizations/routes/organizations.routes.js +1 -1
- package/src/modules/organizations/store/departments.store.js +5 -0
- package/src/modules/organizations/store/invites.store.js +5 -0
- package/src/modules/organizations/store/memberships.store.js +23 -0
- package/src/modules/products/components/pages/Products.vue +0 -1
- package/src/modules/spots/components/blocks/CardSpot.vue +1 -1
- package/src/modules/spots/components/pages/Spots.vue +3 -203
- package/src/styles/base/all.scss +0 -15
- package/src/styles/responsive.scss +1 -31
- package/src/styles/typography.scss +20 -5
- package/dist/main-CSzPfQYR.cjs +0 -11
- package/dist/martyrs/src/components/Address/Address.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue.js.map +0 -1
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Select/Select.vue2.cjs.map +0 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.cjs +0 -76
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.js +0 -76
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.js.map +0 -1
- package/dist/martyrs/src/modules/inventory/store/ inventory.store.cjs.map +0 -1
- package/dist/martyrs/src/modules/inventory/store/ inventory.store.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +0 -280
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +0 -280
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/departments.cjs +0 -121
- package/dist/martyrs/src/modules/organizations/store/departments.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/departments.js +0 -121
- package/dist/martyrs/src/modules/organizations/store/departments.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/invites.cjs +0 -64
- package/dist/martyrs/src/modules/organizations/store/invites.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/invites.js +0 -64
- package/dist/martyrs/src/modules/organizations/store/invites.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/memberships.cjs +0 -87
- package/dist/martyrs/src/modules/organizations/store/memberships.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/memberships.js +0 -87
- package/dist/martyrs/src/modules/organizations/store/memberships.js.map +0 -1
- package/src/modules/globals/controllers/classes/globals.websocket.ws.js +0 -102
- package/src/modules/globals/views/components/blocks/BlockFilter.vue +0 -60
- package/src/modules/inventory/docs/README.md +0 -291
- package/src/modules/inventory/models/stock.balance.model.js +0 -43
- package/src/modules/inventory/services/inventory.crud.js +0 -710
- package/src/modules/inventory/tests/inventory.test.js +0 -281
- package/src/modules/organizations/store/departments.js +0 -137
- package/src/modules/organizations/store/invites.js +0 -76
- package/src/modules/organizations/store/memberships.js +0 -110
package/dist/chats.server.js
CHANGED
|
@@ -2,10 +2,15 @@ import "./mailing-DzlhsxCC.js";
|
|
|
2
2
|
import { m as middlewareIndexFactory } from "./index-_Edcmck_.js";
|
|
3
3
|
const controllerFactory = (db) => {
|
|
4
4
|
const ChatMessage = db.chat;
|
|
5
|
+
const Department = db.department;
|
|
6
|
+
const Order = db.order;
|
|
7
|
+
const notificationTimers = /* @__PURE__ */ new Map();
|
|
8
|
+
const NOTIFICATION_DELAY = 3e3;
|
|
5
9
|
const saveMessage = async (msg) => {
|
|
6
10
|
try {
|
|
7
11
|
const message = new ChatMessage(msg);
|
|
8
12
|
await message.save();
|
|
13
|
+
console.log("[CHAT CONTROLLER] Saved message with userId:", msg.userId);
|
|
9
14
|
return message;
|
|
10
15
|
} catch (error) {
|
|
11
16
|
console.error("Error saving message to database:", error);
|
|
@@ -19,9 +24,149 @@ const controllerFactory = (db) => {
|
|
|
19
24
|
console.error("Error retrieving messages from database:", error);
|
|
20
25
|
}
|
|
21
26
|
};
|
|
27
|
+
const markMessagesAsRead = async (messageIds, userId) => {
|
|
28
|
+
try {
|
|
29
|
+
console.log("[CHAT CONTROLLER] markMessagesAsRead called:", { messageIds, userId });
|
|
30
|
+
const messages = await ChatMessage.find({ _id: { $in: messageIds } });
|
|
31
|
+
console.log("[CHAT CONTROLLER] Found messages to mark:", messages.map((m) => ({
|
|
32
|
+
id: m._id,
|
|
33
|
+
userId: m.userId,
|
|
34
|
+
isOwnMessage: m.userId?.toString() === userId.toString(),
|
|
35
|
+
alreadyRead: m.readBy?.some((r) => r.userId.toString() === userId.toString())
|
|
36
|
+
})));
|
|
37
|
+
const result = await ChatMessage.updateMany(
|
|
38
|
+
{
|
|
39
|
+
_id: { $in: messageIds },
|
|
40
|
+
userId: { $ne: userId },
|
|
41
|
+
// НЕ свои сообщения
|
|
42
|
+
"readBy.userId": { $ne: userId }
|
|
43
|
+
// еще не прочитанные
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
$push: {
|
|
47
|
+
readBy: {
|
|
48
|
+
userId,
|
|
49
|
+
readAt: /* @__PURE__ */ new Date()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
console.log("[CHAT CONTROLLER] Mark as read result:", result);
|
|
55
|
+
return result;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error("Error marking messages as read:", error);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const getUsersWithOrdersConfirmAccess = async (organizationId) => {
|
|
61
|
+
const pipeline = [
|
|
62
|
+
{ $match: {
|
|
63
|
+
organization: new db.mongoose.Types.ObjectId(organizationId),
|
|
64
|
+
"accesses.orders.confirm": true
|
|
65
|
+
} },
|
|
66
|
+
{ $unwind: "$members" },
|
|
67
|
+
{ $group: {
|
|
68
|
+
_id: "$members.user"
|
|
69
|
+
} },
|
|
70
|
+
{ $project: { userId: "$_id" } }
|
|
71
|
+
];
|
|
72
|
+
const result = await Department.aggregate(pipeline);
|
|
73
|
+
return result.map((item) => item.userId);
|
|
74
|
+
};
|
|
75
|
+
const sendChatNotifications = async (message, recipientIds) => {
|
|
76
|
+
if (!recipientIds || recipientIds.length === 0) return;
|
|
77
|
+
const notifications = recipientIds.map((userId) => ({
|
|
78
|
+
title: "New Message",
|
|
79
|
+
body: `${message.username}: ${message.text.substring(0, 100)}`,
|
|
80
|
+
type: "chat_message",
|
|
81
|
+
metadata: {
|
|
82
|
+
type: "chat_message",
|
|
83
|
+
chatId: message.chatId,
|
|
84
|
+
messageId: message._id,
|
|
85
|
+
context: "chat"
|
|
86
|
+
},
|
|
87
|
+
userId
|
|
88
|
+
}));
|
|
89
|
+
try {
|
|
90
|
+
const response = await fetch(`${process.env.API_URL || ""}/api/notifications/batch`, {
|
|
91
|
+
method: "POST",
|
|
92
|
+
headers: {
|
|
93
|
+
"Content-Type": "application/json",
|
|
94
|
+
"X-Service-Key": process.env.SERVICE_KEY
|
|
95
|
+
},
|
|
96
|
+
body: JSON.stringify({ notifications })
|
|
97
|
+
});
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
const errorData = await response.text();
|
|
100
|
+
throw new Error(`Notification API failed: ${response.status} - ${errorData}`);
|
|
101
|
+
}
|
|
102
|
+
const result = await response.json();
|
|
103
|
+
console.log("Chat notifications sent:", result);
|
|
104
|
+
return result;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error("Failed to send chat notifications:", error);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const scheduleNotifications = async (message, wss, senderUserId) => {
|
|
110
|
+
console.log("[CHAT CONTROLLER] scheduleNotifications called for message:", message);
|
|
111
|
+
console.log("[CHAT CONTROLLER] Sender userId:", senderUserId);
|
|
112
|
+
console.log("[CHAT CONTROLLER] Chat type:", message.chatType);
|
|
113
|
+
console.log("[CHAT CONTROLLER] Chat ID:", message.chatId);
|
|
114
|
+
let recipientIds = [];
|
|
115
|
+
if (message.chatType === "order") {
|
|
116
|
+
try {
|
|
117
|
+
const order = await Order.findById(message.chatId);
|
|
118
|
+
console.log("[CHAT CONTROLLER] Found order:", order?._id, "Owner:", order?.owner);
|
|
119
|
+
const organizationId = order?.owner?.target?._id || order?.owner?.target;
|
|
120
|
+
if (order && organizationId) {
|
|
121
|
+
console.log("[CHAT CONTROLLER] Looking for users with orders.confirm access in org:", organizationId);
|
|
122
|
+
recipientIds = await getUsersWithOrdersConfirmAccess(organizationId);
|
|
123
|
+
console.log("[CHAT CONTROLLER] Found recipient IDs:", recipientIds);
|
|
124
|
+
} else {
|
|
125
|
+
console.log("[CHAT CONTROLLER] Order not found or has no organization");
|
|
126
|
+
}
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error("[CHAT CONTROLLER] Error fetching order:", error);
|
|
129
|
+
}
|
|
130
|
+
} else if (message.chatType === "group") {
|
|
131
|
+
console.log("[CHAT CONTROLLER] Group notifications are mocked for now");
|
|
132
|
+
return;
|
|
133
|
+
} else {
|
|
134
|
+
console.log("[CHAT CONTROLLER] Unknown chat type:", message.chatType);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const filteredRecipientIds = recipientIds.filter(
|
|
138
|
+
(userId) => userId.toString() !== senderUserId?.toString()
|
|
139
|
+
);
|
|
140
|
+
console.log("[CHAT CONTROLLER] Recipients after filtering out sender:", filteredRecipientIds);
|
|
141
|
+
if (filteredRecipientIds.length === 0) {
|
|
142
|
+
console.log("[CHAT CONTROLLER] No recipients after filtering, skipping notifications");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
filteredRecipientIds.forEach((userId) => {
|
|
146
|
+
const timerKey = `${message._id}_${userId}`;
|
|
147
|
+
console.log(`[CHAT CONTROLLER] Setting timer for user ${userId}, key: ${timerKey}`);
|
|
148
|
+
const timer = setTimeout(async () => {
|
|
149
|
+
console.log(`[CHAT CONTROLLER] Timer fired for user ${userId}, checking if message is read`);
|
|
150
|
+
const currentMessage = await ChatMessage.findById(message._id);
|
|
151
|
+
const isRead = currentMessage.readBy.some((r) => r.userId.toString() === userId.toString());
|
|
152
|
+
console.log(`[CHAT CONTROLLER] Message read status for user ${userId}:`, isRead);
|
|
153
|
+
if (!isRead) {
|
|
154
|
+
console.log(`[CHAT CONTROLLER] Sending notification to user ${userId}`);
|
|
155
|
+
await sendChatNotifications(message, [userId]);
|
|
156
|
+
} else {
|
|
157
|
+
console.log(`[CHAT CONTROLLER] Message already read by user ${userId}, skipping notification`);
|
|
158
|
+
}
|
|
159
|
+
notificationTimers.delete(timerKey);
|
|
160
|
+
}, NOTIFICATION_DELAY);
|
|
161
|
+
notificationTimers.set(timerKey, timer);
|
|
162
|
+
});
|
|
163
|
+
};
|
|
22
164
|
return {
|
|
23
165
|
saveMessage,
|
|
24
|
-
getMessages
|
|
166
|
+
getMessages,
|
|
167
|
+
markMessagesAsRead,
|
|
168
|
+
scheduleNotifications,
|
|
169
|
+
notificationTimers
|
|
25
170
|
};
|
|
26
171
|
};
|
|
27
172
|
const ChatModel = (db) => {
|
|
@@ -30,14 +175,35 @@ const ChatModel = (db) => {
|
|
|
30
175
|
type: String,
|
|
31
176
|
required: true
|
|
32
177
|
},
|
|
178
|
+
userId: {
|
|
179
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
180
|
+
ref: "User",
|
|
181
|
+
required: true
|
|
182
|
+
},
|
|
33
183
|
chatId: {
|
|
34
184
|
type: String,
|
|
35
185
|
required: true
|
|
36
186
|
},
|
|
187
|
+
chatType: {
|
|
188
|
+
type: String,
|
|
189
|
+
required: true,
|
|
190
|
+
enum: ["order", "group", "support", "private"],
|
|
191
|
+
default: "private"
|
|
192
|
+
},
|
|
37
193
|
text: {
|
|
38
194
|
type: String,
|
|
39
195
|
required: true
|
|
40
196
|
},
|
|
197
|
+
readBy: [{
|
|
198
|
+
userId: {
|
|
199
|
+
type: db.mongoose.Schema.Types.ObjectId,
|
|
200
|
+
ref: "User"
|
|
201
|
+
},
|
|
202
|
+
readAt: {
|
|
203
|
+
type: Date,
|
|
204
|
+
default: Date.now
|
|
205
|
+
}
|
|
206
|
+
}],
|
|
41
207
|
createdAt: {
|
|
42
208
|
type: Date,
|
|
43
209
|
default: Date.now
|
|
@@ -56,7 +222,9 @@ const chatsRoutes = function(app, db, wss) {
|
|
|
56
222
|
ws.activeChats.add(msg.chatId);
|
|
57
223
|
}
|
|
58
224
|
if (msg.type === "message") {
|
|
225
|
+
console.log("[CHAT] Received message:", msg);
|
|
59
226
|
const savedMessage = await controller.saveMessage(msg);
|
|
227
|
+
console.log("[CHAT] Saved message:", savedMessage);
|
|
60
228
|
wss.broadcastToModuleWithFilter(
|
|
61
229
|
"chat",
|
|
62
230
|
(client) => {
|
|
@@ -64,6 +232,35 @@ const chatsRoutes = function(app, db, wss) {
|
|
|
64
232
|
},
|
|
65
233
|
savedMessage
|
|
66
234
|
);
|
|
235
|
+
console.log("[CHAT] Scheduling notifications for message:", savedMessage._id, "from user:", ws.userId);
|
|
236
|
+
controller.scheduleNotifications(savedMessage, wss, ws.userId);
|
|
237
|
+
}
|
|
238
|
+
if (msg.type === "markAsRead") {
|
|
239
|
+
console.log("[CHAT] markAsRead request:", { messageIds: msg.messageIds, userId: ws.userId });
|
|
240
|
+
if (!msg.messageIds || !msg.chatId || !ws.userId) {
|
|
241
|
+
console.log("[CHAT] markAsRead missing params:", { hasMessageIds: !!msg.messageIds, hasChatId: !!msg.chatId, hasUserId: !!ws.userId });
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
await controller.markMessagesAsRead(msg.messageIds, ws.userId);
|
|
245
|
+
msg.messageIds.forEach((messageId) => {
|
|
246
|
+
const timerKey = `${messageId}_${ws.userId}`;
|
|
247
|
+
if (controller.notificationTimers.has(timerKey)) {
|
|
248
|
+
clearTimeout(controller.notificationTimers.get(timerKey));
|
|
249
|
+
controller.notificationTimers.delete(timerKey);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
wss.broadcastToModuleWithFilter(
|
|
253
|
+
"chat",
|
|
254
|
+
(client) => {
|
|
255
|
+
return client.activeChats?.has(msg.chatId) && client.userId !== ws.userId;
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
type: "readReceipt",
|
|
259
|
+
messageIds: msg.messageIds,
|
|
260
|
+
userId: ws.userId,
|
|
261
|
+
readAt: /* @__PURE__ */ new Date()
|
|
262
|
+
}
|
|
263
|
+
);
|
|
67
264
|
}
|
|
68
265
|
});
|
|
69
266
|
app.get("/messages/:chatId", async (req, res) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as middlewareFactory } from "./authJwt-J1csaMWA.js";
|
|
2
2
|
import { q as queryProcessorGlobals } from "./queryProcessor-CVcLPEnv.js";
|
|
3
|
-
import { O as
|
|
4
|
-
import { L as
|
|
3
|
+
import { O as ObserverNamespaced } from "./globals.observer-MZsqaE6F.js";
|
|
4
|
+
import { L as LoggerNamespaced, C as CacheNamespaced } from "./globals.logger-VRHh-WUW.js";
|
|
5
5
|
class CRUDCore {
|
|
6
6
|
constructor(crud) {
|
|
7
7
|
this.crud = crud;
|
|
@@ -833,8 +833,8 @@ class CRUDEvents {
|
|
|
833
833
|
this.enabled = options.enabled !== false;
|
|
834
834
|
this.options = options;
|
|
835
835
|
if (this.enabled) {
|
|
836
|
-
this.observer = options.observer || new
|
|
837
|
-
this.logger = options.logger || new
|
|
836
|
+
this.observer = options.observer || new ObserverNamespaced();
|
|
837
|
+
this.logger = options.logger || new LoggerNamespaced(this.crud.db);
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
840
|
// Отправка события
|
|
@@ -1004,8 +1004,8 @@ class CRUD {
|
|
|
1004
1004
|
this.model = model;
|
|
1005
1005
|
this.basePath = basePath;
|
|
1006
1006
|
this.modelName = modelName;
|
|
1007
|
-
this.cache = cache !== false ? cache instanceof
|
|
1008
|
-
this.logger = logger || new
|
|
1007
|
+
this.cache = cache !== false ? cache instanceof CacheNamespaced ? cache : new CacheNamespaced() : null;
|
|
1008
|
+
this.logger = logger || new LoggerNamespaced(db);
|
|
1009
1009
|
this.initModules(otherOptions);
|
|
1010
1010
|
this.core.init(otherOptions);
|
|
1011
1011
|
if (!otherOptions.disableDefaultRoutes) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const authJwt = require("./authJwt-BIZ2GIfT.cjs");
|
|
3
3
|
const queryProcessor = require("./queryProcessor-B_X680wC.cjs");
|
|
4
|
-
const globals_observer = require("./globals.observer-
|
|
5
|
-
const globals_logger = require("./globals.logger-
|
|
4
|
+
const globals_observer = require("./globals.observer-C_FYclgV.cjs");
|
|
5
|
+
const globals_logger = require("./globals.logger-BuW7JHMY.cjs");
|
|
6
6
|
class CRUDCore {
|
|
7
7
|
constructor(crud) {
|
|
8
8
|
this.crud = crud;
|
|
@@ -834,8 +834,8 @@ class CRUDEvents {
|
|
|
834
834
|
this.enabled = options.enabled !== false;
|
|
835
835
|
this.options = options;
|
|
836
836
|
if (this.enabled) {
|
|
837
|
-
this.observer = options.observer || new globals_observer.
|
|
838
|
-
this.logger = options.logger || new globals_logger.
|
|
837
|
+
this.observer = options.observer || new globals_observer.ObserverNamespaced();
|
|
838
|
+
this.logger = options.logger || new globals_logger.LoggerNamespaced(this.crud.db);
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
// Отправка события
|
|
@@ -1005,8 +1005,8 @@ class CRUD {
|
|
|
1005
1005
|
this.model = model;
|
|
1006
1006
|
this.basePath = basePath;
|
|
1007
1007
|
this.modelName = modelName;
|
|
1008
|
-
this.cache = cache !== false ? cache instanceof globals_logger.
|
|
1009
|
-
this.logger = logger || new globals_logger.
|
|
1008
|
+
this.cache = cache !== false ? cache instanceof globals_logger.CacheNamespaced ? cache : new globals_logger.CacheNamespaced() : null;
|
|
1009
|
+
this.logger = logger || new globals_logger.LoggerNamespaced(db);
|
|
1010
1010
|
this.initModules(otherOptions);
|
|
1011
1011
|
this.core.init(otherOptions);
|
|
1012
1012
|
if (!otherOptions.disableDefaultRoutes) {
|
|
@@ -6,30 +6,12 @@ class Cache {
|
|
|
6
6
|
this.cache = new NodeCache({ stdTTL: ttlSeconds });
|
|
7
7
|
this.tagStore = /* @__PURE__ */ new Map();
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Получение значения по ключу
|
|
11
|
-
* @param {string} key - Ключ
|
|
12
|
-
* @returns {Promise<any>} Значение из кэша
|
|
13
|
-
*/
|
|
14
9
|
async get(key) {
|
|
15
10
|
return this.cache.get(key);
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Установка значения по ключу
|
|
19
|
-
* @param {string} key - Ключ
|
|
20
|
-
* @param {any} value - Значение
|
|
21
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
22
|
-
*/
|
|
23
12
|
async set(key, value) {
|
|
24
13
|
return this.cache.set(key, value);
|
|
25
14
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Установка значения с тегами
|
|
28
|
-
* @param {string} key - Ключ
|
|
29
|
-
* @param {any} value - Значение
|
|
30
|
-
* @param {string[]} tags - Массив тегов
|
|
31
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
32
|
-
*/
|
|
33
15
|
async setWithTags(key, value, tags = []) {
|
|
34
16
|
const success = this.cache.set(key, value);
|
|
35
17
|
if (success && tags.length > 0) {
|
|
@@ -42,11 +24,6 @@ class Cache {
|
|
|
42
24
|
}
|
|
43
25
|
return success;
|
|
44
26
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Удаление по ключу или ключам
|
|
47
|
-
* @param {string|string[]} keys - Ключ или массив ключей
|
|
48
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
49
|
-
*/
|
|
50
27
|
async del(keys) {
|
|
51
28
|
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
52
29
|
const deletedCount = this.cache.del(keyArray);
|
|
@@ -62,11 +39,6 @@ class Cache {
|
|
|
62
39
|
}
|
|
63
40
|
return deletedCount;
|
|
64
41
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Удаление всех ключей, связанных с тегом
|
|
67
|
-
* @param {string} tag - Тег
|
|
68
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
69
|
-
*/
|
|
70
42
|
async delByTag(tag) {
|
|
71
43
|
if (!this.tagStore.has(tag)) return 0;
|
|
72
44
|
const keys = Array.from(this.tagStore.get(tag));
|
|
@@ -74,11 +46,6 @@ class Cache {
|
|
|
74
46
|
this.tagStore.delete(tag);
|
|
75
47
|
return deletedCount;
|
|
76
48
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Удаление всех ключей, связанных с массивом тегов
|
|
79
|
-
* @param {string[]} tags - Массив тегов
|
|
80
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
81
|
-
*/
|
|
82
49
|
async delByTags(tags) {
|
|
83
50
|
let totalDeleted = 0;
|
|
84
51
|
for (const tag of tags) {
|
|
@@ -86,26 +53,13 @@ class Cache {
|
|
|
86
53
|
}
|
|
87
54
|
return totalDeleted;
|
|
88
55
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Полная очистка кэша
|
|
91
|
-
* @returns {Promise<void>}
|
|
92
|
-
*/
|
|
93
56
|
async flush() {
|
|
94
57
|
this.cache.flushAll();
|
|
95
58
|
this.tagStore.clear();
|
|
96
59
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Получение всех ключей в кэше
|
|
99
|
-
* @returns {Promise<string[]>} Массив ключей
|
|
100
|
-
*/
|
|
101
60
|
async keys() {
|
|
102
61
|
return this.cache.keys();
|
|
103
62
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Получение тегов для ключа
|
|
106
|
-
* @param {string} key - Ключ
|
|
107
|
-
* @returns {Promise<string[]>} Массив тегов
|
|
108
|
-
*/
|
|
109
63
|
async getTagsForKey(key) {
|
|
110
64
|
const tags = [];
|
|
111
65
|
for (const [tag, keySet] of this.tagStore.entries()) {
|
|
@@ -115,10 +69,6 @@ class Cache {
|
|
|
115
69
|
}
|
|
116
70
|
return tags;
|
|
117
71
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Получение статистики кэша
|
|
120
|
-
* @returns {Promise<object>} Статистика
|
|
121
|
-
*/
|
|
122
72
|
async stats() {
|
|
123
73
|
return {
|
|
124
74
|
keys: this.cache.keys().length,
|
|
@@ -127,6 +77,42 @@ class Cache {
|
|
|
127
77
|
};
|
|
128
78
|
}
|
|
129
79
|
}
|
|
80
|
+
const instances$1 = /* @__PURE__ */ new Map();
|
|
81
|
+
class CacheNamespaced {
|
|
82
|
+
constructor(namespaceOrOptions, options) {
|
|
83
|
+
let namespace = "global";
|
|
84
|
+
let cacheOptions = {};
|
|
85
|
+
if (typeof namespaceOrOptions === "string") {
|
|
86
|
+
namespace = namespaceOrOptions;
|
|
87
|
+
cacheOptions = options || {};
|
|
88
|
+
} else if (typeof namespaceOrOptions === "object") {
|
|
89
|
+
cacheOptions = namespaceOrOptions || {};
|
|
90
|
+
}
|
|
91
|
+
if (instances$1.has(namespace)) {
|
|
92
|
+
return instances$1.get(namespace);
|
|
93
|
+
}
|
|
94
|
+
const instance = new Cache(cacheOptions);
|
|
95
|
+
instances$1.set(namespace, instance);
|
|
96
|
+
return instance;
|
|
97
|
+
}
|
|
98
|
+
// Статический метод для получения всех namespace'ов
|
|
99
|
+
static getNamespaces() {
|
|
100
|
+
return Array.from(instances$1.keys());
|
|
101
|
+
}
|
|
102
|
+
// Статический метод для очистки конкретного namespace
|
|
103
|
+
static async flushNamespace(namespace) {
|
|
104
|
+
if (instances$1.has(namespace)) {
|
|
105
|
+
await instances$1.get(namespace).flush();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Статический метод для удаления namespace (полностью)
|
|
109
|
+
static removeNamespace(namespace) {
|
|
110
|
+
if (instances$1.has(namespace)) {
|
|
111
|
+
instances$1.get(namespace).flush();
|
|
112
|
+
instances$1.delete(namespace);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
130
116
|
class Logger {
|
|
131
117
|
constructor(db) {
|
|
132
118
|
this.LogModel = db.log;
|
|
@@ -143,7 +129,6 @@ class Logger {
|
|
|
143
129
|
console.error("Logging error:", err);
|
|
144
130
|
}
|
|
145
131
|
}
|
|
146
|
-
// Удобные методы для различных уровней логирования
|
|
147
132
|
async info(message) {
|
|
148
133
|
await this.log("info", message);
|
|
149
134
|
}
|
|
@@ -151,5 +136,30 @@ class Logger {
|
|
|
151
136
|
await this.log("error", message);
|
|
152
137
|
}
|
|
153
138
|
}
|
|
154
|
-
|
|
155
|
-
|
|
139
|
+
const instances = /* @__PURE__ */ new Map();
|
|
140
|
+
class LoggerNamespaced {
|
|
141
|
+
constructor(namespaceOrDb, db) {
|
|
142
|
+
if (!db && namespaceOrDb && typeof namespaceOrDb === "object") {
|
|
143
|
+
const namespace2 = "global";
|
|
144
|
+
if (instances.has(namespace2)) {
|
|
145
|
+
return instances.get(namespace2);
|
|
146
|
+
}
|
|
147
|
+
const instance2 = new Logger(namespaceOrDb);
|
|
148
|
+
instances.set(namespace2, instance2);
|
|
149
|
+
return instance2;
|
|
150
|
+
}
|
|
151
|
+
const namespace = namespaceOrDb;
|
|
152
|
+
if (instances.has(namespace)) {
|
|
153
|
+
return instances.get(namespace);
|
|
154
|
+
}
|
|
155
|
+
const instance = new Logger(db);
|
|
156
|
+
instances.set(namespace, instance);
|
|
157
|
+
return instance;
|
|
158
|
+
}
|
|
159
|
+
// Статический метод для получения всех namespace'ов
|
|
160
|
+
static getNamespaces() {
|
|
161
|
+
return Array.from(instances.keys());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.CacheNamespaced = CacheNamespaced;
|
|
165
|
+
exports.LoggerNamespaced = LoggerNamespaced;
|
|
@@ -5,30 +5,12 @@ class Cache {
|
|
|
5
5
|
this.cache = new NodeCache({ stdTTL: ttlSeconds });
|
|
6
6
|
this.tagStore = /* @__PURE__ */ new Map();
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* Получение значения по ключу
|
|
10
|
-
* @param {string} key - Ключ
|
|
11
|
-
* @returns {Promise<any>} Значение из кэша
|
|
12
|
-
*/
|
|
13
8
|
async get(key) {
|
|
14
9
|
return this.cache.get(key);
|
|
15
10
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Установка значения по ключу
|
|
18
|
-
* @param {string} key - Ключ
|
|
19
|
-
* @param {any} value - Значение
|
|
20
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
21
|
-
*/
|
|
22
11
|
async set(key, value) {
|
|
23
12
|
return this.cache.set(key, value);
|
|
24
13
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Установка значения с тегами
|
|
27
|
-
* @param {string} key - Ключ
|
|
28
|
-
* @param {any} value - Значение
|
|
29
|
-
* @param {string[]} tags - Массив тегов
|
|
30
|
-
* @returns {Promise<boolean>} Успешность операции
|
|
31
|
-
*/
|
|
32
14
|
async setWithTags(key, value, tags = []) {
|
|
33
15
|
const success = this.cache.set(key, value);
|
|
34
16
|
if (success && tags.length > 0) {
|
|
@@ -41,11 +23,6 @@ class Cache {
|
|
|
41
23
|
}
|
|
42
24
|
return success;
|
|
43
25
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Удаление по ключу или ключам
|
|
46
|
-
* @param {string|string[]} keys - Ключ или массив ключей
|
|
47
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
48
|
-
*/
|
|
49
26
|
async del(keys) {
|
|
50
27
|
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
51
28
|
const deletedCount = this.cache.del(keyArray);
|
|
@@ -61,11 +38,6 @@ class Cache {
|
|
|
61
38
|
}
|
|
62
39
|
return deletedCount;
|
|
63
40
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Удаление всех ключей, связанных с тегом
|
|
66
|
-
* @param {string} tag - Тег
|
|
67
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
68
|
-
*/
|
|
69
41
|
async delByTag(tag) {
|
|
70
42
|
if (!this.tagStore.has(tag)) return 0;
|
|
71
43
|
const keys = Array.from(this.tagStore.get(tag));
|
|
@@ -73,11 +45,6 @@ class Cache {
|
|
|
73
45
|
this.tagStore.delete(tag);
|
|
74
46
|
return deletedCount;
|
|
75
47
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Удаление всех ключей, связанных с массивом тегов
|
|
78
|
-
* @param {string[]} tags - Массив тегов
|
|
79
|
-
* @returns {Promise<number>} Количество удаленных элементов
|
|
80
|
-
*/
|
|
81
48
|
async delByTags(tags) {
|
|
82
49
|
let totalDeleted = 0;
|
|
83
50
|
for (const tag of tags) {
|
|
@@ -85,26 +52,13 @@ class Cache {
|
|
|
85
52
|
}
|
|
86
53
|
return totalDeleted;
|
|
87
54
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Полная очистка кэша
|
|
90
|
-
* @returns {Promise<void>}
|
|
91
|
-
*/
|
|
92
55
|
async flush() {
|
|
93
56
|
this.cache.flushAll();
|
|
94
57
|
this.tagStore.clear();
|
|
95
58
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Получение всех ключей в кэше
|
|
98
|
-
* @returns {Promise<string[]>} Массив ключей
|
|
99
|
-
*/
|
|
100
59
|
async keys() {
|
|
101
60
|
return this.cache.keys();
|
|
102
61
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Получение тегов для ключа
|
|
105
|
-
* @param {string} key - Ключ
|
|
106
|
-
* @returns {Promise<string[]>} Массив тегов
|
|
107
|
-
*/
|
|
108
62
|
async getTagsForKey(key) {
|
|
109
63
|
const tags = [];
|
|
110
64
|
for (const [tag, keySet] of this.tagStore.entries()) {
|
|
@@ -114,10 +68,6 @@ class Cache {
|
|
|
114
68
|
}
|
|
115
69
|
return tags;
|
|
116
70
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Получение статистики кэша
|
|
119
|
-
* @returns {Promise<object>} Статистика
|
|
120
|
-
*/
|
|
121
71
|
async stats() {
|
|
122
72
|
return {
|
|
123
73
|
keys: this.cache.keys().length,
|
|
@@ -126,6 +76,42 @@ class Cache {
|
|
|
126
76
|
};
|
|
127
77
|
}
|
|
128
78
|
}
|
|
79
|
+
const instances$1 = /* @__PURE__ */ new Map();
|
|
80
|
+
class CacheNamespaced {
|
|
81
|
+
constructor(namespaceOrOptions, options) {
|
|
82
|
+
let namespace = "global";
|
|
83
|
+
let cacheOptions = {};
|
|
84
|
+
if (typeof namespaceOrOptions === "string") {
|
|
85
|
+
namespace = namespaceOrOptions;
|
|
86
|
+
cacheOptions = options || {};
|
|
87
|
+
} else if (typeof namespaceOrOptions === "object") {
|
|
88
|
+
cacheOptions = namespaceOrOptions || {};
|
|
89
|
+
}
|
|
90
|
+
if (instances$1.has(namespace)) {
|
|
91
|
+
return instances$1.get(namespace);
|
|
92
|
+
}
|
|
93
|
+
const instance = new Cache(cacheOptions);
|
|
94
|
+
instances$1.set(namespace, instance);
|
|
95
|
+
return instance;
|
|
96
|
+
}
|
|
97
|
+
// Статический метод для получения всех namespace'ов
|
|
98
|
+
static getNamespaces() {
|
|
99
|
+
return Array.from(instances$1.keys());
|
|
100
|
+
}
|
|
101
|
+
// Статический метод для очистки конкретного namespace
|
|
102
|
+
static async flushNamespace(namespace) {
|
|
103
|
+
if (instances$1.has(namespace)) {
|
|
104
|
+
await instances$1.get(namespace).flush();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Статический метод для удаления namespace (полностью)
|
|
108
|
+
static removeNamespace(namespace) {
|
|
109
|
+
if (instances$1.has(namespace)) {
|
|
110
|
+
instances$1.get(namespace).flush();
|
|
111
|
+
instances$1.delete(namespace);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
129
115
|
class Logger {
|
|
130
116
|
constructor(db) {
|
|
131
117
|
this.LogModel = db.log;
|
|
@@ -142,7 +128,6 @@ class Logger {
|
|
|
142
128
|
console.error("Logging error:", err);
|
|
143
129
|
}
|
|
144
130
|
}
|
|
145
|
-
// Удобные методы для различных уровней логирования
|
|
146
131
|
async info(message) {
|
|
147
132
|
await this.log("info", message);
|
|
148
133
|
}
|
|
@@ -150,7 +135,32 @@ class Logger {
|
|
|
150
135
|
await this.log("error", message);
|
|
151
136
|
}
|
|
152
137
|
}
|
|
138
|
+
const instances = /* @__PURE__ */ new Map();
|
|
139
|
+
class LoggerNamespaced {
|
|
140
|
+
constructor(namespaceOrDb, db) {
|
|
141
|
+
if (!db && namespaceOrDb && typeof namespaceOrDb === "object") {
|
|
142
|
+
const namespace2 = "global";
|
|
143
|
+
if (instances.has(namespace2)) {
|
|
144
|
+
return instances.get(namespace2);
|
|
145
|
+
}
|
|
146
|
+
const instance2 = new Logger(namespaceOrDb);
|
|
147
|
+
instances.set(namespace2, instance2);
|
|
148
|
+
return instance2;
|
|
149
|
+
}
|
|
150
|
+
const namespace = namespaceOrDb;
|
|
151
|
+
if (instances.has(namespace)) {
|
|
152
|
+
return instances.get(namespace);
|
|
153
|
+
}
|
|
154
|
+
const instance = new Logger(db);
|
|
155
|
+
instances.set(namespace, instance);
|
|
156
|
+
return instance;
|
|
157
|
+
}
|
|
158
|
+
// Статический метод для получения всех namespace'ов
|
|
159
|
+
static getNamespaces() {
|
|
160
|
+
return Array.from(instances.keys());
|
|
161
|
+
}
|
|
162
|
+
}
|
|
153
163
|
export {
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
CacheNamespaced as C,
|
|
165
|
+
LoggerNamespaced as L
|
|
156
166
|
};
|