@sudoplatform/sudo-common 7.0.2 → 8.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.
Files changed (404) hide show
  1. package/cjs/configurationManager/defaultConfigurationManager.d.ts +123 -0
  2. package/cjs/configurationManager/defaultConfigurationManager.js +122 -0
  3. package/cjs/configurationManager/defaultConfigurationManager.js.map +1 -0
  4. package/cjs/errors/error.d.ts +263 -0
  5. package/cjs/errors/error.js +442 -0
  6. package/cjs/errors/error.js.map +1 -0
  7. package/cjs/index.d.ts +9 -0
  8. package/cjs/index.js +13 -0
  9. package/cjs/index.js.map +1 -0
  10. package/cjs/logging/bunyanLogger.d.ts +8 -0
  11. package/cjs/logging/bunyanLogger.js +36 -0
  12. package/cjs/logging/bunyanLogger.js.map +1 -0
  13. package/cjs/logging/logger.d.ts +87 -0
  14. package/cjs/logging/logger.js +77 -0
  15. package/cjs/logging/logger.js.map +1 -0
  16. package/cjs/sudoKeyArchive/index.d.ts +4 -0
  17. package/cjs/sudoKeyArchive/index.js +8 -0
  18. package/cjs/sudoKeyArchive/index.js.map +1 -0
  19. package/cjs/sudoKeyArchive/keyArchive.d.ts +137 -0
  20. package/cjs/sudoKeyArchive/keyArchive.js +84 -0
  21. package/cjs/sudoKeyArchive/keyArchive.js.map +1 -0
  22. package/cjs/sudoKeyArchive/keyInfo.d.ts +41 -0
  23. package/cjs/sudoKeyArchive/keyInfo.js +17 -0
  24. package/cjs/sudoKeyArchive/keyInfo.js.map +1 -0
  25. package/cjs/sudoKeyArchive/keyType.d.ts +13 -0
  26. package/cjs/sudoKeyArchive/keyType.js +39 -0
  27. package/cjs/sudoKeyArchive/keyType.js.map +1 -0
  28. package/cjs/sudoKeyArchive/sudoKeyArchive.d.ts +190 -0
  29. package/cjs/sudoKeyArchive/sudoKeyArchive.js +373 -0
  30. package/cjs/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
  31. package/cjs/sudoKeyManager/index.d.ts +4 -0
  32. package/cjs/sudoKeyManager/index.js +8 -0
  33. package/cjs/sudoKeyManager/index.js.map +1 -0
  34. package/cjs/sudoKeyManager/keyData.d.ts +56 -0
  35. package/cjs/sudoKeyManager/keyData.js +46 -0
  36. package/cjs/sudoKeyManager/keyData.js.map +1 -0
  37. package/cjs/sudoKeyManager/publicKey.d.ts +8 -0
  38. package/cjs/sudoKeyManager/publicKey.js +9 -0
  39. package/cjs/sudoKeyManager/publicKey.js.map +1 -0
  40. package/cjs/sudoKeyManager/sudoCryptoProvider.d.ts +324 -0
  41. package/cjs/sudoKeyManager/sudoCryptoProvider.js +12 -0
  42. package/cjs/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
  43. package/cjs/sudoKeyManager/sudoKeyManager.d.ts +344 -0
  44. package/cjs/sudoKeyManager/sudoKeyManager.js +140 -0
  45. package/cjs/sudoKeyManager/sudoKeyManager.js.map +1 -0
  46. package/cjs/types/types.d.ts +115 -0
  47. package/cjs/types/types.js +45 -0
  48. package/cjs/types/types.js.map +1 -0
  49. package/cjs/utils/base64.d.ts +44 -0
  50. package/cjs/utils/base64.js +71 -0
  51. package/cjs/utils/base64.js.map +1 -0
  52. package/cjs/utils/buffer.d.ts +13 -0
  53. package/cjs/utils/buffer.js +37 -0
  54. package/cjs/utils/buffer.js.map +1 -0
  55. package/cjs/utils/stream.d.ts +6 -0
  56. package/cjs/utils/stream.js +70 -0
  57. package/cjs/utils/stream.js.map +1 -0
  58. package/lib/configurationManager/defaultConfigurationManager.js +106 -158
  59. package/lib/configurationManager/defaultConfigurationManager.js.map +1 -0
  60. package/lib/errors/error.js +226 -438
  61. package/lib/errors/error.js.map +1 -0
  62. package/lib/index.d.ts +1 -0
  63. package/lib/index.js +10 -109
  64. package/lib/index.js.map +1 -0
  65. package/lib/logging/bunyanLogger.js +29 -41
  66. package/lib/logging/bunyanLogger.js.map +1 -0
  67. package/lib/logging/logger.js +66 -92
  68. package/lib/logging/logger.js.map +1 -0
  69. package/lib/sudoKeyArchive/index.js +5 -57
  70. package/lib/sudoKeyArchive/index.js.map +1 -0
  71. package/lib/sudoKeyArchive/keyArchive.d.ts +8 -8
  72. package/lib/sudoKeyArchive/keyArchive.js +69 -96
  73. package/lib/sudoKeyArchive/keyArchive.js.map +1 -0
  74. package/lib/sudoKeyArchive/keyInfo.js +11 -49
  75. package/lib/sudoKeyArchive/keyInfo.js.map +1 -0
  76. package/lib/sudoKeyArchive/keyType.js +27 -37
  77. package/lib/sudoKeyArchive/keyType.js.map +1 -0
  78. package/lib/sudoKeyArchive/sudoKeyArchive.js +351 -444
  79. package/lib/sudoKeyArchive/sudoKeyArchive.js.map +1 -0
  80. package/lib/sudoKeyManager/index.js +5 -57
  81. package/lib/sudoKeyManager/index.js.map +1 -0
  82. package/lib/sudoKeyManager/keyData.js +38 -33
  83. package/lib/sudoKeyManager/keyData.js.map +1 -0
  84. package/lib/sudoKeyManager/publicKey.js +5 -12
  85. package/lib/sudoKeyManager/publicKey.js.map +1 -0
  86. package/lib/sudoKeyManager/sudoCryptoProvider.js +8 -26
  87. package/lib/sudoKeyManager/sudoCryptoProvider.js.map +1 -0
  88. package/lib/sudoKeyManager/sudoKeyManager.js +135 -173
  89. package/lib/sudoKeyManager/sudoKeyManager.js.map +1 -0
  90. package/lib/types/types.js +27 -33
  91. package/lib/types/types.js.map +1 -0
  92. package/lib/utils/base64.d.ts +35 -0
  93. package/lib/utils/base64.js +63 -28
  94. package/lib/utils/base64.js.map +1 -0
  95. package/lib/utils/buffer.js +28 -46
  96. package/lib/utils/buffer.js.map +1 -0
  97. package/lib/utils/stream.d.ts +6 -0
  98. package/lib/utils/stream.js +63 -0
  99. package/lib/utils/stream.js.map +1 -0
  100. package/package.json +36 -29
  101. package/.babelrc +0 -10
  102. package/.eslintrc.js +0 -91
  103. package/.gitignore +0 -14
  104. package/.gitlab-ci.yml +0 -101
  105. package/.npmignore +0 -1
  106. package/.prettierignore +0 -3
  107. package/.prettierrc.js +0 -7
  108. package/.publisher.json +0 -7
  109. package/.vscode/settings.json +0 -5
  110. package/.yarn/releases/yarn-1.22.19.cjs +0 -147529
  111. package/.yarnrc +0 -5
  112. package/dependencies-report.json +0 -640
  113. package/docs/.nojekyll +0 -1
  114. package/docs/assets/highlight.css +0 -57
  115. package/docs/assets/main.js +0 -54
  116. package/docs/assets/search.js +0 -1
  117. package/docs/assets/style.css +0 -1224
  118. package/docs/assets/widgets.png +0 -0
  119. package/docs/assets/widgets@2x.png +0 -0
  120. package/docs/classes/AccountLockedError.html +0 -163
  121. package/docs/classes/AuthenticationError.html +0 -169
  122. package/docs/classes/Base64.html +0 -134
  123. package/docs/classes/Buffer.html +0 -158
  124. package/docs/classes/ConfigurationNotSetError.html +0 -164
  125. package/docs/classes/ConfigurationSetNotFoundError.html +0 -168
  126. package/docs/classes/DecodeError.html +0 -168
  127. package/docs/classes/DefaultConfigurationManager.html +0 -213
  128. package/docs/classes/DefaultLogger.html +0 -291
  129. package/docs/classes/DefaultSudoKeyArchive.html +0 -363
  130. package/docs/classes/DefaultSudoKeyManager.html +0 -814
  131. package/docs/classes/FatalError.html +0 -169
  132. package/docs/classes/IllegalArgumentError.html +0 -168
  133. package/docs/classes/IllegalStateError.html +0 -169
  134. package/docs/classes/InsufficientEntitlementsError.html +0 -164
  135. package/docs/classes/InvalidOwnershipProofError.html +0 -163
  136. package/docs/classes/InvalidTokenError.html +0 -163
  137. package/docs/classes/KeyArchiveDecodingError.html +0 -168
  138. package/docs/classes/KeyArchiveIncorrectPasswordError.html +0 -168
  139. package/docs/classes/KeyArchiveMissingError.html +0 -168
  140. package/docs/classes/KeyArchiveNoPasswordRequiredError.html +0 -168
  141. package/docs/classes/KeyArchivePasswordRequiredError.html +0 -168
  142. package/docs/classes/KeyArchiveTypeError.html +0 -168
  143. package/docs/classes/KeyArchiveUnknownKeyTypeError.html +0 -168
  144. package/docs/classes/KeyArchiveVersionError.html +0 -168
  145. package/docs/classes/KeyNotFoundError.html +0 -168
  146. package/docs/classes/KeyStoreNotExportableError.html +0 -168
  147. package/docs/classes/LimitExceededError.html +0 -164
  148. package/docs/classes/NoEntitlementsError.html +0 -163
  149. package/docs/classes/NotAuthorizedError.html +0 -169
  150. package/docs/classes/NotRegisteredError.html +0 -168
  151. package/docs/classes/NotSignedInError.html +0 -164
  152. package/docs/classes/OperationNotImplementedError.html +0 -168
  153. package/docs/classes/RegisterError.html +0 -169
  154. package/docs/classes/RequestFailedError.html +0 -189
  155. package/docs/classes/ServiceError.html +0 -170
  156. package/docs/classes/SignOutError.html +0 -168
  157. package/docs/classes/SudoCryptoProviderDefaults.html +0 -106
  158. package/docs/classes/UnknownGraphQLError.html +0 -169
  159. package/docs/classes/UnrecognizedAlgorithmError.html +0 -168
  160. package/docs/classes/UserNotConfirmedError.html +0 -164
  161. package/docs/classes/VersionMismatchError.html +0 -166
  162. package/docs/enums/CachePolicy.html +0 -72
  163. package/docs/enums/EncryptionAlgorithm.html +0 -80
  164. package/docs/enums/KeyArchiveKeyType.html +0 -86
  165. package/docs/enums/KeyDataKeyFormat.html +0 -92
  166. package/docs/enums/KeyDataKeyType.html +0 -85
  167. package/docs/enums/ListOperationResultStatus.html +0 -85
  168. package/docs/enums/PublicKeyFormat.html +0 -68
  169. package/docs/functions/isAppSyncNetworkError.html +0 -147
  170. package/docs/functions/isInsecureKeyArchive.html +0 -147
  171. package/docs/functions/isSecureKeyArchive.html +0 -147
  172. package/docs/functions/isUnrecognizedKeyArchive.html +0 -147
  173. package/docs/functions/keyArchiveInfoFromKeyData.html +0 -147
  174. package/docs/functions/keyArchiveKeyTypeFromKeyDataKeyType.html +0 -147
  175. package/docs/functions/mapGraphQLToClientError.html +0 -154
  176. package/docs/functions/mapNetworkErrorToClientError.html +0 -154
  177. package/docs/index.html +0 -146
  178. package/docs/interfaces/AsymmetricEncryptionOptions.html +0 -68
  179. package/docs/interfaces/BooleanFilter.html +0 -75
  180. package/docs/interfaces/ConfigurationManager.html +0 -200
  181. package/docs/interfaces/KeyData.html +0 -106
  182. package/docs/interfaces/ListOperationFailureResult.html +0 -76
  183. package/docs/interfaces/ListOperationPartialResult.html +0 -102
  184. package/docs/interfaces/ListOperationSuccessResult.html +0 -90
  185. package/docs/interfaces/ListOutput.html +0 -80
  186. package/docs/interfaces/Logger.html +0 -251
  187. package/docs/interfaces/Owner.html +0 -72
  188. package/docs/interfaces/PublicKey.html +0 -72
  189. package/docs/interfaces/ServiceCompatibilityInfo.html +0 -110
  190. package/docs/interfaces/StringFilter.html +0 -82
  191. package/docs/interfaces/SudoCryptoProvider.html +0 -865
  192. package/docs/interfaces/SudoKeyArchive.html +0 -257
  193. package/docs/interfaces/SudoKeyManager.html +0 -848
  194. package/docs/interfaces/SymmetricEncryptionOptions.html +0 -75
  195. package/docs/interfaces/ValidationResult.html +0 -83
  196. package/docs/modules.html +0 -248
  197. package/docs/types/AppSyncError.html +0 -138
  198. package/docs/types/AppSyncNetworkError.html +0 -138
  199. package/docs/types/InsecureKeyArchive.html +0 -138
  200. package/docs/types/KeyArchive.html +0 -138
  201. package/docs/types/KeyArchiveKeyInfo.html +0 -154
  202. package/docs/types/KeyArchiveKeyInfoDecoded.html +0 -138
  203. package/docs/types/ListOperationResult.html +0 -148
  204. package/docs/types/SecureKeyArchive.html +0 -138
  205. package/docs/types/Subset.html +0 -144
  206. package/docs/types/UnrecognizedKeyArchive.html +0 -138
  207. package/docs/variables/CURRENT_ARCHIVE_VERSION.html +0 -138
  208. package/docs/variables/InsecureKeyArchiveCodec.html +0 -138
  209. package/docs/variables/InsecureKeyArchiveType.html +0 -138
  210. package/docs/variables/KeyArchiveCodec.html +0 -138
  211. package/docs/variables/KeyArchiveKeyInfoArrayCodec.html +0 -138
  212. package/docs/variables/KeyArchiveKeyInfoCodec.html +0 -138
  213. package/docs/variables/KeyArchiveKeyTypeCodec.html +0 -138
  214. package/docs/variables/SecureKeyArchiveCodec.html +0 -138
  215. package/docs/variables/SecureKeyArchiveType.html +0 -138
  216. package/docs/variables/UnrecognizedKeyArchiveCodec.html +0 -138
  217. package/github/.babelrc +0 -10
  218. package/github/.eslintrc.js +0 -91
  219. package/github/.gitignore +0 -14
  220. package/github/.gitlab-ci.yml +0 -101
  221. package/github/.npmignore +0 -1
  222. package/github/.prettierignore +0 -3
  223. package/github/.prettierrc.js +0 -7
  224. package/github/.publisher.json +0 -7
  225. package/github/.vscode/settings.json +0 -5
  226. package/github/.yarn/releases/yarn-1.22.19.cjs +0 -147529
  227. package/github/.yarnrc +0 -5
  228. package/github/CHANGELOG.md +0 -51
  229. package/github/README.md +0 -8
  230. package/github/bin/outdated-with-suppression.sh +0 -203
  231. package/github/bin/suppress-audit.sh +0 -15
  232. package/github/bin/suppress-outdated.sh +0 -60
  233. package/github/bin/yarn-audit-with-suppression.sh +0 -19
  234. package/github/docs/.nojekyll +0 -1
  235. package/github/docs/assets/highlight.css +0 -57
  236. package/github/docs/assets/main.js +0 -54
  237. package/github/docs/assets/search.js +0 -1
  238. package/github/docs/assets/style.css +0 -1224
  239. package/github/docs/assets/widgets.png +0 -0
  240. package/github/docs/assets/widgets@2x.png +0 -0
  241. package/github/docs/classes/AccountLockedError.html +0 -163
  242. package/github/docs/classes/AuthenticationError.html +0 -169
  243. package/github/docs/classes/Base64.html +0 -134
  244. package/github/docs/classes/Buffer.html +0 -158
  245. package/github/docs/classes/ConfigurationNotSetError.html +0 -164
  246. package/github/docs/classes/ConfigurationSetNotFoundError.html +0 -168
  247. package/github/docs/classes/DecodeError.html +0 -168
  248. package/github/docs/classes/DefaultConfigurationManager.html +0 -213
  249. package/github/docs/classes/DefaultLogger.html +0 -291
  250. package/github/docs/classes/DefaultSudoKeyArchive.html +0 -363
  251. package/github/docs/classes/DefaultSudoKeyManager.html +0 -814
  252. package/github/docs/classes/FatalError.html +0 -169
  253. package/github/docs/classes/IllegalArgumentError.html +0 -168
  254. package/github/docs/classes/IllegalStateError.html +0 -169
  255. package/github/docs/classes/InsufficientEntitlementsError.html +0 -164
  256. package/github/docs/classes/InvalidOwnershipProofError.html +0 -163
  257. package/github/docs/classes/InvalidTokenError.html +0 -163
  258. package/github/docs/classes/KeyArchiveDecodingError.html +0 -168
  259. package/github/docs/classes/KeyArchiveIncorrectPasswordError.html +0 -168
  260. package/github/docs/classes/KeyArchiveMissingError.html +0 -168
  261. package/github/docs/classes/KeyArchiveNoPasswordRequiredError.html +0 -168
  262. package/github/docs/classes/KeyArchivePasswordRequiredError.html +0 -168
  263. package/github/docs/classes/KeyArchiveTypeError.html +0 -168
  264. package/github/docs/classes/KeyArchiveUnknownKeyTypeError.html +0 -168
  265. package/github/docs/classes/KeyArchiveVersionError.html +0 -168
  266. package/github/docs/classes/KeyNotFoundError.html +0 -168
  267. package/github/docs/classes/KeyStoreNotExportableError.html +0 -168
  268. package/github/docs/classes/LimitExceededError.html +0 -164
  269. package/github/docs/classes/NoEntitlementsError.html +0 -163
  270. package/github/docs/classes/NotAuthorizedError.html +0 -169
  271. package/github/docs/classes/NotRegisteredError.html +0 -168
  272. package/github/docs/classes/NotSignedInError.html +0 -164
  273. package/github/docs/classes/OperationNotImplementedError.html +0 -168
  274. package/github/docs/classes/RegisterError.html +0 -169
  275. package/github/docs/classes/RequestFailedError.html +0 -189
  276. package/github/docs/classes/ServiceError.html +0 -170
  277. package/github/docs/classes/SignOutError.html +0 -168
  278. package/github/docs/classes/SudoCryptoProviderDefaults.html +0 -106
  279. package/github/docs/classes/UnknownGraphQLError.html +0 -169
  280. package/github/docs/classes/UnrecognizedAlgorithmError.html +0 -168
  281. package/github/docs/classes/UserNotConfirmedError.html +0 -164
  282. package/github/docs/classes/VersionMismatchError.html +0 -166
  283. package/github/docs/enums/CachePolicy.html +0 -72
  284. package/github/docs/enums/EncryptionAlgorithm.html +0 -80
  285. package/github/docs/enums/KeyArchiveKeyType.html +0 -86
  286. package/github/docs/enums/KeyDataKeyFormat.html +0 -92
  287. package/github/docs/enums/KeyDataKeyType.html +0 -85
  288. package/github/docs/enums/ListOperationResultStatus.html +0 -85
  289. package/github/docs/enums/PublicKeyFormat.html +0 -68
  290. package/github/docs/functions/isAppSyncNetworkError.html +0 -147
  291. package/github/docs/functions/isInsecureKeyArchive.html +0 -147
  292. package/github/docs/functions/isSecureKeyArchive.html +0 -147
  293. package/github/docs/functions/isUnrecognizedKeyArchive.html +0 -147
  294. package/github/docs/functions/keyArchiveInfoFromKeyData.html +0 -147
  295. package/github/docs/functions/keyArchiveKeyTypeFromKeyDataKeyType.html +0 -147
  296. package/github/docs/functions/mapGraphQLToClientError.html +0 -154
  297. package/github/docs/functions/mapNetworkErrorToClientError.html +0 -154
  298. package/github/docs/index.html +0 -146
  299. package/github/docs/interfaces/AsymmetricEncryptionOptions.html +0 -68
  300. package/github/docs/interfaces/BooleanFilter.html +0 -75
  301. package/github/docs/interfaces/ConfigurationManager.html +0 -200
  302. package/github/docs/interfaces/KeyData.html +0 -106
  303. package/github/docs/interfaces/ListOperationFailureResult.html +0 -76
  304. package/github/docs/interfaces/ListOperationPartialResult.html +0 -102
  305. package/github/docs/interfaces/ListOperationSuccessResult.html +0 -90
  306. package/github/docs/interfaces/ListOutput.html +0 -80
  307. package/github/docs/interfaces/Logger.html +0 -251
  308. package/github/docs/interfaces/Owner.html +0 -72
  309. package/github/docs/interfaces/PublicKey.html +0 -72
  310. package/github/docs/interfaces/ServiceCompatibilityInfo.html +0 -110
  311. package/github/docs/interfaces/StringFilter.html +0 -82
  312. package/github/docs/interfaces/SudoCryptoProvider.html +0 -865
  313. package/github/docs/interfaces/SudoKeyArchive.html +0 -257
  314. package/github/docs/interfaces/SudoKeyManager.html +0 -848
  315. package/github/docs/interfaces/SymmetricEncryptionOptions.html +0 -75
  316. package/github/docs/interfaces/ValidationResult.html +0 -83
  317. package/github/docs/modules.html +0 -248
  318. package/github/docs/types/AppSyncError.html +0 -138
  319. package/github/docs/types/AppSyncNetworkError.html +0 -138
  320. package/github/docs/types/InsecureKeyArchive.html +0 -138
  321. package/github/docs/types/KeyArchive.html +0 -138
  322. package/github/docs/types/KeyArchiveKeyInfo.html +0 -154
  323. package/github/docs/types/KeyArchiveKeyInfoDecoded.html +0 -138
  324. package/github/docs/types/ListOperationResult.html +0 -148
  325. package/github/docs/types/SecureKeyArchive.html +0 -138
  326. package/github/docs/types/Subset.html +0 -144
  327. package/github/docs/types/UnrecognizedKeyArchive.html +0 -138
  328. package/github/docs/variables/CURRENT_ARCHIVE_VERSION.html +0 -138
  329. package/github/docs/variables/InsecureKeyArchiveCodec.html +0 -138
  330. package/github/docs/variables/InsecureKeyArchiveType.html +0 -138
  331. package/github/docs/variables/KeyArchiveCodec.html +0 -138
  332. package/github/docs/variables/KeyArchiveKeyInfoArrayCodec.html +0 -138
  333. package/github/docs/variables/KeyArchiveKeyInfoCodec.html +0 -138
  334. package/github/docs/variables/KeyArchiveKeyTypeCodec.html +0 -138
  335. package/github/docs/variables/SecureKeyArchiveCodec.html +0 -138
  336. package/github/docs/variables/SecureKeyArchiveType.html +0 -138
  337. package/github/docs/variables/UnrecognizedKeyArchiveCodec.html +0 -138
  338. package/github/jest.config.json +0 -14
  339. package/github/package.json +0 -91
  340. package/github/src/configurationManager/defaultConfigurationManager.ts +0 -281
  341. package/github/src/errors/error.ts +0 -469
  342. package/github/src/index.ts +0 -8
  343. package/github/src/logging/bunyanLogger.ts +0 -47
  344. package/github/src/logging/logger.ts +0 -164
  345. package/github/src/sudoKeyArchive/index.ts +0 -4
  346. package/github/src/sudoKeyArchive/keyArchive.ts +0 -120
  347. package/github/src/sudoKeyArchive/keyInfo.ts +0 -47
  348. package/github/src/sudoKeyArchive/keyType.ts +0 -50
  349. package/github/src/sudoKeyArchive/sudoKeyArchive.ts +0 -591
  350. package/github/src/sudoKeyManager/index.ts +0 -4
  351. package/github/src/sudoKeyManager/keyData.ts +0 -60
  352. package/github/src/sudoKeyManager/publicKey.ts +0 -9
  353. package/github/src/sudoKeyManager/sudoCryptoProvider.ts +0 -416
  354. package/github/src/sudoKeyManager/sudoKeyManager.ts +0 -609
  355. package/github/src/types/types.ts +0 -129
  356. package/github/src/utils/base64.ts +0 -21
  357. package/github/src/utils/buffer.ts +0 -39
  358. package/github/test/integration/defaultConfigurationManager.spec.ts +0 -85
  359. package/github/test/matchers.ts +0 -122
  360. package/github/test/unit/configurationManager/defaultConfigurationManager.spec.ts +0 -506
  361. package/github/test/unit/errors/error.spec.ts +0 -115
  362. package/github/test/unit/keyType.spec.ts +0 -54
  363. package/github/test/unit/logging/logger.spec.ts +0 -182
  364. package/github/test/unit/sudoKeyArchive.spec.ts +0 -1609
  365. package/github/test/unit/sudoKeyManager.spec.ts +0 -1045
  366. package/github/test/unit/utils/base64.spec.ts +0 -30
  367. package/github/test/unit/utils/buffer.spec.ts +0 -45
  368. package/github/test/unit/utils/listOperationResult.spec.ts +0 -84
  369. package/github/tsconfig.json +0 -20
  370. package/github/tsconfig.test.json +0 -7
  371. package/github/yarn.lock +0 -5922
  372. package/jest.config.json +0 -14
  373. package/src/configurationManager/defaultConfigurationManager.ts +0 -281
  374. package/src/errors/error.ts +0 -469
  375. package/src/index.ts +0 -8
  376. package/src/logging/bunyanLogger.ts +0 -47
  377. package/src/logging/logger.ts +0 -164
  378. package/src/sudoKeyArchive/index.ts +0 -4
  379. package/src/sudoKeyArchive/keyArchive.ts +0 -120
  380. package/src/sudoKeyArchive/keyInfo.ts +0 -47
  381. package/src/sudoKeyArchive/keyType.ts +0 -50
  382. package/src/sudoKeyArchive/sudoKeyArchive.ts +0 -591
  383. package/src/sudoKeyManager/index.ts +0 -4
  384. package/src/sudoKeyManager/keyData.ts +0 -60
  385. package/src/sudoKeyManager/publicKey.ts +0 -9
  386. package/src/sudoKeyManager/sudoCryptoProvider.ts +0 -416
  387. package/src/sudoKeyManager/sudoKeyManager.ts +0 -609
  388. package/src/types/types.ts +0 -129
  389. package/src/utils/base64.ts +0 -21
  390. package/src/utils/buffer.ts +0 -39
  391. package/test/integration/defaultConfigurationManager.spec.ts +0 -85
  392. package/test/matchers.ts +0 -122
  393. package/test/unit/configurationManager/defaultConfigurationManager.spec.ts +0 -506
  394. package/test/unit/errors/error.spec.ts +0 -115
  395. package/test/unit/keyType.spec.ts +0 -54
  396. package/test/unit/logging/logger.spec.ts +0 -182
  397. package/test/unit/sudoKeyArchive.spec.ts +0 -1609
  398. package/test/unit/sudoKeyManager.spec.ts +0 -1045
  399. package/test/unit/utils/base64.spec.ts +0 -30
  400. package/test/unit/utils/buffer.spec.ts +0 -45
  401. package/test/unit/utils/listOperationResult.spec.ts +0 -84
  402. package/tsconfig.json +0 -20
  403. package/tsconfig.test.json +0 -7
  404. package/yarn.lock +0 -5922
@@ -0,0 +1,442 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapNetworkErrorToClientError = exports.mapGraphQLToClientError = exports.UnrecognizedAlgorithmError = exports.OperationNotImplementedError = exports.KeyArchiveUnknownKeyTypeError = exports.KeyArchiveVersionError = exports.KeyArchiveTypeError = exports.KeyArchiveIncorrectPasswordError = exports.KeyArchiveDecodingError = exports.KeyArchiveNoPasswordRequiredError = exports.KeyArchivePasswordRequiredError = exports.KeyArchiveMissingError = exports.KeyStoreNotExportableError = exports.KeyNotFoundError = exports.InvalidTokenError = exports.NoEntitlementsError = exports.FatalError = exports.RequestFailedError = exports.LimitExceededError = exports.IllegalStateError = exports.IllegalArgumentError = exports.ServiceError = exports.AccountLockedError = exports.InsufficientEntitlementsError = exports.InvalidOwnershipProofError = exports.VersionMismatchError = exports.UserNotConfirmedError = exports.NotSignedInError = exports.NotAuthorizedError = exports.NotRegisteredError = exports.RegisterError = exports.SignOutError = exports.AuthenticationError = exports.DecodeError = exports.ConfigurationNotSetError = exports.ConfigurationSetNotFoundError = exports.UnknownGraphQLError = exports.isAppSyncNetworkError = void 0;
4
+ function isAppSyncNetworkError(u) {
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ return !!u.networkError;
7
+ }
8
+ exports.isAppSyncNetworkError = isAppSyncNetworkError;
9
+ /**
10
+ * Indicates the GraphQL API returned an error that's not recognized by
11
+ * the client.
12
+ */
13
+ class UnknownGraphQLError extends Error {
14
+ constructor(cause) {
15
+ const maybeAppSyncError = cause;
16
+ let message;
17
+ if (maybeAppSyncError?.errorType) {
18
+ message = `type: ${maybeAppSyncError.errorType}, message: ${maybeAppSyncError.message}`;
19
+ }
20
+ else if (maybeAppSyncError?.message) {
21
+ message = maybeAppSyncError?.message;
22
+ }
23
+ else if (maybeAppSyncError?.name) {
24
+ message = maybeAppSyncError.name;
25
+ }
26
+ else {
27
+ message = 'unknown cause';
28
+ }
29
+ super(message);
30
+ this.name = 'UnknownGraphQLError';
31
+ }
32
+ }
33
+ exports.UnknownGraphQLError = UnknownGraphQLError;
34
+ /**
35
+ * The configuration set was not found by the given key
36
+ */
37
+ class ConfigurationSetNotFoundError extends Error {
38
+ constructor(key) {
39
+ super('Configuration set not found.');
40
+ if (key) {
41
+ this.message += ` Key: ${key}`;
42
+ }
43
+ this.name = 'ConfigurationSetNotFoundError';
44
+ }
45
+ }
46
+ exports.ConfigurationSetNotFoundError = ConfigurationSetNotFoundError;
47
+ /**
48
+ * The configuration has not been set on the ConfigurationManager
49
+ * before trying operations that need it
50
+ */
51
+ class ConfigurationNotSetError extends Error {
52
+ constructor() {
53
+ super('Configuration has not been set.');
54
+ this.name = 'ConfigurationNotSetError';
55
+ }
56
+ }
57
+ exports.ConfigurationNotSetError = ConfigurationNotSetError;
58
+ /**
59
+ * A decode error message
60
+ */
61
+ class DecodeError extends Error {
62
+ constructor(message) {
63
+ super(message);
64
+ this.name = 'DecodeError';
65
+ }
66
+ }
67
+ exports.DecodeError = DecodeError;
68
+ /**
69
+ * An error occurred during the authentication process. This may be due to invalid credentials
70
+ * being supplied, or authentication tokens not able to be retrieved from storage.
71
+ */
72
+ class AuthenticationError extends Error {
73
+ constructor(message) {
74
+ super(message);
75
+ this.name = 'AuthenticationError';
76
+ }
77
+ }
78
+ exports.AuthenticationError = AuthenticationError;
79
+ /**
80
+ * An error occurred during the sign out process.
81
+ */
82
+ class SignOutError extends Error {
83
+ constructor(message) {
84
+ super(message);
85
+ this.name = 'SignOutError';
86
+ }
87
+ }
88
+ exports.SignOutError = SignOutError;
89
+ /**
90
+ * An error occurred during the registration process.
91
+ * This may be due to the client already being registered.
92
+ */
93
+ class RegisterError extends Error {
94
+ constructor(message) {
95
+ super(message);
96
+ this.name = 'RegisterError';
97
+ }
98
+ }
99
+ exports.RegisterError = RegisterError;
100
+ /**
101
+ * An error occurred indicating that the user is not registered.
102
+ */
103
+ class NotRegisteredError extends Error {
104
+ constructor(message) {
105
+ super(message ?? 'User is not registered.');
106
+ this.name = 'NotRegisteredError';
107
+ }
108
+ }
109
+ exports.NotRegisteredError = NotRegisteredError;
110
+ /**
111
+ * The user is not authorized to perform the requested operation. This maybe
112
+ * due to specifying the wrong key deriving key or password.
113
+ */
114
+ class NotAuthorizedError extends Error {
115
+ constructor(message) {
116
+ super(message ?? 'User is not authorized perform the requested operation.');
117
+ this.name = 'NotAuthorizedError';
118
+ }
119
+ }
120
+ exports.NotAuthorizedError = NotAuthorizedError;
121
+ /**
122
+ * Indicates the operation requires the user to be signed in but the user is
123
+ * currently not signed in.
124
+ */
125
+ class NotSignedInError extends Error {
126
+ constructor() {
127
+ super('Not signed in.');
128
+ this.name = 'NotSignedInError';
129
+ }
130
+ }
131
+ exports.NotSignedInError = NotSignedInError;
132
+ /**
133
+ * Indicates that the user was registered but is not confirmed due to not
134
+ * passing all the required validation.
135
+ */
136
+ class UserNotConfirmedError extends Error {
137
+ constructor() {
138
+ super('User not confirmed.');
139
+ this.name = 'UserNotConfirmedError';
140
+ }
141
+ }
142
+ exports.UserNotConfirmedError = UserNotConfirmedError;
143
+ /**
144
+ * The version of the vault that's being updated does not match the version
145
+ * stored in the backed. It is likely that another client updated the vault
146
+ * first so the caller should reconcile the changes before attempting to
147
+ * update the vault.
148
+ */
149
+ class VersionMismatchError extends Error {
150
+ constructor() {
151
+ super('Expected object version does not match the actual object version.');
152
+ this.name = 'VersionMismatchError';
153
+ }
154
+ }
155
+ exports.VersionMismatchError = VersionMismatchError;
156
+ /**
157
+ * Indicates that the ownership proof was invalid.
158
+ */
159
+ class InvalidOwnershipProofError extends Error {
160
+ constructor() {
161
+ super('Ownership proof was invalid.');
162
+ this.name = 'InvalidOwnershipProofError';
163
+ }
164
+ }
165
+ exports.InvalidOwnershipProofError = InvalidOwnershipProofError;
166
+ /**
167
+ * Indicates that the user does not have sufficient entitlements to perform
168
+ * the requested operation.
169
+ */
170
+ class InsufficientEntitlementsError extends Error {
171
+ constructor() {
172
+ super('The user does not have sufficient entitlements to perform the requested operation.');
173
+ this.name = 'InsufficientEntitlementsError';
174
+ }
175
+ }
176
+ exports.InsufficientEntitlementsError = InsufficientEntitlementsError;
177
+ /**
178
+ * Indicates the requested operation failed because the user account is locked.
179
+ */
180
+ class AccountLockedError extends Error {
181
+ constructor() {
182
+ super('The requested operation failed because the user account is locked.');
183
+ this.name = 'AccountLockedError';
184
+ }
185
+ }
186
+ exports.AccountLockedError = AccountLockedError;
187
+ /**
188
+ * Indicates that an internal server error caused the operation to fail. The error
189
+ * is possibly transient and retrying at a later time may cause the operation to
190
+ * complete successfully.
191
+ */
192
+ class ServiceError extends Error {
193
+ constructor(message) {
194
+ super(message);
195
+ this.name = 'ServiceError';
196
+ }
197
+ }
198
+ exports.ServiceError = ServiceError;
199
+ /**
200
+ * Error when expected arguments are missing or invalid
201
+ */
202
+ class IllegalArgumentError extends Error {
203
+ constructor(message) {
204
+ super(message ?? 'Invalid arguments were specified');
205
+ this.name = 'IllegalArgumentError';
206
+ }
207
+ }
208
+ exports.IllegalArgumentError = IllegalArgumentError;
209
+ /**
210
+ * Error when the state of the program is expecting a value to
211
+ * be set or available and it is not.
212
+ */
213
+ class IllegalStateError extends Error {
214
+ constructor(message) {
215
+ super(message);
216
+ this.name = 'IllegalStateError';
217
+ }
218
+ }
219
+ exports.IllegalStateError = IllegalStateError;
220
+ /**
221
+ * Operation failed due to it exceeding some limits imposed for the API. For example,
222
+ * this error can occur if the resource size exceeds the database record size limit.
223
+ */
224
+ class LimitExceededError extends Error {
225
+ constructor() {
226
+ super('API limit exceeded.');
227
+ this.name = 'LimitExceededError';
228
+ }
229
+ }
230
+ exports.LimitExceededError = LimitExceededError;
231
+ /**
232
+ * API request failed due to network error or unexpected server error.
233
+ */
234
+ class RequestFailedError extends Error {
235
+ constructor(cause, statusCode) {
236
+ super(`API request failed. cause: ${cause?.message ?? '<none>'}, statusCode: ${statusCode ?? '<none>'}`);
237
+ this.name = 'RequestFailedError';
238
+ this.cause = cause;
239
+ this.statusCode = statusCode;
240
+ }
241
+ }
242
+ exports.RequestFailedError = RequestFailedError;
243
+ /**
244
+ * An unexpected error was encountered. This may result from programmatic error
245
+ * and is unlikley to be user recoverable.
246
+ */
247
+ class FatalError extends Error {
248
+ constructor(message) {
249
+ super(message);
250
+ this.name = 'FatalError';
251
+ }
252
+ }
253
+ exports.FatalError = FatalError;
254
+ /**
255
+ * No entitlements assigned to user.
256
+ */
257
+ class NoEntitlementsError extends Error {
258
+ constructor() {
259
+ super('No entitlements assigned to user.');
260
+ this.name = 'NoEntitlementsError';
261
+ }
262
+ }
263
+ exports.NoEntitlementsError = NoEntitlementsError;
264
+ /**
265
+ * Token presented was not valid for the purpose.
266
+ */
267
+ class InvalidTokenError extends Error {
268
+ constructor() {
269
+ super('Invalid token.');
270
+ this.name = 'InvalidTokenError';
271
+ }
272
+ }
273
+ exports.InvalidTokenError = InvalidTokenError;
274
+ /**
275
+ * Key not found from store when using cryptoProvider
276
+ */
277
+ class KeyNotFoundError extends Error {
278
+ constructor(message) {
279
+ super(message ?? 'Key not found.');
280
+ this.name = 'KeyNotFoundError';
281
+ }
282
+ }
283
+ exports.KeyNotFoundError = KeyNotFoundError;
284
+ /**
285
+ * Underlying secure key store does not support key export
286
+ */
287
+ class KeyStoreNotExportableError extends Error {
288
+ constructor(message) {
289
+ super(message ?? 'Key store not exportable.');
290
+ this.name = 'KeyStoreNotExportableError';
291
+ }
292
+ }
293
+ exports.KeyStoreNotExportableError = KeyStoreNotExportableError;
294
+ /**
295
+ * No key archive provided prior to unarchiving
296
+ */
297
+ class KeyArchiveMissingError extends Error {
298
+ constructor(message) {
299
+ super(message ?? 'No key archive provided prior to unarchiving');
300
+ this.name = 'KeyArchiveMissingError';
301
+ }
302
+ }
303
+ exports.KeyArchiveMissingError = KeyArchiveMissingError;
304
+ /**
305
+ * No password provided to unarchive secure archive
306
+ */
307
+ class KeyArchivePasswordRequiredError extends Error {
308
+ constructor(message) {
309
+ super(message ?? 'No password provided to unarchive secure archive');
310
+ this.name = 'KeyArchivePasswordRequiredError';
311
+ }
312
+ }
313
+ exports.KeyArchivePasswordRequiredError = KeyArchivePasswordRequiredError;
314
+ /**
315
+ * No password required to unarchive insecure archive
316
+ */
317
+ class KeyArchiveNoPasswordRequiredError extends Error {
318
+ constructor(message) {
319
+ super(message ?? 'No password required to unarchive insecure archive');
320
+ this.name = 'KeyArchiveNoPasswordRequiredError';
321
+ }
322
+ }
323
+ exports.KeyArchiveNoPasswordRequiredError = KeyArchiveNoPasswordRequiredError;
324
+ /**
325
+ * Key archive data could not be decoded as expected
326
+ */
327
+ class KeyArchiveDecodingError extends Error {
328
+ constructor(message) {
329
+ super(message ?? 'Key archive data could not be decoded as expected');
330
+ this.name = 'KeyArchiveDecodingError';
331
+ }
332
+ }
333
+ exports.KeyArchiveDecodingError = KeyArchiveDecodingError;
334
+ /**
335
+ * Key archive was unable to be decrypted using the provided password
336
+ */
337
+ class KeyArchiveIncorrectPasswordError extends Error {
338
+ constructor(message) {
339
+ super(message ??
340
+ 'Key archive was unable to be decrypted using the provided password');
341
+ this.name = 'KeyArchiveIncorrectPasswordError';
342
+ }
343
+ }
344
+ exports.KeyArchiveIncorrectPasswordError = KeyArchiveIncorrectPasswordError;
345
+ /**
346
+ * Key archive type is not supported
347
+ */
348
+ class KeyArchiveTypeError extends Error {
349
+ constructor(keyArchiveType) {
350
+ super(`Key archive type ${keyArchiveType} is not supported`);
351
+ this.name = 'KeyArchiveTypeError';
352
+ }
353
+ }
354
+ exports.KeyArchiveTypeError = KeyArchiveTypeError;
355
+ /**
356
+ * Key archive version is not supported
357
+ */
358
+ class KeyArchiveVersionError extends Error {
359
+ constructor(version) {
360
+ super(`Key archive version ${version} is not supported`);
361
+ this.name = 'KeyArchiveVersionError';
362
+ }
363
+ }
364
+ exports.KeyArchiveVersionError = KeyArchiveVersionError;
365
+ /**
366
+ * Key archive key type is not recognized
367
+ */
368
+ class KeyArchiveUnknownKeyTypeError extends Error {
369
+ constructor(message) {
370
+ super(message ?? 'Key type is not recognized');
371
+ this.name = 'KeyArchiveUnknownKeyTypeError';
372
+ }
373
+ }
374
+ exports.KeyArchiveUnknownKeyTypeError = KeyArchiveUnknownKeyTypeError;
375
+ /**
376
+ * Operation not implemented
377
+ */
378
+ class OperationNotImplementedError extends Error {
379
+ constructor(message) {
380
+ super(message ?? 'Operation is not implemented');
381
+ this.name = 'OperationNotImplementedError';
382
+ }
383
+ }
384
+ exports.OperationNotImplementedError = OperationNotImplementedError;
385
+ /**
386
+ * Encryption algorithm is not recognized
387
+ */
388
+ class UnrecognizedAlgorithmError extends Error {
389
+ constructor(message) {
390
+ super(message ?? 'Unrecognized encryption algorithm name.');
391
+ this.name = 'UnrecognizedAlgorithmError';
392
+ }
393
+ }
394
+ exports.UnrecognizedAlgorithmError = UnrecognizedAlgorithmError;
395
+ /**
396
+ * Helper method for mapping an App Sync error to common errors.
397
+ *
398
+ * For consumption by other Sudo Platform SDKs
399
+ *
400
+ * @param error The App Sync error to map
401
+ * @returns The mapped error
402
+ */
403
+ function mapGraphQLToClientError(error) {
404
+ switch (error.errorType) {
405
+ case 'sudoplatform.AccountLockedError':
406
+ return new AccountLockedError();
407
+ case 'sudoplatform.InsufficientEntitlementsError':
408
+ return new InsufficientEntitlementsError();
409
+ case 'sudoplatform.InvalidTokenError':
410
+ return new InvalidTokenError();
411
+ case 'sudoplatform.InvalidArgumentError':
412
+ return new IllegalArgumentError();
413
+ case 'sudoplatform.LimitExceededError':
414
+ return new LimitExceededError();
415
+ case 'sudoplatform.NoEntitlementsError':
416
+ return new NoEntitlementsError();
417
+ case 'sudoplatform.ServiceError':
418
+ return new ServiceError(error.message);
419
+ default:
420
+ return new UnknownGraphQLError(error);
421
+ }
422
+ }
423
+ exports.mapGraphQLToClientError = mapGraphQLToClientError;
424
+ /**
425
+ * Call this in error handling when testing with isAppSyncNetworkError on
426
+ * a caught error from an AppSync operation returns true.
427
+ *
428
+ * @param error AppSyncNetworkError to map
429
+ *
430
+ * @returns Mapped error
431
+ */
432
+ function mapNetworkErrorToClientError(error) {
433
+ const networkError = error.networkError;
434
+ switch (networkError.statusCode) {
435
+ case 401:
436
+ return new NotAuthorizedError();
437
+ default:
438
+ return new RequestFailedError(networkError, networkError.statusCode);
439
+ }
440
+ }
441
+ exports.mapNetworkErrorToClientError = mapNetworkErrorToClientError;
442
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/errors/error.ts"],"names":[],"mappings":";;;AAYA,SAAgB,qBAAqB,CAAC,CAAQ;IAC5C,8DAA8D;IAC9D,OAAO,CAAC,CAAE,CAAiB,CAAC,YAAY,CAAA;AAC1C,CAAC;AAHD,sDAGC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,KAAc;QACxB,MAAM,iBAAiB,GAAG,KAAqB,CAAA;QAC/C,IAAI,OAAe,CAAA;QACnB,IAAI,iBAAiB,EAAE,SAAS,EAAE;YAChC,OAAO,GAAG,SAAS,iBAAiB,CAAC,SAAS,cAAc,iBAAiB,CAAC,OAAO,EAAE,CAAA;SACxF;aAAM,IAAI,iBAAiB,EAAE,OAAO,EAAE;YACrC,OAAO,GAAG,iBAAiB,EAAE,OAAO,CAAA;SACrC;aAAM,IAAI,iBAAiB,EAAE,IAAI,EAAE;YAClC,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAA;SACjC;aAAM;YACL,OAAO,GAA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figurationManager';
2
+ export * from './sudoKeyArchive';
3
+ export * from './sudoKeyManager';
4
+ export * from './utils/base64';
5
+ export * from './utils/buffer';
6
+ export * from './utils/stream';
7
+ export * from './errors/error';
8
+ export * from './logging/logger';
9
+ export * from './types/types';
package/cjs/index.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./configurationManager/defaultConfigurationManager"), exports);
5
+ tslib_1.__exportStar(require("./sudoKeyArchive"), exports);
6
+ tslib_1.__exportStar(require("./sudoKeyManager"), exports);
7
+ tslib_1.__exportStar(require("./utils/base64"), exports);
8
+ tslib_1.__exportStar(require("./utils/buffer"), exports);
9
+ tslib_1.__exportStar(require("./utils/stream"), exports);
10
+ tslib_1.__exportStar(require("./errors/error"), exports);
11
+ tslib_1.__exportStar(require("./logging/logger"), exports);
12
+ tslib_1.__exportStar(require("./types/types"), exports);
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6FAAkE;AAClE,2DAAgC;AAChC,2DAAgC;AAChC,yDAA8B;AAC9B,yDAA8B;AAC9B,yDAA8B;AAC9B,yDAA8B;AAC9B,2DAAgC;AAChC,wDAA6B"}
@@ -0,0 +1,8 @@
1
+ import { createLogger } from 'browser-bunyan';
2
+ import * as t from 'io-ts';
3
+ declare const Level: t.UnionC<[t.LiteralC<"trace">, t.LiteralC<"debug">, t.LiteralC<"info">, t.LiteralC<"warn">, t.LiteralC<"error">, t.LiteralC<"fatal">]>;
4
+ declare type Level = t.TypeOf<typeof Level>;
5
+ export declare function getLogLevel(level: string | undefined): Level | undefined;
6
+ export declare function createBunyanLogger(identifier?: string, logLevel?: string): BunyanLogger;
7
+ export declare type BunyanLogger = ReturnType<typeof createLogger>;
8
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBunyanLogger = exports.getLogLevel = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const browser_bunyan_1 = require("browser-bunyan");
6
+ const console_plain_stream_1 = require("@browser-bunyan/console-plain-stream");
7
+ const t = tslib_1.__importStar(require("io-ts"));
8
+ const pipeable_1 = require("fp-ts/lib/pipeable");
9
+ const Either_1 = require("fp-ts/lib/Either");
10
+ const Level = t.union([
11
+ t.literal('trace'),
12
+ t.literal('debug'),
13
+ t.literal('info'),
14
+ t.literal('warn'),
15
+ t.literal('error'),
16
+ t.literal('fatal'),
17
+ ]);
18
+ function getLogLevel(level) {
19
+ if (!level) {
20
+ return undefined;
21
+ }
22
+ return (0, pipeable_1.pipe)(Level.decode(level), (0, Either_1.fold)(() => undefined, (v) => v));
23
+ }
24
+ exports.getLogLevel = getLogLevel;
25
+ function createBunyanLogger(identifier, logLevel) {
26
+ const level = getLogLevel(process.env.LOG_LEVEL) || getLogLevel(logLevel) || 'info';
27
+ const log = (0, browser_bunyan_1.createLogger)({
28
+ name: process.env.PROJECT_NAME || identifier || 'rootLogger',
29
+ level,
30
+ serializers: browser_bunyan_1.stdSerializers,
31
+ stream: new console_plain_stream_1.ConsolePlainStream(),
32
+ });
33
+ return log;
34
+ }
35
+ exports.createBunyanLogger = createBunyanLogger;
36
+ //# sourceMappingURL=bunyanLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bunyanLogger.js","sourceRoot":"","sources":["../../src/logging/bunyanLogger.ts"],"names":[],"mappings":";;;;AAAA,mDAA6D;AAC7D,+EAAyE;AACzE,iDAA0B;AAC1B,iDAAyC;AACzC,6CAAuC;AAEvC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IACpB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;CACnB,CAAC,CAAA;AAIF,SAAgB,WAAW,CAAC,KAAyB;IACnD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAA;KACjB;IAED,OAAO,IAAA,eAAI,EACT,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACnB,IAAA,aAAI,EACF,GAAG,EAAE,CAAC,SAAS,EACf,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CACT,CACF,CAAA;AACH,CAAC;AAZD,kCAYC;AAED,SAAgB,kBAAkB,CAChC,UAAmB,EACnB,QAAiB;IAEjB,MAAM,KAAK,GACT,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAA;IACvE,MAAM,GAAG,GAAG,IAAA,6BAAY,EAAC;QACvB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,UAAU,IAAI,YAAY;QAC5D,KAAK;QACL,WAAW,EAAE,+BAAc;QAC3B,MAAM,EAAE,IAAI,yCAAkB,EAAE;KACjC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC;AAbD,gDAaC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Interface encapsulating logger functions.
3
+ */
4
+ export interface Logger {
5
+ /**
6
+ * @returns Whether or not trace level logging is enabled
7
+ */
8
+ trace(): boolean;
9
+ /**
10
+ * Will log the given message with the logger implementation using the TRACE level
11
+ * @param message the message to be logged
12
+ * @param fields optional fields that represent an object
13
+ */
14
+ trace(message: string, fields?: Record<string, unknown>): void;
15
+ /**
16
+ * @returns Whether or not debug level logging is enabled
17
+ */
18
+ debug(): boolean;
19
+ /**
20
+ * Will log the given message with the logger implementation using the DEBUG level
21
+ * @param message the message to be logged
22
+ * @param fields optional fields that represent an object
23
+ */
24
+ debug(message: string, fields?: Record<string, unknown>): void;
25
+ /**
26
+ * @returns Whether or not info level logging is enabled
27
+ */
28
+ info(): boolean;
29
+ /**
30
+ * Will log the given message with the logger implementation using the INFO level
31
+ * @param message the message to be logged
32
+ * @param fields optional fields that represent an object
33
+ */
34
+ info(message: string, fields?: Record<string, unknown>): void;
35
+ /**
36
+ * @returns Whether or not warn level logging is enabled
37
+ */
38
+ warn(): boolean;
39
+ /**
40
+ * Will log the given message with the logger implementation using the WARN level
41
+ * @param message the message to be logged
42
+ * @param fields optional fields that represent an object
43
+ */
44
+ warn(message: string, fields?: Record<string, unknown>): void;
45
+ /**
46
+ * @returns Whether or not error level logging is enabled
47
+ */
48
+ error(): boolean;
49
+ /**
50
+ * Will log the given message with the logger implementation using the ERROR level
51
+ * @param message the message to be logged
52
+ * @param fields optional fields that represent an object
53
+ */
54
+ error(message: string, fields?: Record<string, unknown>): void;
55
+ /**
56
+ * @returns Whether or not fatal level logging is enabled
57
+ */
58
+ fatal(): boolean;
59
+ /**
60
+ * Will log the given message with the logger implementation using the FATAL level
61
+ * @param message the message to be logged
62
+ * @param fields optional fields that represent an object
63
+ */
64
+ fatal(message: string, fields?: Record<string, unknown>): void;
65
+ }
66
+ export declare class DefaultLogger implements Logger {
67
+ private logger;
68
+ /**
69
+ * The default logger implementation which wraps browser-bunyan
70
+ *
71
+ * @param identifier the name of the module
72
+ * @param logLevel the log level for the module
73
+ */
74
+ constructor(identifier?: string, logLevel?: string);
75
+ trace(): boolean;
76
+ trace(message: string, fields?: Record<string, unknown>): void;
77
+ debug(): boolean;
78
+ debug(message: string, fields?: Record<string, unknown>): void;
79
+ info(): boolean;
80
+ info(message: string, fields?: Record<string, unknown>): void;
81
+ warn(): boolean;
82
+ warn(message: string, fields?: Record<string, unknown>): void;
83
+ error(): boolean;
84
+ error(message: string, fields?: Record<string, unknown>): void;
85
+ fatal(): boolean;
86
+ fatal(message: string, fields?: Record<string, unknown>): void;
87
+ }