@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.
Files changed (157) hide show
  1. package/.yarn/releases/yarn-1.22.18.cjs +147520 -0
  2. package/.yarnrc +5 -0
  3. package/dependencies-report.json +1 -1
  4. package/docs/assets/main.js +2 -2
  5. package/docs/assets/style.css +3 -2
  6. package/docs/classes/AccountLockedError.html +1 -1
  7. package/docs/classes/AuthenticationError.html +1 -1
  8. package/docs/classes/Base64.html +1 -1
  9. package/docs/classes/Buffer.html +1 -1
  10. package/docs/classes/ConfigurationNotSetError.html +1 -1
  11. package/docs/classes/ConfigurationSetNotFoundError.html +1 -1
  12. package/docs/classes/DecodeError.html +1 -1
  13. package/docs/classes/DefaultConfigurationManager.html +1 -1
  14. package/docs/classes/DefaultLogger.html +1 -1
  15. package/docs/classes/DefaultSudoKeyArchive.html +1 -1
  16. package/docs/classes/DefaultSudoKeyManager.html +1 -1
  17. package/docs/classes/FatalError.html +1 -1
  18. package/docs/classes/IllegalArgumentError.html +1 -1
  19. package/docs/classes/IllegalStateError.html +1 -1
  20. package/docs/classes/InsufficientEntitlementsError.html +1 -1
  21. package/docs/classes/InvalidOwnershipProofError.html +1 -1
  22. package/docs/classes/InvalidTokenError.html +1 -1
  23. package/docs/classes/KeyArchiveDecodingError.html +1 -1
  24. package/docs/classes/KeyArchiveIncorrectPasswordError.html +1 -1
  25. package/docs/classes/KeyArchiveMissingError.html +1 -1
  26. package/docs/classes/KeyArchiveNoPasswordRequiredError.html +1 -1
  27. package/docs/classes/KeyArchivePasswordRequiredError.html +1 -1
  28. package/docs/classes/KeyArchiveTypeError.html +1 -1
  29. package/docs/classes/KeyArchiveUnknownKeyTypeError.html +1 -1
  30. package/docs/classes/KeyArchiveVersionError.html +1 -1
  31. package/docs/classes/KeyNotFoundError.html +1 -1
  32. package/docs/classes/KeyStoreNotExportableError.html +1 -1
  33. package/docs/classes/LimitExceededError.html +1 -1
  34. package/docs/classes/NoEntitlementsError.html +1 -1
  35. package/docs/classes/NotAuthorizedError.html +1 -1
  36. package/docs/classes/NotRegisteredError.html +1 -1
  37. package/docs/classes/NotSignedInError.html +1 -1
  38. package/docs/classes/OperationNotImplementedError.html +1 -1
  39. package/docs/classes/RegisterError.html +1 -1
  40. package/docs/classes/RequestFailedError.html +1 -1
  41. package/docs/classes/ServiceError.html +1 -1
  42. package/docs/classes/SignOutError.html +1 -1
  43. package/docs/classes/SudoCryptoProviderDefaults.html +1 -1
  44. package/docs/classes/UnknownGraphQLError.html +1 -1
  45. package/docs/classes/UnrecognizedAlgorithmError.html +1 -1
  46. package/docs/classes/UserNotConfirmedError.html +1 -1
  47. package/docs/classes/VersionMismatchError.html +1 -1
  48. package/docs/enums/CachePolicy.html +1 -1
  49. package/docs/enums/EncryptionAlgorithm.html +1 -1
  50. package/docs/enums/KeyArchiveKeyType.html +1 -1
  51. package/docs/enums/KeyDataKeyFormat.html +1 -1
  52. package/docs/enums/KeyDataKeyType.html +1 -1
  53. package/docs/enums/ListOperationResultStatus.html +1 -1
  54. package/docs/enums/PublicKeyFormat.html +1 -1
  55. package/docs/index.html +1 -1
  56. package/docs/interfaces/AsymmetricEncryptionOptions.html +1 -1
  57. package/docs/interfaces/BooleanFilter.html +1 -1
  58. package/docs/interfaces/ConfigurationManager.html +1 -1
  59. package/docs/interfaces/KeyData.html +1 -1
  60. package/docs/interfaces/ListOperationFailureResult.html +1 -1
  61. package/docs/interfaces/ListOperationPartialResult.html +1 -1
  62. package/docs/interfaces/ListOperationSuccessResult.html +1 -1
  63. package/docs/interfaces/ListOutput.html +1 -1
  64. package/docs/interfaces/Logger.html +1 -1
  65. package/docs/interfaces/Owner.html +1 -1
  66. package/docs/interfaces/PublicKey.html +1 -1
  67. package/docs/interfaces/ServiceCompatibilityInfo.html +1 -1
  68. package/docs/interfaces/StringFilter.html +1 -1
  69. package/docs/interfaces/SudoCryptoProvider.html +1 -1
  70. package/docs/interfaces/SudoKeyArchive.html +1 -1
  71. package/docs/interfaces/SudoKeyManager.html +1 -1
  72. package/docs/interfaces/SymmetricEncryptionOptions.html +1 -1
  73. package/docs/interfaces/ValidationResult.html +1 -1
  74. package/docs/modules.html +4 -4
  75. package/github/.yarn/releases/yarn-1.22.18.cjs +147520 -0
  76. package/github/.yarnrc +5 -0
  77. package/github/docs/assets/main.js +2 -2
  78. package/github/docs/assets/style.css +3 -2
  79. package/github/docs/classes/AccountLockedError.html +1 -1
  80. package/github/docs/classes/AuthenticationError.html +1 -1
  81. package/github/docs/classes/Base64.html +1 -1
  82. package/github/docs/classes/Buffer.html +1 -1
  83. package/github/docs/classes/ConfigurationNotSetError.html +1 -1
  84. package/github/docs/classes/ConfigurationSetNotFoundError.html +1 -1
  85. package/github/docs/classes/DecodeError.html +1 -1
  86. package/github/docs/classes/DefaultConfigurationManager.html +1 -1
  87. package/github/docs/classes/DefaultLogger.html +1 -1
  88. package/github/docs/classes/DefaultSudoKeyArchive.html +1 -1
  89. package/github/docs/classes/DefaultSudoKeyManager.html +1 -1
  90. package/github/docs/classes/FatalError.html +1 -1
  91. package/github/docs/classes/IllegalArgumentError.html +1 -1
  92. package/github/docs/classes/IllegalStateError.html +1 -1
  93. package/github/docs/classes/InsufficientEntitlementsError.html +1 -1
  94. package/github/docs/classes/InvalidOwnershipProofError.html +1 -1
  95. package/github/docs/classes/InvalidTokenError.html +1 -1
  96. package/github/docs/classes/KeyArchiveDecodingError.html +1 -1
  97. package/github/docs/classes/KeyArchiveIncorrectPasswordError.html +1 -1
  98. package/github/docs/classes/KeyArchiveMissingError.html +1 -1
  99. package/github/docs/classes/KeyArchiveNoPasswordRequiredError.html +1 -1
  100. package/github/docs/classes/KeyArchivePasswordRequiredError.html +1 -1
  101. package/github/docs/classes/KeyArchiveTypeError.html +1 -1
  102. package/github/docs/classes/KeyArchiveUnknownKeyTypeError.html +1 -1
  103. package/github/docs/classes/KeyArchiveVersionError.html +1 -1
  104. package/github/docs/classes/KeyNotFoundError.html +1 -1
  105. package/github/docs/classes/KeyStoreNotExportableError.html +1 -1
  106. package/github/docs/classes/LimitExceededError.html +1 -1
  107. package/github/docs/classes/NoEntitlementsError.html +1 -1
  108. package/github/docs/classes/NotAuthorizedError.html +1 -1
  109. package/github/docs/classes/NotRegisteredError.html +1 -1
  110. package/github/docs/classes/NotSignedInError.html +1 -1
  111. package/github/docs/classes/OperationNotImplementedError.html +1 -1
  112. package/github/docs/classes/RegisterError.html +1 -1
  113. package/github/docs/classes/RequestFailedError.html +1 -1
  114. package/github/docs/classes/ServiceError.html +1 -1
  115. package/github/docs/classes/SignOutError.html +1 -1
  116. package/github/docs/classes/SudoCryptoProviderDefaults.html +1 -1
  117. package/github/docs/classes/UnknownGraphQLError.html +1 -1
  118. package/github/docs/classes/UnrecognizedAlgorithmError.html +1 -1
  119. package/github/docs/classes/UserNotConfirmedError.html +1 -1
  120. package/github/docs/classes/VersionMismatchError.html +1 -1
  121. package/github/docs/enums/CachePolicy.html +1 -1
  122. package/github/docs/enums/EncryptionAlgorithm.html +1 -1
  123. package/github/docs/enums/KeyArchiveKeyType.html +1 -1
  124. package/github/docs/enums/KeyDataKeyFormat.html +1 -1
  125. package/github/docs/enums/KeyDataKeyType.html +1 -1
  126. package/github/docs/enums/ListOperationResultStatus.html +1 -1
  127. package/github/docs/enums/PublicKeyFormat.html +1 -1
  128. package/github/docs/index.html +1 -1
  129. package/github/docs/interfaces/AsymmetricEncryptionOptions.html +1 -1
  130. package/github/docs/interfaces/BooleanFilter.html +1 -1
  131. package/github/docs/interfaces/ConfigurationManager.html +1 -1
  132. package/github/docs/interfaces/KeyData.html +1 -1
  133. package/github/docs/interfaces/ListOperationFailureResult.html +1 -1
  134. package/github/docs/interfaces/ListOperationPartialResult.html +1 -1
  135. package/github/docs/interfaces/ListOperationSuccessResult.html +1 -1
  136. package/github/docs/interfaces/ListOutput.html +1 -1
  137. package/github/docs/interfaces/Logger.html +1 -1
  138. package/github/docs/interfaces/Owner.html +1 -1
  139. package/github/docs/interfaces/PublicKey.html +1 -1
  140. package/github/docs/interfaces/ServiceCompatibilityInfo.html +1 -1
  141. package/github/docs/interfaces/StringFilter.html +1 -1
  142. package/github/docs/interfaces/SudoCryptoProvider.html +1 -1
  143. package/github/docs/interfaces/SudoKeyArchive.html +1 -1
  144. package/github/docs/interfaces/SudoKeyManager.html +1 -1
  145. package/github/docs/interfaces/SymmetricEncryptionOptions.html +1 -1
  146. package/github/docs/interfaces/ValidationResult.html +1 -1
  147. package/github/docs/modules.html +4 -4
  148. package/github/package.json +17 -16
  149. package/github/src/errors/error.ts +5 -1
  150. package/github/test/unit/errors/error.spec.ts +3 -18
  151. package/github/yarn.lock +410 -229
  152. package/lib/errors/error.d.ts +1 -1
  153. package/lib/errors/error.js +3 -0
  154. package/package.json +18 -17
  155. package/src/errors/error.ts +5 -1
  156. package/test/unit/errors/error.spec.ts +3 -18
  157. package/yarn.lock +410 -229
@@ -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.6.1"
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.16.6",
56
- "@babel/core": "^7.17.5",
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.16.11",
60
+ "@babel/preset-env": "^7.17.10",
60
61
  "@babel/preset-typescript": "^7.16.7",
61
- "@types/jest": "^27.4.0",
62
- "@typescript-eslint/eslint-plugin": "^5.12.1",
63
- "@typescript-eslint/parser": "^5.12.1",
64
- "aws-sdk-mock": "^5.6.2",
65
- "eslint": "^8.9.0",
66
- "eslint-config-prettier": "^8.4.0",
67
- "eslint-plugin-import": "^2.25.4",
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.12",
75
+ "monocle-ts": "^2.3.13",
75
76
  "newtype-ts": "^0.3.5",
76
- "prettier": "^2.5.1",
77
+ "prettier": "^2.6.2",
77
78
  "rimraf": "^3.0.2",
78
79
  "ts-mockito": "^2.6.1",
79
- "typedoc": "^0.22.12",
80
- "typescript": "^4.5.5"
80
+ "typedoc": "^0.22.15",
81
+ "typescript": "^4.6.4"
81
82
  }
82
83
  }
@@ -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(error: AppSyncError): Error {
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: AppSyncError = {
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(