@nmshd/runtime 1.0.8 → 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/Runtime.d.ts +1 -1
- package/dist/Runtime.js +3 -4
- package/dist/Runtime.js.map +1 -1
- package/dist/buildInformation.js +5 -5
- package/dist/events/DataEvent.d.ts +2 -1
- package/dist/events/DataEvent.js +2 -1
- package/dist/events/DataEvent.js.map +1 -1
- package/dist/events/consumption/MailReceivedEvent.d.ts +1 -1
- package/dist/events/consumption/MailReceivedEvent.js +2 -2
- package/dist/events/consumption/MailReceivedEvent.js.map +1 -1
- package/dist/events/consumption/RelationshipEvent.d.ts +1 -1
- package/dist/events/consumption/RelationshipEvent.js +2 -2
- package/dist/events/consumption/RelationshipEvent.js.map +1 -1
- package/dist/events/consumption/RequestMailReceivedEvent.d.ts +1 -1
- package/dist/events/consumption/RequestMailReceivedEvent.js +2 -2
- package/dist/events/consumption/RequestMailReceivedEvent.js.map +1 -1
- package/dist/events/consumption/RequestReceivedEvent.d.ts +1 -1
- package/dist/events/consumption/RequestReceivedEvent.js +2 -2
- package/dist/events/consumption/RequestReceivedEvent.js.map +1 -1
- package/dist/events/index.d.ts +1 -0
- package/dist/events/index.js +1 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/transport/MessageDeliveredEvent.d.ts +1 -1
- package/dist/events/transport/MessageDeliveredEvent.js +2 -2
- package/dist/events/transport/MessageDeliveredEvent.js.map +1 -1
- package/dist/events/transport/MessageReceivedEvent.d.ts +1 -1
- package/dist/events/transport/MessageReceivedEvent.js +2 -2
- package/dist/events/transport/MessageReceivedEvent.js.map +1 -1
- package/dist/events/transport/MessageSentEvent.d.ts +6 -0
- package/dist/events/transport/MessageSentEvent.js +12 -0
- package/dist/events/transport/MessageSentEvent.js.map +1 -0
- package/dist/events/transport/RelationshipChangeReceivedEvent.d.ts +1 -1
- package/dist/events/transport/RelationshipChangeReceivedEvent.js +2 -2
- package/dist/events/transport/RelationshipChangeReceivedEvent.js.map +1 -1
- package/dist/events/transport/RelationshipChangedEvent.d.ts +1 -1
- package/dist/events/transport/RelationshipChangedEvent.js +2 -2
- package/dist/events/transport/RelationshipChangedEvent.js.map +1 -1
- package/dist/extensibility/facades/transport/AccountFacade.d.ts +4 -2
- package/dist/extensibility/facades/transport/AccountFacade.js +7 -1
- package/dist/extensibility/facades/transport/AccountFacade.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/MessageModule.js +4 -4
- package/dist/modules/MessageModule.js.map +1 -1
- package/dist/types/transport/RelationshipDTO.d.ts +9 -1
- package/dist/types/transport/RelationshipDTO.js +10 -0
- package/dist/types/transport/RelationshipDTO.js.map +1 -1
- 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 -1580
- package/dist/useCases/common/Schemas.js +198 -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/account/RegisterPushNotificationToken.d.ts +17 -0
- package/dist/useCases/transport/account/RegisterPushNotificationToken.js +54 -0
- package/dist/useCases/transport/account/RegisterPushNotificationToken.js.map +1 -0
- package/dist/useCases/transport/account/SyncEverything.d.ts +4 -4
- package/dist/useCases/transport/account/SyncEverything.js +14 -9
- package/dist/useCases/transport/account/SyncEverything.js.map +1 -1
- package/dist/useCases/transport/account/index.d.ts +1 -0
- package/dist/useCases/transport/account/index.js +1 -0
- package/dist/useCases/transport/account/index.js.map +1 -1
- 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/dist/useCases/transport/messages/SendMessage.d.ts +5 -3
- package/dist/useCases/transport/messages/SendMessage.js +10 -1
- package/dist/useCases/transport/messages/SendMessage.js.map +1 -1
- package/dist/useCases/transport/relationships/AcceptRelationshipChange.d.ts +5 -3
- package/dist/useCases/transport/relationships/AcceptRelationshipChange.js +12 -3
- package/dist/useCases/transport/relationships/AcceptRelationshipChange.js.map +1 -1
- package/dist/useCases/transport/relationships/CreateRelationship.d.ts +5 -3
- package/dist/useCases/transport/relationships/CreateRelationship.js +11 -2
- package/dist/useCases/transport/relationships/CreateRelationship.js.map +1 -1
- package/dist/useCases/transport/relationships/RejectRelationshipChange.d.ts +5 -3
- package/dist/useCases/transport/relationships/RejectRelationshipChange.js +12 -3
- package/dist/useCases/transport/relationships/RejectRelationshipChange.js.map +1 -1
- package/dist/useCases/transport/relationships/RevokeRelationshipChange.d.ts +5 -3
- package/dist/useCases/transport/relationships/RevokeRelationshipChange.js +12 -3
- package/dist/useCases/transport/relationships/RevokeRelationshipChange.js.map +1 -1
- package/lib-web/nmshd.runtime.js +782 -365
- 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 +17 -17
- package/dist/eventBus/EventBus.d.ts +0 -14
- package/dist/eventBus/EventBus.js +0 -11
- package/dist/eventBus/EventBus.js.map +0 -1
- package/dist/eventBus/SubscriptionTargetInfo.d.ts +0 -6
- package/dist/eventBus/SubscriptionTargetInfo.js +0 -36
- package/dist/eventBus/SubscriptionTargetInfo.js.map +0 -1
- package/dist/eventBus/eventEmitter2/EventEmitter2EventBus.d.ts +0 -15
- package/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js +0 -58
- package/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js.map +0 -1
- package/dist/eventBus/index.d.ts +0 -2
- package/dist/eventBus/index.js +0 -15
- package/dist/eventBus/index.js.map +0 -1
- package/dist/eventBus/reflection/Constants.d.ts +0 -1
- package/dist/eventBus/reflection/Constants.js +0 -5
- package/dist/eventBus/reflection/Constants.js.map +0 -1
- package/dist/eventBus/reflection/Reflection.d.ts +0 -5
- package/dist/eventBus/reflection/Reflection.js +0 -21
- package/dist/eventBus/reflection/Reflection.js.map +0 -1
- 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
|
@@ -12,12 +12,11 @@ var NMSHDRuntime;
|
|
|
12
12
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14
14
|
exports.Runtime = void 0;
|
|
15
|
+
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
15
16
|
const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
|
|
16
17
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
17
18
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
18
19
|
const dataViews_1 = __webpack_require__(/*! ./dataViews */ "./dist/dataViews/index.js");
|
|
19
|
-
const eventBus_1 = __webpack_require__(/*! ./eventBus */ "./dist/eventBus/index.js");
|
|
20
|
-
const EventEmitter2EventBus_1 = __webpack_require__(/*! ./eventBus/eventEmitter2/EventEmitter2EventBus */ "./dist/eventBus/eventEmitter2/EventEmitter2EventBus.js");
|
|
21
20
|
const events_1 = __webpack_require__(/*! ./events */ "./dist/events/index.js");
|
|
22
21
|
const extensibility_1 = __webpack_require__(/*! ./extensibility */ "./dist/extensibility/index.js");
|
|
23
22
|
const RuntimeLoggerFactory_1 = __webpack_require__(/*! ./RuntimeLoggerFactory */ "./dist/RuntimeLoggerFactory.js");
|
|
@@ -28,7 +27,7 @@ class Runtime {
|
|
|
28
27
|
this._isInitialized = false;
|
|
29
28
|
this._isStarted = false;
|
|
30
29
|
this.runtimeConfig = config;
|
|
31
|
-
this._eventBus = new
|
|
30
|
+
this._eventBus = new ts_utils_1.EventEmitter2EventBus();
|
|
32
31
|
}
|
|
33
32
|
isLoggedIn() {
|
|
34
33
|
return !!this._accountController;
|
|
@@ -114,7 +113,7 @@ class Runtime {
|
|
|
114
113
|
this.eventBus.publish(new events_1.TransportLibraryInitializedEvent());
|
|
115
114
|
}
|
|
116
115
|
async initDIContainer() {
|
|
117
|
-
typescript_ioc_1.Container.bind(
|
|
116
|
+
typescript_ioc_1.Container.bind(ts_utils_1.EventBus)
|
|
118
117
|
.factory(() => this.eventBus)
|
|
119
118
|
.scope(typescript_ioc_1.Scope.Singleton);
|
|
120
119
|
typescript_ioc_1.Container.bind(RuntimeLoggerFactory_1.RuntimeLoggerFactory)
|
|
@@ -331,11 +330,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
331
330
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
332
331
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
333
332
|
exports.buildInformation = {
|
|
334
|
-
version: "1.
|
|
335
|
-
build: "
|
|
336
|
-
date: "2021-
|
|
337
|
-
commit: "
|
|
338
|
-
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"},
|
|
339
338
|
libraries: {
|
|
340
339
|
serval: ts_serval_1.buildInformation,
|
|
341
340
|
consumption: consumption_1.buildInformation,
|
|
@@ -1149,166 +1148,6 @@ __exportStar(__webpack_require__(/*! ./RelationshipTemplateDVO */ "./dist/dataVi
|
|
|
1149
1148
|
|
|
1150
1149
|
/***/ }),
|
|
1151
1150
|
|
|
1152
|
-
/***/ "./dist/eventBus/EventBus.js":
|
|
1153
|
-
/*!***********************************!*\
|
|
1154
|
-
!*** ./dist/eventBus/EventBus.js ***!
|
|
1155
|
-
\***********************************/
|
|
1156
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
1157
|
-
|
|
1158
|
-
"use strict";
|
|
1159
|
-
|
|
1160
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1161
|
-
exports.getEventNamespaceFromObject = exports.EventBus = void 0;
|
|
1162
|
-
class EventBus {
|
|
1163
|
-
}
|
|
1164
|
-
exports.EventBus = EventBus;
|
|
1165
|
-
function getEventNamespaceFromObject(targetObject) {
|
|
1166
|
-
return targetObject.namespace;
|
|
1167
|
-
}
|
|
1168
|
-
exports.getEventNamespaceFromObject = getEventNamespaceFromObject;
|
|
1169
|
-
//# sourceMappingURL=EventBus.js.map
|
|
1170
|
-
|
|
1171
|
-
/***/ }),
|
|
1172
|
-
|
|
1173
|
-
/***/ "./dist/eventBus/SubscriptionTargetInfo.js":
|
|
1174
|
-
/*!*************************************************!*\
|
|
1175
|
-
!*** ./dist/eventBus/SubscriptionTargetInfo.js ***!
|
|
1176
|
-
\*************************************************/
|
|
1177
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
1178
|
-
|
|
1179
|
-
"use strict";
|
|
1180
|
-
|
|
1181
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1182
|
-
exports.SubscriptionTargetInfo = void 0;
|
|
1183
|
-
class SubscriptionTargetInfo {
|
|
1184
|
-
constructor(namespace) {
|
|
1185
|
-
this.namespace = namespace;
|
|
1186
|
-
}
|
|
1187
|
-
static from(target) {
|
|
1188
|
-
if (target instanceof Function) {
|
|
1189
|
-
return new ConstructorSubscriptionTargetInfo(target);
|
|
1190
|
-
}
|
|
1191
|
-
return new NamespaceSubscriptionTargetInfo(target);
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
exports.SubscriptionTargetInfo = SubscriptionTargetInfo;
|
|
1195
|
-
class ConstructorSubscriptionTargetInfo extends SubscriptionTargetInfo {
|
|
1196
|
-
constructor(constructorFunction) {
|
|
1197
|
-
super(getEventNamespaceFromClass(constructorFunction));
|
|
1198
|
-
this.constructorFunction = constructorFunction;
|
|
1199
|
-
}
|
|
1200
|
-
isCompatibleWith(event) {
|
|
1201
|
-
return event instanceof this.constructorFunction;
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
class NamespaceSubscriptionTargetInfo extends SubscriptionTargetInfo {
|
|
1205
|
-
constructor(namespace) {
|
|
1206
|
-
super(namespace);
|
|
1207
|
-
}
|
|
1208
|
-
isCompatibleWith(_event) {
|
|
1209
|
-
return true;
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
function getEventNamespaceFromClass(targetClass) {
|
|
1213
|
-
return targetClass.namespace;
|
|
1214
|
-
}
|
|
1215
|
-
//# sourceMappingURL=SubscriptionTargetInfo.js.map
|
|
1216
|
-
|
|
1217
|
-
/***/ }),
|
|
1218
|
-
|
|
1219
|
-
/***/ "./dist/eventBus/eventEmitter2/EventEmitter2EventBus.js":
|
|
1220
|
-
/*!**************************************************************!*\
|
|
1221
|
-
!*** ./dist/eventBus/eventEmitter2/EventEmitter2EventBus.js ***!
|
|
1222
|
-
\**************************************************************/
|
|
1223
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1224
|
-
|
|
1225
|
-
"use strict";
|
|
1226
|
-
|
|
1227
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1228
|
-
exports.EventEmitter2EventBus = void 0;
|
|
1229
|
-
const eventemitter2_1 = __webpack_require__(/*! eventemitter2 */ "./node_modules/eventemitter2/lib/eventemitter2.js");
|
|
1230
|
-
__webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
|
|
1231
|
-
const EventBus_1 = __webpack_require__(/*! ../EventBus */ "./dist/eventBus/EventBus.js");
|
|
1232
|
-
const SubscriptionTargetInfo_1 = __webpack_require__(/*! ../SubscriptionTargetInfo */ "./dist/eventBus/SubscriptionTargetInfo.js");
|
|
1233
|
-
class EventEmitter2EventBus {
|
|
1234
|
-
constructor() {
|
|
1235
|
-
this.wrappers = new Map();
|
|
1236
|
-
this.nextId = 0;
|
|
1237
|
-
this.emitter = new eventemitter2_1.EventEmitter2({ wildcard: true, maxListeners: 50, verboseMemoryLeak: true });
|
|
1238
|
-
}
|
|
1239
|
-
subscribe(subscriptionTarget, handler) {
|
|
1240
|
-
return this.registerHandler(subscriptionTarget, handler);
|
|
1241
|
-
}
|
|
1242
|
-
subscribeOnce(subscriptionTarget, handler) {
|
|
1243
|
-
return this.registerHandler(subscriptionTarget, handler, true);
|
|
1244
|
-
}
|
|
1245
|
-
unsubscribe(subscriptionTarget, subscriptionId) {
|
|
1246
|
-
return this.unregisterHandler(subscriptionTarget, subscriptionId);
|
|
1247
|
-
}
|
|
1248
|
-
registerHandler(subscriptionTarget, handler, isOneTimeHandler = false) {
|
|
1249
|
-
const subscriptionTargetInfo = SubscriptionTargetInfo_1.SubscriptionTargetInfo.from(subscriptionTarget);
|
|
1250
|
-
const handlerId = this.nextId++;
|
|
1251
|
-
const handlerWrapper = (event) => {
|
|
1252
|
-
if (!subscriptionTargetInfo.isCompatibleWith(event)) {
|
|
1253
|
-
return;
|
|
1254
|
-
}
|
|
1255
|
-
handler(event);
|
|
1256
|
-
if (isOneTimeHandler) {
|
|
1257
|
-
this.unsubscribe(subscriptionTarget, handlerId);
|
|
1258
|
-
}
|
|
1259
|
-
};
|
|
1260
|
-
this.wrappers.set(handlerId, handlerWrapper);
|
|
1261
|
-
this.emitter.on(subscriptionTargetInfo.namespace, handlerWrapper);
|
|
1262
|
-
return handlerId;
|
|
1263
|
-
}
|
|
1264
|
-
unregisterHandler(subscriptionTarget, handlerId) {
|
|
1265
|
-
const subscriptionTargetInfo = SubscriptionTargetInfo_1.SubscriptionTargetInfo.from(subscriptionTarget);
|
|
1266
|
-
const handlerWrapper = this.wrappers.get(handlerId);
|
|
1267
|
-
if (!handlerWrapper) {
|
|
1268
|
-
return false;
|
|
1269
|
-
}
|
|
1270
|
-
this.emitter.off(subscriptionTargetInfo.namespace, handlerWrapper);
|
|
1271
|
-
this.wrappers.delete(handlerId);
|
|
1272
|
-
return true;
|
|
1273
|
-
}
|
|
1274
|
-
publish(event) {
|
|
1275
|
-
const namespace = (0, EventBus_1.getEventNamespaceFromObject)(event);
|
|
1276
|
-
if (!namespace) {
|
|
1277
|
-
throw Error("The event needs a namespace. Use the EventNamespace-decorator in order to define a namespace for a event.");
|
|
1278
|
-
}
|
|
1279
|
-
this.emitter.emit(namespace, event);
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
exports.EventEmitter2EventBus = EventEmitter2EventBus;
|
|
1283
|
-
//# sourceMappingURL=EventEmitter2EventBus.js.map
|
|
1284
|
-
|
|
1285
|
-
/***/ }),
|
|
1286
|
-
|
|
1287
|
-
/***/ "./dist/eventBus/index.js":
|
|
1288
|
-
/*!********************************!*\
|
|
1289
|
-
!*** ./dist/eventBus/index.js ***!
|
|
1290
|
-
\********************************/
|
|
1291
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1292
|
-
|
|
1293
|
-
"use strict";
|
|
1294
|
-
|
|
1295
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1296
|
-
if (k2 === undefined) k2 = k;
|
|
1297
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
1298
|
-
}) : (function(o, m, k, k2) {
|
|
1299
|
-
if (k2 === undefined) k2 = k;
|
|
1300
|
-
o[k2] = m[k];
|
|
1301
|
-
}));
|
|
1302
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1303
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1304
|
-
};
|
|
1305
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1306
|
-
__exportStar(__webpack_require__(/*! ./EventBus */ "./dist/eventBus/EventBus.js"), exports);
|
|
1307
|
-
__exportStar(__webpack_require__(/*! ./eventEmitter2/EventEmitter2EventBus */ "./dist/eventBus/eventEmitter2/EventEmitter2EventBus.js"), exports);
|
|
1308
|
-
//# sourceMappingURL=index.js.map
|
|
1309
|
-
|
|
1310
|
-
/***/ }),
|
|
1311
|
-
|
|
1312
1151
|
/***/ "./dist/events/DataEvent.js":
|
|
1313
1152
|
/*!**********************************!*\
|
|
1314
1153
|
!*** ./dist/events/DataEvent.js ***!
|
|
@@ -1321,8 +1160,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1321
1160
|
exports.DataEvent = void 0;
|
|
1322
1161
|
const Event_1 = __webpack_require__(/*! ./Event */ "./dist/events/Event.js");
|
|
1323
1162
|
class DataEvent extends Event_1.Event {
|
|
1324
|
-
constructor(namespace, data) {
|
|
1163
|
+
constructor(namespace, eventTargetAddress, data) {
|
|
1325
1164
|
super(namespace);
|
|
1165
|
+
this.eventTargetAddress = eventTargetAddress;
|
|
1326
1166
|
this.data = data;
|
|
1327
1167
|
}
|
|
1328
1168
|
}
|
|
@@ -1363,8 +1203,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1363
1203
|
exports.MailReceivedEvent = void 0;
|
|
1364
1204
|
const DataEvent_1 = __webpack_require__(/*! ../DataEvent */ "./dist/events/DataEvent.js");
|
|
1365
1205
|
class MailReceivedEvent extends DataEvent_1.DataEvent {
|
|
1366
|
-
constructor(mail, data) {
|
|
1367
|
-
super(MailReceivedEvent.namespace, data);
|
|
1206
|
+
constructor(eventTargetAddress, mail, data) {
|
|
1207
|
+
super(MailReceivedEvent.namespace, eventTargetAddress, data);
|
|
1368
1208
|
this.mail = mail;
|
|
1369
1209
|
}
|
|
1370
1210
|
}
|
|
@@ -1386,8 +1226,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1386
1226
|
exports.RelationshipEvent = void 0;
|
|
1387
1227
|
const DataEvent_1 = __webpack_require__(/*! ../DataEvent */ "./dist/events/DataEvent.js");
|
|
1388
1228
|
class RelationshipEvent extends DataEvent_1.DataEvent {
|
|
1389
|
-
constructor(event, data) {
|
|
1390
|
-
super(RelationshipEvent.namespace + data.id, data);
|
|
1229
|
+
constructor(eventTargetAddress, event, data) {
|
|
1230
|
+
super(RelationshipEvent.namespace + data.id, eventTargetAddress, data);
|
|
1391
1231
|
this.event = event;
|
|
1392
1232
|
}
|
|
1393
1233
|
}
|
|
@@ -1409,8 +1249,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1409
1249
|
exports.RequestMailReceivedEvent = void 0;
|
|
1410
1250
|
const DataEvent_1 = __webpack_require__(/*! ../DataEvent */ "./dist/events/DataEvent.js");
|
|
1411
1251
|
class RequestMailReceivedEvent extends DataEvent_1.DataEvent {
|
|
1412
|
-
constructor(requestMail, data) {
|
|
1413
|
-
super(RequestMailReceivedEvent.namespace, data);
|
|
1252
|
+
constructor(eventTargetAddress, requestMail, data) {
|
|
1253
|
+
super(RequestMailReceivedEvent.namespace, eventTargetAddress, data);
|
|
1414
1254
|
this.requestMail = requestMail;
|
|
1415
1255
|
}
|
|
1416
1256
|
}
|
|
@@ -1432,8 +1272,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1432
1272
|
exports.RequestReceivedEvent = void 0;
|
|
1433
1273
|
const DataEvent_1 = __webpack_require__(/*! ../DataEvent */ "./dist/events/DataEvent.js");
|
|
1434
1274
|
class RequestReceivedEvent extends DataEvent_1.DataEvent {
|
|
1435
|
-
constructor(request, data) {
|
|
1436
|
-
super(RequestReceivedEvent.namespace, data);
|
|
1275
|
+
constructor(eventTargetAddress, request, data) {
|
|
1276
|
+
super(RequestReceivedEvent.namespace, eventTargetAddress, data);
|
|
1437
1277
|
this.request = request;
|
|
1438
1278
|
}
|
|
1439
1279
|
}
|
|
@@ -1470,6 +1310,7 @@ __exportStar(__webpack_require__(/*! ./runtime/ModulesStartedEvent */ "./dist/ev
|
|
|
1470
1310
|
__exportStar(__webpack_require__(/*! ./runtime/RuntimeInitializedEvent */ "./dist/events/runtime/RuntimeInitializedEvent.js"), exports);
|
|
1471
1311
|
__exportStar(__webpack_require__(/*! ./runtime/RuntimeInitializingEvent */ "./dist/events/runtime/RuntimeInitializingEvent.js"), exports);
|
|
1472
1312
|
__exportStar(__webpack_require__(/*! ./transport/MessageReceivedEvent */ "./dist/events/transport/MessageReceivedEvent.js"), exports);
|
|
1313
|
+
__exportStar(__webpack_require__(/*! ./transport/MessageSentEvent */ "./dist/events/transport/MessageSentEvent.js"), exports);
|
|
1473
1314
|
__exportStar(__webpack_require__(/*! ./transport/RelationshipChangedEvent */ "./dist/events/transport/RelationshipChangedEvent.js"), exports);
|
|
1474
1315
|
__exportStar(__webpack_require__(/*! ./transport/TransportLibraryInitializedEvent */ "./dist/events/transport/TransportLibraryInitializedEvent.js"), exports);
|
|
1475
1316
|
__exportStar(__webpack_require__(/*! ./transport/TransportLibraryInitializingEvent */ "./dist/events/transport/TransportLibraryInitializingEvent.js"), exports);
|
|
@@ -1599,8 +1440,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1599
1440
|
exports.MessageReceivedEvent = void 0;
|
|
1600
1441
|
const DataEvent_1 = __webpack_require__(/*! ../DataEvent */ "./dist/events/DataEvent.js");
|
|
1601
1442
|
class MessageReceivedEvent extends DataEvent_1.DataEvent {
|
|
1602
|
-
constructor(data) {
|
|
1603
|
-
super(MessageReceivedEvent.namespace, data);
|
|
1443
|
+
constructor(eventTargetAddress, data) {
|
|
1444
|
+
super(MessageReceivedEvent.namespace, eventTargetAddress, data);
|
|
1604
1445
|
}
|
|
1605
1446
|
}
|
|
1606
1447
|
exports.MessageReceivedEvent = MessageReceivedEvent;
|
|
@@ -1609,6 +1450,28 @@ MessageReceivedEvent.namespace = "transport.messageReceived";
|
|
|
1609
1450
|
|
|
1610
1451
|
/***/ }),
|
|
1611
1452
|
|
|
1453
|
+
/***/ "./dist/events/transport/MessageSentEvent.js":
|
|
1454
|
+
/*!***************************************************!*\
|
|
1455
|
+
!*** ./dist/events/transport/MessageSentEvent.js ***!
|
|
1456
|
+
\***************************************************/
|
|
1457
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1458
|
+
|
|
1459
|
+
"use strict";
|
|
1460
|
+
|
|
1461
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1462
|
+
exports.MessageSentEvent = void 0;
|
|
1463
|
+
const DataEvent_1 = __webpack_require__(/*! ../DataEvent */ "./dist/events/DataEvent.js");
|
|
1464
|
+
class MessageSentEvent extends DataEvent_1.DataEvent {
|
|
1465
|
+
constructor(eventTargetAddress, data) {
|
|
1466
|
+
super(MessageSentEvent.namespace, eventTargetAddress, data);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
exports.MessageSentEvent = MessageSentEvent;
|
|
1470
|
+
MessageSentEvent.namespace = "transport.messageSent";
|
|
1471
|
+
//# sourceMappingURL=MessageSentEvent.js.map
|
|
1472
|
+
|
|
1473
|
+
/***/ }),
|
|
1474
|
+
|
|
1612
1475
|
/***/ "./dist/events/transport/RelationshipChangedEvent.js":
|
|
1613
1476
|
/*!***********************************************************!*\
|
|
1614
1477
|
!*** ./dist/events/transport/RelationshipChangedEvent.js ***!
|
|
@@ -1621,8 +1484,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1621
1484
|
exports.RelationshipChangedEvent = void 0;
|
|
1622
1485
|
const DataEvent_1 = __webpack_require__(/*! ../DataEvent */ "./dist/events/DataEvent.js");
|
|
1623
1486
|
class RelationshipChangedEvent extends DataEvent_1.DataEvent {
|
|
1624
|
-
constructor(data) {
|
|
1625
|
-
super(RelationshipChangedEvent.namespace, data);
|
|
1487
|
+
constructor(eventTargetAddress, data) {
|
|
1488
|
+
super(RelationshipChangedEvent.namespace, eventTargetAddress, data);
|
|
1626
1489
|
}
|
|
1627
1490
|
}
|
|
1628
1491
|
exports.RelationshipChangedEvent = RelationshipChangedEvent;
|
|
@@ -2334,9 +2197,10 @@ exports.AccountFacade = void 0;
|
|
|
2334
2197
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
2335
2198
|
const useCases_1 = __webpack_require__(/*! ../../../useCases */ "./dist/useCases/index.js");
|
|
2336
2199
|
let AccountFacade = class AccountFacade {
|
|
2337
|
-
constructor(getIdentityInfoUseCase, getDeviceInfoUseCase, syncDatawalletUseCase, syncEverythingUseCase, getSyncInfoUseCase, disableAutoSyncUseCase, enableAutoSyncUseCase) {
|
|
2200
|
+
constructor(getIdentityInfoUseCase, getDeviceInfoUseCase, registerPushNotificationTokenUseCase, syncDatawalletUseCase, syncEverythingUseCase, getSyncInfoUseCase, disableAutoSyncUseCase, enableAutoSyncUseCase) {
|
|
2338
2201
|
this.getIdentityInfoUseCase = getIdentityInfoUseCase;
|
|
2339
2202
|
this.getDeviceInfoUseCase = getDeviceInfoUseCase;
|
|
2203
|
+
this.registerPushNotificationTokenUseCase = registerPushNotificationTokenUseCase;
|
|
2340
2204
|
this.syncDatawalletUseCase = syncDatawalletUseCase;
|
|
2341
2205
|
this.syncEverythingUseCase = syncEverythingUseCase;
|
|
2342
2206
|
this.getSyncInfoUseCase = getSyncInfoUseCase;
|
|
@@ -2355,6 +2219,9 @@ let AccountFacade = class AccountFacade {
|
|
|
2355
2219
|
recoverDevice() {
|
|
2356
2220
|
throw useCases_1.RuntimeErrors.general.notImplemented();
|
|
2357
2221
|
}
|
|
2222
|
+
async registerPushNotificationToken(request) {
|
|
2223
|
+
return await this.registerPushNotificationTokenUseCase.execute(request);
|
|
2224
|
+
}
|
|
2358
2225
|
async syncDatawallet() {
|
|
2359
2226
|
return await this.syncDatawalletUseCase.execute();
|
|
2360
2227
|
}
|
|
@@ -2379,8 +2246,10 @@ AccountFacade = __decorate([
|
|
|
2379
2246
|
__param(4, typescript_ioc_1.Inject),
|
|
2380
2247
|
__param(5, typescript_ioc_1.Inject),
|
|
2381
2248
|
__param(6, typescript_ioc_1.Inject),
|
|
2249
|
+
__param(7, typescript_ioc_1.Inject),
|
|
2382
2250
|
__metadata("design:paramtypes", [useCases_1.GetIdentityInfoUseCase,
|
|
2383
2251
|
useCases_1.GetDeviceInfoUseCase,
|
|
2252
|
+
useCases_1.RegisterPushNotificationTokenUseCase,
|
|
2384
2253
|
useCases_1.SyncDatawalletUseCase,
|
|
2385
2254
|
useCases_1.SyncEverythingUseCase,
|
|
2386
2255
|
useCases_1.GetSyncInfoUseCase,
|
|
@@ -3019,7 +2888,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
3019
2888
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3020
2889
|
__exportStar(__webpack_require__(/*! ./buildInformation */ "./dist/buildInformation.js"), exports);
|
|
3021
2890
|
__exportStar(__webpack_require__(/*! ./dataViews */ "./dist/dataViews/index.js"), exports);
|
|
3022
|
-
__exportStar(__webpack_require__(/*! ./eventBus */ "./dist/eventBus/index.js"), exports);
|
|
3023
2891
|
__exportStar(__webpack_require__(/*! ./events */ "./dist/events/index.js"), exports);
|
|
3024
2892
|
__exportStar(__webpack_require__(/*! ./extensibility */ "./dist/extensibility/index.js"), exports);
|
|
3025
2893
|
__exportStar(__webpack_require__(/*! ./modules */ "./dist/modules/index.js"), exports);
|
|
@@ -3064,18 +2932,18 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
3064
2932
|
switch (type) {
|
|
3065
2933
|
case "Mail":
|
|
3066
2934
|
const mail = await content_1.Mail.from(message.content);
|
|
3067
|
-
event = new MailReceivedEvent_1.MailReceivedEvent(mail, message);
|
|
2935
|
+
event = new MailReceivedEvent_1.MailReceivedEvent(messageReceivedEvent.eventTargetAddress, mail, message);
|
|
3068
2936
|
this.runtime.eventBus.publish(event);
|
|
3069
2937
|
this.logger.trace(`Published MailReceivedEvent for ${message.id}`);
|
|
3070
2938
|
break;
|
|
3071
2939
|
case "RequestMail":
|
|
3072
2940
|
const requestMail = await content_1.RequestMail.from(message.content);
|
|
3073
|
-
event = new RequestMailReceivedEvent_1.RequestMailReceivedEvent(requestMail, message);
|
|
2941
|
+
event = new RequestMailReceivedEvent_1.RequestMailReceivedEvent(messageReceivedEvent.eventTargetAddress, requestMail, message);
|
|
3074
2942
|
this.runtime.eventBus.publish(event);
|
|
3075
2943
|
this.logger.trace(`Published RequestMailReceivedEvent for ${message.id}`);
|
|
3076
2944
|
let i = 0;
|
|
3077
2945
|
for (const request of requestMail.requests) {
|
|
3078
|
-
this.runtime.eventBus.publish(new RequestReceivedEvent_1.RequestReceivedEvent(request, message));
|
|
2946
|
+
this.runtime.eventBus.publish(new RequestReceivedEvent_1.RequestReceivedEvent(messageReceivedEvent.eventTargetAddress, request, message));
|
|
3079
2947
|
this.logger.trace(`Published RequestReceivedEvent request #${i} of RequestMail ${message.id}`);
|
|
3080
2948
|
i++;
|
|
3081
2949
|
}
|
|
@@ -3090,7 +2958,7 @@ class MessageModule extends RuntimeModule_1.RuntimeModule {
|
|
|
3090
2958
|
return;
|
|
3091
2959
|
}
|
|
3092
2960
|
const relationship = result.value;
|
|
3093
|
-
this.runtime.eventBus.publish(new RelationshipEvent_1.RelationshipEvent(event, relationship));
|
|
2961
|
+
this.runtime.eventBus.publish(new RelationshipEvent_1.RelationshipEvent(messageReceivedEvent.eventTargetAddress, event, relationship));
|
|
3094
2962
|
this.logger.trace(`Published RelationshipEvent for ${message.id} to ${relationship.id}`);
|
|
3095
2963
|
}
|
|
3096
2964
|
stop() {
|
|
@@ -3413,6 +3281,16 @@ var RelationshipChangeType;
|
|
|
3413
3281
|
"use strict";
|
|
3414
3282
|
|
|
3415
3283
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3284
|
+
exports.RelationshipStatus = void 0;
|
|
3285
|
+
var RelationshipStatus;
|
|
3286
|
+
(function (RelationshipStatus) {
|
|
3287
|
+
RelationshipStatus["Pending"] = "Pending";
|
|
3288
|
+
RelationshipStatus["Active"] = "Active";
|
|
3289
|
+
RelationshipStatus["Rejected"] = "Rejected";
|
|
3290
|
+
RelationshipStatus["Revoked"] = "Revoked";
|
|
3291
|
+
RelationshipStatus["Terminating"] = "Terminating";
|
|
3292
|
+
RelationshipStatus["Terminated"] = "Terminated";
|
|
3293
|
+
})(RelationshipStatus = exports.RelationshipStatus || (exports.RelationshipStatus = {}));
|
|
3416
3294
|
//# sourceMappingURL=RelationshipDTO.js.map
|
|
3417
3295
|
|
|
3418
3296
|
/***/ }),
|
|
@@ -3916,21 +3794,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3916
3794
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3917
3795
|
exports.JsonSchema = exports.SchemaRepository = void 0;
|
|
3918
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"));
|
|
3919
3798
|
const ajv_formats_1 = __importDefault(__webpack_require__(/*! ajv-formats */ "./node_modules/ajv-formats/dist/index.js"));
|
|
3920
3799
|
const customFormats = {
|
|
3921
|
-
fileId: "FIL[A-
|
|
3922
|
-
relationshipId: "REL[A-
|
|
3923
|
-
messageId: "MSG[A-
|
|
3924
|
-
relationshipTemplateId: "RLT[A-
|
|
3925
|
-
tokenId: "TOK[A-
|
|
3926
|
-
relationshipChangeId: "RCH[A-
|
|
3927
|
-
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}"
|
|
3928
3807
|
};
|
|
3929
3808
|
class SchemaRepository {
|
|
3930
3809
|
constructor() {
|
|
3931
3810
|
this.jsonSchemas = new Map();
|
|
3932
|
-
this.compiler = new ajv_1.default();
|
|
3811
|
+
this.compiler = new ajv_1.default({ allErrors: true });
|
|
3933
3812
|
(0, ajv_formats_1.default)(this.compiler);
|
|
3813
|
+
(0, ajv_errors_1.default)(this.compiler);
|
|
3934
3814
|
this.addCustomFormats();
|
|
3935
3815
|
}
|
|
3936
3816
|
addCustomFormats() {
|
|
@@ -3963,7 +3843,7 @@ class JsonSchema {
|
|
|
3963
3843
|
this.validateSchema = validateSchema;
|
|
3964
3844
|
}
|
|
3965
3845
|
validate(obj) {
|
|
3966
|
-
return { isValid: this.validateSchema(obj), errors: this.validateSchema.errors };
|
|
3846
|
+
return { isValid: this.validateSchema(obj), errors: this.validateSchema.errors ? [...this.validateSchema.errors] : undefined };
|
|
3967
3847
|
}
|
|
3968
3848
|
}
|
|
3969
3849
|
exports.JsonSchema = JsonSchema;
|
|
@@ -3971,40 +3851,6 @@ exports.JsonSchema = JsonSchema;
|
|
|
3971
3851
|
|
|
3972
3852
|
/***/ }),
|
|
3973
3853
|
|
|
3974
|
-
/***/ "./dist/useCases/common/SchemaValidator.js":
|
|
3975
|
-
/*!*************************************************!*\
|
|
3976
|
-
!*** ./dist/useCases/common/SchemaValidator.js ***!
|
|
3977
|
-
\*************************************************/
|
|
3978
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3979
|
-
|
|
3980
|
-
"use strict";
|
|
3981
|
-
|
|
3982
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3983
|
-
exports.SchemaValidator = void 0;
|
|
3984
|
-
const fluent_ts_validator_1 = __webpack_require__(/*! fluent-ts-validator */ "./node_modules/fluent-ts-validator/index.js");
|
|
3985
|
-
class SchemaValidator {
|
|
3986
|
-
constructor(schema) {
|
|
3987
|
-
this.schema = schema;
|
|
3988
|
-
}
|
|
3989
|
-
validate(input) {
|
|
3990
|
-
const validationResult = this.schema.validate(input);
|
|
3991
|
-
const result = new fluent_ts_validator_1.ValidationResult();
|
|
3992
|
-
if (validationResult.isValid) {
|
|
3993
|
-
return result;
|
|
3994
|
-
}
|
|
3995
|
-
result.addFailures(validationResult.errors.map(this.schemaErrorToValidationFailure));
|
|
3996
|
-
return result;
|
|
3997
|
-
}
|
|
3998
|
-
schemaErrorToValidationFailure(err, target) {
|
|
3999
|
-
const errorMessage = `${err.instancePath} ${err.message}`.replace(/^\//, "").replace(/"/g, "");
|
|
4000
|
-
return new fluent_ts_validator_1.ValidationFailure(target, err.instancePath, undefined, undefined, errorMessage);
|
|
4001
|
-
}
|
|
4002
|
-
}
|
|
4003
|
-
exports.SchemaValidator = SchemaValidator;
|
|
4004
|
-
//# sourceMappingURL=SchemaValidator.js.map
|
|
4005
|
-
|
|
4006
|
-
/***/ }),
|
|
4007
|
-
|
|
4008
3854
|
/***/ "./dist/useCases/common/Schemas.js":
|
|
4009
3855
|
/*!*****************************************!*\
|
|
4010
3856
|
!*** ./dist/useCases/common/Schemas.js ***!
|
|
@@ -4014,8 +3860,8 @@ exports.SchemaValidator = SchemaValidator;
|
|
|
4014
3860
|
"use strict";
|
|
4015
3861
|
|
|
4016
3862
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4017
|
-
exports.
|
|
4018
|
-
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;
|
|
4019
3865
|
exports.LoadPeerTokenAnonymousByIdAndKeyRequest = {
|
|
4020
3866
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4021
3867
|
"$ref": "#/definitions/LoadPeerTokenAnonymousByIdAndKeyRequest",
|
|
@@ -4056,6 +3902,16 @@ exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = {
|
|
|
4056
3902
|
}
|
|
4057
3903
|
}
|
|
4058
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
|
+
};
|
|
4059
3915
|
exports.CreateAttributeRequest = {
|
|
4060
3916
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4061
3917
|
"$ref": "#/definitions/CreateAttributeRequest",
|
|
@@ -4188,16 +4044,6 @@ exports.GetAttributesRequest = {
|
|
|
4188
4044
|
}
|
|
4189
4045
|
}
|
|
4190
4046
|
};
|
|
4191
|
-
exports.GetAttributesByNameRequest = {
|
|
4192
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4193
|
-
"$ref": "#/definitions/GetAttributesByNameRequest",
|
|
4194
|
-
"definitions": {
|
|
4195
|
-
"GetAttributesByNameRequest": {
|
|
4196
|
-
"type": "object",
|
|
4197
|
-
"additionalProperties": false
|
|
4198
|
-
}
|
|
4199
|
-
}
|
|
4200
|
-
};
|
|
4201
4047
|
exports.GetHistoryByNameRequest = {
|
|
4202
4048
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4203
4049
|
"$ref": "#/definitions/GetHistoryByNameRequest",
|
|
@@ -5001,6 +4847,73 @@ exports.UpdateSharedItemRequest = {
|
|
|
5001
4847
|
}
|
|
5002
4848
|
}
|
|
5003
4849
|
};
|
|
4850
|
+
exports.RegisterPushNotificationTokenRequest = {
|
|
4851
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4852
|
+
"$ref": "#/definitions/RegisterPushNotificationTokenRequest",
|
|
4853
|
+
"definitions": {
|
|
4854
|
+
"RegisterPushNotificationTokenRequest": {
|
|
4855
|
+
"type": "object",
|
|
4856
|
+
"properties": {
|
|
4857
|
+
"handle": {
|
|
4858
|
+
"type": "string"
|
|
4859
|
+
},
|
|
4860
|
+
"installationId": {
|
|
4861
|
+
"type": "string"
|
|
4862
|
+
},
|
|
4863
|
+
"platform": {
|
|
4864
|
+
"type": "string"
|
|
4865
|
+
}
|
|
4866
|
+
},
|
|
4867
|
+
"required": [
|
|
4868
|
+
"handle",
|
|
4869
|
+
"installationId",
|
|
4870
|
+
"platform"
|
|
4871
|
+
],
|
|
4872
|
+
"additionalProperties": false
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
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
|
+
};
|
|
5004
4917
|
exports.CreateDeviceRequest = {
|
|
5005
4918
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5006
4919
|
"$ref": "#/definitions/CreateDeviceRequest",
|
|
@@ -5170,25 +5083,6 @@ exports.CreateTokenQrCodeForFileRequest = {
|
|
|
5170
5083
|
}
|
|
5171
5084
|
}
|
|
5172
5085
|
};
|
|
5173
|
-
exports.DownloadFileRequest = {
|
|
5174
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5175
|
-
"$ref": "#/definitions/DownloadFileRequest",
|
|
5176
|
-
"definitions": {
|
|
5177
|
-
"DownloadFileRequest": {
|
|
5178
|
-
"type": "object",
|
|
5179
|
-
"properties": {
|
|
5180
|
-
"id": {
|
|
5181
|
-
"type": "string",
|
|
5182
|
-
"format": "fileId"
|
|
5183
|
-
}
|
|
5184
|
-
},
|
|
5185
|
-
"required": [
|
|
5186
|
-
"id"
|
|
5187
|
-
],
|
|
5188
|
-
"additionalProperties": false
|
|
5189
|
-
}
|
|
5190
|
-
}
|
|
5191
|
-
};
|
|
5192
5086
|
exports.GetFileRequest = {
|
|
5193
5087
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5194
5088
|
"$ref": "#/definitions/GetFileRequest",
|
|
@@ -5231,11 +5125,65 @@ exports.GetFilesRequest = {
|
|
|
5231
5125
|
}
|
|
5232
5126
|
}
|
|
5233
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
|
+
};
|
|
5234
5172
|
exports.LoadPeerFileRequest = {
|
|
5235
5173
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5236
5174
|
"$ref": "#/definitions/LoadPeerFileRequest",
|
|
5237
5175
|
"definitions": {
|
|
5238
5176
|
"LoadPeerFileRequest": {
|
|
5177
|
+
"anyOf": [
|
|
5178
|
+
{
|
|
5179
|
+
"$ref": "#/definitions/LoadPeerFileViaSecretRequest"
|
|
5180
|
+
},
|
|
5181
|
+
{
|
|
5182
|
+
"$ref": "#/definitions/LoadPeerFileViaReferenceRequest"
|
|
5183
|
+
}
|
|
5184
|
+
]
|
|
5185
|
+
},
|
|
5186
|
+
"LoadPeerFileViaSecretRequest": {
|
|
5239
5187
|
"type": "object",
|
|
5240
5188
|
"properties": {
|
|
5241
5189
|
"id": {
|
|
@@ -5243,13 +5191,29 @@ exports.LoadPeerFileRequest = {
|
|
|
5243
5191
|
"format": "fileId"
|
|
5244
5192
|
},
|
|
5245
5193
|
"secretKey": {
|
|
5246
|
-
"type": "string"
|
|
5247
|
-
|
|
5248
|
-
"reference": {
|
|
5249
|
-
"type": "string"
|
|
5194
|
+
"type": "string",
|
|
5195
|
+
"minLength": 100
|
|
5250
5196
|
}
|
|
5251
5197
|
},
|
|
5198
|
+
"required": [
|
|
5199
|
+
"id",
|
|
5200
|
+
"secretKey"
|
|
5201
|
+
],
|
|
5252
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"
|
|
5253
5217
|
}
|
|
5254
5218
|
}
|
|
5255
5219
|
};
|
|
@@ -5330,37 +5294,15 @@ exports.CheckIdentityRequest = {
|
|
|
5330
5294
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5331
5295
|
"$ref": "#/definitions/CheckIdentityRequest",
|
|
5332
5296
|
"definitions": {
|
|
5333
|
-
"CheckIdentityRequest": {
|
|
5334
|
-
"type": "object",
|
|
5335
|
-
"properties": {
|
|
5336
|
-
"address": {
|
|
5337
|
-
"type": "string"
|
|
5338
|
-
}
|
|
5339
|
-
},
|
|
5340
|
-
"required": [
|
|
5341
|
-
"address"
|
|
5342
|
-
],
|
|
5343
|
-
"additionalProperties": false
|
|
5344
|
-
}
|
|
5345
|
-
}
|
|
5346
|
-
};
|
|
5347
|
-
exports.DownloadAttachmentRequest = {
|
|
5348
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5349
|
-
"$ref": "#/definitions/DownloadAttachmentRequest",
|
|
5350
|
-
"definitions": {
|
|
5351
|
-
"DownloadAttachmentRequest": {
|
|
5297
|
+
"CheckIdentityRequest": {
|
|
5352
5298
|
"type": "object",
|
|
5353
5299
|
"properties": {
|
|
5354
|
-
"
|
|
5355
|
-
"type": "string"
|
|
5356
|
-
},
|
|
5357
|
-
"attachmentId": {
|
|
5300
|
+
"address": {
|
|
5358
5301
|
"type": "string"
|
|
5359
5302
|
}
|
|
5360
5303
|
},
|
|
5361
5304
|
"required": [
|
|
5362
|
-
"
|
|
5363
|
-
"attachmentId"
|
|
5305
|
+
"address"
|
|
5364
5306
|
],
|
|
5365
5307
|
"additionalProperties": false
|
|
5366
5308
|
}
|
|
@@ -5631,6 +5573,51 @@ exports.CreateOwnRelationshipTemplateRequest = {
|
|
|
5631
5573
|
}
|
|
5632
5574
|
}
|
|
5633
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
|
+
};
|
|
5634
5621
|
exports.GetRelationshipTemplateRequest = {
|
|
5635
5622
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5636
5623
|
"$ref": "#/definitions/GetRelationshipTemplateRequest",
|
|
@@ -5915,11 +5902,13 @@ __exportStar(__webpack_require__(/*! ./OwnerRestriction */ "./dist/useCases/comm
|
|
|
5915
5902
|
__exportStar(__webpack_require__(/*! ./QRCode */ "./dist/useCases/common/QRCode.js"), exports);
|
|
5916
5903
|
__exportStar(__webpack_require__(/*! ./RuntimeErrors */ "./dist/useCases/common/RuntimeErrors.js"), exports);
|
|
5917
5904
|
__exportStar(__webpack_require__(/*! ./RuntimeValidator */ "./dist/useCases/common/RuntimeValidator.js"), exports);
|
|
5905
|
+
__exportStar(__webpack_require__(/*! ./SchemaRepository */ "./dist/useCases/common/SchemaRepository.js"), exports);
|
|
5918
5906
|
__exportStar(__webpack_require__(/*! ./UseCase */ "./dist/useCases/common/UseCase.js"), exports);
|
|
5919
5907
|
__exportStar(__webpack_require__(/*! ./validation/AddressValidator */ "./dist/useCases/common/validation/AddressValidator.js"), exports);
|
|
5920
5908
|
__exportStar(__webpack_require__(/*! ./validation/DateValidator */ "./dist/useCases/common/validation/DateValidator.js"), exports);
|
|
5921
5909
|
__exportStar(__webpack_require__(/*! ./validation/IdValidator */ "./dist/useCases/common/validation/IdValidator.js"), exports);
|
|
5922
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);
|
|
5923
5912
|
//# sourceMappingURL=index.js.map
|
|
5924
5913
|
|
|
5925
5914
|
/***/ }),
|
|
@@ -6056,6 +6045,43 @@ exports.RelationshipAttributeDTOValidator = RelationshipAttributeDTOValidator;
|
|
|
6056
6045
|
|
|
6057
6046
|
/***/ }),
|
|
6058
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
|
+
|
|
6059
6085
|
/***/ "./dist/useCases/consumption/attributes/AttributeMapper.js":
|
|
6060
6086
|
/*!*****************************************************************!*\
|
|
6061
6087
|
!*** ./dist/useCases/consumption/attributes/AttributeMapper.js ***!
|
|
@@ -8952,6 +8978,70 @@ exports.GetSyncInfoUseCase = GetSyncInfoUseCase;
|
|
|
8952
8978
|
|
|
8953
8979
|
/***/ }),
|
|
8954
8980
|
|
|
8981
|
+
/***/ "./dist/useCases/transport/account/RegisterPushNotificationToken.js":
|
|
8982
|
+
/*!**************************************************************************!*\
|
|
8983
|
+
!*** ./dist/useCases/transport/account/RegisterPushNotificationToken.js ***!
|
|
8984
|
+
\**************************************************************************/
|
|
8985
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
8986
|
+
|
|
8987
|
+
"use strict";
|
|
8988
|
+
|
|
8989
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8990
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8991
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8992
|
+
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;
|
|
8993
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8994
|
+
};
|
|
8995
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8996
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8997
|
+
};
|
|
8998
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8999
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9000
|
+
};
|
|
9001
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9002
|
+
exports.RegisterPushNotificationTokenUseCase = void 0;
|
|
9003
|
+
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
9004
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9005
|
+
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9006
|
+
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9007
|
+
class Validator extends common_1.RuntimeValidator {
|
|
9008
|
+
constructor() {
|
|
9009
|
+
super();
|
|
9010
|
+
this.validateIfString((x) => x.handle)
|
|
9011
|
+
.isDefined()
|
|
9012
|
+
.isNotEmpty();
|
|
9013
|
+
this.validateIfString((x) => x.installationId)
|
|
9014
|
+
.isDefined()
|
|
9015
|
+
.isNotEmpty();
|
|
9016
|
+
this.validateIfString((x) => x.platform)
|
|
9017
|
+
.isDefined()
|
|
9018
|
+
.isNotEmpty();
|
|
9019
|
+
}
|
|
9020
|
+
}
|
|
9021
|
+
let RegisterPushNotificationTokenUseCase = class RegisterPushNotificationTokenUseCase extends common_1.UseCase {
|
|
9022
|
+
constructor(accountController, validator) {
|
|
9023
|
+
super(validator);
|
|
9024
|
+
this.accountController = accountController;
|
|
9025
|
+
}
|
|
9026
|
+
async executeInternal(request) {
|
|
9027
|
+
await this.accountController.registerPushNotificationToken({
|
|
9028
|
+
handle: request.handle,
|
|
9029
|
+
installationId: request.installationId,
|
|
9030
|
+
platform: request.platform
|
|
9031
|
+
});
|
|
9032
|
+
return ts_utils_1.Result.ok(undefined);
|
|
9033
|
+
}
|
|
9034
|
+
};
|
|
9035
|
+
RegisterPushNotificationTokenUseCase = __decorate([
|
|
9036
|
+
__param(0, typescript_ioc_1.Inject),
|
|
9037
|
+
__param(1, typescript_ioc_1.Inject),
|
|
9038
|
+
__metadata("design:paramtypes", [transport_1.AccountController, Validator])
|
|
9039
|
+
], RegisterPushNotificationTokenUseCase);
|
|
9040
|
+
exports.RegisterPushNotificationTokenUseCase = RegisterPushNotificationTokenUseCase;
|
|
9041
|
+
//# sourceMappingURL=RegisterPushNotificationToken.js.map
|
|
9042
|
+
|
|
9043
|
+
/***/ }),
|
|
9044
|
+
|
|
8955
9045
|
/***/ "./dist/useCases/transport/account/SyncDatawallet.js":
|
|
8956
9046
|
/*!***********************************************************!*\
|
|
8957
9047
|
!*** ./dist/useCases/transport/account/SyncDatawallet.js ***!
|
|
@@ -9022,16 +9112,16 @@ exports.SyncEverythingUseCase = void 0;
|
|
|
9022
9112
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
9023
9113
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9024
9114
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9025
|
-
const EventBus_1 = __webpack_require__(/*! ../../../eventBus/EventBus */ "./dist/eventBus/EventBus.js");
|
|
9026
9115
|
const events_1 = __webpack_require__(/*! ../../../events */ "./dist/events/index.js");
|
|
9027
9116
|
const RuntimeLoggerFactory_1 = __webpack_require__(/*! ../../../RuntimeLoggerFactory */ "./dist/RuntimeLoggerFactory.js");
|
|
9028
9117
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9029
9118
|
const MessageMapper_1 = __webpack_require__(/*! ../messages/MessageMapper */ "./dist/useCases/transport/messages/MessageMapper.js");
|
|
9030
9119
|
const RelationshipMapper_1 = __webpack_require__(/*! ../relationships/RelationshipMapper */ "./dist/useCases/transport/relationships/RelationshipMapper.js");
|
|
9031
9120
|
let SyncEverythingUseCase = class SyncEverythingUseCase extends common_1.UseCase {
|
|
9032
|
-
constructor(accountController, eventBus, loggerFactory) {
|
|
9121
|
+
constructor(accountController, identityController, eventBus, loggerFactory) {
|
|
9033
9122
|
super();
|
|
9034
9123
|
this.accountController = accountController;
|
|
9124
|
+
this.identityController = identityController;
|
|
9035
9125
|
this.eventBus = eventBus;
|
|
9036
9126
|
this.logger = loggerFactory.getLogger(SyncEverythingUseCase);
|
|
9037
9127
|
}
|
|
@@ -9051,30 +9141,31 @@ let SyncEverythingUseCase = class SyncEverythingUseCase extends common_1.UseCase
|
|
|
9051
9141
|
const changedItems = await this.accountController.syncEverything();
|
|
9052
9142
|
const messageDTOs = changedItems.messages.map((m) => MessageMapper_1.MessageMapper.toMessageDTO(m));
|
|
9053
9143
|
const relationshipDTOs = changedItems.relationships.map((r) => RelationshipMapper_1.RelationshipMapper.toRelationshipDTO(r));
|
|
9054
|
-
this.
|
|
9055
|
-
this.
|
|
9144
|
+
const eventTargetAddress = this.identityController.identity.address.toString();
|
|
9145
|
+
this.processNewMessages(messageDTOs, eventTargetAddress);
|
|
9146
|
+
this.processNewRelationships(relationshipDTOs, eventTargetAddress);
|
|
9056
9147
|
return ts_utils_1.Result.ok({
|
|
9057
9148
|
messages: messageDTOs,
|
|
9058
9149
|
relationships: relationshipDTOs
|
|
9059
9150
|
});
|
|
9060
9151
|
}
|
|
9061
|
-
processNewRelationships(relationships) {
|
|
9152
|
+
processNewRelationships(relationships, eventTargetAddress) {
|
|
9062
9153
|
if (relationships.length === 0) {
|
|
9063
9154
|
return;
|
|
9064
9155
|
}
|
|
9065
9156
|
this.logger.debug(`Found ${relationships.length} relationship(s) with changes. Start publishing on event bus...`);
|
|
9066
9157
|
for (const relationship of relationships) {
|
|
9067
|
-
this.eventBus.publish(new events_1.RelationshipChangedEvent(relationship));
|
|
9158
|
+
this.eventBus.publish(new events_1.RelationshipChangedEvent(eventTargetAddress, relationship));
|
|
9068
9159
|
}
|
|
9069
9160
|
this.logger.debug("Finished publishing relationship changes on event bus.");
|
|
9070
9161
|
}
|
|
9071
|
-
processNewMessages(messages) {
|
|
9162
|
+
processNewMessages(messages, eventTargetAddress) {
|
|
9072
9163
|
if (messages.length === 0) {
|
|
9073
9164
|
return;
|
|
9074
9165
|
}
|
|
9075
9166
|
this.logger.debug(`Found ${messages.length} new message(s). Start publishing on event bus...`);
|
|
9076
9167
|
for (const message of messages) {
|
|
9077
|
-
this.eventBus.publish(new events_1.MessageReceivedEvent(message));
|
|
9168
|
+
this.eventBus.publish(new events_1.MessageReceivedEvent(eventTargetAddress, message));
|
|
9078
9169
|
}
|
|
9079
9170
|
this.logger.debug("Finished publishing message changes on event bus.");
|
|
9080
9171
|
}
|
|
@@ -9083,7 +9174,11 @@ SyncEverythingUseCase = __decorate([
|
|
|
9083
9174
|
__param(0, typescript_ioc_1.Inject),
|
|
9084
9175
|
__param(1, typescript_ioc_1.Inject),
|
|
9085
9176
|
__param(2, typescript_ioc_1.Inject),
|
|
9086
|
-
|
|
9177
|
+
__param(3, typescript_ioc_1.Inject),
|
|
9178
|
+
__metadata("design:paramtypes", [transport_1.AccountController,
|
|
9179
|
+
transport_1.IdentityController,
|
|
9180
|
+
ts_utils_1.EventBus,
|
|
9181
|
+
RuntimeLoggerFactory_1.RuntimeLoggerFactory])
|
|
9087
9182
|
], SyncEverythingUseCase);
|
|
9088
9183
|
exports.SyncEverythingUseCase = SyncEverythingUseCase;
|
|
9089
9184
|
//# sourceMappingURL=SyncEverything.js.map
|
|
@@ -9114,6 +9209,7 @@ __exportStar(__webpack_require__(/*! ./EnableAutoSync */ "./dist/useCases/transp
|
|
|
9114
9209
|
__exportStar(__webpack_require__(/*! ./GetDeviceInfo */ "./dist/useCases/transport/account/GetDeviceInfo.js"), exports);
|
|
9115
9210
|
__exportStar(__webpack_require__(/*! ./GetIdentityInfo */ "./dist/useCases/transport/account/GetIdentityInfo.js"), exports);
|
|
9116
9211
|
__exportStar(__webpack_require__(/*! ./GetSyncInfo */ "./dist/useCases/transport/account/GetSyncInfo.js"), exports);
|
|
9212
|
+
__exportStar(__webpack_require__(/*! ./RegisterPushNotificationToken */ "./dist/useCases/transport/account/RegisterPushNotificationToken.js"), exports);
|
|
9117
9213
|
__exportStar(__webpack_require__(/*! ./SyncDatawallet */ "./dist/useCases/transport/account/SyncDatawallet.js"), exports);
|
|
9118
9214
|
__exportStar(__webpack_require__(/*! ./SyncEverything */ "./dist/useCases/transport/account/SyncEverything.js"), exports);
|
|
9119
9215
|
//# sourceMappingURL=index.js.map
|
|
@@ -9665,17 +9761,15 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9665
9761
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9666
9762
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9667
9763
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9668
|
-
const SchemaRepository_1 = __webpack_require__(/*! ../../common/SchemaRepository */ "./dist/useCases/common/SchemaRepository.js");
|
|
9669
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9670
9764
|
const TokenMapper_1 = __webpack_require__(/*! ../tokens/TokenMapper */ "./dist/useCases/transport/tokens/TokenMapper.js");
|
|
9671
|
-
let Validator = class Validator extends
|
|
9765
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9672
9766
|
constructor(schemaRepository) {
|
|
9673
9767
|
super(schemaRepository.getSchema("CreateTokenForFileRequest"));
|
|
9674
9768
|
}
|
|
9675
9769
|
};
|
|
9676
9770
|
Validator = __decorate([
|
|
9677
9771
|
__param(0, typescript_ioc_1.Inject),
|
|
9678
|
-
__metadata("design:paramtypes", [
|
|
9772
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9679
9773
|
], Validator);
|
|
9680
9774
|
let CreateTokenForFileUseCase = class CreateTokenForFileUseCase extends common_1.UseCase {
|
|
9681
9775
|
constructor(fileController, tokenController, accountController, validator) {
|
|
@@ -9749,16 +9843,14 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9749
9843
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9750
9844
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9751
9845
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9752
|
-
|
|
9753
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9754
|
-
let Validator = class Validator extends SchemaValidator_1.SchemaValidator {
|
|
9846
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9755
9847
|
constructor(schemaRepository) {
|
|
9756
9848
|
super(schemaRepository.getSchema("CreateTokenQrCodeForFileRequest"));
|
|
9757
9849
|
}
|
|
9758
9850
|
};
|
|
9759
9851
|
Validator = __decorate([
|
|
9760
9852
|
__param(0, typescript_ioc_1.Inject),
|
|
9761
|
-
__metadata("design:paramtypes", [
|
|
9853
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9762
9854
|
], Validator);
|
|
9763
9855
|
let CreateTokenQrCodeForFileUseCase = class CreateTokenQrCodeForFileUseCase extends common_1.UseCase {
|
|
9764
9856
|
constructor(fileController, tokenController, validator) {
|
|
@@ -9824,17 +9916,15 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9824
9916
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9825
9917
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9826
9918
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9827
|
-
const SchemaRepository_1 = __webpack_require__(/*! ../../common/SchemaRepository */ "./dist/useCases/common/SchemaRepository.js");
|
|
9828
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9829
9919
|
const FileMapper_1 = __webpack_require__(/*! ./FileMapper */ "./dist/useCases/transport/files/FileMapper.js");
|
|
9830
|
-
let Validator = class Validator extends
|
|
9920
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9831
9921
|
constructor(schemaRepository) {
|
|
9832
9922
|
super(schemaRepository.getSchema("DownloadFileRequest"));
|
|
9833
9923
|
}
|
|
9834
9924
|
};
|
|
9835
9925
|
Validator = __decorate([
|
|
9836
9926
|
__param(0, typescript_ioc_1.Inject),
|
|
9837
|
-
__metadata("design:paramtypes", [
|
|
9927
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9838
9928
|
], Validator);
|
|
9839
9929
|
let DownloadFileUseCase = class DownloadFileUseCase extends common_1.UseCase {
|
|
9840
9930
|
constructor(fileController, validator) {
|
|
@@ -9943,17 +10033,15 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
9943
10033
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
9944
10034
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
9945
10035
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
9946
|
-
const SchemaRepository_1 = __webpack_require__(/*! ../../common/SchemaRepository */ "./dist/useCases/common/SchemaRepository.js");
|
|
9947
|
-
const SchemaValidator_1 = __webpack_require__(/*! ../../common/SchemaValidator */ "./dist/useCases/common/SchemaValidator.js");
|
|
9948
10036
|
const FileMapper_1 = __webpack_require__(/*! ./FileMapper */ "./dist/useCases/transport/files/FileMapper.js");
|
|
9949
|
-
let Validator = class Validator extends
|
|
10037
|
+
let Validator = class Validator extends common_1.SchemaValidator {
|
|
9950
10038
|
constructor(schemaRepository) {
|
|
9951
10039
|
super(schemaRepository.getSchema("GetFileRequest"));
|
|
9952
10040
|
}
|
|
9953
10041
|
};
|
|
9954
10042
|
Validator = __decorate([
|
|
9955
10043
|
__param(0, typescript_ioc_1.Inject),
|
|
9956
|
-
__metadata("design:paramtypes", [
|
|
10044
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
9957
10045
|
], Validator);
|
|
9958
10046
|
let GetFileUseCase = class GetFileUseCase extends common_1.UseCase {
|
|
9959
10047
|
constructor(fileController, validator) {
|
|
@@ -10088,45 +10176,44 @@ exports.LoadPeerFileUseCase = void 0;
|
|
|
10088
10176
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
10089
10177
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
10090
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");
|
|
10091
10180
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
10092
10181
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
10093
10182
|
const FileMapper_1 = __webpack_require__(/*! ./FileMapper */ "./dist/useCases/transport/files/FileMapper.js");
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
this.validateIfString((x) => x.id)
|
|
10106
|
-
.fulfills(common_1.IdValidator.required(transport_1.BackboneIds.file))
|
|
10107
|
-
.when(this.isCreatePeerFileFromIdAndKeyRequest);
|
|
10108
|
-
this.validateIfString((x) => x.secretKey)
|
|
10109
|
-
.isNotNull()
|
|
10110
|
-
.when(this.isCreatePeerFileFromIdAndKeyRequest);
|
|
10111
|
-
}
|
|
10112
|
-
setupRulesForCreateFileFromTokenReferenceRequest() {
|
|
10113
|
-
this.validateIfString((x) => x.reference)
|
|
10114
|
-
.isNotNull()
|
|
10115
|
-
.fulfills(this.isTokenReference)
|
|
10116
|
-
.when(this.isCreatePeerFileFromTokenReferenceRequest);
|
|
10117
|
-
}
|
|
10118
|
-
isTokenReference(tokenReference) {
|
|
10119
|
-
// "TOK" as Base64
|
|
10120
|
-
const tokInBase64 = "VE9L";
|
|
10121
|
-
return tokenReference.startsWith(tokInBase64);
|
|
10122
|
-
}
|
|
10123
|
-
isCreatePeerFileFromIdAndKeyRequest(x) {
|
|
10124
|
-
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");
|
|
10125
10194
|
}
|
|
10126
|
-
|
|
10127
|
-
|
|
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);
|
|
10128
10211
|
}
|
|
10129
|
-
}
|
|
10212
|
+
};
|
|
10213
|
+
Validator = __decorate([
|
|
10214
|
+
__param(0, typescript_ioc_1.Inject),
|
|
10215
|
+
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
10216
|
+
], Validator);
|
|
10130
10217
|
let LoadPeerFileUseCase = class LoadPeerFileUseCase extends common_1.UseCase {
|
|
10131
10218
|
constructor(fileController, tokenController, accountController, validator) {
|
|
10132
10219
|
super(validator);
|
|
@@ -10136,11 +10223,11 @@ let LoadPeerFileUseCase = class LoadPeerFileUseCase extends common_1.UseCase {
|
|
|
10136
10223
|
}
|
|
10137
10224
|
async executeInternal(request) {
|
|
10138
10225
|
let createdFile;
|
|
10139
|
-
if (request
|
|
10226
|
+
if (isLoadPeerFileViaSecret(request)) {
|
|
10140
10227
|
const key = await crypto_1.CryptoSecretKey.fromBase64(request.secretKey);
|
|
10141
10228
|
createdFile = await this.loadFile(transport_1.CoreId.from(request.id), key);
|
|
10142
10229
|
}
|
|
10143
|
-
else if (request
|
|
10230
|
+
else if (isLoadPeerFileViaReference(request)) {
|
|
10144
10231
|
createdFile = await this.createFileFromTokenReferenceRequest(request.reference);
|
|
10145
10232
|
}
|
|
10146
10233
|
else {
|
|
@@ -10173,7 +10260,7 @@ LoadPeerFileUseCase = __decorate([
|
|
|
10173
10260
|
__metadata("design:paramtypes", [transport_1.FileController,
|
|
10174
10261
|
transport_1.TokenController,
|
|
10175
10262
|
transport_1.AccountController,
|
|
10176
|
-
|
|
10263
|
+
Validator])
|
|
10177
10264
|
], LoadPeerFileUseCase);
|
|
10178
10265
|
exports.LoadPeerFileUseCase = LoadPeerFileUseCase;
|
|
10179
10266
|
//# sourceMappingURL=LoadPeerFile.js.map
|
|
@@ -10864,6 +10951,7 @@ exports.SendMessageUseCase = void 0;
|
|
|
10864
10951
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
10865
10952
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
10866
10953
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
10954
|
+
const events_1 = __webpack_require__(/*! ../../../events */ "./dist/events/index.js");
|
|
10867
10955
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
10868
10956
|
const MessageMapper_1 = __webpack_require__(/*! ./MessageMapper */ "./dist/useCases/transport/messages/MessageMapper.js");
|
|
10869
10957
|
class SendMessageRequestValidator extends common_1.RuntimeValidator {
|
|
@@ -10876,11 +10964,13 @@ class SendMessageRequestValidator extends common_1.RuntimeValidator {
|
|
|
10876
10964
|
}
|
|
10877
10965
|
}
|
|
10878
10966
|
let SendMessageUseCase = class SendMessageUseCase extends common_1.UseCase {
|
|
10879
|
-
constructor(messageController, fileController, accountController, validator) {
|
|
10967
|
+
constructor(messageController, fileController, accountController, identityController, eventBus, validator) {
|
|
10880
10968
|
super(validator);
|
|
10881
10969
|
this.messageController = messageController;
|
|
10882
10970
|
this.fileController = fileController;
|
|
10883
10971
|
this.accountController = accountController;
|
|
10972
|
+
this.identityController = identityController;
|
|
10973
|
+
this.eventBus = eventBus;
|
|
10884
10974
|
}
|
|
10885
10975
|
async executeInternal(request) {
|
|
10886
10976
|
const transformAttachmentsResult = await this.transformAttachments(request.attachments);
|
|
@@ -10892,6 +10982,8 @@ let SendMessageUseCase = class SendMessageUseCase extends common_1.UseCase {
|
|
|
10892
10982
|
content: request.content,
|
|
10893
10983
|
attachments: transformAttachmentsResult.value
|
|
10894
10984
|
});
|
|
10985
|
+
const messageDTO = MessageMapper_1.MessageMapper.toMessageDTO(result);
|
|
10986
|
+
this.eventBus.publish(new events_1.MessageSentEvent(this.identityController.identity.address.toString(), messageDTO));
|
|
10895
10987
|
await this.accountController.syncDatawallet();
|
|
10896
10988
|
return ts_utils_1.Result.ok(MessageMapper_1.MessageMapper.toMessageDTO(result));
|
|
10897
10989
|
}
|
|
@@ -10915,9 +11007,13 @@ SendMessageUseCase = __decorate([
|
|
|
10915
11007
|
__param(1, typescript_ioc_1.Inject),
|
|
10916
11008
|
__param(2, typescript_ioc_1.Inject),
|
|
10917
11009
|
__param(3, typescript_ioc_1.Inject),
|
|
11010
|
+
__param(4, typescript_ioc_1.Inject),
|
|
11011
|
+
__param(5, typescript_ioc_1.Inject),
|
|
10918
11012
|
__metadata("design:paramtypes", [transport_1.MessageController,
|
|
10919
11013
|
transport_1.FileController,
|
|
10920
11014
|
transport_1.AccountController,
|
|
11015
|
+
transport_1.IdentityController,
|
|
11016
|
+
ts_utils_1.EventBus,
|
|
10921
11017
|
SendMessageRequestValidator])
|
|
10922
11018
|
], SendMessageUseCase);
|
|
10923
11019
|
exports.SendMessageUseCase = SendMessageUseCase;
|
|
@@ -11513,6 +11609,7 @@ exports.AcceptRelationshipChangeUseCase = void 0;
|
|
|
11513
11609
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
11514
11610
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
11515
11611
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
11612
|
+
const events_1 = __webpack_require__(/*! ../../../events */ "./dist/events/index.js");
|
|
11516
11613
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
11517
11614
|
const RelationshipMapper_1 = __webpack_require__(/*! ./RelationshipMapper */ "./dist/useCases/transport/relationships/RelationshipMapper.js");
|
|
11518
11615
|
class AcceptRelationshipChangeRequestValidator extends common_1.RuntimeValidator {
|
|
@@ -11523,10 +11620,12 @@ class AcceptRelationshipChangeRequestValidator extends common_1.RuntimeValidator
|
|
|
11523
11620
|
}
|
|
11524
11621
|
}
|
|
11525
11622
|
let AcceptRelationshipChangeUseCase = class AcceptRelationshipChangeUseCase extends common_1.UseCase {
|
|
11526
|
-
constructor(relationshipsController, accountController, validator) {
|
|
11623
|
+
constructor(relationshipsController, accountController, identityController, eventBus, validator) {
|
|
11527
11624
|
super(validator);
|
|
11528
11625
|
this.relationshipsController = relationshipsController;
|
|
11529
11626
|
this.accountController = accountController;
|
|
11627
|
+
this.identityController = identityController;
|
|
11628
|
+
this.eventBus = eventBus;
|
|
11530
11629
|
}
|
|
11531
11630
|
async executeInternal(request) {
|
|
11532
11631
|
const relationship = await this.relationshipsController.getRelationship(transport_1.CoreId.from(request.relationshipId));
|
|
@@ -11540,17 +11639,23 @@ let AcceptRelationshipChangeUseCase = class AcceptRelationshipChangeUseCase exte
|
|
|
11540
11639
|
if (!change) {
|
|
11541
11640
|
return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.RelationshipChange));
|
|
11542
11641
|
}
|
|
11543
|
-
const
|
|
11642
|
+
const updatedRelationship = await this.relationshipsController.acceptChange(change, request.content);
|
|
11643
|
+
const relationshipDTO = RelationshipMapper_1.RelationshipMapper.toRelationshipDTO(updatedRelationship);
|
|
11644
|
+
this.eventBus.publish(new events_1.RelationshipChangedEvent(this.identityController.identity.address.toString(), relationshipDTO));
|
|
11544
11645
|
await this.accountController.syncDatawallet();
|
|
11545
|
-
return ts_utils_1.Result.ok(
|
|
11646
|
+
return ts_utils_1.Result.ok(relationshipDTO);
|
|
11546
11647
|
}
|
|
11547
11648
|
};
|
|
11548
11649
|
AcceptRelationshipChangeUseCase = __decorate([
|
|
11549
11650
|
__param(0, typescript_ioc_1.Inject),
|
|
11550
11651
|
__param(1, typescript_ioc_1.Inject),
|
|
11551
11652
|
__param(2, typescript_ioc_1.Inject),
|
|
11653
|
+
__param(3, typescript_ioc_1.Inject),
|
|
11654
|
+
__param(4, typescript_ioc_1.Inject),
|
|
11552
11655
|
__metadata("design:paramtypes", [transport_1.RelationshipsController,
|
|
11553
11656
|
transport_1.AccountController,
|
|
11657
|
+
transport_1.IdentityController,
|
|
11658
|
+
ts_utils_1.EventBus,
|
|
11554
11659
|
AcceptRelationshipChangeRequestValidator])
|
|
11555
11660
|
], AcceptRelationshipChangeUseCase);
|
|
11556
11661
|
exports.AcceptRelationshipChangeUseCase = AcceptRelationshipChangeUseCase;
|
|
@@ -11583,6 +11688,7 @@ exports.CreateRelationshipUseCase = void 0;
|
|
|
11583
11688
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
11584
11689
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
11585
11690
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
11691
|
+
const events_1 = __webpack_require__(/*! ../../../events */ "./dist/events/index.js");
|
|
11586
11692
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
11587
11693
|
const RelationshipMapper_1 = __webpack_require__(/*! ./RelationshipMapper */ "./dist/useCases/transport/relationships/RelationshipMapper.js");
|
|
11588
11694
|
class CreateRelationshipRequestValidator extends common_1.RuntimeValidator {
|
|
@@ -11593,11 +11699,13 @@ class CreateRelationshipRequestValidator extends common_1.RuntimeValidator {
|
|
|
11593
11699
|
}
|
|
11594
11700
|
}
|
|
11595
11701
|
let CreateRelationshipUseCase = class CreateRelationshipUseCase extends common_1.UseCase {
|
|
11596
|
-
constructor(relationshipsController, relationshipTemplateController, accountController, validator) {
|
|
11702
|
+
constructor(relationshipsController, relationshipTemplateController, accountController, identityController, eventBus, validator) {
|
|
11597
11703
|
super(validator);
|
|
11598
11704
|
this.relationshipsController = relationshipsController;
|
|
11599
11705
|
this.relationshipTemplateController = relationshipTemplateController;
|
|
11600
11706
|
this.accountController = accountController;
|
|
11707
|
+
this.identityController = identityController;
|
|
11708
|
+
this.eventBus = eventBus;
|
|
11601
11709
|
}
|
|
11602
11710
|
async executeInternal(request) {
|
|
11603
11711
|
const template = await this.relationshipTemplateController.getRelationshipTemplate(transport_1.CoreId.from(request.templateId));
|
|
@@ -11608,8 +11716,10 @@ let CreateRelationshipUseCase = class CreateRelationshipUseCase extends common_1
|
|
|
11608
11716
|
template: template,
|
|
11609
11717
|
content: request.content
|
|
11610
11718
|
});
|
|
11719
|
+
const relationshipDTO = RelationshipMapper_1.RelationshipMapper.toRelationshipDTO(relationship);
|
|
11720
|
+
this.eventBus.publish(new events_1.RelationshipChangedEvent(this.identityController.identity.address.toString(), relationshipDTO));
|
|
11611
11721
|
await this.accountController.syncDatawallet();
|
|
11612
|
-
return ts_utils_1.Result.ok(
|
|
11722
|
+
return ts_utils_1.Result.ok(relationshipDTO);
|
|
11613
11723
|
}
|
|
11614
11724
|
};
|
|
11615
11725
|
CreateRelationshipUseCase = __decorate([
|
|
@@ -11617,9 +11727,13 @@ CreateRelationshipUseCase = __decorate([
|
|
|
11617
11727
|
__param(1, typescript_ioc_1.Inject),
|
|
11618
11728
|
__param(2, typescript_ioc_1.Inject),
|
|
11619
11729
|
__param(3, typescript_ioc_1.Inject),
|
|
11730
|
+
__param(4, typescript_ioc_1.Inject),
|
|
11731
|
+
__param(5, typescript_ioc_1.Inject),
|
|
11620
11732
|
__metadata("design:paramtypes", [transport_1.RelationshipsController,
|
|
11621
11733
|
transport_1.RelationshipTemplateController,
|
|
11622
11734
|
transport_1.AccountController,
|
|
11735
|
+
transport_1.IdentityController,
|
|
11736
|
+
ts_utils_1.EventBus,
|
|
11623
11737
|
CreateRelationshipRequestValidator])
|
|
11624
11738
|
], CreateRelationshipUseCase);
|
|
11625
11739
|
exports.CreateRelationshipUseCase = CreateRelationshipUseCase;
|
|
@@ -11888,6 +12002,7 @@ exports.RejectRelationshipChangeUseCase = void 0;
|
|
|
11888
12002
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
11889
12003
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
11890
12004
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
12005
|
+
const events_1 = __webpack_require__(/*! ../../../events */ "./dist/events/index.js");
|
|
11891
12006
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
11892
12007
|
const RelationshipMapper_1 = __webpack_require__(/*! ./RelationshipMapper */ "./dist/useCases/transport/relationships/RelationshipMapper.js");
|
|
11893
12008
|
class RejectRelationshipChangeRequestValidator extends common_1.RuntimeValidator {
|
|
@@ -11898,10 +12013,12 @@ class RejectRelationshipChangeRequestValidator extends common_1.RuntimeValidator
|
|
|
11898
12013
|
}
|
|
11899
12014
|
}
|
|
11900
12015
|
let RejectRelationshipChangeUseCase = class RejectRelationshipChangeUseCase extends common_1.UseCase {
|
|
11901
|
-
constructor(relationshipsController, accountController, validator) {
|
|
12016
|
+
constructor(relationshipsController, accountController, identityController, eventBus, validator) {
|
|
11902
12017
|
super(validator);
|
|
11903
12018
|
this.relationshipsController = relationshipsController;
|
|
11904
12019
|
this.accountController = accountController;
|
|
12020
|
+
this.identityController = identityController;
|
|
12021
|
+
this.eventBus = eventBus;
|
|
11905
12022
|
}
|
|
11906
12023
|
async executeInternal(request) {
|
|
11907
12024
|
const relationship = await this.relationshipsController.getRelationship(transport_1.CoreId.from(request.relationshipId));
|
|
@@ -11915,17 +12032,23 @@ let RejectRelationshipChangeUseCase = class RejectRelationshipChangeUseCase exte
|
|
|
11915
12032
|
if (!change) {
|
|
11916
12033
|
return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.RelationshipChange));
|
|
11917
12034
|
}
|
|
11918
|
-
const
|
|
12035
|
+
const updatedRelationship = await this.relationshipsController.rejectChange(change, request.content);
|
|
12036
|
+
const relationshipDTO = RelationshipMapper_1.RelationshipMapper.toRelationshipDTO(updatedRelationship);
|
|
12037
|
+
this.eventBus.publish(new events_1.RelationshipChangedEvent(this.identityController.identity.address.toString(), relationshipDTO));
|
|
11919
12038
|
await this.accountController.syncDatawallet();
|
|
11920
|
-
return ts_utils_1.Result.ok(
|
|
12039
|
+
return ts_utils_1.Result.ok(relationshipDTO);
|
|
11921
12040
|
}
|
|
11922
12041
|
};
|
|
11923
12042
|
RejectRelationshipChangeUseCase = __decorate([
|
|
11924
12043
|
__param(0, typescript_ioc_1.Inject),
|
|
11925
12044
|
__param(1, typescript_ioc_1.Inject),
|
|
11926
12045
|
__param(2, typescript_ioc_1.Inject),
|
|
12046
|
+
__param(3, typescript_ioc_1.Inject),
|
|
12047
|
+
__param(4, typescript_ioc_1.Inject),
|
|
11927
12048
|
__metadata("design:paramtypes", [transport_1.RelationshipsController,
|
|
11928
12049
|
transport_1.AccountController,
|
|
12050
|
+
transport_1.IdentityController,
|
|
12051
|
+
ts_utils_1.EventBus,
|
|
11929
12052
|
RejectRelationshipChangeRequestValidator])
|
|
11930
12053
|
], RejectRelationshipChangeUseCase);
|
|
11931
12054
|
exports.RejectRelationshipChangeUseCase = RejectRelationshipChangeUseCase;
|
|
@@ -12021,6 +12144,7 @@ exports.RevokeRelationshipChangeUseCase = void 0;
|
|
|
12021
12144
|
const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
|
|
12022
12145
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
12023
12146
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
12147
|
+
const events_1 = __webpack_require__(/*! ../../../events */ "./dist/events/index.js");
|
|
12024
12148
|
const common_1 = __webpack_require__(/*! ../../common */ "./dist/useCases/common/index.js");
|
|
12025
12149
|
const RelationshipMapper_1 = __webpack_require__(/*! ./RelationshipMapper */ "./dist/useCases/transport/relationships/RelationshipMapper.js");
|
|
12026
12150
|
class RevokeRelationshipChangeRequestValidator extends common_1.RuntimeValidator {
|
|
@@ -12031,10 +12155,12 @@ class RevokeRelationshipChangeRequestValidator extends common_1.RuntimeValidator
|
|
|
12031
12155
|
}
|
|
12032
12156
|
}
|
|
12033
12157
|
let RevokeRelationshipChangeUseCase = class RevokeRelationshipChangeUseCase extends common_1.UseCase {
|
|
12034
|
-
constructor(relationshipsController, accountController, validator) {
|
|
12158
|
+
constructor(relationshipsController, accountController, eventBus, identityController, validator) {
|
|
12035
12159
|
super(validator);
|
|
12036
12160
|
this.relationshipsController = relationshipsController;
|
|
12037
12161
|
this.accountController = accountController;
|
|
12162
|
+
this.eventBus = eventBus;
|
|
12163
|
+
this.identityController = identityController;
|
|
12038
12164
|
}
|
|
12039
12165
|
async executeInternal(request) {
|
|
12040
12166
|
const relationship = await this.relationshipsController.getRelationship(transport_1.CoreId.from(request.relationshipId));
|
|
@@ -12048,17 +12174,23 @@ let RevokeRelationshipChangeUseCase = class RevokeRelationshipChangeUseCase exte
|
|
|
12048
12174
|
if (!change) {
|
|
12049
12175
|
return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.RelationshipChange));
|
|
12050
12176
|
}
|
|
12051
|
-
const
|
|
12177
|
+
const updatedRelationship = await this.relationshipsController.revokeChange(change, request.content);
|
|
12178
|
+
const relationshipDTO = RelationshipMapper_1.RelationshipMapper.toRelationshipDTO(updatedRelationship);
|
|
12179
|
+
this.eventBus.publish(new events_1.RelationshipChangedEvent(this.identityController.identity.address.toString(), relationshipDTO));
|
|
12052
12180
|
await this.accountController.syncDatawallet();
|
|
12053
|
-
return ts_utils_1.Result.ok(
|
|
12181
|
+
return ts_utils_1.Result.ok(relationshipDTO);
|
|
12054
12182
|
}
|
|
12055
12183
|
};
|
|
12056
12184
|
RevokeRelationshipChangeUseCase = __decorate([
|
|
12057
12185
|
__param(0, typescript_ioc_1.Inject),
|
|
12058
12186
|
__param(1, typescript_ioc_1.Inject),
|
|
12059
12187
|
__param(2, typescript_ioc_1.Inject),
|
|
12188
|
+
__param(3, typescript_ioc_1.Inject),
|
|
12189
|
+
__param(4, typescript_ioc_1.Inject),
|
|
12060
12190
|
__metadata("design:paramtypes", [transport_1.RelationshipsController,
|
|
12061
12191
|
transport_1.AccountController,
|
|
12192
|
+
ts_utils_1.EventBus,
|
|
12193
|
+
transport_1.IdentityController,
|
|
12062
12194
|
RevokeRelationshipChangeRequestValidator])
|
|
12063
12195
|
], RevokeRelationshipChangeUseCase);
|
|
12064
12196
|
exports.RevokeRelationshipChangeUseCase = RevokeRelationshipChangeUseCase;
|
|
@@ -13233,6 +13365,291 @@ exports.sleep = sleep;
|
|
|
13233
13365
|
|
|
13234
13366
|
/***/ }),
|
|
13235
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
|
+
|
|
13236
13653
|
/***/ "./node_modules/ajv-formats/dist/formats.js":
|
|
13237
13654
|
/*!**************************************************!*\
|
|
13238
13655
|
!*** ./node_modules/ajv-formats/dist/formats.js ***!
|