@nmshd/consumption 3.11.0 → 5.0.0-alpha.1
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 +1 -1
- package/dist/consumption/ConsumptionController.js.map +1 -1
- package/dist/consumption/CoreErrors.d.ts +3 -0
- package/dist/consumption/CoreErrors.d.ts.map +1 -1
- package/dist/consumption/CoreErrors.js +9 -0
- package/dist/consumption/CoreErrors.js.map +1 -1
- package/dist/modules/attributes/AttributesController.d.ts.map +1 -1
- package/dist/modules/attributes/AttributesController.js +70 -62
- package/dist/modules/attributes/AttributesController.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.d.ts.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.js +6 -9
- package/dist/modules/attributes/local/LocalAttribute.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttributeShareInfo.d.ts.map +1 -1
- package/dist/modules/attributes/local/LocalAttributeShareInfo.js +3 -4
- package/dist/modules/attributes/local/LocalAttributeShareInfo.js.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.d.ts.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js +4 -5
- package/dist/modules/notifications/itemProcessors/attributeDeleted/OwnSharedAttributeDeletedByOwnerNotificationItemProcessor.js.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.d.ts.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js +3 -4
- package/dist/modules/notifications/itemProcessors/attributeDeleted/PeerSharedAttributeDeletedByPeerNotificationItemProcessor.js.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.d.ts.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js +3 -4
- package/dist/modules/notifications/itemProcessors/attributeDeleted/ThirdPartyOwnedRelationshipAttributeDeletedByPeerNotificationItemProcessor.js.map +1 -1
- package/dist/modules/notifications/itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor.js +2 -2
- package/dist/modules/notifications/itemProcessors/attributeSucceeded/PeerSharedAttributeSucceededNotificationItemProcessor.js.map +1 -1
- package/dist/modules/notifications/local/LocalNotification.js +2 -2
- package/dist/modules/notifications/local/LocalNotification.js.map +1 -1
- package/dist/modules/requests/incoming/IncomingRequestsController.d.ts +4 -1
- package/dist/modules/requests/incoming/IncomingRequestsController.d.ts.map +1 -1
- package/dist/modules/requests/incoming/IncomingRequestsController.js +8 -2
- package/dist/modules/requests/incoming/IncomingRequestsController.js.map +1 -1
- package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.d.ts +3 -3
- package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.d.ts.map +1 -1
- package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.js +1 -1
- package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/decide/DecideRequestItemGroupParameters.js +1 -1
- package/dist/modules/requests/incoming/decide/DecideRequestItemGroupParameters.js.map +1 -1
- package/dist/modules/requests/incoming/decide/DecideRequestItemParameters.js +1 -1
- package/dist/modules/requests/incoming/decide/DecideRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +12 -6
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js +4 -7
- package/dist/modules/requests/itemProcessors/deleteAttribute/DeleteAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js +2 -2
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.d.ts +2 -2
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js +57 -29
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js +2 -2
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts +2 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +81 -21
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.d.ts +1 -1
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js +45 -12
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.d.ts +5 -0
- package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.d.ts.map +1 -0
- package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.js +124 -0
- package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.js.map +1 -0
- package/dist/modules/requests/itemProcessors/utility/validateQuery.d.ts.map +1 -1
- package/dist/modules/requests/itemProcessors/utility/validateQuery.js +0 -3
- package/dist/modules/requests/itemProcessors/utility/validateQuery.js.map +1 -1
- package/dist/modules/requests/local/LocalResponse.d.ts +2 -2
- package/dist/modules/requests/local/LocalResponse.d.ts.map +1 -1
- package/dist/modules/requests/local/LocalResponse.js.map +1 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts +2 -2
- package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts.map +1 -1
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js +17 -9
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
- package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.d.ts +4 -3
- package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.d.ts.map +1 -1
- package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.js +7 -2
- package/dist/modules/requests/outgoing/createAndCompleteFromRelationshipTemplateResponse/CreateAndCompleteOutgoingRequestFromRelationshipTemplateResponseParameters.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcceptReadAttributeRequestItemParameters.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kDAA8F;AAC9F,4CAA4H;AAC5H,gDAA0C;AAC1C,uDAA0C;AAC1C,+EAA4E;AAgBrE,IAAM,wCAAwC,gDAA9C,MAAM,wCAAyC,SAAQ,wBAAY;IAS/D,uBAAuB;QAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"AcceptReadAttributeRequestItemParameters.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kDAA8F;AAC9F,4CAA4H;AAC5H,gDAA0C;AAC1C,uDAA0C;AAC1C,+EAA4E;AAgBrE,IAAM,wCAAwC,gDAA9C,MAAM,wCAAyC,SAAQ,wBAAY;IAS/D,uBAAuB;QAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;IACtC,CAAC;IAEM,kBAAkB;QACrB,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,KAAmD;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAES,MAAM,CAAU,QAAQ,CAAyB,KAAQ;QAC/D,IAAI,CAAC,CAAC,KAAK,YAAY,0CAAwC,CAAC,EAAE,CAAC;YAC/D,MAAM,IAAI,mCAAgB,CAAC,0BAA0B,CAAC,CAAC;QAC3D,CAAC;QAED,IAAI,KAAK,CAAC,mBAAmB,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,IAAI,2BAAe,CACrB,0CAAwC,CAAC,IAAI,EAC7C,IAAA,yBAAM,EAA2C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,EACvE,2BAA2B,IAAA,yBAAM,EAC7B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CACxB,QAAQ,IAAA,yBAAM,EAA2C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAC7F,CAAC;QACN,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACpD,MAAM,IAAI,2BAAe,CACrB,0CAAwC,CAAC,IAAI,EAC7C,IAAA,yBAAM,EAA2C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,EACvE,8BAA8B,IAAA,yBAAM,EAChC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CACxB,OAAO,IAAA,yBAAM,EAA2C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAC5F,CAAC;QACN,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAhDY,4FAAwC;AAG1C;IAFN,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACA,kBAAM;qFAAC;AAI7B;IAFN,IAAA,qBAAS,EAAC,EAAE,UAAU,EAAE,CAAC,2BAAiB,EAAE,+BAAqB,CAAC,EAAE,CAAC;IACrE,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8EACmC;mDAPvD,wCAAwC;IADpD,IAAA,gBAAI,EAAC,0CAA0C,CAAC;GACpC,wCAAwC,CAgDpD"}
|
package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import { LocalRequestInfo } from "../IRequestItemProcessor";
|
|
|
7
7
|
import { AcceptReadAttributeRequestItemParametersJSON } from "./AcceptReadAttributeRequestItemParameters";
|
|
8
8
|
export declare class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor<ReadAttributeRequestItem, AcceptReadAttributeRequestItemParametersJSON> {
|
|
9
9
|
canCreateOutgoingRequestItem(requestItem: ReadAttributeRequestItem, _request: Request, recipient?: CoreAddress): ValidationResult;
|
|
10
|
-
|
|
10
|
+
private validateQuery;
|
|
11
|
+
canAccept(requestItem: ReadAttributeRequestItem, params: AcceptReadAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ValidationResult>;
|
|
11
12
|
accept(_requestItem: ReadAttributeRequestItem, params: AcceptReadAttributeRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ReadAttributeAcceptResponseItem | AttributeSuccessionAcceptResponseItem | AttributeAlreadySharedAcceptResponseItem>;
|
|
12
13
|
private performOwnSharedIdentityAttributeSuccession;
|
|
13
14
|
private performOwnSharedThirdPartyRelationshipAttributeSuccession;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wCAAwC,EACxC,qCAAqC,
|
|
1
|
+
{"version":3,"file":"ReadAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wCAAwC,EACxC,qCAAqC,EAGrC,+BAA+B,EAC/B,wBAAwB,EACxB,kBAAkB,EAIlB,OAAO,EAGV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAA6C,MAAM,kBAAkB,CAAC;AAG1F,OAAO,EAAqD,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAE3H,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAA4C,4CAA4C,EAAE,MAAM,4CAA4C,CAAC;AAEpJ,qBAAa,iCAAkC,SAAQ,2BAA2B,CAAC,wBAAwB,EAAE,4CAA4C,CAAC;IACtI,4BAA4B,CAAC,WAAW,EAAE,wBAAwB,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,gBAAgB;IASjJ,OAAO,CAAC,aAAa;IAiBC,SAAS,CAC3B,WAAW,EAAE,wBAAwB,EACrC,MAAM,EAAE,4CAA4C,EACpD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IA8HN,MAAM,CACxB,YAAY,EAAE,wBAAwB,EACtC,MAAM,EAAE,4CAA4C,EACpD,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,+BAA+B,GAAG,qCAAqC,GAAG,wCAAwC,CAAC;YAiFhH,2CAA2C;YAa3C,yDAAyD;YAazD,qDAAqD;YAarD,kBAAkB;IAoBV,yBAAyB,CAC3C,YAAY,EAAE,+BAA+B,GAAG,qCAAqC,GAAG,wCAAwC,GAAG,kBAAkB,EACrJ,YAAY,EAAE,wBAAwB,EACtC,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,iCAAiC,GAAG,IAAI,CAAC;CAgCvD"}
|
package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js
CHANGED
|
@@ -6,46 +6,99 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ReadAttributeRequestItemProcessor = void 0;
|
|
7
7
|
const content_1 = require("@nmshd/content");
|
|
8
8
|
const transport_1 = require("@nmshd/transport");
|
|
9
|
+
const ts_simple_nameof_1 = require("ts-simple-nameof");
|
|
9
10
|
const CoreErrors_1 = require("../../../../consumption/CoreErrors");
|
|
10
11
|
const attributes_1 = require("../../../attributes");
|
|
11
12
|
const LocalAttribute_1 = require("../../../attributes/local/LocalAttribute");
|
|
12
13
|
const ValidationResult_1 = require("../../../common/ValidationResult");
|
|
13
14
|
const GenericRequestItemProcessor_1 = require("../GenericRequestItemProcessor");
|
|
15
|
+
const validateAttributeMatchesWithQuery_1 = __importDefault(require("../utility/validateAttributeMatchesWithQuery"));
|
|
14
16
|
const validateQuery_1 = __importDefault(require("../utility/validateQuery"));
|
|
15
17
|
const AcceptReadAttributeRequestItemParameters_1 = require("./AcceptReadAttributeRequestItemParameters");
|
|
16
18
|
class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
17
19
|
canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
18
|
-
const queryValidationResult =
|
|
20
|
+
const queryValidationResult = this.validateQuery(requestItem, recipient);
|
|
19
21
|
if (queryValidationResult.isError()) {
|
|
20
22
|
return queryValidationResult;
|
|
21
23
|
}
|
|
22
24
|
return ValidationResult_1.ValidationResult.success();
|
|
23
25
|
}
|
|
24
|
-
|
|
26
|
+
validateQuery(requestItem, recipient) {
|
|
27
|
+
const commonQueryValidationResult = (0, validateQuery_1.default)(requestItem.query, this.currentIdentityAddress, recipient);
|
|
28
|
+
if (commonQueryValidationResult.isError()) {
|
|
29
|
+
return commonQueryValidationResult;
|
|
30
|
+
}
|
|
31
|
+
if (requestItem.query instanceof content_1.RelationshipAttributeQuery && !["", this.currentIdentityAddress.toString()].includes(requestItem.query.owner.toString())) {
|
|
32
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The owner of the given `query` can only be an empty string or yourself. This is because you can only request RelationshipAttributes using a ReadAttributeRequestitem with a RelationshipAttributeQuery where the Recipient of the Request or yourself is the owner. And in order to avoid mistakes, the Recipient automatically will become the owner of the RelationshipAttribute later on if the owner of the `query` is an empty string."));
|
|
33
|
+
}
|
|
34
|
+
return ValidationResult_1.ValidationResult.success();
|
|
35
|
+
}
|
|
36
|
+
async canAccept(requestItem, params, requestInfo) {
|
|
25
37
|
const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
|
|
38
|
+
let attribute;
|
|
26
39
|
if (parsedParams.isWithExistingAttribute()) {
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
if (requestItem.query instanceof content_1.RelationshipAttributeQuery) {
|
|
41
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("When responding to a RelationshipAttributeQuery, only new RelationshipAttributes may be provided."));
|
|
42
|
+
}
|
|
43
|
+
const foundLocalAttribute = await this.consumptionController.attributes.getLocalAttribute(parsedParams.existingAttributeId);
|
|
44
|
+
if (!foundLocalAttribute) {
|
|
29
45
|
return ValidationResult_1.ValidationResult.error(transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, requestInfo.id.toString()));
|
|
30
46
|
}
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
|
|
47
|
+
attribute = foundLocalAttribute.content;
|
|
48
|
+
if (requestItem.query instanceof content_1.IdentityAttributeQuery && attribute instanceof content_1.IdentityAttribute && this.accountController.identity.isMe(attribute.owner)) {
|
|
49
|
+
if (foundLocalAttribute.isShared()) {
|
|
50
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided IdentityAttribute is a shared copy of a RepositoryAttribute. You can only share RepositoryAttributes."));
|
|
51
|
+
}
|
|
52
|
+
const ownSharedIdentityAttributeSuccessors = await this.consumptionController.attributes.getSharedSuccessorsOfAttribute(foundLocalAttribute, {
|
|
53
|
+
"shareInfo.peer": requestInfo.peer.toString()
|
|
54
|
+
});
|
|
55
|
+
if (ownSharedIdentityAttributeSuccessors.length > 0) {
|
|
56
|
+
if (!ownSharedIdentityAttributeSuccessors[0].shareInfo?.sourceAttribute) {
|
|
57
|
+
throw new Error(`The LocalAttribute ${ownSharedIdentityAttributeSuccessors[0].id} does not have a 'shareInfo.sourceAttribute', even though it was found as a shared version of a LocalAttribute.`);
|
|
58
|
+
}
|
|
59
|
+
const successorSourceRepositoryAttribute = await this.consumptionController.attributes.getLocalAttribute(ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute);
|
|
60
|
+
if (!successorSourceRepositoryAttribute) {
|
|
61
|
+
throw new Error(`The RepositoryAttribute ${ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute} was not found.`);
|
|
62
|
+
}
|
|
63
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch(`The provided IdentityAttribute is outdated. You have already shared the successor '${ownSharedIdentityAttributeSuccessors[0].shareInfo.sourceAttribute}' of it.`));
|
|
64
|
+
}
|
|
34
65
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
throw new Error(`The Attribute ${latestSharedVersion[0].id} doesn't have a 'shareInfo.sourceAttribute', even though it was found as shared version of an Attribute.`);
|
|
66
|
+
if (requestItem.query instanceof content_1.ThirdPartyRelationshipAttributeQuery && attribute instanceof content_1.RelationshipAttribute) {
|
|
67
|
+
if (!foundLocalAttribute.isShared()) {
|
|
68
|
+
throw new Error("The LocalAttribute found is faulty because its shareInfo is undefined, although its content is given by a RelationshipAttribute. Since RelationshipAttributes only make sense in the context of Relationships, they must always be shared.");
|
|
39
69
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
throw new Error(`The Attribute ${latestSharedVersion[0].shareInfo.sourceAttribute} was not found.`);
|
|
70
|
+
if (typeof foundLocalAttribute.shareInfo.sourceAttribute !== "undefined") {
|
|
71
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("When responding to a ThirdPartyRelationshipAttributeQuery, only RelationshipAttributes that are not a copy of a sourceAttribute may be provided."));
|
|
43
72
|
}
|
|
44
|
-
|
|
45
|
-
|
|
73
|
+
const queriedThirdParties = requestItem.query.thirdParty.map((aThirdParty) => aThirdParty.toString());
|
|
74
|
+
if ((this.accountController.identity.isMe(attribute.owner) || queriedThirdParties.includes(attribute.owner.toString())) &&
|
|
75
|
+
!queriedThirdParties.includes("") &&
|
|
76
|
+
!queriedThirdParties.includes(foundLocalAttribute.shareInfo.peer.toString())) {
|
|
77
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute exists in the context of a Relationship with a third party that should not be involved."));
|
|
46
78
|
}
|
|
47
79
|
}
|
|
48
80
|
}
|
|
81
|
+
else if (parsedParams.isWithNewAttribute()) {
|
|
82
|
+
if (requestItem.query instanceof content_1.ThirdPartyRelationshipAttributeQuery) {
|
|
83
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters("When responding to a ThirdPartyRelationshipAttributeQuery, only RelationshipAttributes that already exist may be provided."));
|
|
84
|
+
}
|
|
85
|
+
attribute = parsedParams.newAttribute;
|
|
86
|
+
const ownerIsEmpty = attribute.owner.equals("");
|
|
87
|
+
if (ownerIsEmpty) {
|
|
88
|
+
attribute.owner = this.currentIdentityAddress;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (typeof attribute === "undefined") {
|
|
92
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidAcceptParameters(`You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.newAttribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.existingAttributeId)}.`));
|
|
93
|
+
}
|
|
94
|
+
const answerToQueryValidationResult = (0, validateAttributeMatchesWithQuery_1.default)(requestItem.query, attribute, this.currentIdentityAddress, requestInfo.peer);
|
|
95
|
+
if (answerToQueryValidationResult.isError())
|
|
96
|
+
return answerToQueryValidationResult;
|
|
97
|
+
if (requestItem.query instanceof content_1.ThirdPartyRelationshipAttributeQuery &&
|
|
98
|
+
attribute instanceof content_1.RelationshipAttribute &&
|
|
99
|
+
attribute.confidentiality === content_1.RelationshipAttributeConfidentiality.Private) {
|
|
100
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The confidentiality of the provided RelationshipAttribute is private. Therefore you are not allowed to share it."));
|
|
101
|
+
}
|
|
49
102
|
return ValidationResult_1.ValidationResult.success();
|
|
50
103
|
}
|
|
51
104
|
async accept(_requestItem, params, requestInfo) {
|
|
@@ -53,7 +106,7 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
|
|
|
53
106
|
let sharedLocalAttribute;
|
|
54
107
|
if (parsedParams.isWithExistingAttribute()) {
|
|
55
108
|
const existingSourceAttribute = await this.consumptionController.attributes.getLocalAttribute(parsedParams.existingAttributeId);
|
|
56
|
-
if (
|
|
109
|
+
if (!existingSourceAttribute) {
|
|
57
110
|
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, parsedParams.existingAttributeId.toString());
|
|
58
111
|
}
|
|
59
112
|
const latestSharedVersion = await this.consumptionController.attributes.getSharedVersionsOfAttribute(parsedParams.existingAttributeId, [requestInfo.peer], true);
|
|
@@ -70,7 +123,7 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
|
|
|
70
123
|
});
|
|
71
124
|
}
|
|
72
125
|
const latestSharedAttribute = latestSharedVersion[0];
|
|
73
|
-
if (
|
|
126
|
+
if (!latestSharedAttribute.shareInfo?.sourceAttribute) {
|
|
74
127
|
throw new Error(`The Attribute ${latestSharedAttribute.id} doesn't have a 'shareInfo.sourceAttribute', even though it was found as shared version of an Attribute.`);
|
|
75
128
|
}
|
|
76
129
|
if (latestSharedAttribute.shareInfo.sourceAttribute.toString() === existingSourceAttribute.id.toString()) {
|
|
@@ -80,9 +133,8 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
|
|
|
80
133
|
});
|
|
81
134
|
}
|
|
82
135
|
const predecessorSourceAttribute = await this.consumptionController.attributes.getLocalAttribute(latestSharedAttribute.shareInfo.sourceAttribute);
|
|
83
|
-
if (
|
|
136
|
+
if (!predecessorSourceAttribute)
|
|
84
137
|
throw transport_1.CoreErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, latestSharedAttribute.shareInfo.sourceAttribute.toString());
|
|
85
|
-
}
|
|
86
138
|
if (await this.consumptionController.attributes.isSubsequentInSuccession(predecessorSourceAttribute, existingSourceAttribute)) {
|
|
87
139
|
let successorSharedAttribute;
|
|
88
140
|
if (existingSourceAttribute.isRepositoryAttribute(this.currentIdentityAddress)) {
|
|
@@ -102,7 +154,15 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
|
|
|
102
154
|
});
|
|
103
155
|
}
|
|
104
156
|
}
|
|
105
|
-
|
|
157
|
+
else if (parsedParams.isWithNewAttribute()) {
|
|
158
|
+
if (parsedParams.newAttribute.owner.equals("")) {
|
|
159
|
+
parsedParams.newAttribute.owner = this.currentIdentityAddress;
|
|
160
|
+
}
|
|
161
|
+
sharedLocalAttribute = await this.createNewAttribute(parsedParams.newAttribute, requestInfo);
|
|
162
|
+
}
|
|
163
|
+
if (!sharedLocalAttribute) {
|
|
164
|
+
throw new Error(`You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.newAttribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.existingAttributeId)}.`);
|
|
165
|
+
}
|
|
106
166
|
return content_1.ReadAttributeAcceptResponseItem.from({
|
|
107
167
|
result: content_1.ResponseItemResult.Accepted,
|
|
108
168
|
attributeId: sharedLocalAttribute.id,
|
package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;;;;AAAA,4CAUwB;AACxB,gDAA0F;AAC1F,mEAAgE;AAChE,oDAA2H;AAC3H,6EAA0E;AAC1E,uEAAoE;AACpE,gFAA6E;AAE7E,6EAAqD;AACrD,yGAAoJ;AAEpJ,MAAa,iCAAkC,SAAQ,yDAAmG;IACtI,4BAA4B,CAAC,WAAqC,EAAE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AQ,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;YACjH,CAAC;iBAAM,IAAI,YAAY,CAAC,gBAAgB,CAAC,KAAK,KAAK,WAAW,CAAC,IAAI,EAAE,CAAC;gBAClE,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,sCAAsC,CAAC,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YACpI,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,2CAA2C,CAAC,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YACzI,CAAC;QACL,CAAC;QAED,OAAO;IACX,CAAC;CACJ;AA5ND,8EA4NC"}
|
|
1
|
+
{"version":3,"file":"ReadAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;;;;AAAA,4CAcwB;AACxB,gDAA0F;AAC1F,uDAA0C;AAC1C,mEAAgE;AAChE,oDAA2H;AAC3H,6EAA0E;AAC1E,uEAAoE;AACpE,gFAA6E;AAE7E,qHAA6F;AAC7F,6EAAqD;AACrD,yGAAoJ;AAEpJ,MAAa,iCAAkC,SAAQ,yDAAmG;IACtI,4BAA4B,CAAC,WAAqC,EAAE,QAAiB,EAAE,SAAuB;QAC1H,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACzE,IAAI,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC;YAClC,OAAO,qBAAqB,CAAC;QACjC,CAAC;QAED,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAEO,aAAa,CAAC,WAAqC,EAAE,SAAuB;QAChF,MAAM,2BAA2B,GAAG,IAAA,uBAAa,EAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC;QAC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AAI,YAAY,YAAY,+CAAqC,EAAE,CAAC;YAChE,MAAM,eAAe,GAAG,qCAAwB,CAAC,IAAI,CAAC;gBAClD,EAAE,EAAE,YAAY,CAAC,WAAW;gBAC5B,OAAO,EAAE,YAAY,CAAC,gBAAgB;gBACtC,SAAS,EAAE,oCAAuB,CAAC,IAAI,CAAC;oBACpC,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,gBAAgB,EAAE,WAAW,CAAC,EAAE;iBACnC,CAAC;aACL,CAAC,CAAC;YAEH,IAAI,YAAY,CAAC,gBAAgB,YAAY,2BAAiB,EAAE,CAAC;gBAC7D,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,kCAAkC,CAAC,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;gBAC/J,OAAO,IAAI,8CAAiC,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;YACjH,CAAC;iBAAM,IAAI,YAAY,CAAC,gBAAgB,CAAC,KAAK,KAAK,WAAW,CAAC,IAAI,EAAE,CAAC;gBAClE,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,sCAAsC,CAAC,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YACpI,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,2CAA2C,CAAC,YAAY,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;YACzI,CAAC;QACL,CAAC;QAED,OAAO;IACX,CAAC;CACJ;AAjVD,8EAiVC"}
|
package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { LocalRequestInfo } from "../IRequestItemProcessor";
|
|
|
7
7
|
export declare class ShareAttributeRequestItemProcessor extends GenericRequestItemProcessor<ShareAttributeRequestItem> {
|
|
8
8
|
canCreateOutgoingRequestItem(requestItem: ShareAttributeRequestItem, _request: Request, recipient?: CoreAddress): Promise<ValidationResult>;
|
|
9
9
|
private canCreateWithIdentityAttribute;
|
|
10
|
-
private canCreateWithRelationshipAttribute;
|
|
10
|
+
private static canCreateWithRelationshipAttribute;
|
|
11
11
|
accept(requestItem: ShareAttributeRequestItem, _params: AcceptRequestItemParametersJSON, requestInfo: LocalRequestInfo): Promise<ShareAttributeAcceptResponseItem>;
|
|
12
12
|
applyIncomingResponseItem(responseItem: ShareAttributeAcceptResponseItem | RejectResponseItem, requestItem: ShareAttributeRequestItem, requestInfo: LocalRequestInfo): Promise<void>;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,kBAAkB,EAGlB,OAAO,EAEP,gCAAgC,EAChC,yBAAyB,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,qBAAa,kCAAmC,SAAQ,2BAA2B,CAAC,yBAAyB,CAAC;IACpF,4BAA4B,CAAC,WAAW,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ShareAttributeRequestItemProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,kBAAkB,EAGlB,OAAO,EAEP,gCAAgC,EAChC,yBAAyB,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,qBAAa,kCAAmC,SAAQ,2BAA2B,CAAC,yBAAyB,CAAC;IACpF,4BAA4B,CAAC,WAAW,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA2FjK,OAAO,CAAC,8BAA8B;IAWtC,OAAO,CAAC,MAAM,CAAC,kCAAkC;IAc3B,MAAM,CACxB,WAAW,EAAE,yBAAyB,EACtC,OAAO,EAAE,+BAA+B,EACxC,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,gCAAgC,CAAC;IAiBtB,yBAAyB,CAC3C,YAAY,EAAE,gCAAgC,GAAG,kBAAkB,EACnE,WAAW,EAAE,yBAAyB,EACtC,WAAW,EAAE,gBAAgB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAYnB"}
|
package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js
CHANGED
|
@@ -11,37 +11,70 @@ const ValidationResult_1 = require("../../../common/ValidationResult");
|
|
|
11
11
|
const GenericRequestItemProcessor_1 = require("../GenericRequestItemProcessor");
|
|
12
12
|
class ShareAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
13
13
|
async canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
14
|
+
const foundAttribute = await this.consumptionController.attributes.getLocalAttribute(requestItem.sourceAttributeId);
|
|
15
|
+
if (typeof foundAttribute === "undefined") {
|
|
16
16
|
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The Attribute with the given sourceAttributeId '${requestItem.sourceAttributeId.toString()}' could not be found.`));
|
|
17
17
|
}
|
|
18
18
|
const requestItemAttributeJSON = requestItem.attribute.toJSON();
|
|
19
19
|
if (requestItemAttributeJSON.owner === "") {
|
|
20
20
|
requestItemAttributeJSON.owner = this.currentIdentityAddress.toString();
|
|
21
21
|
}
|
|
22
|
-
if (!lodash_1.default.isEqual(
|
|
23
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The Attribute with the given sourceAttributeId '${requestItem.sourceAttributeId.toString()}' does not match the given
|
|
22
|
+
if (!lodash_1.default.isEqual(foundAttribute.content.toJSON(), requestItemAttributeJSON)) {
|
|
23
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The Attribute with the given sourceAttributeId '${requestItem.sourceAttributeId.toString()}' does not match the given Attribute.`));
|
|
24
|
+
}
|
|
25
|
+
if (requestItem.attribute instanceof content_1.IdentityAttribute && this.accountController.identity.isMe(requestItem.attribute.owner)) {
|
|
26
|
+
if (foundAttribute.isShared()) {
|
|
27
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The provided IdentityAttribute is a shared copy of a RepositoryAttribute. You can only share RepositoryAttributes."));
|
|
28
|
+
}
|
|
29
|
+
if (typeof recipient !== "undefined") {
|
|
30
|
+
const query = { "shareInfo.sourceAttribute": requestItem.sourceAttributeId.toString(), "shareInfo.peer": recipient.toString() };
|
|
31
|
+
if ((await this.consumptionController.attributes.getLocalAttributes(query)).length > 0) {
|
|
32
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The IdentityAttribute with the given sourceAttributeId '${requestItem.sourceAttributeId.toString()}' has already been shared with the peer.`));
|
|
33
|
+
}
|
|
34
|
+
const ownSharedIdentityAttributeSuccessors = await this.consumptionController.attributes.getSharedSuccessorsOfAttribute(foundAttribute, {
|
|
35
|
+
"shareInfo.peer": recipient.toString()
|
|
36
|
+
});
|
|
37
|
+
if (ownSharedIdentityAttributeSuccessors.length > 0) {
|
|
38
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`The provided IdentityAttribute is outdated. You have already shared the successor '${ownSharedIdentityAttributeSuccessors[0].shareInfo?.sourceAttribute}' of it.`));
|
|
39
|
+
}
|
|
40
|
+
const ownSharedIdentityAttributePredecessors = await this.consumptionController.attributes.getSharedPredecessorsOfAttribute(foundAttribute, {
|
|
41
|
+
"shareInfo.peer": recipient.toString()
|
|
42
|
+
});
|
|
43
|
+
if (ownSharedIdentityAttributePredecessors.length > 0) {
|
|
44
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem(`You have already shared the predecessor '${ownSharedIdentityAttributePredecessors[0].shareInfo?.sourceAttribute}' of the IdentityAttribute. Instead of sharing it, you should notify the peer about the Attribute succession.`));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (requestItem.attribute instanceof content_1.RelationshipAttribute) {
|
|
49
|
+
if (!foundAttribute.isShared()) {
|
|
50
|
+
throw new Error("The LocalAttribute found is faulty because its shareInfo is undefined, although its content is given by a RelationshipAttribute. Since RelationshipAttributes only make sense in the context of Relationships, they must always be shared.");
|
|
51
|
+
}
|
|
52
|
+
if (typeof foundAttribute.shareInfo.sourceAttribute !== "undefined") {
|
|
53
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("You can only share RelationshipAttributes that are not a copy of a sourceAttribute."));
|
|
54
|
+
}
|
|
55
|
+
if (typeof recipient !== "undefined" && foundAttribute.shareInfo.peer.equals(recipient)) {
|
|
56
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The provided RelationshipAttribute already exists in the context of the Relationship with the peer."));
|
|
57
|
+
}
|
|
24
58
|
}
|
|
25
59
|
if (requestItem.attribute instanceof content_1.IdentityAttribute) {
|
|
26
60
|
return this.canCreateWithIdentityAttribute(requestItem);
|
|
27
61
|
}
|
|
28
|
-
return
|
|
62
|
+
return ShareAttributeRequestItemProcessor.canCreateWithRelationshipAttribute(requestItem.attribute, recipient);
|
|
29
63
|
}
|
|
30
64
|
canCreateWithIdentityAttribute(requestItem) {
|
|
31
|
-
const ownerIsEmpty = requestItem.attribute.owner.toString() === "";
|
|
32
65
|
const ownerIsCurrentIdentity = requestItem.attribute.owner.equals(this.currentIdentityAddress);
|
|
33
|
-
if (!
|
|
34
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The
|
|
66
|
+
if (!ownerIsCurrentIdentity) {
|
|
67
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The provided IdentityAttribute belongs to someone else. You can only share own IdentityAttributes."));
|
|
35
68
|
}
|
|
36
69
|
return ValidationResult_1.ValidationResult.success();
|
|
37
70
|
}
|
|
38
|
-
canCreateWithRelationshipAttribute(attribute, recipient) {
|
|
39
|
-
if (attribute.confidentiality === content_1.RelationshipAttributeConfidentiality.Private) {
|
|
40
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The confidentiality of the given `attribute` is private. Therefore you are not allowed to share it."));
|
|
41
|
-
}
|
|
71
|
+
static canCreateWithRelationshipAttribute(attribute, recipient) {
|
|
42
72
|
if (attribute.owner.equals(recipient)) {
|
|
43
73
|
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("It doesn't make sense to share a RelationshipAttribute with its owner."));
|
|
44
74
|
}
|
|
75
|
+
if (attribute.confidentiality === content_1.RelationshipAttributeConfidentiality.Private) {
|
|
76
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("The confidentiality of the given `attribute` is private. Therefore you are not allowed to share it."));
|
|
77
|
+
}
|
|
45
78
|
return ValidationResult_1.ValidationResult.success();
|
|
46
79
|
}
|
|
47
80
|
async accept(requestItem, _params, requestInfo) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;;;;AAAA,4CASwB;AAExB,oDAAuB;AACvB,mEAAgE;AAChE,uEAAoE;AAEpE,gFAA6E;AAG7E,MAAa,kCAAmC,SAAQ,yDAAsD;IAC1F,KAAK,CAAC,4BAA4B,CAAC,WAAsC,EAAE,QAAiB,EAAE,SAAuB;QACjI,MAAM,
|
|
1
|
+
{"version":3,"file":"ShareAttributeRequestItemProcessor.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.ts"],"names":[],"mappings":";;;;;;AAAA,4CASwB;AAExB,oDAAuB;AACvB,mEAAgE;AAChE,uEAAoE;AAEpE,gFAA6E;AAG7E,MAAa,kCAAmC,SAAQ,yDAAsD;IAC1F,KAAK,CAAC,4BAA4B,CAAC,WAAsC,EAAE,QAAiB,EAAE,SAAuB;QACjI,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,iBAAiB,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAEpH,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;YACxC,OAAO,mCAAgB,CAAC,KAAK,CACzB,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,mDAAmD,WAAW,CAAC,iBAAiB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shipAttribute, RelationshipAttributeQuery, ThirdPartyRelationshipAttributeQuery } from "@nmshd/content";
|
|
2
|
+
import { CoreAddress } from "@nmshd/transport";
|
|
3
|
+
import { ValidationResult } from "../../../common/ValidationResult";
|
|
4
|
+
export default function validateAttributeMatchesWithQuery(query: IdentityAttributeQuery | IQLQuery | RelationshipAttributeQuery | ThirdPartyRelationshipAttributeQuery, attribute: IdentityAttribute | RelationshipAttribute, recipient: CoreAddress, sender: CoreAddress): ValidationResult;
|
|
5
|
+
//# sourceMappingURL=validateAttributeMatchesWithQuery.d.ts.map
|
package/dist/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateAttributeMatchesWithQuery.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,iBAAiB,EACjB,sBAAsB,EACtB,QAAQ,EACR,qBAAqB,EACrB,0BAA0B,EAC1B,oCAAoC,EACvC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,iCAAiC,CACrD,KAAK,EAAE,sBAAsB,GAAG,QAAQ,GAAG,0BAA0B,GAAG,oCAAoC,EAC5G,SAAS,EAAE,iBAAiB,GAAG,qBAAqB,EACpD,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,WAAW,GACpB,gBAAgB,CAsClB"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const content_1 = require("@nmshd/content");
|
|
4
|
+
const CoreErrors_1 = require("../../../../consumption/CoreErrors");
|
|
5
|
+
const ValidationResult_1 = require("../../../common/ValidationResult");
|
|
6
|
+
function validateAttributeMatchesWithQuery(query, attribute, recipient, sender) {
|
|
7
|
+
if (query instanceof content_1.IdentityAttributeQuery) {
|
|
8
|
+
const result = validateAttributeMatchesWithIdentityAttributeQuery(query, attribute, recipient);
|
|
9
|
+
if (result.isError())
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
else if (query instanceof content_1.IQLQuery) {
|
|
13
|
+
const result = validateAttributeMatchesWithIQLQuery(query, attribute, recipient);
|
|
14
|
+
if (result.isError())
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
else if (query instanceof content_1.RelationshipAttributeQuery) {
|
|
18
|
+
const result = validateAttributeMatchesWithRelationshipAttributeQuery(query, attribute, recipient);
|
|
19
|
+
if (result.isError())
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
else if (query instanceof content_1.ThirdPartyRelationshipAttributeQuery) {
|
|
23
|
+
const result = validateAttributeMatchesWithThirdPartyRelationshipAttributeQuery(query, attribute, recipient, sender);
|
|
24
|
+
if (result.isError())
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.unexpectedErrorDuringRequestItemProcessing("The query is not of a known type. Only the IdentityAttributeQuery, IQLQuery, RelationshipAttributeQuery or ThirdPartyRelationshipAttributeQuery can be used."));
|
|
29
|
+
}
|
|
30
|
+
if (query instanceof content_1.IdentityAttributeQuery || query instanceof content_1.RelationshipAttributeQuery || query instanceof content_1.ThirdPartyRelationshipAttributeQuery) {
|
|
31
|
+
if ((typeof query.validFrom === "undefined" && typeof attribute.validFrom !== "undefined") ||
|
|
32
|
+
(typeof query.validFrom !== "undefined" && typeof attribute.validFrom !== "undefined" && query.validFrom.isBefore(attribute.validFrom))) {
|
|
33
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided Attribute is not valid in the queried time frame."));
|
|
34
|
+
}
|
|
35
|
+
if ((typeof query.validTo === "undefined" && typeof attribute.validTo !== "undefined") ||
|
|
36
|
+
(typeof query.validTo !== "undefined" && typeof attribute.validTo !== "undefined" && query.validTo.isAfter(attribute.validTo))) {
|
|
37
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided Attribute is not valid in the queried time frame."));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return ValidationResult_1.ValidationResult.success();
|
|
41
|
+
}
|
|
42
|
+
exports.default = validateAttributeMatchesWithQuery;
|
|
43
|
+
function validateAttributeMatchesWithIdentityAttributeQuery(query, attribute, recipient) {
|
|
44
|
+
if (!(attribute instanceof content_1.IdentityAttribute)) {
|
|
45
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided Attribute is not an IdentityAttribute, but an IdentityAttribute was queried."));
|
|
46
|
+
}
|
|
47
|
+
const recipientIsAttributeOwner = recipient.equals(attribute.owner);
|
|
48
|
+
if (!recipientIsAttributeOwner) {
|
|
49
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided IdentityAttribute belongs to someone else. You can only share own IdentityAttributes."));
|
|
50
|
+
}
|
|
51
|
+
if (query.valueType !== attribute.value.constructor.name) {
|
|
52
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided IdentityAttribute is not of the queried IdentityAttribute value type."));
|
|
53
|
+
}
|
|
54
|
+
if (typeof query.tags !== "undefined" && query.tags.length !== 0) {
|
|
55
|
+
if (attribute.tags === undefined || attribute.tags.length === 0 || !query.tags.some((aQueriedTag) => attribute.tags.includes(aQueriedTag))) {
|
|
56
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The tags of the provided IdentityAttribute do not contain at least one queried tag."));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return ValidationResult_1.ValidationResult.success();
|
|
60
|
+
}
|
|
61
|
+
function validateAttributeMatchesWithIQLQuery(query, attribute, recipient) {
|
|
62
|
+
if (!(attribute instanceof content_1.IdentityAttribute)) {
|
|
63
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided Attribute is not an IdentityAttribute. Currently, only IdentityAttributes can be queried by an IQLQuery."));
|
|
64
|
+
}
|
|
65
|
+
const recipientIsAttributeOwner = recipient.equals(attribute.owner);
|
|
66
|
+
if (!recipientIsAttributeOwner) {
|
|
67
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided IdentityAttribute belongs to someone else. You can only share own IdentityAttributes."));
|
|
68
|
+
}
|
|
69
|
+
return ValidationResult_1.ValidationResult.success();
|
|
70
|
+
}
|
|
71
|
+
function validateAttributeMatchesWithRelationshipAttributeQuery(query, attribute, recipient) {
|
|
72
|
+
if (!(attribute instanceof content_1.RelationshipAttribute)) {
|
|
73
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided Attribute is not a RelationshipAttribute, but a RelationshipAttribute was queried."));
|
|
74
|
+
}
|
|
75
|
+
const recipientIsAttributeOwner = recipient.equals(attribute.owner);
|
|
76
|
+
const queriedOwnerIsEmpty = query.owner.equals("");
|
|
77
|
+
if (!queriedOwnerIsEmpty && !query.owner.equals(attribute.owner)) {
|
|
78
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute does not belong to the queried owner."));
|
|
79
|
+
}
|
|
80
|
+
if (queriedOwnerIsEmpty && !recipientIsAttributeOwner) {
|
|
81
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("You are not the owner of the provided RelationshipAttribute, but an empty string was specified for the owner of the query."));
|
|
82
|
+
}
|
|
83
|
+
if (query.key !== attribute.key) {
|
|
84
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute does not have the queried key."));
|
|
85
|
+
}
|
|
86
|
+
if (query.attributeCreationHints.confidentiality !== attribute.confidentiality) {
|
|
87
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute does not have the queried confidentiality."));
|
|
88
|
+
}
|
|
89
|
+
if (query.attributeCreationHints.valueType !== attribute.value.constructor.name) {
|
|
90
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute is not of the queried RelationshipAttribute value type."));
|
|
91
|
+
}
|
|
92
|
+
if (!(attribute.value instanceof content_1.Consent)) {
|
|
93
|
+
if (query.attributeCreationHints.title !== attribute.value.title) {
|
|
94
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute does not have the queried title."));
|
|
95
|
+
}
|
|
96
|
+
if (query.attributeCreationHints.description !== attribute.value.description) {
|
|
97
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute does not have the queried description."));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return ValidationResult_1.ValidationResult.success();
|
|
101
|
+
}
|
|
102
|
+
function validateAttributeMatchesWithThirdPartyRelationshipAttributeQuery(query, attribute, recipient, sender) {
|
|
103
|
+
if (!(attribute instanceof content_1.RelationshipAttribute)) {
|
|
104
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided Attribute is not a RelationshipAttribute, but a RelationshipAttribute was queried."));
|
|
105
|
+
}
|
|
106
|
+
const recipientIsAttributeOwner = recipient.equals(attribute.owner);
|
|
107
|
+
const senderIsAttributeOwner = sender.equals(attribute.owner);
|
|
108
|
+
const queriedThirdParties = query.thirdParty.map((aThirdParty) => aThirdParty.toString());
|
|
109
|
+
if (senderIsAttributeOwner ||
|
|
110
|
+
(query.owner === "recipient" && !recipientIsAttributeOwner) ||
|
|
111
|
+
(query.owner === "thirdParty" &&
|
|
112
|
+
!queriedThirdParties.includes(attribute.owner.toString()) &&
|
|
113
|
+
(!queriedThirdParties.includes("") || (recipientIsAttributeOwner && !queriedThirdParties.includes(recipient.toString()))))) {
|
|
114
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute does not belong to a queried owner."));
|
|
115
|
+
}
|
|
116
|
+
if (query.owner === "" && !recipientIsAttributeOwner && !queriedThirdParties.includes("") && !queriedThirdParties.includes(attribute.owner.toString())) {
|
|
117
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("Neither you nor one of the involved third parties is the owner of the provided RelationshipAttribute, but an empty string was specified for the owner of the query."));
|
|
118
|
+
}
|
|
119
|
+
if (query.key !== attribute.key) {
|
|
120
|
+
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.attributeQueryMismatch("The provided RelationshipAttribute does not have the queried key."));
|
|
121
|
+
}
|
|
122
|
+
return ValidationResult_1.ValidationResult.success();
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=validateAttributeMatchesWithQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateAttributeMatchesWithQuery.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/utility/validateAttributeMatchesWithQuery.ts"],"names":[],"mappings":";;AAAA,4CAQwB;AAExB,mEAAgE;AAChE,uEAAoE;AAEpE,SAAwB,iCAAiC,CACrD,KAA4G,EAC5G,SAAoD,EACpD,SAAsB,EACtB,MAAmB;IAEnB,IAAI,KAAK,YAAY,gCAAsB,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,kDAAkD,CAAC,KAAK,EAA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AAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,aAAa,CACjC,KAAK,EAAE,sBAAsB,GAAG,0BAA0B,GAAG,oCAAoC,GAAG,QAAQ,EAC5G,MAAM,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,WAAW,GACxB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"validateQuery.d.ts","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/utility/validateQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,0BAA0B,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AAEpI,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,aAAa,CACjC,KAAK,EAAE,sBAAsB,GAAG,0BAA0B,GAAG,oCAAoC,GAAG,QAAQ,EAC5G,MAAM,EAAE,WAAW,EACnB,SAAS,CAAC,EAAE,WAAW,GACxB,gBAAgB,CAclB"}
|
|
@@ -11,9 +11,6 @@ function validateQuery(query, sender, recipient) {
|
|
|
11
11
|
if (result.isError())
|
|
12
12
|
return result;
|
|
13
13
|
}
|
|
14
|
-
if (query.owner.equals(sender)) {
|
|
15
|
-
return ValidationResult_1.ValidationResult.error(CoreErrors_1.CoreErrors.requests.invalidRequestItem("Cannot query own Attributes from a third party."));
|
|
16
|
-
}
|
|
17
14
|
}
|
|
18
15
|
else if (query instanceof content_1.IQLQuery) {
|
|
19
16
|
const validationResult = (0, iql_1.validate)(query.queryString);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateQuery.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/utility/validateQuery.ts"],"names":[],"mappings":";;AAAA,4CAAoI;AACpI,oCAAqD;AAErD,mEAAgE;AAChE,uEAAoE;AAEpE,SAAwB,aAAa,CACjC,KAA4G,EAC5G,MAAmB,EACnB,SAAuB;IAEvB,IAAI,KAAK,YAAY,8CAAoC,EAAE,CAAC;QACxD,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;YACjE,IAAI,MAAM,CAAC,OAAO,EAAE;gBAAE,OAAO,MAAM,CAAC;QACxC,CAAC;
|
|
1
|
+
{"version":3,"file":"validateQuery.js","sourceRoot":"","sources":["../../../../../src/modules/requests/itemProcessors/utility/validateQuery.ts"],"names":[],"mappings":";;AAAA,4CAAoI;AACpI,oCAAqD;AAErD,mEAAgE;AAChE,uEAAoE;AAEpE,SAAwB,aAAa,CACjC,KAA4G,EAC5G,MAAmB,EACnB,SAAuB;IAEvB,IAAI,KAAK,YAAY,8CAAoC,EAAE,CAAC;QACxD,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;YACjE,IAAI,MAAM,CAAC,OAAO,EAAE;gBAAE,OAAO,MAAM,CAAC;QACxC,CAAC;IACL,CAAC;SAAM,IAAI,KAAK,YAAY,kBAAQ,EAAE,CAAC;QACnC,MAAM,gBAAgB,GAAG,IAAA,cAAW,EAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACxD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC5B,OAAO,mCAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,uCAAuC,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACjK,CAAC;IACL,CAAC;IAED,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC;AAlBD,gCAkBC;AAED,SAAS,kBAAkB,CAAC,UAAuB,EAAE,MAAmB,EAAE,SAAuB;IAC7F,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,mCAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,gEAAgE,CAAC,CAAC,CAAC;IAC5I,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,mCAAgB,CAAC,KAAK,CAAC,uBAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,wEAAwE,CAAC,CAAC,CAAC;IACpJ,CAAC;IAED,OAAO,mCAAgB,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IResponse, Response } from "@nmshd/content";
|
|
2
2
|
import { CoreDate, CoreId, CoreSerializable, ICoreDate, ICoreId, ICoreSerializable } from "@nmshd/transport";
|
|
3
3
|
export interface ILocalResponseSource extends ICoreSerializable {
|
|
4
|
-
type: "Message" | "
|
|
4
|
+
type: "Message" | "Relationship";
|
|
5
5
|
reference: ICoreId;
|
|
6
6
|
}
|
|
7
7
|
export declare class LocalResponseSource extends CoreSerializable implements ILocalResponseSource {
|
|
8
|
-
type: "Message" | "
|
|
8
|
+
type: "Message" | "Relationship";
|
|
9
9
|
reference: CoreId;
|
|
10
10
|
static from(value: ILocalResponseSource): LocalResponseSource;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalResponse.d.ts","sourceRoot":"","sources":["../../../../src/modules/requests/local/LocalResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE7G,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC3D,IAAI,EAAE,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"LocalResponse.d.ts","sourceRoot":"","sources":["../../../../src/modules/requests/local/LocalResponse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE7G,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC3D,IAAI,EAAE,SAAS,GAAG,cAAc,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,qBACa,mBAAoB,SAAQ,gBAAiB,YAAW,oBAAoB;IAG9E,IAAI,EAAE,SAAS,GAAG,cAAc,CAAC;IAIjC,SAAS,EAAE,MAAM,CAAC;WAEX,IAAI,CAAC,KAAK,EAAE,oBAAoB,GAAG,mBAAmB;CAGvE;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACrD,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CACjC;AAED,qBACa,aAAc,SAAQ,gBAAiB,YAAW,cAAc;IAGlE,SAAS,EAAE,QAAQ,CAAC;IAIpB,OAAO,EAAE,QAAQ,CAAC;IAIlB,MAAM,CAAC,EAAE,mBAAmB,CAAC;WAEtB,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa;CAG3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalResponse.js","sourceRoot":"","sources":["../../../../src/modules/requests/local/LocalResponse.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA+D;AAC/D,4CAAq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