@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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LocalAttributeDeletionInfo = exports.DeletionStatus = void 0;
|
|
13
|
+
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
14
|
+
const transport_1 = require("@nmshd/transport");
|
|
15
|
+
var DeletionStatus;
|
|
16
|
+
(function (DeletionStatus) {
|
|
17
|
+
DeletionStatus["ToBeDeleted"] = "ToBeDeleted";
|
|
18
|
+
DeletionStatus["ToBeDeletedByPeer"] = "ToBeDeletedByPeer";
|
|
19
|
+
DeletionStatus["DeletedByPeer"] = "DeletedByPeer";
|
|
20
|
+
DeletionStatus["DeletedByOwner"] = "DeletedByOwner";
|
|
21
|
+
})(DeletionStatus || (exports.DeletionStatus = DeletionStatus = {}));
|
|
22
|
+
class LocalAttributeDeletionInfo extends transport_1.CoreSerializable {
|
|
23
|
+
static from(value) {
|
|
24
|
+
return this.fromAny(value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.LocalAttributeDeletionInfo = LocalAttributeDeletionInfo;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, ts_serval_1.serialize)(),
|
|
30
|
+
(0, ts_serval_1.validate)({
|
|
31
|
+
customValidator: (v) => (!Object.values(DeletionStatus).includes(v) ? `must be one of: ${Object.values(DeletionStatus).map((o) => `"${o}"`)}` : undefined)
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], LocalAttributeDeletionInfo.prototype, "deletionStatus", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, ts_serval_1.serialize)(),
|
|
37
|
+
(0, ts_serval_1.validate)(),
|
|
38
|
+
__metadata("design:type", transport_1.CoreDate)
|
|
39
|
+
], LocalAttributeDeletionInfo.prototype, "deletionDate", void 0);
|
|
40
|
+
//# sourceMappingURL=LocalAttributeDeletionInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalAttributeDeletionInfo.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/LocalAttributeDeletionInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAyD;AACzD,gDAAyE;AAEzE,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,6CAA2B,CAAA;IAC3B,yDAAuC,CAAA;IACvC,iDAA+B,CAAA;IAC/B,mDAAiC,CAAA;AACrC,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB;AAYD,MAAa,0BAA2B,SAAQ,4BAAgB;IAWrD,MAAM,CAAC,IAAI,CAAC,KAAmE;QAClF,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACJ;AAdD,gEAcC;AATU;IAJN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,EAAC;QACN,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;KAC7J,CAAC;;kEACoC;AAI/B;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACU,oBAAQ;gEAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./itemProcessors/AbstractNotificationItemProcessor";
|
|
2
|
+
export * from "./itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor";
|
|
3
|
+
export * from "./itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor";
|
|
4
|
+
export * from "./itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor";
|
|
2
5
|
export * from "./itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor";
|
|
3
6
|
export * from "./itemProcessors/NotificationItemConstructor";
|
|
4
7
|
export * from "./itemProcessors/NotificationItemProcessorConstructor";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,oDAAoD,CAAC;AACnE,cAAc,2FAA2F,CAAC;AAC1G,cAAc,8CAA8C,CAAC;AAC7D,cAAc,uDAAuD,CAAC;AACtE,cAAc,oDAAoD,CAAC;AACnE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,oDAAoD,CAAC;AACnE,cAAc,6FAA6F,CAAC;AAC5G,cAAc,6FAA6F,CAAC;AAC5G,cAAc,8GAA8G,CAAC;AAC7H,cAAc,2FAA2F,CAAC;AAC1G,cAAc,8CAA8C,CAAC;AAC7D,cAAc,uDAAuD,CAAC;AACtE,cAAc,oDAAoD,CAAC;AACnE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC"}
|
|
@@ -15,6 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./itemProcessors/AbstractNotificationItemProcessor"), exports);
|
|
18
|
+
__exportStar(require("./itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor"), exports);
|
|
19
|
+
__exportStar(require("./itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor"), exports);
|
|
20
|
+
__exportStar(require("./itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor"), exports);
|
|
18
21
|
__exportStar(require("./itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor"), exports);
|
|
19
22
|
__exportStar(require("./itemProcessors/NotificationItemConstructor"), exports);
|
|
20
23
|
__exportStar(require("./itemProcessors/NotificationItemProcessorConstructor"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/notifications/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qFAAmE;AACnE,4HAA0G;AAC1G,+EAA6D;AAC7D,wFAAsE;AACtE,qFAAmE;AACnE,4DAA0C;AAC1C,kEAAgD;AAChD,4DAA0C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/notifications/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qFAAmE;AACnE,8HAA4G;AAC5G,8HAA4G;AAC5G,+IAA6H;AAC7H,4HAA0G;AAC1G,+EAA6D;AAC7D,wFAAsE;AACtE,qFAAmE;AACnE,4DAA0C;AAC1C,kEAAgD;AAChD,4DAA0C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OwnSharedAttributeDeletedByOwnerNotificationItem } from "@nmshd/content";
|
|
2
|
+
import { ConsumptionController } from "../../../../consumption/ConsumptionController";
|
|
3
|
+
import { OwnSharedAttributeDeletedByOwnerEvent } from "../../../attributes";
|
|
4
|
+
import { ValidationResult } from "../../../common";
|
|
5
|
+
import { LocalNotification } from "../../local/LocalNotification";
|
|
6
|
+
import { AbstractNotificationItemProcessor } from "../AbstractNotificationItemProcessor";
|
|
7
|
+
export declare class OwnSharedAttributeDeletedByOwnerNotificationItemProcessor extends AbstractNotificationItemProcessor<OwnSharedAttributeDeletedByOwnerNotificationItem> {
|
|
8
|
+
private readonly _logger;
|
|
9
|
+
constructor(consumptionController: ConsumptionController);
|
|
10
|
+
checkPrerequisitesOfIncomingNotificationItem(notificationItem: OwnSharedAttributeDeletedByOwnerNotificationItem, notification: LocalNotification): Promise<ValidationResult>;
|
|
11
|
+
process(notificationItem: OwnSharedAttributeDeletedByOwnerNotificationItem, _notification: LocalNotification): Promise<OwnSharedAttributeDeletedByOwnerEvent | void>;
|
|
12
|
+
rollback(notificationItem: OwnSharedAttributeDeletedByOwnerNotificationItem, _notification: LocalNotification): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gDAAgD,EAAE,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,EAA8C,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AACxH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAEzF,qBAAa,yDAA0D,SAAQ,iCAAiC,CAAC,gDAAgD,CAAC;IAC9J,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEf,qBAAqB,EAAE,qBAAqB;IAKzC,4CAA4C,CAC9D,gBAAgB,EAAE,gDAAgD,EAClE,YAAY,EAAE,iBAAiB,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAkBN,OAAO,CACzB,gBAAgB,EAAE,gDAAgD,EAClE,aAAa,EAAE,iBAAiB,GACjC,OAAO,CAAC,qCAAqC,GAAG,IAAI,CAAC;IAqBlC,QAAQ,CAAC,gBAAgB,EAAE,gDAAgD,EAAE,aAAa,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAUtJ"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OwnSharedAttributeDeletedByOwnerNotificationItemProcessor = void 0;
|
|
4
|
+
const transport_1 = require("@nmshd/transport");
|
|
5
|
+
const CoreErrors_1 = require("../../../../consumption/CoreErrors");
|
|
6
|
+
const attributes_1 = require("../../../attributes");
|
|
7
|
+
const common_1 = require("../../../common");
|
|
8
|
+
const AbstractNotificationItemProcessor_1 = require("../AbstractNotificationItemProcessor");
|
|
9
|
+
class OwnSharedAttributeDeletedByOwnerNotificationItemProcessor extends AbstractNotificationItemProcessor_1.AbstractNotificationItemProcessor {
|
|
10
|
+
constructor(consumptionController) {
|
|
11
|
+
super(consumptionController);
|
|
12
|
+
this._logger = transport_1.TransportLoggerFactory.getLogger(OwnSharedAttributeDeletedByOwnerNotificationItemProcessor);
|
|
13
|
+
}
|
|
14
|
+
async checkPrerequisitesOfIncomingNotificationItem(notificationItem, notification) {
|
|
15
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
16
|
+
if (typeof attribute === "undefined") {
|
|
17
|
+
return common_1.ValidationResult.success();
|
|
18
|
+
}
|
|
19
|
+
if (!attribute.isPeerSharedAttribute()) {
|
|
20
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.isNotPeerSharedAttribute(notificationItem.attributeId));
|
|
21
|
+
}
|
|
22
|
+
if (!notification.peer.equals(attribute.shareInfo.peer)) {
|
|
23
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.senderIsNotPeerOfSharedAttribute(notification.peer, notificationItem.attributeId));
|
|
24
|
+
}
|
|
25
|
+
return common_1.ValidationResult.success();
|
|
26
|
+
}
|
|
27
|
+
async process(notificationItem, _notification) {
|
|
28
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
29
|
+
if (typeof attribute === "undefined")
|
|
30
|
+
return;
|
|
31
|
+
const deletionInfo = attributes_1.LocalAttributeDeletionInfo.from({
|
|
32
|
+
deletionStatus: attributes_1.DeletionStatus.DeletedByOwner,
|
|
33
|
+
deletionDate: transport_1.CoreDate.utc()
|
|
34
|
+
});
|
|
35
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
36
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
37
|
+
if (typeof attr.deletionInfo === "undefined") {
|
|
38
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
39
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return new attributes_1.OwnSharedAttributeDeletedByOwnerEvent(this.currentIdentityAddress.toString(), attribute);
|
|
43
|
+
}
|
|
44
|
+
async rollback(notificationItem, _notification) {
|
|
45
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
46
|
+
if (typeof attribute === "undefined")
|
|
47
|
+
return;
|
|
48
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
49
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
50
|
+
attr.deletionInfo = undefined;
|
|
51
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.OwnSharedAttributeDeletedByOwnerNotificationItemProcessor = OwnSharedAttributeDeletedByOwnerNotificationItemProcessor;
|
|
56
|
+
//# sourceMappingURL=OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.ts"],"names":[],"mappings":";;;AAEA,gDAAoE;AAEpE,mEAAgE;AAChE,oDAAwH;AACxH,4CAAmD;AAEnD,4FAAyF;AAEzF,MAAa,yDAA0D,SAAQ,qEAAmF;IAG9J,YAAmB,qBAA4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
|
|
1
|
+
import { PeerSharedAttributeDeletedByPeerNotificationItem } from "@nmshd/content";
|
|
2
|
+
import { ConsumptionController } from "../../../../consumption/ConsumptionController";
|
|
3
|
+
import { PeerSharedAttributeDeletedByPeerEvent } from "../../../attributes";
|
|
4
|
+
import { ValidationResult } from "../../../common";
|
|
5
|
+
import { LocalNotification } from "../../local/LocalNotification";
|
|
6
|
+
import { AbstractNotificationItemProcessor } from "../AbstractNotificationItemProcessor";
|
|
7
|
+
export declare class PeerSharedAttributeDeletedByPeerNotificationItemProcessor extends AbstractNotificationItemProcessor<PeerSharedAttributeDeletedByPeerNotificationItem> {
|
|
8
|
+
private readonly _logger;
|
|
9
|
+
constructor(consumptionController: ConsumptionController);
|
|
10
|
+
checkPrerequisitesOfIncomingNotificationItem(notificationItem: PeerSharedAttributeDeletedByPeerNotificationItem, notification: LocalNotification): Promise<ValidationResult>;
|
|
11
|
+
process(notificationItem: PeerSharedAttributeDeletedByPeerNotificationItem, _notification: LocalNotification): Promise<PeerSharedAttributeDeletedByPeerEvent | void>;
|
|
12
|
+
rollback(notificationItem: PeerSharedAttributeDeletedByPeerNotificationItem, _notification: LocalNotification): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=PeerSharedAttributeDeletedByPeerNotificationItemProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeerSharedAttributeDeletedByPeerNotificationItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gDAAgD,EAAE,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAEzF,qBAAa,yDAA0D,SAAQ,iCAAiC,CAAC,gDAAgD,CAAC;IAC9J,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEf,qBAAqB,EAAE,qBAAqB;IAKzC,4CAA4C,CAC9D,gBAAgB,EAAE,gDAAgD,EAClE,YAAY,EAAE,iBAAiB,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAkBN,OAAO,CACzB,gBAAgB,EAAE,gDAAgD,EAClE,aAAa,EAAE,iBAAiB,GACjC,OAAO,CAAC,qCAAqC,GAAG,IAAI,CAAC;IAoBlC,QAAQ,CAAC,gBAAgB,EAAE,gDAAgD,EAAE,aAAa,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAYtJ"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PeerSharedAttributeDeletedByPeerNotificationItemProcessor = void 0;
|
|
4
|
+
const transport_1 = require("@nmshd/transport");
|
|
5
|
+
const CoreErrors_1 = require("../../../../consumption/CoreErrors");
|
|
6
|
+
const attributes_1 = require("../../../attributes");
|
|
7
|
+
const LocalAttributeDeletionInfo_1 = require("../../../attributes/local/LocalAttributeDeletionInfo");
|
|
8
|
+
const common_1 = require("../../../common");
|
|
9
|
+
const AbstractNotificationItemProcessor_1 = require("../AbstractNotificationItemProcessor");
|
|
10
|
+
class PeerSharedAttributeDeletedByPeerNotificationItemProcessor extends AbstractNotificationItemProcessor_1.AbstractNotificationItemProcessor {
|
|
11
|
+
constructor(consumptionController) {
|
|
12
|
+
super(consumptionController);
|
|
13
|
+
this._logger = transport_1.TransportLoggerFactory.getLogger(PeerSharedAttributeDeletedByPeerNotificationItemProcessor);
|
|
14
|
+
}
|
|
15
|
+
async checkPrerequisitesOfIncomingNotificationItem(notificationItem, notification) {
|
|
16
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
17
|
+
if (typeof attribute === "undefined") {
|
|
18
|
+
return common_1.ValidationResult.success();
|
|
19
|
+
}
|
|
20
|
+
if (!attribute.isOwnSharedAttribute(this.currentIdentityAddress)) {
|
|
21
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.isNotOwnSharedAttribute(notificationItem.attributeId));
|
|
22
|
+
}
|
|
23
|
+
if (!notification.peer.equals(attribute.shareInfo.peer)) {
|
|
24
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.senderIsNotPeerOfSharedAttribute(notification.peer, notificationItem.attributeId));
|
|
25
|
+
}
|
|
26
|
+
return common_1.ValidationResult.success();
|
|
27
|
+
}
|
|
28
|
+
async process(notificationItem, _notification) {
|
|
29
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
30
|
+
if (typeof attribute === "undefined")
|
|
31
|
+
return;
|
|
32
|
+
const deletionDate = transport_1.CoreDate.utc();
|
|
33
|
+
const deletionInfo = LocalAttributeDeletionInfo_1.LocalAttributeDeletionInfo.from({
|
|
34
|
+
deletionStatus: LocalAttributeDeletionInfo_1.DeletionStatus.DeletedByPeer,
|
|
35
|
+
deletionDate: deletionDate
|
|
36
|
+
});
|
|
37
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
38
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
39
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
40
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
41
|
+
}
|
|
42
|
+
return new attributes_1.PeerSharedAttributeDeletedByPeerEvent(this.currentIdentityAddress.toString(), attribute);
|
|
43
|
+
}
|
|
44
|
+
async rollback(notificationItem, _notification) {
|
|
45
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
46
|
+
if (typeof attribute === "undefined")
|
|
47
|
+
return;
|
|
48
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
49
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
50
|
+
// the previous deletionState cannot be unambiguously known, either it was undefined or 'toBeDeletedByPeer'
|
|
51
|
+
attr.deletionInfo = undefined;
|
|
52
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.PeerSharedAttributeDeletedByPeerNotificationItemProcessor = PeerSharedAttributeDeletedByPeerNotificationItemProcessor;
|
|
57
|
+
//# sourceMappingURL=PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.ts"],"names":[],"mappings":";;;AAEA,gDAAoE;AAEpE,mEAAgE;AAChE,oDAA4E;AAC5E,qGAAkH;AAClH,4CAAmD;AAEnD,4FAAyF;AAEzF,MAAa,yDAA0D,SAAQ,qEAAmF;IAG9J,YAAmB,qBAA4C;QAC3D,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,kCAAsB,CAAC,SAAS,CAAC,yDAAyD,CAAC,CAAC;IAC/G,CAAC;IAEe,KAAK,CAAC,4CAA4C,CAC9D,gBAAkE,EAClE,YAA+B;QAE/B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAE9G,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;YACnC,OAAO,yBAAgB,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;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MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,IAAI,kDAAqC,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;IACxG,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,gBAAkE,EAAE,aAAgC;QAC/H,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC9G,IAAI,OAAO,SAAS,KAAK,WAAW;YAAE,OAAO;QAE7C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAE1G,KAAK,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC;YAC9C,2GAA2G;YAC3G,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;YAC9B,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;CACJ;AAhED,8HAgEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItem } from "@nmshd/content";
|
|
2
|
+
import { ConsumptionController } from "../../../../consumption/ConsumptionController";
|
|
3
|
+
import { ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent } from "../../../attributes";
|
|
4
|
+
import { ValidationResult } from "../../../common";
|
|
5
|
+
import { LocalNotification } from "../../local/LocalNotification";
|
|
6
|
+
import { AbstractNotificationItemProcessor } from "../AbstractNotificationItemProcessor";
|
|
7
|
+
export declare class ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor extends AbstractNotificationItemProcessor<ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItem> {
|
|
8
|
+
private readonly _logger;
|
|
9
|
+
constructor(consumptionController: ConsumptionController);
|
|
10
|
+
checkPrerequisitesOfIncomingNotificationItem(notificationItem: ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItem, notification: LocalNotification): Promise<ValidationResult>;
|
|
11
|
+
process(notificationItem: ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItem, _notification: LocalNotification): Promise<ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent | void>;
|
|
12
|
+
rollback(notificationItem: ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItem, _notification: LocalNotification): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iEAAiE,EAAE,MAAM,gBAAgB,CAAC;AAEnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,EAAE,sDAAsD,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAEzF,qBAAa,0EAA2E,SAAQ,iCAAiC,CAAC,iEAAiE,CAAC;IAChM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEf,qBAAqB,EAAE,qBAAqB;IAKzC,4CAA4C,CAC9D,gBAAgB,EAAE,iEAAiE,EACnF,YAAY,EAAE,iBAAiB,GAChC,OAAO,CAAC,gBAAgB,CAAC;IAkBN,OAAO,CACzB,gBAAgB,EAAE,iEAAiE,EACnF,aAAa,EAAE,iBAAiB,GACjC,OAAO,CAAC,sDAAsD,GAAG,IAAI,CAAC;IAoBnD,QAAQ,CAAC,gBAAgB,EAAE,iEAAiE,EAAE,aAAa,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAYvK"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor = void 0;
|
|
4
|
+
const transport_1 = require("@nmshd/transport");
|
|
5
|
+
const CoreErrors_1 = require("../../../../consumption/CoreErrors");
|
|
6
|
+
const attributes_1 = require("../../../attributes");
|
|
7
|
+
const LocalAttributeDeletionInfo_1 = require("../../../attributes/local/LocalAttributeDeletionInfo");
|
|
8
|
+
const common_1 = require("../../../common");
|
|
9
|
+
const AbstractNotificationItemProcessor_1 = require("../AbstractNotificationItemProcessor");
|
|
10
|
+
class ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor extends AbstractNotificationItemProcessor_1.AbstractNotificationItemProcessor {
|
|
11
|
+
constructor(consumptionController) {
|
|
12
|
+
super(consumptionController);
|
|
13
|
+
this._logger = transport_1.TransportLoggerFactory.getLogger(ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor);
|
|
14
|
+
}
|
|
15
|
+
async checkPrerequisitesOfIncomingNotificationItem(notificationItem, notification) {
|
|
16
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
17
|
+
if (typeof attribute === "undefined") {
|
|
18
|
+
return common_1.ValidationResult.success();
|
|
19
|
+
}
|
|
20
|
+
if (!attribute.isThirdPartyOwnedRelationshipAttribute(this.currentIdentityAddress)) {
|
|
21
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.isNotThirdPartyOwnedRelationshipAttribute(notificationItem.attributeId));
|
|
22
|
+
}
|
|
23
|
+
if (!notification.peer.equals(attribute.shareInfo.peer)) {
|
|
24
|
+
return common_1.ValidationResult.error(CoreErrors_1.CoreErrors.attributes.senderIsNotPeerOfSharedAttribute(notification.peer, notificationItem.attributeId));
|
|
25
|
+
}
|
|
26
|
+
return common_1.ValidationResult.success();
|
|
27
|
+
}
|
|
28
|
+
async process(notificationItem, _notification) {
|
|
29
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
30
|
+
if (typeof attribute === "undefined")
|
|
31
|
+
return;
|
|
32
|
+
const deletionDate = transport_1.CoreDate.utc();
|
|
33
|
+
const deletionInfo = LocalAttributeDeletionInfo_1.LocalAttributeDeletionInfo.from({
|
|
34
|
+
deletionStatus: LocalAttributeDeletionInfo_1.DeletionStatus.DeletedByPeer,
|
|
35
|
+
deletionDate: deletionDate
|
|
36
|
+
});
|
|
37
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
38
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
39
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
40
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
41
|
+
}
|
|
42
|
+
return new attributes_1.ThirdPartyOwnedRelationshipAttributeDeletedByPeerEvent(this.currentIdentityAddress.toString(), attribute);
|
|
43
|
+
}
|
|
44
|
+
async rollback(notificationItem, _notification) {
|
|
45
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(notificationItem.attributeId);
|
|
46
|
+
if (typeof attribute === "undefined")
|
|
47
|
+
return;
|
|
48
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
49
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
50
|
+
// the previous deletionState cannot be unambiguously known, either it was undefined or 'toBeDeletedByPeer'
|
|
51
|
+
attr.deletionInfo = undefined;
|
|
52
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor = ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor;
|
|
57
|
+
//# sourceMappingURL=ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.ts"],"names":[],"mappings":";;;AAEA,gDAAoE;AAEpE,mEAAgE;AAChE,oDAA6F;AAC7F,qGAAkH;AAClH,4CAAmD;AAEnD,4FAAyF;AAEzF,MAAa,0EAA2E,SAAQ,qEAAoG;IAGhM,YAAmB,qBAA4C;QAC3D,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,kCAAsB,CAAC,SAAS,CAAC,0EAA0E,CAAC,CAAC;IAChI,CAAC;IAEe,KAAK,CAAC,4CAA4C,CAC9D,gBAAmF,EACnF,YAA+B;QAE/B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAE9G,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;YACnC,OAAO,yBAAgB,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,sCAAsC,CAAC,IAAI,CAAC,sBAAsB,CAAC,EAAE,CAAC;YACjF,OAAO,yBAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,UAAU,CAAC,y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AAQ,EAAE,EAAE,SAAS,CAAC,CAAC;IACzH,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,gBAAmF,EAAE,aAAgC;QAChJ,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC9G,IAAI,OAAO,SAAS,KAAK,WAAW;YAAE,OAAO;QAE7C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAE1G,KAAK,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC;YAC9C,2GAA2G;YAC3G,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;YAC9B,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC5E,CAAC;IACL,CAAC;CACJ;AAhED,gKAgEC"}
|
|
@@ -12,6 +12,8 @@ export * from "./incoming/received/ReceivedIncomingRequestParameters";
|
|
|
12
12
|
export * from "./incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters";
|
|
13
13
|
export * from "./itemProcessors/AbstractRequestItemProcessor";
|
|
14
14
|
export * from "./itemProcessors/createAttribute/CreateAttributeRequestItemProcessor";
|
|
15
|
+
export * from "./itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters";
|
|
16
|
+
export * from "./itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor";
|
|
15
17
|
export * from "./itemProcessors/freeText/AcceptFreeTextRequestItemParameters";
|
|
16
18
|
export * from "./itemProcessors/freeText/FreeTextRequestItemProcessor";
|
|
17
19
|
export * from "./itemProcessors/GenericRequestItemProcessor";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,6EAA6E,CAAC;AAC5F,cAAc,uDAAuD,CAAC;AACtE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oDAAoD,CAAC;AACnE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AACtD,cAAc,uDAAuD,CAAC;AACtE,cAAc,mFAAmF,CAAC;AAClG,cAAc,+CAA+C,CAAC;AAC9D,cAAc,sEAAsE,CAAC;AACrF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,wDAAwD,CAAC;AACvE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,wCAAwC,CAAC;AACvD,cAAc,+EAA+E,CAAC;AAC9F,cAAc,wEAAwE,CAAC;AACvF,OAAO,EACH,4CAA4C,EAC5C,iEAAiE,EACjE,4DAA4D,EAC/D,MAAM,yEAAyE,CAAC;AACjF,cAAc,kEAAkE,CAAC;AACjF,cAAc,0FAA0F,CAAC;AACzG,cAAc,yCAAyC,CAAC;AACxD,cAAc,kDAAkD,CAAC;AACjE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oEAAoE,CAAC;AACnF,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,sEAAsE,CAAC;AACrF,cAAc,yIAAyI,CAAC;AACxJ,cAAc,qEAAqE,CAAC;AACpF,cAAc,kEAAkE,CAAC;AACjF,cAAc,uCAAuC,CAAC;AACtD,cAAc,8DAA8D,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,6EAA6E,CAAC;AAC5F,cAAc,uDAAuD,CAAC;AACtE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oDAAoD,CAAC;AACnE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AACtD,cAAc,uDAAuD,CAAC;AACtE,cAAc,mFAAmF,CAAC;AAClG,cAAc,+CAA+C,CAAC;AAC9D,cAAc,sEAAsE,CAAC;AACrF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,sEAAsE,CAAC;AACrF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,wDAAwD,CAAC;AACvE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,wCAAwC,CAAC;AACvD,cAAc,+EAA+E,CAAC;AAC9F,cAAc,wEAAwE,CAAC;AACvF,OAAO,EACH,4CAA4C,EAC5C,iEAAiE,EACjE,4DAA4D,EAC/D,MAAM,yEAAyE,CAAC;AACjF,cAAc,kEAAkE,CAAC;AACjF,cAAc,0FAA0F,CAAC;AACzG,cAAc,yCAAyC,CAAC;AACxD,cAAc,kDAAkD,CAAC;AACjE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oEAAoE,CAAC;AACnF,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,sEAAsE,CAAC;AACrF,cAAc,yIAAyI,CAAC;AACxJ,cAAc,qEAAqE,CAAC;AACpF,cAAc,kEAAkE,CAAC;AACjF,cAAc,uCAAuC,CAAC;AACtD,cAAc,8DAA8D,CAAC"}
|
|
@@ -28,6 +28,8 @@ __exportStar(require("./incoming/received/ReceivedIncomingRequestParameters"), e
|
|
|
28
28
|
__exportStar(require("./incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters"), exports);
|
|
29
29
|
__exportStar(require("./itemProcessors/AbstractRequestItemProcessor"), exports);
|
|
30
30
|
__exportStar(require("./itemProcessors/createAttribute/CreateAttributeRequestItemProcessor"), exports);
|
|
31
|
+
__exportStar(require("./itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters"), exports);
|
|
32
|
+
__exportStar(require("./itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor"), exports);
|
|
31
33
|
__exportStar(require("./itemProcessors/freeText/AcceptFreeTextRequestItemParameters"), exports);
|
|
32
34
|
__exportStar(require("./itemProcessors/freeText/FreeTextRequestItemProcessor"), exports);
|
|
33
35
|
__exportStar(require("./itemProcessors/GenericRequestItemProcessor"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8GAA4F;AAC5F,wFAAsE;AACtE,gFAA8D;AAC9D,qFAAmE;AACnE,gFAA8D;AAC9D,4EAA0D;AAC1D,gFAA8D;AAC9D,8EAA4D;AAC5D,wEAAsD;AACtD,wFAAsE;AACtE,oHAAkG;AAClG,gFAA8D;AAC9D,uGAAqF;AACrF,gGAA8E;AAC9E,yFAAuE;AACvE,+EAA6D;AAC7D,yEAAuD;AACvD,gHAA8F;AAC9F,yGAAuF;AAMvF,mGAAiF;AACjF,2HAAyG;AACzG,0EAAwD;AACxD,mFAAiE;AACjE,gFAA8D;AAC9D,qGAAmF;AACnF,uDAAqC;AACrC,6DAA2C;AAC3C,qEAAmD;AACnD,wDAAsC;AACtC,uGAAqF;AACrF,0KAAwJ;AACxJ,sGAAoF;AACpF,mGAAiF;AACjF,wEAAsD;AACtD,+FAA6E"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/requests/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8GAA4F;AAC5F,wFAAsE;AACtE,gFAA8D;AAC9D,qFAAmE;AACnE,gFAA8D;AAC9D,4EAA0D;AAC1D,gFAA8D;AAC9D,8EAA4D;AAC5D,wEAAsD;AACtD,wFAAsE;AACtE,oHAAkG;AAClG,gFAA8D;AAC9D,uGAAqF;AACrF,8GAA4F;AAC5F,uGAAqF;AACrF,gGAA8E;AAC9E,yFAAuE;AACvE,+EAA6D;AAC7D,yEAAuD;AACvD,gHAA8F;AAC9F,yGAAuF;AAMvF,mGAAiF;AACjF,2HAAyG;AACzG,0EAAwD;AACxD,mFAAiE;AACjE,gFAA8D;AAC9D,qGAAmF;AACnF,uDAAqC;AACrC,6DAA2C;AAC3C,qEAAmD;AACnD,wDAAsC;AACtC,uGAAqF;AACrF,0KAAwJ;AACxJ,sGAAoF;AACpF,mGAAiF;AACjF,wEAAsD;AACtD,+FAA6E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Serializable } from "@js-soft/ts-serval";
|
|
2
|
+
import { CoreDate } from "@nmshd/transport";
|
|
3
|
+
import { AcceptRequestItemParametersJSON } from "../../incoming/decide/AcceptRequestItemParameters";
|
|
4
|
+
export interface AcceptDeleteAttributeRequestItemParametersJSON extends AcceptRequestItemParametersJSON {
|
|
5
|
+
deletionDate: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class AcceptDeleteAttributeRequestItemParameters extends Serializable {
|
|
8
|
+
deletionDate: CoreDate;
|
|
9
|
+
static from(value: AcceptDeleteAttributeRequestItemParametersJSON): AcceptDeleteAttributeRequestItemParameters;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=AcceptDeleteAttributeRequestItemParameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcceptDeleteAttributeRequestItemParameters.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6B,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AAEpG,MAAM,WAAW,8CAA+C,SAAQ,+BAA+B;IACnG,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,qBACa,0CAA2C,SAAQ,YAAY;IAGjE,YAAY,EAAE,QAAQ,CAAC;WAEhB,IAAI,CAAC,KAAK,EAAE,8CAA8C,GAAG,0CAA0C;CAGxH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AcceptDeleteAttributeRequestItemParameters = void 0;
|
|
13
|
+
const ts_serval_1 = require("@js-soft/ts-serval");
|
|
14
|
+
const transport_1 = require("@nmshd/transport");
|
|
15
|
+
let AcceptDeleteAttributeRequestItemParameters = class AcceptDeleteAttributeRequestItemParameters extends ts_serval_1.Serializable {
|
|
16
|
+
static from(value) {
|
|
17
|
+
return this.fromAny(value);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.AcceptDeleteAttributeRequestItemParameters = AcceptDeleteAttributeRequestItemParameters;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, ts_serval_1.serialize)(),
|
|
23
|
+
(0, ts_serval_1.validate)(),
|
|
24
|
+
__metadata("design:type", transport_1.CoreDate)
|
|
25
|
+
], AcceptDeleteAttributeRequestItemParameters.prototype, "deletionDate", void 0);
|
|
26
|
+
exports.AcceptDeleteAttributeRequestItemParameters = AcceptDeleteAttributeRequestItemParameters = __decorate([
|
|
27
|
+
(0, ts_serval_1.type)("AcceptDeleteAttributeRequestItemParameters")
|
|
28
|
+
], AcceptDeleteAttributeRequestItemParameters);
|
|
29
|
+
//# sourceMappingURL=AcceptDeleteAttributeRequestItemParameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcceptDeleteAttributeRequestItemParameters.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/deleteAttribute/AcceptDeleteAttributeRequestItemParameters.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA6E;AAC7E,gDAA4C;AAQrC,IAAM,0CAA0C,GAAhD,MAAM,0CAA2C,SAAQ,wBAAY;IAKjE,MAAM,CAAC,IAAI,CAAC,KAAqD;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACJ,CAAA;AARY,gGAA0C;AAG5C;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACU,oBAAQ;gFAAC;qDAHrB,0CAA0C;IADtD,IAAA,gBAAI,EAAC,4CAA4C,CAAC;GACtC,0CAA0C,CAQtD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AcceptResponseItem, DeleteAttributeAcceptResponseItem, DeleteAttributeRequestItem, RejectResponseItem, Request } from "@nmshd/content";
|
|
2
|
+
import { CoreAddress } from "@nmshd/transport";
|
|
3
|
+
import { ValidationResult } from "../../../common/ValidationResult";
|
|
4
|
+
import { GenericRequestItemProcessor } from "../GenericRequestItemProcessor";
|
|
5
|
+
import { LocalRequestInfo } from "../IRequestItemProcessor";
|
|
6
|
+
import { AcceptDeleteAttributeRequestItemParametersJSON } from "./AcceptDeleteAttributeRequestItemParameters";
|
|
7
|
+
export declare class DeleteAttributeRequestItemProcessor extends GenericRequestItemProcessor<DeleteAttributeRequestItem> {
|
|
8
|
+
canCreateOutgoingRequestItem(requestItem: DeleteAttributeRequestItem, _request: Request, recipient?: CoreAddress): Promise<ValidationResult>;
|
|
9
|
+
canAccept(requestItem: DeleteAttributeRequestItem, params: AcceptDeleteAttributeRequestItemParametersJSON, _requestInfo: LocalRequestInfo): Promise<ValidationResult>;
|
|
10
|
+
accept(requestItem: DeleteAttributeRequestItem, params: AcceptDeleteAttributeRequestItemParametersJSON, _requestInfo: LocalRequestInfo): Promise<DeleteAttributeAcceptResponseItem | AcceptResponseItem>;
|
|
11
|
+
applyIncomingResponseItem(responseItem: DeleteAttributeAcceptResponseItem | AcceptResponseItem | RejectResponseItem, requestItem: DeleteAttributeRequestItem, _requestInfo: LocalRequestInfo): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DeleteAttributeRequestItemProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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;IAgC5I,SAAS,CAC3B,WAAW,EAAE,0BAA0B,EACvC,MAAM,EAAE,8CAA8C,EACtD,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,gBAAgB,CAAC;IAmBN,MAAM,CACxB,WAAW,EAAE,0BAA0B,EACvC,MAAM,EAAE,8CAA8C,EACtD,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,iCAAiC,GAAG,kBAAkB,CAAC;IAwB5C,yBAAyB,CAC3C,YAAY,EAAE,iCAAiC,GAAG,kBAAkB,GAAG,kBAAkB,EACzF,WAAW,EAAE,0BAA0B,EACvC,YAAY,EAAE,gBAAgB,GAC/B,OAAO,CAAC,IAAI,CAAC;CAwBnB"}
|
package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteAttributeRequestItemProcessor = void 0;
|
|
4
|
+
const content_1 = require("@nmshd/content");
|
|
5
|
+
const transport_1 = require("@nmshd/transport");
|
|
6
|
+
const CoreErrors_1 = require("../../../../consumption/CoreErrors");
|
|
7
|
+
const attributes_1 = require("../../../attributes");
|
|
8
|
+
const ValidationResult_1 = require("../../../common/ValidationResult");
|
|
9
|
+
const GenericRequestItemProcessor_1 = require("../GenericRequestItemProcessor");
|
|
10
|
+
class DeleteAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
11
|
+
async canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
12
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
13
|
+
if (typeof attribute === "undefined") {
|
|
14
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The Attribute '${requestItem.attributeId.toString()}' could not be found.`));
|
|
15
|
+
}
|
|
16
|
+
if (!attribute.isOwnSharedAttribute(this.accountController.identity.address)) {
|
|
17
|
+
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.`));
|
|
18
|
+
}
|
|
19
|
+
if (attribute.deletionInfo?.deletionStatus === attributes_1.DeletionStatus.DeletedByPeer) {
|
|
20
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The Attribute was already deleted by the peer."));
|
|
21
|
+
}
|
|
22
|
+
if (attribute.deletionInfo?.deletionStatus === attributes_1.DeletionStatus.ToBeDeletedByPeer) {
|
|
23
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The peer already accepted the deletion of the Attribute."));
|
|
24
|
+
}
|
|
25
|
+
if (!attribute.shareInfo.peer.equals(recipient)) {
|
|
26
|
+
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."));
|
|
27
|
+
}
|
|
28
|
+
return ValidationResult_1.ValidationResult.success();
|
|
29
|
+
}
|
|
30
|
+
async canAccept(requestItem, params, _requestInfo) {
|
|
31
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
32
|
+
if (typeof attribute === "undefined") {
|
|
33
|
+
return ValidationResult_1.ValidationResult.success();
|
|
34
|
+
}
|
|
35
|
+
const deletionDate = transport_1.CoreDate.from(params.deletionDate);
|
|
36
|
+
if (!deletionDate.dateTime.isValid) {
|
|
37
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The deletionDate is invalid."));
|
|
38
|
+
}
|
|
39
|
+
if (deletionDate.isBefore(transport_1.CoreDate.utc())) {
|
|
40
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The deletionDate must be in the future."));
|
|
41
|
+
}
|
|
42
|
+
return ValidationResult_1.ValidationResult.success();
|
|
43
|
+
}
|
|
44
|
+
async accept(requestItem, params, _requestInfo) {
|
|
45
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
46
|
+
if (typeof attribute === "undefined") {
|
|
47
|
+
return content_1.AcceptResponseItem.from({ result: content_1.ResponseItemResult.Accepted });
|
|
48
|
+
}
|
|
49
|
+
const deletionDate = transport_1.CoreDate.from(params.deletionDate);
|
|
50
|
+
const deletionInfo = attributes_1.LocalAttributeDeletionInfo.from({
|
|
51
|
+
deletionStatus: attributes_1.DeletionStatus.ToBeDeleted,
|
|
52
|
+
deletionDate: deletionDate
|
|
53
|
+
});
|
|
54
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
55
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
56
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
57
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
58
|
+
}
|
|
59
|
+
return content_1.DeleteAttributeAcceptResponseItem.from({
|
|
60
|
+
deletionDate: deletionDate,
|
|
61
|
+
result: content_1.ResponseItemResult.Accepted
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async applyIncomingResponseItem(responseItem, requestItem, _requestInfo) {
|
|
65
|
+
if (!(responseItem instanceof content_1.DeleteAttributeAcceptResponseItem)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const attribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.attributeId);
|
|
69
|
+
if (typeof attribute === "undefined")
|
|
70
|
+
return;
|
|
71
|
+
if (attribute.deletionInfo?.deletionStatus === attributes_1.DeletionStatus.DeletedByPeer)
|
|
72
|
+
return;
|
|
73
|
+
const deletionInfo = attributes_1.LocalAttributeDeletionInfo.from({
|
|
74
|
+
deletionStatus: attributes_1.DeletionStatus.ToBeDeletedByPeer,
|
|
75
|
+
deletionDate: responseItem.deletionDate
|
|
76
|
+
});
|
|
77
|
+
const predecessors = await this.consumptionController.attributes.getPredecessorsOfAttribute(attribute.id);
|
|
78
|
+
for (const attr of [attribute, ...predecessors]) {
|
|
79
|
+
if (attr.deletionInfo?.deletionStatus !== attributes_1.DeletionStatus.DeletedByPeer) {
|
|
80
|
+
attr.setDeletionInfo(deletionInfo, this.accountController.identity.address);
|
|
81
|
+
await this.consumptionController.attributes.updateAttributeUnsafe(attr);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.DeleteAttributeRequestItemProcessor = DeleteAttributeRequestItemProcessor;
|
|
87
|
+
//# sourceMappingURL=DeleteAttributeRequestItemProcessor.js.map
|
|
@@ -0,0 +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;QAEzG,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;YACnC,OAAO,mCAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,kBAAkB,WAAW,CAA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AI,CAAC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;gBAC5E,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC5E,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAhHD,kFAgHC"}
|
package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js
CHANGED
|
@@ -23,6 +23,6 @@ __decorate([
|
|
|
23
23
|
__metadata("design:type", String)
|
|
24
24
|
], AcceptFreeTextRequestItemParameters.prototype, "freeText", void 0);
|
|
25
25
|
exports.AcceptFreeTextRequestItemParameters = AcceptFreeTextRequestItemParameters = __decorate([
|
|
26
|
-
(0, ts_serval_1.type)("
|
|
26
|
+
(0, ts_serval_1.type)("AcceptFreeTextRequestItemParameters")
|
|
27
27
|
], AcceptFreeTextRequestItemParameters);
|
|
28
28
|
//# sourceMappingURL=AcceptFreeTextRequestItemParameters.js.map
|
package/dist/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcceptFreeTextRequestItemParameters.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA6E;AAQtE,IAAM,mCAAmC,GAAzC,MAAM,mCAAoC,SAAQ,wBAAY;IAK1D,MAAM,CAAC,IAAI,CAAC,KAA8C;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACJ,CAAA;AARY,kFAAmC;AAGrC;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;;qEACa;8CAHf,mCAAmC;IAD/C,IAAA,gBAAI,EAAC
|
|
1
|
+
{"version":3,"file":"AcceptFreeTextRequestItemParameters.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/freeText/AcceptFreeTextRequestItemParameters.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA6E;AAQtE,IAAM,mCAAmC,GAAzC,MAAM,mCAAoC,SAAQ,wBAAY;IAK1D,MAAM,CAAC,IAAI,CAAC,KAA8C;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACJ,CAAA;AARY,kFAAmC;AAGrC;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;;qEACa;8CAHf,mCAAmC;IAD/C,IAAA,gBAAI,EAAC,qCAAqC,CAAC;GAC/B,mCAAmC,CAQ/C"}
|
|
@@ -15,7 +15,7 @@ class FreeTextRequestItemProcessor extends GenericRequestItemProcessor_1.Generic
|
|
|
15
15
|
catch (error) {
|
|
16
16
|
if (!(error instanceof ts_serval_1.ParsingError))
|
|
17
17
|
throw error;
|
|
18
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters());
|
|
18
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The RequestItem was answered with incorrect parameters."));
|
|
19
19
|
}
|
|
20
20
|
return ValidationResult_1.ValidationResult.success();
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FreeTextRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,4CAAqG;AACrG,uEAAoE;AACpE,gFAA6E;AAE7E,mEAAgE;AAChE,+FAAqI;AAErI,MAAa,4BAA6B,SAAQ,yDAAyF;IACvH,SAAS,CAAC,YAAiC,EAAE,MAA+C;QACxG,IAAI,CAAC;YACD,yEAAmC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,CAAC,KAAK,YAAY,wBAAY,CAAC;gBAAE,MAAM,KAAK,CAAC;YAElD,OAAO,mCAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,QAAQ,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"FreeTextRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/freeText/FreeTextRequestItemProcessor.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,4CAAqG;AACrG,uEAAoE;AACpE,gFAA6E;AAE7E,mEAAgE;AAChE,+FAAqI;AAErI,MAAa,4BAA6B,SAAQ,yDAAyF;IACvH,SAAS,CAAC,YAAiC,EAAE,MAA+C;QACxG,IAAI,CAAC;YACD,yEAAmC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,CAAC,KAAK,YAAY,wBAAY,CAAC;gBAAE,MAAM,KAAK,CAAC;YAElD,OAAO,mCAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,yDAAyD,CAAC,CAAC,CAAC;QAC1I,CAAC;QAED,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAEe,MAAM,CAAC,YAAiC,EAAE,MAA+C;QACrG,MAAM,YAAY,GAAG,yEAAmC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtE,OAAO,oCAA0B,CAAC,IAAI,CAAC;YACnC,MAAM,EAAE,4BAAkB,CAAC,QAAQ;YACnC,QAAQ,EAAE,YAAY,CAAC,QAAQ;SAClC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,oEAoBC"}
|
|
@@ -53,7 +53,7 @@ class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1
|
|
|
53
53
|
const ownerIsEmpty = attribute.owner.equals("");
|
|
54
54
|
const ownerIsCurrentIdentity = attribute.owner.equals(this.currentIdentityAddress);
|
|
55
55
|
if (!ownerIsEmpty && !ownerIsCurrentIdentity) {
|
|
56
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.
|
|
56
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("The given Attribute belongs to someone else. You can only share own Attributes."));
|
|
57
57
|
}
|
|
58
58
|
return ValidationResult_1.ValidationResult.success();
|
|
59
59
|
}
|