@sudoplatform/sudo-notification 1.0.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.
- package/LICENSE +14 -0
- package/README.md +20 -0
- package/cjs/gen/graphqlTypes.js +34 -0
- package/cjs/gen/graphqlTypes.js.map +1 -0
- package/cjs/index.js +10 -0
- package/cjs/index.js.map +1 -0
- package/cjs/private/apiClient.js +139 -0
- package/cjs/private/apiClient.js.map +1 -0
- package/cjs/private/codecs/sudoPlatformPayloadCodec.js +21 -0
- package/cjs/private/codecs/sudoPlatformPayloadCodec.js.map +1 -0
- package/cjs/private/constants.js +10 -0
- package/cjs/private/constants.js.map +1 -0
- package/cjs/private/transformers/buildTypeTransformer.js +30 -0
- package/cjs/private/transformers/buildTypeTransformer.js.map +1 -0
- package/cjs/private/transformers/errorTransformer.js +34 -0
- package/cjs/private/transformers/errorTransformer.js.map +1 -0
- package/cjs/private/transformers/notificationConfigurationTransformer.js +21 -0
- package/cjs/private/transformers/notificationConfigurationTransformer.js.map +1 -0
- package/cjs/private/transformers/notificationEnableStatusTransformer.js +32 -0
- package/cjs/private/transformers/notificationEnableStatusTransformer.js.map +1 -0
- package/cjs/private/transformers/notificationMetadataTransformer.js +17 -0
- package/cjs/private/transformers/notificationMetadataTransformer.js.map +1 -0
- package/cjs/private/types/canonicalPushSubscriptionJSON.js +8 -0
- package/cjs/private/types/canonicalPushSubscriptionJSON.js.map +1 -0
- package/cjs/private/types/notifiableServiceConfig.js +12 -0
- package/cjs/private/types/notifiableServiceConfig.js.map +1 -0
- package/cjs/private/types/notificationServiceConfig.js +17 -0
- package/cjs/private/types/notificationServiceConfig.js.map +1 -0
- package/cjs/private/types/sudoNotificationClientPrivateOptions.js +3 -0
- package/cjs/private/types/sudoNotificationClientPrivateOptions.js.map +1 -0
- package/cjs/public/errors.js +131 -0
- package/cjs/public/errors.js.map +1 -0
- package/cjs/public/index.js +13 -0
- package/cjs/public/index.js.map +1 -0
- package/cjs/public/sudoNotifiableClient.js +106 -0
- package/cjs/public/sudoNotifiableClient.js.map +1 -0
- package/cjs/public/sudoNotificationClient.js +164 -0
- package/cjs/public/sudoNotificationClient.js.map +1 -0
- package/cjs/public/types/buildType.js +18 -0
- package/cjs/public/types/buildType.js.map +1 -0
- package/cjs/public/types/index.js +20 -0
- package/cjs/public/types/index.js.map +1 -0
- package/cjs/public/types/notificationConfiguration.js +13 -0
- package/cjs/public/types/notificationConfiguration.js.map +1 -0
- package/cjs/public/types/notificationDeviceInfo.js +3 -0
- package/cjs/public/types/notificationDeviceInfo.js.map +1 -0
- package/cjs/public/types/notificationEnabledStatus.js +14 -0
- package/cjs/public/types/notificationEnabledStatus.js.map +1 -0
- package/cjs/public/types/notificationFilterItem.js +35 -0
- package/cjs/public/types/notificationFilterItem.js.map +1 -0
- package/cjs/public/types/notificationMetadata.js +22 -0
- package/cjs/public/types/notificationMetadata.js.map +1 -0
- package/cjs/public/types/notificationSchemaEntry.js +26 -0
- package/cjs/public/types/notificationSchemaEntry.js.map +1 -0
- package/cjs/public/types/sudoNotification.js +29 -0
- package/cjs/public/types/sudoNotification.js.map +1 -0
- package/cjs/public/types/sudoNotificationClientOptions.js +8 -0
- package/cjs/public/types/sudoNotificationClientOptions.js.map +1 -0
- package/cjs/public/types/sudoNotificationData.js +25 -0
- package/cjs/public/types/sudoNotificationData.js.map +1 -0
- package/cjs/public/types/sudoNotificationFilterClient.js +8 -0
- package/cjs/public/types/sudoNotificationFilterClient.js.map +1 -0
- package/lib/gen/graphqlTypes.js +31 -0
- package/lib/gen/graphqlTypes.js.map +1 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/lib/private/apiClient.js +135 -0
- package/lib/private/apiClient.js.map +1 -0
- package/lib/private/codecs/sudoPlatformPayloadCodec.js +17 -0
- package/lib/private/codecs/sudoPlatformPayloadCodec.js.map +1 -0
- package/lib/private/constants.js +7 -0
- package/lib/private/constants.js.map +1 -0
- package/lib/private/transformers/buildTypeTransformer.js +26 -0
- package/lib/private/transformers/buildTypeTransformer.js.map +1 -0
- package/lib/private/transformers/errorTransformer.js +30 -0
- package/lib/private/transformers/errorTransformer.js.map +1 -0
- package/lib/private/transformers/notificationConfigurationTransformer.js +17 -0
- package/lib/private/transformers/notificationConfigurationTransformer.js.map +1 -0
- package/lib/private/transformers/notificationEnableStatusTransformer.js +28 -0
- package/lib/private/transformers/notificationEnableStatusTransformer.js.map +1 -0
- package/lib/private/transformers/notificationMetadataTransformer.js +13 -0
- package/lib/private/transformers/notificationMetadataTransformer.js.map +1 -0
- package/lib/private/types/canonicalPushSubscriptionJSON.js +7 -0
- package/lib/private/types/canonicalPushSubscriptionJSON.js.map +1 -0
- package/lib/private/types/notifiableServiceConfig.js +8 -0
- package/lib/private/types/notifiableServiceConfig.js.map +1 -0
- package/lib/private/types/notificationServiceConfig.js +13 -0
- package/lib/private/types/notificationServiceConfig.js.map +1 -0
- package/lib/private/types/sudoNotificationClientPrivateOptions.js +2 -0
- package/lib/private/types/sudoNotificationClientPrivateOptions.js.map +1 -0
- package/lib/public/errors.js +116 -0
- package/lib/public/errors.js.map +1 -0
- package/lib/public/index.js +10 -0
- package/lib/public/index.js.map +1 -0
- package/lib/public/sudoNotifiableClient.js +102 -0
- package/lib/public/sudoNotifiableClient.js.map +1 -0
- package/lib/public/sudoNotificationClient.js +160 -0
- package/lib/public/sudoNotificationClient.js.map +1 -0
- package/lib/public/types/buildType.js +15 -0
- package/lib/public/types/buildType.js.map +1 -0
- package/lib/public/types/index.js +17 -0
- package/lib/public/types/index.js.map +1 -0
- package/lib/public/types/notificationConfiguration.js +9 -0
- package/lib/public/types/notificationConfiguration.js.map +1 -0
- package/lib/public/types/notificationDeviceInfo.js +2 -0
- package/lib/public/types/notificationDeviceInfo.js.map +1 -0
- package/lib/public/types/notificationEnabledStatus.js +11 -0
- package/lib/public/types/notificationEnabledStatus.js.map +1 -0
- package/lib/public/types/notificationFilterItem.js +31 -0
- package/lib/public/types/notificationFilterItem.js.map +1 -0
- package/lib/public/types/notificationMetadata.js +18 -0
- package/lib/public/types/notificationMetadata.js.map +1 -0
- package/lib/public/types/notificationSchemaEntry.js +22 -0
- package/lib/public/types/notificationSchemaEntry.js.map +1 -0
- package/lib/public/types/sudoNotification.js +25 -0
- package/lib/public/types/sudoNotification.js.map +1 -0
- package/lib/public/types/sudoNotificationClientOptions.js +7 -0
- package/lib/public/types/sudoNotificationClientOptions.js.map +1 -0
- package/lib/public/types/sudoNotificationData.js +21 -0
- package/lib/public/types/sudoNotificationData.js.map +1 -0
- package/lib/public/types/sudoNotificationFilterClient.js +7 -0
- package/lib/public/types/sudoNotificationFilterClient.js.map +1 -0
- package/package.json +107 -0
- package/types/gen/graphqlTypes.d.ts +229 -0
- package/types/index.d.ts +1 -0
- package/types/private/apiClient.d.ts +20 -0
- package/types/private/codecs/sudoPlatformPayloadCodec.d.ts +12 -0
- package/types/private/constants.d.ts +1 -0
- package/types/private/transformers/buildTypeTransformer.d.ts +6 -0
- package/types/private/transformers/errorTransformer.d.ts +4 -0
- package/types/private/transformers/notificationConfigurationTransformer.d.ts +6 -0
- package/types/private/transformers/notificationEnableStatusTransformer.d.ts +6 -0
- package/types/private/transformers/notificationMetadataTransformer.d.ts +5 -0
- package/types/private/types/canonicalPushSubscriptionJSON.d.ts +17 -0
- package/types/private/types/notifiableServiceConfig.d.ts +5 -0
- package/types/private/types/notificationServiceConfig.d.ts +7 -0
- package/types/private/types/sudoNotificationClientPrivateOptions.d.ts +13 -0
- package/types/public/errors.d.ts +81 -0
- package/types/public/index.d.ts +4 -0
- package/types/public/sudoNotifiableClient.d.ts +69 -0
- package/types/public/sudoNotificationClient.d.ts +109 -0
- package/types/public/types/buildType.d.ts +8 -0
- package/types/public/types/index.d.ts +11 -0
- package/types/public/types/notificationConfiguration.d.ts +6 -0
- package/types/public/types/notificationDeviceInfo.d.ts +41 -0
- package/types/public/types/notificationEnabledStatus.d.ts +4 -0
- package/types/public/types/notificationFilterItem.d.ts +13 -0
- package/types/public/types/notificationMetadata.d.ts +22 -0
- package/types/public/types/notificationSchemaEntry.d.ts +18 -0
- package/types/public/types/sudoNotification.d.ts +25 -0
- package/types/public/types/sudoNotificationClientOptions.d.ts +11 -0
- package/types/public/types/sudoNotificationData.d.ts +14 -0
- package/types/public/types/sudoNotificationFilterClient.d.ts +17 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { SendTestNotificationInput } from '../gen/graphqlTypes';
|
|
2
|
+
import { CanonicalPushSubscriptionJSON } from '../private/types/canonicalPushSubscriptionJSON';
|
|
3
|
+
import { NotificationConfiguration } from './types/notificationConfiguration';
|
|
4
|
+
import { NotificationDeviceInfo } from './types/notificationDeviceInfo';
|
|
5
|
+
import { SudoNotificationClientOptions } from './types/sudoNotificationClientOptions';
|
|
6
|
+
/**
|
|
7
|
+
* Client used to interface with the Sudo Notification Platform service.
|
|
8
|
+
*
|
|
9
|
+
* It is recommended to code to this interface, rather than the implementation class (`DefaultSudoNotificationClient`) as
|
|
10
|
+
* the implementation class is only meant to be used for initializing an instance of the client.
|
|
11
|
+
*/
|
|
12
|
+
export interface SudoNotificationClient {
|
|
13
|
+
/**
|
|
14
|
+
* Register to receive Sudo Platform web push notifications on a given
|
|
15
|
+
* Web Push API subscription.
|
|
16
|
+
*
|
|
17
|
+
* @param deviceInfo Information that identifies the user's device and application
|
|
18
|
+
* @param pushSubscription The web push subscription to register
|
|
19
|
+
*
|
|
20
|
+
* @throws NotSignedInError if user is not signed in
|
|
21
|
+
* @throws DeviceAlreadyRegisteredError if the same subscription has already been registered
|
|
22
|
+
* @throws DeviceCreateError if some other issue registering the subscription occurs
|
|
23
|
+
*/
|
|
24
|
+
registerPushSubscription(deviceInfo: NotificationDeviceInfo, pushSubscription: PushSubscription): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Update registration for the user with new push subscription information.
|
|
27
|
+
*
|
|
28
|
+
* @param deviceInfo Information that identifies the user's device and application
|
|
29
|
+
* @param pushSubscription
|
|
30
|
+
* Push subscription to update. The push subscription's endpoint must be
|
|
31
|
+
* the same. The only reason to update is to change the subscription's
|
|
32
|
+
* expiration.
|
|
33
|
+
*
|
|
34
|
+
* @throws {@link DeviceNotFoundError} if the push subscription has not been registered
|
|
35
|
+
* @throws {@link DeviceUpdateError} if the device update fails
|
|
36
|
+
*/
|
|
37
|
+
updatePushSubscription(deviceInfo: NotificationDeviceInfo, pushSubscription: PushSubscription): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Deregister a push subscription for the user
|
|
40
|
+
*
|
|
41
|
+
* @param deviceInfo Information that identifies the user's device and application
|
|
42
|
+
*
|
|
43
|
+
* @throws {@link DeviceNotFoundError} if the push subscription has not been registered
|
|
44
|
+
* @throws {@link DeviceDeleteError} if the deregistration fails
|
|
45
|
+
*/
|
|
46
|
+
deregisterPushSubscription(deviceInfo: NotificationDeviceInfo): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Get the user's current set of notification configurations for a push
|
|
49
|
+
* subscription.
|
|
50
|
+
*
|
|
51
|
+
* @param deviceInfo Information that identifies the user's device and application
|
|
52
|
+
*
|
|
53
|
+
* @throws {@link DeviceNotFoundError} if the device has not been registered
|
|
54
|
+
* @throws {@link DeviceReadError} if the retrieval fails for some other reason
|
|
55
|
+
*/
|
|
56
|
+
getNotificationConfiguration(deviceInfo: NotificationDeviceInfo): Promise<NotificationConfiguration>;
|
|
57
|
+
/**
|
|
58
|
+
* Set the notification configuration for the user.
|
|
59
|
+
*
|
|
60
|
+
* @param deviceInfo Information that identifies the user's device and application
|
|
61
|
+
*
|
|
62
|
+
* @throws {@link DeviceNotFoundError} if the device has not been registered
|
|
63
|
+
* @throws {@link SchemaValidationError} if the retrieval fails for some other reason
|
|
64
|
+
*/
|
|
65
|
+
setNotificationConfiguration(deviceInfo: NotificationDeviceInfo, config: NotificationConfiguration): Promise<void>;
|
|
66
|
+
/** @ignore */
|
|
67
|
+
sendTestNotification(input: SendTestNotificationInput): Promise<boolean>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Default {@link SudoNotificationClient} for use by Sudo Platform applications.
|
|
71
|
+
*/
|
|
72
|
+
export declare class DefaultSudoNotificationClient implements SudoNotificationClient {
|
|
73
|
+
private readonly apiClient;
|
|
74
|
+
private readonly sudoUserClient;
|
|
75
|
+
private readonly notifiableServices;
|
|
76
|
+
private readonly notificationServiceConfig;
|
|
77
|
+
private readonly logger;
|
|
78
|
+
/**
|
|
79
|
+
* Constructor
|
|
80
|
+
*
|
|
81
|
+
* @param opts Constructor options
|
|
82
|
+
* {@link SudoNotificationClientOptions.sudoUserClient} user client to authenticate the user
|
|
83
|
+
* {@link SudoNotificationClientOptions.notifiableServices} array of {@link SudoNotificationFilterClient}s from
|
|
84
|
+
* other notification enabled Sudo Platform SDKs.
|
|
85
|
+
*
|
|
86
|
+
* @throws
|
|
87
|
+
* NotificationServiceConfigNotFoundError if the Sudo Platform Notification Service is
|
|
88
|
+
* deployed in the Sudo Platform environment in which the SDK is being used.
|
|
89
|
+
*
|
|
90
|
+
* @throws
|
|
91
|
+
* InvalidConfigurationError if any of the services identified in opts.notifiableServices does
|
|
92
|
+
* not have notifications enabled.
|
|
93
|
+
*/
|
|
94
|
+
constructor(opts: SudoNotificationClientOptions);
|
|
95
|
+
registerPushSubscription(deviceInfo: NotificationDeviceInfo, pushSubscription: PushSubscription): Promise<void>;
|
|
96
|
+
updatePushSubscription(deviceInfo: NotificationDeviceInfo, pushSubscription: PushSubscription): Promise<void>;
|
|
97
|
+
deregisterPushSubscription(deviceInfo: NotificationDeviceInfo): Promise<void>;
|
|
98
|
+
getNotificationConfiguration(deviceInfo: NotificationDeviceInfo): Promise<NotificationConfiguration>;
|
|
99
|
+
setNotificationConfiguration(deviceInfo: NotificationDeviceInfo, config: NotificationConfiguration): Promise<void>;
|
|
100
|
+
/** @ignore */
|
|
101
|
+
sendTestNotification(input: SendTestNotificationInput): Promise<boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* Visible for testing
|
|
104
|
+
*
|
|
105
|
+
* @ignore
|
|
106
|
+
*/
|
|
107
|
+
canonicalPushSubscriptionJson(json: PushSubscriptionJSON): CanonicalPushSubscriptionJSON;
|
|
108
|
+
private checkIsSignedInOrThrow;
|
|
109
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './buildType';
|
|
2
|
+
export * from './notificationConfiguration';
|
|
3
|
+
export * from './notificationDeviceInfo';
|
|
4
|
+
export * from './notificationEnabledStatus';
|
|
5
|
+
export * from './notificationFilterItem';
|
|
6
|
+
export * from './notificationMetadata';
|
|
7
|
+
export * from './notificationSchemaEntry';
|
|
8
|
+
export * from './sudoNotification';
|
|
9
|
+
export * from './sudoNotificationClientOptions';
|
|
10
|
+
export * from './sudoNotificationData';
|
|
11
|
+
export * from './sudoNotificationFilterClient';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BuildType } from './buildType';
|
|
2
|
+
/**
|
|
3
|
+
* Information that uniquely identifies the device and application that is
|
|
4
|
+
* registering to receive web push notifications. Device IDs a scoped
|
|
5
|
+
* by the user's subject ID and applications' bundle ID and so only needs
|
|
6
|
+
* to be unique among all the user's devices. If bundle ID is shared across
|
|
7
|
+
* platforms then the device ID should be further qualified by platform by
|
|
8
|
+
* the consuming application.
|
|
9
|
+
*
|
|
10
|
+
* Notifications are sent to a subscription associated with a particular
|
|
11
|
+
* device ID, and the device ID is used to contain the notification filter
|
|
12
|
+
* configuration i.e. the rules for which notifications the user wants
|
|
13
|
+
* to receive on the particular device. Consuming applications may need to
|
|
14
|
+
* derive the device ID in a consistent way from the browser environment
|
|
15
|
+
* or persist a generated random device ID.
|
|
16
|
+
*/
|
|
17
|
+
export interface NotificationDeviceInfo {
|
|
18
|
+
/**
|
|
19
|
+
* ID representing user and device that perists beyond
|
|
20
|
+
* lifetime of a single push subscription
|
|
21
|
+
*/
|
|
22
|
+
deviceId: string;
|
|
23
|
+
/**
|
|
24
|
+
* Reverse DNS name idenfifying the application. For example
|
|
25
|
+
* com.sudoplatform.examples.notification.
|
|
26
|
+
*/
|
|
27
|
+
bundleId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Type of build. Allows for separate keys to be used in debug vs production
|
|
30
|
+
* environments.
|
|
31
|
+
*/
|
|
32
|
+
buildType: BuildType;
|
|
33
|
+
/**
|
|
34
|
+
* Version of the application.
|
|
35
|
+
*/
|
|
36
|
+
appVersion: string;
|
|
37
|
+
/**
|
|
38
|
+
* User's locale.
|
|
39
|
+
*/
|
|
40
|
+
locale: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NotificationEnableStatus } from './notificationEnabledStatus';
|
|
2
|
+
export declare class NotificationFilterItem {
|
|
3
|
+
static readonly DEFAULT_RULE_STRING = "{\"==\": [1, 1]}";
|
|
4
|
+
private readonly _name;
|
|
5
|
+
private readonly _status;
|
|
6
|
+
private readonly _rules;
|
|
7
|
+
private readonly _meta;
|
|
8
|
+
constructor(name: string, status: boolean | undefined, rules: string | undefined, meta: string | undefined);
|
|
9
|
+
get name(): string;
|
|
10
|
+
get status(): NotificationEnableStatus;
|
|
11
|
+
get rules(): string;
|
|
12
|
+
get meta(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NotificationSchemaEntry } from './notificationSchemaEntry';
|
|
2
|
+
/**
|
|
3
|
+
* Definition of all filterable notification properties of a specific
|
|
4
|
+
* service.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NotificationMetadata {
|
|
7
|
+
/**
|
|
8
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding service's configuration
|
|
9
|
+
* section within sudoplatformconfig.json
|
|
10
|
+
*/
|
|
11
|
+
readonly serviceName: string;
|
|
12
|
+
/** Array of schema entries, one for each filterable property */
|
|
13
|
+
readonly schema: ReadonlyArray<NotificationSchemaEntry>;
|
|
14
|
+
constructor(
|
|
15
|
+
/**
|
|
16
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding service's configuration
|
|
17
|
+
* section within sudoplatformconfig.json
|
|
18
|
+
*/
|
|
19
|
+
serviceName: string,
|
|
20
|
+
/** Array of schema entries, one for each filterable property */
|
|
21
|
+
schema: ReadonlyArray<NotificationSchemaEntry>);
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema of a single filterable property of a notification
|
|
3
|
+
*/
|
|
4
|
+
export declare class NotificationSchemaEntry {
|
|
5
|
+
/** Description of the filterable property */
|
|
6
|
+
readonly description: string;
|
|
7
|
+
/** Name of the filterable property */
|
|
8
|
+
readonly fieldName: string;
|
|
9
|
+
/** Type of the filterable property */
|
|
10
|
+
readonly type: string;
|
|
11
|
+
constructor(
|
|
12
|
+
/** Description of the filterable property */
|
|
13
|
+
description: string,
|
|
14
|
+
/** Name of the filterable property */
|
|
15
|
+
fieldName: string,
|
|
16
|
+
/** Type of the filterable property */
|
|
17
|
+
type: string);
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base SudoNotification class. Service specific SDKs provide concrete classes extending this
|
|
3
|
+
* base class that will be returned by SudoNotifiableClient.decodeData.
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class SudoNotification {
|
|
6
|
+
/**
|
|
7
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding
|
|
8
|
+
* service's configuration section within sudoplatformconfig.json
|
|
9
|
+
*/
|
|
10
|
+
readonly serviceName: string;
|
|
11
|
+
/**
|
|
12
|
+
* Service specific type of notification.
|
|
13
|
+
*/
|
|
14
|
+
readonly type: string;
|
|
15
|
+
constructor(
|
|
16
|
+
/**
|
|
17
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding
|
|
18
|
+
* service's configuration section within sudoplatformconfig.json
|
|
19
|
+
*/
|
|
20
|
+
serviceName: string,
|
|
21
|
+
/**
|
|
22
|
+
* Service specific type of notification.
|
|
23
|
+
*/
|
|
24
|
+
type: string);
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SudoUserClient } from '@sudoplatform/sudo-user';
|
|
2
|
+
import { SudoNotificationFilterClient } from './sudoNotificationFilterClient';
|
|
3
|
+
/**
|
|
4
|
+
* Options passed in to DefaultSudoNotificationClient's constructor
|
|
5
|
+
*/
|
|
6
|
+
export interface SudoNotificationClientOptions {
|
|
7
|
+
/** Sudo User client to use. No default */
|
|
8
|
+
sudoUserClient: SudoUserClient;
|
|
9
|
+
/** Array of notifiable Sudo Platform services */
|
|
10
|
+
notifiableServices: SudoNotificationFilterClient[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class SudoNotificationData {
|
|
2
|
+
readonly serviceName: string;
|
|
3
|
+
readonly data?: string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param serviceName
|
|
7
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding
|
|
8
|
+
* service's configuration section within sudoplatformconfig.json
|
|
9
|
+
*
|
|
10
|
+
* @param data
|
|
11
|
+
* Opaque, serialized service specific notification data
|
|
12
|
+
*/
|
|
13
|
+
constructor(serviceName: string, data?: string | undefined);
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NotificationMetadata } from './notificationMetadata';
|
|
2
|
+
/**
|
|
3
|
+
* Client used to provide filter schema information to the notification SDk. Each Sudo Platform service SDK that has
|
|
4
|
+
* notifications provides an implementation of this protocol that must be passed to `DefaultSudoNotificationClient`
|
|
5
|
+
* on construction.
|
|
6
|
+
*/
|
|
7
|
+
export interface SudoNotificationFilterClient {
|
|
8
|
+
/**
|
|
9
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding service's configuration
|
|
10
|
+
* section within sudoplatformconfig.json
|
|
11
|
+
*/
|
|
12
|
+
serviceName: string;
|
|
13
|
+
/**
|
|
14
|
+
* Return the schema describing properties available for filtering for the specific service
|
|
15
|
+
*/
|
|
16
|
+
getSchema(): NotificationMetadata;
|
|
17
|
+
}
|