@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 NotificationRecipient {
6
- id: mongoose.Types.ObjectId;
7
- type: NotificationAccountType;
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: PushNotificationEventType;
10
+ clickType?: ClickType | null;
11
+ clickableUrl?: string | null;
12
+ notificationType?: PushNotificationEventType;
13
+ [key: string]: any;
14
14
  }
15
- export interface NotificationEventType<TData extends BaseNotificationData = BaseNotificationData> extends Omit<FCMNotificationPayload, 'data'> {
16
- data: TData;
17
- recipients: NotificationRecipient;
15
+ export interface NotificationEventType extends Omit<FCMNotificationPayload, 'data'> {
16
+ data: NotificationEventData;
18
17
  }
19
- export declare class NotificationEvent<TData extends BaseNotificationData = BaseNotificationData> extends BaseEvent<NotificationEventType<TData>> {
20
- constructor(payload: NotificationEventType<TData>);
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
- super('notification', payload);
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":";;;AACA,kDAA+C;AAsB/C,MAAa,iBAA6E,SAAQ,qBAEjG;IACA,YAAY,OAAqC;QAChD,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;CACD;AAND,8CAMC","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 NotificationRecipient {\n\tid: mongoose.Types.ObjectId;\n\ttype: NotificationAccountType;\n}\n\nexport interface BaseNotificationData {\n\tisClickable: boolean;\n\tclickType?: ClickType;\n\tclickableUrl?: string;\n\tnotificationType: PushNotificationEventType;\n}\n\nexport interface NotificationEventType<TData extends BaseNotificationData = BaseNotificationData>\n\textends Omit<FCMNotificationPayload, 'data'> {\n\tdata: TData;\n\trecipients: NotificationRecipient;\n}\n\nexport class NotificationEvent<TData extends BaseNotificationData = BaseNotificationData> extends BaseEvent<\n\tNotificationEventType<TData>\n> {\n\tconstructor(payload: NotificationEventType<TData>) {\n\t\tsuper('notification', payload);\n\t}\n}\n"]}
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"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.3.150
25
+ Version: 1.3.151
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.150",
3
+ "version": "1.3.151",
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.150",
3
+ "version": "1.3.151",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",