@lyxa.ai/core 1.3.33 → 1.3.35

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.
@@ -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,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,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AAe,EAAE,CAAC;IAC/C,MAAM,cAAc,GAAkE,EAAE,CAAC;IAGzF,MAAM,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,SAAS,EAAC,EAAE;QAChC,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,IAAA,mDAAwB,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QAEzF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,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 { 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,GA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C,MAAM,KAAK,GAAG,IAAA,gBAAY,GAAE,CAAC,eAAe,EAAE,CAAC;IAC/C,MAAM,cAAc,GAAkE,EAAE,CAAC;IAGzF,MAAM,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,SAAS,EAAC,EAAE;QAChC,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,IAAA,mDAAwB,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QAEzF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,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,131 @@ 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>;
24
+ orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
25
+ orderAction: z.ZodNativeEnum<typeof OrderAction>;
26
+ paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
27
+ preparationTimeMinutes: z.ZodNumber;
28
+ adjustedFinance: z.ZodObject<{
29
+ paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
30
+ shopProfit: z.ZodNumber;
31
+ pricing: z.ZodObject<{
32
+ total: z.ZodNumber;
33
+ secondaryTotal: z.ZodNumber;
34
+ paidAmount: z.ZodNumber;
35
+ secondaryPaidAmount: z.ZodNumber;
36
+ deliveryFee: z.ZodNumber;
37
+ secondaryDeliveryFee: z.ZodNumber;
38
+ riderTips: z.ZodNumber;
39
+ secondaryRiderTips: z.ZodNumber;
91
40
  }, "strip", z.ZodTypeAny, {
92
- type: import("../../../utilities/enum").GeoLocationType;
93
- coordinates: [number, number];
41
+ total: number;
42
+ deliveryFee: number;
43
+ riderTips: number;
44
+ secondaryDeliveryFee: number;
45
+ secondaryRiderTips: number;
46
+ secondaryTotal: number;
47
+ paidAmount: number;
48
+ secondaryPaidAmount: number;
94
49
  }, {
95
- coordinates: [number, number];
96
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
50
+ total: number;
51
+ deliveryFee: number;
52
+ riderTips: number;
53
+ secondaryDeliveryFee: number;
54
+ secondaryRiderTips: number;
55
+ secondaryTotal: number;
56
+ paidAmount: number;
57
+ secondaryPaidAmount: number;
97
58
  }>;
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
59
  }, "strip", z.ZodTypeAny, {
155
60
  paymentMethod: PaymentMethod;
156
- totalAmount: number;
157
- subtotal: number;
158
- secondaryTotalAmount?: number | undefined;
159
- secondarySubtotal?: number | undefined;
61
+ pricing: {
62
+ total: number;
63
+ deliveryFee: number;
64
+ riderTips: number;
65
+ secondaryDeliveryFee: number;
66
+ secondaryRiderTips: number;
67
+ secondaryTotal: number;
68
+ paidAmount: number;
69
+ secondaryPaidAmount: number;
70
+ };
71
+ shopProfit: number;
160
72
  }, {
161
73
  paymentMethod: PaymentMethod;
162
- totalAmount: number;
163
- subtotal: number;
164
- secondaryTotalAmount?: number | undefined;
165
- secondarySubtotal?: number | undefined;
74
+ pricing: {
75
+ total: number;
76
+ deliveryFee: number;
77
+ riderTips: number;
78
+ secondaryDeliveryFee: number;
79
+ secondaryRiderTips: number;
80
+ secondaryTotal: number;
81
+ paidAmount: number;
82
+ secondaryPaidAmount: number;
83
+ };
84
+ shopProfit: number;
166
85
  }>;
167
- preparationTimeMinutes: z.ZodNumber;
168
- placedAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
169
- orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
170
- orderAction: z.ZodNativeEnum<typeof OrderAction>;
86
+ createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
87
+ triggerAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
171
88
  }, "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
89
  user: {
193
90
  name: string;
194
91
  _id: import("mongoose").Types.ObjectId;
195
- ordersCount: number;
196
92
  };
197
93
  _id: import("mongoose").Types.ObjectId;
94
+ createdAt: Date;
198
95
  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: {
96
+ paymentMethod: PaymentMethod;
97
+ triggerAt: Date;
98
+ adjustedFinance: {
211
99
  paymentMethod: PaymentMethod;
212
- totalAmount: number;
213
- subtotal: number;
214
- secondaryTotalAmount?: number | undefined;
215
- secondarySubtotal?: number | undefined;
100
+ pricing: {
101
+ total: number;
102
+ deliveryFee: number;
103
+ riderTips: number;
104
+ secondaryDeliveryFee: number;
105
+ secondaryRiderTips: number;
106
+ secondaryTotal: number;
107
+ paidAmount: number;
108
+ secondaryPaidAmount: number;
109
+ };
110
+ shopProfit: number;
216
111
  };
217
- preparationTimeMinutes: number;
218
112
  orderStatus: RegularOrderStatus;
219
113
  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;
114
+ preparationTimeMinutes: number;
230
115
  }, {
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
116
  user: {
252
117
  name: string;
253
118
  _id: string | import("mongoose").Types.ObjectId;
254
- ordersCount: number;
255
119
  };
256
120
  _id: string | import("mongoose").Types.ObjectId;
121
+ createdAt: Date;
257
122
  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: {
123
+ paymentMethod: PaymentMethod;
124
+ triggerAt: Date;
125
+ adjustedFinance: {
270
126
  paymentMethod: PaymentMethod;
271
- totalAmount: number;
272
- subtotal: number;
273
- secondaryTotalAmount?: number | undefined;
274
- secondarySubtotal?: number | undefined;
127
+ pricing: {
128
+ total: number;
129
+ deliveryFee: number;
130
+ riderTips: number;
131
+ secondaryDeliveryFee: number;
132
+ secondaryRiderTips: number;
133
+ secondaryTotal: number;
134
+ paidAmount: number;
135
+ secondaryPaidAmount: number;
136
+ };
137
+ shopProfit: number;
275
138
  };
276
- preparationTimeMinutes: number;
277
139
  orderStatus: RegularOrderStatus;
278
140
  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;
141
+ preparationTimeMinutes: number;
289
142
  }>;
290
143
  export declare const OrderActionsInputSchema: z.ZodObject<{
291
144
  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 +164,133 @@ export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof Orde
311
164
  user: z.ZodObject<{
312
165
  _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
166
  name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
314
- ordersCount: z.ZodNumber;
315
167
  }, "strip", z.ZodTypeAny, {
316
168
  name: string;
317
169
  _id: import("mongoose").Types.ObjectId;
318
- ordersCount: number;
319
170
  }, {
320
171
  name: string;
321
172
  _id: string | import("mongoose").Types.ObjectId;
322
- ordersCount: number;
323
173
  }>;
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
- }, "strip", z.ZodTypeAny, {
334
- name: string;
335
- _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
- }, {
343
- name: string;
344
- _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>;
174
+ orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
175
+ orderAction: z.ZodNativeEnum<typeof OrderAction>;
176
+ paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
177
+ preparationTimeMinutes: z.ZodNumber;
178
+ adjustedFinance: z.ZodObject<{
179
+ paymentMethod: z.ZodNativeEnum<typeof PaymentMethod>;
180
+ shopProfit: z.ZodNumber;
181
+ pricing: z.ZodObject<{
182
+ total: z.ZodNumber;
183
+ secondaryTotal: z.ZodNumber;
184
+ paidAmount: z.ZodNumber;
185
+ secondaryPaidAmount: z.ZodNumber;
186
+ deliveryFee: z.ZodNumber;
187
+ secondaryDeliveryFee: z.ZodNumber;
188
+ riderTips: z.ZodNumber;
189
+ secondaryRiderTips: z.ZodNumber;
389
190
  }, "strip", z.ZodTypeAny, {
390
- type: import("../../../utilities/enum").GeoLocationType;
391
- coordinates: [number, number];
191
+ total: number;
192
+ deliveryFee: number;
193
+ riderTips: number;
194
+ secondaryDeliveryFee: number;
195
+ secondaryRiderTips: number;
196
+ secondaryTotal: number;
197
+ paidAmount: number;
198
+ secondaryPaidAmount: number;
392
199
  }, {
393
- coordinates: [number, number];
394
- type?: import("../../../utilities/enum").GeoLocationType | undefined;
200
+ total: number;
201
+ deliveryFee: number;
202
+ riderTips: number;
203
+ secondaryDeliveryFee: number;
204
+ secondaryRiderTips: number;
205
+ secondaryTotal: number;
206
+ paidAmount: number;
207
+ secondaryPaidAmount: number;
395
208
  }>;
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
- }>;
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
209
  }, "strip", z.ZodTypeAny, {
453
210
  paymentMethod: PaymentMethod;
454
- totalAmount: number;
455
- subtotal: number;
456
- secondaryTotalAmount?: number | undefined;
457
- secondarySubtotal?: number | undefined;
211
+ pricing: {
212
+ total: number;
213
+ deliveryFee: number;
214
+ riderTips: number;
215
+ secondaryDeliveryFee: number;
216
+ secondaryRiderTips: number;
217
+ secondaryTotal: number;
218
+ paidAmount: number;
219
+ secondaryPaidAmount: number;
220
+ };
221
+ shopProfit: number;
458
222
  }, {
459
223
  paymentMethod: PaymentMethod;
460
- totalAmount: number;
461
- subtotal: number;
462
- secondaryTotalAmount?: number | undefined;
463
- secondarySubtotal?: number | undefined;
224
+ pricing: {
225
+ total: number;
226
+ deliveryFee: number;
227
+ riderTips: number;
228
+ secondaryDeliveryFee: number;
229
+ secondaryRiderTips: number;
230
+ secondaryTotal: number;
231
+ paidAmount: number;
232
+ secondaryPaidAmount: number;
233
+ };
234
+ shopProfit: number;
464
235
  }>;
465
- preparationTimeMinutes: z.ZodNumber;
466
- placedAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
467
- orderStatus: z.ZodNativeEnum<typeof RegularOrderStatus>;
468
- orderAction: z.ZodNativeEnum<typeof OrderAction>;
236
+ createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
237
+ triggerAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
469
238
  }, "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
239
  user: {
491
240
  name: string;
492
241
  _id: import("mongoose").Types.ObjectId;
493
- ordersCount: number;
494
242
  };
495
243
  _id: import("mongoose").Types.ObjectId;
244
+ createdAt: Date;
496
245
  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: {
246
+ paymentMethod: PaymentMethod;
247
+ triggerAt: Date;
248
+ adjustedFinance: {
509
249
  paymentMethod: PaymentMethod;
510
- totalAmount: number;
511
- subtotal: number;
512
- secondaryTotalAmount?: number | undefined;
513
- secondarySubtotal?: number | undefined;
250
+ pricing: {
251
+ total: number;
252
+ deliveryFee: number;
253
+ riderTips: number;
254
+ secondaryDeliveryFee: number;
255
+ secondaryRiderTips: number;
256
+ secondaryTotal: number;
257
+ paidAmount: number;
258
+ secondaryPaidAmount: number;
259
+ };
260
+ shopProfit: number;
514
261
  };
515
- preparationTimeMinutes: number;
516
262
  orderStatus: RegularOrderStatus;
517
263
  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;
264
+ preparationTimeMinutes: number;
528
265
  }, {
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
266
  user: {
550
267
  name: string;
551
268
  _id: string | import("mongoose").Types.ObjectId;
552
- ordersCount: number;
553
269
  };
554
270
  _id: string | import("mongoose").Types.ObjectId;
271
+ createdAt: Date;
555
272
  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: {
273
+ paymentMethod: PaymentMethod;
274
+ triggerAt: Date;
275
+ adjustedFinance: {
568
276
  paymentMethod: PaymentMethod;
569
- totalAmount: number;
570
- subtotal: number;
571
- secondaryTotalAmount?: number | undefined;
572
- secondarySubtotal?: number | undefined;
277
+ pricing: {
278
+ total: number;
279
+ deliveryFee: number;
280
+ riderTips: number;
281
+ secondaryDeliveryFee: number;
282
+ secondaryRiderTips: number;
283
+ secondaryTotal: number;
284
+ paidAmount: number;
285
+ secondaryPaidAmount: number;
286
+ };
287
+ shopProfit: number;
573
288
  };
574
- preparationTimeMinutes: number;
575
289
  orderStatus: RegularOrderStatus;
576
290
  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;
291
+ preparationTimeMinutes: number;
587
292
  }>;
293
+ socketNotificationEvent: SocketNotificationEvent;
588
294
  };
589
295
  constructor(payload: OrderActionSocketOutputDTO);
590
296
  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,33 @@ 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
+ adjustedFinance: zod_1.z.object({
30
+ paymentMethod: validation_1.ZodValidation.enumType(enum_1.PaymentMethod, 'paymentMethod'),
31
+ shopProfit: validation_1.ZodValidation.number('shopProfit'),
32
+ pricing: zod_1.z.object({
33
+ total: validation_1.ZodValidation.number('total'),
34
+ secondaryTotal: validation_1.ZodValidation.number('secondaryTotal'),
35
+ paidAmount: validation_1.ZodValidation.number('paidAmount'),
36
+ secondaryPaidAmount: validation_1.ZodValidation.number('secondaryPaidAmount'),
37
+ deliveryFee: validation_1.ZodValidation.number('deliveryFee'),
38
+ secondaryDeliveryFee: validation_1.ZodValidation.number('secondaryDeliveryFee'),
39
+ riderTips: validation_1.ZodValidation.number('riderTip'),
40
+ secondaryRiderTips: validation_1.ZodValidation.number('secondaryRiderTips'),
41
+ }),
42
+ }),
43
+ createdAt: validation_1.ZodValidation.coerce.date('Order Creation Date'),
44
+ triggerAt: validation_1.ZodValidation.coerce.date('Order Trigger Date'),
65
45
  });
66
46
  exports.OrderActionsInputSchema = zod_1.z.object({
67
47
  shopId: validation_1.ZodValidation.objectId('shopId'),
@@ -70,6 +50,7 @@ class OrderActionsSocketEvent extends BaseSocketEvent_1.BaseSocketEvent {
70
50
  static schemas = {
71
51
  input: exports.OrderActionsInputSchema,
72
52
  output: exports.OrderActionsOutputSchema,
53
+ socketNotificationEvent: new socketNotificationEvent_1.SocketNotificationEvent({ message: 'New Order!' }),
73
54
  };
74
55
  constructor(payload) {
75
56
  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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ACA,MAAM,CAAU,OAAO,GAAG;QACzB,KAAK,EAAE,+BAAuB;QAC9B,MAAM,EAAE,gCAAwB;KAChC,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;;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":[],"mappings":";;;AAAA,6BAAwB;AACxB,+DAAoE;AACpE,kDAA6F;AAC7F,wDAAqD;AACrD,uEAAoE;AAEpE,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;CACvC,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,GAAG,EAAE,0BAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;IACvC,OAAO,EAAE,0BAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAClD,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,0BAAa,CAAC,QAAQ,CAAC,yBAAkB,EAAE,QAAQ,CAAC;IACjE,WAAW,EAAE,0BAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IAC/D,aAAa,EAAE,0BAAa,CAAC,QAAQ,CAAC,oBAAa,EAAE,eAAe,CAAC;IACrE,sBAAsB,EAAE,0BAAa,CAAC,MAAM,CAAC,4BAA4B,EAAE;QAC1E,aAAa,EAAE,IAAI;KACnB,CAAC;IACF,eAAe,EAAE,OAAC,CAAC,MAAM,CAAC;QACzB,aAAa,EAAE,0BAAa,CAAC,QAAQ,CAAC,oBAAa,EAAE,eAAe,CAAC;QACrE,UAAU,EAAE,0BAAa,CAAC,MAAM,CAAC,YAAY,CAAC;QAC9C,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;YACjB,KAAK,EAAE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, 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\tadjustedFinance: z.object({\n\t\tpaymentMethod: ZodValidation.enumType(PaymentMethod, 'paymentMethod'),\n\t\tshopProfit: ZodValidation.number('shopProfit'),\n\t\tpricing: z.object({\n\t\t\ttotal: ZodValidation.number('total'),\n\t\t\tsecondaryTotal: ZodValidation.number('secondaryTotal'),\n\t\t\tpaidAmount: ZodValidation.number('paidAmount'),\n\t\t\tsecondaryPaidAmount: ZodValidation.number('secondaryPaidAmount'),\n\t\t\tdeliveryFee: ZodValidation.number('deliveryFee'),\n\t\t\tsecondaryDeliveryFee: ZodValidation.number('secondaryDeliveryFee'),\n\t\t\triderTips: ZodValidation.number('riderTip'),\n\t\t\tsecondaryRiderTips: ZodValidation.number('secondaryRiderTips'),\n\t\t}),\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.33
25
+ Version: 1.3.35
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.33",
3
+ "version": "1.3.35",
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.33",
3
+ "version": "1.3.35",
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"]}