@nmshd/consumption 2.0.0-alpha.20 → 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 +4 -4
- 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 -2
- package/dist/consumption/ConsumptionErrors.js +2 -5
- package/dist/consumption/ConsumptionErrors.js.map +1 -1
- package/dist/modules/attributes/ConsumptionAttributesController.d.ts +7 -9
- package/dist/modules/attributes/ConsumptionAttributesController.js +3 -14
- 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/{CreateRelationshipAttributeParams.d.ts → local/CreateRelationshipAttributeParams.d.ts} +0 -0
- package/dist/modules/attributes/{CreateRelationshipAttributeParams.js → local/CreateRelationshipAttributeParams.js} +0 -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 +11 -7
- package/dist/modules/index.js +11 -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/CreateAttributeRequestItemProcessor.d.ts +8 -5
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +25 -18
- package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -1
- 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/ReadAttributeRequestItemProcessor.d.ts +7 -5
- package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +30 -19
- 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 +717 -403
- 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 +10 -10
- package/dist/modules/attributes/CreateConsumptionAttributeParams.js.map +0 -1
- package/dist/modules/attributes/CreatePeerConsumptionAttributeParams.js.map +0 -1
- package/dist/modules/attributes/CreateRelationshipAttributeParams.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,10 +17,10 @@ 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-06-
|
|
23
|
-
commit: "
|
|
20
|
+
version: "2.0.0-alpha.21",
|
|
21
|
+
build: "40",
|
|
22
|
+
date: "2022-06-27T07:10:09+00:00",
|
|
23
|
+
commit: "26615e613c315ca69ebb76ab528cc8cabec673a9",
|
|
24
24
|
dependencies: {"@js-soft/docdb-querytranslator":"^1.0.1","ts-simple-nameof":"^1.3.1"},
|
|
25
25
|
libraries: {
|
|
26
26
|
transport: transport_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,11 +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.
|
|
176
|
-
}
|
|
177
|
-
canOnlyShareOwnAttributes() {
|
|
178
|
-
return new transport_1.CoreError("error.consumption.requests.canOnlyShareOwnAttributes", "The given Attribute belongs to someone else. You can only share own Attributes.");
|
|
187
|
+
invalidRequestItem(message) {
|
|
188
|
+
return new transport_1.CoreError("error.consumption.requests.invalidRequestItem", message);
|
|
179
189
|
}
|
|
180
190
|
}
|
|
181
191
|
class RelationshipInfo {
|
|
@@ -299,12 +309,11 @@ exports.ConsumptionAttributesController = void 0;
|
|
|
299
309
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
300
310
|
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
301
311
|
const consumption_1 = __webpack_require__(/*! ../../consumption */ "./dist/consumption/index.js");
|
|
302
|
-
const CreateRelationshipAttributeParams_1 = __webpack_require__(/*! ./CreateRelationshipAttributeParams */ "./dist/modules/attributes/CreateRelationshipAttributeParams.js");
|
|
303
|
-
const CreateSharedConsumptionAttributeCopyParams_1 = __webpack_require__(/*! ./CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js");
|
|
304
312
|
const ConsumptionAttribute_1 = __webpack_require__(/*! ./local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js");
|
|
305
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");
|
|
306
315
|
const QueryTranslator_1 = __webpack_require__(/*! ./local/QueryTranslator */ "./dist/modules/attributes/local/QueryTranslator.js");
|
|
307
|
-
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");
|
|
308
317
|
class ConsumptionAttributesController extends consumption_1.ConsumptionBaseController {
|
|
309
318
|
constructor(parent) {
|
|
310
319
|
super(consumption_1.ConsumptionControllerName.ConsumptionAttributesController, parent);
|
|
@@ -416,16 +425,6 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
|
|
|
416
425
|
await this.attributes.create(successor);
|
|
417
426
|
return successor;
|
|
418
427
|
}
|
|
419
|
-
async createRelationshipAttribute(params) {
|
|
420
|
-
const parsedParams = CreateRelationshipAttributeParams_1.CreateRelationshipAttributeParams.from(params);
|
|
421
|
-
const shareInfo = ConsumptionAttributeShareInfo_1.ConsumptionAttributeShareInfo.from({
|
|
422
|
-
peer: parsedParams.peer,
|
|
423
|
-
requestReference: parsedParams.requestReference
|
|
424
|
-
});
|
|
425
|
-
const sharedConsumptionAttribute = await ConsumptionAttribute_1.ConsumptionAttribute.fromAttribute(params.content, undefined, shareInfo);
|
|
426
|
-
await this.attributes.create(sharedConsumptionAttribute);
|
|
427
|
-
return sharedConsumptionAttribute;
|
|
428
|
-
}
|
|
429
428
|
async createSharedConsumptionAttributeCopy(params) {
|
|
430
429
|
const parsedParams = CreateSharedConsumptionAttributeCopyParams_1.CreateSharedConsumptionAttributeCopyParams.from(params);
|
|
431
430
|
const sourceAttribute = await this.getConsumptionAttribute(parsedParams.attributeId);
|
|
@@ -447,7 +446,7 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
|
|
|
447
446
|
requestReference: params.requestReference
|
|
448
447
|
});
|
|
449
448
|
const peerConsumptionAttribute = ConsumptionAttribute_1.ConsumptionAttribute.from({
|
|
450
|
-
id: params.id,
|
|
449
|
+
id: params.id ?? (await consumption_1.ConsumptionIds.attribute.generate()),
|
|
451
450
|
content: params.content,
|
|
452
451
|
shareInfo: shareInfo,
|
|
453
452
|
createdAt: transport_1.CoreDate.utc()
|
|
@@ -482,46 +481,10 @@ exports.ConsumptionAttributesController = ConsumptionAttributesController;
|
|
|
482
481
|
|
|
483
482
|
/***/ }),
|
|
484
483
|
|
|
485
|
-
/***/ "./dist/modules/attributes/
|
|
486
|
-
|
|
487
|
-
!*** ./dist/modules/attributes/
|
|
488
|
-
|
|
489
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
490
|
-
|
|
491
|
-
"use strict";
|
|
492
|
-
|
|
493
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
494
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
495
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
496
|
-
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;
|
|
497
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
498
|
-
};
|
|
499
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
500
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
501
|
-
};
|
|
502
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
503
|
-
exports.CreateConsumptionAttributeParams = void 0;
|
|
504
|
-
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
505
|
-
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
506
|
-
class CreateConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
507
|
-
static from(value) {
|
|
508
|
-
return this.fromAny(value);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
__decorate([
|
|
512
|
-
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
513
|
-
(0, ts_serval_1.validate)(),
|
|
514
|
-
__metadata("design:type", Object)
|
|
515
|
-
], CreateConsumptionAttributeParams.prototype, "content", void 0);
|
|
516
|
-
exports.CreateConsumptionAttributeParams = CreateConsumptionAttributeParams;
|
|
517
|
-
//# sourceMappingURL=CreateConsumptionAttributeParams.js.map
|
|
518
|
-
|
|
519
|
-
/***/ }),
|
|
520
|
-
|
|
521
|
-
/***/ "./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js":
|
|
522
|
-
/*!*************************************************************************!*\
|
|
523
|
-
!*** ./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js ***!
|
|
524
|
-
\*************************************************************************/
|
|
484
|
+
/***/ "./dist/modules/attributes/local/ConsumptionAttribute.js":
|
|
485
|
+
/*!***************************************************************!*\
|
|
486
|
+
!*** ./dist/modules/attributes/local/ConsumptionAttribute.js ***!
|
|
487
|
+
\***************************************************************/
|
|
525
488
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
526
489
|
|
|
527
490
|
"use strict";
|
|
@@ -536,94 +499,75 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
536
499
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
537
500
|
};
|
|
538
501
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
539
|
-
exports.
|
|
502
|
+
exports.ConsumptionAttribute = void 0;
|
|
540
503
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
541
504
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
542
505
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
543
|
-
|
|
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
|
+
}
|
|
544
521
|
static from(value) {
|
|
545
522
|
return this.fromAny(value);
|
|
546
523
|
}
|
|
547
|
-
|
|
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
|
+
};
|
|
548
534
|
__decorate([
|
|
549
|
-
(0, ts_serval_1.serialize)(),
|
|
550
535
|
(0, ts_serval_1.validate)(),
|
|
551
|
-
__metadata("design:type", transport_1.CoreId)
|
|
552
|
-
], CreatePeerConsumptionAttributeParams.prototype, "id", void 0);
|
|
553
|
-
__decorate([
|
|
554
536
|
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
555
|
-
(0, ts_serval_1.validate)(),
|
|
556
537
|
__metadata("design:type", Object)
|
|
557
|
-
],
|
|
538
|
+
], ConsumptionAttribute.prototype, "content", void 0);
|
|
558
539
|
__decorate([
|
|
559
|
-
(0, ts_serval_1.serialize)(),
|
|
560
540
|
(0, ts_serval_1.validate)(),
|
|
561
|
-
__metadata("design:type", transport_1.CoreId)
|
|
562
|
-
], CreatePeerConsumptionAttributeParams.prototype, "requestReference", void 0);
|
|
563
|
-
__decorate([
|
|
564
541
|
(0, ts_serval_1.serialize)(),
|
|
565
|
-
(
|
|
566
|
-
|
|
567
|
-
], CreatePeerConsumptionAttributeParams.prototype, "peer", void 0);
|
|
568
|
-
exports.CreatePeerConsumptionAttributeParams = CreatePeerConsumptionAttributeParams;
|
|
569
|
-
//# sourceMappingURL=CreatePeerConsumptionAttributeParams.js.map
|
|
570
|
-
|
|
571
|
-
/***/ }),
|
|
572
|
-
|
|
573
|
-
/***/ "./dist/modules/attributes/CreateRelationshipAttributeParams.js":
|
|
574
|
-
/*!**********************************************************************!*\
|
|
575
|
-
!*** ./dist/modules/attributes/CreateRelationshipAttributeParams.js ***!
|
|
576
|
-
\**********************************************************************/
|
|
577
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
578
|
-
|
|
579
|
-
"use strict";
|
|
580
|
-
|
|
581
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
582
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
583
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
584
|
-
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;
|
|
585
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
586
|
-
};
|
|
587
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
588
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
589
|
-
};
|
|
590
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
591
|
-
exports.CreateRelationshipAttributeParams = void 0;
|
|
592
|
-
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
593
|
-
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
594
|
-
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
595
|
-
let CreateRelationshipAttributeParams = class CreateRelationshipAttributeParams extends ts_serval_1.Serializable {
|
|
596
|
-
static from(value) {
|
|
597
|
-
return this.fromAny(value);
|
|
598
|
-
}
|
|
599
|
-
};
|
|
542
|
+
__metadata("design:type", transport_1.CoreDate)
|
|
543
|
+
], ConsumptionAttribute.prototype, "createdAt", void 0);
|
|
600
544
|
__decorate([
|
|
545
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
601
546
|
(0, ts_serval_1.serialize)(),
|
|
602
|
-
(
|
|
603
|
-
|
|
604
|
-
], CreateRelationshipAttributeParams.prototype, "content", void 0);
|
|
547
|
+
__metadata("design:type", transport_1.CoreId)
|
|
548
|
+
], ConsumptionAttribute.prototype, "succeeds", void 0);
|
|
605
549
|
__decorate([
|
|
550
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
606
551
|
(0, ts_serval_1.serialize)(),
|
|
607
|
-
(
|
|
608
|
-
|
|
609
|
-
], CreateRelationshipAttributeParams.prototype, "peer", void 0);
|
|
552
|
+
__metadata("design:type", transport_1.CoreId)
|
|
553
|
+
], ConsumptionAttribute.prototype, "succeededBy", void 0);
|
|
610
554
|
__decorate([
|
|
555
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
611
556
|
(0, ts_serval_1.serialize)(),
|
|
612
|
-
(
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
//# sourceMappingURL=CreateRelationshipAttributeParams.js.map
|
|
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
|
|
620
564
|
|
|
621
565
|
/***/ }),
|
|
622
566
|
|
|
623
|
-
/***/ "./dist/modules/attributes/
|
|
624
|
-
|
|
625
|
-
!*** ./dist/modules/attributes/
|
|
626
|
-
|
|
567
|
+
/***/ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js":
|
|
568
|
+
/*!************************************************************************!*\
|
|
569
|
+
!*** ./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js ***!
|
|
570
|
+
\************************************************************************/
|
|
627
571
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
628
572
|
|
|
629
573
|
"use strict";
|
|
@@ -638,38 +582,38 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
638
582
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
639
583
|
};
|
|
640
584
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
641
|
-
exports.
|
|
585
|
+
exports.ConsumptionAttributeShareInfo = void 0;
|
|
642
586
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
643
587
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
644
|
-
class
|
|
588
|
+
class ConsumptionAttributeShareInfo extends transport_1.CoreSerializable {
|
|
645
589
|
static from(value) {
|
|
646
|
-
return
|
|
590
|
+
return super.fromAny(value);
|
|
647
591
|
}
|
|
648
592
|
}
|
|
649
593
|
__decorate([
|
|
650
|
-
(0, ts_serval_1.serialize)(),
|
|
651
594
|
(0, ts_serval_1.validate)(),
|
|
595
|
+
(0, ts_serval_1.serialize)(),
|
|
652
596
|
__metadata("design:type", transport_1.CoreId)
|
|
653
|
-
],
|
|
597
|
+
], ConsumptionAttributeShareInfo.prototype, "requestReference", void 0);
|
|
654
598
|
__decorate([
|
|
655
|
-
(0, ts_serval_1.serialize)(),
|
|
656
599
|
(0, ts_serval_1.validate)(),
|
|
600
|
+
(0, ts_serval_1.serialize)(),
|
|
657
601
|
__metadata("design:type", transport_1.CoreAddress)
|
|
658
|
-
],
|
|
602
|
+
], ConsumptionAttributeShareInfo.prototype, "peer", void 0);
|
|
659
603
|
__decorate([
|
|
604
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
660
605
|
(0, ts_serval_1.serialize)(),
|
|
661
|
-
(0, ts_serval_1.validate)(),
|
|
662
606
|
__metadata("design:type", transport_1.CoreId)
|
|
663
|
-
],
|
|
664
|
-
exports.
|
|
665
|
-
//# sourceMappingURL=
|
|
607
|
+
], ConsumptionAttributeShareInfo.prototype, "sourceAttribute", void 0);
|
|
608
|
+
exports.ConsumptionAttributeShareInfo = ConsumptionAttributeShareInfo;
|
|
609
|
+
//# sourceMappingURL=ConsumptionAttributeShareInfo.js.map
|
|
666
610
|
|
|
667
611
|
/***/ }),
|
|
668
612
|
|
|
669
|
-
/***/ "./dist/modules/attributes/
|
|
670
|
-
|
|
671
|
-
!*** ./dist/modules/attributes/
|
|
672
|
-
|
|
613
|
+
/***/ "./dist/modules/attributes/local/CreateConsumptionAttributeParams.js":
|
|
614
|
+
/*!***************************************************************************!*\
|
|
615
|
+
!*** ./dist/modules/attributes/local/CreateConsumptionAttributeParams.js ***!
|
|
616
|
+
\***************************************************************************/
|
|
673
617
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
674
618
|
|
|
675
619
|
"use strict";
|
|
@@ -684,28 +628,28 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
684
628
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
685
629
|
};
|
|
686
630
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
687
|
-
exports.
|
|
631
|
+
exports.CreateConsumptionAttributeParams = void 0;
|
|
688
632
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
689
633
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
690
|
-
class
|
|
634
|
+
class CreateConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
691
635
|
static from(value) {
|
|
692
636
|
return this.fromAny(value);
|
|
693
637
|
}
|
|
694
638
|
}
|
|
695
639
|
__decorate([
|
|
696
|
-
(0, ts_serval_1.serialize)(),
|
|
640
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
697
641
|
(0, ts_serval_1.validate)(),
|
|
698
|
-
__metadata("design:type",
|
|
699
|
-
],
|
|
700
|
-
exports.
|
|
701
|
-
//# sourceMappingURL=
|
|
642
|
+
__metadata("design:type", Object)
|
|
643
|
+
], CreateConsumptionAttributeParams.prototype, "content", void 0);
|
|
644
|
+
exports.CreateConsumptionAttributeParams = CreateConsumptionAttributeParams;
|
|
645
|
+
//# sourceMappingURL=CreateConsumptionAttributeParams.js.map
|
|
702
646
|
|
|
703
647
|
/***/ }),
|
|
704
648
|
|
|
705
|
-
/***/ "./dist/modules/attributes/
|
|
706
|
-
|
|
707
|
-
!*** ./dist/modules/attributes/
|
|
708
|
-
|
|
649
|
+
/***/ "./dist/modules/attributes/local/CreatePeerConsumptionAttributeParams.js":
|
|
650
|
+
/*!*******************************************************************************!*\
|
|
651
|
+
!*** ./dist/modules/attributes/local/CreatePeerConsumptionAttributeParams.js ***!
|
|
652
|
+
\*******************************************************************************/
|
|
709
653
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
710
654
|
|
|
711
655
|
"use strict";
|
|
@@ -720,10 +664,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
720
664
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
721
665
|
};
|
|
722
666
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
723
|
-
exports.
|
|
667
|
+
exports.CreatePeerConsumptionAttributeParams = void 0;
|
|
724
668
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
725
669
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
726
|
-
|
|
670
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
671
|
+
class CreatePeerConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
727
672
|
static from(value) {
|
|
728
673
|
return this.fromAny(value);
|
|
729
674
|
}
|
|
@@ -731,59 +676,32 @@ class GetRelationshipAttributesParams extends ts_serval_1.Serializable {
|
|
|
731
676
|
__decorate([
|
|
732
677
|
(0, ts_serval_1.serialize)(),
|
|
733
678
|
(0, ts_serval_1.validate)(),
|
|
734
|
-
__metadata("design:type",
|
|
735
|
-
],
|
|
736
|
-
exports.GetRelationshipAttributesParams = GetRelationshipAttributesParams;
|
|
737
|
-
//# sourceMappingURL=GetRelationshipAttributesParams.js.map
|
|
738
|
-
|
|
739
|
-
/***/ }),
|
|
740
|
-
|
|
741
|
-
/***/ "./dist/modules/attributes/SucceedConsumptionAttributeParams.js":
|
|
742
|
-
/*!**********************************************************************!*\
|
|
743
|
-
!*** ./dist/modules/attributes/SucceedConsumptionAttributeParams.js ***!
|
|
744
|
-
\**********************************************************************/
|
|
745
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
746
|
-
|
|
747
|
-
"use strict";
|
|
748
|
-
|
|
749
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
750
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
751
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
752
|
-
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;
|
|
753
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
754
|
-
};
|
|
755
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
756
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
757
|
-
};
|
|
758
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
759
|
-
exports.SucceedConsumptionAttributeParams = void 0;
|
|
760
|
-
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
761
|
-
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
762
|
-
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
763
|
-
class SucceedConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
764
|
-
static from(value) {
|
|
765
|
-
return this.fromAny(value);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
679
|
+
__metadata("design:type", transport_1.CoreId)
|
|
680
|
+
], CreatePeerConsumptionAttributeParams.prototype, "id", void 0);
|
|
768
681
|
__decorate([
|
|
769
682
|
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
770
683
|
(0, ts_serval_1.validate)(),
|
|
771
684
|
__metadata("design:type", Object)
|
|
772
|
-
],
|
|
685
|
+
], CreatePeerConsumptionAttributeParams.prototype, "content", void 0);
|
|
773
686
|
__decorate([
|
|
774
687
|
(0, ts_serval_1.serialize)(),
|
|
775
688
|
(0, ts_serval_1.validate)(),
|
|
776
689
|
__metadata("design:type", transport_1.CoreId)
|
|
777
|
-
],
|
|
778
|
-
|
|
779
|
-
|
|
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
|
|
780
698
|
|
|
781
699
|
/***/ }),
|
|
782
700
|
|
|
783
|
-
/***/ "./dist/modules/attributes/
|
|
784
|
-
|
|
785
|
-
!*** ./dist/modules/attributes/
|
|
786
|
-
|
|
701
|
+
/***/ "./dist/modules/attributes/local/CreateSharedConsumptionAttributeCopyParams.js":
|
|
702
|
+
/*!*************************************************************************************!*\
|
|
703
|
+
!*** ./dist/modules/attributes/local/CreateSharedConsumptionAttributeCopyParams.js ***!
|
|
704
|
+
\*************************************************************************************/
|
|
787
705
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
788
706
|
|
|
789
707
|
"use strict";
|
|
@@ -798,11 +716,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
798
716
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
799
717
|
};
|
|
800
718
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
801
|
-
exports.
|
|
719
|
+
exports.CreateSharedConsumptionAttributeCopyParams = void 0;
|
|
802
720
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
803
|
-
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
804
721
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
805
|
-
class
|
|
722
|
+
class CreateSharedConsumptionAttributeCopyParams extends ts_serval_1.Serializable {
|
|
806
723
|
static from(value) {
|
|
807
724
|
return this.fromAny(value);
|
|
808
725
|
}
|
|
@@ -811,21 +728,26 @@ __decorate([
|
|
|
811
728
|
(0, ts_serval_1.serialize)(),
|
|
812
729
|
(0, ts_serval_1.validate)(),
|
|
813
730
|
__metadata("design:type", transport_1.CoreId)
|
|
814
|
-
],
|
|
731
|
+
], CreateSharedConsumptionAttributeCopyParams.prototype, "attributeId", void 0);
|
|
815
732
|
__decorate([
|
|
816
|
-
(0, ts_serval_1.serialize)(
|
|
733
|
+
(0, ts_serval_1.serialize)(),
|
|
817
734
|
(0, ts_serval_1.validate)(),
|
|
818
|
-
__metadata("design:type",
|
|
819
|
-
],
|
|
820
|
-
|
|
821
|
-
|
|
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
|
|
822
744
|
|
|
823
745
|
/***/ }),
|
|
824
746
|
|
|
825
|
-
/***/ "./dist/modules/attributes/local/
|
|
826
|
-
|
|
827
|
-
!*** ./dist/modules/attributes/local/
|
|
828
|
-
|
|
747
|
+
/***/ "./dist/modules/attributes/local/GetIdentityAttributesParams.js":
|
|
748
|
+
/*!**********************************************************************!*\
|
|
749
|
+
!*** ./dist/modules/attributes/local/GetIdentityAttributesParams.js ***!
|
|
750
|
+
\**********************************************************************/
|
|
829
751
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
830
752
|
|
|
831
753
|
"use strict";
|
|
@@ -840,75 +762,28 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
840
762
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
841
763
|
};
|
|
842
764
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
843
|
-
exports.
|
|
765
|
+
exports.GetIdentityAttributesParams = void 0;
|
|
844
766
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
845
767
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
846
|
-
|
|
847
|
-
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
848
|
-
const consumption_1 = __webpack_require__(/*! ../../../consumption */ "./dist/consumption/index.js");
|
|
849
|
-
const ConsumptionAttributeShareInfo_1 = __webpack_require__(/*! ./ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js");
|
|
850
|
-
let ConsumptionAttribute = class ConsumptionAttribute extends transport_1.CoreSynchronizable {
|
|
851
|
-
constructor() {
|
|
852
|
-
super(...arguments);
|
|
853
|
-
this.technicalProperties = [
|
|
854
|
-
"@type",
|
|
855
|
-
"@context",
|
|
856
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt),
|
|
857
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.succeeds),
|
|
858
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt)
|
|
859
|
-
];
|
|
860
|
-
this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.content)];
|
|
861
|
-
}
|
|
768
|
+
class GetIdentityAttributesParams extends ts_serval_1.Serializable {
|
|
862
769
|
static from(value) {
|
|
863
770
|
return this.fromAny(value);
|
|
864
771
|
}
|
|
865
|
-
|
|
866
|
-
return this.from({
|
|
867
|
-
content: attribute,
|
|
868
|
-
id: await consumption_1.ConsumptionIds.attribute.generate(),
|
|
869
|
-
createdAt: transport_1.CoreDate.utc(),
|
|
870
|
-
succeeds: succeeds,
|
|
871
|
-
shareInfo: shareInfo
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
__decorate([
|
|
876
|
-
(0, ts_serval_1.validate)(),
|
|
877
|
-
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
878
|
-
__metadata("design:type", Object)
|
|
879
|
-
], ConsumptionAttribute.prototype, "content", void 0);
|
|
880
|
-
__decorate([
|
|
881
|
-
(0, ts_serval_1.validate)(),
|
|
882
|
-
(0, ts_serval_1.serialize)(),
|
|
883
|
-
__metadata("design:type", transport_1.CoreDate)
|
|
884
|
-
], ConsumptionAttribute.prototype, "createdAt", void 0);
|
|
885
|
-
__decorate([
|
|
886
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
887
|
-
(0, ts_serval_1.serialize)(),
|
|
888
|
-
__metadata("design:type", transport_1.CoreId)
|
|
889
|
-
], ConsumptionAttribute.prototype, "succeeds", void 0);
|
|
890
|
-
__decorate([
|
|
891
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
892
|
-
(0, ts_serval_1.serialize)(),
|
|
893
|
-
__metadata("design:type", transport_1.CoreId)
|
|
894
|
-
], ConsumptionAttribute.prototype, "succeededBy", void 0);
|
|
772
|
+
}
|
|
895
773
|
__decorate([
|
|
896
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
897
774
|
(0, ts_serval_1.serialize)(),
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
exports.ConsumptionAttribute = ConsumptionAttribute;
|
|
904
|
-
//# 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
|
|
905
780
|
|
|
906
781
|
/***/ }),
|
|
907
782
|
|
|
908
|
-
/***/ "./dist/modules/attributes/local/
|
|
909
|
-
|
|
910
|
-
!*** ./dist/modules/attributes/local/
|
|
911
|
-
|
|
783
|
+
/***/ "./dist/modules/attributes/local/GetRelationshipAttributesParams.js":
|
|
784
|
+
/*!**************************************************************************!*\
|
|
785
|
+
!*** ./dist/modules/attributes/local/GetRelationshipAttributesParams.js ***!
|
|
786
|
+
\**************************************************************************/
|
|
912
787
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
913
788
|
|
|
914
789
|
"use strict";
|
|
@@ -923,31 +798,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
923
798
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
924
799
|
};
|
|
925
800
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
926
|
-
exports.
|
|
801
|
+
exports.GetRelationshipAttributesParams = void 0;
|
|
927
802
|
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
928
|
-
const
|
|
929
|
-
class
|
|
803
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
804
|
+
class GetRelationshipAttributesParams extends ts_serval_1.Serializable {
|
|
930
805
|
static from(value) {
|
|
931
|
-
return
|
|
806
|
+
return this.fromAny(value);
|
|
932
807
|
}
|
|
933
808
|
}
|
|
934
809
|
__decorate([
|
|
935
|
-
(0, ts_serval_1.validate)(),
|
|
936
810
|
(0, ts_serval_1.serialize)(),
|
|
937
|
-
__metadata("design:type", transport_1.CoreId)
|
|
938
|
-
], ConsumptionAttributeShareInfo.prototype, "requestReference", void 0);
|
|
939
|
-
__decorate([
|
|
940
811
|
(0, ts_serval_1.validate)(),
|
|
941
|
-
(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
(0, ts_serval_1.validate)({ nullable: true }),
|
|
946
|
-
(0, ts_serval_1.serialize)(),
|
|
947
|
-
__metadata("design:type", transport_1.CoreId)
|
|
948
|
-
], ConsumptionAttributeShareInfo.prototype, "sourceAttribute", void 0);
|
|
949
|
-
exports.ConsumptionAttributeShareInfo = ConsumptionAttributeShareInfo;
|
|
950
|
-
//# 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
|
|
951
816
|
|
|
952
817
|
/***/ }),
|
|
953
818
|
|
|
@@ -1066,8 +931,92 @@ exports.relationshipQueryTranslator = new docdb_querytranslator_1.QueryTranslato
|
|
|
1066
931
|
};
|
|
1067
932
|
}
|
|
1068
933
|
}
|
|
1069
|
-
});
|
|
1070
|
-
//# sourceMappingURL=QueryTranslator.js.map
|
|
934
|
+
});
|
|
935
|
+
//# sourceMappingURL=QueryTranslator.js.map
|
|
936
|
+
|
|
937
|
+
/***/ }),
|
|
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
|
|
1071
1020
|
|
|
1072
1021
|
/***/ }),
|
|
1073
1022
|
|
|
@@ -1232,15 +1181,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
1232
1181
|
};
|
|
1233
1182
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1234
1183
|
__exportStar(__webpack_require__(/*! ./attributes/ConsumptionAttributesController */ "./dist/modules/attributes/ConsumptionAttributesController.js"), exports);
|
|
1235
|
-
__exportStar(__webpack_require__(/*! ./attributes/CreateConsumptionAttributeParams */ "./dist/modules/attributes/CreateConsumptionAttributeParams.js"), exports);
|
|
1236
|
-
__exportStar(__webpack_require__(/*! ./attributes/CreatePeerConsumptionAttributeParams */ "./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js"), exports);
|
|
1237
|
-
__exportStar(__webpack_require__(/*! ./attributes/CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js"), exports);
|
|
1238
|
-
__exportStar(__webpack_require__(/*! ./attributes/GetIdentityAttributesParams */ "./dist/modules/attributes/GetIdentityAttributesParams.js"), exports);
|
|
1239
|
-
__exportStar(__webpack_require__(/*! ./attributes/GetRelationshipAttributesParams */ "./dist/modules/attributes/GetRelationshipAttributesParams.js"), exports);
|
|
1240
1184
|
__exportStar(__webpack_require__(/*! ./attributes/local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js"), exports);
|
|
1241
1185
|
__exportStar(__webpack_require__(/*! ./attributes/local/ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js"), exports);
|
|
1242
|
-
__exportStar(__webpack_require__(/*! ./attributes/
|
|
1243
|
-
__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);
|
|
1244
1193
|
__exportStar(__webpack_require__(/*! ./drafts/DraftsController */ "./dist/modules/drafts/DraftsController.js"), exports);
|
|
1245
1194
|
__exportStar(__webpack_require__(/*! ./drafts/local/Draft */ "./dist/modules/drafts/local/Draft.js"), exports);
|
|
1246
1195
|
__exportStar(__webpack_require__(/*! ./requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters */ "./dist/modules/requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters.js"), exports);
|
|
@@ -1260,10 +1209,14 @@ __exportStar(__webpack_require__(/*! ./requests/itemProcessors/createAttribute/C
|
|
|
1260
1209
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js"), exports);
|
|
1261
1210
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/IRequestItemProcessor */ "./dist/modules/requests/itemProcessors/IRequestItemProcessor.js"), exports);
|
|
1262
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);
|
|
1263
1214
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js"), exports);
|
|
1264
1215
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js"), exports);
|
|
1265
1216
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/RequestItemConstructor */ "./dist/modules/requests/itemProcessors/RequestItemConstructor.js"), exports);
|
|
1266
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);
|
|
1267
1220
|
__exportStar(__webpack_require__(/*! ./requests/itemProcessors/ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js"), exports);
|
|
1268
1221
|
__exportStar(__webpack_require__(/*! ./requests/local/ConsumptionRequest */ "./dist/modules/requests/local/ConsumptionRequest.js"), exports);
|
|
1269
1222
|
__exportStar(__webpack_require__(/*! ./requests/local/ConsumptionRequestStatus */ "./dist/modules/requests/local/ConsumptionRequestStatus.js"), exports);
|
|
@@ -1440,7 +1393,7 @@ class IncomingRequestsController extends consumption_1.ConsumptionBaseController
|
|
|
1440
1393
|
for (const item of request.content.items) {
|
|
1441
1394
|
if (item instanceof content_1.RequestItem) {
|
|
1442
1395
|
const processor = this.processorRegistry.getProcessorForItem(item);
|
|
1443
|
-
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(item);
|
|
1396
|
+
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(item, request);
|
|
1444
1397
|
if (!prerequisitesFulfilled) {
|
|
1445
1398
|
return request;
|
|
1446
1399
|
}
|
|
@@ -1448,7 +1401,7 @@ class IncomingRequestsController extends consumption_1.ConsumptionBaseController
|
|
|
1448
1401
|
else {
|
|
1449
1402
|
for (const childItem of item.items) {
|
|
1450
1403
|
const processor = this.processorRegistry.getProcessorForItem(childItem);
|
|
1451
|
-
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(childItem);
|
|
1404
|
+
const prerequisitesFulfilled = await processor.checkPrerequisitesOfIncomingRequestItem(childItem, request);
|
|
1452
1405
|
if (!prerequisitesFulfilled) {
|
|
1453
1406
|
return request;
|
|
1454
1407
|
}
|
|
@@ -1952,6 +1905,8 @@ exports.AbstractRequestItemProcessor = void 0;
|
|
|
1952
1905
|
class AbstractRequestItemProcessor {
|
|
1953
1906
|
constructor(consumptionController) {
|
|
1954
1907
|
this.consumptionController = consumptionController;
|
|
1908
|
+
this.accountController = this.consumptionController.accountController;
|
|
1909
|
+
this.currentIdentityAddress = this.accountController.identity.address;
|
|
1955
1910
|
}
|
|
1956
1911
|
}
|
|
1957
1912
|
exports.AbstractRequestItemProcessor = AbstractRequestItemProcessor;
|
|
@@ -1974,34 +1929,34 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
1974
1929
|
const AbstractRequestItemProcessor_1 = __webpack_require__(/*! ./AbstractRequestItemProcessor */ "./dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js");
|
|
1975
1930
|
const ValidationResult_1 = __webpack_require__(/*! ./ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
1976
1931
|
class GenericRequestItemProcessor extends AbstractRequestItemProcessor_1.AbstractRequestItemProcessor {
|
|
1977
|
-
checkPrerequisitesOfIncomingRequestItem(
|
|
1932
|
+
checkPrerequisitesOfIncomingRequestItem(requestItem, requestInfo) {
|
|
1978
1933
|
return true;
|
|
1979
1934
|
}
|
|
1980
|
-
canAccept(requestItem, params,
|
|
1935
|
+
canAccept(requestItem, params, requestInfo) {
|
|
1981
1936
|
return ValidationResult_1.ValidationResult.success();
|
|
1982
1937
|
}
|
|
1983
|
-
canReject(requestItem, params,
|
|
1938
|
+
canReject(requestItem, params, requestInfo) {
|
|
1984
1939
|
return ValidationResult_1.ValidationResult.success();
|
|
1985
1940
|
}
|
|
1986
|
-
accept(requestItem, params,
|
|
1941
|
+
accept(requestItem, params, requestInfo) {
|
|
1987
1942
|
return content_1.AcceptResponseItem.from({
|
|
1988
1943
|
result: content_1.ResponseItemResult.Accepted,
|
|
1989
1944
|
metadata: requestItem.responseMetadata
|
|
1990
1945
|
});
|
|
1991
1946
|
}
|
|
1992
|
-
reject(requestItem, params,
|
|
1947
|
+
reject(requestItem, params, requestInfo) {
|
|
1993
1948
|
return content_1.RejectResponseItem.from({
|
|
1994
1949
|
result: content_1.ResponseItemResult.Rejected,
|
|
1995
1950
|
metadata: requestItem.responseMetadata
|
|
1996
1951
|
});
|
|
1997
1952
|
}
|
|
1998
|
-
canCreateOutgoingRequestItem(requestItem) {
|
|
1953
|
+
canCreateOutgoingRequestItem(requestItem, request, recipient) {
|
|
1999
1954
|
return ValidationResult_1.ValidationResult.success();
|
|
2000
1955
|
}
|
|
2001
|
-
canApplyIncomingResponseItem(responseItem, requestItem,
|
|
1956
|
+
canApplyIncomingResponseItem(responseItem, requestItem, requestInfo) {
|
|
2002
1957
|
return ValidationResult_1.ValidationResult.success();
|
|
2003
1958
|
}
|
|
2004
|
-
applyIncomingResponseItem(responseItem, requestItem,
|
|
1959
|
+
applyIncomingResponseItem(responseItem, requestItem, requestInfo) {
|
|
2005
1960
|
// do nothing
|
|
2006
1961
|
}
|
|
2007
1962
|
}
|
|
@@ -2060,24 +2015,21 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
2060
2015
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2061
2016
|
exports.RequestItemProcessorRegistry = void 0;
|
|
2062
2017
|
class RequestItemProcessorRegistry {
|
|
2063
|
-
constructor(consumptionController, processors =
|
|
2018
|
+
constructor(consumptionController, processors = new Map()) {
|
|
2064
2019
|
this.consumptionController = consumptionController;
|
|
2065
|
-
this.
|
|
2066
|
-
for (const { itemConstructor, processorConstructor } of processors) {
|
|
2067
|
-
this.registerProcessor(processorConstructor, itemConstructor);
|
|
2068
|
-
}
|
|
2020
|
+
this.processors = processors;
|
|
2069
2021
|
}
|
|
2070
|
-
registerProcessor(
|
|
2071
|
-
if (this.
|
|
2022
|
+
registerProcessor(itemConstructor, processorConstructor) {
|
|
2023
|
+
if (this.processors.has(itemConstructor)) {
|
|
2072
2024
|
throw new Error(`There is already a processor registered for '${itemConstructor.name}''. Use 'replaceProcessorForType' if you want to replace it.`);
|
|
2073
2025
|
}
|
|
2074
|
-
this.
|
|
2026
|
+
this.processors.set(itemConstructor, processorConstructor);
|
|
2075
2027
|
}
|
|
2076
|
-
|
|
2077
|
-
this.
|
|
2028
|
+
registerOrReplaceProcessor(itemConstructor, processorConstructor) {
|
|
2029
|
+
this.processors.set(itemConstructor, processorConstructor);
|
|
2078
2030
|
}
|
|
2079
2031
|
getProcessorForItem(item) {
|
|
2080
|
-
const constructor = this.
|
|
2032
|
+
const constructor = this.processors.get(item.constructor);
|
|
2081
2033
|
if (!constructor) {
|
|
2082
2034
|
throw new Error(`There was no processor registered for '${item.constructor.name}'.`);
|
|
2083
2035
|
}
|
|
@@ -2098,20 +2050,20 @@ exports.RequestItemProcessorRegistry = RequestItemProcessorRegistry;
|
|
|
2098
2050
|
"use strict";
|
|
2099
2051
|
|
|
2100
2052
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2101
|
-
exports.ErrorValidationResult = exports.
|
|
2053
|
+
exports.ErrorValidationResult = exports.SuccessfulValidationResult = exports.ValidationResult = void 0;
|
|
2102
2054
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
2103
2055
|
class ValidationResult {
|
|
2104
2056
|
constructor(items) {
|
|
2105
2057
|
this.items = items;
|
|
2106
2058
|
}
|
|
2107
2059
|
isSuccess() {
|
|
2108
|
-
return this instanceof
|
|
2060
|
+
return this instanceof SuccessfulValidationResult;
|
|
2109
2061
|
}
|
|
2110
2062
|
isError() {
|
|
2111
2063
|
return this instanceof ErrorValidationResult;
|
|
2112
2064
|
}
|
|
2113
2065
|
static success(items = []) {
|
|
2114
|
-
return new
|
|
2066
|
+
return new SuccessfulValidationResult(items);
|
|
2115
2067
|
}
|
|
2116
2068
|
static error(error, items = []) {
|
|
2117
2069
|
return new ErrorValidationResult(error, items);
|
|
@@ -2123,12 +2075,12 @@ class ValidationResult {
|
|
|
2123
2075
|
}
|
|
2124
2076
|
}
|
|
2125
2077
|
exports.ValidationResult = ValidationResult;
|
|
2126
|
-
class
|
|
2078
|
+
class SuccessfulValidationResult extends ValidationResult {
|
|
2127
2079
|
constructor(items) {
|
|
2128
2080
|
super(items);
|
|
2129
2081
|
}
|
|
2130
2082
|
}
|
|
2131
|
-
exports.
|
|
2083
|
+
exports.SuccessfulValidationResult = SuccessfulValidationResult;
|
|
2132
2084
|
class ErrorValidationResult extends ValidationResult {
|
|
2133
2085
|
constructor(error, items) {
|
|
2134
2086
|
super(items);
|
|
@@ -2185,41 +2137,48 @@ const consumption_1 = __webpack_require__(/*! ../../../../consumption */ "./dist
|
|
|
2185
2137
|
const GenericRequestItemProcessor_1 = __webpack_require__(/*! ../GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js");
|
|
2186
2138
|
const ValidationResult_1 = __webpack_require__(/*! ../ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
2187
2139
|
class CreateAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
2188
|
-
canCreateOutgoingRequestItem(requestItem) {
|
|
2189
|
-
// TODO: remove the following if we for sure only allow RelationshipAttributes in a RequestItem
|
|
2140
|
+
canCreateOutgoingRequestItem(requestItem, _request, _recipient) {
|
|
2190
2141
|
if (requestItem.attribute instanceof content_1.IdentityAttribute) {
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
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.`));
|
|
2197
2150
|
}
|
|
2198
2151
|
return ValidationResult_1.ValidationResult.success();
|
|
2199
2152
|
}
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
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."));
|
|
2203
2157
|
}
|
|
2204
|
-
|
|
2158
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2159
|
+
}
|
|
2160
|
+
async accept(requestItem, _params, requestInfo) {
|
|
2161
|
+
const peerConsumptionAttribute = await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2205
2162
|
content: requestItem.attribute,
|
|
2206
|
-
peer:
|
|
2207
|
-
requestReference:
|
|
2163
|
+
peer: requestInfo.peer,
|
|
2164
|
+
requestReference: requestInfo.id
|
|
2208
2165
|
});
|
|
2209
2166
|
return content_1.CreateAttributeAcceptResponseItem.from({
|
|
2167
|
+
attributeId: peerConsumptionAttribute.id,
|
|
2210
2168
|
result: content_1.ResponseItemResult.Accepted,
|
|
2211
|
-
|
|
2169
|
+
metadata: requestItem.responseMetadata
|
|
2212
2170
|
});
|
|
2213
2171
|
}
|
|
2214
|
-
async applyIncomingResponseItem(responseItem, requestItem,
|
|
2172
|
+
async applyIncomingResponseItem(responseItem, requestItem, requestInfo) {
|
|
2215
2173
|
if (!(responseItem instanceof content_1.CreateAttributeAcceptResponseItem)) {
|
|
2216
2174
|
return;
|
|
2217
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 */
|
|
2218
2177
|
await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2219
2178
|
id: responseItem.attributeId,
|
|
2220
2179
|
content: requestItem.attribute,
|
|
2221
|
-
peer:
|
|
2222
|
-
requestReference:
|
|
2180
|
+
peer: requestInfo.peer,
|
|
2181
|
+
requestReference: requestInfo.id
|
|
2223
2182
|
});
|
|
2224
2183
|
}
|
|
2225
2184
|
}
|
|
@@ -2228,6 +2187,161 @@ exports.CreateAttributeRequestItemProcessor = CreateAttributeRequestItemProcesso
|
|
|
2228
2187
|
|
|
2229
2188
|
/***/ }),
|
|
2230
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
|
+
|
|
2231
2345
|
/***/ "./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js":
|
|
2232
2346
|
/*!********************************************************************************************************!*\
|
|
2233
2347
|
!*** ./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js ***!
|
|
@@ -2289,10 +2403,13 @@ exports.AcceptReadAttributeRequestItemParameters = AcceptReadAttributeRequestIte
|
|
|
2289
2403
|
/*!*************************************************************************************************!*\
|
|
2290
2404
|
!*** ./dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js ***!
|
|
2291
2405
|
\*************************************************************************************************/
|
|
2292
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
2406
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2293
2407
|
|
|
2294
2408
|
"use strict";
|
|
2295
2409
|
|
|
2410
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2411
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2412
|
+
};
|
|
2296
2413
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2297
2414
|
exports.ReadAttributeRequestItemProcessor = void 0;
|
|
2298
2415
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
@@ -2300,30 +2417,38 @@ const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transpor
|
|
|
2300
2417
|
const consumption_1 = __webpack_require__(/*! ../../../../consumption */ "./dist/consumption/index.js");
|
|
2301
2418
|
const ConsumptionAttribute_1 = __webpack_require__(/*! ../../../attributes/local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js");
|
|
2302
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"));
|
|
2303
2421
|
const ValidationResult_1 = __webpack_require__(/*! ../ValidationResult */ "./dist/modules/requests/itemProcessors/ValidationResult.js");
|
|
2304
2422
|
const AcceptReadAttributeRequestItemParameters_1 = __webpack_require__(/*! ./AcceptReadAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js");
|
|
2305
2423
|
class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
2306
|
-
|
|
2424
|
+
canCreateOutgoingRequestItem(requestItem, _request, recipient) {
|
|
2425
|
+
const queryValidationResult = (0, validateQuery_1.default)(requestItem.query, this.currentIdentityAddress, recipient);
|
|
2426
|
+
if (queryValidationResult.isError()) {
|
|
2427
|
+
return queryValidationResult;
|
|
2428
|
+
}
|
|
2429
|
+
return ValidationResult_1.ValidationResult.success();
|
|
2430
|
+
}
|
|
2431
|
+
async canAccept(_requestItem, params, requestInfo) {
|
|
2307
2432
|
const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
|
|
2308
2433
|
if (parsedParams.attributeId) {
|
|
2309
2434
|
const foundAttribute = await this.consumptionController.attributes.getConsumptionAttribute(parsedParams.attributeId);
|
|
2310
2435
|
if (!foundAttribute) {
|
|
2311
|
-
return ValidationResult_1.ValidationResult.error(transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute,
|
|
2436
|
+
return ValidationResult_1.ValidationResult.error(transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, requestInfo.id.toString()));
|
|
2312
2437
|
}
|
|
2313
|
-
if (!this.
|
|
2314
|
-
return ValidationResult_1.ValidationResult.error(consumption_1.ConsumptionErrors.requests.
|
|
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."));
|
|
2315
2440
|
}
|
|
2316
2441
|
}
|
|
2317
2442
|
return ValidationResult_1.ValidationResult.success();
|
|
2318
2443
|
}
|
|
2319
|
-
async accept(_requestItem, params,
|
|
2444
|
+
async accept(_requestItem, params, requestInfo) {
|
|
2320
2445
|
const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
|
|
2321
2446
|
let sharedConsumptionAttribute;
|
|
2322
2447
|
if (parsedParams.attributeId) {
|
|
2323
|
-
sharedConsumptionAttribute = await this.copyExistingAttribute(parsedParams.attributeId,
|
|
2448
|
+
sharedConsumptionAttribute = await this.copyExistingAttribute(parsedParams.attributeId, requestInfo);
|
|
2324
2449
|
}
|
|
2325
2450
|
else {
|
|
2326
|
-
sharedConsumptionAttribute = await this.createNewAttribute(parsedParams.attribute,
|
|
2451
|
+
sharedConsumptionAttribute = await this.createNewAttribute(parsedParams.attribute, requestInfo);
|
|
2327
2452
|
}
|
|
2328
2453
|
return content_1.ReadAttributeAcceptResponseItem.from({
|
|
2329
2454
|
result: content_1.ResponseItemResult.Accepted,
|
|
@@ -2331,39 +2456,39 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
|
|
|
2331
2456
|
attribute: sharedConsumptionAttribute.content
|
|
2332
2457
|
});
|
|
2333
2458
|
}
|
|
2334
|
-
async copyExistingAttribute(attributeId,
|
|
2459
|
+
async copyExistingAttribute(attributeId, requestInfo) {
|
|
2335
2460
|
return await this.consumptionController.attributes.createSharedConsumptionAttributeCopy({
|
|
2336
2461
|
attributeId: transport_1.CoreId.from(attributeId),
|
|
2337
|
-
peer: transport_1.CoreAddress.from(
|
|
2338
|
-
requestReference: transport_1.CoreId.from(
|
|
2462
|
+
peer: transport_1.CoreAddress.from(requestInfo.peer),
|
|
2463
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2339
2464
|
});
|
|
2340
2465
|
}
|
|
2341
|
-
async createNewAttribute(attribute,
|
|
2466
|
+
async createNewAttribute(attribute, requestInfo) {
|
|
2342
2467
|
if (attribute instanceof content_1.IdentityAttribute) {
|
|
2343
2468
|
const repositoryConsumptionAttribute = await this.consumptionController.attributes.createConsumptionAttribute({
|
|
2344
2469
|
content: attribute
|
|
2345
2470
|
});
|
|
2346
2471
|
return await this.consumptionController.attributes.createSharedConsumptionAttributeCopy({
|
|
2347
2472
|
attributeId: transport_1.CoreId.from(repositoryConsumptionAttribute.id),
|
|
2348
|
-
peer: transport_1.CoreAddress.from(
|
|
2349
|
-
requestReference: transport_1.CoreId.from(
|
|
2473
|
+
peer: transport_1.CoreAddress.from(requestInfo.peer),
|
|
2474
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2350
2475
|
});
|
|
2351
2476
|
}
|
|
2352
|
-
return await this.consumptionController.attributes.
|
|
2477
|
+
return await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2353
2478
|
content: attribute,
|
|
2354
|
-
peer:
|
|
2355
|
-
requestReference: transport_1.CoreId.from(
|
|
2479
|
+
peer: requestInfo.peer,
|
|
2480
|
+
requestReference: transport_1.CoreId.from(requestInfo.id)
|
|
2356
2481
|
});
|
|
2357
2482
|
}
|
|
2358
|
-
async applyIncomingResponseItem(responseItem, _requestItem,
|
|
2483
|
+
async applyIncomingResponseItem(responseItem, _requestItem, requestInfo) {
|
|
2359
2484
|
if (!(responseItem instanceof content_1.ReadAttributeAcceptResponseItem)) {
|
|
2360
2485
|
return;
|
|
2361
2486
|
}
|
|
2362
2487
|
await this.consumptionController.attributes.createPeerConsumptionAttribute({
|
|
2363
2488
|
id: responseItem.attributeId,
|
|
2364
2489
|
content: responseItem.attribute,
|
|
2365
|
-
peer:
|
|
2366
|
-
requestReference:
|
|
2490
|
+
peer: requestInfo.peer,
|
|
2491
|
+
requestReference: requestInfo.id
|
|
2367
2492
|
});
|
|
2368
2493
|
}
|
|
2369
2494
|
}
|
|
@@ -2372,6 +2497,170 @@ exports.ReadAttributeRequestItemProcessor = ReadAttributeRequestItemProcessor;
|
|
|
2372
2497
|
|
|
2373
2498
|
/***/ }),
|
|
2374
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
|
+
|
|
2375
2664
|
/***/ "./dist/modules/requests/local/ConsumptionRequest.js":
|
|
2376
2665
|
/*!***********************************************************!*\
|
|
2377
2666
|
!*** ./dist/modules/requests/local/ConsumptionRequest.js ***!
|
|
@@ -2666,32 +2955,32 @@ class OutgoingRequestsController extends consumption_1.ConsumptionBaseController
|
|
|
2666
2955
|
}
|
|
2667
2956
|
async canCreate(params) {
|
|
2668
2957
|
const parsedParams = CreateOutgoingRequestParameters_1.CreateOutgoingRequestParameters.from(params);
|
|
2669
|
-
const innerResults = await this.canCreateItems(parsedParams.content.
|
|
2958
|
+
const innerResults = await this.canCreateItems(parsedParams.content, parsedParams.peer);
|
|
2670
2959
|
const result = ValidationResult_1.ValidationResult.fromItems(innerResults);
|
|
2671
2960
|
return result;
|
|
2672
2961
|
}
|
|
2673
|
-
async canCreateItems(
|
|
2962
|
+
async canCreateItems(request, recipient) {
|
|
2674
2963
|
const results = [];
|
|
2675
|
-
for (const requestItem of items) {
|
|
2964
|
+
for (const requestItem of request.items) {
|
|
2676
2965
|
if (requestItem instanceof content_1.RequestItem) {
|
|
2677
|
-
const canCreateItem = await this.canCreateItem(requestItem);
|
|
2966
|
+
const canCreateItem = await this.canCreateItem(requestItem, request, recipient);
|
|
2678
2967
|
results.push(canCreateItem);
|
|
2679
2968
|
}
|
|
2680
2969
|
else {
|
|
2681
|
-
const result = await this.canCreateItemGroup(requestItem);
|
|
2970
|
+
const result = await this.canCreateItemGroup(requestItem, request, recipient);
|
|
2682
2971
|
results.push(result);
|
|
2683
2972
|
}
|
|
2684
2973
|
}
|
|
2685
2974
|
return results;
|
|
2686
2975
|
}
|
|
2687
|
-
async canCreateItem(requestItem) {
|
|
2976
|
+
async canCreateItem(requestItem, request, recipient) {
|
|
2688
2977
|
const processor = this.processorRegistry.getProcessorForItem(requestItem);
|
|
2689
|
-
return await processor.canCreateOutgoingRequestItem(requestItem);
|
|
2978
|
+
return await processor.canCreateOutgoingRequestItem(requestItem, request, recipient);
|
|
2690
2979
|
}
|
|
2691
|
-
async canCreateItemGroup(requestItem) {
|
|
2980
|
+
async canCreateItemGroup(requestItem, request, recipient) {
|
|
2692
2981
|
const innerResults = [];
|
|
2693
2982
|
for (const innerRequestItem of requestItem.items) {
|
|
2694
|
-
const canCreateItem = await this.canCreateItem(innerRequestItem);
|
|
2983
|
+
const canCreateItem = await this.canCreateItem(innerRequestItem, request, recipient);
|
|
2695
2984
|
innerResults.push(canCreateItem);
|
|
2696
2985
|
}
|
|
2697
2986
|
const result = ValidationResult_1.ValidationResult.fromItems(innerResults);
|
|
@@ -6282,7 +6571,7 @@ function formatOffset(offset, format) {
|
|
|
6282
6571
|
function timeObject(obj) {
|
|
6283
6572
|
return pick(obj, ["hour", "minute", "second", "millisecond"]);
|
|
6284
6573
|
}
|
|
6285
|
-
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})?)?/;
|
|
6286
6575
|
|
|
6287
6576
|
/**
|
|
6288
6577
|
* @private
|
|
@@ -7056,6 +7345,11 @@ var Zone = /*#__PURE__*/function () {
|
|
|
7056
7345
|
get: function get() {
|
|
7057
7346
|
throw new ZoneIsAbstractError();
|
|
7058
7347
|
}
|
|
7348
|
+
}, {
|
|
7349
|
+
key: "ianaName",
|
|
7350
|
+
get: function get() {
|
|
7351
|
+
return this.name;
|
|
7352
|
+
}
|
|
7059
7353
|
/**
|
|
7060
7354
|
* Returns whether the offset is known to be fixed for the whole year.
|
|
7061
7355
|
* @abstract
|
|
@@ -7490,6 +7784,15 @@ var FixedOffsetZone = /*#__PURE__*/function (_Zone) {
|
|
|
7490
7784
|
get: function get() {
|
|
7491
7785
|
return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow");
|
|
7492
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
|
+
}
|
|
7493
7796
|
}, {
|
|
7494
7797
|
key: "isUniversal",
|
|
7495
7798
|
get: function get() {
|
|
@@ -8399,7 +8702,7 @@ function combineExtractors() {
|
|
|
8399
8702
|
zone = _ex[1],
|
|
8400
8703
|
next = _ex[2];
|
|
8401
8704
|
|
|
8402
|
-
return [_extends({}, mergedVals, val),
|
|
8705
|
+
return [_extends({}, mergedVals, val), zone || mergedZone, next];
|
|
8403
8706
|
}, [{}, null, 1]).slice(0, 2);
|
|
8404
8707
|
};
|
|
8405
8708
|
}
|
|
@@ -8445,19 +8748,20 @@ function simpleParse() {
|
|
|
8445
8748
|
} // ISO and SQL parsing
|
|
8446
8749
|
|
|
8447
8750
|
|
|
8448
|
-
var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
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 + ")?");
|
|
8461
8765
|
|
|
8462
8766
|
function int(match, pos, fallback) {
|
|
8463
8767
|
var m = match[pos];
|
|
@@ -8632,11 +8936,11 @@ var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionR
|
|
|
8632
8936
|
var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
|
|
8633
8937
|
var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
|
|
8634
8938
|
var isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
|
|
8635
|
-
var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset);
|
|
8636
|
-
var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset);
|
|
8637
|
-
var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset);
|
|
8638
|
-
var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);
|
|
8639
|
-
|
|
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
|
+
/*
|
|
8640
8944
|
* @private
|
|
8641
8945
|
*/
|
|
8642
8946
|
|
|
@@ -8658,10 +8962,9 @@ function parseISOTimeOnly(s) {
|
|
|
8658
8962
|
}
|
|
8659
8963
|
var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
|
|
8660
8964
|
var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
|
|
8661
|
-
var extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone);
|
|
8662
8965
|
var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
|
|
8663
8966
|
function parseSQL(s) {
|
|
8664
|
-
return parse(s, [sqlYmdWithTimeExtensionRegex,
|
|
8967
|
+
return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
|
|
8665
8968
|
}
|
|
8666
8969
|
|
|
8667
8970
|
var INVALID$2 = "Invalid Duration"; // unit conversion constants
|
|
@@ -10809,7 +11112,7 @@ function intUnit(regex, post) {
|
|
|
10809
11112
|
}
|
|
10810
11113
|
|
|
10811
11114
|
var NBSP = String.fromCharCode(160);
|
|
10812
|
-
var spaceOrNBSP = "
|
|
11115
|
+
var spaceOrNBSP = "[ " + NBSP + "]";
|
|
10813
11116
|
var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
|
|
10814
11117
|
|
|
10815
11118
|
function fixListRegex(s) {
|
|
@@ -11693,7 +11996,7 @@ function _toISODate(o, extended) {
|
|
|
11693
11996
|
return c;
|
|
11694
11997
|
}
|
|
11695
11998
|
|
|
11696
|
-
function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {
|
|
11999
|
+
function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone) {
|
|
11697
12000
|
var c = padStart(o.c.hour);
|
|
11698
12001
|
|
|
11699
12002
|
if (extended) {
|
|
@@ -11717,7 +12020,7 @@ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeO
|
|
|
11717
12020
|
}
|
|
11718
12021
|
|
|
11719
12022
|
if (includeOffset) {
|
|
11720
|
-
if (o.isOffsetFixed && o.offset === 0) {
|
|
12023
|
+
if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {
|
|
11721
12024
|
c += "Z";
|
|
11722
12025
|
} else if (o.o < 0) {
|
|
11723
12026
|
c += "-";
|
|
@@ -11732,6 +12035,10 @@ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeO
|
|
|
11732
12035
|
}
|
|
11733
12036
|
}
|
|
11734
12037
|
|
|
12038
|
+
if (extendedZone) {
|
|
12039
|
+
c += "[" + o.zone.ianaName + "]";
|
|
12040
|
+
}
|
|
12041
|
+
|
|
11735
12042
|
return c;
|
|
11736
12043
|
} // defaults for unspecified units in the supported calendars
|
|
11737
12044
|
|
|
@@ -12905,6 +13212,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12905
13212
|
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
|
|
12906
13213
|
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
|
|
12907
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
|
|
12908
13216
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
12909
13217
|
* @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
|
|
12910
13218
|
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
|
|
@@ -12923,7 +13231,9 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12923
13231
|
_ref4$suppressMillise = _ref4.suppressMilliseconds,
|
|
12924
13232
|
suppressMilliseconds = _ref4$suppressMillise === void 0 ? false : _ref4$suppressMillise,
|
|
12925
13233
|
_ref4$includeOffset = _ref4.includeOffset,
|
|
12926
|
-
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;
|
|
12927
13237
|
|
|
12928
13238
|
if (!this.isValid) {
|
|
12929
13239
|
return null;
|
|
@@ -12934,7 +13244,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12934
13244
|
var c = _toISODate(this, ext);
|
|
12935
13245
|
|
|
12936
13246
|
c += "T";
|
|
12937
|
-
c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset);
|
|
13247
|
+
c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
|
|
12938
13248
|
return c;
|
|
12939
13249
|
}
|
|
12940
13250
|
/**
|
|
@@ -12974,6 +13284,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12974
13284
|
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
|
|
12975
13285
|
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
|
|
12976
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
|
|
12977
13288
|
* @param {boolean} [opts.includePrefix=false] - include the `T` prefix
|
|
12978
13289
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
12979
13290
|
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
|
|
@@ -12994,6 +13305,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
12994
13305
|
includeOffset = _ref6$includeOffset === void 0 ? true : _ref6$includeOffset,
|
|
12995
13306
|
_ref6$includePrefix = _ref6.includePrefix,
|
|
12996
13307
|
includePrefix = _ref6$includePrefix === void 0 ? false : _ref6$includePrefix,
|
|
13308
|
+
_ref6$extendedZone = _ref6.extendedZone,
|
|
13309
|
+
extendedZone = _ref6$extendedZone === void 0 ? false : _ref6$extendedZone,
|
|
12997
13310
|
_ref6$format = _ref6.format,
|
|
12998
13311
|
format = _ref6$format === void 0 ? "extended" : _ref6$format;
|
|
12999
13312
|
|
|
@@ -13002,7 +13315,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
13002
13315
|
}
|
|
13003
13316
|
|
|
13004
13317
|
var c = includePrefix ? "T" : "";
|
|
13005
|
-
return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset);
|
|
13318
|
+
return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
|
|
13006
13319
|
}
|
|
13007
13320
|
/**
|
|
13008
13321
|
* Returns an RFC 2822-compatible string representation of this DateTime
|
|
@@ -13809,7 +14122,8 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
13809
14122
|
return false;
|
|
13810
14123
|
} else {
|
|
13811
14124
|
return this.offset > this.set({
|
|
13812
|
-
month: 1
|
|
14125
|
+
month: 1,
|
|
14126
|
+
day: 1
|
|
13813
14127
|
}).offset || this.offset > this.set({
|
|
13814
14128
|
month: 5
|
|
13815
14129
|
}).offset;
|
|
@@ -14095,7 +14409,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
14095
14409
|
}
|
|
14096
14410
|
}
|
|
14097
14411
|
|
|
14098
|
-
var VERSION = "2.
|
|
14412
|
+
var VERSION = "2.4.0";
|
|
14099
14413
|
|
|
14100
14414
|
exports.DateTime = DateTime;
|
|
14101
14415
|
exports.Duration = Duration;
|