@openfin/cloud-notification-core-api 0.0.1-alpha.85addcf → 0.0.1-alpha.85b756f

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