@openfin/cloud-notification-core-api 0.0.1-alpha.d138264 → 0.0.1-alpha.e273588

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.
Files changed (4) hide show
  1. package/bundle.d.ts +569 -284
  2. package/index.cjs +324 -179
  3. package/index.mjs +323 -179
  4. package/package.json +1 -1
package/bundle.d.ts CHANGED
@@ -4,331 +4,616 @@ export declare class AuthorizationError extends CloudNotificationAPIError {
4
4
  constructor(message?: string, code?: string);
5
5
  }
6
6
 
7
+ /**
8
+ * Represents common properties for all notification events
9
+ */
7
10
  export declare type BaseNotificationReceivedEvent = {
8
- action: 'new' | 'update';
11
+ /**
12
+ * The action that was performed on the notification
13
+ */
14
+ action: 'new' | 'update' | 'delete';
15
+ /**
16
+ * The unique identifier for the notification
17
+ */
9
18
  notificationId: string;
19
+ /**
20
+ * The correlation identifier for the notification
21
+ */
10
22
  correlationId?: string;
23
+ /**
24
+ * The identifier of the target of the notification
25
+ */
11
26
  target: string;
27
+ /**
28
+ * The name of the target i.e, the group or user that the notification was sent to
29
+ */
12
30
  targetName?: string;
31
+ /**
32
+ * The type of the target i.e, 'group' or 'user'
33
+ */
13
34
  targetType: string;
35
+ /**
36
+ * The payload of the notification.
37
+ * See the documentation for the notification center events for more information on the payload
38
+ */
14
39
  payload: unknown;
15
40
  };
16
41
 
17
42
  /**
18
- * Represents a single connection to a Cloud Notification service
43
+ * Represents a single connection to the Cloud Notification service
19
44
  *
20
- * @public
21
- * @class
22
45
  */
23
46
  export declare class CloudNotificationAPI {
24
47
  #private;
25
- constructor(cloudNotificationSettings: CloudNotificationSettings);
26
48
  /**
27
- * Connects and creates a session on the Cloud Notifications service
49
+ * Constructs a new instance of the CloudNotificationAPI
28
50
  *
29
- * @param {ConnectParameters} parameters - The parameters to use to connect
30
- * @returns {*} {Promise<void>}
31
- * @memberof CloudNotificationAPI
32
- * @throws {CloudNotificationAPIError} - If an error occurs during connection
33
- * @throws {AuthorizationError} - If the connection is unauthorized
51
+ * @param cloudNotificationSettings - The settings for the Cloud Notification API.
34
52
  */
35
- connect(parameters: ConnectParameters): Promise<ConnectionResult>;
53
+ constructor(cloudNotificationSettings: CloudNotificationSettings);
36
54
  /**
37
- * Disconnects from the Cloud Notification service
55
+ * Connects and creates a session on the Cloud Notifications service.
38
56
  *
39
- * @returns {*} {Promise<void>}
40
- * @memberof CloudNotificationAPI
41
- * @throws {CloudNotificationAPIError} - If an error occurs during disconnection
42
- */
43
- disconnect(): Promise<void>;
44
- postNotificationEvent(event: {
45
- notificationId: string;
46
- category: string;
47
- type: string;
48
- payload?: unknown;
49
- }): Promise<void>;
50
- getNotificationEvents(notificationIds: string[]): Promise<NotificationEventDetailGroupedByUserId>;
51
- raiseNotification(options: NotificationOptions_2, payload: unknown): Promise<NotificationRaiseResult>;
52
- updateNotification(): Promise<void>;
53
- deleteNotification(): Promise<void>;
54
- addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
55
- removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
56
- once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
57
- }
57
+ * @example
58
+ * ```typescript
59
+ * const notificationApi = new CloudNotificationAPI({
60
+ * url: process.env.NOTIFICATION_SERVER_HOST
61
+ * });
62
+ *
63
+ * let connectionResult: ConnectionResult;
64
+ * try {
65
+ * connectionResult = await notificationApi.connect(connectSettings);
66
+ * } catch (errorConnect) {
67
+ * terminal.write(chalk.red(`\nError connecting to notification server: ${errorConnect}\n`));
68
+ * process.exit(1);
69
+ * }
70
+ * ```
71
+ *
72
+ * @param parameters - The parameters to use to connect.
73
+ * @returns A promise that resolves when the connection is established.
74
+ * @throws {@link CloudNotificationAPIError} If an error occurs during connection.
75
+ * @throws {@link AuthorizationError} If the connection is unauthorized.
76
+ */
77
+ connect(parameters: ConnectParameters): Promise<ConnectionResult>;
78
+ /**
79
+ * Disconnects from the Cloud Notification service.
80
+ *
81
+ * @returns A promise that resolves when disconnected.
82
+ * @throws {@link CloudNotificationAPIError} If an error occurs during disconnection.
83
+ */
84
+ disconnect(): Promise<void>;
85
+ /**
86
+ * Posts a notification event to the Cloud Notification service.
87
+ *
88
+ * @param notificationId - The ID of the notification.
89
+ * @param event - The event details, including category, type, and optional payload.
90
+ * @returns A promise that resolves when the event is posted.
91
+ * @throws {@link SessionNotConnectedError} If the session is not connected.
92
+ * @throws {@link PublishError} If an error occurs during publishing.
93
+ */
94
+ postNotificationEvent(notificationId: string, event: {
95
+ category: string;
96
+ type: string;
97
+ payload?: unknown;
98
+ }, options?: NotificationEventOptions): Promise<void>;
99
+ /**
100
+ * Removes a notification from the notification center for a given set of users or user groups.
101
+ *
102
+ * @param notificationId - The ID of the notification to remove.
103
+ * @param targets - The targets to remove the notification from.
104
+ * @returns A promise that resolves when the notification is removed.
105
+ */
106
+ removeFromNotificationCenter(notificationId: string, targets: NotificationTargets): Promise<void>;
107
+ /**
108
+ * Raises a notification to the Cloud Notification service.
109
+ *
110
+ * @param options - The options for the notification.
111
+ * @param payload - The payload of the notification which should generally conform to the notification center schema
112
+ * @returns A promise that resolves with the notification raise result.
113
+ * @throws {@link SessionNotConnectedError} If the session is not connected.
114
+ * @throws {@link PublishError} If an error occurs during publishing.
115
+ */
116
+ raiseNotification(options: NotificationOptions_2, payload: unknown): Promise<NotificationRaiseResult>;
117
+ /**
118
+ * Raises a notification update to the Cloud Notification service.
119
+ *
120
+ * @param notificationId - The ID of the notification to update.
121
+ * @param options - The options for the notification update.
122
+ * @param payload - The new payload of the notification which should generally conform to the notification center update schema
123
+ * @throws {@link SessionNotConnectedError} If the session is not connected.
124
+ * @throws {@link PublishError} If an error occurs during publishing of the update.
125
+ */
126
+ updateNotification(notificationId: string, options: NotificationUpdateOptions, payload: unknown): Promise<void>;
127
+ /**
128
+ * Marks a notification as deleted in the Cloud Notification service.
129
+ *
130
+ * This in turn causes notification events to be raised for the notification
131
+ *
132
+ * @param notificationId - The ID of the notification to delete.
133
+ * @returns A promise that resolves when the notification is deleted.
134
+ * @throws {@link SessionNotConnectedError} If the session is not connected.
135
+ */
136
+ deleteNotification(notificationId: string): Promise<void>;
137
+ /**
138
+ * Replays notifications from the Cloud Notification service.
139
+ *
140
+ * This is called at platform startup to populate the notification center with notifications that were missed since the last time the platform was started.
141
+ *
142
+ * @param pageItemLimit - The maximum number of items per page.
143
+ * @param pageStartCursor - The cursor to start the page from. This is retrieved from the pageInfo property.
144
+ * @returns A promise that resolves with the notifications replay details.
145
+ * @throws {@link SessionNotConnectedError} If the session is not connected.
146
+ * @throws {@link NotificationRetrievalError} If an error occurs during retrieval.
147
+ */
148
+ replayNotifications(pageItemLimit: number | undefined, pageStartCursor: string | undefined): Promise<NotificationsReplayDetails>;
149
+ /**
150
+ * Adds an event listener for a specific event type.
151
+ *
152
+ * @param type - The event type.
153
+ * @param callback - The callback function to invoke when the event occurs.
154
+ */
155
+ addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
156
+ /**
157
+ * Removes an event listener for a specific event type.
158
+ *
159
+ * @param type - The event type.
160
+ * @param callback - The callback function to remove.
161
+ */
162
+ removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
163
+ /**
164
+ * Adds a one-time event listener for a specific event type.
165
+ *
166
+ * @param type - The event type.
167
+ * @param callback - The callback function to invoke once when the event occurs.
168
+ */
169
+ once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
170
+ }
58
171
 
59
- export declare class CloudNotificationAPIError extends Error {
60
- code: string;
61
- constructor(message?: string, code?: string, cause?: unknown);
62
- }
172
+ export declare class CloudNotificationAPIError extends Error {
173
+ code: string;
174
+ constructor(message?: string, code?: string, cause?: unknown);
175
+ }
63
176
 
64
- /**
65
- * Represents a logging function to be used by the cloud notification client
66
- */
67
- export declare type CloudNotificationLogger = (level: LogLevel, message: string) => void;
177
+ /**
178
+ * Represents a logging function to be used by the cloud notification client
179
+ */
180
+ export declare type CloudNotificationLogger = (level: LogLevel, message: string) => void;
68
181
 
69
- export declare type CloudNotificationSettings = {
70
- /**
71
- * The URL of the notification server to connect to
72
- */
73
- url: string;
74
- /**
75
- * The default TTL for notifications published.
76
- * Can be overridden on each publish if required
77
- * */
78
- defaultTTL?: number;
79
- };
182
+ export declare type CloudNotificationSettings = {
183
+ /**
184
+ * The URL of the notification server to connect to
185
+ *
186
+ * @example 'https://the-environment.example.com/notifications'
187
+ */
188
+ url: string;
189
+ /**
190
+ * The maximum number of times to retry connecting to the cloud notification service when the connection is dropped
191
+ * defaults to 30
192
+ */
193
+ reconnectRetryLimit?: number;
194
+ /**
195
+ * Specifies how often keep alive messages should be sent to the cloud notification service in seconds
196
+ * defaults to 30
197
+ */
198
+ keepAliveIntervalSeconds?: number;
199
+ /**
200
+ * Optional function to call with any logging messages to allow integration with the host application's logging
201
+ *
202
+ * Defaults to console.log
203
+ */
204
+ logger?: CloudNotificationLogger;
205
+ /**
206
+ * The time used to deduplicate notifications
207
+ */
208
+ deduplicationTTLms?: number;
209
+ /**
210
+ * Will cause the api to calculate the time offset between the local machine and the notification server
211
+ * defaults to true
212
+ */
213
+ syncTime?: boolean;
214
+ };
80
215
 
81
- export declare type ConnectionResult = {
82
- sessionId: string;
83
- platformId: string;
84
- sourceId: string;
85
- userId: string;
86
- groups: {
87
- uuid: string;
88
- name: string;
89
- }[];
90
- };
216
+ /**
217
+ * Represents the result of a successful connection to the server
218
+ */
219
+ export declare type ConnectionResult = {
220
+ /**
221
+ * The unique identifier for the session
222
+ */
223
+ sessionId: string;
224
+ /**
225
+ * The platform identifier
226
+ */
227
+ platformId: string;
228
+ /**
229
+ * The source identifier
230
+ */
231
+ sourceId: string;
232
+ /**
233
+ * The user identifier
234
+ */
235
+ userId: string;
236
+ /**
237
+ * A collection of groups that the user is either a direct or indirect member of
238
+ */
239
+ groups: {
240
+ uuid: string;
241
+ name: string;
242
+ }[];
243
+ };
91
244
 
92
- /**
93
- * Represents the parameters to use to connect to an notification server
94
- */
95
- export declare type ConnectParameters = {
96
- /**
97
- * ID for a group of shared applications.
98
- * This acts as a namespace for the notification messages that allows separation of messages between different groups of applications for the same user
99
- */
100
- platformId: string;
101
- /**
102
- * A value that distinguishes the host the application is running in. For example this could be the hostname of the current machine
103
- */
104
- sourceId: string;
105
- /**
106
- * The maximum number of times to retry connecting to the cloud notification service when the connection is dropped
107
- * defaults to 30
108
- */
109
- reconnectRetryLimit?: number;
110
- /**
111
- * Specifies how often keep alive messages should be sent to the cloud notification service in seconds
112
- * defaults to 30
113
- */
114
- keepAliveIntervalSeconds?: number;
115
- /**
116
- * Calculates the time offset between the local machine and the notification server
117
- * defaults to true
118
- */
119
- syncTime?: boolean;
120
- /**
121
- * Optional function to call with any logging messages to allow integration with the host application's logging
122
- *
123
- * defaults to console.log
124
- */
125
- logger?: CloudNotificationLogger;
126
- /**
127
- * Determines the type of authentication to use with the service gateway
128
- * defaults to 'none'
129
- *
130
- * 'jwt' - Use JWT authentication, in this case jwtAuthenticationParameters must also be provided
131
- * 'basic' - Use basic authentication, in this case basicAuthenticationParameters must also be provided
132
- * 'default' - Authentication will be inherited from the current session
133
- */
134
- authenticationType?: 'jwt' | 'basic' | 'default';
135
- /**
136
- * Optional parameters for basic authentication
137
- */
138
- basicAuthenticationParameters?: {
139
- /**
140
- * The username to use for basic authentication
141
- */
142
- username: string;
143
- /**
144
- * The password to use for basic authentication
145
- */
146
- password: string;
147
- };
148
- /**
149
- * Optional parameters for JWT authentication
150
- */
151
- jwtAuthenticationParameters?: {
152
- /**
153
- * When JWT authentication is being used, this will be invoked just whenever a JWT token is required for a request
154
- */
155
- jwtRequestCallback: () => string | object;
156
- /**
157
- * The id of the service gateway JWT authentication definition to use
158
- *
159
- * Note: Contact Here support to to get your organization's authentication id
160
- */
161
- authenticationId: string;
162
- };
163
- };
245
+ /**
246
+ * Represents the parameters to use to connect to an notification server
247
+ */
248
+ export declare type ConnectParameters = {
249
+ /**
250
+ * ID for a group of shared applications.
251
+ *
252
+ * This acts as a namespace for the notification messages that allows separation of messages between different groups of applications for the same user
253
+ *
254
+ * This, in general, should be the uuid of the platform that you are communicating
255
+ */
256
+ platformId: string;
257
+ /**
258
+ * A value that distinguishes the host the application is running in. For example this could be the hostname of the current machine
259
+ */
260
+ sourceId: string;
261
+ /**
262
+ * Determines the type of authentication to use with the service gateway
263
+ *
264
+ * - 'jwt' - Use JWT authentication, in this case jwtAuthenticationParameters must also be provided
265
+ * - 'basic' - Use basic authentication, in this case basicAuthenticationParameters must also be provided
266
+ * - 'default' - Authentication will be inherited from the current session
267
+ */
268
+ authenticationType?: 'jwt' | 'basic' | 'default';
269
+ /**
270
+ * Optional parameters for basic authentication
271
+ */
272
+ basicAuthenticationParameters?: {
273
+ /**
274
+ * The username to use for basic authentication
275
+ */
276
+ username: string;
277
+ /**
278
+ * The password to use for basic authentication
279
+ */
280
+ password: string;
281
+ };
282
+ /**
283
+ * Optional parameters for JWT authentication
284
+ */
285
+ jwtAuthenticationParameters?: {
286
+ /**
287
+ * When JWT authentication is being used, this will be invoked just whenever a JWT token is required for a request
288
+ *
289
+ * This token should be conform to the configuration set within your environment. Contact Here support for more details
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * const jwtRequestCallback = () => {
294
+ * return 'your-jwt-token';
295
+ * };
296
+ * ```
297
+ */
298
+ jwtRequestCallback: () => string | object;
299
+ /**
300
+ * The id of the service gateway JWT authentication definition to use
301
+ *
302
+ * Note: Contact Here support to to get your organization's authentication id
303
+ */
304
+ authenticationId: string;
305
+ };
306
+ };
164
307
 
165
- export declare type CreateSessionResponse = {
166
- sessionId: string;
167
- sessionRootTopic: string;
168
- userNotificationEventsTopic: string;
169
- allNotificationEventsTopic: string;
170
- channelsRootTopic: string;
171
- publishTopic: string;
172
- lastWillTopic: string;
173
- url: string;
174
- token: string;
175
- orgId: string;
176
- userId: string;
177
- platformId: string;
178
- groups: UserGroupWithTopic[];
179
- userNotificationTopic: string;
180
- };
308
+ export declare type DeleteNotificationEvent = BaseNotificationReceivedEvent & {
309
+ action: 'delete';
310
+ };
181
311
 
182
- export declare type EventListenersMap = Map<keyof EventMap, Array<(...args: Parameters<EventMap[keyof EventMap]>) => void>>;
312
+ export declare type EventMap = {
313
+ /**
314
+ * Emitted when the connection has been re-established
315
+ * @returns void
316
+ */
317
+ reconnected: () => void;
318
+ /**
319
+ * Emitted when the connection has been disconnected
320
+ * @returns void
321
+ */
322
+ reconnecting: (attemptNo: number) => void;
323
+ /**
324
+ * Emitted when the connection has been disconnected
325
+ * @returns void
326
+ */
327
+ disconnected: () => void;
328
+ /**
329
+ * Emitted when an error occurs
330
+ * @returns void
331
+ */
332
+ error: (error: Error) => void;
333
+ /**
334
+ * Emitted when the session has expired
335
+ * @returns void
336
+ */
337
+ 'session-expired': () => void;
338
+ /**
339
+ * Emitted when the session has been extended
340
+ * @returns void
341
+ */
342
+ 'session-extended': () => void;
343
+ /**
344
+ * Emitted when a new notification is received
345
+ * @returns void
346
+ */
347
+ 'new-notification': (event: NewNotificationEvent) => void;
348
+ /**
349
+ * Emitted when an update to a notification is received
350
+ * @returns void
351
+ */
352
+ 'update-notification': (event: UpdateNotificationEvent) => void;
353
+ /**
354
+ * Emitted when a notification is deleted
355
+ * @returns void
356
+ */
357
+ 'delete-notification': (event: DeleteNotificationEvent) => void;
358
+ /**
359
+ * Emitted when a notification event is received for this specific session
360
+ * @returns void
361
+ */
362
+ 'notification-event': (event: NotificationEvent) => void;
363
+ /**
364
+ * Emitted when a notification event is received for all sessions
365
+ * @returns void
366
+ */
367
+ 'global-notification-event': (event: NotificationEvent) => void;
368
+ };
183
369
 
184
- export declare type EventMap = {
185
- reconnected: () => void;
186
- disconnected: () => void;
187
- reconnecting: (attemptNo: number) => void;
188
- error: (error: Error) => void;
189
- 'session-expired': () => void;
190
- 'session-extended': () => void;
191
- 'new-notification': (event: NewNotificationEvent) => void;
192
- 'update-notification': (event: UpdateNotificationEvent) => void;
193
- 'notification-event': (event: NotificationEvent) => void;
194
- 'notification-event-all': (event: NotificationEvent) => void;
195
- };
370
+ export declare class EventPublishError extends CloudNotificationAPIError {
371
+ constructor(message?: string, code?: string, cause?: unknown);
372
+ }
196
373
 
197
- export declare class EventRetrievalError extends CloudNotificationAPIError {
198
- constructor(message?: string, code?: string, cause?: unknown);
199
- }
374
+ export declare class EventRetrievalError extends CloudNotificationAPIError {
375
+ constructor(message?: string, code?: string, cause?: unknown);
376
+ }
200
377
 
201
- export declare class InvalidMessageFormatError extends CloudNotificationAPIError {
202
- constructor(zodParseResult: z.SafeParseReturnType<unknown, unknown>);
203
- }
378
+ export declare class InvalidMessageFormatError extends CloudNotificationAPIError {
379
+ constructor(zodParseResult: z.SafeParseReturnType<unknown, unknown>);
380
+ }
204
381
 
205
- export declare type LogLevel = 'log' | 'debug' | 'info' | 'warn' | 'error';
382
+ export declare type LogLevel = 'log' | 'debug' | 'info' | 'warn' | 'error';
206
383
 
207
- export declare type NewNotificationEvent = BaseNotificationReceivedEvent & {
208
- action: 'new';
209
- };
384
+ export declare type NewNotificationEvent = BaseNotificationReceivedEvent & {
385
+ action: 'new';
386
+ };
210
387
 
211
- export declare type NotificationEvent = {
212
- notificationId: string;
213
- correlationId?: string;
214
- category: string;
215
- type: string;
216
- payload?: unknown;
217
- };
388
+ /**
389
+ * Represents a notification event
390
+ */
391
+ export declare type NotificationEvent = {
392
+ /**
393
+ * The unique identifier for the notification
394
+ */
395
+ notificationId: string;
396
+ /**
397
+ * The correlation identifier for the notification
398
+ */
399
+ correlationId?: string;
400
+ /**
401
+ * The source identifier
402
+ */
403
+ sourceId: string;
404
+ /**
405
+ * The platform identifier
406
+ */
407
+ platformId: string;
408
+ /**
409
+ * The unique platform identifier for the user
410
+ */
411
+ userId: string;
412
+ /**
413
+ * The resolved username of the user
414
+ */
415
+ userName?: string;
416
+ /**
417
+ * The category of the notification.
418
+ * For notification center events this will be 'notification-center-event'
419
+ */
420
+ category: string;
421
+ /**
422
+ * The type of the notification.
423
+ * For example 'notification-close' when a user closes a notification in the notification center
424
+ */
425
+ type: string;
426
+ /**
427
+ * The payload of the notification.
428
+ * See the documentation for the notification center events for more information on the payload
429
+ */
430
+ payload?: unknown;
431
+ };
218
432
 
219
- export declare type NotificationEventDetail = z.infer<typeof notificationEventDetailSchema>;
433
+ /**
434
+ * Represents the options for a notification event publish
435
+ */
436
+ export declare type NotificationEventOptions = {
437
+ /**
438
+ * The targets to send the event to
439
+ *
440
+ * This is a set of groups and users that the notification event will direct to. You may use to explicitly remove the notification
441
+ * from a subset of the original targets that received it.
442
+ *
443
+ * For example you send a notification to *all-users* and then want to remove the notification from a specific group. You can do this by
444
+ * specifying the group name in the targets.
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const notificationEventOptions: NotificationEventOptions = {
449
+ * targets: {
450
+ * groups: ['all-users'],
451
+ * users: ['someuser@company.com']
452
+ * }
453
+ * };
454
+ * ```
455
+ */
456
+ targets: NotificationTargets;
457
+ };
220
458
 
221
- export declare type NotificationEventDetailGroupedByUserId = {
222
- [userId: string]: NotificationEventDetail[];
223
- };
459
+ /**
460
+ * Represents the options for a notification publish
461
+ */
462
+ declare type NotificationOptions_2 = {
463
+ /**
464
+ * A caller specified identifier for the notification
465
+ *
466
+ * This is used to identify the notification in the system when events and responses are received
467
+ */
468
+ correlationId?: string;
469
+ /**
470
+ * The targets to send the notification to
471
+ *
472
+ * This is a set of groups and users that the notification will be sent to
473
+ *
474
+ * @example
475
+ * ```typescript
476
+ * const notificationOptions: NotificationOptions = {
477
+ * targets: {
478
+ * groups: ['all-users'],
479
+ * users: ['someuser@company.com']
480
+ * }
481
+ * };
482
+ * ```
483
+ */
484
+ targets: NotificationTargets;
485
+ /**
486
+ * Optional number of seconds to keep the notification alive
487
+ *
488
+ * After this time the notification will be expired and a delete update will be raised
489
+ */
490
+ ttlSeconds?: number;
491
+ };
492
+ export { NotificationOptions_2 as NotificationOptions }
224
493
 
225
- export declare const notificationEventDetailSchema: z.ZodObject<{
226
- userId: z.ZodString;
227
- platformId: z.ZodString;
228
- sourceId: z.ZodString;
229
- notificationId: z.ZodString;
230
- category: z.ZodString;
231
- type: z.ZodString;
232
- sessionId: z.ZodString;
233
- payload: z.ZodOptional<z.ZodUnknown>;
234
- correlationId: z.ZodOptional<z.ZodString>;
235
- timestamp: z.ZodString;
236
- }, "strip", z.ZodTypeAny, {
237
- notificationId: string;
238
- category: string;
239
- type: string;
240
- userId: string;
241
- platformId: string;
242
- sourceId: string;
243
- sessionId: string;
244
- timestamp: string;
245
- payload?: unknown;
246
- correlationId?: string | undefined;
247
- }, {
248
- notificationId: string;
249
- category: string;
250
- type: string;
251
- userId: string;
252
- platformId: string;
253
- sourceId: string;
254
- sessionId: string;
255
- timestamp: string;
256
- payload?: unknown;
257
- correlationId?: string | undefined;
258
- }>;
494
+ /**
495
+ * Represents the response from raising a notification
496
+ */
497
+ export declare type NotificationRaiseResult = {
498
+ /**
499
+ * The unique identifier for the notification
500
+ */
501
+ notificationId: string;
502
+ /**
503
+ * The correlation ID that was provided when raising the notification
504
+ */
505
+ correlationId?: string;
506
+ };
259
507
 
260
- /**
261
- * Represents the options for a notification publish
262
- */
263
- declare type NotificationOptions_2 = {
264
- /**
265
- * Time to live for the notification in seconds
266
- * This is the time that the notification will be kept in the system before it is deleted
267
- * If not specified, the default time to live for the notification will be used
268
- */
269
- ttl?: number;
270
- /**
271
- * A caller specified identifier for the notification
272
- * This is used to identify the notification in the system when events and responses are received
273
- */
274
- correlationId?: string;
275
- /**
276
- * The targets to send the notification to
277
- * This is a set of groups and users that the notification will be sent to
278
- */
279
- targets: NotificationTargets;
280
- };
281
- export { NotificationOptions_2 as NotificationOptions }
508
+ export declare class NotificationRetrievalError extends CloudNotificationAPIError {
509
+ constructor(message?: string, code?: string, cause?: unknown);
510
+ }
282
511
 
283
- /**
284
- * Represents the response from raising a notification
285
- */
286
- export declare type NotificationRaiseResult = {
287
- /**
288
- * The unique identifier for the notification
289
- */
290
- notificationId: string;
291
- /**
292
- * The correction ID that was provided when raising the notification
293
- */
294
- correlationId?: string;
295
- };
512
+ /**
513
+ * Represents a single notification replay detail.
514
+ */
515
+ export declare type NotificationsReplayDetail = {
516
+ /**
517
+ * The cursor of the notification.
518
+ */
519
+ cursor: string;
520
+ /**
521
+ * The session ID of the notification.
522
+ */
523
+ sessionId: string;
524
+ /**
525
+ * The notification ID.
526
+ */
527
+ notificationId: string;
528
+ /**
529
+ * The version of the notification.
530
+ */
531
+ version: number;
532
+ /**
533
+ * The type of notification record.
534
+ */
535
+ action: 'new' | 'update' | 'delete';
536
+ /**
537
+ * The payload of the notification.
538
+ */
539
+ payload?: unknown;
540
+ /**
541
+ * The original correlation ID of the notification if specified.
542
+ */
543
+ correlationId?: string | null;
544
+ /**
545
+ * The timestamp of the notification.
546
+ */
547
+ timestamp: Date;
548
+ };
296
549
 
297
- /**
298
- * Represents a set of targets for a notification publish
299
- */
300
- export declare type NotificationTargets = {
301
- /**
302
- * The groups to send the notification to
303
- */
304
- groups: string[];
305
- /**
306
- * The users to send the notification to
307
- */
308
- users: string[];
309
- };
550
+ /**
551
+ * Represents the results of a notifications replay request.
552
+ */
553
+ export declare type NotificationsReplayDetails = {
554
+ /**
555
+ * The list of notifications replay details.
556
+ */
557
+ data: NotificationsReplayDetail[];
558
+ /**
559
+ * The pagination information for the notifications replay request.
560
+ */
561
+ pageInfo: {
562
+ /**
563
+ * The cursor of the first notification in the page.
564
+ */
565
+ pageStart?: string;
566
+ /**
567
+ * The cursor of the next page.
568
+ */
569
+ nextPage?: string;
570
+ /**
571
+ * Whether there is a next page of notifications.
572
+ */
573
+ hasNextPage: boolean;
574
+ };
575
+ };
310
576
 
311
- export declare class PublishError extends CloudNotificationAPIError {
312
- constructor(message?: string, code?: string, cause?: unknown);
313
- }
577
+ /**
578
+ * Represents a set of targets for a notification publish
579
+ */
580
+ export declare type NotificationTargets = {
581
+ /**
582
+ * The optional groups to send the notification to
583
+ *
584
+ * This can be a collection of either group names e.g. all-users which can be retrieved from the admin console or the
585
+ * UUID of the group itself
586
+ */
587
+ groups: string[];
588
+ /**
589
+ * The optional specific users to send the notification to
590
+ *
591
+ * This can be the username e.g. someuser\@company.com or the UUID of the user itself
592
+ */
593
+ users: string[];
594
+ };
314
595
 
315
- export declare type PublishResult = {
316
- notificationId: string;
317
- correlationId: string | undefined;
318
- };
596
+ /**
597
+ * Represents the options for a notification update
598
+ */
599
+ export declare type NotificationUpdateOptions = {
600
+ /**
601
+ * Optional number of seconds to keep the notification alive
602
+ * After this time the notification will be expired and a delete update will be raised
603
+ */
604
+ ttlSeconds?: number;
605
+ };
319
606
 
320
- export declare class SessionNotConnectedError extends CloudNotificationAPIError {
321
- constructor(message?: string, code?: string);
322
- }
607
+ export declare class PublishError extends CloudNotificationAPIError {
608
+ constructor(message?: string, code?: string, cause?: unknown);
609
+ }
323
610
 
324
- export declare type UpdateNotificationEvent = BaseNotificationReceivedEvent & {
325
- action: 'update';
326
- };
611
+ export declare class SessionNotConnectedError extends CloudNotificationAPIError {
612
+ constructor(message?: string, code?: string);
613
+ }
327
614
 
328
- export declare type UserGroupWithTopic = {
329
- uuid: string;
330
- name: string;
331
- topic?: string;
332
- };
615
+ export declare type UpdateNotificationEvent = BaseNotificationReceivedEvent & {
616
+ action: 'update';
617
+ };
333
618
 
334
- export { }
619
+ export { }