@nmshd/consumption 2.0.0-alpha.22 → 2.0.0-alpha.26

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.
Files changed (33) hide show
  1. package/README.md +2 -2
  2. package/dist/buildInformation.js +4 -4
  3. package/dist/modules/attributes/LocalAttributesController.d.ts +3 -4
  4. package/dist/modules/attributes/LocalAttributesController.js +7 -8
  5. package/dist/modules/attributes/LocalAttributesController.js.map +1 -1
  6. package/dist/modules/attributes/local/QueryTranslator.d.ts +9 -3
  7. package/dist/modules/attributes/local/QueryTranslator.js +31 -20
  8. package/dist/modules/attributes/local/QueryTranslator.js.map +1 -1
  9. package/dist/modules/index.d.ts +1 -3
  10. package/dist/modules/index.js +0 -3
  11. package/dist/modules/index.js.map +1 -1
  12. package/dist/modules/requests/incoming/IncomingRequestsController.js +1 -4
  13. package/dist/modules/requests/incoming/IncomingRequestsController.js.map +1 -1
  14. package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js +2 -8
  15. package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js.map +1 -1
  16. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +1 -2
  17. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -1
  18. package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.d.ts +13 -4
  19. package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js +13 -6
  20. package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js.map +1 -1
  21. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +3 -3
  22. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -1
  23. package/lib-web/nmshd.consumption.js +62 -130
  24. package/lib-web/nmshd.consumption.js.map +1 -1
  25. package/lib-web/nmshd.consumption.min.js +1 -1
  26. package/lib-web/nmshd.consumption.min.js.map +1 -1
  27. package/package.json +6 -6
  28. package/dist/modules/attributes/local/GetIdentityAttributesParams.d.ts +0 -12
  29. package/dist/modules/attributes/local/GetIdentityAttributesParams.js +0 -26
  30. package/dist/modules/attributes/local/GetIdentityAttributesParams.js.map +0 -1
  31. package/dist/modules/attributes/local/GetRelationshipAttributesParams.d.ts +0 -12
  32. package/dist/modules/attributes/local/GetRelationshipAttributesParams.js +0 -26
  33. package/dist/modules/attributes/local/GetRelationshipAttributesParams.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.22",
21
- build: "41",
22
- date: "2022-06-28T10:52:46+00:00",
23
- commit: "08cce66412e885c884342f669400097d11956402",
20
+ version: "2.0.0-alpha.26",
21
+ build: "46",
22
+ date: "2022-07-06T13:53:17+00:00",
23
+ commit: "b07ccf5a6db88a9deae7622e1b57a00d3dc5f21b",
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,
@@ -306,6 +306,7 @@ __exportStar(__webpack_require__(/*! ./modules */ "./dist/modules/index.js"), ex
306
306
 
307
307
  Object.defineProperty(exports, "__esModule", ({ value: true }));
308
308
  exports.LocalAttributesController = void 0;
309
+ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
309
310
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
310
311
  const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
311
312
  const consumption_1 = __webpack_require__(/*! ../../consumption */ "./dist/consumption/index.js");
@@ -387,17 +388,15 @@ class LocalAttributesController extends consumption_1.ConsumptionBaseController
387
388
  const items = await this.parseArray(attributes, LocalAttribute_1.LocalAttribute);
388
389
  return this.filterCurrent(items);
389
390
  }
390
- async executeRelationshipAttributeQuery(params) {
391
- const queryWithType = params.query;
392
- queryWithType["attributeType"] = "RelationshipAttribute";
393
- const dbQuery = QueryTranslator_1.relationshipQueryTranslator.parse(queryWithType);
391
+ async executeRelationshipAttributeQuery(query) {
392
+ const parsedQuery = content_1.RelationshipAttributeQuery.from(query);
393
+ const dbQuery = QueryTranslator_1.RelationshipAttributeQueryTranslator.translate(parsedQuery);
394
394
  const attributes = await this.attributes.find(dbQuery);
395
395
  return await this.parseArray(attributes, LocalAttribute_1.LocalAttribute);
396
396
  }
397
- async executeIdentityAttributeQuery(params) {
398
- const queryWithType = params.query;
399
- queryWithType["attributeType"] = "IdentityAttribute";
400
- const dbQuery = QueryTranslator_1.identityQueryTranslator.parse(queryWithType);
397
+ async executeIdentityAttributeQuery(query) {
398
+ const parsedQuery = content_1.IdentityAttributeQuery.from(query);
399
+ const dbQuery = QueryTranslator_1.IdentityAttributeQueryTranslator.translate(parsedQuery);
401
400
  const attributes = await this.attributes.find(dbQuery);
402
401
  return await this.parseArray(attributes, LocalAttribute_1.LocalAttribute);
403
402
  }
@@ -615,78 +614,6 @@ exports.CreateSharedLocalAttributeCopyParams = CreateSharedLocalAttributeCopyPar
615
614
 
616
615
  /***/ }),
617
616
 
618
- /***/ "./dist/modules/attributes/local/GetIdentityAttributesParams.js":
619
- /*!**********************************************************************!*\
620
- !*** ./dist/modules/attributes/local/GetIdentityAttributesParams.js ***!
621
- \**********************************************************************/
622
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
623
-
624
- "use strict";
625
-
626
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
627
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
628
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
629
- 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;
630
- return c > 3 && r && Object.defineProperty(target, key, r), r;
631
- };
632
- var __metadata = (this && this.__metadata) || function (k, v) {
633
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
634
- };
635
- Object.defineProperty(exports, "__esModule", ({ value: true }));
636
- exports.GetIdentityAttributesParams = void 0;
637
- const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
638
- const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
639
- class GetIdentityAttributesParams extends ts_serval_1.Serializable {
640
- static from(value) {
641
- return this.fromAny(value);
642
- }
643
- }
644
- __decorate([
645
- (0, ts_serval_1.serialize)(),
646
- (0, ts_serval_1.validate)(),
647
- __metadata("design:type", content_1.IdentityAttributeQuery)
648
- ], GetIdentityAttributesParams.prototype, "query", void 0);
649
- exports.GetIdentityAttributesParams = GetIdentityAttributesParams;
650
- //# sourceMappingURL=GetIdentityAttributesParams.js.map
651
-
652
- /***/ }),
653
-
654
- /***/ "./dist/modules/attributes/local/GetRelationshipAttributesParams.js":
655
- /*!**************************************************************************!*\
656
- !*** ./dist/modules/attributes/local/GetRelationshipAttributesParams.js ***!
657
- \**************************************************************************/
658
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
659
-
660
- "use strict";
661
-
662
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
663
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
664
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
665
- 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;
666
- return c > 3 && r && Object.defineProperty(target, key, r), r;
667
- };
668
- var __metadata = (this && this.__metadata) || function (k, v) {
669
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
670
- };
671
- Object.defineProperty(exports, "__esModule", ({ value: true }));
672
- exports.GetRelationshipAttributesParams = void 0;
673
- const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
674
- const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
675
- class GetRelationshipAttributesParams extends ts_serval_1.Serializable {
676
- static from(value) {
677
- return this.fromAny(value);
678
- }
679
- }
680
- __decorate([
681
- (0, ts_serval_1.serialize)(),
682
- (0, ts_serval_1.validate)(),
683
- __metadata("design:type", content_1.RelationshipAttributeQuery)
684
- ], GetRelationshipAttributesParams.prototype, "query", void 0);
685
- exports.GetRelationshipAttributesParams = GetRelationshipAttributesParams;
686
- //# sourceMappingURL=GetRelationshipAttributesParams.js.map
687
-
688
- /***/ }),
689
-
690
617
  /***/ "./dist/modules/attributes/local/LocalAttribute.js":
691
618
  /*!*********************************************************!*\
692
619
  !*** ./dist/modules/attributes/local/LocalAttribute.js ***!
@@ -825,11 +752,17 @@ exports.LocalAttributeShareInfo = LocalAttributeShareInfo;
825
752
  "use strict";
826
753
 
827
754
  Object.defineProperty(exports, "__esModule", ({ value: true }));
828
- exports.relationshipQueryTranslator = exports.identityQueryTranslator = void 0;
755
+ exports.RelationshipAttributeQueryTranslator = exports.IdentityAttributeQueryTranslator = void 0;
829
756
  const docdb_querytranslator_1 = __webpack_require__(/*! @js-soft/docdb-querytranslator */ "./node_modules/@js-soft/docdb-querytranslator/dist/index.js");
830
757
  const luxon_1 = __webpack_require__(/*! luxon */ "./node_modules/luxon/build/cjs-browser/luxon.js");
831
758
  const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
832
- exports.identityQueryTranslator = new docdb_querytranslator_1.QueryTranslator({
759
+ class IdentityAttributeQueryTranslator {
760
+ static translate(query) {
761
+ return this.translator.parse({ ...query.toJSON(), attributeType: "IdentityAttribute" });
762
+ }
763
+ }
764
+ exports.IdentityAttributeQueryTranslator = IdentityAttributeQueryTranslator;
765
+ IdentityAttributeQueryTranslator.translator = new docdb_querytranslator_1.QueryTranslator({
833
766
  whitelist: {
834
767
  [(0, ts_simple_nameof_1.nameof)((x) => x.tags)]: true,
835
768
  [(0, ts_simple_nameof_1.nameof)((x) => x.valueType)]: true,
@@ -848,16 +781,17 @@ exports.identityQueryTranslator = new docdb_querytranslator_1.QueryTranslator({
848
781
  custom: {
849
782
  // tags
850
783
  [(0, ts_simple_nameof_1.nameof)((x) => x.tags)]: (query, input) => {
851
- const allowedTags = [];
852
- for (const tag of input) {
853
- const tagQuery = {
854
- [`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.tags)}`]: {
855
- $contains: tag
856
- }
857
- };
858
- allowedTags.push(tagQuery);
784
+ if (!input)
785
+ return;
786
+ if (!Array.isArray(input)) {
787
+ throw new Error("Invalid input: 'tags' must be an array");
859
788
  }
860
- query["$or"] = allowedTags;
789
+ const inputAsArray = input;
790
+ query["$or"] = inputAsArray.map((t) => ({
791
+ [`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.tags)}`]: {
792
+ $contains: t
793
+ }
794
+ }));
861
795
  },
862
796
  // validFrom
863
797
  [(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)]: (query, input) => {
@@ -865,10 +799,9 @@ exports.identityQueryTranslator = new docdb_querytranslator_1.QueryTranslator({
865
799
  return;
866
800
  }
867
801
  const validFromUtcString = luxon_1.DateTime.fromISO(input).toUTC().toString();
868
- query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)}`] =
869
- {
870
- $gte: validFromUtcString
871
- };
802
+ query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)}`] = {
803
+ $gte: validFromUtcString
804
+ };
872
805
  },
873
806
  // validTo
874
807
  [(0, ts_simple_nameof_1.nameof)((x) => x.validTo)]: (query, input) => {
@@ -882,7 +815,13 @@ exports.identityQueryTranslator = new docdb_querytranslator_1.QueryTranslator({
882
815
  }
883
816
  }
884
817
  });
885
- exports.relationshipQueryTranslator = new docdb_querytranslator_1.QueryTranslator({
818
+ class RelationshipAttributeQueryTranslator {
819
+ static translate(query) {
820
+ return this.translator.parse({ ...query.toJSON(), attributeType: "RelationshipAttribute" });
821
+ }
822
+ }
823
+ exports.RelationshipAttributeQueryTranslator = RelationshipAttributeQueryTranslator;
824
+ RelationshipAttributeQueryTranslator.translator = new docdb_querytranslator_1.QueryTranslator({
886
825
  whitelist: {
887
826
  [(0, ts_simple_nameof_1.nameof)((x) => x.key)]: true,
888
827
  [(0, ts_simple_nameof_1.nameof)((x) => x.valueType)]: true,
@@ -919,10 +858,9 @@ exports.relationshipQueryTranslator = new docdb_querytranslator_1.QueryTranslato
919
858
  return;
920
859
  }
921
860
  const validFromUtcString = luxon_1.DateTime.fromISO(input).toUTC().toString();
922
- query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)}`] =
923
- {
924
- $gte: validFromUtcString
925
- };
861
+ query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)}`] = {
862
+ $gte: validFromUtcString
863
+ };
926
864
  },
927
865
  // validTo
928
866
  [(0, ts_simple_nameof_1.nameof)((x) => x.validTo)]: (query, input) => {
@@ -1187,8 +1125,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
1187
1125
  __exportStar(__webpack_require__(/*! ./attributes/local/CreateLocalAttributeParams */ "./dist/modules/attributes/local/CreateLocalAttributeParams.js"), exports);
1188
1126
  __exportStar(__webpack_require__(/*! ./attributes/local/CreatePeerLocalAttributeParams */ "./dist/modules/attributes/local/CreatePeerLocalAttributeParams.js"), exports);
1189
1127
  __exportStar(__webpack_require__(/*! ./attributes/local/CreateSharedLocalAttributeCopyParams */ "./dist/modules/attributes/local/CreateSharedLocalAttributeCopyParams.js"), exports);
1190
- __exportStar(__webpack_require__(/*! ./attributes/local/GetIdentityAttributesParams */ "./dist/modules/attributes/local/GetIdentityAttributesParams.js"), exports);
1191
- __exportStar(__webpack_require__(/*! ./attributes/local/GetRelationshipAttributesParams */ "./dist/modules/attributes/local/GetRelationshipAttributesParams.js"), exports);
1192
1128
  __exportStar(__webpack_require__(/*! ./attributes/local/LocalAttribute */ "./dist/modules/attributes/local/LocalAttribute.js"), exports);
1193
1129
  __exportStar(__webpack_require__(/*! ./attributes/local/LocalAttributeShareInfo */ "./dist/modules/attributes/local/LocalAttributeShareInfo.js"), exports);
1194
1130
  __exportStar(__webpack_require__(/*! ./attributes/local/SucceedLocalAttributeParams */ "./dist/modules/attributes/local/SucceedLocalAttributeParams.js"), exports);
@@ -1215,7 +1151,6 @@ __exportStar(__webpack_require__(/*! ./requests/itemProcessors/IRequestItemProce
1215
1151
  __exportStar(__webpack_require__(/*! ./requests/itemProcessors/ProcessorConstructor */ "./dist/modules/requests/itemProcessors/ProcessorConstructor.js"), exports);
1216
1152
  __exportStar(__webpack_require__(/*! ./requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js"), exports);
1217
1153
  __exportStar(__webpack_require__(/*! ./requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js"), exports);
1218
- __exportStar(__webpack_require__(/*! ./requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js"), exports);
1219
1154
  __exportStar(__webpack_require__(/*! ./requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js"), exports);
1220
1155
  __exportStar(__webpack_require__(/*! ./requests/itemProcessors/RequestItemConstructor */ "./dist/modules/requests/itemProcessors/RequestItemConstructor.js"), exports);
1221
1156
  __exportStar(__webpack_require__(/*! ./requests/itemProcessors/RequestItemProcessorRegistry */ "./dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js"), exports);
@@ -1513,10 +1448,7 @@ class IncomingRequestsController extends consumption_1.ConsumptionBaseController
1513
1448
  }
1514
1449
  async decideGroup(groupItemParam, requestItemGroup, request) {
1515
1450
  const items = (await this.decideItems(groupItemParam.items, requestItemGroup.items, request));
1516
- const group = content_1.ResponseItemGroup.from({
1517
- items: items,
1518
- metadata: requestItemGroup.responseMetadata
1519
- });
1451
+ const group = content_1.ResponseItemGroup.from({ items: items });
1520
1452
  return group;
1521
1453
  }
1522
1454
  async decideItems(params, requestItems, request) {
@@ -1943,16 +1875,10 @@ class GenericRequestItemProcessor extends AbstractRequestItemProcessor_1.Abstrac
1943
1875
  return ValidationResult_1.ValidationResult.success();
1944
1876
  }
1945
1877
  accept(requestItem, params, requestInfo) {
1946
- return content_1.AcceptResponseItem.from({
1947
- result: content_1.ResponseItemResult.Accepted,
1948
- metadata: requestItem.responseMetadata
1949
- });
1878
+ return content_1.AcceptResponseItem.from({ result: content_1.ResponseItemResult.Accepted });
1950
1879
  }
1951
1880
  reject(requestItem, params, requestInfo) {
1952
- return content_1.RejectResponseItem.from({
1953
- result: content_1.ResponseItemResult.Rejected,
1954
- metadata: requestItem.responseMetadata
1955
- });
1881
+ return content_1.RejectResponseItem.from({ result: content_1.ResponseItemResult.Rejected });
1956
1882
  }
1957
1883
  canCreateOutgoingRequestItem(requestItem, request, recipient) {
1958
1884
  return ValidationResult_1.ValidationResult.success();
@@ -2169,8 +2095,7 @@ class CreateAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.
2169
2095
  });
2170
2096
  return content_1.CreateAttributeAcceptResponseItem.from({
2171
2097
  attributeId: peerLocalAttribute.id,
2172
- result: content_1.ResponseItemResult.Accepted,
2173
- metadata: requestItem.responseMetadata
2098
+ result: content_1.ResponseItemResult.Accepted
2174
2099
  });
2175
2100
  }
2176
2101
  async applyIncomingResponseItem(responseItem, requestItem, requestInfo) {
@@ -2371,16 +2296,23 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
2371
2296
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
2372
2297
  const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
2373
2298
  let AcceptReadAttributeRequestItemParameters = AcceptReadAttributeRequestItemParameters_1 = class AcceptReadAttributeRequestItemParameters extends ts_serval_1.Serializable {
2299
+ isWithExistingAttribute() {
2300
+ return this.attributeId !== undefined;
2301
+ }
2302
+ isWithNewAttribute() {
2303
+ return this.newAttributeValue !== undefined;
2304
+ }
2374
2305
  static from(value) {
2375
2306
  return this.fromAny(value);
2376
2307
  }
2377
2308
  static postFrom(value) {
2378
- const typedValue = value;
2379
- if (typedValue.attributeId && typedValue.attribute) {
2380
- throw new ts_serval_1.ValidationError(AcceptReadAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.attribute), `You cannot specify both ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} and ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
2309
+ if (!(value instanceof AcceptReadAttributeRequestItemParameters_1))
2310
+ throw new Error("this should never happen");
2311
+ if (value.attributeId && value.newAttributeValue) {
2312
+ throw new ts_serval_1.ValidationError(AcceptReadAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.newAttributeValue), `You cannot specify both ${(0, ts_simple_nameof_1.nameof)((x) => x.newAttributeValue)} and ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
2381
2313
  }
2382
- if (!typedValue.attributeId && !typedValue.attribute) {
2383
- throw new ts_serval_1.ValidationError(AcceptReadAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.attribute), `You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.attribute)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
2314
+ if (!value.attributeId && !value.newAttributeValue) {
2315
+ throw new ts_serval_1.ValidationError(AcceptReadAttributeRequestItemParameters_1.name, (0, ts_simple_nameof_1.nameof)((x) => x.newAttributeValue), `You have to specify either ${(0, ts_simple_nameof_1.nameof)((x) => x.newAttributeValue)} or ${(0, ts_simple_nameof_1.nameof)((x) => x.attributeId)}.`);
2384
2316
  }
2385
2317
  return value;
2386
2318
  }
@@ -2394,7 +2326,7 @@ __decorate([
2394
2326
  (0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
2395
2327
  (0, ts_serval_1.validate)({ nullable: true }),
2396
2328
  __metadata("design:type", Object)
2397
- ], AcceptReadAttributeRequestItemParameters.prototype, "attribute", void 0);
2329
+ ], AcceptReadAttributeRequestItemParameters.prototype, "newAttributeValue", void 0);
2398
2330
  AcceptReadAttributeRequestItemParameters = AcceptReadAttributeRequestItemParameters_1 = __decorate([
2399
2331
  (0, ts_serval_1.type)("AcceptReadAttributeRequestItemParameters")
2400
2332
  ], AcceptReadAttributeRequestItemParameters);
@@ -2434,7 +2366,7 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
2434
2366
  }
2435
2367
  async canAccept(_requestItem, params, requestInfo) {
2436
2368
  const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
2437
- if (parsedParams.attributeId) {
2369
+ if (parsedParams.isWithExistingAttribute()) {
2438
2370
  const foundAttribute = await this.consumptionController.attributes.getLocalAttribute(parsedParams.attributeId);
2439
2371
  if (!foundAttribute) {
2440
2372
  return ValidationResult_1.ValidationResult.error(transport_1.TransportErrors.general.recordNotFound(LocalAttribute_1.LocalAttribute, requestInfo.id.toString()));
@@ -2448,11 +2380,11 @@ class ReadAttributeRequestItemProcessor extends GenericRequestItemProcessor_1.Ge
2448
2380
  async accept(_requestItem, params, requestInfo) {
2449
2381
  const parsedParams = AcceptReadAttributeRequestItemParameters_1.AcceptReadAttributeRequestItemParameters.from(params);
2450
2382
  let sharedLocalAttribute;
2451
- if (parsedParams.attributeId) {
2383
+ if (parsedParams.isWithExistingAttribute()) {
2452
2384
  sharedLocalAttribute = await this.copyExistingAttribute(parsedParams.attributeId, requestInfo);
2453
2385
  }
2454
2386
  else {
2455
- sharedLocalAttribute = await this.createNewAttribute(parsedParams.attribute, requestInfo);
2387
+ sharedLocalAttribute = await this.createNewAttribute(parsedParams.newAttributeValue, requestInfo);
2456
2388
  }
2457
2389
  return content_1.ReadAttributeAcceptResponseItem.from({
2458
2390
  result: content_1.ResponseItemResult.Accepted,