@lyxa.ai/core 1.3.143 → 1.3.145

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/index.js CHANGED
@@ -155,7 +155,7 @@ async function registerLibraries(options) {
155
155
  await (0, event_1.initEventBus)(rabbitmq_environments_1.RabbitMQUrlMap[options?.environment ?? EnvironmentConfigurationType_1.EnvironmentConfigurationType.DEV]);
156
156
  const allSubscriptions = SubscriptionRegistry_1.SubscriptionRegistry.getAllSubscriptions();
157
157
  const instantiatedServices = new Map();
158
- for (const { eventId, targetConstructor, methodName } of allSubscriptions) {
158
+ for (const { eventId, targetConstructor, methodName, opts } of allSubscriptions) {
159
159
  let instance = instantiatedServices.get(targetConstructor);
160
160
  if (!instance) {
161
161
  instance = typedi_1.Container.get(targetConstructor);
@@ -163,7 +163,7 @@ async function registerLibraries(options) {
163
163
  }
164
164
  await (0, event_1.subscribeToEvent)(eventId, async (payload) => {
165
165
  return instance[methodName](payload);
166
- });
166
+ }, opts);
167
167
  }
168
168
  }
169
169
  function getLibraries() {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,sCA2BC;AAED,8CAyGC;AAED,oCAEC;AA/KD,qFAAqF;AACrF,IAAA,0CAAqB,GAAE,CAAC;AAExB,2CAA6C;AAC7C,mCAAmC;AACnC,6DAAuF;AACvF,+CAAgD;AAChD,6CAAiD;AACjD,6CAAoF;AACpF,iDAA2D;AAC3D,uDAAgE;AAChE,+CAAmD;AACnD,mDAAuD;AACvD,6CAAmE;AACnE,0FAAuF;AACvF,yCAAgE;AAChE,yDAAmE;AACnE,gEAKyC;AACzC,wEAAmE;AACnE,iEAA4F;AAC5F,+GAA4G;AAC5G,yDAAgE;AAChE,yFAA+E;AAC/E,4FAAuG;AACvG,uDAAuD;AAKvD,6GAA4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5D,kBAAS,CAAC,GAAG,CAAC,+BAAkB,EAAE,0BAA0B,CAAC,CAAC;IAC9D,kBAAS,CAAC,GAAG,CAAC,8BAAiB,EAAE,yBAAyB,CAAC,CAAC;IAE5D,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAEtC,MAAM,IAAA,oBAAY,EAAC,sCAAc,CAAC,OAAO,EAAE,WAAW,IAAI,2DAA4B,CAAC,GAAG,CAAC,CAAC,CAAC;IAE7F,MAAM,gBAAgB,GAAG,2CAAoB,CAAC,mBAAmB,EAAE,CAAC;IAEpE,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEtD,KAAK,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,gBAAgB,EAAE,CAAC;QAC3E,IAAI,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,kBAAS,CAAC,GAAG,CAAC,iBAAwB,CAAC,CAAC;YACnD,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,IAAA,wBAAgB,EAAC,OAAO,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;YAC/C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,SAAgB,YAAY;IAC3B,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Apply the soft delete plugin globally before any connections or models\nimport { applySoftDeletePlugin } from './libraries/mongo/plugins/soft-delete-plugin';\napplySoftDeletePlugin();\n\nimport { LibraryManager } from './libraries';\nimport { Container } from 'typedi';\nimport { ConfigurationOptions, ConfigurationService } from './libraries/configuration';\nimport { LyxaLogger } from './libraries/logger';\nimport { RedisService } from './libraries/redis';\nimport { initGlobalConnection, initLyxaMongoDbConnection } from './libraries/mongo';\nimport { SecretManagerService } from './libraries/secrets';\nimport { MicroServiceDispatcher } from './libraries/dispatcher';\nimport { TwilioService } from './libraries/twilio';\nimport { FirebaseService } from './libraries/firebase';\nimport { initEventBus, subscribeToEvent } from './libraries/event';\nimport { SubscriptionRegistry } from './libraries/event/registry/SubscriptionRegistry';\nimport { GoogleMapsService, MapService } from './libraries/map';\nimport { CachedSettingsService } from './libraries/cache/settings';\nimport {\n\tFCMService,\n\tFCMServiceForRider,\n\tFCMServiceForShop,\n\tFCMServiceForUser,\n} from './libraries/firebase/fcmService';\nimport { BullMQService } from './libraries/bullmq/bull-mq-service';\nimport { BOBSecrets, BOBService, CashSettlementService } from './libraries/cash-settlement';\nimport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nimport { OsrmMapService } from './libraries/map/providers/osrm';\nimport { RabbitMQUrlMap } from './utilities/environment/rabbitmq-environments';\nimport { disconnectAllEntitiesFromInstance } from './libraries/socket/connections/instance-disconnect';\nimport { LyxaLoggerKit } from './libraries/logger-kit';\n\n\n\nexport { ConfigurationOptions } from './libraries/configuration';\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nexport { initGlobalConnection } from './libraries/mongo';\n\nexport async function bootstrapCore(options?: ConfigurationOptions) {\n\ttry {\n\t\tawait registerLibraries(options);\n\n\t\tgetLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');\n\n\t\tconst gracefulShutdown = async () => {\n\t\t\tgetLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\n\t\t\tif (options?.instanceType == 'socket') await disconnectAllEntitiesFromInstance();\n\t\t\tprocess.exit();\n\t\t};\n\n\t\tprocess.on('SIGTERM', gracefulShutdown);\n\t\tprocess.on('SIGINT', gracefulShutdown);\n\t\tprocess.on('uncaughtException', err => {\n\t\t\tconsole.log('err', err);\n\t\t\tgetLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\n\t\t\tgracefulShutdown();\n\t\t});\n\t\tprocess.on('exit', code => {\n\t\t\tgetLibraries().getLogger().logger.info(`Exiting with code: ${code}`);\n\t\t});\n\n\t\tconsole.log('Created hooks.');\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function registerLibraries(options?: ConfigurationOptions) {\n\t// Setup configuration.\n\tconst configurationInstance = new ConfigurationService(options);\n\tContainer.set(ConfigurationService, configurationInstance);\n\n\t// Setup redis.\n\tconst redisInstance = new RedisService(configurationInstance.redisURL);\n\tContainer.set(RedisService, redisInstance);\n\n\t// Setup secret\n\tconst secretInstance = new SecretManagerService(configurationInstance, redisInstance);\n\tContainer.set(SecretManagerService, secretInstance);\n\n\t// Setup BullMQ\n\tconst bullMQInstance = new BullMQService(redisInstance);\n\tContainer.set(BullMQService, bullMQInstance);\n\n\tconst mongoUrl = options?.mongoDbUrl\n\t\t? options.mongoDbUrl\n\t\t: await getLibraries().getSecretsService().getKey('MONGO_URL');\n\n\tawait initLyxaMongoDbConnection(mongoUrl!, options);\n\tawait initGlobalConnection(mongoUrl!, options!.environment);\n\n\tconst loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\n\tContainer.set(LyxaLogger, loggerInstance);\n\n\tconst loggerKit = new LyxaLoggerKit({ instanceType: options!.instanceType! });\n\tContainer.set(LyxaLoggerKit, loggerKit);\n\t\n\t// Setup firebase\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\n\tContainer.set(FirebaseService, firebaseInstance);\n\n\t// Setup microservice dispatcher\n\tconst microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\n\tContainer.set(MicroServiceDispatcher, microserviceDispatcherInstance);\n\n\t// Setup twilio\n\tconst twilioServiceInstance = new TwilioService();\n\tContainer.set(TwilioService, twilioServiceInstance);\n\n\t// Setup map service\n\tconst googleMapsKey = await getLibraries().getSecretsService().getKey('GOOGLE_MAPS_API_KEY');\n\tconst googleMapService = new GoogleMapsService(redisInstance, googleMapsKey as string);\n\tconst osrmMapService = new OsrmMapService();\n\tconst mapServiceInstance = new MapService(googleMapService, osrmMapService);\n\tContainer.set(MapService, mapServiceInstance);\n\n\t// Setup cash settlement service\n\tconst bobUsername = await getLibraries().getSecretsService().getKey('BOB_USER_NAME');\n\tconst bobPassword = await getLibraries().getSecretsService().getKey('BOB_PASSWORD');\n\tconst bobURL = await getLibraries().getSecretsService().getKey('BOB_URL');\n\n\tconst bobService = new BOBService({\n\t\tBOB_USER_NAME: bobUsername,\n\t\tBOB_PASSWORD: bobPassword,\n\t\tBOB_URL: bobURL,\n\t} as BOBSecrets);\n\tconst cashSettlementServiceInstance = new CashSettlementService(bobService);\n\tContainer.set(CashSettlementService, cashSettlementServiceInstance);\n\tContainer.set(BOBService, bobService);\n\n\tconst settingsServiceInstance = new CachedSettingsService(redisInstance);\n\tContainer.set(CachedSettingsService, settingsServiceInstance);\n\n\ttry {\n\t\tconst settings = await settingsServiceInstance.getSettings();\n\t\tconst { _setTimezone } = await import('./utilities/dayjs/dayjs');\n\t\t_setTimezone(settings?.timezone || 'Asia/Beirut');\n\t\tconsole.log('Timezone initialized:', settings?.timezone || 'Asia/Beirut');\n\t} catch (error) {\n\t\tconsole.error('Failed to initialize timezone:', error);\n\t}\n\n\t// Setup fcm service\n\tconst firebaseService = getLibraries().getFirebaseService();\n\tconst fcmServiceInstance = new FCMService(firebaseService.superApp);\n\tconst fcmServiceInstanceForUser = new FCMService(firebaseService.userApp);\n\tconst fcmServiceInstanceForRider = new FCMService(firebaseService.riderApp);\n\tconst fcmServiceInstanceForShop = new FCMService(firebaseService.shopApp);\n\tContainer.set(FCMService, fcmServiceInstance);\n\tContainer.set(FCMServiceForUser, fcmServiceInstanceForUser);\n\tContainer.set(FCMServiceForRider, fcmServiceInstanceForRider);\n\tContainer.set(FCMServiceForShop, fcmServiceInstanceForShop);\n\n\tconsole.log('Initialized everything');\n\n\tawait initEventBus(RabbitMQUrlMap[options?.environment ?? EnvironmentConfigurationType.DEV]);\n\n\tconst allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\n\n\tconst instantiatedServices = new Map<Function, any>();\n\n\tfor (const { eventId, targetConstructor, methodName } of allSubscriptions) {\n\t\tlet instance = instantiatedServices.get(targetConstructor);\n\t\tif (!instance) {\n\t\t\tinstance = Container.get(targetConstructor as any);\n\t\t\tinstantiatedServices.set(targetConstructor, instance);\n\t\t}\n\n\t\tawait subscribeToEvent(eventId, async payload => {\n\t\t\treturn instance[methodName](payload);\n\t\t});\n\t}\n}\n\nexport function getLibraries(): LibraryManager {\n\treturn Container.get(LibraryManager);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,sCA2BC;AAED,8CA6GC;AAED,oCAEC;AAlLD,qFAAqF;AACrF,IAAA,0CAAqB,GAAE,CAAC;AACxB,2CAA6C;AAC7C,mCAAmC;AACnC,6DAAuF;AACvF,+CAAgD;AAChD,6CAAiD;AACjD,6CAAoF;AACpF,iDAA2D;AAC3D,uDAAgE;AAChE,+CAAmD;AACnD,mDAAuD;AACvD,6CAAmE;AACnE,0FAAuF;AACvF,yCAAgE;AAChE,yDAAmE;AACnE,gEAKyC;AACzC,wEAAmE;AACnE,iEAA4F;AAC5F,+GAA4G;AAC5G,yDAAgE;AAChE,yFAA+E;AAC/E,4FAAuG;AACvG,uDAAuD;AAKvD,6GAA4G;AAAnG,4IAAA,4BAA4B,OAAA;AACrC,2CAAyD;AAAhD,6GAAA,oBAAoB,OAAA;AAEtB,KAAK,UAAU,aAAa,CAAC,OAA8B;IACjE,IAAI,CAAC;QACJ,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEjC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAE/E,MAAM,gBAAgB,GAAG,KAAK,IAA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AM,gBAAgB,GAAG,2CAAoB,CAAC,mBAAmB,EAAE,CAAC;IAEpE,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEtD,KAAK,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,gBAAgB,EAAE,CAAC;QACjF,IAAI,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,kBAAS,CAAC,GAAG,CAAC,iBAAwB,CAAC,CAAC;YACnD,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,IAAA,wBAAgB,EACrB,OAAO,EACP,KAAK,EAAC,OAAO,EAAC,EAAE;YACf,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,EACD,IAAI,CACJ,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAgB,YAAY;IAC3B,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Apply the soft delete plugin globally before any connections or models\nimport { applySoftDeletePlugin } from './libraries/mongo/plugins/soft-delete-plugin';\napplySoftDeletePlugin();\nimport { LibraryManager } from './libraries';\nimport { Container } from 'typedi';\nimport { ConfigurationOptions, ConfigurationService } from './libraries/configuration';\nimport { LyxaLogger } from './libraries/logger';\nimport { RedisService } from './libraries/redis';\nimport { initGlobalConnection, initLyxaMongoDbConnection } from './libraries/mongo';\nimport { SecretManagerService } from './libraries/secrets';\nimport { MicroServiceDispatcher } from './libraries/dispatcher';\nimport { TwilioService } from './libraries/twilio';\nimport { FirebaseService } from './libraries/firebase';\nimport { initEventBus, subscribeToEvent } from './libraries/event';\nimport { SubscriptionRegistry } from './libraries/event/registry/SubscriptionRegistry';\nimport { GoogleMapsService, MapService } from './libraries/map';\nimport { CachedSettingsService } from './libraries/cache/settings';\nimport {\n\tFCMService,\n\tFCMServiceForRider,\n\tFCMServiceForShop,\n\tFCMServiceForUser,\n} from './libraries/firebase/fcmService';\nimport { BullMQService } from './libraries/bullmq/bull-mq-service';\nimport { BOBSecrets, BOBService, CashSettlementService } from './libraries/cash-settlement';\nimport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nimport { OsrmMapService } from './libraries/map/providers/osrm';\nimport { RabbitMQUrlMap } from './utilities/environment/rabbitmq-environments';\nimport { disconnectAllEntitiesFromInstance } from './libraries/socket/connections/instance-disconnect';\nimport { LyxaLoggerKit } from './libraries/logger-kit';\n\n\n\nexport { ConfigurationOptions } from './libraries/configuration';\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nexport { initGlobalConnection } from './libraries/mongo';\n\nexport async function bootstrapCore(options?: ConfigurationOptions) {\n\ttry {\n\t\tawait registerLibraries(options);\n\n\t\tgetLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');\n\n\t\tconst gracefulShutdown = async () => {\n\t\t\tgetLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\n\t\t\tif (options?.instanceType == 'socket') await disconnectAllEntitiesFromInstance();\n\t\t\tprocess.exit();\n\t\t};\n\n\t\tprocess.on('SIGTERM', gracefulShutdown);\n\t\tprocess.on('SIGINT', gracefulShutdown);\n\t\tprocess.on('uncaughtException', err => {\n\t\t\tconsole.log('err', err);\n\t\t\tgetLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\n\t\t\tgracefulShutdown();\n\t\t});\n\t\tprocess.on('exit', code => {\n\t\t\tgetLibraries().getLogger().logger.info(`Exiting with code: ${code}`);\n\t\t});\n\n\t\tconsole.log('Created hooks.');\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function registerLibraries(options?: ConfigurationOptions) {\n\t// Setup configuration.\n\tconst configurationInstance = new ConfigurationService(options);\n\tContainer.set(ConfigurationService, configurationInstance);\n\n\t// Setup redis.\n\tconst redisInstance = new RedisService(configurationInstance.redisURL);\n\tContainer.set(RedisService, redisInstance);\n\n\t// Setup secret\n\tconst secretInstance = new SecretManagerService(configurationInstance, redisInstance);\n\tContainer.set(SecretManagerService, secretInstance);\n\n\t// Setup BullMQ\n\tconst bullMQInstance = new BullMQService(redisInstance);\n\tContainer.set(BullMQService, bullMQInstance);\n\n\tconst mongoUrl = options?.mongoDbUrl\n\t\t? options.mongoDbUrl\n\t\t: await getLibraries().getSecretsService().getKey('MONGO_URL');\n\n\tawait initLyxaMongoDbConnection(mongoUrl!, options);\n\tawait initGlobalConnection(mongoUrl!, options!.environment);\n\n\tconst loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\n\tContainer.set(LyxaLogger, loggerInstance);\n\n\tconst loggerKit = new LyxaLoggerKit({ instanceType: options!.instanceType! });\n\tContainer.set(LyxaLoggerKit, loggerKit);\n\t\n\t// Setup firebase\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\n\tContainer.set(FirebaseService, firebaseInstance);\n\n\t// Setup microservice dispatcher\n\tconst microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\n\tContainer.set(MicroServiceDispatcher, microserviceDispatcherInstance);\n\n\t// Setup twilio\n\tconst twilioServiceInstance = new TwilioService();\n\tContainer.set(TwilioService, twilioServiceInstance);\n\n\t// Setup map service\n\tconst googleMapsKey = await getLibraries().getSecretsService().getKey('GOOGLE_MAPS_API_KEY');\n\tconst googleMapService = new GoogleMapsService(redisInstance, googleMapsKey as string);\n\tconst osrmMapService = new OsrmMapService();\n\tconst mapServiceInstance = new MapService(googleMapService, osrmMapService);\n\tContainer.set(MapService, mapServiceInstance);\n\n\t// Setup cash settlement service\n\tconst bobUsername = await getLibraries().getSecretsService().getKey('BOB_USER_NAME');\n\tconst bobPassword = await getLibraries().getSecretsService().getKey('BOB_PASSWORD');\n\tconst bobURL = await getLibraries().getSecretsService().getKey('BOB_URL');\n\n\tconst bobService = new BOBService({\n\t\tBOB_USER_NAME: bobUsername,\n\t\tBOB_PASSWORD: bobPassword,\n\t\tBOB_URL: bobURL,\n\t} as BOBSecrets);\n\tconst cashSettlementServiceInstance = new CashSettlementService(bobService);\n\tContainer.set(CashSettlementService, cashSettlementServiceInstance);\n\tContainer.set(BOBService, bobService);\n\n\tconst settingsServiceInstance = new CachedSettingsService(redisInstance);\n\tContainer.set(CachedSettingsService, settingsServiceInstance);\n\n\ttry {\n\t\tconst settings = await settingsServiceInstance.getSettings();\n\t\tconst { _setTimezone } = await import('./utilities/dayjs/dayjs');\n\t\t_setTimezone(settings?.timezone || 'Asia/Beirut');\n\t\tconsole.log('Timezone initialized:', settings?.timezone || 'Asia/Beirut');\n\t} catch (error) {\n\t\tconsole.error('Failed to initialize timezone:', error);\n\t}\n\n\t// Setup fcm service\n\tconst firebaseService = getLibraries().getFirebaseService();\n\tconst fcmServiceInstance = new FCMService(firebaseService.superApp);\n\tconst fcmServiceInstanceForUser = new FCMService(firebaseService.userApp);\n\tconst fcmServiceInstanceForRider = new FCMService(firebaseService.riderApp);\n\tconst fcmServiceInstanceForShop = new FCMService(firebaseService.shopApp);\n\tContainer.set(FCMService, fcmServiceInstance);\n\tContainer.set(FCMServiceForUser, fcmServiceInstanceForUser);\n\tContainer.set(FCMServiceForRider, fcmServiceInstanceForRider);\n\tContainer.set(FCMServiceForShop, fcmServiceInstanceForShop);\n\n\tconsole.log('Initialized everything');\n\n\tawait initEventBus(RabbitMQUrlMap[options?.environment ?? EnvironmentConfigurationType.DEV]);\n\n\tconst allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\n\n\tconst instantiatedServices = new Map<Function, any>();\n\n\tfor (const { eventId, targetConstructor, methodName, opts } of allSubscriptions) {\n\t\tlet instance = instantiatedServices.get(targetConstructor);\n\t\tif (!instance) {\n\t\t\tinstance = Container.get(targetConstructor as any);\n\t\t\tinstantiatedServices.set(targetConstructor, instance);\n\t\t}\n\n\t\tawait subscribeToEvent(\n\t\t\teventId,\n\t\t\tasync payload => {\n\t\t\t\treturn instance[methodName](payload);\n\t\t\t},\n\t\t\topts\n\t\t);\n\t}\n}\n\nexport function getLibraries(): LibraryManager {\n\treturn Container.get(LibraryManager);\n}\n"]}
@@ -1 +1,2 @@
1
- export declare function Subscribe(eventId: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
1
+ import { RabbitMQEventOptions } from '../index';
2
+ export declare function Subscribe(eventId: string, opts?: RabbitMQEventOptions): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Subscribe = Subscribe;
4
4
  const SubscriptionRegistry_1 = require("../registry/SubscriptionRegistry");
5
- function Subscribe(eventId) {
5
+ function Subscribe(eventId, opts) {
6
6
  return function (target, propertyKey, descriptor) {
7
- SubscriptionRegistry_1.SubscriptionRegistry.register(eventId, target.constructor, propertyKey);
7
+ SubscriptionRegistry_1.SubscriptionRegistry.register(eventId, target.constructor, propertyKey, opts);
8
8
  };
9
9
  }
10
10
  //# sourceMappingURL=subscribe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscribe.js","sourceRoot":"/","sources":["libraries/event/decorators/subscribe.ts"],"names":[],"mappings":";;AAEA,8BAIC;AAND,2EAAwE;AAExE,SAAgB,SAAS,CAAC,OAAe;IACxC,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAChF,2CAAoB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACzE,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { SubscriptionRegistry } from '../registry/SubscriptionRegistry';\n\nexport function Subscribe(eventId: string) {\n\treturn function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tSubscriptionRegistry.register(eventId, target.constructor, propertyKey);\n\t};\n}\n\n"]}
1
+ {"version":3,"file":"subscribe.js","sourceRoot":"/","sources":["libraries/event/decorators/subscribe.ts"],"names":[],"mappings":";;AAGA,8BAIC;AAPD,2EAAwE;AAGxE,SAAgB,SAAS,CAAC,OAAe,EAAE,IAA2B;IACrE,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAChF,2CAAoB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAC/E,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { SubscriptionRegistry } from '../registry/SubscriptionRegistry';\nimport { RabbitMQEventOptions } from '../index';\n\nexport function Subscribe(eventId: string, opts?: RabbitMQEventOptions) {\n\treturn function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tSubscriptionRegistry.register(eventId, target.constructor, propertyKey, opts);\n\t};\n}\n"]}
@@ -1,5 +1,8 @@
1
1
  import amqp from 'amqplib';
2
2
  import { BaseEvent } from './BaseEvent';
3
+ export interface RabbitMQEventOptions {
4
+ consumeImmediately?: boolean;
5
+ }
3
6
  export declare const EXCHANGE_NAME = "lyxa.events";
4
7
  export declare const INSTANCE_ROUTE_PREFIX = "instance";
5
8
  export declare function initEventBus(rabbitUrl: string): Promise<void>;
@@ -8,5 +11,6 @@ export declare function getChannel(): {
8
11
  subChannel: amqp.Channel;
9
12
  };
10
13
  export declare function publishEvent<TPayload extends Record<string, unknown>>(event: BaseEvent<TPayload>): Promise<void>;
11
- export declare function subscribeToEvent(eventId: string, onMessage: (payload: any) => Promise<void>): Promise<void>;
14
+ export declare function subscribeToEvent(eventId: string, onMessage: (payload: any) => Promise<void>, opts?: RabbitMQEventOptions): Promise<void>;
15
+ export declare function consumeAllMessages<T>(queueName: string): Promise<T[]>;
12
16
  export declare function closeEventBus(): Promise<void>;
@@ -8,9 +8,12 @@ exports.initEventBus = initEventBus;
8
8
  exports.getChannel = getChannel;
9
9
  exports.publishEvent = publishEvent;
10
10
  exports.subscribeToEvent = subscribeToEvent;
11
+ exports.consumeAllMessages = consumeAllMessages;
11
12
  exports.closeEventBus = closeEventBus;
12
13
  const amqplib_1 = __importDefault(require("amqplib"));
13
14
  const instance_utils_1 = require("../../utilities/instance.utils");
15
+ const index_1 = require("../../index");
16
+ const enum_1 = require("../../utilities/enum");
14
17
  let connection;
15
18
  let pubChannel;
16
19
  let subChannel;
@@ -45,7 +48,7 @@ async function publishEvent(event) {
45
48
  });
46
49
  await ch.waitForConfirms();
47
50
  }
48
- async function subscribeToEvent(eventId, onMessage) {
51
+ async function subscribeToEvent(eventId, onMessage, opts) {
49
52
  const ch = getChannel().subChannel;
50
53
  const queueName = `${eventId}`;
51
54
  await ch.assertQueue(queueName, {
@@ -54,26 +57,54 @@ async function subscribeToEvent(eventId, onMessage) {
54
57
  autoDelete: false,
55
58
  });
56
59
  await ch.bindQueue(queueName, exports.EXCHANGE_NAME, eventId);
57
- await ch.consume(queueName, async (msg) => {
60
+ if (opts?.consumeImmediately !== false) {
61
+ await ch.consume(queueName, async (msg) => {
62
+ if (!msg)
63
+ return;
64
+ let processed = false;
65
+ try {
66
+ const payload = JSON.parse(msg.content.toString());
67
+ await onMessage(payload);
68
+ processed = true;
69
+ }
70
+ catch (err) {
71
+ console.error(`Error handling event [${eventId}]`, err);
72
+ }
73
+ finally {
74
+ if (processed)
75
+ ch.ack(msg);
76
+ else
77
+ ch.nack(msg, false, true);
78
+ }
79
+ });
80
+ }
81
+ console.log(`Subscribed to event [${eventId}]`);
82
+ }
83
+ async function consumeAllMessages(queueName) {
84
+ const logger = (0, index_1.getLibraries)().getLoggerKit();
85
+ const ch = getChannel().subChannel;
86
+ const messages = [];
87
+ while (true) {
88
+ const msg = await ch.get(queueName, { noAck: false });
58
89
  if (!msg)
59
- return;
60
- let processed = false;
90
+ break;
61
91
  try {
62
92
  const payload = JSON.parse(msg.content.toString());
63
- await onMessage(payload);
64
- processed = true;
93
+ messages.push(payload);
94
+ ch.ack(msg);
95
+ logger.debug(`Message consumed successfully for event ${queueName}`, {
96
+ tag: enum_1.LogTag.INFRA_QUEUE,
97
+ });
65
98
  }
66
99
  catch (err) {
67
- console.error(`Error handling event [${eventId}]`, err);
100
+ logger.error(`Error processing message for event ${queueName}:`, err, {
101
+ tag: enum_1.LogTag.INFRA_QUEUE,
102
+ });
103
+ ch.nack(msg, false, true);
68
104
  }
69
- finally {
70
- if (processed)
71
- ch.ack(msg);
72
- else
73
- ch.nack(msg, false, true);
74
- }
75
- });
76
- console.log(`Subscribed to event [${eventId}]`);
105
+ }
106
+ logger.debug(`Fetched ${messages.length} messages for event ${queueName}`, { tag: enum_1.LogTag.INFRA_QUEUE });
107
+ return messages;
77
108
  }
78
109
  async function closeEventBus() {
79
110
  if (pubChannel)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;;AAWA,oCAUC;AAED,gCAOC;AAED,oCAYC;AAED,4CAuCC;AAED,sCAKC;AA5FD,sDAA2B;AAE3B,mEAA+D;AAE/D,IAAI,UAA6B,CAAC;AAClC,IAAI,UAA+B,CAAC;AACpC,IAAI,UAAwB,CAAC;AAEhB,QAAA,aAAa,GAAG,aAAa,CAAC;AAC9B,QAAA,qBAAqB,GAAG,UAAU,CAAC;AAEzC,KAAK,UAAU,YAAY,CAAC,SAAiB;IACnD,UAAU,GAAG,MAAM,iBAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,UAAU,GAAG,MAAM,UAAU,CAAC,oBAAoB,EAAE,CAAC;IACrD,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAEhC,UAAU,GAAG,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;IAC9C,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAEhC,MAAM,UAAU,CAAC,cAAc,CAAC,qBAAa,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,0CAA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,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACP,UAAU,GAAG,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;YAC9C,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE;QACpB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import amqp from 'amqplib';\nimport { BaseEvent } from './BaseEvent';\nimport { getInstanceId } from '../../utilities/instance.utils';\n\nlet connection: amqp.ChannelModel;\nlet pubChannel: amqp.ConfirmChannel;\nlet subChannel: amqp.Channel;\n\nexport const EXCHANGE_NAME = 'lyxa.events';\nexport const INSTANCE_ROUTE_PREFIX = 'instance'; // routing key: instance.{instanceName}.{eventType}\n\nexport async function initEventBus(rabbitUrl: string) {\n\tconnection = await amqp.connect(rabbitUrl);\n\tpubChannel = await connection.createConfirmChannel();\n\tattachGuards(pubChannel, 'pub');\n\n\tsubChannel = await connection.createChannel();\n\tattachGuards(subChannel, 'sub');\n\n\tawait pubChannel.assertExchange(EXCHANGE_NAME, 'topic', { durable: true });\n\tconsole.log(`EventBus initialized with instance ID: ${getInstanceId()}`);\n}\n\nexport function getChannel(): { pubChannel: amqp.ConfirmChannel; subChannel: amqp.Channel } {\n\tif (!pubChannel) throw new Error('Channel not initialized. Call initEventBus first.');\n\tif (!subChannel) throw new Error('Channel not initialized. Call initEventBus first.');\n\treturn {\n\t\tpubChannel,\n\t\tsubChannel,\n\t};\n}\n\nexport async function publishEvent<TPayload extends Record<string, unknown>>(\n\tevent: BaseEvent<TPayload>\n): Promise<void> {\n\tconsole.log('taking event', event);\n\n\tconst ch = getChannel().pubChannel;\n\tconst messageBuffer = Buffer.from(JSON.stringify(event.payload));\n\tch.publish(EXCHANGE_NAME, event.eventId, messageBuffer, {\n\t\tcontentType: 'application/json',\n\t\tpersistent: true,\n\t});\n\tawait ch.waitForConfirms();\n}\n\nexport async function subscribeToEvent(\n\teventId: string,\n\tonMessage: (payload: any) => Promise<void>\n): Promise<void> {\n\tconst ch = getChannel().subChannel;\n\tconst queueName = `${eventId}`;\n\t// const queueName = `${eventId}.${getInstanceId()}`;\n\n\tawait ch.assertQueue(queueName, {\n\t\tdurable: true, // survive broker restart\n\t\texclusive: false, // Allow multiple consumers to attach. Only one connection can use it (each pod has own queue). Set to TRUE if each pod needs it's own queue\n\t\tautoDelete: false, // Queue removed when pod disconnects when set to TRUE\n\t\t// arguments: {\n\t\t// \t// Optional safety: limit queue size and TTL to prevent disk issues\n\t\t// \t'x-max-length': 50000, // max 50k messages\n\t\t// \t'x-message-ttl': 24 * 60 * 60 * 1000, // 24h TTL\n\t\t// \t'x-overflow': 'drop-head', // drop oldest messages if full\n\t\t// },\n\t});\n\n\tawait ch.bindQueue(queueName, EXCHANGE_NAME, eventId);\n\n\tawait ch.consume(queueName, async msg => {\n\t\tif (!msg) return;\n\t\tlet processed = false;\n\t\ttry {\n\t\t\tconst payload = JSON.parse(msg.content.toString());\n\t\t\tawait onMessage(payload);\n\t\t\tprocessed = true;\n\t\t} catch (err) {\n\t\t\tconsole.error(`Error handling event [${eventId}]`, err);\n\t\t} finally {\n\t\t\tif (processed) ch.ack(msg);\n\t\t\telse ch.nack(msg, false, true); // retry\n\t\t}\n\t});\n\n\t// console.log(`Subscribed to event [${eventId}] on queue [${queueName}]`);\n\tconsole.log(`Subscribed to event [${eventId}]`);\n}\n\nexport async function closeEventBus(): Promise<void> {\n\tif (pubChannel) await pubChannel.close();\n\tif (subChannel) await subChannel.close();\n\tif (connection) await connection.close();\n\tconsole.log(`EventBus closed for instance [${getInstanceId()}]`);\n}\n\nfunction attachGuards(ch: amqp.Channel | amqp.ConfirmChannel, type: 'pub' | 'sub') {\n\tch.on('close', async () => {\n\t\tconsole.error(`${type} channel closed, recreating...`);\n\t\tif (type === 'pub') {\n\t\t\tpubChannel = await connection.createConfirmChannel();\n\t\t\tawait pubChannel.assertExchange(EXCHANGE_NAME, 'topic', { durable: true });\n\t\t\tattachGuards(pubChannel, 'pub');\n\t\t} else {\n\t\t\tsubChannel = await connection.createChannel();\n\t\t\tattachGuards(subChannel, 'sub');\n\t\t}\n\t});\n\n\tch.on('error', err => {\n\t\tconsole.error(`${type} channel error`, err);\n\t});\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;;AAiBA,oCAUC;AAED,gCAOC;AAED,oCAYC;AAED,4CAyCC;AAED,gDAyBC;AAED,sCAKC;AA/HD,sDAA2B;AAE3B,mEAA+D;AAC/D,uCAA2C;AAC3C,+CAA8C;AAE9C,IAAI,UAA6B,CAAC;AAClC,IAAI,UAA+B,CAAC;AACpC,IAAI,UAAwB,CAAC;AAMhB,QAAA,aAAa,GAAG,aAAa,CAAC;AAC9B,QAAA,qBAAqB,GAAG,UAAU,CAAC;AAEzC,KAAK,UAAU,YAAY,CAAC,SAAiB;IACnD,UAAU,GAAG,MAAM,iBAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,UAAU,GAAG,MAAM,UAAU,CAAC,oBAAoB,EAAE,CAAC;IACrD,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAEhC,UAAU,GAAG,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;IAC9C,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAEhC,MAAM,UAAU,CAAC,cAAc,CAAC,qBAAa,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,0CAA0C,IAAA,8BAAa,GAAE,EAAE,CAAC,CAAC;AAC1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Y,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACP,UAAU,GAAG,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;YAC9C,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE;QACpB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import amqp from 'amqplib';\nimport { BaseEvent } from './BaseEvent';\nimport { getInstanceId } from '../../utilities/instance.utils';\nimport { getLibraries } from '../../index';\nimport { LogTag } from '../../utilities/enum';\n\nlet connection: amqp.ChannelModel;\nlet pubChannel: amqp.ConfirmChannel;\nlet subChannel: amqp.Channel;\n\nexport interface RabbitMQEventOptions {\n\tconsumeImmediately?: boolean;\n}\n\nexport const EXCHANGE_NAME = 'lyxa.events';\nexport const INSTANCE_ROUTE_PREFIX = 'instance'; // routing key: instance.{instanceName}.{eventType}\n\nexport async function initEventBus(rabbitUrl: string) {\n\tconnection = await amqp.connect(rabbitUrl);\n\tpubChannel = await connection.createConfirmChannel();\n\tattachGuards(pubChannel, 'pub');\n\n\tsubChannel = await connection.createChannel();\n\tattachGuards(subChannel, 'sub');\n\n\tawait pubChannel.assertExchange(EXCHANGE_NAME, 'topic', { durable: true });\n\tconsole.log(`EventBus initialized with instance ID: ${getInstanceId()}`);\n}\n\nexport function getChannel(): { pubChannel: amqp.ConfirmChannel; subChannel: amqp.Channel } {\n\tif (!pubChannel) throw new Error('Channel not initialized. Call initEventBus first.');\n\tif (!subChannel) throw new Error('Channel not initialized. Call initEventBus first.');\n\treturn {\n\t\tpubChannel,\n\t\tsubChannel,\n\t};\n}\n\nexport async function publishEvent<TPayload extends Record<string, unknown>>(\n\tevent: BaseEvent<TPayload>\n): Promise<void> {\n\tconsole.log('taking event', event);\n\n\tconst ch = getChannel().pubChannel;\n\tconst messageBuffer = Buffer.from(JSON.stringify(event.payload));\n\tch.publish(EXCHANGE_NAME, event.eventId, messageBuffer, {\n\t\tcontentType: 'application/json',\n\t\tpersistent: true,\n\t});\n\tawait ch.waitForConfirms();\n}\n\nexport async function subscribeToEvent(\n\teventId: string,\n\tonMessage: (payload: any) => Promise<void>,\n\topts?: RabbitMQEventOptions\n): Promise<void> {\n\tconst ch = getChannel().subChannel;\n\tconst queueName = `${eventId}`;\n\t// const queueName = `${eventId}.${getInstanceId()}`;\n\n\tawait ch.assertQueue(queueName, {\n\t\tdurable: true, // survive broker restart\n\t\texclusive: false, // Allow multiple consumers to attach. Only one connection can use it (each pod has own queue). Set to TRUE if each pod needs it's own queue\n\t\tautoDelete: false, // Queue removed when pod disconnects when set to TRUE\n\t\t// arguments: {\n\t\t// \t// Optional safety: limit queue size and TTL to prevent disk issues\n\t\t// \t'x-max-length': 50000, // max 50k messages\n\t\t// \t'x-message-ttl': 24 * 60 * 60 * 1000, // 24h TTL\n\t\t// \t'x-overflow': 'drop-head', // drop oldest messages if full\n\t\t// },\n\t});\n\n\tawait ch.bindQueue(queueName, EXCHANGE_NAME, eventId);\n\tif (opts?.consumeImmediately !== false) {\n\t\tawait ch.consume(queueName, async msg => {\n\t\t\tif (!msg) return;\n\t\t\tlet processed = false;\n\t\t\ttry {\n\t\t\t\tconst payload = JSON.parse(msg.content.toString());\n\t\t\t\tawait onMessage(payload);\n\t\t\t\tprocessed = true;\n\t\t\t} catch (err) {\n\t\t\t\tconsole.error(`Error handling event [${eventId}]`, err);\n\t\t\t} finally {\n\t\t\t\tif (processed) ch.ack(msg);\n\t\t\t\telse ch.nack(msg, false, true); // retry\n\t\t\t}\n\t\t});\n\t}\n\n\t// console.log(`Subscribed to event [${eventId}] on queue [${queueName}]`);\n\tconsole.log(`Subscribed to event [${eventId}]`);\n}\n\nexport async function consumeAllMessages<T>(queueName: string): Promise<T[]> {\n\tconst logger = getLibraries().getLoggerKit();\n\tconst ch = getChannel().subChannel;\n\tconst messages: T[] = [];\n\n\twhile (true) {\n\t\tconst msg = await ch.get(queueName, { noAck: false });\n\t\tif (!msg) break;\n\n\t\ttry {\n\t\t\tconst payload = JSON.parse(msg.content.toString()) as T;\n\t\t\tmessages.push(payload);\n\t\t\tch.ack(msg);\n\t\t\tlogger.debug(`Message consumed successfully for event ${queueName}`, {\n\t\t\t\ttag: LogTag.INFRA_QUEUE,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tlogger.error(`Error processing message for event ${queueName}:`, err, {\n\t\t\t\ttag: LogTag.INFRA_QUEUE,\n\t\t\t});\n\t\t\tch.nack(msg, false, true);\n\t\t}\n\t}\n\tlogger.debug(`Fetched ${messages.length} messages for event ${queueName}`, { tag: LogTag.INFRA_QUEUE });\n\treturn messages;\n}\n\nexport async function closeEventBus(): Promise<void> {\n\tif (pubChannel) await pubChannel.close();\n\tif (subChannel) await subChannel.close();\n\tif (connection) await connection.close();\n\tconsole.log(`EventBus closed for instance [${getInstanceId()}]`);\n}\n\nfunction attachGuards(ch: amqp.Channel | amqp.ConfirmChannel, type: 'pub' | 'sub') {\n\tch.on('close', async () => {\n\t\tconsole.error(`${type} channel closed, recreating...`);\n\t\tif (type === 'pub') {\n\t\t\tpubChannel = await connection.createConfirmChannel();\n\t\t\tawait pubChannel.assertExchange(EXCHANGE_NAME, 'topic', { durable: true });\n\t\t\tattachGuards(pubChannel, 'pub');\n\t\t} else {\n\t\t\tsubChannel = await connection.createChannel();\n\t\t\tattachGuards(subChannel, 'sub');\n\t\t}\n\t});\n\n\tch.on('error', err => {\n\t\tconsole.error(`${type} channel error`, err);\n\t});\n}\n"]}
@@ -1,11 +1,13 @@
1
+ import { RabbitMQEventOptions } from '../index';
1
2
  interface SubscriptionMetadata {
2
3
  eventId: string;
3
4
  targetConstructor: Function;
4
5
  methodName: string;
6
+ opts?: RabbitMQEventOptions;
5
7
  }
6
8
  export declare class SubscriptionRegistry {
7
9
  private static subscriptions;
8
- static register(eventId: string, targetConstructor: Function, methodName: string): void;
10
+ static register(eventId: string, targetConstructor: Function, methodName: string, opts?: RabbitMQEventOptions): void;
9
11
  static getAllSubscriptions(): SubscriptionMetadata[];
10
12
  }
11
13
  export {};
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SubscriptionRegistry = void 0;
4
4
  class SubscriptionRegistry {
5
5
  static subscriptions = [];
6
- static register(eventId, targetConstructor, methodName) {
6
+ static register(eventId, targetConstructor, methodName, opts) {
7
7
  this.subscriptions.push({
8
8
  eventId,
9
9
  targetConstructor,
10
10
  methodName,
11
+ opts: opts,
11
12
  });
12
13
  }
13
14
  static getAllSubscriptions() {
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionRegistry.js","sourceRoot":"/","sources":["libraries/event/registry/SubscriptionRegistry.ts"],"names":[],"mappings":";;;AAMA,MAAa,oBAAoB;IACxB,MAAM,CAAC,aAAa,GAA2B,EAAE,CAAC;IAMnD,MAAM,CAAC,QAAQ,CAAC,OAAe,EAAE,iBAA2B,EAAE,UAAkB;QACtF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACvB,OAAO;YACP,iBAAiB;YACjB,UAAU;SACV,CAAC,CAAC;IACJ,CAAC;IAMM,MAAM,CAAC,mBAAmB;QAChC,OAAO,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;;AArBF,oDAsBC","sourcesContent":["interface SubscriptionMetadata {\n\teventId: string;\n\ttargetConstructor: Function;\n\tmethodName: string;\n}\n\nexport class SubscriptionRegistry {\n\tprivate static subscriptions: SubscriptionMetadata[] = [];\n\n\t/**\n\t * Called by the decorator to record which class method\n\t * is subscribed to which eventId.\n\t */\n\tpublic static register(eventId: string, targetConstructor: Function, methodName: string) {\n\t\tthis.subscriptions.push({\n\t\t\teventId,\n\t\t\ttargetConstructor,\n\t\t\tmethodName,\n\t\t});\n\t}\n\n\t/**\n\t * Called at bootstrap to retrieve all known subscriptions\n\t * so we can actually wire them up.\n\t */\n\tpublic static getAllSubscriptions(): SubscriptionMetadata[] {\n\t\treturn [...this.subscriptions];\n\t}\n}\n"]}
1
+ {"version":3,"file":"SubscriptionRegistry.js","sourceRoot":"/","sources":["libraries/event/registry/SubscriptionRegistry.ts"],"names":[],"mappings":";;;AASA,MAAa,oBAAoB;IACxB,MAAM,CAAC,aAAa,GAA2B,EAAE,CAAC;IAMnD,MAAM,CAAC,QAAQ,CACrB,OAAe,EACf,iBAA2B,EAC3B,UAAkB,EAClB,IAA2B;QAE3B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACvB,OAAO;YACP,iBAAiB;YACjB,UAAU;YACV,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;IACJ,CAAC;IAMM,MAAM,CAAC,mBAAmB;QAChC,OAAO,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;;AA3BF,oDA4BC","sourcesContent":["import { RabbitMQEventOptions } from '../index';\n\ninterface SubscriptionMetadata {\n\teventId: string;\n\ttargetConstructor: Function;\n\tmethodName: string;\n\topts?: RabbitMQEventOptions;\n}\n\nexport class SubscriptionRegistry {\n\tprivate static subscriptions: SubscriptionMetadata[] = [];\n\n\t/**\n\t * Called by the decorator to record which class method\n\t * is subscribed to which eventId.\n\t */\n\tpublic static register(\n\t\teventId: string,\n\t\ttargetConstructor: Function,\n\t\tmethodName: string,\n\t\topts?: RabbitMQEventOptions\n\t) {\n\t\tthis.subscriptions.push({\n\t\t\teventId,\n\t\t\ttargetConstructor,\n\t\t\tmethodName,\n\t\t\topts: opts,\n\t\t});\n\t}\n\n\t/**\n\t * Called at bootstrap to retrieve all known subscriptions\n\t * so we can actually wire them up.\n\t */\n\tpublic static getAllSubscriptions(): SubscriptionMetadata[] {\n\t\treturn [...this.subscriptions];\n\t}\n}\n"]}
@@ -1,8 +1,13 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { LineItem } from '../line-item.model';
3
+ import { LineItemAttribute } from './line-item-attribute.model';
4
+ import { Product } from '../product.model';
3
5
  declare class SelectedLineItemsInfo {
4
6
  lineItemId: Ref<LineItem>;
5
7
  quantity?: number;
8
+ product?: Ref<Product>;
9
+ attributes?: LineItemAttribute[][];
10
+ isOnlyAttributeRefunded?: boolean;
6
11
  }
7
12
  export declare class OrderRefund {
8
13
  isFullRefund?: boolean;
@@ -12,9 +12,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OrderRefund = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const line_item_model_1 = require("../line-item.model");
15
+ const line_item_attribute_model_1 = require("./line-item-attribute.model");
16
+ const product_model_1 = require("../product.model");
15
17
  class SelectedLineItemsInfo {
16
18
  lineItemId;
17
19
  quantity;
20
+ product;
21
+ attributes;
22
+ isOnlyAttributeRefunded;
18
23
  }
19
24
  __decorate([
20
25
  (0, typegoose_1.prop)({ required: true, ref: () => line_item_model_1.LineItem }),
@@ -24,6 +29,18 @@ __decorate([
24
29
  (0, typegoose_1.prop)({ type: Number, default: 1 }),
25
30
  __metadata("design:type", Number)
26
31
  ], SelectedLineItemsInfo.prototype, "quantity", void 0);
32
+ __decorate([
33
+ (0, typegoose_1.prop)({ required: true, ref: () => product_model_1.Product }),
34
+ __metadata("design:type", Object)
35
+ ], SelectedLineItemsInfo.prototype, "product", void 0);
36
+ __decorate([
37
+ (0, typegoose_1.prop)({ type: () => [[line_item_attribute_model_1.LineItemAttribute]], default: [] }),
38
+ __metadata("design:type", Array)
39
+ ], SelectedLineItemsInfo.prototype, "attributes", void 0);
40
+ __decorate([
41
+ (0, typegoose_1.prop)({ type: Boolean }),
42
+ __metadata("design:type", Boolean)
43
+ ], SelectedLineItemsInfo.prototype, "isOnlyAttributeRefunded", void 0);
27
44
  class OrderRefund {
28
45
  isFullRefund;
29
46
  selectedLineItems;
@@ -44,7 +61,7 @@ __decorate([
44
61
  __metadata("design:type", Boolean)
45
62
  ], OrderRefund.prototype, "isFullRefund", void 0);
46
63
  __decorate([
47
- (0, typegoose_1.prop)({ type: () => [SelectedLineItemsInfo], default: [] }),
64
+ (0, typegoose_1.prop)({ type: () => [SelectedLineItemsInfo], default: [], _id: false }),
48
65
  __metadata("design:type", Array)
49
66
  ], OrderRefund.prototype, "selectedLineItems", void 0);
50
67
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"order-refund.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-refund.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,wDAA8C;AAE9C,MAAM,qBAAqB;IAEnB,UAAU,CAAiB;IAG3B,QAAQ,CAAU;CACzB;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;yDACZ;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACV;AAG1B,MAAa,WAAW;IAEhB,YAAY,CAAW;IAGvB,iBAAiB,CAA2B;IAG5C,4BAA4B,CAAU;IAGtC,qCAAqC,CAAU;IAG/C,+BAA+B,CAAU;IAGzC,wCAAwC,CAAU;IAGlD,+BAA+B,CAAU;IAGzC,wCAAwC,CAAU;IAGlD,kCAAkC,CAAU;IAG5C,2CAA2C,CAAU;IAGrD,WAAW,CAAU;IAGrB,oBAAoB,CAAU;CACrC;AApCD,kCAoCC;AAlCO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;iDACV;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sDACR;AAG5C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;iEACU;AAGtC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0EACmB;AAG/C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oEACa;AAGzC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6EACsB;AAGlD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oEACa;AAGzC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6EACsB;AAGlD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uEACgB;AAG5C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gFACyB;AAGrD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gDACP;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACE","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { LineItem } from '../line-item.model';\n\nclass SelectedLineItemsInfo {\n\t@prop({ required: true, ref: () => LineItem })\n\tpublic lineItemId!: Ref<LineItem>;\n\n\t@prop({ type: Number, default: 1 })\n\tpublic quantity?: number;\n}\n\nexport class OrderRefund {\n\t@prop({ type: Boolean, default: false })\n\tpublic isFullRefund?: boolean;\n\n\t@prop({ type: () => [SelectedLineItemsInfo], default: [] })\n\tpublic selectedLineItems?: SelectedLineItemsInfo[];\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic totalRefund?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryTotalRefund?: number;\n}\n"]}
1
+ {"version":3,"file":"order-refund.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-refund.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,wDAA8C;AAC9C,2EAAgE;AAChE,oDAA2C;AAE3C,MAAM,qBAAqB;IAEnB,UAAU,CAAiB;IAG3B,QAAQ,CAAU;IAGlB,OAAO,CAAgB;IAGvB,UAAU,CAAyB;IAGnC,uBAAuB,CAAW;CACzC;AAbO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;yDACZ;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACV;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE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EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oEACa;AAGzC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6EACsB;AAGlD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uEACgB;AAG5C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gFACyB;AAGrD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gDACP;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACE","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { LineItem } from '../line-item.model';\nimport { LineItemAttribute } from './line-item-attribute.model';\nimport { Product } from '../product.model';\n\nclass SelectedLineItemsInfo {\n\t@prop({ required: true, ref: () => LineItem })\n\tpublic lineItemId!: Ref<LineItem>;\n\n\t@prop({ type: Number, default: 1 })\n\tpublic quantity?: number;\n\n\t@prop({ required: true, ref: () => Product })\n\tpublic product?: Ref<Product>;\n\n\t@prop({ type: () => [[LineItemAttribute]], default: [] })\n\tpublic attributes?: LineItemAttribute[][];\n\n\t@prop({ type: Boolean })\n\tpublic isOnlyAttributeRefunded?: boolean;\n}\n\nexport class OrderRefund {\n\t@prop({ type: Boolean, default: false })\n\tpublic isFullRefund?: boolean;\n\n\t@prop({ type: () => [SelectedLineItemsInfo], default: [], _id: false })\n\tpublic selectedLineItems?: SelectedLineItemsInfo[];\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic refundedAmountByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRefundedAmountByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic totalRefund?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryTotalRefund?: number;\n}\n"]}
@@ -2,9 +2,13 @@ import { Ref } from '@typegoose/typegoose';
2
2
  import { ReplacementType } from '../../../../utilities/enum';
3
3
  import { Order } from '../order.model';
4
4
  import { LineItem } from '../line-item.model';
5
+ import { LineItemAttribute } from './line-item-attribute.model';
6
+ import { Product } from '../product.model';
5
7
  declare class SelectedLineItemsInfo {
6
8
  lineItemId: Ref<LineItem>;
7
9
  quantity?: number;
10
+ product?: Ref<Product>;
11
+ attributes?: LineItemAttribute[][];
8
12
  }
9
13
  export declare class ReplacementOrder {
10
14
  originalOrder: Ref<Order>;
@@ -14,9 +14,13 @@ const typegoose_1 = require("@typegoose/typegoose");
14
14
  const enum_1 = require("../../../../utilities/enum");
15
15
  const order_model_1 = require("../order.model");
16
16
  const line_item_model_1 = require("../line-item.model");
17
+ const line_item_attribute_model_1 = require("./line-item-attribute.model");
18
+ const product_model_1 = require("../product.model");
17
19
  class SelectedLineItemsInfo {
18
20
  lineItemId;
19
21
  quantity;
22
+ product;
23
+ attributes;
20
24
  }
21
25
  __decorate([
22
26
  (0, typegoose_1.prop)({ required: true, ref: () => line_item_model_1.LineItem }),
@@ -26,6 +30,14 @@ __decorate([
26
30
  (0, typegoose_1.prop)({ type: Number, default: 1 }),
27
31
  __metadata("design:type", Number)
28
32
  ], SelectedLineItemsInfo.prototype, "quantity", void 0);
33
+ __decorate([
34
+ (0, typegoose_1.prop)({ required: true, ref: () => product_model_1.Product }),
35
+ __metadata("design:type", Object)
36
+ ], SelectedLineItemsInfo.prototype, "product", void 0);
37
+ __decorate([
38
+ (0, typegoose_1.prop)({ type: () => [[line_item_attribute_model_1.LineItemAttribute]], default: [] }),
39
+ __metadata("design:type", Array)
40
+ ], SelectedLineItemsInfo.prototype, "attributes", void 0);
29
41
  class ReplacementOrder {
30
42
  originalOrder;
31
43
  selectedLineItems;
@@ -46,7 +58,7 @@ __decorate([
46
58
  __metadata("design:type", Object)
47
59
  ], ReplacementOrder.prototype, "originalOrder", void 0);
48
60
  __decorate([
49
- (0, typegoose_1.prop)({ type: () => [SelectedLineItemsInfo], default: [] }),
61
+ (0, typegoose_1.prop)({ type: () => [SelectedLineItemsInfo], default: [], _id: false }),
50
62
  __metadata("design:type", Array)
51
63
  ], ReplacementOrder.prototype, "selectedLineItems", void 0);
52
64
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"replacement-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/replacement-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAA6D;AAC7D,gDAAuC;AACvC,wDAA8C;AAE9C,MAAM,qBAAqB;IAEnB,UAAU,CAAiB;IAG3B,QAAQ,CAAU;CACzB;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;yDACZ;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACV;AAG1B,MAAa,gBAAgB;IAErB,aAAa,CAAc;IAG3B,iBAAiB,CAA2B;IAG5C,eAAe,CAAmB;IAGlC,yBAAyB,CAAU;IAGnC,kCAAkC,CAAU;IA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;yEACa;AAGzC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kFACsB;AAGlD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACG","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { ReplacementType } from '../../../../utilities/enum';\nimport { Order } from '../order.model';\nimport { LineItem } from '../line-item.model';\n\nclass SelectedLineItemsInfo {\n\t@prop({ required: true, ref: () => LineItem })\n\tpublic lineItemId!: Ref<LineItem>;\n\n\t@prop({ type: Number, default: 1 })\n\tpublic quantity?: number;\n}\n\nexport class ReplacementOrder {\n\t@prop({ required: true, ref: () => Order })\n\tpublic originalOrder!: Ref<Order>;\n\n\t@prop({ type: () => [SelectedLineItemsInfo], default: [] })\n\tpublic selectedLineItems?: SelectedLineItemsInfo[];\n\n\t@prop({ required: true, type: String, enum: ReplacementType })\n\tpublic replacementType!: ReplacementType;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForDelivery?: number;\n\n\t@prop({ type: String })\n\tpublic bringItem?: string;\n}\n"]}
1
+ {"version":3,"file":"replacement-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/replacement-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAi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;;2DACpB;AAG5C;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAe,EAAE,CAAC;;yDACrB;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mEACO;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4EACgB;AAG5C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;sEACU;AAGtC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+EACmB;AAG/C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;sEACU;AAGtC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+EACmB;AAG/C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yEACa;AAGzC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kFACsB;AAGlD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACG","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { ReplacementType } from '../../../../utilities/enum';\nimport { Order } from '../order.model';\nimport { LineItem } from '../line-item.model';\nimport { LineItemAttribute } from './line-item-attribute.model';\nimport { Product } from '../product.model';\n\nclass SelectedLineItemsInfo {\n\t@prop({ required: true, ref: () => LineItem })\n\tpublic lineItemId!: Ref<LineItem>;\n\n\t@prop({ type: Number, default: 1 })\n\tpublic quantity?: number;\n\n\t@prop({ required: true, ref: () => Product })\n\tpublic product?: Ref<Product>;\n\n\t@prop({ type: () => [[LineItemAttribute]], default: [] })\n\tpublic attributes?: LineItemAttribute[][];\n}\n\nexport class ReplacementOrder {\n\t@prop({ required: true, ref: () => Order })\n\tpublic originalOrder!: Ref<Order>;\n\n\t@prop({ type: () => [SelectedLineItemsInfo], default: [], _id: false })\n\tpublic selectedLineItems?: SelectedLineItemsInfo[];\n\n\t@prop({ required: true, type: String, enum: ReplacementType })\n\tpublic replacementType!: ReplacementType;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForDelivery?: number;\n\n\t@prop({ type: String })\n\tpublic bringItem?: string;\n}\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.3.143
25
+ Version: 1.3.145
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.143",
3
+ "version": "1.3.145",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -26,8 +26,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
26
26
  searchFields?: string[] | undefined;
27
27
  } | undefined;
28
28
  sort?: Record<string, 1 | -1> | undefined;
29
- populate?: any;
30
29
  select?: Record<string, 0 | 1> | undefined;
30
+ populate?: any;
31
31
  query?: Record<string, any> | undefined;
32
32
  }, {
33
33
  search?: {
@@ -36,8 +36,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
36
36
  } | undefined;
37
37
  sort?: Record<string, 1 | -1> | undefined;
38
38
  size?: number | undefined;
39
- populate?: any;
40
39
  select?: Record<string, 0 | 1> | undefined;
40
+ populate?: any;
41
41
  query?: Record<string, any> | undefined;
42
42
  page?: number | undefined;
43
43
  }>>;
@@ -733,12 +733,12 @@ export declare const GetByIdInputSchema: z.ZodObject<{
733
733
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
734
734
  }, "strip", z.ZodTypeAny, {
735
735
  _id: import("mongoose").Types.ObjectId;
736
- populate?: any;
737
736
  select?: Record<string, 0 | 1> | undefined;
737
+ populate?: any;
738
738
  }, {
739
739
  _id: string | import("mongoose").Types.ObjectId;
740
- populate?: any;
741
740
  select?: Record<string, 0 | 1> | undefined;
741
+ populate?: any;
742
742
  }>;
743
743
  export type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;
744
744
  export declare const GetProductByIdInputSchema: z.ZodObject<{
@@ -751,12 +751,12 @@ export declare const GetProductByIdInputSchema: z.ZodObject<{
751
751
  _id: import("mongoose").Types.ObjectId;
752
752
  withAttributeHiddenItems: boolean;
753
753
  withAddonsHiddenItems: boolean;
754
- populate?: any;
755
754
  select?: Record<string, 0 | 1> | undefined;
755
+ populate?: any;
756
756
  }, {
757
757
  _id: string | import("mongoose").Types.ObjectId;
758
- populate?: any;
759
758
  select?: Record<string, 0 | 1> | undefined;
759
+ populate?: any;
760
760
  withAttributeHiddenItems?: boolean | undefined;
761
761
  withAddonsHiddenItems?: boolean | undefined;
762
762
  }>;
@@ -768,13 +768,13 @@ export declare const GetOrderByIdInputSchema: z.ZodObject<{
768
768
  userOrderCompletionScope: z.ZodOptional<z.ZodNativeEnum<typeof UserOrderCompletionScope>>;
769
769
  }, "strip", z.ZodTypeAny, {
770
770
  _id: import("mongoose").Types.ObjectId;
771
- populate?: any;
772
771
  select?: Record<string, 0 | 1> | undefined;
772
+ populate?: any;
773
773
  userOrderCompletionScope?: UserOrderCompletionScope | undefined;
774
774
  }, {
775
775
  _id: string | import("mongoose").Types.ObjectId;
776
- populate?: any;
777
776
  select?: Record<string, 0 | 1> | undefined;
777
+ populate?: any;
778
778
  userOrderCompletionScope?: UserOrderCompletionScope | undefined;
779
779
  }>;
780
780
  export type GetOrderByIdInputDTO = DTO<typeof GetOrderByIdInputSchema>;
@@ -782,11 +782,11 @@ export declare const GetByTokenInputSchema: z.ZodOptional<z.ZodObject<{
782
782
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
783
783
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
784
784
  }, "strip", z.ZodTypeAny, {
785
- populate?: any;
786
785
  select?: Record<string, 0 | 1> | undefined;
787
- }, {
788
786
  populate?: any;
787
+ }, {
789
788
  select?: Record<string, 0 | 1> | undefined;
789
+ populate?: any;
790
790
  }>>;
791
791
  export type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;
792
792
  export declare const GetOneQuerySchema: z.ZodObject<{
@@ -794,12 +794,12 @@ export declare const GetOneQuerySchema: z.ZodObject<{
794
794
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
795
795
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
796
796
  }, "strip", z.ZodTypeAny, {
797
- populate?: any;
798
797
  select?: Record<string, 0 | 1> | undefined;
798
+ populate?: any;
799
799
  query?: Record<string, any> | undefined;
800
800
  }, {
801
- populate?: any;
802
801
  select?: Record<string, 0 | 1> | undefined;
802
+ populate?: any;
803
803
  query?: Record<string, any> | undefined;
804
804
  }>;
805
805
  export type GetOneQueryDTO = DTO<typeof GetOneQuerySchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.3.143",
3
+ "version": "1.3.145",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",