@nmshd/consumption 2.0.0-alpha.13 → 2.0.0-alpha.14

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.
@@ -6,10 +6,10 @@ const content_1 = require("@nmshd/content");
6
6
  const crypto_1 = require("@nmshd/crypto");
7
7
  const transport_1 = require("@nmshd/transport");
8
8
  exports.buildInformation = {
9
- version: "2.0.0-alpha.13",
10
- build: "31",
11
- date: "2022-05-17T12:00:51+00:00",
12
- commit: "44fe03b9135fe648c60e658c1d26ee7dc7b1f145",
9
+ version: "2.0.0-alpha.14",
10
+ build: "32",
11
+ date: "2022-05-18T13:56:33+00:00",
12
+ commit: "6e1e22cfd79e7f43c9143c4ae5b2db57b0f4a92b",
13
13
  dependencies: {},
14
14
  libraries: {
15
15
  transport: transport_1.buildInformation,
@@ -2,9 +2,11 @@ import { CoreId } from "@nmshd/transport";
2
2
  import { ConsumptionBaseController } from "../../consumption";
3
3
  import { ConsumptionController } from "../../consumption/ConsumptionController";
4
4
  import { ICreateConsumptionAttributeParams } from "./CreateConsumptionAttributeParams";
5
+ import { ICreatePeerConsumptionAttributeParams } from "./CreatePeerConsumptionAttributeParams";
5
6
  import { ICreateSharedConsumptionAttributeCopyParams } from "./CreateSharedConsumptionAttributeCopyParams";
6
7
  import { ConsumptionAttribute } from "./local/ConsumptionAttribute";
7
8
  import { ISucceedConsumptionAttributeParams } from "./SuccedConsumptionAttributeParams";
9
+ import { IUpdateConsumptionAttributeParams } from "./UpdateConsumptionAttributeParams";
8
10
  export declare class ConsumptionAttributesController extends ConsumptionBaseController {
9
11
  private attributes;
10
12
  constructor(parent: ConsumptionController);
@@ -18,6 +20,7 @@ export declare class ConsumptionAttributesController extends ConsumptionBaseCont
18
20
  createConsumptionAttribute(params: ICreateConsumptionAttributeParams): Promise<ConsumptionAttribute>;
19
21
  succeedConsumptionAttribute(params: ISucceedConsumptionAttributeParams): Promise<ConsumptionAttribute>;
20
22
  createSharedConsumptionAttributeCopy(params: ICreateSharedConsumptionAttributeCopyParams): Promise<ConsumptionAttribute>;
21
- updateConsumptionAttribute(attribute: ConsumptionAttribute): Promise<ConsumptionAttribute>;
23
+ createPeerConsumptionAttribute(params: ICreatePeerConsumptionAttributeParams): Promise<ConsumptionAttribute>;
24
+ updateConsumptionAttribute(params: IUpdateConsumptionAttributeParams): Promise<ConsumptionAttribute>;
22
25
  deleteAttribute(attribute: ConsumptionAttribute): Promise<void>;
23
26
  }
@@ -88,7 +88,9 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
88
88
  }
89
89
  async succeedConsumptionAttribute(params) {
90
90
  const parsedParams = SuccedConsumptionAttributeParams_1.SucceedConsumptionAttributeParams.from(params);
91
- const current = await this.getConsumptionAttribute(parsedParams.succeeds);
91
+ const current = await this.attributes.findOne({
92
+ [(0, ts_simple_nameof_1.nameof)((c) => c.id)]: params.succeeds.toString()
93
+ });
92
94
  if (!current) {
93
95
  throw consumption_1.ConsumptionErrors.attributes.predecessorNotFound(parsedParams.succeeds.toString());
94
96
  }
@@ -96,8 +98,9 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
96
98
  parsedParams.successorContent.validFrom = transport_1.CoreDate.utc();
97
99
  }
98
100
  const validFrom = parsedParams.successorContent.validFrom;
99
- current.content.validTo = validFrom.subtract(1);
100
- await this.updateConsumptionAttribute(current);
101
+ const currentUpdated = ConsumptionAttribute_1.ConsumptionAttribute.from(current);
102
+ currentUpdated.content.validTo = validFrom.subtract(1);
103
+ await this.attributes.update(current, currentUpdated);
101
104
  const successor = await ConsumptionAttribute_1.ConsumptionAttribute.fromAttribute(parsedParams.successorContent, parsedParams.succeeds);
102
105
  await this.attributes.create(successor);
103
106
  return successor;
@@ -117,15 +120,37 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
117
120
  await this.attributes.create(sharedConsumptionAttributeCopy);
118
121
  return sharedConsumptionAttributeCopy;
119
122
  }
120
- async updateConsumptionAttribute(attribute) {
123
+ async createPeerConsumptionAttribute(params) {
124
+ const shareInfo = ConsumptionAttributeShareInfo_1.ConsumptionAttributeShareInfo.from({
125
+ peer: params.peer,
126
+ requestReference: params.requestReference
127
+ });
128
+ const peerConsumptionAttribute = ConsumptionAttribute_1.ConsumptionAttribute.from({
129
+ id: params.id,
130
+ content: params.content,
131
+ shareInfo: shareInfo,
132
+ createdAt: transport_1.CoreDate.utc()
133
+ });
134
+ await this.attributes.create(peerConsumptionAttribute);
135
+ return peerConsumptionAttribute;
136
+ }
137
+ async updateConsumptionAttribute(params) {
121
138
  const current = await this.attributes.findOne({
122
- [(0, ts_simple_nameof_1.nameof)((c) => c.id)]: attribute.id.toString()
139
+ [(0, ts_simple_nameof_1.nameof)((c) => c.id)]: params.id.toString()
123
140
  });
124
141
  if (!current) {
125
- throw transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, attribute.id.toString());
142
+ throw transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, params.id.toString());
126
143
  }
127
- await this.attributes.update(current, attribute);
128
- return attribute;
144
+ const updatedConsumptionAttribute = ConsumptionAttribute_1.ConsumptionAttribute.from({
145
+ id: current.id,
146
+ content: params.content,
147
+ createdAt: current.createdAt,
148
+ shareInfo: current.shareInfo,
149
+ succeededBy: current.succeededBy,
150
+ succeeds: current.succeeds
151
+ });
152
+ await this.attributes.update(current, updatedConsumptionAttribute);
153
+ return updatedConsumptionAttribute;
129
154
  }
130
155
  async deleteAttribute(attribute) {
131
156
  await this.attributes.delete(attribute);
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumptionAttributesController.js","sourceRoot":"","sources":["../../../src/modules/attributes/ConsumptionAttributesController.ts"],"names":[],"mappings":";;;AAAA,gDAA4F;AAC5F,uDAAyC;AACzC,mDAA2G;AAG3G,6GAGqD;AACrD,uEAAmE;AACnE,yFAAqF;AACrF,yFAG2C;AAE3C,MAAa,+BAAgC,SAAQ,uCAAyB;IAG1E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AC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE;SACvE,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,2BAAe,CAAC,OAAO,CAAC,cAAc,CAAC,2CAAoB,EAAE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;SAC9F;QACD,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;QAChD,OAAO,SAAS,CAAA;IACpB,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAA+B;QACxD,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC3C,CAAC;CACJ;AAxJD,0EAwJC"}
1
+ {"version":3,"file":"ConsumptionAttributesController.js","sourceRoot":"","sources":["../../../src/modules/attributes/ConsumptionAttributesController.ts"],"names":[],"mappings":";;;AAAA,gDAA4F;AAC5F,uDAAyC;AACzC,mDAA2G;AAI3G,6GAGqD;AACrD,uEAAmE;AACnE,yFAAqF;AACrF,yFAG2C;AAG3C,MAAa,+BAAgC,SAAQ,uCAAyB;IAG1E,YAAmB,MAA6B;QAC5C,KAAK,CAAC,uCAAyB,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAA;IAC5E,CAAC;IAEe,KAAK,CAAC,IAAI;QACtB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAElB,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAA;QAE7F,OAAO,IAAI,CAAA;IACf,CAAC;IAEM,UAAU,CAAC,SAA+B;QAC7C,MAAM,GAAG,GAAG,oBAAQ,CAAC,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE;YAC5D,OAAO,IAA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C,CAAA;QACtD,OAAO,wBAAwB,CAAA;IACnC,CAAC;IAEM,KAAK,CAAC,0BAA0B,CAAC,MAAyC;QAC7E,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAC1C,CAAC,IAAA,yBAAM,EAAuB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE;SACpE,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,2BAAe,CAAC,OAAO,CAAC,cAAc,CAAC,2CAAoB,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;SAC3F;QACD,MAAM,2BAA2B,GAAG,2CAAoB,CAAC,IAAI,CAAC;YAC1D,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC7B,CAAC,CAAA;QACF,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,2BAA2B,CAAC,CAAA;QAClE,OAAO,2BAA2B,CAAA;IACtC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,SAA+B;QACxD,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC3C,CAAC;CACJ;AApLD,0EAoLC"}
@@ -0,0 +1,16 @@
1
+ import { ISerializable, Serializable } from "@js-soft/ts-serval";
2
+ import { IdentityAttribute, IIdentityAttribute, IRelationshipAttribute, RelationshipAttribute } from "@nmshd/content";
3
+ import { CoreAddress, CoreId, ICoreAddress, ICoreId } from "@nmshd/transport";
4
+ export interface ICreatePeerConsumptionAttributeParams extends ISerializable {
5
+ id: ICoreId;
6
+ content: IIdentityAttribute | IRelationshipAttribute;
7
+ requestReference: ICoreId;
8
+ peer: ICoreAddress;
9
+ }
10
+ export declare class CreatePeerConsumptionAttributeParams extends Serializable implements ICreatePeerConsumptionAttributeParams {
11
+ id: CoreId;
12
+ content: IdentityAttribute | RelationshipAttribute;
13
+ requestReference: CoreId;
14
+ peer: CoreAddress;
15
+ static from(value: ICreatePeerConsumptionAttributeParams): CreatePeerConsumptionAttributeParams;
16
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CreatePeerConsumptionAttributeParams = void 0;
13
+ const ts_serval_1 = require("@js-soft/ts-serval");
14
+ const content_1 = require("@nmshd/content");
15
+ const transport_1 = require("@nmshd/transport");
16
+ class CreatePeerConsumptionAttributeParams extends ts_serval_1.Serializable {
17
+ static from(value) {
18
+ return this.fromAny(value);
19
+ }
20
+ }
21
+ __decorate([
22
+ (0, ts_serval_1.serialize)(),
23
+ (0, ts_serval_1.validate)(),
24
+ __metadata("design:type", transport_1.CoreId)
25
+ ], CreatePeerConsumptionAttributeParams.prototype, "id", void 0);
26
+ __decorate([
27
+ (0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
28
+ (0, ts_serval_1.validate)(),
29
+ __metadata("design:type", Object)
30
+ ], CreatePeerConsumptionAttributeParams.prototype, "content", void 0);
31
+ __decorate([
32
+ (0, ts_serval_1.serialize)(),
33
+ (0, ts_serval_1.validate)(),
34
+ __metadata("design:type", transport_1.CoreId)
35
+ ], CreatePeerConsumptionAttributeParams.prototype, "requestReference", void 0);
36
+ __decorate([
37
+ (0, ts_serval_1.serialize)(),
38
+ (0, ts_serval_1.validate)(),
39
+ __metadata("design:type", transport_1.CoreAddress)
40
+ ], CreatePeerConsumptionAttributeParams.prototype, "peer", void 0);
41
+ exports.CreatePeerConsumptionAttributeParams = CreatePeerConsumptionAttributeParams;
42
+ //# sourceMappingURL=CreatePeerConsumptionAttributeParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreatePeerConsumptionAttributeParams.js","sourceRoot":"","sources":["../../../src/modules/attributes/CreatePeerConsumptionAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAAqH;AACrH,gDAA6E;AAS7E,MAAa,oCACT,SAAQ,wBAAY;IAmBb,MAAM,CAAC,IAAI,CAAC,KAA4C;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;AAjBG;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACA,kBAAM;gEAAA;AAIjB;IAFC,IAAA,qBAAS,EAAC,EAAE,UAAU,EAAE,CAAC,2BAAiB,EAAE,+BAAqB,CAAC,EAAE,CAAC;IACrE,IAAA,oBAAQ,GAAE;;qEAC8C;AAIzD;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACc,kBAAM;8EAAA;AAI/B;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACE,uBAAW;kEAAA;AAlB5B,oFAuBC"}
@@ -0,0 +1,12 @@
1
+ import { ISerializable, Serializable } from "@js-soft/ts-serval";
2
+ import { IdentityAttribute, IIdentityAttribute, IRelationshipAttribute, RelationshipAttribute } from "@nmshd/content";
3
+ import { CoreId, ICoreId } from "@nmshd/transport";
4
+ export interface IUpdateConsumptionAttributeParams extends ISerializable {
5
+ id: ICoreId;
6
+ content: IIdentityAttribute | IRelationshipAttribute;
7
+ }
8
+ export declare class UpdateConsumptionAttributeParams extends Serializable implements IUpdateConsumptionAttributeParams {
9
+ id: CoreId;
10
+ content: IdentityAttribute | RelationshipAttribute;
11
+ static from(value: IUpdateConsumptionAttributeParams): UpdateConsumptionAttributeParams;
12
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.UpdateConsumptionAttributeParams = void 0;
13
+ const ts_serval_1 = require("@js-soft/ts-serval");
14
+ const content_1 = require("@nmshd/content");
15
+ const transport_1 = require("@nmshd/transport");
16
+ class UpdateConsumptionAttributeParams extends ts_serval_1.Serializable {
17
+ static from(value) {
18
+ return this.fromAny(value);
19
+ }
20
+ }
21
+ __decorate([
22
+ (0, ts_serval_1.serialize)(),
23
+ (0, ts_serval_1.validate)(),
24
+ __metadata("design:type", transport_1.CoreId)
25
+ ], UpdateConsumptionAttributeParams.prototype, "id", void 0);
26
+ __decorate([
27
+ (0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
28
+ (0, ts_serval_1.validate)(),
29
+ __metadata("design:type", Object)
30
+ ], UpdateConsumptionAttributeParams.prototype, "content", void 0);
31
+ exports.UpdateConsumptionAttributeParams = UpdateConsumptionAttributeParams;
32
+ //# sourceMappingURL=UpdateConsumptionAttributeParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpdateConsumptionAttributeParams.js","sourceRoot":"","sources":["../../../src/modules/attributes/UpdateConsumptionAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAAqH;AACrH,gDAAkD;AAOlD,MAAa,gCAAiC,SAAQ,wBAAY;IASvD,MAAM,CAAC,IAAI,CAAC,KAAwC;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;AATG;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACA,kBAAM;4DAAA;AAIjB;IAFC,IAAA,qBAAS,EAAC,EAAE,UAAU,EAAE,CAAC,2BAAiB,EAAE,+BAAqB,CAAC,EAAE,CAAC;IACrE,IAAA,oBAAQ,GAAE;;iEAC8C;AAP7D,4EAYC"}
@@ -1,6 +1,13 @@
1
- import { IdentityAttribute, IIdentityAttribute, IRelationshipAttribute, RelationshipAttribute } from "@nmshd/content";
1
+ import { IdentityAttribute, IdentityAttributeJSON, IIdentityAttribute, IRelationshipAttribute, RelationshipAttribute, RelationshipAttributeJSON } from "@nmshd/content";
2
2
  import { CoreDate, CoreId, CoreSynchronizable, ICoreDate, ICoreId, ICoreSynchronizable } from "@nmshd/transport";
3
- import { ConsumptionAttributeShareInfo, IConsumptionAttributeShareInfo } from "./ConsumptionAttributeShareInfo";
3
+ import { ConsumptionAttributeShareInfo, ConsumptionAttributeShareInfoJSON, IConsumptionAttributeShareInfo } from "./ConsumptionAttributeShareInfo";
4
+ export interface ConsumptionAttributeJSON {
5
+ content: IdentityAttributeJSON | RelationshipAttributeJSON;
6
+ createdAt: string;
7
+ succeeds: string;
8
+ succeededBy: string;
9
+ shareInfo: ConsumptionAttributeShareInfoJSON;
10
+ }
4
11
  export interface IConsumptionAttribute extends ICoreSynchronizable {
5
12
  content: IIdentityAttribute | IRelationshipAttribute;
6
13
  createdAt: ICoreDate;
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumptionAttribute.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/ConsumptionAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA8D;AAC9D,4CAAqH;AACrH,gDAAgH;AAChH,uDAAyC;AACzC,sDAAqD;AACrD,mFAA+G;AAW/G,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,8BAAkB;IAA5D;;QAC6B,wBAAmB,GAAG;YAC3C,OAAO;YACP,UAAU;YACV,IAAA,yBAAM,EAAuB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YAChD,IAAA,yBAAM,EAAuB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;YAC/C,IAAA,yBAAM,EAAuB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACnD,CAAA;QAEwB,uBAAkB,GAAG,CAAC,IAAA,yBAAM,EAAuB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAuClG,CAAC;IAjBU,MAAM,CAAC,IAAI,CAAC,KAA4B;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,aAAa,CAC7B,SAAsD,EACtD,QAAkB,EAClB,SAA0C;QAE1C,OAAO,IAAI,CAAC,IAAI,CAAC;YACb,OAAO,EAAE,SAAS;YAClB,EAAE,EAAE,MAAM,4BAAc,CAAC,SAAS,CAAC,QAAQ,EAAE;Y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A,qBAAS,GAAE;8BACO,6DAA6B;uDAAA;AA7BvC,oBAAoB;IADhC,IAAA,gBAAI,EAAC,sBAAsB,CAAC;GAChB,oBAAoB,CAgDhC;AAhDY,oDAAoB"}
@@ -1,4 +1,9 @@
1
1
  import { CoreAddress, CoreId, CoreSerializable, ICoreAddress, ICoreId, ICoreSerializable } from "@nmshd/transport";
2
+ export interface ConsumptionAttributeShareInfoJSON {
3
+ requestReference: string;
4
+ peer: string;
5
+ sourceAttribute?: string;
6
+ }
2
7
  export interface IConsumptionAttributeShareInfo extends ICoreSerializable {
3
8
  requestReference: ICoreId;
4
9
  peer: ICoreAddress;
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumptionAttributeShareInfo.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/ConsumptionAttributeShareInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAwD;AACxD,gDAAkH;AAQlH,MAAa,6BAA8B,SAAQ,4BAAgB;IAaxD,MAAM,CAAC,IAAI,CAAC,KAAqC;QACpD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAkC,CAAA;IAChE,CAAC;CACJ;AAbG;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACa,kBAAM;uEAAA;AAI/B;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACC,uBAAW;2DAAA;AAIxB;IAFC,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;8BACa,kBAAM;sEAAA;AAXnC,sEAgBC"}
1
+ {"version":3,"file":"ConsumptionAttributeShareInfo.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/ConsumptionAttributeShareInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAwD;AACxD,gDAAkH;AAclH,MAAa,6BAA8B,SAAQ,4BAAgB;IAaxD,MAAM,CAAC,IAAI,CAAC,KAAqC;QACpD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAkC,CAAA;IAChE,CAAC;CACJ;AAbG;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACa,kBAAM;uEAAA;AAI/B;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACC,uBAAW;2DAAA;AAIxB;IAFC,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;8BACa,kBAAM;sEAAA;AAXnC,sEAgBC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./attributes/ConsumptionAttributesController";
2
2
  export * from "./attributes/CreateConsumptionAttributeParams";
3
+ export * from "./attributes/CreatePeerConsumptionAttributeParams";
3
4
  export * from "./attributes/CreateSharedConsumptionAttributeCopyParams";
4
5
  export * from "./attributes/local/ConsumptionAttribute";
5
6
  export * from "./attributes/SuccedConsumptionAttributeParams";
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./attributes/ConsumptionAttributesController"), exports);
18
18
  __exportStar(require("./attributes/CreateConsumptionAttributeParams"), exports);
19
+ __exportStar(require("./attributes/CreatePeerConsumptionAttributeParams"), exports);
19
20
  __exportStar(require("./attributes/CreateSharedConsumptionAttributeCopyParams"), exports);
20
21
  __exportStar(require("./attributes/local/ConsumptionAttribute"), exports);
21
22
  __exportStar(require("./attributes/SuccedConsumptionAttributeParams"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+EAA4D;AAC5D,gFAA6D;AAC7D,0FAAuE;AACvE,0EAAuD;AACvD,gFAA6D;AAC7D,4DAAyC;AACzC,uDAAoC;AACpC,uHAAoG;AACpG,iGAA8E;AAC9E,yFAAsE;AACtE,8FAA2E;AAC3E,yFAAsE;AACtE,qFAAkE;AAClE,yFAAsE;AACtE,uFAAoE;AACpE,iFAA8D;AAC9D,iGAA8E;AAC9E,6HAA0G;AAC1G,wFAAqE;AACrE,iFAA8D;AAC9D,mFAAgE;AAChE,yFAAsE;AACtE,6EAA0D;AAC1D,sEAAmD;AACnD,4EAAyD;AACzD,oFAAiE;AACjE,uEAAoD;AACpD,gHAA6F;AAC7F,yJAAsI;AACtI,4GAAyF;AACzF,iFAA8D;AAC9D,wGAAqF;AACrF,2DAAwC;AACxC,gEAA6C;AAC7C,yDAAsC;AACtC,gEAA6C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+EAA4D;AAC5D,gFAA6D;AAC7D,oFAAiE;AACjE,0FAAuE;AACvE,0EAAuD;AACvD,gFAA6D;AAC7D,4DAAyC;AACzC,uDAAoC;AACpC,uHAAoG;AACpG,iGAA8E;AAC9E,yFAAsE;AACtE,8FAA2E;AAC3E,yFAAsE;AACtE,qFAAkE;AAClE,yFAAsE;AACtE,uFAAoE;AACpE,iFAA8D;AAC9D,iGAA8E;AAC9E,6HAA0G;AAC1G,wFAAqE;AACrE,iFAA8D;AAC9D,mFAAgE;AAChE,yFAAsE;AACtE,6EAA0D;AAC1D,sEAAmD;AACnD,4EAAyD;AACzD,oFAAiE;AACjE,uEAAoD;AACpD,gHAA6F;AAC7F,yJAAsI;AACtI,4GAAyF;AACzF,iFAA8D;AAC9D,wGAAqF;AACrF,2DAAwC;AACxC,gEAA6C;AAC7C,yDAAsC;AACtC,gEAA6C"}
@@ -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.13",
21
- build: "31",
22
- date: "2022-05-17T12:00:51+00:00",
23
- commit: "44fe03b9135fe648c60e658c1d26ee7dc7b1f145",
20
+ version: "2.0.0-alpha.14",
21
+ build: "32",
22
+ date: "2022-05-18T13:56:33+00:00",
23
+ commit: "6e1e22cfd79e7f43c9143c4ae5b2db57b0f4a92b",
24
24
  dependencies: {},
25
25
  libraries: {
26
26
  transport: transport_1.buildInformation,
@@ -370,7 +370,9 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
370
370
  }
371
371
  async succeedConsumptionAttribute(params) {
372
372
  const parsedParams = SuccedConsumptionAttributeParams_1.SucceedConsumptionAttributeParams.from(params);
373
- const current = await this.getConsumptionAttribute(parsedParams.succeeds);
373
+ const current = await this.attributes.findOne({
374
+ [(0, ts_simple_nameof_1.nameof)((c) => c.id)]: params.succeeds.toString()
375
+ });
374
376
  if (!current) {
375
377
  throw consumption_1.ConsumptionErrors.attributes.predecessorNotFound(parsedParams.succeeds.toString());
376
378
  }
@@ -378,8 +380,9 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
378
380
  parsedParams.successorContent.validFrom = transport_1.CoreDate.utc();
379
381
  }
380
382
  const validFrom = parsedParams.successorContent.validFrom;
381
- current.content.validTo = validFrom.subtract(1);
382
- await this.updateConsumptionAttribute(current);
383
+ const currentUpdated = ConsumptionAttribute_1.ConsumptionAttribute.from(current);
384
+ currentUpdated.content.validTo = validFrom.subtract(1);
385
+ await this.attributes.update(current, currentUpdated);
383
386
  const successor = await ConsumptionAttribute_1.ConsumptionAttribute.fromAttribute(parsedParams.successorContent, parsedParams.succeeds);
384
387
  await this.attributes.create(successor);
385
388
  return successor;
@@ -399,15 +402,37 @@ class ConsumptionAttributesController extends consumption_1.ConsumptionBaseContr
399
402
  await this.attributes.create(sharedConsumptionAttributeCopy);
400
403
  return sharedConsumptionAttributeCopy;
401
404
  }
402
- async updateConsumptionAttribute(attribute) {
405
+ async createPeerConsumptionAttribute(params) {
406
+ const shareInfo = ConsumptionAttributeShareInfo_1.ConsumptionAttributeShareInfo.from({
407
+ peer: params.peer,
408
+ requestReference: params.requestReference
409
+ });
410
+ const peerConsumptionAttribute = ConsumptionAttribute_1.ConsumptionAttribute.from({
411
+ id: params.id,
412
+ content: params.content,
413
+ shareInfo: shareInfo,
414
+ createdAt: transport_1.CoreDate.utc()
415
+ });
416
+ await this.attributes.create(peerConsumptionAttribute);
417
+ return peerConsumptionAttribute;
418
+ }
419
+ async updateConsumptionAttribute(params) {
403
420
  const current = await this.attributes.findOne({
404
- [(0, ts_simple_nameof_1.nameof)((c) => c.id)]: attribute.id.toString()
421
+ [(0, ts_simple_nameof_1.nameof)((c) => c.id)]: params.id.toString()
405
422
  });
406
423
  if (!current) {
407
- throw transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, attribute.id.toString());
408
- }
409
- await this.attributes.update(current, attribute);
410
- return attribute;
424
+ throw transport_1.TransportErrors.general.recordNotFound(ConsumptionAttribute_1.ConsumptionAttribute, params.id.toString());
425
+ }
426
+ const updatedConsumptionAttribute = ConsumptionAttribute_1.ConsumptionAttribute.from({
427
+ id: current.id,
428
+ content: params.content,
429
+ createdAt: current.createdAt,
430
+ shareInfo: current.shareInfo,
431
+ succeededBy: current.succeededBy,
432
+ succeeds: current.succeeds
433
+ });
434
+ await this.attributes.update(current, updatedConsumptionAttribute);
435
+ return updatedConsumptionAttribute;
411
436
  }
412
437
  async deleteAttribute(attribute) {
413
438
  await this.attributes.delete(attribute);
@@ -454,6 +479,58 @@ exports.CreateConsumptionAttributeParams = CreateConsumptionAttributeParams;
454
479
 
455
480
  /***/ }),
456
481
 
482
+ /***/ "./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js":
483
+ /*!*************************************************************************!*\
484
+ !*** ./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js ***!
485
+ \*************************************************************************/
486
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
487
+
488
+ "use strict";
489
+
490
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
491
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
492
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
493
+ 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;
494
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
495
+ };
496
+ var __metadata = (this && this.__metadata) || function (k, v) {
497
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
498
+ };
499
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
500
+ exports.CreatePeerConsumptionAttributeParams = void 0;
501
+ const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
502
+ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
503
+ const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
504
+ class CreatePeerConsumptionAttributeParams extends ts_serval_1.Serializable {
505
+ static from(value) {
506
+ return this.fromAny(value);
507
+ }
508
+ }
509
+ __decorate([
510
+ (0, ts_serval_1.serialize)(),
511
+ (0, ts_serval_1.validate)(),
512
+ __metadata("design:type", transport_1.CoreId)
513
+ ], CreatePeerConsumptionAttributeParams.prototype, "id", void 0);
514
+ __decorate([
515
+ (0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
516
+ (0, ts_serval_1.validate)(),
517
+ __metadata("design:type", Object)
518
+ ], CreatePeerConsumptionAttributeParams.prototype, "content", void 0);
519
+ __decorate([
520
+ (0, ts_serval_1.serialize)(),
521
+ (0, ts_serval_1.validate)(),
522
+ __metadata("design:type", transport_1.CoreId)
523
+ ], CreatePeerConsumptionAttributeParams.prototype, "requestReference", void 0);
524
+ __decorate([
525
+ (0, ts_serval_1.serialize)(),
526
+ (0, ts_serval_1.validate)(),
527
+ __metadata("design:type", transport_1.CoreAddress)
528
+ ], CreatePeerConsumptionAttributeParams.prototype, "peer", void 0);
529
+ exports.CreatePeerConsumptionAttributeParams = CreatePeerConsumptionAttributeParams;
530
+ //# sourceMappingURL=CreatePeerConsumptionAttributeParams.js.map
531
+
532
+ /***/ }),
533
+
457
534
  /***/ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js":
458
535
  /*!*******************************************************************************!*\
459
536
  !*** ./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js ***!
@@ -833,6 +910,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
833
910
  Object.defineProperty(exports, "__esModule", ({ value: true }));
834
911
  __exportStar(__webpack_require__(/*! ./attributes/ConsumptionAttributesController */ "./dist/modules/attributes/ConsumptionAttributesController.js"), exports);
835
912
  __exportStar(__webpack_require__(/*! ./attributes/CreateConsumptionAttributeParams */ "./dist/modules/attributes/CreateConsumptionAttributeParams.js"), exports);
913
+ __exportStar(__webpack_require__(/*! ./attributes/CreatePeerConsumptionAttributeParams */ "./dist/modules/attributes/CreatePeerConsumptionAttributeParams.js"), exports);
836
914
  __exportStar(__webpack_require__(/*! ./attributes/CreateSharedConsumptionAttributeCopyParams */ "./dist/modules/attributes/CreateSharedConsumptionAttributeCopyParams.js"), exports);
837
915
  __exportStar(__webpack_require__(/*! ./attributes/local/ConsumptionAttribute */ "./dist/modules/attributes/local/ConsumptionAttribute.js"), exports);
838
916
  __exportStar(__webpack_require__(/*! ./attributes/SuccedConsumptionAttributeParams */ "./dist/modules/attributes/SuccedConsumptionAttributeParams.js"), exports);