@sudoplatform/sudo-common 6.2.0 → 6.2.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/.yarn/releases/yarn-1.22.18.cjs +147520 -0
- package/.yarnrc +5 -0
- package/dependencies-report.json +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/style.css +3 -2
- package/docs/classes/AccountLockedError.html +1 -1
- package/docs/classes/AuthenticationError.html +1 -1
- package/docs/classes/Base64.html +1 -1
- package/docs/classes/Buffer.html +1 -1
- package/docs/classes/ConfigurationNotSetError.html +1 -1
- package/docs/classes/ConfigurationSetNotFoundError.html +1 -1
- package/docs/classes/DecodeError.html +1 -1
- package/docs/classes/DefaultConfigurationManager.html +1 -1
- package/docs/classes/DefaultLogger.html +1 -1
- package/docs/classes/DefaultSudoKeyArchive.html +1 -1
- package/docs/classes/DefaultSudoKeyManager.html +1 -1
- package/docs/classes/FatalError.html +1 -1
- package/docs/classes/IllegalArgumentError.html +1 -1
- package/docs/classes/IllegalStateError.html +1 -1
- package/docs/classes/InsufficientEntitlementsError.html +1 -1
- package/docs/classes/InvalidOwnershipProofError.html +1 -1
- package/docs/classes/InvalidTokenError.html +1 -1
- package/docs/classes/KeyArchiveDecodingError.html +1 -1
- package/docs/classes/KeyArchiveIncorrectPasswordError.html +1 -1
- package/docs/classes/KeyArchiveMissingError.html +1 -1
- package/docs/classes/KeyArchiveNoPasswordRequiredError.html +1 -1
- package/docs/classes/KeyArchivePasswordRequiredError.html +1 -1
- package/docs/classes/KeyArchiveTypeError.html +1 -1
- package/docs/classes/KeyArchiveUnknownKeyTypeError.html +1 -1
- package/docs/classes/KeyArchiveVersionError.html +1 -1
- package/docs/classes/KeyNotFoundError.html +1 -1
- package/docs/classes/KeyStoreNotExportableError.html +1 -1
- package/docs/classes/LimitExceededError.html +1 -1
- package/docs/classes/NoEntitlementsError.html +1 -1
- package/docs/classes/NotAuthorizedError.html +1 -1
- package/docs/classes/NotRegisteredError.html +1 -1
- package/docs/classes/NotSignedInError.html +1 -1
- package/docs/classes/OperationNotImplementedError.html +1 -1
- package/docs/classes/RegisterError.html +1 -1
- package/docs/classes/RequestFailedError.html +1 -1
- package/docs/classes/ServiceError.html +1 -1
- package/docs/classes/SignOutError.html +1 -1
- package/docs/classes/SudoCryptoProviderDefaults.html +1 -1
- package/docs/classes/UnknownGraphQLError.html +1 -1
- package/docs/classes/UnrecognizedAlgorithmError.html +1 -1
- package/docs/classes/UserNotConfirmedError.html +1 -1
- package/docs/classes/VersionMismatchError.html +1 -1
- package/docs/enums/CachePolicy.html +1 -1
- package/docs/enums/EncryptionAlgorithm.html +1 -1
- package/docs/enums/KeyArchiveKeyType.html +1 -1
- package/docs/enums/KeyDataKeyFormat.html +1 -1
- package/docs/enums/KeyDataKeyType.html +1 -1
- package/docs/enums/ListOperationResultStatus.html +1 -1
- package/docs/enums/PublicKeyFormat.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/AsymmetricEncryptionOptions.html +1 -1
- package/docs/interfaces/BooleanFilter.html +1 -1
- package/docs/interfaces/ConfigurationManager.html +1 -1
- package/docs/interfaces/KeyData.html +1 -1
- package/docs/interfaces/ListOperationFailureResult.html +1 -1
- package/docs/interfaces/ListOperationPartialResult.html +1 -1
- package/docs/interfaces/ListOperationSuccessResult.html +1 -1
- package/docs/interfaces/ListOutput.html +1 -1
- package/docs/interfaces/Logger.html +1 -1
- package/docs/interfaces/Owner.html +1 -1
- package/docs/interfaces/PublicKey.html +1 -1
- package/docs/interfaces/ServiceCompatibilityInfo.html +1 -1
- package/docs/interfaces/StringFilter.html +1 -1
- package/docs/interfaces/SudoCryptoProvider.html +1 -1
- package/docs/interfaces/SudoKeyArchive.html +1 -1
- package/docs/interfaces/SudoKeyManager.html +1 -1
- package/docs/interfaces/SymmetricEncryptionOptions.html +1 -1
- package/docs/interfaces/ValidationResult.html +1 -1
- package/docs/modules.html +4 -4
- package/github/.yarn/releases/yarn-1.22.18.cjs +147520 -0
- package/github/.yarnrc +5 -0
- package/github/docs/assets/main.js +2 -2
- package/github/docs/assets/style.css +3 -2
- package/github/docs/classes/AccountLockedError.html +1 -1
- package/github/docs/classes/AuthenticationError.html +1 -1
- package/github/docs/classes/Base64.html +1 -1
- package/github/docs/classes/Buffer.html +1 -1
- package/github/docs/classes/ConfigurationNotSetError.html +1 -1
- package/github/docs/classes/ConfigurationSetNotFoundError.html +1 -1
- package/github/docs/classes/DecodeError.html +1 -1
- package/github/docs/classes/DefaultConfigurationManager.html +1 -1
- package/github/docs/classes/DefaultLogger.html +1 -1
- package/github/docs/classes/DefaultSudoKeyArchive.html +1 -1
- package/github/docs/classes/DefaultSudoKeyManager.html +1 -1
- package/github/docs/classes/FatalError.html +1 -1
- package/github/docs/classes/IllegalArgumentError.html +1 -1
- package/github/docs/classes/IllegalStateError.html +1 -1
- package/github/docs/classes/InsufficientEntitlementsError.html +1 -1
- package/github/docs/classes/InvalidOwnershipProofError.html +1 -1
- package/github/docs/classes/InvalidTokenError.html +1 -1
- package/github/docs/classes/KeyArchiveDecodingError.html +1 -1
- package/github/docs/classes/KeyArchiveIncorrectPasswordError.html +1 -1
- package/github/docs/classes/KeyArchiveMissingError.html +1 -1
- package/github/docs/classes/KeyArchiveNoPasswordRequiredError.html +1 -1
- package/github/docs/classes/KeyArchivePasswordRequiredError.html +1 -1
- package/github/docs/classes/KeyArchiveTypeError.html +1 -1
- package/github/docs/classes/KeyArchiveUnknownKeyTypeError.html +1 -1
- package/github/docs/classes/KeyArchiveVersionError.html +1 -1
- package/github/docs/classes/KeyNotFoundError.html +1 -1
- package/github/docs/classes/KeyStoreNotExportableError.html +1 -1
- package/github/docs/classes/LimitExceededError.html +1 -1
- package/github/docs/classes/NoEntitlementsError.html +1 -1
- package/github/docs/classes/NotAuthorizedError.html +1 -1
- package/github/docs/classes/NotRegisteredError.html +1 -1
- package/github/docs/classes/NotSignedInError.html +1 -1
- package/github/docs/classes/OperationNotImplementedError.html +1 -1
- package/github/docs/classes/RegisterError.html +1 -1
- package/github/docs/classes/RequestFailedError.html +1 -1
- package/github/docs/classes/ServiceError.html +1 -1
- package/github/docs/classes/SignOutError.html +1 -1
- package/github/docs/classes/SudoCryptoProviderDefaults.html +1 -1
- package/github/docs/classes/UnknownGraphQLError.html +1 -1
- package/github/docs/classes/UnrecognizedAlgorithmError.html +1 -1
- package/github/docs/classes/UserNotConfirmedError.html +1 -1
- package/github/docs/classes/VersionMismatchError.html +1 -1
- package/github/docs/enums/CachePolicy.html +1 -1
- package/github/docs/enums/EncryptionAlgorithm.html +1 -1
- package/github/docs/enums/KeyArchiveKeyType.html +1 -1
- package/github/docs/enums/KeyDataKeyFormat.html +1 -1
- package/github/docs/enums/KeyDataKeyType.html +1 -1
- package/github/docs/enums/ListOperationResultStatus.html +1 -1
- package/github/docs/enums/PublicKeyFormat.html +1 -1
- package/github/docs/index.html +1 -1
- package/github/docs/interfaces/AsymmetricEncryptionOptions.html +1 -1
- package/github/docs/interfaces/BooleanFilter.html +1 -1
- package/github/docs/interfaces/ConfigurationManager.html +1 -1
- package/github/docs/interfaces/KeyData.html +1 -1
- package/github/docs/interfaces/ListOperationFailureResult.html +1 -1
- package/github/docs/interfaces/ListOperationPartialResult.html +1 -1
- package/github/docs/interfaces/ListOperationSuccessResult.html +1 -1
- package/github/docs/interfaces/ListOutput.html +1 -1
- package/github/docs/interfaces/Logger.html +1 -1
- package/github/docs/interfaces/Owner.html +1 -1
- package/github/docs/interfaces/PublicKey.html +1 -1
- package/github/docs/interfaces/ServiceCompatibilityInfo.html +1 -1
- package/github/docs/interfaces/StringFilter.html +1 -1
- package/github/docs/interfaces/SudoCryptoProvider.html +1 -1
- package/github/docs/interfaces/SudoKeyArchive.html +1 -1
- package/github/docs/interfaces/SudoKeyManager.html +1 -1
- package/github/docs/interfaces/SymmetricEncryptionOptions.html +1 -1
- package/github/docs/interfaces/ValidationResult.html +1 -1
- package/github/docs/modules.html +4 -4
- package/github/package.json +17 -16
- package/github/src/errors/error.ts +5 -1
- package/github/test/unit/errors/error.spec.ts +3 -18
- package/github/yarn.lock +410 -229
- package/lib/errors/error.d.ts +1 -1
- package/lib/errors/error.js +3 -0
- package/package.json +18 -17
- package/src/errors/error.ts +5 -1
- package/test/unit/errors/error.spec.ts +3 -18
- package/yarn.lock +410 -229
package/lib/errors/error.d.ts
CHANGED
|
@@ -251,7 +251,7 @@ export declare class UnrecognizedAlgorithmError extends Error {
|
|
|
251
251
|
* @param error The App Sync error to map
|
|
252
252
|
* @returns The mapped error
|
|
253
253
|
*/
|
|
254
|
-
export declare function mapGraphQLToClientError(error: AppSyncError): Error;
|
|
254
|
+
export declare function mapGraphQLToClientError(error: Pick<AppSyncError, 'errorType' | 'message'>): Error;
|
|
255
255
|
/**
|
|
256
256
|
* Call this in error handling when testing with isAppSyncNetworkError on
|
|
257
257
|
* a caught error from an AppSync operation returns true.
|
package/lib/errors/error.js
CHANGED
|
@@ -577,6 +577,9 @@ function mapGraphQLToClientError(error) {
|
|
|
577
577
|
case 'sudoplatform.InvalidArgumentError':
|
|
578
578
|
return new IllegalArgumentError();
|
|
579
579
|
|
|
580
|
+
case 'sudoplatform.LimitExceededError':
|
|
581
|
+
return new LimitExceededError();
|
|
582
|
+
|
|
580
583
|
case 'sudoplatform.NoEntitlementsError':
|
|
581
584
|
return new NoEntitlementsError();
|
|
582
585
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudoplatform/sudo-common",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"author": "Anonyome Labs, Inc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,44 +39,45 @@
|
|
|
39
39
|
"**/apollo-cache-inmemory": "^1.6.6",
|
|
40
40
|
"**/apollo-client": "^2.6.10",
|
|
41
41
|
"ansi-regex": "^5.0.1",
|
|
42
|
-
"tmpl": "^1.0.5"
|
|
42
|
+
"tmpl": "^1.0.5",
|
|
43
|
+
"minimist": "^1.2.6"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"apollo-client": "^2.6.10",
|
|
46
47
|
"aws-sdk": "^2.973.0",
|
|
47
48
|
"browser-bunyan": "^1.8.0",
|
|
48
49
|
"fflate": "^0.7.3",
|
|
49
|
-
"graphql": "^15.
|
|
50
|
+
"graphql": "^15.8.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"io-ts": "^2.2.10"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"@babel/cli": "^7.
|
|
56
|
-
"@babel/core": "^7.17.
|
|
56
|
+
"@babel/cli": "^7.17.10",
|
|
57
|
+
"@babel/core": "^7.17.10",
|
|
57
58
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
58
59
|
"@babel/plugin-proposal-private-methods": "^7.16.11",
|
|
59
|
-
"@babel/preset-env": "^7.
|
|
60
|
+
"@babel/preset-env": "^7.17.10",
|
|
60
61
|
"@babel/preset-typescript": "^7.16.7",
|
|
61
|
-
"@types/jest": "^27.
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
63
|
-
"@typescript-eslint/parser": "^5.
|
|
64
|
-
"aws-sdk-mock": "^5.
|
|
65
|
-
"eslint": "^8.
|
|
66
|
-
"eslint-config-prettier": "^8.
|
|
67
|
-
"eslint-plugin-import": "^2.
|
|
62
|
+
"@types/jest": "^27.5.0",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
|
64
|
+
"@typescript-eslint/parser": "^5.22.0",
|
|
65
|
+
"aws-sdk-mock": "^5.7.0",
|
|
66
|
+
"eslint": "^8.14.0",
|
|
67
|
+
"eslint-config-prettier": "^8.5.0",
|
|
68
|
+
"eslint-plugin-import": "^2.26.0",
|
|
68
69
|
"eslint-plugin-prettier": "^4.0.0",
|
|
69
70
|
"fp-ts": "^2.11.8",
|
|
70
71
|
"io-ts": "^2.2.16",
|
|
71
72
|
"io-ts-types": "^0.5.16",
|
|
72
73
|
"isomorphic-webcrypto": "^2.3.8",
|
|
73
74
|
"jest": "^27.5.1",
|
|
74
|
-
"monocle-ts": "^2.3.
|
|
75
|
+
"monocle-ts": "^2.3.13",
|
|
75
76
|
"newtype-ts": "^0.3.5",
|
|
76
|
-
"prettier": "^2.
|
|
77
|
+
"prettier": "^2.6.2",
|
|
77
78
|
"rimraf": "^3.0.2",
|
|
78
79
|
"ts-mockito": "^2.6.1",
|
|
79
|
-
"typedoc": "^0.22.
|
|
80
|
-
"typescript": "^4.
|
|
80
|
+
"typedoc": "^0.22.15",
|
|
81
|
+
"typescript": "^4.6.4"
|
|
81
82
|
}
|
|
82
83
|
}
|
package/src/errors/error.ts
CHANGED
|
@@ -425,7 +425,9 @@ export class UnrecognizedAlgorithmError extends Error {
|
|
|
425
425
|
* @param error The App Sync error to map
|
|
426
426
|
* @returns The mapped error
|
|
427
427
|
*/
|
|
428
|
-
export function mapGraphQLToClientError(
|
|
428
|
+
export function mapGraphQLToClientError(
|
|
429
|
+
error: Pick<AppSyncError, 'errorType' | 'message'>,
|
|
430
|
+
): Error {
|
|
429
431
|
switch (error.errorType) {
|
|
430
432
|
case 'sudoplatform.AccountLockedError':
|
|
431
433
|
return new AccountLockedError()
|
|
@@ -435,6 +437,8 @@ export function mapGraphQLToClientError(error: AppSyncError): Error {
|
|
|
435
437
|
return new InvalidTokenError()
|
|
436
438
|
case 'sudoplatform.InvalidArgumentError':
|
|
437
439
|
return new IllegalArgumentError()
|
|
440
|
+
case 'sudoplatform.LimitExceededError':
|
|
441
|
+
return new LimitExceededError()
|
|
438
442
|
case 'sudoplatform.NoEntitlementsError':
|
|
439
443
|
return new NoEntitlementsError()
|
|
440
444
|
case 'sudoplatform.ServiceError':
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccountLockedError,
|
|
3
|
-
AppSyncError,
|
|
4
3
|
AppSyncNetworkError,
|
|
5
4
|
IllegalArgumentError,
|
|
6
5
|
InsufficientEntitlementsError,
|
|
7
6
|
InvalidTokenError,
|
|
8
7
|
isAppSyncNetworkError,
|
|
8
|
+
LimitExceededError,
|
|
9
9
|
mapGraphQLToClientError,
|
|
10
10
|
mapNetworkErrorToClientError,
|
|
11
11
|
NoEntitlementsError,
|
|
@@ -26,34 +26,19 @@ describe('error', () => {
|
|
|
26
26
|
${'sudoplatform.InvalidArgumentError'} | ${new IllegalArgumentError()}
|
|
27
27
|
${'sudoplatform.NoEntitlementsError'} | ${new NoEntitlementsError()}
|
|
28
28
|
${'sudoplatform.ServiceError'} | ${new ServiceError(message)}
|
|
29
|
+
${'sudoplatform.LimitExceededError'} | ${new LimitExceededError()}
|
|
29
30
|
`('should map common error $code properly', ({ code, error }) => {
|
|
30
31
|
expect(
|
|
31
32
|
mapGraphQLToClientError({
|
|
32
33
|
message,
|
|
33
|
-
path: [],
|
|
34
|
-
locations: [],
|
|
35
|
-
nodes: [],
|
|
36
|
-
positions: [],
|
|
37
|
-
source: undefined,
|
|
38
|
-
originalError: undefined,
|
|
39
|
-
extensions: [],
|
|
40
|
-
name: code,
|
|
41
34
|
errorType: code,
|
|
42
35
|
}),
|
|
43
36
|
).toEqual(error)
|
|
44
37
|
})
|
|
45
38
|
|
|
46
39
|
it('should map an unrecognized error to UnknownGraphQLError', () => {
|
|
47
|
-
const unrecognized
|
|
40
|
+
const unrecognized = {
|
|
48
41
|
message,
|
|
49
|
-
path: [],
|
|
50
|
-
locations: [],
|
|
51
|
-
nodes: [],
|
|
52
|
-
positions: [],
|
|
53
|
-
source: undefined,
|
|
54
|
-
originalError: undefined,
|
|
55
|
-
extensions: [],
|
|
56
|
-
name: 'unrecognized',
|
|
57
42
|
errorType: 'unrecognized',
|
|
58
43
|
}
|
|
59
44
|
expect(mapGraphQLToClientError(unrecognized)).toEqual(
|