@lyxa.ai/core 1.4.316 → 1.4.318

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/index.js +2 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/libraries/google-location/google-location.client.d.ts +7 -0
  4. package/dist/libraries/google-location/google-location.client.js +44 -0
  5. package/dist/libraries/google-location/google-location.client.js.map +1 -0
  6. package/dist/libraries/google-location/google-location.dto.d.ts +103 -0
  7. package/dist/libraries/google-location/google-location.dto.js +3 -0
  8. package/dist/libraries/google-location/google-location.dto.js.map +1 -0
  9. package/dist/libraries/google-location/google-location.service.d.ts +15 -0
  10. package/dist/libraries/google-location/google-location.service.js +181 -0
  11. package/dist/libraries/google-location/google-location.service.js.map +1 -0
  12. package/dist/libraries/google-location/index.d.ts +1 -0
  13. package/dist/libraries/google-location/index.js +18 -0
  14. package/dist/libraries/google-location/index.js.map +1 -0
  15. package/dist/libraries/index.d.ts +2 -0
  16. package/dist/libraries/index.js +4 -0
  17. package/dist/libraries/index.js.map +1 -1
  18. package/dist/libraries/map/providers/osrm.d.ts +1 -1
  19. package/dist/libraries/map/providers/osrm.js +3 -2
  20. package/dist/libraries/map/providers/osrm.js.map +1 -1
  21. package/dist/libraries/socket/events/chatroom-message-send.socket.event.d.ts +33 -33
  22. package/dist/libraries/socket/events/order-actions.socket.event.d.ts +20 -20
  23. package/dist/libraries/socket/events/rider-location-update.socket.event.d.ts +8 -8
  24. package/dist/libraries/socket/events/ticket-actions.socket.event.d.ts +8 -8
  25. package/dist/libraries/socket/events/ticket-assign.socket.event.d.ts +40 -40
  26. package/dist/libraries/trpc/middlewares/auth.d.ts +2 -2
  27. package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.d.ts +2 -2
  28. package/dist/libraries/trpc/middlewares/phone-verified.d.ts +2 -2
  29. package/dist/libraries/trpc/middlewares/publicUserDecoder.d.ts +2 -2
  30. package/dist/types/README.md +1 -1
  31. package/dist/types/package.json +1 -1
  32. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -131,7 +131,8 @@ async function registerLibraries(options) {
131
131
  typedi_1.Container.set(llm_provider_service_1.LLMCompletionService, llmCompletionService);
132
132
  const googleMapsKey = await getLibraries().getSecretsService().getKey('GOOGLE_MAPS_API_KEY');
133
133
  const googleMapService = new map_1.GoogleMapsService(redisInstance, googleMapsKey);
134
- const osrmMapService = new osrm_1.OsrmMapService();
134
+ const osrmUrl = await getLibraries().getSecretsService().getKey('OSRM_URL');
135
+ const osrmMapService = new osrm_1.OsrmMapService(osrmUrl);
135
136
  const mapServiceInstance = new map_1.MapService(googleMapService, osrmMapService);
136
137
  typedi_1.Container.set(map_1.MapService, mapServiceInstance);
137
138
  const bobUsername = await getLibraries().getSecretsService().getKey('BOB_USER_NAME');
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,sCA0BC;AAED,8CAiHC;AAED,oCAEC;AAvLD,qFAAqF;AAErF,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,6CAA6E;AAC7E,0FAAuF;AACvF,yCAAgE;AAChE,yDAAmE;AACnE,wFAAmF;AACnF,wEAAmE;AACnE,iEAA4F;AAC5F,+GAA4G;AAC5G,yDAAgE;AAChE,yFAA+E;AAC/E,mFAAyE;AACzE,4FAAuG;AACvG,uDAAuD;AACvD,gFAA2E;AAC3E,8EAAyE;AACzE,gGAAkG;AAElG,+EAAyF;AAGzF,6GAA4G;AAAnG,4IAAA,4BAA4B,OAAA;AACrC,2CAAyD;AAAhD,6GAAA,oBAAoB,OAAA;AAC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,GAAG,CAAC,yCAAkB,EAAE,UAAU,CAAC,CAAC;IAC9C,kBAAS,CAAC,GAAG,CAAC,iCAAc,EAAE,cAAc,CAAC,CAAC;IAE9C,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAEtC,MAAM,WAAW,GAAG,MAAM,IAAA,sCAAc,EAAC,OAAO,EAAE,WAAW,IAAI,2DAA4B,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACnH,MAAM,IAAA,8BAAsB,EAAC,WAAW,CAAC,CAAC;IAE1C,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,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACjF,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';\n\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 { initRabbitMQConnection, subscribeToEvent } from './libraries/event';\nimport { SubscriptionRegistry } from './libraries/event/registry/SubscriptionRegistry';\nimport { GoogleMapsService, MapService } from './libraries/map';\nimport { CachedSettingsService } from './libraries/cache/settings';\nimport { FirebaseFcmService } from './libraries/notification/firebase-fcm.service';\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 { getRabbitMQUrl } from './utilities/environment/rabbitmq-environments';\nimport { getRedisUrl } from './utilities/environment/redis-environments';\nimport { disconnectAllEntitiesFromInstance } from './libraries/socket/connections/instance-disconnect';\nimport { LyxaLoggerKit } from './libraries/logger-kit';\nimport { LyxaFcmService } from './libraries/notification/lyxa-fcm.service';\nimport { LyxaFcmSender } from './libraries/notification/lyxa-fcm-sender';\nimport { FirebaseMessageBuilderFactory } from './libraries/notification/firebase-message.builder';\nimport { GoogleTranslateService } from './libraries/google-translate';\nimport { LLMCompletionService, LLMProvider } from './libraries/llm/llm-provider-service';\n\nexport { ConfigurationOptions } from './libraries/configuration';\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nexport { initGlobalConnection } from './libraries/mongo';\nexport * from './libraries/google-translate';\n\nexport async function bootstrapCore(options?: ConfigurationOptions) {\n\ttry {\n\t\tawait registerLibraries(options);\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 redisUrl = options?.redisURL\n\t\t? options.redisURL\n\t\t: await getRedisUrl(options?.environment ?? EnvironmentConfigurationType.DEV);\n\n\tconst redisInstance = new RedisService(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\n\t// Setup firebase\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\n\tContainer.set(FirebaseService, firebaseInstance);\n\n\t//Setup google translate\n\t// Container.set(GoogleTranslateService, Container.get(GoogleTranslateService));\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 LLM service\n\tconst llmCompletionService = new LLMCompletionService(LLMProvider.OPENAI);\n\tContainer.set(LLMCompletionService, llmCompletionService);\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 fcmService = new FirebaseFcmService();\n\tconst builder = new FirebaseMessageBuilderFactory();\n\tconst lyxaFcmSender = new LyxaFcmSender(fcmService, builder);\n\tconst lyxaFcmService = new LyxaFcmService(lyxaFcmSender);\n\n\tContainer.set(FirebaseFcmService, fcmService);\n\tContainer.set(LyxaFcmService, lyxaFcmService);\n\n\tconsole.log('Initialized everything');\n\n\tconst rabbitMQUrl = await getRabbitMQUrl(options?.environment ?? EnvironmentConfigurationType.DEV, secretInstance);\n\tawait initRabbitMQConnection(rabbitMQUrl);\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 => instance[methodName](payload));\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,sCA0BC;AAED,8CAkHC;AAED,oCAEC;AAvLD,qFAAqF;AAErF,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,6CAA6E;AAC7E,0FAAuF;AACvF,yCAAgE;AAChE,yDAAmE;AACnE,wFAAmF;AACnF,wEAAmE;AACnE,iEAA4F;AAC5F,+GAA4G;AAC5G,yDAAgE;AAChE,yFAA+E;AAC/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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';\n\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 { initRabbitMQConnection, subscribeToEvent } from './libraries/event';\nimport { SubscriptionRegistry } from './libraries/event/registry/SubscriptionRegistry';\nimport { GoogleMapsService, MapService } from './libraries/map';\nimport { CachedSettingsService } from './libraries/cache/settings';\nimport { FirebaseFcmService } from './libraries/notification/firebase-fcm.service';\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 { getRabbitMQUrl } from './utilities/environment/rabbitmq-environments';\nimport { getRedisUrl } from './utilities/environment/redis-environments';\nimport { disconnectAllEntitiesFromInstance } from './libraries/socket/connections/instance-disconnect';\nimport { LyxaLoggerKit } from './libraries/logger-kit';\nimport { LyxaFcmService } from './libraries/notification/lyxa-fcm.service';\nimport { LyxaFcmSender } from './libraries/notification/lyxa-fcm-sender';\nimport { FirebaseMessageBuilderFactory } from './libraries/notification/firebase-message.builder';\nimport { LLMCompletionService, LLMProvider } from './libraries/llm/llm-provider-service';\n\nexport { ConfigurationOptions } from './libraries/configuration';\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nexport { initGlobalConnection } from './libraries/mongo';\nexport * from './libraries/google-translate';\n\nexport async function bootstrapCore(options?: ConfigurationOptions) {\n\ttry {\n\t\tawait registerLibraries(options);\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 redisUrl = options?.redisURL\n\t\t? options.redisURL\n\t\t: await getRedisUrl(options?.environment ?? EnvironmentConfigurationType.DEV);\n\n\tconst redisInstance = new RedisService(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\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 LLM service\n\tconst llmCompletionService = new LLMCompletionService(LLMProvider.OPENAI);\n\tContainer.set(LLMCompletionService, llmCompletionService);\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 osrmUrl = await getLibraries().getSecretsService().getKey('OSRM_URL');\n\tconst osrmMapService = new OsrmMapService(osrmUrl as string);\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 fcmService = new FirebaseFcmService();\n\tconst builder = new FirebaseMessageBuilderFactory();\n\tconst lyxaFcmSender = new LyxaFcmSender(fcmService, builder);\n\tconst lyxaFcmService = new LyxaFcmService(lyxaFcmSender);\n\n\tContainer.set(FirebaseFcmService, fcmService);\n\tContainer.set(LyxaFcmService, lyxaFcmService);\n\n\tconsole.log('Initialized everything');\n\n\tconst rabbitMQUrl = await getRabbitMQUrl(\n\t\toptions?.environment ?? EnvironmentConfigurationType.DEV,\n\t\tsecretInstance\n\t);\n\tawait initRabbitMQConnection(rabbitMQUrl);\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 => instance[methodName](payload));\n\t}\n}\n\nexport function getLibraries(): LibraryManager {\n\treturn Container.get(LibraryManager);\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { LyxaLogger } from '../logger';
2
+ export declare class GoogleLocationClient {
3
+ private readonly logger;
4
+ constructor(logger: LyxaLogger);
5
+ private getUrl;
6
+ callGoogleMapsAPI(endpoint: string, apiKey: string, params: Record<string, string>): Promise<any>;
7
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GoogleLocationClient = void 0;
13
+ const typedi_1 = require("typedi");
14
+ const logger_1 = require("../logger");
15
+ let GoogleLocationClient = class GoogleLocationClient {
16
+ logger;
17
+ constructor(logger) {
18
+ this.logger = logger;
19
+ }
20
+ getUrl(endpoint, apiKey) {
21
+ return `https://maps.googleapis.com/maps/api/${endpoint}/json?key=${apiKey}`;
22
+ }
23
+ async callGoogleMapsAPI(endpoint, apiKey, params) {
24
+ const baseUrl = this.getUrl(endpoint, apiKey);
25
+ const queryParams = new URLSearchParams(params).toString();
26
+ const finalUrl = `${baseUrl}&${queryParams}`;
27
+ const response = await fetch(finalUrl, { method: 'GET' });
28
+ const responseBody = await response.text();
29
+ if (!response.ok) {
30
+ this.logger.logger.error(`Google Maps API request failed for ${endpoint}`, {
31
+ status: response.status,
32
+ body: responseBody,
33
+ });
34
+ throw new Error(responseBody);
35
+ }
36
+ return JSON.parse(responseBody);
37
+ }
38
+ };
39
+ exports.GoogleLocationClient = GoogleLocationClient;
40
+ exports.GoogleLocationClient = GoogleLocationClient = __decorate([
41
+ (0, typedi_1.Service)(),
42
+ __metadata("design:paramtypes", [logger_1.LyxaLogger])
43
+ ], GoogleLocationClient);
44
+ //# sourceMappingURL=google-location.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-location.client.js","sourceRoot":"/","sources":["libraries/google-location/google-location.client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAiC;AACjC,sCAAuC;AAGhC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACH;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE3C,MAAM,CAAC,QAAgB,EAAE,MAAc;QAC9C,OAAO,wCAAwC,QAAQ,aAAa,MAAM,EAAE,CAAC;IAC9E,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC7B,QAAgB,EAChB,MAAc,EACd,MAA8B;QAE9B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE9C,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC3D,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI,WAAW,EAAE,CAAC;QAE7C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE3C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,EAAE;gBAC1E,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,IAAI,EAAE,YAAY;aAClB,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;CACD,CAAA;AA9BY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,gBAAO,GAAE;qCAE4B,mBAAU;GADnC,oBAAoB,CA8BhC","sourcesContent":["import { Service } from 'typedi';\nimport { LyxaLogger } from '../logger';\n\n@Service()\nexport class GoogleLocationClient {\n\tconstructor(private readonly logger: LyxaLogger) {}\n\n\tprivate getUrl(endpoint: string, apiKey: string): string {\n\t\treturn `https://maps.googleapis.com/maps/api/${endpoint}/json?key=${apiKey}`;\n\t}\n\n\tpublic async callGoogleMapsAPI(\n\t\tendpoint: string,\n\t\tapiKey: string,\n\t\tparams: Record<string, string>\n\t): Promise<any> {\n\t\tconst baseUrl = this.getUrl(endpoint, apiKey);\n\n\t\tconst queryParams = new URLSearchParams(params).toString();\n\t\tconst finalUrl = `${baseUrl}&${queryParams}`;\n\n\t\tconst response = await fetch(finalUrl, { method: 'GET' });\n\t\tconst responseBody = await response.text();\n\n\t\tif (!response.ok) {\n\t\t\tthis.logger.logger.error(`Google Maps API request failed for ${endpoint}`, {\n\t\t\t\tstatus: response.status,\n\t\t\t\tbody: responseBody,\n\t\t\t});\n\t\t\tthrow new Error(responseBody);\n\t\t}\n\n\t\treturn JSON.parse(responseBody);\n\t}\n}\n"]}
@@ -0,0 +1,103 @@
1
+ export interface GoogleAutocompleteInputDTO {
2
+ searchText: string;
3
+ sessionToken?: string;
4
+ location?: string;
5
+ radius?: string;
6
+ components?: string;
7
+ [key: string]: string | undefined;
8
+ }
9
+ export interface AutocompletePrediction {
10
+ description: string;
11
+ matched_substrings: {
12
+ length: number;
13
+ offset: number;
14
+ }[];
15
+ place_id: string;
16
+ reference: string;
17
+ structured_formatting: {
18
+ main_text: string;
19
+ main_text_matched_substrings: {
20
+ length: number;
21
+ offset: number;
22
+ }[];
23
+ secondary_text: string;
24
+ };
25
+ terms: {
26
+ offset: number;
27
+ value: string;
28
+ }[];
29
+ types: string[];
30
+ }
31
+ export interface GoogleAutocompleteResponse {
32
+ predictions: AutocompletePrediction[];
33
+ status: 'OK' | 'ZERO_RESULTS' | 'OVER_QUERY_LIMIT' | 'REQUEST_DENIED' | 'INVALID_REQUEST' | 'UNKNOWN_ERROR';
34
+ error_message?: string;
35
+ }
36
+ export interface GooglePlaceDetailsInputDTO {
37
+ placeId: string;
38
+ sessionToken?: string;
39
+ }
40
+ export interface AddressComponent {
41
+ long_name: string;
42
+ short_name: string;
43
+ types: string[];
44
+ }
45
+ export interface PlaceDetailsResult {
46
+ address_components: AddressComponent[];
47
+ formatted_address: string;
48
+ geometry: {
49
+ location: {
50
+ lat: number;
51
+ lng: number;
52
+ };
53
+ viewport: {
54
+ northeast: {
55
+ lat: number;
56
+ lng: number;
57
+ };
58
+ southwest: {
59
+ lat: number;
60
+ lng: number;
61
+ };
62
+ };
63
+ };
64
+ name: string;
65
+ }
66
+ export interface GooglePlaceDetailsResponse {
67
+ html_attributions: string[];
68
+ result: PlaceDetailsResult;
69
+ status: 'OK' | 'ZERO_RESULTS' | 'OVER_QUERY_LIMIT' | 'REQUEST_DENIED' | 'INVALID_REQUEST' | 'UNKNOWN_ERROR';
70
+ error_message?: string;
71
+ }
72
+ export interface GoogleReverseGeocodeInputDTO {
73
+ latitude: string;
74
+ longitude: string;
75
+ }
76
+ export interface GeocodingResult {
77
+ address_components: AddressComponent[];
78
+ formatted_address: string;
79
+ geometry: {
80
+ location: {
81
+ lat: number;
82
+ lng: number;
83
+ };
84
+ location_type: string;
85
+ viewport: {
86
+ northeast: {
87
+ lat: number;
88
+ lng: number;
89
+ };
90
+ southwest: {
91
+ lat: number;
92
+ lng: number;
93
+ };
94
+ };
95
+ };
96
+ place_id: string;
97
+ types: string[];
98
+ }
99
+ export interface GoogleReverseGeocodeResponse {
100
+ results: GeocodingResult[];
101
+ status: 'OK' | 'ZERO_RESULTS' | 'OVER_QUERY_LIMIT' | 'REQUEST_DENIED' | 'INVALID_REQUEST' | 'UNKNOWN_ERROR';
102
+ error_message?: string;
103
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=google-location.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-location.dto.js","sourceRoot":"/","sources":["libraries/google-location/google-location.dto.ts"],"names":[],"mappings":"","sourcesContent":["// ==========================================\n// 1. AUTOCOMPLETE DTOs\n// ==========================================\n\nexport interface GoogleAutocompleteInputDTO {\n\tsearchText: string;\n\tsessionToken?: string;\n\tlocation?: string; // format: \"lat,lng\" (e.g. \"23.7465,90.3760\")\n\tradius?: string; // distance in meters\n\tcomponents?: string; // e.g. \"country:bd\"\n\t[key: string]: string | undefined; // For handling any other dynamic client query params safely\n}\n\nexport interface AutocompletePrediction {\n\tdescription: string;\n\tmatched_substrings: {\n\t\tlength: number;\n\t\toffset: number;\n\t}[];\n\tplace_id: string;\n\treference: string;\n\tstructured_formatting: {\n\t\tmain_text: string;\n\t\tmain_text_matched_substrings: {\n\t\t\tlength: number;\n\t\t\toffset: number;\n\t\t}[];\n\t\tsecondary_text: string;\n\t};\n\tterms: {\n\t\toffset: number;\n\t\tvalue: string;\n\t}[];\n\ttypes: string[];\n}\n\nexport interface GoogleAutocompleteResponse {\n\tpredictions: AutocompletePrediction[];\n\tstatus: 'OK' | 'ZERO_RESULTS' | 'OVER_QUERY_LIMIT' | 'REQUEST_DENIED' | 'INVALID_REQUEST' | 'UNKNOWN_ERROR';\n\terror_message?: string;\n}\n\n// ==========================================\n// 2. PLACE DETAILS DTOs\n// ==========================================\n\nexport interface GooglePlaceDetailsInputDTO {\n\tplaceId: string;\n\tsessionToken?: string;\n}\n\nexport interface AddressComponent {\n\tlong_name: string;\n\tshort_name: string;\n\ttypes: string[];\n}\n\nexport interface PlaceDetailsResult {\n\taddress_components: AddressComponent[];\n\tformatted_address: string;\n\tgeometry: {\n\t\tlocation: {\n\t\t\tlat: number;\n\t\t\tlng: number;\n\t\t};\n\t\tviewport: {\n\t\t\tnortheast: { lat: number; lng: number };\n\t\t\tsouthwest: { lat: number; lng: number };\n\t\t};\n\t};\n\tname: string;\n}\n\nexport interface GooglePlaceDetailsResponse {\n\thtml_attributions: string[];\n\tresult: PlaceDetailsResult;\n\tstatus: 'OK' | 'ZERO_RESULTS' | 'OVER_QUERY_LIMIT' | 'REQUEST_DENIED' | 'INVALID_REQUEST' | 'UNKNOWN_ERROR';\n\terror_message?: string;\n}\n\n// ==========================================\n// 3. REVERSE GEOCODING DTOs\n// ==========================================\n\nexport interface GoogleReverseGeocodeInputDTO {\n\tlatitude: string;\n\tlongitude: string;\n}\n\nexport interface GeocodingResult {\n\taddress_components: AddressComponent[];\n\tformatted_address: string;\n\tgeometry: {\n\t\tlocation: { lat: number; lng: number };\n\t\tlocation_type: string;\n\t\tviewport: {\n\t\t\tnortheast: { lat: number; lng: number };\n\t\t\tsouthwest: { lat: number; lng: number };\n\t\t};\n\t};\n\tplace_id: string;\n\ttypes: string[];\n}\n\nexport interface GoogleReverseGeocodeResponse {\n\tresults: GeocodingResult[];\n\tstatus: 'OK' | 'ZERO_RESULTS' | 'OVER_QUERY_LIMIT' | 'REQUEST_DENIED' | 'INVALID_REQUEST' | 'UNKNOWN_ERROR';\n\terror_message?: string;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { GoogleLocationClient } from './google-location.client';
2
+ import { SecretManagerService } from '../secrets';
3
+ import { RedisService } from '../redis';
4
+ import { LyxaLogger } from '../logger';
5
+ import { GoogleAutocompleteInputDTO, GoogleAutocompleteResponse, GooglePlaceDetailsInputDTO, GooglePlaceDetailsResponse, GoogleReverseGeocodeInputDTO, GoogleReverseGeocodeResponse } from './google-location.dto';
6
+ export declare class GoogleLocationService {
7
+ private readonly client;
8
+ private readonly secretManager;
9
+ private readonly redisService;
10
+ private readonly logger;
11
+ constructor(client: GoogleLocationClient, secretManager: SecretManagerService, redisService: RedisService, logger: LyxaLogger);
12
+ getAutocomplete(input: GoogleAutocompleteInputDTO): Promise<GoogleAutocompleteResponse>;
13
+ getPlaceDetails(input: GooglePlaceDetailsInputDTO): Promise<GooglePlaceDetailsResponse>;
14
+ getReverseGeocode(input: GoogleReverseGeocodeInputDTO): Promise<GoogleReverseGeocodeResponse>;
15
+ }
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.GoogleLocationService = void 0;
16
+ const typedi_1 = require("typedi");
17
+ const google_location_client_1 = require("./google-location.client");
18
+ const secrets_1 = require("../secrets");
19
+ const redis_1 = require("../redis");
20
+ const logger_1 = require("../logger");
21
+ let GoogleLocationService = class GoogleLocationService {
22
+ client;
23
+ secretManager;
24
+ redisService;
25
+ logger;
26
+ constructor(client, secretManager, redisService, logger) {
27
+ this.client = client;
28
+ this.secretManager = secretManager;
29
+ this.redisService = redisService;
30
+ this.logger = logger;
31
+ }
32
+ async getAutocomplete(input) {
33
+ const { searchText, sessionToken, ...otherParams } = input;
34
+ if (!searchText?.trim()) {
35
+ this.logger.logger.info('Google Autocomplete skipped: empty input provided');
36
+ return { predictions: [], status: 'OK' };
37
+ }
38
+ const queryParams = { input: searchText, ...otherParams };
39
+ if (sessionToken)
40
+ queryParams.sessiontoken = sessionToken;
41
+ const querySummary = Object.entries(queryParams)
42
+ .map(([k, v]) => `${k}:${v}`)
43
+ .join('|');
44
+ const cacheKey = `maps:autocomplete:${this.redisService.sanitizeKey(querySummary)}`;
45
+ try {
46
+ const cached = await this.redisService.getCachedObject(cacheKey);
47
+ if (cached !== undefined) {
48
+ this.logger.logger.info('Google Autocomplete Cache HIT', { cacheKey, input });
49
+ return cached;
50
+ }
51
+ this.logger.logger.info('Google Autocomplete Cache MISS - Calling API', { cacheKey, input });
52
+ const apiKey = await this.secretManager.getKey('GOOGLE_MAPS_API_KEY');
53
+ if (!apiKey) {
54
+ this.logger.logger.error('GOOGLE_MAPS_API_KEY is missing in SecretManager');
55
+ throw new Error('GOOGLE_MAPS_API_KEY is not configured');
56
+ }
57
+ const result = await this.client.callGoogleMapsAPI('place/autocomplete', apiKey, queryParams);
58
+ if (result.status === 'OK') {
59
+ await this.redisService.cacheObject(cacheKey, result, 86400);
60
+ this.logger.logger.info('Google Autocomplete response cached successfully', {
61
+ cacheKey,
62
+ predictionCount: result.predictions?.length ?? 0,
63
+ });
64
+ }
65
+ else {
66
+ this.logger.logger.warn('Google Autocomplete returned non-OK status', {
67
+ status: result.status,
68
+ errorMessage: result.error_message,
69
+ });
70
+ }
71
+ return result;
72
+ }
73
+ catch (error) {
74
+ this.logger.logger.error('Google Autocomplete failed', { input, error });
75
+ throw error;
76
+ }
77
+ }
78
+ async getPlaceDetails(input) {
79
+ const { placeId, sessionToken } = input;
80
+ if (!placeId) {
81
+ this.logger.logger.error('Google Place Details failed: missing placeId');
82
+ throw new Error('Missing place_id');
83
+ }
84
+ const cacheKey = `maps:details:${placeId}`;
85
+ try {
86
+ const cached = await this.redisService.getCachedObject(cacheKey);
87
+ if (cached !== undefined) {
88
+ this.logger.logger.info('Google Place Details Cache HIT', { cacheKey, placeId });
89
+ return cached;
90
+ }
91
+ this.logger.logger.info('Google Place Details Cache MISS - Calling API', { cacheKey, placeId });
92
+ const apiKey = await this.secretManager.getKey('GOOGLE_MAPS_API_KEY');
93
+ if (!apiKey) {
94
+ this.logger.logger.error('GOOGLE_MAPS_API_KEY is missing in SecretManager');
95
+ throw new Error('GOOGLE_MAPS_API_KEY is not configured');
96
+ }
97
+ const params = {
98
+ place_id: placeId,
99
+ fields: 'name,formatted_address,geometry,address_component',
100
+ };
101
+ if (sessionToken)
102
+ params.sessiontoken = sessionToken;
103
+ const result = await this.client.callGoogleMapsAPI('place/details', apiKey, params);
104
+ if (result.status === 'OK') {
105
+ await this.redisService.cacheObject(cacheKey, result, 604800);
106
+ this.logger.logger.info('Google Place Details cached successfully', { cacheKey, placeId });
107
+ }
108
+ else {
109
+ this.logger.logger.warn('Google Place Details returned non-OK status', {
110
+ status: result.status,
111
+ errorMessage: result.error_message,
112
+ });
113
+ }
114
+ return result;
115
+ }
116
+ catch (error) {
117
+ this.logger.logger.error('Google Place Details failed', { input, error });
118
+ throw error;
119
+ }
120
+ }
121
+ async getReverseGeocode(input) {
122
+ const { latitude, longitude } = input;
123
+ if (!latitude || !longitude) {
124
+ this.logger.logger.error('Google Reverse Geocode failed: missing coordinates', { latitude, longitude });
125
+ throw new Error('Missing latitude or longitude');
126
+ }
127
+ const roundedLat = parseFloat(latitude).toFixed(4);
128
+ const roundedLng = parseFloat(longitude).toFixed(4);
129
+ const cacheKey = `maps:geocode:${roundedLat}:${roundedLng}`;
130
+ try {
131
+ const cached = await this.redisService.getCachedObject(cacheKey);
132
+ if (cached !== undefined) {
133
+ this.logger.logger.info('Google Reverse Geocode Cache HIT', { cacheKey, roundedLat, roundedLng });
134
+ return cached;
135
+ }
136
+ this.logger.logger.info('Google Reverse Geocode Cache MISS - Calling API', {
137
+ cacheKey,
138
+ latitude,
139
+ longitude,
140
+ });
141
+ const apiKey = await this.secretManager.getKey('GOOGLE_MAPS_API_KEY');
142
+ if (!apiKey) {
143
+ this.logger.logger.error('GOOGLE_MAPS_API_KEY is missing in SecretManager');
144
+ throw new Error('GOOGLE_MAPS_API_KEY is not configured');
145
+ }
146
+ const params = { latlng: `${latitude},${longitude}` };
147
+ const result = await this.client.callGoogleMapsAPI('geocode', apiKey, params);
148
+ if (result.status === 'OK') {
149
+ await this.redisService.cacheObject(cacheKey, result, 259200);
150
+ this.logger.logger.info('Google Reverse Geocode cached successfully', {
151
+ cacheKey,
152
+ resultsCount: result.results?.length ?? 0,
153
+ });
154
+ }
155
+ else {
156
+ this.logger.logger.warn('Google Reverse Geocode returned non-OK status', {
157
+ status: result.status,
158
+ errorMessage: result.error_message,
159
+ });
160
+ }
161
+ return result;
162
+ }
163
+ catch (error) {
164
+ this.logger.logger.error('Google Reverse Geocode failed', { input, error });
165
+ throw error;
166
+ }
167
+ }
168
+ };
169
+ exports.GoogleLocationService = GoogleLocationService;
170
+ exports.GoogleLocationService = GoogleLocationService = __decorate([
171
+ (0, typedi_1.Service)(),
172
+ __param(0, (0, typedi_1.Inject)()),
173
+ __param(1, (0, typedi_1.Inject)()),
174
+ __param(2, (0, typedi_1.Inject)()),
175
+ __param(3, (0, typedi_1.Inject)()),
176
+ __metadata("design:paramtypes", [google_location_client_1.GoogleLocationClient,
177
+ secrets_1.SecretManagerService,
178
+ redis_1.RedisService,
179
+ logger_1.LyxaLogger])
180
+ ], GoogleLocationService);
181
+ //# sourceMappingURL=google-location.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-location.service.js","sourceRoot":"/","sources":["libraries/google-location/google-location.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAyC;AACzC,qEAAgE;AAChE,wCAAkD;AAClD,oCAAwC;AACxC,sCAAuC;AAWhC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAEL;IACA;IACA;IACA;IAJ5B,YAC4B,MAA4B,EAC5B,aAAmC,EACnC,YAA0B,EAC1B,MAAkB;QAHlB,WAAM,GAAN,MAAM,CAAsB;QAC5B,kBAAa,GAAb,aAAa,CAAsB;QACnC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,WAAM,GAAN,MAAM,CAAY;IAC3C,CAAC;IAEG,KAAK,CAAC,eAAe,CAAC,KAAiC;QAC7D,MAAM,EAAE,UAAU,EAAE,YAA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,MAAsC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5E,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD,CAAA;AAnKY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,gBAAO,GAAE;IAGP,WAAA,IAAA,eAAM,GAAE,CAAA;IACR,WAAA,IAAA,eAAM,GAAE,CAAA;IACR,WAAA,IAAA,eAAM,GAAE,CAAA;IACR,WAAA,IAAA,eAAM,GAAE,CAAA;qCAH0B,6CAAoB;QACb,8BAAoB;QACrB,oBAAY;QAClB,mBAAU;GALlC,qBAAqB,CAmKjC","sourcesContent":["import { Inject, Service } from 'typedi';\nimport { GoogleLocationClient } from './google-location.client';\nimport { SecretManagerService } from '../secrets';\nimport { RedisService } from '../redis';\nimport { LyxaLogger } from '../logger';\nimport {\n\tGoogleAutocompleteInputDTO,\n\tGoogleAutocompleteResponse,\n\tGooglePlaceDetailsInputDTO,\n\tGooglePlaceDetailsResponse,\n\tGoogleReverseGeocodeInputDTO,\n\tGoogleReverseGeocodeResponse,\n} from './google-location.dto';\n\n@Service()\nexport class GoogleLocationService {\n\tconstructor(\n\t\t@Inject() private readonly client: GoogleLocationClient,\n\t\t@Inject() private readonly secretManager: SecretManagerService,\n\t\t@Inject() private readonly redisService: RedisService,\n\t\t@Inject() private readonly logger: LyxaLogger\n\t) {}\n\n\tpublic async getAutocomplete(input: GoogleAutocompleteInputDTO): Promise<GoogleAutocompleteResponse> {\n\t\tconst { searchText, sessionToken, ...otherParams } = input;\n\n\t\tif (!searchText?.trim()) {\n\t\t\tthis.logger.logger.info('Google Autocomplete skipped: empty input provided');\n\t\t\treturn { predictions: [], status: 'OK' };\n\t\t}\n\n\t\tconst queryParams: Record<string, string> = { input: searchText, ...otherParams };\n\t\tif (sessionToken) queryParams.sessiontoken = sessionToken;\n\n\t\tconst querySummary = Object.entries(queryParams)\n\t\t\t.map(([k, v]) => `${k}:${v}`)\n\t\t\t.join('|');\n\t\tconst cacheKey = `maps:autocomplete:${this.redisService.sanitizeKey(querySummary)}`;\n\n\t\ttry {\n\t\t\tconst cached = await this.redisService.getCachedObject<GoogleAutocompleteResponse>(cacheKey);\n\t\t\tif (cached !== undefined) {\n\t\t\t\tthis.logger.logger.info('Google Autocomplete Cache HIT', { cacheKey, input });\n\t\t\t\treturn cached;\n\t\t\t}\n\n\t\t\tthis.logger.logger.info('Google Autocomplete Cache MISS - Calling API', { cacheKey, input });\n\n\t\t\tconst apiKey = await this.secretManager.getKey('GOOGLE_MAPS_API_KEY');\n\t\t\tif (!apiKey) {\n\t\t\t\tthis.logger.logger.error('GOOGLE_MAPS_API_KEY is missing in SecretManager');\n\t\t\t\tthrow new Error('GOOGLE_MAPS_API_KEY is not configured');\n\t\t\t}\n\n\t\t\tconst result = await this.client.callGoogleMapsAPI('place/autocomplete', apiKey, queryParams);\n\n\t\t\tif (result.status === 'OK') {\n\t\t\t\tawait this.redisService.cacheObject(cacheKey, result, 86400);\n\t\t\t\tthis.logger.logger.info('Google Autocomplete response cached successfully', {\n\t\t\t\t\tcacheKey,\n\t\t\t\t\tpredictionCount: result.predictions?.length ?? 0,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.logger.logger.warn('Google Autocomplete returned non-OK status', {\n\t\t\t\t\tstatus: result.status,\n\t\t\t\t\terrorMessage: result.error_message,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn result as GoogleAutocompleteResponse;\n\t\t} catch (error) {\n\t\t\tthis.logger.logger.error('Google Autocomplete failed', { input, error });\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic async getPlaceDetails(input: GooglePlaceDetailsInputDTO): Promise<GooglePlaceDetailsResponse> {\n\t\tconst { placeId, sessionToken } = input;\n\t\tif (!placeId) {\n\t\t\tthis.logger.logger.error('Google Place Details failed: missing placeId');\n\t\t\tthrow new Error('Missing place_id');\n\t\t}\n\n\t\tconst cacheKey = `maps:details:${placeId}`;\n\n\t\ttry {\n\t\t\tconst cached = await this.redisService.getCachedObject<GooglePlaceDetailsResponse>(cacheKey);\n\t\t\tif (cached !== undefined) {\n\t\t\t\tthis.logger.logger.info('Google Place Details Cache HIT', { cacheKey, placeId });\n\t\t\t\treturn cached;\n\t\t\t}\n\n\t\t\tthis.logger.logger.info('Google Place Details Cache MISS - Calling API', { cacheKey, placeId });\n\n\t\t\tconst apiKey = await this.secretManager.getKey('GOOGLE_MAPS_API_KEY');\n\t\t\tif (!apiKey) {\n\t\t\t\tthis.logger.logger.error('GOOGLE_MAPS_API_KEY is missing in SecretManager');\n\t\t\t\tthrow new Error('GOOGLE_MAPS_API_KEY is not configured');\n\t\t\t}\n\n\t\t\tconst params: Record<string, string> = {\n\t\t\t\tplace_id: placeId,\n\t\t\t\tfields: 'name,formatted_address,geometry,address_component',\n\t\t\t};\n\t\t\tif (sessionToken) params.sessiontoken = sessionToken;\n\n\t\t\tconst result = await this.client.callGoogleMapsAPI('place/details', apiKey, params);\n\n\t\t\tif (result.status === 'OK') {\n\t\t\t\tawait this.redisService.cacheObject(cacheKey, result, 604800);\n\t\t\t\tthis.logger.logger.info('Google Place Details cached successfully', { cacheKey, placeId });\n\t\t\t} else {\n\t\t\t\tthis.logger.logger.warn('Google Place Details returned non-OK status', {\n\t\t\t\t\tstatus: result.status,\n\t\t\t\t\terrorMessage: result.error_message,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn result as GooglePlaceDetailsResponse;\n\t\t} catch (error) {\n\t\t\tthis.logger.logger.error('Google Place Details failed', { input, error });\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic async getReverseGeocode(input: GoogleReverseGeocodeInputDTO): Promise<GoogleReverseGeocodeResponse> {\n\t\tconst { latitude, longitude } = input;\n\t\tif (!latitude || !longitude) {\n\t\t\tthis.logger.logger.error('Google Reverse Geocode failed: missing coordinates', { latitude, longitude });\n\t\t\tthrow new Error('Missing latitude or longitude');\n\t\t}\n\n\t\tconst roundedLat = parseFloat(latitude).toFixed(4);\n\t\tconst roundedLng = parseFloat(longitude).toFixed(4);\n\t\tconst cacheKey = `maps:geocode:${roundedLat}:${roundedLng}`;\n\n\t\ttry {\n\t\t\tconst cached = await this.redisService.getCachedObject<GoogleReverseGeocodeResponse>(cacheKey);\n\t\t\tif (cached !== undefined) {\n\t\t\t\tthis.logger.logger.info('Google Reverse Geocode Cache HIT', { cacheKey, roundedLat, roundedLng });\n\t\t\t\treturn cached;\n\t\t\t}\n\n\t\t\tthis.logger.logger.info('Google Reverse Geocode Cache MISS - Calling API', {\n\t\t\t\tcacheKey,\n\t\t\t\tlatitude,\n\t\t\t\tlongitude,\n\t\t\t});\n\n\t\t\tconst apiKey = await this.secretManager.getKey('GOOGLE_MAPS_API_KEY');\n\t\t\tif (!apiKey) {\n\t\t\t\tthis.logger.logger.error('GOOGLE_MAPS_API_KEY is missing in SecretManager');\n\t\t\t\tthrow new Error('GOOGLE_MAPS_API_KEY is not configured');\n\t\t\t}\n\n\t\t\tconst params = { latlng: `${latitude},${longitude}` };\n\n\t\t\tconst result = await this.client.callGoogleMapsAPI('geocode', apiKey, params);\n\n\t\t\tif (result.status === 'OK') {\n\t\t\t\tawait this.redisService.cacheObject(cacheKey, result, 259200);\n\t\t\t\tthis.logger.logger.info('Google Reverse Geocode cached successfully', {\n\t\t\t\t\tcacheKey,\n\t\t\t\t\tresultsCount: result.results?.length ?? 0,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.logger.logger.warn('Google Reverse Geocode returned non-OK status', {\n\t\t\t\t\tstatus: result.status,\n\t\t\t\t\terrorMessage: result.error_message,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn result as GoogleReverseGeocodeResponse;\n\t\t} catch (error) {\n\t\t\tthis.logger.logger.error('Google Reverse Geocode failed', { input, error });\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from './google-location.service';
@@ -0,0 +1,18 @@
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("./google-location.service"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/google-location/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C","sourcesContent":["export * from './google-location.service';\n"]}
@@ -16,6 +16,7 @@ import { LyxaLoggerKit } from './logger-kit';
16
16
  import { ICloudStorage, StorageProvider } from './cloud-storage';
17
17
  import { LyxaFcmService } from './notification/lyxa-fcm.service';
18
18
  import { GoogleTranslateService } from './google-translate';
19
+ import { GoogleLocationService } from './google-location';
19
20
  import { LLMCompletionService } from './llm/llm-provider-service';
20
21
  export declare class LibraryManager {
21
22
  private readonly _singletons;
@@ -26,6 +27,7 @@ export declare class LibraryManager {
26
27
  private resolve;
27
28
  getLogger(): LyxaLogger;
28
29
  getGoogleTranslateService(): GoogleTranslateService;
30
+ getGoogleLocationService(): GoogleLocationService;
29
31
  getLoggerKit(): LyxaLoggerKit;
30
32
  getMicroServiceDispatcher(): MicroServiceDispatcher;
31
33
  getTwilioService(): TwilioService;
@@ -26,6 +26,7 @@ const logger_kit_1 = require("./logger-kit");
26
26
  const cloud_storage_1 = require("./cloud-storage");
27
27
  const lyxa_fcm_service_1 = require("./notification/lyxa-fcm.service");
28
28
  const google_translate_1 = require("./google-translate");
29
+ const google_location_1 = require("./google-location");
29
30
  const llm_provider_service_1 = require("./llm/llm-provider-service");
30
31
  let LibraryManager = class LibraryManager {
31
32
  _singletons = new Map();
@@ -47,6 +48,9 @@ let LibraryManager = class LibraryManager {
47
48
  getGoogleTranslateService() {
48
49
  return this.resolve(google_translate_1.GoogleTranslateService);
49
50
  }
51
+ getGoogleLocationService() {
52
+ return this.resolve(google_location_1.GoogleLocationService);
53
+ }
50
54
  getLoggerKit() {
51
55
  return this.resolve(logger_kit_1.LyxaLoggerKit);
52
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAA4C;AAC5C,qCAAyC;AACzC,qCAAsC;AACtC,6CAAsD;AACtD,uCAAiD;AACjD,mCAAuC;AACvC,mDAAuD;AACvD,qCAAyC;AACzC,yCAA6C;AAC7C,kDAAoD;AACpD,+BAAmC;AACnC,+CAAyD;AACzD,8EAAyE;AACzE,8DAAyD;AACzD,uDAAsE;AACtE,6CAA6C;AAC7C,mDAAsF;AACtF,sEAAiE;AACjE,yDAA4D;AAC5D,qEAAkE;AAG3D,IAAM,cAAc,GAApB,MAAM,cAAc;IAIT,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAC;IAMnD,aAAa,CAAiB;IACrB,YAAY,GAAG,IAAI,GAAG,EAAyB,CAAC;IAChD,cAAc,GAAG,IAAI,GAAG,EAAkC,CAAC;IAC3D,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE1D,OAAO,CAAI,KAAgC;QAClD,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAkB,CAAC;QAC5D,IAAI,QAAQ,KAAK,SAA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wBAAwB;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,gCAAqB,CAAC,CAAC;IAC5C,CAAC;IAEM,iBAAiB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,iCAAc,CAAC,CAAC;IACrC,CAAC;IAEM,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,yCAAkB,CAAC,CAAC;IACzC,CAAC;IACM,gBAAgB;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,+BAAa,CAAC,CAAC;IACpC,CAAC;IACM,wBAAwB;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,uCAAqB,CAAC,CAAC;IAC5C,CAAC;IACM,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,4BAAU,CAAC,CAAC;IACjC,CAAC;IACM,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,2CAAoB,CAAC,CAAC;IAC3C,CAAC;CACD,CAAA;AAhHY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,gBAAO,GAAE;GACG,cAAc,CAgH1B","sourcesContent":["import { Container, Service } from 'typedi';\nimport { TwilioService } from './twilio';\nimport { LyxaLogger } from './logger';\nimport { MicroServiceDispatcher } from './dispatcher';\nimport { SecretManagerService } from './secrets';\nimport { RedisService } from './redis';\nimport { ConfigurationService } from './configuration';\nimport { UploadService } from './upload';\nimport { FirebaseService } from './firebase';\nimport { TokenRepository } from './auth/repository';\nimport { MapService } from './map';\nimport { CachedSettingsService } from './cache/settings';\nimport { FirebaseFcmService } from './notification/firebase-fcm.service';\nimport { BullMQService } from './bullmq/bull-mq-service';\nimport { BOBService, CashSettlementService } from './cash-settlement';\nimport { LyxaLoggerKit } from './logger-kit';\nimport { CloudStorageFactory, ICloudStorage, StorageProvider } from './cloud-storage';\nimport { LyxaFcmService } from './notification/lyxa-fcm.service';\nimport { GoogleTranslateService } from './google-translate';\nimport { LLMCompletionService } from './llm/llm-provider-service';\n\n@Service()\nexport class LibraryManager {\n\t// Memoized TypeDI singletons — resolved from the Container once, then reused.\n\t// LibraryManager itself is a @Service() singleton (getLibraries() -> Container.get),\n\t// so these caches live for the process lifetime.\n\tprivate readonly _singletons = new Map<unknown, unknown>();\n\n\t// Upload/storage services are constructed (not Container-managed). They hold only\n\t// immutable state derived from their bucket name + the process-fixed tenet, so a\n\t// single instance per (bucket, provider) is safe. Keyed by bucket/tenet to preserve\n\t// isolation should the resolved tenet ever differ.\n\tprivate _globalUpload?: UploadService;\n\tprivate readonly _tenetUpload = new Map<string, UploadService>();\n\tprivate readonly _globalStorage = new Map<StorageProvider, ICloudStorage>();\n\tprivate readonly _tenetStorage = new Map<string, ICloudStorage>();\n\n\tprivate resolve<T>(token: new (...args: any[]) => T): T {\n\t\tlet instance = this._singletons.get(token) as T | undefined;\n\t\tif (instance === undefined) {\n\t\t\tinstance = Container.get(token);\n\t\t\tthis._singletons.set(token, instance);\n\t\t}\n\t\treturn instance;\n\t}\n\n\tpublic getLogger(): LyxaLogger {\n\t\treturn this.resolve(LyxaLogger);\n\t}\n\tpublic getGoogleTranslateService() {\n\t\treturn this.resolve(GoogleTranslateService);\n\t}\n\tpublic getLoggerKit(): LyxaLoggerKit {\n\t\treturn this.resolve(LyxaLoggerKit);\n\t}\n\tpublic getMicroServiceDispatcher(): MicroServiceDispatcher {\n\t\treturn this.resolve(MicroServiceDispatcher);\n\t}\n\tpublic getTwilioService(): TwilioService {\n\t\treturn this.resolve(TwilioService);\n\t}\n\tpublic getSecretsService(): SecretManagerService {\n\t\treturn this.resolve(SecretManagerService);\n\t}\n\tpublic getRedisService(): RedisService {\n\t\treturn this.resolve(RedisService);\n\t}\n\tpublic getConfigurationService(): ConfigurationService {\n\t\treturn this.resolve(ConfigurationService);\n\t}\n\tpublic getFirebaseService(): FirebaseService {\n\t\treturn this.resolve(FirebaseService);\n\t}\n\tpublic getAuthTokenRepository(): TokenRepository {\n\t\treturn this.resolve(TokenRepository);\n\t}\n\tpublic getGlobalUploadService(): UploadService {\n\t\treturn (this._globalUpload ??= new UploadService());\n\t}\n\tpublic getTenetUploadService(): UploadService {\n\t\tconst bucket = 'lyxa-' + this.getConfigurationService().options.tenet;\n\t\tlet service = this._tenetUpload.get(bucket);\n\t\tif (!service) {\n\t\t\tservice = new UploadService(bucket);\n\t\t\tthis._tenetUpload.set(bucket, service);\n\t\t}\n\t\treturn service;\n\t}\n\n\tpublic getGlobalStorageService(provider: StorageProvider = StorageProvider.GCS): ICloudStorage {\n\t\tlet service = this._globalStorage.get(provider);\n\t\tif (!service) {\n\t\t\tservice = CloudStorageFactory.create(undefined, provider);\n\t\t\tthis._globalStorage.set(provider, service);\n\t\t}\n\t\treturn service;\n\t}\n\n\tpublic getTenetStorageService(provider: StorageProvider = StorageProvider.GCS): ICloudStorage {\n\t\tconst bucket = 'lyxa-' + this.getConfigurationService().options.tenet;\n\t\tconst key = `${bucket}:${provider}`;\n\t\tlet service = this._tenetStorage.get(key);\n\t\tif (!service) {\n\t\t\tservice = CloudStorageFactory.create(bucket, provider);\n\t\t\tthis._tenetStorage.set(key, service);\n\t\t}\n\t\treturn service;\n\t}\n\tpublic getMapService(): MapService {\n\t\treturn this.resolve(MapService);\n\t}\n\tpublic getCachedSettingsService(): CachedSettingsService {\n\t\treturn this.resolve(CachedSettingsService);\n\t}\n\n\tpublic getLyxaFcmService(): LyxaFcmService {\n\t\treturn this.resolve(LyxaFcmService);\n\t}\n\n\tpublic getFCMService(): FirebaseFcmService {\n\t\treturn this.resolve(FirebaseFcmService);\n\t}\n\tpublic getBullMQService(): BullMQService {\n\t\treturn this.resolve(BullMQService);\n\t}\n\tpublic getCashSettlementService(): CashSettlementService {\n\t\treturn this.resolve(CashSettlementService);\n\t}\n\tpublic getBOBService(): BOBService {\n\t\treturn this.resolve(BOBService);\n\t}\n\tpublic getLLMService(): LLMCompletionService {\n\t\treturn this.resolve(LLMCompletionService);\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/index.ts"],"names":[],"mappings":";;;;;;;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CAAC;IACjC,CAAC;IACM,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,2CAAoB,CAAC,CAAC;IAC3C,CAAC;CACD,CAAA;AAnHY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,gBAAO,GAAE;GACG,cAAc,CAmH1B","sourcesContent":["import { Container, Service } from 'typedi';\nimport { TwilioService } from './twilio';\nimport { LyxaLogger } from './logger';\nimport { MicroServiceDispatcher } from './dispatcher';\nimport { SecretManagerService } from './secrets';\nimport { RedisService } from './redis';\nimport { ConfigurationService } from './configuration';\nimport { UploadService } from './upload';\nimport { FirebaseService } from './firebase';\nimport { TokenRepository } from './auth/repository';\nimport { MapService } from './map';\nimport { CachedSettingsService } from './cache/settings';\nimport { FirebaseFcmService } from './notification/firebase-fcm.service';\nimport { BullMQService } from './bullmq/bull-mq-service';\nimport { BOBService, CashSettlementService } from './cash-settlement';\nimport { LyxaLoggerKit } from './logger-kit';\nimport { CloudStorageFactory, ICloudStorage, StorageProvider } from './cloud-storage';\nimport { LyxaFcmService } from './notification/lyxa-fcm.service';\nimport { GoogleTranslateService } from './google-translate';\nimport { GoogleLocationService } from './google-location';\nimport { LLMCompletionService } from './llm/llm-provider-service';\n\n@Service()\nexport class LibraryManager {\n\t// Memoized TypeDI singletons — resolved from the Container once, then reused.\n\t// LibraryManager itself is a @Service() singleton (getLibraries() -> Container.get),\n\t// so these caches live for the process lifetime.\n\tprivate readonly _singletons = new Map<unknown, unknown>();\n\n\t// Upload/storage services are constructed (not Container-managed). They hold only\n\t// immutable state derived from their bucket name + the process-fixed tenet, so a\n\t// single instance per (bucket, provider) is safe. Keyed by bucket/tenet to preserve\n\t// isolation should the resolved tenet ever differ.\n\tprivate _globalUpload?: UploadService;\n\tprivate readonly _tenetUpload = new Map<string, UploadService>();\n\tprivate readonly _globalStorage = new Map<StorageProvider, ICloudStorage>();\n\tprivate readonly _tenetStorage = new Map<string, ICloudStorage>();\n\n\tprivate resolve<T>(token: new (...args: any[]) => T): T {\n\t\tlet instance = this._singletons.get(token) as T | undefined;\n\t\tif (instance === undefined) {\n\t\t\tinstance = Container.get(token);\n\t\t\tthis._singletons.set(token, instance);\n\t\t}\n\t\treturn instance;\n\t}\n\n\tpublic getLogger(): LyxaLogger {\n\t\treturn this.resolve(LyxaLogger);\n\t}\n\tpublic getGoogleTranslateService() {\n\t\treturn this.resolve(GoogleTranslateService);\n\t}\n\tpublic getGoogleLocationService(): GoogleLocationService {\n\t\treturn this.resolve(GoogleLocationService);\n\t}\n\tpublic getLoggerKit(): LyxaLoggerKit {\n\t\treturn this.resolve(LyxaLoggerKit);\n\t}\n\tpublic getMicroServiceDispatcher(): MicroServiceDispatcher {\n\t\treturn this.resolve(MicroServiceDispatcher);\n\t}\n\tpublic getTwilioService(): TwilioService {\n\t\treturn this.resolve(TwilioService);\n\t}\n\tpublic getSecretsService(): SecretManagerService {\n\t\treturn this.resolve(SecretManagerService);\n\t}\n\tpublic getRedisService(): RedisService {\n\t\treturn this.resolve(RedisService);\n\t}\n\tpublic getConfigurationService(): ConfigurationService {\n\t\treturn this.resolve(ConfigurationService);\n\t}\n\tpublic getFirebaseService(): FirebaseService {\n\t\treturn this.resolve(FirebaseService);\n\t}\n\tpublic getAuthTokenRepository(): TokenRepository {\n\t\treturn this.resolve(TokenRepository);\n\t}\n\tpublic getGlobalUploadService(): UploadService {\n\t\treturn (this._globalUpload ??= new UploadService());\n\t}\n\tpublic getTenetUploadService(): UploadService {\n\t\tconst bucket = 'lyxa-' + this.getConfigurationService().options.tenet;\n\t\tlet service = this._tenetUpload.get(bucket);\n\t\tif (!service) {\n\t\t\tservice = new UploadService(bucket);\n\t\t\tthis._tenetUpload.set(bucket, service);\n\t\t}\n\t\treturn service;\n\t}\n\n\tpublic getGlobalStorageService(provider: StorageProvider = StorageProvider.GCS): ICloudStorage {\n\t\tlet service = this._globalStorage.get(provider);\n\t\tif (!service) {\n\t\t\tservice = CloudStorageFactory.create(undefined, provider);\n\t\t\tthis._globalStorage.set(provider, service);\n\t\t}\n\t\treturn service;\n\t}\n\n\tpublic getTenetStorageService(provider: StorageProvider = StorageProvider.GCS): ICloudStorage {\n\t\tconst bucket = 'lyxa-' + this.getConfigurationService().options.tenet;\n\t\tconst key = `${bucket}:${provider}`;\n\t\tlet service = this._tenetStorage.get(key);\n\t\tif (!service) {\n\t\t\tservice = CloudStorageFactory.create(bucket, provider);\n\t\t\tthis._tenetStorage.set(key, service);\n\t\t}\n\t\treturn service;\n\t}\n\tpublic getMapService(): MapService {\n\t\treturn this.resolve(MapService);\n\t}\n\tpublic getCachedSettingsService(): CachedSettingsService {\n\t\treturn this.resolve(CachedSettingsService);\n\t}\n\n\tpublic getLyxaFcmService(): LyxaFcmService {\n\t\treturn this.resolve(LyxaFcmService);\n\t}\n\n\tpublic getFCMService(): FirebaseFcmService {\n\t\treturn this.resolve(FirebaseFcmService);\n\t}\n\tpublic getBullMQService(): BullMQService {\n\t\treturn this.resolve(BullMQService);\n\t}\n\tpublic getCashSettlementService(): CashSettlementService {\n\t\treturn this.resolve(CashSettlementService);\n\t}\n\tpublic getBOBService(): BOBService {\n\t\treturn this.resolve(BOBService);\n\t}\n\tpublic getLLMService(): LLMCompletionService {\n\t\treturn this.resolve(LLMCompletionService);\n\t}\n}\n"]}
@@ -4,7 +4,7 @@ export declare class OsrmMapService implements IMapService {
4
4
  private zoneExtraTimeModel;
5
5
  private readonly DEFAULT_EXTRA_TIME;
6
6
  private readonly _url;
7
- constructor();
7
+ constructor(url: string);
8
8
  getDistanceInfo(origin: ICoordinate, destination: ICoordinate): Promise<IDistanceInfo>;
9
9
  getDistanceMatrix(origins: ICoordinate[], destinations: ICoordinate[]): Promise<IRouteMatrixDTO[]>;
10
10
  getWaypointsDistanceInfo(origin: ICoordinate, destination: ICoordinate, waypoints: ICoordinate[]): Promise<IWaypointDistanceInfo>;
@@ -10,8 +10,9 @@ class OsrmMapService {
10
10
  zoneModel;
11
11
  zoneExtraTimeModel;
12
12
  DEFAULT_EXTRA_TIME = 0;
13
- _url = 'https://api-v2-development.lyxa.ai/distance';
14
- constructor() {
13
+ _url;
14
+ constructor(url) {
15
+ this._url = url;
15
16
  this.zoneModel = models_1.ZoneModel;
16
17
  this.zoneExtraTimeModel = models_1.ZoneExtraTimeModel;
17
18
  }