@limetech/lime-web-components 5.32.0 → 5.33.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [5.33.1](https://github.com/Lundalogik/lime-web-components/compare/v5.33.0...v5.33.1) (2024-09-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+
7
+ * **notifications:** update interfaces to better align with other services ([900b937](https://github.com/Lundalogik/lime-web-components/commit/900b93711ff3e7ade43010536948afcd58fae753)), closes [Lundalogik/crm-feature#4341](https://github.com/Lundalogik/crm-feature/issues/4341)
8
+
9
+ ## [5.33.0](https://github.com/Lundalogik/lime-web-components/compare/v5.32.0...v5.33.0) (2024-08-30)
10
+
11
+
12
+ ### Features
13
+
14
+
15
+ * **notifications:** update load response and provide load options ([dd6aa7c](https://github.com/Lundalogik/lime-web-components/commit/dd6aa7c8f83dd80416552b5acc232c518eff9d59))
16
+
1
17
  ## [5.32.0](https://github.com/Lundalogik/lime-web-components/compare/v5.31.0...v5.32.0) (2024-08-23)
2
18
 
3
19
 
@@ -4,9 +4,46 @@
4
4
  * @alpha
5
5
  * @group NotificationRepository
6
6
  */
7
- export type Notification = {
7
+ export type Notification<T = unknown> = {
8
+ /**
9
+ * The notification id
10
+ */
8
11
  id: number;
9
- iduser: number;
10
- read: Boolean;
12
+ /**
13
+ * Type of notification
14
+ */
15
+ type?: NotificationType;
16
+ /**
17
+ * ID of the user the notification belongs to
18
+ */
19
+ userId: number;
20
+ /**
21
+ * Date when the notification was marked as read
22
+ */
23
+ read?: Date;
24
+ /**
25
+ * Date when the notification was created
26
+ */
27
+ createdTime: Date;
28
+ /**
29
+ * ID of the user that created the notification
30
+ */
31
+ createdUser: number;
32
+ /**
33
+ * Limetype that the notification is attached to
34
+ */
35
+ limetype?: string;
36
+ /**
37
+ * ID of the object the notification is attached to
38
+ */
39
+ objectId?: number;
40
+ /**
41
+ * Data attached to the notification
42
+ */
43
+ data?: T;
11
44
  };
45
+ /**
46
+ * @alpha
47
+ */
48
+ export type NotificationType = 'mention';
12
49
  //# sourceMappingURL=notification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/notification-service/notification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/notification-service/notification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAExB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC"}
@@ -7,36 +7,64 @@ import { Notification } from './notification';
7
7
  */
8
8
  export interface NotificationRepository {
9
9
  /**
10
- * Gets all notifications
10
+ * Load all notifications belonging to the logged in user from the server
11
11
  *
12
- * @returns the saved notifications
13
- */
14
- loadNotifications(): Promise<Notification[] | undefined>;
15
- /**
16
- * Creates a notification
12
+ * @param options - options to provide when loading notifications
17
13
  *
18
- * @returns the created notification
14
+ * @returns the saved notifications
19
15
  */
20
- createNotification(): Promise<Notification | undefined>;
16
+ loadAll(options?: NotificationLoadOptions): Promise<NotificationResponse>;
21
17
  /**
22
- * Gets a notification by its id
18
+ * Gets a loaded notification by its id
23
19
  *
24
20
  * @param notificationId - the id of the notification to get
25
21
  * @returns the fetched notification
26
22
  */
27
- getNotification(notificationId: number): Promise<Notification | undefined>;
23
+ get(notificationId: number): Notification | undefined;
28
24
  /**
29
- * Deletes a notification by its id
25
+ * Delete a notification
30
26
  *
31
- * @param notificationId - the id of the notification to delete
27
+ * @param notification - the notification to delete
32
28
  */
33
- deleteNotification(notificationId: number): Promise<void>;
29
+ delete(notification: Notification): Promise<void>;
34
30
  /**
35
31
  * Marks a notification as read
36
32
  *
37
- * @param notificationId - the id of the notification to mark as read
38
- * @returns the read notification
33
+ * @param notification - the notification to mark as read
34
+ * @returns the updated notification
35
+ */
36
+ markAsRead(notification: Notification): Promise<Notification>;
37
+ }
38
+ /**
39
+ * The count response of loaded notifications
40
+ *
41
+ * @alpha
42
+ * @group NotificationRepository
43
+ */
44
+ export type NotificationCount = {
45
+ total: number;
46
+ unread: number;
47
+ };
48
+ /**
49
+ * The response of loaded notifications
50
+ *
51
+ * @alpha
52
+ * @group NotificationRepository
53
+ */
54
+ export type NotificationResponse = {
55
+ items: Notification[];
56
+ count: NotificationCount;
57
+ };
58
+ /**
59
+ * The options to load notifications with
60
+ *
61
+ * @alpha
62
+ * @group NotificationRepository
63
+ */
64
+ export interface NotificationLoadOptions {
65
+ /**
66
+ * Maximum number of notifications to load
39
67
  */
40
- markNotificationAsRead(notificationId: number): Promise<Notification | undefined>;
68
+ limit?: number;
41
69
  }
42
70
  //# sourceMappingURL=repository.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/notification-service/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,WAAW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AiB,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-web-components",
3
- "version": "5.32.0",
3
+ "version": "5.33.1",
4
4
  "description": "Lime Web Components",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "tslib": "^2.6.3"
36
36
  },
37
37
  "devDependencies": {
38
- "@commitlint/config-conventional": "^19.2.2",
38
+ "@commitlint/config-conventional": "^19.4.1",
39
39
  "@microsoft/api-extractor": "^7.47.7",
40
40
  "@types/jest": "^27.5.0",
41
41
  "@typescript-eslint/eslint-plugin": "^7.5.0",