@lyxa.ai/core 1.4.276 → 1.4.277

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
@@ -120,11 +120,7 @@ async function registerLibraries(options) {
120
120
  typedi_1.Container.set(logger_kit_1.LyxaLoggerKit, loggerKit);
121
121
  const firebaseInstance = new firebase_1.FirebaseService(configurationInstance);
122
122
  typedi_1.Container.set(firebase_1.FirebaseService, firebaseInstance);
123
- const googleTranslateApiKey = await getLibraries().getSecretsService().getKey('GOOGLE_TRANSLATE_API_KEY');
124
- if (!googleTranslateApiKey) {
125
- throw new Error('GOOGLE_TRANSLATE_API_KEY not found');
126
- }
127
- typedi_1.Container.set(google_translate_1.GoogleTranslateService, new google_translate_1.GoogleTranslateService(googleTranslateApiKey));
123
+ typedi_1.Container.set(google_translate_1.GoogleTranslateService, typedi_1.Container.get(google_translate_1.GoogleTranslateService));
128
124
  const microserviceDispatcherInstance = new dispatcher_1.MicroServiceDispatcher(secretInstance);
129
125
  typedi_1.Container.set(dispatcher_1.MicroServiceDispatcher, microserviceDispatcherInstance);
130
126
  const twilioServiceInstance = new twilio_1.TwilioService();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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;AA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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 { RabbitMQUrlMap } from './utilities/environment/rabbitmq-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 { TransliterationProvider, TransliterationService } from './libraries/transliteration/transliteration-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 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\n\t// Setup firebase\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\n\tContainer.set(FirebaseService, firebaseInstance);\n\n\t//Setup google translate\n\tconst googleTranslateApiKey = await getLibraries().getSecretsService().getKey('GOOGLE_TRANSLATE_API_KEY');\n\n\tif (!googleTranslateApiKey) {\n\t\tthrow new Error('GOOGLE_TRANSLATE_API_KEY not found');\n\t}\n\n\tContainer.set(GoogleTranslateService, new GoogleTranslateService(googleTranslateApiKey));\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 Transliteration service\n\tconst transliterationService = new TransliterationService(TransliterationProvider.OPENAI);\n\tContainer.set(TransliterationService, transliterationService);\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\tawait initRabbitMQConnection(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 => 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,8CA4GC;AAED,oCAEC;AAjLD,qFAAqF;AAErF,IAAA,0CAAqB,GAAE,CAAC;AAExB,2C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AC,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 { RabbitMQUrlMap } from './utilities/environment/rabbitmq-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 { TransliterationProvider, TransliterationService } from './libraries/transliteration/transliteration-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 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\n\t// Setup firebase\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\n\tContainer.set(FirebaseService, firebaseInstance);\n\n\t//Setup google translate\n\tContainer.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 Transliteration service\n\tconst transliterationService = new TransliterationService(TransliterationProvider.OPENAI);\n\tContainer.set(TransliterationService, transliterationService);\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\tawait initRabbitMQConnection(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 => instance[methodName](payload));\n\t}\n}\n\nexport function getLibraries(): LibraryManager {\n\treturn Container.get(LibraryManager);\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { GoogleTranslateInputDTO, TranslateResponse } from './google-translate.dto';
2
+ export declare class GoogleTranslateClient {
3
+ private getUrl;
4
+ translate(apiKey: string, input: GoogleTranslateInputDTO): Promise<TranslateResponse>;
5
+ }
@@ -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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.GoogleTranslateClient = void 0;
10
+ const typedi_1 = require("typedi");
11
+ const logSettings_1 = require("@typegoose/typegoose/lib/logSettings");
12
+ let GoogleTranslateClient = class GoogleTranslateClient {
13
+ getUrl(apiKey) {
14
+ return `https://translation.googleapis.com/language/translate/v2?key=${apiKey}`;
15
+ }
16
+ async translate(apiKey, input) {
17
+ const response = await fetch(this.getUrl(apiKey), {
18
+ method: 'POST',
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ },
22
+ body: JSON.stringify(input),
23
+ });
24
+ const responseBody = await response.text();
25
+ logSettings_1.logger.info(`Google Translate Response: ${JSON.stringify({
26
+ status: response.status,
27
+ body: responseBody,
28
+ })}`);
29
+ if (!response.ok) {
30
+ logSettings_1.logger.error(`Google Translate API request failed: ${JSON.stringify({
31
+ status: response.status,
32
+ input,
33
+ body: responseBody,
34
+ })}`);
35
+ throw new Error(responseBody);
36
+ }
37
+ return JSON.parse(responseBody);
38
+ }
39
+ };
40
+ exports.GoogleTranslateClient = GoogleTranslateClient;
41
+ exports.GoogleTranslateClient = GoogleTranslateClient = __decorate([
42
+ (0, typedi_1.Service)()
43
+ ], GoogleTranslateClient);
44
+ //# sourceMappingURL=google-translate.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-translate.client.js","sourceRoot":"/","sources":["libraries/google-translate/google-translate.client.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAiC;AAEjC,sEAA8D;AAGvD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACzB,MAAM,CAAC,MAAc;QAC5B,OAAO,gEAAgE,MAAM,EAAE,CAAC;IACjF,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,MAAc,EAAE,KAA8B;QACpE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACR,cAAc,EAAE,kBAAkB;aAClC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SAC3B,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAE3C,oBAAM,CAAC,IAAI,CACV,8BAA8B,IAAI,CAAC,SAAS,CAAC;YAC5C,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,IAAI,EAAE,YAAY;SAClB,CAAC,EAAE,CACJ,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAClB,oBAAM,CAAC,KAAK,CACX,wCAAwC,IAAI,CAAC,SAAS,CAAC;gBACtD,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,KAAK;gBACL,IAAI,EAAE,YAAY;aAClB,CAAC,EAAE,CACJ,CAAC;YAEF,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAsB,CAAC;IACtD,CAAC;CACD,CAAA;AApCY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,gBAAO,GAAE;GACG,qBAAqB,CAoCjC","sourcesContent":["import { Service } from 'typedi';\nimport { GoogleTranslateInputDTO, TranslateResponse } from './google-translate.dto';\nimport { logger } from '@typegoose/typegoose/lib/logSettings';\n\n@Service()\nexport class GoogleTranslateClient {\n\tprivate getUrl(apiKey: string): string {\n\t\treturn `https://translation.googleapis.com/language/translate/v2?key=${apiKey}`;\n\t}\n\n\tpublic async translate(apiKey: string, input: GoogleTranslateInputDTO): Promise<TranslateResponse> {\n\t\tconst response = await fetch(this.getUrl(apiKey), {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tbody: JSON.stringify(input),\n\t\t});\n\n\t\tconst responseBody = await response.text();\n\n\t\tlogger.info(\n\t\t\t`Google Translate Response: ${JSON.stringify({\n\t\t\t\tstatus: response.status,\n\t\t\t\tbody: responseBody,\n\t\t\t})}`\n\t\t);\n\t\tif (!response.ok) {\n\t\t\tlogger.error(\n\t\t\t\t`Google Translate API request failed: ${JSON.stringify({\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\tinput,\n\t\t\t\t\tbody: responseBody,\n\t\t\t\t})}`\n\t\t\t);\n\n\t\t\tthrow new Error(responseBody);\n\t\t}\n\n\t\treturn JSON.parse(responseBody) as TranslateResponse;\n\t}\n}\n"]}
@@ -0,0 +1,13 @@
1
+ export interface GoogleTranslateInputDTO {
2
+ q: string | string[];
3
+ target: string;
4
+ source?: string;
5
+ format: 'text';
6
+ }
7
+ export interface TranslateResponse {
8
+ data: {
9
+ translations: {
10
+ translatedText: string;
11
+ }[];
12
+ };
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=google-translate.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-translate.dto.js","sourceRoot":"/","sources":["libraries/google-translate/google-translate.dto.ts"],"names":[],"mappings":"","sourcesContent":["export interface GoogleTranslateInputDTO {\n\tq: string | string[];\n\ttarget: string;\n\tsource?: string;\n\tformat: 'text';\n}\n\nexport interface TranslateResponse {\n\tdata: {\n\t\ttranslations: {\n\t\t\ttranslatedText: string;\n\t\t}[];\n\t};\n}\n"]}
@@ -1,7 +1,7 @@
1
+ import { GoogleTranslateClient } from './google-translate.client';
1
2
  export declare class GoogleTranslateService {
2
- private readonly apiKey;
3
- constructor(apiKey: string);
4
- private get url();
5
- translate(text: string, targetLanguage: string, sourceLanguage?: string): Promise<string>;
6
- translateBatch(texts: string[], targetLanguage: string, sourceLanguage?: string): Promise<string[]>;
3
+ private readonly googleTranslateClient;
4
+ constructor(googleTranslateClient: GoogleTranslateClient);
5
+ translate(apiKey: string, text: string, targetLanguage: string, sourceLanguage?: string): Promise<string>;
6
+ translateBatch(apiKey: string, texts: string[], targetLanguage: string, sourceLanguage?: string): Promise<string[]>;
7
7
  }
@@ -8,65 +8,82 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.GoogleTranslateService = void 0;
13
16
  const typedi_1 = require("typedi");
17
+ const google_translate_client_1 = require("./google-translate.client");
18
+ const logSettings_1 = require("@typegoose/typegoose/lib/logSettings");
14
19
  let GoogleTranslateService = class GoogleTranslateService {
15
- apiKey;
16
- constructor(apiKey) {
17
- this.apiKey = apiKey;
18
- }
19
- get url() {
20
- return `https://translation.googleapis.com/language/translate/v2?key=${this.apiKey}`;
20
+ googleTranslateClient;
21
+ constructor(googleTranslateClient) {
22
+ this.googleTranslateClient = googleTranslateClient;
21
23
  }
22
- async translate(text, targetLanguage, sourceLanguage) {
24
+ async translate(apiKey, text, targetLanguage, sourceLanguage) {
23
25
  if (!text?.trim()) {
24
26
  return text;
25
27
  }
26
- const response = await fetch(this.url, {
27
- method: 'POST',
28
- headers: {
29
- 'Content-Type': 'application/json',
30
- },
31
- body: JSON.stringify({
32
- q: text,
33
- target: targetLanguage,
34
- source: sourceLanguage,
35
- format: 'text',
36
- }),
28
+ const input = {
29
+ q: text,
30
+ target: targetLanguage,
31
+ source: sourceLanguage,
32
+ format: 'text',
33
+ };
34
+ logSettings_1.logger.info('Google Translate request', {
35
+ input,
37
36
  });
38
- if (!response.ok) {
39
- throw new Error(await response.text());
37
+ try {
38
+ const result = await this.googleTranslateClient.translate(apiKey, input);
39
+ logSettings_1.logger.info('Google Translate response', {
40
+ input,
41
+ result: result.data,
42
+ });
43
+ return result.data.translations[0]?.translatedText ?? text;
44
+ }
45
+ catch (error) {
46
+ logSettings_1.logger.error('Google Translate failed', {
47
+ input,
48
+ error,
49
+ });
50
+ throw error;
40
51
  }
41
- const result = (await response.json());
42
- return result.data.translations[0]?.translatedText ?? text;
43
52
  }
44
- async translateBatch(texts, targetLanguage, sourceLanguage) {
53
+ async translateBatch(apiKey, texts, targetLanguage, sourceLanguage) {
45
54
  if (!texts.length) {
46
55
  return [];
47
56
  }
48
- const response = await fetch(this.url, {
49
- method: 'POST',
50
- headers: {
51
- 'Content-Type': 'application/json',
52
- },
53
- body: JSON.stringify({
54
- q: texts,
55
- target: targetLanguage,
56
- source: sourceLanguage,
57
- format: 'text',
58
- }),
57
+ const input = {
58
+ q: texts,
59
+ target: targetLanguage,
60
+ source: sourceLanguage,
61
+ format: 'text',
62
+ };
63
+ logSettings_1.logger.info('Google Translate request', {
64
+ input,
59
65
  });
60
- if (!response.ok) {
61
- throw new Error(await response.text());
66
+ try {
67
+ const result = await this.googleTranslateClient.translate(apiKey, input);
68
+ logSettings_1.logger.info('Google Translate batch response', {
69
+ input,
70
+ result: result.data,
71
+ });
72
+ return result.data.translations.map(x => x.translatedText);
73
+ }
74
+ catch (error) {
75
+ logSettings_1.logger.error('Google Translate batch failed', {
76
+ input,
77
+ error,
78
+ });
79
+ throw error;
62
80
  }
63
- const result = (await response.json());
64
- return result.data.translations.map(x => x.translatedText);
65
81
  }
66
82
  };
67
83
  exports.GoogleTranslateService = GoogleTranslateService;
68
84
  exports.GoogleTranslateService = GoogleTranslateService = __decorate([
69
85
  (0, typedi_1.Service)(),
70
- __metadata("design:paramtypes", [String])
86
+ __param(0, (0, typedi_1.Inject)()),
87
+ __metadata("design:paramtypes", [google_translate_client_1.GoogleTranslateClient])
71
88
  ], GoogleTranslateService);
72
89
  //# sourceMappingURL=google-translate.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"google-translate.service.js","sourceRoot":"/","sources":["libraries/google-translate/google-translate.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAiC;AAW1B,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACL;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,IAAY,GAAG;QACd,OAAO,gEAAgE,IAAI,CAAC,MAAM,EAAE,CAAC;IACtF,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,cAAsB,EAAE,cAAuB;QACnF,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACtC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACR,cAAc,EAAE,kBAAkB;aAClC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,CAAC,EAAE,IAAI;gBACP,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,MAAM;aACd,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;QAE5D,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,cAAc,IAAI,IAAI,CAAC;IAC5D,CAAC;IAEM,KAAK,CAAC,cAAc,CAC1B,KAAe,EACf,cAAsB,EACtB,cAAuB;QAEvB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,EAAE,CAAC;QACX,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACtC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACR,cAAc,EAAE,kBAAkB;aAClC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,CAAC,EAAE,KAAK;gBACR,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,MAAM;aACd,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;QAE5D,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAC5D,CAAC;CACD,CAAA;AAhEY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,gBAAO,GAAE;;GACG,sBAAsB,CAgElC","sourcesContent":["import { Service } from 'typedi';\n\ninterface TranslateResponse {\n\tdata: {\n\t\ttranslations: {\n\t\t\ttranslatedText: string;\n\t\t}[];\n\t};\n}\n\n@Service()\nexport class GoogleTranslateService {\n\tconstructor(private readonly apiKey: string) {}\n\n\tprivate get url() {\n\t\treturn `https://translation.googleapis.com/language/translate/v2?key=${this.apiKey}`;\n\t}\n\n\tpublic async translate(text: string, targetLanguage: string, sourceLanguage?: string): Promise<string> {\n\t\tif (!text?.trim()) {\n\t\t\treturn text;\n\t\t}\n\n\t\tconst response = await fetch(this.url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tq: text,\n\t\t\t\ttarget: targetLanguage,\n\t\t\t\tsource: sourceLanguage,\n\t\t\t\tformat: 'text',\n\t\t\t}),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(await response.text());\n\t\t}\n\n\t\tconst result = (await response.json()) as TranslateResponse;\n\n\t\treturn result.data.translations[0]?.translatedText ?? text;\n\t}\n\n\tpublic async translateBatch(\n\t\ttexts: string[],\n\t\ttargetLanguage: string,\n\t\tsourceLanguage?: string\n\t): Promise<string[]> {\n\t\tif (!texts.length) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst response = await fetch(this.url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tq: texts,\n\t\t\t\ttarget: targetLanguage,\n\t\t\t\tsource: sourceLanguage,\n\t\t\t\tformat: 'text',\n\t\t\t}),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(await response.text());\n\t\t}\n\n\t\tconst result = (await response.json()) as TranslateResponse;\n\n\t\treturn result.data.translations.map(x => x.translatedText);\n\t}\n}\n"]}
1
+ {"version":3,"file":"google-translate.service.js","sourceRoot":"/","sources":["libraries/google-translate/google-translate.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAyC;AACzC,uEAAkE;AAElE,sEAA8D;AAGvD,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAGhB;IAFlB,YAEkB,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAC3D,CAAC;IAEG,KAAK,CAAC,SAAS,CACrB,MAAc,EACd,IAAY,EACZ,cAAsB,EACtB,cAAuB;QAEvB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACb,CAAC;QAED,MAAM,KA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M,EAAE,MAAM,CAAC,IAAI;aACnB,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,oBAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE;gBAC7C,KAAK;gBACL,KAAK;aACL,CAAC,CAAC;YAEH,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;CACD,CAAA;AA/EY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,gBAAO,GAAE;IAGP,WAAA,IAAA,eAAM,GAAE,CAAA;qCAC+B,+CAAqB;GAHlD,sBAAsB,CA+ElC","sourcesContent":["import { Inject, Service } from 'typedi';\nimport { GoogleTranslateClient } from './google-translate.client';\nimport { GoogleTranslateInputDTO } from './google-translate.dto';\nimport { logger } from '@typegoose/typegoose/lib/logSettings';\n\n@Service()\nexport class GoogleTranslateService {\n\tconstructor(\n\t\t@Inject()\n\t\tprivate readonly googleTranslateClient: GoogleTranslateClient\n\t) {}\n\n\tpublic async translate(\n\t\tapiKey: string,\n\t\ttext: string,\n\t\ttargetLanguage: string,\n\t\tsourceLanguage?: string\n\t): Promise<string> {\n\t\tif (!text?.trim()) {\n\t\t\treturn text;\n\t\t}\n\n\t\tconst input: GoogleTranslateInputDTO = {\n\t\t\tq: text,\n\t\t\ttarget: targetLanguage,\n\t\t\tsource: sourceLanguage,\n\t\t\tformat: 'text',\n\t\t};\n\t\tlogger.info('Google Translate request', {\n\t\t\tinput,\n\t\t});\n\t\ttry {\n\t\t\tconst result = await this.googleTranslateClient.translate(apiKey, input);\n\t\t\tlogger.info('Google Translate response', {\n\t\t\t\tinput,\n\t\t\t\tresult: result.data,\n\t\t\t});\n\n\t\t\treturn result.data.translations[0]?.translatedText ?? text;\n\t\t} catch (error) {\n\t\t\tlogger.error('Google Translate failed', {\n\t\t\t\tinput,\n\t\t\t\terror,\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic async translateBatch(\n\t\tapiKey: string,\n\t\ttexts: string[],\n\t\ttargetLanguage: string,\n\t\tsourceLanguage?: string\n\t): Promise<string[]> {\n\t\tif (!texts.length) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst input: GoogleTranslateInputDTO = {\n\t\t\tq: texts,\n\t\t\ttarget: targetLanguage,\n\t\t\tsource: sourceLanguage,\n\t\t\tformat: 'text',\n\t\t};\n\t\tlogger.info('Google Translate request', {\n\t\t\tinput,\n\t\t});\n\n\t\ttry {\n\t\t\tconst result = await this.googleTranslateClient.translate(apiKey, input);\n\t\t\tlogger.info('Google Translate batch response', {\n\t\t\t\tinput,\n\t\t\t\tresult: result.data,\n\t\t\t});\n\n\t\t\treturn result.data.translations.map(x => x.translatedText);\n\t\t} catch (error) {\n\t\t\tlogger.error('Google Translate batch failed', {\n\t\t\t\tinput,\n\t\t\t\terror,\n\t\t\t});\n\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"]}
@@ -5,9 +5,9 @@ interface AuthOptions {
5
5
  autoRefresh?: boolean;
6
6
  }
7
7
  export declare function createAuthenticatedProcedure(options: AuthOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
8
+ req: import("http").IncomingMessage;
8
9
  res: import("http").ServerResponse<import("http").IncomingMessage>;
9
10
  tokenType: TokenType | undefined;
10
- req: import("http").IncomingMessage;
11
11
  requestId: string | undefined;
12
12
  entity: import("../context").EntityContext | undefined;
13
13
  usedRefreshToken: boolean | undefined;
@@ -4,9 +4,9 @@ interface RoleProtectedOptions {
4
4
  allowedRoles: string[];
5
5
  }
6
6
  export declare function createRoleProtectedProcedure(options: RoleProtectedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
7
+ req: import("http").IncomingMessage;
7
8
  res: import("http").ServerResponse<import("http").IncomingMessage>;
8
9
  tokenType: import("../../auth").TokenType | undefined;
9
- req: import("http").IncomingMessage;
10
10
  requestId: string | undefined;
11
11
  entity: import("../context").EntityContext | undefined;
12
12
  usedRefreshToken: boolean | undefined;
@@ -3,9 +3,9 @@ interface PhoneVerifiedOptions {
3
3
  entityTypes: AuthEntityType[];
4
4
  }
5
5
  export declare function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
6
+ req: import("http").IncomingMessage;
6
7
  res: import("http").ServerResponse<import("http").IncomingMessage>;
7
8
  tokenType: import("../../auth").TokenType | undefined;
8
- req: import("http").IncomingMessage;
9
9
  requestId: string | undefined;
10
10
  entity: import("../context").EntityContext | undefined;
11
11
  usedRefreshToken: boolean | undefined;
@@ -5,9 +5,9 @@ interface AuthOptions {
5
5
  autoRefresh?: boolean;
6
6
  }
7
7
  export declare function publicUserDecoder(options: AuthOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
8
+ req: import("http").IncomingMessage;
8
9
  res: import("http").ServerResponse<import("http").IncomingMessage>;
9
10
  tokenType: TokenType | undefined;
10
- req: import("http").IncomingMessage;
11
11
  requestId: string | undefined;
12
12
  entity: import("../context").EntityContext | undefined;
13
13
  usedRefreshToken: boolean | undefined;
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.4.276
25
+ Version: 1.4.277
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.4.276",
3
+ "version": "1.4.277",
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
- select?: Record<string, 0 | 1> | undefined;
30
29
  populate?: any;
30
+ select?: Record<string, 0 | 1> | undefined;
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
- select?: Record<string, 0 | 1> | undefined;
40
39
  populate?: any;
40
+ select?: Record<string, 0 | 1> | undefined;
41
41
  query?: Record<string, any> | undefined;
42
42
  page?: number | undefined;
43
43
  }>>;
@@ -736,12 +736,12 @@ export declare const GetByIdInputSchema: z.ZodObject<{
736
736
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
737
737
  }, "strip", z.ZodTypeAny, {
738
738
  _id: import("mongoose").Types.ObjectId;
739
- select?: Record<string, 0 | 1> | undefined;
740
739
  populate?: any;
740
+ select?: Record<string, 0 | 1> | undefined;
741
741
  }, {
742
742
  _id: string | import("mongoose").Types.ObjectId;
743
- select?: Record<string, 0 | 1> | undefined;
744
743
  populate?: any;
744
+ select?: Record<string, 0 | 1> | undefined;
745
745
  }>;
746
746
  export type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;
747
747
  export declare const GetProductByIdInputSchema: z.ZodObject<{
@@ -754,12 +754,12 @@ export declare const GetProductByIdInputSchema: z.ZodObject<{
754
754
  _id: import("mongoose").Types.ObjectId;
755
755
  withAttributeHiddenItems: boolean;
756
756
  withAddonsHiddenItems: boolean;
757
- select?: Record<string, 0 | 1> | undefined;
758
757
  populate?: any;
758
+ select?: Record<string, 0 | 1> | undefined;
759
759
  }, {
760
760
  _id: string | import("mongoose").Types.ObjectId;
761
- select?: Record<string, 0 | 1> | undefined;
762
761
  populate?: any;
762
+ select?: Record<string, 0 | 1> | undefined;
763
763
  withAttributeHiddenItems?: boolean | undefined;
764
764
  withAddonsHiddenItems?: boolean | undefined;
765
765
  }>;
@@ -773,15 +773,15 @@ export declare const GetOrderByIdInputSchema: z.ZodObject<{
773
773
  userOrderCompletionScope: z.ZodOptional<z.ZodNativeEnum<typeof UserOrderCompletionScope>>;
774
774
  }, "strip", z.ZodTypeAny, {
775
775
  _id: import("mongoose").Types.ObjectId;
776
- select?: Record<string, 0 | 1> | undefined;
777
776
  populate?: any;
777
+ select?: Record<string, 0 | 1> | undefined;
778
778
  groupByCategories?: boolean | undefined;
779
779
  getParentCategory?: boolean | undefined;
780
780
  userOrderCompletionScope?: UserOrderCompletionScope | undefined;
781
781
  }, {
782
782
  _id: string | import("mongoose").Types.ObjectId;
783
- select?: Record<string, 0 | 1> | undefined;
784
783
  populate?: any;
784
+ select?: Record<string, 0 | 1> | undefined;
785
785
  groupByCategories?: boolean | undefined;
786
786
  getParentCategory?: boolean | undefined;
787
787
  userOrderCompletionScope?: UserOrderCompletionScope | undefined;
@@ -791,11 +791,11 @@ export declare const GetByTokenInputSchema: z.ZodOptional<z.ZodObject<{
791
791
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
792
792
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
793
793
  }, "strip", z.ZodTypeAny, {
794
- select?: Record<string, 0 | 1> | undefined;
795
794
  populate?: any;
796
- }, {
797
795
  select?: Record<string, 0 | 1> | undefined;
796
+ }, {
798
797
  populate?: any;
798
+ select?: Record<string, 0 | 1> | undefined;
799
799
  }>>;
800
800
  export type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;
801
801
  export declare const GetOneQuerySchema: z.ZodObject<{
@@ -803,12 +803,12 @@ export declare const GetOneQuerySchema: z.ZodObject<{
803
803
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
804
804
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
805
805
  }, "strip", z.ZodTypeAny, {
806
- select?: Record<string, 0 | 1> | undefined;
807
806
  populate?: any;
807
+ select?: Record<string, 0 | 1> | undefined;
808
808
  query?: Record<string, any> | undefined;
809
809
  }, {
810
- select?: Record<string, 0 | 1> | undefined;
811
810
  populate?: any;
811
+ select?: Record<string, 0 | 1> | undefined;
812
812
  query?: Record<string, any> | undefined;
813
813
  }>;
814
814
  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.4.276",
3
+ "version": "1.4.277",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",