@nmshd/consumption 3.12.1 → 5.0.0-alpha.10

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 (94) hide show
  1. package/dist/buildInformation.js +4 -4
  2. package/dist/consumption/ConsumptionController.d.ts +2 -1
  3. package/dist/consumption/ConsumptionController.d.ts.map +1 -1
  4. package/dist/consumption/ConsumptionController.js +9 -1
  5. package/dist/consumption/ConsumptionController.js.map +1 -1
  6. package/dist/consumption/CoreErrors.d.ts +5 -2
  7. package/dist/consumption/CoreErrors.d.ts.map +1 -1
  8. package/dist/consumption/CoreErrors.js +13 -4
  9. package/dist/consumption/CoreErrors.js.map +1 -1
  10. package/dist/modules/attributeListeners/AttributeListenersController.d.ts +1 -0
  11. package/dist/modules/attributeListeners/AttributeListenersController.d.ts.map +1 -1
  12. package/dist/modules/attributeListeners/AttributeListenersController.js +7 -0
  13. package/dist/modules/attributeListeners/AttributeListenersController.js.map +1 -1
  14. package/dist/modules/attributes/AttributesController.d.ts +5 -4
  15. package/dist/modules/attributes/AttributesController.d.ts.map +1 -1
  16. package/dist/modules/attributes/AttributesController.js +41 -11
  17. package/dist/modules/attributes/AttributesController.js.map +1 -1
  18. package/dist/modules/attributes/index.d.ts +2 -2
  19. package/dist/modules/attributes/index.d.ts.map +1 -1
  20. package/dist/modules/attributes/index.js +2 -2
  21. package/dist/modules/attributes/index.js.map +1 -1
  22. package/dist/modules/attributes/local/CreateRepositoryAttributeParams.d.ts +20 -0
  23. package/dist/modules/attributes/local/CreateRepositoryAttributeParams.d.ts.map +1 -0
  24. package/dist/modules/attributes/local/{CreateLocalAttributeParams.js → CreateRepositoryAttributeParams.js} +8 -19
  25. package/dist/modules/attributes/local/CreateRepositoryAttributeParams.js.map +1 -0
  26. package/dist/modules/attributes/local/{CreatePeerLocalAttributeParams.d.ts → CreateSharedLocalAttributeParams.d.ts} +7 -7
  27. package/dist/modules/attributes/local/CreateSharedLocalAttributeParams.d.ts.map +1 -0
  28. package/dist/modules/attributes/local/{CreatePeerLocalAttributeParams.js → CreateSharedLocalAttributeParams.js} +9 -9
  29. package/dist/modules/attributes/local/CreateSharedLocalAttributeParams.js.map +1 -0
  30. package/dist/modules/notifications/NotificationsController.d.ts +2 -1
  31. package/dist/modules/notifications/NotificationsController.d.ts.map +1 -1
  32. package/dist/modules/notifications/NotificationsController.js +6 -0
  33. package/dist/modules/notifications/NotificationsController.js.map +1 -1
  34. package/dist/modules/requests/incoming/DecideRequestParametersValidator.d.ts.map +1 -1
  35. package/dist/modules/requests/incoming/DecideRequestParametersValidator.js +11 -18
  36. package/dist/modules/requests/incoming/DecideRequestParametersValidator.js.map +1 -1
  37. package/dist/modules/requests/incoming/IncomingRequestsController.d.ts +5 -1
  38. package/dist/modules/requests/incoming/IncomingRequestsController.d.ts.map +1 -1
  39. package/dist/modules/requests/incoming/IncomingRequestsController.js +16 -3
  40. package/dist/modules/requests/incoming/IncomingRequestsController.js.map +1 -1
  41. package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.d.ts +3 -3
  42. package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.d.ts.map +1 -1
  43. package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.js +1 -1
  44. package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.js.map +1 -1
  45. package/dist/modules/requests/incoming/decide/DecideRequestItemGroupParameters.js +1 -2
  46. package/dist/modules/requests/incoming/decide/DecideRequestItemGroupParameters.js.map +1 -1
  47. package/dist/modules/requests/incoming/decide/DecideRequestItemParameters.js +1 -2
  48. package/dist/modules/requests/incoming/decide/DecideRequestItemParameters.js.map +1 -1
  49. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.d.ts.map +1 -1
  50. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +17 -9
  51. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -1
  52. package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.d.ts.map +1 -1
  53. package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js +3 -1
  54. package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js.map +1 -1
  55. package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.d.ts +2 -2
  56. package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.d.ts.map +1 -1
  57. package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js +58 -29
  58. package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js.map +1 -1
  59. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts +2 -1
  60. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts.map +1 -1
  61. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +83 -23
  62. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -1
  63. package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.d.ts +1 -1
  64. package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.d.ts.map +1 -1
  65. package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js +51 -13
  66. package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js.map +1 -1
  67. package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.d.ts +5 -0
  68. package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.d.ts.map +1 -0
  69. package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.js +124 -0
  70. package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.js.map +1 -0
  71. package/dist/modules/requests/itemProcessors/utility/validateQuery.d.ts.map +1 -1
  72. package/dist/modules/requests/itemProcessors/utility/validateQuery.js +1 -4
  73. package/dist/modules/requests/itemProcessors/utility/validateQuery.js.map +1 -1
  74. package/dist/modules/requests/local/LocalResponse.d.ts +2 -2
  75. package/dist/modules/requests/local/LocalResponse.d.ts.map +1 -1
  76. package/dist/modules/requests/local/LocalResponse.js.map +1 -1
  77. package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts +3 -2
  78. package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts.map +1 -1
  79. package/dist/modules/requests/outgoing/OutgoingRequestsController.js +22 -5
  80. package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
  81. package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.d.ts +4 -3
  82. package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.d.ts.map +1 -1
  83. package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.js +7 -2
  84. package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.js.map +1 -1
  85. package/dist/modules/settings/SettingsController.d.ts +1 -0
  86. package/dist/modules/settings/SettingsController.d.ts.map +1 -1
  87. package/dist/modules/settings/SettingsController.js +6 -0
  88. package/dist/modules/settings/SettingsController.js.map +1 -1
  89. package/package.json +2 -2
  90. package/dist/modules/attributes/local/CreateLocalAttributeParams.d.ts +0 -27
  91. package/dist/modules/attributes/local/CreateLocalAttributeParams.d.ts.map +0 -1
  92. package/dist/modules/attributes/local/CreateLocalAttributeParams.js.map +0 -1
  93. package/dist/modules/attributes/local/CreatePeerLocalAttributeParams.d.ts.map +0 -1
  94. package/dist/modules/attributes/local/CreatePeerLocalAttributeParams.js.map +0 -1
@@ -11,16 +11,24 @@ class CreateAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.
11
11
  const senderIsAttributeOwner = requestItem.attribute.owner.equals(this.currentIdentityAddress);
12
12
  const ownerIsEmptyString = requestItem.attribute.owner.toString() === "";
13
13
  if (requestItem.attribute instanceof content_1.IdentityAttribute) {
14
+ if (recipientIsAttributeOwner || ownerIsEmptyString) {
15
+ return ValidationResult_1.ValidationResult.success();
16
+ }
14
17
  if (senderIsAttributeOwner) {
15
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("Cannot create own Attributes with a CreateAttributeRequestItem. Use a ShareAttributeRequestItem instead."));
18
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("Cannot create own IdentityAttributes with a CreateAttributeRequestItem. Use a ShareAttributeRequestItem instead."));
16
19
  }
17
- if (recipientIsAttributeOwner || ownerIsEmptyString || !recipient)
18
- return ValidationResult_1.ValidationResult.success();
19
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given `attribute` can only be the recipient's address or an empty string. The latter will default to the recipient's address."));
20
+ if (typeof recipient !== "undefined") {
21
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the provided IdentityAttribute for the `attribute` property can only be the Recipient's Address or an empty string. The latter will default to the Recipient's Address."));
22
+ }
23
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the provided IdentityAttribute for the `attribute` property can only be an empty string. It will default to the Recipient's Address."));
20
24
  }
21
- if (recipientIsAttributeOwner || senderIsAttributeOwner || ownerIsEmptyString || !recipient)
25
+ if (recipientIsAttributeOwner || senderIsAttributeOwner || ownerIsEmptyString) {
22
26
  return ValidationResult_1.ValidationResult.success();
23
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given 'attribute' can only be the sender's address, the recipient's address or an empty string. The latter will default to the recipient's address."));
27
+ }
28
+ if (typeof recipient !== "undefined") {
29
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the provided RelationshipAttribute for the `attribute` property can only be the Sender's Address, the Recipient's Address or an empty string. The latter will default to the Recipient's Address."));
30
+ }
31
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the provided RelationshipAttribute for the `attribute` property can only be the Sender's Address or an empty string. The latter will default to the Recipient's Address."));
24
32
  }
25
33
  async accept(requestItem, _params, requestInfo) {
26
34
  if (requestItem.attribute.owner.toString() === "") {
@@ -28,7 +36,7 @@ class CreateAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.
28
36
  }
29
37
  let sharedAttribute;
30
38
  if (requestItem.attribute instanceof content_1.IdentityAttribute) {
31
- const repositoryAttribute = await this.consumptionController.attributes.createLocalAttribute({
39
+ const repositoryAttribute = await this.consumptionController.attributes.createRepositoryAttribute({
32
40
  content: requestItem.attribute
33
41
  });
34
42
  sharedAttribute = await this.consumptionController.attributes.createSharedLocalAttributeCopy({
@@ -38,7 +46,7 @@ class CreateAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.
38
46
  });
39
47
  }
40
48
  else {
41
- sharedAttribute = await this.consumptionController.attributes.createPeerLocalAttribute({
49
+ sharedAttribute = await this.consumptionController.attributes.createSharedLocalAttribute({
42
50
  content: requestItem.attribute,
43
51
  peer: requestInfo.peer,
44
52
  requestReference: requestInfo.id
@@ -56,7 +64,7 @@ class CreateAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.
56
64
  if (requestItem.attribute.owner.toString() === "") {
57
65
  requestItem.attribute.owner = requestInfo.peer;
58
66
  }
59
- await this.consumptionController.attributes.createPeerLocalAttribute({
67
+ await this.consumptionController.attributes.createSharedLocalAttribute({
60
68
  id: responseItem.attributeId,
61
69
  content: requestItem.attribute,
62
70
  peer: requestInfo.peer,
@@ -1 +1 @@
1
- {"version":3,"file":"CreateAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;AAAA,4CAAmK;AAEnK,mEAAgE;AAEhE,uEAAoE;AAEpE,gFAA6E;AAG7E,MAAa,mCAAoC,SAAQ,yDAAuD;IAC5F,4BAA4B,CACxC,WAAuC,EACvC,QAAkB,EAClB,SAAuB;QAEvB,MAAM,yBAAyB,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAChF,MAAM,sBAAsB,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC/F,MAAM,kBAAkB,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;QAEzE,IAAI,WAAW,CAAC,SAAS,YAAY,2BAAiB,EAAE,CAAC;YACrD,IAAI,sBAAsB,EAAE,CAAC;gBACzB,OAAO,mCAAgB,CAAC,KAAK,CACzB,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,0GAA0G,CAAC,CACrJ,CAAC;YACN,CAAC;YAED,IAAI,yBAAyB,IAAI,kBAAkB,IAAI,CAAC,SAAS;gBAAE,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;YAErG,OAAO,mCAAgB,CAAC,KAAK,CACzB,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAClC,gJAAgJ,CACnJ,CACJ,CAAC;QACN,CAAC;QAED,IAAI,yBAAyB,IAAI,sBAAsB,IAAI,kBAAkB,IAAI,CAAC,SAAS;YAAE,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;QAE/H,OAAO,mCAAgB,CAAC,KAAK,CACzB,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,C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AC/D,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC;YAChD,WAAW,CAAC,SAAS,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC;QACnD,CAAC;QAED,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,wBAAwB,CAAC;YACjE,EAAE,EAAE,YAAY,CAAC,WAAW;YAC5B,OAAO,EAAE,WAAW,CAAC,SAAS;YAC9B,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,gBAAgB,EAAE,WAAW,CAAC,EAAE;SACnC,CAAC,CAAC;IACP,CAAC;CACJ;AA1FD,kFA0FC"}
1
+ {"version":3,"file":"CreateAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;AAAA,4CAAmK;AAEnK,mEAAgE;AAEhE,uEAAoE;AAEpE,gFAA6E;AAG7E,MAAa,mCAAoC,SAAQ,yDAAuD;IAC5F,4BAA4B,CACxC,WAAuC,EACvC,QAAkB,EAClB,SAAuB;QAEvB,MAAM,yBAAyB,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAChF,MAAM,sBAAsB,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC/F,MAAM,kBAAkB,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;QAEzE,IAAI,WAAW,CAAC,SAAS,YAAY,2BAAiB,EAAE,CAAC;YACrD,IAAI,yBAAyB,IAAI,kBAAkB,EAAE,CAAC;gBAClD,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;YACtC,CAAC;YAED,IAAI,sBAAsB,EAAE,CAAC;gBACzB,OA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eleteAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,OAAO,EAAsB,MAAM,gBAAgB,CAAC;AACpK,OAAO,EAAE,WAAW,EAAY,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,8CAA8C,EAAE,MAAM,8CAA8C,CAAC;AAE9G,qBAAa,mCAAoC,SAAQ,2BAA2B,CAAC,0BAA0B,CAAC;IACtF,4BAA4B,CAAC,WAAW,EAAE,0BAA0B,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA6B5I,SAAS,CAC3B,WAAW,EAAE,0BAA0B,EACvC,MAAM,EAAE,8CAA8C,EACtD,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAiBN,MAAM,CACxB,WAAW,EAAE,0BAA0B,EACvC,MAAM,EAAE,8CAA8C,EACtD,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,iCAAiC,GAAG,kBAAkB,CAAC;IAsB5C,yBAAyB,CAC3C,YAAY,EAAE,iCAAiC,GAAG,kBAAkB,GAAG,kBAAkB,EACzF,WAAW,EAAE,0BAA0B,EACvC,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,IAAI,CAAC;CAwCnB"}
1
+ {"version":3,"file":"DeleteAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iCAAiC,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,OAAO,EAAsB,MAAM,gBAAgB,CAAC;AACpK,OAAO,EAAE,WAAW,EAAY,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAA8C,8CAA8C,EAAE,MAAM,8CAA8C,CAAC;AAE1J,qBAAa,mCAAoC,SAAQ,2BAA2B,CAAC,0BAA0B,CAAC;IACtF,4BAA4B,CAAC,WAAW,EAAE,0BAA0B,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA6B5I,SAAS,CAC3B,WAAW,EAAE,0BAA0B,EACvC,MAAM,EAAE,8CAA8C,EACtD,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAkBN,MAAM,CACxB,WAAW,EAAE,0BAA0B,EACvC,MAAM,EAAE,8CAA8C,EACtD,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,iCAAiC,GAAG,kBAAkB,CAAC;IAsB5C,yBAAyB,CAC3C,YAAY,EAAE,iCAAiC,GAAG,kBAAkB,GAAG,kBAAkB,EACzF,WAAW,EAAE,0BAA0B,EACvC,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,IAAI,CAAC;CAwCnB"}
@@ -7,6 +7,7 @@ const CoreErrors_1 = require("../../../../consumption/CoreErrors");
7
7
  const attributes_1 = require("../../../attributes");
8
8
  const ValidationResult_1 = require("../../../common/ValidationResult");
9
9
  const GenericRequestItemProcessor_1 = require("../GenericRequestItemProcessor");
10
+ const AcceptDeleteAttributeRequestItemParameters_1 = require("./AcceptDeleteAttributeRequestItemParameters");
10
11
  class DeleteAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
11
12
  async canCreateOutgoingRequestItem(requestItem, _request, recipient) {
12
13
  const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
@@ -27,10 +28,11 @@ class DeleteAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.
27
28
  return ValidationResult_1.ValidationResult.success();
28
29
  }
29
30
  async canAccept(requestItem, params, _requestInfo) {
31
+ const parsedParams = AcceptDeleteAttributeRequestItemParameters_1.AcceptDeleteAttributeRequestItemParameters.from(params);
30
32
  const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
31
33
  if (!attribute)
32
34
  return ValidationResult_1.ValidationResult.success();
33
- const deletionDate = transport_1.CoreDate.from(params.deletionDate);
35
+ const deletionDate = parsedParams.deletionDate;
34
36
  if (!deletionDate.dateTime.isValid) {
35
37
  return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The deletionDate is invalid."));
36
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DeleteAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;AAAA,4CAAoK;AACpK,gDAAyD;AACzD,mEAAgE;AAChE,oDAAiF;AACjF,uEAAoE;AACpE,gFAA6E;AAI7E,MAAa,mCAAoC,SAAQ,yDAAuD;IAC5F,KAAK,CAAC,4BAA4B,CAAC,WAAuC,EAAE,QAAiB,EAAE,SAAuB;QAClI,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACzG,IAAI,CAAC,SAAS;YAAE,OAAO,mCAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,kBAAkB,WA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AAe,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;oBAC5E,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;gBAC5E,CAAC;YACL,CAAC;QACL,CAAC;QAED,IAAI,YAAY,YAAY,4BAAkB,EAAE,CAAC;YAC7C,MAAM,YAAY,GAAG,uCAA0B,CAAC,IAAI,CAAC;gBACjD,cAAc,EAAE,2BAAc,CAAC,uBAAuB;gBACtD,YAAY,EAAE,oBAAQ,CAAC,GAAG,EAAE;aAC/B,CAAC,CAAC;YAEH,KAAK,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC;gBAC9C,IAAI,IAAI,CAAC,YAAY,EAAE,cAAc,KAAK,2BAAc,CAAC,iBAAiB,IAAI,IAAI,CAAC,YAAY,EAAE,cAAc,KAAK,2BAAc,CAAC,aAAa,EAAE,CAAC;oBAC/I,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;oBAC5E,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;gBAC5E,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAzHD,kFAyHC"}
1
+ {"version":3,"file":"DeleteAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;AAAA,4CAAoK;AACpK,gDAAyD;AACzD,mEAAgE;AAChE,oDAAiF;AACjF,uEAAoE;AACpE,gFAA6E;AAE7E,6GAA0J;AAE1J,MAAa,mCAAoC,SAAQ,yDAAuD;IAC5F,KAAK,CAAC,4BAA4B,CAAC,WAAuC,EAAE,QAAiB,EAAE,SAAuB;QAClI,M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from "./AcceptProposeAttributeRequestItemParameters";
8
8
  export declare class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor<ProposeAttributeRequestItem, AcceptProposeAttributeRequestItemParametersJSON> {
9
9
  canCreateOutgoingRequestItem(requestItem: ProposeAttributeRequestItem, _request: Request, recipient?: CoreAddress): ValidationResult;
10
- private validateAttribute;
10
+ private static validateAttribute;
11
11
  private validateQuery;
12
- canAccept(_requestItem: ProposeAttributeRequestItem, params: AcceptProposeAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ValidationResult>;
12
+ canAccept(requestItem: ProposeAttributeRequestItem, params: AcceptProposeAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ValidationResult>;
13
13
  accept(_requestItem: ProposeAttributeRequestItem, params: AcceptProposeAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ProposeAttributeAcceptResponseItem | AttributeSuccessionAcceptResponseItem | AttributeAlreadySharedAcceptResponseItem>;
14
14
  private performOwnSharedIdentityAttributeSuccession;
15
15
  private createNewAttribute;
@@ -1 +1 @@
1
- {"version":3,"file":"ProposeAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wCAAwC,EACxC,qCAAqC,EAErC,kCAAkC,EAClC,2BAA2B,EAC3B,kBAAkB,EAGlB,OAAO,EAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAA6C,MAAM,kBAAkB,CAAC;AAE1F,OAAO,EAAqE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAE3I,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAA+C,+CAA+C,EAAE,MAAM,+CAA+C,CAAC;AAE7J,qBAAa,oCAAqC,SAAQ,2BAA2B,CAAC,2BAA2B,EAAE,+CAA+C,CAAC;IAC/I,4BAA4B,CAAC,WAAW,EAAE,2BAA2B,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,gBAAgB;IAcpJ,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,aAAa;IAiBC,SAAS,CAC3B,YAAY,EAAE,2BAA2B,EACzC,MAAM,EAAE,+CAA+C,EACvD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IAsCN,MAAM,CACxB,YAAY,EAAE,2BAA2B,EACzC,MAAM,EAAE,+CAA+C,EACvD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,kCAAkC,GAAG,qCAAqC,GAAG,wCAAwC,CAAC;YA6EnH,2CAA2C;YAa3C,kBAAkB;IAoBV,yBAAyB,CAC3C,YAAY,EAAE,kCAAkC,GAAG,qCAAqC,GAAG,wCAAwC,GAAG,kBAAkB,EACxJ,YAAY,EAAE,2BAA2B,EACzC,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,iCAAiC,GAAG,IAAI,CAAC;CAwBvD"}
1
+ {"version":3,"file":"ProposeAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wCAAwC,EACxC,qCAAqC,EAGrC,kCAAkC,EAClC,2BAA2B,EAC3B,kBAAkB,EAGlB,OAAO,EAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAA6C,MAAM,kBAAkB,CAAC;AAG1F,OAAO,EAAqE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAE3I,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAA+C,+CAA+C,EAAE,MAAM,+CAA+C,CAAC;AAE7J,qBAAa,oCAAqC,SAAQ,2BAA2B,CAAC,2BAA2B,EAAE,+CAA+C,CAAC;IAC/I,4BAA4B,CAAC,WAAW,EAAE,2BAA2B,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,gBAAgB;IAwBpJ,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAYhC,OAAO,CAAC,aAAa;IAiBC,SAAS,CAC3B,WAAW,EAAE,2BAA2B,EACxC,MAAM,EAAE,+CAA+C,EACvD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IA8EN,MAAM,CACxB,YAAY,EAAE,2BAA2B,EACzC,MAAM,EAAE,+CAA+C,EACvD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,kCAAkC,GAAG,qCAAqC,GAAG,wCAAwC,CAAC;YAkFnH,2CAA2C;YAa3C,kBAAkB;IAoBV,yBAAyB,CAC3C,YAAY,EAAE,kCAAkC,GAAG,qCAAqC,GAAG,wCAAwC,GAAG,kBAAkB,EACxJ,YAAY,EAAE,2BAA2B,EACzC,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,iCAAiC,GAAG,IAAI,CAAC;CAwBvD"}
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ProposeAttributeRequestItemProcessor = void 0;
7
7
  const content_1 = require("@nmshd/content");
8
8
  const transport_1 = require("@nmshd/transport");
9
+ const ts_simple_nameof_1 = require("ts-simple-nameof");
9
10
  const CoreErrors_1 = require("../../../../consumption/CoreErrors");
10
11
  const attributes_1 = require("../../../attributes");
11
12
  const LocalAttribute_1 = require("../../../attributes/local/LocalAttribute");
12
13
  const ValidationResult_1 = require("../../../common/ValidationResult");
13
14
  const GenericRequestItemProcessor_1 = require("../GenericRequestItemProcessor");
15
+ const validateAttributeMatchesWithQuery_1 = __importDefault(require("../utility/validateAttributeMatchesWithQuery"));
14
16
  const validateQuery_1 = __importDefault(require("../utility/validateQuery"));
15
17
  const AcceptProposeAttributeRequestItemParameters_1 = require("./AcceptProposeAttributeRequestItemParameters");
16
18
  class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
@@ -19,15 +21,19 @@ class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1
19
21
  if (queryValidationResult.isError()) {
20
22
  return queryValidationResult;
21
23
  }
22
- const attributeValidationResult = this.validateAttribute(requestItem.attribute);
24
+ const attributeValidationResult = ProposeAttributeRequestItemProcessor.validateAttribute(requestItem.attribute);
23
25
  if (attributeValidationResult.isError()) {
24
26
  return attributeValidationResult;
25
27
  }
28
+ const proposedAttributeMatchesWithQueryValidationResult = (0, validateAttributeMatchesWithQuery_1.default)(requestItem.query, requestItem.attribute, transport_1.CoreAddress.from(""), this.currentIdentityAddress);
29
+ if (proposedAttributeMatchesWithQueryValidationResult.isError()) {
30
+ return proposedAttributeMatchesWithQueryValidationResult;
31
+ }
26
32
  return ValidationResult_1.ValidationResult.success();
27
33
  }
28
- validateAttribute(attribute) {
34
+ static validateAttribute(attribute) {
29
35
  if (attribute.owner.toString() !== "") {
30
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given `attribute` can only be an empty string. This is because you can only propose Attributes where the recipient of the Request is the owner anyway. And in order to avoid mistakes, the owner will be automatically filled for you."));
36
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given `attribute` can only be an empty string. This is because you can only propose Attributes where the Recipient of the Request is the owner anyway. And in order to avoid mistakes, the owner will be automatically filled for you."));
31
37
  }
32
38
  return ValidationResult_1.ValidationResult.success();
33
39
  }
@@ -37,36 +43,54 @@ class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1
37
43
  return commonQueryValidationResult;
38
44
  }
39
45
  if (requestItem.query instanceof content_1.RelationshipAttributeQuery && requestItem.query.owner.toString() !== "") {
40
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given `query` can only be an empty string. This is because you can only propose Attributes where the recipient of the Request is the owner anyway. And in order to avoid mistakes, the owner will be automatically filled for you."));
46
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given `query` can only be an empty string. This is because you can only propose Attributes where the Recipient of the Request is the owner anyway. And in order to avoid mistakes, the owner will be automatically filled for you."));
41
47
  }
42
48
  return ValidationResult_1.ValidationResult.success();
43
49
  }
44
- async canAccept(_requestItem, params, requestInfo) {
50
+ async canAccept(requestItem, params, requestInfo) {
45
51
  const parsedParams = AcceptProposeAttributeRequestItemParameters_1.AcceptProposeAttributeRequestItemParameters.from(params);
46
- let attribute = parsedParams.attribute;
52
+ let attribute;
47
53
  if (parsedParams.isWithExistingAttribute()) {
48
- const foundAttribute = await this.consumptionController.attributes.getLocalAttribute(parsedParams.attributeId);
49
- if (!foundAttribute)
54
+ if (requestItem.query instanceof content_1.RelationshipAttributeQuery) {
55
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("When responding to a RelationshipAttributeQuery, only new RelationshipAttributes may be provided."));
56
+ }
57
+ const foundLocalAttribute = await this.consumptionController.attributes.getLocalAttribute(parsedParams.attributeId);
58
+ if (!foundLocalAttribute) {
50
59
  return ValidationResult_1.ValidationResult.error(transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, parsedParams.attributeId.toString()));
51
- const latestSharedVersion = await this.consumptionController.attributes.getSharedVersionsOfAttribute(parsedParams.attributeId, [requestInfo.peer], true);
52
- if (latestSharedVersion.length > 0) {
53
- if (!latestSharedVersion[0].shareInfo?.sourceAttribute) {
54
- throw new Error(`The Attribute ${latestSharedVersion[0].id} doesn't have a 'shareInfo.sourceAttribute', even though it was found as shared version of an Attribute.`);
60
+ }
61
+ attribute = foundLocalAttribute.content;
62
+ if (requestItem.query instanceof content_1.IdentityAttributeQuery && attribute instanceof content_1.IdentityAttribute && this.accountController.identity.isMe(attribute.owner)) {
63
+ if (foundLocalAttribute.isShared()) {
64
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided IdentityAttribute is a shared copy of a RepositoryAttribute. You can only share RepositoryAttributes."));
55
65
  }
56
- const latestSharedVersionSourceAttribute = await this.consumptionController.attributes.getLocalAttribute(latestSharedVersion[0].shareInfo.sourceAttribute);
57
- if (!latestSharedVersionSourceAttribute)
58
- throw new Error(`The Attribute ${latestSharedVersion[0].shareInfo.sourceAttribute} was not found.`);
59
- if (await this.consumptionController.attributes.isSubsequentInSuccession(foundAttribute, latestSharedVersionSourceAttribute)) {
60
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("You cannot share the predecessor of an already shared Attribute version."));
66
+ const ownSharedIdentityAttributeSuccessors = await this.consumptionController.attributes.getSharedSuccessorsOfAttribute(foundLocalAttribute, {
67
+ "shareInfo.peer": requestInfo.peer.toString()
68
+ });
69
+ if (ownSharedIdentityAttributeSuccessors.length > 0) {
70
+ if (!ownSharedIdentityAttributeSuccessors[0].shareInfo?.sourceAttribute) {
71
+ throw new Error(`The LocalAttribute ${ownSharedIdentityAttributeSuccessors[0].id} does not have a 'shareInfo.sourceAttribute', even though it was found as a shared version of a LocalAttribute.`);
72
+ }
73
+ const successorRepositorySourceAttribute = await this.consumptionController.attributes.getLocalAttribute(ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute);
74
+ if (!successorRepositorySourceAttribute) {
75
+ throw new Error(`The RepositoryAttribute ${ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute} was not found.`);
76
+ }
77
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch(`The provided IdentityAttribute is outdated. You have already shared the successor '${ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute}' of it.`));
61
78
  }
62
79
  }
63
- attribute = foundAttribute.content;
64
80
  }
65
- const ownerIsEmpty = attribute.owner.equals("");
66
- const ownerIsCurrentIdentity = attribute.owner.equals(this.currentIdentityAddress);
67
- if (!ownerIsEmpty && !ownerIsCurrentIdentity) {
68
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The given Attribute belongs to someone else. You can only share own Attributes."));
81
+ else if (parsedParams.isWithNewAttribute()) {
82
+ attribute = parsedParams.attribute;
83
+ const ownerIsEmpty = attribute.owner.equals("");
84
+ if (ownerIsEmpty) {
85
+ attribute.owner = this.currentIdentityAddress;
86
+ }
87
+ }
88
+ if (typeof attribute === "undefined") {
89
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters(`You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`));
69
90
  }
91
+ const answerToQueryValidationResult = (0, validateAttributeMatchesWithQuery_1.default)(requestItem.query, attribute, this.currentIdentityAddress, requestInfo.peer);
92
+ if (answerToQueryValidationResult.isError())
93
+ return answerToQueryValidationResult;
70
94
  return ValidationResult_1.ValidationResult.success();
71
95
  }
72
96
  async accept(_requestItem, params, requestInfo) {
@@ -121,10 +145,15 @@ class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1
121
145
  }
122
146
  }
123
147
  }
124
- if (!parsedParams.attribute) {
125
- throw new Error("The ProposeAttributeRequestItem wasn't answered with a new Attribute, but it wasn't handled as having been answered with an existing Attribute, either.");
148
+ else if (parsedParams.isWithNewAttribute()) {
149
+ if (parsedParams.attribute.owner.equals("")) {
150
+ parsedParams.attribute.owner = this.currentIdentityAddress;
151
+ }
152
+ sharedLocalAttribute = await this.createNewAttribute(parsedParams.attribute, requestInfo);
153
+ }
154
+ if (!sharedLocalAttribute) {
155
+ throw new Error(`You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
126
156
  }
127
- sharedLocalAttribute = await this.createNewAttribute(parsedParams.attribute, requestInfo);
128
157
  return content_1.ProposeAttributeAcceptResponseItem.from({
129
158
  result: content_1.ResponseItemResult.Accepted,
130
159
  attributeId: sharedLocalAttribute.id,
@@ -145,16 +174,16 @@ class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1
145
174
  }
146
175
  async createNewAttribute(attribute, requestInfo) {
147
176
  if (attribute instanceof content_1.IdentityAttribute) {
148
- const repositoryLocalAttribute = await this.consumptionController.attributes.createLocalAttribute({
177
+ const repositoryAttribute = await this.consumptionController.attributes.createRepositoryAttribute({
149
178
  content: attribute
150
179
  });
151
180
  return await this.consumptionController.attributes.createSharedLocalAttributeCopy({
152
- sourceAttributeId: transport_1.CoreId.from(repositoryLocalAttribute.id),
181
+ sourceAttributeId: transport_1.CoreId.from(repositoryAttribute.id),
153
182
  peer: transport_1.CoreAddress.from(requestInfo.peer),
154
183
  requestReference: transport_1.CoreId.from(requestInfo.id)
155
184
  });
156
185
  }
157
- return await this.consumptionController.attributes.createPeerLocalAttribute({
186
+ return await this.consumptionController.attributes.createSharedLocalAttribute({
158
187
  content: attribute,
159
188
  peer: requestInfo.peer,
160
189
  requestReference: transport_1.CoreId.from(requestInfo.id)
@@ -162,7 +191,7 @@ class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1
162
191
  }
163
192
  async applyIncomingResponseItem(responseItem, _requestItem, requestInfo) {
164
193
  if (responseItem instanceof content_1.ProposeAttributeAcceptResponseItem) {
165
- await this.consumptionController.attributes.createPeerLocalAttribute({
194
+ await this.consumptionController.attributes.createSharedLocalAttribute({
166
195
  id: responseItem.attributeId,
167
196
  content: responseItem.attribute,
168
197
  peer: requestInfo.peer,
@@ -1 +1 @@
1
- {"version":3,"file":"ProposeAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;;;;AAAA,4CAWwB;AACxB,gDAA0F;AAC1F,mEAAgE;AAChE,oDAA2I;AAC3I,6EAA0E;AAC1E,uEAAoE;AACpE,gFAA6E;AAE7E,6EAAqD;AACrD,+GAA6J;AAE7J,MAAa,oCAAqC,SAAQ,yDAAyG;IAC/I,4BAA4B,CAAC,WAAwC,EAAE,QAAiB,EAAE,SAAuB;QAC7H,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACzE,IAAI,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;YAClC,OAAO,qBAAqB,CAAC;QACjC,CAAC;QAED,MAAM,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAChF,IAAI,yBAAyB,CAAC,OAAO,EAAE,EAAE,CAAC;YACtC,OAAO,yBAAyB,CAAC;QACrC,CAAC;QAED,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAEO,iBAAiB,CAAC,SAAoD;QAC1E,IAAI,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC;YACpC,OAAO,mCAAgB,CAAC,KAAK,CACzB,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAClC,yPAAyP,CAC5P,CACJ,CAAC;QACN,CAAC;QAED,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAEO,aAAa,CAAC,WAAwC,EAAE,SAAuB;QACnF,MAAM,2BAA2B,GAAG,IAAA,uBAAa,EAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC;QAC7G,IAAI,2BAA2B,CAAC,OAA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AAC;gBAClD,EAAE,EAAE,YAAY,CAAC,WAAW;gBAC5B,OAAO,EAAE,YAAY,CAAC,gBAAgB;gBACtC,SAAS,EAAE,oCAAuB,CAAC,IAAI,CAAC;oBACpC,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,gBAAgB,EAAE,WAAW,CAAC,EAAE;iBACnC,CAAC;aACL,CAAC,CAAC;YACH,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,kCAAkC,CAAC,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YAC/J,OAAO,IAAI,8CAAiC,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QACjH,CAAC;QACD,OAAO;IACX,CAAC;CACJ;AApOD,oFAoOC"}
1
+ {"version":3,"file":"ProposeAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;;;;AAAA,4CAYwB;AACxB,gDAA0F;AAC1F,uDAA0C;AAC1C,mEAAgE;AAChE,oDAA2I;AAC3I,6EAA0E;AAC1E,uEAAoE;AACpE,gFAA6E;AAE7E,qHAA6F;AAC7F,6EAAqD;AACrD,+GAA6J;AAE7J,MAAa,oCAAqC,SAAQ,yDAAyG;IAC/I,4BAA4B,CAAC,WAAwC,EAAE,QAAiB,EAAE,SAAuB;QAC7H,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACzE,IAAI,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;YAClC,OAAO,qBAAqB,CAAC;QACjC,CAAC;QAED,MAAM,yBAAyB,GAAG,oCAAoC,CAAC,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAChH,IAAI,yBAAyB,CAAC,OAAO,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AM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,kCAAkC,CAAC,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YAC/J,OAAO,IAAI,8CAAiC,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QACjH,CAAC;QACD,OAAO;IACX,CAAC;CACJ;AA3RD,oFA2RC"}
@@ -7,7 +7,8 @@ import { LocalRequestInfo } from "../IRequestItemProcessor";
7
7
  import { AcceptReadAttributeRequestItemParametersJSON } from "./AcceptReadAttributeRequestItemParameters";
8
8
  export declare class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor<ReadAttributeRequestItem, AcceptReadAttributeRequestItemParametersJSON> {
9
9
  canCreateOutgoingRequestItem(requestItem: ReadAttributeRequestItem, _request: Request, recipient?: CoreAddress): ValidationResult;
10
- canAccept(_requestItem: ReadAttributeRequestItem, params: AcceptReadAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ValidationResult>;
10
+ private validateQuery;
11
+ canAccept(requestItem: ReadAttributeRequestItem, params: AcceptReadAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ValidationResult>;
11
12
  accept(_requestItem: ReadAttributeRequestItem, params: AcceptReadAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ReadAttributeAcceptResponseItem | AttributeSuccessionAcceptResponseItem | AttributeAlreadySharedAcceptResponseItem>;
12
13
  private performOwnSharedIdentityAttributeSuccession;
13
14
  private performOwnSharedThirdPartyRelationshipAttributeSuccession;
@@ -1 +1 @@
1
- {"version":3,"file":"ReadAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wCAAwC,EACxC,qCAAqC,EAErC,+BAA+B,EAC/B,wBAAwB,EACxB,kBAAkB,EAElB,OAAO,EAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAA6C,MAAM,kBAAkB,CAAC;AAE1F,OAAO,EAAqE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAE3I,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAA4C,4CAA4C,EAAE,MAAM,4CAA4C,CAAC;AAEpJ,qBAAa,iCAAkC,SAAQ,2BAA2B,CAAC,wBAAwB,EAAE,4CAA4C,CAAC;IACtI,4BAA4B,CAAC,WAAW,EAAE,wBAAwB,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,gBAAgB;IAS3H,SAAS,CAC3B,YAAY,EAAE,wBAAwB,EACtC,MAAM,EAAE,4CAA4C,EACpD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IAgCN,MAAM,CACxB,YAAY,EAAE,wBAAwB,EACtC,MAAM,EAAE,4CAA4C,EACpD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,+BAA+B,GAAG,qCAAqC,GAAG,wCAAwC,CAAC;YAkFhH,2CAA2C;YAa3C,yDAAyD;YAazD,qDAAqD;YAarD,kBAAkB;IAoBV,yBAAyB,CAC3C,YAAY,EAAE,+BAA+B,GAAG,qCAAqC,GAAG,wCAAwC,GAAG,kBAAkB,EACrJ,YAAY,EAAE,wBAAwB,EACtC,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,iCAAiC,GAAG,IAAI,CAAC;CAgCvD"}
1
+ {"version":3,"file":"ReadAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wCAAwC,EACxC,qC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eRequestItemProcessor = void 0;
7
7
  const content_1 = require("@nmshd/content");
8
8
  const transport_1 = require("@nmshd/transport");
9
+ const ts_simple_nameof_1 = require("ts-simple-nameof");
9
10
  const CoreErrors_1 = require("../../../../consumption/CoreErrors");
10
11
  const attributes_1 = require("../../../attributes");
11
12
  const LocalAttribute_1 = require("../../../attributes/local/LocalAttribute");
12
13
  const ValidationResult_1 = require("../../../common/ValidationResult");
13
14
  const GenericRequestItemProcessor_1 = require("../GenericRequestItemProcessor");
15
+ const validateAttributeMatchesWithQuery_1 = __importDefault(require("../utility/validateAttributeMatchesWithQuery"));
14
16
  const validateQuery_1 = __importDefault(require("../utility/validateQuery"));
15
17
  const AcceptReadAttributeRequestItemParameters_1 = require("./AcceptReadAttributeRequestItemParameters");
16
18
  class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
17
19
  canCreateOutgoingRequestItem(requestItem, _request, recipient) {
18
- const queryValidationResult = (0, validateQuery_1.default)(requestItem.query, this.currentIdentityAddress, recipient);
20
+ const queryValidationResult = this.validateQuery(requestItem, recipient);
19
21
  if (queryValidationResult.isError()) {
20
22
  return queryValidationResult;
21
23
  }
22
24
  return ValidationResult_1.ValidationResult.success();
23
25
  }
24
- async canAccept(_requestItem, params, requestInfo) {
26
+ validateQuery(requestItem, recipient) {
27
+ const commonQueryValidationResult = (0, validateQuery_1.default)(requestItem.query, this.currentIdentityAddress, recipient);
28
+ if (commonQueryValidationResult.isError()) {
29
+ return commonQueryValidationResult;
30
+ }
31
+ if (requestItem.query instanceof content_1.RelationshipAttributeQuery && !["", this.currentIdentityAddress.toString()].includes(requestItem.query.owner.toString())) {
32
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given `query` can only be an empty string or yourself. This is because you can only request RelationshipAttributes using a ReadAttributeRequestitem with a RelationshipAttributeQuery where the Recipient of the Request or yourself is the owner. And in order to avoid mistakes, the Recipient automatically will become the owner of the RelationshipAttribute later on if the owner of the `query` is an empty string."));
33
+ }
34
+ return ValidationResult_1.ValidationResult.success();
35
+ }
36
+ async canAccept(requestItem, params, requestInfo) {
25
37
  const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
38
+ let attribute;
26
39
  if (parsedParams.isWithExistingAttribute()) {
27
- const foundAttribute = await this.consumptionController.attributes.getLocalAttribute(parsedParams.existingAttributeId);
28
- if (!foundAttribute)
40
+ if (requestItem.query instanceof content_1.RelationshipAttributeQuery) {
41
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("When responding to a RelationshipAttributeQuery, only new RelationshipAttributes may be provided."));
42
+ }
43
+ const foundLocalAttribute = await this.consumptionController.attributes.getLocalAttribute(parsedParams.existingAttributeId);
44
+ if (!foundLocalAttribute) {
29
45
  return ValidationResult_1.ValidationResult.error(transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, parsedParams.existingAttributeId.toString()));
30
- const ownerIsCurrentIdentity = this.accountController.identity.isMe(foundAttribute.content.owner);
31
- if (!ownerIsCurrentIdentity && foundAttribute.content instanceof content_1.IdentityAttribute) {
32
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The given Attribute belongs to someone else. You can only share own Attributes."));
33
46
  }
34
- const latestSharedVersion = await this.consumptionController.attributes.getSharedVersionsOfAttribute(parsedParams.existingAttributeId, [requestInfo.peer], true);
35
- if (latestSharedVersion.length > 0) {
36
- if (!latestSharedVersion[0].shareInfo?.sourceAttribute) {
37
- throw new Error(`The Attribute ${latestSharedVersion[0].id} doesn't have a 'shareInfo.sourceAttribute', even though it was found as shared version of an Attribute.`);
47
+ attribute = foundLocalAttribute.content;
48
+ if (requestItem.query instanceof content_1.IdentityAttributeQuery && attribute instanceof content_1.IdentityAttribute && this.accountController.identity.isMe(attribute.owner)) {
49
+ if (foundLocalAttribute.isShared()) {
50
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided IdentityAttribute is a shared copy of a RepositoryAttribute. You can only share RepositoryAttributes."));
51
+ }
52
+ const ownSharedIdentityAttributeSuccessors = await this.consumptionController.attributes.getSharedSuccessorsOfAttribute(foundLocalAttribute, {
53
+ "shareInfo.peer": requestInfo.peer.toString()
54
+ });
55
+ if (ownSharedIdentityAttributeSuccessors.length > 0) {
56
+ if (!ownSharedIdentityAttributeSuccessors[0].shareInfo?.sourceAttribute) {
57
+ throw new Error(`The LocalAttribute ${ownSharedIdentityAttributeSuccessors[0].id} does not have a 'shareInfo.sourceAttribute', even though it was found as a shared version of a LocalAttribute.`);
58
+ }
59
+ const successorSourceRepositoryAttribute = await this.consumptionController.attributes.getLocalAttribute(ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute);
60
+ if (!successorSourceRepositoryAttribute) {
61
+ throw new Error(`The RepositoryAttribute ${ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute} was not found.`);
62
+ }
63
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch(`The provided IdentityAttribute is outdated. You have already shared the successor '${ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute}' of it.`));
38
64
  }
39
- const latestSharedVersionSourceAttribute = await this.consumptionController.attributes.getLocalAttribute(latestSharedVersion[0].shareInfo.sourceAttribute);
40
- if (!latestSharedVersionSourceAttribute)
41
- throw new Error(`The Attribute ${latestSharedVersion[0].shareInfo.sourceAttribute} was not found.`);
42
- if (await this.consumptionController.attributes.isSubsequentInSuccession(foundAttribute, latestSharedVersionSourceAttribute)) {
43
- return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("You cannot share the predecessor of an already shared Attribute version."));
65
+ }
66
+ if (requestItem.query instanceof content_1.ThirdPartyRelationshipAttributeQuery && attribute instanceof content_1.RelationshipAttribute) {
67
+ if (!foundLocalAttribute.isShared()) {
68
+ throw new Error("The LocalAttribute found is faulty because its shareInfo is undefined, although its content is given by a RelationshipAttribute. Since RelationshipAttributes only make sense in the context of Relationships, they must always be shared.");
69
+ }
70
+ if (typeof foundLocalAttribute.shareInfo.sourceAttribute !== "undefined") {
71
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("When responding to a ThirdPartyRelationshipAttributeQuery, only RelationshipAttributes that are not a copy of a sourceAttribute may be provided."));
72
+ }
73
+ const queriedThirdParties = requestItem.query.thirdParty.map((aThirdParty) => aThirdParty.toString());
74
+ if ((this.accountController.identity.isMe(attribute.owner) || queriedThirdParties.includes(attribute.owner.toString())) &&
75
+ !queriedThirdParties.includes("") &&
76
+ !queriedThirdParties.includes(foundLocalAttribute.shareInfo.peer.toString())) {
77
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute exists in the context of a Relationship with a third party that should not be involved."));
44
78
  }
45
79
  }
46
80
  }
81
+ else if (parsedParams.isWithNewAttribute()) {
82
+ if (requestItem.query instanceof content_1.ThirdPartyRelationshipAttributeQuery) {
83
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("When responding to a ThirdPartyRelationshipAttributeQuery, only RelationshipAttributes that already exist may be provided."));
84
+ }
85
+ attribute = parsedParams.newAttribute;
86
+ const ownerIsEmpty = attribute.owner.equals("");
87
+ if (ownerIsEmpty) {
88
+ attribute.owner = this.currentIdentityAddress;
89
+ }
90
+ }
91
+ if (typeof attribute === "undefined") {
92
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters(`You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.newAttribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.existingAttributeId)}.`));
93
+ }
94
+ const answerToQueryValidationResult = (0, validateAttributeMatchesWithQuery_1.default)(requestItem.query, attribute, this.currentIdentityAddress, requestInfo.peer);
95
+ if (answerToQueryValidationResult.isError())
96
+ return answerToQueryValidationResult;
97
+ if (requestItem.query instanceof content_1.ThirdPartyRelationshipAttributeQuery &&
98
+ attribute instanceof content_1.RelationshipAttribute &&
99
+ attribute.confidentiality === content_1.RelationshipAttributeConfidentiality.Private) {
100
+ return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The confidentiality of the provided RelationshipAttribute is private. Therefore you are not allowed to share it."));
101
+ }
47
102
  return ValidationResult_1.ValidationResult.success();
48
103
  }
49
104
  async accept(_requestItem, params, requestInfo) {
@@ -106,10 +161,15 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
106
161
  }
107
162
  }
108
163
  }
109
- if (!parsedParams.newAttribute) {
110
- throw new Error("The ReadAttributeRequestItem wasn't answered with a new Attribute, but it wasn't handled as having been answered with an existing Attribute, either.");
164
+ else if (parsedParams.isWithNewAttribute()) {
165
+ if (parsedParams.newAttribute.owner.equals("")) {
166
+ parsedParams.newAttribute.owner = this.currentIdentityAddress;
167
+ }
168
+ sharedLocalAttribute = await this.createNewAttribute(parsedParams.newAttribute, requestInfo);
169
+ }
170
+ if (!sharedLocalAttribute) {
171
+ throw new Error(`You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.newAttribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.existingAttributeId)}.`);
111
172
  }
112
- sharedLocalAttribute = await this.createNewAttribute(parsedParams.newAttribute, requestInfo);
113
173
  return content_1.ReadAttributeAcceptResponseItem.from({
114
174
  result: content_1.ResponseItemResult.Accepted,
115
175
  attributeId: sharedLocalAttribute.id,
@@ -154,16 +214,16 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
154
214
  }
155
215
  async createNewAttribute(attribute, requestInfo) {
156
216
  if (attribute instanceof content_1.IdentityAttribute) {
157
- const repositoryLocalAttribute = await this.consumptionController.attributes.createLocalAttribute({
217
+ const repositoryAttribute = await this.consumptionController.attributes.createRepositoryAttribute({
158
218
  content: attribute
159
219
  });
160
220
  return await this.consumptionController.attributes.createSharedLocalAttributeCopy({
161
- sourceAttributeId: transport_1.CoreId.from(repositoryLocalAttribute.id),
221
+ sourceAttributeId: transport_1.CoreId.from(repositoryAttribute.id),
162
222
  peer: transport_1.CoreAddress.from(requestInfo.peer),
163
223
  requestReference: transport_1.CoreId.from(requestInfo.id)
164
224
  });
165
225
  }
166
- return await this.consumptionController.attributes.createPeerLocalAttribute({
226
+ return await this.consumptionController.attributes.createSharedLocalAttribute({
167
227
  content: attribute,
168
228
  peer: requestInfo.peer,
169
229
  requestReference: transport_1.CoreId.from(requestInfo.id)
@@ -171,7 +231,7 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
171
231
  }
172
232
  async applyIncomingResponseItem(responseItem, _requestItem, requestInfo) {
173
233
  if (responseItem instanceof content_1.ReadAttributeAcceptResponseItem) {
174
- await this.consumptionController.attributes.createPeerLocalAttribute({
234
+ await this.consumptionController.attributes.createSharedLocalAttribute({
175
235
  id: responseItem.attributeId,
176
236
  content: responseItem.attribute,
177
237
  peer: requestInfo.peer,