@nmshd/consumption 2.0.0-alpha.19 → 2.0.0-alpha.21
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/consumption/ConsumptionController.d.ts +2 -4
- package/dist/consumption/ConsumptionController.js +15 -2
- package/dist/consumption/ConsumptionController.js.map +1 -1
- package/dist/consumption/ConsumptionErrors.d.ts +1 -1
- package/dist/consumption/ConsumptionErrors.js +2 -2
- package/dist/consumption/ConsumptionErrors.js.map +1 -1
- package/dist/modules/attributes/ConsumptionAttributesController.d.ts +7 -7
- package/dist/modules/attributes/ConsumptionAttributesController.js +3 -3
- package/dist/modules/attributes/ConsumptionAttributesController.js.map +1 -1
- package/dist/modules/attributes/{CreateConsumptionAttributeParams.d.ts → local/CreateConsumptionAttributeParams.d.ts} +0 -0
- package/dist/modules/attributes/{CreateConsumptionAttributeParams.js → local/CreateConsumptionAttributeParams.js} +0 -0
- package/dist/modules/attributes/local/CreateConsumptionAttributeParams.js.map +1 -0
- package/dist/modules/attributes/{CreatePeerConsumptionAttributeParams.d.ts → local/CreatePeerConsumptionAttributeParams.d.ts} +1 -1
- package/dist/modules/attributes/{CreatePeerConsumptionAttributeParams.js → local/CreatePeerConsumptionAttributeParams.js} +0 -0
- package/dist/modules/attributes/local/CreatePeerConsumptionAttributeParams.js.map +1 -0
- package/dist/modules/attributes/local/CreateRelationshipAttributeParams.d.ts +14 -0
- package/dist/modules/attributes/local/CreateRelationshipAttributeParams.js +40 -0
- package/dist/modules/attributes/local/CreateRelationshipAttributeParams.js.map +1 -0
- package/dist/modules/attributes/{CreateSharedConsumptionAttributeCopyParams.d.ts → local/CreateSharedConsumptionAttributeCopyParams.d.ts} +0 -0
- package/dist/modules/attributes/{CreateSharedConsumptionAttributeCopyParams.js → local/CreateSharedConsumptionAttributeCopyParams.js} +0 -0
- package/dist/modules/attributes/local/CreateSharedConsumptionAttributeCopyParams.js.map +1 -0
- package/dist/modules/attributes/{GetIdentityAttributesParams.d.ts → local/GetIdentityAttributesParams.d.ts} +0 -0
- package/dist/modules/attributes/{GetIdentityAttributesParams.js → local/GetIdentityAttributesParams.js} +0 -0
- package/dist/modules/attributes/local/GetIdentityAttributesParams.js.map +1 -0
- package/dist/modules/attributes/{GetRelationshipAttributesParams.d.ts → local/GetRelationshipAttributesParams.d.ts} +0 -0
- package/dist/modules/attributes/{GetRelationshipAttributesParams.js → local/GetRelationshipAttributesParams.js} +0 -0
- package/dist/modules/attributes/local/GetRelationshipAttributesParams.js.map +1 -0
- package/dist/modules/attributes/{SucceedConsumptionAttributeParams.d.ts → local/SucceedConsumptionAttributeParams.d.ts} +0 -0
- package/dist/modules/attributes/{SucceedConsumptionAttributeParams.js → local/SucceedConsumptionAttributeParams.js} +0 -0
- package/dist/modules/attributes/local/SucceedConsumptionAttributeParams.js.map +1 -0
- package/dist/modules/attributes/{UpdateConsumptionAttributeParams.d.ts → local/UpdateConsumptionAttributeParams.d.ts} +0 -0
- package/dist/modules/attributes/{UpdateConsumptionAttributeParams.js → local/UpdateConsumptionAttributeParams.js} +0 -0
- package/dist/modules/attributes/local/UpdateConsumptionAttributeParams.js.map +1 -0
- package/dist/modules/index.d.ts +13 -7
- package/dist/modules/index.js +13 -7
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/requests/incoming/IncomingRequestsController.js +2 -2
- package/dist/modules/requests/incoming/IncomingRequestsController.js.map +1 -1
- package/dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.d.ts +13 -11
- package/dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js +2 -0
- package/dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.d.ts +11 -10
- package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js +8 -8
- package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/IRequestItemProcessor.d.ts +14 -10
- package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.d.ts +4 -7
- package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js +8 -11
- package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js.map +1 -1
- package/dist/modules/requests/itemProcessors/ValidationResult.d.ts +3 -3
- package/dist/modules/requests/itemProcessors/ValidationResult.js +5 -5
- package/dist/modules/requests/itemProcessors/ValidationResult.js.map +1 -1
- package/dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.d.ts +7 -0
- package/dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js +20 -0
- package/dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js.map +1 -0
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.d.ts +13 -0
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +55 -0
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -0
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.d.ts +20 -0
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js +47 -0
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js.map +1 -0
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.d.ts +14 -0
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js +88 -0
- package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js.map +1 -0
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.d.ts +6 -2
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js +21 -3
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts +9 -5
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +58 -18
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -1
- package/dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.d.ts +7 -0
- package/dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js +20 -0
- package/dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js.map +1 -0
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.d.ts +15 -0
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js +93 -0
- package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js.map +1 -0
- package/dist/modules/requests/itemProcessors/utility/validateQuery.d.ts +4 -0
- package/dist/modules/requests/itemProcessors/utility/validateQuery.js +21 -0
- package/dist/modules/requests/itemProcessors/utility/validateQuery.js.map +1 -0
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js +9 -9
- package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
- package/lib-web/nmshd.consumption.js +840 -325
- package/lib-web/nmshd.consumption.js.map +1 -1
- package/lib-web/nmshd.consumption.min.js +1 -1
- package/lib-web/nmshd.consumption.min.js.map +1 -1
- package/package.json +14 -13
- package/dist/modules/attributes/CreateConsumptionAttributeParams.js.map +0 -1
- package/dist/modules/attributes/CreatePeerConsumptionAttributeParams.js.map +0 -1
- package/dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js.map +0 -1
- package/dist/modules/attributes/GetIdentityAttributesParams.js.map +0 -1
- package/dist/modules/attributes/GetRelationshipAttributesParams.js.map +0 -1
- package/dist/modules/attributes/SucceedConsumptionAttributeParams.js.map +0 -1
- package/dist/modules/attributes/UpdateConsumptionAttributeParams.js.map +0 -1
|
@@ -17,11 +17,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
17
17
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
18
18
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
19
19
|
exports.buildInformation = {
|
|
20
|
-
version: "2.0.0-alpha.
|
|
21
|
-
build: "
|
|
22
|
-
date: "2022-
|
|
23
|
-
commit: "
|
|
24
|
-
dependencies: {"@js-soft/docdb-querytranslator":"^1.0.1"},
|
|
20
|
+
version: "2.0.0-alpha.21",
|
|
21
|
+
build: "40",
|
|
22
|
+
date: "2022-06-27T07:10:09+00:00",
|
|
23
|
+
commit: "26615e613c315ca69ebb76ab528cc8cabec673a9",
|
|
24
|
+
dependencies: {"@js-soft/docdb-querytranslator":"^1.0.1","ts-simple-nameof":"^1.3.1"},
|
|
25
25
|
libraries: {
|
|
26
26
|
transport: transport_1.buildInformation,
|
|
27
27
|
crypto: crypto_1.buildInformation,
|
|
@@ -78,6 +78,8 @@ exports.ConsumptionBaseController = ConsumptionBaseController;
|
|
|
78
78
|
|
|
79
79
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80
80
|
exports.ConsumptionController = void 0;
|
|
81
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
82
|
+
const modules_1 = __webpack_require__(/*! ../modules */ "./dist/modules/index.js");
|
|
81
83
|
const ConsumptionAttributesController_1 = __webpack_require__(/*! ../modules/attributes/ConsumptionAttributesController */ "./dist/modules/attributes/ConsumptionAttributesController.js");
|
|
82
84
|
const DraftsController_1 = __webpack_require__(/*! ../modules/drafts/DraftsController */ "./dist/modules/drafts/DraftsController.js");
|
|
83
85
|
const IncomingRequestsController_1 = __webpack_require__(/*! ../modules/requests/incoming/IncomingRequestsController */ "./dist/modules/requests/incoming/IncomingRequestsController.js");
|
|
@@ -104,15 +106,26 @@ class ConsumptionController {
|
|
|
104
106
|
get settings() {
|
|
105
107
|
return this._settings;
|
|
106
108
|
}
|
|
107
|
-
async init(
|
|
109
|
+
async init(requestItemProcessorOverrides = new Map()) {
|
|
108
110
|
this._attributes = await new ConsumptionAttributesController_1.ConsumptionAttributesController(this).init();
|
|
109
111
|
this._drafts = await new DraftsController_1.DraftsController(this).init();
|
|
110
|
-
const processorRegistry = new RequestItemProcessorRegistry_1.RequestItemProcessorRegistry(this,
|
|
112
|
+
const processorRegistry = new RequestItemProcessorRegistry_1.RequestItemProcessorRegistry(this, this.getDefaultProcessors());
|
|
113
|
+
for (const [itemConstructor, processorConstructor] of requestItemProcessorOverrides) {
|
|
114
|
+
processorRegistry.registerOrReplaceProcessor(itemConstructor, processorConstructor);
|
|
115
|
+
}
|
|
111
116
|
this._outgoingRequests = await new OutgoingRequestsController_1.OutgoingRequestsController(await this.accountController.getSynchronizedCollection("Requests"), processorRegistry, this).init();
|
|
112
117
|
this._incomingRequests = await new IncomingRequestsController_1.IncomingRequestsController(await this.accountController.getSynchronizedCollection("Requests"), processorRegistry, this).init();
|
|
113
118
|
this._settings = await new SettingsController_1.SettingsController(this).init();
|
|
114
119
|
return this;
|
|
115
120
|
}
|
|
121
|
+
getDefaultProcessors() {
|
|
122
|
+
return new Map([
|
|
123
|
+
[content_1.CreateAttributeRequestItem, modules_1.CreateAttributeRequestItemProcessor],
|
|
124
|
+
[content_1.ReadAttributeRequestItem, modules_1.ReadAttributeRequestItemProcessor],
|
|
125
|
+
[content_1.ProposeAttributeRequestItem, modules_1.ProposeAttributeRequestItemProcessor],
|
|
126
|
+
[content_1.ShareAttributeRequestItem, modules_1.ShareAttributeRequestItemProcessor]
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
116
129
|
}
|
|
117
130
|
exports.ConsumptionController = ConsumptionController;
|
|
118
131
|
//# sourceMappingURL=ConsumptionController.js.map
|
|
@@ -171,8 +184,8 @@ class Requests {
|
|
|
171
184
|
unexpectedErrorDuringRequestItemProcessing(error) {
|
|
172
185
|
return new transport_1.CoreError("error.consumption.requests.unexpectedErrorDuringRequestItemProcessing", error instanceof Error ? error.message : "Unknown error: '${JSON.stringify(e)'");
|
|
173
186
|
}
|
|
174
|
-
|
|
175
|
-
return new transport_1.CoreError("error.consumption.requests.
|
|
187
|
+
invalidRequestItem(message) {
|
|
188
|
+
return new transport_1.CoreError("error.consumption.requests.invalidRequestItem", message);
|
|
176
189
|
}
|
|
177
190
|
}
|
|
178
191
|
class RelationshipInfo {
|
|
@@ -296,11 +309,11 @@ exports.ConsumptionAttributesController = void 0;
|
|
|
296
309
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
297
310
|
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
298
311
|
const consumption_1 = __webpack_require__(/*! ../../consumption */ "./dist/consumption/index.js");
|
|
299
|
-
const CreateSharedConsumptionAttributeCopyParams_1 = __webpack_require__(/*! ./CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js");
|
|
300
312
|
const ConsumptionAttribute_1 = __webpack_require__(/*! ./local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js");
|
|
301
313
|
const ConsumptionAttributeShareInfo_1 = __webpack_require__(/*! ./local/ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js");
|
|
314
|
+
const CreateSharedConsumptionAttributeCopyParams_1 = __webpack_require__(/*! ./local/CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/local/CreateSharedConsumptionAttributeCopyParams.js");
|
|
302
315
|
const QueryTranslator_1 = __webpack_require__(/*! ./local/QueryTranslator */ "./dist/modules/attributes/local/QueryTranslator.js");
|
|
303
|
-
const SucceedConsumptionAttributeParams_1 = __webpack_require__(/*! ./SucceedConsumptionAttributeParams */ "./dist/modules/attributes/SucceedConsumptionAttributeParams.js");
|
|
316
|
+
const SucceedConsumptionAttributeParams_1 = __webpack_require__(/*! ./local/SucceedConsumptionAttributeParams */ "./dist/modules/attributes/local/SucceedConsumptionAttributeParams.js");
|
|
304
317
|
class ConsumptionAttributesController extends consumption_1.ConsumptionBaseController {
|
|
305
318
|
constructor(parent) {
|
|
306
319
|
super(consumption_1.ConsumptionControllerName.ConsumptionAttributesController, parent);
|
|
@@ -433,7 +446,7 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
|
|
|
433
446
|
requestReference: params.requestReference
|
|
434
447
|
});
|
|
435
448
|
const peerConsumptionAttribute = ConsumptionAttribute_1.ConsumptionAttribute.from({
|
|
436
|
-
id: params.id,
|
|
449
|
+
id: params.id ?? (await consumption_1.ConsumptionIds.attribute.generate()),
|
|
437
450
|
content: params.content,
|
|
438
451
|
shareInfo: shareInfo,
|
|
439
452
|
createdAt: transport_1.CoreDate.utc()
|
|
@@ -468,10 +481,10 @@ exports.ConsumptionAttributesController = ConsumptionAttributesController;
|
|
|
468
481
|
|
|
469
482
|
/***/ }),
|
|
470
483
|
|
|
471
|
-
/***/ "./dist/modules/attributes/
|
|
472
|
-
|
|
473
|
-
!*** ./dist/modules/attributes/
|
|
474
|
-
|
|
484
|
+
/***/ "./dist/modules/attributes/local/ConsumptionAttribute.js":
|
|
485
|
+
/*!***************************************************************!*\
|
|
486
|
+
!*** ./dist/modules/attributes/local/ConsumptionAttribute.js ***!
|
|
487
|
+
\***************************************************************/
|
|
475
488
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
476
489
|
|
|
477
490
|
"use strict";
|
|
@@ -486,80 +499,75 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
486
499
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
487
500
|
};
|
|
488
501
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
489
|
-
exports.
|
|
502
|
+
exports.ConsumptionAttribute = void 0;
|
|
490
503
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
491
504
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
492
|
-
|
|
505
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
506
|
+
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
507
|
+
const consumption_1 = __webpack_require__(/*! ../../../consumption */ "./dist/consumption/index.js");
|
|
508
|
+
const ConsumptionAttributeShareInfo_1 = __webpack_require__(/*! ./ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js");
|
|
509
|
+
let ConsumptionAttribute = class ConsumptionAttribute extends transport_1.CoreSynchronizable {
|
|
510
|
+
constructor() {
|
|
511
|
+
super(...arguments);
|
|
512
|
+
this.technicalProperties = [
|
|
513
|
+
"@type",
|
|
514
|
+
"@context",
|
|
515
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt),
|
|
516
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.succeeds),
|
|
517
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt)
|
|
518
|
+
];
|
|
519
|
+
this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.content)];
|
|
520
|
+
}
|
|
493
521
|
static from(value) {
|
|
494
522
|
return this.fromAny(value);
|
|
495
523
|
}
|
|
496
|
-
|
|
524
|
+
static async fromAttribute(attribute, succeeds, shareInfo) {
|
|
525
|
+
return this.from({
|
|
526
|
+
content: attribute,
|
|
527
|
+
id: await consumption_1.ConsumptionIds.attribute.generate(),
|
|
528
|
+
createdAt: transport_1.CoreDate.utc(),
|
|
529
|
+
succeeds: succeeds,
|
|
530
|
+
shareInfo: shareInfo
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
};
|
|
497
534
|
__decorate([
|
|
498
|
-
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
499
535
|
(0, ts_serval_1.validate)(),
|
|
536
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
500
537
|
__metadata("design:type", Object)
|
|
501
|
-
],
|
|
502
|
-
exports.CreateConsumptionAttributeParams = CreateConsumptionAttributeParams;
|
|
503
|
-
//# sourceMappingURL=CreateConsumptionAttributeParams.js.map
|
|
504
|
-
|
|
505
|
-
/***/ }),
|
|
506
|
-
|
|
507
|
-
/***/ "./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js":
|
|
508
|
-
/*!*************************************************************************!*\
|
|
509
|
-
!*** ./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js ***!
|
|
510
|
-
\*************************************************************************/
|
|
511
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
512
|
-
|
|
513
|
-
"use strict";
|
|
514
|
-
|
|
515
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
516
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
517
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
518
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
519
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
520
|
-
};
|
|
521
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
522
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
523
|
-
};
|
|
524
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
525
|
-
exports.CreatePeerConsumptionAttributeParams = void 0;
|
|
526
|
-
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
527
|
-
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
528
|
-
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
529
|
-
class CreatePeerConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
530
|
-
static from(value) {
|
|
531
|
-
return this.fromAny(value);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
538
|
+
], ConsumptionAttribute.prototype, "content", void 0);
|
|
534
539
|
__decorate([
|
|
535
|
-
(0, ts_serval_1.serialize)(),
|
|
536
540
|
(0, ts_serval_1.validate)(),
|
|
537
|
-
|
|
538
|
-
|
|
541
|
+
(0, ts_serval_1.serialize)(),
|
|
542
|
+
__metadata("design:type", transport_1.CoreDate)
|
|
543
|
+
], ConsumptionAttribute.prototype, "createdAt", void 0);
|
|
539
544
|
__decorate([
|
|
540
|
-
(0, ts_serval_1.
|
|
541
|
-
(0, ts_serval_1.
|
|
542
|
-
__metadata("design:type",
|
|
543
|
-
],
|
|
545
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
546
|
+
(0, ts_serval_1.serialize)(),
|
|
547
|
+
__metadata("design:type", transport_1.CoreId)
|
|
548
|
+
], ConsumptionAttribute.prototype, "succeeds", void 0);
|
|
544
549
|
__decorate([
|
|
550
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
545
551
|
(0, ts_serval_1.serialize)(),
|
|
546
|
-
(0, ts_serval_1.validate)(),
|
|
547
552
|
__metadata("design:type", transport_1.CoreId)
|
|
548
|
-
],
|
|
553
|
+
], ConsumptionAttribute.prototype, "succeededBy", void 0);
|
|
549
554
|
__decorate([
|
|
555
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
550
556
|
(0, ts_serval_1.serialize)(),
|
|
551
|
-
(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
557
|
+
__metadata("design:type", ConsumptionAttributeShareInfo_1.ConsumptionAttributeShareInfo)
|
|
558
|
+
], ConsumptionAttribute.prototype, "shareInfo", void 0);
|
|
559
|
+
ConsumptionAttribute = __decorate([
|
|
560
|
+
(0, ts_serval_1.type)("ConsumptionAttribute")
|
|
561
|
+
], ConsumptionAttribute);
|
|
562
|
+
exports.ConsumptionAttribute = ConsumptionAttribute;
|
|
563
|
+
//# sourceMappingURL=ConsumptionAttribute.js.map
|
|
556
564
|
|
|
557
565
|
/***/ }),
|
|
558
566
|
|
|
559
|
-
/***/ "./dist/modules/attributes/
|
|
560
|
-
|
|
561
|
-
!*** ./dist/modules/attributes/
|
|
562
|
-
|
|
567
|
+
/***/ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js":
|
|
568
|
+
/*!************************************************************************!*\
|
|
569
|
+
!*** ./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js ***!
|
|
570
|
+
\************************************************************************/
|
|
563
571
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
564
572
|
|
|
565
573
|
"use strict";
|
|
@@ -574,38 +582,38 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
574
582
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
575
583
|
};
|
|
576
584
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
577
|
-
exports.
|
|
585
|
+
exports.ConsumptionAttributeShareInfo = void 0;
|
|
578
586
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
579
587
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
580
|
-
class
|
|
588
|
+
class ConsumptionAttributeShareInfo extends transport_1.CoreSerializable {
|
|
581
589
|
static from(value) {
|
|
582
|
-
return
|
|
590
|
+
return super.fromAny(value);
|
|
583
591
|
}
|
|
584
592
|
}
|
|
585
593
|
__decorate([
|
|
586
|
-
(0, ts_serval_1.serialize)(),
|
|
587
594
|
(0, ts_serval_1.validate)(),
|
|
595
|
+
(0, ts_serval_1.serialize)(),
|
|
588
596
|
__metadata("design:type", transport_1.CoreId)
|
|
589
|
-
],
|
|
597
|
+
], ConsumptionAttributeShareInfo.prototype, "requestReference", void 0);
|
|
590
598
|
__decorate([
|
|
591
|
-
(0, ts_serval_1.serialize)(),
|
|
592
599
|
(0, ts_serval_1.validate)(),
|
|
600
|
+
(0, ts_serval_1.serialize)(),
|
|
593
601
|
__metadata("design:type", transport_1.CoreAddress)
|
|
594
|
-
],
|
|
602
|
+
], ConsumptionAttributeShareInfo.prototype, "peer", void 0);
|
|
595
603
|
__decorate([
|
|
604
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
596
605
|
(0, ts_serval_1.serialize)(),
|
|
597
|
-
(0, ts_serval_1.validate)(),
|
|
598
606
|
__metadata("design:type", transport_1.CoreId)
|
|
599
|
-
],
|
|
600
|
-
exports.
|
|
601
|
-
//# sourceMappingURL=
|
|
607
|
+
], ConsumptionAttributeShareInfo.prototype, "sourceAttribute", void 0);
|
|
608
|
+
exports.ConsumptionAttributeShareInfo = ConsumptionAttributeShareInfo;
|
|
609
|
+
//# sourceMappingURL=ConsumptionAttributeShareInfo.js.map
|
|
602
610
|
|
|
603
611
|
/***/ }),
|
|
604
612
|
|
|
605
|
-
/***/ "./dist/modules/attributes/
|
|
606
|
-
|
|
607
|
-
!*** ./dist/modules/attributes/
|
|
608
|
-
|
|
613
|
+
/***/ "./dist/modules/attributes/local/CreateConsumptionAttributeParams.js":
|
|
614
|
+
/*!***************************************************************************!*\
|
|
615
|
+
!*** ./dist/modules/attributes/local/CreateConsumptionAttributeParams.js ***!
|
|
616
|
+
\***************************************************************************/
|
|
609
617
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
610
618
|
|
|
611
619
|
"use strict";
|
|
@@ -620,28 +628,28 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
620
628
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
621
629
|
};
|
|
622
630
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
623
|
-
exports.
|
|
631
|
+
exports.CreateConsumptionAttributeParams = void 0;
|
|
624
632
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
625
633
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
626
|
-
class
|
|
634
|
+
class CreateConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
627
635
|
static from(value) {
|
|
628
636
|
return this.fromAny(value);
|
|
629
637
|
}
|
|
630
638
|
}
|
|
631
639
|
__decorate([
|
|
632
|
-
(0, ts_serval_1.serialize)(),
|
|
640
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
633
641
|
(0, ts_serval_1.validate)(),
|
|
634
|
-
__metadata("design:type",
|
|
635
|
-
],
|
|
636
|
-
exports.
|
|
637
|
-
//# sourceMappingURL=
|
|
642
|
+
__metadata("design:type", Object)
|
|
643
|
+
], CreateConsumptionAttributeParams.prototype, "content", void 0);
|
|
644
|
+
exports.CreateConsumptionAttributeParams = CreateConsumptionAttributeParams;
|
|
645
|
+
//# sourceMappingURL=CreateConsumptionAttributeParams.js.map
|
|
638
646
|
|
|
639
647
|
/***/ }),
|
|
640
648
|
|
|
641
|
-
/***/ "./dist/modules/attributes/
|
|
642
|
-
|
|
643
|
-
!*** ./dist/modules/attributes/
|
|
644
|
-
|
|
649
|
+
/***/ "./dist/modules/attributes/local/CreatePeerConsumptionAttributeParams.js":
|
|
650
|
+
/*!*******************************************************************************!*\
|
|
651
|
+
!*** ./dist/modules/attributes/local/CreatePeerConsumptionAttributeParams.js ***!
|
|
652
|
+
\*******************************************************************************/
|
|
645
653
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
646
654
|
|
|
647
655
|
"use strict";
|
|
@@ -656,10 +664,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
656
664
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
657
665
|
};
|
|
658
666
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
659
|
-
exports.
|
|
667
|
+
exports.CreatePeerConsumptionAttributeParams = void 0;
|
|
660
668
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
661
669
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
662
|
-
|
|
670
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
671
|
+
class CreatePeerConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
663
672
|
static from(value) {
|
|
664
673
|
return this.fromAny(value);
|
|
665
674
|
}
|
|
@@ -667,59 +676,32 @@ class GetRelationshipAttributesParams extends ts_serval_1.Serializable {
|
|
|
667
676
|
__decorate([
|
|
668
677
|
(0, ts_serval_1.serialize)(),
|
|
669
678
|
(0, ts_serval_1.validate)(),
|
|
670
|
-
__metadata("design:type",
|
|
671
|
-
],
|
|
672
|
-
exports.GetRelationshipAttributesParams = GetRelationshipAttributesParams;
|
|
673
|
-
//# sourceMappingURL=GetRelationshipAttributesParams.js.map
|
|
674
|
-
|
|
675
|
-
/***/ }),
|
|
676
|
-
|
|
677
|
-
/***/ "./dist/modules/attributes/SucceedConsumptionAttributeParams.js":
|
|
678
|
-
/*!**********************************************************************!*\
|
|
679
|
-
!*** ./dist/modules/attributes/SucceedConsumptionAttributeParams.js ***!
|
|
680
|
-
\**********************************************************************/
|
|
681
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
682
|
-
|
|
683
|
-
"use strict";
|
|
684
|
-
|
|
685
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
686
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
687
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
688
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
689
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
690
|
-
};
|
|
691
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
692
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
693
|
-
};
|
|
694
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
695
|
-
exports.SucceedConsumptionAttributeParams = void 0;
|
|
696
|
-
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
697
|
-
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
698
|
-
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
699
|
-
class SucceedConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
700
|
-
static from(value) {
|
|
701
|
-
return this.fromAny(value);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
679
|
+
__metadata("design:type", transport_1.CoreId)
|
|
680
|
+
], CreatePeerConsumptionAttributeParams.prototype, "id", void 0);
|
|
704
681
|
__decorate([
|
|
705
682
|
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
706
683
|
(0, ts_serval_1.validate)(),
|
|
707
684
|
__metadata("design:type", Object)
|
|
708
|
-
],
|
|
685
|
+
], CreatePeerConsumptionAttributeParams.prototype, "content", void 0);
|
|
709
686
|
__decorate([
|
|
710
687
|
(0, ts_serval_1.serialize)(),
|
|
711
688
|
(0, ts_serval_1.validate)(),
|
|
712
689
|
__metadata("design:type", transport_1.CoreId)
|
|
713
|
-
],
|
|
714
|
-
|
|
715
|
-
|
|
690
|
+
], CreatePeerConsumptionAttributeParams.prototype, "requestReference", void 0);
|
|
691
|
+
__decorate([
|
|
692
|
+
(0, ts_serval_1.serialize)(),
|
|
693
|
+
(0, ts_serval_1.validate)(),
|
|
694
|
+
__metadata("design:type", transport_1.CoreAddress)
|
|
695
|
+
], CreatePeerConsumptionAttributeParams.prototype, "peer", void 0);
|
|
696
|
+
exports.CreatePeerConsumptionAttributeParams = CreatePeerConsumptionAttributeParams;
|
|
697
|
+
//# sourceMappingURL=CreatePeerConsumptionAttributeParams.js.map
|
|
716
698
|
|
|
717
699
|
/***/ }),
|
|
718
700
|
|
|
719
|
-
/***/ "./dist/modules/attributes/
|
|
720
|
-
|
|
721
|
-
!*** ./dist/modules/attributes/
|
|
722
|
-
|
|
701
|
+
/***/ "./dist/modules/attributes/local/CreateSharedConsumptionAttributeCopyParams.js":
|
|
702
|
+
/*!*************************************************************************************!*\
|
|
703
|
+
!*** ./dist/modules/attributes/local/CreateSharedConsumptionAttributeCopyParams.js ***!
|
|
704
|
+
\*************************************************************************************/
|
|
723
705
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
724
706
|
|
|
725
707
|
"use strict";
|
|
@@ -734,11 +716,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
734
716
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
735
717
|
};
|
|
736
718
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
737
|
-
exports.
|
|
719
|
+
exports.CreateSharedConsumptionAttributeCopyParams = void 0;
|
|
738
720
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
739
|
-
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
740
721
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
741
|
-
class
|
|
722
|
+
class CreateSharedConsumptionAttributeCopyParams extends ts_serval_1.Serializable {
|
|
742
723
|
static from(value) {
|
|
743
724
|
return this.fromAny(value);
|
|
744
725
|
}
|
|
@@ -747,21 +728,26 @@ __decorate([
|
|
|
747
728
|
(0, ts_serval_1.serialize)(),
|
|
748
729
|
(0, ts_serval_1.validate)(),
|
|
749
730
|
__metadata("design:type", transport_1.CoreId)
|
|
750
|
-
],
|
|
731
|
+
], CreateSharedConsumptionAttributeCopyParams.prototype, "attributeId", void 0);
|
|
751
732
|
__decorate([
|
|
752
|
-
(0, ts_serval_1.serialize)(
|
|
733
|
+
(0, ts_serval_1.serialize)(),
|
|
753
734
|
(0, ts_serval_1.validate)(),
|
|
754
|
-
__metadata("design:type",
|
|
755
|
-
],
|
|
756
|
-
|
|
757
|
-
|
|
735
|
+
__metadata("design:type", transport_1.CoreAddress)
|
|
736
|
+
], CreateSharedConsumptionAttributeCopyParams.prototype, "peer", void 0);
|
|
737
|
+
__decorate([
|
|
738
|
+
(0, ts_serval_1.serialize)(),
|
|
739
|
+
(0, ts_serval_1.validate)(),
|
|
740
|
+
__metadata("design:type", transport_1.CoreId)
|
|
741
|
+
], CreateSharedConsumptionAttributeCopyParams.prototype, "requestReference", void 0);
|
|
742
|
+
exports.CreateSharedConsumptionAttributeCopyParams = CreateSharedConsumptionAttributeCopyParams;
|
|
743
|
+
//# sourceMappingURL=CreateSharedConsumptionAttributeCopyParams.js.map
|
|
758
744
|
|
|
759
745
|
/***/ }),
|
|
760
746
|
|
|
761
|
-
/***/ "./dist/modules/attributes/local/
|
|
762
|
-
|
|
763
|
-
!*** ./dist/modules/attributes/local/
|
|
764
|
-
|
|
747
|
+
/***/ "./dist/modules/attributes/local/GetIdentityAttributesParams.js":
|
|
748
|
+
/*!**********************************************************************!*\
|
|
749
|
+
!*** ./dist/modules/attributes/local/GetIdentityAttributesParams.js ***!
|
|
750
|
+
\**********************************************************************/
|
|
765
751
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
766
752
|
|
|
767
753
|
"use strict";
|
|
@@ -776,75 +762,28 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
776
762
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
777
763
|
};
|
|
778
764
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
779
|
-
exports.
|
|
765
|
+
exports.GetIdentityAttributesParams = void 0;
|
|
780
766
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
781
767
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
782
|
-
|
|
783
|
-
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
784
|
-
const consumption_1 = __webpack_require__(/*! ../../../consumption */ "./dist/consumption/index.js");
|
|
785
|
-
const ConsumptionAttributeShareInfo_1 = __webpack_require__(/*! ./ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js");
|
|
786
|
-
let ConsumptionAttribute = class ConsumptionAttribute extends transport_1.CoreSynchronizable {
|
|
787
|
-
constructor() {
|
|
788
|
-
super(...arguments);
|
|
789
|
-
this.technicalProperties = [
|
|
790
|
-
"@type",
|
|
791
|
-
"@context",
|
|
792
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt),
|
|
793
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.succeeds),
|
|
794
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt)
|
|
795
|
-
];
|
|
796
|
-
this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.content)];
|
|
797
|
-
}
|
|
768
|
+
class GetIdentityAttributesParams extends ts_serval_1.Serializable {
|
|
798
769
|
static from(value) {
|
|
799
770
|
return this.fromAny(value);
|
|
800
771
|
}
|
|
801
|
-
|
|
802
|
-
return this.from({
|
|
803
|
-
content: attribute,
|
|
804
|
-
id: await consumption_1.ConsumptionIds.attribute.generate(),
|
|
805
|
-
createdAt: transport_1.CoreDate.utc(),
|
|
806
|
-
succeeds: succeeds,
|
|
807
|
-
shareInfo: shareInfo
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
__decorate([
|
|
812
|
-
(0, ts_serval_1.validate)(),
|
|
813
|
-
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
814
|
-
__metadata("design:type", Object)
|
|
815
|
-
], ConsumptionAttribute.prototype, "content", void 0);
|
|
816
|
-
__decorate([
|
|
817
|
-
(0, ts_serval_1.validate)(),
|
|
818
|
-
(0, ts_serval_1.serialize)(),
|
|
819
|
-
__metadata("design:type", transport_1.CoreDate)
|
|
820
|
-
], ConsumptionAttribute.prototype, "createdAt", void 0);
|
|
821
|
-
__decorate([
|
|
822
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
823
|
-
(0, ts_serval_1.serialize)(),
|
|
824
|
-
__metadata("design:type", transport_1.CoreId)
|
|
825
|
-
], ConsumptionAttribute.prototype, "succeeds", void 0);
|
|
826
|
-
__decorate([
|
|
827
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
828
|
-
(0, ts_serval_1.serialize)(),
|
|
829
|
-
__metadata("design:type", transport_1.CoreId)
|
|
830
|
-
], ConsumptionAttribute.prototype, "succeededBy", void 0);
|
|
772
|
+
}
|
|
831
773
|
__decorate([
|
|
832
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
833
774
|
(0, ts_serval_1.serialize)(),
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
exports.ConsumptionAttribute = ConsumptionAttribute;
|
|
840
|
-
//# sourceMappingURL=ConsumptionAttribute.js.map
|
|
775
|
+
(0, ts_serval_1.validate)(),
|
|
776
|
+
__metadata("design:type", content_1.IdentityAttributeQuery)
|
|
777
|
+
], GetIdentityAttributesParams.prototype, "query", void 0);
|
|
778
|
+
exports.GetIdentityAttributesParams = GetIdentityAttributesParams;
|
|
779
|
+
//# sourceMappingURL=GetIdentityAttributesParams.js.map
|
|
841
780
|
|
|
842
781
|
/***/ }),
|
|
843
782
|
|
|
844
|
-
/***/ "./dist/modules/attributes/local/
|
|
845
|
-
|
|
846
|
-
!*** ./dist/modules/attributes/local/
|
|
847
|
-
|
|
783
|
+
/***/ "./dist/modules/attributes/local/GetRelationshipAttributesParams.js":
|
|
784
|
+
/*!**************************************************************************!*\
|
|
785
|
+
!*** ./dist/modules/attributes/local/GetRelationshipAttributesParams.js ***!
|
|
786
|
+
\**************************************************************************/
|
|
848
787
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
849
788
|
|
|
850
789
|
"use strict";
|
|
@@ -859,31 +798,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
859
798
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
860
799
|
};
|
|
861
800
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
862
|
-
exports.
|
|
801
|
+
exports.GetRelationshipAttributesParams = void 0;
|
|
863
802
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
864
|
-
const
|
|
865
|
-
class
|
|
803
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
804
|
+
class GetRelationshipAttributesParams extends ts_serval_1.Serializable {
|
|
866
805
|
static from(value) {
|
|
867
|
-
return
|
|
806
|
+
return this.fromAny(value);
|
|
868
807
|
}
|
|
869
808
|
}
|
|
870
809
|
__decorate([
|
|
871
|
-
(0, ts_serval_1.validate)(),
|
|
872
810
|
(0, ts_serval_1.serialize)(),
|
|
873
|
-
__metadata("design:type", transport_1.CoreId)
|
|
874
|
-
], ConsumptionAttributeShareInfo.prototype, "requestReference", void 0);
|
|
875
|
-
__decorate([
|
|
876
811
|
(0, ts_serval_1.validate)(),
|
|
877
|
-
(
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
882
|
-
(0, ts_serval_1.serialize)(),
|
|
883
|
-
__metadata("design:type", transport_1.CoreId)
|
|
884
|
-
], ConsumptionAttributeShareInfo.prototype, "sourceAttribute", void 0);
|
|
885
|
-
exports.ConsumptionAttributeShareInfo = ConsumptionAttributeShareInfo;
|
|
886
|
-
//# sourceMappingURL=ConsumptionAttributeShareInfo.js.map
|
|
812
|
+
__metadata("design:type", content_1.RelationshipAttributeQuery)
|
|
813
|
+
], GetRelationshipAttributesParams.prototype, "query", void 0);
|
|
814
|
+
exports.GetRelationshipAttributesParams = GetRelationshipAttributesParams;
|
|
815
|
+
//# sourceMappingURL=GetRelationshipAttributesParams.js.map
|
|
887
816
|
|
|
888
817
|
/***/ }),
|
|
889
818
|
|
|
@@ -1007,6 +936,90 @@ exports.relationshipQueryTranslator = new docdb_querytranslator_1.QueryTranslato
|
|
|
1007
936
|
|
|
1008
937
|
/***/ }),
|
|
1009
938
|
|
|
939
|
+
/***/ "./dist/modules/attributes/local/SucceedConsumptionAttributeParams.js":
|
|
940
|
+
/*!****************************************************************************!*\
|
|
941
|
+
!*** ./dist/modules/attributes/local/SucceedConsumptionAttributeParams.js ***!
|
|
942
|
+
\****************************************************************************/
|
|
943
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
944
|
+
|
|
945
|
+
"use strict";
|
|
946
|
+
|
|
947
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
948
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
949
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
950
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
951
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
952
|
+
};
|
|
953
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
954
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
955
|
+
};
|
|
956
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
957
|
+
exports.SucceedConsumptionAttributeParams = void 0;
|
|
958
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
959
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
960
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
961
|
+
class SucceedConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
962
|
+
static from(value) {
|
|
963
|
+
return this.fromAny(value);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
__decorate([
|
|
967
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
968
|
+
(0, ts_serval_1.validate)(),
|
|
969
|
+
__metadata("design:type", Object)
|
|
970
|
+
], SucceedConsumptionAttributeParams.prototype, "successorContent", void 0);
|
|
971
|
+
__decorate([
|
|
972
|
+
(0, ts_serval_1.serialize)(),
|
|
973
|
+
(0, ts_serval_1.validate)(),
|
|
974
|
+
__metadata("design:type", transport_1.CoreId)
|
|
975
|
+
], SucceedConsumptionAttributeParams.prototype, "succeeds", void 0);
|
|
976
|
+
exports.SucceedConsumptionAttributeParams = SucceedConsumptionAttributeParams;
|
|
977
|
+
//# sourceMappingURL=SucceedConsumptionAttributeParams.js.map
|
|
978
|
+
|
|
979
|
+
/***/ }),
|
|
980
|
+
|
|
981
|
+
/***/ "./dist/modules/attributes/local/UpdateConsumptionAttributeParams.js":
|
|
982
|
+
/*!***************************************************************************!*\
|
|
983
|
+
!*** ./dist/modules/attributes/local/UpdateConsumptionAttributeParams.js ***!
|
|
984
|
+
\***************************************************************************/
|
|
985
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
986
|
+
|
|
987
|
+
"use strict";
|
|
988
|
+
|
|
989
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
990
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
991
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
992
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
993
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
994
|
+
};
|
|
995
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
996
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
997
|
+
};
|
|
998
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
999
|
+
exports.UpdateConsumptionAttributeParams = void 0;
|
|
1000
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
1001
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
1002
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
1003
|
+
class UpdateConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
1004
|
+
static from(value) {
|
|
1005
|
+
return this.fromAny(value);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
__decorate([
|
|
1009
|
+
(0, ts_serval_1.serialize)(),
|
|
1010
|
+
(0, ts_serval_1.validate)(),
|
|
1011
|
+
__metadata("design:type", transport_1.CoreId)
|
|
1012
|
+
], UpdateConsumptionAttributeParams.prototype, "id", void 0);
|
|
1013
|
+
__decorate([
|
|
1014
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
1015
|
+
(0, ts_serval_1.validate)(),
|
|
1016
|
+
__metadata("design:type", Object)
|
|
1017
|
+
], UpdateConsumptionAttributeParams.prototype, "content", void 0);
|
|
1018
|
+
exports.UpdateConsumptionAttributeParams = UpdateConsumptionAttributeParams;
|
|
1019
|
+
//# sourceMappingURL=UpdateConsumptionAttributeParams.js.map
|
|
1020
|
+
|
|
1021
|
+
/***/ }),
|
|
1022
|
+
|
|
1010
1023
|
/***/ "./dist/modules/drafts/DraftsController.js":
|
|
1011
1024
|
/*!*************************************************!*\
|
|
1012
1025
|
!*** ./dist/modules/drafts/DraftsController.js ***!
|
|
@@ -1168,15 +1181,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
1168
1181
|
};
|
|
1169
1182
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1170
1183
|
__exportStar(__webpack_require__(/*! ./attributes/ConsumptionAttributesController */ "./dist/modules/attributes/ConsumptionAttributesController.js"), exports);
|
|
1171
|
-
__exportStar(__webpack_require__(/*! ./attributes/CreateConsumptionAttributeParams */ "./dist/modules/attributes/CreateConsumptionAttributeParams.js"), exports);
|
|
1172
|
-
__exportStar(__webpack_require__(/*! ./attributes/CreatePeerConsumptionAttributeParams */ "./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js"), exports);
|
|
1173
|
-
__exportStar(__webpack_require__(/*! ./attributes/CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js"), exports);
|
|
1174
|
-
__exportStar(__webpack_require__(/*! ./attributes/GetIdentityAttributesParams */ "./dist/modules/attributes/GetIdentityAttributesParams.js"), exports);
|
|
1175
|
-
__exportStar(__webpack_require__(/*! ./attributes/GetRelationshipAttributesParams */ "./dist/modules/attributes/GetRelationshipAttributesParams.js"), exports);
|
|
1176
1184
|
__exportStar(__webpack_require__(/*! ./attributes/local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js"), exports);
|
|
1177
1185
|
__exportStar(__webpack_require__(/*! ./attributes/local/ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js"), exports);
|
|
1178
|
-
__exportStar(__webpack_require__(/*! ./attributes/
|
|
1179
|
-
__exportStar(__webpack_require__(/*! ./attributes/
|
|
1186
|
+
__exportStar(__webpack_require__(/*! ./attributes/local/CreateConsumptionAttributeParams */ "./dist/modules/attributes/local/CreateConsumptionAttributeParams.js"), exports);
|
|
1187
|
+
__exportStar(__webpack_require__(/*! ./attributes/local/CreatePeerConsumptionAttributeParams */ "./dist/modules/attributes/local/CreatePeerConsumptionAttributeParams.js"), exports);
|
|
1188
|
+
__exportStar(__webpack_require__(/*! ./attributes/local/CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/local/CreateSharedConsumptionAttributeCopyParams.js"), exports);
|
|
1189
|
+
__exportStar(__webpack_require__(/*! ./attributes/local/GetIdentityAttributesParams */ "./dist/modules/attributes/local/GetIdentityAttributesParams.js"), exports);
|
|
1190
|
+
__exportStar(__webpack_require__(/*! ./attributes/local/GetRelationshipAttributesParams */ "./dist/modules/attributes/local/GetRelationshipAttributesParams.js"), exports);
|
|
1191
|
+
__exportStar(__webpack_require__(/*! ./attributes/local/SucceedConsumptionAttributeParams */ "./dist/modules/attributes/local/SucceedConsumptionAttributeParams.js"), exports);
|
|
1192
|
+
__exportStar(__webpack_require__(/*! ./attributes/local/UpdateConsumptionAttributeParams */ "./dist/modules/attributes/local/UpdateConsumptionAttributeParams.js"), exports);
|
|
1180
1193
|
__exportStar(__webpack_require__(/*! ./drafts/DraftsController */ "./dist/modules/drafts/DraftsController.js"), exports);
|
|
1181
1194
|
__exportStar(__webpack_require__(/*! ./drafts/local/Draft */ "./dist/modules/drafts/local/Draft.js"), exports);
|
|
1182
1195
|
__exportStar(__webpack_require__(/*! ./requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters */ "./dist/modules/requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters.js"), exports);
|
|
@@ -1191,13 +1204,19 @@ __exportStar(__webpack_require__(/*! ./requests/incoming/IncomingRequestsControl
|
|
|
1191
1204
|
__exportStar(__webpack_require__(/*! ./requests/incoming/received/ReceivedIncomingRequestParameters */ "./dist/modules/requests/incoming/received/ReceivedIncomingRequestParameters.js"), exports);
|
|
1192
1205
|
__exportStar(__webpack_require__(/*! ./requests/incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters */ "./dist/modules/requests/incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters.js"), exports);
|
|
1193
1206
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/AbstractRequestItemProcessor */ "./dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js"), exports);
|
|
1207
|
+
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js"), exports);
|
|
1208
|
+
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js"), exports);
|
|
1194
1209
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js"), exports);
|
|
1195
1210
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/IRequestItemProcessor */ "./dist/modules/requests/itemProcessors/IRequestItemProcessor.js"), exports);
|
|
1196
1211
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/ProcessorConstructor */ "./dist/modules/requests/itemProcessors/ProcessorConstructor.js"), exports);
|
|
1212
|
+
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js"), exports);
|
|
1213
|
+
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js"), exports);
|
|
1197
1214
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js"), exports);
|
|
1198
1215
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js"), exports);
|
|
1199
1216
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/RequestItemConstructor */ "./dist/modules/requests/itemProcessors/RequestItemConstructor.js"), exports);
|
|
1200
1217
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/RequestItemProcessorRegistry */ "./dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js"), exports);
|
|
1218
|
+
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js"), exports);
|
|
1219
|
+
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js"), exports);
|
|
1201
1220
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js"), exports);
|
|
1202
1221
|
__exportStar(__webpack_require__(/*! ./requests/local/ConsumptionRequest */ "./dist/modules/requests/local/ConsumptionRequest.js"), exports);
|
|
1203
1222
|
__exportStar(__webpack_require__(/*! ./requests/local/ConsumptionRequestStatus */ "./dist/modules/requests/local/ConsumptionRequestStatus.js"), exports);
|
|
@@ -1374,7 +1393,7 @@ class IncomingRequestsController extends consumption_1.ConsumptionBaseController
|
|
|
1374
1393
|
for (const item of request.content.items) {
|
|
1375
1394
|
if (item instanceof content_1.RequestItem) {
|
|
1376
1395
|
const processor = this.processorRegistry.getProcessorForItem(item);
|
|
1377
|
-
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(item);
|
|
1396
|
+
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(item, request);
|
|
1378
1397
|
if (!prerequisitesFulfilled) {
|
|
1379
1398
|
return request;
|
|
1380
1399
|
}
|
|
@@ -1382,7 +1401,7 @@ class IncomingRequestsController extends consumption_1.ConsumptionBaseController
|
|
|
1382
1401
|
else {
|
|
1383
1402
|
for (const childItem of item.items) {
|
|
1384
1403
|
const processor = this.processorRegistry.getProcessorForItem(childItem);
|
|
1385
|
-
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(childItem);
|
|
1404
|
+
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(childItem, request);
|
|
1386
1405
|
if (!prerequisitesFulfilled) {
|
|
1387
1406
|
return request;
|
|
1388
1407
|
}
|
|
@@ -1886,6 +1905,8 @@ exports.AbstractRequestItemProcessor = void 0;
|
|
|
1886
1905
|
class AbstractRequestItemProcessor {
|
|
1887
1906
|
constructor(consumptionController) {
|
|
1888
1907
|
this.consumptionController = consumptionController;
|
|
1908
|
+
this.accountController = this.consumptionController.accountController;
|
|
1909
|
+
this.currentIdentityAddress = this.accountController.identity.address;
|
|
1889
1910
|
}
|
|
1890
1911
|
}
|
|
1891
1912
|
exports.AbstractRequestItemProcessor = AbstractRequestItemProcessor;
|
|
@@ -1908,34 +1929,34 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
1908
1929
|
const AbstractRequestItemProcessor_1 = __webpack_require__(/*! ./AbstractRequestItemProcessor */ "./dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js");
|
|
1909
1930
|
const ValidationResult_1 = __webpack_require__(/*! ./ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
1910
1931
|
class GenericRequestItemProcessor extends AbstractRequestItemProcessor_1.AbstractRequestItemProcessor {
|
|
1911
|
-
checkPrerequisitesOfIncomingRequestItem(
|
|
1932
|
+
checkPrerequisitesOfIncomingRequestItem(requestItem, requestInfo) {
|
|
1912
1933
|
return true;
|
|
1913
1934
|
}
|
|
1914
|
-
canAccept(requestItem, params,
|
|
1935
|
+
canAccept(requestItem, params, requestInfo) {
|
|
1915
1936
|
return ValidationResult_1.ValidationResult.success();
|
|
1916
1937
|
}
|
|
1917
|
-
canReject(requestItem, params,
|
|
1938
|
+
canReject(requestItem, params, requestInfo) {
|
|
1918
1939
|
return ValidationResult_1.ValidationResult.success();
|
|
1919
1940
|
}
|
|
1920
|
-
accept(requestItem, params,
|
|
1941
|
+
accept(requestItem, params, requestInfo) {
|
|
1921
1942
|
return content_1.AcceptResponseItem.from({
|
|
1922
1943
|
result: content_1.ResponseItemResult.Accepted,
|
|
1923
1944
|
metadata: requestItem.responseMetadata
|
|
1924
1945
|
});
|
|
1925
1946
|
}
|
|
1926
|
-
reject(requestItem, params,
|
|
1947
|
+
reject(requestItem, params, requestInfo) {
|
|
1927
1948
|
return content_1.RejectResponseItem.from({
|
|
1928
1949
|
result: content_1.ResponseItemResult.Rejected,
|
|
1929
1950
|
metadata: requestItem.responseMetadata
|
|
1930
1951
|
});
|
|
1931
1952
|
}
|
|
1932
|
-
canCreateOutgoingRequestItem(requestItem) {
|
|
1953
|
+
canCreateOutgoingRequestItem(requestItem, request, recipient) {
|
|
1933
1954
|
return ValidationResult_1.ValidationResult.success();
|
|
1934
1955
|
}
|
|
1935
|
-
canApplyIncomingResponseItem(responseItem, requestItem,
|
|
1956
|
+
canApplyIncomingResponseItem(responseItem, requestItem, requestInfo) {
|
|
1936
1957
|
return ValidationResult_1.ValidationResult.success();
|
|
1937
1958
|
}
|
|
1938
|
-
applyIncomingResponseItem(responseItem, requestItem,
|
|
1959
|
+
applyIncomingResponseItem(responseItem, requestItem, requestInfo) {
|
|
1939
1960
|
// do nothing
|
|
1940
1961
|
}
|
|
1941
1962
|
}
|
|
@@ -1994,24 +2015,21 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1994
2015
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1995
2016
|
exports.RequestItemProcessorRegistry = void 0;
|
|
1996
2017
|
class RequestItemProcessorRegistry {
|
|
1997
|
-
constructor(consumptionController, processors =
|
|
2018
|
+
constructor(consumptionController, processors = new Map()) {
|
|
1998
2019
|
this.consumptionController = consumptionController;
|
|
1999
|
-
this.
|
|
2000
|
-
for (const { itemConstructor, processorConstructor } of processors) {
|
|
2001
|
-
this.registerProcessor(processorConstructor, itemConstructor);
|
|
2002
|
-
}
|
|
2020
|
+
this.processors = processors;
|
|
2003
2021
|
}
|
|
2004
|
-
registerProcessor(
|
|
2005
|
-
if (this.
|
|
2022
|
+
registerProcessor(itemConstructor, processorConstructor) {
|
|
2023
|
+
if (this.processors.has(itemConstructor)) {
|
|
2006
2024
|
throw new Error(`There is already a processor registered for '${itemConstructor.name}''. Use 'replaceProcessorForType' if you want to replace it.`);
|
|
2007
2025
|
}
|
|
2008
|
-
this.
|
|
2026
|
+
this.processors.set(itemConstructor, processorConstructor);
|
|
2009
2027
|
}
|
|
2010
|
-
|
|
2011
|
-
this.
|
|
2028
|
+
registerOrReplaceProcessor(itemConstructor, processorConstructor) {
|
|
2029
|
+
this.processors.set(itemConstructor, processorConstructor);
|
|
2012
2030
|
}
|
|
2013
2031
|
getProcessorForItem(item) {
|
|
2014
|
-
const constructor = this.
|
|
2032
|
+
const constructor = this.processors.get(item.constructor);
|
|
2015
2033
|
if (!constructor) {
|
|
2016
2034
|
throw new Error(`There was no processor registered for '${item.constructor.name}'.`);
|
|
2017
2035
|
}
|
|
@@ -2032,20 +2050,20 @@ exports.RequestItemProcessorRegistry = RequestItemProcessorRegistry;
|
|
|
2032
2050
|
"use strict";
|
|
2033
2051
|
|
|
2034
2052
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2035
|
-
exports.ErrorValidationResult = exports.
|
|
2053
|
+
exports.ErrorValidationResult = exports.SuccessfulValidationResult = exports.ValidationResult = void 0;
|
|
2036
2054
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
2037
2055
|
class ValidationResult {
|
|
2038
2056
|
constructor(items) {
|
|
2039
2057
|
this.items = items;
|
|
2040
2058
|
}
|
|
2041
2059
|
isSuccess() {
|
|
2042
|
-
return this instanceof
|
|
2060
|
+
return this instanceof SuccessfulValidationResult;
|
|
2043
2061
|
}
|
|
2044
2062
|
isError() {
|
|
2045
2063
|
return this instanceof ErrorValidationResult;
|
|
2046
2064
|
}
|
|
2047
2065
|
static success(items = []) {
|
|
2048
|
-
return new
|
|
2066
|
+
return new SuccessfulValidationResult(items);
|
|
2049
2067
|
}
|
|
2050
2068
|
static error(error, items = []) {
|
|
2051
2069
|
return new ErrorValidationResult(error, items);
|
|
@@ -2057,12 +2075,12 @@ class ValidationResult {
|
|
|
2057
2075
|
}
|
|
2058
2076
|
}
|
|
2059
2077
|
exports.ValidationResult = ValidationResult;
|
|
2060
|
-
class
|
|
2078
|
+
class SuccessfulValidationResult extends ValidationResult {
|
|
2061
2079
|
constructor(items) {
|
|
2062
2080
|
super(items);
|
|
2063
2081
|
}
|
|
2064
2082
|
}
|
|
2065
|
-
exports.
|
|
2083
|
+
exports.SuccessfulValidationResult = SuccessfulValidationResult;
|
|
2066
2084
|
class ErrorValidationResult extends ValidationResult {
|
|
2067
2085
|
constructor(error, items) {
|
|
2068
2086
|
super(items);
|
|
@@ -2074,6 +2092,256 @@ exports.ErrorValidationResult = ErrorValidationResult;
|
|
|
2074
2092
|
|
|
2075
2093
|
/***/ }),
|
|
2076
2094
|
|
|
2095
|
+
/***/ "./dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js":
|
|
2096
|
+
/*!************************************************************************************************************!*\
|
|
2097
|
+
!*** ./dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js ***!
|
|
2098
|
+
\************************************************************************************************************/
|
|
2099
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2100
|
+
|
|
2101
|
+
"use strict";
|
|
2102
|
+
|
|
2103
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2104
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2105
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2106
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2107
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2108
|
+
};
|
|
2109
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2110
|
+
exports.AcceptCreateAttributeRequestItemParameters = void 0;
|
|
2111
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
2112
|
+
let AcceptCreateAttributeRequestItemParameters = class AcceptCreateAttributeRequestItemParameters extends ts_serval_1.Serializable {
|
|
2113
|
+
static from(value) {
|
|
2114
|
+
return this.fromAny(value);
|
|
2115
|
+
}
|
|
2116
|
+
};
|
|
2117
|
+
AcceptCreateAttributeRequestItemParameters = __decorate([
|
|
2118
|
+
(0, ts_serval_1.type)("AcceptCreateAttributeRequestItemParameters")
|
|
2119
|
+
], AcceptCreateAttributeRequestItemParameters);
|
|
2120
|
+
exports.AcceptCreateAttributeRequestItemParameters = AcceptCreateAttributeRequestItemParameters;
|
|
2121
|
+
//# sourceMappingURL=AcceptCreateAttributeRequestItemParameters.js.map
|
|
2122
|
+
|
|
2123
|
+
/***/ }),
|
|
2124
|
+
|
|
2125
|
+
/***/ "./dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js":
|
|
2126
|
+
/*!*****************************************************************************************************!*\
|
|
2127
|
+
!*** ./dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js ***!
|
|
2128
|
+
\*****************************************************************************************************/
|
|
2129
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2130
|
+
|
|
2131
|
+
"use strict";
|
|
2132
|
+
|
|
2133
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2134
|
+
exports.CreateAttributeRequestItemProcessor = void 0;
|
|
2135
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
2136
|
+
const consumption_1 = __webpack_require__(/*! ../../../../consumption */ "./dist/consumption/index.js");
|
|
2137
|
+
const GenericRequestItemProcessor_1 = __webpack_require__(/*! ../GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js");
|
|
2138
|
+
const ValidationResult_1 = __webpack_require__(/*! ../ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
2139
|
+
class CreateAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
2140
|
+
canCreateOutgoingRequestItem(requestItem, _request, _recipient) {
|
|
2141
|
+
if (requestItem.attribute instanceof content_1.IdentityAttribute) {
|
|
2142
|
+
return this.canCreateRequestItemWithIdentityAttribute(requestItem);
|
|
2143
|
+
}
|
|
2144
|
+
return this.canCreateRequestItemWithRelationshipAttribute(requestItem);
|
|
2145
|
+
}
|
|
2146
|
+
canCreateRequestItemWithIdentityAttribute(requestItem) {
|
|
2147
|
+
const iAmOwnerOfTheAttribute = this.accountController.identity.isMe(requestItem.attribute.owner);
|
|
2148
|
+
if (!iAmOwnerOfTheAttribute) {
|
|
2149
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem(`Cannot send Identity Attributes of which you are not the owner via ${content_1.CreateAttributeRequestItem.name}. Consider using a ${content_1.ProposeAttributeRequestItem.name} instead.`));
|
|
2150
|
+
}
|
|
2151
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2152
|
+
}
|
|
2153
|
+
canCreateRequestItemWithRelationshipAttribute(requestItem) {
|
|
2154
|
+
const iAmOwnerOfTheAttribute = this.accountController.identity.isMe(requestItem.attribute.owner);
|
|
2155
|
+
if (!iAmOwnerOfTheAttribute) {
|
|
2156
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("Cannot send Relationship Attributes of which you are not the owner."));
|
|
2157
|
+
}
|
|
2158
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2159
|
+
}
|
|
2160
|
+
async accept(requestItem, _params, requestInfo) {
|
|
2161
|
+
const peerConsumptionAttribute = await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2162
|
+
content: requestItem.attribute,
|
|
2163
|
+
peer: requestInfo.peer,
|
|
2164
|
+
requestReference: requestInfo.id
|
|
2165
|
+
});
|
|
2166
|
+
return content_1.CreateAttributeAcceptResponseItem.from({
|
|
2167
|
+
attributeId: peerConsumptionAttribute.id,
|
|
2168
|
+
result: content_1.ResponseItemResult.Accepted,
|
|
2169
|
+
metadata: requestItem.responseMetadata
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
async applyIncomingResponseItem(responseItem, requestItem, requestInfo) {
|
|
2173
|
+
if (!(responseItem instanceof content_1.CreateAttributeAcceptResponseItem)) {
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
/* TODO: in case of an own IdentityAttribute that was sent to the peer, we need to specify a source attribute; but currently we can't find the source attribute, because we don't know the id the user picked when sending the request */
|
|
2177
|
+
await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2178
|
+
id: responseItem.attributeId,
|
|
2179
|
+
content: requestItem.attribute,
|
|
2180
|
+
peer: requestInfo.peer,
|
|
2181
|
+
requestReference: requestInfo.id
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
exports.CreateAttributeRequestItemProcessor = CreateAttributeRequestItemProcessor;
|
|
2186
|
+
//# sourceMappingURL=CreateAttributeRequestItemProcessor.js.map
|
|
2187
|
+
|
|
2188
|
+
/***/ }),
|
|
2189
|
+
|
|
2190
|
+
/***/ "./dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js":
|
|
2191
|
+
/*!**************************************************************************************************************!*\
|
|
2192
|
+
!*** ./dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js ***!
|
|
2193
|
+
\**************************************************************************************************************/
|
|
2194
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2195
|
+
|
|
2196
|
+
"use strict";
|
|
2197
|
+
|
|
2198
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2199
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2200
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2201
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2202
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2203
|
+
};
|
|
2204
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
2205
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2206
|
+
};
|
|
2207
|
+
var AcceptProposeAttributeRequestItemParameters_1;
|
|
2208
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2209
|
+
exports.AcceptProposeAttributeRequestItemParameters = void 0;
|
|
2210
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
2211
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
2212
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
2213
|
+
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
2214
|
+
let AcceptProposeAttributeRequestItemParameters = AcceptProposeAttributeRequestItemParameters_1 = class AcceptProposeAttributeRequestItemParameters extends ts_serval_1.Serializable {
|
|
2215
|
+
static from(value) {
|
|
2216
|
+
return this.fromAny(value);
|
|
2217
|
+
}
|
|
2218
|
+
static postFrom(value) {
|
|
2219
|
+
const typedValue = value;
|
|
2220
|
+
if (typedValue.attributeId && typedValue.attribute) {
|
|
2221
|
+
throw new ts_serval_1.ValidationError(AcceptProposeAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.attribute), `You cannot specify both ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} and ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
|
|
2222
|
+
}
|
|
2223
|
+
if (!typedValue.attributeId && !typedValue.attribute) {
|
|
2224
|
+
throw new ts_serval_1.ValidationError(AcceptProposeAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.attribute), `You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
|
|
2225
|
+
}
|
|
2226
|
+
return value;
|
|
2227
|
+
}
|
|
2228
|
+
};
|
|
2229
|
+
__decorate([
|
|
2230
|
+
(0, ts_serval_1.serialize)(),
|
|
2231
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
2232
|
+
__metadata("design:type", transport_1.CoreId)
|
|
2233
|
+
], AcceptProposeAttributeRequestItemParameters.prototype, "attributeId", void 0);
|
|
2234
|
+
__decorate([
|
|
2235
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
2236
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
2237
|
+
__metadata("design:type", Object)
|
|
2238
|
+
], AcceptProposeAttributeRequestItemParameters.prototype, "attribute", void 0);
|
|
2239
|
+
AcceptProposeAttributeRequestItemParameters = AcceptProposeAttributeRequestItemParameters_1 = __decorate([
|
|
2240
|
+
(0, ts_serval_1.type)("AcceptProposeAttributeRequestItemParameters")
|
|
2241
|
+
], AcceptProposeAttributeRequestItemParameters);
|
|
2242
|
+
exports.AcceptProposeAttributeRequestItemParameters = AcceptProposeAttributeRequestItemParameters;
|
|
2243
|
+
//# sourceMappingURL=AcceptProposeAttributeRequestItemParameters.js.map
|
|
2244
|
+
|
|
2245
|
+
/***/ }),
|
|
2246
|
+
|
|
2247
|
+
/***/ "./dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js":
|
|
2248
|
+
/*!*******************************************************************************************************!*\
|
|
2249
|
+
!*** ./dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js ***!
|
|
2250
|
+
\*******************************************************************************************************/
|
|
2251
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2252
|
+
|
|
2253
|
+
"use strict";
|
|
2254
|
+
|
|
2255
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2256
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2257
|
+
};
|
|
2258
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2259
|
+
exports.ProposeAttributeRequestItemProcessor = void 0;
|
|
2260
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
2261
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
2262
|
+
const consumption_1 = __webpack_require__(/*! ../../../../consumption */ "./dist/consumption/index.js");
|
|
2263
|
+
const ConsumptionAttribute_1 = __webpack_require__(/*! ../../../attributes/local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js");
|
|
2264
|
+
const GenericRequestItemProcessor_1 = __webpack_require__(/*! ../GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js");
|
|
2265
|
+
const validateQuery_1 = __importDefault(__webpack_require__(/*! ../utility/validateQuery */ "./dist/modules/requests/itemProcessors/utility/validateQuery.js"));
|
|
2266
|
+
const ValidationResult_1 = __webpack_require__(/*! ../ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
2267
|
+
const AcceptProposeAttributeRequestItemParameters_1 = __webpack_require__(/*! ./AcceptProposeAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js");
|
|
2268
|
+
class ProposeAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
2269
|
+
canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
2270
|
+
const queryValidationResult = (0, validateQuery_1.default)(requestItem.query, this.currentIdentityAddress, recipient);
|
|
2271
|
+
if (queryValidationResult.isError()) {
|
|
2272
|
+
return queryValidationResult;
|
|
2273
|
+
}
|
|
2274
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2275
|
+
}
|
|
2276
|
+
async canAccept(_requestItem, params, requestInfo) {
|
|
2277
|
+
const parsedParams = AcceptProposeAttributeRequestItemParameters_1.AcceptProposeAttributeRequestItemParameters.from(params);
|
|
2278
|
+
if (parsedParams.attributeId) {
|
|
2279
|
+
const foundAttribute = await this.consumptionController.attributes.getConsumptionAttribute(parsedParams.attributeId);
|
|
2280
|
+
if (!foundAttribute) {
|
|
2281
|
+
return ValidationResult_1.ValidationResult.error(transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, requestInfo.id.toString()));
|
|
2282
|
+
}
|
|
2283
|
+
if (!this.accountController.identity.isMe(foundAttribute.content.owner)) {
|
|
2284
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("The given Attribute belongs to someone else. You can only share own Attributes."));
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2288
|
+
}
|
|
2289
|
+
async accept(_requestItem, params, requestInfo) {
|
|
2290
|
+
const parsedParams = AcceptProposeAttributeRequestItemParameters_1.AcceptProposeAttributeRequestItemParameters.from(params);
|
|
2291
|
+
let sharedConsumptionAttribute;
|
|
2292
|
+
if (parsedParams.attributeId) {
|
|
2293
|
+
sharedConsumptionAttribute = await this.copyExistingAttribute(parsedParams.attributeId, requestInfo);
|
|
2294
|
+
}
|
|
2295
|
+
else {
|
|
2296
|
+
sharedConsumptionAttribute = await this.createNewAttribute(parsedParams.attribute, requestInfo);
|
|
2297
|
+
}
|
|
2298
|
+
return content_1.ProposeAttributeAcceptResponseItem.from({
|
|
2299
|
+
result: content_1.ResponseItemResult.Accepted,
|
|
2300
|
+
attributeId: sharedConsumptionAttribute.id,
|
|
2301
|
+
attribute: sharedConsumptionAttribute.content
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
async copyExistingAttribute(attributeId, requestInfo) {
|
|
2305
|
+
return await this.consumptionController.attributes.createSharedConsumptionAttributeCopy({
|
|
2306
|
+
attributeId: transport_1.CoreId.from(attributeId),
|
|
2307
|
+
peer: transport_1.CoreAddress.from(requestInfo.peer),
|
|
2308
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
async createNewAttribute(attribute, requestInfo) {
|
|
2312
|
+
if (attribute instanceof content_1.IdentityAttribute) {
|
|
2313
|
+
const repositoryConsumptionAttribute = await this.consumptionController.attributes.createConsumptionAttribute({
|
|
2314
|
+
content: attribute
|
|
2315
|
+
});
|
|
2316
|
+
return await this.consumptionController.attributes.createSharedConsumptionAttributeCopy({
|
|
2317
|
+
attributeId: transport_1.CoreId.from(repositoryConsumptionAttribute.id),
|
|
2318
|
+
peer: transport_1.CoreAddress.from(requestInfo.peer),
|
|
2319
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
return await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2323
|
+
content: attribute,
|
|
2324
|
+
peer: requestInfo.peer,
|
|
2325
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
async applyIncomingResponseItem(responseItem, _requestItem, requestInfo) {
|
|
2329
|
+
if (!(responseItem instanceof content_1.ProposeAttributeAcceptResponseItem)) {
|
|
2330
|
+
return;
|
|
2331
|
+
}
|
|
2332
|
+
await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2333
|
+
id: responseItem.attributeId,
|
|
2334
|
+
content: responseItem.attribute,
|
|
2335
|
+
peer: requestInfo.peer,
|
|
2336
|
+
requestReference: requestInfo.id
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
exports.ProposeAttributeRequestItemProcessor = ProposeAttributeRequestItemProcessor;
|
|
2341
|
+
//# sourceMappingURL=ProposeAttributeRequestItemProcessor.js.map
|
|
2342
|
+
|
|
2343
|
+
/***/ }),
|
|
2344
|
+
|
|
2077
2345
|
/***/ "./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js":
|
|
2078
2346
|
/*!********************************************************************************************************!*\
|
|
2079
2347
|
!*** ./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js ***!
|
|
@@ -2091,21 +2359,39 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
2091
2359
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
2092
2360
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2093
2361
|
};
|
|
2362
|
+
var AcceptReadAttributeRequestItemParameters_1;
|
|
2094
2363
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2095
2364
|
exports.AcceptReadAttributeRequestItemParameters = void 0;
|
|
2096
2365
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
2366
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
2097
2367
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
2098
|
-
|
|
2368
|
+
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
2369
|
+
let AcceptReadAttributeRequestItemParameters = AcceptReadAttributeRequestItemParameters_1 = class AcceptReadAttributeRequestItemParameters extends ts_serval_1.Serializable {
|
|
2099
2370
|
static from(value) {
|
|
2100
2371
|
return this.fromAny(value);
|
|
2101
2372
|
}
|
|
2373
|
+
static postFrom(value) {
|
|
2374
|
+
const typedValue = value;
|
|
2375
|
+
if (typedValue.attributeId && typedValue.attribute) {
|
|
2376
|
+
throw new ts_serval_1.ValidationError(AcceptReadAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.attribute), `You cannot specify both ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} and ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
|
|
2377
|
+
}
|
|
2378
|
+
if (!typedValue.attributeId && !typedValue.attribute) {
|
|
2379
|
+
throw new ts_serval_1.ValidationError(AcceptReadAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.attribute), `You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
|
|
2380
|
+
}
|
|
2381
|
+
return value;
|
|
2382
|
+
}
|
|
2102
2383
|
};
|
|
2103
2384
|
__decorate([
|
|
2104
2385
|
(0, ts_serval_1.serialize)(),
|
|
2105
|
-
(0, ts_serval_1.validate)(),
|
|
2386
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
2106
2387
|
__metadata("design:type", transport_1.CoreId)
|
|
2107
2388
|
], AcceptReadAttributeRequestItemParameters.prototype, "attributeId", void 0);
|
|
2108
|
-
|
|
2389
|
+
__decorate([
|
|
2390
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
2391
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
2392
|
+
__metadata("design:type", Object)
|
|
2393
|
+
], AcceptReadAttributeRequestItemParameters.prototype, "attribute", void 0);
|
|
2394
|
+
AcceptReadAttributeRequestItemParameters = AcceptReadAttributeRequestItemParameters_1 = __decorate([
|
|
2109
2395
|
(0, ts_serval_1.type)("AcceptReadAttributeRequestItemParameters")
|
|
2110
2396
|
], AcceptReadAttributeRequestItemParameters);
|
|
2111
2397
|
exports.AcceptReadAttributeRequestItemParameters = AcceptReadAttributeRequestItemParameters;
|
|
@@ -2117,10 +2403,13 @@ exports.AcceptReadAttributeRequestItemParameters = AcceptReadAttributeRequestIte
|
|
|
2117
2403
|
/*!*************************************************************************************************!*\
|
|
2118
2404
|
!*** ./dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js ***!
|
|
2119
2405
|
\*************************************************************************************************/
|
|
2120
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
2406
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2121
2407
|
|
|
2122
2408
|
"use strict";
|
|
2123
2409
|
|
|
2410
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2411
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2412
|
+
};
|
|
2124
2413
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2125
2414
|
exports.ReadAttributeRequestItemProcessor = void 0;
|
|
2126
2415
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
@@ -2128,41 +2417,78 @@ const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transpor
|
|
|
2128
2417
|
const consumption_1 = __webpack_require__(/*! ../../../../consumption */ "./dist/consumption/index.js");
|
|
2129
2418
|
const ConsumptionAttribute_1 = __webpack_require__(/*! ../../../attributes/local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js");
|
|
2130
2419
|
const GenericRequestItemProcessor_1 = __webpack_require__(/*! ../GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js");
|
|
2420
|
+
const validateQuery_1 = __importDefault(__webpack_require__(/*! ../utility/validateQuery */ "./dist/modules/requests/itemProcessors/utility/validateQuery.js"));
|
|
2131
2421
|
const ValidationResult_1 = __webpack_require__(/*! ../ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
2132
2422
|
const AcceptReadAttributeRequestItemParameters_1 = __webpack_require__(/*! ./AcceptReadAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js");
|
|
2133
2423
|
class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
2134
|
-
|
|
2135
|
-
const
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
return ValidationResult_1.ValidationResult.error(transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, request.id.toString()));
|
|
2424
|
+
canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
2425
|
+
const queryValidationResult = (0, validateQuery_1.default)(requestItem.query, this.currentIdentityAddress, recipient);
|
|
2426
|
+
if (queryValidationResult.isError()) {
|
|
2427
|
+
return queryValidationResult;
|
|
2139
2428
|
}
|
|
2140
|
-
|
|
2141
|
-
|
|
2429
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2430
|
+
}
|
|
2431
|
+
async canAccept(_requestItem, params, requestInfo) {
|
|
2432
|
+
const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
|
|
2433
|
+
if (parsedParams.attributeId) {
|
|
2434
|
+
const foundAttribute = await this.consumptionController.attributes.getConsumptionAttribute(parsedParams.attributeId);
|
|
2435
|
+
if (!foundAttribute) {
|
|
2436
|
+
return ValidationResult_1.ValidationResult.error(transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, requestInfo.id.toString()));
|
|
2437
|
+
}
|
|
2438
|
+
if (!this.accountController.identity.isMe(foundAttribute.content.owner)) {
|
|
2439
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("The given Attribute belongs to someone else. You can only share own Attributes."));
|
|
2440
|
+
}
|
|
2142
2441
|
}
|
|
2143
2442
|
return ValidationResult_1.ValidationResult.success();
|
|
2144
2443
|
}
|
|
2145
|
-
async accept(_requestItem, params,
|
|
2146
|
-
const
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
}
|
|
2444
|
+
async accept(_requestItem, params, requestInfo) {
|
|
2445
|
+
const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
|
|
2446
|
+
let sharedConsumptionAttribute;
|
|
2447
|
+
if (parsedParams.attributeId) {
|
|
2448
|
+
sharedConsumptionAttribute = await this.copyExistingAttribute(parsedParams.attributeId, requestInfo);
|
|
2449
|
+
}
|
|
2450
|
+
else {
|
|
2451
|
+
sharedConsumptionAttribute = await this.createNewAttribute(parsedParams.attribute, requestInfo);
|
|
2452
|
+
}
|
|
2151
2453
|
return content_1.ReadAttributeAcceptResponseItem.from({
|
|
2152
2454
|
result: content_1.ResponseItemResult.Accepted,
|
|
2153
|
-
attributeId:
|
|
2154
|
-
attribute:
|
|
2455
|
+
attributeId: sharedConsumptionAttribute.id,
|
|
2456
|
+
attribute: sharedConsumptionAttribute.content
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
async copyExistingAttribute(attributeId, requestInfo) {
|
|
2460
|
+
return await this.consumptionController.attributes.createSharedConsumptionAttributeCopy({
|
|
2461
|
+
attributeId: transport_1.CoreId.from(attributeId),
|
|
2462
|
+
peer: transport_1.CoreAddress.from(requestInfo.peer),
|
|
2463
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2155
2464
|
});
|
|
2156
2465
|
}
|
|
2157
|
-
async
|
|
2466
|
+
async createNewAttribute(attribute, requestInfo) {
|
|
2467
|
+
if (attribute instanceof content_1.IdentityAttribute) {
|
|
2468
|
+
const repositoryConsumptionAttribute = await this.consumptionController.attributes.createConsumptionAttribute({
|
|
2469
|
+
content: attribute
|
|
2470
|
+
});
|
|
2471
|
+
return await this.consumptionController.attributes.createSharedConsumptionAttributeCopy({
|
|
2472
|
+
attributeId: transport_1.CoreId.from(repositoryConsumptionAttribute.id),
|
|
2473
|
+
peer: transport_1.CoreAddress.from(requestInfo.peer),
|
|
2474
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
return await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2478
|
+
content: attribute,
|
|
2479
|
+
peer: requestInfo.peer,
|
|
2480
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
async applyIncomingResponseItem(responseItem, _requestItem, requestInfo) {
|
|
2158
2484
|
if (!(responseItem instanceof content_1.ReadAttributeAcceptResponseItem)) {
|
|
2159
2485
|
return;
|
|
2160
2486
|
}
|
|
2161
2487
|
await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2162
2488
|
id: responseItem.attributeId,
|
|
2163
2489
|
content: responseItem.attribute,
|
|
2164
|
-
peer:
|
|
2165
|
-
requestReference:
|
|
2490
|
+
peer: requestInfo.peer,
|
|
2491
|
+
requestReference: requestInfo.id
|
|
2166
2492
|
});
|
|
2167
2493
|
}
|
|
2168
2494
|
}
|
|
@@ -2171,6 +2497,170 @@ exports.ReadAttributeRequestItemProcessor = ReadAttributeRequestItemProcessor;
|
|
|
2171
2497
|
|
|
2172
2498
|
/***/ }),
|
|
2173
2499
|
|
|
2500
|
+
/***/ "./dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js":
|
|
2501
|
+
/*!**********************************************************************************************************!*\
|
|
2502
|
+
!*** ./dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js ***!
|
|
2503
|
+
\**********************************************************************************************************/
|
|
2504
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2505
|
+
|
|
2506
|
+
"use strict";
|
|
2507
|
+
|
|
2508
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2509
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2510
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2511
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2512
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2513
|
+
};
|
|
2514
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2515
|
+
exports.AcceptShareAttributeRequestItemParameters = void 0;
|
|
2516
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
2517
|
+
let AcceptShareAttributeRequestItemParameters = class AcceptShareAttributeRequestItemParameters extends ts_serval_1.Serializable {
|
|
2518
|
+
static from(value) {
|
|
2519
|
+
return this.fromAny(value);
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
AcceptShareAttributeRequestItemParameters = __decorate([
|
|
2523
|
+
(0, ts_serval_1.type)("AcceptShareAttributeRequestItemParameters")
|
|
2524
|
+
], AcceptShareAttributeRequestItemParameters);
|
|
2525
|
+
exports.AcceptShareAttributeRequestItemParameters = AcceptShareAttributeRequestItemParameters;
|
|
2526
|
+
//# sourceMappingURL=AcceptShareAttributeRequestItemParameters.js.map
|
|
2527
|
+
|
|
2528
|
+
/***/ }),
|
|
2529
|
+
|
|
2530
|
+
/***/ "./dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js":
|
|
2531
|
+
/*!***************************************************************************************************!*\
|
|
2532
|
+
!*** ./dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js ***!
|
|
2533
|
+
\***************************************************************************************************/
|
|
2534
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2535
|
+
|
|
2536
|
+
"use strict";
|
|
2537
|
+
|
|
2538
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2539
|
+
exports.ShareAttributeRequestItemProcessor = void 0;
|
|
2540
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
2541
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
2542
|
+
const consumption_1 = __webpack_require__(/*! ../../../../consumption */ "./dist/consumption/index.js");
|
|
2543
|
+
const GenericRequestItemProcessor_1 = __webpack_require__(/*! ../GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js");
|
|
2544
|
+
const ValidationResult_1 = __webpack_require__(/*! ../ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
2545
|
+
class ShareAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
2546
|
+
async canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
2547
|
+
const attribute = await this.consumptionController.attributes.getConsumptionAttribute(requestItem.attributeId);
|
|
2548
|
+
if (!attribute) {
|
|
2549
|
+
return ValidationResult_1.ValidationResult.error(transport_1.TransportErrors.general.recordNotFound(content_1.Attribute, requestItem.attributeId.toString()));
|
|
2550
|
+
}
|
|
2551
|
+
const attributeOwnerValidationResult = this.validateAttributeOwner(attribute.content, this.currentIdentityAddress, recipient);
|
|
2552
|
+
if (attributeOwnerValidationResult.isError()) {
|
|
2553
|
+
return attributeOwnerValidationResult;
|
|
2554
|
+
}
|
|
2555
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2556
|
+
}
|
|
2557
|
+
async checkPrerequisitesOfIncomingRequestItem(requestItem, requestInfo) {
|
|
2558
|
+
const relationshipToShareWith = await this.accountController.relationships.getRelationshipToIdentity(requestItem.shareWith);
|
|
2559
|
+
if (!relationshipToShareWith) {
|
|
2560
|
+
return false; // Should the containing Request move to Error state?
|
|
2561
|
+
}
|
|
2562
|
+
const attribute = await this.consumptionController.attributes.getConsumptionAttribute(requestItem.attributeId);
|
|
2563
|
+
if (!attribute) {
|
|
2564
|
+
return false; // Should the containing Request move to Error state?
|
|
2565
|
+
}
|
|
2566
|
+
if (this.validateAttributeOwner(attribute.content, requestInfo.peer, this.currentIdentityAddress).isError()) {
|
|
2567
|
+
return false;
|
|
2568
|
+
}
|
|
2569
|
+
return true;
|
|
2570
|
+
}
|
|
2571
|
+
validateAttributeOwner(attribute, sender, recipient) {
|
|
2572
|
+
const attributeOwner = attribute.owner;
|
|
2573
|
+
if (attribute instanceof content_1.IdentityAttribute) {
|
|
2574
|
+
if (!attributeOwner.equals(recipient)) {
|
|
2575
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("Can only request sharing of identity attributes owned by the recipient."));
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
if (attribute instanceof content_1.RelationshipAttribute) {
|
|
2579
|
+
if (!attributeOwner.equals(recipient) && !attributeOwner.equals(sender)) {
|
|
2580
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("Cannot request sharing of relationship attributes not owned by recipient or sender."));
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2584
|
+
}
|
|
2585
|
+
canAccept(_requestItem, _params, _requestInfo) {
|
|
2586
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2587
|
+
}
|
|
2588
|
+
async accept(requestItem, _params, _requestInfo) {
|
|
2589
|
+
const attribute = await this.consumptionController.attributes.getConsumptionAttribute(requestItem.attributeId);
|
|
2590
|
+
if (!(await this.isAttributeAlreadyShared(attribute, requestItem.shareWith))) {
|
|
2591
|
+
await this.shareAttribute(attribute, requestItem.shareWith);
|
|
2592
|
+
}
|
|
2593
|
+
return content_1.AcceptResponseItem.from({ result: content_1.ResponseItemResult.Accepted });
|
|
2594
|
+
}
|
|
2595
|
+
async isAttributeAlreadyShared(attribute, shareWith) {
|
|
2596
|
+
if (attribute.content instanceof content_1.IdentityAttribute) {
|
|
2597
|
+
return ((await this.consumptionController.attributes.getConsumptionAttributes({
|
|
2598
|
+
"shareInfo.sourceAttribute": attribute.shareInfo.sourceAttribute.toString(),
|
|
2599
|
+
"shareInfo.peer": shareWith.toString() // eslint-disable-line @typescript-eslint/naming-convention
|
|
2600
|
+
})).length > 0);
|
|
2601
|
+
}
|
|
2602
|
+
return ((await this.consumptionController.attributes.getConsumptionAttributes({
|
|
2603
|
+
"shareInfo.sourceAttribute": attribute.id.toString(),
|
|
2604
|
+
"shareInfo.peer": shareWith.toString() // eslint-disable-line @typescript-eslint/naming-convention
|
|
2605
|
+
})).length > 0);
|
|
2606
|
+
}
|
|
2607
|
+
async shareAttribute(attribute, shareWith) {
|
|
2608
|
+
const createAttributeRequestItem = content_1.CreateAttributeRequestItem.from({
|
|
2609
|
+
attribute: attribute.content,
|
|
2610
|
+
mustBeAccepted: true
|
|
2611
|
+
});
|
|
2612
|
+
const createAttributeRequest = await this.consumptionController.outgoingRequests.create({
|
|
2613
|
+
peer: shareWith,
|
|
2614
|
+
content: content_1.Request.from({
|
|
2615
|
+
items: [createAttributeRequestItem]
|
|
2616
|
+
})
|
|
2617
|
+
});
|
|
2618
|
+
const message = await this.accountController.messages.sendMessage({
|
|
2619
|
+
recipients: [shareWith],
|
|
2620
|
+
content: createAttributeRequest.content
|
|
2621
|
+
});
|
|
2622
|
+
await this.consumptionController.outgoingRequests.sent({
|
|
2623
|
+
requestId: createAttributeRequest.id,
|
|
2624
|
+
requestSourceObject: message
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
exports.ShareAttributeRequestItemProcessor = ShareAttributeRequestItemProcessor;
|
|
2629
|
+
//# sourceMappingURL=ShareAttributeRequestItemProcessor.js.map
|
|
2630
|
+
|
|
2631
|
+
/***/ }),
|
|
2632
|
+
|
|
2633
|
+
/***/ "./dist/modules/requests/itemProcessors/utility/validateQuery.js":
|
|
2634
|
+
/*!***********************************************************************!*\
|
|
2635
|
+
!*** ./dist/modules/requests/itemProcessors/utility/validateQuery.js ***!
|
|
2636
|
+
\***********************************************************************/
|
|
2637
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2638
|
+
|
|
2639
|
+
"use strict";
|
|
2640
|
+
|
|
2641
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2642
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
2643
|
+
const consumption_1 = __webpack_require__(/*! ../../../../consumption */ "./dist/consumption/index.js");
|
|
2644
|
+
const ValidationResult_1 = __webpack_require__(/*! ../ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
2645
|
+
function validateQuery(query, sender, recipient) {
|
|
2646
|
+
if (query instanceof content_1.RelationshipAttributeQuery) {
|
|
2647
|
+
if (query.thirdParty?.equals(sender)) {
|
|
2648
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("Cannot query an Attribute with the own address as third party."));
|
|
2649
|
+
}
|
|
2650
|
+
if (query.thirdParty?.equals(recipient)) {
|
|
2651
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("Cannot query an Attribute with the recipient's address as third party."));
|
|
2652
|
+
}
|
|
2653
|
+
if (query.owner.equals(sender) && query.thirdParty !== undefined) {
|
|
2654
|
+
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.invalidRequestItem("Cannot query own Attributes from a third party."));
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2658
|
+
}
|
|
2659
|
+
exports["default"] = validateQuery;
|
|
2660
|
+
//# sourceMappingURL=validateQuery.js.map
|
|
2661
|
+
|
|
2662
|
+
/***/ }),
|
|
2663
|
+
|
|
2174
2664
|
/***/ "./dist/modules/requests/local/ConsumptionRequest.js":
|
|
2175
2665
|
/*!***********************************************************!*\
|
|
2176
2666
|
!*** ./dist/modules/requests/local/ConsumptionRequest.js ***!
|
|
@@ -2465,32 +2955,32 @@ class OutgoingRequestsController extends consumption_1.ConsumptionBaseController
|
|
|
2465
2955
|
}
|
|
2466
2956
|
async canCreate(params) {
|
|
2467
2957
|
const parsedParams = CreateOutgoingRequestParameters_1.CreateOutgoingRequestParameters.from(params);
|
|
2468
|
-
const innerResults = await this.canCreateItems(parsedParams.content.
|
|
2958
|
+
const innerResults = await this.canCreateItems(parsedParams.content, parsedParams.peer);
|
|
2469
2959
|
const result = ValidationResult_1.ValidationResult.fromItems(innerResults);
|
|
2470
2960
|
return result;
|
|
2471
2961
|
}
|
|
2472
|
-
async canCreateItems(
|
|
2962
|
+
async canCreateItems(request, recipient) {
|
|
2473
2963
|
const results = [];
|
|
2474
|
-
for (const requestItem of items) {
|
|
2964
|
+
for (const requestItem of request.items) {
|
|
2475
2965
|
if (requestItem instanceof content_1.RequestItem) {
|
|
2476
|
-
const canCreateItem = await this.canCreateItem(requestItem);
|
|
2966
|
+
const canCreateItem = await this.canCreateItem(requestItem, request, recipient);
|
|
2477
2967
|
results.push(canCreateItem);
|
|
2478
2968
|
}
|
|
2479
2969
|
else {
|
|
2480
|
-
const result = await this.canCreateItemGroup(requestItem);
|
|
2970
|
+
const result = await this.canCreateItemGroup(requestItem, request, recipient);
|
|
2481
2971
|
results.push(result);
|
|
2482
2972
|
}
|
|
2483
2973
|
}
|
|
2484
2974
|
return results;
|
|
2485
2975
|
}
|
|
2486
|
-
async canCreateItem(requestItem) {
|
|
2976
|
+
async canCreateItem(requestItem, request, recipient) {
|
|
2487
2977
|
const processor = this.processorRegistry.getProcessorForItem(requestItem);
|
|
2488
|
-
return await processor.canCreateOutgoingRequestItem(requestItem);
|
|
2978
|
+
return await processor.canCreateOutgoingRequestItem(requestItem, request, recipient);
|
|
2489
2979
|
}
|
|
2490
|
-
async canCreateItemGroup(requestItem) {
|
|
2980
|
+
async canCreateItemGroup(requestItem, request, recipient) {
|
|
2491
2981
|
const innerResults = [];
|
|
2492
2982
|
for (const innerRequestItem of requestItem.items) {
|
|
2493
|
-
const canCreateItem = await this.canCreateItem(innerRequestItem);
|
|
2983
|
+
const canCreateItem = await this.canCreateItem(innerRequestItem, request, recipient);
|
|
2494
2984
|
innerResults.push(canCreateItem);
|
|
2495
2985
|
}
|
|
2496
2986
|
const result = ValidationResult_1.ValidationResult.fromItems(innerResults);
|
|
@@ -6081,7 +6571,7 @@ function formatOffset(offset, format) {
|
|
|
6081
6571
|
function timeObject(obj) {
|
|
6082
6572
|
return pick(obj, ["hour", "minute", "second", "millisecond"]);
|
|
6083
6573
|
}
|
|
6084
|
-
var ianaRegex = /[A-Za-z_+-]{1,256}(
|
|
6574
|
+
var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
|
|
6085
6575
|
|
|
6086
6576
|
/**
|
|
6087
6577
|
* @private
|
|
@@ -6855,6 +7345,11 @@ var Zone = /*#__PURE__*/function () {
|
|
|
6855
7345
|
get: function get() {
|
|
6856
7346
|
throw new ZoneIsAbstractError();
|
|
6857
7347
|
}
|
|
7348
|
+
}, {
|
|
7349
|
+
key: "ianaName",
|
|
7350
|
+
get: function get() {
|
|
7351
|
+
return this.name;
|
|
7352
|
+
}
|
|
6858
7353
|
/**
|
|
6859
7354
|
* Returns whether the offset is known to be fixed for the whole year.
|
|
6860
7355
|
* @abstract
|
|
@@ -7289,6 +7784,15 @@ var FixedOffsetZone = /*#__PURE__*/function (_Zone) {
|
|
|
7289
7784
|
get: function get() {
|
|
7290
7785
|
return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow");
|
|
7291
7786
|
}
|
|
7787
|
+
}, {
|
|
7788
|
+
key: "ianaName",
|
|
7789
|
+
get: function get() {
|
|
7790
|
+
if (this.fixed === 0) {
|
|
7791
|
+
return "Etc/UTC";
|
|
7792
|
+
} else {
|
|
7793
|
+
return "Etc/GMT" + formatOffset(-this.fixed, "narrow");
|
|
7794
|
+
}
|
|
7795
|
+
}
|
|
7292
7796
|
}, {
|
|
7293
7797
|
key: "isUniversal",
|
|
7294
7798
|
get: function get() {
|
|
@@ -8198,7 +8702,7 @@ function combineExtractors() {
|
|
|
8198
8702
|
zone = _ex[1],
|
|
8199
8703
|
next = _ex[2];
|
|
8200
8704
|
|
|
8201
|
-
return [_extends({}, mergedVals, val),
|
|
8705
|
+
return [_extends({}, mergedVals, val), zone || mergedZone, next];
|
|
8202
8706
|
}, [{}, null, 1]).slice(0, 2);
|
|
8203
8707
|
};
|
|
8204
8708
|
}
|
|
@@ -8244,19 +8748,20 @@ function simpleParse() {
|
|
|
8244
8748
|
} // ISO and SQL parsing
|
|
8245
8749
|
|
|
8246
8750
|
|
|
8247
|
-
var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8751
|
+
var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
|
|
8752
|
+
var isoExtendedZone = "(?:" + offsetRegex.source + "?(?:\\[(" + ianaRegex.source + ")\\])?)?";
|
|
8753
|
+
var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
|
|
8754
|
+
var isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + isoExtendedZone);
|
|
8755
|
+
var isoTimeExtensionRegex = RegExp("(?:T" + isoTimeRegex.source + ")?");
|
|
8756
|
+
var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
|
|
8757
|
+
var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
|
|
8758
|
+
var isoOrdinalRegex = /(\d{4})-?(\d{3})/;
|
|
8759
|
+
var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
|
|
8760
|
+
var extractISOOrdinalData = simpleParse("year", "ordinal");
|
|
8761
|
+
var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one
|
|
8762
|
+
|
|
8763
|
+
var sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?");
|
|
8764
|
+
var sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?");
|
|
8260
8765
|
|
|
8261
8766
|
function int(match, pos, fallback) {
|
|
8262
8767
|
var m = match[pos];
|
|
@@ -8431,11 +8936,11 @@ var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionR
|
|
|
8431
8936
|
var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
|
|
8432
8937
|
var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
|
|
8433
8938
|
var isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
|
|
8434
|
-
var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset);
|
|
8435
|
-
var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset);
|
|
8436
|
-
var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset);
|
|
8437
|
-
var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);
|
|
8438
|
-
|
|
8939
|
+
var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone);
|
|
8940
|
+
var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone);
|
|
8941
|
+
var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone);
|
|
8942
|
+
var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
|
|
8943
|
+
/*
|
|
8439
8944
|
* @private
|
|
8440
8945
|
*/
|
|
8441
8946
|
|
|
@@ -8457,10 +8962,9 @@ function parseISOTimeOnly(s) {
|
|
|
8457
8962
|
}
|
|
8458
8963
|
var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
|
|
8459
8964
|
var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
|
|
8460
|
-
var extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone);
|
|
8461
8965
|
var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
|
|
8462
8966
|
function parseSQL(s) {
|
|
8463
|
-
return parse(s, [sqlYmdWithTimeExtensionRegex,
|
|
8967
|
+
return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
|
|
8464
8968
|
}
|
|
8465
8969
|
|
|
8466
8970
|
var INVALID$2 = "Invalid Duration"; // unit conversion constants
|
|
@@ -10608,7 +11112,7 @@ function intUnit(regex, post) {
|
|
|
10608
11112
|
}
|
|
10609
11113
|
|
|
10610
11114
|
var NBSP = String.fromCharCode(160);
|
|
10611
|
-
var spaceOrNBSP = "
|
|
11115
|
+
var spaceOrNBSP = "[ " + NBSP + "]";
|
|
10612
11116
|
var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
|
|
10613
11117
|
|
|
10614
11118
|
function fixListRegex(s) {
|
|
@@ -11492,7 +11996,7 @@ function _toISODate(o, extended) {
|
|
|
11492
11996
|
return c;
|
|
11493
11997
|
}
|
|
11494
11998
|
|
|
11495
|
-
function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {
|
|
11999
|
+
function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone) {
|
|
11496
12000
|
var c = padStart(o.c.hour);
|
|
11497
12001
|
|
|
11498
12002
|
if (extended) {
|
|
@@ -11516,7 +12020,7 @@ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeO
|
|
|
11516
12020
|
}
|
|
11517
12021
|
|
|
11518
12022
|
if (includeOffset) {
|
|
11519
|
-
if (o.isOffsetFixed && o.offset === 0) {
|
|
12023
|
+
if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {
|
|
11520
12024
|
c += "Z";
|
|
11521
12025
|
} else if (o.o < 0) {
|
|
11522
12026
|
c += "-";
|
|
@@ -11531,6 +12035,10 @@ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeO
|
|
|
11531
12035
|
}
|
|
11532
12036
|
}
|
|
11533
12037
|
|
|
12038
|
+
if (extendedZone) {
|
|
12039
|
+
c += "[" + o.zone.ianaName + "]";
|
|
12040
|
+
}
|
|
12041
|
+
|
|
11534
12042
|
return c;
|
|
11535
12043
|
} // defaults for unspecified units in the supported calendars
|
|
11536
12044
|
|
|
@@ -12704,6 +13212,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12704
13212
|
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
|
|
12705
13213
|
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
|
|
12706
13214
|
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
|
|
13215
|
+
* @param {boolean} [opts.extendedZone=true] - add the time zone format extension
|
|
12707
13216
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
12708
13217
|
* @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
|
|
12709
13218
|
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
|
|
@@ -12722,7 +13231,9 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12722
13231
|
_ref4$suppressMillise = _ref4.suppressMilliseconds,
|
|
12723
13232
|
suppressMilliseconds = _ref4$suppressMillise === void 0 ? false : _ref4$suppressMillise,
|
|
12724
13233
|
_ref4$includeOffset = _ref4.includeOffset,
|
|
12725
|
-
includeOffset = _ref4$includeOffset === void 0 ? true : _ref4$includeOffset
|
|
13234
|
+
includeOffset = _ref4$includeOffset === void 0 ? true : _ref4$includeOffset,
|
|
13235
|
+
_ref4$extendedZone = _ref4.extendedZone,
|
|
13236
|
+
extendedZone = _ref4$extendedZone === void 0 ? false : _ref4$extendedZone;
|
|
12726
13237
|
|
|
12727
13238
|
if (!this.isValid) {
|
|
12728
13239
|
return null;
|
|
@@ -12733,7 +13244,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12733
13244
|
var c = _toISODate(this, ext);
|
|
12734
13245
|
|
|
12735
13246
|
c += "T";
|
|
12736
|
-
c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset);
|
|
13247
|
+
c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
|
|
12737
13248
|
return c;
|
|
12738
13249
|
}
|
|
12739
13250
|
/**
|
|
@@ -12773,6 +13284,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12773
13284
|
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
|
|
12774
13285
|
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
|
|
12775
13286
|
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
|
|
13287
|
+
* @param {boolean} [opts.extendedZone=true] - add the time zone format extension
|
|
12776
13288
|
* @param {boolean} [opts.includePrefix=false] - include the `T` prefix
|
|
12777
13289
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
12778
13290
|
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
|
|
@@ -12793,6 +13305,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12793
13305
|
includeOffset = _ref6$includeOffset === void 0 ? true : _ref6$includeOffset,
|
|
12794
13306
|
_ref6$includePrefix = _ref6.includePrefix,
|
|
12795
13307
|
includePrefix = _ref6$includePrefix === void 0 ? false : _ref6$includePrefix,
|
|
13308
|
+
_ref6$extendedZone = _ref6.extendedZone,
|
|
13309
|
+
extendedZone = _ref6$extendedZone === void 0 ? false : _ref6$extendedZone,
|
|
12796
13310
|
_ref6$format = _ref6.format,
|
|
12797
13311
|
format = _ref6$format === void 0 ? "extended" : _ref6$format;
|
|
12798
13312
|
|
|
@@ -12801,7 +13315,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12801
13315
|
}
|
|
12802
13316
|
|
|
12803
13317
|
var c = includePrefix ? "T" : "";
|
|
12804
|
-
return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset);
|
|
13318
|
+
return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
|
|
12805
13319
|
}
|
|
12806
13320
|
/**
|
|
12807
13321
|
* Returns an RFC 2822-compatible string representation of this DateTime
|
|
@@ -13608,7 +14122,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
13608
14122
|
return false;
|
|
13609
14123
|
} else {
|
|
13610
14124
|
return this.offset > this.set({
|
|
13611
|
-
month: 1
|
|
14125
|
+
month: 1,
|
|
14126
|
+
day: 1
|
|
13612
14127
|
}).offset || this.offset > this.set({
|
|
13613
14128
|
month: 5
|
|
13614
14129
|
}).offset;
|
|
@@ -13894,7 +14409,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
13894
14409
|
}
|
|
13895
14410
|
}
|
|
13896
14411
|
|
|
13897
|
-
var VERSION = "2.
|
|
14412
|
+
var VERSION = "2.4.0";
|
|
13898
14413
|
|
|
13899
14414
|
exports.DateTime = DateTime;
|
|
13900
14415
|
exports.Duration = Duration;
|