@nmshd/runtime 2.0.0-alpha.26 → 2.0.0-alpha.29
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/README.md +2 -2
- package/dist/buildInformation.js +5 -5
- package/dist/dataViews/DataViewExpander.d.ts +26 -19
- package/dist/dataViews/DataViewExpander.js +352 -56
- package/dist/dataViews/DataViewExpander.js.map +1 -1
- package/dist/dataViews/consumption/DecidableRequestItemDVOs.d.ts +30 -0
- package/dist/dataViews/consumption/DecidableRequestItemDVOs.js +3 -0
- package/dist/dataViews/consumption/DecidableRequestItemDVOs.js.map +1 -0
- package/dist/dataViews/consumption/LocalAttributeDVO.d.ts +41 -25
- package/dist/dataViews/consumption/LocalRequestDVO.d.ts +8 -2
- package/dist/dataViews/consumption/PeerRelationshipTemplateDVO.d.ts +18 -0
- package/dist/dataViews/consumption/PeerRelationshipTemplateDVO.js +3 -0
- package/dist/dataViews/consumption/PeerRelationshipTemplateDVO.js.map +1 -0
- package/dist/dataViews/consumption/index.d.ts +2 -0
- package/dist/dataViews/consumption/index.js +2 -0
- package/dist/dataViews/consumption/index.js.map +1 -1
- package/dist/dataViews/content/AttributeDVOs.d.ts +37 -0
- package/dist/dataViews/content/AttributeDVOs.js +3 -0
- package/dist/dataViews/content/AttributeDVOs.js.map +1 -0
- package/dist/dataViews/content/MailDVOs.d.ts +4 -5
- package/dist/dataViews/content/RequestDVO.d.ts +7 -0
- package/dist/dataViews/content/{RequestDVOs.js → RequestDVO.js} +1 -1
- package/dist/dataViews/content/RequestDVO.js.map +1 -0
- package/dist/dataViews/content/RequestItemDVOs.d.ts +36 -0
- package/dist/dataViews/content/RequestItemDVOs.js +3 -0
- package/dist/dataViews/content/RequestItemDVOs.js.map +1 -0
- package/dist/dataViews/content/index.d.ts +3 -1
- package/dist/dataViews/content/index.js +3 -1
- package/dist/dataViews/content/index.js.map +1 -1
- package/dist/dataViews/transport/MessageDVO.d.ts +4 -0
- package/dist/dataViews/transport/RelationshipDVO.d.ts +2 -2
- package/dist/dataViews/transport/RelationshipTemplateDVO.d.ts +8 -2
- package/dist/modules/RequestModule.js +3 -1
- package/dist/modules/RequestModule.js.map +1 -1
- package/dist/types/transport/RelationshipDTO.d.ts +0 -2
- package/dist/useCases/common/Schemas.js +2218 -464
- package/dist/useCases/common/Schemas.js.map +1 -1
- package/dist/useCases/consumption/attributes/CreateSharedAttributeCopy.js +1 -1
- package/dist/useCases/consumption/attributes/CreateSharedAttributeCopy.js.map +1 -1
- package/dist/useCases/consumption/attributes/ExecuteIdentityAttributeQuery.js +2 -4
- package/dist/useCases/consumption/attributes/ExecuteIdentityAttributeQuery.js.map +1 -1
- package/dist/useCases/consumption/attributes/ExecuteRelationshipAttributeQuery.js +2 -4
- package/dist/useCases/consumption/attributes/ExecuteRelationshipAttributeQuery.js.map +1 -1
- package/dist/useCases/consumption/attributes/GetAttributes.d.ts +1 -1
- package/dist/useCases/consumption/attributes/GetAttributes.js +2 -0
- package/dist/useCases/consumption/attributes/GetAttributes.js.map +1 -1
- package/dist/useCases/transport/relationships/GetRelationships.js +0 -4
- package/dist/useCases/transport/relationships/GetRelationships.js.map +1 -1
- package/dist/useCases/transport/relationships/RelationshipMapper.js +1 -3
- package/dist/useCases/transport/relationships/RelationshipMapper.js.map +1 -1
- package/lib-web/nmshd.runtime.js +2692 -592
- 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 +4 -4
- package/dist/dataViews/content/RequestDVOs.d.ts +0 -62
- package/dist/dataViews/content/RequestDVOs.js.map +0 -1
|
@@ -36,7 +36,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
36
36
|
if (content["@type"]) {
|
|
37
37
|
type = content["@type"];
|
|
38
38
|
}
|
|
39
|
-
if (content
|
|
39
|
+
if (Array.isArray(content)) {
|
|
40
40
|
if (content.length > 0) {
|
|
41
41
|
type = content[0]["@type"];
|
|
42
42
|
}
|
|
@@ -48,51 +48,51 @@ let DataViewExpander = class DataViewExpander {
|
|
|
48
48
|
}
|
|
49
49
|
switch (type) {
|
|
50
50
|
case "Message":
|
|
51
|
-
if (content
|
|
51
|
+
if (Array.isArray(content)) {
|
|
52
52
|
return await this.expandMessageDTOs(content);
|
|
53
53
|
}
|
|
54
54
|
return await this.expandMessageDTO(content);
|
|
55
55
|
case "Attribute":
|
|
56
|
-
if (content
|
|
56
|
+
if (Array.isArray(content)) {
|
|
57
57
|
return await this.expandAttributes(content);
|
|
58
58
|
}
|
|
59
59
|
return await this.expandAttribute(content);
|
|
60
60
|
case "Address":
|
|
61
|
-
if (content
|
|
61
|
+
if (Array.isArray(content)) {
|
|
62
62
|
return await this.expandAddresses(content);
|
|
63
63
|
}
|
|
64
64
|
return await this.expandAddress(content);
|
|
65
65
|
case "FileId":
|
|
66
|
-
if (content
|
|
66
|
+
if (Array.isArray(content)) {
|
|
67
67
|
return await this.expandFileIds(content);
|
|
68
68
|
}
|
|
69
69
|
return await this.expandFileId(content);
|
|
70
70
|
case "File":
|
|
71
|
-
if (content
|
|
71
|
+
if (Array.isArray(content)) {
|
|
72
72
|
return await this.expandFileDTOs(content);
|
|
73
73
|
}
|
|
74
74
|
return await this.expandFileDTO(content);
|
|
75
75
|
case "Recipient":
|
|
76
|
-
if (content
|
|
77
|
-
return await this.
|
|
76
|
+
if (Array.isArray(content)) {
|
|
77
|
+
return await this.expandRecipientDTOs(content);
|
|
78
78
|
}
|
|
79
79
|
return await this.expandAddress(content);
|
|
80
80
|
case "Relationship":
|
|
81
|
-
if (content
|
|
81
|
+
if (Array.isArray(content)) {
|
|
82
82
|
return await this.expandRelationshipDTOs(content);
|
|
83
83
|
}
|
|
84
84
|
return await this.expandRelationshipDTO(content);
|
|
85
85
|
case "LocalAttribute":
|
|
86
|
-
if (content
|
|
87
|
-
return await this.
|
|
86
|
+
if (Array.isArray(content)) {
|
|
87
|
+
return await this.expandLocalAttributeDTOs(content);
|
|
88
88
|
}
|
|
89
|
-
return await this.
|
|
89
|
+
return await this.expandLocalAttributeDTO(content);
|
|
90
90
|
default:
|
|
91
91
|
throw useCases_1.RuntimeErrors.general.notImplemented();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
async expandMessageDTO(message) {
|
|
95
|
-
const recipientRelationships = await this.
|
|
95
|
+
const recipientRelationships = await this.expandRecipientDTOs(message.recipients);
|
|
96
96
|
const addressMap = {};
|
|
97
97
|
recipientRelationships.forEach((value) => (addressMap[value.id] = value));
|
|
98
98
|
const createdByRelationship = await this.expandAddress(message.createdBy);
|
|
@@ -138,7 +138,8 @@ let DataViewExpander = class DataViewExpander {
|
|
|
138
138
|
status,
|
|
139
139
|
statusText: `i18n://dvo.message.${status}`,
|
|
140
140
|
image: "",
|
|
141
|
-
peer: peer
|
|
141
|
+
peer: peer,
|
|
142
|
+
content: message.content
|
|
142
143
|
};
|
|
143
144
|
if (message.content["@type"] === "Mail" || message.content["@type"] === "RequestMail") {
|
|
144
145
|
const mailContent = message.content;
|
|
@@ -158,56 +159,305 @@ let DataViewExpander = class DataViewExpander {
|
|
|
158
159
|
cc: cc,
|
|
159
160
|
ccCount: cc.length
|
|
160
161
|
};
|
|
161
|
-
if (mailContent["@type"] === "RequestMail") {
|
|
162
|
-
const requestMailContent = message.content;
|
|
163
|
-
const requestMailDVO = {
|
|
164
|
-
...mailDVO,
|
|
165
|
-
type: "RequestMailDVO",
|
|
166
|
-
name: requestMailContent.subject ? requestMailContent.subject : DataViewTranslateable_1.DataViewTranslateable.consumption.mails.requestMailSubjectFallback,
|
|
167
|
-
requests: [],
|
|
168
|
-
requestCount: requestMailContent.requests.length
|
|
169
|
-
};
|
|
170
|
-
return requestMailDVO;
|
|
171
|
-
}
|
|
172
162
|
return mailDVO;
|
|
173
163
|
}
|
|
164
|
+
if (message.content["@type"] === "Request") {
|
|
165
|
+
let localRequest;
|
|
166
|
+
if (isOwn) {
|
|
167
|
+
const localRequestsResult = await this.consumption.outgoingRequests.getRequests({
|
|
168
|
+
query: { source: { reference: message.id } }
|
|
169
|
+
});
|
|
170
|
+
if (localRequestsResult.value.length === 0) {
|
|
171
|
+
throw new Error("No LocalRequest has been found for this message id.");
|
|
172
|
+
}
|
|
173
|
+
if (localRequestsResult.value.length > 1) {
|
|
174
|
+
throw new Error("More than one LocalRequest has been found for this message id.");
|
|
175
|
+
}
|
|
176
|
+
localRequest = localRequestsResult.value[0];
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
const localRequestsResult = await this.consumption.incomingRequests.getRequests({
|
|
180
|
+
query: { source: { reference: message.id } }
|
|
181
|
+
});
|
|
182
|
+
if (localRequestsResult.value.length === 0) {
|
|
183
|
+
throw new Error("No LocalRequest has been found for this message id.");
|
|
184
|
+
}
|
|
185
|
+
if (localRequestsResult.value.length > 1) {
|
|
186
|
+
throw new Error("More than one LocalRequest has been found for this message id.");
|
|
187
|
+
}
|
|
188
|
+
localRequest = localRequestsResult.value[0];
|
|
189
|
+
}
|
|
190
|
+
const requestMessageDVO = {
|
|
191
|
+
...messageDVO,
|
|
192
|
+
type: "RequestMessageDVO",
|
|
193
|
+
request: await this.expandLocalRequestDTO(localRequest)
|
|
194
|
+
};
|
|
195
|
+
return requestMessageDVO;
|
|
196
|
+
}
|
|
197
|
+
if (message.content["@type"] === "Response") {
|
|
198
|
+
let localRequest;
|
|
199
|
+
if (isOwn) {
|
|
200
|
+
const localRequestsResult = await this.consumption.incomingRequests.getRequests({
|
|
201
|
+
query: { id: message.content.requestId }
|
|
202
|
+
});
|
|
203
|
+
if (localRequestsResult.value.length === 0) {
|
|
204
|
+
throw new Error("No LocalRequest has been found for this message id.");
|
|
205
|
+
}
|
|
206
|
+
if (localRequestsResult.value.length > 1) {
|
|
207
|
+
throw new Error("More than one LocalRequest has been found for this message id.");
|
|
208
|
+
}
|
|
209
|
+
localRequest = localRequestsResult.value[0];
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const localRequestsResult = await this.consumption.outgoingRequests.getRequests({
|
|
213
|
+
query: { id: message.content.requestId }
|
|
214
|
+
});
|
|
215
|
+
if (localRequestsResult.value.length === 0) {
|
|
216
|
+
throw new Error("No LocalRequest has been found for this message id.");
|
|
217
|
+
}
|
|
218
|
+
if (localRequestsResult.value.length > 1) {
|
|
219
|
+
throw new Error("More than one LocalRequest has been found for this message id.");
|
|
220
|
+
}
|
|
221
|
+
localRequest = localRequestsResult.value[0];
|
|
222
|
+
}
|
|
223
|
+
const requestMessageDVO = {
|
|
224
|
+
...messageDVO,
|
|
225
|
+
type: "RequestMessageDVO",
|
|
226
|
+
request: await this.expandLocalRequestDTO(localRequest)
|
|
227
|
+
};
|
|
228
|
+
return requestMessageDVO;
|
|
229
|
+
}
|
|
174
230
|
return messageDVO;
|
|
175
231
|
}
|
|
176
232
|
async expandMessageDTOs(messages) {
|
|
177
233
|
const messagePromises = messages.map((message) => this.expandMessageDTO(message));
|
|
178
234
|
return await Promise.all(messagePromises);
|
|
179
235
|
}
|
|
180
|
-
|
|
236
|
+
async expandRelationshipTemplateDTO(template) {
|
|
237
|
+
let onNewRelationship;
|
|
238
|
+
let onExistingRelationship;
|
|
239
|
+
let name = "i18n://dvo.template.name";
|
|
240
|
+
if (template.content["@type"] === "RelationshipTemplateBody") {
|
|
241
|
+
const templateBody = content_1.RelationshipTemplateBody.from(template.content).toJSON();
|
|
242
|
+
if (templateBody.title) {
|
|
243
|
+
name = templateBody.title;
|
|
244
|
+
}
|
|
245
|
+
let localRequest;
|
|
246
|
+
if (!template.isOwn) {
|
|
247
|
+
const onNewRelationshipRequest = await this.consumption.incomingRequests.getRequests({
|
|
248
|
+
query: {
|
|
249
|
+
source: { reference: template.id }
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
localRequest = onNewRelationshipRequest.value[0];
|
|
253
|
+
return {
|
|
254
|
+
name,
|
|
255
|
+
type: "PeerRelationshipTemplateDVO",
|
|
256
|
+
date: template.createdAt,
|
|
257
|
+
...template,
|
|
258
|
+
createdBy: await this.expandAddress(template.createdBy),
|
|
259
|
+
onNewRelationship: await this.expandLocalRequestDTO(localRequest)
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
onNewRelationship = await this.expandRequest(templateBody.onNewRelationship);
|
|
263
|
+
if (templateBody.onExistingRelationship) {
|
|
264
|
+
onExistingRelationship = await this.expandRequest(templateBody.onExistingRelationship);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
name,
|
|
269
|
+
type: "RelationshipTemplateDVO",
|
|
270
|
+
date: template.createdAt,
|
|
271
|
+
...template,
|
|
272
|
+
createdBy: await this.expandAddress(template.createdBy),
|
|
273
|
+
onNewRelationship,
|
|
274
|
+
onExistingRelationship
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
async expandRelationshipTemplateDTOs(templates) {
|
|
278
|
+
const templatePromises = templates.map((template) => this.expandRelationshipTemplateDTO(template));
|
|
279
|
+
return await Promise.all(templatePromises);
|
|
280
|
+
}
|
|
281
|
+
async expandRequest(request, localRequestDTO) {
|
|
181
282
|
const id = request.id ? request.id : "";
|
|
283
|
+
const itemDVOs = [];
|
|
284
|
+
for (const requestItem of request.items) {
|
|
285
|
+
itemDVOs.push(await this.expandRequestGroupOrItem(requestItem, localRequestDTO));
|
|
286
|
+
}
|
|
182
287
|
return {
|
|
183
288
|
id: id,
|
|
184
289
|
name: `${request["@type"]} ${id}`,
|
|
185
290
|
type: "RequestDVO",
|
|
186
291
|
date: request.expiresAt,
|
|
187
|
-
...request
|
|
292
|
+
...request,
|
|
293
|
+
items: itemDVOs
|
|
188
294
|
};
|
|
189
295
|
}
|
|
190
|
-
|
|
296
|
+
/*
|
|
297
|
+
public async expandRequests(requests: RequestJSON[]): Promise<RequestDVO[]> {
|
|
298
|
+
const requestPromises = requests.map((request) => this.expandRequest(request));
|
|
299
|
+
return await Promise.all(requestPromises);
|
|
300
|
+
}
|
|
301
|
+
*/
|
|
302
|
+
async expandRequestItem(requestItem, localRequestDTO) {
|
|
303
|
+
let isDecidable = false;
|
|
304
|
+
if (localRequestDTO && !localRequestDTO.isOwn && (localRequestDTO.status === "DecisionRequired" || localRequestDTO.status === "ManualDecisionRequired")) {
|
|
305
|
+
isDecidable = true;
|
|
306
|
+
}
|
|
307
|
+
switch (requestItem["@type"]) {
|
|
308
|
+
case "ReadAttributeRequestItem":
|
|
309
|
+
const readAttributeRequestItem = requestItem;
|
|
310
|
+
if (isDecidable) {
|
|
311
|
+
return {
|
|
312
|
+
...readAttributeRequestItem,
|
|
313
|
+
type: "DecidableReadAttributeRequestItemDVO",
|
|
314
|
+
id: "",
|
|
315
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ReadAttributeRequestItem.name",
|
|
316
|
+
query: await this.processIdentityAttributeQuery(readAttributeRequestItem.query),
|
|
317
|
+
isDecidable
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
...readAttributeRequestItem,
|
|
322
|
+
type: "ReadAttributeRequestItemDVO",
|
|
323
|
+
id: "",
|
|
324
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ReadAttributeRequestItem.name",
|
|
325
|
+
query: this.expandIdentityAttributeQuery(readAttributeRequestItem.query),
|
|
326
|
+
isDecidable
|
|
327
|
+
};
|
|
328
|
+
case "CreateAttributeRequestItem":
|
|
329
|
+
const createAttributeRequestItem = requestItem;
|
|
330
|
+
if (isDecidable) {
|
|
331
|
+
return {
|
|
332
|
+
...createAttributeRequestItem,
|
|
333
|
+
type: "DecidableCreateAttributeRequestItemDVO",
|
|
334
|
+
id: "",
|
|
335
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.CreateAttributeRequestItem.name",
|
|
336
|
+
attribute: await this.expandAttribute(createAttributeRequestItem.attribute),
|
|
337
|
+
isDecidable
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
...createAttributeRequestItem,
|
|
342
|
+
type: "CreateAttributeRequestItemDVO",
|
|
343
|
+
id: "",
|
|
344
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.CreateAttributeRequestItem.name",
|
|
345
|
+
attribute: await this.expandAttribute(createAttributeRequestItem.attribute),
|
|
346
|
+
isDecidable
|
|
347
|
+
};
|
|
348
|
+
case "ProposeAttributeRequestItem":
|
|
349
|
+
const proposeAttributeRequestItem = requestItem;
|
|
350
|
+
if (isDecidable) {
|
|
351
|
+
return {
|
|
352
|
+
...proposeAttributeRequestItem,
|
|
353
|
+
type: "DecidableProposeAttributeRequestItemDVO",
|
|
354
|
+
id: "",
|
|
355
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ProposeAttributeRequestItem.name",
|
|
356
|
+
attribute: await this.expandAttribute(proposeAttributeRequestItem.attribute),
|
|
357
|
+
query: await this.processIdentityAttributeQuery(proposeAttributeRequestItem.query),
|
|
358
|
+
isDecidable
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
...proposeAttributeRequestItem,
|
|
363
|
+
type: "ProposeAttributeRequestItemDVO",
|
|
364
|
+
id: "",
|
|
365
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ProposeAttributeRequestItem.name",
|
|
366
|
+
attribute: await this.expandAttribute(proposeAttributeRequestItem.attribute),
|
|
367
|
+
query: this.expandIdentityAttributeQuery(proposeAttributeRequestItem.query),
|
|
368
|
+
isDecidable
|
|
369
|
+
};
|
|
370
|
+
case "ShareAttributeRequestItem":
|
|
371
|
+
const shareAttributeRequestItem = requestItem;
|
|
372
|
+
const attributeResult = await this.consumption.attributes.getAttribute({ id: shareAttributeRequestItem.attributeId });
|
|
373
|
+
const attribute = attributeResult.value;
|
|
374
|
+
const attributeDVO = await this.expandLocalAttributeDTO(attribute);
|
|
375
|
+
const shareWith = await this.expandAddress(shareAttributeRequestItem.shareWith);
|
|
376
|
+
if (isDecidable) {
|
|
377
|
+
return {
|
|
378
|
+
...shareAttributeRequestItem,
|
|
379
|
+
type: "DecidableShareAttributeRequestItemDVO",
|
|
380
|
+
id: "",
|
|
381
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ProposeAttributeRequestItem.name",
|
|
382
|
+
attribute: attributeDVO,
|
|
383
|
+
shareWith,
|
|
384
|
+
isDecidable
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
...shareAttributeRequestItem,
|
|
389
|
+
type: "ShareAttributeRequestItemDVO",
|
|
390
|
+
id: "",
|
|
391
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.ProposeAttributeRequestItem.name",
|
|
392
|
+
attribute: attributeDVO,
|
|
393
|
+
shareWith,
|
|
394
|
+
isDecidable
|
|
395
|
+
};
|
|
396
|
+
default:
|
|
397
|
+
return {
|
|
398
|
+
...requestItem,
|
|
399
|
+
type: "RequestItemDVO",
|
|
400
|
+
id: "",
|
|
401
|
+
name: requestItem.title ? requestItem.title : "i18n://dvo.requestItem.name",
|
|
402
|
+
isDecidable
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
async expandRequestGroupOrItem(requestGroupOrItem, localRequestDTO) {
|
|
407
|
+
if (requestGroupOrItem["@type"] === "RequestItemGroup") {
|
|
408
|
+
let isDecidable = false;
|
|
409
|
+
if (localRequestDTO && !localRequestDTO.isOwn && (localRequestDTO.status === "DecisionRequired" || localRequestDTO.status === "ManualDecisionRequired")) {
|
|
410
|
+
isDecidable = true;
|
|
411
|
+
}
|
|
412
|
+
const group = requestGroupOrItem;
|
|
413
|
+
const itemDVOs = [];
|
|
414
|
+
for (const requestItem of group.items) {
|
|
415
|
+
itemDVOs.push(await this.expandRequestItem(requestItem, localRequestDTO));
|
|
416
|
+
}
|
|
417
|
+
return {
|
|
418
|
+
type: "RequestItemGroupDVO",
|
|
419
|
+
items: itemDVOs,
|
|
420
|
+
isDecidable,
|
|
421
|
+
title: requestGroupOrItem.title,
|
|
422
|
+
description: requestGroupOrItem.description,
|
|
423
|
+
mustBeAccepted: requestGroupOrItem.mustBeAccepted
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
return await this.expandRequestItem(requestGroupOrItem, localRequestDTO);
|
|
427
|
+
}
|
|
428
|
+
async expandLocalRequestDTO(request) {
|
|
429
|
+
const requestDVO = await this.expandRequest(request.content, request);
|
|
430
|
+
const peerDVO = await this.expandAddress(request.peer);
|
|
431
|
+
let isDecidable = false;
|
|
432
|
+
if (!request.isOwn && (request.status === "DecisionRequired" || request.status === "ManualDecisionRequired")) {
|
|
433
|
+
isDecidable = true;
|
|
434
|
+
}
|
|
191
435
|
return {
|
|
192
436
|
...request,
|
|
193
437
|
id: request.id,
|
|
194
|
-
|
|
438
|
+
content: requestDVO,
|
|
439
|
+
items: requestDVO.items,
|
|
440
|
+
name: "i18n://dvo.localRequest.name",
|
|
195
441
|
type: "LocalRequestDVO",
|
|
196
442
|
date: request.createdAt,
|
|
197
|
-
|
|
198
|
-
|
|
443
|
+
createdBy: request.isOwn ? this.expandSelf() : peerDVO,
|
|
444
|
+
decider: request.isOwn ? peerDVO : this.expandSelf(),
|
|
445
|
+
peer: peerDVO,
|
|
446
|
+
response: request.response ? this.expandLocalResponseDTO(request.response) : undefined,
|
|
447
|
+
statusText: `i18n://dvo.localRequest.status.${request.status}`,
|
|
448
|
+
isDecidable
|
|
199
449
|
};
|
|
200
450
|
}
|
|
201
|
-
|
|
451
|
+
expandLocalResponseDTO(response) {
|
|
202
452
|
return {
|
|
203
453
|
...response,
|
|
204
454
|
id: "",
|
|
205
|
-
name: "i18n://dvo.
|
|
455
|
+
name: "i18n://dvo.localResponse.name",
|
|
206
456
|
type: "LocalResponseDVO",
|
|
207
457
|
date: response.createdAt
|
|
208
458
|
};
|
|
209
459
|
}
|
|
210
|
-
async
|
|
460
|
+
async expandLocalAttributeDTO(attribute) {
|
|
211
461
|
const valueType = attribute.content.value["@type"];
|
|
212
462
|
const localAttribute = await this.consumptionController.attributes.getLocalAttribute(transport_1.CoreId.from(attribute.id));
|
|
213
463
|
if (!localAttribute) {
|
|
@@ -241,8 +491,10 @@ let DataViewExpander = class DataViewExpander {
|
|
|
241
491
|
createdAt: attribute.createdAt,
|
|
242
492
|
isOwn: true,
|
|
243
493
|
peer: peer,
|
|
494
|
+
isDraft: false,
|
|
244
495
|
requestReference: localAttribute.shareInfo.requestReference.toString(),
|
|
245
|
-
sourceAttribute: localAttribute.shareInfo.sourceAttribute.toString()
|
|
496
|
+
sourceAttribute: localAttribute.shareInfo.sourceAttribute.toString(),
|
|
497
|
+
tags: []
|
|
246
498
|
};
|
|
247
499
|
}
|
|
248
500
|
// Peer Attribute
|
|
@@ -261,11 +513,13 @@ let DataViewExpander = class DataViewExpander {
|
|
|
261
513
|
createdAt: attribute.createdAt,
|
|
262
514
|
isOwn: false,
|
|
263
515
|
peer: peer,
|
|
264
|
-
|
|
516
|
+
isDraft: false,
|
|
517
|
+
requestReference: localAttribute.shareInfo.requestReference.toString(),
|
|
518
|
+
tags: []
|
|
265
519
|
};
|
|
266
520
|
}
|
|
267
521
|
const sharedToPeerAttributes = await this.consumption.attributes.getAttributes({ query: { shareInfo: { sourceAttribute: attribute.id } } });
|
|
268
|
-
const sharedToPeerDVOs = await this.
|
|
522
|
+
const sharedToPeerDVOs = await this.expandLocalAttributeDTOs(sharedToPeerAttributes.value);
|
|
269
523
|
// Own Source Attribute
|
|
270
524
|
return {
|
|
271
525
|
type: "RepositoryAttributeDVO",
|
|
@@ -281,18 +535,16 @@ let DataViewExpander = class DataViewExpander {
|
|
|
281
535
|
isValid: true,
|
|
282
536
|
createdAt: attribute.createdAt,
|
|
283
537
|
isOwn: true,
|
|
284
|
-
|
|
538
|
+
isDraft: false,
|
|
539
|
+
sharedWith: sharedToPeerDVOs,
|
|
540
|
+
tags: []
|
|
285
541
|
};
|
|
286
542
|
}
|
|
287
|
-
async
|
|
288
|
-
const attributesPromise = attributes.map((attribute) => this.
|
|
543
|
+
async expandLocalAttributeDTOs(attributes) {
|
|
544
|
+
const attributesPromise = attributes.map((attribute) => this.expandLocalAttributeDTO(attribute));
|
|
289
545
|
return await Promise.all(attributesPromise);
|
|
290
546
|
}
|
|
291
|
-
|
|
292
|
-
const queryInstance = content_1.IdentityAttributeQuery.from(query);
|
|
293
|
-
const matchedAttributes = await this.consumptionController.attributes.executeIdentityAttributeQuery({ query: queryInstance });
|
|
294
|
-
const matchedAttributeDTOs = useCases_1.AttributeMapper.toAttributeDTOList(matchedAttributes);
|
|
295
|
-
const matchedAttributeDVOs = await this.expandLocalAttributes(matchedAttributeDTOs);
|
|
547
|
+
expandIdentityAttributeQuery(query) {
|
|
296
548
|
const valueType = query.valueType;
|
|
297
549
|
const name = `i18n://dvo.attribute.name.${valueType}`;
|
|
298
550
|
const description = `i18n://dvo.attribute.description.${valueType}`;
|
|
@@ -316,7 +568,48 @@ let DataViewExpander = class DataViewExpander {
|
|
|
316
568
|
valueHints = valueTypeClass.valueHints.toJSON();
|
|
317
569
|
}
|
|
318
570
|
return {
|
|
319
|
-
type: "
|
|
571
|
+
type: "IdentityAttributeQueryDVO",
|
|
572
|
+
id: "",
|
|
573
|
+
name,
|
|
574
|
+
description,
|
|
575
|
+
valueType,
|
|
576
|
+
validFrom: query.validFrom,
|
|
577
|
+
validTo: query.validTo,
|
|
578
|
+
renderHints,
|
|
579
|
+
valueHints,
|
|
580
|
+
isProcessed: false
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
async processIdentityAttributeQuery(query) {
|
|
584
|
+
const matchedAttributeDTOs = await this.consumption.attributes.executeIdentityAttributeQuery({
|
|
585
|
+
query
|
|
586
|
+
});
|
|
587
|
+
const matchedAttributeDVOs = await this.expandLocalAttributeDTOs(matchedAttributeDTOs.value);
|
|
588
|
+
const valueType = query.valueType;
|
|
589
|
+
const name = `i18n://dvo.attribute.name.${valueType}`;
|
|
590
|
+
const description = `i18n://dvo.attribute.description.${valueType}`;
|
|
591
|
+
const valueTypeClass = ts_serval_1.SerializableBase.getModule(valueType, 1);
|
|
592
|
+
if (!valueTypeClass) {
|
|
593
|
+
throw new Error(`No class implementation found for ${valueType}`);
|
|
594
|
+
}
|
|
595
|
+
let renderHints = {
|
|
596
|
+
"@type": "RenderHints",
|
|
597
|
+
editType: content_1.RenderHintsEditType.InputLike,
|
|
598
|
+
technicalType: content_1.RenderHintsTechnicalType.String
|
|
599
|
+
};
|
|
600
|
+
let valueHints = {
|
|
601
|
+
"@type": "ValueHints",
|
|
602
|
+
max: 200
|
|
603
|
+
};
|
|
604
|
+
if (valueTypeClass.renderHints && valueTypeClass.renderHints instanceof content_1.RenderHints) {
|
|
605
|
+
renderHints = valueTypeClass.renderHints.toJSON();
|
|
606
|
+
}
|
|
607
|
+
if (valueTypeClass.valueHints && valueTypeClass.valueHints instanceof content_1.ValueHints) {
|
|
608
|
+
valueHints = valueTypeClass.valueHints.toJSON();
|
|
609
|
+
}
|
|
610
|
+
return {
|
|
611
|
+
type: "ProcessedIdentityAttributeQueryDVO",
|
|
612
|
+
id: "",
|
|
320
613
|
name,
|
|
321
614
|
description,
|
|
322
615
|
valueType,
|
|
@@ -324,7 +617,8 @@ let DataViewExpander = class DataViewExpander {
|
|
|
324
617
|
validTo: query.validTo,
|
|
325
618
|
results: matchedAttributeDVOs,
|
|
326
619
|
renderHints,
|
|
327
|
-
valueHints
|
|
620
|
+
valueHints,
|
|
621
|
+
isProcessed: true
|
|
328
622
|
};
|
|
329
623
|
}
|
|
330
624
|
async expandAttribute(attribute) {
|
|
@@ -348,7 +642,9 @@ let DataViewExpander = class DataViewExpander {
|
|
|
348
642
|
owner: owner,
|
|
349
643
|
renderHints,
|
|
350
644
|
valueHints,
|
|
351
|
-
value: attribute.value
|
|
645
|
+
value: attribute.value,
|
|
646
|
+
isDraft: true,
|
|
647
|
+
isOwn: owner.isSelf
|
|
352
648
|
};
|
|
353
649
|
}
|
|
354
650
|
async expandAttributes(attributes) {
|
|
@@ -397,7 +693,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
397
693
|
const relationshipPromises = addresses.map((address) => this.expandAddress(address));
|
|
398
694
|
return await Promise.all(relationshipPromises);
|
|
399
695
|
}
|
|
400
|
-
async
|
|
696
|
+
async expandRecipientDTO(recipient) {
|
|
401
697
|
const identity = await this.expandAddress(recipient.address);
|
|
402
698
|
return {
|
|
403
699
|
...identity,
|
|
@@ -406,11 +702,11 @@ let DataViewExpander = class DataViewExpander {
|
|
|
406
702
|
receivedByDevice: recipient.receivedByDevice
|
|
407
703
|
};
|
|
408
704
|
}
|
|
409
|
-
async
|
|
410
|
-
const relationshipPromises = recipients.map((recipient) => this.
|
|
705
|
+
async expandRecipientDTOs(recipients) {
|
|
706
|
+
const relationshipPromises = recipients.map((recipient) => this.expandRecipientDTO(recipient));
|
|
411
707
|
return await Promise.all(relationshipPromises);
|
|
412
708
|
}
|
|
413
|
-
|
|
709
|
+
expandRelationshipChangeDTO(relationship, change) {
|
|
414
710
|
const date = change.response ? change.response.createdAt : change.request.createdAt;
|
|
415
711
|
let isOwn = false;
|
|
416
712
|
if (this.identityController.isMe(transport_1.CoreAddress.from(change.request.createdBy))) {
|
|
@@ -444,8 +740,8 @@ let DataViewExpander = class DataViewExpander {
|
|
|
444
740
|
response: response
|
|
445
741
|
});
|
|
446
742
|
}
|
|
447
|
-
async
|
|
448
|
-
const changePromises = relationship.changes.map((change) => this.
|
|
743
|
+
async expandRelationshipChangeDTOs(relationship) {
|
|
744
|
+
const changePromises = relationship.changes.map((change) => this.expandRelationshipChangeDTO(relationship, change));
|
|
449
745
|
return await Promise.all(changePromises);
|
|
450
746
|
}
|
|
451
747
|
async createRelationshipDVO(relationship, relationshipInfo) {
|
|
@@ -474,7 +770,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
474
770
|
else if (relationship.status === transport_1.RelationshipStatus.Active) {
|
|
475
771
|
statusText = DataViewTranslateable_1.DataViewTranslateable.transport.relationshipActive;
|
|
476
772
|
}
|
|
477
|
-
const changes = await this.
|
|
773
|
+
const changes = await this.expandRelationshipChangeDTOs(relationship);
|
|
478
774
|
return {
|
|
479
775
|
id: relationship.id,
|
|
480
776
|
name: relationshipInfo?.userTitle ?? relationshipInfo?.title ?? "",
|
|
@@ -553,7 +849,7 @@ let DataViewExpander = class DataViewExpander {
|
|
|
553
849
|
hasRelationship: false
|
|
554
850
|
};
|
|
555
851
|
}
|
|
556
|
-
async
|
|
852
|
+
async expandIdentityDTO(identity) {
|
|
557
853
|
return await this.expandIdentityForAddress(identity.address);
|
|
558
854
|
}
|
|
559
855
|
async expandRelationshipDTOs(relationships) {
|