@nmshd/transport 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (497) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +18 -0
  3. package/dist/TransportBuildInformation.d.ts +13 -0
  4. package/dist/TransportBuildInformation.js +25 -0
  5. package/dist/TransportBuildInformation.js.map +1 -0
  6. package/dist/core/CoreCrypto.d.ts +108 -0
  7. package/dist/core/CoreCrypto.js +205 -0
  8. package/dist/core/CoreCrypto.js.map +1 -0
  9. package/dist/core/CoreError.d.ts +18 -0
  10. package/dist/core/CoreError.js +63 -0
  11. package/dist/core/CoreError.js.map +1 -0
  12. package/dist/core/CoreIdHelper.d.ts +9 -0
  13. package/dist/core/CoreIdHelper.js +23 -0
  14. package/dist/core/CoreIdHelper.js.map +1 -0
  15. package/dist/core/CoreIds.d.ts +9 -0
  16. package/dist/core/CoreIds.js +14 -0
  17. package/dist/core/CoreIds.js.map +1 -0
  18. package/dist/core/CoreSerializable.d.ts +18 -0
  19. package/dist/core/CoreSerializable.js +44 -0
  20. package/dist/core/CoreSerializable.js.map +1 -0
  21. package/dist/core/CoreSerializableAsync.d.ts +18 -0
  22. package/dist/core/CoreSerializableAsync.js +44 -0
  23. package/dist/core/CoreSerializableAsync.js.map +1 -0
  24. package/dist/core/CoreSynchronizable.d.ts +11 -0
  25. package/dist/core/CoreSynchronizable.js +30 -0
  26. package/dist/core/CoreSynchronizable.js.map +1 -0
  27. package/dist/core/CoreUtil.d.ts +6 -0
  28. package/dist/core/CoreUtil.js +38 -0
  29. package/dist/core/CoreUtil.js.map +1 -0
  30. package/dist/core/DbCollectionNames.d.ts +11 -0
  31. package/dist/core/DbCollectionNames.js +16 -0
  32. package/dist/core/DbCollectionNames.js.map +1 -0
  33. package/dist/core/ICacheable.d.ts +4 -0
  34. package/dist/core/ICacheable.js +14 -0
  35. package/dist/core/ICacheable.js.map +1 -0
  36. package/dist/core/Transport.d.ts +47 -0
  37. package/dist/core/Transport.js +71 -0
  38. package/dist/core/Transport.js.map +1 -0
  39. package/dist/core/TransportContext.d.ts +8 -0
  40. package/dist/core/TransportContext.js +29 -0
  41. package/dist/core/TransportContext.js.map +1 -0
  42. package/dist/core/TransportController.d.ts +51 -0
  43. package/dist/core/TransportController.js +99 -0
  44. package/dist/core/TransportController.js.map +1 -0
  45. package/dist/core/TransportErrors.d.ts +125 -0
  46. package/dist/core/TransportErrors.js +255 -0
  47. package/dist/core/TransportErrors.js.map +1 -0
  48. package/dist/core/TransportLoggerFactory.d.ts +7 -0
  49. package/dist/core/TransportLoggerFactory.js +23 -0
  50. package/dist/core/TransportLoggerFactory.js.map +1 -0
  51. package/dist/core/backbone/AuthClient.d.ts +17 -0
  52. package/dist/core/backbone/AuthClient.js +47 -0
  53. package/dist/core/backbone/AuthClient.js.map +1 -0
  54. package/dist/core/backbone/Authenticator.d.ts +16 -0
  55. package/dist/core/backbone/Authenticator.js +62 -0
  56. package/dist/core/backbone/Authenticator.js.map +1 -0
  57. package/dist/core/backbone/BackboneIds.d.ts +11 -0
  58. package/dist/core/backbone/BackboneIds.js +16 -0
  59. package/dist/core/backbone/BackboneIds.js.map +1 -0
  60. package/dist/core/backbone/ClientResult.d.ts +19 -0
  61. package/dist/core/backbone/ClientResult.js +58 -0
  62. package/dist/core/backbone/ClientResult.js.map +1 -0
  63. package/dist/core/backbone/Paginator.d.ts +17 -0
  64. package/dist/core/backbone/Paginator.js +44 -0
  65. package/dist/core/backbone/Paginator.js.map +1 -0
  66. package/dist/core/backbone/PlatformError.d.ts +9 -0
  67. package/dist/core/backbone/PlatformError.js +3 -0
  68. package/dist/core/backbone/PlatformError.js.map +1 -0
  69. package/dist/core/backbone/PlatformParameters.d.ts +6 -0
  70. package/dist/core/backbone/PlatformParameters.js +3 -0
  71. package/dist/core/backbone/PlatformParameters.js.map +1 -0
  72. package/dist/core/backbone/PlatformResponse.d.ts +16 -0
  73. package/dist/core/backbone/PlatformResponse.js +3 -0
  74. package/dist/core/backbone/PlatformResponse.js.map +1 -0
  75. package/dist/core/backbone/RESTClient.d.ts +46 -0
  76. package/dist/core/backbone/RESTClient.js +425 -0
  77. package/dist/core/backbone/RESTClient.js.map +1 -0
  78. package/dist/core/backbone/RESTClientAuthenticate.d.ts +23 -0
  79. package/dist/core/backbone/RESTClientAuthenticate.js +72 -0
  80. package/dist/core/backbone/RESTClientAuthenticate.js.map +1 -0
  81. package/dist/core/backbone/RequestError.d.ts +24 -0
  82. package/dist/core/backbone/RequestError.js +101 -0
  83. package/dist/core/backbone/RequestError.js.map +1 -0
  84. package/dist/core/backbone/index.d.ts +6 -0
  85. package/dist/core/backbone/index.js +19 -0
  86. package/dist/core/backbone/index.js.map +1 -0
  87. package/dist/core/index.d.ts +16 -0
  88. package/dist/core/index.js +29 -0
  89. package/dist/core/index.js.map +1 -0
  90. package/dist/core/logging/logExecutionTime.d.ts +26 -0
  91. package/dist/core/logging/logExecutionTime.js +58 -0
  92. package/dist/core/logging/logExecutionTime.js.map +1 -0
  93. package/dist/core/types/CoreAddress.d.ts +15 -0
  94. package/dist/core/types/CoreAddress.js +56 -0
  95. package/dist/core/types/CoreAddress.js.map +1 -0
  96. package/dist/core/types/CoreDate.d.ts +37 -0
  97. package/dist/core/types/CoreDate.js +156 -0
  98. package/dist/core/types/CoreDate.js.map +1 -0
  99. package/dist/core/types/CoreHash.d.ts +37 -0
  100. package/dist/core/types/CoreHash.js +75 -0
  101. package/dist/core/types/CoreHash.js.map +1 -0
  102. package/dist/core/types/CoreId.d.ts +16 -0
  103. package/dist/core/types/CoreId.js +57 -0
  104. package/dist/core/types/CoreId.js.map +1 -0
  105. package/dist/core/types/TransportVersion.d.ts +4 -0
  106. package/dist/core/types/TransportVersion.js +9 -0
  107. package/dist/core/types/TransportVersion.js.map +1 -0
  108. package/dist/core/types/index.d.ts +5 -0
  109. package/dist/core/types/index.js +18 -0
  110. package/dist/core/types/index.js.map +1 -0
  111. package/dist/index.d.ts +3 -0
  112. package/dist/index.js +16 -0
  113. package/dist/index.js.map +1 -0
  114. package/dist/modules/accounts/AccountController.d.ts +77 -0
  115. package/dist/modules/accounts/AccountController.js +337 -0
  116. package/dist/modules/accounts/AccountController.js.map +1 -0
  117. package/dist/modules/accounts/IdentityController.d.ts +21 -0
  118. package/dist/modules/accounts/IdentityController.js +67 -0
  119. package/dist/modules/accounts/IdentityController.js.map +1 -0
  120. package/dist/modules/accounts/IdentityUtil.d.ts +6 -0
  121. package/dist/modules/accounts/IdentityUtil.js +56 -0
  122. package/dist/modules/accounts/IdentityUtil.js.map +1 -0
  123. package/dist/modules/accounts/backbone/IdentityClient.d.ts +23 -0
  124. package/dist/modules/accounts/backbone/IdentityClient.js +15 -0
  125. package/dist/modules/accounts/backbone/IdentityClient.js.map +1 -0
  126. package/dist/modules/accounts/data/Identity.d.ts +34 -0
  127. package/dist/modules/accounts/data/Identity.js +69 -0
  128. package/dist/modules/accounts/data/Identity.js.map +1 -0
  129. package/dist/modules/accounts/data/IdentitySecretCredentials.d.ts +16 -0
  130. package/dist/modules/accounts/data/IdentitySecretCredentials.js +47 -0
  131. package/dist/modules/accounts/data/IdentitySecretCredentials.js.map +1 -0
  132. package/dist/modules/certificates/CertificateController.d.ts +14 -0
  133. package/dist/modules/certificates/CertificateController.js +20 -0
  134. package/dist/modules/certificates/CertificateController.js.map +1 -0
  135. package/dist/modules/certificates/CertificateIssuer.d.ts +27 -0
  136. package/dist/modules/certificates/CertificateIssuer.js +42 -0
  137. package/dist/modules/certificates/CertificateIssuer.js.map +1 -0
  138. package/dist/modules/certificates/CertificateValidator.d.ts +14 -0
  139. package/dist/modules/certificates/CertificateValidator.js +20 -0
  140. package/dist/modules/certificates/CertificateValidator.js.map +1 -0
  141. package/dist/modules/certificates/data/Certificate.d.ts +34 -0
  142. package/dist/modules/certificates/data/Certificate.js +65 -0
  143. package/dist/modules/certificates/data/Certificate.js.map +1 -0
  144. package/dist/modules/certificates/data/CertificateConstraint.d.ts +10 -0
  145. package/dist/modules/certificates/data/CertificateConstraint.js +28 -0
  146. package/dist/modules/certificates/data/CertificateConstraint.js.map +1 -0
  147. package/dist/modules/certificates/data/CertificateContent.d.ts +28 -0
  148. package/dist/modules/certificates/data/CertificateContent.js +70 -0
  149. package/dist/modules/certificates/data/CertificateContent.js.map +1 -0
  150. package/dist/modules/certificates/data/CertificateItem.d.ts +11 -0
  151. package/dist/modules/certificates/data/CertificateItem.js +29 -0
  152. package/dist/modules/certificates/data/CertificateItem.js.map +1 -0
  153. package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.d.ts +29 -0
  154. package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js +57 -0
  155. package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js.map +1 -0
  156. package/dist/modules/certificates/data/constraints/CertificateCityConstraint.d.ts +31 -0
  157. package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js +60 -0
  158. package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js.map +1 -0
  159. package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.d.ts +9 -0
  160. package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js +31 -0
  161. package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js.map +1 -0
  162. package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.d.ts +16 -0
  163. package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js +41 -0
  164. package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js.map +1 -0
  165. package/dist/modules/certificates/data/items/CertificateAuthorizationItem.d.ts +17 -0
  166. package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js +39 -0
  167. package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js.map +1 -0
  168. package/dist/modules/certificates/data/items/CertificateDelegateItem.d.ts +18 -0
  169. package/dist/modules/certificates/data/items/CertificateDelegateItem.js +46 -0
  170. package/dist/modules/certificates/data/items/CertificateDelegateItem.js.map +1 -0
  171. package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.d.ts +19 -0
  172. package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js +42 -0
  173. package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js.map +1 -0
  174. package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.d.ts +25 -0
  175. package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js +55 -0
  176. package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js.map +1 -0
  177. package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.d.ts +14 -0
  178. package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js +39 -0
  179. package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js.map +1 -0
  180. package/dist/modules/certificates/data/items/CertificateRoleItem.d.ts +16 -0
  181. package/dist/modules/certificates/data/items/CertificateRoleItem.js +38 -0
  182. package/dist/modules/certificates/data/items/CertificateRoleItem.js.map +1 -0
  183. package/dist/modules/challenges/ChallengeController.d.ts +16 -0
  184. package/dist/modules/challenges/ChallengeController.js +123 -0
  185. package/dist/modules/challenges/ChallengeController.js.map +1 -0
  186. package/dist/modules/challenges/backbone/ChallengeAuthClient.d.ts +18 -0
  187. package/dist/modules/challenges/backbone/ChallengeAuthClient.js +14 -0
  188. package/dist/modules/challenges/backbone/ChallengeAuthClient.js.map +1 -0
  189. package/dist/modules/challenges/backbone/ChallengeClient.d.ts +6 -0
  190. package/dist/modules/challenges/backbone/ChallengeClient.js +11 -0
  191. package/dist/modules/challenges/backbone/ChallengeClient.js.map +1 -0
  192. package/dist/modules/challenges/data/Challenge.d.ts +22 -0
  193. package/dist/modules/challenges/data/Challenge.js +59 -0
  194. package/dist/modules/challenges/data/Challenge.js.map +1 -0
  195. package/dist/modules/challenges/data/ChallengeSigned.d.ts +18 -0
  196. package/dist/modules/challenges/data/ChallengeSigned.js +50 -0
  197. package/dist/modules/challenges/data/ChallengeSigned.js.map +1 -0
  198. package/dist/modules/devices/DeviceController.d.ts +27 -0
  199. package/dist/modules/devices/DeviceController.js +120 -0
  200. package/dist/modules/devices/DeviceController.js.map +1 -0
  201. package/dist/modules/devices/DeviceSecretController.d.ts +36 -0
  202. package/dist/modules/devices/DeviceSecretController.js +163 -0
  203. package/dist/modules/devices/DeviceSecretController.js.map +1 -0
  204. package/dist/modules/devices/DevicesController.d.ts +20 -0
  205. package/dist/modules/devices/DevicesController.js +96 -0
  206. package/dist/modules/devices/DevicesController.js.map +1 -0
  207. package/dist/modules/devices/backbone/BackbonePostDevices.d.ts +11 -0
  208. package/dist/modules/devices/backbone/BackbonePostDevices.js +3 -0
  209. package/dist/modules/devices/backbone/BackbonePostDevices.js.map +1 -0
  210. package/dist/modules/devices/backbone/DeviceAuthClient.d.ts +18 -0
  211. package/dist/modules/devices/backbone/DeviceAuthClient.js +21 -0
  212. package/dist/modules/devices/backbone/DeviceAuthClient.js.map +1 -0
  213. package/dist/modules/devices/backbone/DeviceClient.d.ts +7 -0
  214. package/dist/modules/devices/backbone/DeviceClient.js +15 -0
  215. package/dist/modules/devices/backbone/DeviceClient.js.map +1 -0
  216. package/dist/modules/devices/local/Device.d.ts +46 -0
  217. package/dist/modules/devices/local/Device.js +115 -0
  218. package/dist/modules/devices/local/Device.js.map +1 -0
  219. package/dist/modules/devices/local/DeviceSecretCredentials.d.ts +12 -0
  220. package/dist/modules/devices/local/DeviceSecretCredentials.js +40 -0
  221. package/dist/modules/devices/local/DeviceSecretCredentials.js.map +1 -0
  222. package/dist/modules/devices/local/SendDeviceParameters.d.ts +13 -0
  223. package/dist/modules/devices/local/SendDeviceParameters.js +43 -0
  224. package/dist/modules/devices/local/SendDeviceParameters.js.map +1 -0
  225. package/dist/modules/devices/transmission/DeviceSharedSecret.d.ts +33 -0
  226. package/dist/modules/devices/transmission/DeviceSharedSecret.js +90 -0
  227. package/dist/modules/devices/transmission/DeviceSharedSecret.js.map +1 -0
  228. package/dist/modules/files/FileController.d.ts +25 -0
  229. package/dist/modules/files/FileController.js +196 -0
  230. package/dist/modules/files/FileController.js.map +1 -0
  231. package/dist/modules/files/backbone/BackboneGetFiles.d.ts +21 -0
  232. package/dist/modules/files/backbone/BackboneGetFiles.js +3 -0
  233. package/dist/modules/files/backbone/BackboneGetFiles.js.map +1 -0
  234. package/dist/modules/files/backbone/BackbonePostFiles.d.ts +25 -0
  235. package/dist/modules/files/backbone/BackbonePostFiles.js +3 -0
  236. package/dist/modules/files/backbone/BackbonePostFiles.js.map +1 -0
  237. package/dist/modules/files/backbone/FileClient.d.ts +12 -0
  238. package/dist/modules/files/backbone/FileClient.js +23 -0
  239. package/dist/modules/files/backbone/FileClient.js.map +1 -0
  240. package/dist/modules/files/local/CachedFile.d.ts +47 -0
  241. package/dist/modules/files/local/CachedFile.js +140 -0
  242. package/dist/modules/files/local/CachedFile.js.map +1 -0
  243. package/dist/modules/files/local/File.d.ts +27 -0
  244. package/dist/modules/files/local/File.js +88 -0
  245. package/dist/modules/files/local/File.js.map +1 -0
  246. package/dist/modules/files/local/SendFileParameters.d.ts +23 -0
  247. package/dist/modules/files/local/SendFileParameters.js +65 -0
  248. package/dist/modules/files/local/SendFileParameters.js.map +1 -0
  249. package/dist/modules/files/transmission/FileMetadata.d.ts +24 -0
  250. package/dist/modules/files/transmission/FileMetadata.js +69 -0
  251. package/dist/modules/files/transmission/FileMetadata.js.map +1 -0
  252. package/dist/modules/files/transmission/FileReference.d.ts +15 -0
  253. package/dist/modules/files/transmission/FileReference.js +66 -0
  254. package/dist/modules/files/transmission/FileReference.js.map +1 -0
  255. package/dist/modules/index.d.ts +110 -0
  256. package/dist/modules/index.js +123 -0
  257. package/dist/modules/index.js.map +1 -0
  258. package/dist/modules/messages/MessageController.d.ts +29 -0
  259. package/dist/modules/messages/MessageController.js +316 -0
  260. package/dist/modules/messages/MessageController.js.map +1 -0
  261. package/dist/modules/messages/backbone/BackboneGetMessages.d.ts +25 -0
  262. package/dist/modules/messages/backbone/BackboneGetMessages.js +3 -0
  263. package/dist/modules/messages/backbone/BackboneGetMessages.js.map +1 -0
  264. package/dist/modules/messages/backbone/BackbonePostMessages.d.ts +16 -0
  265. package/dist/modules/messages/backbone/BackbonePostMessages.js +3 -0
  266. package/dist/modules/messages/backbone/BackbonePostMessages.js.map +1 -0
  267. package/dist/modules/messages/backbone/MessageClient.d.ts +12 -0
  268. package/dist/modules/messages/backbone/MessageClient.js +23 -0
  269. package/dist/modules/messages/backbone/MessageClient.js.map +1 -0
  270. package/dist/modules/messages/local/CachedMessage.d.ts +23 -0
  271. package/dist/modules/messages/local/CachedMessage.js +67 -0
  272. package/dist/modules/messages/local/CachedMessage.js.map +1 -0
  273. package/dist/modules/messages/local/Message.d.ts +26 -0
  274. package/dist/modules/messages/local/Message.js +87 -0
  275. package/dist/modules/messages/local/Message.js.map +1 -0
  276. package/dist/modules/messages/local/SendMessageParameters.d.ts +15 -0
  277. package/dist/modules/messages/local/SendMessageParameters.js +44 -0
  278. package/dist/modules/messages/local/SendMessageParameters.js.map +1 -0
  279. package/dist/modules/messages/transmission/MessageEnvelope.d.ts +24 -0
  280. package/dist/modules/messages/transmission/MessageEnvelope.js +81 -0
  281. package/dist/modules/messages/transmission/MessageEnvelope.js.map +1 -0
  282. package/dist/modules/messages/transmission/MessageEnvelopeRecipient.d.ts +16 -0
  283. package/dist/modules/messages/transmission/MessageEnvelopeRecipient.js +47 -0
  284. package/dist/modules/messages/transmission/MessageEnvelopeRecipient.js.map +1 -0
  285. package/dist/modules/messages/transmission/MessagePlain.d.ts +29 -0
  286. package/dist/modules/messages/transmission/MessagePlain.js +68 -0
  287. package/dist/modules/messages/transmission/MessagePlain.js.map +1 -0
  288. package/dist/modules/messages/transmission/MessageSignature.d.ts +11 -0
  289. package/dist/modules/messages/transmission/MessageSignature.js +36 -0
  290. package/dist/modules/messages/transmission/MessageSignature.js.map +1 -0
  291. package/dist/modules/messages/transmission/MessageSigned.d.ts +15 -0
  292. package/dist/modules/messages/transmission/MessageSigned.js +43 -0
  293. package/dist/modules/messages/transmission/MessageSigned.js.map +1 -0
  294. package/dist/modules/relationshipTemplates/RelationshipTemplateController.d.ts +26 -0
  295. package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +156 -0
  296. package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -0
  297. package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.d.ts +17 -0
  298. package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.js +3 -0
  299. package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.js.map +1 -0
  300. package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.d.ts +9 -0
  301. package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.js +3 -0
  302. package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.js.map +1 -0
  303. package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.d.ts +11 -0
  304. package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.js +20 -0
  305. package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.js.map +1 -0
  306. package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.d.ts +29 -0
  307. package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js +80 -0
  308. package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js.map +1 -0
  309. package/dist/modules/relationshipTemplates/local/RelationshipTemplate.d.ts +26 -0
  310. package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js +85 -0
  311. package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js.map +1 -0
  312. package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.d.ts +14 -0
  313. package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js +44 -0
  314. package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js.map +1 -0
  315. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.d.ts +16 -0
  316. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.js +45 -0
  317. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.js.map +1 -0
  318. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.d.ts +19 -0
  319. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.js +61 -0
  320. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.js.map +1 -0
  321. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.d.ts +12 -0
  322. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.js +39 -0
  323. package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.js.map +1 -0
  324. package/dist/modules/relationships/RelationshipSecretController.d.ts +31 -0
  325. package/dist/modules/relationships/RelationshipSecretController.js +161 -0
  326. package/dist/modules/relationships/RelationshipSecretController.js.map +1 -0
  327. package/dist/modules/relationships/RelationshipsController.d.ts +47 -0
  328. package/dist/modules/relationships/RelationshipsController.js +472 -0
  329. package/dist/modules/relationships/RelationshipsController.js.map +1 -0
  330. package/dist/modules/relationships/backbone/BackboneGetRelationships.d.ts +18 -0
  331. package/dist/modules/relationships/backbone/BackboneGetRelationships.js +3 -0
  332. package/dist/modules/relationships/backbone/BackboneGetRelationships.js.map +1 -0
  333. package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.d.ts +23 -0
  334. package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.js +3 -0
  335. package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.js.map +1 -0
  336. package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.d.ts +8 -0
  337. package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.js +3 -0
  338. package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.js.map +1 -0
  339. package/dist/modules/relationships/backbone/RelationshipClient.d.ts +17 -0
  340. package/dist/modules/relationships/backbone/RelationshipClient.js +42 -0
  341. package/dist/modules/relationships/backbone/RelationshipClient.js.map +1 -0
  342. package/dist/modules/relationships/local/CachedRelationship.d.ts +18 -0
  343. package/dist/modules/relationships/local/CachedRelationship.js +53 -0
  344. package/dist/modules/relationships/local/CachedRelationship.js.map +1 -0
  345. package/dist/modules/relationships/local/Relationship.d.ts +37 -0
  346. package/dist/modules/relationships/local/Relationship.js +140 -0
  347. package/dist/modules/relationships/local/Relationship.js.map +1 -0
  348. package/dist/modules/relationships/local/SendRelationshipParameters.d.ts +13 -0
  349. package/dist/modules/relationships/local/SendRelationshipParameters.js +39 -0
  350. package/dist/modules/relationships/local/SendRelationshipParameters.js.map +1 -0
  351. package/dist/modules/relationships/transmission/RelationshipStatus.d.ts +8 -0
  352. package/dist/modules/relationships/transmission/RelationshipStatus.js +13 -0
  353. package/dist/modules/relationships/transmission/RelationshipStatus.js.map +1 -0
  354. package/dist/modules/relationships/transmission/changes/RelationshipChange.d.ts +27 -0
  355. package/dist/modules/relationships/transmission/changes/RelationshipChange.js +72 -0
  356. package/dist/modules/relationships/transmission/changes/RelationshipChange.js.map +1 -0
  357. package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.d.ts +20 -0
  358. package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js +53 -0
  359. package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js.map +1 -0
  360. package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.d.ts +20 -0
  361. package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js +53 -0
  362. package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js.map +1 -0
  363. package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.d.ts +6 -0
  364. package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js +11 -0
  365. package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js.map +1 -0
  366. package/dist/modules/relationships/transmission/changes/RelationshipChangeType.d.ts +5 -0
  367. package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js +10 -0
  368. package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js.map +1 -0
  369. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.d.ts +13 -0
  370. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js +42 -0
  371. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js.map +1 -0
  372. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.d.ts +15 -0
  373. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.js +44 -0
  374. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.js.map +1 -0
  375. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.d.ts +14 -0
  376. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js +44 -0
  377. package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js.map +1 -0
  378. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.d.ts +13 -0
  379. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js +42 -0
  380. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js.map +1 -0
  381. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.d.ts +12 -0
  382. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.js +38 -0
  383. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.js.map +1 -0
  384. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.d.ts +14 -0
  385. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js +44 -0
  386. package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js.map +1 -0
  387. package/dist/modules/secrets/SecretController.d.ts +39 -0
  388. package/dist/modules/secrets/SecretController.js +168 -0
  389. package/dist/modules/secrets/SecretController.js.map +1 -0
  390. package/dist/modules/secrets/data/SecretContainerCipher.d.ts +25 -0
  391. package/dist/modules/secrets/data/SecretContainerCipher.js +87 -0
  392. package/dist/modules/secrets/data/SecretContainerCipher.js.map +1 -0
  393. package/dist/modules/secrets/data/SecretContainerPlain.d.ts +25 -0
  394. package/dist/modules/secrets/data/SecretContainerPlain.js +76 -0
  395. package/dist/modules/secrets/data/SecretContainerPlain.js.map +1 -0
  396. package/dist/modules/sync/ChangedItems.d.ts +9 -0
  397. package/dist/modules/sync/ChangedItems.js +17 -0
  398. package/dist/modules/sync/ChangedItems.js.map +1 -0
  399. package/dist/modules/sync/DatawalletModificationMapper.d.ts +7 -0
  400. package/dist/modules/sync/DatawalletModificationMapper.js +62 -0
  401. package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -0
  402. package/dist/modules/sync/DatawalletModificationsProcessor.d.ts +21 -0
  403. package/dist/modules/sync/DatawalletModificationsProcessor.js +111 -0
  404. package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -0
  405. package/dist/modules/sync/ExternalEventsProcessor.d.ts +19 -0
  406. package/dist/modules/sync/ExternalEventsProcessor.js +83 -0
  407. package/dist/modules/sync/ExternalEventsProcessor.js.map +1 -0
  408. package/dist/modules/sync/SyncController.d.ts +37 -0
  409. package/dist/modules/sync/SyncController.js +214 -0
  410. package/dist/modules/sync/SyncController.js.map +1 -0
  411. package/dist/modules/sync/SynchronizedCollection.d.ts +18 -0
  412. package/dist/modules/sync/SynchronizedCollection.js +163 -0
  413. package/dist/modules/sync/SynchronizedCollection.js.map +1 -0
  414. package/dist/modules/sync/WhatToSync.d.ts +1 -0
  415. package/dist/modules/sync/WhatToSync.js +3 -0
  416. package/dist/modules/sync/WhatToSync.js.map +1 -0
  417. package/dist/modules/sync/backbone/BackboneDatawalletModification.d.ts +11 -0
  418. package/dist/modules/sync/backbone/BackboneDatawalletModification.js +3 -0
  419. package/dist/modules/sync/backbone/BackboneDatawalletModification.js.map +1 -0
  420. package/dist/modules/sync/backbone/BackboneExternalEvent.d.ts +8 -0
  421. package/dist/modules/sync/backbone/BackboneExternalEvent.js +3 -0
  422. package/dist/modules/sync/backbone/BackboneExternalEvent.js.map +1 -0
  423. package/dist/modules/sync/backbone/BackboneSyncRun.d.ts +9 -0
  424. package/dist/modules/sync/backbone/BackboneSyncRun.js +3 -0
  425. package/dist/modules/sync/backbone/BackboneSyncRun.js.map +1 -0
  426. package/dist/modules/sync/backbone/CreateDatawalletModifications.d.ts +19 -0
  427. package/dist/modules/sync/backbone/CreateDatawalletModifications.js +3 -0
  428. package/dist/modules/sync/backbone/CreateDatawalletModifications.js.map +1 -0
  429. package/dist/modules/sync/backbone/FinalizeSyncRun.d.ts +23 -0
  430. package/dist/modules/sync/backbone/FinalizeSyncRun.js +3 -0
  431. package/dist/modules/sync/backbone/FinalizeSyncRun.js.map +1 -0
  432. package/dist/modules/sync/backbone/GetDatawalletModifications.d.ts +3 -0
  433. package/dist/modules/sync/backbone/GetDatawalletModifications.js +3 -0
  434. package/dist/modules/sync/backbone/GetDatawalletModifications.js.map +1 -0
  435. package/dist/modules/sync/backbone/StartSyncRun.d.ts +9 -0
  436. package/dist/modules/sync/backbone/StartSyncRun.js +9 -0
  437. package/dist/modules/sync/backbone/StartSyncRun.js.map +1 -0
  438. package/dist/modules/sync/backbone/SyncClient.d.ts +15 -0
  439. package/dist/modules/sync/backbone/SyncClient.js +23 -0
  440. package/dist/modules/sync/backbone/SyncClient.js.map +1 -0
  441. package/dist/modules/sync/local/DatawalletModification.d.ts +30 -0
  442. package/dist/modules/sync/local/DatawalletModification.js +71 -0
  443. package/dist/modules/sync/local/DatawalletModification.js.map +1 -0
  444. package/dist/modules/tokens/AnonymousTokenController.d.ts +11 -0
  445. package/dist/modules/tokens/AnonymousTokenController.js +47 -0
  446. package/dist/modules/tokens/AnonymousTokenController.js.map +1 -0
  447. package/dist/modules/tokens/TokenController.d.ts +24 -0
  448. package/dist/modules/tokens/TokenController.js +137 -0
  449. package/dist/modules/tokens/TokenController.js.map +1 -0
  450. package/dist/modules/tokens/backbone/AnonymousTokenClient.d.ts +6 -0
  451. package/dist/modules/tokens/backbone/AnonymousTokenClient.js +11 -0
  452. package/dist/modules/tokens/backbone/AnonymousTokenClient.js.map +1 -0
  453. package/dist/modules/tokens/backbone/BackboneGetTokens.d.ts +11 -0
  454. package/dist/modules/tokens/backbone/BackboneGetTokens.js +3 -0
  455. package/dist/modules/tokens/backbone/BackboneGetTokens.js.map +1 -0
  456. package/dist/modules/tokens/backbone/BackbonePostTokens.d.ts +9 -0
  457. package/dist/modules/tokens/backbone/BackbonePostTokens.js +3 -0
  458. package/dist/modules/tokens/backbone/BackbonePostTokens.js.map +1 -0
  459. package/dist/modules/tokens/backbone/TokenClient.d.ts +11 -0
  460. package/dist/modules/tokens/backbone/TokenClient.js +20 -0
  461. package/dist/modules/tokens/backbone/TokenClient.js.map +1 -0
  462. package/dist/modules/tokens/local/CachedToken.d.ts +18 -0
  463. package/dist/modules/tokens/local/CachedToken.js +53 -0
  464. package/dist/modules/tokens/local/CachedToken.js.map +1 -0
  465. package/dist/modules/tokens/local/SendTokenParameters.d.ts +14 -0
  466. package/dist/modules/tokens/local/SendTokenParameters.js +43 -0
  467. package/dist/modules/tokens/local/SendTokenParameters.js.map +1 -0
  468. package/dist/modules/tokens/local/Token.d.ts +28 -0
  469. package/dist/modules/tokens/local/Token.js +91 -0
  470. package/dist/modules/tokens/local/Token.js.map +1 -0
  471. package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.d.ts +10 -0
  472. package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.js +34 -0
  473. package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.js.map +1 -0
  474. package/dist/modules/tokens/transmission/TokenContentFile.d.ts +12 -0
  475. package/dist/modules/tokens/transmission/TokenContentFile.js +39 -0
  476. package/dist/modules/tokens/transmission/TokenContentFile.js.map +1 -0
  477. package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.d.ts +12 -0
  478. package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.js +39 -0
  479. package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.js.map +1 -0
  480. package/dist/modules/tokens/transmission/TokenReference.d.ts +14 -0
  481. package/dist/modules/tokens/transmission/TokenReference.js +71 -0
  482. package/dist/modules/tokens/transmission/TokenReference.js.map +1 -0
  483. package/dist/util/PasswordGenerator.d.ts +28 -0
  484. package/dist/util/PasswordGenerator.js +179 -0
  485. package/dist/util/PasswordGenerator.js.map +1 -0
  486. package/dist/util/Random.d.ts +50 -0
  487. package/dist/util/Random.js +129 -0
  488. package/dist/util/Random.js.map +1 -0
  489. package/dist/util/index.d.ts +2 -0
  490. package/dist/util/index.js +15 -0
  491. package/dist/util/index.js.map +1 -0
  492. package/lib-web/nmshd.transport.js +54733 -0
  493. package/lib-web/nmshd.transport.js.map +1 -0
  494. package/lib-web/nmshd.transport.min.js +3 -0
  495. package/lib-web/nmshd.transport.min.js.map +1 -0
  496. package/package.json +109 -0
  497. package/ui5.yaml +9 -0
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientResult = void 0;
4
+ const CoreDate_1 = require("../types/CoreDate");
5
+ class ClientResult {
6
+ constructor(isSuccess, value, error, platformParameters) {
7
+ if (isSuccess && error) {
8
+ throw new Error("InvalidOperation: A result cannot be successful and contain an error");
9
+ }
10
+ if (!isSuccess && !error) {
11
+ throw new Error("InvalidOperation: A failing result needs to contain an error");
12
+ }
13
+ if (value !== undefined && !isSuccess) {
14
+ throw new Error("InvalidOperation: A value is only useful in case of a success.");
15
+ }
16
+ this._value = value;
17
+ this._isSuccess = isSuccess;
18
+ this._error = error;
19
+ if (platformParameters) {
20
+ this.requestTime = platformParameters.requestTime
21
+ ? CoreDate_1.CoreDate.from(platformParameters.requestTime)
22
+ : undefined;
23
+ this.responseDuration = platformParameters.responseDuration
24
+ ? parseInt(platformParameters.responseDuration)
25
+ : undefined;
26
+ this.responseTime = platformParameters.responseTime
27
+ ? CoreDate_1.CoreDate.from(platformParameters.responseTime)
28
+ : undefined;
29
+ this.traceId = platformParameters.traceId;
30
+ }
31
+ }
32
+ get isSuccess() {
33
+ return this._isSuccess;
34
+ }
35
+ get isError() {
36
+ return !this._isSuccess;
37
+ }
38
+ get error() {
39
+ if (this._isSuccess) {
40
+ throw new Error("Can't get the error of an succeeded result. Use 'value' instead.");
41
+ }
42
+ return this._error;
43
+ }
44
+ get value() {
45
+ if (!this._isSuccess) {
46
+ throw this.error;
47
+ }
48
+ return this._value;
49
+ }
50
+ static fail(error, platformParameters) {
51
+ return new ClientResult(false, undefined, error, platformParameters);
52
+ }
53
+ static ok(value, platformParameters) {
54
+ return new ClientResult(true, value, undefined, platformParameters);
55
+ }
56
+ }
57
+ exports.ClientResult = ClientResult;
58
+ //# sourceMappingURL=ClientResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientResult.js","sourceRoot":"","sources":["../../../src/core/backbone/ClientResult.ts"],"names":[],"mappings":";;;AACA,gDAA4C;AAG5C,MAAa,YAAY;IAUrB,YACI,SAAkB,EAClB,KAAS,EACT,KAAwB,EACxB,kBAAuC;QAEvC,IAAI,SAAS,IAAI,KAAK,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAA;SAC1F;QACD,IAAI,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAA;SAClF;QAED,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,SAAS,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;SACpF;QAED,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QAEnB,IAAI,kBAAkB,EAAE;YACpB,IAAI,CAAC,WAAW,GAAG,kBAAkB,CAAC,WAAW;gBAC7C,CAAC,CAAC,mBAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC;gBAC/C,CAAC,CAAC,SAAS,CAAA;YAEf,IAAI,CAAC,gBAAgB,GAAG,kBAAkB,CAAC,gBAAgB;gBACvD,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,gBAAgB,CAAC;gBAC/C,CAAC,CAAC,SAAS,CAAA;YAEf,IAAI,CAAC,YAAY,GAAG,kBAAkB,CAAC,YAAY;gBAC/C,CAAC,CAAC,mBAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC;gBAChD,CAAC,CAAC,SAAS,CAAA;YAEf,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAA;SAC5C;IACL,CAAC;IAED,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAA;IAC1B,CAAC;IAED,IAAW,OAAO;QACd,OAAO,CAAC,IAAI,CAAC,UAAU,CAAA;IAC3B,CAAC;IAED,IAAW,KAAK;QACZ,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAA;SACtF;QAED,OAAO,IAAI,CAAC,MAAO,CAAA;IACvB,CAAC;IAED,IAAW,KAAK;QACZ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,MAAM,IAAI,CAAC,KAAK,CAAA;SACnB;QAED,OAAO,IAAI,CAAC,MAAO,CAAA;IACvB,CAAC;IAEM,MAAM,CAAC,IAAI,CAAI,KAAuB,EAAE,kBAAuC;QAClF,OAAO,IAAI,YAAY,CAAI,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAA;IAC3E,CAAC;IAEM,MAAM,CAAC,EAAE,CAAI,KAAQ,EAAE,kBAAuC;QACjE,OAAO,IAAI,YAAY,CAAI,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAA;IAC1E,CAAC;CACJ;AA/ED,oCA+EC"}
@@ -0,0 +1,17 @@
1
+ import { PaginationProperties } from "./PlatformResponse";
2
+ export interface IPaginationDataSource<T> {
3
+ getPage(pageNumber: number): Promise<T[]>;
4
+ }
5
+ export declare class Paginator<T> implements AsyncIterable<T> {
6
+ private currentPage;
7
+ private readonly paginationProperties;
8
+ private readonly dataSource;
9
+ private currentItemIndex;
10
+ constructor(currentPage: T[], paginationProperties: PaginationProperties, dataSource: IPaginationDataSource<T>);
11
+ private hasNext;
12
+ private next;
13
+ private hasNextPage;
14
+ private nextPage;
15
+ collect(): Promise<T[]>;
16
+ [Symbol.asyncIterator](): AsyncIterator<T, any, undefined>;
17
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Paginator = void 0;
4
+ class Paginator {
5
+ constructor(currentPage, paginationProperties, dataSource) {
6
+ this.currentPage = currentPage;
7
+ this.paginationProperties = paginationProperties;
8
+ this.dataSource = dataSource;
9
+ this.currentItemIndex = 0;
10
+ }
11
+ hasNext() {
12
+ return this.hasNextPage() || this.currentItemIndex < this.currentPage.length;
13
+ }
14
+ async next() {
15
+ const isAtEndOfPage = this.currentItemIndex >= this.currentPage.length;
16
+ if (isAtEndOfPage && this.hasNextPage()) {
17
+ this.currentItemIndex = 0;
18
+ this.currentPage = await this.nextPage();
19
+ }
20
+ return this.currentPage[this.currentItemIndex++];
21
+ }
22
+ hasNextPage() {
23
+ return this.paginationProperties.pageNumber < this.paginationProperties.totalPages;
24
+ }
25
+ async nextPage() {
26
+ this.paginationProperties.pageNumber++;
27
+ const response = await this.dataSource.getPage(this.paginationProperties.pageNumber);
28
+ return response;
29
+ }
30
+ async collect() {
31
+ const collection = this.currentPage;
32
+ while (this.hasNextPage()) {
33
+ collection.push(...(await this.nextPage()));
34
+ }
35
+ return collection;
36
+ }
37
+ [Symbol.asyncIterator]() {
38
+ return {
39
+ next: async () => this.hasNext() ? { value: await this.next(), done: false } : { value: undefined, done: true }
40
+ };
41
+ }
42
+ }
43
+ exports.Paginator = Paginator;
44
+ //# sourceMappingURL=Paginator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Paginator.js","sourceRoot":"","sources":["../../../src/core/backbone/Paginator.ts"],"names":[],"mappings":";;;AAMA,MAAa,SAAS;IAGlB,YACY,WAAgB,EACP,oBAA0C,EAC1C,UAAoC;QAF7C,gBAAW,GAAX,WAAW,CAAK;QACP,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,eAAU,GAAV,UAAU,CAA0B;QALjD,qBAAgB,GAAG,CAAC,CAAA;IAMzB,CAAC;IAEI,OAAO;QACX,OAAO,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAA;IAChF,CAAC;IAEO,KAAK,CAAC,IAAI;QACd,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAA;QACtE,IAAI,aAAa,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACrC,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAA;YACzB,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAA;SAC3C;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA;IACpD,CAAC;IAEO,WAAW;QACf,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAA;IACtF,CAAC;IAEO,KAAK,CAAC,QAAQ;QAClB,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,CAAA;QACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAA;QACpF,OAAO,QAAQ,CAAA;IACnB,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAA;QAEnC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE;YACvB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;SAC9C;QAED,OAAO,UAAU,CAAA;IACrB,CAAC;IAEM,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,OAAO;YACH,IAAI,EAAE,KAAK,IAAI,EAAE,CACb,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;SACpG,CAAA;IACL,CAAC;CACJ;AAjDD,8BAiDC"}
@@ -0,0 +1,9 @@
1
+ export interface PlatformError {
2
+ id: string;
3
+ code: string;
4
+ details: string | null;
5
+ message: string;
6
+ docs: string;
7
+ status: number | null;
8
+ time: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=PlatformError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformError.js","sourceRoot":"","sources":["../../../src/core/backbone/PlatformError.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface PlatformParameters {
2
+ requestTime?: string;
3
+ responseDuration?: string;
4
+ responseTime?: string;
5
+ traceId?: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=PlatformParameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformParameters.js","sourceRoot":"","sources":["../../../src/core/backbone/PlatformParameters.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { PlatformError } from "./PlatformError";
2
+ export interface PlatformResponse<T> {
3
+ result?: T;
4
+ error?: PlatformError;
5
+ }
6
+ export interface PaginationProperties {
7
+ pageNumber: number;
8
+ pageSize: number;
9
+ totalPages: number;
10
+ totalRecords: number;
11
+ }
12
+ export interface PaginatedPlatformResponse<T> {
13
+ result?: T;
14
+ error?: PlatformError;
15
+ pagination?: PaginationProperties;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=PlatformResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformResponse.js","sourceRoot":"","sources":["../../../src/core/backbone/PlatformResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ /// <reference types="node" />
2
+ import { ILogger } from "@js-soft/logging-abstractions";
3
+ import { AxiosInstance, AxiosRequestConfig } from "axios";
4
+ import { Agent } from "http";
5
+ import { Agent as HTTPSAgent } from "https";
6
+ import { IConfig } from "../../core";
7
+ import { ClientResult } from "./ClientResult";
8
+ import { IPaginationDataSource, Paginator } from "./Paginator";
9
+ export declare class RestPaginationDataSource<T> implements IPaginationDataSource<T> {
10
+ private readonly client;
11
+ private readonly path;
12
+ private args;
13
+ constructor(client: RESTClient, path: string, args: any);
14
+ getPage(pageNumber: number): Promise<T[]>;
15
+ }
16
+ export declare enum RESTClientLogDirective {
17
+ LogNone = 0,
18
+ LogRequest = 1,
19
+ LogResponse = 2,
20
+ LogAll = 3
21
+ }
22
+ export declare class RESTClient {
23
+ protected readonly config: IConfig;
24
+ protected requestConfig: AxiosRequestConfig;
25
+ protected _logger: ILogger;
26
+ protected _logDirective: RESTClientLogDirective;
27
+ private _httpAgent?;
28
+ private _httpsAgent?;
29
+ logRequest(): boolean;
30
+ logResponse(): boolean;
31
+ createHTTPAgent(): Agent;
32
+ createHTTPSAgent(): HTTPSAgent;
33
+ private generateRequestId;
34
+ constructor(config: IConfig, requestConfig?: AxiosRequestConfig);
35
+ protected createAxios(): AxiosInstance;
36
+ private addAxiosLoggingInterceptors;
37
+ private getResult;
38
+ private getPaginator;
39
+ get<T>(path: string, params?: any, config?: AxiosRequestConfig): Promise<ClientResult<T>>;
40
+ getPaged<T>(path: string, params?: any, config?: AxiosRequestConfig): Promise<ClientResult<Paginator<T>>>;
41
+ post<T>(path: string, data: any, params?: any, config?: AxiosRequestConfig): Promise<ClientResult<T>>;
42
+ postMultipart<T>(path: string, data: any, config?: AxiosRequestConfig): Promise<ClientResult<T>>;
43
+ put<T>(path: string, data: any, config?: AxiosRequestConfig): Promise<ClientResult<T>>;
44
+ delete<T>(path: string, config?: AxiosRequestConfig): Promise<ClientResult<T>>;
45
+ download<T>(path: string, config?: AxiosRequestConfig): Promise<ClientResult<T>>;
46
+ }
@@ -0,0 +1,425 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RESTClient = exports.RESTClientLogDirective = exports.RestPaginationDataSource = void 0;
7
+ const crypto_1 = require("@nmshd/crypto");
8
+ const axios_1 = __importDefault(require("axios"));
9
+ const form_data_1 = __importDefault(require("form-data"));
10
+ const http_1 = require("http");
11
+ const https_1 = require("https");
12
+ const lodash_1 = __importDefault(require("lodash"));
13
+ const qs_1 = __importDefault(require("qs"));
14
+ const TransportLoggerFactory_1 = require("../TransportLoggerFactory");
15
+ const types_1 = require("../types");
16
+ const ClientResult_1 = require("./ClientResult");
17
+ const Paginator_1 = require("./Paginator");
18
+ const RequestError_1 = require("./RequestError");
19
+ class RestPaginationDataSource {
20
+ constructor(client, path, args) {
21
+ this.client = client;
22
+ this.path = path;
23
+ this.args = args;
24
+ }
25
+ async getPage(pageNumber) {
26
+ this.args.pageNumber = pageNumber;
27
+ return (await this.client.get(this.path, this.args)).value;
28
+ }
29
+ }
30
+ exports.RestPaginationDataSource = RestPaginationDataSource;
31
+ var RESTClientLogDirective;
32
+ (function (RESTClientLogDirective) {
33
+ RESTClientLogDirective[RESTClientLogDirective["LogNone"] = 0] = "LogNone";
34
+ RESTClientLogDirective[RESTClientLogDirective["LogRequest"] = 1] = "LogRequest";
35
+ RESTClientLogDirective[RESTClientLogDirective["LogResponse"] = 2] = "LogResponse";
36
+ RESTClientLogDirective[RESTClientLogDirective["LogAll"] = 3] = "LogAll";
37
+ })(RESTClientLogDirective = exports.RESTClientLogDirective || (exports.RESTClientLogDirective = {}));
38
+ class RESTClient {
39
+ constructor(config, requestConfig = {}) {
40
+ this.config = config;
41
+ this.requestConfig = requestConfig;
42
+ this._logDirective = RESTClientLogDirective.LogAll;
43
+ const defaults = {
44
+ baseURL: config.baseUrl,
45
+ timeout: this.config.platformTimeout,
46
+ maxRedirects: this.config.platformMaxRedirects,
47
+ maxContentLength: Infinity,
48
+ maxBodyLength: Infinity,
49
+ validateStatus: (status) => status < 300 || status === 400 || status === 404 || status === 500,
50
+ paramsSerializer: (params) => {
51
+ return qs_1.default.stringify(params, {
52
+ arrayFormat: "repeat",
53
+ encode: false,
54
+ allowDots: true
55
+ });
56
+ }
57
+ };
58
+ if (this.config.platformAdditionalHeaders) {
59
+ defaults.headers = this.config.platformAdditionalHeaders;
60
+ }
61
+ if (typeof http_1.Agent !== "undefined" && typeof https_1.Agent !== "undefined") {
62
+ defaults.httpAgent = this.createHTTPAgent();
63
+ defaults.httpsAgent = this.createHTTPSAgent();
64
+ }
65
+ this.requestConfig = lodash_1.default.defaultsDeep(this.requestConfig, defaults);
66
+ this._logger = TransportLoggerFactory_1.TransportLoggerFactory.getLogger(RESTClient);
67
+ }
68
+ logRequest() {
69
+ return (this._logDirective === RESTClientLogDirective.LogRequest ||
70
+ this._logDirective === RESTClientLogDirective.LogAll);
71
+ }
72
+ logResponse() {
73
+ return (this._logDirective === RESTClientLogDirective.LogResponse ||
74
+ this._logDirective === RESTClientLogDirective.LogAll);
75
+ }
76
+ createHTTPAgent() {
77
+ if (this._httpAgent) {
78
+ return this._httpAgent;
79
+ }
80
+ this._httpAgent = new http_1.Agent(this.config.httpAgent);
81
+ return this._httpAgent;
82
+ }
83
+ createHTTPSAgent() {
84
+ if (this._httpsAgent) {
85
+ return this._httpsAgent;
86
+ }
87
+ this._httpsAgent = new https_1.Agent(this.config.httpsAgent);
88
+ return this._httpsAgent;
89
+ }
90
+ async generateRequestId() {
91
+ const id = await types_1.CoreId.generate("HTTP");
92
+ return id.toString();
93
+ }
94
+ createAxios() {
95
+ const axiosInstance = axios_1.default.create(this.requestConfig);
96
+ if (this.config.debug) {
97
+ this.addAxiosLoggingInterceptors(axiosInstance);
98
+ }
99
+ return axiosInstance;
100
+ }
101
+ addAxiosLoggingInterceptors(axiosInstance) {
102
+ axiosInstance.interceptors.request.use((config) => {
103
+ const requestAsAny = config;
104
+ requestAsAny.meta = config.meta || {};
105
+ requestAsAny.meta.startTime = new Date().getTime();
106
+ return config;
107
+ });
108
+ axiosInstance.interceptors.response.use((response) => {
109
+ logResponseTime(response);
110
+ return response;
111
+ });
112
+ const logResponseTime = (response) => {
113
+ var _a;
114
+ const requestStartTime = response.config.meta.startTime;
115
+ // Backbone Call duration
116
+ const backboneResponseDuration = ((_a = response.headers) === null || _a === void 0 ? void 0 : _a["x-response-duration-ms"])
117
+ ? Number.parseInt(response.headers["x-response-duration-ms"])
118
+ : undefined;
119
+ const backboneMessage = `${response.config.method.toUpperCase()} ${response.request.path} (backbone call): ${backboneResponseDuration ? `${backboneResponseDuration}ms` : "unknown"}`;
120
+ if (backboneResponseDuration && backboneResponseDuration > 200) {
121
+ this._logger.warn(backboneMessage);
122
+ }
123
+ else {
124
+ this._logger.debug(backboneMessage);
125
+ }
126
+ // Latency duration
127
+ const requestEndTime = new Date().getTime();
128
+ const callAndLatencyMilliseconds = requestEndTime - requestStartTime;
129
+ const latencyMilliseconds = backboneResponseDuration
130
+ ? callAndLatencyMilliseconds - backboneResponseDuration
131
+ : undefined;
132
+ const latencyMessage = `${response.config.method.toUpperCase()} ${response.request.path} (latency): ${latencyMilliseconds}ms`;
133
+ this._logger.debug(latencyMessage);
134
+ // Backbone Call + Latency duration
135
+ this._logger.debug(`${response.config.method.toUpperCase()} ${response.request.path} (backbone call + latency): ${callAndLatencyMilliseconds}ms`);
136
+ };
137
+ }
138
+ getResult(method, path, response, requestId) {
139
+ var _a, _b, _c;
140
+ const platformParameters = {
141
+ requestTime: response.headers["x-request-time"],
142
+ responseDuration: response.headers["x-response-duration-ms"],
143
+ responseTime: response.headers["x-response-time"],
144
+ traceId: response.headers["x-trace-id"]
145
+ };
146
+ if (response.data && this.logResponse()) {
147
+ const message = `Response ${requestId}: ${method} ${path} | TraceId: '${platformParameters.traceId}' | PlatformDuration: ${platformParameters.responseDuration}`;
148
+ try {
149
+ this._logger.trace(message, JSON.stringify(response.data, undefined, 2));
150
+ }
151
+ catch (e) {
152
+ this._logger.trace(message);
153
+ }
154
+ }
155
+ // Rare case: We receive status 400 JSON error from backbone when downloading a file
156
+ if (response.status === 400 &&
157
+ !((_a = response.data) === null || _a === void 0 ? void 0 : _a.error) &&
158
+ response.headers["content-type"] === "application/json; charset=utf-8") {
159
+ try {
160
+ const errorText = crypto_1.CoreBuffer.from(response.data).toUtf8();
161
+ response.data = JSON.parse(errorText);
162
+ }
163
+ catch (e) {
164
+ // Do nothing here: Error is handled below
165
+ }
166
+ }
167
+ if ((_b = response.data) === null || _b === void 0 ? void 0 : _b.error) {
168
+ const backboneError = response.data.error;
169
+ const error = new RequestError_1.RequestError(method, path, platformParameters, backboneError.code, backboneError.message, backboneError.docs, response.status, backboneError.time, {
170
+ id: backboneError.id,
171
+ details: backboneError.details
172
+ });
173
+ this._logger.debug(error);
174
+ return ClientResult_1.ClientResult.fail(error, platformParameters);
175
+ }
176
+ if (response.status === 204) {
177
+ return ClientResult_1.ClientResult.ok({}, platformParameters);
178
+ }
179
+ if (response.status === 404) {
180
+ const error = new RequestError_1.RequestError(method, path, platformParameters, "error.transport.request.notFound", "The requested entity was not found. Make sure the ID exists and the record is not expired.", "", 404);
181
+ this._logger.debug(error);
182
+ return ClientResult_1.ClientResult.fail(error, platformParameters);
183
+ }
184
+ if (response.status >= 400 && response.status <= 499) {
185
+ const error = new RequestError_1.RequestError(method, path, platformParameters, "error.transport.request.badRequest", "The platform responded with a Bad Request without giving any specific reason.", "", response.status).setObject(response.data);
186
+ this._logger.debug(error);
187
+ return ClientResult_1.ClientResult.fail(error, platformParameters);
188
+ }
189
+ if ((typeof Buffer === "function" && response.data instanceof Buffer) || response.data instanceof ArrayBuffer) {
190
+ // Casting is required for typescript to not complain => data is a buffer
191
+ return ClientResult_1.ClientResult.ok(response.data, platformParameters);
192
+ }
193
+ if (!((_c = response.data) === null || _c === void 0 ? void 0 : _c.result)) {
194
+ const error = new RequestError_1.RequestError(method, path, platformParameters, "error.transport.request.resultUndefined", "The Platform responded without a result.").setObject(response.data);
195
+ this._logger.debug(error);
196
+ return ClientResult_1.ClientResult.fail(error, platformParameters);
197
+ }
198
+ return ClientResult_1.ClientResult.ok(response.data.result, platformParameters);
199
+ }
200
+ getPaginator(path, response, requestId, args) {
201
+ var _a, _b;
202
+ const platformParameters = {
203
+ requestTime: response.headers["x-request-time"],
204
+ responseDuration: response.headers["x-response-duration-ms"],
205
+ responseTime: response.headers["x-response-time"],
206
+ traceId: response.headers["x-trace-id"]
207
+ };
208
+ if (response.data && this.logResponse()) {
209
+ const message = `Response ${requestId}: GET ${path} | TraceId: '${platformParameters.traceId}' | PlatformDuration: ${platformParameters.responseDuration}`;
210
+ try {
211
+ this._logger.trace(message, JSON.stringify(response.data, undefined, 2));
212
+ }
213
+ catch (e) {
214
+ this._logger.trace(message);
215
+ }
216
+ }
217
+ if ((_a = response.data) === null || _a === void 0 ? void 0 : _a.error) {
218
+ const backboneError = response.data.error;
219
+ const error = new RequestError_1.RequestError("GET", path, platformParameters, backboneError.code, backboneError.message, backboneError.docs, response.status, backboneError.time, {
220
+ id: backboneError.id,
221
+ details: backboneError.details
222
+ });
223
+ this._logger.debug(error);
224
+ return ClientResult_1.ClientResult.fail(error, platformParameters);
225
+ }
226
+ if (response.status >= 400 && response.status <= 499) {
227
+ const error = new RequestError_1.RequestError("GET", path, platformParameters, "error.transport.request.badRequest", "The platform responded with a Bad Request without giving any specific reason.", "", response.status).setObject(response.data);
228
+ this._logger.debug(error);
229
+ return ClientResult_1.ClientResult.fail(error, platformParameters);
230
+ }
231
+ if (!((_b = response.data) === null || _b === void 0 ? void 0 : _b.result)) {
232
+ const error = new RequestError_1.RequestError("GET", path, platformParameters, "error.transport.request.resultUndefined", "The Platform responded without a result.").setObject(response.data);
233
+ this._logger.debug(error);
234
+ return ClientResult_1.ClientResult.fail(error, platformParameters);
235
+ }
236
+ if (!response.data.pagination) {
237
+ response.data.pagination = {
238
+ pageNumber: 1,
239
+ pageSize: response.data.result.length,
240
+ totalPages: 1,
241
+ totalRecords: response.data.result.length
242
+ };
243
+ }
244
+ const paginationDataSource = new RestPaginationDataSource(this, path, args);
245
+ const paginator = new Paginator_1.Paginator(response.data.result, response.data.pagination, paginationDataSource);
246
+ return ClientResult_1.ClientResult.ok(paginator, platformParameters);
247
+ }
248
+ async get(path, params = {}, config) {
249
+ const id = await this.generateRequestId();
250
+ const conf = lodash_1.default.defaultsDeep({ params: params }, config, this.requestConfig);
251
+ if (this.logRequest()) {
252
+ const anyThis = this;
253
+ if (anyThis._username) {
254
+ this._logger.trace(`Request ${id} by ${anyThis._username}: GET ${path}`);
255
+ }
256
+ else {
257
+ this._logger.trace(`Request ${id}: GET ${path}`);
258
+ }
259
+ }
260
+ try {
261
+ const response = await this.createAxios().get(path, conf);
262
+ return this.getResult("GET", path, response, id);
263
+ }
264
+ catch (e) {
265
+ const err = RequestError_1.RequestError.fromAxiosError("GET", path, e, id);
266
+ this._logger.debug(err);
267
+ return ClientResult_1.ClientResult.fail(err);
268
+ }
269
+ }
270
+ async getPaged(path, params = {}, config) {
271
+ const id = await this.generateRequestId();
272
+ const conf = lodash_1.default.defaultsDeep({ params: params }, config, this.requestConfig);
273
+ try {
274
+ const response = await this.createAxios().get(path, conf);
275
+ return this.getPaginator(path, response, id, params);
276
+ }
277
+ catch (e) {
278
+ const err = RequestError_1.RequestError.fromAxiosError("GET", path, e, id);
279
+ this._logger.debug(err);
280
+ return ClientResult_1.ClientResult.fail(err);
281
+ }
282
+ }
283
+ async post(path, data, params = {}, config) {
284
+ const id = await this.generateRequestId();
285
+ const conf = lodash_1.default.defaultsDeep({ params: params }, config, this.requestConfig);
286
+ if (this.logRequest()) {
287
+ const anyThis = this;
288
+ if (anyThis._username) {
289
+ this._logger.trace(`Request ${id} by ${anyThis._username}: POST ${path}`, data);
290
+ }
291
+ else {
292
+ this._logger.trace(`Request ${id}: POST ${path}`, data);
293
+ }
294
+ }
295
+ try {
296
+ const response = await this.createAxios().post(path, data, conf);
297
+ return this.getResult("POST", path, response, id);
298
+ }
299
+ catch (e) {
300
+ const err = RequestError_1.RequestError.fromAxiosError("POST", path, e, id);
301
+ this._logger.debug(err);
302
+ return ClientResult_1.ClientResult.fail(err);
303
+ }
304
+ }
305
+ async postMultipart(path, data, config) {
306
+ const id = await this.generateRequestId();
307
+ const formData = new form_data_1.default();
308
+ for (const key in data) {
309
+ if (data.hasOwnProperty(key)) {
310
+ if (key.toLowerCase() === "content") {
311
+ let value = data[key];
312
+ if (value instanceof Uint8Array && typeof Blob !== "undefined") {
313
+ value = new Blob([value]);
314
+ formData.append(key, value);
315
+ }
316
+ else {
317
+ formData.append(key, Buffer.from(value), {
318
+ filename: "cipher.bin"
319
+ });
320
+ }
321
+ }
322
+ else {
323
+ formData.append(key, data[key]);
324
+ }
325
+ }
326
+ }
327
+ const conf = lodash_1.default.defaultsDeep({}, config, this.requestConfig);
328
+ let sendData = formData;
329
+ if (typeof formData.getHeaders !== "undefined") {
330
+ const h = formData.getHeaders();
331
+ conf["headers"] = conf["headers"] || {};
332
+ for (const key in h) {
333
+ conf["headers"][key] = h[key];
334
+ }
335
+ sendData = formData.getBuffer();
336
+ }
337
+ if (this.logRequest()) {
338
+ const anyThis = this;
339
+ if (anyThis._username) {
340
+ this._logger.trace(`Request ${id} by ${anyThis._username}: POST-Upload ${path}`);
341
+ }
342
+ else {
343
+ this._logger.trace(`Request ${id}: POST-Upload ${path}`);
344
+ }
345
+ }
346
+ try {
347
+ const response = await this.createAxios().post(path, sendData, conf);
348
+ return this.getResult("POST-Upload", path, response, id);
349
+ }
350
+ catch (e) {
351
+ const err = RequestError_1.RequestError.fromAxiosError("POST-Upload", path, e, id);
352
+ this._logger.debug(err);
353
+ return ClientResult_1.ClientResult.fail(err);
354
+ }
355
+ }
356
+ async put(path, data, config) {
357
+ const id = await this.generateRequestId();
358
+ const conf = lodash_1.default.defaultsDeep({}, config, this.requestConfig);
359
+ if (this.logRequest()) {
360
+ const anyThis = this;
361
+ if (anyThis._username) {
362
+ this._logger.trace(`Request ${id} by ${anyThis._username}: PUT ${path}`, data);
363
+ }
364
+ else {
365
+ this._logger.trace(`Request ${id}: PUT ${path}`, data);
366
+ }
367
+ }
368
+ try {
369
+ const response = await this.createAxios().put(path, data, conf);
370
+ return this.getResult("PUT", path, response, id);
371
+ }
372
+ catch (e) {
373
+ const err = RequestError_1.RequestError.fromAxiosError("PUT", path, e, id);
374
+ this._logger.debug(err);
375
+ return ClientResult_1.ClientResult.fail(err);
376
+ }
377
+ }
378
+ async delete(path, config) {
379
+ const id = await this.generateRequestId();
380
+ const conf = lodash_1.default.defaultsDeep({}, config, this.requestConfig);
381
+ if (this.logRequest()) {
382
+ const anyThis = this;
383
+ if (anyThis._username) {
384
+ this._logger.trace(`Request ${id} by ${anyThis._username}: DELETE ${path}`);
385
+ }
386
+ else {
387
+ this._logger.trace(`Request ${id}: DELETE ${path}`);
388
+ }
389
+ }
390
+ try {
391
+ const response = await this.createAxios().delete(path, conf);
392
+ return this.getResult("DELETE", path, response, id);
393
+ }
394
+ catch (e) {
395
+ const err = RequestError_1.RequestError.fromAxiosError("DELETE", path, e, id);
396
+ this._logger.debug(err);
397
+ return ClientResult_1.ClientResult.fail(err);
398
+ }
399
+ }
400
+ async download(path, config) {
401
+ const id = await this.generateRequestId();
402
+ const conf = lodash_1.default.defaultsDeep({}, config, this.requestConfig);
403
+ conf.responseType = "arraybuffer";
404
+ if (this.logRequest()) {
405
+ const anyThis = this;
406
+ if (anyThis._username) {
407
+ this._logger.trace(`Request ${id} by ${anyThis._username}: GET-Download ${path}`);
408
+ }
409
+ else {
410
+ this._logger.trace(`Request ${id}: GET-Download ${path}`);
411
+ }
412
+ }
413
+ try {
414
+ const response = await this.createAxios().get(path, conf);
415
+ return this.getResult("GET-Download", path, response, id);
416
+ }
417
+ catch (e) {
418
+ const err = RequestError_1.RequestError.fromAxiosError("GET-Download", path, e, id);
419
+ this._logger.debug(err);
420
+ return ClientResult_1.ClientResult.fail(err);
421
+ }
422
+ }
423
+ }
424
+ exports.RESTClient = RESTClient;
425
+ //# sourceMappingURL=RESTClient.js.map