@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.
- package/LICENSE +1 -0
- package/README.md +18 -0
- package/dist/TransportBuildInformation.d.ts +13 -0
- package/dist/TransportBuildInformation.js +25 -0
- package/dist/TransportBuildInformation.js.map +1 -0
- package/dist/core/CoreCrypto.d.ts +108 -0
- package/dist/core/CoreCrypto.js +205 -0
- package/dist/core/CoreCrypto.js.map +1 -0
- package/dist/core/CoreError.d.ts +18 -0
- package/dist/core/CoreError.js +63 -0
- package/dist/core/CoreError.js.map +1 -0
- package/dist/core/CoreIdHelper.d.ts +9 -0
- package/dist/core/CoreIdHelper.js +23 -0
- package/dist/core/CoreIdHelper.js.map +1 -0
- package/dist/core/CoreIds.d.ts +9 -0
- package/dist/core/CoreIds.js +14 -0
- package/dist/core/CoreIds.js.map +1 -0
- package/dist/core/CoreSerializable.d.ts +18 -0
- package/dist/core/CoreSerializable.js +44 -0
- package/dist/core/CoreSerializable.js.map +1 -0
- package/dist/core/CoreSerializableAsync.d.ts +18 -0
- package/dist/core/CoreSerializableAsync.js +44 -0
- package/dist/core/CoreSerializableAsync.js.map +1 -0
- package/dist/core/CoreSynchronizable.d.ts +11 -0
- package/dist/core/CoreSynchronizable.js +30 -0
- package/dist/core/CoreSynchronizable.js.map +1 -0
- package/dist/core/CoreUtil.d.ts +6 -0
- package/dist/core/CoreUtil.js +38 -0
- package/dist/core/CoreUtil.js.map +1 -0
- package/dist/core/DbCollectionNames.d.ts +11 -0
- package/dist/core/DbCollectionNames.js +16 -0
- package/dist/core/DbCollectionNames.js.map +1 -0
- package/dist/core/ICacheable.d.ts +4 -0
- package/dist/core/ICacheable.js +14 -0
- package/dist/core/ICacheable.js.map +1 -0
- package/dist/core/Transport.d.ts +47 -0
- package/dist/core/Transport.js +71 -0
- package/dist/core/Transport.js.map +1 -0
- package/dist/core/TransportContext.d.ts +8 -0
- package/dist/core/TransportContext.js +29 -0
- package/dist/core/TransportContext.js.map +1 -0
- package/dist/core/TransportController.d.ts +51 -0
- package/dist/core/TransportController.js +99 -0
- package/dist/core/TransportController.js.map +1 -0
- package/dist/core/TransportErrors.d.ts +125 -0
- package/dist/core/TransportErrors.js +255 -0
- package/dist/core/TransportErrors.js.map +1 -0
- package/dist/core/TransportLoggerFactory.d.ts +7 -0
- package/dist/core/TransportLoggerFactory.js +23 -0
- package/dist/core/TransportLoggerFactory.js.map +1 -0
- package/dist/core/backbone/AuthClient.d.ts +17 -0
- package/dist/core/backbone/AuthClient.js +47 -0
- package/dist/core/backbone/AuthClient.js.map +1 -0
- package/dist/core/backbone/Authenticator.d.ts +16 -0
- package/dist/core/backbone/Authenticator.js +62 -0
- package/dist/core/backbone/Authenticator.js.map +1 -0
- package/dist/core/backbone/BackboneIds.d.ts +11 -0
- package/dist/core/backbone/BackboneIds.js +16 -0
- package/dist/core/backbone/BackboneIds.js.map +1 -0
- package/dist/core/backbone/ClientResult.d.ts +19 -0
- package/dist/core/backbone/ClientResult.js +58 -0
- package/dist/core/backbone/ClientResult.js.map +1 -0
- package/dist/core/backbone/Paginator.d.ts +17 -0
- package/dist/core/backbone/Paginator.js +44 -0
- package/dist/core/backbone/Paginator.js.map +1 -0
- package/dist/core/backbone/PlatformError.d.ts +9 -0
- package/dist/core/backbone/PlatformError.js +3 -0
- package/dist/core/backbone/PlatformError.js.map +1 -0
- package/dist/core/backbone/PlatformParameters.d.ts +6 -0
- package/dist/core/backbone/PlatformParameters.js +3 -0
- package/dist/core/backbone/PlatformParameters.js.map +1 -0
- package/dist/core/backbone/PlatformResponse.d.ts +16 -0
- package/dist/core/backbone/PlatformResponse.js +3 -0
- package/dist/core/backbone/PlatformResponse.js.map +1 -0
- package/dist/core/backbone/RESTClient.d.ts +46 -0
- package/dist/core/backbone/RESTClient.js +425 -0
- package/dist/core/backbone/RESTClient.js.map +1 -0
- package/dist/core/backbone/RESTClientAuthenticate.d.ts +23 -0
- package/dist/core/backbone/RESTClientAuthenticate.js +72 -0
- package/dist/core/backbone/RESTClientAuthenticate.js.map +1 -0
- package/dist/core/backbone/RequestError.d.ts +24 -0
- package/dist/core/backbone/RequestError.js +101 -0
- package/dist/core/backbone/RequestError.js.map +1 -0
- package/dist/core/backbone/index.d.ts +6 -0
- package/dist/core/backbone/index.js +19 -0
- package/dist/core/backbone/index.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +29 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logging/logExecutionTime.d.ts +26 -0
- package/dist/core/logging/logExecutionTime.js +58 -0
- package/dist/core/logging/logExecutionTime.js.map +1 -0
- package/dist/core/types/CoreAddress.d.ts +15 -0
- package/dist/core/types/CoreAddress.js +56 -0
- package/dist/core/types/CoreAddress.js.map +1 -0
- package/dist/core/types/CoreDate.d.ts +37 -0
- package/dist/core/types/CoreDate.js +156 -0
- package/dist/core/types/CoreDate.js.map +1 -0
- package/dist/core/types/CoreHash.d.ts +37 -0
- package/dist/core/types/CoreHash.js +75 -0
- package/dist/core/types/CoreHash.js.map +1 -0
- package/dist/core/types/CoreId.d.ts +16 -0
- package/dist/core/types/CoreId.js +57 -0
- package/dist/core/types/CoreId.js.map +1 -0
- package/dist/core/types/TransportVersion.d.ts +4 -0
- package/dist/core/types/TransportVersion.js +9 -0
- package/dist/core/types/TransportVersion.js.map +1 -0
- package/dist/core/types/index.d.ts +5 -0
- package/dist/core/types/index.js +18 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/accounts/AccountController.d.ts +77 -0
- package/dist/modules/accounts/AccountController.js +337 -0
- package/dist/modules/accounts/AccountController.js.map +1 -0
- package/dist/modules/accounts/IdentityController.d.ts +21 -0
- package/dist/modules/accounts/IdentityController.js +67 -0
- package/dist/modules/accounts/IdentityController.js.map +1 -0
- package/dist/modules/accounts/IdentityUtil.d.ts +6 -0
- package/dist/modules/accounts/IdentityUtil.js +56 -0
- package/dist/modules/accounts/IdentityUtil.js.map +1 -0
- package/dist/modules/accounts/backbone/IdentityClient.d.ts +23 -0
- package/dist/modules/accounts/backbone/IdentityClient.js +15 -0
- package/dist/modules/accounts/backbone/IdentityClient.js.map +1 -0
- package/dist/modules/accounts/data/Identity.d.ts +34 -0
- package/dist/modules/accounts/data/Identity.js +69 -0
- package/dist/modules/accounts/data/Identity.js.map +1 -0
- package/dist/modules/accounts/data/IdentitySecretCredentials.d.ts +16 -0
- package/dist/modules/accounts/data/IdentitySecretCredentials.js +47 -0
- package/dist/modules/accounts/data/IdentitySecretCredentials.js.map +1 -0
- package/dist/modules/certificates/CertificateController.d.ts +14 -0
- package/dist/modules/certificates/CertificateController.js +20 -0
- package/dist/modules/certificates/CertificateController.js.map +1 -0
- package/dist/modules/certificates/CertificateIssuer.d.ts +27 -0
- package/dist/modules/certificates/CertificateIssuer.js +42 -0
- package/dist/modules/certificates/CertificateIssuer.js.map +1 -0
- package/dist/modules/certificates/CertificateValidator.d.ts +14 -0
- package/dist/modules/certificates/CertificateValidator.js +20 -0
- package/dist/modules/certificates/CertificateValidator.js.map +1 -0
- package/dist/modules/certificates/data/Certificate.d.ts +34 -0
- package/dist/modules/certificates/data/Certificate.js +65 -0
- package/dist/modules/certificates/data/Certificate.js.map +1 -0
- package/dist/modules/certificates/data/CertificateConstraint.d.ts +10 -0
- package/dist/modules/certificates/data/CertificateConstraint.js +28 -0
- package/dist/modules/certificates/data/CertificateConstraint.js.map +1 -0
- package/dist/modules/certificates/data/CertificateContent.d.ts +28 -0
- package/dist/modules/certificates/data/CertificateContent.js +70 -0
- package/dist/modules/certificates/data/CertificateContent.js.map +1 -0
- package/dist/modules/certificates/data/CertificateItem.d.ts +11 -0
- package/dist/modules/certificates/data/CertificateItem.js +29 -0
- package/dist/modules/certificates/data/CertificateItem.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.d.ts +29 -0
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js +57 -0
- package/dist/modules/certificates/data/constraints/CertificateBorderConstraint.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.d.ts +31 -0
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js +60 -0
- package/dist/modules/certificates/data/constraints/CertificateCityConstraint.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.d.ts +9 -0
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js +31 -0
- package/dist/modules/certificates/data/constraints/CertificateIdentityConstraint.js.map +1 -0
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.d.ts +16 -0
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js +41 -0
- package/dist/modules/certificates/data/constraints/CertificateTimeConstraint.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.d.ts +17 -0
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js +39 -0
- package/dist/modules/certificates/data/items/CertificateAuthorizationItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificateDelegateItem.d.ts +18 -0
- package/dist/modules/certificates/data/items/CertificateDelegateItem.js +46 -0
- package/dist/modules/certificates/data/items/CertificateDelegateItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.d.ts +19 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js +42 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.d.ts +25 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js +55 -0
- package/dist/modules/certificates/data/items/CertificatePrivateAttributeItemSource.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.d.ts +14 -0
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js +39 -0
- package/dist/modules/certificates/data/items/CertificatePublicAttributeItem.js.map +1 -0
- package/dist/modules/certificates/data/items/CertificateRoleItem.d.ts +16 -0
- package/dist/modules/certificates/data/items/CertificateRoleItem.js +38 -0
- package/dist/modules/certificates/data/items/CertificateRoleItem.js.map +1 -0
- package/dist/modules/challenges/ChallengeController.d.ts +16 -0
- package/dist/modules/challenges/ChallengeController.js +123 -0
- package/dist/modules/challenges/ChallengeController.js.map +1 -0
- package/dist/modules/challenges/backbone/ChallengeAuthClient.d.ts +18 -0
- package/dist/modules/challenges/backbone/ChallengeAuthClient.js +14 -0
- package/dist/modules/challenges/backbone/ChallengeAuthClient.js.map +1 -0
- package/dist/modules/challenges/backbone/ChallengeClient.d.ts +6 -0
- package/dist/modules/challenges/backbone/ChallengeClient.js +11 -0
- package/dist/modules/challenges/backbone/ChallengeClient.js.map +1 -0
- package/dist/modules/challenges/data/Challenge.d.ts +22 -0
- package/dist/modules/challenges/data/Challenge.js +59 -0
- package/dist/modules/challenges/data/Challenge.js.map +1 -0
- package/dist/modules/challenges/data/ChallengeSigned.d.ts +18 -0
- package/dist/modules/challenges/data/ChallengeSigned.js +50 -0
- package/dist/modules/challenges/data/ChallengeSigned.js.map +1 -0
- package/dist/modules/devices/DeviceController.d.ts +27 -0
- package/dist/modules/devices/DeviceController.js +120 -0
- package/dist/modules/devices/DeviceController.js.map +1 -0
- package/dist/modules/devices/DeviceSecretController.d.ts +36 -0
- package/dist/modules/devices/DeviceSecretController.js +163 -0
- package/dist/modules/devices/DeviceSecretController.js.map +1 -0
- package/dist/modules/devices/DevicesController.d.ts +20 -0
- package/dist/modules/devices/DevicesController.js +96 -0
- package/dist/modules/devices/DevicesController.js.map +1 -0
- package/dist/modules/devices/backbone/BackbonePostDevices.d.ts +11 -0
- package/dist/modules/devices/backbone/BackbonePostDevices.js +3 -0
- package/dist/modules/devices/backbone/BackbonePostDevices.js.map +1 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.d.ts +18 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.js +21 -0
- package/dist/modules/devices/backbone/DeviceAuthClient.js.map +1 -0
- package/dist/modules/devices/backbone/DeviceClient.d.ts +7 -0
- package/dist/modules/devices/backbone/DeviceClient.js +15 -0
- package/dist/modules/devices/backbone/DeviceClient.js.map +1 -0
- package/dist/modules/devices/local/Device.d.ts +46 -0
- package/dist/modules/devices/local/Device.js +115 -0
- package/dist/modules/devices/local/Device.js.map +1 -0
- package/dist/modules/devices/local/DeviceSecretCredentials.d.ts +12 -0
- package/dist/modules/devices/local/DeviceSecretCredentials.js +40 -0
- package/dist/modules/devices/local/DeviceSecretCredentials.js.map +1 -0
- package/dist/modules/devices/local/SendDeviceParameters.d.ts +13 -0
- package/dist/modules/devices/local/SendDeviceParameters.js +43 -0
- package/dist/modules/devices/local/SendDeviceParameters.js.map +1 -0
- package/dist/modules/devices/transmission/DeviceSharedSecret.d.ts +33 -0
- package/dist/modules/devices/transmission/DeviceSharedSecret.js +90 -0
- package/dist/modules/devices/transmission/DeviceSharedSecret.js.map +1 -0
- package/dist/modules/files/FileController.d.ts +25 -0
- package/dist/modules/files/FileController.js +196 -0
- package/dist/modules/files/FileController.js.map +1 -0
- package/dist/modules/files/backbone/BackboneGetFiles.d.ts +21 -0
- package/dist/modules/files/backbone/BackboneGetFiles.js +3 -0
- package/dist/modules/files/backbone/BackboneGetFiles.js.map +1 -0
- package/dist/modules/files/backbone/BackbonePostFiles.d.ts +25 -0
- package/dist/modules/files/backbone/BackbonePostFiles.js +3 -0
- package/dist/modules/files/backbone/BackbonePostFiles.js.map +1 -0
- package/dist/modules/files/backbone/FileClient.d.ts +12 -0
- package/dist/modules/files/backbone/FileClient.js +23 -0
- package/dist/modules/files/backbone/FileClient.js.map +1 -0
- package/dist/modules/files/local/CachedFile.d.ts +47 -0
- package/dist/modules/files/local/CachedFile.js +140 -0
- package/dist/modules/files/local/CachedFile.js.map +1 -0
- package/dist/modules/files/local/File.d.ts +27 -0
- package/dist/modules/files/local/File.js +88 -0
- package/dist/modules/files/local/File.js.map +1 -0
- package/dist/modules/files/local/SendFileParameters.d.ts +23 -0
- package/dist/modules/files/local/SendFileParameters.js +65 -0
- package/dist/modules/files/local/SendFileParameters.js.map +1 -0
- package/dist/modules/files/transmission/FileMetadata.d.ts +24 -0
- package/dist/modules/files/transmission/FileMetadata.js +69 -0
- package/dist/modules/files/transmission/FileMetadata.js.map +1 -0
- package/dist/modules/files/transmission/FileReference.d.ts +15 -0
- package/dist/modules/files/transmission/FileReference.js +66 -0
- package/dist/modules/files/transmission/FileReference.js.map +1 -0
- package/dist/modules/index.d.ts +110 -0
- package/dist/modules/index.js +123 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/messages/MessageController.d.ts +29 -0
- package/dist/modules/messages/MessageController.js +316 -0
- package/dist/modules/messages/MessageController.js.map +1 -0
- package/dist/modules/messages/backbone/BackboneGetMessages.d.ts +25 -0
- package/dist/modules/messages/backbone/BackboneGetMessages.js +3 -0
- package/dist/modules/messages/backbone/BackboneGetMessages.js.map +1 -0
- package/dist/modules/messages/backbone/BackbonePostMessages.d.ts +16 -0
- package/dist/modules/messages/backbone/BackbonePostMessages.js +3 -0
- package/dist/modules/messages/backbone/BackbonePostMessages.js.map +1 -0
- package/dist/modules/messages/backbone/MessageClient.d.ts +12 -0
- package/dist/modules/messages/backbone/MessageClient.js +23 -0
- package/dist/modules/messages/backbone/MessageClient.js.map +1 -0
- package/dist/modules/messages/local/CachedMessage.d.ts +23 -0
- package/dist/modules/messages/local/CachedMessage.js +67 -0
- package/dist/modules/messages/local/CachedMessage.js.map +1 -0
- package/dist/modules/messages/local/Message.d.ts +26 -0
- package/dist/modules/messages/local/Message.js +87 -0
- package/dist/modules/messages/local/Message.js.map +1 -0
- package/dist/modules/messages/local/SendMessageParameters.d.ts +15 -0
- package/dist/modules/messages/local/SendMessageParameters.js +44 -0
- package/dist/modules/messages/local/SendMessageParameters.js.map +1 -0
- package/dist/modules/messages/transmission/MessageEnvelope.d.ts +24 -0
- package/dist/modules/messages/transmission/MessageEnvelope.js +81 -0
- package/dist/modules/messages/transmission/MessageEnvelope.js.map +1 -0
- package/dist/modules/messages/transmission/MessageEnvelopeRecipient.d.ts +16 -0
- package/dist/modules/messages/transmission/MessageEnvelopeRecipient.js +47 -0
- package/dist/modules/messages/transmission/MessageEnvelopeRecipient.js.map +1 -0
- package/dist/modules/messages/transmission/MessagePlain.d.ts +29 -0
- package/dist/modules/messages/transmission/MessagePlain.js +68 -0
- package/dist/modules/messages/transmission/MessagePlain.js.map +1 -0
- package/dist/modules/messages/transmission/MessageSignature.d.ts +11 -0
- package/dist/modules/messages/transmission/MessageSignature.js +36 -0
- package/dist/modules/messages/transmission/MessageSignature.js.map +1 -0
- package/dist/modules/messages/transmission/MessageSigned.d.ts +15 -0
- package/dist/modules/messages/transmission/MessageSigned.js +43 -0
- package/dist/modules/messages/transmission/MessageSigned.js.map +1 -0
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.d.ts +26 -0
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +156 -0
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -0
- package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.d.ts +17 -0
- package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.js +3 -0
- package/dist/modules/relationshipTemplates/backbone/BackboneGetRelationshipTemplates.js.map +1 -0
- package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.d.ts +9 -0
- package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.js +3 -0
- package/dist/modules/relationshipTemplates/backbone/BackbonePostRelationshipTemplates.js.map +1 -0
- package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.d.ts +11 -0
- package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.js +20 -0
- package/dist/modules/relationshipTemplates/backbone/RelationshipTemplateClient.js.map +1 -0
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.d.ts +29 -0
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js +80 -0
- package/dist/modules/relationshipTemplates/local/CachedRelationshipTemplate.js.map +1 -0
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.d.ts +26 -0
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js +85 -0
- package/dist/modules/relationshipTemplates/local/RelationshipTemplate.js.map +1 -0
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.d.ts +14 -0
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js +44 -0
- package/dist/modules/relationshipTemplates/local/SendRelationshipTemplateParameters.js.map +1 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.d.ts +16 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.js +45 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateContent.js.map +1 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.d.ts +19 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.js +61 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplatePublicKey.js.map +1 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.d.ts +12 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.js +39 -0
- package/dist/modules/relationshipTemplates/transmission/RelationshipTemplateSigned.js.map +1 -0
- package/dist/modules/relationships/RelationshipSecretController.d.ts +31 -0
- package/dist/modules/relationships/RelationshipSecretController.js +161 -0
- package/dist/modules/relationships/RelationshipSecretController.js.map +1 -0
- package/dist/modules/relationships/RelationshipsController.d.ts +47 -0
- package/dist/modules/relationships/RelationshipsController.js +472 -0
- package/dist/modules/relationships/RelationshipsController.js.map +1 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationships.d.ts +18 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationships.js +3 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationships.js.map +1 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.d.ts +23 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.js +3 -0
- package/dist/modules/relationships/backbone/BackboneGetRelationshipsChanges.js.map +1 -0
- package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.d.ts +8 -0
- package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.js +3 -0
- package/dist/modules/relationships/backbone/BackbonePostRelationshipsChanges.js.map +1 -0
- package/dist/modules/relationships/backbone/RelationshipClient.d.ts +17 -0
- package/dist/modules/relationships/backbone/RelationshipClient.js +42 -0
- package/dist/modules/relationships/backbone/RelationshipClient.js.map +1 -0
- package/dist/modules/relationships/local/CachedRelationship.d.ts +18 -0
- package/dist/modules/relationships/local/CachedRelationship.js +53 -0
- package/dist/modules/relationships/local/CachedRelationship.js.map +1 -0
- package/dist/modules/relationships/local/Relationship.d.ts +37 -0
- package/dist/modules/relationships/local/Relationship.js +140 -0
- package/dist/modules/relationships/local/Relationship.js.map +1 -0
- package/dist/modules/relationships/local/SendRelationshipParameters.d.ts +13 -0
- package/dist/modules/relationships/local/SendRelationshipParameters.js +39 -0
- package/dist/modules/relationships/local/SendRelationshipParameters.js.map +1 -0
- package/dist/modules/relationships/transmission/RelationshipStatus.d.ts +8 -0
- package/dist/modules/relationships/transmission/RelationshipStatus.js +13 -0
- package/dist/modules/relationships/transmission/RelationshipStatus.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChange.d.ts +27 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChange.js +72 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChange.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.d.ts +20 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js +53 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeRequest.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.d.ts +20 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js +53 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeResponse.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.d.ts +6 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js +11 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeStatus.js.map +1 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeType.d.ts +5 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js +10 -0
- package/dist/modules/relationships/transmission/changes/RelationshipChangeType.js.map +1 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.d.ts +13 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js +42 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestCipher.js.map +1 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.d.ts +15 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.js +44 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestContent.js.map +1 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.d.ts +14 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js +44 -0
- package/dist/modules/relationships/transmission/requests/RelationshipCreationChangeRequestSigned.js.map +1 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.d.ts +13 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js +42 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseCipher.js.map +1 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.d.ts +12 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.js +38 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseContent.js.map +1 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.d.ts +14 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js +44 -0
- package/dist/modules/relationships/transmission/responses/RelationshipCreationChangeResponseSigned.js.map +1 -0
- package/dist/modules/secrets/SecretController.d.ts +39 -0
- package/dist/modules/secrets/SecretController.js +168 -0
- package/dist/modules/secrets/SecretController.js.map +1 -0
- package/dist/modules/secrets/data/SecretContainerCipher.d.ts +25 -0
- package/dist/modules/secrets/data/SecretContainerCipher.js +87 -0
- package/dist/modules/secrets/data/SecretContainerCipher.js.map +1 -0
- package/dist/modules/secrets/data/SecretContainerPlain.d.ts +25 -0
- package/dist/modules/secrets/data/SecretContainerPlain.js +76 -0
- package/dist/modules/secrets/data/SecretContainerPlain.js.map +1 -0
- package/dist/modules/sync/ChangedItems.d.ts +9 -0
- package/dist/modules/sync/ChangedItems.js +17 -0
- package/dist/modules/sync/ChangedItems.js.map +1 -0
- package/dist/modules/sync/DatawalletModificationMapper.d.ts +7 -0
- package/dist/modules/sync/DatawalletModificationMapper.js +62 -0
- package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.d.ts +21 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.js +111 -0
- package/dist/modules/sync/DatawalletModificationsProcessor.js.map +1 -0
- package/dist/modules/sync/ExternalEventsProcessor.d.ts +19 -0
- package/dist/modules/sync/ExternalEventsProcessor.js +83 -0
- package/dist/modules/sync/ExternalEventsProcessor.js.map +1 -0
- package/dist/modules/sync/SyncController.d.ts +37 -0
- package/dist/modules/sync/SyncController.js +214 -0
- package/dist/modules/sync/SyncController.js.map +1 -0
- package/dist/modules/sync/SynchronizedCollection.d.ts +18 -0
- package/dist/modules/sync/SynchronizedCollection.js +163 -0
- package/dist/modules/sync/SynchronizedCollection.js.map +1 -0
- package/dist/modules/sync/WhatToSync.d.ts +1 -0
- package/dist/modules/sync/WhatToSync.js +3 -0
- package/dist/modules/sync/WhatToSync.js.map +1 -0
- package/dist/modules/sync/backbone/BackboneDatawalletModification.d.ts +11 -0
- package/dist/modules/sync/backbone/BackboneDatawalletModification.js +3 -0
- package/dist/modules/sync/backbone/BackboneDatawalletModification.js.map +1 -0
- package/dist/modules/sync/backbone/BackboneExternalEvent.d.ts +8 -0
- package/dist/modules/sync/backbone/BackboneExternalEvent.js +3 -0
- package/dist/modules/sync/backbone/BackboneExternalEvent.js.map +1 -0
- package/dist/modules/sync/backbone/BackboneSyncRun.d.ts +9 -0
- package/dist/modules/sync/backbone/BackboneSyncRun.js +3 -0
- package/dist/modules/sync/backbone/BackboneSyncRun.js.map +1 -0
- package/dist/modules/sync/backbone/CreateDatawalletModifications.d.ts +19 -0
- package/dist/modules/sync/backbone/CreateDatawalletModifications.js +3 -0
- package/dist/modules/sync/backbone/CreateDatawalletModifications.js.map +1 -0
- package/dist/modules/sync/backbone/FinalizeSyncRun.d.ts +23 -0
- package/dist/modules/sync/backbone/FinalizeSyncRun.js +3 -0
- package/dist/modules/sync/backbone/FinalizeSyncRun.js.map +1 -0
- package/dist/modules/sync/backbone/GetDatawalletModifications.d.ts +3 -0
- package/dist/modules/sync/backbone/GetDatawalletModifications.js +3 -0
- package/dist/modules/sync/backbone/GetDatawalletModifications.js.map +1 -0
- package/dist/modules/sync/backbone/StartSyncRun.d.ts +9 -0
- package/dist/modules/sync/backbone/StartSyncRun.js +9 -0
- package/dist/modules/sync/backbone/StartSyncRun.js.map +1 -0
- package/dist/modules/sync/backbone/SyncClient.d.ts +15 -0
- package/dist/modules/sync/backbone/SyncClient.js +23 -0
- package/dist/modules/sync/backbone/SyncClient.js.map +1 -0
- package/dist/modules/sync/local/DatawalletModification.d.ts +30 -0
- package/dist/modules/sync/local/DatawalletModification.js +71 -0
- package/dist/modules/sync/local/DatawalletModification.js.map +1 -0
- package/dist/modules/tokens/AnonymousTokenController.d.ts +11 -0
- package/dist/modules/tokens/AnonymousTokenController.js +47 -0
- package/dist/modules/tokens/AnonymousTokenController.js.map +1 -0
- package/dist/modules/tokens/TokenController.d.ts +24 -0
- package/dist/modules/tokens/TokenController.js +137 -0
- package/dist/modules/tokens/TokenController.js.map +1 -0
- package/dist/modules/tokens/backbone/AnonymousTokenClient.d.ts +6 -0
- package/dist/modules/tokens/backbone/AnonymousTokenClient.js +11 -0
- package/dist/modules/tokens/backbone/AnonymousTokenClient.js.map +1 -0
- package/dist/modules/tokens/backbone/BackboneGetTokens.d.ts +11 -0
- package/dist/modules/tokens/backbone/BackboneGetTokens.js +3 -0
- package/dist/modules/tokens/backbone/BackboneGetTokens.js.map +1 -0
- package/dist/modules/tokens/backbone/BackbonePostTokens.d.ts +9 -0
- package/dist/modules/tokens/backbone/BackbonePostTokens.js +3 -0
- package/dist/modules/tokens/backbone/BackbonePostTokens.js.map +1 -0
- package/dist/modules/tokens/backbone/TokenClient.d.ts +11 -0
- package/dist/modules/tokens/backbone/TokenClient.js +20 -0
- package/dist/modules/tokens/backbone/TokenClient.js.map +1 -0
- package/dist/modules/tokens/local/CachedToken.d.ts +18 -0
- package/dist/modules/tokens/local/CachedToken.js +53 -0
- package/dist/modules/tokens/local/CachedToken.js.map +1 -0
- package/dist/modules/tokens/local/SendTokenParameters.d.ts +14 -0
- package/dist/modules/tokens/local/SendTokenParameters.js +43 -0
- package/dist/modules/tokens/local/SendTokenParameters.js.map +1 -0
- package/dist/modules/tokens/local/Token.d.ts +28 -0
- package/dist/modules/tokens/local/Token.js +91 -0
- package/dist/modules/tokens/local/Token.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.d.ts +10 -0
- package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.js +34 -0
- package/dist/modules/tokens/transmission/TokenContentDeviceSharedSecret.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenContentFile.d.ts +12 -0
- package/dist/modules/tokens/transmission/TokenContentFile.js +39 -0
- package/dist/modules/tokens/transmission/TokenContentFile.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.d.ts +12 -0
- package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.js +39 -0
- package/dist/modules/tokens/transmission/TokenContentRelationshipTemplate.js.map +1 -0
- package/dist/modules/tokens/transmission/TokenReference.d.ts +14 -0
- package/dist/modules/tokens/transmission/TokenReference.js +71 -0
- package/dist/modules/tokens/transmission/TokenReference.js.map +1 -0
- package/dist/util/PasswordGenerator.d.ts +28 -0
- package/dist/util/PasswordGenerator.js +179 -0
- package/dist/util/PasswordGenerator.js.map +1 -0
- package/dist/util/Random.d.ts +50 -0
- package/dist/util/Random.js +129 -0
- package/dist/util/Random.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +15 -0
- package/dist/util/index.js.map +1 -0
- package/lib-web/nmshd.transport.js +54733 -0
- package/lib-web/nmshd.transport.js.map +1 -0
- package/lib-web/nmshd.transport.min.js +3 -0
- package/lib-web/nmshd.transport.min.js.map +1 -0
- package/package.json +109 -0
- 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 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformError.js","sourceRoot":"","sources":["../../../src/core/backbone/PlatformError.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
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
|