@nmshd/runtime 1.2.1 → 1.2.2
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 +5 -5
- package/dist/useCases/common/SchemaRepository.d.ts +5 -4
- package/dist/useCases/common/SchemaRepository.js +11 -9
- package/dist/useCases/common/SchemaRepository.js.map +1 -1
- package/dist/useCases/common/Schemas.d.ts +78 -1602
- package/dist/useCases/common/Schemas.js +172 -57
- package/dist/useCases/common/Schemas.js.map +1 -1
- package/dist/useCases/common/UseCase.d.ts +1 -4
- package/dist/useCases/common/UseCase.js.map +1 -1
- package/dist/useCases/common/index.d.ts +2 -0
- package/dist/useCases/common/index.js +2 -0
- package/dist/useCases/common/index.js.map +1 -1
- package/dist/useCases/common/validation/IValidator.d.ts +4 -0
- package/dist/useCases/common/validation/IValidator.js +3 -0
- package/dist/useCases/common/validation/IValidator.js.map +1 -0
- package/dist/useCases/common/validation/SchemaValidator.d.ts +10 -0
- package/dist/useCases/common/{SchemaValidator.js → validation/SchemaValidator.js} +3 -0
- package/dist/useCases/common/validation/SchemaValidator.js.map +1 -0
- package/dist/useCases/transport/files/CreateTokenForFile.d.ts +1 -3
- package/dist/useCases/transport/files/CreateTokenForFile.js +2 -4
- package/dist/useCases/transport/files/CreateTokenForFile.js.map +1 -1
- package/dist/useCases/transport/files/CreateTokenQrCodeForFile.d.ts +1 -3
- package/dist/useCases/transport/files/CreateTokenQrCodeForFile.js +2 -4
- package/dist/useCases/transport/files/CreateTokenQrCodeForFile.js.map +1 -1
- package/dist/useCases/transport/files/DownloadFile.d.ts +1 -3
- package/dist/useCases/transport/files/DownloadFile.js +2 -4
- package/dist/useCases/transport/files/DownloadFile.js.map +1 -1
- package/dist/useCases/transport/files/GetFile.d.ts +1 -3
- package/dist/useCases/transport/files/GetFile.js +2 -4
- package/dist/useCases/transport/files/GetFile.js.map +1 -1
- package/dist/useCases/transport/files/LoadPeerFile.d.ts +24 -13
- package/dist/useCases/transport/files/LoadPeerFile.js +36 -37
- package/dist/useCases/transport/files/LoadPeerFile.js.map +1 -1
- package/lib-web/nmshd.runtime.js +556 -158
- package/lib-web/nmshd.runtime.js.map +1 -1
- package/lib-web/nmshd.runtime.min.js +2 -2
- package/lib-web/nmshd.runtime.min.js.map +1 -1
- package/package.json +16 -16
- package/dist/useCases/common/SchemaValidator.d.ts +0 -9
- package/dist/useCases/common/SchemaValidator.js.map +0 -1
package/lib-web/nmshd.runtime.js
CHANGED
|
@@ -330,11 +330,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
330
330
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
331
331
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
332
332
|
exports.buildInformation = {
|
|
333
|
-
version: "1.2.
|
|
334
|
-
build: "
|
|
335
|
-
date: "2021-12-
|
|
336
|
-
commit: "
|
|
337
|
-
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.5","@nmshd/content":"1.
|
|
333
|
+
version: "1.2.2",
|
|
334
|
+
build: "17",
|
|
335
|
+
date: "2021-12-08T13:49:18+00:00",
|
|
336
|
+
commit: "89b47f99c03afe5084f413a82b682e1d3f91eb2f",
|
|
337
|
+
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.5","@nmshd/content":"1.1.1","@nmshd/crypto":"1.0.5","@nmshd/transport":"1.1.0","ajv":"^8.8.2","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.2","luxon":"^2.1.1","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
|
|
338
338
|
libraries: {
|
|
339
339
|
serval: ts_serval_1.buildInformation,
|
|
340
340
|
consumption: consumption_1.buildInformation,
|
|
@@ -3794,21 +3794,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3794
3794
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3795
3795
|
exports.JsonSchema = exports.SchemaRepository = void 0;
|
|
3796
3796
|
const ajv_1 = __importDefault(__webpack_require__(/*! ajv */ "./node_modules/ajv/dist/ajv.js"));
|
|
3797
|
+
const ajv_errors_1 = __importDefault(__webpack_require__(/*! ajv-errors */ "./node_modules/ajv-errors/dist/index.js"));
|
|
3797
3798
|
const ajv_formats_1 = __importDefault(__webpack_require__(/*! ajv-formats */ "./node_modules/ajv-formats/dist/index.js"));
|
|
3798
3799
|
const customFormats = {
|
|
3799
|
-
fileId: "FIL[A-
|
|
3800
|
-
relationshipId: "REL[A-
|
|
3801
|
-
messageId: "MSG[A-
|
|
3802
|
-
relationshipTemplateId: "RLT[A-
|
|
3803
|
-
tokenId: "TOK[A-
|
|
3804
|
-
relationshipChangeId: "RCH[A-
|
|
3805
|
-
deviceId: "DVC[A-
|
|
3800
|
+
fileId: "FIL[A-z0-9]{17}",
|
|
3801
|
+
relationshipId: "REL[A-z0-9]{17}",
|
|
3802
|
+
messageId: "MSG[A-z0-9]{17}",
|
|
3803
|
+
relationshipTemplateId: "RLT[A-z0-9]{17}",
|
|
3804
|
+
tokenId: "TOK[A-z0-9]{17}",
|
|
3805
|
+
relationshipChangeId: "RCH[A-z0-9]{17}",
|
|
3806
|
+
deviceId: "DVC[A-z0-9]{17}"
|
|
3806
3807
|
};
|
|
3807
3808
|
class SchemaRepository {
|
|
3808
3809
|
constructor() {
|
|
3809
3810
|
this.jsonSchemas = new Map();
|
|
3810
|
-
this.compiler = new ajv_1.default();
|
|
3811
|
+
this.compiler = new ajv_1.default({ allErrors: true });
|
|
3811
3812
|
(0, ajv_formats_1.default)(this.compiler);
|
|
3813
|
+
(0, ajv_errors_1.default)(this.compiler);
|
|
3812
3814
|
this.addCustomFormats();
|
|
3813
3815
|
}
|
|
3814
3816
|
addCustomFormats() {
|
|
@@ -3841,7 +3843,7 @@ class JsonSchema {
|
|
|
3841
3843
|
this.validateSchema = validateSchema;
|
|
3842
3844
|
}
|
|
3843
3845
|
validate(obj) {
|
|
3844
|
-
return { isValid: this.validateSchema(obj), errors: this.validateSchema.errors };
|
|
3846
|
+
return { isValid: this.validateSchema(obj), errors: this.validateSchema.errors ? [...this.validateSchema.errors] : undefined };
|
|
3845
3847
|
}
|
|
3846
3848
|
}
|
|
3847
3849
|
exports.JsonSchema = JsonSchema;
|
|
@@ -3849,40 +3851,6 @@ exports.JsonSchema = JsonSchema;
|
|
|
3849
3851
|
|
|
3850
3852
|
/***/ }),
|
|
3851
3853
|
|
|
3852
|
-
/***/ "./dist/useCases/common/SchemaValidator.js":
|
|
3853
|
-
/*!*************************************************!*\
|
|
3854
|
-
!*** ./dist/useCases/common/SchemaValidator.js ***!
|
|
3855
|
-
\*************************************************/
|
|
3856
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3857
|
-
|
|
3858
|
-
"use strict";
|
|
3859
|
-
|
|
3860
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3861
|
-
exports.SchemaValidator = void 0;
|
|
3862
|
-
const fluent_ts_validator_1 = __webpack_require__(/*! fluent-ts-validator */ "./node_modules/fluent-ts-validator/index.js");
|
|
3863
|
-
class SchemaValidator {
|
|
3864
|
-
constructor(schema) {
|
|
3865
|
-
this.schema = schema;
|
|
3866
|
-
}
|
|
3867
|
-
validate(input) {
|
|
3868
|
-
const validationResult = this.schema.validate(input);
|
|
3869
|
-
const result = new fluent_ts_validator_1.ValidationResult();
|
|
3870
|
-
if (validationResult.isValid) {
|
|
3871
|
-
return result;
|
|
3872
|
-
}
|
|
3873
|
-
result.addFailures(validationResult.errors.map(this.schemaErrorToValidationFailure));
|
|
3874
|
-
return result;
|
|
3875
|
-
}
|
|
3876
|
-
schemaErrorToValidationFailure(err, target) {
|
|
3877
|
-
const errorMessage = `${err.instancePath} ${err.message}`.replace(/^\//, "").replace(/"/g, "");
|
|
3878
|
-
return new fluent_ts_validator_1.ValidationFailure(target, err.instancePath, undefined, undefined, errorMessage);
|
|
3879
|
-
}
|
|
3880
|
-
}
|
|
3881
|
-
exports.SchemaValidator = SchemaValidator;
|
|
3882
|
-
//# sourceMappingURL=SchemaValidator.js.map
|
|
3883
|
-
|
|
3884
|
-
/***/ }),
|
|
3885
|
-
|
|
3886
3854
|
/***/ "./dist/useCases/common/Schemas.js":
|
|
3887
3855
|
/*!*****************************************!*\
|
|
3888
3856
|
!*** ./dist/useCases/common/Schemas.js ***!
|
|
@@ -3892,8 +3860,8 @@ exports.SchemaValidator = SchemaValidator;
|
|
|
3892
3860
|
"use strict";
|
|
3893
3861
|
|
|
3894
3862
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3895
|
-
exports.
|
|
3896
|
-
exports.LoadPeerTokenRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.CreateRelationshipChangeRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.
|
|
3863
|
+
exports.GetFilesRequest = exports.GetFileRequest = exports.CreateTokenQrCodeForFileRequest = exports.CreateTokenForFileRequest = exports.UpdateDeviceRequest = exports.GetDeviceOnboardingInfoRequest = exports.GetDeviceRequest = exports.DeleteDeviceRequest = exports.CreateDeviceOnboardingTokenRequest = exports.CreateDeviceRequest = exports.DownloadAttachmentRequest = exports.DownloadFileRequest = exports.RegisterPushNotificationTokenRequest = exports.UpdateSharedItemRequest = exports.GetSharedItemsSharedWithAddressRequest = exports.GetSharedItemsSharedByAddressRequest = exports.GetSharedItemsByReferenceRequest = exports.GetSharedItemsByAddressRequest = exports.GetSharedItemsRequest = exports.GetSharedItemRequest = exports.DeleteSharedItemRequest = exports.CreateSharedItemRequest = exports.UpdateSettingRequest = exports.GetSettingsRequest = exports.GetSettingRequest = exports.DeleteSettingRequest = exports.CreateSettingRequest = exports.UpdateRelationshipInfoRequest = exports.GetRelationshipInfoByRelationshipRequest = exports.GetRelationshipInfoRequest = exports.DeleteRelationshipInfoByRelationshipRequest = exports.DeleteRelationshipInfoRequest = exports.CreateRelationshipInfoRequest = exports.UpdateDraftRequest = exports.GetDraftsRequest = exports.GetDraftRequest = exports.DeleteDraftRequest = exports.CreateDraftRequest = exports.UpdateAttributeRequest = exports.SucceedAttributeRequest = exports.GetHistoryByNameRequest = exports.GetAttributesRequest = exports.GetAttributeByNameRequest = exports.GetAttributeRequest = exports.DeleteAttributeByNameRequest = exports.DeleteAttributeRequest = exports.CreateAttributeRequest = exports.GetAttributesByNameRequest = exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = exports.LoadPeerTokenAnonymousByIdAndKeyRequest = void 0;
|
|
3864
|
+
exports.LoadPeerTokenRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateTokenQrCodeForOwnTemplateRequest = exports.CreateTokenForOwnTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.CreateRelationshipChangeRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.CheckIdentityRequest = exports.UploadOwnFileRequest = exports.LoadPeerFileRequest = exports.LoadPeerFileViaReferenceRequest = exports.LoadPeerFileViaSecretRequest = void 0;
|
|
3897
3865
|
exports.LoadPeerTokenAnonymousByIdAndKeyRequest = {
|
|
3898
3866
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3899
3867
|
"$ref": "#/definitions/LoadPeerTokenAnonymousByIdAndKeyRequest",
|
|
@@ -3934,6 +3902,16 @@ exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = {
|
|
|
3934
3902
|
}
|
|
3935
3903
|
}
|
|
3936
3904
|
};
|
|
3905
|
+
exports.GetAttributesByNameRequest = {
|
|
3906
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3907
|
+
"$ref": "#/definitions/GetAttributesByNameRequest",
|
|
3908
|
+
"definitions": {
|
|
3909
|
+
"GetAttributesByNameRequest": {
|
|
3910
|
+
"type": "object",
|
|
3911
|
+
"additionalProperties": false
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
};
|
|
3937
3915
|
exports.CreateAttributeRequest = {
|
|
3938
3916
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3939
3917
|
"$ref": "#/definitions/CreateAttributeRequest",
|
|
@@ -4066,16 +4044,6 @@ exports.GetAttributesRequest = {
|
|
|
4066
4044
|
}
|
|
4067
4045
|
}
|
|
4068
4046
|
};
|
|
4069
|
-
exports.GetAttributesByNameRequest = {
|
|
4070
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4071
|
-
"$ref": "#/definitions/GetAttributesByNameRequest",
|
|
4072
|
-
"definitions": {
|
|
4073
|
-
"GetAttributesByNameRequest": {
|
|
4074
|
-
"type": "object",
|
|
4075
|
-
"additionalProperties": false
|
|
4076
|
-
}
|
|
4077
|
-
}
|
|
4078
|
-
};
|
|
4079
4047
|
exports.GetHistoryByNameRequest = {
|
|
4080
4048
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4081
4049
|
"$ref": "#/definitions/GetHistoryByNameRequest",
|
|
@@ -4905,6 +4873,47 @@ exports.RegisterPushNotificationTokenRequest = {
|
|
|
4905
4873
|
}
|
|
4906
4874
|
}
|
|
4907
4875
|
};
|
|
4876
|
+
exports.DownloadFileRequest = {
|
|
4877
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4878
|
+
"$ref": "#/definitions/DownloadFileRequest",
|
|
4879
|
+
"definitions": {
|
|
4880
|
+
"DownloadFileRequest": {
|
|
4881
|
+
"type": "object",
|
|
4882
|
+
"properties": {
|
|
4883
|
+
"id": {
|
|
4884
|
+
"type": "string",
|
|
4885
|
+
"format": "fileId"
|
|
4886
|
+
}
|
|
4887
|
+
},
|
|
4888
|
+
"required": [
|
|
4889
|
+
"id"
|
|
4890
|
+
],
|
|
4891
|
+
"additionalProperties": false
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
};
|
|
4895
|
+
exports.DownloadAttachmentRequest = {
|
|
4896
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4897
|
+
"$ref": "#/definitions/DownloadAttachmentRequest",
|
|
4898
|
+
"definitions": {
|
|
4899
|
+
"DownloadAttachmentRequest": {
|
|
4900
|
+
"type": "object",
|
|
4901
|
+
"properties": {
|
|
4902
|
+
"id": {
|
|
4903
|
+
"type": "string"
|
|
4904
|
+
},
|
|
4905
|
+
"attachmentId": {
|
|
4906
|
+
"type": "string"
|
|
4907
|
+
}
|
|
4908
|
+
},
|
|
4909
|
+
"required": [
|
|
4910
|
+
"id",
|
|
4911
|
+
"attachmentId"
|
|
4912
|
+
],
|
|
4913
|
+
"additionalProperties": false
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
};
|
|
4908
4917
|
exports.CreateDeviceRequest = {
|
|
4909
4918
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4910
4919
|
"$ref": "#/definitions/CreateDeviceRequest",
|
|
@@ -5074,25 +5083,6 @@ exports.CreateTokenQrCodeForFileRequest = {
|
|
|
5074
5083
|
}
|
|
5075
5084
|
}
|
|
5076
5085
|
};
|
|
5077
|
-
exports.DownloadFileRequest = {
|
|
5078
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5079
|
-
"$ref": "#/definitions/DownloadFileRequest",
|
|
5080
|
-
"definitions": {
|
|
5081
|
-
"DownloadFileRequest": {
|
|
5082
|
-
"type": "object",
|
|
5083
|
-
"properties": {
|
|
5084
|
-
"id": {
|
|
5085
|
-
"type": "string",
|
|
5086
|
-
"format": "fileId"
|
|
5087
|
-
}
|
|
5088
|
-
},
|
|
5089
|
-
"required": [
|
|
5090
|
-
"id"
|
|
5091
|
-
],
|
|
5092
|
-
"additionalProperties": false
|
|
5093
|
-
}
|
|
5094
|
-
}
|
|
5095
|
-
};
|
|
5096
5086
|
exports.GetFileRequest = {
|
|
5097
5087
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5098
5088
|
"$ref": "#/definitions/GetFileRequest",
|
|
@@ -5135,11 +5125,65 @@ exports.GetFilesRequest = {
|
|
|
5135
5125
|
}
|
|
5136
5126
|
}
|
|
5137
5127
|
};
|
|
5128
|
+
exports.LoadPeerFileViaSecretRequest = {
|
|
5129
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5130
|
+
"$ref": "#/definitions/LoadPeerFileViaSecretRequest",
|
|
5131
|
+
"definitions": {
|
|
5132
|
+
"LoadPeerFileViaSecretRequest": {
|
|
5133
|
+
"type": "object",
|
|
5134
|
+
"properties": {
|
|
5135
|
+
"id": {
|
|
5136
|
+
"type": "string",
|
|
5137
|
+
"format": "fileId"
|
|
5138
|
+
},
|
|
5139
|
+
"secretKey": {
|
|
5140
|
+
"type": "string",
|
|
5141
|
+
"minLength": 100
|
|
5142
|
+
}
|
|
5143
|
+
},
|
|
5144
|
+
"required": [
|
|
5145
|
+
"id",
|
|
5146
|
+
"secretKey"
|
|
5147
|
+
],
|
|
5148
|
+
"additionalProperties": false
|
|
5149
|
+
}
|
|
5150
|
+
}
|
|
5151
|
+
};
|
|
5152
|
+
exports.LoadPeerFileViaReferenceRequest = {
|
|
5153
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5154
|
+
"$ref": "#/definitions/LoadPeerFileViaReferenceRequest",
|
|
5155
|
+
"definitions": {
|
|
5156
|
+
"LoadPeerFileViaReferenceRequest": {
|
|
5157
|
+
"type": "object",
|
|
5158
|
+
"properties": {
|
|
5159
|
+
"reference": {
|
|
5160
|
+
"type": "string",
|
|
5161
|
+
"pattern": "VE9L.{84}"
|
|
5162
|
+
}
|
|
5163
|
+
},
|
|
5164
|
+
"required": [
|
|
5165
|
+
"reference"
|
|
5166
|
+
],
|
|
5167
|
+
"additionalProperties": false,
|
|
5168
|
+
"errorMessage": "token reference invalid"
|
|
5169
|
+
}
|
|
5170
|
+
}
|
|
5171
|
+
};
|
|
5138
5172
|
exports.LoadPeerFileRequest = {
|
|
5139
5173
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5140
5174
|
"$ref": "#/definitions/LoadPeerFileRequest",
|
|
5141
5175
|
"definitions": {
|
|
5142
5176
|
"LoadPeerFileRequest": {
|
|
5177
|
+
"anyOf": [
|
|
5178
|
+
{
|
|
5179
|
+
"$ref": "#/definitions/LoadPeerFileViaSecretRequest"
|
|
5180
|
+
},
|
|
5181
|
+
{
|
|
5182
|
+
"$ref": "#/definitions/LoadPeerFileViaReferenceRequest"
|
|
5183
|
+
}
|
|
5184
|
+
]
|
|
5185
|
+
},
|
|
5186
|
+
"LoadPeerFileViaSecretRequest": {
|
|
5143
5187
|
"type": "object",
|
|
5144
5188
|
"properties": {
|
|
5145
5189
|
"id": {
|
|
@@ -5147,13 +5191,29 @@ exports.LoadPeerFileRequest = {
|
|
|
5147
5191
|
"format": "fileId"
|
|
5148
5192
|
},
|
|
5149
5193
|
"secretKey": {
|
|
5150
|
-
"type": "string"
|
|
5151
|
-
|
|
5152
|
-
"reference": {
|
|
5153
|
-
"type": "string"
|
|
5194
|
+
"type": "string",
|
|
5195
|
+
"minLength": 100
|
|
5154
5196
|
}
|
|
5155
5197
|
},
|
|
5198
|
+
"required": [
|
|
5199
|
+
"id",
|
|
5200
|
+
"secretKey"
|
|
5201
|
+
],
|
|
5156
5202
|
"additionalProperties": false
|
|
5203
|
+
},
|
|
5204
|
+
"LoadPeerFileViaReferenceRequest": {
|
|
5205
|
+
"type": "object",
|
|
5206
|
+
"properties": {
|
|
5207
|
+
"reference": {
|
|
5208
|
+
"type": "string",
|
|
5209
|
+
"pattern": "VE9L.{84}"
|
|
5210
|
+
}
|
|
5211
|
+
},
|
|
5212
|
+
"required": [
|
|
5213
|
+
"reference"
|
|
5214
|
+
],
|
|
5215
|
+
"additionalProperties": false,
|
|
5216
|
+
"errorMessage": "token reference invalid"
|
|
5157
5217
|
}
|
|
5158
5218
|
}
|
|
5159
5219
|
};
|
|
@@ -5248,28 +5308,6 @@ exports.CheckIdentityRequest = {
|
|
|
5248
5308
|
}
|
|
5249
5309
|
}
|
|
5250
5310
|
};
|
|
5251
|
-
exports.DownloadAttachmentRequest = {
|
|
5252
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5253
|
-
"$ref": "#/definitions/DownloadAttachmentRequest",
|
|
5254
|
-
"definitions": {
|
|
5255
|
-
"DownloadAttachmentRequest": {
|
|
5256
|
-
"type": "object",
|
|
5257
|
-
"properties": {
|
|
5258
|
-
"id": {
|
|
5259
|
-
"type": "string"
|
|
5260
|
-
},
|
|
5261
|
-
"attachmentId": {
|
|
5262
|
-
"type": "string"
|
|
5263
|
-
}
|
|
5264
|
-
},
|
|
5265
|
-
"required": [
|
|
5266
|
-
"id",
|
|
5267
|
-
"attachmentId"
|
|
5268
|
-
],
|
|
5269
|
-
"additionalProperties": false
|
|
5270
|
-
}
|
|
5271
|
-
}
|
|
5272
|
-
};
|
|
5273
5311
|
exports.GetAttachmentMetadataRequest = {
|
|
5274
5312
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5275
5313
|
"$ref": "#/definitions/GetAttachmentMetadataRequest",
|
|
@@ -5535,6 +5573,51 @@ exports.CreateOwnRelationshipTemplateRequest = {
|
|
|
5535
5573
|
}
|
|
5536
5574
|
}
|
|
5537
5575
|
};
|
|
5576
|
+
exports.CreateTokenForOwnTemplateRequest = {
|
|
5577
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5578
|
+
"$ref": "#/definitions/CreateTokenForOwnTemplateRequest",
|
|
5579
|
+
"definitions": {
|
|
5580
|
+
"CreateTokenForOwnTemplateRequest": {
|
|
5581
|
+
"type": "object",
|
|
5582
|
+
"properties": {
|
|
5583
|
+
"templateId": {
|
|
5584
|
+
"type": "string"
|
|
5585
|
+
},
|
|
5586
|
+
"expiresAt": {
|
|
5587
|
+
"type": "string"
|
|
5588
|
+
},
|
|
5589
|
+
"ephemeral": {
|
|
5590
|
+
"type": "boolean"
|
|
5591
|
+
}
|
|
5592
|
+
},
|
|
5593
|
+
"required": [
|
|
5594
|
+
"templateId"
|
|
5595
|
+
],
|
|
5596
|
+
"additionalProperties": false
|
|
5597
|
+
}
|
|
5598
|
+
}
|
|
5599
|
+
};
|
|
5600
|
+
exports.CreateTokenQrCodeForOwnTemplateRequest = {
|
|
5601
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5602
|
+
"$ref": "#/definitions/CreateTokenQrCodeForOwnTemplateRequest",
|
|
5603
|
+
"definitions": {
|
|
5604
|
+
"CreateTokenQrCodeForOwnTemplateRequest": {
|
|
5605
|
+
"type": "object",
|
|
5606
|
+
"properties": {
|
|
5607
|
+
"templateId": {
|
|
5608
|
+
"type": "string"
|
|
5609
|
+
},
|
|
5610
|
+
"expiresAt": {
|
|
5611
|
+
"type": "string"
|
|
5612
|
+
}
|
|
5613
|
+
},
|
|
5614
|
+
"required": [
|
|
5615
|
+
"templateId"
|
|
5616
|
+
],
|
|
5617
|
+
"additionalProperties": false
|
|
5618
|
+
}
|
|
5619
|
+
}
|
|
5620
|
+
};
|
|
5538
5621
|
exports.GetRelationshipTemplateRequest = {
|
|
5539
5622
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5540
5623
|
"$ref": "#/definitions/GetRelationshipTemplateRequest",
|
|
@@ -5819,11 +5902,13 @@ __exportStar(__webpack_require__(/*! ./OwnerRestriction */ "./dist/useCases/comm
|
|
|
5819
5902
|
__exportStar(__webpack_require__(/*! ./QRCode */ "./dist/useCases/common/QRCode.js"), exports);
|
|
5820
5903
|
__exportStar(__webpack_require__(/*! ./RuntimeErrors */ "./dist/useCases/common/RuntimeErrors.js"), exports);
|
|
5821
5904
|
__exportStar(__webpack_require__(/*! ./RuntimeValidator */ "./dist/useCases/common/RuntimeValidator.js"), exports);
|
|
5905
|
+
__exportStar(__webpack_require__(/*! ./SchemaRepository */ "./dist/useCases/common/SchemaRepository.js"), exports);
|
|
5822
5906
|
__exportStar(__webpack_require__(/*! ./UseCase */ "./dist/useCases/common/UseCase.js"), exports);
|
|
5823
5907
|
__exportStar(__webpack_require__(/*! ./validation/AddressValidator */ "./dist/useCases/common/validation/AddressValidator.js"), exports);
|
|
5824
5908
|
__exportStar(__webpack_require__(/*! ./validation/DateValidator */ "./dist/useCases/common/validation/DateValidator.js"), exports);
|
|
5825
5909
|
__exportStar(__webpack_require__(/*! ./validation/IdValidator */ "./dist/useCases/common/validation/IdValidator.js"), exports);
|
|
5826
5910
|
__exportStar(__webpack_require__(/*! ./validation/RelationshipAttributeDTOValidator */ "./dist/useCases/common/validation/RelationshipAttributeDTOValidator.js"), exports);
|
|
5911
|
+
__exportStar(__webpack_require__(/*! ./validation/SchemaValidator */ "./dist/useCases/common/validation/SchemaValidator.js"), exports);
|
|
5827
5912
|
//# sourceMappingURL=index.js.map
|
|
5828
5913
|
|
|
5829
5914
|
/***/ }),
|
|
@@ -5960,6 +6045,43 @@ exports.RelationshipAttributeDTOValidator = RelationshipAttributeDTOValidator;
|
|
|
5960
6045
|
|
|
5961
6046
|
/***/ }),
|
|
5962
6047
|
|
|
6048
|
+
/***/ "./dist/useCases/common/validation/SchemaValidator.js":
|
|
6049
|
+
/*!************************************************************!*\
|
|
6050
|
+
!*** ./dist/useCases/common/validation/SchemaValidator.js ***!
|
|
6051
|
+
\************************************************************/
|
|
6052
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6053
|
+
|
|
6054
|
+
"use strict";
|
|
6055
|
+
|
|
6056
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6057
|
+
exports.SchemaValidator = void 0;
|
|
6058
|
+
const fluent_ts_validator_1 = __webpack_require__(/*! fluent-ts-validator */ "./node_modules/fluent-ts-validator/index.js");
|
|
6059
|
+
class SchemaValidator {
|
|
6060
|
+
constructor(schema) {
|
|
6061
|
+
this.schema = schema;
|
|
6062
|
+
}
|
|
6063
|
+
validate(input) {
|
|
6064
|
+
const validationResult = this.schema.validate(input);
|
|
6065
|
+
return this.convertValidationResult(validationResult);
|
|
6066
|
+
}
|
|
6067
|
+
convertValidationResult(validationResult) {
|
|
6068
|
+
const result = new fluent_ts_validator_1.ValidationResult();
|
|
6069
|
+
if (validationResult.isValid) {
|
|
6070
|
+
return result;
|
|
6071
|
+
}
|
|
6072
|
+
result.addFailures(validationResult.errors.map(this.schemaErrorToValidationFailure));
|
|
6073
|
+
return result;
|
|
6074
|
+
}
|
|
6075
|
+
schemaErrorToValidationFailure(err, target) {
|
|
6076
|
+
const errorMessage = `${err.instancePath} ${err.message}`.replace(/^\//, "").replace(/"/g, "");
|
|
6077
|
+
return new fluent_ts_validator_1.ValidationFailure(target, err.instancePath, undefined, undefined, errorMessage);
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
exports.SchemaValidator = SchemaValidator;
|
|
6081
|
+
//# sourceMappingURL=SchemaValidator.js.map
|
|
6082
|
+
|
|
6083
|
+
/***/ }),
|
|
6084
|
+
|
|
5963
6085
|
/***/ "./dist/useCases/consumption/attributes/AttributeMapper.js":
|
|
5964
6086
|
/*!*****************************************************************!*\
|
|
5965
6087
|
!*** ./dist/useCases/consumption/attributes/AttributeMapper.js ***!
|
|
@@ -9639,17 +9761,15 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9639
9761
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9640
9762
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9641
9763
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9642
|
-
const SchemaRepository_1 = __webpack_require__(/*! ../../common/SchemaRepository */ "./dist/useCases/common/SchemaRepository.js");
|
|
9643
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9644
9764
|
const TokenMapper_1 = __webpack_require__(/*! ../tokens/TokenMapper */ "./dist/useCases/transport/tokens/TokenMapper.js");
|
|
9645
|
-
let Validator = class Validator extends
|
|
9765
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9646
9766
|
constructor(schemaRepository) {
|
|
9647
9767
|
super(schemaRepository.getSchema("CreateTokenForFileRequest"));
|
|
9648
9768
|
}
|
|
9649
9769
|
};
|
|
9650
9770
|
Validator = __decorate([
|
|
9651
9771
|
__param(0, typescript_ioc_1.Inject),
|
|
9652
|
-
__metadata("design:paramtypes", [
|
|
9772
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9653
9773
|
], Validator);
|
|
9654
9774
|
let CreateTokenForFileUseCase = class CreateTokenForFileUseCase extends common_1.UseCase {
|
|
9655
9775
|
constructor(fileController, tokenController, accountController, validator) {
|
|
@@ -9723,16 +9843,14 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9723
9843
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9724
9844
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9725
9845
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9726
|
-
|
|
9727
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9728
|
-
let Validator = class Validator extends SchemaValidator_1.SchemaValidator {
|
|
9846
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9729
9847
|
constructor(schemaRepository) {
|
|
9730
9848
|
super(schemaRepository.getSchema("CreateTokenQrCodeForFileRequest"));
|
|
9731
9849
|
}
|
|
9732
9850
|
};
|
|
9733
9851
|
Validator = __decorate([
|
|
9734
9852
|
__param(0, typescript_ioc_1.Inject),
|
|
9735
|
-
__metadata("design:paramtypes", [
|
|
9853
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9736
9854
|
], Validator);
|
|
9737
9855
|
let CreateTokenQrCodeForFileUseCase = class CreateTokenQrCodeForFileUseCase extends common_1.UseCase {
|
|
9738
9856
|
constructor(fileController, tokenController, validator) {
|
|
@@ -9798,17 +9916,15 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9798
9916
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9799
9917
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9800
9918
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9801
|
-
const SchemaRepository_1 = __webpack_require__(/*! ../../common/SchemaRepository */ "./dist/useCases/common/SchemaRepository.js");
|
|
9802
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9803
9919
|
const FileMapper_1 = __webpack_require__(/*! ./FileMapper */ "./dist/useCases/transport/files/FileMapper.js");
|
|
9804
|
-
let Validator = class Validator extends
|
|
9920
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9805
9921
|
constructor(schemaRepository) {
|
|
9806
9922
|
super(schemaRepository.getSchema("DownloadFileRequest"));
|
|
9807
9923
|
}
|
|
9808
9924
|
};
|
|
9809
9925
|
Validator = __decorate([
|
|
9810
9926
|
__param(0, typescript_ioc_1.Inject),
|
|
9811
|
-
__metadata("design:paramtypes", [
|
|
9927
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9812
9928
|
], Validator);
|
|
9813
9929
|
let DownloadFileUseCase = class DownloadFileUseCase extends common_1.UseCase {
|
|
9814
9930
|
constructor(fileController, validator) {
|
|
@@ -9917,17 +10033,15 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9917
10033
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9918
10034
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9919
10035
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9920
|
-
const SchemaRepository_1 = __webpack_require__(/*! ../../common/SchemaRepository */ "./dist/useCases/common/SchemaRepository.js");
|
|
9921
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9922
10036
|
const FileMapper_1 = __webpack_require__(/*! ./FileMapper */ "./dist/useCases/transport/files/FileMapper.js");
|
|
9923
|
-
let Validator = class Validator extends
|
|
10037
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9924
10038
|
constructor(schemaRepository) {
|
|
9925
10039
|
super(schemaRepository.getSchema("GetFileRequest"));
|
|
9926
10040
|
}
|
|
9927
10041
|
};
|
|
9928
10042
|
Validator = __decorate([
|
|
9929
10043
|
__param(0, typescript_ioc_1.Inject),
|
|
9930
|
-
__metadata("design:paramtypes", [
|
|
10044
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9931
10045
|
], Validator);
|
|
9932
10046
|
let GetFileUseCase = class GetFileUseCase extends common_1.UseCase {
|
|
9933
10047
|
constructor(fileController, validator) {
|
|
@@ -10062,45 +10176,44 @@ exports.LoadPeerFileUseCase = void 0;
|
|
|
10062
10176
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
10063
10177
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
10064
10178
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
10179
|
+
const fluent_ts_validator_1 = __webpack_require__(/*! fluent-ts-validator */ "./node_modules/fluent-ts-validator/index.js");
|
|
10065
10180
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
10066
10181
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
10067
10182
|
const FileMapper_1 = __webpack_require__(/*! ./FileMapper */ "./dist/useCases/transport/files/FileMapper.js");
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
this.validateIfString((x) => x.id)
|
|
10080
|
-
.fulfills(common_1.IdValidator.required(transport_1.BackboneIds.file))
|
|
10081
|
-
.when(this.isCreatePeerFileFromIdAndKeyRequest);
|
|
10082
|
-
this.validateIfString((x) => x.secretKey)
|
|
10083
|
-
.isNotNull()
|
|
10084
|
-
.when(this.isCreatePeerFileFromIdAndKeyRequest);
|
|
10085
|
-
}
|
|
10086
|
-
setupRulesForCreateFileFromTokenReferenceRequest() {
|
|
10087
|
-
this.validateIfString((x) => x.reference)
|
|
10088
|
-
.isNotNull()
|
|
10089
|
-
.fulfills(this.isTokenReference)
|
|
10090
|
-
.when(this.isCreatePeerFileFromTokenReferenceRequest);
|
|
10091
|
-
}
|
|
10092
|
-
isTokenReference(tokenReference) {
|
|
10093
|
-
// "TOK" as Base64
|
|
10094
|
-
const tokInBase64 = "VE9L";
|
|
10095
|
-
return tokenReference.startsWith(tokInBase64);
|
|
10096
|
-
}
|
|
10097
|
-
isCreatePeerFileFromIdAndKeyRequest(x) {
|
|
10098
|
-
return !!x.id && !!x.secretKey;
|
|
10183
|
+
function isLoadPeerFileViaSecret(request) {
|
|
10184
|
+
return "id" in request && "secretKey" in request;
|
|
10185
|
+
}
|
|
10186
|
+
function isLoadPeerFileViaReference(request) {
|
|
10187
|
+
return "reference" in request;
|
|
10188
|
+
}
|
|
10189
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
10190
|
+
constructor(schemaRepository) {
|
|
10191
|
+
super(schemaRepository.getSchema("LoadPeerFileRequest"));
|
|
10192
|
+
this.loadViaSecretSchema = schemaRepository.getSchema("LoadPeerFileViaSecretRequest");
|
|
10193
|
+
this.loadViaReferenceSchema = schemaRepository.getSchema("LoadPeerFileViaReferenceRequest");
|
|
10099
10194
|
}
|
|
10100
|
-
|
|
10101
|
-
|
|
10195
|
+
validate(input) {
|
|
10196
|
+
let validationResult = this.schema.validate(input);
|
|
10197
|
+
if (validationResult.isValid) {
|
|
10198
|
+
return new fluent_ts_validator_1.ValidationResult();
|
|
10199
|
+
}
|
|
10200
|
+
// any-of in combination with missing properties is a bit weird
|
|
10201
|
+
// when { reference: null | undefined } is passed, it ignores reference
|
|
10202
|
+
// and treats it like a LoadPeerFileViaSecret.
|
|
10203
|
+
// That's why we validate with the specific schema afterwards
|
|
10204
|
+
if (isLoadPeerFileViaReference(input)) {
|
|
10205
|
+
validationResult = this.loadViaReferenceSchema.validate(input);
|
|
10206
|
+
}
|
|
10207
|
+
else if (isLoadPeerFileViaSecret(input)) {
|
|
10208
|
+
validationResult = this.loadViaSecretSchema.validate(input);
|
|
10209
|
+
}
|
|
10210
|
+
return this.convertValidationResult(validationResult);
|
|
10102
10211
|
}
|
|
10103
|
-
}
|
|
10212
|
+
};
|
|
10213
|
+
Validator = __decorate([
|
|
10214
|
+
__param(0, typescript_ioc_1.Inject),
|
|
10215
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
10216
|
+
], Validator);
|
|
10104
10217
|
let LoadPeerFileUseCase = class LoadPeerFileUseCase extends common_1.UseCase {
|
|
10105
10218
|
constructor(fileController, tokenController, accountController, validator) {
|
|
10106
10219
|
super(validator);
|
|
@@ -10110,11 +10223,11 @@ let LoadPeerFileUseCase = class LoadPeerFileUseCase extends common_1.UseCase {
|
|
|
10110
10223
|
}
|
|
10111
10224
|
async executeInternal(request) {
|
|
10112
10225
|
let createdFile;
|
|
10113
|
-
if (request
|
|
10226
|
+
if (isLoadPeerFileViaSecret(request)) {
|
|
10114
10227
|
const key = await crypto_1.CryptoSecretKey.fromBase64(request.secretKey);
|
|
10115
10228
|
createdFile = await this.loadFile(transport_1.CoreId.from(request.id), key);
|
|
10116
10229
|
}
|
|
10117
|
-
else if (request
|
|
10230
|
+
else if (isLoadPeerFileViaReference(request)) {
|
|
10118
10231
|
createdFile = await this.createFileFromTokenReferenceRequest(request.reference);
|
|
10119
10232
|
}
|
|
10120
10233
|
else {
|
|
@@ -10147,7 +10260,7 @@ LoadPeerFileUseCase = __decorate([
|
|
|
10147
10260
|
__metadata("design:paramtypes", [transport_1.FileController,
|
|
10148
10261
|
transport_1.TokenController,
|
|
10149
10262
|
transport_1.AccountController,
|
|
10150
|
-
|
|
10263
|
+
Validator])
|
|
10151
10264
|
], LoadPeerFileUseCase);
|
|
10152
10265
|
exports.LoadPeerFileUseCase = LoadPeerFileUseCase;
|
|
10153
10266
|
//# sourceMappingURL=LoadPeerFile.js.map
|
|
@@ -13252,6 +13365,291 @@ exports.sleep = sleep;
|
|
|
13252
13365
|
|
|
13253
13366
|
/***/ }),
|
|
13254
13367
|
|
|
13368
|
+
/***/ "./node_modules/ajv-errors/dist/index.js":
|
|
13369
|
+
/*!***********************************************!*\
|
|
13370
|
+
!*** ./node_modules/ajv-errors/dist/index.js ***!
|
|
13371
|
+
\***********************************************/
|
|
13372
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
13373
|
+
|
|
13374
|
+
"use strict";
|
|
13375
|
+
|
|
13376
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13377
|
+
const ajv_1 = __webpack_require__(/*! ajv */ "./node_modules/ajv/dist/ajv.js");
|
|
13378
|
+
const codegen_1 = __webpack_require__(/*! ajv/dist/compile/codegen */ "./node_modules/ajv/dist/compile/codegen/index.js");
|
|
13379
|
+
const code_1 = __webpack_require__(/*! ajv/dist/compile/codegen/code */ "./node_modules/ajv/dist/compile/codegen/code.js");
|
|
13380
|
+
const validate_1 = __webpack_require__(/*! ajv/dist/compile/validate */ "./node_modules/ajv/dist/compile/validate/index.js");
|
|
13381
|
+
const errors_1 = __webpack_require__(/*! ajv/dist/compile/errors */ "./node_modules/ajv/dist/compile/errors.js");
|
|
13382
|
+
const names_1 = __webpack_require__(/*! ajv/dist/compile/names */ "./node_modules/ajv/dist/compile/names.js");
|
|
13383
|
+
const keyword = "errorMessage";
|
|
13384
|
+
const used = new ajv_1.Name("emUsed");
|
|
13385
|
+
const KEYWORD_PROPERTY_PARAMS = {
|
|
13386
|
+
required: "missingProperty",
|
|
13387
|
+
dependencies: "property",
|
|
13388
|
+
dependentRequired: "property",
|
|
13389
|
+
};
|
|
13390
|
+
const INTERPOLATION = /\$\{[^}]+\}/;
|
|
13391
|
+
const INTERPOLATION_REPLACE = /\$\{([^}]+)\}/g;
|
|
13392
|
+
const EMPTY_STR = /^""\s*\+\s*|\s*\+\s*""$/g;
|
|
13393
|
+
function errorMessage(options) {
|
|
13394
|
+
return {
|
|
13395
|
+
keyword,
|
|
13396
|
+
schemaType: ["string", "object"],
|
|
13397
|
+
post: true,
|
|
13398
|
+
code(cxt) {
|
|
13399
|
+
const { gen, data, schema, schemaValue, it } = cxt;
|
|
13400
|
+
if (it.createErrors === false)
|
|
13401
|
+
return;
|
|
13402
|
+
const sch = schema;
|
|
13403
|
+
const instancePath = codegen_1.strConcat(names_1.default.instancePath, it.errorPath);
|
|
13404
|
+
gen.if(ajv_1._ `${names_1.default.errors} > 0`, () => {
|
|
13405
|
+
if (typeof sch == "object") {
|
|
13406
|
+
const [kwdPropErrors, kwdErrors] = keywordErrorsConfig(sch);
|
|
13407
|
+
if (kwdErrors)
|
|
13408
|
+
processKeywordErrors(kwdErrors);
|
|
13409
|
+
if (kwdPropErrors)
|
|
13410
|
+
processKeywordPropErrors(kwdPropErrors);
|
|
13411
|
+
processChildErrors(childErrorsConfig(sch));
|
|
13412
|
+
}
|
|
13413
|
+
const schMessage = typeof sch == "string" ? sch : sch._;
|
|
13414
|
+
if (schMessage)
|
|
13415
|
+
processAllErrors(schMessage);
|
|
13416
|
+
if (!options.keepErrors)
|
|
13417
|
+
removeUsedErrors();
|
|
13418
|
+
});
|
|
13419
|
+
function childErrorsConfig({ properties, items }) {
|
|
13420
|
+
const errors = {};
|
|
13421
|
+
if (properties) {
|
|
13422
|
+
errors.props = {};
|
|
13423
|
+
for (const p in properties)
|
|
13424
|
+
errors.props[p] = [];
|
|
13425
|
+
}
|
|
13426
|
+
if (items) {
|
|
13427
|
+
errors.items = {};
|
|
13428
|
+
for (let i = 0; i < items.length; i++)
|
|
13429
|
+
errors.items[i] = [];
|
|
13430
|
+
}
|
|
13431
|
+
return errors;
|
|
13432
|
+
}
|
|
13433
|
+
function keywordErrorsConfig(emSchema) {
|
|
13434
|
+
let propErrors;
|
|
13435
|
+
let errors;
|
|
13436
|
+
for (const k in emSchema) {
|
|
13437
|
+
if (k === "properties" || k === "items")
|
|
13438
|
+
continue;
|
|
13439
|
+
const kwdSch = emSchema[k];
|
|
13440
|
+
if (typeof kwdSch == "object") {
|
|
13441
|
+
propErrors || (propErrors = {});
|
|
13442
|
+
const errMap = (propErrors[k] = {});
|
|
13443
|
+
for (const p in kwdSch)
|
|
13444
|
+
errMap[p] = [];
|
|
13445
|
+
}
|
|
13446
|
+
else {
|
|
13447
|
+
errors || (errors = {});
|
|
13448
|
+
errors[k] = [];
|
|
13449
|
+
}
|
|
13450
|
+
}
|
|
13451
|
+
return [propErrors, errors];
|
|
13452
|
+
}
|
|
13453
|
+
function processKeywordErrors(kwdErrors) {
|
|
13454
|
+
const kwdErrs = gen.const("emErrors", ajv_1.stringify(kwdErrors));
|
|
13455
|
+
const templates = gen.const("templates", getTemplatesCode(kwdErrors, schema));
|
|
13456
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(matchKeywordError(err, kwdErrs), () => gen.code(ajv_1._ `${kwdErrs}[${err}.keyword].push(${err})`).assign(ajv_1._ `${err}.${used}`, true)));
|
|
13457
|
+
const { singleError } = options;
|
|
13458
|
+
if (singleError) {
|
|
13459
|
+
const message = gen.let("message", ajv_1._ `""`);
|
|
13460
|
+
const paramsErrors = gen.let("paramsErrors", ajv_1._ `[]`);
|
|
13461
|
+
loopErrors((key) => {
|
|
13462
|
+
gen.if(message, () => gen.code(ajv_1._ `${message} += ${typeof singleError == "string" ? singleError : ";"}`));
|
|
13463
|
+
gen.code(ajv_1._ `${message} += ${errMessage(key)}`);
|
|
13464
|
+
gen.assign(paramsErrors, ajv_1._ `${paramsErrors}.concat(${kwdErrs}[${key}])`);
|
|
13465
|
+
});
|
|
13466
|
+
errors_1.reportError(cxt, { message, params: ajv_1._ `{errors: ${paramsErrors}}` });
|
|
13467
|
+
}
|
|
13468
|
+
else {
|
|
13469
|
+
loopErrors((key) => errors_1.reportError(cxt, {
|
|
13470
|
+
message: errMessage(key),
|
|
13471
|
+
params: ajv_1._ `{errors: ${kwdErrs}[${key}]}`,
|
|
13472
|
+
}));
|
|
13473
|
+
}
|
|
13474
|
+
function loopErrors(body) {
|
|
13475
|
+
gen.forIn("key", kwdErrs, (key) => gen.if(ajv_1._ `${kwdErrs}[${key}].length`, () => body(key)));
|
|
13476
|
+
}
|
|
13477
|
+
function errMessage(key) {
|
|
13478
|
+
return ajv_1._ `${key} in ${templates} ? ${templates}[${key}]() : ${schemaValue}[${key}]`;
|
|
13479
|
+
}
|
|
13480
|
+
}
|
|
13481
|
+
function processKeywordPropErrors(kwdPropErrors) {
|
|
13482
|
+
const kwdErrs = gen.const("emErrors", ajv_1.stringify(kwdPropErrors));
|
|
13483
|
+
const templatesCode = [];
|
|
13484
|
+
for (const k in kwdPropErrors) {
|
|
13485
|
+
templatesCode.push([
|
|
13486
|
+
k,
|
|
13487
|
+
getTemplatesCode(kwdPropErrors[k], schema[k]),
|
|
13488
|
+
]);
|
|
13489
|
+
}
|
|
13490
|
+
const templates = gen.const("templates", gen.object(...templatesCode));
|
|
13491
|
+
const kwdPropParams = gen.scopeValue("obj", {
|
|
13492
|
+
ref: KEYWORD_PROPERTY_PARAMS,
|
|
13493
|
+
code: ajv_1.stringify(KEYWORD_PROPERTY_PARAMS),
|
|
13494
|
+
});
|
|
13495
|
+
const propParam = gen.let("emPropParams");
|
|
13496
|
+
const paramsErrors = gen.let("emParamsErrors");
|
|
13497
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(matchKeywordError(err, kwdErrs), () => {
|
|
13498
|
+
gen.assign(propParam, ajv_1._ `${kwdPropParams}[${err}.keyword]`);
|
|
13499
|
+
gen.assign(paramsErrors, ajv_1._ `${kwdErrs}[${err}.keyword][${err}.params[${propParam}]]`);
|
|
13500
|
+
gen.if(paramsErrors, () => gen.code(ajv_1._ `${paramsErrors}.push(${err})`).assign(ajv_1._ `${err}.${used}`, true));
|
|
13501
|
+
}));
|
|
13502
|
+
gen.forIn("key", kwdErrs, (key) => gen.forIn("keyProp", ajv_1._ `${kwdErrs}[${key}]`, (keyProp) => {
|
|
13503
|
+
gen.assign(paramsErrors, ajv_1._ `${kwdErrs}[${key}][${keyProp}]`);
|
|
13504
|
+
gen.if(ajv_1._ `${paramsErrors}.length`, () => {
|
|
13505
|
+
const tmpl = gen.const("tmpl", ajv_1._ `${templates}[${key}] && ${templates}[${key}][${keyProp}]`);
|
|
13506
|
+
errors_1.reportError(cxt, {
|
|
13507
|
+
message: ajv_1._ `${tmpl} ? ${tmpl}() : ${schemaValue}[${key}][${keyProp}]`,
|
|
13508
|
+
params: ajv_1._ `{errors: ${paramsErrors}}`,
|
|
13509
|
+
});
|
|
13510
|
+
});
|
|
13511
|
+
}));
|
|
13512
|
+
}
|
|
13513
|
+
function processChildErrors(childErrors) {
|
|
13514
|
+
const { props, items } = childErrors;
|
|
13515
|
+
if (!props && !items)
|
|
13516
|
+
return;
|
|
13517
|
+
const isObj = ajv_1._ `typeof ${data} == "object"`;
|
|
13518
|
+
const isArr = ajv_1._ `Array.isArray(${data})`;
|
|
13519
|
+
const childErrs = gen.let("emErrors");
|
|
13520
|
+
let childKwd;
|
|
13521
|
+
let childProp;
|
|
13522
|
+
const templates = gen.let("templates");
|
|
13523
|
+
if (props && items) {
|
|
13524
|
+
childKwd = gen.let("emChildKwd");
|
|
13525
|
+
gen.if(isObj);
|
|
13526
|
+
gen.if(isArr, () => {
|
|
13527
|
+
init(items, schema.items);
|
|
13528
|
+
gen.assign(childKwd, ajv_1.str `items`);
|
|
13529
|
+
}, () => {
|
|
13530
|
+
init(props, schema.properties);
|
|
13531
|
+
gen.assign(childKwd, ajv_1.str `properties`);
|
|
13532
|
+
});
|
|
13533
|
+
childProp = ajv_1._ `[${childKwd}]`;
|
|
13534
|
+
}
|
|
13535
|
+
else if (items) {
|
|
13536
|
+
gen.if(isArr);
|
|
13537
|
+
init(items, schema.items);
|
|
13538
|
+
childProp = ajv_1._ `.items`;
|
|
13539
|
+
}
|
|
13540
|
+
else if (props) {
|
|
13541
|
+
gen.if(codegen_1.and(isObj, codegen_1.not(isArr)));
|
|
13542
|
+
init(props, schema.properties);
|
|
13543
|
+
childProp = ajv_1._ `.properties`;
|
|
13544
|
+
}
|
|
13545
|
+
gen.forOf("err", names_1.default.vErrors, (err) => ifMatchesChildError(err, childErrs, (child) => gen.code(ajv_1._ `${childErrs}[${child}].push(${err})`).assign(ajv_1._ `${err}.${used}`, true)));
|
|
13546
|
+
gen.forIn("key", childErrs, (key) => gen.if(ajv_1._ `${childErrs}[${key}].length`, () => {
|
|
13547
|
+
errors_1.reportError(cxt, {
|
|
13548
|
+
message: ajv_1._ `${key} in ${templates} ? ${templates}[${key}]() : ${schemaValue}${childProp}[${key}]`,
|
|
13549
|
+
params: ajv_1._ `{errors: ${childErrs}[${key}]}`,
|
|
13550
|
+
});
|
|
13551
|
+
gen.assign(ajv_1._ `${names_1.default.vErrors}[${names_1.default.errors}-1].instancePath`, ajv_1._ `${instancePath} + "/" + ${key}.replace(/~/g, "~0").replace(/\\//g, "~1")`);
|
|
13552
|
+
}));
|
|
13553
|
+
gen.endIf();
|
|
13554
|
+
function init(children, msgs) {
|
|
13555
|
+
gen.assign(childErrs, ajv_1.stringify(children));
|
|
13556
|
+
gen.assign(templates, getTemplatesCode(children, msgs));
|
|
13557
|
+
}
|
|
13558
|
+
}
|
|
13559
|
+
function processAllErrors(schMessage) {
|
|
13560
|
+
const errs = gen.const("emErrs", ajv_1._ `[]`);
|
|
13561
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(matchAnyError(err), () => gen.code(ajv_1._ `${errs}.push(${err})`).assign(ajv_1._ `${err}.${used}`, true)));
|
|
13562
|
+
gen.if(ajv_1._ `${errs}.length`, () => errors_1.reportError(cxt, {
|
|
13563
|
+
message: templateExpr(schMessage),
|
|
13564
|
+
params: ajv_1._ `{errors: ${errs}}`,
|
|
13565
|
+
}));
|
|
13566
|
+
}
|
|
13567
|
+
function removeUsedErrors() {
|
|
13568
|
+
const errs = gen.const("emErrs", ajv_1._ `[]`);
|
|
13569
|
+
gen.forOf("err", names_1.default.vErrors, (err) => gen.if(ajv_1._ `!${err}.${used}`, () => gen.code(ajv_1._ `${errs}.push(${err})`)));
|
|
13570
|
+
gen.assign(names_1.default.vErrors, errs).assign(names_1.default.errors, ajv_1._ `${errs}.length`);
|
|
13571
|
+
}
|
|
13572
|
+
function matchKeywordError(err, kwdErrs) {
|
|
13573
|
+
return codegen_1.and(ajv_1._ `${err}.keyword !== ${keyword}`, ajv_1._ `!${err}.${used}`, ajv_1._ `${err}.instancePath === ${instancePath}`, ajv_1._ `${err}.keyword in ${kwdErrs}`,
|
|
13574
|
+
// TODO match the end of the string?
|
|
13575
|
+
ajv_1._ `${err}.schemaPath.indexOf(${it.errSchemaPath}) === 0`, ajv_1._ `/^\\/[^\\/]*$/.test(${err}.schemaPath.slice(${it.errSchemaPath.length}))`);
|
|
13576
|
+
}
|
|
13577
|
+
function ifMatchesChildError(err, childErrs, thenBody) {
|
|
13578
|
+
gen.if(codegen_1.and(ajv_1._ `${err}.keyword !== ${keyword}`, ajv_1._ `!${err}.${used}`, ajv_1._ `${err}.instancePath.indexOf(${instancePath}) === 0`), () => {
|
|
13579
|
+
const childRegex = gen.scopeValue("pattern", {
|
|
13580
|
+
ref: /^\/([^/]*)(?:\/|$)/,
|
|
13581
|
+
code: ajv_1._ `new RegExp("^\\\/([^/]*)(?:\\\/|$)")`,
|
|
13582
|
+
});
|
|
13583
|
+
const matches = gen.const("emMatches", ajv_1._ `${childRegex}.exec(${err}.instancePath.slice(${instancePath}.length))`);
|
|
13584
|
+
const child = gen.const("emChild", ajv_1._ `${matches} && ${matches}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);
|
|
13585
|
+
gen.if(ajv_1._ `${child} !== undefined && ${child} in ${childErrs}`, () => thenBody(child));
|
|
13586
|
+
});
|
|
13587
|
+
}
|
|
13588
|
+
function matchAnyError(err) {
|
|
13589
|
+
return codegen_1.and(ajv_1._ `${err}.keyword !== ${keyword}`, ajv_1._ `!${err}.${used}`, codegen_1.or(ajv_1._ `${err}.instancePath === ${instancePath}`, codegen_1.and(ajv_1._ `${err}.instancePath.indexOf(${instancePath}) === 0`, ajv_1._ `${err}.instancePath[${instancePath}.length] === "/"`)), ajv_1._ `${err}.schemaPath.indexOf(${it.errSchemaPath}) === 0`, ajv_1._ `${err}.schemaPath[${it.errSchemaPath}.length] === "/"`);
|
|
13590
|
+
}
|
|
13591
|
+
function getTemplatesCode(keys, msgs) {
|
|
13592
|
+
const templatesCode = [];
|
|
13593
|
+
for (const k in keys) {
|
|
13594
|
+
const msg = msgs[k];
|
|
13595
|
+
if (INTERPOLATION.test(msg))
|
|
13596
|
+
templatesCode.push([k, templateFunc(msg)]);
|
|
13597
|
+
}
|
|
13598
|
+
return gen.object(...templatesCode);
|
|
13599
|
+
}
|
|
13600
|
+
function templateExpr(msg) {
|
|
13601
|
+
if (!INTERPOLATION.test(msg))
|
|
13602
|
+
return ajv_1.stringify(msg);
|
|
13603
|
+
return new code_1._Code(code_1.safeStringify(msg)
|
|
13604
|
+
.replace(INTERPOLATION_REPLACE, (_s, ptr) => `" + JSON.stringify(${validate_1.getData(ptr, it)}) + "`)
|
|
13605
|
+
.replace(EMPTY_STR, ""));
|
|
13606
|
+
}
|
|
13607
|
+
function templateFunc(msg) {
|
|
13608
|
+
return ajv_1._ `function(){return ${templateExpr(msg)}}`;
|
|
13609
|
+
}
|
|
13610
|
+
},
|
|
13611
|
+
metaSchema: {
|
|
13612
|
+
anyOf: [
|
|
13613
|
+
{ type: "string" },
|
|
13614
|
+
{
|
|
13615
|
+
type: "object",
|
|
13616
|
+
properties: {
|
|
13617
|
+
properties: { $ref: "#/$defs/stringMap" },
|
|
13618
|
+
items: { $ref: "#/$defs/stringList" },
|
|
13619
|
+
required: { $ref: "#/$defs/stringOrMap" },
|
|
13620
|
+
dependencies: { $ref: "#/$defs/stringOrMap" },
|
|
13621
|
+
},
|
|
13622
|
+
additionalProperties: { type: "string" },
|
|
13623
|
+
},
|
|
13624
|
+
],
|
|
13625
|
+
$defs: {
|
|
13626
|
+
stringMap: {
|
|
13627
|
+
type: "object",
|
|
13628
|
+
additionalProperties: { type: "string" },
|
|
13629
|
+
},
|
|
13630
|
+
stringOrMap: {
|
|
13631
|
+
anyOf: [{ type: "string" }, { $ref: "#/$defs/stringMap" }],
|
|
13632
|
+
},
|
|
13633
|
+
stringList: { type: "array", items: { type: "string" } },
|
|
13634
|
+
},
|
|
13635
|
+
},
|
|
13636
|
+
};
|
|
13637
|
+
}
|
|
13638
|
+
const ajvErrors = (ajv, options = {}) => {
|
|
13639
|
+
if (!ajv.opts.allErrors)
|
|
13640
|
+
throw new Error("ajv-errors: Ajv option allErrors must be true");
|
|
13641
|
+
if (ajv.opts.jsPropertySyntax) {
|
|
13642
|
+
throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");
|
|
13643
|
+
}
|
|
13644
|
+
return ajv.addKeyword(errorMessage(options));
|
|
13645
|
+
};
|
|
13646
|
+
exports["default"] = ajvErrors;
|
|
13647
|
+
module.exports = ajvErrors;
|
|
13648
|
+
module.exports["default"] = ajvErrors;
|
|
13649
|
+
//# sourceMappingURL=index.js.map
|
|
13650
|
+
|
|
13651
|
+
/***/ }),
|
|
13652
|
+
|
|
13255
13653
|
/***/ "./node_modules/ajv-formats/dist/formats.js":
|
|
13256
13654
|
/*!**************************************************!*\
|
|
13257
13655
|
!*** ./node_modules/ajv-formats/dist/formats.js ***!
|