@lyxa.ai/core 1.4.297 → 1.4.298
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/libraries/index.d.ts +6 -0
- package/dist/libraries/index.js +57 -26
- package/dist/libraries/index.js.map +1 -1
- package/dist/libraries/mongo/models/bob-finance.model.js +2 -5
- package/dist/libraries/mongo/models/bob-finance.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.d.ts +2 -0
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js +6 -0
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js.map +1 -1
- package/dist/libraries/upload/index.js +3 -3
- package/dist/libraries/upload/index.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/index.js.map +1 -0
- package/dist/types/libraries/auth/index.d.ts +77 -0
- package/dist/types/libraries/auth/index.js +270 -0
- package/dist/types/libraries/auth/index.js.map +1 -0
- package/dist/types/libraries/auth/refreshtoken.d.ts +15 -0
- package/dist/types/libraries/auth/refreshtoken.js +91 -0
- package/dist/types/libraries/auth/refreshtoken.js.map +1 -0
- package/dist/types/libraries/auth/repository.d.ts +18 -0
- package/dist/types/libraries/auth/repository.js +43 -0
- package/dist/types/libraries/auth/repository.js.map +1 -0
- package/dist/types/libraries/bullmq/bull-mq-service.d.ts +9 -0
- package/dist/types/libraries/bullmq/bull-mq-service.js +42 -0
- package/dist/types/libraries/bullmq/bull-mq-service.js.map +1 -0
- package/dist/types/libraries/cache/settings/index.d.ts +7 -0
- package/dist/types/libraries/cache/settings/index.js +56 -0
- package/dist/types/libraries/cache/settings/index.js.map +1 -0
- package/dist/types/libraries/cash-settlement/cashSettlementService.d.ts +16 -0
- package/dist/types/libraries/cash-settlement/cashSettlementService.js +53 -0
- package/dist/types/libraries/cash-settlement/cashSettlementService.js.map +1 -0
- package/dist/types/libraries/cash-settlement/index.d.ts +2 -0
- package/dist/types/libraries/cash-settlement/index.js +19 -0
- package/dist/types/libraries/cash-settlement/index.js.map +1 -0
- package/dist/types/libraries/cash-settlement/interfaces/ICashSettlement.d.ts +24 -0
- package/dist/types/libraries/cash-settlement/interfaces/ICashSettlement.js +10 -0
- package/dist/types/libraries/cash-settlement/interfaces/ICashSettlement.js.map +1 -0
- package/dist/types/libraries/cash-settlement/providers/bob.d.ts +45 -0
- package/dist/types/libraries/cash-settlement/providers/bob.js +634 -0
- package/dist/types/libraries/cash-settlement/providers/bob.js.map +1 -0
- package/dist/types/libraries/cash-settlement/providers/index.d.ts +1 -0
- package/dist/types/libraries/cash-settlement/providers/index.js +18 -0
- package/dist/types/libraries/cash-settlement/providers/index.js.map +1 -0
- package/dist/types/libraries/cloud-storage/CloudStorageFactory.d.ts +7 -0
- package/dist/types/libraries/cloud-storage/CloudStorageFactory.js +18 -0
- package/dist/types/libraries/cloud-storage/CloudStorageFactory.js.map +1 -0
- package/dist/types/libraries/cloud-storage/index.d.ts +4 -0
- package/dist/types/libraries/cloud-storage/index.js +21 -0
- package/dist/types/libraries/cloud-storage/index.js.map +1 -0
- package/dist/types/libraries/cloud-storage/interfaces/ICloudStorage.d.ts +8 -0
- package/dist/types/libraries/cloud-storage/interfaces/ICloudStorage.js +3 -0
- package/dist/types/libraries/cloud-storage/interfaces/ICloudStorage.js.map +1 -0
- package/dist/types/libraries/cloud-storage/providers/GcsStorageService.d.ts +11 -0
- package/dist/types/libraries/cloud-storage/providers/GcsStorageService.js +63 -0
- package/dist/types/libraries/cloud-storage/providers/GcsStorageService.js.map +1 -0
- package/dist/types/libraries/cloud-storage/types/FileUploadResult.d.ts +11 -0
- package/dist/types/libraries/cloud-storage/types/FileUploadResult.js +3 -0
- package/dist/types/libraries/cloud-storage/types/FileUploadResult.js.map +1 -0
- package/dist/types/libraries/configuration/index.d.ts +39 -0
- package/dist/types/libraries/configuration/index.js +84 -0
- package/dist/types/libraries/configuration/index.js.map +1 -0
- package/dist/types/libraries/configuration/types/EnvironmentConfigurationType.d.ts +9 -0
- package/dist/types/libraries/configuration/types/EnvironmentConfigurationType.js +14 -0
- package/dist/types/libraries/configuration/types/EnvironmentConfigurationType.js.map +1 -0
- package/dist/types/libraries/dispatcher/index.d.ts +10 -0
- package/dist/types/libraries/dispatcher/index.js +43 -0
- package/dist/types/libraries/dispatcher/index.js.map +1 -0
- package/dist/types/libraries/event/BaseEvent.d.ts +7 -0
- package/dist/types/libraries/event/BaseEvent.js +19 -0
- package/dist/types/libraries/event/BaseEvent.js.map +1 -0
- package/dist/types/libraries/event/EventEnums.d.ts +26 -0
- package/dist/types/libraries/event/EventEnums.js +31 -0
- package/dist/types/libraries/event/EventEnums.js.map +1 -0
- package/dist/types/libraries/event/decorators/metadata.d.ts +13 -0
- package/dist/types/libraries/event/decorators/metadata.js +20 -0
- package/dist/types/libraries/event/decorators/metadata.js.map +1 -0
- package/dist/types/libraries/event/events/index.d.ts +2 -0
- package/dist/types/libraries/event/events/index.js +19 -0
- package/dist/types/libraries/event/events/index.js.map +1 -0
- package/dist/types/libraries/event/events/payout/index.d.ts +1 -0
- package/dist/types/libraries/event/events/payout/index.js +18 -0
- package/dist/types/libraries/event/events/payout/index.js.map +1 -0
- package/dist/types/libraries/event/events/payout/payout-schedule.event.d.ts +9 -0
- package/dist/types/libraries/event/events/payout/payout-schedule.event.js +12 -0
- package/dist/types/libraries/event/events/payout/payout-schedule.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/cash/index.d.ts +5 -0
- package/dist/types/libraries/event/events/rider/cash/index.js +14 -0
- package/dist/types/libraries/event/events/rider/cash/index.js.map +1 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-added.event.d.ts +11 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-added.event.js +19 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-added.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-event.d.ts +11 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-event.js +18 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-hold-period-changed.event.d.ts +10 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-hold-period-changed.event.js +17 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-hold-period-changed.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-settled.event.d.ts +11 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-settled.event.js +19 -0
- package/dist/types/libraries/event/events/rider/cash/rider-cash-settled.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/cash/rider-max-cash-balance-for-bob-payout-updated.event.d.ts +10 -0
- package/dist/types/libraries/event/events/rider/cash/rider-max-cash-balance-for-bob-payout-updated.event.js +17 -0
- package/dist/types/libraries/event/events/rider/cash/rider-max-cash-balance-for-bob-payout-updated.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/index.d.ts +2 -0
- package/dist/types/libraries/event/events/rider/index.js +19 -0
- package/dist/types/libraries/event/events/rider/index.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/index.d.ts +7 -0
- package/dist/types/libraries/event/events/rider/scoring/index.js +18 -0
- package/dist/types/libraries/event/events/rider/scoring/index.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-accepted-order.event.d.ts +11 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-accepted-order.event.js +20 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-accepted-order.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-arrived-at-store.event.d.ts +13 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-arrived-at-store.event.js +24 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-arrived-at-store.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-assigned-order.event.d.ts +11 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-assigned-order.event.js +20 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-assigned-order.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-delivered-order.event.d.ts +13 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-delivered-order.event.js +24 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-delivered-order.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-order-completed.event.d.ts +19 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-order-completed.event.js +36 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-order-completed.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-rating.event.d.ts +13 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-rating.event.js +18 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-rating.event.js.map +1 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-score-event.d.ts +14 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-score-event.js +21 -0
- package/dist/types/libraries/event/events/rider/scoring/rider-score-event.js.map +1 -0
- package/dist/types/libraries/event/index.d.ts +11 -0
- package/dist/types/libraries/event/index.js +152 -0
- package/dist/types/libraries/event/index.js.map +1 -0
- package/dist/types/libraries/event/registry/SubscriptionRegistry.d.ts +11 -0
- package/dist/types/libraries/event/registry/SubscriptionRegistry.js +14 -0
- package/dist/types/libraries/event/registry/SubscriptionRegistry.js.map +1 -0
- package/dist/types/libraries/firebase/index.d.ts +16 -0
- package/dist/types/libraries/firebase/index.js +107 -0
- package/dist/types/libraries/firebase/index.js.map +1 -0
- package/dist/types/libraries/google-translate/google-translate.client.d.ts +5 -0
- package/dist/types/libraries/google-translate/google-translate.client.js +44 -0
- package/dist/types/libraries/google-translate/google-translate.client.js.map +1 -0
- package/dist/types/libraries/google-translate/google-translate.dto.d.ts +13 -0
- package/dist/types/libraries/google-translate/google-translate.dto.js +3 -0
- package/dist/types/libraries/google-translate/google-translate.dto.js.map +1 -0
- package/dist/types/libraries/google-translate/google-translate.service.d.ts +9 -0
- package/dist/types/libraries/google-translate/google-translate.service.js +102 -0
- package/dist/types/libraries/google-translate/google-translate.service.js.map +1 -0
- package/dist/types/libraries/google-translate/index.d.ts +1 -0
- package/dist/types/libraries/google-translate/index.js +18 -0
- package/dist/types/libraries/google-translate/index.js.map +1 -0
- package/dist/types/libraries/index.d.ts +43 -0
- package/dist/types/libraries/index.js +102 -0
- package/dist/types/libraries/index.js.map +1 -0
- package/dist/types/libraries/llm/interfaces/common-llm-interfaces.d.ts +28 -0
- package/dist/types/libraries/llm/interfaces/common-llm-interfaces.js +3 -0
- package/dist/types/libraries/llm/interfaces/common-llm-interfaces.js.map +1 -0
- package/dist/types/libraries/llm/llm-provider-service.d.ts +13 -0
- package/dist/types/libraries/llm/llm-provider-service.js +47 -0
- package/dist/types/libraries/llm/llm-provider-service.js.map +1 -0
- package/dist/types/libraries/llm/providers/openai-provider.d.ts +19 -0
- package/dist/types/libraries/llm/providers/openai-provider.js +223 -0
- package/dist/types/libraries/llm/providers/openai-provider.js.map +1 -0
- package/dist/types/libraries/logger/index.d.ts +8 -0
- package/dist/types/libraries/logger/index.js +75 -0
- package/dist/types/libraries/logger/index.js.map +1 -0
- package/dist/types/libraries/logger-kit/index.d.ts +3 -0
- package/dist/types/libraries/logger-kit/index.js +22 -0
- package/dist/types/libraries/logger-kit/index.js.map +1 -0
- package/dist/types/libraries/logger-kit/logger.service.d.ts +117 -0
- package/dist/types/libraries/logger-kit/logger.service.js +304 -0
- package/dist/types/libraries/logger-kit/logger.service.js.map +1 -0
- package/dist/types/libraries/logger-kit/types.d.ts +34 -0
- package/dist/types/libraries/logger-kit/types.js +3 -0
- package/dist/types/libraries/logger-kit/types.js.map +1 -0
- package/dist/types/libraries/map/index.d.ts +2 -0
- package/dist/types/libraries/map/index.js +19 -0
- package/dist/types/libraries/map/index.js.map +1 -0
- package/dist/types/libraries/map/interfaces/IMapService.d.ts +43 -0
- package/dist/types/libraries/map/interfaces/IMapService.js +9 -0
- package/dist/types/libraries/map/interfaces/IMapService.js.map +1 -0
- package/dist/types/libraries/map/mapService.d.ts +21 -0
- package/dist/types/libraries/map/mapService.js +57 -0
- package/dist/types/libraries/map/mapService.js.map +1 -0
- package/dist/types/libraries/map/providers/google-maps.d.ts +27 -0
- package/dist/types/libraries/map/providers/google-maps.js +462 -0
- package/dist/types/libraries/map/providers/google-maps.js.map +1 -0
- package/dist/types/libraries/map/providers/index.d.ts +1 -0
- package/dist/types/libraries/map/providers/index.js +18 -0
- package/dist/types/libraries/map/providers/index.js.map +1 -0
- package/dist/types/libraries/map/providers/osrm.d.ts +13 -0
- package/dist/types/libraries/map/providers/osrm.js +137 -0
- package/dist/types/libraries/map/providers/osrm.js.map +1 -0
- package/dist/types/libraries/mongo/index.d.ts +7 -0
- package/dist/types/libraries/mongo/index.js +87 -0
- package/dist/types/libraries/mongo/index.js.map +1 -0
- package/dist/types/libraries/mongo/models/activity-log.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/activity-log.model.js +48 -0
- package/dist/types/libraries/mongo/models/activity-log.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/admin-access-control.model.d.ts +11 -0
- package/dist/types/libraries/mongo/models/admin-access-control.model.js +75 -0
- package/dist/types/libraries/mongo/models/admin-access-control.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/admin.model.d.ts +11 -0
- package/dist/types/libraries/mongo/models/admin.model.js +65 -0
- package/dist/types/libraries/mongo/models/admin.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/agent-performance.model.d.ts +15 -0
- package/dist/types/libraries/mongo/models/agent-performance.model.js +73 -0
- package/dist/types/libraries/mongo/models/agent-performance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/app-appearance.model.d.ts +25 -0
- package/dist/types/libraries/mongo/models/app-appearance.model.js +102 -0
- package/dist/types/libraries/mongo/models/app-appearance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/app-instance.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/app-instance.model.js +54 -0
- package/dist/types/libraries/mongo/models/app-instance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/attribute.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/attribute.model.js +58 -0
- package/dist/types/libraries/mongo/models/attribute.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/banner.model.d.ts +27 -0
- package/dist/types/libraries/mongo/models/banner.model.js +118 -0
- package/dist/types/libraries/mongo/models/banner.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/base/base-coupon.model.d.ts +19 -0
- package/dist/types/libraries/mongo/models/base/base-coupon.model.js +90 -0
- package/dist/types/libraries/mongo/models/base/base-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/bob-finance.model.d.ts +19 -0
- package/dist/types/libraries/mongo/models/bob-finance.model.js +88 -0
- package/dist/types/libraries/mongo/models/bob-finance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/booking-cancellation-rescheduling-rules.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/booking-cancellation-rescheduling-rules.model.js +48 -0
- package/dist/types/libraries/mongo/models/booking-cancellation-rescheduling-rules.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/brand.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/brand.model.js +32 -0
- package/dist/types/libraries/mongo/models/brand.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/cancellation-reason.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/cancellation-reason.model.js +55 -0
- package/dist/types/libraries/mongo/models/cancellation-reason.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/card.model.d.ts +19 -0
- package/dist/types/libraries/mongo/models/card.model.js +88 -0
- package/dist/types/libraries/mongo/models/card.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/cart-participant.model.d.ts +29 -0
- package/dist/types/libraries/mongo/models/cart-participant.model.js +130 -0
- package/dist/types/libraries/mongo/models/cart-participant.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/cart.model.d.ts +39 -0
- package/dist/types/libraries/mongo/models/cart.model.js +184 -0
- package/dist/types/libraries/mongo/models/cart.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/category.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/category.model.js +68 -0
- package/dist/types/libraries/mongo/models/category.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/chat-room.model.d.ts +28 -0
- package/dist/types/libraries/mongo/models/chat-room.model.js +99 -0
- package/dist/types/libraries/mongo/models/chat-room.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/copy-attribute-map.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/copy-attribute-map.model.js +38 -0
- package/dist/types/libraries/mongo/models/copy-attribute-map.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/copy-product-job.model.d.ts +21 -0
- package/dist/types/libraries/mongo/models/copy-product-job.model.js +101 -0
- package/dist/types/libraries/mongo/models/copy-product-job.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/copy-product-map.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/copy-product-map.model.js +38 -0
- package/dist/types/libraries/mongo/models/copy-product-map.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/copy-shop-category-map.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/copy-shop-category-map.model.js +38 -0
- package/dist/types/libraries/mongo/models/copy-shop-category-map.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/core-auth-identity.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/core-auth-identity.model.js +32 -0
- package/dist/types/libraries/mongo/models/core-auth-identity.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/core-user.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/core-user.model.js +85 -0
- package/dist/types/libraries/mongo/models/core-user.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/counter.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/counter.model.js +42 -0
- package/dist/types/libraries/mongo/models/counter.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/coupon.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/coupon.model.js +60 -0
- package/dist/types/libraries/mongo/models/coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/deal-setting.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/deal-setting.model.js +52 -0
- package/dist/types/libraries/mongo/models/deal-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/default-chat.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/default-chat.model.js +26 -0
- package/dist/types/libraries/mongo/models/default-chat.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/delivery-charges.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/delivery-charges.model.js +63 -0
- package/dist/types/libraries/mongo/models/delivery-charges.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/dish.model.d.ts +18 -0
- package/dist/types/libraries/mongo/models/dish.model.js +92 -0
- package/dist/types/libraries/mongo/models/dish.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/address-change-history.model.d.ts +25 -0
- package/dist/types/libraries/mongo/models/embedded/address-change-history.model.js +112 -0
- package/dist/types/libraries/mongo/models/embedded/address-change-history.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/adjustment-information.model.d.ts +33 -0
- package/dist/types/libraries/mongo/models/embedded/adjustment-information.model.js +133 -0
- package/dist/types/libraries/mongo/models/embedded/adjustment-information.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/agent-notification-setting.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/agent-notification-setting.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/agent-notification-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/app-force-update.d.ts +9 -0
- package/dist/types/libraries/mongo/models/embedded/app-force-update.js +52 -0
- package/dist/types/libraries/mongo/models/embedded/app-force-update.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/attribute-item.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/attribute-item.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/attribute-map.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/embedded/attribute-map.model.js +29 -0
- package/dist/types/libraries/mongo/models/embedded/attribute-map.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/business-development-setting.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/business-development-setting.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/business-development-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/cash-settlement.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/embedded/cash-settlement.model.js +52 -0
- package/dist/types/libraries/mongo/models/embedded/cash-settlement.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/cashback-amounts.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/cashback-amounts.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/cashback-amounts.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/charge.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/charge.model.js +28 -0
- package/dist/types/libraries/mongo/models/embedded/charge.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/chat-participant.model.d.ts +18 -0
- package/dist/types/libraries/mongo/models/embedded/chat-participant.model.js +64 -0
- package/dist/types/libraries/mongo/models/embedded/chat-participant.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/cleaning-material.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/cleaning-material.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/cleaning-material.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/company-info.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/embedded/company-info.model.js +37 -0
- package/dist/types/libraries/mongo/models/embedded/company-info.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/courier-order-finance.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/embedded/courier-order-finance.model.js +36 -0
- package/dist/types/libraries/mongo/models/embedded/courier-order-finance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/courier-setting.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/courier-setting.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/courier-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/currency-setting.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/embedded/currency-setting.model.js +38 -0
- package/dist/types/libraries/mongo/models/embedded/currency-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/currency.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/currency.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/currency.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/customer-support-batches.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/customer-support-batches.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/customer-support-batches.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/customer-support-numbers.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/customer-support-numbers.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/customer-support-numbers.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/delivery-charge-setting.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/embedded/delivery-charge-setting.model.js +51 -0
- package/dist/types/libraries/mongo/models/embedded/delivery-charge-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/delivery-info.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/delivery-info.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/delivery-info.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/external-ref.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/external-ref.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/external-ref.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/featured-item.mode.d.ts +6 -0
- package/dist/types/libraries/mongo/models/embedded/featured-item.mode.js +33 -0
- package/dist/types/libraries/mongo/models/embedded/featured-item.mode.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/frequency-configuration.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/embedded/frequency-configuration.model.js +38 -0
- package/dist/types/libraries/mongo/models/embedded/frequency-configuration.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/line-item-attribute.model.d.ts +17 -0
- package/dist/types/libraries/mongo/models/embedded/line-item-attribute.model.js +63 -0
- package/dist/types/libraries/mongo/models/embedded/line-item-attribute.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/marketing-cut.model.d.ts +46 -0
- package/dist/types/libraries/mongo/models/embedded/marketing-cut.model.js +178 -0
- package/dist/types/libraries/mongo/models/embedded/marketing-cut.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/order-cancel.model.d.ts +26 -0
- package/dist/types/libraries/mongo/models/embedded/order-cancel.model.js +110 -0
- package/dist/types/libraries/mongo/models/embedded/order-cancel.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/order-delivery-information.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/embedded/order-delivery-information.model.js +67 -0
- package/dist/types/libraries/mongo/models/embedded/order-delivery-information.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/order-finance.model.d.ts +18 -0
- package/dist/types/libraries/mongo/models/embedded/order-finance.model.js +64 -0
- package/dist/types/libraries/mongo/models/embedded/order-finance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/order-pricing.model.d.ts +34 -0
- package/dist/types/libraries/mongo/models/embedded/order-pricing.model.js +163 -0
- package/dist/types/libraries/mongo/models/embedded/order-pricing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/order-refund.model.d.ts +28 -0
- package/dist/types/libraries/mongo/models/embedded/order-refund.model.js +113 -0
- package/dist/types/libraries/mongo/models/embedded/order-refund.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/otp-fields.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/embedded/otp-fields.model.js +46 -0
- package/dist/types/libraries/mongo/models/embedded/otp-fields.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/package.model.d.ts +25 -0
- package/dist/types/libraries/mongo/models/embedded/package.model.js +86 -0
- package/dist/types/libraries/mongo/models/embedded/package.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/parent-document.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/parent-document.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/parent-document.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/payment-infromation.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/embedded/payment-infromation.model.js +38 -0
- package/dist/types/libraries/mongo/models/embedded/payment-infromation.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/payment-record.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/embedded/payment-record.model.js +53 -0
- package/dist/types/libraries/mongo/models/embedded/payment-record.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/payout-setting.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/payout-setting.model.js +28 -0
- package/dist/types/libraries/mongo/models/embedded/payout-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/plus-settings.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/embedded/plus-settings.model.js +33 -0
- package/dist/types/libraries/mongo/models/embedded/plus-settings.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/preparing-time.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/preparing-time.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/preparing-time.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/price-breakdown.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/embedded/price-breakdown.model.js +80 -0
- package/dist/types/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/product-category.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/product-category.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/product-category.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/product-marketing-info.model.d.ts +17 -0
- package/dist/types/libraries/mongo/models/embedded/product-marketing-info.model.js +72 -0
- package/dist/types/libraries/mongo/models/embedded/product-marketing-info.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/product-nutrition.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/product-nutrition.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/product-search-fields.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/embedded/product-search-fields.model.js +60 -0
- package/dist/types/libraries/mongo/models/embedded/product-search-fields.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/product-snap.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/embedded/product-snap.model.js +79 -0
- package/dist/types/libraries/mongo/models/embedded/product-snap.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/profit.model.d.ts +22 -0
- package/dist/types/libraries/mongo/models/embedded/profit.model.js +96 -0
- package/dist/types/libraries/mongo/models/embedded/profit.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/referral-discount-config.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/embedded/referral-discount-config.model.js +38 -0
- package/dist/types/libraries/mongo/models/embedded/referral-discount-config.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/regular-order-finance.model.d.ts +18 -0
- package/dist/types/libraries/mongo/models/embedded/regular-order-finance.model.js +73 -0
- package/dist/types/libraries/mongo/models/embedded/regular-order-finance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/replacement-order.model.d.ts +28 -0
- package/dist/types/libraries/mongo/models/embedded/replacement-order.model.js +109 -0
- package/dist/types/libraries/mongo/models/embedded/replacement-order.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/rest-password.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/rest-password.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/rest-password.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/rider-assignment-model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/embedded/rider-assignment-model.js +44 -0
- package/dist/types/libraries/mongo/models/embedded/rider-assignment-model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/rider-batches.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/rider-batches.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/rider-batches.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/rider-equipment.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/rider-equipment.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/rider-equipment.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/rider-setting.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/embedded/rider-setting.model.js +47 -0
- package/dist/types/libraries/mongo/models/embedded/rider-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/rider-statistics.d.ts +11 -0
- package/dist/types/libraries/mongo/models/embedded/rider-statistics.js +62 -0
- package/dist/types/libraries/mongo/models/embedded/rider-statistics.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-cancellation-details.model.d.ts +18 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-cancellation-details.model.js +77 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-cancellation-details.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-finance.model.d.ts +23 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-finance.model.js +85 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-finance.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-pricing.model.d.ts +24 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-pricing.model.js +127 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-pricing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-refund-information.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-refund-information.model.js +70 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-refund-information.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-replacement-information.model.d.ts +19 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-replacement-information.model.js +76 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-replacement-information.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-settings.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-settings.model.js +57 -0
- package/dist/types/libraries/mongo/models/embedded/service-booking-settings.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-fee-setting.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/service-fee-setting.model.js +28 -0
- package/dist/types/libraries/mongo/models/embedded/service-fee-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/service-line-item.model.d.ts +38 -0
- package/dist/types/libraries/mongo/models/embedded/service-line-item.model.js +154 -0
- package/dist/types/libraries/mongo/models/embedded/service-line-item.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/shop-company-details.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/shop-company-details.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/shop-company-details.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/shop-default-category.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/embedded/shop-default-category.model.js +47 -0
- package/dist/types/libraries/mongo/models/embedded/shop-default-category.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/shop-document.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/embedded/shop-document.model.js +37 -0
- package/dist/types/libraries/mongo/models/embedded/shop-document.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/shop-search-fields.model.d.ts +15 -0
- package/dist/types/libraries/mongo/models/embedded/shop-search-fields.model.js +75 -0
- package/dist/types/libraries/mongo/models/embedded/shop-search-fields.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/spend-to-get-tier.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/embedded/spend-to-get-tier.model.js +43 -0
- package/dist/types/libraries/mongo/models/embedded/spend-to-get-tier.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/status-timeline.model.d.ts +25 -0
- package/dist/types/libraries/mongo/models/embedded/status-timeline.model.js +97 -0
- package/dist/types/libraries/mongo/models/embedded/status-timeline.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/subscription-summary.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/embedded/subscription-summary.model.js +47 -0
- package/dist/types/libraries/mongo/models/embedded/subscription-summary.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/support-reason-info.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/embedded/support-reason-info.model.js +27 -0
- package/dist/types/libraries/mongo/models/embedded/support-reason-info.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/trip-leg.mode.d.ts +28 -0
- package/dist/types/libraries/mongo/models/embedded/trip-leg.mode.js +134 -0
- package/dist/types/libraries/mongo/models/embedded/trip-leg.mode.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/vat.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/vat.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/vat.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/wallet.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/wallet.model.js +32 -0
- package/dist/types/libraries/mongo/models/embedded/wallet.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/embedded/zone-geometry.mode.d.ts +5 -0
- package/dist/types/libraries/mongo/models/embedded/zone-geometry.mode.js +28 -0
- package/dist/types/libraries/mongo/models/embedded/zone-geometry.mode.js.map +1 -0
- package/dist/types/libraries/mongo/models/favourite.model.d.ts +14 -0
- package/dist/types/libraries/mongo/models/favourite.model.js +52 -0
- package/dist/types/libraries/mongo/models/favourite.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/featured-setting.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/featured-setting.model.js +33 -0
- package/dist/types/libraries/mongo/models/featured-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/filter-container.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/filter-container.model.js +63 -0
- package/dist/types/libraries/mongo/models/filter-container.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/finance-settlement.model.d.ts +41 -0
- package/dist/types/libraries/mongo/models/finance-settlement.model.js +175 -0
- package/dist/types/libraries/mongo/models/finance-settlement.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/flag.model.d.ts +22 -0
- package/dist/types/libraries/mongo/models/flag.model.js +83 -0
- package/dist/types/libraries/mongo/models/flag.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/gallery-upload.model.d.ts +17 -0
- package/dist/types/libraries/mongo/models/gallery-upload.model.js +77 -0
- package/dist/types/libraries/mongo/models/gallery-upload.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/gallery.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/gallery.model.js +59 -0
- package/dist/types/libraries/mongo/models/gallery.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/google-maps-usage.model.d.ts +21 -0
- package/dist/types/libraries/mongo/models/google-maps-usage.model.js +255 -0
- package/dist/types/libraries/mongo/models/google-maps-usage.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/index.d.ts +395 -0
- package/dist/types/libraries/mongo/models/index.js +485 -0
- package/dist/types/libraries/mongo/models/index.js.map +1 -0
- package/dist/types/libraries/mongo/models/integration-configuration.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/integration-configuration.model.js +33 -0
- package/dist/types/libraries/mongo/models/integration-configuration.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-campaign-session.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-campaign-session.model.js +45 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-campaign-session.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-campaign.model.d.ts +14 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-campaign.model.js +76 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-campaign.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-config.d.ts +6 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-config.js +36 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-config.js.map +1 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-participant.model.d.ts +22 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-participant.model.js +96 -0
- package/dist/types/libraries/mongo/models/limited-time-offer-participant.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/line-item.model.d.ts +47 -0
- package/dist/types/libraries/mongo/models/line-item.model.js +205 -0
- package/dist/types/libraries/mongo/models/line-item.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/list-container.model.d.ts +19 -0
- package/dist/types/libraries/mongo/models/list-container.model.js +92 -0
- package/dist/types/libraries/mongo/models/list-container.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/log.model.d.ts +35 -0
- package/dist/types/libraries/mongo/models/log.model.js +163 -0
- package/dist/types/libraries/mongo/models/log.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/marketing.model.d.ts +18 -0
- package/dist/types/libraries/mongo/models/marketing.model.js +88 -0
- package/dist/types/libraries/mongo/models/marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/meal-plan.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/meal-plan.model.js +51 -0
- package/dist/types/libraries/mongo/models/meal-plan.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/message.model.d.ts +25 -0
- package/dist/types/libraries/mongo/models/message.model.js +105 -0
- package/dist/types/libraries/mongo/models/message.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/notification.model.d.ts +53 -0
- package/dist/types/libraries/mongo/models/notification.model.js +201 -0
- package/dist/types/libraries/mongo/models/notification.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/nutrition.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/nutrition.model.js +33 -0
- package/dist/types/libraries/mongo/models/nutrition.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/order.model.d.ts +66 -0
- package/dist/types/libraries/mongo/models/order.model.js +350 -0
- package/dist/types/libraries/mongo/models/order.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/parent.model.d.ts +29 -0
- package/dist/types/libraries/mongo/models/parent.model.js +144 -0
- package/dist/types/libraries/mongo/models/parent.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/payment-configuration.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/payment-configuration.model.js +33 -0
- package/dist/types/libraries/mongo/models/payment-configuration.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/payment-intent.model.d.ts +17 -0
- package/dist/types/libraries/mongo/models/payment-intent.model.js +79 -0
- package/dist/types/libraries/mongo/models/payment-intent.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/payout.model.d.ts +15 -0
- package/dist/types/libraries/mongo/models/payout.model.js +86 -0
- package/dist/types/libraries/mongo/models/payout.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/product-brand.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/product-brand.model.js +38 -0
- package/dist/types/libraries/mongo/models/product-brand.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/product-marketing.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/product-marketing.model.js +57 -0
- package/dist/types/libraries/mongo/models/product-marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/product-stock-tracker.model.d.ts +15 -0
- package/dist/types/libraries/mongo/models/product-stock-tracker.model.js +57 -0
- package/dist/types/libraries/mongo/models/product-stock-tracker.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/product-upload.model.d.ts +25 -0
- package/dist/types/libraries/mongo/models/product-upload.model.js +105 -0
- package/dist/types/libraries/mongo/models/product-upload.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/product.model.d.ts +63 -0
- package/dist/types/libraries/mongo/models/product.model.js +339 -0
- package/dist/types/libraries/mongo/models/product.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/professional-blocked-time.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/professional-blocked-time.model.js +49 -0
- package/dist/types/libraries/mongo/models/professional-blocked-time.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/professional.model.d.ts +17 -0
- package/dist/types/libraries/mongo/models/professional.model.js +91 -0
- package/dist/types/libraries/mongo/models/professional.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/buy1-get1-marketing.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/providers/buy1-get1-marketing.model.js +62 -0
- package/dist/types/libraries/mongo/models/providers/buy1-get1-marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/core-apple-auth-identity.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/providers/core-apple-auth-identity.model.js +28 -0
- package/dist/types/libraries/mongo/models/providers/core-apple-auth-identity.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/core-email-auth-identity.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/providers/core-email-auth-identity.model.js +69 -0
- package/dist/types/libraries/mongo/models/providers/core-email-auth-identity.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/core-google-auth-identity.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/providers/core-google-auth-identity.model.js +28 -0
- package/dist/types/libraries/mongo/models/providers/core-google-auth-identity.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/core-phone-auth-identity.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/providers/core-phone-auth-identity.model.js +29 -0
- package/dist/types/libraries/mongo/models/providers/core-phone-auth-identity.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/courier-order.model.d.ts +41 -0
- package/dist/types/libraries/mongo/models/providers/courier-order.model.js +151 -0
- package/dist/types/libraries/mongo/models/providers/courier-order.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/custom-coupon.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/providers/custom-coupon.model.js +43 -0
- package/dist/types/libraries/mongo/models/providers/custom-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/discount-marketing.model.d.ts +22 -0
- package/dist/types/libraries/mongo/models/providers/discount-marketing.model.js +92 -0
- package/dist/types/libraries/mongo/models/providers/discount-marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/featured-marketing.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/providers/featured-marketing.model.js +25 -0
- package/dist/types/libraries/mongo/models/providers/featured-marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/free-delivery-marketing.model.d.ts +7 -0
- package/dist/types/libraries/mongo/models/providers/free-delivery-marketing.model.js +30 -0
- package/dist/types/libraries/mongo/models/providers/free-delivery-marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/global-coupon.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/providers/global-coupon.model.js +10 -0
- package/dist/types/libraries/mongo/models/providers/global-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/individual-store-coupon.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/providers/individual-store-coupon.model.js +42 -0
- package/dist/types/libraries/mongo/models/providers/individual-store-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/individual-user-coupon.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/providers/individual-user-coupon.model.js +43 -0
- package/dist/types/libraries/mongo/models/providers/individual-user-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/punch-marketing.model.d.ts +11 -0
- package/dist/types/libraries/mongo/models/providers/punch-marketing.model.js +50 -0
- package/dist/types/libraries/mongo/models/providers/punch-marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/referral-code-coupon.model.d.ts +9 -0
- package/dist/types/libraries/mongo/models/providers/referral-code-coupon.model.js +27 -0
- package/dist/types/libraries/mongo/models/providers/referral-code-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/referral-reward-coupon.model.d.ts +11 -0
- package/dist/types/libraries/mongo/models/providers/referral-reward-coupon.model.js +37 -0
- package/dist/types/libraries/mongo/models/providers/referral-reward-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/regular-order.model.d.ts +54 -0
- package/dist/types/libraries/mongo/models/providers/regular-order.model.js +204 -0
- package/dist/types/libraries/mongo/models/providers/regular-order.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/rider-payout.model.d.ts +23 -0
- package/dist/types/libraries/mongo/models/providers/rider-payout.model.js +94 -0
- package/dist/types/libraries/mongo/models/providers/rider-payout.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/rider-review.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/providers/rider-review.model.js +32 -0
- package/dist/types/libraries/mongo/models/providers/rider-review.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/service-package-review.model.d.ts +14 -0
- package/dist/types/libraries/mongo/models/providers/service-package-review.model.js +44 -0
- package/dist/types/libraries/mongo/models/providers/service-package-review.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/shop-courier.model.d.ts +26 -0
- package/dist/types/libraries/mongo/models/providers/shop-courier.model.js +93 -0
- package/dist/types/libraries/mongo/models/providers/shop-courier.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/shop-payout.model.d.ts +62 -0
- package/dist/types/libraries/mongo/models/providers/shop-payout.model.js +244 -0
- package/dist/types/libraries/mongo/models/providers/shop-payout.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/shop-review.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/providers/shop-review.model.js +38 -0
- package/dist/types/libraries/mongo/models/providers/shop-review.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/shops-categories-coupon.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/providers/shops-categories-coupon.model.js +47 -0
- package/dist/types/libraries/mongo/models/providers/shops-categories-coupon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/spend-to-get-marketing.model.d.ts +11 -0
- package/dist/types/libraries/mongo/models/providers/spend-to-get-marketing.model.js +46 -0
- package/dist/types/libraries/mongo/models/providers/spend-to-get-marketing.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/vendor-payout.model.d.ts +50 -0
- package/dist/types/libraries/mongo/models/providers/vendor-payout.model.js +192 -0
- package/dist/types/libraries/mongo/models/providers/vendor-payout.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/providers/vendor-review.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/providers/vendor-review.model.js +38 -0
- package/dist/types/libraries/mongo/models/providers/vendor-review.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/punch-marketing-history.model.d.ts +24 -0
- package/dist/types/libraries/mongo/models/punch-marketing-history.model.js +101 -0
- package/dist/types/libraries/mongo/models/punch-marketing-history.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/rating-setting.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/rating-setting.model.js +46 -0
- package/dist/types/libraries/mongo/models/rating-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/referral-setting.model.d.ts +6 -0
- package/dist/types/libraries/mongo/models/referral-setting.model.js +32 -0
- package/dist/types/libraries/mongo/models/referral-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/request-area.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/request-area.model.js +33 -0
- package/dist/types/libraries/mongo/models/request-area.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/review.model.d.ts +15 -0
- package/dist/types/libraries/mongo/models/review.model.js +68 -0
- package/dist/types/libraries/mongo/models/review.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/reward.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/reward.model.js +70 -0
- package/dist/types/libraries/mongo/models/reward.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/rider-timeout.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/rider-timeout.model.js +47 -0
- package/dist/types/libraries/mongo/models/rider-timeout.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/rider-tracking.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/rider-tracking.model.js +47 -0
- package/dist/types/libraries/mongo/models/rider-tracking.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/rider.model.d.ts +70 -0
- package/dist/types/libraries/mongo/models/rider.model.js +358 -0
- package/dist/types/libraries/mongo/models/rider.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-addon.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/service-addon.model.js +86 -0
- package/dist/types/libraries/mongo/models/service-addon.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-booking.model.d.ts +68 -0
- package/dist/types/libraries/mongo/models/service-booking.model.js +310 -0
- package/dist/types/libraries/mongo/models/service-booking.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-cart.model.d.ts +14 -0
- package/dist/types/libraries/mongo/models/service-cart.model.js +51 -0
- package/dist/types/libraries/mongo/models/service-cart.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-category.model.d.ts +14 -0
- package/dist/types/libraries/mongo/models/service-category.model.js +87 -0
- package/dist/types/libraries/mongo/models/service-category.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-control.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/service-control.model.js +50 -0
- package/dist/types/libraries/mongo/models/service-control.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-flag.model.d.ts +19 -0
- package/dist/types/libraries/mongo/models/service-flag.model.js +72 -0
- package/dist/types/libraries/mongo/models/service-flag.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-package.model.d.ts +27 -0
- package/dist/types/libraries/mongo/models/service-package.model.js +142 -0
- package/dist/types/libraries/mongo/models/service-package.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service-promotion.model.d.ts +27 -0
- package/dist/types/libraries/mongo/models/service-promotion.model.js +120 -0
- package/dist/types/libraries/mongo/models/service-promotion.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/service.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/service.model.js +43 -0
- package/dist/types/libraries/mongo/models/service.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/setting.model.d.ts +51 -0
- package/dist/types/libraries/mongo/models/setting.model.js +201 -0
- package/dist/types/libraries/mongo/models/setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shared/address.model.d.ts +38 -0
- package/dist/types/libraries/mongo/models/shared/address.model.js +158 -0
- package/dist/types/libraries/mongo/models/shared/address.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shared/duration.model.d.ts +14 -0
- package/dist/types/libraries/mongo/models/shared/duration.model.js +59 -0
- package/dist/types/libraries/mongo/models/shared/duration.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shared/geo-location.model.d.ts +5 -0
- package/dist/types/libraries/mongo/models/shared/geo-location.model.js +28 -0
- package/dist/types/libraries/mongo/models/shared/geo-location.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shared/work-hour.model.d.ts +19 -0
- package/dist/types/libraries/mongo/models/shared/work-hour.model.js +81 -0
- package/dist/types/libraries/mongo/models/shared/work-hour.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shop-access-control.model.d.ts +16 -0
- package/dist/types/libraries/mongo/models/shop-access-control.model.js +81 -0
- package/dist/types/libraries/mongo/models/shop-access-control.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shop-category.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/shop-category.model.js +64 -0
- package/dist/types/libraries/mongo/models/shop-category.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shop-meal-plan.model.d.ts +12 -0
- package/dist/types/libraries/mongo/models/shop-meal-plan.model.js +45 -0
- package/dist/types/libraries/mongo/models/shop-meal-plan.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shop-section.model.d.ts +18 -0
- package/dist/types/libraries/mongo/models/shop-section.model.js +89 -0
- package/dist/types/libraries/mongo/models/shop-section.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/shop.model.d.ts +65 -0
- package/dist/types/libraries/mongo/models/shop.model.js +304 -0
- package/dist/types/libraries/mongo/models/shop.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/spend-to-get-history.model.d.ts +13 -0
- package/dist/types/libraries/mongo/models/spend-to-get-history.model.js +51 -0
- package/dist/types/libraries/mongo/models/spend-to-get-history.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/subscription.model.d.ts +20 -0
- package/dist/types/libraries/mongo/models/subscription.model.js +93 -0
- package/dist/types/libraries/mongo/models/subscription.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/support-reason.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/support-reason.model.js +61 -0
- package/dist/types/libraries/mongo/models/support-reason.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/tag.model.d.ts +10 -0
- package/dist/types/libraries/mongo/models/tag.model.js +64 -0
- package/dist/types/libraries/mongo/models/tag.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/terms-and-conditions.model.d.ts +8 -0
- package/dist/types/libraries/mongo/models/terms-and-conditions.model.js +51 -0
- package/dist/types/libraries/mongo/models/terms-and-conditions.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/ticket-action.model.d.ts +4 -0
- package/dist/types/libraries/mongo/models/ticket-action.model.js +31 -0
- package/dist/types/libraries/mongo/models/ticket-action.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/ticket.model.d.ts +35 -0
- package/dist/types/libraries/mongo/models/ticket.model.js +144 -0
- package/dist/types/libraries/mongo/models/ticket.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/tournament-participant.model.d.ts +22 -0
- package/dist/types/libraries/mongo/models/tournament-participant.model.js +84 -0
- package/dist/types/libraries/mongo/models/tournament-participant.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/tournament.model.d.ts +65 -0
- package/dist/types/libraries/mongo/models/tournament.model.js +273 -0
- package/dist/types/libraries/mongo/models/tournament.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/user-action.model.d.ts +29 -0
- package/dist/types/libraries/mongo/models/user-action.model.js +113 -0
- package/dist/types/libraries/mongo/models/user-action.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/user-app-section-setting.model.d.ts +24 -0
- package/dist/types/libraries/mongo/models/user-app-section-setting.model.js +103 -0
- package/dist/types/libraries/mongo/models/user-app-section-setting.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/user.model.d.ts +39 -0
- package/dist/types/libraries/mongo/models/user.model.js +150 -0
- package/dist/types/libraries/mongo/models/user.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/vendor-access-control.model.d.ts +14 -0
- package/dist/types/libraries/mongo/models/vendor-access-control.model.js +75 -0
- package/dist/types/libraries/mongo/models/vendor-access-control.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/vendor-parent.model.d.ts +25 -0
- package/dist/types/libraries/mongo/models/vendor-parent.model.js +121 -0
- package/dist/types/libraries/mongo/models/vendor-parent.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/vendor.model.d.ts +33 -0
- package/dist/types/libraries/mongo/models/vendor.model.js +150 -0
- package/dist/types/libraries/mongo/models/vendor.model.js.map +1 -0
- package/dist/types/libraries/mongo/models/zone-extra-time.d.ts +12 -0
- package/dist/types/libraries/mongo/models/zone-extra-time.js +54 -0
- package/dist/types/libraries/mongo/models/zone-extra-time.js.map +1 -0
- package/dist/types/libraries/mongo/models/zone.model.d.ts +17 -0
- package/dist/types/libraries/mongo/models/zone.model.js +80 -0
- package/dist/types/libraries/mongo/models/zone.model.js.map +1 -0
- package/dist/types/libraries/mongo/plugins/normalize-field.plugin.d.ts +4 -0
- package/dist/types/libraries/mongo/plugins/normalize-field.plugin.js +42 -0
- package/dist/types/libraries/mongo/plugins/normalize-field.plugin.js.map +1 -0
- package/dist/types/libraries/mongo/plugins/soft-delete-plugin.d.ts +32 -0
- package/dist/types/libraries/mongo/plugins/soft-delete-plugin.js +145 -0
- package/dist/types/libraries/mongo/plugins/soft-delete-plugin.js.map +1 -0
- package/dist/types/libraries/mongo/utilities/shop.hooks.d.ts +9 -0
- package/dist/types/libraries/mongo/utilities/shop.hooks.js +11 -0
- package/dist/types/libraries/mongo/utilities/shop.hooks.js.map +1 -0
- package/dist/types/libraries/mongo/utilities/sorting-order.hooks.d.ts +14 -0
- package/dist/types/libraries/mongo/utilities/sorting-order.hooks.js +58 -0
- package/dist/types/libraries/mongo/utilities/sorting-order.hooks.js.map +1 -0
- package/dist/types/libraries/mongo/utilities/unique-id.hooks.d.ts +6 -0
- package/dist/types/libraries/mongo/utilities/unique-id.hooks.js +17 -0
- package/dist/types/libraries/mongo/utilities/unique-id.hooks.js.map +1 -0
- package/dist/types/libraries/notification/firebase-fcm.service.d.ts +7 -0
- package/dist/types/libraries/notification/firebase-fcm.service.js +40 -0
- package/dist/types/libraries/notification/firebase-fcm.service.js.map +1 -0
- package/dist/types/libraries/notification/firebase-message.builder.d.ts +22 -0
- package/dist/types/libraries/notification/firebase-message.builder.js +107 -0
- package/dist/types/libraries/notification/firebase-message.builder.js.map +1 -0
- package/dist/types/libraries/notification/lyxa-fcm-sender.d.ts +19 -0
- package/dist/types/libraries/notification/lyxa-fcm-sender.js +127 -0
- package/dist/types/libraries/notification/lyxa-fcm-sender.js.map +1 -0
- package/dist/types/libraries/notification/lyxa-fcm.service.d.ts +40 -0
- package/dist/types/libraries/notification/lyxa-fcm.service.js +177 -0
- package/dist/types/libraries/notification/lyxa-fcm.service.js.map +1 -0
- package/dist/types/libraries/redis/index.d.ts +25 -0
- package/dist/types/libraries/redis/index.js +137 -0
- package/dist/types/libraries/redis/index.js.map +1 -0
- package/dist/types/libraries/secrets/index.d.ts +10 -0
- package/dist/types/libraries/secrets/index.js +64 -0
- package/dist/types/libraries/secrets/index.js.map +1 -0
- package/dist/types/libraries/socket/BaseSocketEvent.d.ts +27 -0
- package/dist/types/libraries/socket/BaseSocketEvent.js +47 -0
- package/dist/types/libraries/socket/BaseSocketEvent.js.map +1 -0
- package/dist/types/libraries/socket/PushNotificationEvent.d.ts +36 -0
- package/dist/types/libraries/socket/PushNotificationEvent.js +45 -0
- package/dist/types/libraries/socket/PushNotificationEvent.js.map +1 -0
- package/dist/types/libraries/socket/connections/batch.d.ts +12 -0
- package/dist/types/libraries/socket/connections/batch.js +58 -0
- package/dist/types/libraries/socket/connections/batch.js.map +1 -0
- package/dist/types/libraries/socket/connections/cache.d.ts +9 -0
- package/dist/types/libraries/socket/connections/cache.js +36 -0
- package/dist/types/libraries/socket/connections/cache.js.map +1 -0
- package/dist/types/libraries/socket/connections/constants.d.ts +2 -0
- package/dist/types/libraries/socket/connections/constants.js +6 -0
- package/dist/types/libraries/socket/connections/constants.js.map +1 -0
- package/dist/types/libraries/socket/connections/index.d.ts +7 -0
- package/dist/types/libraries/socket/connections/index.js +24 -0
- package/dist/types/libraries/socket/connections/index.js.map +1 -0
- package/dist/types/libraries/socket/connections/instance-disconnect.d.ts +2 -0
- package/dist/types/libraries/socket/connections/instance-disconnect.js +43 -0
- package/dist/types/libraries/socket/connections/instance-disconnect.js.map +1 -0
- package/dist/types/libraries/socket/connections/keys.d.ts +10 -0
- package/dist/types/libraries/socket/connections/keys.js +23 -0
- package/dist/types/libraries/socket/connections/keys.js.map +1 -0
- package/dist/types/libraries/socket/connections/presence.d.ts +6 -0
- package/dist/types/libraries/socket/connections/presence.js +39 -0
- package/dist/types/libraries/socket/connections/presence.js.map +1 -0
- package/dist/types/libraries/socket/connections/redis-helpers.d.ts +2 -0
- package/dist/types/libraries/socket/connections/redis-helpers.js +14 -0
- package/dist/types/libraries/socket/connections/redis-helpers.js.map +1 -0
- package/dist/types/libraries/socket/connections/subscription.d.ts +13 -0
- package/dist/types/libraries/socket/connections/subscription.js +73 -0
- package/dist/types/libraries/socket/connections/subscription.js.map +1 -0
- package/dist/types/libraries/socket/core/index.d.ts +6 -0
- package/dist/types/libraries/socket/core/index.js +23 -0
- package/dist/types/libraries/socket/core/index.js.map +1 -0
- package/dist/types/libraries/socket/core/local-subscription-registry.d.ts +17 -0
- package/dist/types/libraries/socket/core/local-subscription-registry.js +60 -0
- package/dist/types/libraries/socket/core/local-subscription-registry.js.map +1 -0
- package/dist/types/libraries/socket/core/socket-event-consumer.d.ts +1 -0
- package/dist/types/libraries/socket/core/socket-event-consumer.js +14 -0
- package/dist/types/libraries/socket/core/socket-event-consumer.js.map +1 -0
- package/dist/types/libraries/socket/core/socket-event-publisher.d.ts +6 -0
- package/dist/types/libraries/socket/core/socket-event-publisher.js +82 -0
- package/dist/types/libraries/socket/core/socket-event-publisher.js.map +1 -0
- package/dist/types/libraries/socket/core/socket-event-registry.d.ts +12 -0
- package/dist/types/libraries/socket/core/socket-event-registry.js +23 -0
- package/dist/types/libraries/socket/core/socket-event-registry.js.map +1 -0
- package/dist/types/libraries/socket/core/socket-event-registry.map.d.ts +34 -0
- package/dist/types/libraries/socket/core/socket-event-registry.map.js +34 -0
- package/dist/types/libraries/socket/core/socket-event-registry.map.js.map +1 -0
- package/dist/types/libraries/socket/core/zAsyncIterable.d.ts +7 -0
- package/dist/types/libraries/socket/core/zAsyncIterable.js +35 -0
- package/dist/types/libraries/socket/core/zAsyncIterable.js.map +1 -0
- package/dist/types/libraries/socket/events/chatlist-message-send.socket.event.d.ts +153 -0
- package/dist/types/libraries/socket/events/chatlist-message-send.socket.event.js +44 -0
- package/dist/types/libraries/socket/events/chatlist-message-send.socket.event.js.map +1 -0
- package/dist/types/libraries/socket/events/chatroom-message-send.socket.event.d.ts +286 -0
- package/dist/types/libraries/socket/events/chatroom-message-send.socket.event.js +96 -0
- package/dist/types/libraries/socket/events/chatroom-message-send.socket.event.js.map +1 -0
- package/dist/types/libraries/socket/events/index.d.ts +7 -0
- package/dist/types/libraries/socket/events/index.js +24 -0
- package/dist/types/libraries/socket/events/index.js.map +1 -0
- package/dist/types/libraries/socket/events/order-actions.socket.event.d.ts +297 -0
- package/dist/types/libraries/socket/events/order-actions.socket.event.js +82 -0
- package/dist/types/libraries/socket/events/order-actions.socket.event.js.map +1 -0
- package/dist/types/libraries/socket/events/rider-connect.socket.event.d.ts +13 -0
- package/dist/types/libraries/socket/events/rider-connect.socket.event.js +22 -0
- package/dist/types/libraries/socket/events/rider-connect.socket.event.js.map +1 -0
- package/dist/types/libraries/socket/events/rider-location-update.socket.event.d.ts +76 -0
- package/dist/types/libraries/socket/events/rider-location-update.socket.event.js +39 -0
- package/dist/types/libraries/socket/events/rider-location-update.socket.event.js.map +1 -0
- package/dist/types/libraries/socket/events/socketNotificationEvent.d.ts +46 -0
- package/dist/types/libraries/socket/events/socketNotificationEvent.js +29 -0
- package/dist/types/libraries/socket/events/socketNotificationEvent.js.map +1 -0
- package/dist/types/libraries/socket/events/ticket-actions.socket.event.d.ts +106 -0
- package/dist/types/libraries/socket/events/ticket-actions.socket.event.js +62 -0
- package/dist/types/libraries/socket/events/ticket-actions.socket.event.js.map +1 -0
- package/dist/types/libraries/socket/events/ticket-assign.socket.event.d.ts +161 -0
- package/dist/types/libraries/socket/events/ticket-assign.socket.event.js +42 -0
- package/dist/types/libraries/socket/events/ticket-assign.socket.event.js.map +1 -0
- package/dist/types/libraries/socket/events/ticket-unassign.socket.event.d.ts +27 -0
- package/dist/types/libraries/socket/events/ticket-unassign.socket.event.js +31 -0
- package/dist/types/libraries/socket/events/ticket-unassign.socket.event.js.map +1 -0
- package/dist/types/libraries/trpc/context.d.ts +37 -0
- package/dist/types/libraries/trpc/context.js +43 -0
- package/dist/types/libraries/trpc/context.js.map +1 -0
- package/dist/types/libraries/trpc/index.d.ts +75 -0
- package/dist/types/libraries/trpc/index.js +80 -0
- package/dist/types/libraries/trpc/index.js.map +1 -0
- package/dist/types/libraries/twilio/index.d.ts +6 -0
- package/dist/types/libraries/twilio/index.js +42 -0
- package/dist/types/libraries/twilio/index.js.map +1 -0
- package/dist/types/libraries/upload/index.d.ts +50 -0
- package/dist/types/libraries/upload/index.js +312 -0
- package/dist/types/libraries/upload/index.js.map +1 -0
- package/dist/types/package.json +1 -1
- package/dist/types/utilities/auth-ref.mapper.d.ts +4 -0
- package/dist/types/utilities/auth-ref.mapper.js +22 -0
- package/dist/types/utilities/auth-ref.mapper.js.map +1 -0
- package/dist/types/utilities/dayjs/dayjs.d.ts +14 -0
- package/dist/types/utilities/dayjs/dayjs.js +47 -0
- package/dist/types/utilities/dayjs/dayjs.js.map +1 -0
- package/dist/types/utilities/dayjs/index.d.ts +2 -0
- package/dist/types/utilities/dayjs/index.js +9 -0
- package/dist/types/utilities/dayjs/index.js.map +1 -0
- package/dist/types/utilities/environment/rabbitmq-environments.d.ts +2 -0
- package/dist/types/utilities/environment/rabbitmq-environments.js +14 -0
- package/dist/types/utilities/environment/rabbitmq-environments.js.map +1 -0
- package/dist/types/utilities/environment/redis-environments.d.ts +2 -0
- package/dist/types/utilities/environment/redis-environments.js +14 -0
- package/dist/types/utilities/environment/redis-environments.js.map +1 -0
- package/dist/types/utilities/error-common.d.ts +10 -0
- package/dist/types/utilities/error-common.js +76 -0
- package/dist/types/utilities/error-common.js.map +1 -0
- package/dist/types/utilities/id-generator.d.ts +6 -0
- package/dist/types/utilities/id-generator.js +161 -0
- package/dist/types/utilities/id-generator.js.map +1 -0
- package/dist/types/utilities/instance.utils.d.ts +1 -0
- package/dist/types/utilities/instance.utils.js +12 -0
- package/dist/types/utilities/instance.utils.js.map +1 -0
- package/dist/types/utilities/normalize.d.ts +6 -0
- package/dist/types/utilities/normalize.js +51 -0
- package/dist/types/utilities/normalize.js.map +1 -0
- package/dist/types/utilities/password.d.ts +2 -0
- package/dist/types/utilities/password.js +20 -0
- package/dist/types/utilities/password.js.map +1 -0
- package/dist/types/utilities/projection.d.ts +8 -0
- package/dist/types/utilities/projection.js +37 -0
- package/dist/types/utilities/projection.js.map +1 -0
- package/dist/types/utilities/time.d.ts +13 -0
- package/dist/types/utilities/time.js +128 -0
- package/dist/types/utilities/time.js.map +1 -0
- package/package.json +1 -5
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.disconnectAllEntitiesFromInstance = disconnectAllEntitiesFromInstance;
|
|
4
|
+
const instance_utils_1 = require("../../../utilities/instance.utils");
|
|
5
|
+
const __1 = require("../../..");
|
|
6
|
+
const keys_1 = require("./keys");
|
|
7
|
+
const redis_helpers_1 = require("./redis-helpers");
|
|
8
|
+
async function disconnectAllEntitiesFromInstance(entityType) {
|
|
9
|
+
const instanceId = (0, instance_utils_1.getInstanceId)();
|
|
10
|
+
const redis = (0, __1.getLibraries)().getRedisService();
|
|
11
|
+
const pattern = entityType
|
|
12
|
+
? `socket:active_subscriptions:${entityType}:*`
|
|
13
|
+
: 'socket:active_subscriptions:*';
|
|
14
|
+
const ledgerKeys = await (0, redis_helpers_1.scanKeys)(redis.redisClient, pattern);
|
|
15
|
+
const affectedEvents = new Set();
|
|
16
|
+
await Promise.all(ledgerKeys.map(async (ledgerKey) => {
|
|
17
|
+
const [, , type, id] = ledgerKey.split(':');
|
|
18
|
+
const entity = {
|
|
19
|
+
id,
|
|
20
|
+
type: type === 'default' ? undefined : type,
|
|
21
|
+
};
|
|
22
|
+
const eventKeys = await redis.getSetMembers(ledgerKey);
|
|
23
|
+
const pipeline = redis.redisClient.pipeline();
|
|
24
|
+
for (const eventKey of eventKeys) {
|
|
25
|
+
const entityEventKey = (0, keys_1.kEntityEventSockets)(entity, eventKey);
|
|
26
|
+
const sockets = await redis.getSetMembers(entityEventKey);
|
|
27
|
+
const toRemove = sockets.filter(s => {
|
|
28
|
+
const [sInstanceId] = s.split('|');
|
|
29
|
+
return sInstanceId === instanceId;
|
|
30
|
+
});
|
|
31
|
+
for (const s of toRemove) {
|
|
32
|
+
pipeline.srem(entityEventKey, s);
|
|
33
|
+
}
|
|
34
|
+
if (sockets.length - toRemove.length === 0) {
|
|
35
|
+
pipeline.del(entityEventKey);
|
|
36
|
+
pipeline.srem(ledgerKey, eventKey);
|
|
37
|
+
}
|
|
38
|
+
affectedEvents.add(eventKey);
|
|
39
|
+
}
|
|
40
|
+
await pipeline.exec();
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=instance-disconnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-disconnect.js","sourceRoot":"/","sources":["libraries/socket/connections/instance-disconnect.ts"],"names":[],"mappings":";;AAgBA,8EAqCC;AApDD,sEAAkE;AAClE,gCAAwC;AACxC,iCAA0F;AAC1F,mDAA2C;AAYpC,KAAK,UAAU,iCAAiC,CAAC,UAA2B;IAClF,MAAM,UAAU,GAAG,IAAA,8BAAa,GAAE,CAAC;IACnC,MAAM,KAAK,GAAG,IAAA,gBAAY,GAAE,CAAC,eAAe,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,UAAU;QACzB,CAAC,CAAC,+BAA+B,UAAU,IAAI;QAC/C,CAAC,CAAC,+BAA+B,CAAC;IACnC,MAAM,UAAU,GAAG,MAAM,IAAA,wBAAQ,EAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACzC,MAAM,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,SAAS,EAAC,EAAE;QAChC,MAAM,CAAC,EAAE,AAAD,EAAG,IAAI,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAuB;YAClC,EAAE;YACF,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAE,IAAuB;SAC/D,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YAClC,MAAM,cAAc,GAAG,IAAA,0BAAmB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC7D,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;YAE1D,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;gBACnC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnC,OAAO,WAAW,KAAK,UAAU,CAAC;YACnC,CAAC,CAAC,CAAC;YACH,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;gBAC1B,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;YAClC,CAAC;YACD,IAAI,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5C,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACpC,CAAC;YACD,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;QACD,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC,CAAC,CACF,CAAC;AACH,CAAC","sourcesContent":["// Instance disconnect logic for socket Redis\nimport { getInstanceId } from '../../../utilities/instance.utils';\nimport { getLibraries } from '../../..';\nimport { kEntityEvent, kEntityEventSockets, entityKey, EntitySubscription } from './keys';\nimport { scanKeys } from './redis-helpers';\nimport { AuthEntityType } from '../../auth';\nimport { LRUCache } from './cache';\n\n/**\n * Removes all sockets belonging to the current instance.\n * Used on shutdown or crash recovery.\n * Cleans entity-event keys, event subscribers, and ledgers in bulk.\n *\n * NOTE: This currently scans all ledgers (SCAN), which is acceptable for small/medium scale and infrequent use.\n * For very large scale or frequent shutdowns, consider maintaining a reverse index (instance → ledgers) to avoid SCAN entirely.\n */\nexport async function disconnectAllEntitiesFromInstance(entityType?: AuthEntityType) {\n\tconst instanceId = getInstanceId();\n\tconst redis = getLibraries().getRedisService();\n\tconst pattern = entityType\n\t\t? `socket:active_subscriptions:${entityType}:*`\n\t\t: 'socket:active_subscriptions:*';\n\tconst ledgerKeys = await scanKeys(redis.redisClient, pattern);\n\tconst affectedEvents = new Set<string>();\n\tawait Promise.all(\n\t\tledgerKeys.map(async ledgerKey => {\n\t\t\tconst [, , type, id] = ledgerKey.split(':');\n\t\t\tconst entity: EntitySubscription = {\n\t\t\t\tid,\n\t\t\t\ttype: type === 'default' ? undefined : (type as AuthEntityType),\n\t\t\t};\n\t\t\tconst eventKeys = await redis.getSetMembers(ledgerKey);\n\t\t\tconst pipeline = redis.redisClient.pipeline();\n\t\t\tfor (const eventKey of eventKeys) {\n\t\t\t\tconst entityEventKey = kEntityEventSockets(entity, eventKey);\n\t\t\t\tconst sockets = await redis.getSetMembers(entityEventKey);\n\t\t\t\t// Remove all sockets for this instance\n\t\t\t\tconst toRemove = sockets.filter(s => {\n\t\t\t\t\tconst [sInstanceId] = s.split('|');\n\t\t\t\t\treturn sInstanceId === instanceId;\n\t\t\t\t});\n\t\t\t\tfor (const s of toRemove) {\n\t\t\t\t\tpipeline.srem(entityEventKey, s);\n\t\t\t\t}\n\t\t\t\tif (sockets.length - toRemove.length === 0) {\n\t\t\t\t\tpipeline.del(entityEventKey);\n\t\t\t\t\tpipeline.srem(ledgerKey, eventKey);\n\t\t\t\t}\n\t\t\t\taffectedEvents.add(eventKey);\n\t\t\t}\n\t\t\tawait pipeline.exec();\n\t\t})\n\t);\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthEntityType } from '../../auth';
|
|
2
|
+
export type EntitySubscription = {
|
|
3
|
+
id: string;
|
|
4
|
+
type?: AuthEntityType;
|
|
5
|
+
};
|
|
6
|
+
export declare const entityKey: (entity: EntitySubscription) => string;
|
|
7
|
+
export declare const kEventEntity: (eventKey: string) => string;
|
|
8
|
+
export declare const kEntityEvent: (entity: EntitySubscription) => string;
|
|
9
|
+
export declare const kOnlineEntities: (type: AuthEntityType) => string;
|
|
10
|
+
export declare const kEntityEventSockets: (entity: EntitySubscription, eventKey: string) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kEntityEventSockets = exports.kOnlineEntities = exports.kEntityEvent = exports.kEventEntity = exports.entityKey = void 0;
|
|
4
|
+
const keyCache = new Map();
|
|
5
|
+
const entityKey = (entity) => {
|
|
6
|
+
const cacheKey = `${entity.type}:${entity.id}`;
|
|
7
|
+
let key = keyCache.get(cacheKey);
|
|
8
|
+
if (!key) {
|
|
9
|
+
key = `${entity.type ?? 'default'}:${entity.id}`;
|
|
10
|
+
keyCache.set(cacheKey, key);
|
|
11
|
+
}
|
|
12
|
+
return key;
|
|
13
|
+
};
|
|
14
|
+
exports.entityKey = entityKey;
|
|
15
|
+
const kEventEntity = (eventKey) => `socket:event:${eventKey}`;
|
|
16
|
+
exports.kEventEntity = kEventEntity;
|
|
17
|
+
const kEntityEvent = (entity) => `socket:subscriptions:${(0, exports.entityKey)(entity)}`;
|
|
18
|
+
exports.kEntityEvent = kEntityEvent;
|
|
19
|
+
const kOnlineEntities = (type) => `socket:online:${type}`;
|
|
20
|
+
exports.kOnlineEntities = kOnlineEntities;
|
|
21
|
+
const kEntityEventSockets = (entity, eventKey) => `socket:entity:${(0, exports.entityKey)(entity)}:${eventKey}`;
|
|
22
|
+
exports.kEntityEventSockets = kEntityEventSockets;
|
|
23
|
+
//# sourceMappingURL=keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"/","sources":["libraries/socket/connections/keys.ts"],"names":[],"mappings":";;;AAOA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEpC,MAAM,SAAS,GAAG,CAAC,MAA0B,EAAU,EAAE;IAC/D,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;IAC/C,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,GAAG,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI,SAAS,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;QACjD,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AARW,QAAA,SAAS,aAQpB;AAEK,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,gBAAgB,QAAQ,EAAE,CAAC;AAAhE,QAAA,YAAY,gBAAoD;AAEtE,MAAM,YAAY,GAAG,CAAC,MAA0B,EAAE,EAAE,CAAC,wBAAwB,IAAA,iBAAS,EAAC,MAAM,CAAC,EAAE,CAAC;AAA3F,QAAA,YAAY,gBAA+E;AAEjG,MAAM,eAAe,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,iBAAiB,IAAI,EAAE,CAAC;AAApE,QAAA,eAAe,mBAAqD;AAE1E,MAAM,mBAAmB,GAAG,CAAC,MAA0B,EAAE,QAAgB,EAAE,EAAE,CACnF,iBAAiB,IAAA,iBAAS,EAAC,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;AADrC,QAAA,mBAAmB,uBACkB","sourcesContent":["import { AuthEntityType } from '../../auth';\n\nexport type EntitySubscription = {\n\tid: string;\n\ttype?: AuthEntityType;\n};\n\nconst keyCache = new Map<string, string>();\n\nexport const entityKey = (entity: EntitySubscription): string => {\n\tconst cacheKey = `${entity.type}:${entity.id}`;\n\tlet key = keyCache.get(cacheKey);\n\tif (!key) {\n\t\tkey = `${entity.type ?? 'default'}:${entity.id}`;\n\t\tkeyCache.set(cacheKey, key);\n\t}\n\treturn key;\n};\n\nexport const kEventEntity = (eventKey: string) => `socket:event:${eventKey}`;\n\nexport const kEntityEvent = (entity: EntitySubscription) => `socket:subscriptions:${entityKey(entity)}`;\n\nexport const kOnlineEntities = (type: AuthEntityType) => `socket:online:${type}`;\n\nexport const kEntityEventSockets = (entity: EntitySubscription, eventKey: string) =>\n\t`socket:entity:${entityKey(entity)}:${eventKey}`;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AuthEntityType } from '../../auth';
|
|
2
|
+
export declare function setUserOnline(userId: string, type: AuthEntityType, timestamp?: number): Promise<void>;
|
|
3
|
+
export declare function setUserOffline(userId: string, type: AuthEntityType): Promise<void>;
|
|
4
|
+
export declare function getOnlineUsers(type: AuthEntityType, page?: number, pageSize?: number): Promise<string[]>;
|
|
5
|
+
export declare function getOnlineUsersCount(type: AuthEntityType, activeWindowMs?: number): Promise<number>;
|
|
6
|
+
export declare function isUserOnline(userId: string, type: AuthEntityType): Promise<boolean>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setUserOnline = setUserOnline;
|
|
4
|
+
exports.setUserOffline = setUserOffline;
|
|
5
|
+
exports.getOnlineUsers = getOnlineUsers;
|
|
6
|
+
exports.getOnlineUsersCount = getOnlineUsersCount;
|
|
7
|
+
exports.isUserOnline = isUserOnline;
|
|
8
|
+
const __1 = require("../../..");
|
|
9
|
+
const dayjs_1 = require("../../../utilities/dayjs");
|
|
10
|
+
const keys_1 = require("./keys");
|
|
11
|
+
async function setUserOnline(userId, type, timestamp = Date.now()) {
|
|
12
|
+
const redis = (0, __1.getLibraries)().getRedisService().redisClient;
|
|
13
|
+
await redis.zadd((0, keys_1.kOnlineEntities)(type), timestamp, userId);
|
|
14
|
+
}
|
|
15
|
+
async function setUserOffline(userId, type) {
|
|
16
|
+
const redis = (0, __1.getLibraries)().getRedisService().redisClient;
|
|
17
|
+
await redis.zrem((0, keys_1.kOnlineEntities)(type), userId);
|
|
18
|
+
}
|
|
19
|
+
async function getOnlineUsers(type, page = 1, pageSize = 100) {
|
|
20
|
+
const redis = (0, __1.getLibraries)().getRedisService().redisClient;
|
|
21
|
+
const zsetKey = (0, keys_1.kOnlineEntities)(type);
|
|
22
|
+
const start = (page - 1) * pageSize;
|
|
23
|
+
const end = start + pageSize - 1;
|
|
24
|
+
return await redis.zrange(zsetKey, start, end);
|
|
25
|
+
}
|
|
26
|
+
async function getOnlineUsersCount(type, activeWindowMs = 60000) {
|
|
27
|
+
const redis = (0, __1.getLibraries)().getRedisService().redisClient;
|
|
28
|
+
const zsetKey = (0, keys_1.kOnlineEntities)(type);
|
|
29
|
+
const now = (0, dayjs_1.dayjs)().valueOf();
|
|
30
|
+
const min = now - activeWindowMs;
|
|
31
|
+
await redis.zremrangebyscore(zsetKey, 0, min);
|
|
32
|
+
return await redis.zcount(zsetKey, min, now);
|
|
33
|
+
}
|
|
34
|
+
async function isUserOnline(userId, type) {
|
|
35
|
+
const redis = (0, __1.getLibraries)().getRedisService().redisClient;
|
|
36
|
+
const score = await redis.zscore((0, keys_1.kOnlineEntities)(type), userId);
|
|
37
|
+
return score !== null;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=presence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.js","sourceRoot":"/","sources":["libraries/socket/connections/presence.ts"],"names":[],"mappings":";;AASA,sCAGC;AAKD,wCAGC;AAKD,wCAUC;AAED,kDAaC;AAED,oCAIC;AAxDD,gCAAwC;AACxC,oDAAiD;AAEjD,iCAAyC;AAMlC,KAAK,UAAU,aAAa,CAAC,MAAc,EAAE,IAAoB,EAAE,YAAoB,IAAI,CAAC,GAAG,EAAE;IACvG,MAAM,KAAK,GAAG,IAAA,gBAAY,GAAE,CAAC,eAAe,EAAE,CAAC,WAAoB,CAAC;IACpE,MAAM,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC;AAKM,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,IAAoB;IACxE,MAAM,KAAK,GAAG,IAAA,gBAAY,GAAE,CAAC,eAAe,EAAE,CAAC,WAAoB,CAAC;IACpE,MAAM,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAKM,KAAK,UAAU,cAAc,CACnC,IAAoB,EACpB,OAAe,CAAC,EAChB,WAAmB,GAAG;IAEtB,MAAM,KAAK,GAAG,IAAA,gBAAY,GAAE,CAAC,eAAe,EAAE,CAAC,WAAoB,CAAC;IACpE,MAAM,OAAO,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IACpC,MAAM,GAAG,GAAG,KAAK,GAAG,QAAQ,GAAG,CAAC,CAAC;IACjC,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC;AAEM,KAAK,UAAU,mBAAmB,CACxC,IAAoB,EACpB,iBAAyB,KAAK;IAE9B,MAAM,KAAK,GAAG,IAAA,gBAAY,GAAE,CAAC,eAAe,EAAE,CAAC,WAAoB,CAAC;IACpE,MAAM,OAAO,GAAG,IAAA,sBAAe,EAAC,IAAI,CAAC,CAAC;IAEtC,MAAM,GAAG,GAAG,IAAA,aAAK,GAAE,CAAC,OAAO,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,GAAG,GAAG,cAAc,CAAC;IAEjC,MAAM,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAE9C,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,MAAc,EAAE,IAAoB;IACtE,MAAM,KAAK,GAAG,IAAA,gBAAY,GAAE,CAAC,eAAe,EAAE,CAAC,WAAoB,CAAC;IACpE,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAChE,OAAO,KAAK,KAAK,IAAI,CAAC;AACvB,CAAC","sourcesContent":["import { getLibraries } from '../../..';\nimport { dayjs } from '../../../utilities/dayjs';\nimport { AuthEntityType } from '../../auth';\nimport { kOnlineEntities } from './keys';\nimport type { Redis } from 'ioredis';\n\n/**\n * Add or update a user as online in the type-based ZSET.\n */\nexport async function setUserOnline(userId: string, type: AuthEntityType, timestamp: number = Date.now()) {\n\tconst redis = getLibraries().getRedisService().redisClient as Redis;\n\tawait redis.zadd(kOnlineEntities(type), timestamp, userId);\n}\n\n/**\n * Remove a user from the type-based online ZSET (on disconnect).\n */\nexport async function setUserOffline(userId: string, type: AuthEntityType) {\n\tconst redis = getLibraries().getRedisService().redisClient as Redis;\n\tawait redis.zrem(kOnlineEntities(type), userId);\n}\n\n/**\n * Paginate online users for a given entity type (deep pagination, scalable).\n */\nexport async function getOnlineUsers(\n\ttype: AuthEntityType,\n\tpage: number = 1,\n\tpageSize: number = 100\n): Promise<string[]> {\n\tconst redis = getLibraries().getRedisService().redisClient as Redis;\n\tconst zsetKey = kOnlineEntities(type);\n\tconst start = (page - 1) * pageSize;\n\tconst end = start + pageSize - 1;\n\treturn await redis.zrange(zsetKey, start, end);\n}\n\nexport async function getOnlineUsersCount(\n\ttype: AuthEntityType,\n\tactiveWindowMs: number = 60000\n): Promise<number> {\n\tconst redis = getLibraries().getRedisService().redisClient as Redis;\n\tconst zsetKey = kOnlineEntities(type);\n\n\tconst now = dayjs().valueOf();\n\tconst min = now - activeWindowMs;\n\n\tawait redis.zremrangebyscore(zsetKey, 0, min);\n\n\treturn await redis.zcount(zsetKey, min, now);\n}\n\nexport async function isUserOnline(userId: string, type: AuthEntityType): Promise<boolean> {\n\tconst redis = getLibraries().getRedisService().redisClient as Redis;\n\tconst score = await redis.zscore(kOnlineEntities(type), userId);\n\treturn score !== null;\n}\n\n/**\n * Example usage:\n *\n * import { getConnectedEntityByType } from './type-queries';\n *\n * // For entity type 'user', get page 2, 100 per page:\n * const users = await getConnectedEntityByType('user', 2, 100);\n */\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanKeys = scanKeys;
|
|
4
|
+
async function scanKeys(redis, pattern) {
|
|
5
|
+
const keys = [];
|
|
6
|
+
let cursor = '0';
|
|
7
|
+
do {
|
|
8
|
+
const [newCursor, foundKeys] = await redis.scan(cursor, 'MATCH', pattern, 'COUNT', 100);
|
|
9
|
+
cursor = newCursor;
|
|
10
|
+
keys.push(...foundKeys);
|
|
11
|
+
} while (cursor !== '0');
|
|
12
|
+
return keys;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=redis-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-helpers.js","sourceRoot":"/","sources":["libraries/socket/connections/redis-helpers.ts"],"names":[],"mappings":";;AAGA,4BASC;AATM,KAAK,UAAU,QAAQ,CAAC,KAAY,EAAE,OAAe;IAC3D,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,MAAM,GAAG,GAAG,CAAC;IACjB,GAAG,CAAC;QACH,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QACxF,MAAM,GAAG,SAAS,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IACzB,CAAC,QAAQ,MAAM,KAAK,GAAG,EAAE;IACzB,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["// Redis set helpers for socket logic\nimport type { Redis } from 'ioredis';\n\nexport async function scanKeys(redis: Redis, pattern: string): Promise<string[]> {\n\tconst keys: string[] = [];\n\tlet cursor = '0';\n\tdo {\n\t\tconst [newCursor, foundKeys] = await redis.scan(cursor, 'MATCH', pattern, 'COUNT', 100);\n\t\tcursor = newCursor;\n\t\tkeys.push(...foundKeys);\n\t} while (cursor !== '0');\n\treturn keys;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EntitySubscription } from './keys';
|
|
2
|
+
export interface SocketRedisEventInformation {
|
|
3
|
+
eventKey: string;
|
|
4
|
+
instanceId: string;
|
|
5
|
+
socketId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function connectEntityToSocketEvent(entity: EntitySubscription, socketRedisEventInformation: SocketRedisEventInformation): Promise<void>;
|
|
8
|
+
export declare function disconnectEntityFromSocketEvent(entity: EntitySubscription, socketRedisEventInformation: SocketRedisEventInformation): Promise<{
|
|
9
|
+
removed: boolean;
|
|
10
|
+
socketsRemoved: number;
|
|
11
|
+
subscribersRemoved: number;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function refreshEntityEventTTL(entity: EntitySubscription): Promise<void>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectEntityToSocketEvent = connectEntityToSocketEvent;
|
|
4
|
+
exports.disconnectEntityFromSocketEvent = disconnectEntityFromSocketEvent;
|
|
5
|
+
exports.refreshEntityEventTTL = refreshEntityEventTTL;
|
|
6
|
+
const __1 = require("../../..");
|
|
7
|
+
const keys_1 = require("./keys");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const cache_1 = require("./cache");
|
|
10
|
+
const subscriptionCache = new cache_1.LRUCache(10000);
|
|
11
|
+
const eventSubscribersCache = new cache_1.LRUCache(5000);
|
|
12
|
+
async function connectEntityToSocketEvent(entity, socketRedisEventInformation) {
|
|
13
|
+
const redis = (0, __1.getLibraries)().getRedisService();
|
|
14
|
+
const entityKeyStr = (0, keys_1.entityKey)(entity);
|
|
15
|
+
const { instanceId, socketId, eventKey } = socketRedisEventInformation;
|
|
16
|
+
const socketData = `${instanceId}|${socketId}`;
|
|
17
|
+
const subscriberData = `${entityKeyStr}|${instanceId}|${socketId}`;
|
|
18
|
+
const entityEventKey = (0, keys_1.kEntityEventSockets)(entity, eventKey);
|
|
19
|
+
const eventSubsKey = (0, keys_1.kEventEntity)(eventKey);
|
|
20
|
+
const ledgerKey = (0, keys_1.kEntityEvent)(entity);
|
|
21
|
+
await Promise.all([
|
|
22
|
+
redis.addToSet(entityEventKey, socketData),
|
|
23
|
+
redis.addToSet(eventSubsKey, subscriberData),
|
|
24
|
+
redis.addToSet(ledgerKey, eventKey),
|
|
25
|
+
]);
|
|
26
|
+
await Promise.all([
|
|
27
|
+
redis.redisClient.expire(entityEventKey, constants_1.REDIS_KEY_TTL_SECONDS),
|
|
28
|
+
redis.redisClient.expire(eventSubsKey, constants_1.REDIS_KEY_TTL_SECONDS),
|
|
29
|
+
redis.redisClient.expire(ledgerKey, constants_1.REDIS_KEY_TTL_SECONDS),
|
|
30
|
+
]);
|
|
31
|
+
subscriptionCache.delete(`${entityKeyStr}:${eventKey}`);
|
|
32
|
+
eventSubscribersCache.delete(eventKey);
|
|
33
|
+
}
|
|
34
|
+
async function disconnectEntityFromSocketEvent(entity, socketRedisEventInformation) {
|
|
35
|
+
const redis = (0, __1.getLibraries)().getRedisService();
|
|
36
|
+
const entityKeyStr = (0, keys_1.entityKey)(entity);
|
|
37
|
+
const { instanceId, socketId, eventKey } = socketRedisEventInformation;
|
|
38
|
+
const entityEventKey = (0, keys_1.kEntityEventSockets)(entity, eventKey);
|
|
39
|
+
const eventSubsKey = (0, keys_1.kEventEntity)(eventKey);
|
|
40
|
+
const ledgerKey = (0, keys_1.kEntityEvent)(entity);
|
|
41
|
+
const socketData = `${instanceId}|${socketId}`;
|
|
42
|
+
const subscriberData = `${entityKeyStr}|${instanceId}|${socketId}`;
|
|
43
|
+
await Promise.all([
|
|
44
|
+
redis.removeFromSet(entityEventKey, socketData),
|
|
45
|
+
redis.removeFromSet(eventSubsKey, subscriberData),
|
|
46
|
+
]);
|
|
47
|
+
const entitySockets = await redis.getSetMembers(entityEventKey);
|
|
48
|
+
if (entitySockets.length === 0) {
|
|
49
|
+
await Promise.all([redis.deleteCachedObject(entityEventKey), redis.removeFromSet(ledgerKey, eventKey)]);
|
|
50
|
+
}
|
|
51
|
+
subscriptionCache.delete(`${entityKeyStr}:${eventKey}`);
|
|
52
|
+
eventSubscribersCache.delete(eventKey);
|
|
53
|
+
return {
|
|
54
|
+
removed: true,
|
|
55
|
+
socketsRemoved: 1,
|
|
56
|
+
subscribersRemoved: 1,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async function refreshEntityEventTTL(entity) {
|
|
60
|
+
const redis = (0, __1.getLibraries)().getRedisService();
|
|
61
|
+
const ledgerKey = (0, keys_1.kEntityEvent)(entity);
|
|
62
|
+
const activeEvents = await redis.getSetMembers(ledgerKey);
|
|
63
|
+
if (!activeEvents.length)
|
|
64
|
+
return;
|
|
65
|
+
const pipeline = redis.redisClient.pipeline();
|
|
66
|
+
pipeline.expire(ledgerKey, constants_1.REDIS_KEY_TTL_SECONDS);
|
|
67
|
+
for (const eventKey of activeEvents) {
|
|
68
|
+
pipeline.expire((0, keys_1.kEntityEventSockets)(entity, eventKey), constants_1.REDIS_KEY_TTL_SECONDS);
|
|
69
|
+
pipeline.expire((0, keys_1.kEventEntity)(eventKey), constants_1.REDIS_KEY_TTL_SECONDS);
|
|
70
|
+
}
|
|
71
|
+
await pipeline.exec();
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"/","sources":["libraries/socket/connections/subscription.ts"],"names":[],"mappings":"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","sourcesContent":["// Subscription management logic for socket Redis\nimport { getLibraries } from '../../..';\nimport { kEntityEventSockets, kEventEntity, kEntityEvent, entityKey, EntitySubscription } from './keys';\nimport { REDIS_KEY_TTL_SECONDS } from './constants';\nimport { LRUCache } from './cache';\n\nexport interface SocketRedisEventInformation {\n\teventKey: string;\n\tinstanceId: string;\n\tsocketId: string;\n}\n\nconst subscriptionCache = new LRUCache<\n\tstring,\n\t{ isSubscribed: boolean; instances: string[]; timestamp: number }\n>(10000);\nconst eventSubscribersCache = new LRUCache<string, { subscribers: EntitySubscription[]; timestamp: number }>(\n\t5000\n);\n\nexport async function connectEntityToSocketEvent(\n\tentity: EntitySubscription,\n\tsocketRedisEventInformation: SocketRedisEventInformation\n) {\n\tconst redis = getLibraries().getRedisService();\n\tconst entityKeyStr = entityKey(entity);\n\tconst { instanceId, socketId, eventKey } = socketRedisEventInformation;\n\tconst socketData = `${instanceId}|${socketId}`;\n\tconst subscriberData = `${entityKeyStr}|${instanceId}|${socketId}`;\n\tconst entityEventKey = kEntityEventSockets(entity, eventKey);\n\tconst eventSubsKey = kEventEntity(eventKey);\n\tconst ledgerKey = kEntityEvent(entity);\n\tawait Promise.all([\n\t\tredis.addToSet(entityEventKey, socketData),\n\t\tredis.addToSet(eventSubsKey, subscriberData),\n\t\tredis.addToSet(ledgerKey, eventKey),\n\t]);\n\tawait Promise.all([\n\t\tredis.redisClient.expire(entityEventKey, REDIS_KEY_TTL_SECONDS),\n\t\tredis.redisClient.expire(eventSubsKey, REDIS_KEY_TTL_SECONDS),\n\t\tredis.redisClient.expire(ledgerKey, REDIS_KEY_TTL_SECONDS),\n\t]);\n\tsubscriptionCache.delete(`${entityKeyStr}:${eventKey}`);\n\teventSubscribersCache.delete(eventKey);\n}\n\nexport async function disconnectEntityFromSocketEvent(\n\tentity: EntitySubscription,\n\tsocketRedisEventInformation: SocketRedisEventInformation\n) {\n\tconst redis = getLibraries().getRedisService();\n\tconst entityKeyStr = entityKey(entity);\n\tconst { instanceId, socketId, eventKey } = socketRedisEventInformation;\n\tconst entityEventKey = kEntityEventSockets(entity, eventKey);\n\tconst eventSubsKey = kEventEntity(eventKey);\n\tconst ledgerKey = kEntityEvent(entity);\n\tconst socketData = `${instanceId}|${socketId}`;\n\tconst subscriberData = `${entityKeyStr}|${instanceId}|${socketId}`;\n\tawait Promise.all([\n\t\tredis.removeFromSet(entityEventKey, socketData),\n\t\tredis.removeFromSet(eventSubsKey, subscriberData),\n\t]);\n\tconst entitySockets = await redis.getSetMembers(entityEventKey);\n\tif (entitySockets.length === 0) {\n\t\tawait Promise.all([redis.deleteCachedObject(entityEventKey), redis.removeFromSet(ledgerKey, eventKey)]);\n\t}\n\tsubscriptionCache.delete(`${entityKeyStr}:${eventKey}`);\n\teventSubscribersCache.delete(eventKey);\n\treturn {\n\t\tremoved: true,\n\t\tsocketsRemoved: 1,\n\t\tsubscribersRemoved: 1,\n\t};\n}\n\nexport async function refreshEntityEventTTL(entity: EntitySubscription) {\n\tconst redis = getLibraries().getRedisService();\n\tconst ledgerKey = kEntityEvent(entity);\n\tconst activeEvents = await redis.getSetMembers(ledgerKey);\n\tif (!activeEvents.length) return;\n\tconst pipeline = redis.redisClient.pipeline();\n\tpipeline.expire(ledgerKey, REDIS_KEY_TTL_SECONDS);\n\tfor (const eventKey of activeEvents) {\n\t\tpipeline.expire(kEntityEventSockets(entity, eventKey), REDIS_KEY_TTL_SECONDS);\n\t\tpipeline.expire(kEventEntity(eventKey), REDIS_KEY_TTL_SECONDS);\n\t}\n\tawait pipeline.exec();\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../BaseSocketEvent"), exports);
|
|
18
|
+
__exportStar(require("./local-subscription-registry"), exports);
|
|
19
|
+
__exportStar(require("./socket-event-registry"), exports);
|
|
20
|
+
__exportStar(require("./zAsyncIterable"), exports);
|
|
21
|
+
__exportStar(require("./socket-event-publisher"), exports);
|
|
22
|
+
__exportStar(require("./socket-event-consumer"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/socket/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,gEAA8C;AAC9C,0DAAwC;AACxC,mDAAiC;AACjC,2DAAyC;AACzC,0DAAwC","sourcesContent":["export * from '../BaseSocketEvent';\nexport * from './local-subscription-registry';\nexport * from './socket-event-registry';\nexport * from './zAsyncIterable';\nexport * from './socket-event-publisher';\nexport * from './socket-event-consumer';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
import { EntitySubscription } from '../connections';
|
|
3
|
+
type EventKey = string;
|
|
4
|
+
type SocketId = string;
|
|
5
|
+
export declare class LocalEventEmitter {
|
|
6
|
+
readonly ee: EventEmitter;
|
|
7
|
+
readonly socketId: SocketId;
|
|
8
|
+
constructor(socketId: SocketId);
|
|
9
|
+
}
|
|
10
|
+
declare class LocalSubscriptionRegistry {
|
|
11
|
+
private listeners;
|
|
12
|
+
bind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter): void;
|
|
13
|
+
unbind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter): void;
|
|
14
|
+
emit(entity: EntitySubscription, eventKey: EventKey, payload: unknown): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const LocalSubs: LocalSubscriptionRegistry;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LocalSubs = exports.LocalEventEmitter = void 0;
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
const keyCache = new Map();
|
|
9
|
+
const entityKey = (entity) => {
|
|
10
|
+
const raw = `${entity.type ?? 'default'}:${entity.id}`;
|
|
11
|
+
let cached = keyCache.get(raw);
|
|
12
|
+
if (!cached) {
|
|
13
|
+
cached = raw;
|
|
14
|
+
keyCache.set(raw, cached);
|
|
15
|
+
}
|
|
16
|
+
return cached;
|
|
17
|
+
};
|
|
18
|
+
class LocalEventEmitter {
|
|
19
|
+
ee;
|
|
20
|
+
socketId;
|
|
21
|
+
constructor(socketId) {
|
|
22
|
+
this.ee = new events_1.default();
|
|
23
|
+
this.ee.setMaxListeners(0);
|
|
24
|
+
this.socketId = socketId;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.LocalEventEmitter = LocalEventEmitter;
|
|
28
|
+
class LocalSubscriptionRegistry {
|
|
29
|
+
listeners = new Map();
|
|
30
|
+
bind(entity, eventKey, ee) {
|
|
31
|
+
const key = `${entityKey(entity)}:${eventKey}`;
|
|
32
|
+
let listenerSet = this.listeners.get(key);
|
|
33
|
+
if (!listenerSet) {
|
|
34
|
+
listenerSet = new Set();
|
|
35
|
+
this.listeners.set(key, listenerSet);
|
|
36
|
+
}
|
|
37
|
+
listenerSet.add(ee);
|
|
38
|
+
}
|
|
39
|
+
unbind(entity, eventKey, ee) {
|
|
40
|
+
const key = `${entityKey(entity)}:${eventKey}`;
|
|
41
|
+
const listenerSet = this.listeners.get(key);
|
|
42
|
+
if (listenerSet) {
|
|
43
|
+
listenerSet.delete(ee);
|
|
44
|
+
if (listenerSet.size === 0) {
|
|
45
|
+
this.listeners.delete(key);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
emit(entity, eventKey, payload) {
|
|
50
|
+
const key = `${entityKey(entity)}:${eventKey}`;
|
|
51
|
+
const listeners = this.listeners.get(key);
|
|
52
|
+
if (!listeners)
|
|
53
|
+
return;
|
|
54
|
+
for (const listener of listeners) {
|
|
55
|
+
listener.ee.emit(eventKey, payload);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.LocalSubs = new LocalSubscriptionRegistry();
|
|
60
|
+
//# sourceMappingURL=local-subscription-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-subscription-registry.js","sourceRoot":"/","sources":["libraries/socket/core/local-subscription-registry.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAkC;AAOlC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;AAC3C,MAAM,SAAS,GAAG,CAAC,MAA0B,EAAU,EAAE;IACxD,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI,SAAS,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;IACvD,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,CAAC;QACb,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAGF,MAAa,iBAAiB;IACpB,EAAE,CAAe;IACjB,QAAQ,CAAW;IAE5B,YAAY,QAAkB;QAC7B,IAAI,CAAC,EAAE,GAAG,IAAI,gBAAY,EAAE,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;CACD;AATD,8CASC;AAED,MAAM,yBAAyB;IAEtB,SAAS,GAAG,IAAI,GAAG,EAAkC,CAAC;IAE9D,IAAI,CAAC,MAA0B,EAAE,QAAkB,EAAE,EAAqB;QACzE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC/C,IAAI,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE1C,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QACtC,CAAC;QAED,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,MAA0B,EAAE,QAAkB,EAAE,EAAqB;QAC3E,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE5C,IAAI,WAAW,EAAE,CAAC;YACjB,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACvB,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;QACF,CAAC;IACF,CAAC;IAGD,IAAI,CAAC,MAA0B,EAAE,QAAkB,EAAE,OAAgB;QACpE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE1C,IAAI,CAAC,SAAS;YAAE,OAAO;QAGvB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YAClC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD;AAEY,QAAA,SAAS,GAAG,IAAI,yBAAyB,EAAE,CAAC","sourcesContent":["import EventEmitter from 'events';\nimport { EntitySubscription } from '../connections';\n\ntype EventKey = string;\ntype SocketId = string;\n\n// Zero-overhead key with memoization\nconst keyCache = new Map<string, string>();\nconst entityKey = (entity: EntitySubscription): string => {\n\tconst raw = `${entity.type ?? 'default'}:${entity.id}`;\n\tlet cached = keyCache.get(raw);\n\tif (!cached) {\n\t\tcached = raw;\n\t\tkeyCache.set(raw, cached);\n\t}\n\treturn cached;\n};\n\n// Remove wrapper class - direct EventEmitter usage\nexport class LocalEventEmitter {\n\treadonly ee: EventEmitter;\n\treadonly socketId: SocketId;\n\n\tconstructor(socketId: SocketId) {\n\t\tthis.ee = new EventEmitter();\n\t\tthis.ee.setMaxListeners(0); // Unlimited listeners\n\t\tthis.socketId = socketId;\n\t}\n}\n\nclass LocalSubscriptionRegistry {\n\t// Direct map for O(1) lookups with minimal overhead\n\tprivate listeners = new Map<string, Set<LocalEventEmitter>>();\n\n\tbind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter): void {\n\t\tconst key = `${entityKey(entity)}:${eventKey}`;\n\t\tlet listenerSet = this.listeners.get(key);\n\n\t\tif (!listenerSet) {\n\t\t\tlistenerSet = new Set();\n\t\t\tthis.listeners.set(key, listenerSet);\n\t\t}\n\n\t\tlistenerSet.add(ee);\n\t}\n\n\tunbind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter): void {\n\t\tconst key = `${entityKey(entity)}:${eventKey}`;\n\t\tconst listenerSet = this.listeners.get(key);\n\n\t\tif (listenerSet) {\n\t\t\tlistenerSet.delete(ee);\n\t\t\tif (listenerSet.size === 0) {\n\t\t\t\tthis.listeners.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Zero-overhead emit - inline fast path\n\temit(entity: EntitySubscription, eventKey: EventKey, payload: unknown): void {\n\t\tconst key = `${entityKey(entity)}:${eventKey}`;\n\t\tconst listeners = this.listeners.get(key);\n\n\t\tif (!listeners) return;\n\n\t\t// Direct iteration - fastest possible\n\t\tfor (const listener of listeners) {\n\t\t\tlistener.ee.emit(eventKey, payload);\n\t\t}\n\t}\n}\n\nexport const LocalSubs = new LocalSubscriptionRegistry();\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function subscribeToSocketEvent(): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscribeToSocketEvent = subscribeToSocketEvent;
|
|
4
|
+
const instance_utils_1 = require("../../../utilities/instance.utils");
|
|
5
|
+
const event_1 = require("../../event");
|
|
6
|
+
const local_subscription_registry_1 = require("./local-subscription-registry");
|
|
7
|
+
async function subscribeToSocketEvent() {
|
|
8
|
+
const instanceId = (0, instance_utils_1.getInstanceId)();
|
|
9
|
+
await (0, event_1.subscribeToQueue)(`socket-events-${instanceId}`, `instance.${instanceId}`, (msg) => {
|
|
10
|
+
const { localKey, payload, recipient } = msg;
|
|
11
|
+
local_subscription_registry_1.LocalSubs.emit(recipient, localKey, payload);
|
|
12
|
+
}, { requeue: false });
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=socket-event-consumer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket-event-consumer.js","sourceRoot":"/","sources":["libraries/socket/core/socket-event-consumer.ts"],"names":[],"mappings":";;AAIA,wDAWC;AAfD,sEAAkE;AAClE,uCAA+C;AAC/C,+EAA0D;AAEnD,KAAK,UAAU,sBAAsB;IAC3C,MAAM,UAAU,GAAG,IAAA,8BAAa,GAAE,CAAC;IACnC,MAAM,IAAA,wBAAgB,EACrB,iBAAiB,UAAU,EAAE,EAC7B,YAAY,UAAU,EAAE,EACxB,CAAC,GAAY,EAAE,EAAE;QAChB,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAA6D,CAAC;QACvG,uCAAS,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC,EACD,EAAE,OAAO,EAAE,KAAK,EAAE,CAClB,CAAC;AACH,CAAC","sourcesContent":["import { getInstanceId } from '../../../utilities/instance.utils';\nimport { subscribeToQueue } from '../../event';\nimport { LocalSubs } from './local-subscription-registry';\n\nexport async function subscribeToSocketEvent(): Promise<void> {\n\tconst instanceId = getInstanceId();\n\tawait subscribeToQueue(\n\t\t`socket-events-${instanceId}`,\n\t\t`instance.${instanceId}`,\n\t\t(msg: unknown) => {\n\t\t\tconst { localKey, payload, recipient } = msg as { localKey: string; payload: unknown; recipient: any };\n\t\t\tLocalSubs.emit(recipient, localKey, payload);\n\t\t},\n\t\t{ requeue: false }\n\t);\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseSocketEvent } from '../BaseSocketEvent';
|
|
2
|
+
import { SocketNotificationEvent } from '../events';
|
|
3
|
+
import type { ZodTypeAny } from 'zod';
|
|
4
|
+
import { EntitySubscription } from '../connections';
|
|
5
|
+
export declare function publishSocketEvent(event: BaseSocketEvent<ZodTypeAny, ZodTypeAny, ZodTypeAny | undefined>, recipients: EntitySubscription[]): Promise<void>;
|
|
6
|
+
export declare function publishNotificationSocketEvent(event: SocketNotificationEvent, recipients: EntitySubscription[]): Promise<void>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.publishSocketEvent = publishSocketEvent;
|
|
4
|
+
exports.publishNotificationSocketEvent = publishNotificationSocketEvent;
|
|
5
|
+
const __1 = require("../../..");
|
|
6
|
+
const event_1 = require("../../event");
|
|
7
|
+
const PushNotificationEvent_1 = require("../PushNotificationEvent");
|
|
8
|
+
const connections_1 = require("../connections");
|
|
9
|
+
function fanOutToInstances(recipientsWithInstances, localKey, payload) {
|
|
10
|
+
if (recipientsWithInstances.length === 0)
|
|
11
|
+
return;
|
|
12
|
+
for (const { recipient, instances } of recipientsWithInstances) {
|
|
13
|
+
const message = { localKey, payload, recipient };
|
|
14
|
+
for (const instanceId of instances) {
|
|
15
|
+
(0, event_1.publish)(`instance.${instanceId}`, message).catch((error) => {
|
|
16
|
+
console.error(`[Socket] Publish failed for instance ${instanceId}`, error);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function getActiveSubscribedRecipients(recipients, localKey) {
|
|
22
|
+
if (recipients.length === 0)
|
|
23
|
+
return { subscribed: [], unsubscribed: [] };
|
|
24
|
+
const redis = (0, __1.getLibraries)().getRedisService();
|
|
25
|
+
const subscribed = [];
|
|
26
|
+
const unsubscribed = [];
|
|
27
|
+
await Promise.all(recipients.map(async (recipient) => {
|
|
28
|
+
const sockets = await redis.getSetMembers((0, connections_1.kEntityEventSockets)(recipient, localKey));
|
|
29
|
+
if (sockets.length === 0) {
|
|
30
|
+
unsubscribed.push(recipient);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const instances = [...new Set(sockets.map(s => s.split('|')[0]).filter(Boolean))];
|
|
34
|
+
if (instances.length > 0)
|
|
35
|
+
subscribed.push({ recipient, instances });
|
|
36
|
+
else
|
|
37
|
+
unsubscribed.push(recipient);
|
|
38
|
+
}));
|
|
39
|
+
return { subscribed, unsubscribed };
|
|
40
|
+
}
|
|
41
|
+
async function publishSocketEvent(event, recipients) {
|
|
42
|
+
const logger = (0, __1.getLibraries)().getLogger().logger;
|
|
43
|
+
if (recipients.length === 0)
|
|
44
|
+
return;
|
|
45
|
+
const localKey = event.getSubscriptionKey();
|
|
46
|
+
const payload = event.payload();
|
|
47
|
+
const { subscribed, unsubscribed } = await getActiveSubscribedRecipients(recipients, localKey);
|
|
48
|
+
logger.debug({ subscribed }, '[Socket] Subscribed recipients:');
|
|
49
|
+
logger.debug({ unsubscribed }, '[Socket] Unsubscribed recipients:');
|
|
50
|
+
if (subscribed.length > 0)
|
|
51
|
+
fanOutToInstances(subscribed, localKey, payload);
|
|
52
|
+
if (unsubscribed.length > 0) {
|
|
53
|
+
logger.debug({ unsubscribed }, '[Socket] Processing unsubscribed recipients');
|
|
54
|
+
if (event.notificationSettings?.isPushNotification) {
|
|
55
|
+
const pushNotificationPayload = event.getPushNotificationPayload();
|
|
56
|
+
await (0, event_1.publishEvent)(new PushNotificationEvent_1.PushNotificationEvent(event.eventType(), pushNotificationPayload, unsubscribed, event.notificationSettings)).catch(err => console.error('[Socket] Push notification failed:', err));
|
|
57
|
+
}
|
|
58
|
+
const socketNotificationPayload = event.getSocketNotificationEvent();
|
|
59
|
+
logger.debug({ socketNotificationPayload }, '[Socket] Socket notification payload');
|
|
60
|
+
if (socketNotificationPayload) {
|
|
61
|
+
await publishNotificationSocketEvent(socketNotificationPayload, unsubscribed);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function publishNotificationSocketEvent(event, recipients) {
|
|
66
|
+
if (recipients.length === 0)
|
|
67
|
+
return;
|
|
68
|
+
const eventKey = event.getSubscriptionKey();
|
|
69
|
+
const redis = (0, __1.getLibraries)().getRedisService();
|
|
70
|
+
const validInstances = [];
|
|
71
|
+
await Promise.all(recipients.map(async (recipient) => {
|
|
72
|
+
const sockets = await redis.getSetMembers((0, connections_1.kEntityEventSockets)(recipient, eventKey));
|
|
73
|
+
if (sockets.length === 0)
|
|
74
|
+
return;
|
|
75
|
+
const instances = [...new Set(sockets.map(s => s.split('|')[0]).filter(Boolean))];
|
|
76
|
+
if (instances.length > 0)
|
|
77
|
+
validInstances.push({ recipient, instances });
|
|
78
|
+
}));
|
|
79
|
+
if (validInstances.length > 0)
|
|
80
|
+
fanOutToInstances(validInstances, eventKey, event.payload());
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=socket-event-publisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket-event-publisher.js","sourceRoot":"/","sources":["libraries/socket/core/socket-event-publisher.ts"],"names":[],"mappings":"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","sourcesContent":["import { getLibraries } from '../../..';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\nimport { SocketNotificationEvent } from '../events';\nimport { publish, publishEvent } from '../../event';\nimport { PushNotificationEvent } from '../PushNotificationEvent';\nimport type { ZodTypeAny } from 'zod';\nimport { EntitySubscription, kEntityEventSockets } from '../connections';\n\nfunction fanOutToInstances(\n\trecipientsWithInstances: Array<{ recipient: EntitySubscription; instances: string[] }>,\n\tlocalKey: string,\n\tpayload: unknown\n): void {\n\tif (recipientsWithInstances.length === 0) return;\n\n\tfor (const { recipient, instances } of recipientsWithInstances) {\n\t\tconst message = { localKey, payload, recipient };\n\t\tfor (const instanceId of instances) {\n\t\t\tpublish(`instance.${instanceId}`, message).catch((error: unknown) => {\n\t\t\t\tconsole.error(`[Socket] Publish failed for instance ${instanceId}`, error);\n\t\t\t});\n\t\t}\n\t}\n}\n\nasync function getActiveSubscribedRecipients(\n\trecipients: EntitySubscription[],\n\tlocalKey: string\n): Promise<{\n\tsubscribed: Array<{ recipient: EntitySubscription; instances: string[] }>;\n\tunsubscribed: EntitySubscription[];\n}> {\n\tif (recipients.length === 0) return { subscribed: [], unsubscribed: [] };\n\n\tconst redis = getLibraries().getRedisService();\n\tconst subscribed: Array<{ recipient: EntitySubscription; instances: string[] }> = [];\n\tconst unsubscribed: EntitySubscription[] = [];\n\n\tawait Promise.all(\n\t\trecipients.map(async recipient => {\n\t\t\tconst sockets = await redis.getSetMembers(kEntityEventSockets(recipient, localKey));\n\t\t\tif (sockets.length === 0) {\n\t\t\t\tunsubscribed.push(recipient);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst instances = [...new Set(sockets.map(s => s.split('|')[0]).filter(Boolean))];\n\t\t\tif (instances.length > 0) subscribed.push({ recipient, instances });\n\t\t\telse unsubscribed.push(recipient);\n\t\t})\n\t);\n\n\treturn { subscribed, unsubscribed };\n}\n\nexport async function publishSocketEvent(\n\tevent: BaseSocketEvent<ZodTypeAny, ZodTypeAny, ZodTypeAny | undefined>,\n\trecipients: EntitySubscription[]\n): Promise<void> {\n\tconst logger = getLibraries().getLogger().logger;\n\tif (recipients.length === 0) return;\n\n\tconst localKey = event.getSubscriptionKey();\n\tconst payload = event.payload();\n\n\tconst { subscribed, unsubscribed } = await getActiveSubscribedRecipients(recipients, localKey);\n\n\tlogger.debug({ subscribed }, '[Socket] Subscribed recipients:');\n\tlogger.debug({ unsubscribed }, '[Socket] Unsubscribed recipients:');\n\n\tif (subscribed.length > 0) fanOutToInstances(subscribed, localKey, payload);\n\n\tif (unsubscribed.length > 0) {\n\t\tlogger.debug({ unsubscribed }, '[Socket] Processing unsubscribed recipients');\n\n\t\tif (event.notificationSettings?.isPushNotification) {\n\t\t\tconst pushNotificationPayload = event.getPushNotificationPayload();\n\t\t\tawait publishEvent(\n\t\t\t\tnew PushNotificationEvent(event.eventType(), pushNotificationPayload, unsubscribed, event.notificationSettings)\n\t\t\t).catch(err => console.error('[Socket] Push notification failed:', err));\n\t\t}\n\n\t\tconst socketNotificationPayload = event.getSocketNotificationEvent();\n\t\tlogger.debug({ socketNotificationPayload }, '[Socket] Socket notification payload');\n\n\t\tif (socketNotificationPayload) {\n\t\t\tawait publishNotificationSocketEvent(socketNotificationPayload, unsubscribed);\n\t\t}\n\t}\n}\n\nexport async function publishNotificationSocketEvent(\n\tevent: SocketNotificationEvent,\n\trecipients: EntitySubscription[]\n): Promise<void> {\n\tif (recipients.length === 0) return;\n\n\tconst eventKey = event.getSubscriptionKey();\n\tconst redis = getLibraries().getRedisService();\n\tconst validInstances: Array<{ recipient: EntitySubscription; instances: string[] }> = [];\n\n\tawait Promise.all(\n\t\trecipients.map(async recipient => {\n\t\t\tconst sockets = await redis.getSetMembers(kEntityEventSockets(recipient, eventKey));\n\t\t\tif (sockets.length === 0) return;\n\t\t\tconst instances = [...new Set(sockets.map(s => s.split('|')[0]).filter(Boolean))];\n\t\t\tif (instances.length > 0) validInstances.push({ recipient, instances });\n\t\t})\n\t);\n\n\tif (validInstances.length > 0) fanOutToInstances(validInstances, eventKey, event.payload());\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { SocketEventType } from '../../../utilities/enum';
|
|
3
|
+
import { REGISTRY } from './socket-event-registry.map';
|
|
4
|
+
type InputFor<T extends SocketEventType> = z.infer<(typeof REGISTRY)[T]['schemas']['input']>;
|
|
5
|
+
type OutputFor<T extends SocketEventType> = z.infer<(typeof REGISTRY)[T]['schemas']['output']>;
|
|
6
|
+
type EventFor<T extends SocketEventType> = InstanceType<(typeof REGISTRY)[T]>;
|
|
7
|
+
export declare class EventFactory {
|
|
8
|
+
static getEventClass<T extends SocketEventType>(eventType: T): (typeof REGISTRY)[T];
|
|
9
|
+
static getSubscriptionKey<T extends SocketEventType>(eventType: T, input: InputFor<T>): string;
|
|
10
|
+
static createEvent<T extends SocketEventType>(eventType: T, data: OutputFor<T>): EventFor<T>;
|
|
11
|
+
}
|
|
12
|
+
export type { EventFor, InputFor, OutputFor };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventFactory = void 0;
|
|
4
|
+
const socket_event_registry_map_1 = require("./socket-event-registry.map");
|
|
5
|
+
class EventFactory {
|
|
6
|
+
static getEventClass(eventType) {
|
|
7
|
+
return socket_event_registry_map_1.REGISTRY[eventType];
|
|
8
|
+
}
|
|
9
|
+
static getSubscriptionKey(eventType, input) {
|
|
10
|
+
const eventClass = this.getEventClass(eventType);
|
|
11
|
+
const schemas = (0, socket_event_registry_map_1.getSchemas)(eventClass);
|
|
12
|
+
const identifier = (0, socket_event_registry_map_1.getIdentifier)(eventClass);
|
|
13
|
+
const validatedInput = schemas.input.parse(input);
|
|
14
|
+
const key = typeof identifier === 'function' ? identifier(validatedInput) : 'default';
|
|
15
|
+
return `${eventType}:${key}`;
|
|
16
|
+
}
|
|
17
|
+
static createEvent(eventType, data) {
|
|
18
|
+
const EventClass = this.getEventClass(eventType);
|
|
19
|
+
return new EventClass(data);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.EventFactory = EventFactory;
|
|
23
|
+
//# sourceMappingURL=socket-event-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket-event-registry.js","sourceRoot":"/","sources":["libraries/socket/core/socket-event-registry.ts"],"names":[],"mappings":";;;AAEA,2EAAkF;AAOlF,MAAa,YAAY;IAExB,MAAM,CAAC,aAAa,CAA4B,SAAY;QAC3D,OAAO,oCAAQ,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAGD,MAAM,CAAC,kBAAkB,CAA4B,SAAY,EAAE,KAAkB;QACpF,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,IAAA,sCAAU,EAAC,UAAU,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,IAAA,yCAAa,EAAC,UAAU,CAAC,CAAC;QAE7C,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEtF,OAAO,GAAG,SAAS,IAAI,GAAG,EAAE,CAAC;IAC9B,CAAC;IAGD,MAAM,CAAC,WAAW,CAA4B,SAAY,EAAE,IAAkB;QAC7E,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACjD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAgB,CAAC;IAC5C,CAAC;CACD;AAvBD,oCAuBC","sourcesContent":["import type { z } from 'zod';\nimport type { SocketEventType } from '../../../utilities/enum';\nimport { getIdentifier, getSchemas, REGISTRY } from './socket-event-registry.map';\n\n// Infer types directly from the registry\ntype InputFor<T extends SocketEventType> = z.infer<(typeof REGISTRY)[T]['schemas']['input']>;\ntype OutputFor<T extends SocketEventType> = z.infer<(typeof REGISTRY)[T]['schemas']['output']>;\ntype EventFor<T extends SocketEventType> = InstanceType<(typeof REGISTRY)[T]>;\n\nexport class EventFactory {\n\t// Get the event class constructor\n\tstatic getEventClass<T extends SocketEventType>(eventType: T): (typeof REGISTRY)[T] {\n\t\treturn REGISTRY[eventType];\n\t}\n\n\t// Create a subscription key for an event with validated input\n\tstatic getSubscriptionKey<T extends SocketEventType>(eventType: T, input: InputFor<T>): string {\n\t\tconst eventClass = this.getEventClass(eventType);\n\t\tconst schemas = getSchemas(eventClass);\n\t\tconst identifier = getIdentifier(eventClass);\n\n\t\tconst validatedInput = schemas.input.parse(input);\n\t\tconst key = typeof identifier === 'function' ? identifier(validatedInput) : 'default';\n\n\t\treturn `${eventType}:${key}`;\n\t}\n\n\t// Create an event instance from validated output data\n\tstatic createEvent<T extends SocketEventType>(eventType: T, data: OutputFor<T>): EventFor<T> {\n\t\tconst EventClass = this.getEventClass(eventType);\n\t\treturn new EventClass(data) as EventFor<T>;\n\t}\n}\n\nexport type { EventFor, InputFor, OutputFor };\n"]}
|