@nmshd/consumption 2.0.0-alpha.7 → 2.0.0-beta.1

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 (159) hide show
  1. package/README.md +2 -2
  2. package/dist/buildInformation.js +5 -5
  3. package/dist/consumption/ConsumptionBaseController.d.ts +1 -1
  4. package/dist/consumption/ConsumptionController.d.ts +9 -10
  5. package/dist/consumption/ConsumptionController.js +23 -14
  6. package/dist/consumption/ConsumptionController.js.map +1 -1
  7. package/dist/consumption/ConsumptionControllerName.d.ts +1 -1
  8. package/dist/consumption/ConsumptionControllerName.js +1 -1
  9. package/dist/consumption/ConsumptionControllerName.js.map +1 -1
  10. package/dist/consumption/ConsumptionErrors.d.ts +5 -2
  11. package/dist/consumption/ConsumptionErrors.js +12 -3
  12. package/dist/consumption/ConsumptionErrors.js.map +1 -1
  13. package/dist/consumption/ConsumptionIds.d.ts +2 -5
  14. package/dist/consumption/ConsumptionIds.js +4 -7
  15. package/dist/consumption/ConsumptionIds.js.map +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/modules/attributes/LocalAttributesController.d.ts +29 -0
  20. package/dist/modules/attributes/LocalAttributesController.js +174 -0
  21. package/dist/modules/attributes/LocalAttributesController.js.map +1 -0
  22. package/dist/modules/attributes/local/CreateLocalAttributeParams.d.ts +12 -0
  23. package/dist/modules/attributes/local/CreateLocalAttributeParams.js +26 -0
  24. package/dist/modules/attributes/local/CreateLocalAttributeParams.js.map +1 -0
  25. package/dist/modules/attributes/local/CreatePeerLocalAttributeParams.d.ts +22 -0
  26. package/dist/modules/{signatures/SignatureContent.js → attributes/local/CreatePeerLocalAttributeParams.js} +15 -32
  27. package/dist/modules/attributes/local/CreatePeerLocalAttributeParams.js.map +1 -0
  28. package/dist/modules/attributes/local/CreateRelationshipAttributeParams.d.ts +14 -0
  29. package/dist/modules/{relationships/local/RelationshipAttribute.js → attributes/local/CreateRelationshipAttributeParams.js} +15 -15
  30. package/dist/modules/attributes/local/CreateRelationshipAttributeParams.js.map +1 -0
  31. package/dist/modules/attributes/local/CreateSharedLocalAttributeCopyParams.d.ts +21 -0
  32. package/dist/modules/{relationships/local/RelationshipTheme.js → attributes/local/CreateSharedLocalAttributeCopyParams.js} +18 -20
  33. package/dist/modules/attributes/local/CreateSharedLocalAttributeCopyParams.js.map +1 -0
  34. package/dist/modules/attributes/local/LocalAttribute.d.ts +30 -0
  35. package/dist/modules/attributes/local/{ConsumptionAttribute.js → LocalAttribute.js} +36 -24
  36. package/dist/modules/attributes/local/LocalAttribute.js.map +1 -0
  37. package/dist/modules/attributes/local/LocalAttributeShareInfo.d.ts +17 -0
  38. package/dist/modules/attributes/local/LocalAttributeShareInfo.js +36 -0
  39. package/dist/modules/attributes/local/LocalAttributeShareInfo.js.map +1 -0
  40. package/dist/modules/attributes/local/QueryTranslator.d.ts +9 -0
  41. package/dist/modules/attributes/local/QueryTranslator.js +125 -0
  42. package/dist/modules/attributes/local/QueryTranslator.js.map +1 -0
  43. package/dist/modules/attributes/local/SucceedLocalAttributeParams.d.ts +16 -0
  44. package/dist/modules/attributes/local/SucceedLocalAttributeParams.js +32 -0
  45. package/dist/modules/attributes/local/SucceedLocalAttributeParams.js.map +1 -0
  46. package/dist/modules/attributes/local/UpdateLocalAttributeParams.d.ts +16 -0
  47. package/dist/modules/attributes/local/UpdateLocalAttributeParams.js +32 -0
  48. package/dist/modules/attributes/local/UpdateLocalAttributeParams.js.map +1 -0
  49. package/dist/modules/drafts/DraftsController.d.ts +1 -1
  50. package/dist/modules/drafts/DraftsController.js.map +1 -1
  51. package/dist/modules/index.d.ts +23 -14
  52. package/dist/modules/index.js +22 -14
  53. package/dist/modules/index.js.map +1 -1
  54. package/dist/modules/requests/incoming/DecideRequestParametersValidator.d.ts +3 -3
  55. package/dist/modules/requests/incoming/DecideRequestParametersValidator.js +20 -27
  56. package/dist/modules/requests/incoming/DecideRequestParametersValidator.js.map +1 -1
  57. package/dist/modules/requests/incoming/IncomingRequestsController.d.ts +12 -13
  58. package/dist/modules/requests/incoming/IncomingRequestsController.js +55 -58
  59. package/dist/modules/requests/incoming/IncomingRequestsController.js.map +1 -1
  60. package/dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.d.ts +21 -0
  61. package/dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js +12 -0
  62. package/dist/modules/requests/itemProcessors/AbstractRequestItemProcessor.js.map +1 -0
  63. package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.d.ts +13 -11
  64. package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js +13 -17
  65. package/dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js.map +1 -1
  66. package/dist/modules/requests/itemProcessors/IRequestItemProcessor.d.ts +14 -9
  67. package/dist/modules/requests/itemProcessors/ProcessorConstructor.d.ts +2 -1
  68. package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.d.ts +6 -7
  69. package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js +10 -12
  70. package/dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js.map +1 -1
  71. package/dist/modules/requests/itemProcessors/ValidationResult.d.ts +7 -7
  72. package/dist/modules/requests/itemProcessors/ValidationResult.js +11 -11
  73. package/dist/modules/requests/itemProcessors/ValidationResult.js.map +1 -1
  74. package/dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.d.ts +7 -0
  75. package/dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js +20 -0
  76. package/dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js.map +1 -0
  77. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.d.ts +13 -0
  78. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js +71 -0
  79. package/dist/modules/requests/itemProcessors/createAttribute/CreateAttributeRequestItemProcessor.js.map +1 -0
  80. package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.d.ts +20 -0
  81. package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js +47 -0
  82. package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js.map +1 -0
  83. package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.d.ts +16 -0
  84. package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js +110 -0
  85. package/dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js.map +1 -0
  86. package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.d.ts +23 -0
  87. package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js +54 -0
  88. package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js.map +1 -0
  89. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.d.ts +14 -0
  90. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js +88 -0
  91. package/dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js.map +1 -0
  92. package/dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.d.ts +7 -0
  93. package/dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js +20 -0
  94. package/dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js.map +1 -0
  95. package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.d.ts +15 -0
  96. package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js +94 -0
  97. package/dist/modules/requests/itemProcessors/shareAttribute/ShareAttributeRequestItemProcessor.js.map +1 -0
  98. package/dist/modules/requests/itemProcessors/utility/validateQuery.d.ts +4 -0
  99. package/dist/modules/requests/itemProcessors/utility/validateQuery.js +21 -0
  100. package/dist/modules/requests/itemProcessors/utility/validateQuery.js.map +1 -0
  101. package/dist/modules/requests/local/LocalRequest.d.ts +37 -0
  102. package/dist/modules/requests/local/{ConsumptionRequest.js → LocalRequest.js} +32 -32
  103. package/dist/modules/requests/local/LocalRequest.js.map +1 -0
  104. package/dist/modules/requests/local/{ConsumptionRequestStatus.d.ts → LocalRequestStatus.d.ts} +1 -1
  105. package/dist/modules/requests/local/LocalRequestStatus.js +13 -0
  106. package/dist/modules/requests/local/LocalRequestStatus.js.map +1 -0
  107. package/dist/modules/requests/local/LocalRequestStatusLogEntry.d.ts +17 -0
  108. package/dist/modules/requests/local/{ConsumptionRequestStatusLogEntry.js → LocalRequestStatusLogEntry.js} +13 -13
  109. package/dist/modules/requests/local/LocalRequestStatusLogEntry.js.map +1 -0
  110. package/dist/modules/requests/local/LocalResponse.d.ts +22 -0
  111. package/dist/modules/requests/local/{ConsumptionResponse.js → LocalResponse.js} +18 -18
  112. package/dist/modules/requests/local/LocalResponse.js.map +1 -0
  113. package/dist/modules/requests/outgoing/OutgoingRequestsController.d.ts +9 -10
  114. package/dist/modules/requests/outgoing/OutgoingRequestsController.js +49 -43
  115. package/dist/modules/requests/outgoing/OutgoingRequestsController.js.map +1 -1
  116. package/dist/modules/settings/SettingsController.d.ts +1 -1
  117. package/dist/modules/settings/SettingsController.js.map +1 -1
  118. package/lib-web/nmshd.consumption.js +12465 -3351
  119. package/lib-web/nmshd.consumption.js.map +1 -1
  120. package/lib-web/nmshd.consumption.min.js +1 -1
  121. package/lib-web/nmshd.consumption.min.js.map +1 -1
  122. package/package.json +29 -25
  123. package/dist/modules/attributes/ConsumptionAttributesController.d.ts +0 -22
  124. package/dist/modules/attributes/ConsumptionAttributesController.js +0 -141
  125. package/dist/modules/attributes/ConsumptionAttributesController.js.map +0 -1
  126. package/dist/modules/attributes/local/ConsumptionAttribute.d.ts +0 -19
  127. package/dist/modules/attributes/local/ConsumptionAttribute.js.map +0 -1
  128. package/dist/modules/relationships/RelationshipInfoController.d.ts +0 -15
  129. package/dist/modules/relationships/RelationshipInfoController.js +0 -61
  130. package/dist/modules/relationships/RelationshipInfoController.js.map +0 -1
  131. package/dist/modules/relationships/RelationshipInfoUtil.d.ts +0 -15
  132. package/dist/modules/relationships/RelationshipInfoUtil.js +0 -219
  133. package/dist/modules/relationships/RelationshipInfoUtil.js.map +0 -1
  134. package/dist/modules/relationships/local/RelationshipAttribute.d.ts +0 -14
  135. package/dist/modules/relationships/local/RelationshipAttribute.js.map +0 -1
  136. package/dist/modules/relationships/local/RelationshipInfo.d.ts +0 -27
  137. package/dist/modules/relationships/local/RelationshipInfo.js +0 -97
  138. package/dist/modules/relationships/local/RelationshipInfo.js.map +0 -1
  139. package/dist/modules/relationships/local/RelationshipTheme.d.ts +0 -14
  140. package/dist/modules/relationships/local/RelationshipTheme.js.map +0 -1
  141. package/dist/modules/requests/local/ConsumptionRequest.d.ts +0 -37
  142. package/dist/modules/requests/local/ConsumptionRequest.js.map +0 -1
  143. package/dist/modules/requests/local/ConsumptionRequestStatus.js +0 -13
  144. package/dist/modules/requests/local/ConsumptionRequestStatus.js.map +0 -1
  145. package/dist/modules/requests/local/ConsumptionRequestStatusLogEntry.d.ts +0 -17
  146. package/dist/modules/requests/local/ConsumptionRequestStatusLogEntry.js.map +0 -1
  147. package/dist/modules/requests/local/ConsumptionResponse.d.ts +0 -22
  148. package/dist/modules/requests/local/ConsumptionResponse.js.map +0 -1
  149. package/dist/modules/sharedItems/SharedItemsController.d.ts +0 -14
  150. package/dist/modules/sharedItems/SharedItemsController.js +0 -40
  151. package/dist/modules/sharedItems/SharedItemsController.js.map +0 -1
  152. package/dist/modules/sharedItems/local/SharedItem.d.ts +0 -31
  153. package/dist/modules/sharedItems/local/SharedItem.js +0 -100
  154. package/dist/modules/sharedItems/local/SharedItem.js.map +0 -1
  155. package/dist/modules/signatures/Signature.d.ts +0 -16
  156. package/dist/modules/signatures/Signature.js +0 -56
  157. package/dist/modules/signatures/Signature.js.map +0 -1
  158. package/dist/modules/signatures/SignatureContent.d.ts +0 -21
  159. package/dist/modules/signatures/SignatureContent.js.map +0 -1
@@ -9,51 +9,34 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SignatureContent = void 0;
12
+ exports.CreatePeerLocalAttributeParams = void 0;
13
13
  const ts_serval_1 = require("@js-soft/ts-serval");
14
+ const content_1 = require("@nmshd/content");
14
15
  const transport_1 = require("@nmshd/transport");
15
- let SignatureContent = class SignatureContent extends transport_1.CoreSerializable {
16
+ class CreatePeerLocalAttributeParams extends ts_serval_1.Serializable {
16
17
  static from(value) {
17
18
  return this.fromAny(value);
18
19
  }
19
- };
20
- __decorate([
21
- (0, ts_serval_1.validate)(),
22
- (0, ts_serval_1.serialize)(),
23
- __metadata("design:type", Number)
24
- ], SignatureContent.prototype, "version", void 0);
20
+ }
25
21
  __decorate([
26
- (0, ts_serval_1.validate)(),
27
22
  (0, ts_serval_1.serialize)(),
28
- __metadata("design:type", Number)
29
- ], SignatureContent.prototype, "signatureAlgorithm", void 0);
30
- __decorate([
31
23
  (0, ts_serval_1.validate)(),
32
- (0, ts_serval_1.serialize)(),
33
- __metadata("design:type", Number)
34
- ], SignatureContent.prototype, "hashAlgorithm", void 0);
24
+ __metadata("design:type", transport_1.CoreId)
25
+ ], CreatePeerLocalAttributeParams.prototype, "id", void 0);
35
26
  __decorate([
27
+ (0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
36
28
  (0, ts_serval_1.validate)(),
37
- (0, ts_serval_1.serialize)(),
38
- __metadata("design:type", transport_1.CoreDate)
39
- ], SignatureContent.prototype, "signedAt", void 0);
29
+ __metadata("design:type", Object)
30
+ ], CreatePeerLocalAttributeParams.prototype, "content", void 0);
40
31
  __decorate([
41
- (0, ts_serval_1.validate)(),
42
32
  (0, ts_serval_1.serialize)(),
43
- __metadata("design:type", transport_1.CoreAddress)
44
- ], SignatureContent.prototype, "signer", void 0);
45
- __decorate([
46
33
  (0, ts_serval_1.validate)(),
47
- (0, ts_serval_1.serialize)(),
48
34
  __metadata("design:type", transport_1.CoreId)
49
- ], SignatureContent.prototype, "keyId", void 0);
35
+ ], CreatePeerLocalAttributeParams.prototype, "requestReference", void 0);
50
36
  __decorate([
51
- (0, ts_serval_1.validate)(),
52
37
  (0, ts_serval_1.serialize)(),
53
- __metadata("design:type", transport_1.CoreHash)
54
- ], SignatureContent.prototype, "hash", void 0);
55
- SignatureContent = __decorate([
56
- (0, ts_serval_1.type)("SignatureContent")
57
- ], SignatureContent);
58
- exports.SignatureContent = SignatureContent;
59
- //# sourceMappingURL=SignatureContent.js.map
38
+ (0, ts_serval_1.validate)(),
39
+ __metadata("design:type", transport_1.CoreAddress)
40
+ ], CreatePeerLocalAttributeParams.prototype, "peer", void 0);
41
+ exports.CreatePeerLocalAttributeParams = CreatePeerLocalAttributeParams;
42
+ //# sourceMappingURL=CreatePeerLocalAttributeParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreatePeerLocalAttributeParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/CreatePeerLocalAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAOuB;AACvB,gDAA6E;AAgB7E,MAAa,8BAA+B,SAAQ,wBAAY;IAiBrD,MAAM,CAAC,IAAI,CACd,KAA2E;QAE3E,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;AAnBG;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACA,kBAAM;0DAAA;AAIjB;IAFC,IAAA,qBAAS,EAAC,EAAE,UAAU,EAAE,CAAC,2BAAiB,EAAE,+BAAqB,CAAC,EAAE,CAAC;IACrE,IAAA,oBAAQ,GAAE;;+DAC8C;AAIzD;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACc,kBAAM;wEAAA;AAI/B;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACE,uBAAW;4DAAA;AAf5B,wEAsBC"}
@@ -0,0 +1,14 @@
1
+ import { ISerializable, Serializable } from "@js-soft/ts-serval";
2
+ import { IRelationshipAttribute, RelationshipAttribute } from "@nmshd/content";
3
+ import { CoreAddress, CoreId, ICoreAddress, ICoreId } from "@nmshd/transport";
4
+ export interface ICreateRelationshipAttributeParams extends ISerializable {
5
+ content: IRelationshipAttribute;
6
+ peer: ICoreAddress;
7
+ requestReference: ICoreId;
8
+ }
9
+ export declare class CreateRelationshipAttributeParams extends Serializable implements ICreateRelationshipAttributeParams {
10
+ content: RelationshipAttribute;
11
+ peer: CoreAddress;
12
+ requestReference: CoreId;
13
+ static from(value: ICreateRelationshipAttributeParams): CreateRelationshipAttributeParams;
14
+ }
@@ -9,32 +9,32 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RelationshipAttribute = void 0;
12
+ exports.CreateRelationshipAttributeParams = void 0;
13
13
  const ts_serval_1 = require("@js-soft/ts-serval");
14
14
  const content_1 = require("@nmshd/content");
15
15
  const transport_1 = require("@nmshd/transport");
16
- let RelationshipAttribute = class RelationshipAttribute extends ts_serval_1.Serializable {
16
+ let CreateRelationshipAttributeParams = class CreateRelationshipAttributeParams extends ts_serval_1.Serializable {
17
17
  static from(value) {
18
18
  return this.fromAny(value);
19
19
  }
20
20
  };
21
21
  __decorate([
22
- (0, ts_serval_1.validate)(),
23
22
  (0, ts_serval_1.serialize)(),
24
- __metadata("design:type", String)
25
- ], RelationshipAttribute.prototype, "name", void 0);
26
- __decorate([
27
23
  (0, ts_serval_1.validate)(),
28
- (0, ts_serval_1.serialize)(),
29
- __metadata("design:type", content_1.Attribute)
30
- ], RelationshipAttribute.prototype, "content", void 0);
24
+ __metadata("design:type", content_1.RelationshipAttribute)
25
+ ], CreateRelationshipAttributeParams.prototype, "content", void 0);
31
26
  __decorate([
27
+ (0, ts_serval_1.serialize)(),
32
28
  (0, ts_serval_1.validate)(),
29
+ __metadata("design:type", transport_1.CoreAddress)
30
+ ], CreateRelationshipAttributeParams.prototype, "peer", void 0);
31
+ __decorate([
33
32
  (0, ts_serval_1.serialize)(),
33
+ (0, ts_serval_1.validate)(),
34
34
  __metadata("design:type", transport_1.CoreId)
35
- ], RelationshipAttribute.prototype, "sharedItem", void 0);
36
- RelationshipAttribute = __decorate([
37
- (0, ts_serval_1.type)("RelationshipAttribute")
38
- ], RelationshipAttribute);
39
- exports.RelationshipAttribute = RelationshipAttribute;
40
- //# sourceMappingURL=RelationshipAttribute.js.map
35
+ ], CreateRelationshipAttributeParams.prototype, "requestReference", void 0);
36
+ CreateRelationshipAttributeParams = __decorate([
37
+ (0, ts_serval_1.type)("CreateRelationshipAttributeParams")
38
+ ], CreateRelationshipAttributeParams);
39
+ exports.CreateRelationshipAttributeParams = CreateRelationshipAttributeParams;
40
+ //# sourceMappingURL=CreateRelationshipAttributeParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateRelationshipAttributeParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/CreateRelationshipAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA2F;AAC3F,4CAA8E;AAC9E,gDAA6E;AAS7E,IAAa,iCAAiC,GAA9C,MAAa,iCAAkC,SAAQ,wBAAY;IAaxD,MAAM,CAAC,IAAI,CAAC,KAAyC;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ,CAAA;AAbG;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACK,+BAAqB;kEAAA;AAIrC;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACE,uBAAW;+DAAA;AAIxB;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACc,kBAAM;2EAAA;AAXtB,iCAAiC;IAD7C,IAAA,gBAAI,EAAC,mCAAmC,CAAC;GAC7B,iCAAiC,CAgB7C;AAhBY,8EAAiC"}
@@ -0,0 +1,21 @@
1
+ import { ISerializable, Serializable } from "@js-soft/ts-serval";
2
+ import { CoreAddress, CoreId, ICoreAddress, ICoreId } from "@nmshd/transport";
3
+ export interface CreateSharedLocalAttributeCopyParamsJSON {
4
+ attributeId?: string;
5
+ sourceAttributeId?: string;
6
+ peer: string;
7
+ requestReference: string;
8
+ }
9
+ export interface ICreateSharedLocalAttributeCopyParams extends ISerializable {
10
+ attributeId?: ICoreId;
11
+ sourceAttributeId: ICoreId;
12
+ peer: ICoreAddress;
13
+ requestReference: ICoreId;
14
+ }
15
+ export declare class CreateSharedLocalAttributeCopyParams extends Serializable implements ICreateSharedLocalAttributeCopyParams {
16
+ attributeId?: CoreId;
17
+ sourceAttributeId: CoreId;
18
+ peer: CoreAddress;
19
+ requestReference: CoreId;
20
+ static from(value: ICreateSharedLocalAttributeCopyParams | CreateSharedLocalAttributeCopyParamsJSON): CreateSharedLocalAttributeCopyParams;
21
+ }
@@ -9,35 +9,33 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RelationshipTheme = void 0;
12
+ exports.CreateSharedLocalAttributeCopyParams = void 0;
13
13
  const ts_serval_1 = require("@js-soft/ts-serval");
14
- let RelationshipTheme = class RelationshipTheme extends ts_serval_1.Serializable {
14
+ const transport_1 = require("@nmshd/transport");
15
+ class CreateSharedLocalAttributeCopyParams extends ts_serval_1.Serializable {
15
16
  static from(value) {
16
17
  return this.fromAny(value);
17
18
  }
18
- };
19
+ }
19
20
  __decorate([
20
- (0, ts_serval_1.validate)(),
21
21
  (0, ts_serval_1.serialize)(),
22
- __metadata("design:type", String)
23
- ], RelationshipTheme.prototype, "image", void 0);
22
+ (0, ts_serval_1.validate)({ nullable: true }),
23
+ __metadata("design:type", transport_1.CoreId)
24
+ ], CreateSharedLocalAttributeCopyParams.prototype, "attributeId", void 0);
24
25
  __decorate([
25
- (0, ts_serval_1.validate)(),
26
26
  (0, ts_serval_1.serialize)(),
27
- __metadata("design:type", String)
28
- ], RelationshipTheme.prototype, "imageBar", void 0);
29
- __decorate([
30
27
  (0, ts_serval_1.validate)(),
31
- (0, ts_serval_1.serialize)(),
32
- __metadata("design:type", String)
33
- ], RelationshipTheme.prototype, "backgroundColor", void 0);
28
+ __metadata("design:type", transport_1.CoreId)
29
+ ], CreateSharedLocalAttributeCopyParams.prototype, "sourceAttributeId", void 0);
34
30
  __decorate([
31
+ (0, ts_serval_1.serialize)(),
35
32
  (0, ts_serval_1.validate)(),
33
+ __metadata("design:type", transport_1.CoreAddress)
34
+ ], CreateSharedLocalAttributeCopyParams.prototype, "peer", void 0);
35
+ __decorate([
36
36
  (0, ts_serval_1.serialize)(),
37
- __metadata("design:type", String)
38
- ], RelationshipTheme.prototype, "foregroundColor", void 0);
39
- RelationshipTheme = __decorate([
40
- (0, ts_serval_1.type)("RelationshipTheme")
41
- ], RelationshipTheme);
42
- exports.RelationshipTheme = RelationshipTheme;
43
- //# sourceMappingURL=RelationshipTheme.js.map
37
+ (0, ts_serval_1.validate)(),
38
+ __metadata("design:type", transport_1.CoreId)
39
+ ], CreateSharedLocalAttributeCopyParams.prototype, "requestReference", void 0);
40
+ exports.CreateSharedLocalAttributeCopyParams = CreateSharedLocalAttributeCopyParams;
41
+ //# sourceMappingURL=CreateSharedLocalAttributeCopyParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateSharedLocalAttributeCopyParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/CreateSharedLocalAttributeCopyParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,gDAA6E;AAgB7E,MAAa,oCACT,SAAQ,wBAAY;IAmBb,MAAM,CAAC,IAAI,CACd,KAAuF;QAEvF,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;AAnBG;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACR,kBAAM;yEAAA;AAI3B;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACe,kBAAM;+EAAA;AAIhC;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACE,uBAAW;kEAAA;AAIxB;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACc,kBAAM;8EAAA;AAlBnC,oFAyBC"}
@@ -0,0 +1,30 @@
1
+ import { IdentityAttribute, IdentityAttributeJSON, IIdentityAttribute, IRelationshipAttribute, RelationshipAttribute, RelationshipAttributeJSON } from "@nmshd/content";
2
+ import { CoreAddress, CoreDate, CoreId, CoreSynchronizable, ICoreDate, ICoreId, ICoreSynchronizable } from "@nmshd/transport";
3
+ import { ILocalAttributeShareInfo, LocalAttributeShareInfo, LocalAttributeShareInfoJSON } from "./LocalAttributeShareInfo";
4
+ export interface LocalAttributeJSON {
5
+ content: IdentityAttributeJSON | RelationshipAttributeJSON;
6
+ createdAt: string;
7
+ succeeds: string;
8
+ succeededBy: string;
9
+ shareInfo: LocalAttributeShareInfoJSON;
10
+ }
11
+ export interface ILocalAttribute extends ICoreSynchronizable {
12
+ content: IIdentityAttribute | IRelationshipAttribute;
13
+ createdAt: ICoreDate;
14
+ succeeds?: ICoreId;
15
+ succeededBy?: ICoreId;
16
+ shareInfo?: ILocalAttributeShareInfo;
17
+ }
18
+ export declare class LocalAttribute extends CoreSynchronizable implements ILocalAttribute {
19
+ readonly technicalProperties: string[];
20
+ readonly userdataProperties: string[];
21
+ content: IdentityAttribute | RelationshipAttribute;
22
+ createdAt: CoreDate;
23
+ succeeds?: CoreId;
24
+ succeededBy?: CoreId;
25
+ shareInfo?: LocalAttributeShareInfo;
26
+ isIdentityAttribute(): boolean;
27
+ isOwnedBy(identity: CoreAddress): boolean;
28
+ static from(value: ILocalAttribute): LocalAttribute;
29
+ static fromAttribute(attribute: IIdentityAttribute | IRelationshipAttribute, succeeds?: ICoreId, shareInfo?: ILocalAttributeShareInfo, id?: CoreId): Promise<LocalAttribute>;
30
+ }
@@ -9,59 +9,71 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ConsumptionAttribute = void 0;
12
+ exports.LocalAttribute = void 0;
13
13
  const ts_serval_1 = require("@js-soft/ts-serval");
14
14
  const content_1 = require("@nmshd/content");
15
15
  const transport_1 = require("@nmshd/transport");
16
16
  const ts_simple_nameof_1 = require("ts-simple-nameof");
17
17
  const consumption_1 = require("../../../consumption");
18
- let ConsumptionAttribute = class ConsumptionAttribute extends transport_1.CoreSynchronizable {
18
+ const LocalAttributeShareInfo_1 = require("./LocalAttributeShareInfo");
19
+ let LocalAttribute = class LocalAttribute extends transport_1.CoreSynchronizable {
19
20
  constructor() {
20
21
  super(...arguments);
21
22
  this.technicalProperties = [
22
23
  "@type",
23
24
  "@context",
25
+ (0, ts_simple_nameof_1.nameof)((r) => r.createdAt),
26
+ (0, ts_simple_nameof_1.nameof)((r) => r.succeeds),
24
27
  (0, ts_simple_nameof_1.nameof)((r) => r.createdAt)
25
28
  ];
26
29
  this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((r) => r.content)];
27
- this.metadataProperties = [
28
- (0, ts_simple_nameof_1.nameof)((r) => r.metadata),
29
- (0, ts_simple_nameof_1.nameof)((r) => r.metadataModifiedAt)
30
- ];
30
+ }
31
+ isIdentityAttribute() {
32
+ return this.content instanceof content_1.IdentityAttribute;
33
+ }
34
+ isOwnedBy(identity) {
35
+ return this.content.owner.equals(identity);
31
36
  }
32
37
  static from(value) {
33
38
  return this.fromAny(value);
34
39
  }
35
- static async fromAttribute(attribute) {
40
+ static async fromAttribute(attribute, succeeds, shareInfo, id) {
36
41
  return this.from({
37
- content: content_1.Attribute.from(attribute),
38
- id: await consumption_1.ConsumptionIds.attribute.generate(),
39
- createdAt: transport_1.CoreDate.utc()
42
+ id: id ?? (await consumption_1.ConsumptionIds.attribute.generate()),
43
+ content: attribute,
44
+ createdAt: transport_1.CoreDate.utc(),
45
+ succeeds: succeeds,
46
+ shareInfo: shareInfo
40
47
  });
41
48
  }
42
49
  };
43
50
  __decorate([
44
51
  (0, ts_serval_1.validate)(),
45
- (0, ts_serval_1.serialize)({ type: content_1.Attribute }),
46
- __metadata("design:type", content_1.Attribute)
47
- ], ConsumptionAttribute.prototype, "content", void 0);
52
+ (0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
53
+ __metadata("design:type", Object)
54
+ ], LocalAttribute.prototype, "content", void 0);
48
55
  __decorate([
49
56
  (0, ts_serval_1.validate)(),
50
57
  (0, ts_serval_1.serialize)(),
51
58
  __metadata("design:type", transport_1.CoreDate)
52
- ], ConsumptionAttribute.prototype, "createdAt", void 0);
59
+ ], LocalAttribute.prototype, "createdAt", void 0);
53
60
  __decorate([
54
61
  (0, ts_serval_1.validate)({ nullable: true }),
55
- (0, ts_serval_1.serialize)({ any: true }),
56
- __metadata("design:type", Object)
57
- ], ConsumptionAttribute.prototype, "metadata", void 0);
62
+ (0, ts_serval_1.serialize)(),
63
+ __metadata("design:type", transport_1.CoreId)
64
+ ], LocalAttribute.prototype, "succeeds", void 0);
58
65
  __decorate([
59
66
  (0, ts_serval_1.validate)({ nullable: true }),
60
67
  (0, ts_serval_1.serialize)(),
61
- __metadata("design:type", transport_1.CoreDate)
62
- ], ConsumptionAttribute.prototype, "metadataModifiedAt", void 0);
63
- ConsumptionAttribute = __decorate([
64
- (0, ts_serval_1.type)("ConsumptionAttribute")
65
- ], ConsumptionAttribute);
66
- exports.ConsumptionAttribute = ConsumptionAttribute;
67
- //# sourceMappingURL=ConsumptionAttribute.js.map
68
+ __metadata("design:type", transport_1.CoreId)
69
+ ], LocalAttribute.prototype, "succeededBy", void 0);
70
+ __decorate([
71
+ (0, ts_serval_1.validate)({ nullable: true }),
72
+ (0, ts_serval_1.serialize)(),
73
+ __metadata("design:type", LocalAttributeShareInfo_1.LocalAttributeShareInfo)
74
+ ], LocalAttribute.prototype, "shareInfo", void 0);
75
+ LocalAttribute = __decorate([
76
+ (0, ts_serval_1.type)("LocalAttribute")
77
+ ], LocalAttribute);
78
+ exports.LocalAttribute = LocalAttribute;
79
+ //# sourceMappingURL=LocalAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalAttribute.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/LocalAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA8D;AAC9D,4CAOuB;AACvB,gDAQyB;AACzB,uDAAyC;AACzC,sDAAqD;AACrD,uEAIkC;AAmBlC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,8BAAkB;IAAtD;;QAC6B,wBAAmB,GAAG;YAC3C,OAAO;YACP,UAAU;YACV,IAAA,yBAAM,EAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YAC1C,IAAA,yBAAM,EAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;YACzC,IAAA,yBAAM,EAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAC7C,CAAA;QAEwB,uB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AA;AAI3B;IAFC,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;8BACO,iDAAuB;iDAAA;AA7BjC,cAAc;IAD1B,IAAA,gBAAI,EAAC,gBAAgB,CAAC;GACV,cAAc,CAyD1B;AAzDY,wCAAc"}
@@ -0,0 +1,17 @@
1
+ import { CoreAddress, CoreId, CoreSerializable, ICoreAddress, ICoreId, ICoreSerializable } from "@nmshd/transport";
2
+ export interface LocalAttributeShareInfoJSON {
3
+ requestReference: string;
4
+ peer: string;
5
+ sourceAttribute?: string;
6
+ }
7
+ export interface ILocalAttributeShareInfo extends ICoreSerializable {
8
+ requestReference: ICoreId;
9
+ peer: ICoreAddress;
10
+ sourceAttribute?: ICoreId;
11
+ }
12
+ export declare class LocalAttributeShareInfo extends CoreSerializable implements ILocalAttributeShareInfo {
13
+ requestReference: CoreId;
14
+ peer: CoreAddress;
15
+ sourceAttribute?: CoreId;
16
+ static from(value: ILocalAttributeShareInfo): LocalAttributeShareInfo;
17
+ }
@@ -0,0 +1,36 @@
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.LocalAttributeShareInfo = void 0;
13
+ const ts_serval_1 = require("@js-soft/ts-serval");
14
+ const transport_1 = require("@nmshd/transport");
15
+ class LocalAttributeShareInfo extends transport_1.CoreSerializable {
16
+ static from(value) {
17
+ return super.fromAny(value);
18
+ }
19
+ }
20
+ __decorate([
21
+ (0, ts_serval_1.validate)(),
22
+ (0, ts_serval_1.serialize)(),
23
+ __metadata("design:type", transport_1.CoreId)
24
+ ], LocalAttributeShareInfo.prototype, "requestReference", void 0);
25
+ __decorate([
26
+ (0, ts_serval_1.validate)(),
27
+ (0, ts_serval_1.serialize)(),
28
+ __metadata("design:type", transport_1.CoreAddress)
29
+ ], LocalAttributeShareInfo.prototype, "peer", void 0);
30
+ __decorate([
31
+ (0, ts_serval_1.validate)({ nullable: true }),
32
+ (0, ts_serval_1.serialize)(),
33
+ __metadata("design:type", transport_1.CoreId)
34
+ ], LocalAttributeShareInfo.prototype, "sourceAttribute", void 0);
35
+ exports.LocalAttributeShareInfo = LocalAttributeShareInfo;
36
+ //# sourceMappingURL=LocalAttributeShareInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalAttributeShareInfo.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/LocalAttributeShareInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAwD;AACxD,gDAAkH;AAclH,MAAa,uBAAwB,SAAQ,4BAAgB;IAalD,MAAM,CAAC,IAAI,CAAC,KAA+B;QAC9C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAA4B,CAAA;IAC1D,CAAC;CACJ;AAbG;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACa,kBAAM;iEAAA;AAI/B;IAFC,IAAA,oBAAQ,GAAE;IACV,IAAA,qBAAS,GAAE;8BACC,uBAAW;qDAAA;AAIxB;IAFC,IAAA,oBAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,IAAA,qBAAS,GAAE;8BACa,kBAAM;gEAAA;AAXnC,0DAgBC"}
@@ -0,0 +1,9 @@
1
+ import { IdentityAttributeQuery, RelationshipAttributeQuery } from "@nmshd/content";
2
+ export declare class IdentityAttributeQueryTranslator {
3
+ static translate(query: IdentityAttributeQuery): any;
4
+ private static readonly translator;
5
+ }
6
+ export declare class RelationshipAttributeQueryTranslator {
7
+ static translate(query: RelationshipAttributeQuery): any;
8
+ private static readonly translator;
9
+ }
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RelationshipAttributeQueryTranslator = exports.IdentityAttributeQueryTranslator = void 0;
4
+ const docdb_querytranslator_1 = require("@js-soft/docdb-querytranslator");
5
+ const luxon_1 = require("luxon");
6
+ const ts_simple_nameof_1 = require("ts-simple-nameof");
7
+ class IdentityAttributeQueryTranslator {
8
+ static translate(query) {
9
+ return this.translator.parse({ ...query.toJSON(), attributeType: "IdentityAttribute" });
10
+ }
11
+ }
12
+ exports.IdentityAttributeQueryTranslator = IdentityAttributeQueryTranslator;
13
+ IdentityAttributeQueryTranslator.translator = new docdb_querytranslator_1.QueryTranslator({
14
+ whitelist: {
15
+ [(0, ts_simple_nameof_1.nameof)((x) => x.tags)]: true,
16
+ [(0, ts_simple_nameof_1.nameof)((x) => x.valueType)]: true,
17
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)]: true,
18
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validTo)]: true,
19
+ attributeType: true
20
+ },
21
+ alias: {
22
+ // @type of attributeValue
23
+ [(0, ts_simple_nameof_1.nameof)((x) => x.valueType)]: [
24
+ `${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.value)}.@type`
25
+ ],
26
+ // @type of attribute
27
+ attributeType: [`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.@type`]
28
+ },
29
+ custom: {
30
+ // tags
31
+ [(0, ts_simple_nameof_1.nameof)((x) => x.tags)]: (query, input) => {
32
+ if (!input)
33
+ return;
34
+ if (!Array.isArray(input)) {
35
+ throw new Error("Invalid input: 'tags' must be an array");
36
+ }
37
+ const inputAsArray = input;
38
+ query["$or"] = inputAsArray.map((t) => ({
39
+ [`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.tags)}`]: {
40
+ $contains: t
41
+ }
42
+ }));
43
+ },
44
+ // validFrom
45
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)]: (query, input) => {
46
+ if (!input) {
47
+ return;
48
+ }
49
+ const validFromUtcString = luxon_1.DateTime.fromISO(input).toUTC().toString();
50
+ query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)}`] = {
51
+ $gte: validFromUtcString
52
+ };
53
+ },
54
+ // validTo
55
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validTo)]: (query, input) => {
56
+ if (!input) {
57
+ return;
58
+ }
59
+ const validToUtcString = luxon_1.DateTime.fromISO(input).toUTC().toString();
60
+ query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validTo)}`] = {
61
+ $lte: validToUtcString
62
+ };
63
+ }
64
+ }
65
+ });
66
+ class RelationshipAttributeQueryTranslator {
67
+ static translate(query) {
68
+ return this.translator.parse({ ...query.toJSON(), attributeType: "RelationshipAttribute" });
69
+ }
70
+ }
71
+ exports.RelationshipAttributeQueryTranslator = RelationshipAttributeQueryTranslator;
72
+ RelationshipAttributeQueryTranslator.translator = new docdb_querytranslator_1.QueryTranslator({
73
+ whitelist: {
74
+ [(0, ts_simple_nameof_1.nameof)((x) => x.key)]: true,
75
+ [(0, ts_simple_nameof_1.nameof)((x) => x.valueType)]: true,
76
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)]: true,
77
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validTo)]: true,
78
+ [(0, ts_simple_nameof_1.nameof)((x) => x.owner)]: true,
79
+ [(0, ts_simple_nameof_1.nameof)((x) => x.thirdParty)]: true,
80
+ attributeType: true
81
+ },
82
+ alias: {
83
+ // key
84
+ [(0, ts_simple_nameof_1.nameof)((x) => x.key)]: [
85
+ `${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.key)}`
86
+ ],
87
+ // @type of attributeValue
88
+ [(0, ts_simple_nameof_1.nameof)((x) => x.valueType)]: [
89
+ `${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.value)}.@type`
90
+ ],
91
+ // @type of attribute
92
+ attributeType: [`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.@type`],
93
+ // owner
94
+ [(0, ts_simple_nameof_1.nameof)((x) => x.owner)]: [
95
+ `${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.owner)}`
96
+ ],
97
+ // peer
98
+ [(0, ts_simple_nameof_1.nameof)((x) => x.thirdParty)]: [
99
+ `${(0, ts_simple_nameof_1.nameof)((x) => x.shareInfo)}.${(0, ts_simple_nameof_1.nameof)((x) => x.peer)}`
100
+ ]
101
+ },
102
+ custom: {
103
+ // validFrom
104
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)]: (query, input) => {
105
+ if (!input) {
106
+ return;
107
+ }
108
+ const validFromUtcString = luxon_1.DateTime.fromISO(input).toUTC().toString();
109
+ query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validFrom)}`] = {
110
+ $gte: validFromUtcString
111
+ };
112
+ },
113
+ // validTo
114
+ [(0, ts_simple_nameof_1.nameof)((x) => x.validTo)]: (query, input) => {
115
+ if (!input) {
116
+ return;
117
+ }
118
+ const validToUtcString = luxon_1.DateTime.fromISO(input).toUTC().toString();
119
+ query[`${(0, ts_simple_nameof_1.nameof)((x) => x.content)}.${(0, ts_simple_nameof_1.nameof)((x) => x.validTo)}`] = {
120
+ $lte: validToUtcString
121
+ };
122
+ }
123
+ }
124
+ });
125
+ //# sourceMappingURL=QueryTranslator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryTranslator.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/QueryTranslator.ts"],"names":[],"mappings":";;;AAAA,0EAAgE;AAWhE,iCAAgC;AAChC,uDAAyC;AAIzC,MAAa,gCAAgC;IAClC,MAAM,CAAC,SAAS,CAAC,KAA6B;QACjD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC,CAAA;IAC3F,CAAC;;AAHL,4EAgEC;AA3D2B,2CAAU,GAAG,IAAI,uCAAe,CAAC;IACrD,SAAS,EAAE;QACP,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI;QACtD,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI;QAC3D,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI;QAC3D,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI;QACzD,aAAa,EAAE,IAAI;KACtB;IACD,KAAK,EAAE;QACH,0BAA0B;QAC1B,CAAC,IAAA,yBAAM,EAA0B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE;YACnD,GAAG,IAAA,yBAAM,EAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAA,yBAAM,EAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,Q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E,EAAE;YAChF,IAAI,CAAC,KAAK,EAAE;gBACR,OAAM;aACT;YACD,MAAM,gBAAgB,GAAG,gBAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAA;YACnE,KAAK,CACD,GAAG,IAAA,yBAAM,EAAiB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAA,yBAAM,EAAwB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CACnG,GAAG;gBACA,IAAI,EAAE,gBAAgB;aACzB,CAAA;QACL,CAAC;KACJ;CACJ,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { ISerializable, Serializable } from "@js-soft/ts-serval";
2
+ import { IdentityAttribute, IdentityAttributeJSON, IIdentityAttribute, IRelationshipAttribute, RelationshipAttribute, RelationshipAttributeJSON } from "@nmshd/content";
3
+ import { CoreId, ICoreId } from "@nmshd/transport";
4
+ export interface SucceedLocalAttributeParamsJSON {
5
+ successorContent: IdentityAttributeJSON | RelationshipAttributeJSON;
6
+ succeeds: string;
7
+ }
8
+ export interface ISucceedLocalAttributeParams extends ISerializable {
9
+ successorContent: IIdentityAttribute | IRelationshipAttribute;
10
+ succeeds: ICoreId;
11
+ }
12
+ export declare class SucceedLocalAttributeParams extends Serializable implements ISucceedLocalAttributeParams {
13
+ successorContent: IdentityAttribute | RelationshipAttribute;
14
+ succeeds: CoreId;
15
+ static from(value: ISucceedLocalAttributeParams | SucceedLocalAttributeParamsJSON): SucceedLocalAttributeParams;
16
+ }
@@ -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.SucceedLocalAttributeParams = 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 SucceedLocalAttributeParams extends ts_serval_1.Serializable {
17
+ static from(value) {
18
+ return this.fromAny(value);
19
+ }
20
+ }
21
+ __decorate([
22
+ (0, ts_serval_1.serialize)({ unionTypes: [content_1.IdentityAttribute, content_1.RelationshipAttribute] }),
23
+ (0, ts_serval_1.validate)(),
24
+ __metadata("design:type", Object)
25
+ ], SucceedLocalAttributeParams.prototype, "successorContent", void 0);
26
+ __decorate([
27
+ (0, ts_serval_1.serialize)(),
28
+ (0, ts_serval_1.validate)(),
29
+ __metadata("design:type", transport_1.CoreId)
30
+ ], SucceedLocalAttributeParams.prototype, "succeeds", void 0);
31
+ exports.SucceedLocalAttributeParams = SucceedLocalAttributeParams;
32
+ //# sourceMappingURL=SucceedLocalAttributeParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SucceedLocalAttributeParams.js","sourceRoot":"","sources":["../../../../src/modules/attributes/local/SucceedLocalAttributeParams.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqF;AACrF,4CAOuB;AACvB,gDAAkD;AAYlD,MAAa,2BAA4B,SAAQ,wBAAY;IASlD,MAAM,CAAC,IAAI,CACd,KAAqE;QAErE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACJ;AAXG;IAFC,IAAA,qBAAS,EAAC,EAAE,UAAU,EAAE,CAAC,2BAAiB,EAAE,+BAAqB,CAAC,EAAE,CAAC;IACrE,IAAA,oBAAQ,GAAE;;qEACuD;AAIlE;IAFC,IAAA,qBAAS,GAAE;IACX,IAAA,oBAAQ,GAAE;8BACM,kBAAM;6DAAA;AAP3B,kEAcC"}