@nmshd/consumption 2.0.0-alpha.12 → 2.0.0-alpha.13
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/ConsumptionErrors.d.ts +2 -1
- package/dist/consumption/ConsumptionErrors.js +5 -2
- package/dist/consumption/ConsumptionErrors.js.map +1 -1
- package/dist/modules/attributes/ConsumptionAttributesController.d.ts +11 -10
- package/dist/modules/attributes/ConsumptionAttributesController.js +48 -54
- package/dist/modules/attributes/ConsumptionAttributesController.js.map +1 -1
- package/dist/modules/attributes/CreateConsumptionAttributeParams.d.ts +9 -0
- package/dist/modules/attributes/CreateConsumptionAttributeParams.js +26 -0
- package/dist/modules/attributes/CreateConsumptionAttributeParams.js.map +1 -0
- package/dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.d.ts +13 -0
- package/dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js +36 -0
- package/dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js.map +1 -0
- package/dist/modules/attributes/SuccedConsumptionAttributeParams.d.ts +12 -0
- package/dist/modules/attributes/SuccedConsumptionAttributeParams.js +32 -0
- package/dist/modules/attributes/SuccedConsumptionAttributeParams.js.map +1 -0
- package/dist/modules/attributes/local/ConsumptionAttribute.d.ts +12 -10
- package/dist/modules/attributes/local/ConsumptionAttribute.js +20 -14
- package/dist/modules/attributes/local/ConsumptionAttribute.js.map +1 -1
- package/dist/modules/attributes/local/ConsumptionAttributeShareInfo.d.ts +12 -0
- package/dist/modules/attributes/local/ConsumptionAttributeShareInfo.js +36 -0
- package/dist/modules/attributes/local/ConsumptionAttributeShareInfo.js.map +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +3 -0
- package/dist/modules/index.js.map +1 -1
- package/lib-web/nmshd.consumption.js +253 -77
- 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 +1 -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-05-
|
|
23
|
-
commit: "
|
|
20
|
+
version: "2.0.0-alpha.13",
|
|
21
|
+
build: "31",
|
|
22
|
+
date: "2022-05-17T12:00:51+00:00",
|
|
23
|
+
commit: "44fe03b9135fe648c60e658c1d26ee7dc7b1f145",
|
|
24
24
|
dependencies: {},
|
|
25
25
|
libraries: {
|
|
26
26
|
transport: transport_1.buildInformation,
|
|
@@ -153,8 +153,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
153
153
|
exports.ConsumptionErrors = void 0;
|
|
154
154
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
155
155
|
class Attributes {
|
|
156
|
-
attributeExists(
|
|
157
|
-
return new transport_1.CoreError("error.consumption.attributes.attributeExists", `Attribute with
|
|
156
|
+
attributeExists(id) {
|
|
157
|
+
return new transport_1.CoreError("error.consumption.attributes.attributeExists", `Attribute with id '${id}' already exists. Please use succeed instead.`);
|
|
158
|
+
}
|
|
159
|
+
predecessorNotFound(id) {
|
|
160
|
+
return new transport_1.CoreError("error.consumption.attributes.predecessorNotFound", `Attribute with id '${id}' does not exist. Please use create instead.`);
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
class Requests {
|
|
@@ -283,7 +286,10 @@ exports.ConsumptionAttributesController = void 0;
|
|
|
283
286
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
284
287
|
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
285
288
|
const consumption_1 = __webpack_require__(/*! ../../consumption */ "./dist/consumption/index.js");
|
|
289
|
+
const CreateSharedConsumptionAttributeCopyParams_1 = __webpack_require__(/*! ./CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js");
|
|
286
290
|
const ConsumptionAttribute_1 = __webpack_require__(/*! ./local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js");
|
|
291
|
+
const ConsumptionAttributeShareInfo_1 = __webpack_require__(/*! ./local/ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js");
|
|
292
|
+
const SuccedConsumptionAttributeParams_1 = __webpack_require__(/*! ./SuccedConsumptionAttributeParams */ "./dist/modules/attributes/SuccedConsumptionAttributeParams.js");
|
|
287
293
|
class ConsumptionAttributesController extends consumption_1.ConsumptionBaseController {
|
|
288
294
|
constructor(parent) {
|
|
289
295
|
super(consumption_1.ConsumptionControllerName.ConsumptionAttributesController, parent);
|
|
@@ -305,13 +311,13 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
|
|
|
305
311
|
}
|
|
306
312
|
else if (!attribute.content.validFrom &&
|
|
307
313
|
attribute.content.validTo &&
|
|
308
|
-
attribute.content.validTo.
|
|
314
|
+
attribute.content.validTo.isSameOrAfter(now)) {
|
|
309
315
|
return true;
|
|
310
316
|
}
|
|
311
317
|
else if (attribute.content.validFrom &&
|
|
312
318
|
attribute.content.validTo &&
|
|
313
319
|
attribute.content.validFrom.isSameOrBefore(now) &&
|
|
314
|
-
attribute.content.validTo.
|
|
320
|
+
attribute.content.validTo.isSameOrAfter(now)) {
|
|
315
321
|
return true;
|
|
316
322
|
}
|
|
317
323
|
return false;
|
|
@@ -340,69 +346,60 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
|
|
|
340
346
|
}
|
|
341
347
|
return items;
|
|
342
348
|
}
|
|
343
|
-
async
|
|
344
|
-
const result = await this.attributes.
|
|
349
|
+
async getConsumptionAttribute(id) {
|
|
350
|
+
const result = await this.attributes.findOne({
|
|
345
351
|
[(0, ts_simple_nameof_1.nameof)((c) => c.id)]: id.toString()
|
|
346
352
|
});
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
if (!result)
|
|
354
|
+
return;
|
|
355
|
+
return ConsumptionAttribute_1.ConsumptionAttribute.from(result);
|
|
349
356
|
}
|
|
350
|
-
async
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
});
|
|
354
|
-
const attributes = await this.parseArray(result, ConsumptionAttribute_1.ConsumptionAttribute);
|
|
355
|
-
return this.findCurrent(attributes);
|
|
357
|
+
async getConsumptionAttributes(query) {
|
|
358
|
+
const attributes = await this.attributes.find(query);
|
|
359
|
+
return await this.parseArray(attributes, ConsumptionAttribute_1.ConsumptionAttribute);
|
|
356
360
|
}
|
|
357
|
-
async
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
});
|
|
361
|
-
const attributes = await this.parseArray(result, ConsumptionAttribute_1.ConsumptionAttribute);
|
|
362
|
-
const sorted = attributes.sort((a, b) => {
|
|
363
|
-
return a.createdAt.compare(b.createdAt);
|
|
364
|
-
});
|
|
365
|
-
return sorted;
|
|
366
|
-
}
|
|
367
|
-
async getAttributes(query) {
|
|
368
|
-
const items = await this.attributes.find(query);
|
|
369
|
-
return await this.parseArray(items, ConsumptionAttribute_1.ConsumptionAttribute);
|
|
370
|
-
}
|
|
371
|
-
async getValidAttributes(query) {
|
|
372
|
-
const docs = await this.attributes.find(query);
|
|
373
|
-
const items = await this.parseArray(docs, ConsumptionAttribute_1.ConsumptionAttribute);
|
|
361
|
+
async getValidConsumptionAttributes(query) {
|
|
362
|
+
const attributes = await this.attributes.find(query);
|
|
363
|
+
const items = await this.parseArray(attributes, ConsumptionAttribute_1.ConsumptionAttribute);
|
|
374
364
|
return this.filterCurrent(items);
|
|
375
365
|
}
|
|
376
|
-
async
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return result;
|
|
381
|
-
};
|
|
382
|
-
return attributes.reduce(mapper, {});
|
|
366
|
+
async createConsumptionAttribute(params) {
|
|
367
|
+
const consumptionAttribute = await ConsumptionAttribute_1.ConsumptionAttribute.fromAttribute(params.content);
|
|
368
|
+
await this.attributes.create(consumptionAttribute);
|
|
369
|
+
return consumptionAttribute;
|
|
383
370
|
}
|
|
384
|
-
async
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
await this.
|
|
403
|
-
|
|
371
|
+
async succeedConsumptionAttribute(params) {
|
|
372
|
+
const parsedParams = SuccedConsumptionAttributeParams_1.SucceedConsumptionAttributeParams.from(params);
|
|
373
|
+
const current = await this.getConsumptionAttribute(parsedParams.succeeds);
|
|
374
|
+
if (!current) {
|
|
375
|
+
throw consumption_1.ConsumptionErrors.attributes.predecessorNotFound(parsedParams.succeeds.toString());
|
|
376
|
+
}
|
|
377
|
+
if (!parsedParams.successorContent.validFrom) {
|
|
378
|
+
parsedParams.successorContent.validFrom = transport_1.CoreDate.utc();
|
|
379
|
+
}
|
|
380
|
+
const validFrom = parsedParams.successorContent.validFrom;
|
|
381
|
+
current.content.validTo = validFrom.subtract(1);
|
|
382
|
+
await this.updateConsumptionAttribute(current);
|
|
383
|
+
const successor = await ConsumptionAttribute_1.ConsumptionAttribute.fromAttribute(parsedParams.successorContent, parsedParams.succeeds);
|
|
384
|
+
await this.attributes.create(successor);
|
|
385
|
+
return successor;
|
|
386
|
+
}
|
|
387
|
+
async createSharedConsumptionAttributeCopy(params) {
|
|
388
|
+
const parsedParams = CreateSharedConsumptionAttributeCopyParams_1.CreateSharedConsumptionAttributeCopyParams.from(params);
|
|
389
|
+
const sourceAttribute = await this.getConsumptionAttribute(parsedParams.attributeId);
|
|
390
|
+
if (!sourceAttribute) {
|
|
391
|
+
throw consumption_1.ConsumptionErrors.attributes.predecessorNotFound(parsedParams.attributeId.toString());
|
|
392
|
+
}
|
|
393
|
+
const shareInfo = ConsumptionAttributeShareInfo_1.ConsumptionAttributeShareInfo.from({
|
|
394
|
+
peer: parsedParams.peer,
|
|
395
|
+
requestReference: parsedParams.requestReference,
|
|
396
|
+
sourceAttribute: parsedParams.attributeId
|
|
397
|
+
});
|
|
398
|
+
const sharedConsumptionAttributeCopy = await ConsumptionAttribute_1.ConsumptionAttribute.fromAttribute(sourceAttribute.content, undefined, shareInfo);
|
|
399
|
+
await this.attributes.create(sharedConsumptionAttributeCopy);
|
|
400
|
+
return sharedConsumptionAttributeCopy;
|
|
404
401
|
}
|
|
405
|
-
async
|
|
402
|
+
async updateConsumptionAttribute(attribute) {
|
|
406
403
|
const current = await this.attributes.findOne({
|
|
407
404
|
[(0, ts_simple_nameof_1.nameof)((c) => c.id)]: attribute.id.toString()
|
|
408
405
|
});
|
|
@@ -421,6 +418,130 @@ exports.ConsumptionAttributesController = ConsumptionAttributesController;
|
|
|
421
418
|
|
|
422
419
|
/***/ }),
|
|
423
420
|
|
|
421
|
+
/***/ "./dist/modules/attributes/CreateConsumptionAttributeParams.js":
|
|
422
|
+
/*!*********************************************************************!*\
|
|
423
|
+
!*** ./dist/modules/attributes/CreateConsumptionAttributeParams.js ***!
|
|
424
|
+
\*********************************************************************/
|
|
425
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
426
|
+
|
|
427
|
+
"use strict";
|
|
428
|
+
|
|
429
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
430
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
431
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
432
|
+
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;
|
|
433
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
434
|
+
};
|
|
435
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
436
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
437
|
+
};
|
|
438
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
439
|
+
exports.CreateConsumptionAttributeParams = void 0;
|
|
440
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
441
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
442
|
+
class CreateConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
443
|
+
static from(value) {
|
|
444
|
+
return this.fromAny(value);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
__decorate([
|
|
448
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
449
|
+
(0, ts_serval_1.validate)(),
|
|
450
|
+
__metadata("design:type", Object)
|
|
451
|
+
], CreateConsumptionAttributeParams.prototype, "content", void 0);
|
|
452
|
+
exports.CreateConsumptionAttributeParams = CreateConsumptionAttributeParams;
|
|
453
|
+
//# sourceMappingURL=CreateConsumptionAttributeParams.js.map
|
|
454
|
+
|
|
455
|
+
/***/ }),
|
|
456
|
+
|
|
457
|
+
/***/ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js":
|
|
458
|
+
/*!*******************************************************************************!*\
|
|
459
|
+
!*** ./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js ***!
|
|
460
|
+
\*******************************************************************************/
|
|
461
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
462
|
+
|
|
463
|
+
"use strict";
|
|
464
|
+
|
|
465
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
466
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
467
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
468
|
+
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;
|
|
469
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
470
|
+
};
|
|
471
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
472
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
473
|
+
};
|
|
474
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
475
|
+
exports.CreateSharedConsumptionAttributeCopyParams = void 0;
|
|
476
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
477
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
478
|
+
class CreateSharedConsumptionAttributeCopyParams extends ts_serval_1.Serializable {
|
|
479
|
+
static from(value) {
|
|
480
|
+
return this.fromAny(value);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
__decorate([
|
|
484
|
+
(0, ts_serval_1.serialize)(),
|
|
485
|
+
(0, ts_serval_1.validate)(),
|
|
486
|
+
__metadata("design:type", transport_1.CoreId)
|
|
487
|
+
], CreateSharedConsumptionAttributeCopyParams.prototype, "attributeId", void 0);
|
|
488
|
+
__decorate([
|
|
489
|
+
(0, ts_serval_1.serialize)(),
|
|
490
|
+
(0, ts_serval_1.validate)(),
|
|
491
|
+
__metadata("design:type", transport_1.CoreAddress)
|
|
492
|
+
], CreateSharedConsumptionAttributeCopyParams.prototype, "peer", void 0);
|
|
493
|
+
__decorate([
|
|
494
|
+
(0, ts_serval_1.serialize)(),
|
|
495
|
+
(0, ts_serval_1.validate)(),
|
|
496
|
+
__metadata("design:type", transport_1.CoreId)
|
|
497
|
+
], CreateSharedConsumptionAttributeCopyParams.prototype, "requestReference", void 0);
|
|
498
|
+
exports.CreateSharedConsumptionAttributeCopyParams = CreateSharedConsumptionAttributeCopyParams;
|
|
499
|
+
//# sourceMappingURL=CreateSharedConsumptionAttributeCopyParams.js.map
|
|
500
|
+
|
|
501
|
+
/***/ }),
|
|
502
|
+
|
|
503
|
+
/***/ "./dist/modules/attributes/SuccedConsumptionAttributeParams.js":
|
|
504
|
+
/*!*********************************************************************!*\
|
|
505
|
+
!*** ./dist/modules/attributes/SuccedConsumptionAttributeParams.js ***!
|
|
506
|
+
\*********************************************************************/
|
|
507
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
508
|
+
|
|
509
|
+
"use strict";
|
|
510
|
+
|
|
511
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
512
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
513
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
514
|
+
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;
|
|
515
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
516
|
+
};
|
|
517
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
518
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
519
|
+
};
|
|
520
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
521
|
+
exports.SucceedConsumptionAttributeParams = void 0;
|
|
522
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
523
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
524
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
525
|
+
class SucceedConsumptionAttributeParams extends ts_serval_1.Serializable {
|
|
526
|
+
static from(value) {
|
|
527
|
+
return this.fromAny(value);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
__decorate([
|
|
531
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
532
|
+
(0, ts_serval_1.validate)(),
|
|
533
|
+
__metadata("design:type", Object)
|
|
534
|
+
], SucceedConsumptionAttributeParams.prototype, "successorContent", void 0);
|
|
535
|
+
__decorate([
|
|
536
|
+
(0, ts_serval_1.serialize)(),
|
|
537
|
+
(0, ts_serval_1.validate)(),
|
|
538
|
+
__metadata("design:type", transport_1.CoreId)
|
|
539
|
+
], SucceedConsumptionAttributeParams.prototype, "succeeds", void 0);
|
|
540
|
+
exports.SucceedConsumptionAttributeParams = SucceedConsumptionAttributeParams;
|
|
541
|
+
//# sourceMappingURL=SuccedConsumptionAttributeParams.js.map
|
|
542
|
+
|
|
543
|
+
/***/ }),
|
|
544
|
+
|
|
424
545
|
/***/ "./dist/modules/attributes/local/ConsumptionAttribute.js":
|
|
425
546
|
/*!***************************************************************!*\
|
|
426
547
|
!*** ./dist/modules/attributes/local/ConsumptionAttribute.js ***!
|
|
@@ -445,35 +566,36 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
445
566
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
446
567
|
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
447
568
|
const consumption_1 = __webpack_require__(/*! ../../../consumption */ "./dist/consumption/index.js");
|
|
569
|
+
const ConsumptionAttributeShareInfo_1 = __webpack_require__(/*! ./ConsumptionAttributeShareInfo */ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js");
|
|
448
570
|
let ConsumptionAttribute = class ConsumptionAttribute extends transport_1.CoreSynchronizable {
|
|
449
571
|
constructor() {
|
|
450
572
|
super(...arguments);
|
|
451
573
|
this.technicalProperties = [
|
|
452
574
|
"@type",
|
|
453
575
|
"@context",
|
|
576
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt),
|
|
577
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.succeeds),
|
|
454
578
|
(0, ts_simple_nameof_1.nameof)((r) => r.createdAt)
|
|
455
579
|
];
|
|
456
580
|
this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.content)];
|
|
457
|
-
this.metadataProperties = [
|
|
458
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.metadata),
|
|
459
|
-
(0, ts_simple_nameof_1.nameof)((r) => r.metadataModifiedAt)
|
|
460
|
-
];
|
|
461
581
|
}
|
|
462
582
|
static from(value) {
|
|
463
583
|
return this.fromAny(value);
|
|
464
584
|
}
|
|
465
|
-
static async fromAttribute(attribute) {
|
|
585
|
+
static async fromAttribute(attribute, succeeds, shareInfo) {
|
|
466
586
|
return this.from({
|
|
467
|
-
content:
|
|
587
|
+
content: attribute,
|
|
468
588
|
id: await consumption_1.ConsumptionIds.attribute.generate(),
|
|
469
|
-
createdAt: transport_1.CoreDate.utc()
|
|
589
|
+
createdAt: transport_1.CoreDate.utc(),
|
|
590
|
+
succeeds: succeeds,
|
|
591
|
+
shareInfo: shareInfo
|
|
470
592
|
});
|
|
471
593
|
}
|
|
472
594
|
};
|
|
473
595
|
__decorate([
|
|
474
596
|
(0, ts_serval_1.validate)(),
|
|
475
|
-
(0, ts_serval_1.serialize)({
|
|
476
|
-
__metadata("design:type",
|
|
597
|
+
(0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
|
|
598
|
+
__metadata("design:type", Object)
|
|
477
599
|
], ConsumptionAttribute.prototype, "content", void 0);
|
|
478
600
|
__decorate([
|
|
479
601
|
(0, ts_serval_1.validate)(),
|
|
@@ -482,14 +604,19 @@ __decorate([
|
|
|
482
604
|
], ConsumptionAttribute.prototype, "createdAt", void 0);
|
|
483
605
|
__decorate([
|
|
484
606
|
(0, ts_serval_1.validate)({ nullable: true }),
|
|
485
|
-
(0, ts_serval_1.serialize)(
|
|
486
|
-
__metadata("design:type",
|
|
487
|
-
], ConsumptionAttribute.prototype, "
|
|
607
|
+
(0, ts_serval_1.serialize)(),
|
|
608
|
+
__metadata("design:type", transport_1.CoreId)
|
|
609
|
+
], ConsumptionAttribute.prototype, "succeeds", void 0);
|
|
488
610
|
__decorate([
|
|
489
611
|
(0, ts_serval_1.validate)({ nullable: true }),
|
|
490
612
|
(0, ts_serval_1.serialize)(),
|
|
491
|
-
__metadata("design:type", transport_1.
|
|
492
|
-
], ConsumptionAttribute.prototype, "
|
|
613
|
+
__metadata("design:type", transport_1.CoreId)
|
|
614
|
+
], ConsumptionAttribute.prototype, "succeededBy", void 0);
|
|
615
|
+
__decorate([
|
|
616
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
617
|
+
(0, ts_serval_1.serialize)(),
|
|
618
|
+
__metadata("design:type", ConsumptionAttributeShareInfo_1.ConsumptionAttributeShareInfo)
|
|
619
|
+
], ConsumptionAttribute.prototype, "shareInfo", void 0);
|
|
493
620
|
ConsumptionAttribute = __decorate([
|
|
494
621
|
(0, ts_serval_1.type)("ConsumptionAttribute")
|
|
495
622
|
], ConsumptionAttribute);
|
|
@@ -498,6 +625,52 @@ exports.ConsumptionAttribute = ConsumptionAttribute;
|
|
|
498
625
|
|
|
499
626
|
/***/ }),
|
|
500
627
|
|
|
628
|
+
/***/ "./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js":
|
|
629
|
+
/*!************************************************************************!*\
|
|
630
|
+
!*** ./dist/modules/attributes/local/ConsumptionAttributeShareInfo.js ***!
|
|
631
|
+
\************************************************************************/
|
|
632
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
633
|
+
|
|
634
|
+
"use strict";
|
|
635
|
+
|
|
636
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
637
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
638
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
639
|
+
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;
|
|
640
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
641
|
+
};
|
|
642
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
643
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
644
|
+
};
|
|
645
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
646
|
+
exports.ConsumptionAttributeShareInfo = void 0;
|
|
647
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
648
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
649
|
+
class ConsumptionAttributeShareInfo extends transport_1.CoreSerializable {
|
|
650
|
+
static from(value) {
|
|
651
|
+
return super.fromAny(value);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
__decorate([
|
|
655
|
+
(0, ts_serval_1.validate)(),
|
|
656
|
+
(0, ts_serval_1.serialize)(),
|
|
657
|
+
__metadata("design:type", transport_1.CoreId)
|
|
658
|
+
], ConsumptionAttributeShareInfo.prototype, "requestReference", void 0);
|
|
659
|
+
__decorate([
|
|
660
|
+
(0, ts_serval_1.validate)(),
|
|
661
|
+
(0, ts_serval_1.serialize)(),
|
|
662
|
+
__metadata("design:type", transport_1.CoreAddress)
|
|
663
|
+
], ConsumptionAttributeShareInfo.prototype, "peer", void 0);
|
|
664
|
+
__decorate([
|
|
665
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
666
|
+
(0, ts_serval_1.serialize)(),
|
|
667
|
+
__metadata("design:type", transport_1.CoreId)
|
|
668
|
+
], ConsumptionAttributeShareInfo.prototype, "sourceAttribute", void 0);
|
|
669
|
+
exports.ConsumptionAttributeShareInfo = ConsumptionAttributeShareInfo;
|
|
670
|
+
//# sourceMappingURL=ConsumptionAttributeShareInfo.js.map
|
|
671
|
+
|
|
672
|
+
/***/ }),
|
|
673
|
+
|
|
501
674
|
/***/ "./dist/modules/drafts/DraftsController.js":
|
|
502
675
|
/*!*************************************************!*\
|
|
503
676
|
!*** ./dist/modules/drafts/DraftsController.js ***!
|
|
@@ -659,7 +832,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
659
832
|
};
|
|
660
833
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
661
834
|
__exportStar(__webpack_require__(/*! ./attributes/ConsumptionAttributesController */ "./dist/modules/attributes/ConsumptionAttributesController.js"), exports);
|
|
835
|
+
__exportStar(__webpack_require__(/*! ./attributes/CreateConsumptionAttributeParams */ "./dist/modules/attributes/CreateConsumptionAttributeParams.js"), exports);
|
|
836
|
+
__exportStar(__webpack_require__(/*! ./attributes/CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js"), exports);
|
|
662
837
|
__exportStar(__webpack_require__(/*! ./attributes/local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js"), exports);
|
|
838
|
+
__exportStar(__webpack_require__(/*! ./attributes/SuccedConsumptionAttributeParams */ "./dist/modules/attributes/SuccedConsumptionAttributeParams.js"), exports);
|
|
663
839
|
__exportStar(__webpack_require__(/*! ./drafts/DraftsController */ "./dist/modules/drafts/DraftsController.js"), exports);
|
|
664
840
|
__exportStar(__webpack_require__(/*! ./drafts/local/Draft */ "./dist/modules/drafts/local/Draft.js"), exports);
|
|
665
841
|
__exportStar(__webpack_require__(/*! ./requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters */ "./dist/modules/requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters.js"), exports);
|