@lyxa.ai/core 1.3.150 → 1.3.151
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.
|
@@ -2,20 +2,19 @@ import { ClickType, NotificationAccountType, PushNotificationEventType } from '.
|
|
|
2
2
|
import { BaseEvent } from '../event/BaseEvent';
|
|
3
3
|
import mongoose from 'mongoose';
|
|
4
4
|
import { FCMNotificationPayload } from '../firebase/fcmService';
|
|
5
|
-
export interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface BaseNotificationData {
|
|
5
|
+
export interface NotificationEventData {
|
|
6
|
+
accountType: NotificationAccountType;
|
|
7
|
+
recipientId: mongoose.Types.ObjectId;
|
|
8
|
+
isGlobal: boolean;
|
|
10
9
|
isClickable: boolean;
|
|
11
|
-
clickType?: ClickType;
|
|
12
|
-
clickableUrl?: string;
|
|
13
|
-
notificationType
|
|
10
|
+
clickType?: ClickType | null;
|
|
11
|
+
clickableUrl?: string | null;
|
|
12
|
+
notificationType?: PushNotificationEventType;
|
|
13
|
+
[key: string]: any;
|
|
14
14
|
}
|
|
15
|
-
export interface NotificationEventType
|
|
16
|
-
data:
|
|
17
|
-
recipients: NotificationRecipient;
|
|
15
|
+
export interface NotificationEventType extends Omit<FCMNotificationPayload, 'data'> {
|
|
16
|
+
data: NotificationEventData;
|
|
18
17
|
}
|
|
19
|
-
export declare class NotificationEvent
|
|
20
|
-
constructor(payload: NotificationEventType
|
|
18
|
+
export declare class NotificationEvent extends BaseEvent<NotificationEventType> {
|
|
19
|
+
constructor(payload: Partial<NotificationEventType>);
|
|
21
20
|
}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.NotificationEvent = void 0;
|
|
7
|
+
const enum_1 = require("../../utilities/enum");
|
|
4
8
|
const BaseEvent_1 = require("../event/BaseEvent");
|
|
9
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
5
10
|
class NotificationEvent extends BaseEvent_1.BaseEvent {
|
|
6
11
|
constructor(payload) {
|
|
7
|
-
|
|
12
|
+
const defaultData = {
|
|
13
|
+
isClickable: false,
|
|
14
|
+
isGlobal: false,
|
|
15
|
+
accountType: enum_1.NotificationAccountType.USER,
|
|
16
|
+
recipientId: new mongoose_1.default.Types.ObjectId(),
|
|
17
|
+
};
|
|
18
|
+
const finalPayload = {
|
|
19
|
+
...payload,
|
|
20
|
+
data: {
|
|
21
|
+
...defaultData,
|
|
22
|
+
...(payload.data || {}),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
super('notification', finalPayload);
|
|
8
26
|
}
|
|
9
27
|
}
|
|
10
28
|
exports.NotificationEvent = NotificationEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/notification/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/notification/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAqG;AACrG,kDAA+C;AAC/C,wDAAgC;AAmBhC,MAAa,iBAAkB,SAAQ,qBAAgC;IACtE,YAAY,OAAuC;QAClD,MAAM,WAAW,GAA0B;YAC1C,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,8BAAuB,CAAC,IAAI;YACzC,WAAW,EAAE,IAAI,kBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE;SAC1C,CAAC;QACF,MAAM,YAAY,GAA0B;YAC3C,GAAG,OAAO;YACV,IAAI,EAAE;gBACL,GAAG,WAAW;gBACd,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;aACvB;SACD,CAAC;QAEF,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;CACD;AAlBD,8CAkBC","sourcesContent":["import { ClickType, NotificationAccountType, PushNotificationEventType } from '../../utilities/enum';\nimport { BaseEvent } from '../event/BaseEvent';\nimport mongoose from 'mongoose';\nimport { FCMNotificationPayload } from '../firebase/fcmService';\n\nexport interface NotificationEventData {\n\taccountType: NotificationAccountType;\n\trecipientId: mongoose.Types.ObjectId;\n\tisGlobal: boolean;\n\tisClickable: boolean;\n\tclickType?: ClickType | null;\n\tclickableUrl?: string | null;\n\tnotificationType?: PushNotificationEventType;\n\n\t[key: string]: any;\n}\n\nexport interface NotificationEventType extends Omit<FCMNotificationPayload, 'data'> {\n\tdata: NotificationEventData;\n}\n\nexport class NotificationEvent extends BaseEvent<NotificationEventType> {\n\tconstructor(payload: Partial<NotificationEventType>) {\n\t\tconst defaultData: NotificationEventData = {\n\t\t\tisClickable: false,\n\t\t\tisGlobal: false,\n\t\t\taccountType: NotificationAccountType.USER,\n\t\t\trecipientId: new mongoose.Types.ObjectId(),\n\t\t};\n\t\tconst finalPayload: NotificationEventType = {\n\t\t\t...payload,\n\t\t\tdata: {\n\t\t\t\t...defaultData,\n\t\t\t\t...(payload.data || {}),\n\t\t\t},\n\t\t};\n\n\t\tsuper('notification', finalPayload);\n\t}\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED