@lyxa.ai/core 1.3.162 → 1.3.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libraries/mongo/models/embedded/trip-leg.mode.d.ts +1 -0
- package/dist/libraries/mongo/models/embedded/trip-leg.mode.js +5 -0
- package/dist/libraries/mongo/models/embedded/trip-leg.mode.js.map +1 -1
- package/dist/libraries/socket/events/order-actions.socket.event.d.ts +6 -0
- package/dist/libraries/socket/events/order-actions.socket.event.js +2 -0
- package/dist/libraries/socket/events/order-actions.socket.event.js.map +1 -1
- package/dist/libraries/socket/events/socketNotificationEvent.d.ts +7 -0
- package/dist/libraries/socket/events/socketNotificationEvent.js +2 -0
- package/dist/libraries/socket/events/socketNotificationEvent.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ class TripLeg {
|
|
|
25
25
|
type;
|
|
26
26
|
rider;
|
|
27
27
|
orders;
|
|
28
|
+
processedOrders;
|
|
28
29
|
orderId;
|
|
29
30
|
user;
|
|
30
31
|
shop;
|
|
@@ -74,6 +75,10 @@ __decorate([
|
|
|
74
75
|
(0, typegoose_1.prop)({ ref: () => order_model_1.Order }),
|
|
75
76
|
__metadata("design:type", Array)
|
|
76
77
|
], TripLeg.prototype, "orders", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typegoose_1.prop)({ ref: () => order_model_1.Order }),
|
|
80
|
+
__metadata("design:type", Array)
|
|
81
|
+
], TripLeg.prototype, "processedOrders", void 0);
|
|
77
82
|
__decorate([
|
|
78
83
|
(0, typegoose_1.prop)({ type: String }),
|
|
79
84
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip-leg.mode.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/trip-leg.mode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2D;AAC3D,gDAAuC;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;IADC,IAAA,gBAAI,GAAE;;8CACmB;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;;sDACQ;AAGnC;IADC,IAAA,gBAAI,GAAE;;yCACc;AAGrB;IADC,IAAA,gBAAI,GAAE;;yCACc;AAKrB;IAHC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;KAChB,CAAC;;iDAC4B","sourcesContent":["import { Ref, prop, mongoose } from '@typegoose/typegoose';\nimport { Order } from '../order.model';\nimport { Rider } from '../rider.model';\nimport { FaqAccountType, ItemType, TripLegStatus } from '../../../../utilities/enum';\nimport { User } from '../user.model';\nimport { Shop } from '../shop.model';\nimport { IDistance, IDuration } from '../../../map/interfaces/IMapService';\n\nexport class TripLeg {\n\t@prop({ type: String })\n\tname?: string;\n\n\t@prop({ type: String })\n\taddress?: string;\n\n\t@prop({ type: String })\n\taddressDescription?: string;\n\n\t@prop({ required: true, type: Number })\n\tlatitude?: number;\n\n\t@prop({ required: true, type: Number })\n\tlongitude?: number;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: FaqAccountType,\n\t\tdefault: FaqAccountType.RIDER,\n\t})\n\ttype?: FaqAccountType;\n\n\t@prop({ ref: () => Rider })\n\trider?: Ref<Rider>;\n\n\t@prop({ ref: () => Order })\n\torders?: mongoose.Types.ObjectId[];\n\n\t@prop({ ref: () => Order })\n\tprocessedOrders?: mongoose.Types.ObjectId[];\n\n\t@prop({ type: String })\n\torderId?: string;\n\n\t@prop({ ref: () => User })\n\tuser?: Ref<User>;\n\n\t@prop({ ref: () => Shop })\n\tshop?: Ref<Shop>;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: ItemType,\n\t})\n\tshopType?: ItemType;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: TripLegStatus,\n\t})\n\tstatus?: TripLegStatus;\n\n\t@prop()\n\ttotalDistance?: IDistance;\n\n\t@prop()\n\ttotalDuration?: IDuration;\n\n\t@prop({ type: [[Number]] })\n\ttotalOverviewPolyline?: number[][];\n\n\t@prop()\n\tdistance?: IDistance;\n\n\t@prop()\n\tduration?: IDuration;\n\n\t@prop({\n\t\ttype: [[Number]],\n\t})\n\toverviewPolyline?: number[][];\n}\n"]}
|
|
@@ -85,6 +85,7 @@ export declare const OrderActionsOutputSchema: z.ZodObject<{
|
|
|
85
85
|
}>;
|
|
86
86
|
createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
|
|
87
87
|
triggerAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
|
|
88
|
+
orderActionType: z.ZodNativeEnum<typeof OrderAction>;
|
|
88
89
|
}, "strip", z.ZodTypeAny, {
|
|
89
90
|
user: {
|
|
90
91
|
name: string;
|
|
@@ -110,6 +111,7 @@ export declare const OrderActionsOutputSchema: z.ZodObject<{
|
|
|
110
111
|
};
|
|
111
112
|
shopProfit: number;
|
|
112
113
|
};
|
|
114
|
+
orderActionType: OrderAction;
|
|
113
115
|
orderStatus: RegularOrderStatus;
|
|
114
116
|
orderAction: OrderAction;
|
|
115
117
|
preparationTimeMinutes: number;
|
|
@@ -138,6 +140,7 @@ export declare const OrderActionsOutputSchema: z.ZodObject<{
|
|
|
138
140
|
};
|
|
139
141
|
shopProfit: number;
|
|
140
142
|
};
|
|
143
|
+
orderActionType: OrderAction;
|
|
141
144
|
orderStatus: RegularOrderStatus;
|
|
142
145
|
orderAction: OrderAction;
|
|
143
146
|
preparationTimeMinutes: number;
|
|
@@ -226,6 +229,7 @@ export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof Orde
|
|
|
226
229
|
}>;
|
|
227
230
|
createdAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
|
|
228
231
|
triggerAt: z.ZodEffects<z.ZodEffects<z.ZodDate, Date, Date>, Date, Date>;
|
|
232
|
+
orderActionType: z.ZodNativeEnum<typeof OrderAction>;
|
|
229
233
|
}, "strip", z.ZodTypeAny, {
|
|
230
234
|
user: {
|
|
231
235
|
name: string;
|
|
@@ -251,6 +255,7 @@ export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof Orde
|
|
|
251
255
|
};
|
|
252
256
|
shopProfit: number;
|
|
253
257
|
};
|
|
258
|
+
orderActionType: OrderAction;
|
|
254
259
|
orderStatus: RegularOrderStatus;
|
|
255
260
|
orderAction: OrderAction;
|
|
256
261
|
preparationTimeMinutes: number;
|
|
@@ -279,6 +284,7 @@ export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof Orde
|
|
|
279
284
|
};
|
|
280
285
|
shopProfit: number;
|
|
281
286
|
};
|
|
287
|
+
orderActionType: OrderAction;
|
|
282
288
|
orderStatus: RegularOrderStatus;
|
|
283
289
|
orderAction: OrderAction;
|
|
284
290
|
preparationTimeMinutes: number;
|
|
@@ -43,6 +43,7 @@ exports.OrderActionsOutputSchema = zod_1.z.object({
|
|
|
43
43
|
}),
|
|
44
44
|
createdAt: validation_1.ZodValidation.coerce.date('Order Creation Date'),
|
|
45
45
|
triggerAt: validation_1.ZodValidation.coerce.date('Order Trigger Date'),
|
|
46
|
+
orderActionType: validation_1.ZodValidation.enumType(OrderAction, 'order action type'),
|
|
46
47
|
});
|
|
47
48
|
exports.OrderActionsInputSchema = zod_1.z.undefined();
|
|
48
49
|
class OrderActionsSocketEvent extends BaseSocketEvent_1.BaseSocketEvent {
|
|
@@ -68,6 +69,7 @@ class OrderActionsSocketEvent extends BaseSocketEvent_1.BaseSocketEvent {
|
|
|
68
69
|
message,
|
|
69
70
|
notificationType: enum_1.SocketEventType.ORDER_ACTIONS,
|
|
70
71
|
_id: payload._id,
|
|
72
|
+
orderActionType: payload.orderAction,
|
|
71
73
|
});
|
|
72
74
|
super(enum_1.SocketEventType.ORDER_ACTIONS, OrderActionsSocketEvent.schemas, payload, undefined, socketNotificationEvent);
|
|
73
75
|
}
|
|
@@ -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,+DAAoE;AACpE,kDAA6F;AAC7F,wDAAqD;AACrD,uEAAoE;AAGpE,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,MAAM,EAAE,0BAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACxC,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,0BAAa,CAAC,MAAM,CAAC,OAAO,CAAC;YACpC,cAAc,EAAE,0BAAa,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACtD,UAAU,EAAE,0BAAa,CAAC,MAAM,CAAC,YAAY,CAAC;YAC9C,mBAAmB,EAAE,0BAAa,CAAC,MAAM,CAAC,qBAAqB,CAAC;YAChE,WAAW,EAAE,0BAAa,CAAC,MAAM,CAAC,aAAa,CAAC;YAChD,oBAAoB,EAAE,0BAAa,CAAC,MAAM,CAAC,sBAAsB,CAAC;YAClE,SAAS,EAAE,0BAAa,CAAC,MAAM,CAAC,UAAU,CAAC;YAC3C,kBAAkB,EAAE,0BAAa,CAAC,MAAM,CAAC,oBAAoB,CAAC;SAC9D,CAAC;KACF,CAAC;IACF,SAAS,EAAE,0BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC;IAC3D,SAAS,EAAE,0BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;
|
|
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;AAGpE,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,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CAAC;IAC3D,SAAS,EAAE,0BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;IAC1D,eAAe,EAAE,0BAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;CACzE,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,OAAC,CAAC,SAAS,EAAE,CAAC;AAKrD,MAAa,uBAAwB,SAAQ,iCAG5C;IACA,MAAM,CAAU,OAAO,GAAG;QACzB,KAAK,EAAE,+BAAuB;QAC9B,MAAM,EAAE,gCAAwB;KAChC,CAAC;IAGM,MAAM,CAAC,mBAAmB,CAAC,WAAwB;QAC1D,QAAQ,WAAW,EAAE,CAAC;YACrB,KAAK,WAAW,CAAC,MAAM;gBACtB,OAAO,YAAY,CAAC;YACrB,KAAK,WAAW,CAAC,UAAU;gBAC1B,OAAO,yBAAyB,CAAC;YAClC,KAAK,WAAW,CAAC,WAAW;gBAC3B,OAAO,yBAAyB,CAAC;YAClC;gBACC,OAAO,cAAc,CAAC;QACxB,CAAC;IACF,CAAC;IAED,YAAY,OAAmC;QAC9C,MAAM,OAAO,GAAG,uBAAuB,CAAC,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACjF,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,CAAC;YAC3D,OAAO;YACP,gBAAgB,EAAE,sBAAe,CAAC,aAAa;YAC/C,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,eAAe,EAAE,OAAO,CAAC,WAAW;SACpC,CAAC,CAAC;QAEH,KAAK,CACJ,sBAAe,CAAC,aAAa,EAC7B,uBAAuB,CAAC,OAAO,EAC/B,OAAO,EACP,SAAS,EACT,uBAAuB,CACvB,CAAC;IACH,CAAC;IAES,aAAa;QACtB,OAAO,SAAS,CAAC;IAClB,CAAC;;AA3CF,0DA4CC","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';\nimport { EventFactory } from '../core';\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\tshopId: ZodValidation.objectId('shopId'),\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\torderActionType: ZodValidation.enumType(OrderAction, 'order action type'),\n});\n\nexport const OrderActionsInputSchema = z.undefined();\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\t// Map each OrderAction to its message\n\tprivate static getMessageForAction(orderAction: OrderAction): string {\n\t\tswitch (orderAction) {\n\t\t\tcase OrderAction.PLACED:\n\t\t\t\treturn 'New Order!';\n\t\t\tcase OrderAction.ADJUSTMENT:\n\t\t\t\treturn 'Order has been adjusted';\n\t\t\tcase OrderAction.REPLACEMENT:\n\t\t\t\treturn 'Order has been replaced';\n\t\t\tdefault:\n\t\t\t\treturn 'Order update';\n\t\t}\n\t}\n\n\tconstructor(payload: OrderActionSocketOutputDTO) {\n\t\tconst message = OrderActionsSocketEvent.getMessageForAction(payload.orderAction);\n\t\tconst socketNotificationEvent = new SocketNotificationEvent({\n\t\t\tmessage,\n\t\t\tnotificationType: SocketEventType.ORDER_ACTIONS,\n\t\t\t_id: payload._id,\n\t\t\torderActionType: payload.orderAction,\n\t\t});\n\n\t\tsuper(\n\t\t\tSocketEventType.ORDER_ACTIONS,\n\t\t\tOrderActionsSocketEvent.schemas,\n\t\t\tpayload,\n\t\t\tundefined,\n\t\t\tsocketNotificationEvent\n\t\t);\n\t}\n\n\tprotected getIdentifier(): string {\n\t\treturn 'default';\n\t}\n}\n"]}
|
|
@@ -2,19 +2,23 @@ import { BaseSocketEvent } from '../BaseSocketEvent';
|
|
|
2
2
|
import z from 'zod';
|
|
3
3
|
import { DTO } from '../../../utilities/validation';
|
|
4
4
|
import { SocketEventType } from '../../../utilities/enum';
|
|
5
|
+
import { OrderAction } from './order-actions.socket.event';
|
|
5
6
|
export declare const NotificationSocketInputSchema: z.ZodUndefined;
|
|
6
7
|
export declare const NotificationSocketOutputSchema: z.ZodObject<{
|
|
7
8
|
_id: 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>]>>;
|
|
8
9
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
9
10
|
notificationType: z.ZodNativeEnum<typeof SocketEventType>;
|
|
11
|
+
orderActionType: z.ZodOptional<z.ZodNativeEnum<typeof OrderAction>>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
13
|
message: string;
|
|
12
14
|
notificationType: SocketEventType;
|
|
13
15
|
_id?: import("mongoose").Types.ObjectId | undefined;
|
|
16
|
+
orderActionType?: OrderAction | undefined;
|
|
14
17
|
}, {
|
|
15
18
|
message: string;
|
|
16
19
|
notificationType: SocketEventType;
|
|
17
20
|
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
21
|
+
orderActionType?: OrderAction | undefined;
|
|
18
22
|
}>;
|
|
19
23
|
export type NotificationSocketOutputDTO = DTO<typeof NotificationSocketOutputSchema>;
|
|
20
24
|
export declare class SocketNotificationEvent extends BaseSocketEvent<typeof NotificationSocketInputSchema, typeof NotificationSocketOutputSchema> {
|
|
@@ -24,14 +28,17 @@ export declare class SocketNotificationEvent extends BaseSocketEvent<typeof Noti
|
|
|
24
28
|
_id: 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>]>>;
|
|
25
29
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
26
30
|
notificationType: z.ZodNativeEnum<typeof SocketEventType>;
|
|
31
|
+
orderActionType: z.ZodOptional<z.ZodNativeEnum<typeof OrderAction>>;
|
|
27
32
|
}, "strip", z.ZodTypeAny, {
|
|
28
33
|
message: string;
|
|
29
34
|
notificationType: SocketEventType;
|
|
30
35
|
_id?: import("mongoose").Types.ObjectId | undefined;
|
|
36
|
+
orderActionType?: OrderAction | undefined;
|
|
31
37
|
}, {
|
|
32
38
|
message: string;
|
|
33
39
|
notificationType: SocketEventType;
|
|
34
40
|
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
41
|
+
orderActionType?: OrderAction | undefined;
|
|
35
42
|
}>;
|
|
36
43
|
};
|
|
37
44
|
constructor(payload: DTO<typeof NotificationSocketOutputSchema>);
|
|
@@ -8,11 +8,13 @@ const BaseSocketEvent_1 = require("../BaseSocketEvent");
|
|
|
8
8
|
const zod_1 = __importDefault(require("zod"));
|
|
9
9
|
const validation_1 = require("../../../utilities/validation");
|
|
10
10
|
const enum_1 = require("../../../utilities/enum");
|
|
11
|
+
const order_actions_socket_event_1 = require("./order-actions.socket.event");
|
|
11
12
|
exports.NotificationSocketInputSchema = zod_1.default.undefined();
|
|
12
13
|
exports.NotificationSocketOutputSchema = zod_1.default.object({
|
|
13
14
|
_id: validation_1.ZodValidation.objectId().optional(),
|
|
14
15
|
message: validation_1.ZodValidation.string(),
|
|
15
16
|
notificationType: validation_1.ZodValidation.enumType(enum_1.SocketEventType, 'type'),
|
|
17
|
+
orderActionType: validation_1.ZodValidation.enumType(order_actions_socket_event_1.OrderAction, 'Order action type').optional(),
|
|
16
18
|
});
|
|
17
19
|
class SocketNotificationEvent extends BaseSocketEvent_1.BaseSocketEvent {
|
|
18
20
|
static schemas = { input: exports.NotificationSocketInputSchema, output: exports.NotificationSocketOutputSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socketNotificationEvent.js","sourceRoot":"/","sources":["libraries/socket/events/socketNotificationEvent.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAqD;AACrD,8CAAoB;AACpB,8DAAmE;AACnE,kDAA0D;
|
|
1
|
+
{"version":3,"file":"socketNotificationEvent.js","sourceRoot":"/","sources":["libraries/socket/events/socketNotificationEvent.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAqD;AACrD,8CAAoB;AACpB,8DAAmE;AACnE,kDAA0D;AAC1D,6EAA2D;AAE9C,QAAA,6BAA6B,GAAG,aAAC,CAAC,SAAS,EAAE,CAAC;AAC9C,QAAA,8BAA8B,GAAG,aAAC,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,0BAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACxC,OAAO,EAAE,0BAAa,CAAC,MAAM,EAAE;IAC/B,gBAAgB,EAAE,0BAAa,CAAC,QAAQ,CAAC,sBAAe,EAAE,MAAM,CAAC;IACjE,eAAe,EAAE,0BAAa,CAAC,QAAQ,CAAC,wCAAW,EAAE,mBAAmB,CAAC,CAAC,QAAQ,EAAE;CACpF,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 { SocketEventType } from '../../../utilities/enum';\nimport { OrderAction } from './order-actions.socket.event';\n\nexport const NotificationSocketInputSchema = z.undefined();\nexport const NotificationSocketOutputSchema = z.object({\n\t_id: ZodValidation.objectId().optional(),\n\tmessage: ZodValidation.string(),\n\tnotificationType: ZodValidation.enumType(SocketEventType, 'type'),\n\torderActionType: ZodValidation.enumType(OrderAction, 'Order action type').optional(),\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"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED