@lyxa.ai/core 1.3.32 → 1.3.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/libraries/logger/index.js +3 -2
  2. package/dist/libraries/logger/index.js.map +1 -1
  3. package/dist/libraries/socket/BaseSocketEvent.d.ts +5 -2
  4. package/dist/libraries/socket/BaseSocketEvent.js +6 -1
  5. package/dist/libraries/socket/BaseSocketEvent.js.map +1 -1
  6. package/dist/libraries/socket/adapters/socket-subscription.d.ts +2 -2
  7. package/dist/libraries/socket/adapters/socket-subscription.js +12 -13
  8. package/dist/libraries/socket/adapters/socket-subscription.js.map +1 -1
  9. package/dist/libraries/socket/core/socket-event-publisher.d.ts +2 -2
  10. package/dist/libraries/socket/core/socket-event-publisher.js +4 -0
  11. package/dist/libraries/socket/core/socket-event-publisher.js.map +1 -1
  12. package/dist/libraries/socket/core/socket-event-registry.map.d.ts +2 -2
  13. package/dist/libraries/socket/core/socket-event-registry.map.js +2 -2
  14. package/dist/libraries/socket/core/socket-event-registry.map.js.map +1 -1
  15. package/dist/libraries/socket/events/index.d.ts +1 -1
  16. package/dist/libraries/socket/events/index.js +1 -1
  17. package/dist/libraries/socket/events/index.js.map +1 -1
  18. package/dist/libraries/socket/events/order-actions.socket.event.d.ts +26 -492
  19. package/dist/libraries/socket/events/order-actions.socket.event.js +7 -40
  20. package/dist/libraries/socket/events/order-actions.socket.event.js.map +1 -1
  21. package/dist/libraries/socket/events/{notification.socket.event.d.ts → socketNotificationEvent.d.ts} +1 -1
  22. package/dist/libraries/socket/events/{notification.socket.event.js → socketNotificationEvent.js} +5 -5
  23. package/dist/libraries/socket/events/socketNotificationEvent.js.map +1 -0
  24. package/dist/types/README.md +1 -1
  25. package/dist/types/package.json +1 -1
  26. package/package.json +1 -1
  27. package/dist/libraries/socket/events/notification.socket.event.js.map +0 -1
@@ -23,6 +23,7 @@ let LyxaLogger = class LyxaLogger {
23
23
  constructor(identifier, mongoURI) {
24
24
  this.logDirectory = path_1.default.join(process.cwd(), 'logs');
25
25
  this.ensureLogDirectoryExists();
26
+ const baseLevel = process.env.NODE_ENV === 'DEV' || process.env.NODE_ENV === undefined ? 'debug' : 'info';
26
27
  const transports = pino_1.pino.transport({
27
28
  targets: [
28
29
  {
@@ -30,7 +31,7 @@ let LyxaLogger = class LyxaLogger {
30
31
  options: {
31
32
  colorize: true,
32
33
  },
33
- level: 'info',
34
+ level: baseLevel,
34
35
  },
35
36
  {
36
37
  target: 'pino/file',
@@ -51,7 +52,7 @@ let LyxaLogger = class LyxaLogger {
51
52
  ],
52
53
  });
53
54
  this._logger = (0, pino_1.pino)({
54
- level: 'info',
55
+ level: baseLevel,
55
56
  }, transports);
56
57
  }
57
58
  ensureLogDirectoryExists() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/logger/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,+BAAoC;AACpC,mCAAiC;AAG1B,IAAM,UAAU,GAAhB,MAAM,UAAU;IACL,OAAO,CAAS;IAChB,YAAY,CAAS;IAEtC,YAAY,UAAkB,EAAE,QAAgB;QAC/C,IAAI,CAAC,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;QAErD,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEhC,MAAM,UAAU,GAAG,WAAI,CAAC,SAAS,CAAC;YACjC,OAAO,EAAE;gBACR;oBACC,MAAM,EAAE,aAAa;oBACrB,OAAO,EAAE;wBACR,QAAQ,EAAE,IAAI;qBACd;oBACD,KAAK,EAAE,MAAM;iBACb;gBACD;oBACC,MAAM,EAAE,WAAW;oBACnB,OAAO,EAAE;wBACR,WAAW,EAAE,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC;qBACtD;oBACD,KAAK,EAAE,OAAO;iBACd;gBACD;oBACC,MAAM,EAAE,cAAc;oBACtB,OAAO,EAAE;wBACR,GAAG,EAAE,QAAQ;wBACb,QAAQ,EAAE,WAAW;wBACrB,UAAU,EAAE,UAAU;qBACtB;oBACD,KAAK,EAAE,OAAO;iBACd;aACD;SACD,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,IAAA,WAAI,EAClB;YACC,KAAK,EAAE,MAAM;SACb,EACD,UAAU,CACV,CAAC;IACH,CAAC;IAEO,wBAAwB;QAC/B,IAAI,CAAC;YACJ,YAAE,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IACF,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD,CAAA;AAxDY,gCAAU;qBAAV,UAAU;IADtB,IAAA,gBAAO,GAAE;;GACG,UAAU,CAwDtB","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { pino, Logger } from 'pino';\nimport { Service } from 'typedi';\n\n@Service()\nexport class LyxaLogger {\n\tprivate readonly _logger: Logger;\n\tprivate readonly logDirectory: string;\n\n\tconstructor(identifier: string, mongoURI: string) {\n\t\tthis.logDirectory = path.join(process.cwd(), 'logs');\n\n\t\tthis.ensureLogDirectoryExists();\n\n\t\tconst transports = pino.transport({\n\t\t\ttargets: [\n\t\t\t\t{\n\t\t\t\t\ttarget: 'pino-pretty',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tcolorize: true,\n\t\t\t\t\t},\n\t\t\t\t\tlevel: 'info',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttarget: 'pino/file',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tdestination: path.join(this.logDirectory, 'error.log'),\n\t\t\t\t\t},\n\t\t\t\t\tlevel: 'error',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttarget: 'pino-mongodb',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\turi: mongoURI,\n\t\t\t\t\t\tdatabase: 'lyxa-logs',\n\t\t\t\t\t\tcollection: identifier,\n\t\t\t\t\t},\n\t\t\t\t\tlevel: 'error',\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\tthis._logger = pino(\n\t\t\t{\n\t\t\t\tlevel: 'info',\n\t\t\t},\n\t\t\ttransports\n\t\t);\n\t}\n\n\tprivate ensureLogDirectoryExists(): void {\n\t\ttry {\n\t\t\tfs.mkdirSync(this.logDirectory, { recursive: true });\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to create log directory:', error);\n\t\t}\n\t}\n\n\tget logger(): Logger {\n\t\treturn this._logger;\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/logger/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,+BAAoC;AACpC,mCAAiC;AAG1B,IAAM,UAAU,GAAhB,MAAM,UAAU;IACL,OAAO,CAAS;IAChB,YAAY,CAAS;IAEtC,YAAY,UAAkB,EAAE,QAAgB;QAC/C,IAAI,CAAC,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;QAErD,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEhC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QAE1G,MAAM,UAAU,GAAG,WAAI,CAAC,SAAS,CAAC;YACjC,OAAO,EAAE;gBACR;oBACC,MAAM,EAAE,aAAa;oBACrB,OAAO,EAAE;wBACR,QAAQ,EAAE,IAAI;qBACd;oBACD,KAAK,EAAE,SAAS;iBAChB;gBACD;oBACC,MAAM,EAAE,WAAW;oBACnB,OAAO,EAAE;wBACR,WAAW,EAAE,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC;qBACtD;oBACD,KAAK,EAAE,OAAO;iBACd;gBACD;oBACC,MAAM,EAAE,cAAc;oBACtB,OAAO,EAAE;wBACR,GAAG,EAAE,QAAQ;wBACb,QAAQ,EAAE,WAAW;wBACrB,UAAU,EAAE,UAAU;qBACtB;oBACD,KAAK,EAAE,OAAO;iBACd;aACD;SACD,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,IAAA,WAAI,EAClB;YACC,KAAK,EAAE,SAAS;SAChB,EACD,UAAU,CACV,CAAC;IACH,CAAC;IAEO,wBAAwB;QAC/B,IAAI,CAAC;YACJ,YAAE,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IACF,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD,CAAA;AA1DY,gCAAU;qBAAV,UAAU;IADtB,IAAA,gBAAO,GAAE;;GACG,UAAU,CA0DtB","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { Logger, pino } from 'pino';\nimport { Service } from 'typedi';\n\n@Service()\nexport class LyxaLogger {\n\tprivate readonly _logger: Logger;\n\tprivate readonly logDirectory: string;\n\n\tconstructor(identifier: string, mongoURI: string) {\n\t\tthis.logDirectory = path.join(process.cwd(), 'logs');\n\n\t\tthis.ensureLogDirectoryExists();\n\n\t\tconst baseLevel = process.env.NODE_ENV === 'DEV' || process.env.NODE_ENV === undefined ? 'debug' : 'info';\n\n\t\tconst transports = pino.transport({\n\t\t\ttargets: [\n\t\t\t\t{\n\t\t\t\t\ttarget: 'pino-pretty',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tcolorize: true,\n\t\t\t\t\t},\n\t\t\t\t\tlevel: baseLevel,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttarget: 'pino/file',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tdestination: path.join(this.logDirectory, 'error.log'),\n\t\t\t\t\t},\n\t\t\t\t\tlevel: 'error',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttarget: 'pino-mongodb',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\turi: mongoURI,\n\t\t\t\t\t\tdatabase: 'lyxa-logs',\n\t\t\t\t\t\tcollection: identifier,\n\t\t\t\t\t},\n\t\t\t\t\tlevel: 'error',\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\tthis._logger = pino(\n\t\t\t{\n\t\t\t\tlevel: baseLevel,\n\t\t\t},\n\t\t\ttransports\n\t\t);\n\t}\n\n\tprivate ensureLogDirectoryExists(): void {\n\t\ttry {\n\t\t\tfs.mkdirSync(this.logDirectory, { recursive: true });\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to create log directory:', error);\n\t\t}\n\t}\n\n\tget logger(): Logger {\n\t\treturn this._logger;\n\t}\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import z, { ZodTypeAny } from 'zod';
2
2
  import { SocketEventType } from '../../utilities/enum';
3
- import { PushNotificationEvent, NotificationSettings } from './PushNotificationEvent';
3
+ import { NotificationSettings, PushNotificationEvent } from './PushNotificationEvent';
4
+ import { SocketNotificationEvent } from './events';
4
5
  export declare abstract class BaseSocketEvent<SIn extends ZodTypeAny, SOut extends ZodTypeAny, SPush extends ZodTypeAny | undefined = undefined> {
5
6
  protected readonly _eventType: SocketEventType;
6
7
  readonly inputSchema: SIn;
@@ -8,6 +9,7 @@ export declare abstract class BaseSocketEvent<SIn extends ZodTypeAny, SOut exten
8
9
  readonly pushNotificationOutputSchema?: SPush;
9
10
  protected readonly data: z.infer<SOut>;
10
11
  protected readonly pushNotificationData?: SPush extends ZodTypeAny ? z.infer<SPush> : undefined;
12
+ protected readonly socketNotificationEvent?: SocketNotificationEvent;
11
13
  protected abstract getIdentifier(): string;
12
14
  get notificationSettings(): NotificationSettings | undefined;
13
15
  notification?(): PushNotificationEvent | null;
@@ -16,9 +18,10 @@ export declare abstract class BaseSocketEvent<SIn extends ZodTypeAny, SOut exten
16
18
  input: SIn;
17
19
  output: SOut;
18
20
  pushNotificationOutput?: SPush;
19
- }, data: z.infer<SOut>, pushNotificationData?: SPush extends ZodTypeAny ? z.infer<SPush> : undefined);
21
+ }, data: z.infer<SOut>, pushNotificationData?: SPush extends ZodTypeAny ? z.infer<SPush> : undefined, socketNotificationEvent?: SocketNotificationEvent);
20
22
  payload(): z.infer<SOut>;
21
23
  getPushNotificationPayload(): SPush extends ZodTypeAny ? z.infer<SPush> | undefined : undefined;
24
+ getSocketNotificationEvent(): SocketNotificationEvent | undefined;
22
25
  eventType(): SocketEventType;
23
26
  getSubscriptionKey(): string;
24
27
  }
@@ -8,15 +8,17 @@ class BaseSocketEvent {
8
8
  pushNotificationOutputSchema;
9
9
  data;
10
10
  pushNotificationData;
11
+ socketNotificationEvent;
11
12
  get notificationSettings() {
12
13
  return undefined;
13
14
  }
14
15
  pushNotification = false;
15
- constructor(eventType, schemas, data, pushNotificationData) {
16
+ constructor(eventType, schemas, data, pushNotificationData, socketNotificationEvent) {
16
17
  this._eventType = eventType;
17
18
  this.inputSchema = schemas.input;
18
19
  this.outputSchema = schemas.output;
19
20
  this.data = this.outputSchema.parse(data);
21
+ this.socketNotificationEvent = socketNotificationEvent;
20
22
  if (schemas.pushNotificationOutput) {
21
23
  this.pushNotificationOutputSchema = schemas.pushNotificationOutput;
22
24
  if (pushNotificationData !== undefined) {
@@ -30,6 +32,9 @@ class BaseSocketEvent {
30
32
  getPushNotificationPayload() {
31
33
  return this.pushNotificationData;
32
34
  }
35
+ getSocketNotificationEvent() {
36
+ return this.socketNotificationEvent;
37
+ }
33
38
  eventType() {
34
39
  return this._eventType;
35
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseSocketEvent.js","sourceRoot":"/","sources":["libraries/socket/BaseSocketEvent.ts"],"names":[],"mappings":";;;AAMA,MAAsB,eAAe;IAGjB,UAAU,CAAkB;IAC/B,WAAW,CAAM;IACjB,YAAY,CAAO;IACnB,4BAA4B,CAAS;IAClC,IAAI,CAAgB;IACpB,oBAAoB,CAAyD;IAIhG,IAAW,oBAAoB;QAC9B,OAAO,SAAS,CAAC;IAClB,CAAC;IAGM,gBAAgB,GAAa,KAAK,CAAC;IAEvC,YACI,SAA0B,EAC1B,OAAqE,EACrE,IAAmB,EACnB,oBAA4E;QAE5E,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAG1C,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACjC,IAAI,CAAC,4BAA4B,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAEnE,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;gBACrC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,oBAAoB,CAA0D,CAAC;YACpJ,CAAC;QACL,CAAC;IACL,CAAC;IACG,OAAO;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAEM,0BAA0B;QAChC,OAAO,IAAI,CAAC,oBAAyF,CAAC;IACvG,CAAC;IAGM,SAAS;QACf,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,kBAAkB;QACxB,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,OAAO,GAAG,IAAI,CAAC,UAAU,IAAI,UAAU,EAAE,CAAC;IAC3C,CAAC;CACD;AAxDD,0CAwDC","sourcesContent":["\nimport z, { ZodTypeAny } from 'zod';\nimport { SocketEventType } from '../../utilities/enum';\nimport { PushNotificationEvent, NotificationSettings } from './PushNotificationEvent';\n\n\nexport abstract class BaseSocketEvent<SIn extends ZodTypeAny,\n\tSOut extends ZodTypeAny,\n\tSPush extends ZodTypeAny | undefined = undefined> {\n\tprotected readonly _eventType: SocketEventType;\n\tpublic readonly inputSchema: SIn;\n\tpublic readonly outputSchema: SOut;\n\tpublic readonly pushNotificationOutputSchema?: SPush;\n\tprotected readonly data: z.infer<SOut>;\n\tprotected readonly pushNotificationData?: SPush extends ZodTypeAny ? z.infer<SPush> : undefined;\n\n\tprotected abstract getIdentifier(): string;\n\n\tpublic get notificationSettings(): NotificationSettings | undefined {\n\t\treturn undefined;\n\t}\n\n\tpublic notification?(): PushNotificationEvent | null;\n\tpublic pushNotification?: boolean = false;\n\n protected constructor(\n eventType: SocketEventType,\n schemas: { input: SIn; output: SOut; pushNotificationOutput?: SPush },\n data: z.infer<SOut>,\n pushNotificationData?: SPush extends ZodTypeAny ? z.infer<SPush> : undefined\n ) {\n this._eventType = eventType;\n this.inputSchema = schemas.input;\n this.outputSchema = schemas.output;\n this.data = this.outputSchema.parse(data);\n\n // Set push notification data if schema exists\n if (schemas.pushNotificationOutput) {\n this.pushNotificationOutputSchema = schemas.pushNotificationOutput;\n // If pushNotificationData is explicitly provided, use it; otherwise undefined\n if (pushNotificationData !== undefined) {\n this.pushNotificationData = schemas.pushNotificationOutput.parse(pushNotificationData) as SPush extends ZodTypeAny ? z.infer<SPush> : undefined;\n }\n }\n }\n\tpublic payload(): z.infer<SOut> {\n\t\treturn this.data;\n\t}\n\n\tpublic getPushNotificationPayload(): SPush extends ZodTypeAny ? z.infer<SPush> | undefined : undefined {\n\t\treturn this.pushNotificationData as SPush extends ZodTypeAny ? z.infer<SPush> | undefined : undefined;\n\t}\n\n\n\tpublic eventType(): SocketEventType {\n\t\treturn this._eventType;\n\t}\n\n\tpublic getSubscriptionKey(): string {\n\t\tconst identifier = this.getIdentifier();\n\t\treturn `${this._eventType}:${identifier}`;\n\t}\n}\n"]}
1
+ {"version":3,"file":"BaseSocketEvent.js","sourceRoot":"/","sources":["libraries/socket/BaseSocketEvent.ts"],"names":[],"mappings":";;;AAKA,MAAsB,eAAe;IAKjB,UAAU,CAAkB;IAC/B,WAAW,CAAM;IACjB,YAAY,CAAO;IACnB,4BAA4B,CAAS;IAClC,IAAI,CAAgB;IACpB,oBAAoB,CAAyD;IAC7E,uBAAuB,CAA2B;IAIrE,IAAW,oBAAoB;QAC9B,OAAO,SAAS,CAAC;IAClB,CAAC;IAGM,gBAAgB,GAAa,KAAK,CAAC;IAE1C,YACC,SAA0B,EAC1B,OAAqE,EACrE,IAAmB,EACnB,oBAA4E,EAC5E,uBAAiD;QAEjD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QAGvD,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACpC,IAAI,CAAC,4BAA4B,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAEnE,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;gBACxC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAC/D,oBAAoB,CACqC,CAAC;YAC5D,CAAC;QACF,CAAC;IACF,CAAC;IACM,OAAO;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAEM,0BAA0B;QAChC,OAAO,IAAI,CAAC,oBAAyF,CAAC;IACvG,CAAC;IAEM,0BAA0B;QAChC,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACrC,CAAC;IAEM,SAAS;QACf,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,kBAAkB;QACxB,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,OAAO,GAAG,IAAI,CAAC,UAAU,IAAI,UAAU,EAAE,CAAC;IAC3C,CAAC;CACD;AAlED,0CAkEC","sourcesContent":["import z, { ZodTypeAny } from 'zod';\nimport { SocketEventType } from '../../utilities/enum';\nimport { NotificationSettings, PushNotificationEvent } from './PushNotificationEvent';\nimport { SocketNotificationEvent } from './events';\n\nexport abstract class BaseSocketEvent<\n\tSIn extends ZodTypeAny,\n\tSOut extends ZodTypeAny,\n\tSPush extends ZodTypeAny | undefined = undefined,\n> {\n\tprotected readonly _eventType: SocketEventType;\n\tpublic readonly inputSchema: SIn;\n\tpublic readonly outputSchema: SOut;\n\tpublic readonly pushNotificationOutputSchema?: SPush;\n\tprotected readonly data: z.infer<SOut>;\n\tprotected readonly pushNotificationData?: SPush extends ZodTypeAny ? z.infer<SPush> : undefined;\n\tprotected readonly socketNotificationEvent?: SocketNotificationEvent;\n\n\tprotected abstract getIdentifier(): string;\n\n\tpublic get notificationSettings(): NotificationSettings | undefined {\n\t\treturn undefined;\n\t}\n\n\tpublic notification?(): PushNotificationEvent | null;\n\tpublic pushNotification?: boolean = false;\n\n\tprotected constructor(\n\t\teventType: SocketEventType,\n\t\tschemas: { input: SIn; output: SOut; pushNotificationOutput?: SPush },\n\t\tdata: z.infer<SOut>,\n\t\tpushNotificationData?: SPush extends ZodTypeAny ? z.infer<SPush> : undefined,\n\t\tsocketNotificationEvent?: SocketNotificationEvent\n\t) {\n\t\tthis._eventType = eventType;\n\t\tthis.inputSchema = schemas.input;\n\t\tthis.outputSchema = schemas.output;\n\t\tthis.data = this.outputSchema.parse(data);\n\t\tthis.socketNotificationEvent = socketNotificationEvent;\n\n\t\t// Set push notification data if schema exists\n\t\tif (schemas.pushNotificationOutput) {\n\t\t\tthis.pushNotificationOutputSchema = schemas.pushNotificationOutput;\n\t\t\t// If pushNotificationData is explicitly provided, use it; otherwise undefined\n\t\t\tif (pushNotificationData !== undefined) {\n\t\t\t\tthis.pushNotificationData = schemas.pushNotificationOutput.parse(\n\t\t\t\t\tpushNotificationData\n\t\t\t\t) as SPush extends ZodTypeAny ? z.infer<SPush> : undefined;\n\t\t\t}\n\t\t}\n\t}\n\tpublic payload(): z.infer<SOut> {\n\t\treturn this.data;\n\t}\n\n\tpublic getPushNotificationPayload(): SPush extends ZodTypeAny ? z.infer<SPush> | undefined : undefined {\n\t\treturn this.pushNotificationData as SPush extends ZodTypeAny ? z.infer<SPush> | undefined : undefined;\n\t}\n\n\tpublic getSocketNotificationEvent(): SocketNotificationEvent | undefined {\n\t\treturn this.socketNotificationEvent;\n\t}\n\n\tpublic eventType(): SocketEventType {\n\t\treturn this._eventType;\n\t}\n\n\tpublic getSubscriptionKey(): string {\n\t\tconst identifier = this.getIdentifier();\n\t\treturn `${this._eventType}:${identifier}`;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { SocketEventType } from '../../../utilities/enum';
2
- import { InputFor } from '../index';
2
+ import { InputFor, OutputFor } from '../core';
3
3
  import { TokenType } from '../../auth';
4
4
  import { ProcedureResolverOptions } from '@trpc/server/unstable-core-do-not-import';
5
5
  import { EntityContext, LyxaHTTPContext } from '../../trpc/context';
@@ -12,5 +12,5 @@ type optsType<TEventType extends SocketEventType, TInput extends InputFor<TEvent
12
12
  usedRefreshToken: boolean | undefined;
13
13
  tokenRenewed: boolean | undefined;
14
14
  }, TInput>;
15
- export declare function createSocketSubscriptionAdapter<TEventType extends SocketEventType, TInput extends InputFor<TEventType>>(eventType: TEventType): (opts: optsType<TEventType, TInput>) => AsyncGenerator<any, void, unknown>;
15
+ export declare function createSocketSubscriptionAdapter<TEventType extends SocketEventType, TInput extends InputFor<TEventType>>(eventType: TEventType): (opts: optsType<TEventType, TInput>) => AsyncGenerator<Awaited<OutputFor<TEventType>>, void, unknown>;
16
16
  export {};
@@ -1,30 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSocketSubscriptionAdapter = createSocketSubscriptionAdapter;
4
- const index_1 = require("../index");
4
+ const core_1 = require("../core");
5
5
  const crypto_1 = require("crypto");
6
6
  const instance_utils_1 = require("../../../utilities/instance.utils");
7
7
  const events_1 = require("events");
8
+ const index_1 = require("../../../index");
8
9
  async function* _createSocketSubscription(eventType, opts) {
9
10
  const { ctx } = opts;
10
- console.log('Options are: ', opts);
11
+ const logger = (0, index_1.getLibraries)().getLogger().logger;
11
12
  const entity = { id: ctx.entity.id, type: ctx.entity.type };
12
- const eventKey = index_1.EventFactory.getSubscriptionKey(eventType, opts.input);
13
+ const eventKey = core_1.EventFactory.getSubscriptionKey(eventType, opts.input);
13
14
  const socketId = (0, crypto_1.randomUUID)();
14
15
  const socketInfo = { socketId, eventKey, instanceId: (0, instance_utils_1.getInstanceId)() };
15
- const localEE = new index_1.LocalEventEmitter(socketId);
16
- await (0, index_1.connectEntityToSocketEvent)(entity, socketInfo);
17
- index_1.LocalSubs.bind(entity, eventKey, localEE);
16
+ const localEE = new core_1.LocalEventEmitter(socketId);
17
+ await (0, core_1.connectEntityToSocketEvent)(entity, socketInfo);
18
+ core_1.LocalSubs.bind(entity, eventKey, localEE);
19
+ logger.debug({ entity, socketId, eventKey }, 'Socket subscription connected');
18
20
  opts.signal?.addEventListener('abort', () => {
19
- index_1.LocalSubs.unbind(entity, eventKey, localEE);
20
- (0, index_1.disconnectEntityFromSocketEvent)(entity, socketInfo).catch(console.error);
21
- console.log('Unsubscribed from event listener:', entity.id, socketId);
22
- console.log('Abort signal reason:', opts.signal?.reason);
23
- console.log('Abort signal reason:', opts.signal);
21
+ core_1.LocalSubs.unbind(entity, eventKey, localEE);
22
+ (0, core_1.disconnectEntityFromSocketEvent)(entity, socketInfo);
23
+ logger.debug({ entity, socketId, eventKey }, 'Socket subscription disconnected');
24
24
  });
25
- yield { _ready: true };
26
25
  for await (const [data] of (0, events_1.on)(localEE.ee, eventKey, { signal: opts.signal })) {
27
- console.log('Yielding event with signal:', opts.signal);
26
+ logger.debug({ entity, socketId, eventKey, data }, 'Socket subscription sending data');
28
27
  yield data;
29
28
  }
30
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"socket-subscription.js","sourceRoot":"/","sources":["libraries/socket/adapters/socket-subscription.ts"],"names":[],"mappings":";;AAqFA,0EAKC;AAzFD,oCASkB;AAClB,mCAAoC;AACpC,sEAAkE;AAIlE,mCAA4B;AA8B5B,KAAK,SAAS,CAAC,CAAC,yBAAyB,CAGvC,SAAqB,EAAE,IAAkC;IAC1D,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAEnC,MAAM,MAAM,GAAuB,EAAE,EAAE,EAAE,GAAG,CAAC,MAAO,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAO,CAAC,IAAI,EAAE,CAAC;IAElF,MAAM,QAAQ,GAAG,oBAAY,CAAC,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,IAAA,mBAAU,GAAE,CAAC;IAC9B,MAAM,UAAU,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAA,8BAAa,GAAE,EAAE,CAAC;IAEvE,MAAM,OAAO,GAAG,IAAI,yBAAiB,CAAC,QAAQ,CAAC,CAAC;IAGhD,MAAM,IAAA,kCAA0B,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrD,iBAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAG1C,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;QAC3C,iBAAS,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAA,uCAA+B,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,MAAM,EAAE,MAAM,EAAE,IAAI,EAAS,CAAC;IAI9B,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAA,WAAE,EAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;QAC9E,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACxD,MAAM,IAAW,CAAC;IACnB,CAAC;AACF,CAAC;AAED,SAAgB,+BAA+B,CAG7C,SAAqB;IACtB,OAAO,CAAC,IAAkC,EAAE,EAAE,CAAC,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import { SocketEventType } from '../../../utilities/enum';\nimport {\n\tconnectEntityToSocketEvent,\n\tdisconnectEntityFromSocketEvent,\n\tEntitySubscription,\n\tEventFactory,\n\tInputFor,\n\tLocalEventEmitter,\n\tLocalSubs,\n\tOutputFor,\n} from '../index';\nimport { randomUUID } from 'crypto';\nimport { getInstanceId } from '../../../utilities/instance.utils';\nimport { AuthEntityType, TokenType } from '../../auth';\nimport { ProcedureResolverOptions } from '@trpc/server/unstable-core-do-not-import';\nimport { EntityContext, LyxaHTTPContext } from '../../trpc/context';\nimport { on } from 'events';\n\ntype optsType<\n\tTEventType extends SocketEventType,\n\tTInput extends InputFor<TEventType>,\n> = ProcedureResolverOptions<\n\tobject,\n\tLyxaHTTPContext,\n\t{\n\t\tres: import('http').ServerResponse<import('http').IncomingMessage>;\n\t\ttokenType: TokenType | undefined;\n\t\tentity: EntityContext | undefined;\n\t\treq: import('http').IncomingMessage;\n\t\trequestId: string | undefined;\n\t\tusedRefreshToken: boolean | undefined;\n\t\ttokenRenewed: boolean | undefined;\n\t},\n\tTInput\n>;\n\ninterface _SubscriptionContext {\n\tentity?: { id: string; type: AuthEntityType };\n\tsignal?: AbortSignal;\n}\n\ninterface _SubscriptionOpts<TEventType extends SocketEventType, TInput extends InputFor<TEventType>> {\n\tctx: _SubscriptionContext;\n\tinput: TInput;\n}\n\nasync function* _createSocketSubscription<\n\tTEventType extends SocketEventType,\n\tTInput extends InputFor<TEventType>,\n>(eventType: TEventType, opts: optsType<TEventType, TInput>) {\n\tconst { ctx } = opts;\n\n\tconsole.log('Options are: ', opts);\n\n\tconst entity: EntitySubscription = { id: ctx.entity!.id, type: ctx.entity!.type };\n\n\tconst eventKey = EventFactory.getSubscriptionKey(eventType, opts.input);\n\tconst socketId = randomUUID();\n\tconst socketInfo = { socketId, eventKey, instanceId: getInstanceId() };\n\n\tconst localEE = new LocalEventEmitter(socketId);\n\n\t// Setup: connect to Redis and local registry\n\tawait connectEntityToSocketEvent(entity, socketInfo);\n\tLocalSubs.bind(entity, eventKey, localEE);\n\n\t// Cleanup on abort\n\topts.signal?.addEventListener('abort', () => {\n\t\tLocalSubs.unbind(entity, eventKey, localEE);\n\t\tdisconnectEntityFromSocketEvent(entity, socketInfo).catch(console.error);\n\t\tconsole.log('Unsubscribed from event listener:', entity.id, socketId);\n\t\tconsole.log('Abort signal reason:', opts.signal?.reason);\n\t\tconsole.log('Abort signal reason:', opts.signal);\n\t});\n\n\tyield { _ready: true } as any;\n\n\t// Stream events\n\ttype Out = OutputFor<TEventType>;\n\tfor await (const [data] of on(localEE.ee, eventKey, { signal: opts.signal })) {\n\t\tconsole.log('Yielding event with signal:', opts.signal);\n\t\tyield data as Out;\n\t}\n}\n\nexport function createSocketSubscriptionAdapter<\n\tTEventType extends SocketEventType,\n\tTInput extends InputFor<TEventType>,\n>(eventType: TEventType) {\n\treturn (opts: optsType<TEventType, TInput>) => _createSocketSubscription(eventType, opts);\n}\n\n/**\n * @Example\n * const socketRouterTwo = createTRPCRouter({\n * \tonMessage: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n * \t\t.input(ChatroomMessageSendSocketInputSchema)\n * \t\t.output(zAsyncIterable({ yield: ChatroomMessageSendOutputSchema }))\n * \t\t.subscription(createSocketSubscriptionAdapter(SocketEventType.CHATROOM_MESSAGE_SEND)),\n * });\n */\n"]}
1
+ {"version":3,"file":"socket-subscription.js","sourceRoot":"/","sources":["libraries/socket/adapters/socket-subscription.ts"],"names":[],"mappings":";;AAiFA,0EAKC;AArFD,kCASiB;AACjB,mCAAoC;AACpC,sEAAkE;AAIlE,mCAA4B;AAC5B,0CAA8C;AA8B9C,KAAK,SAAS,CAAC,CAAC,yBAAyB,CAGvC,SAAqB,EAAE,IAAkC;IAC1D,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACrB,MAAM,MAAM,GAAG,IAAA,oBAAY,GAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;IAEjD,MAAM,MAAM,GAAuB,EAAE,EAAE,EAAE,GAAG,CAAC,MAAO,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAO,CAAC,IAAI,EAAE,CAAC;IAClF,MAAM,QAAQ,GAAG,mBAAY,CAAC,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CA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AAI,CAAC,CAAC;AAC3F,CAAC","sourcesContent":["import { SocketEventType } from '../../../utilities/enum';\nimport {\n\tconnectEntityToSocketEvent,\n\tdisconnectEntityFromSocketEvent,\n\tEntitySubscription,\n\tEventFactory,\n\tInputFor,\n\tLocalEventEmitter,\n\tLocalSubs,\n\tOutputFor,\n} from '../core';\nimport { randomUUID } from 'crypto';\nimport { getInstanceId } from '../../../utilities/instance.utils';\nimport { AuthEntityType, TokenType } from '../../auth';\nimport { ProcedureResolverOptions } from '@trpc/server/unstable-core-do-not-import';\nimport { EntityContext, LyxaHTTPContext } from '../../trpc/context';\nimport { on } from 'events';\nimport { getLibraries } from '../../../index';\n\ntype optsType<\n\tTEventType extends SocketEventType,\n\tTInput extends InputFor<TEventType>,\n> = ProcedureResolverOptions<\n\tobject,\n\tLyxaHTTPContext,\n\t{\n\t\tres: import('http').ServerResponse<import('http').IncomingMessage>;\n\t\ttokenType: TokenType | undefined;\n\t\tentity: EntityContext | undefined;\n\t\treq: import('http').IncomingMessage;\n\t\trequestId: string | undefined;\n\t\tusedRefreshToken: boolean | undefined;\n\t\ttokenRenewed: boolean | undefined;\n\t},\n\tTInput\n>;\n\ninterface _SubscriptionContext {\n\tentity?: { id: string; type: AuthEntityType };\n\tsignal?: AbortSignal;\n}\n\ninterface _SubscriptionOpts<TEventType extends SocketEventType, TInput extends InputFor<TEventType>> {\n\tctx: _SubscriptionContext;\n\tinput: TInput;\n}\n\nasync function* _createSocketSubscription<\n\tTEventType extends SocketEventType,\n\tTInput extends InputFor<TEventType>,\n>(eventType: TEventType, opts: optsType<TEventType, TInput>) {\n\tconst { ctx } = opts;\n\tconst logger = getLibraries().getLogger().logger;\n\n\tconst entity: EntitySubscription = { id: ctx.entity!.id, type: ctx.entity!.type };\n\tconst eventKey = EventFactory.getSubscriptionKey(eventType, opts.input);\n\tconst socketId = randomUUID();\n\tconst socketInfo = { socketId, eventKey, instanceId: getInstanceId() };\n\n\tconst localEE = new LocalEventEmitter(socketId);\n\n\t// --- CONNECT ---\n\tawait connectEntityToSocketEvent(entity, socketInfo);\n\tLocalSubs.bind(entity, eventKey, localEE);\n\tlogger.debug({ entity, socketId, eventKey }, 'Socket subscription connected');\n\n\t// --- DISCONNECT ---\n\topts.signal?.addEventListener('abort', () => {\n\t\tLocalSubs.unbind(entity, eventKey, localEE);\n\t\tdisconnectEntityFromSocketEvent(entity, socketInfo);\n\t\tlogger.debug({ entity, socketId, eventKey }, 'Socket subscription disconnected');\n\t});\n\n\t// --- STREAM EVENTS ---\n\ttype Out = OutputFor<TEventType>;\n\tfor await (const [data] of on(localEE.ee, eventKey, { signal: opts.signal })) {\n\t\tlogger.debug({ entity, socketId, eventKey, data }, 'Socket subscription sending data');\n\t\tyield data as Out;\n\t}\n}\n\nexport function createSocketSubscriptionAdapter<\n\tTEventType extends SocketEventType,\n\tTInput extends InputFor<TEventType>,\n>(eventType: TEventType) {\n\treturn (opts: optsType<TEventType, TInput>) => _createSocketSubscription(eventType, opts);\n}\n\n/**\n * @Example\n * const socketRouterTwo = createTRPCRouter({\n * \tonMessage: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n * \t\t.input(ChatroomMessageSendSocketInputSchema)\n * \t\t.output(zAsyncIterable({ yield: ChatroomMessageSendOutputSchema }))\n * \t\t.subscription(createSocketSubscriptionAdapter(SocketEventType.CHATROOM_MESSAGE_SEND)),\n * });\n */\n"]}
@@ -1,6 +1,6 @@
1
1
  import { BaseSocketEvent } from '../BaseSocketEvent';
2
2
  import { EntitySubscription } from './socket-redis-connections';
3
- import { NotificationSocketEvent } from '../events';
3
+ import { SocketNotificationEvent } from '../events';
4
4
  import type { ZodTypeAny } from 'zod';
5
5
  export declare function publishSocketEvent(event: BaseSocketEvent<ZodTypeAny, ZodTypeAny, ZodTypeAny | undefined>, recipients: EntitySubscription[]): Promise<void>;
6
- export declare function publishNotificationSocketEvent(event: NotificationSocketEvent, recipients: EntitySubscription[]): Promise<void>;
6
+ export declare function publishNotificationSocketEvent(event: SocketNotificationEvent, recipients: EntitySubscription[]): Promise<void>;
@@ -76,8 +76,12 @@ async function publishSocketEvent(event, recipients) {
76
76
  }
77
77
  if (unsubscribed.length > 0 && event.notificationSettings?.isPushNotification) {
78
78
  const pushNotificationPayload = event.getPushNotificationPayload();
79
+ const socketNotificationPayload = event.getSocketNotificationEvent();
79
80
  const settings = event.notificationSettings;
80
81
  await (0, event_1.publishEvent)(new PushNotificationEvent_1.PushNotificationEvent(event.eventType(), pushNotificationPayload, unsubscribed, settings)).catch(err => console.error('[Socket] Push notification failed:', err));
82
+ if (socketNotificationPayload) {
83
+ await publishNotificationSocketEvent(socketNotificationPayload, unsubscribed);
84
+ }
81
85
  }
82
86
  }
83
87
  async function publishNotificationSocketEvent(event, recipients) {
@@ -1 +1 @@
1
- {"version":3,"file":"socket-event-publisher.js","sourceRoot":"/","sources":["libraries/socket/core/socket-event-publisher.ts"],"names":[],"mappings":";;AA6FA,gDA2BC;AAED,wEAmCC;AA7JD,gCAAwC;AAExC,yEAA0F;AAE1F,uCAA6F;AAC7F,oEAAiE;AAIjE,MAAM,eAAe,GAAG;IACvB,WAAW,EAAE,kBAAkB;IAC/B,UAAU,EAAE,IAAI;CACP,CAAC;AAGX,SAAS,kBAAkB,CAC1B,uBAAsF,EACtF,QAAgB,EAChB,OAAgB;IAEhB,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEjD,MAAM,OAAO,GAAG,IAAA,kBAAU,GAAE,CAAC;IAG7B,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,IAAW,EAAE,CAAC;IAG9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,SAAS,GAAG,SAA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,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACzC,IAAI,CAAC;oBACJ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC1C,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;gBACxC,CAAC;gBAAC,MAAM,CAAC;gBAET,CAAC;YACF,CAAC;YACD,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC1B,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YACxE,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CACF,CAAC;IAEF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,kBAAkB,CAAC,cAAc,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;AACF,CAAC","sourcesContent":["import { getLibraries } from '../../..';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\nimport { EntitySubscription, getEntityEventSocketsKey } from './socket-redis-connections';\nimport { NotificationSocketEvent } from '../events';\nimport { EXCHANGE_NAME, getChannel, INSTANCE_ROUTE_PREFIX, publishEvent } from '../../event';\nimport { PushNotificationEvent } from '../PushNotificationEvent';\nimport type { ZodTypeAny } from 'zod';\n\n// Reusable publish options\nconst PUBLISH_OPTIONS = {\n\tcontentType: 'application/json',\n\tpersistent: true,\n} as const;\n\n// Zero-overhead publishing - minimal allocations\nfunction publishToInstances(\n\trecipientsWithInstances: Array<{ recipient: EntitySubscription; instances: string[] }>,\n\tlocalKey: string,\n\tpayload: unknown\n): void {\n\tif (recipientsWithInstances.length === 0) return;\n\n\tconst channel = getChannel();\n\n\t// Pre-serialize message once\n\tconst message = { localKey, payload, recipient: null as any };\n\n\t// Fire-and-forget with minimal overhead\n\tfor (let i = 0; i < recipientsWithInstances.length; i++) {\n\t\tconst { recipient, instances } = recipientsWithInstances[i];\n\t\tmessage.recipient = recipient;\n\t\tconst messageStr = JSON.stringify(message);\n\n\t\tfor (let j = 0; j < instances.length; j++) {\n\t\t\tconst routingKey = `${INSTANCE_ROUTE_PREFIX}.${instances[j]}`;\n\n\t\t\ttry {\n\t\t\t\t// Direct publish - Buffer.from creates minimal overhead\n\t\t\t\tchannel.publish(EXCHANGE_NAME, routingKey, Buffer.from(messageStr, 'utf8'), PUBLISH_OPTIONS);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`[Socket] Publish failed: ${routingKey}`, error);\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Ultra-simple: Direct Redis lookups, no batch/cache/parsing!\nasync function getActiveSubscribedRecipients(\n\trecipients: EntitySubscription[],\n\tlocalKey: string\n): Promise<{\n\tsubscribed: Array<{ recipient: EntitySubscription; instances: string[] }>;\n\tunsubscribed: EntitySubscription[];\n}> {\n\tif (recipients.length === 0) {\n\t\treturn { subscribed: [], unsubscribed: [] };\n\t}\n\n\tconst redis = getLibraries().getRedisService();\n\tconst subscribed: Array<{ recipient: EntitySubscription; instances: string[] }> = [];\n\tconst unsubscribed: EntitySubscription[] = [];\n\n\t// Parallel lookups - one key per recipient\n\tawait Promise.all(\n\t\trecipients.map(async recipient => {\n\t\t\tconst sockets = await redis.getSetMembers(getEntityEventSocketsKey(recipient, localKey));\n\n\t\t\tif (sockets.length > 0) {\n\t\t\t\t// Extract instances\n\t\t\t\tconst instanceSet = new Set<string>();\n\t\t\t\tfor (let i = 0; i < sockets.length; i++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst socketInfo = JSON.parse(sockets[i]);\n\t\t\t\t\t\tinstanceSet.add(socketInfo.instanceId);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Skip malformed socket data\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (instanceSet.size > 0) {\n\t\t\t\t\tsubscribed.push({ recipient, instances: Array.from(instanceSet) });\n\t\t\t\t} else {\n\t\t\t\t\tunsubscribed.push(recipient);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunsubscribed.push(recipient);\n\t\t\t}\n\t\t})\n\t);\n\n\treturn { subscribed, unsubscribed };\n}\n\n// Minimal overhead publish - early returns, lazy evaluation\nexport async function publishSocketEvent(\n\tevent: BaseSocketEvent<ZodTypeAny, ZodTypeAny, ZodTypeAny | undefined>,\n\trecipients: EntitySubscription[]\n): Promise<void> {\n\tif (recipients.length === 0) return;\n\n\tconst localKey = event.getSubscriptionKey();\n\tconst payload = event.payload();\n\n\tconst { subscribed, unsubscribed } = await getActiveSubscribedRecipients(recipients, localKey);\n\n\tconsole.log('payloadaa', payload);\n\n\tconsole.log('subscribed', subscribed);\n\tconsole.log('unsubscribed', unsubscribed);\n\n\tif (subscribed.length > 0) {\n\t\tpublishToInstances(subscribed, localKey, payload);\n\t}\n\n\tif (unsubscribed.length > 0 && event.notificationSettings?.isPushNotification) {\n\t\tconst pushNotificationPayload = event.getPushNotificationPayload();\n\t\tconst settings = event.notificationSettings;\n\t\tawait publishEvent(\n\t\t\tnew PushNotificationEvent(event.eventType(), pushNotificationPayload, unsubscribed, settings)\n\t\t).catch(err => console.error('[Socket] Push notification failed:', err));\n\t}\n}\n\nexport async function publishNotificationSocketEvent(\n\tevent: NotificationSocketEvent,\n\trecipients: EntitySubscription[]\n): Promise<void> {\n\tif (recipients.length === 0) return;\n\n\tconst eventKey = event.getSubscriptionKey();\n\tconst redis = getLibraries().getRedisService();\n\tconst validInstances: Array<{ recipient: EntitySubscription; instances: string[] }> = [];\n\n\t// Parallel direct lookups\n\tawait Promise.all(\n\t\trecipients.map(async recipient => {\n\t\t\tconst sockets = await redis.getSetMembers(getEntityEventSocketsKey(recipient, eventKey));\n\n\t\t\tif (sockets.length > 0) {\n\t\t\t\tconst instanceSet = new Set<string>();\n\t\t\t\tfor (let i = 0; i < sockets.length; i++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst socketInfo = JSON.parse(sockets[i]);\n\t\t\t\t\t\tinstanceSet.add(socketInfo.instanceId);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Skip malformed socket data\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (instanceSet.size > 0) {\n\t\t\t\t\tvalidInstances.push({ recipient, instances: Array.from(instanceSet) });\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t);\n\n\tif (validInstances.length > 0) {\n\t\tpublishToInstances(validInstances, eventKey, event.payload());\n\t}\n}\n"]}
1
+ {"version":3,"file":"socket-event-publisher.js","sourceRoot":"/","sources":["libraries/socket/core/socket-event-publisher.ts"],"names":[],"mappings":";;AA6FA,gDAiCC;AAED,wEAmCC;AAnKD,gCAAwC;AAExC,yEAA0F;AAE1F,uCAA6F;AAC7F,oEAAiE;AAIjE,MAAM,eAAe,GAAG;IACvB,WAAW,EAAE,kBAAkB;IAC/B,UAAU,EAAE,IAAI;CACP,CAAC;AAGX,SAAS,kBAAkB,CAC1B,uBAAsF,EACtF,QAAgB,EAChB,OAAgB;IAEhB,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAEjD,MAAM,OAAO,GAAG,IAAA,kBAAU,GAAE,CAAC;IAG7B,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,IAAW,EAAE,CAAC;IAG9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC;QAC5D,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;QAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAA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CAAC;YACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACzC,IAAI,CAAC;oBACJ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC1C,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;gBACxC,CAAC;gBAAC,MAAM,CAAC;gBAET,CAAC;YACF,CAAC;YACD,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC1B,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YACxE,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CACF,CAAC;IAEF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,kBAAkB,CAAC,cAAc,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;AACF,CAAC","sourcesContent":["import { getLibraries } from '../../..';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\nimport { EntitySubscription, getEntityEventSocketsKey } from './socket-redis-connections';\nimport { SocketNotificationEvent } from '../events';\nimport { EXCHANGE_NAME, getChannel, INSTANCE_ROUTE_PREFIX, publishEvent } from '../../event';\nimport { PushNotificationEvent } from '../PushNotificationEvent';\nimport type { ZodTypeAny } from 'zod';\n\n// Reusable publish options\nconst PUBLISH_OPTIONS = {\n\tcontentType: 'application/json',\n\tpersistent: true,\n} as const;\n\n// Zero-overhead publishing - minimal allocations\nfunction publishToInstances(\n\trecipientsWithInstances: Array<{ recipient: EntitySubscription; instances: string[] }>,\n\tlocalKey: string,\n\tpayload: unknown\n): void {\n\tif (recipientsWithInstances.length === 0) return;\n\n\tconst channel = getChannel();\n\n\t// Pre-serialize message once\n\tconst message = { localKey, payload, recipient: null as any };\n\n\t// Fire-and-forget with minimal overhead\n\tfor (let i = 0; i < recipientsWithInstances.length; i++) {\n\t\tconst { recipient, instances } = recipientsWithInstances[i];\n\t\tmessage.recipient = recipient;\n\t\tconst messageStr = JSON.stringify(message);\n\n\t\tfor (let j = 0; j < instances.length; j++) {\n\t\t\tconst routingKey = `${INSTANCE_ROUTE_PREFIX}.${instances[j]}`;\n\n\t\t\ttry {\n\t\t\t\t// Direct publish - Buffer.from creates minimal overhead\n\t\t\t\tchannel.publish(EXCHANGE_NAME, routingKey, Buffer.from(messageStr, 'utf8'), PUBLISH_OPTIONS);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`[Socket] Publish failed: ${routingKey}`, error);\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Ultra-simple: Direct Redis lookups, no batch/cache/parsing!\nasync function getActiveSubscribedRecipients(\n\trecipients: EntitySubscription[],\n\tlocalKey: string\n): Promise<{\n\tsubscribed: Array<{ recipient: EntitySubscription; instances: string[] }>;\n\tunsubscribed: EntitySubscription[];\n}> {\n\tif (recipients.length === 0) {\n\t\treturn { subscribed: [], unsubscribed: [] };\n\t}\n\n\tconst redis = getLibraries().getRedisService();\n\tconst subscribed: Array<{ recipient: EntitySubscription; instances: string[] }> = [];\n\tconst unsubscribed: EntitySubscription[] = [];\n\n\t// Parallel lookups - one key per recipient\n\tawait Promise.all(\n\t\trecipients.map(async recipient => {\n\t\t\tconst sockets = await redis.getSetMembers(getEntityEventSocketsKey(recipient, localKey));\n\n\t\t\tif (sockets.length > 0) {\n\t\t\t\t// Extract instances\n\t\t\t\tconst instanceSet = new Set<string>();\n\t\t\t\tfor (let i = 0; i < sockets.length; i++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst socketInfo = JSON.parse(sockets[i]);\n\t\t\t\t\t\tinstanceSet.add(socketInfo.instanceId);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Skip malformed socket data\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (instanceSet.size > 0) {\n\t\t\t\t\tsubscribed.push({ recipient, instances: Array.from(instanceSet) });\n\t\t\t\t} else {\n\t\t\t\t\tunsubscribed.push(recipient);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunsubscribed.push(recipient);\n\t\t\t}\n\t\t})\n\t);\n\n\treturn { subscribed, unsubscribed };\n}\n\n// Minimal overhead publish - early returns, lazy evaluation\nexport async function publishSocketEvent(\n\tevent: BaseSocketEvent<ZodTypeAny, ZodTypeAny, ZodTypeAny | undefined>,\n\trecipients: EntitySubscription[]\n): Promise<void> {\n\tif (recipients.length === 0) return;\n\n\tconst localKey = event.getSubscriptionKey();\n\tconst payload = event.payload();\n\n\tconst { subscribed, unsubscribed } = await getActiveSubscribedRecipients(recipients, localKey);\n\n\tconsole.log('payloadaa', payload);\n\n\tconsole.log('subscribed', subscribed);\n\tconsole.log('unsubscribed', unsubscribed);\n\n\tif (subscribed.length > 0) {\n\t\tpublishToInstances(subscribed, localKey, payload);\n\t}\n\n\tif (unsubscribed.length > 0 && event.notificationSettings?.isPushNotification) {\n\t\tconst pushNotificationPayload = event.getPushNotificationPayload();\n\t\tconst socketNotificationPayload = event.getSocketNotificationEvent();\n\n\t\tconst settings = event.notificationSettings;\n\t\tawait publishEvent(\n\t\t\tnew PushNotificationEvent(event.eventType(), pushNotificationPayload, unsubscribed, settings)\n\t\t).catch(err => console.error('[Socket] Push notification failed:', err));\n\n\t\tif (socketNotificationPayload) {\n\t\t\tawait publishNotificationSocketEvent(socketNotificationPayload, unsubscribed);\n\t\t}\n\t}\n}\n\nexport async function publishNotificationSocketEvent(\n\tevent: SocketNotificationEvent,\n\trecipients: EntitySubscription[]\n): Promise<void> {\n\tif (recipients.length === 0) return;\n\n\tconst eventKey = event.getSubscriptionKey();\n\tconst redis = getLibraries().getRedisService();\n\tconst validInstances: Array<{ recipient: EntitySubscription; instances: string[] }> = [];\n\n\t// Parallel direct lookups\n\tawait Promise.all(\n\t\trecipients.map(async recipient => {\n\t\t\tconst sockets = await redis.getSetMembers(getEntityEventSocketsKey(recipient, eventKey));\n\n\t\t\tif (sockets.length > 0) {\n\t\t\t\tconst instanceSet = new Set<string>();\n\t\t\t\tfor (let i = 0; i < sockets.length; i++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst socketInfo = JSON.parse(sockets[i]);\n\t\t\t\t\t\tinstanceSet.add(socketInfo.instanceId);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Skip malformed socket data\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (instanceSet.size > 0) {\n\t\t\t\t\tvalidInstances.push({ recipient, instances: Array.from(instanceSet) });\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t);\n\n\tif (validInstances.length > 0) {\n\t\tpublishToInstances(validInstances, eventKey, event.payload());\n\t}\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { ChatlistMessageSendSocketEvent } from '../events';
2
2
  import { TicketAssignEvent } from '../events/ticket-assign.socket.event';
3
3
  import { TicketUnassignEvent } from '../events/ticket-unassign.socket.event';
4
- import { NotificationSocketEvent } from '../events/notification.socket.event';
4
+ import { SocketNotificationEvent } from '../events/socketNotificationEvent';
5
5
  import { RiderConnectSocketEvent } from '../events/rider-connect.socket.event';
6
6
  import { RiderLocationUpdateSocketEvent } from '../events/rider-location-update.socket.event';
7
7
  import { TicketActionsSocketEvent } from '../events/ticket-actions.socket.event';
@@ -13,7 +13,7 @@ export declare const REGISTRY: {
13
13
  readonly CHATLIST_MESSAGE_RECEIVED: typeof ChatlistMessageSendSocketEvent;
14
14
  readonly TICKET_ASSIGN: typeof TicketAssignEvent;
15
15
  readonly TICKET_UNASSIGN: typeof TicketUnassignEvent;
16
- readonly NOTIFICATION: typeof NotificationSocketEvent;
16
+ readonly NOTIFICATION: typeof SocketNotificationEvent;
17
17
  readonly RIDER_CONNECT: typeof RiderConnectSocketEvent;
18
18
  readonly RIDER_LOCATION_UPDATE: typeof RiderLocationUpdateSocketEvent;
19
19
  readonly TICKET_ACCEPT: typeof TicketActionsSocketEvent;
@@ -7,7 +7,7 @@ const enum_1 = require("../../../utilities/enum");
7
7
  const events_1 = require("../events");
8
8
  const ticket_assign_socket_event_1 = require("../events/ticket-assign.socket.event");
9
9
  const ticket_unassign_socket_event_1 = require("../events/ticket-unassign.socket.event");
10
- const notification_socket_event_1 = require("../events/notification.socket.event");
10
+ const socketNotificationEvent_1 = require("../events/socketNotificationEvent");
11
11
  const rider_connect_socket_event_1 = require("../events/rider-connect.socket.event");
12
12
  const rider_location_update_socket_event_1 = require("../events/rider-location-update.socket.event");
13
13
  const ticket_actions_socket_event_1 = require("../events/ticket-actions.socket.event");
@@ -18,7 +18,7 @@ exports.REGISTRY = {
18
18
  [enum_1.SocketEventType.CHATLIST_MESSAGE_RECEIVED]: events_1.ChatlistMessageSendSocketEvent,
19
19
  [enum_1.SocketEventType.TICKET_ASSIGN]: ticket_assign_socket_event_1.TicketAssignEvent,
20
20
  [enum_1.SocketEventType.TICKET_UNASSIGN]: ticket_unassign_socket_event_1.TicketUnassignEvent,
21
- [enum_1.SocketEventType.NOTIFICATION]: notification_socket_event_1.NotificationSocketEvent,
21
+ [enum_1.SocketEventType.NOTIFICATION]: socketNotificationEvent_1.SocketNotificationEvent,
22
22
  [enum_1.SocketEventType.RIDER_CONNECT]: rider_connect_socket_event_1.RiderConnectSocketEvent,
23
23
  [enum_1.SocketEventType.RIDER_LOCATION_UPDATE]: rider_location_update_socket_event_1.RiderLocationUpdateSocketEvent,
24
24
  [enum_1.SocketEventType.TICKET_ACTIONS]: ticket_actions_socket_event_1.TicketActionsSocketEvent,
@@ -1 +1 @@
1
- {"version":3,"file":"socket-event-registry.map.js","sourceRoot":"/","sources":["libraries/socket/core/socket-event-registry.map.ts"],"names":[],"mappings":";;;AAkCA,gCAEC;AAGD,sCAUC;AAjDD,kDAA0D;AAC1D,sCAA2D;AAC3D,qFAAyE;AACzE,yFAA6E;AAC7E,mFAA8E;AAC9E,qFAA+E;AAC/E,qGAA8F;AAC9F,uFAAiF;AAEjF,qFAA+E;AAC/E,qGAA8F;AAEjF,QAAA,QAAQ,GAAG;IACvB,CAAC,sBAAe,CAAC,qBAAqB,CAAC,EAAE,mEAA8B;IACvE,CAAC,sBAAe,CAAC,yBAAyB,CAAC,EAAE,uCAA8B;IAC3E,CAAC,sBAAe,CAAC,aAAa,CAAC,EAAE,8CAAiB;IAClD,CAAC,sBAAe,CAAC,eAAe,CAAC,EAAE,kDAAmB;IACtD,CAAC,sBAAe,CAAC,YAAY,CAAC,EAAE,mDAAuB;IACvD,CAAC,sBAAe,CAAC,aAAa,CAAC,EAAE,oDAAuB;IACxD,CAAC,sBAAe,CAAC,qBAAqB,CAAC,EAAE,mEAA8B;IACvE,CAAC,sBAAe,CAAC,cAAc,CAAC,EAAE,sDAAwB;IAC1D,CAAC,sBAAe,CAAC,aAAa,CAAC,EAAE,oDAAuB;CAC/C,CAAC;AAYX,SAAgB,UAAU,CAAsC,UAAa;IAC5E,OAAO,UAAU,CAAC,OAAO,CAAC;AAC3B,CAAC;AAGD,SAAgB,aAAa,CAC5B,UAAa;IAEb,MAAM,aAAa,GAClB,YAAY,IAAI,UAAU,IAAI,OAAQ,UAAqC,CAAC,UAAU,KAAK,UAAU,CAAC;IACvG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAE,UAAoC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAIxE,CAAC;AACd,CAAC","sourcesContent":["import { SocketEventType } from '../../../utilities/enum';\nimport { ChatlistMessageSendSocketEvent } from '../events';\nimport { TicketAssignEvent } from '../events/ticket-assign.socket.event';\nimport { TicketUnassignEvent } from '../events/ticket-unassign.socket.event';\nimport { NotificationSocketEvent } from '../events/notification.socket.event';\nimport { RiderConnectSocketEvent } from '../events/rider-connect.socket.event';\nimport { RiderLocationUpdateSocketEvent } from '../events/rider-location-update.socket.event';\nimport { TicketActionsSocketEvent } from '../events/ticket-actions.socket.event';\nimport type { ZodTypeAny } from 'zod';\nimport { OrderActionsSocketEvent } from '../events/order-actions.socket.event';\nimport { ChatroomMessageSendSocketEvent } from '../events/chatroom-message-send.socket.event';\n\nexport const REGISTRY = {\n\t[SocketEventType.CHATROOM_MESSAGE_SEND]: ChatroomMessageSendSocketEvent,\n\t[SocketEventType.CHATLIST_MESSAGE_RECEIVED]: ChatlistMessageSendSocketEvent,\n\t[SocketEventType.TICKET_ASSIGN]: TicketAssignEvent,\n\t[SocketEventType.TICKET_UNASSIGN]: TicketUnassignEvent,\n\t[SocketEventType.NOTIFICATION]: NotificationSocketEvent,\n\t[SocketEventType.RIDER_CONNECT]: RiderConnectSocketEvent,\n\t[SocketEventType.RIDER_LOCATION_UPDATE]: RiderLocationUpdateSocketEvent,\n\t[SocketEventType.TICKET_ACTIONS]: TicketActionsSocketEvent,\n\t[SocketEventType.ORDER_ACTIONS]: OrderActionsSocketEvent,\n} as const;\n\nexport type Registry = typeof REGISTRY;\n\n// Type-safe schema structure constraint\ntype EventSchemas = {\n\tinput: ZodTypeAny;\n\toutput: ZodTypeAny;\n\tpushNotificationOutput?: ZodTypeAny;\n};\n\n// Extract schemas from event class with full type inference\nexport function getSchemas<T extends { schemas: EventSchemas }>(eventClass: T): T['schemas'] {\n\treturn eventClass.schemas;\n}\n\n// Extract identifier function if present, otherwise undefined\nexport function getIdentifier<T extends object>(\n\teventClass: T\n): T extends { identifier: infer I } ? I : undefined {\n\tconst hasIdentifier =\n\t\t'identifier' in eventClass && typeof (eventClass as { identifier?: never }).identifier === 'function';\n\treturn (hasIdentifier ? (eventClass as { identifier: never }).identifier : undefined) as T extends {\n\t\tidentifier: infer I;\n\t}\n\t\t? I\n\t\t: undefined;\n}\n"]}
1
+ {"version":3,"file":"socket-event-registry.map.js","sourceRoot":"/","sources":["libraries/socket/core/socket-event-registry.map.ts"],"names":[],"mappings":";;;AAkCA,gCAEC;AAGD,sCAUC;AAjDD,kDAA0D;AAC1D,sCAA2D;AAC3D,qFAAyE;AACzE,yFAA6E;AAC7E,+EAA4E;AAC5E,qFAA+E;AAC/E,qGAA8F;AAC9F,uFAAiF;AAEjF,qFAA+E;AAC/E,qGAA8F;AAEjF,QAAA,QAAQ,GAAG;IACvB,CAAC,sBAAe,CAAC,qBAAqB,CAAC,EAAE,mEAA8B;IACvE,CAAC,sBAAe,CAAC,yBAAyB,CAAC,EAAE,uCAA8B;IAC3E,CAAC,sBAAe,CAAC,aAAa,CAAC,EAAE,8CAAiB;IAClD,CAAC,sBAAe,CAAC,eAAe,CAAC,EAAE,kDAAmB;IACtD,CAAC,sBAAe,CAAC,YAAY,CAAC,EAAE,iDAAuB;IACvD,CAAC,sBAAe,CAAC,aAAa,CAAC,EAAE,oDAAuB;IACxD,CAAC,sBAAe,CAAC,qBAAqB,CAAC,EAAE,mEAA8B;IACvE,CAAC,sBAAe,CAAC,cAAc,CAAC,EAAE,sDAAwB;IAC1D,CAAC,sBAAe,CAAC,aAAa,CAAC,EAAE,oDAAuB;CAC/C,CAAC;AAYX,SAAgB,UAAU,CAAsC,UAAa;IAC5E,OAAO,UAAU,CAAC,OAAO,CAAC;AAC3B,CAAC;AAGD,SAAgB,aAAa,CAC5B,UAAa;IAEb,MAAM,aAAa,GAClB,YAAY,IAAI,UAAU,IAAI,OAAQ,UAAqC,CAAC,UAAU,KAAK,UAAU,CAAC;IACvG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAE,UAAoC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAIxE,CAAC;AACd,CAAC","sourcesContent":["import { SocketEventType } from '../../../utilities/enum';\nimport { ChatlistMessageSendSocketEvent } from '../events';\nimport { TicketAssignEvent } from '../events/ticket-assign.socket.event';\nimport { TicketUnassignEvent } from '../events/ticket-unassign.socket.event';\nimport { SocketNotificationEvent } from '../events/socketNotificationEvent';\nimport { RiderConnectSocketEvent } from '../events/rider-connect.socket.event';\nimport { RiderLocationUpdateSocketEvent } from '../events/rider-location-update.socket.event';\nimport { TicketActionsSocketEvent } from '../events/ticket-actions.socket.event';\nimport type { ZodTypeAny } from 'zod';\nimport { OrderActionsSocketEvent } from '../events/order-actions.socket.event';\nimport { ChatroomMessageSendSocketEvent } from '../events/chatroom-message-send.socket.event';\n\nexport const REGISTRY = {\n\t[SocketEventType.CHATROOM_MESSAGE_SEND]: ChatroomMessageSendSocketEvent,\n\t[SocketEventType.CHATLIST_MESSAGE_RECEIVED]: ChatlistMessageSendSocketEvent,\n\t[SocketEventType.TICKET_ASSIGN]: TicketAssignEvent,\n\t[SocketEventType.TICKET_UNASSIGN]: TicketUnassignEvent,\n\t[SocketEventType.NOTIFICATION]: SocketNotificationEvent,\n\t[SocketEventType.RIDER_CONNECT]: RiderConnectSocketEvent,\n\t[SocketEventType.RIDER_LOCATION_UPDATE]: RiderLocationUpdateSocketEvent,\n\t[SocketEventType.TICKET_ACTIONS]: TicketActionsSocketEvent,\n\t[SocketEventType.ORDER_ACTIONS]: OrderActionsSocketEvent,\n} as const;\n\nexport type Registry = typeof REGISTRY;\n\n// Type-safe schema structure constraint\ntype EventSchemas = {\n\tinput: ZodTypeAny;\n\toutput: ZodTypeAny;\n\tpushNotificationOutput?: ZodTypeAny;\n};\n\n// Extract schemas from event class with full type inference\nexport function getSchemas<T extends { schemas: EventSchemas }>(eventClass: T): T['schemas'] {\n\treturn eventClass.schemas;\n}\n\n// Extract identifier function if present, otherwise undefined\nexport function getIdentifier<T extends object>(\n\teventClass: T\n): T extends { identifier: infer I } ? I : undefined {\n\tconst hasIdentifier =\n\t\t'identifier' in eventClass && typeof (eventClass as { identifier?: never }).identifier === 'function';\n\treturn (hasIdentifier ? (eventClass as { identifier: never }).identifier : undefined) as T extends {\n\t\tidentifier: infer I;\n\t}\n\t\t? I\n\t\t: undefined;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export * from './chatlist-message-send.socket.event';
2
- export * from './notification.socket.event';
2
+ export * from './socketNotificationEvent';
3
3
  export * from './rider-connect.socket.event';
4
4
  export * from './rider-location-update.socket.event';
5
5
  export * from './ticket-assign.socket.event';
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./chatlist-message-send.socket.event"), exports);
18
- __exportStar(require("./notification.socket.event"), exports);
18
+ __exportStar(require("./socketNotificationEvent"), exports);
19
19
  __exportStar(require("./rider-connect.socket.event"), exports);
20
20
  __exportStar(require("./rider-location-update.socket.event"), exports);
21
21
  __exportStar(require("./ticket-assign.socket.event"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/socket/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,8DAA4C;AAC5C,+DAA6C;AAC7C,uEAAqD;AACrD,+DAA6C;AAC7C,iEAA+C;AAC/C,+DAA6C","sourcesContent":["export * from './chatlist-message-send.socket.event';\nexport * from './notification.socket.event';\nexport * from './rider-connect.socket.event';\nexport * from './rider-location-update.socket.event';\nexport * from './ticket-assign.socket.event';\nexport * from './ticket-unassign.socket.event';\nexport * from './order-actions.socket.event';"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/socket/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,4DAA0C;AAC1C,+DAA6C;AAC7C,uEAAqD;AACrD,+DAA6C;AAC7C,iEAA+C;AAC/C,+DAA6C","sourcesContent":["export * from './chatlist-message-send.socket.event';\nexport * from './socketNotificationEvent';\nexport * from './rider-connect.socket.event';\nexport * from './rider-location-update.socket.event';\nexport * from './ticket-assign.socket.event';\nexport * from './ticket-unassign.socket.event';\nexport * from './order-actions.socket.event';"]}
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { DTO } from '../../../utilities/validation/';
3
3
  import { PaymentMethod, RegularOrderStatus } from '../../../utilities/enum';
4
4
  import { BaseSocketEvent } from '../BaseSocketEvent';
5
+ import { SocketNotificationEvent } from './socketNotificationEvent';
5
6
  export declare enum OrderAction {
6
7
  PLACED = "placed",
7
8
  ADJUSTMENT = "adjustment",
@@ -13,279 +14,45 @@ export declare const OrderActionsOutputSchema: z.ZodObject<{
13
14
  user: z.ZodObject<{
14
15
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
15
16
  name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
16
- ordersCount: z.ZodNumber;
17
17
  }, "strip", z.ZodTypeAny, {
18
18
  name: string;
19
19
  _id: import("mongoose").Types.ObjectId;
20
- ordersCount: number;
21
20
  }, {
22
21
  name: string;
23
22
  _id: string | import("mongoose").Types.ObjectId;
24
- ordersCount: number;
25
23
  }>;
26
- lineItems: z.ZodArray<z.ZodObject<{
27
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
28
- name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
29
- description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
30
- attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
31
- instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
32
- quantity: z.ZodNumber;
33
- price: z.ZodEffects<z.ZodNumber, number, number>;
34
- secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
35
- }, "strip", z.ZodTypeAny, {
36
- name: string;
37
- _id: import("mongoose").Types.ObjectId;
38
- price: number;
39
- quantity: number;
40
- attributes?: string[] | undefined;
41
- description?: string | undefined;
42
- instructions?: string | undefined;
43
- secondaryPrice?: number | undefined;
44
- }, {
45
- name: string;
46
- _id: string | import("mongoose").Types.ObjectId;
47
- price: number;
48
- quantity: number;
49
- attributes?: string[] | undefined;
50
- description?: string | undefined;
51
- instructions?: string | undefined;
52
- secondaryPrice?: number | undefined;
53
- }>, "many">;
54
- canceledLineItems: z.ZodOptional<z.ZodArray<z.ZodObject<{
55
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
56
- name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
57
- description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
58
- attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
59
- instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
60
- quantity: z.ZodNumber;
61
- price: z.ZodEffects<z.ZodNumber, number, number>;
62
- secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
63
- }, "strip", z.ZodTypeAny, {
64
- name: string;
65
- _id: import("mongoose").Types.ObjectId;
66
- price: number;
67
- quantity: number;
68
- attributes?: string[] | undefined;
69
- description?: string | undefined;
70
- instructions?: string | undefined;
71
- secondaryPrice?: number | undefined;
72
- }, {
73
- name: string;
74
- _id: string | import("mongoose").Types.ObjectId;
75
- price: number;
76
- quantity: number;
77
- attributes?: string[] | undefined;
78
- description?: string | undefined;
79
- instructions?: string | undefined;
80
- secondaryPrice?: number | undefined;
81
- }>, "many">>;
82
- address: z.ZodObject<{
83
- address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
84
- description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
85
- city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
86
- state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
87
- country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
88
- location: z.ZodObject<{
89
- type: z.ZodDefault<z.ZodNativeEnum<typeof import("../../../utilities/enum").GeoLocationType>>;
90
- coordinates: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
91
- }, "strip", z.ZodTypeAny, {
92
- type: import("../../../utilities/enum").GeoLocationType;
93
- coordinates: [number, number];
94
- }, {
95
- coordinates: [number, number];
96
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
97
- }>;
98
- latitude: z.ZodNumber;
99
- longitude: z.ZodNumber;
100
- zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
101
- } & {
102
- addressLabel: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
103
- apartment: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
104
- buildingName: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
105
- deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
106
- instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
107
- } & {
108
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
109
- }, "strip", z.ZodTypeAny, {
110
- location: {
111
- type: import("../../../utilities/enum").GeoLocationType;
112
- coordinates: [number, number];
113
- };
114
- address: string;
115
- country: string;
116
- _id: import("mongoose").Types.ObjectId;
117
- city: string;
118
- latitude: number;
119
- longitude: number;
120
- addressLabel: string;
121
- apartment: string;
122
- buildingName: string;
123
- state?: string | undefined;
124
- description?: string | undefined;
125
- zone?: import("mongoose").Types.ObjectId | undefined;
126
- deliveryOption?: string | undefined;
127
- instructions?: string | undefined;
128
- }, {
129
- location: {
130
- coordinates: [number, number];
131
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
132
- };
133
- address: string;
134
- country: string;
135
- _id: string | import("mongoose").Types.ObjectId;
136
- city: string;
137
- latitude: number;
138
- longitude: number;
139
- addressLabel: string;
140
- apartment: string;
141
- buildingName: string;
142
- state?: string | undefined;
143
- description?: string | undefined;
144
- zone?: string | import("mongoose").Types.ObjectId | undefined;
145
- deliveryOption?: string | undefined;
146
- instructions?: string | undefined;
147
- }>;
148
- paymentSummary: z.ZodObject<{
149
- paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
150
- subtotal: z.ZodEffects<z.ZodNumber, number, number>;
151
- secondarySubtotal: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
152
- totalAmount: z.ZodEffects<z.ZodNumber, number, number>;
153
- secondaryTotalAmount: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
154
- }, "strip", z.ZodTypeAny, {
155
- paymentMethod: PaymentMethod;
156
- totalAmount: number;
157
- subtotal: number;
158
- secondaryTotalAmount?: number | undefined;
159
- secondarySubtotal?: number | undefined;
160
- }, {
161
- paymentMethod: PaymentMethod;
162
- totalAmount: number;
163
- subtotal: number;
164
- secondaryTotalAmount?: number | undefined;
165
- secondarySubtotal?: number | undefined;
166
- }>;
167
- preparationTimeMinutes: z.ZodNumber;
168
- placedAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
169
24
  orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
170
25
  orderAction: z.ZodNativeEnum<typeof OrderAction>;
26
+ paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
27
+ preparationTimeMinutes: z.ZodNumber;
28
+ createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
29
+ triggerAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
171
30
  }, "strip", z.ZodTypeAny, {
172
- address: {
173
- location: {
174
- type: import("../../../utilities/enum").GeoLocationType;
175
- coordinates: [number, number];
176
- };
177
- address: string;
178
- country: string;
179
- _id: import("mongoose").Types.ObjectId;
180
- city: string;
181
- latitude: number;
182
- longitude: number;
183
- addressLabel: string;
184
- apartment: string;
185
- buildingName: string;
186
- state?: string | undefined;
187
- description?: string | undefined;
188
- zone?: import("mongoose").Types.ObjectId | undefined;
189
- deliveryOption?: string | undefined;
190
- instructions?: string | undefined;
191
- };
192
31
  user: {
193
32
  name: string;
194
33
  _id: import("mongoose").Types.ObjectId;
195
- ordersCount: number;
196
34
  };
197
35
  _id: import("mongoose").Types.ObjectId;
36
+ createdAt: Date;
198
37
  orderId: string;
199
- placedAt: Date;
200
- lineItems: {
201
- name: string;
202
- _id: import("mongoose").Types.ObjectId;
203
- price: number;
204
- quantity: number;
205
- attributes?: string[] | undefined;
206
- description?: string | undefined;
207
- instructions?: string | undefined;
208
- secondaryPrice?: number | undefined;
209
- }[];
210
- paymentSummary: {
211
- paymentMethod: PaymentMethod;
212
- totalAmount: number;
213
- subtotal: number;
214
- secondaryTotalAmount?: number | undefined;
215
- secondarySubtotal?: number | undefined;
216
- };
217
- preparationTimeMinutes: number;
38
+ paymentMethod: PaymentMethod;
39
+ triggerAt: Date;
218
40
  orderStatus: RegularOrderStatus;
219
41
  orderAction: OrderAction;
220
- canceledLineItems?: {
221
- name: string;
222
- _id: import("mongoose").Types.ObjectId;
223
- price: number;
224
- quantity: number;
225
- attributes?: string[] | undefined;
226
- description?: string | undefined;
227
- instructions?: string | undefined;
228
- secondaryPrice?: number | undefined;
229
- }[] | undefined;
42
+ preparationTimeMinutes: number;
230
43
  }, {
231
- address: {
232
- location: {
233
- coordinates: [number, number];
234
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
235
- };
236
- address: string;
237
- country: string;
238
- _id: string | import("mongoose").Types.ObjectId;
239
- city: string;
240
- latitude: number;
241
- longitude: number;
242
- addressLabel: string;
243
- apartment: string;
244
- buildingName: string;
245
- state?: string | undefined;
246
- description?: string | undefined;
247
- zone?: string | import("mongoose").Types.ObjectId | undefined;
248
- deliveryOption?: string | undefined;
249
- instructions?: string | undefined;
250
- };
251
44
  user: {
252
45
  name: string;
253
46
  _id: string | import("mongoose").Types.ObjectId;
254
- ordersCount: number;
255
47
  };
256
48
  _id: string | import("mongoose").Types.ObjectId;
49
+ createdAt: Date;
257
50
  orderId: string;
258
- placedAt: Date;
259
- lineItems: {
260
- name: string;
261
- _id: string | import("mongoose").Types.ObjectId;
262
- price: number;
263
- quantity: number;
264
- attributes?: string[] | undefined;
265
- description?: string | undefined;
266
- instructions?: string | undefined;
267
- secondaryPrice?: number | undefined;
268
- }[];
269
- paymentSummary: {
270
- paymentMethod: PaymentMethod;
271
- totalAmount: number;
272
- subtotal: number;
273
- secondaryTotalAmount?: number | undefined;
274
- secondarySubtotal?: number | undefined;
275
- };
276
- preparationTimeMinutes: number;
51
+ paymentMethod: PaymentMethod;
52
+ triggerAt: Date;
277
53
  orderStatus: RegularOrderStatus;
278
54
  orderAction: OrderAction;
279
- canceledLineItems?: {
280
- name: string;
281
- _id: string | import("mongoose").Types.ObjectId;
282
- price: number;
283
- quantity: number;
284
- attributes?: string[] | undefined;
285
- description?: string | undefined;
286
- instructions?: string | undefined;
287
- secondaryPrice?: number | undefined;
288
- }[] | undefined;
55
+ preparationTimeMinutes: number;
289
56
  }>;
290
57
  export declare const OrderActionsInputSchema: z.ZodObject<{
291
58
  shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
@@ -311,280 +78,47 @@ export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof Orde
311
78
  user: z.ZodObject<{
312
79
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
313
80
  name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
314
- ordersCount: z.ZodNumber;
315
- }, "strip", z.ZodTypeAny, {
316
- name: string;
317
- _id: import("mongoose").Types.ObjectId;
318
- ordersCount: number;
319
- }, {
320
- name: string;
321
- _id: string | import("mongoose").Types.ObjectId;
322
- ordersCount: number;
323
- }>;
324
- lineItems: z.ZodArray<z.ZodObject<{
325
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
326
- name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
327
- description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
328
- attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
329
- instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
330
- quantity: z.ZodNumber;
331
- price: z.ZodEffects<z.ZodNumber, number, number>;
332
- secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
333
81
  }, "strip", z.ZodTypeAny, {
334
82
  name: string;
335
83
  _id: import("mongoose").Types.ObjectId;
336
- price: number;
337
- quantity: number;
338
- attributes?: string[] | undefined;
339
- description?: string | undefined;
340
- instructions?: string | undefined;
341
- secondaryPrice?: number | undefined;
342
84
  }, {
343
85
  name: string;
344
86
  _id: string | import("mongoose").Types.ObjectId;
345
- price: number;
346
- quantity: number;
347
- attributes?: string[] | undefined;
348
- description?: string | undefined;
349
- instructions?: string | undefined;
350
- secondaryPrice?: number | undefined;
351
- }>, "many">;
352
- canceledLineItems: z.ZodOptional<z.ZodArray<z.ZodObject<{
353
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
354
- name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
355
- description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
356
- attributes: z.ZodOptional<z.ZodArray<z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
357
- instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
358
- quantity: z.ZodNumber;
359
- price: z.ZodEffects<z.ZodNumber, number, number>;
360
- secondaryPrice: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
361
- }, "strip", z.ZodTypeAny, {
362
- name: string;
363
- _id: import("mongoose").Types.ObjectId;
364
- price: number;
365
- quantity: number;
366
- attributes?: string[] | undefined;
367
- description?: string | undefined;
368
- instructions?: string | undefined;
369
- secondaryPrice?: number | undefined;
370
- }, {
371
- name: string;
372
- _id: string | import("mongoose").Types.ObjectId;
373
- price: number;
374
- quantity: number;
375
- attributes?: string[] | undefined;
376
- description?: string | undefined;
377
- instructions?: string | undefined;
378
- secondaryPrice?: number | undefined;
379
- }>, "many">>;
380
- address: z.ZodObject<{
381
- address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
382
- description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
383
- city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
384
- state: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
385
- country: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
386
- location: z.ZodObject<{
387
- type: z.ZodDefault<z.ZodNativeEnum<typeof import("../../../utilities/enum").GeoLocationType>>;
388
- coordinates: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
389
- }, "strip", z.ZodTypeAny, {
390
- type: import("../../../utilities/enum").GeoLocationType;
391
- coordinates: [number, number];
392
- }, {
393
- coordinates: [number, number];
394
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
395
- }>;
396
- latitude: z.ZodNumber;
397
- longitude: z.ZodNumber;
398
- zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
399
- } & {
400
- addressLabel: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
401
- apartment: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
402
- buildingName: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
403
- deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
404
- instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
405
- } & {
406
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
407
- }, "strip", z.ZodTypeAny, {
408
- location: {
409
- type: import("../../../utilities/enum").GeoLocationType;
410
- coordinates: [number, number];
411
- };
412
- address: string;
413
- country: string;
414
- _id: import("mongoose").Types.ObjectId;
415
- city: string;
416
- latitude: number;
417
- longitude: number;
418
- addressLabel: string;
419
- apartment: string;
420
- buildingName: string;
421
- state?: string | undefined;
422
- description?: string | undefined;
423
- zone?: import("mongoose").Types.ObjectId | undefined;
424
- deliveryOption?: string | undefined;
425
- instructions?: string | undefined;
426
- }, {
427
- location: {
428
- coordinates: [number, number];
429
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
430
- };
431
- address: string;
432
- country: string;
433
- _id: string | import("mongoose").Types.ObjectId;
434
- city: string;
435
- latitude: number;
436
- longitude: number;
437
- addressLabel: string;
438
- apartment: string;
439
- buildingName: string;
440
- state?: string | undefined;
441
- description?: string | undefined;
442
- zone?: string | import("mongoose").Types.ObjectId | undefined;
443
- deliveryOption?: string | undefined;
444
- instructions?: string | undefined;
445
87
  }>;
446
- paymentSummary: z.ZodObject<{
447
- paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
448
- subtotal: z.ZodEffects<z.ZodNumber, number, number>;
449
- secondarySubtotal: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
450
- totalAmount: z.ZodEffects<z.ZodNumber, number, number>;
451
- secondaryTotalAmount: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
452
- }, "strip", z.ZodTypeAny, {
453
- paymentMethod: PaymentMethod;
454
- totalAmount: number;
455
- subtotal: number;
456
- secondaryTotalAmount?: number | undefined;
457
- secondarySubtotal?: number | undefined;
458
- }, {
459
- paymentMethod: PaymentMethod;
460
- totalAmount: number;
461
- subtotal: number;
462
- secondaryTotalAmount?: number | undefined;
463
- secondarySubtotal?: number | undefined;
464
- }>;
465
- preparationTimeMinutes: z.ZodNumber;
466
- placedAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
467
88
  orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
468
89
  orderAction: z.ZodNativeEnum<typeof OrderAction>;
90
+ paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
91
+ preparationTimeMinutes: z.ZodNumber;
92
+ createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
93
+ triggerAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
469
94
  }, "strip", z.ZodTypeAny, {
470
- address: {
471
- location: {
472
- type: import("../../../utilities/enum").GeoLocationType;
473
- coordinates: [number, number];
474
- };
475
- address: string;
476
- country: string;
477
- _id: import("mongoose").Types.ObjectId;
478
- city: string;
479
- latitude: number;
480
- longitude: number;
481
- addressLabel: string;
482
- apartment: string;
483
- buildingName: string;
484
- state?: string | undefined;
485
- description?: string | undefined;
486
- zone?: import("mongoose").Types.ObjectId | undefined;
487
- deliveryOption?: string | undefined;
488
- instructions?: string | undefined;
489
- };
490
95
  user: {
491
96
  name: string;
492
97
  _id: import("mongoose").Types.ObjectId;
493
- ordersCount: number;
494
98
  };
495
99
  _id: import("mongoose").Types.ObjectId;
100
+ createdAt: Date;
496
101
  orderId: string;
497
- placedAt: Date;
498
- lineItems: {
499
- name: string;
500
- _id: import("mongoose").Types.ObjectId;
501
- price: number;
502
- quantity: number;
503
- attributes?: string[] | undefined;
504
- description?: string | undefined;
505
- instructions?: string | undefined;
506
- secondaryPrice?: number | undefined;
507
- }[];
508
- paymentSummary: {
509
- paymentMethod: PaymentMethod;
510
- totalAmount: number;
511
- subtotal: number;
512
- secondaryTotalAmount?: number | undefined;
513
- secondarySubtotal?: number | undefined;
514
- };
515
- preparationTimeMinutes: number;
102
+ paymentMethod: PaymentMethod;
103
+ triggerAt: Date;
516
104
  orderStatus: RegularOrderStatus;
517
105
  orderAction: OrderAction;
518
- canceledLineItems?: {
519
- name: string;
520
- _id: import("mongoose").Types.ObjectId;
521
- price: number;
522
- quantity: number;
523
- attributes?: string[] | undefined;
524
- description?: string | undefined;
525
- instructions?: string | undefined;
526
- secondaryPrice?: number | undefined;
527
- }[] | undefined;
106
+ preparationTimeMinutes: number;
528
107
  }, {
529
- address: {
530
- location: {
531
- coordinates: [number, number];
532
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
533
- };
534
- address: string;
535
- country: string;
536
- _id: string | import("mongoose").Types.ObjectId;
537
- city: string;
538
- latitude: number;
539
- longitude: number;
540
- addressLabel: string;
541
- apartment: string;
542
- buildingName: string;
543
- state?: string | undefined;
544
- description?: string | undefined;
545
- zone?: string | import("mongoose").Types.ObjectId | undefined;
546
- deliveryOption?: string | undefined;
547
- instructions?: string | undefined;
548
- };
549
108
  user: {
550
109
  name: string;
551
110
  _id: string | import("mongoose").Types.ObjectId;
552
- ordersCount: number;
553
111
  };
554
112
  _id: string | import("mongoose").Types.ObjectId;
113
+ createdAt: Date;
555
114
  orderId: string;
556
- placedAt: Date;
557
- lineItems: {
558
- name: string;
559
- _id: string | import("mongoose").Types.ObjectId;
560
- price: number;
561
- quantity: number;
562
- attributes?: string[] | undefined;
563
- description?: string | undefined;
564
- instructions?: string | undefined;
565
- secondaryPrice?: number | undefined;
566
- }[];
567
- paymentSummary: {
568
- paymentMethod: PaymentMethod;
569
- totalAmount: number;
570
- subtotal: number;
571
- secondaryTotalAmount?: number | undefined;
572
- secondarySubtotal?: number | undefined;
573
- };
574
- preparationTimeMinutes: number;
115
+ paymentMethod: PaymentMethod;
116
+ triggerAt: Date;
575
117
  orderStatus: RegularOrderStatus;
576
118
  orderAction: OrderAction;
577
- canceledLineItems?: {
578
- name: string;
579
- _id: string | import("mongoose").Types.ObjectId;
580
- price: number;
581
- quantity: number;
582
- attributes?: string[] | undefined;
583
- description?: string | undefined;
584
- instructions?: string | undefined;
585
- secondaryPrice?: number | undefined;
586
- }[] | undefined;
119
+ preparationTimeMinutes: number;
587
120
  }>;
121
+ socketNotificationEvent: SocketNotificationEvent;
588
122
  };
589
123
  constructor(payload: OrderActionSocketOutputDTO);
590
124
  protected getIdentifier(): string;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrderActionsSocketEvent = exports.OrderActionsInputSchema = exports.OrderActionsOutputSchema = exports.OrderAction = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const validation_1 = require("../../../utilities/validation/");
6
- const shared_1 = require("../../../utilities/shared");
7
6
  const enum_1 = require("../../../utilities/enum");
8
7
  const BaseSocketEvent_1 = require("../BaseSocketEvent");
8
+ const socketNotificationEvent_1 = require("./socketNotificationEvent");
9
9
  var OrderAction;
10
10
  (function (OrderAction) {
11
11
  OrderAction["PLACED"] = "placed";
@@ -15,53 +15,19 @@ var OrderAction;
15
15
  const OrderUserSchema = zod_1.z.object({
16
16
  _id: validation_1.ZodValidation.objectId('User ID'),
17
17
  name: validation_1.ZodValidation.string('User Name'),
18
- ordersCount: validation_1.ZodValidation.number('ordersCount', {
19
- isNonnegative: true,
20
- }),
21
- });
22
- const ItemSchema = zod_1.z.object({
23
- _id: validation_1.ZodValidation.objectId('Order Item ID'),
24
- name: validation_1.ZodValidation.string('Name'),
25
- description: validation_1.ZodValidation.string('Description').optional(),
26
- attributes: validation_1.ZodValidation.array(validation_1.ZodValidation.string()).optional(),
27
- instructions: validation_1.ZodValidation.string('instructions').optional(),
28
- quantity: validation_1.ZodValidation.number('quantity', { isPositive: true }),
29
- price: validation_1.ZodValidation.number('price', { isNonnegative: true }).transform(v => (0, shared_1.roundBaseCurrency)(v)),
30
- secondaryPrice: validation_1.ZodValidation.number('Secondary Item Price', {
31
- isNonnegative: true,
32
- })
33
- .transform(v => (0, shared_1.roundSecondaryCurrency)(v))
34
- .optional(),
35
- });
36
- const OrderPaymentSummarySchema = zod_1.z.object({
37
- paymentMethod: validation_1.ZodValidation.enumType(enum_1.PaymentMethod, 'paymentMethod'),
38
- subtotal: validation_1.ZodValidation.number('Subtotal', { isNonnegative: true }).transform(v => (0, shared_1.roundBaseCurrency)(v)),
39
- secondarySubtotal: validation_1.ZodValidation.number('Secondary Subtotal', {
40
- isNonnegative: true,
41
- })
42
- .transform(v => (0, shared_1.roundSecondaryCurrency)(v))
43
- .optional(),
44
- totalAmount: validation_1.ZodValidation.number('Total Amount', { isNonnegative: true }).transform(v => (0, shared_1.roundBaseCurrency)(v)),
45
- secondaryTotalAmount: validation_1.ZodValidation.number('Secondary Total Amount', {
46
- isNonnegative: true,
47
- })
48
- .transform(v => (0, shared_1.roundSecondaryCurrency)(v))
49
- .optional(),
50
18
  });
51
19
  exports.OrderActionsOutputSchema = zod_1.z.object({
52
20
  _id: validation_1.ZodValidation.objectId('Order ID'),
53
21
  orderId: validation_1.ZodValidation.string('Readable Order ID'),
54
22
  user: OrderUserSchema,
55
- lineItems: validation_1.ZodValidation.array(ItemSchema, 'items'),
56
- canceledLineItems: validation_1.ZodValidation.array(ItemSchema, 'canceledItems').optional(),
57
- address: validation_1.RegularOrderAddressSchema,
58
- paymentSummary: OrderPaymentSummarySchema,
23
+ orderStatus: validation_1.ZodValidation.enumType(enum_1.RegularOrderStatus, 'status'),
24
+ orderAction: validation_1.ZodValidation.enumType(OrderAction, 'orderAction'),
25
+ paymentMethod: validation_1.ZodValidation.enumType(enum_1.PaymentMethod, 'paymentMethod'),
59
26
  preparationTimeMinutes: validation_1.ZodValidation.number('Preparation Time (minutes)', {
60
27
  isNonnegative: true,
61
28
  }),
62
- placedAt: validation_1.ZodValidation.coerce.date('placedAt'),
63
- orderStatus: validation_1.ZodValidation.enumType(enum_1.RegularOrderStatus, 'status'),
64
- orderAction: validation_1.ZodValidation.enumType(OrderAction, 'orderAction'),
29
+ createdAt: validation_1.ZodValidation.coerce.date('Order Creation Date'),
30
+ triggerAt: validation_1.ZodValidation.coerce.date('Order Trigger Date'),
65
31
  });
66
32
  exports.OrderActionsInputSchema = zod_1.z.object({
67
33
  shopId: validation_1.ZodValidation.objectId('shopId'),
@@ -70,6 +36,7 @@ class OrderActionsSocketEvent extends BaseSocketEvent_1.BaseSocketEvent {
70
36
  static schemas = {
71
37
  input: exports.OrderActionsInputSchema,
72
38
  output: exports.OrderActionsOutputSchema,
39
+ socketNotificationEvent: new socketNotificationEvent_1.SocketNotificationEvent({ message: 'New Order!' }),
73
40
  };
74
41
  constructor(payload) {
75
42
  super(enum_1.SocketEventType.ORDER_ACTIONS, OrderActionsSocketEvent.schemas, payload);
@@ -1 +1 @@
1
- {"version":3,"file":"order-actions.socket.event.js","sourceRoot":"/","sources":["libraries/socket/events/order-actions.socket.event.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,+DAMwC;AACxC,sDAAsF;AACtF,kDAA6F;AAC7F,wDAAqD;AAErD,IAAY,WAIX;AAJD,WAAY,WAAW;IACtB,gCAAiB,CAAA;IACjB,wCAAyB,CAAA;IACzB,0CAA2B,CAAA;AAC5B,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,GAAG,EAAE,0BAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;IACtC,IAAI,EAAE,0BAAa,CAAC,MAAM,CAAC,WAAW,CAAC;IACvC,WAAW,EAAE,0BAAa,CAAC,MAAM,CAAC,aAAa,EAAE;QAChD,aAAa,EAAE,IAAI;KACnB,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,0BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC5C,IAAI,EAAE,0BAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,WAAW,EAAE,0BAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IAC3D,UAAU,EAAE,0BAAa,CAAC,KAAK,CAAC,0BAAa,CAAC,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AmC;QAC9C,KAAK,CAAC,sBAAe,CAAC,aAAa,EAAE,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;IAES,aAAa;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;;AAfF,0DAgBC","sourcesContent":["import { z } from 'zod';\nimport {\n\tAddressSchema,\n\tDTO,\n\tRegularOrderAddressSchema,\n\tUserAddressSchema,\n\tZodValidation,\n} from '../../../utilities/validation/';\nimport { roundBaseCurrency, roundSecondaryCurrency } from '../../../utilities/shared';\nimport { PaymentMethod, RegularOrderStatus, SocketEventType } from '../../../utilities/enum';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\n\nexport enum OrderAction {\n\tPLACED = 'placed',\n\tADJUSTMENT = 'adjustment',\n\tREPLACEMENT = 'replacement',\n}\n\nconst OrderUserSchema = z.object({\n\t_id: ZodValidation.objectId('User ID'),\n\tname: ZodValidation.string('User Name'),\n\tordersCount: ZodValidation.number('ordersCount', {\n\t\tisNonnegative: true,\n\t}),\n});\n\nconst ItemSchema = z.object({\n\t_id: ZodValidation.objectId('Order Item ID'),\n\tname: ZodValidation.string('Name'),\n\tdescription: ZodValidation.string('Description').optional(),\n\tattributes: ZodValidation.array(ZodValidation.string()).optional(),\n\tinstructions: ZodValidation.string('instructions').optional(),\n\tquantity: ZodValidation.number('quantity', { isPositive: true }),\n\tprice: ZodValidation.number('price', { isNonnegative: true }).transform(v => roundBaseCurrency(v)),\n\tsecondaryPrice: ZodValidation.number('Secondary Item Price', {\n\t\tisNonnegative: true,\n\t})\n\t\t.transform(v => roundSecondaryCurrency(v))\n\t\t.optional(),\n});\n\nconst OrderPaymentSummarySchema = z.object({\n\tpaymentMethod: ZodValidation.enumType(PaymentMethod, 'paymentMethod'),\n\tsubtotal: ZodValidation.number('Subtotal', { isNonnegative: true }).transform(v => roundBaseCurrency(v)),\n\tsecondarySubtotal: ZodValidation.number('Secondary Subtotal', {\n\t\tisNonnegative: true,\n\t})\n\t\t.transform(v => roundSecondaryCurrency(v))\n\t\t.optional(),\n\n\ttotalAmount: ZodValidation.number('Total Amount', { isNonnegative: true }).transform(v =>\n\t\troundBaseCurrency(v)\n\t),\n\tsecondaryTotalAmount: ZodValidation.number('Secondary Total Amount', {\n\t\tisNonnegative: true,\n\t})\n\t\t.transform(v => roundSecondaryCurrency(v))\n\t\t.optional(),\n});\n\nexport const OrderActionsOutputSchema = z.object({\n\t_id: ZodValidation.objectId('Order ID'),\n\torderId: ZodValidation.string('Readable Order ID'),\n\tuser: OrderUserSchema,\n\tlineItems: ZodValidation.array(ItemSchema, 'items'),\n\tcanceledLineItems: ZodValidation.array(ItemSchema, 'canceledItems').optional(),\n\taddress: RegularOrderAddressSchema,\n\tpaymentSummary: OrderPaymentSummarySchema,\n\tpreparationTimeMinutes: ZodValidation.number('Preparation Time (minutes)', {\n\t\tisNonnegative: true,\n\t}),\n\tplacedAt: ZodValidation.coerce.date('placedAt'),\n\torderStatus: ZodValidation.enumType(RegularOrderStatus, 'status'),\n\torderAction: ZodValidation.enumType(OrderAction, 'orderAction'),\n});\n\nexport const OrderActionsInputSchema = z.object({\n\tshopId: ZodValidation.objectId('shopId'),\n});\n\nexport type OrderActionSocketInputDTO = DTO<typeof OrderActionsInputSchema>;\nexport type OrderActionSocketOutputDTO = DTO<typeof OrderActionsOutputSchema>;\n\nexport class OrderActionsSocketEvent extends BaseSocketEvent<\n\ttypeof OrderActionsInputSchema,\n\ttypeof OrderActionsOutputSchema\n> {\n\tstatic readonly schemas = {\n\t\tinput: OrderActionsInputSchema,\n\t\toutput: OrderActionsOutputSchema,\n\t};\n\n\tconstructor(payload: OrderActionSocketOutputDTO) {\n\t\tsuper(SocketEventType.ORDER_ACTIONS, OrderActionsSocketEvent.schemas, payload);\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn 'default';\n\t}\n}\n"]}
1
+ {"version":3,"file":"order-actions.socket.event.js","sourceRoot":"/","sources":["libraries/socket/events/order-actions.socket.event.ts"],"names":[],"mapp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AAU,OAAO,GAAG;QACzB,KAAK,EAAE,+BAAuB;QAC9B,MAAM,EAAE,gCAAwB;QAChC,uBAAuB,EAAE,IAAI,iDAAuB,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;KAC/E,CAAC;IAEF,YAAY,OAAmC;QAC9C,KAAK,CAAC,sBAAe,CAAC,aAAa,EAAE,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;IAES,aAAa;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;;AAhBF,0DAiBC","sourcesContent":["import { z } from 'zod';\nimport { DTO, ZodValidation } from '../../../utilities/validation/';\nimport { PaymentMethod, RegularOrderStatus, SocketEventType } from '../../../utilities/enum';\nimport { BaseSocketEvent } from '../BaseSocketEvent';\nimport { SocketNotificationEvent } from './socketNotificationEvent';\n\nexport enum OrderAction {\n\tPLACED = 'placed',\n\tADJUSTMENT = 'adjustment',\n\tREPLACEMENT = 'replacement',\n}\n\nconst OrderUserSchema = z.object({\n\t_id: ZodValidation.objectId('User ID'),\n\tname: ZodValidation.string('User Name'),\n});\n\nexport const OrderActionsOutputSchema = z.object({\n\t_id: ZodValidation.objectId('Order ID'),\n\torderId: ZodValidation.string('Readable Order ID'),\n\tuser: OrderUserSchema,\n\torderStatus: ZodValidation.enumType(RegularOrderStatus, 'status'),\n\torderAction: ZodValidation.enumType(OrderAction, 'orderAction'),\n\tpaymentMethod: ZodValidation.enumType(PaymentMethod, 'paymentMethod'),\n\tpreparationTimeMinutes: ZodValidation.number('Preparation Time (minutes)', {\n\t\tisNonnegative: true,\n\t}),\n\tcreatedAt: ZodValidation.coerce.date('Order Creation Date'),\n\ttriggerAt: ZodValidation.coerce.date('Order Trigger Date'),\n});\n\nexport const OrderActionsInputSchema = z.object({\n\tshopId: ZodValidation.objectId('shopId'),\n});\n\nexport type OrderActionSocketInputDTO = DTO<typeof OrderActionsInputSchema>;\nexport type OrderActionSocketOutputDTO = DTO<typeof OrderActionsOutputSchema>;\n\nexport class OrderActionsSocketEvent extends BaseSocketEvent<\n\ttypeof OrderActionsInputSchema,\n\ttypeof OrderActionsOutputSchema\n> {\n\tstatic readonly schemas = {\n\t\tinput: OrderActionsInputSchema,\n\t\toutput: OrderActionsOutputSchema,\n\t\tsocketNotificationEvent: new SocketNotificationEvent({ message: 'New Order!' }),\n\t};\n\n\tconstructor(payload: OrderActionSocketOutputDTO) {\n\t\tsuper(SocketEventType.ORDER_ACTIONS, OrderActionsSocketEvent.schemas, payload);\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn 'default';\n\t}\n}\n"]}
@@ -10,7 +10,7 @@ export declare const NotificationSocketOutputSchema: z.ZodObject<{
10
10
  message: string;
11
11
  }>;
12
12
  export type NotificationSocketOutputDTO = DTO<typeof NotificationSocketOutputSchema>;
13
- export declare class NotificationSocketEvent extends BaseSocketEvent<typeof NotificationSocketInputSchema, typeof NotificationSocketOutputSchema> {
13
+ export declare class SocketNotificationEvent extends BaseSocketEvent<typeof NotificationSocketInputSchema, typeof NotificationSocketOutputSchema> {
14
14
  static readonly schemas: {
15
15
  input: z.ZodUndefined;
16
16
  output: z.ZodObject<{
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NotificationSocketEvent = exports.NotificationSocketOutputSchema = exports.NotificationSocketInputSchema = void 0;
6
+ exports.SocketNotificationEvent = exports.NotificationSocketOutputSchema = exports.NotificationSocketInputSchema = void 0;
7
7
  const BaseSocketEvent_1 = require("../BaseSocketEvent");
8
8
  const zod_1 = __importDefault(require("zod"));
9
9
  const validation_1 = require("../../../utilities/validation");
@@ -12,14 +12,14 @@ exports.NotificationSocketInputSchema = zod_1.default.undefined();
12
12
  exports.NotificationSocketOutputSchema = zod_1.default.object({
13
13
  message: validation_1.ZodValidation.string(),
14
14
  });
15
- class NotificationSocketEvent extends BaseSocketEvent_1.BaseSocketEvent {
15
+ class SocketNotificationEvent extends BaseSocketEvent_1.BaseSocketEvent {
16
16
  static schemas = { input: exports.NotificationSocketInputSchema, output: exports.NotificationSocketOutputSchema };
17
17
  constructor(payload) {
18
- super(enum_1.SocketEventType.NOTIFICATION, NotificationSocketEvent.schemas, payload);
18
+ super(enum_1.SocketEventType.NOTIFICATION, SocketNotificationEvent.schemas, payload);
19
19
  }
20
20
  getIdentifier() {
21
21
  return 'default';
22
22
  }
23
23
  }
24
- exports.NotificationSocketEvent = NotificationSocketEvent;
25
- //# sourceMappingURL=notification.socket.event.js.map
24
+ exports.SocketNotificationEvent = SocketNotificationEvent;
25
+ //# sourceMappingURL=socketNotificationEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socketNotificationEvent.js","sourceRoot":"/","sources":["libraries/socket/events/socketNotificationEvent.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAqD;AACrD,8CAAoB;AACpB,8DAAmE;AACnE,kDAAqF;AAExE,QAAA,6BAA6B,GAAG,aAAC,CAAC,SAAS,EAAE,CAAC;AAC9C,QAAA,8BAA8B,GAAG,aAAC,CAAC,MAAM,CAAC;IACtD,OAAO,EAAE,0BAAa,CAAC,MAAM,EAAE;CAC/B,CAAC,CAAC;AAIH,MAAa,uBAAwB,SAAQ,iCAG5C;IACA,MAAM,CAAU,OAAO,GAAG,EAAE,KAAK,EAAE,qCAA6B,EAAE,MAAM,EAAE,sCAA8B,EAAE,CAAC;IAE3G,YAAY,OAAmD;QAC9D,KAAK,CAAC,sBAAe,CAAC,YAAY,EAAE,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAES,aAAa;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;;AAZF,0DAaC","sourcesContent":["import { BaseSocketEvent } from '../BaseSocketEvent';\nimport z from 'zod';\nimport { DTO, ZodValidation } from '../../../utilities/validation';\nimport { PushNotificationEventType, SocketEventType } from '../../../utilities/enum';\n\nexport const NotificationSocketInputSchema = z.undefined();\nexport const NotificationSocketOutputSchema = z.object({\n\tmessage: ZodValidation.string(),\n});\n\nexport type NotificationSocketOutputDTO = DTO<typeof NotificationSocketOutputSchema>;\n\nexport class SocketNotificationEvent extends BaseSocketEvent<\n\ttypeof NotificationSocketInputSchema,\n\ttypeof NotificationSocketOutputSchema\n> {\n\tstatic readonly schemas = { input: NotificationSocketInputSchema, output: NotificationSocketOutputSchema };\n\n\tconstructor(payload: DTO<typeof NotificationSocketOutputSchema>) {\n\t\tsuper(SocketEventType.NOTIFICATION, SocketNotificationEvent.schemas, payload);\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn 'default';\n\t}\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.32
25
+ Version: 1.3.34
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.32",
3
+ "version": "1.3.34",
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.32",
3
+ "version": "1.3.34",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- {"version":3,"file":"notification.socket.event.js","sourceRoot":"/","sources":["libraries/socket/events/notification.socket.event.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAqD;AACrD,8CAAoB;AACpB,8DAAmE;AACnE,kDAAqF;AAExE,QAAA,6BAA6B,GAAG,aAAC,CAAC,SAAS,EAAE,CAAC;AAC9C,QAAA,8BAA8B,GAAG,aAAC,CAAC,MAAM,CAAC;IACtD,OAAO,EAAE,0BAAa,CAAC,MAAM,EAAE;CAC/B,CAAC,CAAC;AAIH,MAAa,uBAAwB,SAAQ,iCAG5C;IACA,MAAM,CAAU,OAAO,GAAG,EAAE,KAAK,EAAE,qCAA6B,EAAE,MAAM,EAAE,sCAA8B,EAAE,CAAC;IAE3G,YAAY,OAAmD;QAC9D,KAAK,CAAC,sBAAe,CAAC,YAAY,EAAE,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAES,aAAa;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;;AAZF,0DAaC","sourcesContent":["import { BaseSocketEvent } from '../BaseSocketEvent';\nimport z from 'zod';\nimport { DTO, ZodValidation } from '../../../utilities/validation';\nimport { PushNotificationEventType, SocketEventType } from '../../../utilities/enum';\n\nexport const NotificationSocketInputSchema = z.undefined();\nexport const NotificationSocketOutputSchema = z.object({\n\tmessage: ZodValidation.string(),\n});\n\nexport type NotificationSocketOutputDTO = DTO<typeof NotificationSocketOutputSchema>;\n\nexport class NotificationSocketEvent extends BaseSocketEvent<\n\ttypeof NotificationSocketInputSchema,\n\ttypeof NotificationSocketOutputSchema\n> {\n\tstatic readonly schemas = { input: NotificationSocketInputSchema, output: NotificationSocketOutputSchema };\n\n\tconstructor(payload: DTO<typeof NotificationSocketOutputSchema>) {\n\t\tsuper(SocketEventType.NOTIFICATION, NotificationSocketEvent.schemas, payload);\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn 'default';\n\t}\n}\n"]}