@lyxa.ai/core 1.3.51 → 1.3.52

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.
@@ -22,7 +22,7 @@ async function initGlobalConnection(uri, environment) {
22
22
  console.log(`Initializing global connection for environment: ${environment}`);
23
23
  const connection = (0, mongoose_2.createConnection)(uri, {
24
24
  dbName: `lyxa-${environment}-global`,
25
- maxPoolSize: 20,
25
+ maxPoolSize: 30,
26
26
  minPoolSize: 4,
27
27
  maxIdleTimeMS: 30000,
28
28
  waitQueueTimeoutMS: 10000,
@@ -51,7 +51,7 @@ async function initLyxaMongoDbConnection(mongoUrl, options) {
51
51
  console.log(`Initializing lyxa mongodb connection for environment: ${options?.environment}`);
52
52
  await mongoose_1.default.connect(mongoUrl, {
53
53
  dbName: `lyxa-${options.environment}-${options.tenet}`,
54
- maxPoolSize: 20,
54
+ maxPoolSize: 30,
55
55
  minPoolSize: 4,
56
56
  maxIdleTimeMS: 30000,
57
57
  waitQueueTimeoutMS: 10000,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;;;;AAcA,oDAiCC;AAED,8DAyBC;AAKD,sEAEC;AAKD,kDAKC;AAED,4DAKC;AAlGD,wDAAgC;AAChC,uCAAwD;AACxD,qCAAkD;AAElD,6BAAmE;AAGnE,IAAI,gBAAwC,CAAC;AAC7C,IAAI,gBAAwC,CAAC;AAC7C,IAAI,iBAAiB,GAA+B,IAAI,CAAC;AAKlD,KAAK,UAAU,oBAAoB,CAAC,GAAW,EAAE,WAAmB;IAC1E,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,iBAAiB,GAAG,IAAI,OAAO,CAAa,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACrE,IAAI,CAAC;gBACJ,OAAO,CAAC,GAAG,CAAC,mDAAmD,WAAW,EAAE,CAAC,CAAC;gBAC9E,MAAM,UAAU,GAAG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,CAAC;QACJ,cAAc,EAAE,SAAS;QACzB,WAAW,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;QAC/B,wBAAwB,EAAE,IAAI;QAC9B,oBAAoB,EAAE,KAAK;QAC3B,cAAc,EAAE,KAAK;QACrB,WAAW,EAAE,CAAC,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,kBAAQ,CAAC,GAAG,CACX,OAAO,EACP,OAAO,EAAE,aAAa,KAAK,SAAS;QACnC,CAAC,CAAC,OAAO,EAAE,aAAa;QACxB,CAAC,CAAC,IAAA,gBAAY,GAAE,CAAC,uBAAuB,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,gCAA4B,CAAC,GAAG,CACnG,CAAC;IAEF,gBAAgB,GAAG,kBAAQ,CAAC,UAAU,CAAC;AACxC,CAAC;AAKD,SAAgB,6BAA6B;IAC5C,OAAO,CAAC,CAAC,gBAAgB,CAAC;AAC3B,CAAC;AAKD,SAAgB,mBAAmB;IAClC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED,SAAgB,wBAAwB;IACvC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,gBAAgB,CAAC;AACzB,CAAC","sourcesContent":["import mongoose from 'mongoose';\nimport { Connection, createConnection } from 'mongoose';\nimport { initializeGlobalModels } from './models';\nimport { ConfigurationOptions } from '../configuration';\nimport { EnvironmentConfigurationType, getLibraries } from '../..';\n\n// Track connection status\nlet globalConnection: Connection | undefined;\nlet lyxaDbConnection: Connection | undefined;\nlet connectionPromise: Promise<Connection> | null = null;\n\n/**\n * Initialize the global database connection and create all global models\n */\nexport async function initGlobalConnection(uri: string, environment: string): Promise<Connection> {\n\tif (!connectionPromise) {\n\t\tconnectionPromise = new Promise<Connection>(async (resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tconsole.log(`Initializing global connection for environment: ${environment}`);\n\t\t\t\tconst connection = createConnection(uri, {\n\t\t\t\t\tdbName: `lyxa-${environment}-global`,\n\t\t\t\t\tmaxPoolSize: 20,\n\t\t\t\t\tminPoolSize: 4,\n\t\t\t\t\tmaxIdleTimeMS: 30000,\n\t\t\t\t\twaitQueueTimeoutMS: 10000,\n\t\t\t\t\tretryWrites: true,\n\t\t\t\t\tw: 'majority',\n\t\t\t\t});\n\n\t\t\t\tawait new Promise<void>((connectResolve, connectReject) => {\n\t\t\t\t\tconnection.once('connected', () => {\n\t\t\t\t\t\tconsole.log('Global connection successfully established');\n\t\t\t\t\t\tglobalConnection = connection;\n\t\t\t\t\t\tconnectResolve();\n\t\t\t\t\t});\n\t\t\t\t\tconnection.once('error', connectReject);\n\t\t\t\t});\n\n\t\t\t\tinitializeGlobalModels(globalConnection);\n\n\t\t\t\tresolve(connection);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}\n\treturn connectionPromise;\n}\n\nexport async function initLyxaMongoDbConnection(mongoUrl: string, options?: ConfigurationOptions): Promise<void> {\n\tconsole.log(`Initializing lyxa mongodb connection for environment: ${options?.environment}`);\n\tawait mongoose.connect(mongoUrl!, {\n\t\tdbName: `lyxa-${options!.environment}-${options!.tenet}`,\n\t\tmaxPoolSize: 20,\n\t\tminPoolSize: 4,\n\t\tmaxIdleTimeMS: 30000,\n\t\twaitQueueTimeoutMS: 10000,\n\t\tretryWrites: true,\n\t\tw: 1,\n\t\treadPreference: 'primary',\n\t\treadConcern: { level: 'local' },\n\t\tserverSelectionTimeoutMS: 5000,\n\t\theartbeatFrequencyMS: 10000,\n\t\tbufferCommands: false,\n\t\tcompressors: ['zlib'] // Reduces network traffic \n\t});\n\tmongoose.set(\n\t\t'debug',\n\t\toptions?.mongooseDebug !== undefined\n\t\t\t? options?.mongooseDebug\n\t\t\t: getLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV\n\t);\n\n\tlyxaDbConnection = mongoose.connection;\n}\n\n/**\n * Check if the global connection is initialized\n */\nexport function isGlobalConnectionInitialized(): boolean {\n\treturn !!globalConnection;\n}\n\n/**\n * Get the global and lyxa connections (throws if not initialized)\n */\nexport function getGlobalConnection(): Connection {\n\tif (!globalConnection) {\n\t\tthrow new Error('Global connection not initialized. Call initGlobalConnection() first.');\n\t}\n\treturn globalConnection;\n}\n\nexport function getLyxaMongoDbConnection(): Connection {\n\tif (!lyxaDbConnection) {\n\t\tthrow new Error('Lyxa mongodb connection not initialized. Call initLyxaMongoDbConnection() first.');\n\t}\n\treturn lyxaDbConnection;\n}\n\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;;;;AAcA,oDAiCC;AAED,8DAyBC;AAKD,sEAEC;AAKD,kDAKC;AAED,4DAKC;AAlGD,wDAAgC;AAChC,uCAAwD;AACxD,qCAAkD;AAElD,6BAAmE;AAGnE,IAAI,gBAAwC,CAAC;AAC7C,IAAI,gBAAwC,CAAC;AAC7C,IAAI,iBAAiB,GAA+B,IAAI,CAAC;AAKlD,KAAK,UAAU,oBAAoB,CAAC,GAAW,EAAE,WAAmB;IAC1E,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,iBAAiB,GAAG,IAAI,OAAO,CAAa,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACrE,IAAI,CAAC;gBACJ,OAAO,CAAC,GAAG,CAAC,mDAAmD,WAAW,EAAE,CAAC,CAAC;gBAC9E,MAAM,UAAU,GAAG,IAAA,2BAAgB,EAAC,GAAG,EAAE;oBACxC,MAAM,EAAE,QAAQ,WAAW,SAAS;oBACpC,WAAW,EAAE,EAAE;oBACf,WAAW,EAAE,CAAC;oBACd,aAAa,EAAE,KAAK;oBACpB,kBAAkB,EAAE,KAAK;oBACzB,WAAW,EAAE,IAAI;oBACjB,CAAC,EA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IACH,kBAAQ,CAAC,GAAG,CACX,OAAO,EACP,OAAO,EAAE,aAAa,KAAK,SAAS;QACnC,CAAC,CAAC,OAAO,EAAE,aAAa;QACxB,CAAC,CAAC,IAAA,gBAAY,GAAE,CAAC,uBAAuB,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,gCAA4B,CAAC,GAAG,CACnG,CAAC;IAEF,gBAAgB,GAAG,kBAAQ,CAAC,UAAU,CAAC;AACxC,CAAC;AAKD,SAAgB,6BAA6B;IAC5C,OAAO,CAAC,CAAC,gBAAgB,CAAC;AAC3B,CAAC;AAKD,SAAgB,mBAAmB;IAClC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED,SAAgB,wBAAwB;IACvC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,gBAAgB,CAAC;AACzB,CAAC","sourcesContent":["import mongoose from 'mongoose';\nimport { Connection, createConnection } from 'mongoose';\nimport { initializeGlobalModels } from './models';\nimport { ConfigurationOptions } from '../configuration';\nimport { EnvironmentConfigurationType, getLibraries } from '../..';\n\n// Track connection status\nlet globalConnection: Connection | undefined;\nlet lyxaDbConnection: Connection | undefined;\nlet connectionPromise: Promise<Connection> | null = null;\n\n/**\n * Initialize the global database connection and create all global models\n */\nexport async function initGlobalConnection(uri: string, environment: string): Promise<Connection> {\n\tif (!connectionPromise) {\n\t\tconnectionPromise = new Promise<Connection>(async (resolve, reject) => {\n\t\t\ttry {\n\t\t\t\tconsole.log(`Initializing global connection for environment: ${environment}`);\n\t\t\t\tconst connection = createConnection(uri, {\n\t\t\t\t\tdbName: `lyxa-${environment}-global`,\n\t\t\t\t\tmaxPoolSize: 30,\n\t\t\t\t\tminPoolSize: 4,\n\t\t\t\t\tmaxIdleTimeMS: 30000,\n\t\t\t\t\twaitQueueTimeoutMS: 10000,\n\t\t\t\t\tretryWrites: true,\n\t\t\t\t\tw: 'majority',\n\t\t\t\t});\n\n\t\t\t\tawait new Promise<void>((connectResolve, connectReject) => {\n\t\t\t\t\tconnection.once('connected', () => {\n\t\t\t\t\t\tconsole.log('Global connection successfully established');\n\t\t\t\t\t\tglobalConnection = connection;\n\t\t\t\t\t\tconnectResolve();\n\t\t\t\t\t});\n\t\t\t\t\tconnection.once('error', connectReject);\n\t\t\t\t});\n\n\t\t\t\tinitializeGlobalModels(globalConnection);\n\n\t\t\t\tresolve(connection);\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}\n\treturn connectionPromise;\n}\n\nexport async function initLyxaMongoDbConnection(mongoUrl: string, options?: ConfigurationOptions): Promise<void> {\n\tconsole.log(`Initializing lyxa mongodb connection for environment: ${options?.environment}`);\n\tawait mongoose.connect(mongoUrl!, {\n\t\tdbName: `lyxa-${options!.environment}-${options!.tenet}`,\n\t\tmaxPoolSize: 30,\n\t\tminPoolSize: 4,\n\t\tmaxIdleTimeMS: 30000,\n\t\twaitQueueTimeoutMS: 10000,\n\t\tretryWrites: true,\n\t\tw: 1,\n\t\treadPreference: 'primary',\n\t\treadConcern: { level: 'local' },\n\t\tserverSelectionTimeoutMS: 5000,\n\t\theartbeatFrequencyMS: 10000,\n\t\tbufferCommands: false,\n\t\tcompressors: ['zlib'] // Reduces network traffic \n\t});\n\tmongoose.set(\n\t\t'debug',\n\t\toptions?.mongooseDebug !== undefined\n\t\t\t? options?.mongooseDebug\n\t\t\t: getLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV\n\t);\n\n\tlyxaDbConnection = mongoose.connection;\n}\n\n/**\n * Check if the global connection is initialized\n */\nexport function isGlobalConnectionInitialized(): boolean {\n\treturn !!globalConnection;\n}\n\n/**\n * Get the global and lyxa connections (throws if not initialized)\n */\nexport function getGlobalConnection(): Connection {\n\tif (!globalConnection) {\n\t\tthrow new Error('Global connection not initialized. Call initGlobalConnection() first.');\n\t}\n\treturn globalConnection;\n}\n\nexport function getLyxaMongoDbConnection(): Connection {\n\tif (!lyxaDbConnection) {\n\t\tthrow new Error('Lyxa mongodb connection not initialized. Call initLyxaMongoDbConnection() first.');\n\t}\n\treturn lyxaDbConnection;\n}\n\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.3.51
25
+ Version: 1.3.52
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.51",
3
+ "version": "1.3.52",
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.3.51",
3
+ "version": "1.3.52",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",