@nmshd/runtime 7.0.0-alpha.70 → 7.0.0-alpha.72

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 (199) hide show
  1. package/dist/buildInformation.js +4 -4
  2. package/dist/dataViews/DataViewExpander.d.ts +5 -3
  3. package/dist/dataViews/DataViewExpander.d.ts.map +1 -1
  4. package/dist/dataViews/DataViewExpander.js +163 -174
  5. package/dist/dataViews/DataViewExpander.js.map +1 -1
  6. package/dist/dataViews/consumption/LocalAttributeDVO.d.ts +37 -46
  7. package/dist/dataViews/consumption/LocalAttributeDVO.d.ts.map +1 -1
  8. package/dist/dataViews/content/RequestItemDVOs.d.ts +1 -2
  9. package/dist/dataViews/content/RequestItemDVOs.d.ts.map +1 -1
  10. package/dist/dataViews/content/ResponseItemDVOs.d.ts +4 -10
  11. package/dist/dataViews/content/ResponseItemDVOs.d.ts.map +1 -1
  12. package/dist/events/EventProxy.d.ts.map +1 -1
  13. package/dist/events/EventProxy.js +10 -29
  14. package/dist/events/EventProxy.js.map +1 -1
  15. package/dist/events/consumption/AttributeForwardingDetailsChangedEvent.d.ts +7 -0
  16. package/dist/events/consumption/AttributeForwardingDetailsChangedEvent.d.ts.map +1 -0
  17. package/dist/events/consumption/AttributeForwardingDetailsChangedEvent.js +12 -0
  18. package/dist/events/consumption/AttributeForwardingDetailsChangedEvent.js.map +1 -0
  19. package/dist/events/consumption/AttributeSucceededEvent.d.ts +11 -0
  20. package/dist/events/consumption/AttributeSucceededEvent.d.ts.map +1 -0
  21. package/dist/events/consumption/AttributeSucceededEvent.js +12 -0
  22. package/dist/events/consumption/AttributeSucceededEvent.js.map +1 -0
  23. package/dist/events/consumption/ForwardedAttributeDeletedByPeerEvent.d.ts +7 -0
  24. package/dist/events/consumption/ForwardedAttributeDeletedByPeerEvent.d.ts.map +1 -0
  25. package/dist/events/consumption/ForwardedAttributeDeletedByPeerEvent.js +12 -0
  26. package/dist/events/consumption/ForwardedAttributeDeletedByPeerEvent.js.map +1 -0
  27. package/dist/events/consumption/OwnAttributeDeletedByOwnerEvent.d.ts +7 -0
  28. package/dist/events/consumption/OwnAttributeDeletedByOwnerEvent.d.ts.map +1 -0
  29. package/dist/events/consumption/OwnAttributeDeletedByOwnerEvent.js +12 -0
  30. package/dist/events/consumption/OwnAttributeDeletedByOwnerEvent.js.map +1 -0
  31. package/dist/events/consumption/PeerRelationshipAttributeDeletedByPeerEvent.d.ts +7 -0
  32. package/dist/events/consumption/PeerRelationshipAttributeDeletedByPeerEvent.d.ts.map +1 -0
  33. package/dist/events/consumption/PeerRelationshipAttributeDeletedByPeerEvent.js +12 -0
  34. package/dist/events/consumption/PeerRelationshipAttributeDeletedByPeerEvent.js.map +1 -0
  35. package/dist/events/consumption/index.d.ts +5 -9
  36. package/dist/events/consumption/index.d.ts.map +1 -1
  37. package/dist/events/consumption/index.js +5 -9
  38. package/dist/events/consumption/index.js.map +1 -1
  39. package/dist/extensibility/facades/consumption/AttributesFacade.d.ts +27 -31
  40. package/dist/extensibility/facades/consumption/AttributesFacade.d.ts.map +1 -1
  41. package/dist/extensibility/facades/consumption/AttributesFacade.js +51 -63
  42. package/dist/extensibility/facades/consumption/AttributesFacade.js.map +1 -1
  43. package/dist/useCases/common/RuntimeErrors.d.ts +8 -11
  44. package/dist/useCases/common/RuntimeErrors.d.ts.map +1 -1
  45. package/dist/useCases/common/RuntimeErrors.js +16 -25
  46. package/dist/useCases/common/RuntimeErrors.js.map +1 -1
  47. package/dist/useCases/common/Schemas.d.ts +13 -31
  48. package/dist/useCases/common/Schemas.d.ts.map +1 -1
  49. package/dist/useCases/common/Schemas.js +9891 -13286
  50. package/dist/useCases/common/Schemas.js.map +1 -1
  51. package/dist/useCases/consumption/attributes/AttributeMapper.d.ts +3 -2
  52. package/dist/useCases/consumption/attributes/AttributeMapper.d.ts.map +1 -1
  53. package/dist/useCases/consumption/attributes/AttributeMapper.js +27 -5
  54. package/dist/useCases/consumption/attributes/AttributeMapper.js.map +1 -1
  55. package/dist/useCases/consumption/attributes/CanCreateOwnIdentityAttribute.d.ts +37 -0
  56. package/dist/useCases/consumption/attributes/CanCreateOwnIdentityAttribute.d.ts.map +1 -0
  57. package/dist/useCases/consumption/attributes/{CanCreateRepositoryAttribute.js → CanCreateOwnIdentityAttribute.js} +20 -10
  58. package/dist/useCases/consumption/attributes/CanCreateOwnIdentityAttribute.js.map +1 -0
  59. package/dist/useCases/consumption/attributes/{ChangeDefaultRepositoryAttribute.d.ts → ChangeDefaultOwnIdentityAttribute.d.ts} +5 -5
  60. package/dist/useCases/consumption/attributes/ChangeDefaultOwnIdentityAttribute.d.ts.map +1 -0
  61. package/dist/useCases/consumption/attributes/{ChangeDefaultRepositoryAttribute.js → ChangeDefaultOwnIdentityAttribute.js} +13 -13
  62. package/dist/useCases/consumption/attributes/ChangeDefaultOwnIdentityAttribute.js.map +1 -0
  63. package/dist/useCases/consumption/attributes/CreateOwnIdentityAttribute.d.ts +30 -0
  64. package/dist/useCases/consumption/attributes/CreateOwnIdentityAttribute.d.ts.map +1 -0
  65. package/dist/useCases/consumption/attributes/{CreateRepositoryAttribute.js → CreateOwnIdentityAttribute.js} +15 -16
  66. package/dist/useCases/consumption/attributes/CreateOwnIdentityAttribute.js.map +1 -0
  67. package/dist/useCases/consumption/attributes/DeleteAttributeAndNotify.d.ts +33 -0
  68. package/dist/useCases/consumption/attributes/DeleteAttributeAndNotify.d.ts.map +1 -0
  69. package/dist/useCases/consumption/attributes/DeleteAttributeAndNotify.js +198 -0
  70. package/dist/useCases/consumption/attributes/DeleteAttributeAndNotify.js.map +1 -0
  71. package/dist/useCases/consumption/attributes/DeleteSharedAttributesForRejectedOrRevokedRelationship.d.ts.map +1 -1
  72. package/dist/useCases/consumption/attributes/DeleteSharedAttributesForRejectedOrRevokedRelationship.js +8 -2
  73. package/dist/useCases/consumption/attributes/DeleteSharedAttributesForRejectedOrRevokedRelationship.js.map +1 -1
  74. package/dist/useCases/consumption/attributes/GetAttributes.d.ts +5 -8
  75. package/dist/useCases/consumption/attributes/GetAttributes.d.ts.map +1 -1
  76. package/dist/useCases/consumption/attributes/GetAttributes.js +9 -18
  77. package/dist/useCases/consumption/attributes/GetAttributes.js.map +1 -1
  78. package/dist/useCases/consumption/attributes/GetForwardingDetailsForAttribute.d.ts +28 -0
  79. package/dist/useCases/consumption/attributes/GetForwardingDetailsForAttribute.d.ts.map +1 -0
  80. package/dist/useCases/consumption/attributes/GetForwardingDetailsForAttribute.js +77 -0
  81. package/dist/useCases/consumption/attributes/GetForwardingDetailsForAttribute.js.map +1 -0
  82. package/dist/useCases/consumption/attributes/{GetPeerSharedAttributes.d.ts → GetOwnAttributesSharedWithPeer.d.ts} +10 -11
  83. package/dist/useCases/consumption/attributes/GetOwnAttributesSharedWithPeer.d.ts.map +1 -0
  84. package/dist/useCases/consumption/attributes/{GetOwnSharedAttributes.js → GetOwnAttributesSharedWithPeer.js} +12 -17
  85. package/dist/useCases/consumption/attributes/GetOwnAttributesSharedWithPeer.js.map +1 -0
  86. package/dist/useCases/consumption/attributes/{GetRepositoryAttributes.d.ts → GetOwnIdentityAttributes.d.ts} +9 -9
  87. package/dist/useCases/consumption/attributes/GetOwnIdentityAttributes.d.ts.map +1 -0
  88. package/dist/useCases/consumption/attributes/{GetRepositoryAttributes.js → GetOwnIdentityAttributes.js} +8 -8
  89. package/dist/useCases/consumption/attributes/GetOwnIdentityAttributes.js.map +1 -0
  90. package/dist/useCases/consumption/attributes/GetPeerAttributes.d.ts +39 -0
  91. package/dist/useCases/consumption/attributes/GetPeerAttributes.d.ts.map +1 -0
  92. package/dist/useCases/consumption/attributes/{GetPeerSharedAttributes.js → GetPeerAttributes.js} +10 -10
  93. package/dist/useCases/consumption/attributes/GetPeerAttributes.js.map +1 -0
  94. package/dist/useCases/consumption/attributes/GetVersionsOfAttribute.js +1 -1
  95. package/dist/useCases/consumption/attributes/GetVersionsOfAttribute.js.map +1 -1
  96. package/dist/useCases/consumption/attributes/GetVersionsOfAttributeSharedWithPeer.d.ts +22 -0
  97. package/dist/useCases/consumption/attributes/GetVersionsOfAttributeSharedWithPeer.d.ts.map +1 -0
  98. package/dist/useCases/consumption/attributes/{GetSharedVersionsOfAttribute.js → GetVersionsOfAttributeSharedWithPeer.js} +14 -20
  99. package/dist/useCases/consumption/attributes/GetVersionsOfAttributeSharedWithPeer.js.map +1 -0
  100. package/dist/useCases/consumption/attributes/{NotifyPeerAboutRepositoryAttributeSuccession.d.ts → NotifyPeerAboutOwnIdentityAttributeSuccession.d.ts} +9 -9
  101. package/dist/useCases/consumption/attributes/NotifyPeerAboutOwnIdentityAttributeSuccession.d.ts.map +1 -0
  102. package/dist/useCases/consumption/attributes/NotifyPeerAboutOwnIdentityAttributeSuccession.js +95 -0
  103. package/dist/useCases/consumption/attributes/NotifyPeerAboutOwnIdentityAttributeSuccession.js.map +1 -0
  104. package/dist/useCases/consumption/attributes/{ShareRepositoryAttribute.d.ts → ShareOwnIdentityAttribute.d.ts} +5 -5
  105. package/dist/useCases/consumption/attributes/ShareOwnIdentityAttribute.d.ts.map +1 -0
  106. package/dist/useCases/consumption/attributes/{ShareRepositoryAttribute.js → ShareOwnIdentityAttribute.js} +14 -15
  107. package/dist/useCases/consumption/attributes/ShareOwnIdentityAttribute.js.map +1 -0
  108. package/dist/useCases/consumption/attributes/{SucceedRepositoryAttribute.d.ts → SucceedOwnIdentityAttribute.d.ts} +6 -6
  109. package/dist/useCases/consumption/attributes/SucceedOwnIdentityAttribute.d.ts.map +1 -0
  110. package/dist/useCases/consumption/attributes/{SucceedRepositoryAttribute.js → SucceedOwnIdentityAttribute.js} +13 -14
  111. package/dist/useCases/consumption/attributes/SucceedOwnIdentityAttribute.js.map +1 -0
  112. package/dist/useCases/consumption/attributes/SucceedRelationshipAttributeAndNotifyPeer.d.ts.map +1 -1
  113. package/dist/useCases/consumption/attributes/SucceedRelationshipAttributeAndNotifyPeer.js +13 -16
  114. package/dist/useCases/consumption/attributes/SucceedRelationshipAttributeAndNotifyPeer.js.map +1 -1
  115. package/dist/useCases/consumption/attributes/index.d.ts +12 -14
  116. package/dist/useCases/consumption/attributes/index.d.ts.map +1 -1
  117. package/dist/useCases/consumption/attributes/index.js +12 -14
  118. package/dist/useCases/consumption/attributes/index.js.map +1 -1
  119. package/dist/useCases/transport/relationships/GetAttributesForRelationship.d.ts.map +1 -1
  120. package/dist/useCases/transport/relationships/GetAttributesForRelationship.js +3 -7
  121. package/dist/useCases/transport/relationships/GetAttributesForRelationship.js.map +1 -1
  122. package/package.json +6 -6
  123. package/dist/events/consumption/OwnSharedAttributeDeletedByOwnerEvent.d.ts +0 -7
  124. package/dist/events/consumption/OwnSharedAttributeDeletedByOwnerEvent.d.ts.map +0 -1
  125. package/dist/events/consumption/OwnSharedAttributeDeletedByOwnerEvent.js +0 -12
  126. package/dist/events/consumption/OwnSharedAttributeDeletedByOwnerEvent.js.map +0 -1
  127. package/dist/events/consumption/OwnSharedAttributeSucceededEvent.d.ts +0 -7
  128. package/dist/events/consumption/OwnSharedAttributeSucceededEvent.d.ts.map +0 -1
  129. package/dist/events/consumption/OwnSharedAttributeSucceededEvent.js +0 -12
  130. package/dist/events/consumption/OwnSharedAttributeSucceededEvent.js.map +0 -1
  131. package/dist/events/consumption/PeerSharedAttributeDeletedByPeerEvent.d.ts +0 -7
  132. package/dist/events/consumption/PeerSharedAttributeDeletedByPeerEvent.d.ts.map +0 -1
  133. package/dist/events/consumption/PeerSharedAttributeDeletedByPeerEvent.js +0 -12
  134. package/dist/events/consumption/PeerSharedAttributeDeletedByPeerEvent.js.map +0 -1
  135. package/dist/events/consumption/PeerSharedAttributeSucceededEvent.d.ts +0 -7
  136. package/dist/events/consumption/PeerSharedAttributeSucceededEvent.d.ts.map +0 -1
  137. package/dist/events/consumption/PeerSharedAttributeSucceededEvent.js +0 -12
  138. package/dist/events/consumption/PeerSharedAttributeSucceededEvent.js.map +0 -1
  139. package/dist/events/consumption/RepositoryAttributeSucceededEvent.d.ts +0 -7
  140. package/dist/events/consumption/RepositoryAttributeSucceededEvent.d.ts.map +0 -1
  141. package/dist/events/consumption/RepositoryAttributeSucceededEvent.js +0 -12
  142. package/dist/events/consumption/RepositoryAttributeSucceededEvent.js.map +0 -1
  143. package/dist/events/consumption/SuccessionEventData.d.ts +0 -6
  144. package/dist/events/consumption/SuccessionEventData.d.ts.map +0 -1
  145. package/dist/events/consumption/SuccessionEventData.js +0 -3
  146. package/dist/events/consumption/SuccessionEventData.js.map +0 -1
  147. package/dist/events/consumption/ThirdPartyOwnedRelationshipAttributeSucceededEvent.d.ts +0 -7
  148. package/dist/events/consumption/ThirdPartyOwnedRelationshipAttributeSucceededEvent.d.ts.map +0 -1
  149. package/dist/events/consumption/ThirdPartyOwnedRelationshipAttributeSucceededEvent.js +0 -12
  150. package/dist/events/consumption/ThirdPartyOwnedRelationshipAttributeSucceededEvent.js.map +0 -1
  151. package/dist/events/consumption/ThirdPartyRelationshipAttributeDeletedByPeerEvent.d.ts +0 -7
  152. package/dist/events/consumption/ThirdPartyRelationshipAttributeDeletedByPeerEvent.d.ts.map +0 -1
  153. package/dist/events/consumption/ThirdPartyRelationshipAttributeDeletedByPeerEvent.js +0 -12
  154. package/dist/events/consumption/ThirdPartyRelationshipAttributeDeletedByPeerEvent.js.map +0 -1
  155. package/dist/events/consumption/ThirdPartyRelationshipAttributeSucceededEvent.d.ts +0 -7
  156. package/dist/events/consumption/ThirdPartyRelationshipAttributeSucceededEvent.d.ts.map +0 -1
  157. package/dist/events/consumption/ThirdPartyRelationshipAttributeSucceededEvent.js +0 -12
  158. package/dist/events/consumption/ThirdPartyRelationshipAttributeSucceededEvent.js.map +0 -1
  159. package/dist/useCases/consumption/attributes/CanCreateRepositoryAttribute.d.ts +0 -37
  160. package/dist/useCases/consumption/attributes/CanCreateRepositoryAttribute.d.ts.map +0 -1
  161. package/dist/useCases/consumption/attributes/CanCreateRepositoryAttribute.js.map +0 -1
  162. package/dist/useCases/consumption/attributes/ChangeDefaultRepositoryAttribute.d.ts.map +0 -1
  163. package/dist/useCases/consumption/attributes/ChangeDefaultRepositoryAttribute.js.map +0 -1
  164. package/dist/useCases/consumption/attributes/CreateRepositoryAttribute.d.ts +0 -30
  165. package/dist/useCases/consumption/attributes/CreateRepositoryAttribute.d.ts.map +0 -1
  166. package/dist/useCases/consumption/attributes/CreateRepositoryAttribute.js.map +0 -1
  167. package/dist/useCases/consumption/attributes/DeleteOwnSharedAttributeAndNotifyPeer.d.ts +0 -23
  168. package/dist/useCases/consumption/attributes/DeleteOwnSharedAttributeAndNotifyPeer.d.ts.map +0 -1
  169. package/dist/useCases/consumption/attributes/DeleteOwnSharedAttributeAndNotifyPeer.js +0 -89
  170. package/dist/useCases/consumption/attributes/DeleteOwnSharedAttributeAndNotifyPeer.js.map +0 -1
  171. package/dist/useCases/consumption/attributes/DeletePeerSharedAttributeAndNotifyOwner.d.ts +0 -23
  172. package/dist/useCases/consumption/attributes/DeletePeerSharedAttributeAndNotifyOwner.d.ts.map +0 -1
  173. package/dist/useCases/consumption/attributes/DeletePeerSharedAttributeAndNotifyOwner.js +0 -90
  174. package/dist/useCases/consumption/attributes/DeletePeerSharedAttributeAndNotifyOwner.js.map +0 -1
  175. package/dist/useCases/consumption/attributes/DeleteRepositoryAttribute.d.ts +0 -18
  176. package/dist/useCases/consumption/attributes/DeleteRepositoryAttribute.d.ts.map +0 -1
  177. package/dist/useCases/consumption/attributes/DeleteRepositoryAttribute.js +0 -65
  178. package/dist/useCases/consumption/attributes/DeleteRepositoryAttribute.js.map +0 -1
  179. package/dist/useCases/consumption/attributes/DeleteThirdPartyRelationshipAttributeAndNotifyPeer.d.ts +0 -23
  180. package/dist/useCases/consumption/attributes/DeleteThirdPartyRelationshipAttributeAndNotifyPeer.d.ts.map +0 -1
  181. package/dist/useCases/consumption/attributes/DeleteThirdPartyRelationshipAttributeAndNotifyPeer.js +0 -88
  182. package/dist/useCases/consumption/attributes/DeleteThirdPartyRelationshipAttributeAndNotifyPeer.js.map +0 -1
  183. package/dist/useCases/consumption/attributes/GetOwnSharedAttributes.d.ts +0 -43
  184. package/dist/useCases/consumption/attributes/GetOwnSharedAttributes.d.ts.map +0 -1
  185. package/dist/useCases/consumption/attributes/GetOwnSharedAttributes.js.map +0 -1
  186. package/dist/useCases/consumption/attributes/GetPeerSharedAttributes.d.ts.map +0 -1
  187. package/dist/useCases/consumption/attributes/GetPeerSharedAttributes.js.map +0 -1
  188. package/dist/useCases/consumption/attributes/GetRepositoryAttributes.d.ts.map +0 -1
  189. package/dist/useCases/consumption/attributes/GetRepositoryAttributes.js.map +0 -1
  190. package/dist/useCases/consumption/attributes/GetSharedVersionsOfAttribute.d.ts +0 -24
  191. package/dist/useCases/consumption/attributes/GetSharedVersionsOfAttribute.d.ts.map +0 -1
  192. package/dist/useCases/consumption/attributes/GetSharedVersionsOfAttribute.js.map +0 -1
  193. package/dist/useCases/consumption/attributes/NotifyPeerAboutRepositoryAttributeSuccession.d.ts.map +0 -1
  194. package/dist/useCases/consumption/attributes/NotifyPeerAboutRepositoryAttributeSuccession.js +0 -105
  195. package/dist/useCases/consumption/attributes/NotifyPeerAboutRepositoryAttributeSuccession.js.map +0 -1
  196. package/dist/useCases/consumption/attributes/ShareRepositoryAttribute.d.ts.map +0 -1
  197. package/dist/useCases/consumption/attributes/ShareRepositoryAttribute.js.map +0 -1
  198. package/dist/useCases/consumption/attributes/SucceedRepositoryAttribute.d.ts.map +0 -1
  199. package/dist/useCases/consumption/attributes/SucceedRepositoryAttribute.js.map +0 -1
@@ -12,10 +12,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.GetOwnSharedAttributesUseCase = void 0;
15
+ exports.GetOwnAttributesSharedWithPeerUseCase = void 0;
16
16
  const ts_utils_1 = require("@js-soft/ts-utils");
17
17
  const consumption_1 = require("@nmshd/consumption");
18
- const transport_1 = require("@nmshd/transport");
18
+ const core_types_1 = require("@nmshd/core-types");
19
19
  const typescript_ioc_1 = require("@nmshd/typescript-ioc");
20
20
  const common_1 = require("../../common");
21
21
  const flattenObject_1 = require("../../common/flattenObject");
@@ -23,39 +23,34 @@ const AttributeMapper_1 = require("./AttributeMapper");
23
23
  const GetAttributes_1 = require("./GetAttributes");
24
24
  let Validator = class Validator extends common_1.SchemaValidator {
25
25
  constructor(schemaRepository) {
26
- super(schemaRepository.getSchema("GetOwnSharedAttributesRequest"));
26
+ super(schemaRepository.getSchema("GetOwnAttributesSharedWithPeerRequest"));
27
27
  }
28
28
  };
29
29
  Validator = __decorate([
30
30
  __param(0, typescript_ioc_1.Inject),
31
31
  __metadata("design:paramtypes", [common_1.SchemaRepository])
32
32
  ], Validator);
33
- let GetOwnSharedAttributesUseCase = class GetOwnSharedAttributesUseCase extends common_1.UseCase {
34
- constructor(attributeController, identityController, validator) {
33
+ let GetOwnAttributesSharedWithPeerUseCase = class GetOwnAttributesSharedWithPeerUseCase extends common_1.UseCase {
34
+ constructor(attributeController, validator) {
35
35
  super(validator);
36
36
  this.attributeController = attributeController;
37
- this.identityController = identityController;
38
37
  }
39
38
  async executeInternal(request) {
40
39
  const query = request.query ?? {};
41
- query["content.owner"] = this.identityController.address.toString();
42
- query["shareInfo.peer"] = request.peer;
43
40
  const flattenedQuery = (0, flattenObject_1.flattenObject)(query);
44
41
  const dbQuery = GetAttributes_1.GetAttributesUseCase.queryTranslator.parse(flattenedQuery);
45
- if (request.onlyLatestVersions ?? true) {
42
+ dbQuery["@type"] = { $in: ["OwnIdentityAttribute", "OwnRelationshipAttribute"] };
43
+ if (request.onlyLatestVersions ?? true)
46
44
  dbQuery["succeededBy"] = { $exists: false };
47
- }
48
- const attributes = await this.attributeController.getLocalAttributes(dbQuery, request.hideTechnical);
45
+ const attributes = await this.attributeController.getLocalAttributesExchangedWithPeer(core_types_1.CoreAddress.from(request.peer), dbQuery, request.hideTechnical);
49
46
  return ts_utils_1.Result.ok(AttributeMapper_1.AttributeMapper.toAttributeDTOList(attributes));
50
47
  }
51
48
  };
52
- exports.GetOwnSharedAttributesUseCase = GetOwnSharedAttributesUseCase;
53
- exports.GetOwnSharedAttributesUseCase = GetOwnSharedAttributesUseCase = __decorate([
49
+ exports.GetOwnAttributesSharedWithPeerUseCase = GetOwnAttributesSharedWithPeerUseCase;
50
+ exports.GetOwnAttributesSharedWithPeerUseCase = GetOwnAttributesSharedWithPeerUseCase = __decorate([
54
51
  __param(0, typescript_ioc_1.Inject),
55
52
  __param(1, typescript_ioc_1.Inject),
56
- __param(2, typescript_ioc_1.Inject),
57
53
  __metadata("design:paramtypes", [consumption_1.AttributesController,
58
- transport_1.IdentityController,
59
54
  Validator])
60
- ], GetOwnSharedAttributesUseCase);
61
- //# sourceMappingURL=GetOwnSharedAttributes.js.map
55
+ ], GetOwnAttributesSharedWithPeerUseCase);
56
+ //# sourceMappingURL=GetOwnAttributesSharedWithPeer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetOwnAttributesSharedWithPeer.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetOwnAttributesSharedWithPeer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAA0D;AAC1D,kDAAgD;AAEhD,0DAA+C;AAC/C,yCAAyF;AACzF,8DAA2D;AAC3D,uDAAoD;AACpD,mDAAkF;AA6BlF,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAAsD;IAC1E,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAC/E,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,qCAAqC,GAAlD,MAAa,qCAAsC,SAAQ,gBAAmE;IAC1H,YAC6B,mBAAyC,EAC1D,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAHQ,wBAAmB,GAAnB,mBAAmB,CAAsB;IAItE,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,OAA8C;QAC1E,MAAM,KAAK,GAA8B,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QAE7D,MAAM,cAAc,GAAG,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,oCAAoB,CAAC,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAE3E,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,sBAAsB,EAAE,0BAA0B,CAAC,EAAE,CAAC;QACjF,IAAI,OAAO,CAAC,kBAAkB,IAAI,IAAI;YAAE,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAEpF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,mCAAmC,CAAC,wBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QAEtJ,OAAO,iBAAM,CAAC,EAAE,CAAC,iCAAe,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AArBY,sFAAqC;gDAArC,qCAAqC;IAEzC,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCADuC,kCAAoB;QAC/C,SAAS;GAHvB,qCAAqC,CAqBjD"}
@@ -2,29 +2,29 @@ import { Result } from "@js-soft/ts-utils";
2
2
  import { AttributesController } from "@nmshd/consumption";
3
3
  import { LocalAttributeDTO } from "@nmshd/runtime-types";
4
4
  import { SchemaRepository, SchemaValidator, UseCase } from "../../common";
5
- export interface GetRepositoryAttributesRequest {
5
+ export interface GetOwnIdentityAttributesRequest {
6
6
  /**
7
7
  * default: true
8
8
  */
9
9
  onlyLatestVersions?: boolean;
10
- query?: GetRepositoryAttributesRequestQuery;
10
+ query?: GetOwnIdentityAttributesRequestQuery;
11
11
  }
12
- export interface GetRepositoryAttributesRequestQuery {
12
+ export interface GetOwnIdentityAttributesRequestQuery {
13
13
  createdAt?: string;
14
- isDefault?: string;
15
14
  wasViewedAt?: string | string[];
15
+ isDefault?: string;
16
16
  "content.tags"?: string | string[];
17
17
  "content.value.@type"?: string | string[];
18
18
  }
19
- export interface GetRepositoryAttributesResponse extends Array<LocalAttributeDTO> {
19
+ export interface GetOwnIdentityAttributesResponse extends Array<LocalAttributeDTO> {
20
20
  }
21
- declare class Validator extends SchemaValidator<GetRepositoryAttributesRequest> {
21
+ declare class Validator extends SchemaValidator<GetOwnIdentityAttributesRequest> {
22
22
  constructor(schemaRepository: SchemaRepository);
23
23
  }
24
- export declare class GetRepositoryAttributesUseCase extends UseCase<GetRepositoryAttributesRequest, GetRepositoryAttributesResponse> {
24
+ export declare class GetOwnIdentityAttributesUseCase extends UseCase<GetOwnIdentityAttributesRequest, GetOwnIdentityAttributesResponse> {
25
25
  private readonly attributesController;
26
26
  constructor(attributesController: AttributesController, validator: Validator);
27
- protected executeInternal(request: GetRepositoryAttributesRequest): Promise<Result<GetRepositoryAttributesResponse>>;
27
+ protected executeInternal(request: GetOwnIdentityAttributesRequest): Promise<Result<GetOwnIdentityAttributesResponse>>;
28
28
  }
29
29
  export {};
30
- //# sourceMappingURL=GetRepositoryAttributes.d.ts.map
30
+ //# sourceMappingURL=GetOwnIdentityAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetOwnIdentityAttributes.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetOwnIdentityAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAiB,MAAM,cAAc,CAAC;AAIzF,MAAM,WAAW,+BAA+B;IAC5C;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,oCAAoC,CAAC;CAChD;AAED,MAAM,WAAW,oCAAoC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACnC,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,gCAAiC,SAAQ,KAAK,CAAC,iBAAiB,CAAC;CAAG;AAErF,cAAM,SAAU,SAAQ,eAAe,CAAC,+BAA+B,CAAC;gBACzC,gBAAgB,EAAE,gBAAgB;CAGhE;AAED,qBAAa,+BAAgC,SAAQ,OAAO,CAAC,+BAA+B,EAAE,gCAAgC,CAAC;IAE/G,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAApB,oBAAoB,EAAE,oBAAoB,EAC3D,SAAS,EAAE,SAAS;cAKhB,eAAe,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC;CAc/H"}
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.GetRepositoryAttributesUseCase = void 0;
15
+ exports.GetOwnIdentityAttributesUseCase = void 0;
16
16
  const ts_utils_1 = require("@js-soft/ts-utils");
17
17
  const consumption_1 = require("@nmshd/consumption");
18
18
  const typescript_ioc_1 = require("@nmshd/typescript-ioc");
@@ -21,14 +21,14 @@ const AttributeMapper_1 = require("./AttributeMapper");
21
21
  const GetAttributes_1 = require("./GetAttributes");
22
22
  let Validator = class Validator extends common_1.SchemaValidator {
23
23
  constructor(schemaRepository) {
24
- super(schemaRepository.getSchema("GetRepositoryAttributesRequest"));
24
+ super(schemaRepository.getSchema("GetOwnIdentityAttributesRequest"));
25
25
  }
26
26
  };
27
27
  Validator = __decorate([
28
28
  __param(0, typescript_ioc_1.Inject),
29
29
  __metadata("design:paramtypes", [common_1.SchemaRepository])
30
30
  ], Validator);
31
- let GetRepositoryAttributesUseCase = class GetRepositoryAttributesUseCase extends common_1.UseCase {
31
+ let GetOwnIdentityAttributesUseCase = class GetOwnIdentityAttributesUseCase extends common_1.UseCase {
32
32
  constructor(attributesController, validator) {
33
33
  super(validator);
34
34
  this.attributesController = attributesController;
@@ -37,18 +37,18 @@ let GetRepositoryAttributesUseCase = class GetRepositoryAttributesUseCase extend
37
37
  const query = request.query ?? {};
38
38
  const flattenedQuery = (0, common_1.flattenObject)(query);
39
39
  const dbQuery = GetAttributes_1.GetAttributesUseCase.queryTranslator.parse(flattenedQuery);
40
- dbQuery.shareInfo = { $exists: false };
40
+ dbQuery["@type"] = "OwnIdentityAttribute";
41
41
  if (request.onlyLatestVersions ?? true)
42
42
  dbQuery["succeededBy"] = { $exists: false };
43
43
  const attributes = await this.attributesController.getLocalAttributes(dbQuery);
44
44
  return ts_utils_1.Result.ok(AttributeMapper_1.AttributeMapper.toAttributeDTOList(attributes));
45
45
  }
46
46
  };
47
- exports.GetRepositoryAttributesUseCase = GetRepositoryAttributesUseCase;
48
- exports.GetRepositoryAttributesUseCase = GetRepositoryAttributesUseCase = __decorate([
47
+ exports.GetOwnIdentityAttributesUseCase = GetOwnIdentityAttributesUseCase;
48
+ exports.GetOwnIdentityAttributesUseCase = GetOwnIdentityAttributesUseCase = __decorate([
49
49
  __param(0, typescript_ioc_1.Inject),
50
50
  __param(1, typescript_ioc_1.Inject),
51
51
  __metadata("design:paramtypes", [consumption_1.AttributesController,
52
52
  Validator])
53
- ], GetRepositoryAttributesUseCase);
54
- //# sourceMappingURL=GetRepositoryAttributes.js.map
53
+ ], GetOwnIdentityAttributesUseCase);
54
+ //# sourceMappingURL=GetOwnIdentityAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetOwnIdentityAttributes.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetOwnIdentityAttributes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAA0D;AAE1D,0DAA+C;AAC/C,yCAAyF;AACzF,uDAAoD;AACpD,mDAAkF;AAoBlF,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAAgD;IACpE,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC,CAAC;IACzE,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,+BAA+B,GAA5C,MAAa,+BAAgC,SAAQ,gBAA0E;IAC3H,YAC6B,oBAA0C,EAC3D,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAHQ,yBAAoB,GAApB,oBAAoB,CAAsB;IAIvE,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,OAAwC;QACpE,MAAM,KAAK,GAA8B,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QAE7D,MAAM,cAAc,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,oCAAoB,CAAC,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAE3E,OAAO,CAAC,OAAO,CAAC,GAAG,sBAAsB,CAAC;QAE1C,IAAI,OAAO,CAAC,kBAAkB,IAAI,IAAI;YAAE,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAEpF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAE/E,OAAO,iBAAM,CAAC,EAAE,CAAC,iCAAe,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AAtBY,0EAA+B;0CAA/B,+BAA+B;IAEnC,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCADwC,kCAAoB;QAChD,SAAS;GAHvB,+BAA+B,CAsB3C"}
@@ -0,0 +1,39 @@
1
+ import { Result } from "@js-soft/ts-utils";
2
+ import { AttributesController } from "@nmshd/consumption";
3
+ import { LocalAttributeDTO } from "@nmshd/runtime-types";
4
+ import { AddressString, SchemaRepository, SchemaValidator, UseCase } from "../../common";
5
+ export interface GetPeerAttributesRequest {
6
+ peer: AddressString;
7
+ query?: GetPeerAttributesRequestQuery;
8
+ hideTechnical?: boolean;
9
+ /**
10
+ * default: true
11
+ */
12
+ onlyLatestVersions?: boolean;
13
+ }
14
+ export interface GetPeerAttributesRequestQuery {
15
+ "@type"?: string | string[];
16
+ createdAt?: string;
17
+ wasViewedAt?: string | string[];
18
+ "content.@type"?: string | string[];
19
+ "content.tags"?: string | string[];
20
+ "content.key"?: string | string[];
21
+ "content.isTechnical"?: string;
22
+ "content.confidentiality"?: string | string[];
23
+ "content.value.@type"?: string | string[];
24
+ sourceReference?: string | string[];
25
+ initialAttributePeer?: string | string[];
26
+ deletionInfo?: string | string[];
27
+ "deletionInfo.deletionStatus"?: string | string[];
28
+ "deletionInfo.deletionDate"?: string | string[];
29
+ }
30
+ declare class Validator extends SchemaValidator<GetPeerAttributesRequest> {
31
+ constructor(schemaRepository: SchemaRepository);
32
+ }
33
+ export declare class GetPeerAttributesUseCase extends UseCase<GetPeerAttributesRequest, LocalAttributeDTO[]> {
34
+ private readonly attributeController;
35
+ constructor(attributeController: AttributesController, validator: Validator);
36
+ protected executeInternal(request: GetPeerAttributesRequest): Promise<Result<LocalAttributeDTO[]>>;
37
+ }
38
+ export {};
39
+ //# sourceMappingURL=GetPeerAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetPeerAttributes.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetPeerAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAKzF,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,CAAC,EAAE,6BAA6B,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,6BAA6B;IAC1C,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9C,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1C,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,6BAA6B,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClD,2BAA2B,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnD;AAED,cAAM,SAAU,SAAQ,eAAe,CAAC,wBAAwB,CAAC;gBAClC,gBAAgB,EAAE,gBAAgB;CAGhE;AAED,qBAAa,wBAAyB,SAAQ,OAAO,CAAC,wBAAwB,EAAE,iBAAiB,EAAE,CAAC;IAEpF,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,oBAAoB,EAC1D,SAAS,EAAE,SAAS;cAKhB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;CAe3G"}
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.GetPeerSharedAttributesUseCase = void 0;
15
+ exports.GetPeerAttributesUseCase = void 0;
16
16
  const ts_utils_1 = require("@js-soft/ts-utils");
17
17
  const consumption_1 = require("@nmshd/consumption");
18
18
  const typescript_ioc_1 = require("@nmshd/typescript-ioc");
@@ -22,35 +22,35 @@ const AttributeMapper_1 = require("./AttributeMapper");
22
22
  const GetAttributes_1 = require("./GetAttributes");
23
23
  let Validator = class Validator extends common_1.SchemaValidator {
24
24
  constructor(schemaRepository) {
25
- super(schemaRepository.getSchema("GetPeerSharedAttributesRequest"));
25
+ super(schemaRepository.getSchema("GetPeerAttributesRequest"));
26
26
  }
27
27
  };
28
28
  Validator = __decorate([
29
29
  __param(0, typescript_ioc_1.Inject),
30
30
  __metadata("design:paramtypes", [common_1.SchemaRepository])
31
31
  ], Validator);
32
- let GetPeerSharedAttributesUseCase = class GetPeerSharedAttributesUseCase extends common_1.UseCase {
32
+ let GetPeerAttributesUseCase = class GetPeerAttributesUseCase extends common_1.UseCase {
33
33
  constructor(attributeController, validator) {
34
34
  super(validator);
35
35
  this.attributeController = attributeController;
36
36
  }
37
37
  async executeInternal(request) {
38
38
  const query = request.query ?? {};
39
- query["content.owner"] = request.peer;
40
39
  const flattenedQuery = (0, flattenObject_1.flattenObject)(query);
41
40
  const dbQuery = GetAttributes_1.GetAttributesUseCase.queryTranslator.parse(flattenedQuery);
42
- if (request.onlyLatestVersions ?? true) {
41
+ dbQuery["@type"] = { $in: ["PeerIdentityAttribute", "PeerRelationshipAttribute", "ThirdPartyRelationshipAttribute"] };
42
+ dbQuery["peer"] = request.peer;
43
+ if (request.onlyLatestVersions ?? true)
43
44
  dbQuery["succeededBy"] = { $exists: false };
44
- }
45
45
  const attributes = await this.attributeController.getLocalAttributes(dbQuery, request.hideTechnical);
46
46
  return ts_utils_1.Result.ok(AttributeMapper_1.AttributeMapper.toAttributeDTOList(attributes));
47
47
  }
48
48
  };
49
- exports.GetPeerSharedAttributesUseCase = GetPeerSharedAttributesUseCase;
50
- exports.GetPeerSharedAttributesUseCase = GetPeerSharedAttributesUseCase = __decorate([
49
+ exports.GetPeerAttributesUseCase = GetPeerAttributesUseCase;
50
+ exports.GetPeerAttributesUseCase = GetPeerAttributesUseCase = __decorate([
51
51
  __param(0, typescript_ioc_1.Inject),
52
52
  __param(1, typescript_ioc_1.Inject),
53
53
  __metadata("design:paramtypes", [consumption_1.AttributesController,
54
54
  Validator])
55
- ], GetPeerSharedAttributesUseCase);
56
- //# sourceMappingURL=GetPeerSharedAttributes.js.map
55
+ ], GetPeerAttributesUseCase);
56
+ //# sourceMappingURL=GetPeerAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetPeerAttributes.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetPeerAttributes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAA0D;AAE1D,0DAA+C;AAC/C,yCAAyF;AACzF,8DAA2D;AAC3D,uDAAoD;AACp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AE5B,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCADuC,kCAAoB;QAC/C,SAAS;GAHvB,wBAAwB,CAuBpC"}
@@ -37,7 +37,7 @@ let GetVersionsOfAttributeUseCase = class GetVersionsOfAttributeUseCase extends
37
37
  const attribute = await this.attributeController.getLocalAttribute(core_types_1.CoreId.from(request.attributeId));
38
38
  if (!attribute)
39
39
  throw common_1.RuntimeErrors.general.recordNotFound(consumption_1.LocalAttribute);
40
- const allVersions = await this.attributeController.getVersionsOfAttribute(core_types_1.CoreId.from(request.attributeId));
40
+ const allVersions = await this.attributeController.getVersionsOfAttribute(attribute);
41
41
  return ts_utils_1.Result.ok(AttributeMapper_1.AttributeMapper.toAttributeDTOList(allVersions));
42
42
  }
43
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"GetVersionsOfAttribute.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetVersionsOfAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAA0E;AAC1E,kDAA2C;AAE3C,0DAA+C;AAC/C,yCAA4G;AAC5G,uDAAoD;AAMpD,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAA8C;IAClE,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,+BAA+B,CAAC,CAAC,CAAC;IACvE,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,6BAA6B,GAA1C,MAAa,6BAA8B,SAAQ,gBAA2D;IAC1G,YAC6B,mBAAyC,EAC1D,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAHQ,wBAAmB,GAAnB,mBAAmB,CAAsB;IAItE,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,OAAsC;QAClE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,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SAAS,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,mBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QACrG,IAAI,CAAC,SAAS;YAAE,MAAM,sBAAa,CAAC,OAAO,CAAC,cAAc,CAAC,4BAAc,CAAC,CAAC;QAE3E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAErF,OAAO,iBAAM,CAAC,EAAE,CAAC,iCAAe,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;IACtE,CAAC;CACJ,CAAA;AAhBY,sEAA6B;wCAA7B,6BAA6B;IAEjC,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCADuC,kCAAoB;QAC/C,SAAS;GAHvB,6BAA6B,CAgBzC"}
@@ -0,0 +1,22 @@
1
+ import { Result } from "@js-soft/ts-utils";
2
+ import { AttributesController } from "@nmshd/consumption";
3
+ import { LocalAttributeDTO } from "@nmshd/runtime-types";
4
+ import { AddressString, AttributeIdString, SchemaRepository, SchemaValidator, UseCase } from "../../common";
5
+ export interface GetVersionsOfAttributeSharedWithPeerRequest {
6
+ attributeId: AttributeIdString;
7
+ peer: AddressString;
8
+ /**
9
+ * default: true
10
+ */
11
+ onlyLatestVersions?: boolean;
12
+ }
13
+ declare class Validator extends SchemaValidator<GetVersionsOfAttributeSharedWithPeerRequest> {
14
+ constructor(schemaRepository: SchemaRepository);
15
+ }
16
+ export declare class GetVersionsOfAttributeSharedWithPeerUseCase extends UseCase<GetVersionsOfAttributeSharedWithPeerRequest, LocalAttributeDTO[]> {
17
+ private readonly attributeController;
18
+ constructor(attributeController: AttributesController, validator: Validator);
19
+ protected executeInternal(request: GetVersionsOfAttributeSharedWithPeerRequest): Promise<Result<LocalAttributeDTO[]>>;
20
+ }
21
+ export {};
22
+ //# sourceMappingURL=GetVersionsOfAttributeSharedWithPeer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetVersionsOfAttributeSharedWithPeer.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetVersionsOfAttributeSharedWithPeer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAA6F,MAAM,oBAAoB,CAAC;AAErJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAiB,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG3H,MAAM,WAAW,2CAA2C;IACxD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,cAAM,SAAU,SAAQ,eAAe,CAAC,2CAA2C,CAAC;gBACrD,gBAAgB,EAAE,gBAAgB;CAGhE;AAED,qBAAa,2CAA4C,SAAQ,OAAO,CAAC,2CAA2C,EAAE,iBAAiB,EAAE,CAAC;IAE1H,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAnB,mBAAmB,EAAE,oBAAoB,EAC1D,SAAS,EAAE,SAAS;cAKhB,eAAe,CAAC,OAAO,EAAE,2CAA2C,GAAG,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC;CAiB9H"}
@@ -12,49 +12,43 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.GetSharedVersionsOfAttributeUseCase = void 0;
15
+ exports.GetVersionsOfAttributeSharedWithPeerUseCase = void 0;
16
16
  const ts_utils_1 = require("@js-soft/ts-utils");
17
17
  const consumption_1 = require("@nmshd/consumption");
18
18
  const core_types_1 = require("@nmshd/core-types");
19
- const transport_1 = require("@nmshd/transport");
20
19
  const typescript_ioc_1 = require("@nmshd/typescript-ioc");
21
20
  const common_1 = require("../../common");
22
21
  const AttributeMapper_1 = require("./AttributeMapper");
23
22
  let Validator = class Validator extends common_1.SchemaValidator {
24
23
  constructor(schemaRepository) {
25
- super(schemaRepository.getSchema("GetSharedVersionsOfAttributeRequest"));
24
+ super(schemaRepository.getSchema("GetVersionsOfAttributeSharedWithPeerRequest"));
26
25
  }
27
26
  };
28
27
  Validator = __decorate([
29
28
  __param(0, typescript_ioc_1.Inject),
30
29
  __metadata("design:paramtypes", [common_1.SchemaRepository])
31
30
  ], Validator);
32
- let GetSharedVersionsOfAttributeUseCase = class GetSharedVersionsOfAttributeUseCase extends common_1.UseCase {
33
- constructor(accountController, attributeController, validator) {
31
+ let GetVersionsOfAttributeSharedWithPeerUseCase = class GetVersionsOfAttributeSharedWithPeerUseCase extends common_1.UseCase {
32
+ constructor(attributeController, validator) {
34
33
  super(validator);
35
- this.accountController = accountController;
36
34
  this.attributeController = attributeController;
37
35
  }
38
36
  async executeInternal(request) {
39
- const sourceAttributeId = core_types_1.CoreId.from(request.attributeId);
40
- const sourceAttribute = await this.attributeController.getLocalAttribute(sourceAttributeId);
41
- if (!sourceAttribute)
37
+ const localAttribute = await this.attributeController.getLocalAttribute(core_types_1.CoreId.from(request.attributeId));
38
+ if (!localAttribute)
42
39
  return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(consumption_1.LocalAttribute));
43
- if (request.peers?.length === 0) {
44
- return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.invalidPropertyValue("The `peers` property may not be an empty array."));
40
+ if (!(localAttribute instanceof consumption_1.OwnIdentityAttribute || localAttribute instanceof consumption_1.OwnRelationshipAttribute || localAttribute instanceof consumption_1.PeerRelationshipAttribute)) {
41
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.invalidPropertyValue("The `attributeId` property must belong to an OwnIdentityAttribute, an OwnRelationshipAttribute or a PeerRelationshipAttribute."));
45
42
  }
46
- const peers = request.peers?.map((address) => core_types_1.CoreAddress.from(address));
47
- const sharedVersions = await this.attributeController.getSharedVersionsOfAttribute(sourceAttributeId, peers, request.onlyLatestVersions);
43
+ const sharedVersions = await this.attributeController.getVersionsOfAttributeSharedWithPeer(localAttribute, core_types_1.CoreAddress.from(request.peer), request.onlyLatestVersions);
48
44
  return ts_utils_1.Result.ok(AttributeMapper_1.AttributeMapper.toAttributeDTOList(sharedVersions));
49
45
  }
50
46
  };
51
- exports.GetSharedVersionsOfAttributeUseCase = GetSharedVersionsOfAttributeUseCase;
52
- exports.GetSharedVersionsOfAttributeUseCase = GetSharedVersionsOfAttributeUseCase = __decorate([
47
+ exports.GetVersionsOfAttributeSharedWithPeerUseCase = GetVersionsOfAttributeSharedWithPeerUseCase;
48
+ exports.GetVersionsOfAttributeSharedWithPeerUseCase = GetVersionsOfAttributeSharedWithPeerUseCase = __decorate([
53
49
  __param(0, typescript_ioc_1.Inject),
54
50
  __param(1, typescript_ioc_1.Inject),
55
- __param(2, typescript_ioc_1.Inject),
56
- __metadata("design:paramtypes", [transport_1.AccountController,
57
- consumption_1.AttributesController,
51
+ __metadata("design:paramtypes", [consumption_1.AttributesController,
58
52
  Validator])
59
- ], GetSharedVersionsOfAttributeUseCase);
60
- //# sourceMappingURL=GetSharedVersionsOfAttribute.js.map
53
+ ], GetVersionsOfAttributeSharedWithPeerUseCase);
54
+ //# sourceMappingURL=GetVersionsOfAttributeSharedWithPeer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetVersionsOfAttributeSharedWithPeer.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/GetVersionsOfAttributeSharedWithPeer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAAqJ;AACrJ,kDAAwD;AAExD,0DAA+C;AAC/C,yCAA2H;AAC3H,uDAAoD;AAWpD,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ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uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCADuC,kCAAoB;QAC/C,SAAS;GAHvB,2CAA2C,CAyBvD"}
@@ -3,24 +3,24 @@ import { AttributesController } from "@nmshd/consumption";
3
3
  import { LocalAttributeDTO } from "@nmshd/runtime-types";
4
4
  import { AccountController, MessageController } from "@nmshd/transport";
5
5
  import { AddressString, AttributeIdString, NotificationIdString, SchemaRepository, SchemaValidator, UseCase } from "../../common";
6
- export interface NotifyPeerAboutRepositoryAttributeSuccessionResponse {
6
+ export interface NotifyPeerAboutOwnIdentityAttributeSuccessionRequest {
7
+ attributeId: AttributeIdString;
8
+ peer: AddressString;
9
+ }
10
+ export interface NotifyPeerAboutOwnIdentityAttributeSuccessionResponse {
7
11
  predecessor: LocalAttributeDTO;
8
12
  successor: LocalAttributeDTO;
9
13
  notificationId: NotificationIdString;
10
14
  }
11
- export interface NotifyPeerAboutRepositoryAttributeSuccessionRequest {
12
- attributeId: AttributeIdString;
13
- peer: AddressString;
14
- }
15
- declare class Validator extends SchemaValidator<NotifyPeerAboutRepositoryAttributeSuccessionRequest> {
15
+ declare class Validator extends SchemaValidator<NotifyPeerAboutOwnIdentityAttributeSuccessionRequest> {
16
16
  constructor(schemaRepository: SchemaRepository);
17
17
  }
18
- export declare class NotifyPeerAboutRepositoryAttributeSuccessionUseCase extends UseCase<NotifyPeerAboutRepositoryAttributeSuccessionRequest, NotifyPeerAboutRepositoryAttributeSuccessionResponse> {
18
+ export declare class NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase extends UseCase<NotifyPeerAboutOwnIdentityAttributeSuccessionRequest, NotifyPeerAboutOwnIdentityAttributeSuccessionResponse> {
19
19
  private readonly accountController;
20
20
  private readonly attributeController;
21
21
  private readonly messageController;
22
22
  constructor(accountController: AccountController, attributeController: AttributesController, messageController: MessageController, validator: Validator);
23
- protected executeInternal(request: NotifyPeerAboutRepositoryAttributeSuccessionRequest): Promise<Result<NotifyPeerAboutRepositoryAttributeSuccessionResponse>>;
23
+ protected executeInternal(request: NotifyPeerAboutOwnIdentityAttributeSuccessionRequest): Promise<Result<NotifyPeerAboutOwnIdentityAttributeSuccessionResponse>>;
24
24
  }
25
25
  export {};
26
- //# sourceMappingURL=NotifyPeerAboutRepositoryAttributeSuccession.d.ts.map
26
+ //# sourceMappingURL=NotifyPeerAboutOwnIdentityAttributeSuccession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotifyPeerAboutOwnIdentityAttributeSuccession.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/NotifyPeerAboutOwnIdentityAttributeSuccession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAwD,MAAM,oBAAoB,CAAC;AAGhH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,EAAiB,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGjJ,MAAM,WAAW,oDAAoD;IACjE,WAAW,EAAE,iBAAiB,CAAC;IAC/B,IAAI,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,qDAAqD;IAClE,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,cAAc,EAAE,oBAAoB,CAAC;CACxC;AAED,cAAM,SAAU,SAAQ,eAAe,CAAC,oDAAoD,CAAC;gBAC9D,gBAAgB,EAAE,gBAAgB;CAGhE;AAED,qBAAa,oDAAqD,SAAQ,OAAO,CAC7E,oDAAoD,EACpD,qDAAqD,CACxD;IAEe,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,oBAAoB,EACzC,iBAAiB,EAAE,iBAAiB,EACrD,SAAS,EAAE,SAAS;cAKhB,eAAe,CAAC,OAAO,EAAE,oDAAoD,GAAG,OAAO,CAAC,MAAM,CAAC,qDAAqD,CAAC,CAAC;CAsDzK"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase = void 0;
16
+ const ts_utils_1 = require("@js-soft/ts-utils");
17
+ const consumption_1 = require("@nmshd/consumption");
18
+ const content_1 = require("@nmshd/content");
19
+ const core_types_1 = require("@nmshd/core-types");
20
+ const transport_1 = require("@nmshd/transport");
21
+ const typescript_ioc_1 = require("@nmshd/typescript-ioc");
22
+ const common_1 = require("../../common");
23
+ const AttributeMapper_1 = require("./AttributeMapper");
24
+ let Validator = class Validator extends common_1.SchemaValidator {
25
+ constructor(schemaRepository) {
26
+ super(schemaRepository.getSchema("NotifyPeerAboutOwnIdentityAttributeSuccessionRequest"));
27
+ }
28
+ };
29
+ Validator = __decorate([
30
+ __param(0, typescript_ioc_1.Inject),
31
+ __metadata("design:paramtypes", [common_1.SchemaRepository])
32
+ ], Validator);
33
+ let NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase = class NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase extends common_1.UseCase {
34
+ constructor(accountController, attributeController, messageController, validator) {
35
+ super(validator);
36
+ this.accountController = accountController;
37
+ this.attributeController = attributeController;
38
+ this.messageController = messageController;
39
+ }
40
+ async executeInternal(request) {
41
+ const attributeId = core_types_1.CoreId.from(request.attributeId);
42
+ const attribute = await this.attributeController.getLocalAttribute(attributeId);
43
+ if (!attribute)
44
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(consumption_1.LocalAttribute.name));
45
+ if (!(attribute instanceof consumption_1.OwnIdentityAttribute))
46
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.attributes.isNotOwnIdentityAttribute(attributeId));
47
+ const peerAddress = core_types_1.CoreAddress.from(request.peer);
48
+ const candidatePredecessors = await this.attributeController.getVersionsOfAttributeSharedWithPeer(attribute, peerAddress);
49
+ if (candidatePredecessors.length === 0) {
50
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.attributes.peerHasNoPreviousVersionOfAttribute(attributeId, peerAddress));
51
+ }
52
+ const latestVersionSharedWithPeer = candidatePredecessors[0];
53
+ if (latestVersionSharedWithPeer.id.toString() === request.attributeId) {
54
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.attributes.ownIdentityAttributeHasAlreadyBeenSharedWithPeer(request.attributeId, peerAddress));
55
+ }
56
+ const latestSharedVersionIsSuccessor = await this.attributeController.isSubsequentInSuccession(attribute.id, latestVersionSharedWithPeer.id);
57
+ if (latestSharedVersionIsSuccessor) {
58
+ return ts_utils_1.Result.fail(common_1.RuntimeErrors.attributes.successorOfOwnIdentityAttributeHasAlreadyBeenSharedWithPeer(request.attributeId, latestVersionSharedWithPeer.id, peerAddress));
59
+ }
60
+ const notificationId = await consumption_1.ConsumptionIds.notification.generate();
61
+ const updatedAttribute = await this.attributeController.addForwardingDetailsToAttribute(attribute, peerAddress, notificationId);
62
+ const notificationItem = content_1.PeerAttributeSucceededNotificationItem.from({
63
+ predecessorId: latestVersionSharedWithPeer.id,
64
+ successorId: updatedAttribute.id,
65
+ successorContent: updatedAttribute.content
66
+ });
67
+ const notification = content_1.Notification.from({
68
+ id: notificationId,
69
+ items: [notificationItem]
70
+ });
71
+ await this.messageController.sendMessage({
72
+ recipients: [peerAddress],
73
+ content: notification
74
+ });
75
+ await this.accountController.syncDatawallet();
76
+ const result = {
77
+ predecessor: AttributeMapper_1.AttributeMapper.toAttributeDTO(latestVersionSharedWithPeer),
78
+ successor: AttributeMapper_1.AttributeMapper.toAttributeDTO(updatedAttribute),
79
+ notificationId: notificationId.toString()
80
+ };
81
+ return ts_utils_1.Result.ok(result);
82
+ }
83
+ };
84
+ exports.NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase = NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase;
85
+ exports.NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase = NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase = __decorate([
86
+ __param(0, typescript_ioc_1.Inject),
87
+ __param(1, typescript_ioc_1.Inject),
88
+ __param(2, typescript_ioc_1.Inject),
89
+ __param(3, typescript_ioc_1.Inject),
90
+ __metadata("design:paramtypes", [transport_1.AccountController,
91
+ consumption_1.AttributesController,
92
+ transport_1.MessageController,
93
+ Validator])
94
+ ], NotifyPeerAboutOwnIdentityAttributeSuccessionUseCase);
95
+ //# sourceMappingURL=NotifyPeerAboutOwnIdentityAttributeSuccession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotifyPeerAboutOwnIdentityAttributeSuccession.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/NotifyPeerAboutOwnIdentityAttributeSuccession.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAAgH;AAChH,4CAAsF;AAC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,GAAG,sBAAY,CAAC,IAAI,CAAC;YACnC,EAAE,EAAE,cAAc;YAClB,KAAK,EAAE,CAAC,gBAAgB,CAAC;SAC5B,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC;YACrC,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,OAAO,EAAE,YAAY;SACxB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;QAE9C,MAAM,MAAM,GAAG;YACX,WAAW,EAAE,iCAAe,CAAC,cAAc,CAAC,2BAA2B,CAAC;YACxE,SAAS,EAAE,iCAAe,CAAC,cAAc,CAAC,gBAAgB,CAAC;YAC3D,cAAc,EAAE,cAAc,CAAC,QAAQ,EAAE;SAC5C,CAAC;QACF,OAAO,iBAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACJ,CAAA;AAnEY,oHAAoD;+DAApD,oDAAoD;IAKxD,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCAHqC,6BAAiB;QACf,kCAAoB;QACtB,6BAAiB;QAC1C,SAAS;GARvB,oDAAoD,CAmEhE"}
@@ -3,7 +3,7 @@ import { AttributesController, OutgoingRequestsController } from "@nmshd/consump
3
3
  import { LocalRequestDTO } from "@nmshd/runtime-types";
4
4
  import { AccountController, MessageController } from "@nmshd/transport";
5
5
  import { AddressString, AttributeIdString, ISO8601DateTimeString, SchemaRepository, SchemaValidator, UseCase } from "../../common";
6
- export interface ShareRepositoryAttributeRequest {
6
+ export interface ShareOwnIdentityAttributeRequest {
7
7
  attributeId: AttributeIdString;
8
8
  peer: AddressString;
9
9
  requestMetadata?: {
@@ -17,16 +17,16 @@ export interface ShareRepositoryAttributeRequest {
17
17
  metadata?: Record<string, any>;
18
18
  };
19
19
  }
20
- declare class Validator extends SchemaValidator<ShareRepositoryAttributeRequest> {
20
+ declare class Validator extends SchemaValidator<ShareOwnIdentityAttributeRequest> {
21
21
  constructor(schemaRepository: SchemaRepository);
22
22
  }
23
- export declare class ShareRepositoryAttributeUseCase extends UseCase<ShareRepositoryAttributeRequest, LocalRequestDTO> {
23
+ export declare class ShareOwnIdentityAttributeUseCase extends UseCase<ShareOwnIdentityAttributeRequest, LocalRequestDTO> {
24
24
  private readonly attributeController;
25
25
  private readonly accountController;
26
26
  private readonly requestsController;
27
27
  private readonly messageController;
28
28
  constructor(attributeController: AttributesController, accountController: AccountController, requestsController: OutgoingRequestsController, messageController: MessageController, validator: Validator);
29
- protected executeInternal(request: ShareRepositoryAttributeRequest): Promise<Result<LocalRequestDTO>>;
29
+ protected executeInternal(request: ShareOwnIdentityAttributeRequest): Promise<Result<LocalRequestDTO>>;
30
30
  }
31
31
  export {};
32
- //# sourceMappingURL=ShareRepositoryAttribute.d.ts.map
32
+ //# sourceMappingURL=ShareOwnIdentityAttribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareOwnIdentityAttribute.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/ShareOwnIdentityAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAA0E,0BAA0B,EAAwB,MAAM,oBAAoB,CAAC;AAGpL,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,qBAAqB,EAAiB,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGlJ,MAAM,WAAW,gCAAgC;IAC7C,WAAW,EAAE,iBAAiB,CAAC;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,eAAe,CAAC,EAAE;QACd,KAAK,CAAC,EAA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