@or-sdk/notifications 1.7.2-beta.4096.0 → 1.7.2-beta.4097.0
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.
|
@@ -1,196 +1,24 @@
|
|
|
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
|
-
*/
|
|
13
4
|
export declare class Notifications extends Base {
|
|
14
5
|
private readonly validateInputs;
|
|
15
6
|
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
|
-
*/
|
|
51
7
|
constructor(params: NotificationsConfig);
|
|
52
|
-
/**
|
|
53
|
-
* List notifications
|
|
54
|
-
* ```typescript
|
|
55
|
-
* await notifications.listNotifications({size, from});
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
8
|
listNotifications(params?: ListNotificationsParams): Promise<NotificationItem[]>;
|
|
59
|
-
/**
|
|
60
|
-
* Mark all notifications seen
|
|
61
|
-
* ```typescript
|
|
62
|
-
* await notifications.markSeen();
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
9
|
markSeen(): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Create user notification
|
|
68
|
-
* ```typescript
|
|
69
|
-
* await notifications.createUserNotification(data);
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
10
|
createUserNotification(data: NotificationData): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Create user notification
|
|
75
|
-
* ```typescript
|
|
76
|
-
* await notifications.createAccountNotification(data);
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
11
|
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
|
-
*/
|
|
86
12
|
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
|
-
*/
|
|
93
13
|
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
|
-
*/
|
|
100
14
|
SAUpdateNotification(id: string, data: FullNotificationItem): Promise<void>;
|
|
101
|
-
/**
|
|
102
|
-
* Super admin delete notification
|
|
103
|
-
* ```typescript
|
|
104
|
-
* await notifications.SADeleteNotification(id);
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
15
|
SADeleteNotification(id: string): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* Create new trail event
|
|
110
|
-
*
|
|
111
|
-
* ```typescript
|
|
112
|
-
* await notifications.createTrailEvent({service: 'pgsql', data});
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
16
|
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
|
-
*/
|
|
132
17
|
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
|
-
*/
|
|
147
18
|
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
|
-
*/
|
|
163
19
|
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
|
-
*/
|
|
182
20
|
sendPush(data: PushNotificationParams): Promise<void>;
|
|
183
|
-
/**
|
|
184
|
-
* @description Get public key to ask for subscription
|
|
185
|
-
* ```typescript
|
|
186
|
-
* await notifications.getVapidKey();
|
|
187
|
-
*/
|
|
188
21
|
getVapidKey(): Promise<GetVapidKeyResponse>;
|
|
189
|
-
/**
|
|
190
|
-
* @description Subscribe user for push notifications
|
|
191
|
-
* ```typescript
|
|
192
|
-
* await notifications.subscribePush(data);
|
|
193
|
-
*/
|
|
194
22
|
subscribePush(data: SubscribePushParams): Promise<void>;
|
|
195
23
|
}
|
|
196
24
|
//# 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;
|
|
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,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAcxF,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc3E,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc/C,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBvD,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAwBrE,eAAe,CAAC,IAAI,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBnE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IA0B9E,QAAQ,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAarD,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAa3C,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.2-beta.
|
|
3
|
+
"version": "1.7.2-beta.4097.0",
|
|
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.1-beta.
|
|
21
|
+
"@or-sdk/base": "^0.44.1-beta.4097.0",
|
|
22
22
|
"zod": "^3.22.4"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|