@sudoplatform/sudo-notification 1.1.0 → 2.0.1
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/cjs/private/apiClient.js +25 -30
- package/cjs/private/apiClient.js.map +1 -1
- package/cjs/private/transformers/errorTransformer.js +2 -1
- package/cjs/private/transformers/errorTransformer.js.map +1 -1
- package/lib/private/apiClient.js +26 -31
- package/lib/private/apiClient.js.map +1 -1
- package/lib/private/transformers/errorTransformer.js +3 -2
- package/lib/private/transformers/errorTransformer.js.map +1 -1
- package/package.json +101 -43
- package/types/private/apiClient.d.ts +5 -3
- package/types/private/transformers/errorTransformer.d.ts +5 -2
package/cjs/private/apiClient.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApiClient = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
6
|
-
*
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
|
9
4
|
const sudo_api_client_1 = require("@sudoplatform/sudo-api-client");
|
|
10
5
|
const sudo_common_1 = require("@sudoplatform/sudo-common");
|
|
11
6
|
const graphqlTypes_1 = require("../gen/graphqlTypes");
|
|
@@ -13,10 +8,23 @@ const constants_1 = require("./constants");
|
|
|
13
8
|
const errorTransformer_1 = require("./transformers/errorTransformer");
|
|
14
9
|
class ApiClient {
|
|
15
10
|
constructor(apiClientManager) {
|
|
11
|
+
this.mapGraphQLCallError = (err) => {
|
|
12
|
+
if ('graphQLErrors' in err && Array.isArray(err.graphQLErrors)) {
|
|
13
|
+
const error = err.graphQLErrors[0];
|
|
14
|
+
if (error) {
|
|
15
|
+
this.log.debug('appSync operation failed with error', { err });
|
|
16
|
+
return errorTransformer_1.ErrorTransformer.toClientError(error);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if ('errorType' in err) {
|
|
20
|
+
this.log.debug('appSync operation failed with error', { err });
|
|
21
|
+
return errorTransformer_1.ErrorTransformer.toClientError(err);
|
|
22
|
+
}
|
|
23
|
+
return new sudo_common_1.UnknownGraphQLError(err);
|
|
24
|
+
};
|
|
16
25
|
this.log = new sudo_common_1.DefaultLogger(this.constructor.name);
|
|
17
26
|
const clientManager = apiClientManager ?? sudo_api_client_1.DefaultApiClientManager.getInstance();
|
|
18
27
|
this.client = clientManager.getClient({
|
|
19
|
-
disableOffline: true,
|
|
20
28
|
configNamespace: constants_1.SERVICE_NAME,
|
|
21
29
|
});
|
|
22
30
|
}
|
|
@@ -48,7 +56,6 @@ class ApiClient {
|
|
|
48
56
|
const data = await this.performQuery({
|
|
49
57
|
query: graphqlTypes_1.GetNotificationSettingsDocument,
|
|
50
58
|
variables: { input },
|
|
51
|
-
fetchPolicy: 'network-only',
|
|
52
59
|
calleeName: this.getNotificationSettings.name,
|
|
53
60
|
});
|
|
54
61
|
return data.getNotificationSettings;
|
|
@@ -57,7 +64,6 @@ class ApiClient {
|
|
|
57
64
|
const data = await this.performQuery({
|
|
58
65
|
query: graphqlTypes_1.GetUserAndDeviceNotificationSettingsDocument,
|
|
59
66
|
variables: { input },
|
|
60
|
-
fetchPolicy: 'network-only',
|
|
61
67
|
calleeName: this.getUserAndDeviceNotificationSettings.name,
|
|
62
68
|
});
|
|
63
69
|
return data.getUserAndDeviceNotificationSettings;
|
|
@@ -78,30 +84,24 @@ class ApiClient {
|
|
|
78
84
|
});
|
|
79
85
|
return data.sendTestNotification;
|
|
80
86
|
}
|
|
81
|
-
async performQuery({ variables,
|
|
87
|
+
async performQuery({ variables, query, calleeName, }) {
|
|
82
88
|
let result;
|
|
83
89
|
try {
|
|
84
90
|
result = await this.client.query({
|
|
85
91
|
variables,
|
|
86
|
-
fetchPolicy,
|
|
87
92
|
query,
|
|
88
93
|
});
|
|
89
94
|
}
|
|
90
95
|
catch (err) {
|
|
91
|
-
const
|
|
92
|
-
this.log.debug('error received', { calleeName,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.log.debug('appSync query failed with error', { error });
|
|
96
|
-
throw errorTransformer_1.ErrorTransformer.toClientError(error);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
throw new sudo_common_1.UnknownGraphQLError(err);
|
|
96
|
+
const error = err;
|
|
97
|
+
this.log.debug('error received via query', { calleeName, error });
|
|
98
|
+
if ((0, sudo_common_1.isGraphQLNetworkError)(error)) {
|
|
99
|
+
throw (0, sudo_common_1.mapNetworkErrorToClientError)(error);
|
|
100
100
|
}
|
|
101
|
+
throw this.mapGraphQLCallError(error);
|
|
101
102
|
}
|
|
102
103
|
const error = result.errors?.[0];
|
|
103
104
|
if (error) {
|
|
104
|
-
this.log.debug('error received', { error });
|
|
105
105
|
throw errorTransformer_1.ErrorTransformer.toClientError(error);
|
|
106
106
|
}
|
|
107
107
|
if (result.data) {
|
|
@@ -120,20 +120,15 @@ class ApiClient {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
catch (err) {
|
|
123
|
-
const
|
|
124
|
-
this.log.debug('error received', { calleeName,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.log.debug('appSync mutation failed with error', { error });
|
|
128
|
-
throw errorTransformer_1.ErrorTransformer.toClientError(error);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
throw new sudo_common_1.UnknownGraphQLError(err);
|
|
123
|
+
const error = err;
|
|
124
|
+
this.log.debug('error received via mutation', { calleeName, error });
|
|
125
|
+
if ((0, sudo_common_1.isGraphQLNetworkError)(error)) {
|
|
126
|
+
throw (0, sudo_common_1.mapNetworkErrorToClientError)(error);
|
|
132
127
|
}
|
|
128
|
+
throw this.mapGraphQLCallError(error);
|
|
133
129
|
}
|
|
134
130
|
const error = result.errors?.[0];
|
|
135
131
|
if (error) {
|
|
136
|
-
this.log.debug('appSync mutation failed with error', { error });
|
|
137
132
|
throw errorTransformer_1.ErrorTransformer.toClientError(error);
|
|
138
133
|
}
|
|
139
134
|
if (result.data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../src/private/apiClient.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../src/private/apiClient.ts"],"names":[],"mappings":";;;AAMA,mEAGsC;AACtC,2DAOkC;AAGlC,sDAwB4B;AAC5B,2CAA0C;AAC1C,sEAAkE;AAElE,MAAa,SAAS;IAIpB,YAAmB,gBAAmC;QAoKtD,wBAAmB,GAAG,CAAC,GAAU,EAAS,EAAE;YAC1C,IAAI,eAAe,IAAI,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBAC/D,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC,CAGhC,CAAA;gBACD,IAAI,KAAK,EAAE,CAAC;oBACV,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,qCAAqC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;oBAC9D,OAAO,mCAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;gBAC9C,CAAC;YACH,CAAC;YACD,IAAI,WAAW,IAAI,GAAG,EAAE,CAAC;gBACvB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,qCAAqC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;gBAC9D,OAAO,mCAAgB,CAAC,aAAa,CACnC,GAA6C,CAC9C,CAAA;YACH,CAAC;YACD,OAAO,IAAI,iCAAmB,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC,CAAA;QArLC,IAAI,CAAC,GAAG,GAAG,IAAI,2BAAa,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;QAEnD,MAAM,aAAa,GACjB,gBAAgB,IAAI,yCAAuB,CAAC,WAAW,EAAE,CAAA;QAE3D,IAAI,CAAC,MAAM,GAAG,a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AK,EAAE,CAAC;YACV,MAAM,mCAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,OAAO,MAAM,CAAC,IAAI,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,wBAAU,CAClB,GAAG,UAAU,IAAI,aAAa,4BAA4B,CAC3D,CAAA;QACH,CAAC;IACH,CAAC;CAoBF;AA3LD,8BA2LC"}
|
|
@@ -10,7 +10,8 @@ const sudo_common_1 = require("@sudoplatform/sudo-common");
|
|
|
10
10
|
const errors_1 = require("../../public/errors");
|
|
11
11
|
class ErrorTransformer {
|
|
12
12
|
static toClientError(error) {
|
|
13
|
-
|
|
13
|
+
const errorType = 'errorType' in error ? error.errorType : error.message;
|
|
14
|
+
switch (errorType) {
|
|
14
15
|
case 'sudoplatform.ns.DeviceExist':
|
|
15
16
|
return new errors_1.DeviceAlreadyRegisteredError(error.message);
|
|
16
17
|
case 'sudoplatform.ns.DeviceNotFound':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorTransformer.js","sourceRoot":"","sources":["../../../src/private/transformers/errorTransformer.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"errorTransformer.js","sourceRoot":"","sources":["../../../src/private/transformers/errorTransformer.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,2DAAmE;AAEnE,gDAU4B;AAE5B,MAAa,gBAAgB;IAC3B,MAAM,CAAC,aAAa,CAClB,KAA4D;QAE5D,MAAM,SAAS,GAAG,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;QAExE,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,6BAA6B;gBAChC,OAAO,IAAI,qCAA4B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACxD,KAAK,gCAAgC;gBACnC,OAAO,IAAI,4BAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC/C,KAAK,8BAA8B;gBACjC,OAAO,IAAI,0BAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,8BAA8B;gBACjC,OAAO,IAAI,0BAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,8BAA8B;gBACjC,OAAO,IAAI,0BAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,4BAA4B;gBAC/B,OAAO,IAAI,wBAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC3C,KAAK,kCAAkC;gBACrC,OAAO,IAAI,8BAAqB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACjD,KAAK,8BAA8B;gBACjC,OAAO,IAAI,0BAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,gCAAgC;gBACnC,OAAO,IAAI,4BAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC/C;gBACE,OAAO,IAAA,qCAAuB,EAAC,KAAK,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;CACF;AA7BD,4CA6BC"}
|
package/lib/private/apiClient.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © 2025 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
1
|
import { DefaultApiClientManager, } from '@sudoplatform/sudo-api-client';
|
|
7
|
-
import { DefaultLogger, FatalError, UnknownGraphQLError, } from '@sudoplatform/sudo-common';
|
|
2
|
+
import { DefaultLogger, FatalError, isGraphQLNetworkError, mapNetworkErrorToClientError, UnknownGraphQLError, } from '@sudoplatform/sudo-common';
|
|
8
3
|
import { DeleteAppFromDeviceDocument, GetNotificationSettingsDocument, GetUserAndDeviceNotificationSettingsDocument, RegisterAppOnDeviceDocument, SendTestNotificationDocument, UpdateDeviceInfoDocument, UpdateNotificationSettingsDocument, } from '../gen/graphqlTypes';
|
|
9
4
|
import { SERVICE_NAME } from './constants';
|
|
10
5
|
import { ErrorTransformer } from './transformers/errorTransformer';
|
|
11
6
|
export class ApiClient {
|
|
12
7
|
constructor(apiClientManager) {
|
|
8
|
+
this.mapGraphQLCallError = (err) => {
|
|
9
|
+
if ('graphQLErrors' in err && Array.isArray(err.graphQLErrors)) {
|
|
10
|
+
const error = err.graphQLErrors[0];
|
|
11
|
+
if (error) {
|
|
12
|
+
this.log.debug('appSync operation failed with error', { err });
|
|
13
|
+
return ErrorTransformer.toClientError(error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if ('errorType' in err) {
|
|
17
|
+
this.log.debug('appSync operation failed with error', { err });
|
|
18
|
+
return ErrorTransformer.toClientError(err);
|
|
19
|
+
}
|
|
20
|
+
return new UnknownGraphQLError(err);
|
|
21
|
+
};
|
|
13
22
|
this.log = new DefaultLogger(this.constructor.name);
|
|
14
23
|
const clientManager = apiClientManager ?? DefaultApiClientManager.getInstance();
|
|
15
24
|
this.client = clientManager.getClient({
|
|
16
|
-
disableOffline: true,
|
|
17
25
|
configNamespace: SERVICE_NAME,
|
|
18
26
|
});
|
|
19
27
|
}
|
|
@@ -45,7 +53,6 @@ export class ApiClient {
|
|
|
45
53
|
const data = await this.performQuery({
|
|
46
54
|
query: GetNotificationSettingsDocument,
|
|
47
55
|
variables: { input },
|
|
48
|
-
fetchPolicy: 'network-only',
|
|
49
56
|
calleeName: this.getNotificationSettings.name,
|
|
50
57
|
});
|
|
51
58
|
return data.getNotificationSettings;
|
|
@@ -54,7 +61,6 @@ export class ApiClient {
|
|
|
54
61
|
const data = await this.performQuery({
|
|
55
62
|
query: GetUserAndDeviceNotificationSettingsDocument,
|
|
56
63
|
variables: { input },
|
|
57
|
-
fetchPolicy: 'network-only',
|
|
58
64
|
calleeName: this.getUserAndDeviceNotificationSettings.name,
|
|
59
65
|
});
|
|
60
66
|
return data.getUserAndDeviceNotificationSettings;
|
|
@@ -75,30 +81,24 @@ export class ApiClient {
|
|
|
75
81
|
});
|
|
76
82
|
return data.sendTestNotification;
|
|
77
83
|
}
|
|
78
|
-
async performQuery({ variables,
|
|
84
|
+
async performQuery({ variables, query, calleeName, }) {
|
|
79
85
|
let result;
|
|
80
86
|
try {
|
|
81
87
|
result = await this.client.query({
|
|
82
88
|
variables,
|
|
83
|
-
fetchPolicy,
|
|
84
89
|
query,
|
|
85
90
|
});
|
|
86
91
|
}
|
|
87
92
|
catch (err) {
|
|
88
|
-
const
|
|
89
|
-
this.log.debug('error received', { calleeName,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.log.debug('appSync query failed with error', { error });
|
|
93
|
-
throw ErrorTransformer.toClientError(error);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
throw new UnknownGraphQLError(err);
|
|
93
|
+
const error = err;
|
|
94
|
+
this.log.debug('error received via query', { calleeName, error });
|
|
95
|
+
if (isGraphQLNetworkError(error)) {
|
|
96
|
+
throw mapNetworkErrorToClientError(error);
|
|
97
97
|
}
|
|
98
|
+
throw this.mapGraphQLCallError(error);
|
|
98
99
|
}
|
|
99
100
|
const error = result.errors?.[0];
|
|
100
101
|
if (error) {
|
|
101
|
-
this.log.debug('error received', { error });
|
|
102
102
|
throw ErrorTransformer.toClientError(error);
|
|
103
103
|
}
|
|
104
104
|
if (result.data) {
|
|
@@ -117,20 +117,15 @@ export class ApiClient {
|
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
catch (err) {
|
|
120
|
-
const
|
|
121
|
-
this.log.debug('error received', { calleeName,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.log.debug('appSync mutation failed with error', { error });
|
|
125
|
-
throw ErrorTransformer.toClientError(error);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
throw new UnknownGraphQLError(err);
|
|
120
|
+
const error = err;
|
|
121
|
+
this.log.debug('error received via mutation', { calleeName, error });
|
|
122
|
+
if (isGraphQLNetworkError(error)) {
|
|
123
|
+
throw mapNetworkErrorToClientError(error);
|
|
129
124
|
}
|
|
125
|
+
throw this.mapGraphQLCallError(error);
|
|
130
126
|
}
|
|
131
127
|
const error = result.errors?.[0];
|
|
132
128
|
if (error) {
|
|
133
|
-
this.log.debug('appSync mutation failed with error', { error });
|
|
134
129
|
throw ErrorTransformer.toClientError(error);
|
|
135
130
|
}
|
|
136
131
|
if (result.data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../src/private/apiClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../src/private/apiClient.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,uBAAuB,GACxB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,aAAa,EACb,UAAU,EACV,qBAAqB,EAErB,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EACL,2BAA2B,EAG3B,+BAA+B,EAG/B,4CAA4C,EAI5C,2BAA2B,EAG3B,4BAA4B,EAG5B,wBAAwB,EAGxB,kCAAkC,GAInC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAElE,MAAM,OAAO,SAAS;IAIpB,YAAmB,gBAAmC;QAoKtD,wBAAmB,GAAG,CAAC,GAAU,EAAS,EAAE;YAC1C,IAAI,eAAe,IAAI,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBAC/D,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC,CAGhC,CAAA;gBACD,IAAI,KAAK,EAAE,CAAC;oBACV,IAAI,CA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UAAU,GAIX;QACC,IAAI,MAAM,CAAA;QACV,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAI;gBACnC,QAAQ;gBACR,SAAS;aACV,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,KAAK,GAAG,GAAY,CAAA;YAC1B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAA;YACpE,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM,4BAA4B,CAAC,KAAK,CAAC,CAAA;YAC3C,CAAC;YACD,MAAM,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;QAChC,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,OAAO,MAAM,CAAC,IAAI,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,UAAU,CAClB,GAAG,UAAU,IAAI,aAAa,4BAA4B,CAC3D,CAAA;QACH,CAAC;IACH,CAAC;CAoBF"}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { mapGraphQLToClientError
|
|
6
|
+
import { mapGraphQLToClientError } from '@sudoplatform/sudo-common';
|
|
7
7
|
import { DeviceAlreadyRegisteredError, DeviceCreateError, DeviceDeleteError, DeviceNotFoundError, DeviceReadError, DeviceUpdateError, SchemaValidationError, UserInfoReadError, UserInfoUpdateError, } from '../../public/errors';
|
|
8
8
|
export class ErrorTransformer {
|
|
9
9
|
static toClientError(error) {
|
|
10
|
-
|
|
10
|
+
const errorType = 'errorType' in error ? error.errorType : error.message;
|
|
11
|
+
switch (errorType) {
|
|
11
12
|
case 'sudoplatform.ns.DeviceExist':
|
|
12
13
|
return new DeviceAlreadyRegisteredError(error.message);
|
|
13
14
|
case 'sudoplatform.ns.DeviceNotFound':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorTransformer.js","sourceRoot":"","sources":["../../../src/private/transformers/errorTransformer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"errorTransformer.js","sourceRoot":"","sources":["../../../src/private/transformers/errorTransformer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,OAAO,gBAAgB;IAC3B,MAAM,CAAC,aAAa,CAClB,KAA4D;QAE5D,MAAM,SAAS,GAAG,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;QAExE,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,6BAA6B;gBAChC,OAAO,IAAI,4BAA4B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACxD,KAAK,gCAAgC;gBACnC,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC/C,KAAK,8BAA8B;gBACjC,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,8BAA8B;gBACjC,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,8BAA8B;gBACjC,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,4BAA4B;gBAC/B,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC3C,KAAK,kCAAkC;gBACrC,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YACjD,KAAK,8BAA8B;gBACjC,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC7C,KAAK,gCAAgC;gBACnC,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC/C;gBACE,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudoplatform/sudo-notification",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"author": "Anonyome Labs, Inc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/sudoplatform/sudo-notification-web.git"
|
|
7
|
+
"url": "git+https://github.com/sudoplatform/sudo-notification-web.git"
|
|
8
8
|
},
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"audit": "
|
|
11
|
+
"audit": "true",
|
|
12
12
|
"prepare": "husky",
|
|
13
13
|
"lint": "yarn lint:eslint && yarn lint:prettier",
|
|
14
14
|
"lint:eslint": "eslint \"{bin,test,src}/**/*.{js,ts,tsx}\"",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"codegen": "graphql-codegen -c codegen.yml",
|
|
17
17
|
"verify": "yarn audit && yarn lint && yarn unit-test",
|
|
18
18
|
"unit-test": "jest --coverage test/unit",
|
|
19
|
-
"integration-test": "jest test/integration",
|
|
19
|
+
"integration-test": "jest test/integration --passWithNoTests",
|
|
20
|
+
"test": "yarn unit-test && yarn integration-test",
|
|
20
21
|
"clean": "rm -rf esm lib docs",
|
|
21
22
|
"build": "yarn codegen && yarn build:transpile && yarn build:docs",
|
|
22
23
|
"build:transpile": "concurrently \"yarn build:transpile:declarations\" \"yarn build:transpile:cjs\" \"yarn build:transpile:esm\"",
|
|
@@ -42,63 +43,120 @@
|
|
|
42
43
|
"types"
|
|
43
44
|
],
|
|
44
45
|
"peerDependencies": {
|
|
45
|
-
"@sudoplatform/sudo-api-client": "^
|
|
46
|
-
"@sudoplatform/sudo-common": "^
|
|
47
|
-
"@sudoplatform/sudo-user": "^
|
|
46
|
+
"@sudoplatform/sudo-api-client": "^16.0.0",
|
|
47
|
+
"@sudoplatform/sudo-common": "^12.2.0",
|
|
48
|
+
"@sudoplatform/sudo-user": "^16.0.0"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
51
|
+
"aws-amplify": "^6.15.8",
|
|
52
|
+
"fp-ts": "^2.16.11",
|
|
53
|
+
"graphql": "^16.12.0",
|
|
52
54
|
"io-ts": "^2.2.22",
|
|
53
55
|
"monocle-ts": "^2.3.13",
|
|
54
56
|
"newtype-ts": "^0.3.5",
|
|
55
57
|
"tslib": "^2.8.1"
|
|
56
58
|
},
|
|
59
|
+
"resolutions": {
|
|
60
|
+
"graphql": "^16.12.0"
|
|
61
|
+
},
|
|
57
62
|
"devDependencies": {
|
|
58
|
-
"@eslint/compat": "^1.
|
|
59
|
-
"@eslint/eslintrc": "^3.3.
|
|
60
|
-
"@eslint/js": "^9.
|
|
61
|
-
"@graphql-codegen/add": "^
|
|
62
|
-
"@graphql-codegen/cli": "^
|
|
63
|
-
"@graphql-codegen/typed-document-node": "^
|
|
64
|
-
"@graphql-codegen/typescript": "^
|
|
65
|
-
"@graphql-codegen/typescript-operations": "^
|
|
66
|
-
"@
|
|
67
|
-
"@sudoplatform/sudo-
|
|
68
|
-
"@sudoplatform/sudo-
|
|
69
|
-
"@sudoplatform/sudo-user": "^15.1.1",
|
|
63
|
+
"@eslint/compat": "^1.4.1",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
65
|
+
"@eslint/js": "^9.39.1",
|
|
66
|
+
"@graphql-codegen/add": "^6.0.0",
|
|
67
|
+
"@graphql-codegen/cli": "^6.1.0",
|
|
68
|
+
"@graphql-codegen/typed-document-node": "^6.1.4",
|
|
69
|
+
"@graphql-codegen/typescript": "^5.0.6",
|
|
70
|
+
"@graphql-codegen/typescript-operations": "^5.0.6",
|
|
71
|
+
"@sudoplatform/sudo-api-client": "^16.0.0",
|
|
72
|
+
"@sudoplatform/sudo-common": "^12.2.0",
|
|
73
|
+
"@sudoplatform/sudo-user": "^16.0.0",
|
|
70
74
|
"@types/jest": "^30.0.0",
|
|
71
|
-
"@types/lodash": "^4.17.
|
|
72
|
-
"@types/node": "^
|
|
73
|
-
"@
|
|
74
|
-
"@typescript-eslint/
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"aws-appsync": "^4.1.10",
|
|
78
|
-
"concurrently": "^9.2.0",
|
|
79
|
-
"eslint": "^9.31.0",
|
|
75
|
+
"@types/lodash": "^4.17.21",
|
|
76
|
+
"@types/node": "^22.19.1",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
|
78
|
+
"@typescript-eslint/parser": "^8.48.0",
|
|
79
|
+
"concurrently": "^9.2.1",
|
|
80
|
+
"eslint": "^9.39.1",
|
|
80
81
|
"eslint-config-prettier": "^10.1.8",
|
|
81
82
|
"eslint-plugin-import": "^2.32.0",
|
|
82
|
-
"eslint-plugin-jest": "^29.
|
|
83
|
-
"eslint-plugin-prettier": "^5.5.
|
|
83
|
+
"eslint-plugin-jest": "^29.2.1",
|
|
84
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
84
85
|
"eslint-plugin-tree-shaking": "^1.12.2",
|
|
85
86
|
"husky": "^9.1.7",
|
|
86
87
|
"isomorphic-fetch": "^3.0.0",
|
|
87
|
-
"jest": "^30.0
|
|
88
|
-
"jest-environment-jsdom": "^30.0
|
|
88
|
+
"jest": "^30.2.0",
|
|
89
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
89
90
|
"lodash": "^4.17.21",
|
|
90
|
-
"prettier": "^3.
|
|
91
|
-
"prettier-plugin-organize-imports": "^4.
|
|
92
|
-
"ts-jest": "^29.4.
|
|
91
|
+
"prettier": "^3.7.3",
|
|
92
|
+
"prettier-plugin-organize-imports": "^4.3.0",
|
|
93
|
+
"ts-jest": "^29.4.6",
|
|
93
94
|
"ts-mockito": "^2.6.1",
|
|
94
95
|
"ts-node": "^10.9.2",
|
|
95
|
-
"typedoc": "^0.28.
|
|
96
|
-
"typescript": "^5.
|
|
96
|
+
"typedoc": "^0.28.15",
|
|
97
|
+
"typescript": "^5.9.3",
|
|
97
98
|
"uuid": "^11.1.0",
|
|
98
|
-
"wait-for-expect": "^
|
|
99
|
+
"wait-for-expect": "^4.0.0"
|
|
99
100
|
},
|
|
100
101
|
"engines": {
|
|
101
|
-
"node": ">=
|
|
102
|
+
"node": ">=22"
|
|
102
103
|
},
|
|
103
|
-
"packageManager": "yarn@4.
|
|
104
|
-
|
|
104
|
+
"packageManager": "yarn@4.13.0+sha512.5c20ba010c99815433e5c8453112165e673f1c7948d8d2b267f4b5e52097538658388ebc9f9580656d9b75c5cc996f990f611f99304a2197d4c56d21eea370e7",
|
|
105
|
+
"auditSuppressions": {
|
|
106
|
+
"1111243": {
|
|
107
|
+
"until": 1778626512,
|
|
108
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
109
|
+
"reason": "jws 4.0.0 pinned by @sudoplatform/sudo-user — transitive dep"
|
|
110
|
+
},
|
|
111
|
+
"1113153": {
|
|
112
|
+
"until": 1778626512,
|
|
113
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
114
|
+
"reason": "fast-xml-parser pinned by @aws-sdk — transitive dep"
|
|
115
|
+
},
|
|
116
|
+
"1113567": {
|
|
117
|
+
"until": 1778626512,
|
|
118
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
119
|
+
"reason": "fast-xml-parser 4.4.1 pinned by @aws-sdk/core — transitive dep"
|
|
120
|
+
},
|
|
121
|
+
"1113568": {
|
|
122
|
+
"until": 1778626512,
|
|
123
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
124
|
+
"reason": "fast-xml-parser pinned by @aws-sdk — transitive dep"
|
|
125
|
+
},
|
|
126
|
+
"1113569": {
|
|
127
|
+
"until": 1778626512,
|
|
128
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
129
|
+
"reason": "fast-xml-parser pinned by @aws-sdk — transitive dep"
|
|
130
|
+
},
|
|
131
|
+
"1113570": {
|
|
132
|
+
"until": 1778626512,
|
|
133
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
134
|
+
"reason": "fast-xml-parser 4.4.1 pinned by @aws-sdk/core — transitive dep"
|
|
135
|
+
},
|
|
136
|
+
"1114158": {
|
|
137
|
+
"until": 1778626512,
|
|
138
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
139
|
+
"reason": "immutable 3.7.6 pinned by @ardatan/relay-compiler — transitive dep"
|
|
140
|
+
},
|
|
141
|
+
"1115338": {
|
|
142
|
+
"until": 1778626512,
|
|
143
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
144
|
+
"reason": "fast-xml-parser 4.4.1 pinned by @aws-sdk/core — transitive dep"
|
|
145
|
+
},
|
|
146
|
+
"1115339": {
|
|
147
|
+
"until": 1778626512,
|
|
148
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
149
|
+
"reason": "fast-xml-parser pinned by @aws-sdk — transitive dep"
|
|
150
|
+
},
|
|
151
|
+
"1116307": {
|
|
152
|
+
"until": 1778626512,
|
|
153
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
154
|
+
"reason": "fast-xml-parser pinned by @aws-sdk — transitive dep"
|
|
155
|
+
},
|
|
156
|
+
"1116308": {
|
|
157
|
+
"until": 1778626512,
|
|
158
|
+
"untilISO": "2026-05-12T22:55:12Z",
|
|
159
|
+
"reason": "fast-xml-parser 4.4.1 pinned by @aws-sdk/core — transitive dep"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { GraphQLOptions } from '@aws-amplify/api-graphql';
|
|
1
2
|
import { ApiClientManager } from '@sudoplatform/sudo-api-client';
|
|
2
|
-
import { MutationOptions, QueryOptions } from 'apollo-client/core/watchQueryOptions';
|
|
3
3
|
import { DeleteAppFromDeviceInput, GetSettingsInput, GetUserAndDeviceSettingsInput, NotificationSettingsOutput, RegisterAppOnDeviceInput, SendTestNotificationInput, UpdateInfoInput, UpdateSettingsInput, UserAndDeviceNotificationSettingsOutput } from '../gen/graphqlTypes';
|
|
4
4
|
export declare class ApiClient {
|
|
5
5
|
private readonly log;
|
|
@@ -12,10 +12,12 @@ export declare class ApiClient {
|
|
|
12
12
|
getUserAndDeviceNotificationSettings(input: GetUserAndDeviceSettingsInput): Promise<UserAndDeviceNotificationSettingsOutput>;
|
|
13
13
|
updateNotificationSettings(input: UpdateSettingsInput): Promise<boolean>;
|
|
14
14
|
sendTestNotification(input: SendTestNotificationInput): Promise<boolean>;
|
|
15
|
-
performQuery<Q>({ variables,
|
|
15
|
+
performQuery<Q>({ variables, query, calleeName, }: GraphQLOptions & {
|
|
16
16
|
calleeName?: string;
|
|
17
17
|
}): Promise<Q>;
|
|
18
|
-
performMutation<M>({ mutation, variables, calleeName, }: Omit<
|
|
18
|
+
performMutation<M>({ mutation, variables, calleeName, }: Omit<GraphQLOptions, 'query'> & {
|
|
19
|
+
mutation: GraphQLOptions['query'];
|
|
19
20
|
calleeName?: string;
|
|
20
21
|
}): Promise<M>;
|
|
22
|
+
mapGraphQLCallError: (err: Error) => Error;
|
|
21
23
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GraphQLError } from 'graphql/error';
|
|
2
2
|
export declare class ErrorTransformer {
|
|
3
|
-
static toClientError(error:
|
|
3
|
+
static toClientError(error: {
|
|
4
|
+
errorType: string;
|
|
5
|
+
message: string;
|
|
6
|
+
} | GraphQLError): Error;
|
|
4
7
|
}
|