@nmshd/consumption 3.9.7 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +4 -4
- package/dist/consumption/ConsumptionController.d.ts.map +1 -1
- package/dist/consumption/ConsumptionController.js +5 -1
- package/dist/consumption/ConsumptionController.js.map +1 -1
- package/dist/consumption/CoreErrors.d.ts +17 -3
- package/dist/consumption/CoreErrors.d.ts.map +1 -1
- package/dist/consumption/CoreErrors.js +46 -4
- package/dist/consumption/CoreErrors.js.map +1 -1
- package/dist/modules/attributes/AttributesController.d.ts +12 -0
- package/dist/modules/attributes/AttributesController.d.ts.map +1 -1
- package/dist/modules/attributes/AttributesController.js +167 -52
- package/dist/modules/attributes/AttributesController.js.map +1 -1
- package/dist/modules/attributes/events/OwnSharedAttributeDeletedByOwnerEvent.d.ts +7 -0
- package/dist/modules/attributes/events/OwnSharedAttributeDeletedByOwnerEvent.d.ts.map +1 -0
- package/dist/modules/attributes/events/OwnSharedAttributeDeletedByOwnerEvent.js +12 -0
- package/dist/modules/attributes/events/OwnSharedAttributeDeletedByOwnerEvent.js.map +1 -0
- package/dist/modules/attributes/events/PeerSharedAttributeDeletedByPeerEvent.d.ts +7 -0
- package/dist/modules/attributes/events/PeerSharedAttributeDeletedByPeerEvent.d.ts.map +1 -0
- package/dist/modules/attributes/events/PeerSharedAttributeDeletedByPeerEvent.js +12 -0
- package/dist/modules/attributes/events/PeerSharedAttributeDeletedByPeerEvent.js.map +1 -0
- package/dist/modules/attributes/events/ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.d.ts +7 -0
- package/dist/modules/attributes/events/ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.d.ts.map +1 -0
- package/dist/modules/attributes/events/ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.js +12 -0
- package/dist/modules/attributes/events/ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.js.map +1 -0
- package/dist/modules/attributes/events/index.d.ts +3 -0
- package/dist/modules/attributes/events/index.d.ts.map +1 -1
- package/dist/modules/attributes/events/index.js +3 -0
- package/dist/modules/attributes/events/index.js.map +1 -1
- package/dist/modules/attributes/index.d.ts +1 -0
- package/dist/modules/attributes/index.d.ts.map +1 -1
- package/dist/modules/attributes/index.js +1 -0
- package/dist/modules/attributes/index.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.d.ts +20 -9
- package/dist/modules/attributes/local/LocalAttribute.d.ts.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.js +48 -13
- package/dist/modules/attributes/local/LocalAttribute.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttributeDeletionInfo.d.ts +21 -0
- package/dist/modules/attributes/local/LocalAttributeDeletionInfo.d.ts.map +1 -0
- package/dist/modules/attributes/local/LocalAttributeDeletionInfo.js +40 -0
- package/dist/modules/attributes/local/LocalAttributeDeletionInfo.js.map +1 -0
- package/dist/modules/notifications/index.d.ts +3 -0
- package/dist/modules/notifications/index.d.ts.map +1 -1
- package/dist/modules/notifications/index.js +3 -0
- package/dist/modules/notifications/index.js.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.d.ts +14 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.d.ts.map +1 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js +56 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js.map +1 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.d.ts +14 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.d.ts.map +1 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js +57 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js.map +1 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.d.ts +14 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.d.ts.map +1 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js +57 -0
- package/dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js.map +1 -0
- package/dist/modules/requests/index.d.ts +2 -0
- package/dist/modules/requests/index.d.ts.map +1 -1
- package/dist/modules/requests/index.js +2 -0
- package/dist/modules/requests/index.js.map +1 -1
- package/dist/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.d.ts +11 -0
- package/dist/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.d.ts.map +1 -0
- package/dist/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.js +29 -0
- package/dist/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.js.map +1 -0
- package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.d.ts +13 -0
- package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.d.ts.map +1 -0
- package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js +87 -0
- package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js.map +1 -0
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js +1 -1
- package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.js +1 -1
- package/dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -1
- package/lib-web/nmshd.consumption.js +735 -78
- package/lib-web/nmshd.consumption.js.map +1 -1
- package/lib-web/nmshd.consumption.min.js +1 -1
- package/lib-web/nmshd.consumption.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -28293,10 +28293,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
28293
28293
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
28294
28294
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
28295
28295
|
exports.buildInformation = {
|
|
28296
|
-
version: "3.
|
|
28297
|
-
build: "
|
|
28298
|
-
date: "2024-04-
|
|
28299
|
-
commit: "
|
|
28296
|
+
version: "3.10.0",
|
|
28297
|
+
build: "73",
|
|
28298
|
+
date: "2024-04-22T15:09:27+00:00",
|
|
28299
|
+
commit: "af98434e2550967725b8ccbe38a854e88140cb7f",
|
|
28300
28300
|
dependencies: {"@js-soft/docdb-querytranslator":"^1.1.4","@nmshd/iql":"^1.0.2","ts-simple-nameof":"^1.3.1"},
|
|
28301
28301
|
libraries: {
|
|
28302
28302
|
transport: transport_1.buildInformation,
|
|
@@ -28403,6 +28403,7 @@ class ConsumptionController {
|
|
|
28403
28403
|
return new Map([
|
|
28404
28404
|
[content_1.ShareAttributeRequestItem, modules_1.ShareAttributeRequestItemProcessor],
|
|
28405
28405
|
[content_1.CreateAttributeRequestItem, modules_1.CreateAttributeRequestItemProcessor],
|
|
28406
|
+
[content_1.DeleteAttributeRequestItem, modules_1.DeleteAttributeRequestItemProcessor],
|
|
28406
28407
|
[content_1.ReadAttributeRequestItem, modules_1.ReadAttributeRequestItemProcessor],
|
|
28407
28408
|
[content_1.ProposeAttributeRequestItem, modules_1.ProposeAttributeRequestItemProcessor],
|
|
28408
28409
|
[content_1.ConsentRequestItem, modules_1.GenericRequestItemProcessor],
|
|
@@ -28413,7 +28414,10 @@ class ConsumptionController {
|
|
|
28413
28414
|
}
|
|
28414
28415
|
getDefaultNotificationItemProcessors() {
|
|
28415
28416
|
return new Map([
|
|
28416
|
-
[content_1.PeerSharedAttributeSucceededNotificationItem, modules_1.PeerSharedAttributeSucceededNotificationItemProcessor]
|
|
28417
|
+
[content_1.PeerSharedAttributeSucceededNotificationItem, modules_1.PeerSharedAttributeSucceededNotificationItemProcessor],
|
|
28418
|
+
[content_1.OwnSharedAttributeDeletedByOwnerNotificationItem, modules_1.OwnSharedAttributeDeletedByOwnerNotificationItemProcessor],
|
|
28419
|
+
[content_1.PeerSharedAttributeDeletedByPeerNotificationItem, modules_1.PeerSharedAttributeDeletedByPeerNotificationItemProcessor],
|
|
28420
|
+
[content_1.ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItem, modules_1.ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor]
|
|
28417
28421
|
]);
|
|
28418
28422
|
}
|
|
28419
28423
|
}
|
|
@@ -28522,8 +28526,11 @@ class Attributes {
|
|
|
28522
28526
|
successorSourceDoesNotSucceedPredecessorSource() {
|
|
28523
28527
|
return new transport_1.CoreError("error.consumption.attributes.successorSourceDoesNotSucceedPredecessorSource", "Predecessor source attribute is not succeeded by successor source attribute.");
|
|
28524
28528
|
}
|
|
28525
|
-
|
|
28526
|
-
return new transport_1.CoreError("error.consumption.attributes.
|
|
28529
|
+
predecessorSourceContentIsNotEqualToCopyContent() {
|
|
28530
|
+
return new transport_1.CoreError("error.consumption.attributes.predecessorSourceContentIsNotEqualToCopyContent", "Predecessor source attribute content doesn't match predecessor shared attribute copy.");
|
|
28531
|
+
}
|
|
28532
|
+
successorSourceContentIsNotEqualToCopyContent() {
|
|
28533
|
+
return new transport_1.CoreError("error.consumption.attributes.successorSourceContentIsNotEqualToCopyContent", "Successor source attribute content doesn't match successor shared attribute copy.");
|
|
28527
28534
|
}
|
|
28528
28535
|
cannotSucceedChildOfComplexAttribute(parentId) {
|
|
28529
28536
|
return new transport_1.CoreError("error.consumption.attributes.cannotSucceedChildOfComplexAttribute", `The attribute you want to succeed is child attribute of a complex attribute (id: ${parentId}), and cannot be succeeded on its own. Instead, succeed the parent which will implicitly succeed all its children.`);
|
|
@@ -28573,6 +28580,15 @@ class Attributes {
|
|
|
28573
28580
|
predecessorDoesNotExist() {
|
|
28574
28581
|
return new transport_1.CoreError("error.consumption.attributes.predecessorDoesNotExist", "The predecessor does not exist.");
|
|
28575
28582
|
}
|
|
28583
|
+
successorDoesNotExist() {
|
|
28584
|
+
return new transport_1.CoreError("error.consumption.attributes.successorDoesNotExist", "The successor does not exist.");
|
|
28585
|
+
}
|
|
28586
|
+
successorSourceAttributeIsNotSpecified() {
|
|
28587
|
+
return new transport_1.CoreError("error.consumption.attributes.successorSourceAttributeIsNotSpecified", "You must specify the source attribute of the successor.");
|
|
28588
|
+
}
|
|
28589
|
+
successorSourceAttributeDoesNotExist() {
|
|
28590
|
+
return new transport_1.CoreError("error.consumption.attributes.successorSourceAttributeDoesNotExist", "The successor source Attribute does not exist.");
|
|
28591
|
+
}
|
|
28576
28592
|
successionMustNotChangeOwner() {
|
|
28577
28593
|
return new transport_1.CoreError("error.consumption.attributes.successionMustNotChangeOwner", "The successor attribute's owner does not match that of the predecessor. An attribute succession must not change the attribute's owner.");
|
|
28578
28594
|
}
|
|
@@ -28594,9 +28610,39 @@ class Attributes {
|
|
|
28594
28610
|
invalidParentSuccessor(parentSuccessorId) {
|
|
28595
28611
|
return new transport_1.CoreError("error.consumption.attributes.invalidParentSuccessor", `The complex parent successor (id: ${parentSuccessorId}) does not exist.`);
|
|
28596
28612
|
}
|
|
28613
|
+
cannotSucceedAttributesWithDeletionInfo() {
|
|
28614
|
+
return new transport_1.CoreError("error.consumption.attributes.cannotSucceedAttributesWithDeletionInfo", "You cannot succeed attributes with a deletionInfo, since the peer may have already deleted it or marked it for deletion.");
|
|
28615
|
+
}
|
|
28616
|
+
cannotSetDeletionInfoOfRepositoryAttributes() {
|
|
28617
|
+
return new transport_1.CoreError("error.consumption.attributes.cannotSetDeletionInfoOfRepositoryAttributes", "RepositoryAttributes can not have a deletionInfo, since they are not shared with a peer and you can delete them directly.");
|
|
28618
|
+
}
|
|
28619
|
+
invalidDeletionInfoOfOwnSharedAttribute() {
|
|
28620
|
+
return new transport_1.CoreError("error.consumption.attributes.invalidDeletionInfoOfOwnSharedAttribute", "The only valid deletionStatuses for own shared Attributes are 'DeletedByPeer' or 'ToBeDeletedByPeer'.");
|
|
28621
|
+
}
|
|
28622
|
+
invalidDeletionInfoOfPeerSharedAttribute() {
|
|
28623
|
+
return new transport_1.CoreError("error.consumption.attributes.invalidDeletionInfoOfPeerSharedAttribute", "The only valid deletionStatuses for peer shared Attributes are 'DeletedByOwner' or 'ToBeDeleted'.");
|
|
28624
|
+
}
|
|
28625
|
+
invalidDeletionInfoOfThirdPartyOwnedRelationshipAttribute() {
|
|
28626
|
+
return new transport_1.CoreError("error.consumption.attributes.invalidDeletionInfoOfThirdPartyOwnedRelationshipAttribute", "The only valid deletionStatus for third party owned RelationshipAttributes is 'DeletedByPeer'.");
|
|
28627
|
+
}
|
|
28597
28628
|
invalidPropertyValue(message) {
|
|
28598
28629
|
return new transport_1.CoreError("error.consumption.attributes.invalidPropertyValue", message);
|
|
28599
28630
|
}
|
|
28631
|
+
isNotSharedAttribute(attributeId) {
|
|
28632
|
+
return new transport_1.CoreError("error.consumption.attributes.isNotSharedAttribute", `The attribute (id: ${attributeId}) is not a shared attribute.`);
|
|
28633
|
+
}
|
|
28634
|
+
isNotOwnSharedAttribute(attributeId) {
|
|
28635
|
+
return new transport_1.CoreError("error.consumption.attributes.isNotOwnSharedAttribute", `The attribute (id: ${attributeId}) is not an own shared attribute.`);
|
|
28636
|
+
}
|
|
28637
|
+
isNotPeerSharedAttribute(attributeId) {
|
|
28638
|
+
return new transport_1.CoreError("error.consumption.attributes.isNotPeerSharedAttribute", `The attribute (id: ${attributeId}) is not a peer shared attribute.`);
|
|
28639
|
+
}
|
|
28640
|
+
isNotThirdPartyOwnedRelationshipAttribute(attributeId) {
|
|
28641
|
+
return new transport_1.CoreError("error.consumption.attributes.isNotThirdPartyOwnedRelationshipAttribute", `The attribute (id: ${attributeId}) is not a third party owned RelationshipAttribute.`);
|
|
28642
|
+
}
|
|
28643
|
+
senderIsNotPeerOfSharedAttribute(senderId, attributeId) {
|
|
28644
|
+
return new transport_1.CoreError("error.consumption.attributes.senderIsNotPeerOfSharedAttribute", `The sender (id: ${senderId}) is not the peer you shared the attribute (id: ${attributeId}) with.`);
|
|
28645
|
+
}
|
|
28600
28646
|
}
|
|
28601
28647
|
class Requests {
|
|
28602
28648
|
constructor() {
|
|
@@ -28608,8 +28654,8 @@ class Requests {
|
|
|
28608
28654
|
servalErrorDuringRequestItemProcessing(error) {
|
|
28609
28655
|
return new transport_1.CoreError("error.consumption.requests.servalErrorDuringRequestItemProcessing", error instanceof Error ? error.message : `Serval error: '${JSON.stringify(error)}'`, undefined, undefined, error);
|
|
28610
28656
|
}
|
|
28611
|
-
invalidAcceptParameters() {
|
|
28612
|
-
return new ts_utils_1.ApplicationError("error.consumption.requests.
|
|
28657
|
+
invalidAcceptParameters(message) {
|
|
28658
|
+
return new ts_utils_1.ApplicationError("error.consumption.requests.invalidAcceptParameters", message);
|
|
28613
28659
|
}
|
|
28614
28660
|
invalidRequestItem(message) {
|
|
28615
28661
|
return new transport_1.CoreError("error.consumption.requests.invalidRequestItem", message);
|
|
@@ -29120,7 +29166,7 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29120
29166
|
}
|
|
29121
29167
|
async createLocalAttributesForChildrenOfComplexAttribute(localAttribute) {
|
|
29122
29168
|
if (!(localAttribute.content instanceof content_1.IdentityAttribute)) {
|
|
29123
|
-
throw new ConsumptionError_1.ConsumptionError("Only
|
|
29169
|
+
throw new ConsumptionError_1.ConsumptionError("Only IdentityAttributes may have child Attributes.");
|
|
29124
29170
|
}
|
|
29125
29171
|
const childAttributeValues = Object.values(localAttribute.content.value).filter((p) => p instanceof content_1.AbstractAttributeValue);
|
|
29126
29172
|
for (const propertyValue of childAttributeValues) {
|
|
@@ -29166,9 +29212,21 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29166
29212
|
return peerLocalAttribute;
|
|
29167
29213
|
}
|
|
29168
29214
|
async deleteAttribute(attribute) {
|
|
29215
|
+
if (attribute.content instanceof content_1.IdentityAttribute && attribute.content.value instanceof content_1.AbstractComplexValue) {
|
|
29216
|
+
await this.deleteChildAttributesOfComplexAttribute(attribute);
|
|
29217
|
+
}
|
|
29169
29218
|
await this.deleteAttributeUnsafe(attribute.id);
|
|
29170
29219
|
this.eventBus.publish(new events_1.AttributeDeletedEvent(this.identity.address.toString(), attribute));
|
|
29171
29220
|
}
|
|
29221
|
+
async deleteChildAttributesOfComplexAttribute(complexAttribute) {
|
|
29222
|
+
if (!(complexAttribute.content instanceof content_1.IdentityAttribute)) {
|
|
29223
|
+
throw new ConsumptionError_1.ConsumptionError("Only IdentityAttributes may have child Attributes.");
|
|
29224
|
+
}
|
|
29225
|
+
const childAttributes = await this.getLocalAttributes({ parentId: complexAttribute.id.toString() });
|
|
29226
|
+
for (const childAttribute of childAttributes) {
|
|
29227
|
+
await this.deleteAttribute(childAttribute);
|
|
29228
|
+
}
|
|
29229
|
+
}
|
|
29172
29230
|
async succeedRepositoryAttribute(predecessorId, successorParams, validate = true) {
|
|
29173
29231
|
const parsedSuccessorParams = AttributeSuccessorParams_1.AttributeSuccessorParams.from(successorParams);
|
|
29174
29232
|
if (validate) {
|
|
@@ -29394,27 +29452,34 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29394
29452
|
if (!predecessor.shareInfo.peer.equals(successor.shareInfo.peer)) {
|
|
29395
29453
|
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successionMustNotChangePeer());
|
|
29396
29454
|
}
|
|
29397
|
-
|
|
29398
|
-
|
|
29399
|
-
|
|
29455
|
+
if (typeof successor.shareInfo.sourceAttribute === "undefined") {
|
|
29456
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successorSourceAttributeIsNotSpecified());
|
|
29457
|
+
}
|
|
29400
29458
|
const successorSource = await this.getLocalAttribute(successor.shareInfo.sourceAttribute);
|
|
29401
|
-
|
|
29402
|
-
|
|
29403
|
-
if (typeof predecessorSource === "undefined" || !predecessorSource.isRepositoryAttribute(this.identity.address)) {
|
|
29404
|
-
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.predecessorSourceAttributeIsNotRepositoryAttribute());
|
|
29459
|
+
if (typeof successorSource === "undefined") {
|
|
29460
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successorSourceAttributeDoesNotExist());
|
|
29405
29461
|
}
|
|
29406
|
-
if (
|
|
29462
|
+
if (!successorSource.isRepositoryAttribute(this.identity.address)) {
|
|
29407
29463
|
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successorSourceAttributeIsNotRepositoryAttribute());
|
|
29408
29464
|
}
|
|
29409
|
-
if (
|
|
29410
|
-
|
|
29411
|
-
typeof predecessorSource.succeededBy === "undefined" ||
|
|
29412
|
-
!successorSourceVersionIds.some((id) => id === predecessorSource.succeededBy?.toString())) {
|
|
29413
|
-
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successorSourceDoesNotSucceedPredecessorSource());
|
|
29465
|
+
if (!lodash_1.default.isEqual(successorSource.content, successor.content)) {
|
|
29466
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successorSourceContentIsNotEqualToCopyContent());
|
|
29414
29467
|
}
|
|
29415
|
-
|
|
29416
|
-
if (
|
|
29417
|
-
|
|
29468
|
+
let predecessorSource = undefined;
|
|
29469
|
+
if (typeof predecessor.shareInfo.sourceAttribute !== "undefined") {
|
|
29470
|
+
predecessorSource = await this.getLocalAttribute(predecessor.shareInfo.sourceAttribute);
|
|
29471
|
+
}
|
|
29472
|
+
if (typeof predecessorSource !== "undefined") {
|
|
29473
|
+
if (!predecessorSource.isRepositoryAttribute(this.identity.address)) {
|
|
29474
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.predecessorSourceAttributeIsNotRepositoryAttribute());
|
|
29475
|
+
}
|
|
29476
|
+
const successorSourceVersionIds = (await this.getVersionsOfAttribute(successorSource.id)).map((x) => x.id.toString());
|
|
29477
|
+
if (typeof predecessorSource.succeededBy === "undefined" || !successorSourceVersionIds.some((id) => id === predecessorSource.succeededBy?.toString())) {
|
|
29478
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successorSourceDoesNotSucceedPredecessorSource());
|
|
29479
|
+
}
|
|
29480
|
+
if (!lodash_1.default.isEqual(predecessorSource.content, predecessor.content)) {
|
|
29481
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.predecessorSourceContentIsNotEqualToCopyContent());
|
|
29482
|
+
}
|
|
29418
29483
|
}
|
|
29419
29484
|
return common_1.ValidationResult.success();
|
|
29420
29485
|
}
|
|
@@ -29571,6 +29636,9 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29571
29636
|
if (predecessor.content.value.constructor !== successor.content.value.constructor) {
|
|
29572
29637
|
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successionMustNotChangeValueType());
|
|
29573
29638
|
}
|
|
29639
|
+
if (predecessor.hasDeletionInfo()) {
|
|
29640
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.cannotSucceedAttributesWithDeletionInfo());
|
|
29641
|
+
}
|
|
29574
29642
|
return common_1.ValidationResult.success();
|
|
29575
29643
|
}
|
|
29576
29644
|
async createAttributeUnsafe(attributeData) {
|
|
@@ -29581,7 +29649,8 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29581
29649
|
shareInfo: attributeData.shareInfo,
|
|
29582
29650
|
parentId: attributeData.parentId,
|
|
29583
29651
|
succeededBy: attributeData.succeededBy,
|
|
29584
|
-
succeeds: attributeData.succeeds
|
|
29652
|
+
succeeds: attributeData.succeeds,
|
|
29653
|
+
deletionInfo: attributeData.deletionInfo
|
|
29585
29654
|
});
|
|
29586
29655
|
await this.attributes.create(localAttribute);
|
|
29587
29656
|
return localAttribute;
|
|
@@ -29600,7 +29669,8 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29600
29669
|
parentId: attributeParams.parentId,
|
|
29601
29670
|
shareInfo: attributeParams.shareInfo,
|
|
29602
29671
|
succeededBy: attributeParams.succeededBy,
|
|
29603
|
-
succeeds: attributeParams.succeeds
|
|
29672
|
+
succeeds: attributeParams.succeeds,
|
|
29673
|
+
deletionInfo: attributeParams.deletionInfo
|
|
29604
29674
|
};
|
|
29605
29675
|
const newAttribute = LocalAttribute_1.LocalAttribute.from(params);
|
|
29606
29676
|
await this.attributes.update(doc, newAttribute);
|
|
@@ -29609,50 +29679,122 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29609
29679
|
async deleteAttributeUnsafe(id) {
|
|
29610
29680
|
await this.attributes.delete({ id: id });
|
|
29611
29681
|
}
|
|
29682
|
+
async executeFullAttributeDeletionProcess(attribute) {
|
|
29683
|
+
const validationResult = await this.validateFullAttributeDeletionProcess(attribute);
|
|
29684
|
+
if (validationResult.isError()) {
|
|
29685
|
+
throw validationResult.error;
|
|
29686
|
+
}
|
|
29687
|
+
if (typeof attribute.succeededBy !== "undefined") {
|
|
29688
|
+
const successor = await this.getLocalAttribute(attribute.succeededBy);
|
|
29689
|
+
if (typeof successor === "undefined") {
|
|
29690
|
+
throw CoreErrors_1.CoreErrors.attributes.successorDoesNotExist();
|
|
29691
|
+
}
|
|
29692
|
+
await this.detachSuccessor(successor);
|
|
29693
|
+
}
|
|
29694
|
+
const attributeCopies = await this.getLocalAttributes({ "shareInfo.sourceAttribute": attribute.id.toString() });
|
|
29695
|
+
const attributePredecessorCopies = await this.getSharedPredecessorsOfRepositoryAttribute(attribute);
|
|
29696
|
+
const attributeCopiesToDetach = [...attributeCopies, ...attributePredecessorCopies];
|
|
29697
|
+
await this.detachAttributeCopies(attributeCopiesToDetach);
|
|
29698
|
+
await this.deletePredecessorsOfAttribute(attribute.id);
|
|
29699
|
+
await this.deleteAttribute(attribute);
|
|
29700
|
+
}
|
|
29701
|
+
async validateFullAttributeDeletionProcess(attribute) {
|
|
29702
|
+
const validateSuccessorResult = await this.validateSuccessor(attribute);
|
|
29703
|
+
if (validateSuccessorResult.isError()) {
|
|
29704
|
+
return validateSuccessorResult;
|
|
29705
|
+
}
|
|
29706
|
+
const attributeCopies = await this.getLocalAttributes({ "shareInfo.sourceAttribute": attribute.id.toString() });
|
|
29707
|
+
const attributePredecessorCopies = await this.getSharedPredecessorsOfRepositoryAttribute(attribute);
|
|
29708
|
+
const attributeCopiesToDetach = [...attributeCopies, ...attributePredecessorCopies];
|
|
29709
|
+
const validateSharedAttributesResult = this.validateSharedAttributes(attributeCopiesToDetach);
|
|
29710
|
+
return validateSharedAttributesResult;
|
|
29711
|
+
}
|
|
29712
|
+
async validateSuccessor(predecessor) {
|
|
29713
|
+
if (typeof predecessor.succeededBy !== "undefined") {
|
|
29714
|
+
const successor = await this.getLocalAttribute(predecessor.succeededBy);
|
|
29715
|
+
if (typeof successor === "undefined") {
|
|
29716
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.successorDoesNotExist());
|
|
29717
|
+
}
|
|
29718
|
+
}
|
|
29719
|
+
return common_1.ValidationResult.success();
|
|
29720
|
+
}
|
|
29721
|
+
validateSharedAttributes(sharedAttributes) {
|
|
29722
|
+
for (const sharedAttribute of sharedAttributes) {
|
|
29723
|
+
if (!sharedAttribute.isShared()) {
|
|
29724
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.isNotSharedAttribute(sharedAttribute.id));
|
|
29725
|
+
}
|
|
29726
|
+
}
|
|
29727
|
+
return common_1.ValidationResult.success();
|
|
29728
|
+
}
|
|
29729
|
+
async detachSuccessor(successor) {
|
|
29730
|
+
successor.succeeds = undefined;
|
|
29731
|
+
await this.updateAttributeUnsafe(successor);
|
|
29732
|
+
}
|
|
29733
|
+
async detachAttributeCopies(sharedAttributes) {
|
|
29734
|
+
for (const sharedAttribute of sharedAttributes) {
|
|
29735
|
+
if (!sharedAttribute.isShared()) {
|
|
29736
|
+
throw CoreErrors_1.CoreErrors.attributes.isNotSharedAttribute(sharedAttribute.id);
|
|
29737
|
+
}
|
|
29738
|
+
sharedAttribute.shareInfo.sourceAttribute = undefined;
|
|
29739
|
+
await this.updateAttributeUnsafe(sharedAttribute);
|
|
29740
|
+
}
|
|
29741
|
+
}
|
|
29742
|
+
async deletePredecessorsOfAttribute(attributeId) {
|
|
29743
|
+
const predecessors = await this.getPredecessorsOfAttribute(attributeId);
|
|
29744
|
+
for (const predecessor of predecessors) {
|
|
29745
|
+
await this.deleteAttribute(predecessor);
|
|
29746
|
+
}
|
|
29747
|
+
}
|
|
29612
29748
|
async getVersionsOfAttribute(id) {
|
|
29613
|
-
|
|
29749
|
+
const attribute = await this.getLocalAttribute(id);
|
|
29614
29750
|
if (typeof attribute === "undefined") {
|
|
29615
29751
|
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, id.toString());
|
|
29616
29752
|
}
|
|
29617
|
-
|
|
29618
|
-
|
|
29619
|
-
|
|
29620
|
-
|
|
29621
|
-
|
|
29622
|
-
|
|
29623
|
-
|
|
29624
|
-
|
|
29753
|
+
const predecessors = await this.getPredecessorsOfAttribute(id);
|
|
29754
|
+
const successors = await this.getSuccessorsOfAttribute(id);
|
|
29755
|
+
const allAttributeVersions = [...successors.reverse(), attribute, ...predecessors];
|
|
29756
|
+
return allAttributeVersions;
|
|
29757
|
+
}
|
|
29758
|
+
async getPredecessorsOfAttribute(id) {
|
|
29759
|
+
let attribute = await this.getLocalAttribute(id);
|
|
29760
|
+
if (typeof attribute === "undefined") {
|
|
29761
|
+
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, id.toString());
|
|
29625
29762
|
}
|
|
29626
|
-
|
|
29627
|
-
|
|
29628
|
-
while (attribute.succeeds && j < 1000) {
|
|
29763
|
+
const predecessors = [];
|
|
29764
|
+
while (typeof attribute.succeeds !== "undefined") {
|
|
29629
29765
|
const predecessor = await this.getLocalAttribute(attribute.succeeds);
|
|
29630
|
-
if (
|
|
29766
|
+
if (typeof predecessor === "undefined") {
|
|
29631
29767
|
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, attribute.succeeds.toString());
|
|
29632
29768
|
}
|
|
29633
29769
|
attribute = predecessor;
|
|
29634
|
-
|
|
29635
|
-
|
|
29770
|
+
predecessors.push(attribute);
|
|
29771
|
+
}
|
|
29772
|
+
return predecessors;
|
|
29773
|
+
}
|
|
29774
|
+
async getSuccessorsOfAttribute(id) {
|
|
29775
|
+
let attribute = await this.getLocalAttribute(id);
|
|
29776
|
+
if (typeof attribute === "undefined") {
|
|
29777
|
+
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, id.toString());
|
|
29636
29778
|
}
|
|
29637
|
-
|
|
29779
|
+
const successors = [];
|
|
29780
|
+
while (typeof attribute.succeededBy !== "undefined") {
|
|
29781
|
+
const successor = await this.getLocalAttribute(attribute.succeededBy);
|
|
29782
|
+
if (typeof successor === "undefined") {
|
|
29783
|
+
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, attribute.succeededBy.toString());
|
|
29784
|
+
}
|
|
29785
|
+
attribute = successor;
|
|
29786
|
+
successors.push(successor);
|
|
29787
|
+
}
|
|
29788
|
+
return successors;
|
|
29638
29789
|
}
|
|
29639
29790
|
async getSharedVersionsOfRepositoryAttribute(id, peers, onlyLatestVersions = true) {
|
|
29640
|
-
|
|
29791
|
+
const repositoryAttribute = await this.getLocalAttribute(id);
|
|
29641
29792
|
if (typeof repositoryAttribute === "undefined") {
|
|
29642
29793
|
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, id.toString());
|
|
29643
29794
|
}
|
|
29644
29795
|
if (!repositoryAttribute.isRepositoryAttribute(this.identity.address)) {
|
|
29645
29796
|
throw CoreErrors_1.CoreErrors.attributes.invalidPropertyValue(`Attribute '${id}' isn't a repository attribute.`);
|
|
29646
29797
|
}
|
|
29647
|
-
let i = 0;
|
|
29648
|
-
while (repositoryAttribute.succeededBy && i < 1000) {
|
|
29649
|
-
const successor = await this.getLocalAttribute(repositoryAttribute.succeededBy);
|
|
29650
|
-
if (!successor) {
|
|
29651
|
-
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, repositoryAttribute.succeededBy.toString());
|
|
29652
|
-
}
|
|
29653
|
-
repositoryAttribute = successor;
|
|
29654
|
-
i++;
|
|
29655
|
-
}
|
|
29656
29798
|
const query = { "shareInfo.sourceAttribute": repositoryAttribute.id.toString() };
|
|
29657
29799
|
if (typeof peers !== "undefined") {
|
|
29658
29800
|
query["shareInfo.peer"] = { $in: peers.map((address) => address.toString()) };
|
|
@@ -29660,20 +29802,39 @@ class AttributesController extends ConsumptionBaseController_1.ConsumptionBaseCo
|
|
|
29660
29802
|
if (onlyLatestVersions) {
|
|
29661
29803
|
query["succeededBy"] = { $exists: false };
|
|
29662
29804
|
}
|
|
29663
|
-
const
|
|
29664
|
-
|
|
29665
|
-
|
|
29805
|
+
const ownSharedIdentityAttributes = await this.getLocalAttributes(query);
|
|
29806
|
+
const ownSharedIdentityAttributePredecessors = await this.getSharedPredecessorsOfRepositoryAttribute(repositoryAttribute, query);
|
|
29807
|
+
const ownSharedIdentityAttributeSuccessors = await this.getSharedSuccessorsOfRepositoryAttribute(repositoryAttribute, query);
|
|
29808
|
+
const ownSharedIdentityAttributeVersions = [...ownSharedIdentityAttributeSuccessors.reverse(), ...ownSharedIdentityAttributes, ...ownSharedIdentityAttributePredecessors];
|
|
29809
|
+
return ownSharedIdentityAttributeVersions;
|
|
29810
|
+
}
|
|
29811
|
+
async getSharedPredecessorsOfRepositoryAttribute(repositoryAttribute, query = {}) {
|
|
29812
|
+
const ownSharedIdentityAttributePredecessors = [];
|
|
29813
|
+
while (typeof repositoryAttribute.succeeds !== "undefined") {
|
|
29666
29814
|
const predecessor = await this.getLocalAttribute(repositoryAttribute.succeeds);
|
|
29667
|
-
if (
|
|
29815
|
+
if (typeof predecessor === "undefined") {
|
|
29668
29816
|
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, repositoryAttribute.succeeds.toString());
|
|
29669
29817
|
}
|
|
29670
29818
|
repositoryAttribute = predecessor;
|
|
29671
29819
|
query["shareInfo.sourceAttribute"] = repositoryAttribute.id.toString();
|
|
29672
29820
|
const sharedCopies = await this.getLocalAttributes(query);
|
|
29673
|
-
|
|
29674
|
-
j++;
|
|
29821
|
+
ownSharedIdentityAttributePredecessors.push(...sharedCopies);
|
|
29675
29822
|
}
|
|
29676
|
-
return
|
|
29823
|
+
return ownSharedIdentityAttributePredecessors;
|
|
29824
|
+
}
|
|
29825
|
+
async getSharedSuccessorsOfRepositoryAttribute(repositoryAttribute, query = {}) {
|
|
29826
|
+
const ownSharedIdentityAttributeSuccessors = [];
|
|
29827
|
+
while (typeof repositoryAttribute.succeededBy !== "undefined") {
|
|
29828
|
+
const successor = await this.getLocalAttribute(repositoryAttribute.succeededBy);
|
|
29829
|
+
if (typeof successor === "undefined") {
|
|
29830
|
+
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, repositoryAttribute.succeededBy.toString());
|
|
29831
|
+
}
|
|
29832
|
+
repositoryAttribute = successor;
|
|
29833
|
+
query["shareInfo.sourceAttribute"] = repositoryAttribute.id.toString();
|
|
29834
|
+
const sharedCopies = await this.getLocalAttributes(query);
|
|
29835
|
+
ownSharedIdentityAttributeSuccessors.push(...sharedCopies);
|
|
29836
|
+
}
|
|
29837
|
+
return ownSharedIdentityAttributeSuccessors;
|
|
29677
29838
|
}
|
|
29678
29839
|
}
|
|
29679
29840
|
exports.AttributesController = AttributesController;
|
|
@@ -29738,6 +29899,28 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
29738
29899
|
|
|
29739
29900
|
/***/ }),
|
|
29740
29901
|
|
|
29902
|
+
/***/ "./dist/modules/attributes/events/OwnSharedAttributeDeletedByOwnerEvent.js":
|
|
29903
|
+
/*!*********************************************************************************!*\
|
|
29904
|
+
!*** ./dist/modules/attributes/events/OwnSharedAttributeDeletedByOwnerEvent.js ***!
|
|
29905
|
+
\*********************************************************************************/
|
|
29906
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
29907
|
+
|
|
29908
|
+
"use strict";
|
|
29909
|
+
|
|
29910
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
29911
|
+
exports.OwnSharedAttributeDeletedByOwnerEvent = void 0;
|
|
29912
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
29913
|
+
class OwnSharedAttributeDeletedByOwnerEvent extends transport_1.TransportDataEvent {
|
|
29914
|
+
static { this.namespace = "consumption.ownSharedAttributeDeletedByOwner"; }
|
|
29915
|
+
constructor(eventTargetAddress, data) {
|
|
29916
|
+
super(OwnSharedAttributeDeletedByOwnerEvent.namespace, eventTargetAddress, data);
|
|
29917
|
+
}
|
|
29918
|
+
}
|
|
29919
|
+
exports.OwnSharedAttributeDeletedByOwnerEvent = OwnSharedAttributeDeletedByOwnerEvent;
|
|
29920
|
+
//# sourceMappingURL=OwnSharedAttributeDeletedByOwnerEvent.js.map
|
|
29921
|
+
|
|
29922
|
+
/***/ }),
|
|
29923
|
+
|
|
29741
29924
|
/***/ "./dist/modules/attributes/events/OwnSharedAttributeSucceededEvent.js":
|
|
29742
29925
|
/*!****************************************************************************!*\
|
|
29743
29926
|
!*** ./dist/modules/attributes/events/OwnSharedAttributeSucceededEvent.js ***!
|
|
@@ -29760,6 +29943,28 @@ exports.OwnSharedAttributeSucceededEvent = OwnSharedAttributeSucceededEvent;
|
|
|
29760
29943
|
|
|
29761
29944
|
/***/ }),
|
|
29762
29945
|
|
|
29946
|
+
/***/ "./dist/modules/attributes/events/PeerSharedAttributeDeletedByPeerEvent.js":
|
|
29947
|
+
/*!*********************************************************************************!*\
|
|
29948
|
+
!*** ./dist/modules/attributes/events/PeerSharedAttributeDeletedByPeerEvent.js ***!
|
|
29949
|
+
\*********************************************************************************/
|
|
29950
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
29951
|
+
|
|
29952
|
+
"use strict";
|
|
29953
|
+
|
|
29954
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
29955
|
+
exports.PeerSharedAttributeDeletedByPeerEvent = void 0;
|
|
29956
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
29957
|
+
class PeerSharedAttributeDeletedByPeerEvent extends transport_1.TransportDataEvent {
|
|
29958
|
+
static { this.namespace = "consumption.peerSharedAttributeDeletedByPeer"; }
|
|
29959
|
+
constructor(eventTargetAddress, data) {
|
|
29960
|
+
super(PeerSharedAttributeDeletedByPeerEvent.namespace, eventTargetAddress, data);
|
|
29961
|
+
}
|
|
29962
|
+
}
|
|
29963
|
+
exports.PeerSharedAttributeDeletedByPeerEvent = PeerSharedAttributeDeletedByPeerEvent;
|
|
29964
|
+
//# sourceMappingURL=PeerSharedAttributeDeletedByPeerEvent.js.map
|
|
29965
|
+
|
|
29966
|
+
/***/ }),
|
|
29967
|
+
|
|
29763
29968
|
/***/ "./dist/modules/attributes/events/PeerSharedAttributeSucceededEvent.js":
|
|
29764
29969
|
/*!*****************************************************************************!*\
|
|
29765
29970
|
!*** ./dist/modules/attributes/events/PeerSharedAttributeSucceededEvent.js ***!
|
|
@@ -29826,6 +30031,28 @@ exports.SharedAttributeCopyCreatedEvent = SharedAttributeCopyCreatedEvent;
|
|
|
29826
30031
|
|
|
29827
30032
|
/***/ }),
|
|
29828
30033
|
|
|
30034
|
+
/***/ "./dist/modules/attributes/events/ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.js":
|
|
30035
|
+
/*!**************************************************************************************************!*\
|
|
30036
|
+
!*** ./dist/modules/attributes/events/ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.js ***!
|
|
30037
|
+
\**************************************************************************************************/
|
|
30038
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
30039
|
+
|
|
30040
|
+
"use strict";
|
|
30041
|
+
|
|
30042
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30043
|
+
exports.ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent = void 0;
|
|
30044
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
30045
|
+
class ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent extends transport_1.TransportDataEvent {
|
|
30046
|
+
static { this.namespace = "consumption.thirdPartyOwnedRelationshipAttributeDeletedByPeer"; }
|
|
30047
|
+
constructor(eventTargetAddress, data) {
|
|
30048
|
+
super(ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.namespace, eventTargetAddress, data);
|
|
30049
|
+
}
|
|
30050
|
+
}
|
|
30051
|
+
exports.ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent = ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent;
|
|
30052
|
+
//# sourceMappingURL=ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.js.map
|
|
30053
|
+
|
|
30054
|
+
/***/ }),
|
|
30055
|
+
|
|
29829
30056
|
/***/ "./dist/modules/attributes/events/index.js":
|
|
29830
30057
|
/*!*************************************************!*\
|
|
29831
30058
|
!*** ./dist/modules/attributes/events/index.js ***!
|
|
@@ -29852,10 +30079,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
29852
30079
|
__exportStar(__webpack_require__(/*! ./AttributeCreatedEvent */ "./dist/modules/attributes/events/AttributeCreatedEvent.js"), exports);
|
|
29853
30080
|
__exportStar(__webpack_require__(/*! ./AttributeDeletedEvent */ "./dist/modules/attributes/events/AttributeDeletedEvent.js"), exports);
|
|
29854
30081
|
__exportStar(__webpack_require__(/*! ./AttributeSucceededEventData */ "./dist/modules/attributes/events/AttributeSucceededEventData.js"), exports);
|
|
30082
|
+
__exportStar(__webpack_require__(/*! ./OwnSharedAttributeDeletedByOwnerEvent */ "./dist/modules/attributes/events/OwnSharedAttributeDeletedByOwnerEvent.js"), exports);
|
|
29855
30083
|
__exportStar(__webpack_require__(/*! ./OwnSharedAttributeSucceededEvent */ "./dist/modules/attributes/events/OwnSharedAttributeSucceededEvent.js"), exports);
|
|
30084
|
+
__exportStar(__webpack_require__(/*! ./PeerSharedAttributeDeletedByPeerEvent */ "./dist/modules/attributes/events/PeerSharedAttributeDeletedByPeerEvent.js"), exports);
|
|
29856
30085
|
__exportStar(__webpack_require__(/*! ./PeerSharedAttributeSucceededEvent */ "./dist/modules/attributes/events/PeerSharedAttributeSucceededEvent.js"), exports);
|
|
29857
30086
|
__exportStar(__webpack_require__(/*! ./RepositoryAttributeSucceededEvent */ "./dist/modules/attributes/events/RepositoryAttributeSucceededEvent.js"), exports);
|
|
29858
30087
|
__exportStar(__webpack_require__(/*! ./SharedAttributeCopyCreatedEvent */ "./dist/modules/attributes/events/SharedAttributeCopyCreatedEvent.js"), exports);
|
|
30088
|
+
__exportStar(__webpack_require__(/*! ./ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent */ "./dist/modules/attributes/events/ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent.js"), exports);
|
|
29859
30089
|
//# sourceMappingURL=index.js.map
|
|
29860
30090
|
|
|
29861
30091
|
/***/ }),
|
|
@@ -29890,6 +30120,7 @@ __exportStar(__webpack_require__(/*! ./local/CreateLocalAttributeParams */ "./di
|
|
|
29890
30120
|
__exportStar(__webpack_require__(/*! ./local/CreatePeerLocalAttributeParams */ "./dist/modules/attributes/local/CreatePeerLocalAttributeParams.js"), exports);
|
|
29891
30121
|
__exportStar(__webpack_require__(/*! ./local/CreateSharedLocalAttributeCopyParams */ "./dist/modules/attributes/local/CreateSharedLocalAttributeCopyParams.js"), exports);
|
|
29892
30122
|
__exportStar(__webpack_require__(/*! ./local/LocalAttribute */ "./dist/modules/attributes/local/LocalAttribute.js"), exports);
|
|
30123
|
+
__exportStar(__webpack_require__(/*! ./local/LocalAttributeDeletionInfo */ "./dist/modules/attributes/local/LocalAttributeDeletionInfo.js"), exports);
|
|
29893
30124
|
__exportStar(__webpack_require__(/*! ./local/LocalAttributeShareInfo */ "./dist/modules/attributes/local/LocalAttributeShareInfo.js"), exports);
|
|
29894
30125
|
//# sourceMappingURL=index.js.map
|
|
29895
30126
|
|
|
@@ -30151,6 +30382,8 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
30151
30382
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
30152
30383
|
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "../../node_modules/ts-simple-nameof/index.js");
|
|
30153
30384
|
const ConsumptionIds_1 = __webpack_require__(/*! ../../../consumption/ConsumptionIds */ "./dist/consumption/ConsumptionIds.js");
|
|
30385
|
+
const CoreErrors_1 = __webpack_require__(/*! ../../../consumption/CoreErrors */ "./dist/consumption/CoreErrors.js");
|
|
30386
|
+
const LocalAttributeDeletionInfo_1 = __webpack_require__(/*! ./LocalAttributeDeletionInfo */ "./dist/modules/attributes/local/LocalAttributeDeletionInfo.js");
|
|
30154
30387
|
const LocalAttributeShareInfo_1 = __webpack_require__(/*! ./LocalAttributeShareInfo */ "./dist/modules/attributes/local/LocalAttributeShareInfo.js");
|
|
30155
30388
|
let LocalAttribute = class LocalAttribute extends transport_1.CoreSynchronizable {
|
|
30156
30389
|
constructor() {
|
|
@@ -30162,6 +30395,7 @@ let LocalAttribute = class LocalAttribute extends transport_1.CoreSynchronizable
|
|
|
30162
30395
|
(0, ts_simple_nameof_1.nameof)((r) => r.succeeds),
|
|
30163
30396
|
(0, ts_simple_nameof_1.nameof)((r) => r.succeededBy),
|
|
30164
30397
|
(0, ts_simple_nameof_1.nameof)((r) => r.shareInfo),
|
|
30398
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.deletionInfo),
|
|
30165
30399
|
(0, ts_simple_nameof_1.nameof)((r) => r.parentId)
|
|
30166
30400
|
];
|
|
30167
30401
|
this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.content)];
|
|
@@ -30178,17 +30412,14 @@ let LocalAttribute = class LocalAttribute extends transport_1.CoreSynchronizable
|
|
|
30178
30412
|
isPeerSharedRelationshipAttribute(peerAddress) {
|
|
30179
30413
|
return this.isRelationshipAttribute() && this.isPeerSharedAttribute(peerAddress);
|
|
30180
30414
|
}
|
|
30415
|
+
isThirdPartyOwnedRelationshipAttribute(ownAddress, thirdPartyAddress) {
|
|
30416
|
+
return this.isRelationshipAttribute() && this.isThirdPartyOwnedAttribute(ownAddress, thirdPartyAddress);
|
|
30417
|
+
}
|
|
30181
30418
|
isRepositoryAttribute(ownAddress) {
|
|
30182
30419
|
return this.isIdentityAttribute() && !this.isShared() && this.isOwnedBy(ownAddress);
|
|
30183
30420
|
}
|
|
30184
30421
|
isOwnSharedAttribute(ownAddress, peerAddress) {
|
|
30185
30422
|
let isOwnSharedAttribute = this.isShared() && this.isOwnedBy(ownAddress);
|
|
30186
|
-
if (!isOwnSharedAttribute) {
|
|
30187
|
-
return isOwnSharedAttribute;
|
|
30188
|
-
}
|
|
30189
|
-
if (this.isIdentityAttribute()) {
|
|
30190
|
-
isOwnSharedAttribute &&= typeof this.shareInfo.sourceAttribute !== "undefined";
|
|
30191
|
-
}
|
|
30192
30423
|
if (typeof peerAddress !== "undefined") {
|
|
30193
30424
|
isOwnSharedAttribute &&= this.shareInfo.peer.equals(peerAddress);
|
|
30194
30425
|
}
|
|
@@ -30196,22 +30427,24 @@ let LocalAttribute = class LocalAttribute extends transport_1.CoreSynchronizable
|
|
|
30196
30427
|
}
|
|
30197
30428
|
isPeerSharedAttribute(peerAddress) {
|
|
30198
30429
|
let isPeerSharedAttribute = this.isShared() && this.isOwnedBy(this.shareInfo.peer);
|
|
30199
|
-
|
|
30200
|
-
return isPeerSharedAttribute;
|
|
30201
|
-
}
|
|
30202
|
-
if (this.isIdentityAttribute()) {
|
|
30203
|
-
isPeerSharedAttribute &&= typeof this.shareInfo.sourceAttribute === "undefined";
|
|
30204
|
-
}
|
|
30430
|
+
isPeerSharedAttribute &&= typeof this.shareInfo.sourceAttribute === "undefined";
|
|
30205
30431
|
if (typeof peerAddress !== "undefined") {
|
|
30206
30432
|
isPeerSharedAttribute &&= this.isOwnedBy(peerAddress);
|
|
30207
30433
|
}
|
|
30208
30434
|
return isPeerSharedAttribute;
|
|
30209
30435
|
}
|
|
30436
|
+
isThirdPartyOwnedAttribute(ownAddress, thirdPartyAddress) {
|
|
30437
|
+
let isThirdPartyOwnedAttribute = this.isShared() && !this.isOwnedBy(ownAddress) && !this.isOwnedBy(this.shareInfo.peer);
|
|
30438
|
+
if (typeof thirdPartyAddress !== "undefined") {
|
|
30439
|
+
isThirdPartyOwnedAttribute &&= this.isOwnedBy(thirdPartyAddress);
|
|
30440
|
+
}
|
|
30441
|
+
return isThirdPartyOwnedAttribute;
|
|
30442
|
+
}
|
|
30210
30443
|
isIdentityAttribute() {
|
|
30211
30444
|
return this.content instanceof content_1.IdentityAttribute;
|
|
30212
30445
|
}
|
|
30213
30446
|
isRelationshipAttribute() {
|
|
30214
|
-
return this.content instanceof content_1.RelationshipAttribute && this.isShared()
|
|
30447
|
+
return this.content instanceof content_1.RelationshipAttribute && this.isShared();
|
|
30215
30448
|
}
|
|
30216
30449
|
isComplexAttribute() {
|
|
30217
30450
|
return this.content.value instanceof content_1.AbstractComplexValue;
|
|
@@ -30222,6 +30455,34 @@ let LocalAttribute = class LocalAttribute extends transport_1.CoreSynchronizable
|
|
|
30222
30455
|
isShared() {
|
|
30223
30456
|
return typeof this.shareInfo !== "undefined";
|
|
30224
30457
|
}
|
|
30458
|
+
setDeletionInfo(deletionInfo, ownAddress) {
|
|
30459
|
+
if (this.isRepositoryAttribute(ownAddress)) {
|
|
30460
|
+
throw CoreErrors_1.CoreErrors.attributes.cannotSetDeletionInfoOfRepositoryAttributes();
|
|
30461
|
+
}
|
|
30462
|
+
if (this.isOwnSharedAttribute(ownAddress) && !this.isOwnSharedAttributeDeletionInfo(deletionInfo)) {
|
|
30463
|
+
throw CoreErrors_1.CoreErrors.attributes.invalidDeletionInfoOfOwnSharedAttribute();
|
|
30464
|
+
}
|
|
30465
|
+
if (this.isPeerSharedAttribute() && !this.isPeerSharedAttributeDeletionInfo(deletionInfo)) {
|
|
30466
|
+
throw CoreErrors_1.CoreErrors.attributes.invalidDeletionInfoOfPeerSharedAttribute();
|
|
30467
|
+
}
|
|
30468
|
+
if (this.isThirdPartyOwnedRelationshipAttribute(ownAddress) && !this.isThirdPartyOwnedRelationshipAttributeDeletionInfo(deletionInfo)) {
|
|
30469
|
+
throw CoreErrors_1.CoreErrors.attributes.invalidDeletionInfoOfThirdPartyOwnedRelationshipAttribute();
|
|
30470
|
+
}
|
|
30471
|
+
this.deletionInfo = deletionInfo;
|
|
30472
|
+
return this;
|
|
30473
|
+
}
|
|
30474
|
+
isPeerSharedAttributeDeletionInfo(deletionInfo) {
|
|
30475
|
+
return deletionInfo.deletionStatus === LocalAttributeDeletionInfo_1.DeletionStatus.DeletedByOwner || deletionInfo.deletionStatus === LocalAttributeDeletionInfo_1.DeletionStatus.ToBeDeleted;
|
|
30476
|
+
}
|
|
30477
|
+
isOwnSharedAttributeDeletionInfo(deletionInfo) {
|
|
30478
|
+
return deletionInfo.deletionStatus === LocalAttributeDeletionInfo_1.DeletionStatus.DeletedByPeer || deletionInfo.deletionStatus === LocalAttributeDeletionInfo_1.DeletionStatus.ToBeDeletedByPeer;
|
|
30479
|
+
}
|
|
30480
|
+
isThirdPartyOwnedRelationshipAttributeDeletionInfo(deletionInfo) {
|
|
30481
|
+
return deletionInfo.deletionStatus === LocalAttributeDeletionInfo_1.DeletionStatus.DeletedByPeer;
|
|
30482
|
+
}
|
|
30483
|
+
hasDeletionInfo() {
|
|
30484
|
+
return typeof this.deletionInfo !== "undefined";
|
|
30485
|
+
}
|
|
30225
30486
|
static from(value) {
|
|
30226
30487
|
return this.fromAny(value);
|
|
30227
30488
|
}
|
|
@@ -30262,6 +30523,11 @@ __decorate([
|
|
|
30262
30523
|
(0, ts_serval_1.serialize)(),
|
|
30263
30524
|
__metadata("design:type", LocalAttributeShareInfo_1.LocalAttributeShareInfo)
|
|
30264
30525
|
], LocalAttribute.prototype, "shareInfo", void 0);
|
|
30526
|
+
__decorate([
|
|
30527
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
30528
|
+
(0, ts_serval_1.serialize)(),
|
|
30529
|
+
__metadata("design:type", LocalAttributeDeletionInfo_1.LocalAttributeDeletionInfo)
|
|
30530
|
+
], LocalAttribute.prototype, "deletionInfo", void 0);
|
|
30265
30531
|
__decorate([
|
|
30266
30532
|
(0, ts_serval_1.validate)({ nullable: true }),
|
|
30267
30533
|
(0, ts_serval_1.serialize)(),
|
|
@@ -30274,6 +30540,56 @@ exports.LocalAttribute = LocalAttribute = __decorate([
|
|
|
30274
30540
|
|
|
30275
30541
|
/***/ }),
|
|
30276
30542
|
|
|
30543
|
+
/***/ "./dist/modules/attributes/local/LocalAttributeDeletionInfo.js":
|
|
30544
|
+
/*!*********************************************************************!*\
|
|
30545
|
+
!*** ./dist/modules/attributes/local/LocalAttributeDeletionInfo.js ***!
|
|
30546
|
+
\*********************************************************************/
|
|
30547
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
30548
|
+
|
|
30549
|
+
"use strict";
|
|
30550
|
+
|
|
30551
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
30552
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30553
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30554
|
+
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;
|
|
30555
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
30556
|
+
};
|
|
30557
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
30558
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
30559
|
+
};
|
|
30560
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30561
|
+
exports.LocalAttributeDeletionInfo = exports.DeletionStatus = void 0;
|
|
30562
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
30563
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
30564
|
+
var DeletionStatus;
|
|
30565
|
+
(function (DeletionStatus) {
|
|
30566
|
+
DeletionStatus["ToBeDeleted"] = "ToBeDeleted";
|
|
30567
|
+
DeletionStatus["ToBeDeletedByPeer"] = "ToBeDeletedByPeer";
|
|
30568
|
+
DeletionStatus["DeletedByPeer"] = "DeletedByPeer";
|
|
30569
|
+
DeletionStatus["DeletedByOwner"] = "DeletedByOwner";
|
|
30570
|
+
})(DeletionStatus || (exports.DeletionStatus = DeletionStatus = {}));
|
|
30571
|
+
class LocalAttributeDeletionInfo extends transport_1.CoreSerializable {
|
|
30572
|
+
static from(value) {
|
|
30573
|
+
return this.fromAny(value);
|
|
30574
|
+
}
|
|
30575
|
+
}
|
|
30576
|
+
exports.LocalAttributeDeletionInfo = LocalAttributeDeletionInfo;
|
|
30577
|
+
__decorate([
|
|
30578
|
+
(0, ts_serval_1.serialize)(),
|
|
30579
|
+
(0, ts_serval_1.validate)({
|
|
30580
|
+
customValidator: (v) => (!Object.values(DeletionStatus).includes(v) ? `must be one of: ${Object.values(DeletionStatus).map((o) => `"${o}"`)}` : undefined)
|
|
30581
|
+
}),
|
|
30582
|
+
__metadata("design:type", String)
|
|
30583
|
+
], LocalAttributeDeletionInfo.prototype, "deletionStatus", void 0);
|
|
30584
|
+
__decorate([
|
|
30585
|
+
(0, ts_serval_1.serialize)(),
|
|
30586
|
+
(0, ts_serval_1.validate)(),
|
|
30587
|
+
__metadata("design:type", transport_1.CoreDate)
|
|
30588
|
+
], LocalAttributeDeletionInfo.prototype, "deletionDate", void 0);
|
|
30589
|
+
//# sourceMappingURL=LocalAttributeDeletionInfo.js.map
|
|
30590
|
+
|
|
30591
|
+
/***/ }),
|
|
30592
|
+
|
|
30277
30593
|
/***/ "./dist/modules/attributes/local/LocalAttributeShareInfo.js":
|
|
30278
30594
|
/*!******************************************************************!*\
|
|
30279
30595
|
!*** ./dist/modules/attributes/local/LocalAttributeShareInfo.js ***!
|
|
@@ -30947,6 +31263,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
30947
31263
|
};
|
|
30948
31264
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30949
31265
|
__exportStar(__webpack_require__(/*! ./itemProcessors/AbstractNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.js"), exports);
|
|
31266
|
+
__exportStar(__webpack_require__(/*! ./itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js"), exports);
|
|
31267
|
+
__exportStar(__webpack_require__(/*! ./itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js"), exports);
|
|
31268
|
+
__exportStar(__webpack_require__(/*! ./itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js"), exports);
|
|
30950
31269
|
__exportStar(__webpack_require__(/*! ./itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor.js"), exports);
|
|
30951
31270
|
__exportStar(__webpack_require__(/*! ./itemProcessors/NotificationItemConstructor */ "./dist/modules/notifications/itemProcessors/NotificationItemConstructor.js"), exports);
|
|
30952
31271
|
__exportStar(__webpack_require__(/*! ./itemProcessors/NotificationItemProcessorConstructor */ "./dist/modules/notifications/itemProcessors/NotificationItemProcessorConstructor.js"), exports);
|
|
@@ -31044,6 +31363,206 @@ exports.NotificationItemProcessorRegistry = NotificationItemProcessorRegistry;
|
|
|
31044
31363
|
|
|
31045
31364
|
/***/ }),
|
|
31046
31365
|
|
|
31366
|
+
/***/ "./dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js":
|
|
31367
|
+
/*!*********************************************************************************************************************************!*\
|
|
31368
|
+
!*** ./dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js ***!
|
|
31369
|
+
\*********************************************************************************************************************************/
|
|
31370
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
31371
|
+
|
|
31372
|
+
"use strict";
|
|
31373
|
+
|
|
31374
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
31375
|
+
exports.OwnSharedAttributeDeletedByOwnerNotificationItemProcessor = void 0;
|
|
31376
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
31377
|
+
const CoreErrors_1 = __webpack_require__(/*! ../../../../consumption/CoreErrors */ "./dist/consumption/CoreErrors.js");
|
|
31378
|
+
const attributes_1 = __webpack_require__(/*! ../../../attributes */ "./dist/modules/attributes/index.js");
|
|
31379
|
+
const common_1 = __webpack_require__(/*! ../../../common */ "./dist/modules/common/index.js");
|
|
31380
|
+
const AbstractNotificationItemProcessor_1 = __webpack_require__(/*! ../AbstractNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.js");
|
|
31381
|
+
class OwnSharedAttributeDeletedByOwnerNotificationItemProcessor extends AbstractNotificationItemProcessor_1.AbstractNotificationItemProcessor {
|
|
31382
|
+
constructor(consumptionController) {
|
|
31383
|
+
super(consumptionController);
|
|
31384
|
+
this._logger = transport_1.TransportLoggerFactory.getLogger(OwnSharedAttributeDeletedByOwnerNotificationItemProcessor);
|
|
31385
|
+
}
|
|
31386
|
+
async checkPrerequisitesOfIncomingNotificationItem(notificationItem, notification) {
|
|
31387
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31388
|
+
if (typeof attribute === "undefined") {
|
|
31389
|
+
return common_1.ValidationResult.success();
|
|
31390
|
+
}
|
|
31391
|
+
if (!attribute.isPeerSharedAttribute()) {
|
|
31392
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.isNotPeerSharedAttribute(notificationItem.attributeId));
|
|
31393
|
+
}
|
|
31394
|
+
if (!notification.peer.equals(attribute.shareInfo.peer)) {
|
|
31395
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.senderIsNotPeerOfSharedAttribute(notification.peer, notificationItem.attributeId));
|
|
31396
|
+
}
|
|
31397
|
+
return common_1.ValidationResult.success();
|
|
31398
|
+
}
|
|
31399
|
+
async process(notificationItem, _notification) {
|
|
31400
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31401
|
+
if (typeof attribute === "undefined")
|
|
31402
|
+
return;
|
|
31403
|
+
const deletionInfo = attributes_1.LocalAttributeDeletionInfo.from({
|
|
31404
|
+
deletionStatus: attributes_1.DeletionStatus.DeletedByOwner,
|
|
31405
|
+
deletionDate: transport_1.CoreDate.utc()
|
|
31406
|
+
});
|
|
31407
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
31408
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
31409
|
+
if (typeof attr.deletionInfo === "undefined") {
|
|
31410
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
31411
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
31412
|
+
}
|
|
31413
|
+
}
|
|
31414
|
+
return new attributes_1.OwnSharedAttributeDeletedByOwnerEvent(this.currentIdentityAddress.toString(), attribute);
|
|
31415
|
+
}
|
|
31416
|
+
async rollback(notificationItem, _notification) {
|
|
31417
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31418
|
+
if (typeof attribute === "undefined")
|
|
31419
|
+
return;
|
|
31420
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
31421
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
31422
|
+
attr.deletionInfo = undefined;
|
|
31423
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
31424
|
+
}
|
|
31425
|
+
}
|
|
31426
|
+
}
|
|
31427
|
+
exports.OwnSharedAttributeDeletedByOwnerNotificationItemProcessor = OwnSharedAttributeDeletedByOwnerNotificationItemProcessor;
|
|
31428
|
+
//# sourceMappingURL=OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js.map
|
|
31429
|
+
|
|
31430
|
+
/***/ }),
|
|
31431
|
+
|
|
31432
|
+
/***/ "./dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js":
|
|
31433
|
+
/*!*********************************************************************************************************************************!*\
|
|
31434
|
+
!*** ./dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js ***!
|
|
31435
|
+
\*********************************************************************************************************************************/
|
|
31436
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
31437
|
+
|
|
31438
|
+
"use strict";
|
|
31439
|
+
|
|
31440
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
31441
|
+
exports.PeerSharedAttributeDeletedByPeerNotificationItemProcessor = void 0;
|
|
31442
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
31443
|
+
const CoreErrors_1 = __webpack_require__(/*! ../../../../consumption/CoreErrors */ "./dist/consumption/CoreErrors.js");
|
|
31444
|
+
const attributes_1 = __webpack_require__(/*! ../../../attributes */ "./dist/modules/attributes/index.js");
|
|
31445
|
+
const LocalAttributeDeletionInfo_1 = __webpack_require__(/*! ../../../attributes/local/LocalAttributeDeletionInfo */ "./dist/modules/attributes/local/LocalAttributeDeletionInfo.js");
|
|
31446
|
+
const common_1 = __webpack_require__(/*! ../../../common */ "./dist/modules/common/index.js");
|
|
31447
|
+
const AbstractNotificationItemProcessor_1 = __webpack_require__(/*! ../AbstractNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.js");
|
|
31448
|
+
class PeerSharedAttributeDeletedByPeerNotificationItemProcessor extends AbstractNotificationItemProcessor_1.AbstractNotificationItemProcessor {
|
|
31449
|
+
constructor(consumptionController) {
|
|
31450
|
+
super(consumptionController);
|
|
31451
|
+
this._logger = transport_1.TransportLoggerFactory.getLogger(PeerSharedAttributeDeletedByPeerNotificationItemProcessor);
|
|
31452
|
+
}
|
|
31453
|
+
async checkPrerequisitesOfIncomingNotificationItem(notificationItem, notification) {
|
|
31454
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31455
|
+
if (typeof attribute === "undefined") {
|
|
31456
|
+
return common_1.ValidationResult.success();
|
|
31457
|
+
}
|
|
31458
|
+
if (!attribute.isOwnSharedAttribute(this.currentIdentityAddress)) {
|
|
31459
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.isNotOwnSharedAttribute(notificationItem.attributeId));
|
|
31460
|
+
}
|
|
31461
|
+
if (!notification.peer.equals(attribute.shareInfo.peer)) {
|
|
31462
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.senderIsNotPeerOfSharedAttribute(notification.peer, notificationItem.attributeId));
|
|
31463
|
+
}
|
|
31464
|
+
return common_1.ValidationResult.success();
|
|
31465
|
+
}
|
|
31466
|
+
async process(notificationItem, _notification) {
|
|
31467
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31468
|
+
if (typeof attribute === "undefined")
|
|
31469
|
+
return;
|
|
31470
|
+
const deletionDate = transport_1.CoreDate.utc();
|
|
31471
|
+
const deletionInfo = LocalAttributeDeletionInfo_1.LocalAttributeDeletionInfo.from({
|
|
31472
|
+
deletionStatus: LocalAttributeDeletionInfo_1.DeletionStatus.DeletedByPeer,
|
|
31473
|
+
deletionDate: deletionDate
|
|
31474
|
+
});
|
|
31475
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
31476
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
31477
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
31478
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
31479
|
+
}
|
|
31480
|
+
return new attributes_1.PeerSharedAttributeDeletedByPeerEvent(this.currentIdentityAddress.toString(), attribute);
|
|
31481
|
+
}
|
|
31482
|
+
async rollback(notificationItem, _notification) {
|
|
31483
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31484
|
+
if (typeof attribute === "undefined")
|
|
31485
|
+
return;
|
|
31486
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
31487
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
31488
|
+
// the previous deletionState cannot be unambiguously known, either it was undefined or 'toBeDeletedByPeer'
|
|
31489
|
+
attr.deletionInfo = undefined;
|
|
31490
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
31491
|
+
}
|
|
31492
|
+
}
|
|
31493
|
+
}
|
|
31494
|
+
exports.PeerSharedAttributeDeletedByPeerNotificationItemProcessor = PeerSharedAttributeDeletedByPeerNotificationItemProcessor;
|
|
31495
|
+
//# sourceMappingURL=PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js.map
|
|
31496
|
+
|
|
31497
|
+
/***/ }),
|
|
31498
|
+
|
|
31499
|
+
/***/ "./dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js":
|
|
31500
|
+
/*!**************************************************************************************************************************************************!*\
|
|
31501
|
+
!*** ./dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js ***!
|
|
31502
|
+
\**************************************************************************************************************************************************/
|
|
31503
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
31504
|
+
|
|
31505
|
+
"use strict";
|
|
31506
|
+
|
|
31507
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
31508
|
+
exports.ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor = void 0;
|
|
31509
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
31510
|
+
const CoreErrors_1 = __webpack_require__(/*! ../../../../consumption/CoreErrors */ "./dist/consumption/CoreErrors.js");
|
|
31511
|
+
const attributes_1 = __webpack_require__(/*! ../../../attributes */ "./dist/modules/attributes/index.js");
|
|
31512
|
+
const LocalAttributeDeletionInfo_1 = __webpack_require__(/*! ../../../attributes/local/LocalAttributeDeletionInfo */ "./dist/modules/attributes/local/LocalAttributeDeletionInfo.js");
|
|
31513
|
+
const common_1 = __webpack_require__(/*! ../../../common */ "./dist/modules/common/index.js");
|
|
31514
|
+
const AbstractNotificationItemProcessor_1 = __webpack_require__(/*! ../AbstractNotificationItemProcessor */ "./dist/modules/notifications/itemProcessors/AbstractNotificationItemProcessor.js");
|
|
31515
|
+
class ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor extends AbstractNotificationItemProcessor_1.AbstractNotificationItemProcessor {
|
|
31516
|
+
constructor(consumptionController) {
|
|
31517
|
+
super(consumptionController);
|
|
31518
|
+
this._logger = transport_1.TransportLoggerFactory.getLogger(ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor);
|
|
31519
|
+
}
|
|
31520
|
+
async checkPrerequisitesOfIncomingNotificationItem(notificationItem, notification) {
|
|
31521
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31522
|
+
if (typeof attribute === "undefined") {
|
|
31523
|
+
return common_1.ValidationResult.success();
|
|
31524
|
+
}
|
|
31525
|
+
if (!attribute.isThirdPartyOwnedRelationshipAttribute(this.currentIdentityAddress)) {
|
|
31526
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.isNotThirdPartyOwnedRelationshipAttribute(notificationItem.attributeId));
|
|
31527
|
+
}
|
|
31528
|
+
if (!notification.peer.equals(attribute.shareInfo.peer)) {
|
|
31529
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.senderIsNotPeerOfSharedAttribute(notification.peer, notificationItem.attributeId));
|
|
31530
|
+
}
|
|
31531
|
+
return common_1.ValidationResult.success();
|
|
31532
|
+
}
|
|
31533
|
+
async process(notificationItem, _notification) {
|
|
31534
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31535
|
+
if (typeof attribute === "undefined")
|
|
31536
|
+
return;
|
|
31537
|
+
const deletionDate = transport_1.CoreDate.utc();
|
|
31538
|
+
const deletionInfo = LocalAttributeDeletionInfo_1.LocalAttributeDeletionInfo.from({
|
|
31539
|
+
deletionStatus: LocalAttributeDeletionInfo_1.DeletionStatus.DeletedByPeer,
|
|
31540
|
+
deletionDate: deletionDate
|
|
31541
|
+
});
|
|
31542
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
31543
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
31544
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
31545
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
31546
|
+
}
|
|
31547
|
+
return new attributes_1.ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent(this.currentIdentityAddress.toString(), attribute);
|
|
31548
|
+
}
|
|
31549
|
+
async rollback(notificationItem, _notification) {
|
|
31550
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
31551
|
+
if (typeof attribute === "undefined")
|
|
31552
|
+
return;
|
|
31553
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
31554
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
31555
|
+
// the previous deletionState cannot be unambiguously known, either it was undefined or 'toBeDeletedByPeer'
|
|
31556
|
+
attr.deletionInfo = undefined;
|
|
31557
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
31558
|
+
}
|
|
31559
|
+
}
|
|
31560
|
+
}
|
|
31561
|
+
exports.ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor = ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor;
|
|
31562
|
+
//# sourceMappingURL=ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js.map
|
|
31563
|
+
|
|
31564
|
+
/***/ }),
|
|
31565
|
+
|
|
31047
31566
|
/***/ "./dist/modules/notifications/itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor.js":
|
|
31048
31567
|
/*!*******************************************************************************************************************************!*\
|
|
31049
31568
|
!*** ./dist/modules/notifications/itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor.js ***!
|
|
@@ -32162,6 +32681,8 @@ __exportStar(__webpack_require__(/*! ./incoming/received/ReceivedIncomingRequest
|
|
|
32162
32681
|
__exportStar(__webpack_require__(/*! ./incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters */ "./dist/modules/requests/incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters.js"), exports);
|
|
32163
32682
|
__exportStar(__webpack_require__(/*! ./itemProcessors/AbstractRequestItemProcessor */ "./dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js"), exports);
|
|
32164
32683
|
__exportStar(__webpack_require__(/*! ./itemProcessors/createAttribute/CreateAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js"), exports);
|
|
32684
|
+
__exportStar(__webpack_require__(/*! ./itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.js"), exports);
|
|
32685
|
+
__exportStar(__webpack_require__(/*! ./itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js"), exports);
|
|
32165
32686
|
__exportStar(__webpack_require__(/*! ./itemProcessors/freeText/AcceptFreeTextRequestItemParameters */ "./dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js"), exports);
|
|
32166
32687
|
__exportStar(__webpack_require__(/*! ./itemProcessors/freeText/FreeTextRequestItemProcessor */ "./dist/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.js"), exports);
|
|
32167
32688
|
__exportStar(__webpack_require__(/*! ./itemProcessors/GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js"), exports);
|
|
@@ -32412,6 +32933,142 @@ exports.CreateAttributeRequestItemProcessor = CreateAttributeRequestItemProcesso
|
|
|
32412
32933
|
|
|
32413
32934
|
/***/ }),
|
|
32414
32935
|
|
|
32936
|
+
/***/ "./dist/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.js":
|
|
32937
|
+
/*!************************************************************************************************************!*\
|
|
32938
|
+
!*** ./dist/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.js ***!
|
|
32939
|
+
\************************************************************************************************************/
|
|
32940
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
32941
|
+
|
|
32942
|
+
"use strict";
|
|
32943
|
+
|
|
32944
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
32945
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
32946
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
32947
|
+
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;
|
|
32948
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32949
|
+
};
|
|
32950
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32951
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
32952
|
+
};
|
|
32953
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32954
|
+
exports.AcceptDeleteAttributeRequestItemParameters = void 0;
|
|
32955
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
32956
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
32957
|
+
let AcceptDeleteAttributeRequestItemParameters = class AcceptDeleteAttributeRequestItemParameters extends ts_serval_1.Serializable {
|
|
32958
|
+
static from(value) {
|
|
32959
|
+
return this.fromAny(value);
|
|
32960
|
+
}
|
|
32961
|
+
};
|
|
32962
|
+
exports.AcceptDeleteAttributeRequestItemParameters = AcceptDeleteAttributeRequestItemParameters;
|
|
32963
|
+
__decorate([
|
|
32964
|
+
(0, ts_serval_1.serialize)(),
|
|
32965
|
+
(0, ts_serval_1.validate)(),
|
|
32966
|
+
__metadata("design:type", transport_1.CoreDate)
|
|
32967
|
+
], AcceptDeleteAttributeRequestItemParameters.prototype, "deletionDate", void 0);
|
|
32968
|
+
exports.AcceptDeleteAttributeRequestItemParameters = AcceptDeleteAttributeRequestItemParameters = __decorate([
|
|
32969
|
+
(0, ts_serval_1.type)("AcceptDeleteAttributeRequestItemParameters")
|
|
32970
|
+
], AcceptDeleteAttributeRequestItemParameters);
|
|
32971
|
+
//# sourceMappingURL=AcceptDeleteAttributeRequestItemParameters.js.map
|
|
32972
|
+
|
|
32973
|
+
/***/ }),
|
|
32974
|
+
|
|
32975
|
+
/***/ "./dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js":
|
|
32976
|
+
/*!*****************************************************************************************************!*\
|
|
32977
|
+
!*** ./dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js ***!
|
|
32978
|
+
\*****************************************************************************************************/
|
|
32979
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
32980
|
+
|
|
32981
|
+
"use strict";
|
|
32982
|
+
|
|
32983
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
32984
|
+
exports.DeleteAttributeRequestItemProcessor = void 0;
|
|
32985
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
32986
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
32987
|
+
const CoreErrors_1 = __webpack_require__(/*! ../../../../consumption/CoreErrors */ "./dist/consumption/CoreErrors.js");
|
|
32988
|
+
const attributes_1 = __webpack_require__(/*! ../../../attributes */ "./dist/modules/attributes/index.js");
|
|
32989
|
+
const ValidationResult_1 = __webpack_require__(/*! ../../../common/ValidationResult */ "./dist/modules/common/ValidationResult.js");
|
|
32990
|
+
const GenericRequestItemProcessor_1 = __webpack_require__(/*! ../GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js");
|
|
32991
|
+
class DeleteAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
32992
|
+
async canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
32993
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
32994
|
+
if (typeof attribute === "undefined") {
|
|
32995
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The Attribute '${requestItem.attributeId.toString()}' could not be found.`));
|
|
32996
|
+
}
|
|
32997
|
+
if (!attribute.isOwnSharedAttribute(this.accountController.identity.address)) {
|
|
32998
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The Attribute '${requestItem.attributeId.toString()}' is not an own shared Attribute. You can only request the deletion of own shared Attributes.`));
|
|
32999
|
+
}
|
|
33000
|
+
if (attribute.deletionInfo?.deletionStatus === attributes_1.DeletionStatus.DeletedByPeer) {
|
|
33001
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The Attribute was already deleted by the peer."));
|
|
33002
|
+
}
|
|
33003
|
+
if (attribute.deletionInfo?.deletionStatus === attributes_1.DeletionStatus.ToBeDeletedByPeer) {
|
|
33004
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The peer already accepted the deletion of the Attribute."));
|
|
33005
|
+
}
|
|
33006
|
+
if (!attribute.shareInfo.peer.equals(recipient)) {
|
|
33007
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The deletion of a shared Attribute can only be requested from the peer the Attribute is shared with."));
|
|
33008
|
+
}
|
|
33009
|
+
return ValidationResult_1.ValidationResult.success();
|
|
33010
|
+
}
|
|
33011
|
+
async canAccept(requestItem, params, _requestInfo) {
|
|
33012
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
33013
|
+
if (typeof attribute === "undefined") {
|
|
33014
|
+
return ValidationResult_1.ValidationResult.success();
|
|
33015
|
+
}
|
|
33016
|
+
const deletionDate = transport_1.CoreDate.from(params.deletionDate);
|
|
33017
|
+
if (!deletionDate.dateTime.isValid) {
|
|
33018
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The deletionDate is invalid."));
|
|
33019
|
+
}
|
|
33020
|
+
if (deletionDate.isBefore(transport_1.CoreDate.utc())) {
|
|
33021
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The deletionDate must be in the future."));
|
|
33022
|
+
}
|
|
33023
|
+
return ValidationResult_1.ValidationResult.success();
|
|
33024
|
+
}
|
|
33025
|
+
async accept(requestItem, params, _requestInfo) {
|
|
33026
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
33027
|
+
if (typeof attribute === "undefined") {
|
|
33028
|
+
return content_1.AcceptResponseItem.from({ result: content_1.ResponseItemResult.Accepted });
|
|
33029
|
+
}
|
|
33030
|
+
const deletionDate = transport_1.CoreDate.from(params.deletionDate);
|
|
33031
|
+
const deletionInfo = attributes_1.LocalAttributeDeletionInfo.from({
|
|
33032
|
+
deletionStatus: attributes_1.DeletionStatus.ToBeDeleted,
|
|
33033
|
+
deletionDate: deletionDate
|
|
33034
|
+
});
|
|
33035
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
33036
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
33037
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
33038
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
33039
|
+
}
|
|
33040
|
+
return content_1.DeleteAttributeAcceptResponseItem.from({
|
|
33041
|
+
deletionDate: deletionDate,
|
|
33042
|
+
result: content_1.ResponseItemResult.Accepted
|
|
33043
|
+
});
|
|
33044
|
+
}
|
|
33045
|
+
async applyIncomingResponseItem(responseItem, requestItem, _requestInfo) {
|
|
33046
|
+
if (!(responseItem instanceof content_1.DeleteAttributeAcceptResponseItem)) {
|
|
33047
|
+
return;
|
|
33048
|
+
}
|
|
33049
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
33050
|
+
if (typeof attribute === "undefined")
|
|
33051
|
+
return;
|
|
33052
|
+
if (attribute.deletionInfo?.deletionStatus === attributes_1.DeletionStatus.DeletedByPeer)
|
|
33053
|
+
return;
|
|
33054
|
+
const deletionInfo = attributes_1.LocalAttributeDeletionInfo.from({
|
|
33055
|
+
deletionStatus: attributes_1.DeletionStatus.ToBeDeletedByPeer,
|
|
33056
|
+
deletionDate: responseItem.deletionDate
|
|
33057
|
+
});
|
|
33058
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
33059
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
33060
|
+
if (attr.deletionInfo?.deletionStatus !== attributes_1.DeletionStatus.DeletedByPeer) {
|
|
33061
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
33062
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
33063
|
+
}
|
|
33064
|
+
}
|
|
33065
|
+
}
|
|
33066
|
+
}
|
|
33067
|
+
exports.DeleteAttributeRequestItemProcessor = DeleteAttributeRequestItemProcessor;
|
|
33068
|
+
//# sourceMappingURL=DeleteAttributeRequestItemProcessor.js.map
|
|
33069
|
+
|
|
33070
|
+
/***/ }),
|
|
33071
|
+
|
|
32415
33072
|
/***/ "./dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js":
|
|
32416
33073
|
/*!**********************************************************************************************!*\
|
|
32417
33074
|
!*** ./dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js ***!
|
|
@@ -32444,7 +33101,7 @@ __decorate([
|
|
|
32444
33101
|
__metadata("design:type", String)
|
|
32445
33102
|
], AcceptFreeTextRequestItemParameters.prototype, "freeText", void 0);
|
|
32446
33103
|
exports.AcceptFreeTextRequestItemParameters = AcceptFreeTextRequestItemParameters = __decorate([
|
|
32447
|
-
(0, ts_serval_1.type)("
|
|
33104
|
+
(0, ts_serval_1.type)("AcceptFreeTextRequestItemParameters")
|
|
32448
33105
|
], AcceptFreeTextRequestItemParameters);
|
|
32449
33106
|
//# sourceMappingURL=AcceptFreeTextRequestItemParameters.js.map
|
|
32450
33107
|
|
|
@@ -32474,7 +33131,7 @@ class FreeTextRequestItemProcessor extends GenericRequestItemProcessor_1.Generic
|
|
|
32474
33131
|
catch (error) {
|
|
32475
33132
|
if (!(error instanceof ts_serval_1.ParsingError))
|
|
32476
33133
|
throw error;
|
|
32477
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters());
|
|
33134
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The RequestItem was answered with incorrect parameters."));
|
|
32478
33135
|
}
|
|
32479
33136
|
return ValidationResult_1.ValidationResult.success();
|
|
32480
33137
|
}
|
|
@@ -32619,7 +33276,7 @@ class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1
|
|
|
32619
33276
|
const ownerIsEmpty = attribute.owner.equals("");
|
|
32620
33277
|
const ownerIsCurrentIdentity = attribute.owner.equals(this.currentIdentityAddress);
|
|
32621
33278
|
if (!ownerIsEmpty && !ownerIsCurrentIdentity) {
|
|
32622
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.
|
|
33279
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The given Attribute belongs to someone else. You can only share own Attributes."));
|
|
32623
33280
|
}
|
|
32624
33281
|
return ValidationResult_1.ValidationResult.success();
|
|
32625
33282
|
}
|
|
@@ -32783,7 +33440,7 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
|
|
|
32783
33440
|
}
|
|
32784
33441
|
const ownerIsCurrentIdentity = this.accountController.identity.isMe(foundAttribute.content.owner);
|
|
32785
33442
|
if (!ownerIsCurrentIdentity && foundAttribute.content instanceof content_1.IdentityAttribute) {
|
|
32786
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.
|
|
33443
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The given Attribute belongs to someone else. You can only share own Attributes."));
|
|
32787
33444
|
}
|
|
32788
33445
|
}
|
|
32789
33446
|
return ValidationResult_1.ValidationResult.success();
|