@lyxa.ai/core 1.4.87 → 1.4.88

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: 30,
25
+ maxPoolSize: 50,
26
26
  minPoolSize: 4,
27
27
  maxIdleTimeMS: 30000,
28
28
  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,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,EAAE,UAAU;iBACb,CAAC,CAAC;gBAEH,MAAM,IAAI,OAAO,CAAO,CAAC,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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"]}
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,EAAE,UAAU;iBACb,CAAC,CAAC;gBAEH,MAAM,IAAI,OAAO,CAAO,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE;oBACzD,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;wBACjC,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;wBAC1D,gBAAgB,GAAG,UAAU,CAAC;wBAC9B,cAAc,EAAE,CAAC;oBAClB,CAAC,CA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,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: 50,\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"]}
@@ -58,6 +58,7 @@ export declare const ChatroomMessageSendOutputSchema: z.ZodObject<{
58
58
  latitude?: number | undefined;
59
59
  longitude?: number | undefined;
60
60
  }>>;
61
+ ticketId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
61
62
  chatroomId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
62
63
  orderId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
63
64
  createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
@@ -85,6 +86,7 @@ export declare const ChatroomMessageSendOutputSchema: z.ZodObject<{
85
86
  } | undefined;
86
87
  content?: string | undefined;
87
88
  orderId?: import("mongoose").Types.ObjectId | undefined;
89
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
88
90
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
89
91
  }, {
90
92
  media: {
@@ -110,21 +112,25 @@ export declare const ChatroomMessageSendOutputSchema: z.ZodObject<{
110
112
  } | undefined;
111
113
  content?: string | undefined;
112
114
  orderId?: import("mongoose").Types.ObjectId | undefined;
115
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
113
116
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
114
117
  }>;
115
118
  export declare const ChatroomMessageSendPushOutputSchema: z.ZodObject<{
116
119
  lastMessage: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
117
120
  chatroomId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
121
+ ticketId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
118
122
  orderId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
119
123
  type: z.ZodNativeEnum<typeof ChatroomType>;
120
124
  }, "strip", z.ZodTypeAny, {
121
125
  type: ChatroomType;
122
126
  orderId?: import("mongoose").Types.ObjectId | undefined;
127
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
123
128
  lastMessage?: string | undefined;
124
129
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
125
130
  }, {
126
131
  type: ChatroomType;
127
132
  orderId?: import("mongoose").Types.ObjectId | undefined;
133
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
128
134
  lastMessage?: string | undefined;
129
135
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
130
136
  }>;
@@ -188,6 +194,7 @@ export declare class ChatroomMessageSendSocketEvent extends BaseSocketEvent<type
188
194
  latitude?: number | undefined;
189
195
  longitude?: number | undefined;
190
196
  }>>;
197
+ ticketId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
191
198
  chatroomId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
192
199
  orderId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
193
200
  createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
@@ -215,6 +222,7 @@ export declare class ChatroomMessageSendSocketEvent extends BaseSocketEvent<type
215
222
  } | undefined;
216
223
  content?: string | undefined;
217
224
  orderId?: import("mongoose").Types.ObjectId | undefined;
225
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
218
226
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
219
227
  }, {
220
228
  media: {
@@ -240,21 +248,25 @@ export declare class ChatroomMessageSendSocketEvent extends BaseSocketEvent<type
240
248
  } | undefined;
241
249
  content?: string | undefined;
242
250
  orderId?: import("mongoose").Types.ObjectId | undefined;
251
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
243
252
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
244
253
  }>;
245
254
  pushNotificationOutput: z.ZodObject<{
246
255
  lastMessage: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
247
256
  chatroomId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
257
+ ticketId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
248
258
  orderId: z.ZodOptional<z.ZodEffects<z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>, import("mongoose").Types.ObjectId, import("mongoose").Types.ObjectId>>;
249
259
  type: z.ZodNativeEnum<typeof ChatroomType>;
250
260
  }, "strip", z.ZodTypeAny, {
251
261
  type: ChatroomType;
252
262
  orderId?: import("mongoose").Types.ObjectId | undefined;
263
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
253
264
  lastMessage?: string | undefined;
254
265
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
255
266
  }, {
256
267
  type: ChatroomType;
257
268
  orderId?: import("mongoose").Types.ObjectId | undefined;
269
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
258
270
  lastMessage?: string | undefined;
259
271
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
260
272
  }>;
@@ -266,6 +278,7 @@ export declare class ChatroomMessageSendSocketEvent extends BaseSocketEvent<type
266
278
  getPushNotificationPayload(): {
267
279
  type: ChatroomType;
268
280
  orderId?: import("mongoose").Types.ObjectId | undefined;
281
+ ticketId?: import("mongoose").Types.ObjectId | undefined;
269
282
  lastMessage?: string | undefined;
270
283
  chatroomId?: import("mongoose").Types.ObjectId | undefined;
271
284
  } | undefined;
@@ -36,6 +36,7 @@ exports.ChatroomMessageSendOutputSchema = zod_1.default.object({
36
36
  latitude: validation_1.ZodValidation.coerce.number('latitude').optional(),
37
37
  })
38
38
  .optional(),
39
+ ticketId: validation_1.ZodValidation.coerce.objectId('ticketId').optional(),
39
40
  chatroomId: validation_1.ZodValidation.coerce.objectId('chatroomId').optional(),
40
41
  orderId: validation_1.ZodValidation.coerce.objectId('orderId').optional(),
41
42
  createdAt: validation_1.ZodValidation.coerce.date(),
@@ -43,6 +44,7 @@ exports.ChatroomMessageSendOutputSchema = zod_1.default.object({
43
44
  exports.ChatroomMessageSendPushOutputSchema = zod_1.default.object({
44
45
  lastMessage: validation_1.ZodValidation.string('lastMessage').optional(),
45
46
  chatroomId: validation_1.ZodValidation.coerce.objectId('chatroomId').optional(),
47
+ ticketId: validation_1.ZodValidation.coerce.objectId('chatroomId').optional(),
46
48
  orderId: validation_1.ZodValidation.coerce.objectId('orderId').optional(),
47
49
  type: validation_1.ZodValidation.enumType(enum_1.ChatroomType, 'type'),
48
50
  });
@@ -64,6 +66,8 @@ class ChatroomMessageSendSocketEvent extends BaseSocketEvent_1.BaseSocketEvent {
64
66
  const pushPayload = {
65
67
  lastMessage: payload.content,
66
68
  chatroomId: payload.chatroomId,
69
+ ticketId: payload.ticketId,
70
+ orderId: payload.orderId,
67
71
  type: payload.chatroomType,
68
72
  };
69
73
  const socketNotificationEvent = core_1.EventFactory.createEvent(enum_1.SocketEventType.NOTIFICATION, {
@@ -1 +1 @@
1
- {"version":3,"file":"chatroom-message-send.socket.event.js","sourceRoot":"/","sources":["libraries/socket/events/chatroom-message-send.socket.event.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AACpB,kDAAuG;AACvG,8DAA6E;AAC7E,wDAAqD;AAErD,kCAAuC;AAE1B,QAAA,oCAAoC,GAAG,aAAC,CAAC,MAAM,CAAC;IAC5D,UAAU,EAAE,qBAAQ;CACpB,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,aAAC,CAAC,MAAM,CAAC;IACvD,GAAG,EAAE,0BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;IACzC,YAAY,EAAE,0BAAa,CAAC,QAAQ,CAAC,mBAAY,EAAE,cAAc,CAAC;IAClE,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;IACnD,UAAU,EAAE,0BAAa,CAAC,QAAQ,CAAC,cAAO,EAAE,YAAY,CAAC;IACzD,MAAM,EAAE,aAAC,CAAC,MAAM,CAAC;QAChB,EAAE,EAAE,0BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC9C,IAAI,EAAE,0BAAa,CAAC,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,EAAE,0BAAa,CAAC,QAAQ,CAAC,cAAO,EAAE,aAAa,CAAC;KACpD,CAAC;IACF,OAAO,EAAE,0BAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;IACnD,KAAK,EAAE,aAAC,CAAC,KAAK,CACb,aAAC,CAAC,MAAM,CAAC;QACR,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,UAAU,CAAC;QAC1C,SAAS,EAAE,0BAAa,CAAC,QAAQ,CAAC,gBAAS,EAAE,WAAW,C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nimport { ChatroomType, ClickType, MediaType, SocketEventType, UserRef } from '../../../utilities/enum';\nimport { DTO, IdSchema, ZodValidation } from '../../../utilities/validation';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\nimport { NotificationSettings } from '../PushNotificationEvent';\nimport { EventFactory } from '../core';\n\nexport const ChatroomMessageSendSocketInputSchema = z.object({\n\tchatroomId: IdSchema,\n});\n\nexport const ChatroomMessageSendOutputSchema = z.object({\n\t_id: ZodValidation.coerce.objectId('_id'),\n\tchatroomType: ZodValidation.enumType(ChatroomType, 'chatroomType'),\n\tsenderId: ZodValidation.coerce.objectId('senderId'), // DEPRECATED\n\tsenderType: ZodValidation.enumType(UserRef, 'senderType'), // DEPRECATED\n\tsender: z.object({\n\t\tid: ZodValidation.coerce.objectId('sender.id'),\n\t\tname: ZodValidation.string('senderName'),\n\t\ttype: ZodValidation.enumType(UserRef, 'sender.type'),\n\t}),\n\tcontent: ZodValidation.string('content').optional(),\n\tmedia: z.array(\n\t\tz.object({\n\t\t\tmimeType: ZodValidation.string('mimeType'),\n\t\t\tmediaType: ZodValidation.enumType(MediaType, 'mediaType'),\n\t\t\tmediaUrl: ZodValidation.string('url'),\n\t\t\tthumbnailUrl: ZodValidation.string('thumbnailUrl').optional(),\n\t\t\tname: ZodValidation.string('name').optional(),\n\t\t})\n\t),\n\tlocation: z\n\t\t.object({\n\t\t\tlongitude: ZodValidation.coerce.number('longitude').optional(),\n\t\t\tlatitude: ZodValidation.coerce.number('latitude').optional(),\n\t\t})\n\t\t.optional(),\n\tchatroomId: ZodValidation.coerce.objectId('chatroomId').optional(),\n\torderId: ZodValidation.coerce.objectId('orderId').optional(),\n\tcreatedAt: ZodValidation.coerce.date(),\n});\n\nexport const ChatroomMessageSendPushOutputSchema = z.object({\n\tlastMessage: ZodValidation.string('lastMessage').optional(),\n\tchatroomId: ZodValidation.coerce.objectId('chatroomId').optional(),\n\torderId: ZodValidation.coerce.objectId('orderId').optional(),\n\ttype: ZodValidation.enumType(ChatroomType, 'type'),\n});\n\nexport type ChatlistMessageSendPushOutputDTO = DTO<typeof ChatroomMessageSendPushOutputSchema>;\n\nexport type ChatroomMessageSendSocketOutputDTO = DTO<typeof ChatroomMessageSendOutputSchema>;\nexport type ChatroomMessageSendSocketInputDTO = DTO<typeof ChatroomMessageSendSocketInputSchema>;\n\nexport class ChatroomMessageSendSocketEvent extends BaseSocketEvent<\n\ttypeof ChatroomMessageSendSocketInputSchema,\n\ttypeof ChatroomMessageSendOutputSchema,\n\ttypeof ChatroomMessageSendPushOutputSchema\n> {\n\tstatic readonly schemas = {\n\t\tinput: ChatroomMessageSendSocketInputSchema,\n\t\toutput: ChatroomMessageSendOutputSchema,\n\t\tpushNotificationOutput: ChatroomMessageSendPushOutputSchema,\n\t};\n\n\tpublic get notificationSettings(): NotificationSettings | undefined {\n\t\treturn {\n\t\t\tisPushNotification: true,\n\t\t\tisClickable: true,\n\t\t\tclickType: ClickType.CLICKABLE_MESSAGE,\n\t\t\ttitle: this.getTitle(),\n\t\t};\n\t}\n\n\tconstructor(payload: ChatroomMessageSendSocketOutputDTO) {\n\t\tconst pushPayload: ChatlistMessageSendPushOutputDTO = {\n\t\t\tlastMessage: payload.content,\n\t\t\tchatroomId: payload.chatroomId,\n\t\t\t//orderId: payload.orderId,\n\t\t\ttype: payload.chatroomType,\n\t\t};\n\n\t\tconst socketNotificationEvent = EventFactory.createEvent(SocketEventType.NOTIFICATION, {\n\t\t\tmessage: 'New message!',\n\t\t\tnotificationType: SocketEventType.CHATROOM_MESSAGE_SEND,\n\t\t\t_id: payload._id,\n\t\t});\n\n\t\tsuper(\n\t\t\tSocketEventType.CHATROOM_MESSAGE_SEND,\n\t\t\tChatroomMessageSendSocketEvent.schemas,\n\t\t\tpayload,\n\t\t\tpushPayload,\n\t\t\tsocketNotificationEvent\n\t\t);\n\t}\n\n\tprivate getTitle(): string {\n\t\treturn this.payload().senderType === UserRef.ADMIN\n\t\t\t? 'New message from support'\n\t\t\t: this.payload().sender.name;\n\t}\n\n\tstatic identifier(input: z.infer<typeof ChatroomMessageSendSocketInputSchema>): string {\n\t\treturn input.chatroomId.toString();\n\t}\n\n\tpublic getPushNotificationPayload() {\n\t\treturn this.pushNotificationData;\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn this.data.chatroomId?.toString() ?? 'default';\n\t}\n}\n"]}
1
+ {"version":3,"file":"chatroom-message-send.socket.event.js","sourceRoot":"/","sources":["libraries/socket/events/chatroom-message-send.socket.event.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AACpB,kDAAuG;AACvG,8DAA6E;AAC7E,wDAAqD;AAErD,kCAAuC;AAE1B,QAAA,oCAAoC,GAAG,aAAC,CAAC,MAAM,CAAC;IAC5D,UAAU,EAAE,qBAAQ;CACpB,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,aAAC,CAAC,MAAM,CAAC;IACvD,GAAG,EAAE,0BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;IACzC,YAAY,EAAE,0BAAa,CAAC,QAAQ,CAAC,mBAAY,EAAE,cAAc,CAAC;IAClE,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;IACnD,UAAU,EAAE,0BAAa,CAAC,QAAQ,CAAC,cAAO,EAAE,YAAY,CAAC;IACzD,MAAM,EAAE,aAAC,CAAC,MAAM,CAAC;QAChB,EAAE,EAAE,0BAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC9C,IAAI,EAAE,0BAAa,CAAC,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,EAAE,0BAAa,CAAC,QAAQ,CAAC,cAAO,EAAE,aAAa,CAAC;KACpD,CAAC;IACF,OAAO,EAAE,0BAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;IACnD,KAAK,EAAE,aAAC,CAAC,KAAK,CACb,aAAC,CAAC,MAAM,CAAC;QACR,QAAQ,EAAE,0BAAa,CAAC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MAAM,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,KAA2D;QAC5E,OAAO,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;IAEM,0BAA0B;QAChC,OAAO,IAAI,CAAC,oBAAoB,CAAC;IAClC,CAAC;IAES,aAAa;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,SAAS,CAAC;IACtD,CAAC;;AA5DF,wEA6DC","sourcesContent":["import z from 'zod';\nimport { ChatroomType, ClickType, MediaType, SocketEventType, UserRef } from '../../../utilities/enum';\nimport { DTO, IdSchema, ZodValidation } from '../../../utilities/validation';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\nimport { NotificationSettings } from '../PushNotificationEvent';\nimport { EventFactory } from '../core';\n\nexport const ChatroomMessageSendSocketInputSchema = z.object({\n\tchatroomId: IdSchema,\n});\n\nexport const ChatroomMessageSendOutputSchema = z.object({\n\t_id: ZodValidation.coerce.objectId('_id'),\n\tchatroomType: ZodValidation.enumType(ChatroomType, 'chatroomType'),\n\tsenderId: ZodValidation.coerce.objectId('senderId'), // DEPRECATED\n\tsenderType: ZodValidation.enumType(UserRef, 'senderType'), // DEPRECATED\n\tsender: z.object({\n\t\tid: ZodValidation.coerce.objectId('sender.id'),\n\t\tname: ZodValidation.string('senderName'),\n\t\ttype: ZodValidation.enumType(UserRef, 'sender.type'),\n\t}),\n\tcontent: ZodValidation.string('content').optional(),\n\tmedia: z.array(\n\t\tz.object({\n\t\t\tmimeType: ZodValidation.string('mimeType'),\n\t\t\tmediaType: ZodValidation.enumType(MediaType, 'mediaType'),\n\t\t\tmediaUrl: ZodValidation.string('url'),\n\t\t\tthumbnailUrl: ZodValidation.string('thumbnailUrl').optional(),\n\t\t\tname: ZodValidation.string('name').optional(),\n\t\t})\n\t),\n\tlocation: z\n\t\t.object({\n\t\t\tlongitude: ZodValidation.coerce.number('longitude').optional(),\n\t\t\tlatitude: ZodValidation.coerce.number('latitude').optional(),\n\t\t})\n\t\t.optional(),\n\tticketId: ZodValidation.coerce.objectId('ticketId').optional(),\n\tchatroomId: ZodValidation.coerce.objectId('chatroomId').optional(),\n\torderId: ZodValidation.coerce.objectId('orderId').optional(),\n\tcreatedAt: ZodValidation.coerce.date(),\n});\n\nexport const ChatroomMessageSendPushOutputSchema = z.object({\n\tlastMessage: ZodValidation.string('lastMessage').optional(),\n\tchatroomId: ZodValidation.coerce.objectId('chatroomId').optional(),\n\tticketId: ZodValidation.coerce.objectId('chatroomId').optional(),\n\torderId: ZodValidation.coerce.objectId('orderId').optional(),\n\ttype: ZodValidation.enumType(ChatroomType, 'type'),\n});\n\nexport type ChatlistMessageSendPushOutputDTO = DTO<typeof ChatroomMessageSendPushOutputSchema>;\n\nexport type ChatroomMessageSendSocketOutputDTO = DTO<typeof ChatroomMessageSendOutputSchema>;\nexport type ChatroomMessageSendSocketInputDTO = DTO<typeof ChatroomMessageSendSocketInputSchema>;\n\nexport class ChatroomMessageSendSocketEvent extends BaseSocketEvent<\n\ttypeof ChatroomMessageSendSocketInputSchema,\n\ttypeof ChatroomMessageSendOutputSchema,\n\ttypeof ChatroomMessageSendPushOutputSchema\n> {\n\tstatic readonly schemas = {\n\t\tinput: ChatroomMessageSendSocketInputSchema,\n\t\toutput: ChatroomMessageSendOutputSchema,\n\t\tpushNotificationOutput: ChatroomMessageSendPushOutputSchema,\n\t};\n\n\tpublic get notificationSettings(): NotificationSettings | undefined {\n\t\treturn {\n\t\t\tisPushNotification: true,\n\t\t\tisClickable: true,\n\t\t\tclickType: ClickType.CLICKABLE_MESSAGE,\n\t\t\ttitle: this.getTitle(),\n\t\t};\n\t}\n\n\tconstructor(payload: ChatroomMessageSendSocketOutputDTO) {\n\t\tconst pushPayload: ChatlistMessageSendPushOutputDTO = {\n\t\t\tlastMessage: payload.content,\n\t\t\tchatroomId: payload.chatroomId,\n\t\t\tticketId: payload.ticketId,\n\t\t\torderId: payload.orderId,\n\t\t\ttype: payload.chatroomType,\n\t\t};\n\n\t\tconst socketNotificationEvent = EventFactory.createEvent(SocketEventType.NOTIFICATION, {\n\t\t\tmessage: 'New message!',\n\t\t\tnotificationType: SocketEventType.CHATROOM_MESSAGE_SEND,\n\t\t\t_id: payload._id,\n\t\t});\n\n\t\tsuper(\n\t\t\tSocketEventType.CHATROOM_MESSAGE_SEND,\n\t\t\tChatroomMessageSendSocketEvent.schemas,\n\t\t\tpayload,\n\t\t\tpushPayload,\n\t\t\tsocketNotificationEvent\n\t\t);\n\t}\n\n\tprivate getTitle(): string {\n\t\treturn this.payload().senderType === UserRef.ADMIN\n\t\t\t? 'New message from support'\n\t\t\t: this.payload().sender.name;\n\t}\n\n\tstatic identifier(input: z.infer<typeof ChatroomMessageSendSocketInputSchema>): string {\n\t\treturn input.chatroomId.toString();\n\t}\n\n\tpublic getPushNotificationPayload() {\n\t\treturn this.pushNotificationData;\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn this.data.chatroomId?.toString() ?? 'default';\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;
9
8
  res: import("http").ServerResponse<import("http").IncomingMessage>;
10
9
  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;
8
7
  res: import("http").ServerResponse<import("http").IncomingMessage>;
9
8
  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;
7
6
  res: import("http").ServerResponse<import("http").IncomingMessage>;
8
7
  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;
9
8
  res: import("http").ServerResponse<import("http").IncomingMessage>;
10
9
  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.87
25
+ Version: 1.4.88
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.4.87",
3
+ "version": "1.4.88",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -26,8 +26,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
26
26
  searchFields?: string[] | undefined;
27
27
  } | undefined;
28
28
  sort?: Record<string, 1 | -1> | undefined;
29
- populate?: any;
30
29
  select?: Record<string, 0 | 1> | undefined;
30
+ populate?: any;
31
31
  query?: Record<string, any> | undefined;
32
32
  }, {
33
33
  search?: {
@@ -36,8 +36,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
36
36
  } | undefined;
37
37
  sort?: Record<string, 1 | -1> | undefined;
38
38
  size?: number | undefined;
39
- populate?: any;
40
39
  select?: Record<string, 0 | 1> | undefined;
40
+ populate?: any;
41
41
  query?: Record<string, any> | undefined;
42
42
  page?: number | undefined;
43
43
  }>>;
@@ -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
- populate?: any;
740
739
  select?: Record<string, 0 | 1> | undefined;
740
+ populate?: any;
741
741
  }, {
742
742
  _id: string | import("mongoose").Types.ObjectId;
743
- populate?: any;
744
743
  select?: Record<string, 0 | 1> | undefined;
744
+ populate?: any;
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
- populate?: any;
758
757
  select?: Record<string, 0 | 1> | undefined;
758
+ populate?: any;
759
759
  }, {
760
760
  _id: string | import("mongoose").Types.ObjectId;
761
- populate?: any;
762
761
  select?: Record<string, 0 | 1> | undefined;
762
+ populate?: any;
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
- populate?: any;
777
776
  select?: Record<string, 0 | 1> | undefined;
777
+ populate?: any;
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
- populate?: any;
784
783
  select?: Record<string, 0 | 1> | undefined;
784
+ populate?: any;
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
- populate?: any;
795
794
  select?: Record<string, 0 | 1> | undefined;
796
- }, {
797
795
  populate?: any;
796
+ }, {
798
797
  select?: Record<string, 0 | 1> | undefined;
798
+ populate?: any;
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
- populate?: any;
807
806
  select?: Record<string, 0 | 1> | undefined;
807
+ populate?: any;
808
808
  query?: Record<string, any> | undefined;
809
809
  }, {
810
- populate?: any;
811
810
  select?: Record<string, 0 | 1> | undefined;
811
+ populate?: any;
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.87",
3
+ "version": "1.4.88",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",