@or-sdk/notifications 1.7.3-beta.4120.0 → 1.7.3

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
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.7.3](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/notifications@1.7.2...@or-sdk/notifications@1.7.3) (2026-04-30)
7
+
8
+ **Note:** Version bump only for package @or-sdk/notifications
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.7.2](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/compare/@or-sdk/notifications@1.7.1...@or-sdk/notifications@1.7.2) (2026-04-22)
7
15
 
8
16
  **Note:** Version bump only for package @or-sdk/notifications
@@ -1,24 +1,196 @@
1
1
  import { Base } from '@or-sdk/base';
2
2
  import type { CreateTrailEvent, ListTrailEventsParams, NotificationsConfig, TrailEvent } from './schemas';
3
3
  import type { AccountPushNotificationParams, FullNotificationItem, GetVapidKeyResponse, ListNotificationsParams, NotificationData, NotificationItem, PushNotificationParams, SACreateNotificationParams, SAListNotifications, SubscribePushParams } from './types';
4
+ /**
5
+ * OneReach Notifications service client
6
+ *
7
+ * ## Installation:
8
+ *
9
+ * ```sh
10
+ * npm i '@or-sdk/notifications'
11
+ * ```
12
+ */
4
13
  export declare class Notifications extends Base {
5
14
  private readonly validateInputs;
6
15
  private readonly validateOutputs;
16
+ /**
17
+ * To create Notifications client do:
18
+ *
19
+ * ```typescript
20
+ * import { Notifications } from '@or-sdk/notifications';
21
+ *
22
+ * const notifications = new Notifications({
23
+ * token: () => token,
24
+ * notificationsUrl: 'https://notifications.api.example.com',
25
+ * });
26
+ * ```
27
+ *
28
+ * or with service discovery URL:
29
+ *
30
+ * ```typescript
31
+ * const notifications = new Notifications({
32
+ * token: () => token,
33
+ * discoveryUrl: 'https://discovery.api.example.com',
34
+ * });
35
+ * ```
36
+ *
37
+ * ## Validation
38
+ *
39
+ * To disable validation of input params and/or output results do:
40
+ *
41
+ * ```typescript
42
+ * import { Notifications } from '@or-sdk/notifications';
43
+ *
44
+ * const notifications = new Notifications({
45
+ * // ...
46
+ * validateInputs: false, // to disable validation of client methods' arguments
47
+ * validateOutputs: false, // to disable validation of client methods' results
48
+ * });
49
+ * ```
50
+ */
7
51
  constructor(params: NotificationsConfig);
52
+ /**
53
+ * List notifications
54
+ * ```typescript
55
+ * await notifications.listNotifications({size, from});
56
+ * ```
57
+ */
8
58
  listNotifications(params?: ListNotificationsParams): Promise<NotificationItem[]>;
59
+ /**
60
+ * Mark all notifications seen
61
+ * ```typescript
62
+ * await notifications.markSeen();
63
+ * ```
64
+ */
9
65
  markSeen(): Promise<void>;
66
+ /**
67
+ * Create user notification
68
+ * ```typescript
69
+ * await notifications.createUserNotification(data);
70
+ * ```
71
+ */
10
72
  createUserNotification(data: NotificationData): Promise<void>;
73
+ /**
74
+ * Create user notification
75
+ * ```typescript
76
+ * await notifications.createAccountNotification(data);
77
+ * ```
78
+ */
11
79
  createAccountNotification(data: NotificationData): Promise<void>;
80
+ /**
81
+ * Super admin create notification
82
+ * ```typescript
83
+ * await notifications.SACreateNotification({type, data, accountId, userId, dateCreated, parentId});
84
+ * ```
85
+ */
12
86
  SACreateNotification(params: SACreateNotificationParams): Promise<void>;
87
+ /**
88
+ * Super admin list notifications
89
+ * ```typescript
90
+ * await notifications.SAListNotifications({id, accountId,userId, dateCreated, type, seen, size, from, parentId});
91
+ * ```
92
+ */
13
93
  SAListNotifications(params?: SAListNotifications): Promise<FullNotificationItem[]>;
94
+ /**
95
+ * Super admin create notification
96
+ * ```typescript
97
+ * await notifications.SAUpdateNotification(id, {type, data, accountId, userId, dateCreated, parentId});
98
+ * ```
99
+ */
14
100
  SAUpdateNotification(id: string, data: FullNotificationItem): Promise<void>;
101
+ /**
102
+ * Super admin delete notification
103
+ * ```typescript
104
+ * await notifications.SADeleteNotification(id);
105
+ * ```
106
+ */
15
107
  SADeleteNotification(id: string): Promise<void>;
108
+ /**
109
+ * Create new trail event
110
+ *
111
+ * ```typescript
112
+ * await notifications.createTrailEvent({service: 'pgsql', data});
113
+ * ```
114
+ */
16
115
  createTrailEvent(data: CreateTrailEvent): Promise<void>;
116
+ /**
117
+ * List trail events
118
+ *
119
+ * ```typescript
120
+ * await notifications.listTrailEvents({ service: 'pgsql' });
121
+ * ```
122
+ *
123
+ * You can filter trail events by custom attributes:
124
+ *
125
+ * ```typescript
126
+ * await notifications.listTrailEvents({
127
+ * service: 'pgsql',
128
+ * pgsql_database: 'REAL_POSTGRES_DATABASE_NAME',
129
+ * });
130
+ * ```
131
+ */
17
132
  listTrailEvents(params: ListTrailEventsParams): Promise<TrailEvent[]>;
133
+ /**
134
+ * @description Send push notification to all account profiles except of sender
135
+ * @param data
136
+ * ```typescript
137
+ * await notifications.sendAccountPush({
138
+ * title,
139
+ * body,
140
+ * icon: 'image_url',
141
+ * actions: [{
142
+ * title: 'Open link',
143
+ * action: link,
144
+ * }],
145
+ * });
146
+ */
18
147
  sendAccountPush(data: AccountPushNotificationParams): Promise<void>;
148
+ /**
149
+ * @description Send push notification to all users with specific role
150
+ * @param {string} role
151
+ * @param data
152
+ * ```typescript
153
+ * await notifications.sendRolePush('admin', {
154
+ * title,
155
+ * body,
156
+ * icon: 'image_url',
157
+ * actions: [{
158
+ * title: 'Open link',
159
+ * action: link,
160
+ * }],
161
+ * });
162
+ */
19
163
  sendRolePush(role: string, data: AccountPushNotificationParams): Promise<void>;
164
+ /**
165
+ * @description Super Admin. Send push notification to profile(s)
166
+ * @param data
167
+ * ```typescript
168
+ * await notifications.sendAccountPush({
169
+ * userId,
170
+ * userIds,
171
+ * data:{
172
+ * title,
173
+ * body,
174
+ * icon: 'image_url',
175
+ * actions: [{
176
+ * title: 'Open link',
177
+ * action: link,
178
+ * }],
179
+ * }
180
+ * });
181
+ */
20
182
  sendPush(data: PushNotificationParams): Promise<void>;
183
+ /**
184
+ * @description Get public key to ask for subscription
185
+ * ```typescript
186
+ * await notifications.getVapidKey();
187
+ */
21
188
  getVapidKey(): Promise<GetVapidKeyResponse>;
189
+ /**
190
+ * @description Subscribe user for push notifications
191
+ * ```typescript
192
+ * await notifications.subscribePush(data);
193
+ */
22
194
  subscribePush(data: SubscribePushParams): Promise<void>;
23
195
  }
24
196
  //# sourceMappingURL=Notifications.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../src/Notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AASpC,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACX,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,6BAA6B,EAC7B,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAWjB,qBAAa,aAAc,SAAQ,IAAI;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAU;gBAqC9B,MAAM,EAAE,mBAAmB;IAsB1B,iBAAiB,CAAC,MAAM,GAAS,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IActF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAazB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7D,yBAAyB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAchE,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvE,mBAAmB,CAAC,MAAM,GAAS,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I,CAAC;IAQ3F;;;;;;;;;;;;;;;;;OAiBG;IACU,QAAQ,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlE;;;;OAIG;IACU,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAQxD;;;;OAIG;IACU,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAOrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@or-sdk/notifications",
3
- "version": "1.7.3-beta.4120.0",
3
+ "version": "1.7.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -18,7 +18,7 @@
18
18
  "dev": "pnpm build:watch:esm"
19
19
  },
20
20
  "dependencies": {
21
- "@or-sdk/base": "^0.44.2-beta.4120.0",
21
+ "@or-sdk/base": "^0.44.2",
22
22
  "zod": "^3.22.4"
23
23
  },
24
24
  "devDependencies": {
@@ -27,5 +27,6 @@
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
30
- }
30
+ },
31
+ "gitHead": "475a8aa2633c34c73873ec04ba593e0c56b90135"
31
32
  }