@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,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SchemaValidationError = exports.DuplicateNotifiableClientError = exports.DuplicateNotificationFilterClientError = exports.DeviceDeleteError = exports.DeviceUpdateError = exports.DeviceReadError = exports.DeviceCreateError = exports.DeviceNotFoundError = exports.DeviceAlreadyRegisteredError = exports.InvalidPushSubscriptionError = exports.InvalidConfigurationError = exports.NotificationServiceConfigNotFoundError = void 0;
|
|
9
|
+
class NotificationError extends Error {
|
|
10
|
+
constructor(msg) {
|
|
11
|
+
super(msg);
|
|
12
|
+
this.name = this.constructor.name;
|
|
13
|
+
if (Error.captureStackTrace) {
|
|
14
|
+
Error.captureStackTrace(this, this.constructor);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The configuration has not been initialized for the Notification Client.
|
|
20
|
+
*/
|
|
21
|
+
class NotificationServiceConfigNotFoundError extends NotificationError {
|
|
22
|
+
constructor(msg) {
|
|
23
|
+
super(msg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.NotificationServiceConfigNotFoundError = NotificationServiceConfigNotFoundError;
|
|
27
|
+
/**
|
|
28
|
+
* A specified notifiable service is not configured as notifiable.
|
|
29
|
+
*/
|
|
30
|
+
class InvalidConfigurationError extends NotificationError {
|
|
31
|
+
constructor(serviceName) {
|
|
32
|
+
super(serviceName);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.InvalidConfigurationError = InvalidConfigurationError;
|
|
36
|
+
/**
|
|
37
|
+
* The PushSubscription passed to the SDK when calling registerPushSubscription
|
|
38
|
+
* or updatePushSubscription is not formed as expected. The PushSubscription
|
|
39
|
+
* must have an endpoint and auth and p256dh keys.
|
|
40
|
+
*/
|
|
41
|
+
class InvalidPushSubscriptionError extends NotificationError {
|
|
42
|
+
constructor(property) {
|
|
43
|
+
super(property);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.InvalidPushSubscriptionError = InvalidPushSubscriptionError;
|
|
47
|
+
/**
|
|
48
|
+
* The device or push subscription is already registered.
|
|
49
|
+
*/
|
|
50
|
+
class DeviceAlreadyRegisteredError extends NotificationError {
|
|
51
|
+
constructor(msg) {
|
|
52
|
+
super(msg);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.DeviceAlreadyRegisteredError = DeviceAlreadyRegisteredError;
|
|
56
|
+
/**
|
|
57
|
+
* The device or push subscription could not be found
|
|
58
|
+
*/
|
|
59
|
+
class DeviceNotFoundError extends NotificationError {
|
|
60
|
+
constructor(msg) {
|
|
61
|
+
super(msg);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.DeviceNotFoundError = DeviceNotFoundError;
|
|
65
|
+
/**
|
|
66
|
+
* The device or push subscription could not be registered
|
|
67
|
+
*/
|
|
68
|
+
class DeviceCreateError extends NotificationError {
|
|
69
|
+
constructor(msg) {
|
|
70
|
+
super(msg);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.DeviceCreateError = DeviceCreateError;
|
|
74
|
+
/**
|
|
75
|
+
* The device or push subscription could not be read
|
|
76
|
+
*/
|
|
77
|
+
class DeviceReadError extends NotificationError {
|
|
78
|
+
constructor(msg) {
|
|
79
|
+
super(msg);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.DeviceReadError = DeviceReadError;
|
|
83
|
+
/**
|
|
84
|
+
* The device or push subscription could not be updated
|
|
85
|
+
*/
|
|
86
|
+
class DeviceUpdateError extends NotificationError {
|
|
87
|
+
constructor(msg) {
|
|
88
|
+
super(msg);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.DeviceUpdateError = DeviceUpdateError;
|
|
92
|
+
/**
|
|
93
|
+
* The device or push subscription could not be deleted
|
|
94
|
+
*/
|
|
95
|
+
class DeviceDeleteError extends NotificationError {
|
|
96
|
+
constructor(msg) {
|
|
97
|
+
super(msg);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.DeviceDeleteError = DeviceDeleteError;
|
|
101
|
+
/**
|
|
102
|
+
* More than one SudoNotificationFilterClient for the given service name is
|
|
103
|
+
* being registered. At most one is permitted per service.
|
|
104
|
+
*/
|
|
105
|
+
class DuplicateNotificationFilterClientError extends NotificationError {
|
|
106
|
+
constructor(serviceName) {
|
|
107
|
+
super(serviceName);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.DuplicateNotificationFilterClientError = DuplicateNotificationFilterClientError;
|
|
111
|
+
/**
|
|
112
|
+
* More than one SudoNotifiableClient for the given service name is
|
|
113
|
+
* being registered. At most one is permitted per service.
|
|
114
|
+
*/
|
|
115
|
+
class DuplicateNotifiableClientError extends NotificationError {
|
|
116
|
+
constructor(serviceName) {
|
|
117
|
+
super(serviceName);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.DuplicateNotifiableClientError = DuplicateNotifiableClientError;
|
|
121
|
+
/**
|
|
122
|
+
* The metadata schema information passed when setting notification configuration
|
|
123
|
+
* setting is not valid.
|
|
124
|
+
*/
|
|
125
|
+
class SchemaValidationError extends NotificationError {
|
|
126
|
+
constructor(message) {
|
|
127
|
+
super(message);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.SchemaValidationError = SchemaValidationError;
|
|
131
|
+
//# sourceMappingUR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GAEG;AACH,MAAa,eAAgB,SAAQ,iBAAiB;IACpD,YAAY,GAAY;QACtB,KAAK,CAAC,GAAG,CAAC,CAAA;IACZ,CAAC;CACF;AAJD,0CAIC;AAED;;GAEG;AACH,MAAa,iBAAkB,SAAQ,iBAAiB;IACtD,YAAY,GAAY;QACtB,KAAK,CAAC,GAAG,CAAC,CAAA;IACZ,CAAC;CACF;AAJD,8CAIC;AAED;;GAEG;AACH,MAAa,iBAAkB,SAAQ,iBAAiB;IACtD,YAAY,GAAY;QACtB,KAAK,CAAC,GAAG,CAAC,CAAA;IACZ,CAAC;CACF;AAJD,8CAIC;AAED;;;GAGG;AACH,MAAa,sCAAuC,SAAQ,iBAAiB;IAC3E,YAAY,WAAmB;QAC7B,KAAK,CAAC,WAAW,CAAC,CAAA;IACpB,CAAC;CACF;AAJD,wFAIC;AAED;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,iBAAiB;IACnE,YAAY,WAAmB;QAC7B,KAAK,CAAC,WAAW,CAAC,CAAA;IACpB,CAAC;CACF;AAJD,wEAIC;AAED;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;CACF;AAJD,sDAIC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/*
|
|
5
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
tslib_1.__exportStar(require("./errors"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./sudoNotifiableClient"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./sudoNotificationClient"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./types/index"), exports);
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/public/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,mDAAwB;AACxB,iEAAsC;AACtC,mEAAwC;AACxC,wDAA6B"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DefaultSudoNotifiableClient = void 0;
|
|
9
|
+
const sudo_common_1 = require("@sudoplatform/sudo-common");
|
|
10
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
11
|
+
const PathReporter_1 = require("io-ts/PathReporter");
|
|
12
|
+
const sudoPlatformPayloadCodec_1 = require("../private/codecs/sudoPlatformPayloadCodec");
|
|
13
|
+
const errors_1 = require("./errors");
|
|
14
|
+
const sudoNotificationData_1 = require("./types/sudoNotificationData");
|
|
15
|
+
/**
|
|
16
|
+
* Client used to decode notification payload data specific to Sudo Platform services used by an application
|
|
17
|
+
*
|
|
18
|
+
* This client is light weight and suitable for use within a Notification Extension
|
|
19
|
+
*/
|
|
20
|
+
class DefaultSudoNotifiableClient {
|
|
21
|
+
/**
|
|
22
|
+
* Construct a new instance
|
|
23
|
+
*
|
|
24
|
+
* @param notifiableClients
|
|
25
|
+
* Array of SudoNotifiableClient implementations. Provide one for each Sudo Platform
|
|
26
|
+
* notification emitting service consumed by your application.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link DuplicateNotifiableClientError}
|
|
29
|
+
* if more than one {@link SudoNotifiableClient} is provided for a particular
|
|
30
|
+
* Sudo Platform service.
|
|
31
|
+
*/
|
|
32
|
+
constructor(notifiableClients, logger = new sudo_common_1.DefaultLogger('DefaultSudoNotifiableClient')) {
|
|
33
|
+
this.logger = logger;
|
|
34
|
+
this.notifiableClients = {};
|
|
35
|
+
notifiableClients.forEach((notifiableClient) => {
|
|
36
|
+
if (this.notifiableClients[notifiableClient.serviceName]) {
|
|
37
|
+
throw new errors_1.DuplicateNotifiableClientError(notifiableClient.serviceName);
|
|
38
|
+
}
|
|
39
|
+
this.notifiableClients[notifiableClient.serviceName] = notifiableClient;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Extract encoded Sudo Platform notification specific data from a Web Push API PushEvent
|
|
44
|
+
* if it is present.
|
|
45
|
+
*
|
|
46
|
+
* @param event PushEvent to extract data from
|
|
47
|
+
*
|
|
48
|
+
* @returns If the notification payload contains Sudo Platform notification specific data, a
|
|
49
|
+
* {@link SudoNotificationData} is returned that should then be passed to {@link decodeData}.
|
|
50
|
+
* If no Sudo Platform notification specific data is present, then undefined is returned.
|
|
51
|
+
*/
|
|
52
|
+
extractData(event) {
|
|
53
|
+
let payload;
|
|
54
|
+
let payloadErr;
|
|
55
|
+
try {
|
|
56
|
+
payload = event.data?.json();
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
payloadErr = err;
|
|
60
|
+
}
|
|
61
|
+
if (!payload) {
|
|
62
|
+
this.logger.debug('Not handling notification that does not contain a JSON payload', { err: payloadErr, data: event.data });
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
const sudoplatformPayloadDecodeResult = sudoPlatformPayloadCodec_1.SudoPlatformPayloadCodec.decode(payload);
|
|
66
|
+
if ((0, Either_1.isLeft)(sudoplatformPayloadDecodeResult)) {
|
|
67
|
+
this.logger.debug('Not handling notification that cannot be decoded as a SudoPlatform payload', { errors: PathReporter_1.PathReporter.report(sudoplatformPayloadDecodeResult) });
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const sudoplatform = sudoplatformPayloadDecodeResult.right.sudoplatform;
|
|
71
|
+
const serviceName = sudoplatform.servicename;
|
|
72
|
+
if (!serviceName) {
|
|
73
|
+
this.logger.debug('Not handling notification without sudoplatform.servicename');
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
const data = sudoplatform.data;
|
|
77
|
+
return new sudoNotificationData_1.SudoNotificationData(serviceName, data);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Decode Sudo Notification specific data to a service specific instance of a SudoNotification
|
|
81
|
+
* Calls the {@link SudoNotifiableClient.decode} method of the service specific
|
|
82
|
+
* {@link SudoNotifiableClient}
|
|
83
|
+
*
|
|
84
|
+
* @param data {@link SudoNotificationData} to decode
|
|
85
|
+
*
|
|
86
|
+
* @returns
|
|
87
|
+
* Service specific implementation of {@link SudoNotification} or undefined if
|
|
88
|
+
* data contains no data to decode
|
|
89
|
+
*/
|
|
90
|
+
decodeData(data) {
|
|
91
|
+
const notifiableClient = this.notifiableClients[data.serviceName];
|
|
92
|
+
if (!notifiableClient) {
|
|
93
|
+
this.logger.debug(`No registered notifiable client for service ${data.serviceName} notification`, { registered: Object.keys(this.notifiableClients) });
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
const dataToDecode = data.data;
|
|
97
|
+
if (!dataToDecode) {
|
|
98
|
+
this.logger.debug(`No data to decode for ${data.serviceName} notification`);
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
this.logger.debug(`Decoding notification for service ${data.serviceName}`);
|
|
102
|
+
return notifiableClient.decode(dataToDecode);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.DefaultSudoNotifiableClient = DefaultSudoNotifiableClient;
|
|
106
|
+
//# sourceMappingURL=sudoNotifiableClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sudoNotifiableClient.js","sourceRoot":"","sources":["../../src/public/sudoNotifiableClient.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2DAAyD;AACzD,6CAAyC;AACzC,qDAAiD;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0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DefaultSudoNotificationClient = void 0;
|
|
9
|
+
const sudo_common_1 = require("@sudoplatform/sudo-common");
|
|
10
|
+
const graphqlTypes_1 = require("../gen/graphqlTypes");
|
|
11
|
+
const apiClient_1 = require("../private/apiClient");
|
|
12
|
+
const constants_1 = require("../private/constants");
|
|
13
|
+
const buildTypeTransformer_1 = require("../private/transformers/buildTypeTransformer");
|
|
14
|
+
const notificationConfigurationTransformer_1 = require("../private/transformers/notificationConfigurationTransformer");
|
|
15
|
+
const notificationMetadataTransformer_1 = require("../private/transformers/notificationMetadataTransformer");
|
|
16
|
+
const notifiableServiceConfig_1 = require("../private/types/notifiableServiceConfig");
|
|
17
|
+
const notificationServiceConfig_1 = require("../private/types/notificationServiceConfig");
|
|
18
|
+
const errors_1 = require("./errors");
|
|
19
|
+
/**
|
|
20
|
+
* Default {@link SudoNotificationClient} for use by Sudo Platform applications.
|
|
21
|
+
*/
|
|
22
|
+
class DefaultSudoNotificationClient {
|
|
23
|
+
/**
|
|
24
|
+
* Constructor
|
|
25
|
+
*
|
|
26
|
+
* @param opts Constructor options
|
|
27
|
+
* {@link SudoNotificationClientOptions.sudoUserClient} user client to authenticate the user
|
|
28
|
+
* {@link SudoNotificationClientOptions.notifiableServices} array of {@link SudoNotificationFilterClient}s from
|
|
29
|
+
* other notification enabled Sudo Platform SDKs.
|
|
30
|
+
*
|
|
31
|
+
* @throws
|
|
32
|
+
* NotificationServiceConfigNotFoundError if the Sudo Platform Notification Service is
|
|
33
|
+
* deployed in the Sudo Platform environment in which the SDK is being used.
|
|
34
|
+
*
|
|
35
|
+
* @throws
|
|
36
|
+
* InvalidConfigurationError if any of the services identified in opts.notifiableServices does
|
|
37
|
+
* not have notifications enabled.
|
|
38
|
+
*/
|
|
39
|
+
constructor(opts) {
|
|
40
|
+
this.notifiableServices = [];
|
|
41
|
+
this.logger = new sudo_common_1.DefaultLogger('DefaultSudoNotificationClient');
|
|
42
|
+
const privateOptions = opts;
|
|
43
|
+
this.sudoUserClient = opts.sudoUserClient;
|
|
44
|
+
this.apiClient = privateOptions?.apiClient ?? new apiClient_1.ApiClient();
|
|
45
|
+
const configurationManager = privateOptions.configurationManager ??
|
|
46
|
+
sudo_common_1.DefaultConfigurationManager.getInstance();
|
|
47
|
+
try {
|
|
48
|
+
this.notificationServiceConfig =
|
|
49
|
+
configurationManager.bindConfigSet(notificationServiceConfig_1.NotificationServiceConfigCodec, constants_1.SERVICE_NAME);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
this.logger.error('unable to read notificationService configuration from sudoplatform.json', { err });
|
|
53
|
+
throw new errors_1.NotificationServiceConfigNotFoundError();
|
|
54
|
+
}
|
|
55
|
+
for (const notifiableService of opts.notifiableServices) {
|
|
56
|
+
const notifiableServiceConfig = configurationManager.bindConfigSet(notifiableServiceConfig_1.NotifiableServiceConfigCodec, notifiableService.serviceName);
|
|
57
|
+
if (!notifiableServiceConfig.notifiable) {
|
|
58
|
+
throw new errors_1.InvalidConfigurationError(notifiableService.serviceName);
|
|
59
|
+
}
|
|
60
|
+
if (this.notifiableServices.some((n) => n.serviceName === notifiableService.serviceName)) {
|
|
61
|
+
throw new errors_1.DuplicateNotificationFilterClientError(notifiableService.serviceName);
|
|
62
|
+
}
|
|
63
|
+
this.notifiableServices.push(notifiableService);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async registerPushSubscription(deviceInfo, pushSubscription) {
|
|
67
|
+
await this.checkIsSignedInOrThrow();
|
|
68
|
+
const token = this.canonicalPushSubscriptionJson(pushSubscription.toJSON());
|
|
69
|
+
const tokenString = JSON.stringify(token);
|
|
70
|
+
await this.apiClient.registerAppOnDevice({
|
|
71
|
+
standardToken: tokenString,
|
|
72
|
+
build: buildTypeTransformer_1.BuildTypeTransformer.toGraphQL(deviceInfo.buildType),
|
|
73
|
+
bundleId: deviceInfo.bundleId,
|
|
74
|
+
version: deviceInfo.appVersion,
|
|
75
|
+
locale: deviceInfo.locale,
|
|
76
|
+
clientEnv: graphqlTypes_1.ClientEnvType.Web,
|
|
77
|
+
deviceId: deviceInfo.deviceId,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async updatePushSubscription(deviceInfo, pushSubscription) {
|
|
81
|
+
await this.checkIsSignedInOrThrow();
|
|
82
|
+
const token = this.canonicalPushSubscriptionJson(pushSubscription.toJSON());
|
|
83
|
+
const tokenString = JSON.stringify(token);
|
|
84
|
+
await this.apiClient.updateDeviceInfo({
|
|
85
|
+
standardToken: tokenString,
|
|
86
|
+
build: buildTypeTransformer_1.BuildTypeTransformer.toGraphQL(deviceInfo.buildType),
|
|
87
|
+
bundleId: deviceInfo.bundleId,
|
|
88
|
+
version: deviceInfo.appVersion,
|
|
89
|
+
locale: deviceInfo.locale,
|
|
90
|
+
deviceId: deviceInfo.deviceId,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async deregisterPushSubscription(deviceInfo) {
|
|
94
|
+
await this.checkIsSignedInOrThrow();
|
|
95
|
+
await this.apiClient.deleteAppFromDevice({
|
|
96
|
+
bundleId: deviceInfo.bundleId,
|
|
97
|
+
deviceId: deviceInfo.deviceId,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async getNotificationConfiguration(deviceInfo) {
|
|
101
|
+
await this.checkIsSignedInOrThrow();
|
|
102
|
+
const settings = await this.apiClient.getNotificationSettings({
|
|
103
|
+
bundleId: deviceInfo.bundleId,
|
|
104
|
+
deviceId: deviceInfo.deviceId,
|
|
105
|
+
});
|
|
106
|
+
return notificationConfigurationTransformer_1.NotificationConfigurationTransformer.toAPI(settings);
|
|
107
|
+
}
|
|
108
|
+
async setNotificationConfiguration(deviceInfo, config) {
|
|
109
|
+
await this.checkIsSignedInOrThrow();
|
|
110
|
+
const services = this.notifiableServices
|
|
111
|
+
.map((client) => client.getSchema())
|
|
112
|
+
.map((schema) => notificationMetadataTransformer_1.NotificationMetadataTransformer.toGraphQL(schema));
|
|
113
|
+
await this.apiClient.updateNotificationSettings({
|
|
114
|
+
bundleId: deviceInfo.bundleId,
|
|
115
|
+
deviceId: deviceInfo.deviceId,
|
|
116
|
+
filter: notificationConfigurationTransformer_1.NotificationConfigurationTransformer.toGraphQLFilters(config),
|
|
117
|
+
services,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** @ignore */
|
|
121
|
+
async sendTestNotification(input) {
|
|
122
|
+
if (!this.notificationServiceConfig.testNotificationsAvailable) {
|
|
123
|
+
throw new sudo_common_1.OperationNotImplementedError();
|
|
124
|
+
}
|
|
125
|
+
await this.checkIsSignedInOrThrow();
|
|
126
|
+
return await this.apiClient.sendTestNotification(input);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Visible for testing
|
|
130
|
+
*
|
|
131
|
+
* @ignore
|
|
132
|
+
*/
|
|
133
|
+
canonicalPushSubscriptionJson(json) {
|
|
134
|
+
if (!json.endpoint) {
|
|
135
|
+
throw new errors_1.InvalidPushSubscriptionError('endpoint');
|
|
136
|
+
}
|
|
137
|
+
const authKey = json.keys?.['auth'];
|
|
138
|
+
if (!authKey) {
|
|
139
|
+
throw new errors_1.InvalidPushSubscriptionError('keys.auth');
|
|
140
|
+
}
|
|
141
|
+
const p256DHKey = json.keys?.['p256dh'];
|
|
142
|
+
if (!p256DHKey) {
|
|
143
|
+
throw new errors_1.InvalidPushSubscriptionError('keys.p256dh');
|
|
144
|
+
}
|
|
145
|
+
const canonical = {
|
|
146
|
+
endpoint: json.endpoint,
|
|
147
|
+
keys: {
|
|
148
|
+
auth: authKey,
|
|
149
|
+
p256dh: p256DHKey,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
if (json.expirationTime !== undefined && json.expirationTime !== null) {
|
|
153
|
+
canonical.expirationTime = json.expirationTime;
|
|
154
|
+
}
|
|
155
|
+
return canonical;
|
|
156
|
+
}
|
|
157
|
+
async checkIsSignedInOrThrow() {
|
|
158
|
+
if (!(await this.sudoUserClient.isSignedIn())) {
|
|
159
|
+
throw new sudo_common_1.NotSignedInError();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.DefaultSudoNotificationClient = DefaultSudoNotificationClient;
|
|
164
|
+
//# sourceMappingURL=sudoNotificationClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sudoNotificationClient.js","sourceRoot":"","sources":["../../src/public/sudoNotificationClient.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2DAKkC;AAElC,sDAA8E;AAC9E,oDAAgD;AAChD,oDAAmD;AACnD,uFAAmF;AACnF,uHAAmH;AACnH,6GAAyG;AAEzG,sFAGiD;AACjD,0FAGmD;AAEnD,qCAKiB;AAsFjB;;GAEG;AACH,MAAa,6BAA6B;IAOxC;;;;;;;;;;;;;;;OAeG;IACH,YAAmB,IAAmC;QApBrC,uBAAkB,GAAmC,EAAE,CAAA;QAEvD,WAAM,GAAG,IAAI,2BAAa,CAAC,+BAA+B,CAAC,CAAA;QAmB1E,MAAM,cAAc,GAAG,IAA4C,CAAA;QAEnE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QAEzC,IAAI,CAAC,SAAS,GAAG,cAAc,EAAE,SAAS,IAAI,IAAI,qBAAS,EAAE,CAAA;QAE7D,MAAM,oBAAoB,GACxB,cAAc,CAAC,oBAAoB;YACnC,yCAA2B,CAAC,WAAW,EAAE,CAAA;QAE3C,IAAI,CAAC;YACH,IAAI,CAAC,yBAAyB;gBAC5B,oBAAoB,CAAC,aAAa,CAChC,0DAA8B,EAC9B,wBAAY,CACb,CAAA;QACL,CAAC;QAAC,OAAO,GA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ACrD,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAA;QACvC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,qCAA4B,CAAC,aAAa,CAAC,CAAA;QACvD,CAAC;QAED,MAAM,SAAS,GAAkC;YAC/C,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,SAAS;aAClB;SACF,CAAA;QACD,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;YACtE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QAChD,CAAC;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;IAEO,KAAK,CAAC,sBAAsB;QAClC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,8BAAgB,EAAE,CAAA;QAC9B,CAAC;IACH,CAAC;CACF;AA/MD,sEA+MC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BuildType = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* Build type fo the host application. Allows use of separate VAPID
|
|
11
|
+
* keys between debug and release deployments of the same application.
|
|
12
|
+
*/
|
|
13
|
+
var BuildType;
|
|
14
|
+
(function (BuildType) {
|
|
15
|
+
BuildType["RELEASE"] = "RELEASE";
|
|
16
|
+
BuildType["DEBUG"] = "DEBUG";
|
|
17
|
+
})(BuildType || (exports.BuildType = BuildType = {}));
|
|
18
|
+
//# sourceMappingURL=buildType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildType.js","sourceRoot":"","sources":["../../../src/public/types/buildType.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;GAGG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,4BAAe,CAAA;AACjB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
/*
|
|
5
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
tslib_1.__exportStar(require("./buildType"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./notificationConfiguration"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./notificationDeviceInfo"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./notificationEnabledStatus"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./notificationFilterItem"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./notificationMetadata"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./notificationSchemaEntry"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./sudoNotification"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./sudoNotificationClientOptions"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./sudoNotificationData"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./sudoNotificationFilterClient"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/public/types/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,sDAA2B;AAC3B,sEAA2C;AAC3C,mEAAwC;AACxC,sEAA2C;AAC3C,mEAAwC;AACxC,iEAAsC;AACtC,oEAAyC;AACzC,6DAAkC;AAClC,0EAA+C;AAC/C,iEAAsC;AACtC,yEAA8C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationConfiguration = void 0;
|
|
4
|
+
class NotificationConfiguration {
|
|
5
|
+
constructor(configs) {
|
|
6
|
+
this._configs = configs;
|
|
7
|
+
}
|
|
8
|
+
get configs() {
|
|
9
|
+
return this._configs;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.NotificationConfiguration = NotificationConfiguration;
|
|
13
|
+
//# sourceMappingURL=notificationConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationConfiguration.js","sourceRoot":"","sources":["../../../src/public/types/notificationConfiguration.ts"],"names":[],"mappings":";;;AAOA,MAAa,yBAAyB;IAGpC,YAAmB,OAAiC;QAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;CACF;AAVD,8DAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationDeviceInfo.js","sourceRoot":"","sources":["../../../src/public/types/notificationDeviceInfo.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationEnableStatus = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
var NotificationEnableStatus;
|
|
10
|
+
(function (NotificationEnableStatus) {
|
|
11
|
+
NotificationEnableStatus["Enable"] = "ENABLE";
|
|
12
|
+
NotificationEnableStatus["Disable"] = "DISABLE";
|
|
13
|
+
})(NotificationEnableStatus || (exports.NotificationEnableStatus = NotificationEnableStatus = {}));
|
|
14
|
+
//# sourceMappingURL=notificationEnabledStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationEnabledStatus.js","sourceRoot":"","sources":["../../../src/public/types/notificationEnabledStatus.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,6CAAiB,CAAA;IACjB,+CAAmB,CAAA;AACrB,CAAC,EAHW,wBAAwB,wCAAxB,wBAAwB,QAGnC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationFilterItem = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
const notificationEnabledStatus_1 = require("./notificationEnabledStatus");
|
|
10
|
+
class NotificationFilterItem {
|
|
11
|
+
constructor(name, status, rules, meta) {
|
|
12
|
+
status ?? (status = true);
|
|
13
|
+
this._name = name;
|
|
14
|
+
this._status = status
|
|
15
|
+
? notificationEnabledStatus_1.NotificationEnableStatus.Enable
|
|
16
|
+
: notificationEnabledStatus_1.NotificationEnableStatus.Disable;
|
|
17
|
+
this._rules = rules || NotificationFilterItem.DEFAULT_RULE_STRING;
|
|
18
|
+
this._meta = meta ?? '';
|
|
19
|
+
}
|
|
20
|
+
get name() {
|
|
21
|
+
return this._name;
|
|
22
|
+
}
|
|
23
|
+
get status() {
|
|
24
|
+
return this._status;
|
|
25
|
+
}
|
|
26
|
+
get rules() {
|
|
27
|
+
return this._rules;
|
|
28
|
+
}
|
|
29
|
+
get meta() {
|
|
30
|
+
return this._meta;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.NotificationFilterItem = NotificationFilterItem;
|
|
34
|
+
NotificationFilterItem.DEFAULT_RULE_STRING = '{"==": [1, 1]}';
|
|
35
|
+
//# sourceMappingURL=notificationFilterItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationFilterItem.js","sourceRoot":"","sources":["../../../src/public/types/notificationFilterItem.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,2EAAsE;AAEtE,MAAa,sBAAsB;IAQjC,YACE,IAAY,EACZ,MAA2B,EAC3B,KAAyB,EACzB,IAAwB;QAExB,MAAM,KAAN,MAAM,GAAK,IAAI,EAAA;QAEf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,OAAO,GAAG,MAAM;YACnB,CAAC,CAAC,oDAAwB,CAAC,MAAM;YACjC,CAAC,CAAC,oDAAwB,CAAC,OAAO,CAAA;QACpC,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,sBAAsB,CAAC,mBAAmB,CAAA;QACjE,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAE,CAAA;IACzB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;;AAtCH,wDAuCC;AAtCwB,0CAAmB,GAAG,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationMetadata = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Definition of all filterable notification properties of a specific
|
|
6
|
+
* service.
|
|
7
|
+
*/
|
|
8
|
+
class NotificationMetadata {
|
|
9
|
+
constructor(
|
|
10
|
+
/**
|
|
11
|
+
* Name of service for the implementing Sudo Platform SDK. Matches the corresponding service's configuration
|
|
12
|
+
* section within sudoplatformconfig.json
|
|
13
|
+
*/
|
|
14
|
+
serviceName,
|
|
15
|
+
/** Array of schema entries, one for each filterable property */
|
|
16
|
+
schema) {
|
|
17
|
+
this.serviceName = serviceName;
|
|
18
|
+
this.schema = schema;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.NotificationMetadata = NotificationMetadata;
|
|
22
|
+
//# sourceMappingURL=notificationMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationMetadata.js","sourceRoot":"","sources":["../../../src/public/types/notificationMetadata.ts"],"names":[],"mappings":";;;AAOA;;;GAGG;AACH,MAAa,oBAAoB;IAC/B;IACE;;;OAGG;IACa,WAAmB;IACnC,gEAAgE;IAChD,MAA8C;QAF9C,gBAAW,GAAX,WAAW,CAAQ;QAEnB,WAAM,GAAN,MAAM,CAAwC;IAC7D,CAAC;CACL;AAVD,oDAUC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.NotificationSchemaEntry = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* Schema of a single filterable property of a notification
|
|
11
|
+
*/
|
|
12
|
+
class NotificationSchemaEntry {
|
|
13
|
+
constructor(
|
|
14
|
+
/** Description of the filterable property */
|
|
15
|
+
description,
|
|
16
|
+
/** Name of the filterable property */
|
|
17
|
+
fieldName,
|
|
18
|
+
/** Type of the filterable property */
|
|
19
|
+
type) {
|
|
20
|
+
this.description = description;
|
|
21
|
+
this.fieldName = fieldName;
|
|
22
|
+
this.type = type;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.NotificationSchemaEntry = NotificationSchemaEntry;
|
|
26
|
+
//# sourceMappingURL=notificationSchemaEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notificationSchemaEntry.js","sourceRoot":"","sources":["../../../src/public/types/notificationSchemaEntry.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;GAEG;AACH,MAAa,uBAAuB;IAClC;IACE,6CAA6C;IAC7B,WAAmB;IACnC,sCAAsC;IACtB,SAAiB;IACjC,sCAAsC;IACtB,IAAY;QAJZ,gBAAW,GAAX,WAAW,CAAQ;QAEnB,cAAS,GAAT,SAAS,CAAQ;QAEjB,SAAI,GAAJ,IAAI,CAAQ;IAC3B,CAAC;CACL;AATD,0DASC"}
|