@nmshd/runtime 2.0.0-beta.22 → 2.0.0-beta.23
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 +5 -5
- package/dist/dataViews/DataViewExpander.d.ts +17 -7
- package/dist/dataViews/DataViewExpander.js +277 -64
- package/dist/dataViews/DataViewExpander.js.map +1 -1
- package/dist/dataViews/consumption/DecidableRequestItemDVOs.d.ts +6 -6
- package/dist/dataViews/consumption/LocalAttributeDVO.d.ts +47 -3
- package/dist/dataViews/content/AttributeDVOs.d.ts +32 -8
- package/dist/dataViews/content/RequestItemDVOs.d.ts +6 -6
- package/dist/extensibility/facades/consumption/AttributesFacade.d.ts +5 -3
- package/dist/extensibility/facades/consumption/AttributesFacade.js +8 -2
- package/dist/extensibility/facades/consumption/AttributesFacade.js.map +1 -1
- package/dist/useCases/common/Schemas.d.ts +1 -0
- package/dist/useCases/common/Schemas.js +682 -407
- package/dist/useCases/common/Schemas.js.map +1 -1
- package/dist/useCases/consumption/attributes/ExecuteRelationshipAttributeQuery.d.ts +2 -2
- package/dist/useCases/consumption/attributes/ExecuteRelationshipAttributeQuery.js +5 -2
- package/dist/useCases/consumption/attributes/ExecuteRelationshipAttributeQuery.js.map +1 -1
- package/dist/useCases/consumption/attributes/ExecuteThirdPartyRelationshipAttributeQuery.d.ts +13 -0
- package/dist/useCases/consumption/attributes/ExecuteThirdPartyRelationshipAttributeQuery.js +40 -0
- package/dist/useCases/consumption/attributes/ExecuteThirdPartyRelationshipAttributeQuery.js.map +1 -0
- package/dist/useCases/consumption/attributes/index.d.ts +1 -0
- package/dist/useCases/consumption/attributes/index.js +1 -0
- package/dist/useCases/consumption/attributes/index.js.map +1 -1
- package/dist/useCases/consumption/requests/CanCreateOutgoingRequest.d.ts +2 -6
- package/dist/useCases/consumption/requests/CanCreateOutgoingRequest.js +8 -11
- package/dist/useCases/consumption/requests/CanCreateOutgoingRequest.js.map +1 -1
- package/lib-web/nmshd.runtime.js +1041 -496
- package/lib-web/nmshd.runtime.js.map +1 -1
- package/lib-web/nmshd.runtime.min.js +3 -3
- package/lib-web/nmshd.runtime.min.js.map +1 -1
- package/package.json +12 -12
package/dist/buildInformation.js
CHANGED
|
@@ -7,11 +7,11 @@ const content_1 = require("@nmshd/content");
|
|
|
7
7
|
const crypto_1 = require("@nmshd/crypto");
|
|
8
8
|
const transport_1 = require("@nmshd/transport");
|
|
9
9
|
exports.buildInformation = {
|
|
10
|
-
version: "2.0.0-beta.
|
|
11
|
-
build: "
|
|
12
|
-
date: "2022-09-
|
|
13
|
-
commit: "
|
|
14
|
-
dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.4","@js-soft/ts-utils":"^2.2.2","@nmshd/consumption":"2.0.0-beta.
|
|
10
|
+
version: "2.0.0-beta.23",
|
|
11
|
+
build: "109",
|
|
12
|
+
date: "2022-09-09T12:00:25+00:00",
|
|
13
|
+
commit: "c947562c2d16fb241d86de627a054fef64edc5bf",
|
|
14
|
+
dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.4","@js-soft/ts-utils":"^2.2.2","@nmshd/consumption":"2.0.0-beta.15","@nmshd/content":"2.0.0-beta.22","@nmshd/crypto":"2.0.1","@nmshd/transport":"2.0.0-beta.4","ajv":"^8.11.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","luxon":"^3.0.3","qrcode":"1.5.1","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
|
|
15
15
|
libraries: {
|
|
16
16
|
serval: ts_serval_1.buildInformation,
|
|
17
17
|
consumption: consumption_1.buildInformation,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ConsumptionController } from "@nmshd/consumption";
|
|
2
|
-
import { IdentityAttributeJSON, IdentityAttributeQueryJSON, RelationshipAttributeJSON, RequestItemGroupJSON, RequestItemJSON, RequestJSON, ResponseItemGroupJSON, ResponseItemJSON, ResponseJSON } from "@nmshd/content";
|
|
2
|
+
import { IdentityAttributeJSON, IdentityAttributeQueryJSON, RelationshipAttributeJSON, RelationshipAttributeQueryJSON, RequestItemGroupJSON, RequestItemJSON, RequestJSON, ResponseItemGroupJSON, ResponseItemJSON, ResponseJSON } from "@nmshd/content";
|
|
3
|
+
import { ThirdPartyRelationshipAttributeQueryJSON } from "@nmshd/content/dist/attributes/ThirdPartyRelationshipAttributeQuery";
|
|
3
4
|
import { IdentityController } from "@nmshd/transport";
|
|
4
5
|
import { FileDVO, IdentityDVO, RelationshipTemplateDVO, RequestItemDVO, RequestItemGroupDVO, ResponseDVO } from "..";
|
|
5
6
|
import { TransportServices } from "../extensibility";
|
|
6
7
|
import { ConsumptionServices } from "../extensibility/ConsumptionServices";
|
|
7
8
|
import { FileDTO, IdentityDTO, LocalAttributeDTO, LocalRequestDTO, LocalResponseDTO, MessageDTO, MessageWithAttachmentsDTO, RecipientDTO, RelationshipChangeDTO, RelationshipDTO, RelationshipTemplateDTO } from "../types";
|
|
8
|
-
import { LocalRequestDVO, LocalResponseDVO, PeerAttributeDVO, ProcessedIdentityAttributeQueryDVO, RepositoryAttributeDVO, SharedToPeerAttributeDVO } from "./consumption";
|
|
9
|
+
import { LocalRequestDVO, LocalResponseDVO, OwnRelationshipAttributeDVO, PeerAttributeDVO, PeerRelationshipAttributeDVO, ProcessedAttributeQueryDVO, ProcessedIdentityAttributeQueryDVO, ProcessedRelationshipAttributeQueryDVO, ProcessedThirdPartyRelationshipAttributeQueryDVO, RepositoryAttributeDVO, SharedToPeerAttributeDVO } from "./consumption";
|
|
9
10
|
import { PeerRelationshipTemplateDVO } from "./consumption/PeerRelationshipTemplateDVO";
|
|
10
|
-
import {
|
|
11
|
+
import { AttributeQueryDVO, DraftIdentityAttributeDVO, DraftRelationshipAttributeDVO, IdentityAttributeQueryDVO, RelationshipAttributeQueryDVO, ThirdPartyRelationshipAttributeQueryDVO } from "./content/AttributeDVOs";
|
|
11
12
|
import { MailDVO, RequestMessageDVO } from "./content/MailDVOs";
|
|
12
13
|
import { RequestDVO } from "./content/RequestDVO";
|
|
13
14
|
import { ResponseItemDVO, ResponseItemGroupDVO } from "./content/ResponseItemDVOs";
|
|
@@ -35,12 +36,21 @@ export declare class DataViewExpander {
|
|
|
35
36
|
expandLocalRequestDTOs(localRequests: LocalRequestDTO[]): Promise<LocalRequestDVO[]>;
|
|
36
37
|
expandResponse(response: ResponseJSON, request: LocalRequestDTO): Promise<ResponseDVO>;
|
|
37
38
|
expandLocalResponseDTO(response: LocalResponseDTO, request: LocalRequestDTO): Promise<LocalResponseDVO>;
|
|
38
|
-
expandLocalAttributeDTO(attribute: LocalAttributeDTO): Promise<RepositoryAttributeDVO | SharedToPeerAttributeDVO | PeerAttributeDVO>;
|
|
39
|
-
expandLocalAttributeDTOs(attributes: LocalAttributeDTO[]): Promise<(RepositoryAttributeDVO | SharedToPeerAttributeDVO | PeerAttributeDVO)[]>;
|
|
39
|
+
expandLocalAttributeDTO(attribute: LocalAttributeDTO): Promise<RepositoryAttributeDVO | SharedToPeerAttributeDVO | PeerAttributeDVO | PeerRelationshipAttributeDVO | OwnRelationshipAttributeDVO>;
|
|
40
|
+
expandLocalAttributeDTOs(attributes: LocalAttributeDTO[]): Promise<(RepositoryAttributeDVO | SharedToPeerAttributeDVO | PeerAttributeDVO | PeerRelationshipAttributeDVO | OwnRelationshipAttributeDVO)[]>;
|
|
41
|
+
expandAttributeQuery(query: IdentityAttributeQueryJSON | RelationshipAttributeQueryJSON | ThirdPartyRelationshipAttributeQueryJSON): Promise<AttributeQueryDVO>;
|
|
40
42
|
expandIdentityAttributeQuery(query: IdentityAttributeQueryJSON): IdentityAttributeQueryDVO;
|
|
43
|
+
expandRelationshipAttributeQuery(query: RelationshipAttributeQueryJSON): Promise<RelationshipAttributeQueryDVO>;
|
|
44
|
+
expandThirdPartyRelationshipAttributeQuery(query: ThirdPartyRelationshipAttributeQueryJSON): Promise<ThirdPartyRelationshipAttributeQueryDVO>;
|
|
45
|
+
private getHintsForValueType;
|
|
46
|
+
processAttributeQuery(attributeQuery: IdentityAttributeQueryJSON | RelationshipAttributeQueryJSON | ThirdPartyRelationshipAttributeQueryJSON): Promise<ProcessedAttributeQueryDVO>;
|
|
41
47
|
processIdentityAttributeQuery(query: IdentityAttributeQueryJSON): Promise<ProcessedIdentityAttributeQueryDVO>;
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
processRelationshipAttributeQuery(query: RelationshipAttributeQueryJSON): Promise<ProcessedRelationshipAttributeQueryDVO>;
|
|
49
|
+
processThirdPartyRelationshipAttributeQuery(query: ThirdPartyRelationshipAttributeQueryJSON): Promise<ProcessedThirdPartyRelationshipAttributeQueryDVO>;
|
|
50
|
+
private expandIdentityAttribute;
|
|
51
|
+
private expandRelationshipAttribute;
|
|
52
|
+
expandAttribute(attribute: IdentityAttributeJSON | RelationshipAttributeJSON): Promise<DraftIdentityAttributeDVO | DraftRelationshipAttributeDVO>;
|
|
53
|
+
expandAttributes(attributes: (IdentityAttributeJSON | RelationshipAttributeJSON)[]): Promise<(DraftIdentityAttributeDVO | DraftRelationshipAttributeDVO)[]>;
|
|
44
54
|
expandSelf(): IdentityDVO;
|
|
45
55
|
expandUnknown(address: string): IdentityDVO;
|
|
46
56
|
expandAddress(address: string): Promise<IdentityDVO>;
|
|
@@ -324,8 +324,8 @@ let DataViewExpander = class DataViewExpander {
|
|
|
324
324
|
...readAttributeRequestItem,
|
|
325
325
|
type: "DecidableReadAttributeRequestItemDVO",
|
|
326
326
|
id: "",
|
|
327
|
-
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.
|
|
328
|
-
query: await this.
|
|
327
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.DecidableReadAttributeRequestItem.name",
|
|
328
|
+
query: await this.processAttributeQuery(readAttributeRequestItem.query),
|
|
329
329
|
isDecidable
|
|
330
330
|
};
|
|
331
331
|
}
|
|
@@ -334,27 +334,45 @@ let DataViewExpander = class DataViewExpander {
|
|
|
334
334
|
type: "ReadAttributeRequestItemDVO",
|
|
335
335
|
id: "",
|
|
336
336
|
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ReadAttributeRequestItem.name",
|
|
337
|
-
query: this.
|
|
337
|
+
query: await this.expandAttributeQuery(readAttributeRequestItem.query),
|
|
338
338
|
isDecidable
|
|
339
339
|
};
|
|
340
|
-
case "
|
|
340
|
+
case "CreateAttributeRequestItem":
|
|
341
341
|
const createAttributeRequestItem = requestItem;
|
|
342
|
+
const attribute = await this.expandAttribute(createAttributeRequestItem.attribute);
|
|
343
|
+
let isIdentityAttribute = false;
|
|
344
|
+
if (attribute.type === "DraftIdentityAttributeDVO") {
|
|
345
|
+
isIdentityAttribute = true;
|
|
346
|
+
}
|
|
347
|
+
const name = requestItem.title;
|
|
348
|
+
const description = requestItem.description;
|
|
349
|
+
let fallbackName;
|
|
342
350
|
if (isDecidable) {
|
|
351
|
+
fallbackName = "i18n://dvo.requestItem.DecidableCreateIdentityAttributeRequestItem.name";
|
|
352
|
+
if (isIdentityAttribute) {
|
|
353
|
+
fallbackName = "i18n://dvo.requestItem.DecidableCreateRelationshipAttributeRequestItem.name";
|
|
354
|
+
}
|
|
343
355
|
return {
|
|
344
356
|
...createAttributeRequestItem,
|
|
345
|
-
type: "
|
|
357
|
+
type: "DecidableCreateAttributeRequestItemDVO",
|
|
346
358
|
id: "",
|
|
347
|
-
name:
|
|
348
|
-
|
|
359
|
+
name: name ? name : fallbackName,
|
|
360
|
+
description: description ? description : fallbackName,
|
|
361
|
+
attribute,
|
|
349
362
|
isDecidable
|
|
350
363
|
};
|
|
351
364
|
}
|
|
365
|
+
fallbackName = "i18n://dvo.requestItem.CreateIdentityAttributeRequestItem.name";
|
|
366
|
+
if (isIdentityAttribute) {
|
|
367
|
+
fallbackName = "i18n://dvo.requestItem.CreateRelationshipAttributeRequestItem.name";
|
|
368
|
+
}
|
|
352
369
|
return {
|
|
353
370
|
...createAttributeRequestItem,
|
|
354
|
-
type: "
|
|
371
|
+
type: "CreateAttributeRequestItemDVO",
|
|
355
372
|
id: "",
|
|
356
|
-
name:
|
|
357
|
-
|
|
373
|
+
name: name ? name : fallbackName,
|
|
374
|
+
description: description ? description : fallbackName,
|
|
375
|
+
attribute,
|
|
358
376
|
isDecidable
|
|
359
377
|
};
|
|
360
378
|
case "ProposeAttributeRequestItem":
|
|
@@ -367,9 +385,9 @@ let DataViewExpander = class DataViewExpander {
|
|
|
367
385
|
...proposeAttributeRequestItem,
|
|
368
386
|
type: "DecidableProposeAttributeRequestItemDVO",
|
|
369
387
|
id: "",
|
|
370
|
-
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.
|
|
388
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.DecidableProposeAttributeRequestItem.name",
|
|
371
389
|
attribute: await this.expandAttribute(proposeAttributeRequestItem.attribute),
|
|
372
|
-
query: await this.
|
|
390
|
+
query: await this.processAttributeQuery(proposeAttributeRequestItem.query),
|
|
373
391
|
isDecidable
|
|
374
392
|
};
|
|
375
393
|
}
|
|
@@ -379,7 +397,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
379
397
|
id: "",
|
|
380
398
|
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ProposeAttributeRequestItem.name",
|
|
381
399
|
attribute: await this.expandAttribute(proposeAttributeRequestItem.attribute),
|
|
382
|
-
query: this.
|
|
400
|
+
query: await this.expandAttributeQuery(proposeAttributeRequestItem.query),
|
|
383
401
|
isDecidable
|
|
384
402
|
};
|
|
385
403
|
case "ShareAttributeRequestItem":
|
|
@@ -390,7 +408,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
390
408
|
...shareAttributeRequestItem,
|
|
391
409
|
type: "DecidableShareAttributeRequestItemDVO",
|
|
392
410
|
id: "",
|
|
393
|
-
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.
|
|
411
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.DecidableProposeAttributeRequestItem.name",
|
|
394
412
|
attribute: attributeDVO,
|
|
395
413
|
isDecidable
|
|
396
414
|
};
|
|
@@ -450,7 +468,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
450
468
|
name: name,
|
|
451
469
|
attribute: localAttributeDVOForRead
|
|
452
470
|
};
|
|
453
|
-
case "
|
|
471
|
+
case "CreateAttributeAcceptResponseItem":
|
|
454
472
|
const createAttributeResponseItem = responseItem;
|
|
455
473
|
const localAttributeResultForCreate = await this.consumption.attributes.getAttribute({ id: createAttributeResponseItem.attributeId });
|
|
456
474
|
const localAttributeDVOForCreate = await this.expandLocalAttributeDTO(localAttributeResultForCreate.value);
|
|
@@ -580,14 +598,69 @@ let DataViewExpander = class DataViewExpander {
|
|
|
580
598
|
const owner = attribute.content.owner;
|
|
581
599
|
let name = `i18n://dvo.attribute.name.${valueType}`;
|
|
582
600
|
let description = `i18n://dvo.attribute.description.${valueType}`;
|
|
583
|
-
if (localAttribute.content instanceof content_1.RelationshipAttribute) {
|
|
584
|
-
name = "";
|
|
585
|
-
description = "";
|
|
586
|
-
}
|
|
587
601
|
const renderHints = localAttribute.content.value.renderHints.toJSON();
|
|
588
602
|
const valueHints = localAttribute.content.value.valueHints.toJSON();
|
|
589
603
|
if (localAttribute.shareInfo) {
|
|
590
604
|
const peer = localAttribute.shareInfo.peer.toString();
|
|
605
|
+
if (localAttribute.content instanceof content_1.RelationshipAttribute) {
|
|
606
|
+
const relationshipAttribute = localAttribute.content;
|
|
607
|
+
const valueAsAny = relationshipAttribute.value;
|
|
608
|
+
if (valueAsAny.title) {
|
|
609
|
+
name = valueAsAny.title;
|
|
610
|
+
}
|
|
611
|
+
if (valueAsAny.description) {
|
|
612
|
+
description = valueAsAny.description;
|
|
613
|
+
}
|
|
614
|
+
// Peer Relationship Attribute
|
|
615
|
+
if (relationshipAttribute.owner === localAttribute.shareInfo.peer) {
|
|
616
|
+
return {
|
|
617
|
+
type: "PeerRelationshipAttributeDVO",
|
|
618
|
+
id: attribute.id,
|
|
619
|
+
name,
|
|
620
|
+
key: relationshipAttribute.key,
|
|
621
|
+
confidentiality: relationshipAttribute.confidentiality,
|
|
622
|
+
description,
|
|
623
|
+
content: attribute.content,
|
|
624
|
+
value: attribute.content.value,
|
|
625
|
+
date: attribute.createdAt,
|
|
626
|
+
owner,
|
|
627
|
+
renderHints,
|
|
628
|
+
valueHints,
|
|
629
|
+
isValid: true,
|
|
630
|
+
createdAt: attribute.createdAt,
|
|
631
|
+
isOwn: false,
|
|
632
|
+
peer: peer,
|
|
633
|
+
isDraft: false,
|
|
634
|
+
requestReference: localAttribute.shareInfo.requestReference.toString(),
|
|
635
|
+
valueType,
|
|
636
|
+
isTechnical: relationshipAttribute.isTechnical
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
// Own Relationship Attribute
|
|
640
|
+
return {
|
|
641
|
+
type: "OwnRelationshipAttributeDVO",
|
|
642
|
+
id: attribute.id,
|
|
643
|
+
name,
|
|
644
|
+
key: relationshipAttribute.key,
|
|
645
|
+
confidentiality: relationshipAttribute.confidentiality,
|
|
646
|
+
description,
|
|
647
|
+
content: attribute.content,
|
|
648
|
+
value: attribute.content.value,
|
|
649
|
+
date: attribute.createdAt,
|
|
650
|
+
owner,
|
|
651
|
+
renderHints,
|
|
652
|
+
valueHints,
|
|
653
|
+
isValid: true,
|
|
654
|
+
createdAt: attribute.createdAt,
|
|
655
|
+
isOwn: true,
|
|
656
|
+
peer: peer,
|
|
657
|
+
isDraft: false,
|
|
658
|
+
requestReference: localAttribute.shareInfo.requestReference.toString(),
|
|
659
|
+
valueType,
|
|
660
|
+
isTechnical: relationshipAttribute.isTechnical
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
const identityAttribute = localAttribute.content;
|
|
591
664
|
if (localAttribute.shareInfo.sourceAttribute) {
|
|
592
665
|
// Own Shared Attribute
|
|
593
666
|
return {
|
|
@@ -608,7 +681,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
608
681
|
isDraft: false,
|
|
609
682
|
requestReference: localAttribute.shareInfo.requestReference.toString(),
|
|
610
683
|
sourceAttribute: localAttribute.shareInfo.sourceAttribute.toString(),
|
|
611
|
-
tags: [],
|
|
684
|
+
tags: identityAttribute.tags ? identityAttribute.tags : [],
|
|
612
685
|
valueType
|
|
613
686
|
};
|
|
614
687
|
}
|
|
@@ -630,10 +703,11 @@ let DataViewExpander = class DataViewExpander {
|
|
|
630
703
|
peer: peer,
|
|
631
704
|
isDraft: false,
|
|
632
705
|
requestReference: localAttribute.shareInfo.requestReference.toString(),
|
|
633
|
-
tags: [],
|
|
706
|
+
tags: identityAttribute.tags ? identityAttribute.tags : [],
|
|
634
707
|
valueType
|
|
635
708
|
};
|
|
636
709
|
}
|
|
710
|
+
const identityAttribute = localAttribute.content;
|
|
637
711
|
const sharedToPeerAttributes = await this.consumption.attributes.getAttributes({ query: { "shareInfo.sourceAttribute": attribute.id } });
|
|
638
712
|
const sharedToPeerDVOs = await this.expandLocalAttributeDTOs(sharedToPeerAttributes.value);
|
|
639
713
|
// Own Source Attribute
|
|
@@ -653,7 +727,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
653
727
|
isOwn: true,
|
|
654
728
|
isDraft: false,
|
|
655
729
|
sharedWith: sharedToPeerDVOs,
|
|
656
|
-
tags: [],
|
|
730
|
+
tags: identityAttribute.tags ? identityAttribute.tags : [],
|
|
657
731
|
valueType
|
|
658
732
|
};
|
|
659
733
|
}
|
|
@@ -661,50 +735,83 @@ let DataViewExpander = class DataViewExpander {
|
|
|
661
735
|
const attributesPromise = attributes.map((attribute) => this.expandLocalAttributeDTO(attribute));
|
|
662
736
|
return await Promise.all(attributesPromise);
|
|
663
737
|
}
|
|
738
|
+
async expandAttributeQuery(query) {
|
|
739
|
+
switch (query["@type"]) {
|
|
740
|
+
case "IdentityAttributeQuery":
|
|
741
|
+
return this.expandIdentityAttributeQuery(query);
|
|
742
|
+
case "RelationshipAttributeQuery":
|
|
743
|
+
return await this.expandRelationshipAttributeQuery(query);
|
|
744
|
+
case "ThirdPartyRelationshipAttributeQuery":
|
|
745
|
+
return await this.expandThirdPartyRelationshipAttributeQuery(query);
|
|
746
|
+
default:
|
|
747
|
+
throw new Error("Wrong attribute query");
|
|
748
|
+
}
|
|
749
|
+
}
|
|
664
750
|
expandIdentityAttributeQuery(query) {
|
|
665
751
|
const valueType = query.valueType;
|
|
666
752
|
const name = `i18n://dvo.attribute.name.${valueType}`;
|
|
667
753
|
const description = `i18n://dvo.attribute.description.${valueType}`;
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
754
|
+
const hints = this.getHintsForValueType(valueType);
|
|
755
|
+
return {
|
|
756
|
+
type: "IdentityAttributeQueryDVO",
|
|
757
|
+
id: "",
|
|
758
|
+
name,
|
|
759
|
+
description,
|
|
760
|
+
valueType,
|
|
761
|
+
validFrom: query.validFrom,
|
|
762
|
+
validTo: query.validTo,
|
|
763
|
+
renderHints: hints.renderHints,
|
|
764
|
+
valueHints: hints.valueHints,
|
|
765
|
+
isProcessed: false
|
|
680
766
|
};
|
|
681
|
-
|
|
682
|
-
|
|
767
|
+
}
|
|
768
|
+
async expandRelationshipAttributeQuery(query) {
|
|
769
|
+
const valueType = query.attributeCreationHints.valueType;
|
|
770
|
+
let name = "i18n://dvo.attributeQuery.name.ThirdPartyRelationshipAttributeQuery";
|
|
771
|
+
let description = "i18n://dvo.attributeQuery.name.ThirdPartyRelationshipAttributeQuery";
|
|
772
|
+
if (query.attributeCreationHints.title) {
|
|
773
|
+
name = query.attributeCreationHints.title;
|
|
683
774
|
}
|
|
684
|
-
if (
|
|
685
|
-
|
|
775
|
+
if (query.attributeCreationHints.description) {
|
|
776
|
+
description = query.attributeCreationHints.description;
|
|
777
|
+
}
|
|
778
|
+
const hints = this.getHintsForValueType(valueType);
|
|
779
|
+
if (query.attributeCreationHints.valueHints) {
|
|
780
|
+
hints.valueHints = query.attributeCreationHints.valueHints;
|
|
686
781
|
}
|
|
687
782
|
return {
|
|
688
|
-
type: "
|
|
783
|
+
type: "RelationshipAttributeQueryDVO",
|
|
689
784
|
id: "",
|
|
690
785
|
name,
|
|
691
786
|
description,
|
|
692
|
-
valueType,
|
|
693
787
|
validFrom: query.validFrom,
|
|
694
788
|
validTo: query.validTo,
|
|
695
|
-
|
|
696
|
-
|
|
789
|
+
owner: await this.expandAddress(query.owner),
|
|
790
|
+
key: query.key,
|
|
791
|
+
attributeCreationHints: query.attributeCreationHints,
|
|
792
|
+
renderHints: hints.renderHints,
|
|
793
|
+
valueHints: hints.valueHints,
|
|
794
|
+
isProcessed: false,
|
|
795
|
+
valueType
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
async expandThirdPartyRelationshipAttributeQuery(query) {
|
|
799
|
+
const name = "i18n://dvo.attributeQuery.name.ThirdPartyRelationshipAttributeQuery";
|
|
800
|
+
const description = "i18n://dvo.attributeQuery.name.ThirdPartyRelationshipAttributeQuery";
|
|
801
|
+
return {
|
|
802
|
+
type: "ThirdPartyRelationshipAttributeQueryDVO",
|
|
803
|
+
id: "",
|
|
804
|
+
name,
|
|
805
|
+
description,
|
|
806
|
+
validFrom: query.validFrom,
|
|
807
|
+
validTo: query.validTo,
|
|
808
|
+
owner: await this.expandAddress(query.owner),
|
|
809
|
+
thirdParty: await this.expandAddress(query.thirdParty),
|
|
810
|
+
key: query.key,
|
|
697
811
|
isProcessed: false
|
|
698
812
|
};
|
|
699
813
|
}
|
|
700
|
-
|
|
701
|
-
const matchedAttributeDTOs = await this.consumption.attributes.executeIdentityAttributeQuery({
|
|
702
|
-
query
|
|
703
|
-
});
|
|
704
|
-
const matchedAttributeDVOs = await this.expandLocalAttributeDTOs(matchedAttributeDTOs.value);
|
|
705
|
-
const valueType = query.valueType;
|
|
706
|
-
const name = `i18n://dvo.attribute.name.${valueType}`;
|
|
707
|
-
const description = `i18n://dvo.attribute.description.${valueType}`;
|
|
814
|
+
getHintsForValueType(valueType) {
|
|
708
815
|
const valueTypeClass = ts_serval_1.SerializableBase.getModule(valueType, 1);
|
|
709
816
|
if (!valueTypeClass) {
|
|
710
817
|
throw new Error(`No class implementation found for ${valueType}`);
|
|
@@ -724,37 +831,127 @@ let DataViewExpander = class DataViewExpander {
|
|
|
724
831
|
if (valueTypeClass.valueHints && valueTypeClass.valueHints instanceof content_1.ValueHints) {
|
|
725
832
|
valueHints = valueTypeClass.valueHints.toJSON();
|
|
726
833
|
}
|
|
834
|
+
return { renderHints, valueHints };
|
|
835
|
+
}
|
|
836
|
+
async processAttributeQuery(attributeQuery) {
|
|
837
|
+
switch (attributeQuery["@type"]) {
|
|
838
|
+
case "IdentityAttributeQuery":
|
|
839
|
+
return await this.processIdentityAttributeQuery(attributeQuery);
|
|
840
|
+
case "RelationshipAttributeQuery":
|
|
841
|
+
return await this.processRelationshipAttributeQuery(attributeQuery);
|
|
842
|
+
case "ThirdPartyRelationshipAttributeQuery":
|
|
843
|
+
return await this.processThirdPartyRelationshipAttributeQuery(attributeQuery);
|
|
844
|
+
default:
|
|
845
|
+
throw new Error("Wrong attribute query");
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
async processIdentityAttributeQuery(query) {
|
|
849
|
+
const matchedAttributeDTOs = await this.consumption.attributes.executeIdentityAttributeQuery({
|
|
850
|
+
query
|
|
851
|
+
});
|
|
852
|
+
const matchedAttributeDVOs = await this.expandLocalAttributeDTOs(matchedAttributeDTOs.value);
|
|
727
853
|
return {
|
|
854
|
+
...this.expandIdentityAttributeQuery(query),
|
|
728
855
|
type: "ProcessedIdentityAttributeQueryDVO",
|
|
729
|
-
|
|
856
|
+
results: matchedAttributeDVOs,
|
|
857
|
+
isProcessed: true
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
async processRelationshipAttributeQuery(query) {
|
|
861
|
+
const matchedAttributeDTOResult = await this.consumption.attributes.executeRelationshipAttributeQuery({
|
|
862
|
+
query
|
|
863
|
+
});
|
|
864
|
+
if (matchedAttributeDTOResult.isError) {
|
|
865
|
+
if (matchedAttributeDTOResult.error.code !== "error.runtime.recordNotFound") {
|
|
866
|
+
throw matchedAttributeDTOResult.error;
|
|
867
|
+
}
|
|
868
|
+
return {
|
|
869
|
+
...(await this.expandRelationshipAttributeQuery(query)),
|
|
870
|
+
type: "ProcessedRelationshipAttributeQueryDVO",
|
|
871
|
+
results: [],
|
|
872
|
+
isProcessed: true
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
const matchedAttributeDVOs = await this.expandLocalAttributeDTO(matchedAttributeDTOResult.value);
|
|
876
|
+
return {
|
|
877
|
+
...(await this.expandRelationshipAttributeQuery(query)),
|
|
878
|
+
type: "ProcessedRelationshipAttributeQueryDVO",
|
|
879
|
+
results: [matchedAttributeDVOs],
|
|
880
|
+
isProcessed: true
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
async processThirdPartyRelationshipAttributeQuery(query) {
|
|
884
|
+
const matchedAttributeDTOResult = await this.consumption.attributes.executeThirdPartyRelationshipAttributeQuery({
|
|
885
|
+
query
|
|
886
|
+
});
|
|
887
|
+
if (matchedAttributeDTOResult.isError) {
|
|
888
|
+
if (matchedAttributeDTOResult.error.code !== "error.runtime.recordNotFound") {
|
|
889
|
+
throw matchedAttributeDTOResult.error;
|
|
890
|
+
}
|
|
891
|
+
return {
|
|
892
|
+
...(await this.expandThirdPartyRelationshipAttributeQuery(query)),
|
|
893
|
+
type: "ProcessedThirdPartyRelationshipAttributeQueryDVO",
|
|
894
|
+
results: [],
|
|
895
|
+
isProcessed: true
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
const matchedAttributeDVO = await this.expandLocalAttributeDTO(matchedAttributeDTOResult.value);
|
|
899
|
+
const correctlyTypedAttribute = matchedAttributeDVO;
|
|
900
|
+
return {
|
|
901
|
+
...(await this.expandThirdPartyRelationshipAttributeQuery(query)),
|
|
902
|
+
type: "ProcessedThirdPartyRelationshipAttributeQueryDVO",
|
|
903
|
+
results: [correctlyTypedAttribute],
|
|
904
|
+
renderHints: correctlyTypedAttribute.renderHints,
|
|
905
|
+
valueHints: correctlyTypedAttribute.valueHints,
|
|
906
|
+
valueType: correctlyTypedAttribute.valueType,
|
|
907
|
+
isProcessed: true
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
async expandIdentityAttribute(attribute, attributeInstance) {
|
|
911
|
+
const valueType = attribute.value["@type"];
|
|
912
|
+
const name = `i18n://dvo.attribute.name.${valueType}`;
|
|
913
|
+
const description = `i18n://dvo.attribute.description.${valueType}`;
|
|
914
|
+
const renderHints = attributeInstance.value.renderHints.toJSON();
|
|
915
|
+
const valueHints = attributeInstance.value.valueHints.toJSON();
|
|
916
|
+
const owner = await this.expandAddress(attribute.owner);
|
|
917
|
+
return {
|
|
918
|
+
type: "DraftIdentityAttributeDVO",
|
|
919
|
+
content: attribute,
|
|
730
920
|
name,
|
|
731
921
|
description,
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
validTo: query.validTo,
|
|
735
|
-
results: matchedAttributeDVOs,
|
|
922
|
+
id: "",
|
|
923
|
+
owner: owner,
|
|
736
924
|
renderHints,
|
|
737
925
|
valueHints,
|
|
738
|
-
|
|
926
|
+
value: attribute.value,
|
|
927
|
+
isDraft: true,
|
|
928
|
+
isOwn: owner.isSelf,
|
|
929
|
+
valueType,
|
|
930
|
+
tags: attributeInstance.tags ? attributeInstance.tags : []
|
|
739
931
|
};
|
|
740
932
|
}
|
|
741
|
-
async
|
|
742
|
-
const attributeInstance = ts_serval_1.Serializable.fromAny(attribute);
|
|
933
|
+
async expandRelationshipAttribute(attribute, attributeInstance) {
|
|
743
934
|
const valueType = attribute.value["@type"];
|
|
744
935
|
let name = `i18n://dvo.attribute.name.${valueType}`;
|
|
745
936
|
let description = `i18n://dvo.attribute.description.${valueType}`;
|
|
746
937
|
const renderHints = attributeInstance.value.renderHints.toJSON();
|
|
747
938
|
const valueHints = attributeInstance.value.valueHints.toJSON();
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
939
|
+
const valueAsAny = attributeInstance.value;
|
|
940
|
+
if (valueAsAny.title) {
|
|
941
|
+
name = valueAsAny.title;
|
|
942
|
+
}
|
|
943
|
+
if (valueAsAny.description) {
|
|
944
|
+
description = valueAsAny.description;
|
|
751
945
|
}
|
|
752
946
|
const owner = await this.expandAddress(attribute.owner);
|
|
753
947
|
return {
|
|
754
|
-
type: "
|
|
948
|
+
type: "DraftRelationshipAttributeDVO",
|
|
755
949
|
content: attribute,
|
|
756
950
|
name,
|
|
757
951
|
description,
|
|
952
|
+
key: attribute.key,
|
|
953
|
+
confidentiality: attribute.confidentiality,
|
|
954
|
+
isTechnical: !!attribute.isTechnical,
|
|
758
955
|
id: "",
|
|
759
956
|
owner: owner,
|
|
760
957
|
renderHints,
|
|
@@ -762,9 +959,19 @@ let DataViewExpander = class DataViewExpander {
|
|
|
762
959
|
value: attribute.value,
|
|
763
960
|
isDraft: true,
|
|
764
961
|
isOwn: owner.isSelf,
|
|
765
|
-
valueType
|
|
962
|
+
valueType
|
|
766
963
|
};
|
|
767
964
|
}
|
|
965
|
+
async expandAttribute(attribute) {
|
|
966
|
+
const attributeInstance = ts_serval_1.Serializable.fromAny(attribute);
|
|
967
|
+
if (attributeInstance instanceof content_1.IdentityAttribute) {
|
|
968
|
+
return await this.expandIdentityAttribute(attribute, attributeInstance);
|
|
969
|
+
}
|
|
970
|
+
else if (attributeInstance instanceof content_1.RelationshipAttribute) {
|
|
971
|
+
return await this.expandRelationshipAttribute(attribute, attributeInstance);
|
|
972
|
+
}
|
|
973
|
+
throw new Error("Wrong attribute instance");
|
|
974
|
+
}
|
|
768
975
|
async expandAttributes(attributes) {
|
|
769
976
|
const attributesPromise = attributes.map((attribute) => this.expandAttribute(attribute));
|
|
770
977
|
return await Promise.all(attributesPromise);
|
|
@@ -888,7 +1095,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
888
1095
|
attributesByType[valueType] = [attribute];
|
|
889
1096
|
}
|
|
890
1097
|
if (nameRelevantAttributeTypes.includes(valueType)) {
|
|
891
|
-
if (stringByType[valueType]) {
|
|
1098
|
+
if (stringByType[valueType] && valueType === "GivenName") {
|
|
892
1099
|
stringByType[valueType] += ` ${attribute.content.value.value}`;
|
|
893
1100
|
}
|
|
894
1101
|
else {
|
|
@@ -921,12 +1128,18 @@ let DataViewExpander = class DataViewExpander {
|
|
|
921
1128
|
if (stringByType["DisplayName"]) {
|
|
922
1129
|
name = stringByType["DisplayName"];
|
|
923
1130
|
}
|
|
1131
|
+
else if (stringByType["MiddleName"] && stringByType["GivenName"] && stringByType["Surname"]) {
|
|
1132
|
+
name = `${stringByType["GivenName"]} ${stringByType["MiddleName"]} ${stringByType["Surname"]}`;
|
|
1133
|
+
}
|
|
924
1134
|
else if (stringByType["GivenName"] && stringByType["Surname"]) {
|
|
925
1135
|
name = `${stringByType["GivenName"]} ${stringByType["Surname"]}`;
|
|
926
1136
|
}
|
|
927
1137
|
else if (stringByType["Sex"] && stringByType["Surname"]) {
|
|
928
1138
|
name = `i18n://dvo.identity.Salutation.${stringByType["Sex"]} ${stringByType["Surname"]}`;
|
|
929
1139
|
}
|
|
1140
|
+
else if (stringByType["Surname"]) {
|
|
1141
|
+
name = `${stringByType["Surname"]}`;
|
|
1142
|
+
}
|
|
930
1143
|
else {
|
|
931
1144
|
name = relationship.peer.substring(3, 9);
|
|
932
1145
|
}
|