@nmshd/runtime 6.21.0 → 6.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +4 -4
- package/dist/events/transport/DatawalletSynchronizedEvent.d.ts +1 -1
- package/dist/events/transport/DatawalletSynchronizedEvent.d.ts.map +1 -1
- package/dist/events/transport/DatawalletSynchronizedEvent.js.map +1 -1
- package/dist/modules/DeciderModule.d.ts.map +1 -1
- package/dist/modules/DeciderModule.js +42 -12
- package/dist/modules/DeciderModule.js.map +1 -1
- package/dist/modules/decide/RequestConfig.d.ts +4 -3
- package/dist/modules/decide/RequestConfig.d.ts.map +1 -1
- package/dist/modules/decide/RequestConfig.js.map +1 -1
- package/dist/useCases/common/RuntimeErrors.d.ts +5 -0
- package/dist/useCases/common/RuntimeErrors.d.ts.map +1 -1
- package/dist/useCases/common/RuntimeErrors.js +9 -0
- package/dist/useCases/common/RuntimeErrors.js.map +1 -1
- package/dist/useCases/common/Schemas.d.ts +41 -0
- package/dist/useCases/common/Schemas.d.ts.map +1 -1
- package/dist/useCases/common/Schemas.js +5396 -5292
- package/dist/useCases/common/Schemas.js.map +1 -1
- package/dist/useCases/consumption/attributes/CreateRepositoryAttribute.d.ts +12 -4
- package/dist/useCases/consumption/attributes/CreateRepositoryAttribute.d.ts.map +1 -1
- package/dist/useCases/consumption/attributes/CreateRepositoryAttribute.js +29 -3
- package/dist/useCases/consumption/attributes/CreateRepositoryAttribute.js.map +1 -1
- package/dist/useCases/consumption/identityMetadata/DeleteIdentityMetadata.d.ts.map +1 -1
- package/dist/useCases/consumption/identityMetadata/DeleteIdentityMetadata.js +1 -1
- package/dist/useCases/consumption/identityMetadata/DeleteIdentityMetadata.js.map +1 -1
- package/dist/useCases/consumption/identityMetadata/GetIdentityMetadata.d.ts.map +1 -1
- package/dist/useCases/consumption/identityMetadata/GetIdentityMetadata.js +1 -1
- package/dist/useCases/consumption/identityMetadata/GetIdentityMetadata.js.map +1 -1
- package/dist/useCases/consumption/identityMetadata/UpsertIdentityMetadata.d.ts +3 -2
- package/dist/useCases/consumption/identityMetadata/UpsertIdentityMetadata.d.ts.map +1 -1
- package/dist/useCases/consumption/identityMetadata/UpsertIdentityMetadata.js +11 -2
- package/dist/useCases/consumption/identityMetadata/UpsertIdentityMetadata.js.map +1 -1
- package/package.json +5 -5
|
@@ -3,17 +3,25 @@ import { AttributesController } from "@nmshd/consumption";
|
|
|
3
3
|
import { AttributeValues } from "@nmshd/content";
|
|
4
4
|
import { AccountController } from "@nmshd/transport";
|
|
5
5
|
import { LocalAttributeDTO } from "../../../types";
|
|
6
|
-
import { ISO8601DateTimeString, SchemaRepository,
|
|
7
|
-
|
|
6
|
+
import { ISO8601DateTimeString, SchemaRepository, UseCase, ValidationResult } from "../../common";
|
|
7
|
+
import { IValidator } from "../../common/validation/IValidator";
|
|
8
|
+
interface AbstractCreateRepositoryAttributeRequest<T> {
|
|
8
9
|
content: {
|
|
9
|
-
value:
|
|
10
|
+
value: T;
|
|
10
11
|
tags?: string[];
|
|
11
12
|
validFrom?: ISO8601DateTimeString;
|
|
12
13
|
validTo?: ISO8601DateTimeString;
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
export interface CreateRepositoryAttributeRequest extends AbstractCreateRepositoryAttributeRequest<AttributeValues.Identity.Json> {
|
|
17
|
+
}
|
|
18
|
+
export interface SchemaValidatableCreateRepositoryAttributeRequest extends AbstractCreateRepositoryAttributeRequest<unknown> {
|
|
19
|
+
}
|
|
20
|
+
declare class Validator implements IValidator<CreateRepositoryAttributeRequest> {
|
|
21
|
+
private readonly schemaRepository;
|
|
16
22
|
constructor(schemaRepository: SchemaRepository);
|
|
23
|
+
validate(value: CreateRepositoryAttributeRequest): Promise<ValidationResult> | ValidationResult;
|
|
24
|
+
private static addPrefixToErrorMessagesOfResult;
|
|
17
25
|
}
|
|
18
26
|
export declare class CreateRepositoryAttributeUseCase extends UseCase<CreateRepositoryAttributeRequest, LocalAttributeDTO> {
|
|
19
27
|
private readonly attributeController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRepositoryAttribute.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/CreateRepositoryAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CreateRepositoryAttribute.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/CreateRepositoryAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAmC,MAAM,oBAAoB,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAiB,qBAAqB,EAAiB,gBAAgB,EAAmB,OAAO,EAAqB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpK,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGhE,UAAU,wCAAwC,CAAC,CAAC;IAChD,OAAO,EAAE;QACL,KAAK,EAAE,CAAC,CAAC;QACT,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,SAAS,CAAC,EAAE,qBAAqB,CAAC;QAClC,OAAO,CAAC,EAAE,qBAAqB,CAAC;KACnC,CAAC;CACL;AAED,MAAM,WAAW,gCAAiC,SAAQ,wCAAwC,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC;CAAG;AAEpI,MAAM,WAAW,iDAAkD,SAAQ,wCAAwC,CAAC,OAAO,CAAC;CAAG;AAE/H,cAAM,SAAU,YAAW,UAAU,CAAC,gCAAgC,CAAC;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAEvE,QAAQ,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;IAuBtG,OAAO,CAAC,MAAM,CAAC,gCAAgC;CAYlD;AAED,qBAAa,gCAAiC,SAAQ,OAAO,CAAC,gCAAgC,EAAE,iBAAiB,CAAC;IAElG,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBADjB,mBAAmB,EAAE,oBAAoB,EACzC,iBAAiB,EAAE,iBAAiB,EACrD,SAAS,EAAE,SAAS;cAKhB,eAAe,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;CAiCjH"}
|
|
@@ -14,21 +14,47 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
16
|
};
|
|
17
|
+
var Validator_1;
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
19
|
exports.CreateRepositoryAttributeUseCase = void 0;
|
|
19
20
|
const ts_utils_1 = require("@js-soft/ts-utils");
|
|
20
21
|
const consumption_1 = require("@nmshd/consumption");
|
|
22
|
+
const content_1 = require("@nmshd/content");
|
|
21
23
|
const transport_1 = require("@nmshd/transport");
|
|
22
24
|
const typescript_ioc_1 = require("@nmshd/typescript-ioc");
|
|
23
25
|
const lodash_1 = __importDefault(require("lodash"));
|
|
24
26
|
const common_1 = require("../../common");
|
|
25
27
|
const AttributeMapper_1 = require("./AttributeMapper");
|
|
26
|
-
let Validator = class Validator
|
|
28
|
+
let Validator = Validator_1 = class Validator {
|
|
27
29
|
constructor(schemaRepository) {
|
|
28
|
-
|
|
30
|
+
this.schemaRepository = schemaRepository;
|
|
31
|
+
}
|
|
32
|
+
validate(value) {
|
|
33
|
+
const requestSchemaValidator = new common_1.SchemaValidator(this.schemaRepository.getSchema("CreateRepositoryAttributeRequest"));
|
|
34
|
+
const requestValidationResult = requestSchemaValidator.validate(value);
|
|
35
|
+
if (requestValidationResult.isInvalid())
|
|
36
|
+
return requestValidationResult;
|
|
37
|
+
const attributeType = value.content.value["@type"];
|
|
38
|
+
if (!content_1.AttributeValues.Identity.TYPE_NAMES.includes(attributeType)) {
|
|
39
|
+
const attributeTypeValidationResult = new common_1.ValidationResult();
|
|
40
|
+
attributeTypeValidationResult.addFailure(new common_1.ValidationFailure(common_1.RuntimeErrors.general.invalidPropertyValue("content.value.@type must match one of the allowed Attribute value types for IdentityAttributes"), "@type"));
|
|
41
|
+
return attributeTypeValidationResult;
|
|
42
|
+
}
|
|
43
|
+
const attributeContentSchemaValidator = new common_1.SchemaValidator(this.schemaRepository.getSchema(attributeType));
|
|
44
|
+
const attributeContentValidationResult = attributeContentSchemaValidator.validate(value.content.value);
|
|
45
|
+
return Validator_1.addPrefixToErrorMessagesOfResult(`${attributeType} :: `, attributeContentValidationResult);
|
|
46
|
+
}
|
|
47
|
+
static addPrefixToErrorMessagesOfResult(prefix, validationResult) {
|
|
48
|
+
if (validationResult.isValid())
|
|
49
|
+
return validationResult;
|
|
50
|
+
const failures = validationResult.getFailures();
|
|
51
|
+
const failuresWithPrefix = failures.map((failure) => new common_1.ValidationFailure(new ts_utils_1.ApplicationError(failure.error.code, `${prefix}${failure.error.message}`, failure.error.data), failure.propertyName));
|
|
52
|
+
const validationResultWithPrefix = new common_1.ValidationResult();
|
|
53
|
+
validationResultWithPrefix.addFailures(failuresWithPrefix);
|
|
54
|
+
return validationResultWithPrefix;
|
|
29
55
|
}
|
|
30
56
|
};
|
|
31
|
-
Validator = __decorate([
|
|
57
|
+
Validator = Validator_1 = __decorate([
|
|
32
58
|
__param(0, typescript_ioc_1.Inject),
|
|
33
59
|
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
34
60
|
], Validator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRepositoryAttribute.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/CreateRepositoryAttribute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CreateRepositoryAttribute.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/attributes/CreateRepositoryAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,gDAA6D;AAC7D,oDAA2F;AAC3F,4CAAiD;AACjD,gDAAqD;AACrD,0DAA+C;AAC/C,oDAAuB;AAEvB,yCAAoK;AAEpK,uDAAoD;AAepD,IAAM,SAAS,iBAAf,MAAM,SAAS;IACX,YAA4C,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAAG,CAAC;IAE3E,QAAQ,CAAC,KAAuC;QACnD,MAAM,sBAAsB,GAAG,IAAI,wBAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC,CAAC;QACxH,MAAM,uBAAuB,GAAG,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACvE,IAAI,uBAAuB,CAAC,SAAS,EAAE;YAAE,OAAO,uBAAuB,CAAC;QAExE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,yBAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/D,MAAM,6BAA6B,GAAG,IAAI,yBAAgB,EAAE,CAAC;YAE7D,6BAA6B,CAAC,UAAU,CACpC,IAAI,0BAAiB,CACjB,sBAAa,CAAC,OAAO,CAAC,oBAAoB,CAAC,gGAAgG,CAAC,EAC5I,OAAO,CACV,CACJ,CAAC;YACF,OAAO,6BAA6B,CAAC;QACzC,CAAC;QAED,MAAM,+BAA+B,GAAG,IAAI,wBAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,aAAa,CAAC,CAA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;IAC5E,CAAC;CACJ,CAAA;AA1CY,4EAAgC;2CAAhC,gCAAgC;IAEpC,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCAFuC,kCAAoB;QACtB,6BAAiB;QAC1C,SAAS;GAJvB,gCAAgC,CA0C5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteIdentityMetadata.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/DeleteIdentityMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"DeleteIdentityMetadata.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/DeleteIdentityMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAiB,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,MAAM,WAAW,6BAA6B;IAC1C,SAAS,EAAE,aAAa,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,cAAM,SAAU,SAAQ,eAAe,CAAC,6BAA6B,CAAC;gBACvC,gBAAgB,EAAE,gBAAgB;CAGhE;AAED,qBAAa,6BAA8B,SAAQ,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC;IAE/E,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBADjB,0BAA0B,EAAE,0BAA0B,EACtD,iBAAiB,EAAE,iBAAiB,EACrD,SAAS,EAAE,SAAS;cAKP,eAAe,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAY1G"}
|
|
@@ -38,7 +38,7 @@ let DeleteIdentityMetadataUseCase = class DeleteIdentityMetadataUseCase extends
|
|
|
38
38
|
async executeInternal(request) {
|
|
39
39
|
const identityMetadata = await this.identityMetadataController.getIdentityMetadata(core_types_1.CoreAddress.from(request.reference), request.key);
|
|
40
40
|
if (!identityMetadata) {
|
|
41
|
-
return ts_utils_1.Result.fail(common_1.RuntimeErrors.
|
|
41
|
+
return ts_utils_1.Result.fail(common_1.RuntimeErrors.identityMetadata.notFound());
|
|
42
42
|
}
|
|
43
43
|
await this.identityMetadataController.deleteIdentityMetadata(identityMetadata);
|
|
44
44
|
await this.accountController.syncDatawallet();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteIdentityMetadata.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/DeleteIdentityMetadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"DeleteIdentityMetadata.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/DeleteIdentityMetadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAAgE;AAChE,kDAAgD;AAChD,gDAAqD;AACrD,0DAA+C;AAC/C,yCAA+F;AAC/F,kDAA+C;AAO/C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAA8C;IAClE,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,+BAA+B,CAAC,CAAC,CAAC;IACvE,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,6BAA6B,GAA1C,MAAa,6BAA8B,SAAQ,iBAA4C;IAC3F,YAC6B,0BAAsD,EACtD,iBAAoC,EACrD,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAJQ,+BAA0B,GAA1B,0BAA0B,CAA4B;QACtD,sBAAiB,GAAjB,iBAAiB,CAAmB;IAIjE,CAAC;IAEkB,KAAK,CAAC,eAAe,CAAC,OAAsC;QAC3E,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,wBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACrI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACpB,OAAO,iBAAM,CAAC,IAAI,CAAC,sBAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,IAAI,CAAC,0BAA0B,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;QAE/E,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;QAE9C,OAAO,iBAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;CACJ,CAAA;AArBY,sEAA6B;wCAA7B,6BAA6B;IAEjC,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCAF8C,wCAA0B;QACnC,6BAAiB;QAC1C,SAAS;GAJvB,6BAA6B,CAqBzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetIdentityMetadata.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/GetIdentityMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"GetIdentityMetadata.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/GetIdentityMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAiB,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,MAAM,WAAW,0BAA0B;IACvC,SAAS,EAAE,aAAa,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,cAAM,SAAU,SAAQ,eAAe,CAAC,0BAA0B,CAAC;gBACpC,gBAAgB,EAAE,gBAAgB;CAGhE;AAED,qBAAa,0BAA2B,SAAQ,OAAO,CAAC,0BAA0B,EAAE,mBAAmB,CAAC;IAExF,OAAO,CAAC,QAAQ,CAAC,0BAA0B;gBAA1B,0BAA0B,EAAE,0BAA0B,EACvE,SAAS,EAAE,SAAS;cAKP,eAAe,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;CAQtH"}
|
|
@@ -37,7 +37,7 @@ let GetIdentityMetadataUseCase = class GetIdentityMetadataUseCase extends UseCas
|
|
|
37
37
|
async executeInternal(request) {
|
|
38
38
|
const identityMetadata = await this.identityMetadataController.getIdentityMetadata(core_types_1.CoreAddress.from(request.reference), request.key);
|
|
39
39
|
if (!identityMetadata) {
|
|
40
|
-
return ts_utils_1.Result.fail(common_1.RuntimeErrors.
|
|
40
|
+
return ts_utils_1.Result.fail(common_1.RuntimeErrors.identityMetadata.notFound());
|
|
41
41
|
}
|
|
42
42
|
return ts_utils_1.Result.ok(IdentityMetadataMapper_1.IdentityMetadataMapper.toIdentityMetadataDTO(identityMetadata));
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetIdentityMetadata.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/GetIdentityMetadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"GetIdentityMetadata.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/GetIdentityMetadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,oDAAgE;AAChE,kDAAgD;AAChD,0DAA+C;AAE/C,yCAA+F;AAC/F,kDAA+C;AAC/C,qEAAkE;AAOlE,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAA2C;IAC/D,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACpE,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,iBAAwD;IACpG,YAC6B,0BAAsD,EACvE,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAHQ,+BAA0B,GAA1B,0BAA0B,CAA4B;IAInF,CAAC;IAEkB,KAAK,CAAC,eAAe,CAAC,OAAmC;QACxE,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,wBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACrI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACpB,OAAO,iBAAM,CAAC,IAAI,CAAC,sBAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,iBAAM,CAAC,EAAE,CAAC,+CAAsB,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACrF,CAAC;CACJ,CAAA;AAhBY,gEAA0B;qCAA1B,0BAA0B;IAE9B,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCAD8C,wCAA0B;QAC5D,SAAS;GAHvB,0BAA0B,CAgBtC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "@js-soft/ts-utils";
|
|
2
2
|
import { IdentityMetadataController } from "@nmshd/consumption";
|
|
3
|
-
import { AccountController } from "@nmshd/transport";
|
|
3
|
+
import { AccountController, RelationshipsController } from "@nmshd/transport";
|
|
4
4
|
import { IdentityMetadataDTO } from "../../../types";
|
|
5
5
|
import { AddressString, SchemaRepository, SchemaValidator } from "../../common";
|
|
6
6
|
import { UseCase } from "../../common/UseCase";
|
|
@@ -14,8 +14,9 @@ declare class Validator extends SchemaValidator<UpsertIdentityMetadataRequest> {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class UpsertIdentityMetadataUseCase extends UseCase<UpsertIdentityMetadataRequest, IdentityMetadataDTO> {
|
|
16
16
|
private readonly identityMetadataController;
|
|
17
|
+
private readonly relationshipsController;
|
|
17
18
|
private readonly accountController;
|
|
18
|
-
constructor(identityMetadataController: IdentityMetadataController, accountController: AccountController, validator: Validator);
|
|
19
|
+
constructor(identityMetadataController: IdentityMetadataController, relationshipsController: RelationshipsController, accountController: AccountController, validator: Validator);
|
|
19
20
|
protected executeInternal(request: UpsertIdentityMetadataRequest): Promise<Result<IdentityMetadataDTO>>;
|
|
20
21
|
}
|
|
21
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpsertIdentityMetadata.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/UpsertIdentityMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"UpsertIdentityMetadata.d.ts","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/UpsertIdentityMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAiB,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,MAAM,WAAW,6BAA6B;IAC1C,SAAS,EAAE,aAAa,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAClB;AAED,cAAM,SAAU,SAAQ,eAAe,CAAC,6BAA6B,CAAC;gBACvC,gBAAgB,EAAE,gBAAgB;CAGhE;AAED,qBAAa,6BAA8B,SAAQ,OAAO,CAAC,6BAA6B,EAAE,mBAAmB,CAAC;IAE9F,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,0BAA0B,EAAE,0BAA0B,EACtD,uBAAuB,EAAE,uBAAuB,EAChD,iBAAiB,EAAE,iBAAiB,EACrD,SAAS,EAAE,SAAS;cAKP,eAAe,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;CAiBzH"}
|
|
@@ -32,14 +32,21 @@ Validator = __decorate([
|
|
|
32
32
|
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
33
33
|
], Validator);
|
|
34
34
|
let UpsertIdentityMetadataUseCase = class UpsertIdentityMetadataUseCase extends UseCase_1.UseCase {
|
|
35
|
-
constructor(identityMetadataController, accountController, validator) {
|
|
35
|
+
constructor(identityMetadataController, relationshipsController, accountController, validator) {
|
|
36
36
|
super(validator);
|
|
37
37
|
this.identityMetadataController = identityMetadataController;
|
|
38
|
+
this.relationshipsController = relationshipsController;
|
|
38
39
|
this.accountController = accountController;
|
|
39
40
|
}
|
|
40
41
|
async executeInternal(request) {
|
|
42
|
+
const referencedIdentity = core_types_1.CoreAddress.from(request.reference);
|
|
43
|
+
const peersOfRelationships = (await this.relationshipsController.getRelationships({})).map((relationship) => relationship.peer.address);
|
|
44
|
+
const referencedIdentityIsFamiliar = peersOfRelationships.some((peer) => referencedIdentity.equals(peer)) || referencedIdentity.equals(this.accountController.identity.address);
|
|
45
|
+
if (!referencedIdentityIsFamiliar) {
|
|
46
|
+
return ts_utils_1.Result.fail(common_1.RuntimeErrors.identityMetadata.unfamiliarReferencedIdentity());
|
|
47
|
+
}
|
|
41
48
|
const value = ts_serval_1.JSONWrapper.fromAny(request.value);
|
|
42
|
-
const identityMetadata = await this.identityMetadataController.upsertIdentityMetadata({ reference:
|
|
49
|
+
const identityMetadata = await this.identityMetadataController.upsertIdentityMetadata({ reference: referencedIdentity, key: request.key, value });
|
|
43
50
|
await this.accountController.syncDatawallet();
|
|
44
51
|
return ts_utils_1.Result.ok(IdentityMetadataMapper_1.IdentityMetadataMapper.toIdentityMetadataDTO(identityMetadata));
|
|
45
52
|
}
|
|
@@ -49,7 +56,9 @@ exports.UpsertIdentityMetadataUseCase = UpsertIdentityMetadataUseCase = __decora
|
|
|
49
56
|
__param(0, typescript_ioc_1.Inject),
|
|
50
57
|
__param(1, typescript_ioc_1.Inject),
|
|
51
58
|
__param(2, typescript_ioc_1.Inject),
|
|
59
|
+
__param(3, typescript_ioc_1.Inject),
|
|
52
60
|
__metadata("design:paramtypes", [consumption_1.IdentityMetadataController,
|
|
61
|
+
transport_1.RelationshipsController,
|
|
53
62
|
transport_1.AccountController,
|
|
54
63
|
Validator])
|
|
55
64
|
], UpsertIdentityMetadataUseCase);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpsertIdentityMetadata.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/UpsertIdentityMetadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAiD;AACjD,gDAA2C;AAC3C,oDAAgE;AAChE,kDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"UpsertIdentityMetadata.js","sourceRoot":"","sources":["../../../../src/useCases/consumption/identityMetadata/UpsertIdentityMetadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAiD;AACjD,gDAA2C;AAC3C,oDAAgE;AAChE,kDAAgD;AAChD,gDAA8E;AAC9E,0DAA+C;AAE/C,yCAA+F;AAC/F,kDAA+C;AAC/C,qEAAkE;AAQlE,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAA8C;IAClE,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,+BAA+B,CAAC,CAAC,CAAC;IACvE,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,6BAA6B,GAA1C,MAAa,6BAA8B,SAAQ,iBAA2D;IAC1G,YAC6B,0BAAsD,EACtD,uBAAgD,EAChD,iBAAoC,EACrD,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QALQ,+BAA0B,GAA1B,0BAA0B,CAA4B;QACtD,4BAAuB,GAAvB,uBAAuB,CAAyB;QAChD,sBAAiB,GAAjB,iBAAiB,CAAmB;IAIjE,CAAC;IAEkB,KAAK,CAAC,eAAe,CAAC,OAAsC;QAC3E,MAAM,kBAAkB,GAAG,wBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/D,MAAM,oBAAoB,GAAG,CAAC,MAAM,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,EAAE,CA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@js-soft/ts-utils": "^2.3.3",
|
|
67
|
-
"@nmshd/consumption": "6.
|
|
68
|
-
"@nmshd/content": "6.
|
|
69
|
-
"@nmshd/core-types": "6.
|
|
67
|
+
"@nmshd/consumption": "6.23.0",
|
|
68
|
+
"@nmshd/content": "6.23.0",
|
|
69
|
+
"@nmshd/core-types": "6.23.0",
|
|
70
70
|
"@nmshd/crypto": "2.1.0",
|
|
71
71
|
"@nmshd/iql": "^1.0.2",
|
|
72
|
-
"@nmshd/transport": "6.
|
|
72
|
+
"@nmshd/transport": "6.23.0",
|
|
73
73
|
"@nmshd/typescript-ioc": "3.2.4",
|
|
74
74
|
"ajv": "^8.17.1",
|
|
75
75
|
"ajv-errors": "^3.0.0",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"access": "public",
|
|
97
97
|
"provenance": true
|
|
98
98
|
},
|
|
99
|
-
"version": "6.
|
|
99
|
+
"version": "6.23.0"
|
|
100
100
|
}
|