@nmshd/transport 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/buildInformation.js +5 -5
  2. package/dist/core/DependencyOverrides.d.ts +4 -0
  3. package/dist/core/DependencyOverrides.js +3 -0
  4. package/dist/core/DependencyOverrides.js.map +1 -0
  5. package/dist/core/Transport.d.ts +2 -3
  6. package/dist/core/Transport.js +26 -23
  7. package/dist/core/Transport.js.map +1 -1
  8. package/dist/core/TransportErrors.d.ts +4 -0
  9. package/dist/core/TransportErrors.js +12 -0
  10. package/dist/core/TransportErrors.js.map +1 -1
  11. package/dist/core/backbone/RESTClient.js +1 -1
  12. package/dist/core/backbone/RESTClient.js.map +1 -1
  13. package/dist/core/backbone/index.d.ts +1 -0
  14. package/dist/core/backbone/index.js +1 -0
  15. package/dist/core/backbone/index.js.map +1 -1
  16. package/dist/core/index.d.ts +1 -0
  17. package/dist/core/index.js +1 -0
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/modules/accounts/AccountController.d.ts +3 -1
  20. package/dist/modules/accounts/AccountController.js +8 -5
  21. package/dist/modules/accounts/AccountController.js.map +1 -1
  22. package/dist/modules/devices/DeviceController.d.ts +5 -1
  23. package/dist/modules/devices/DeviceController.js +9 -4
  24. package/dist/modules/devices/DeviceController.js.map +1 -1
  25. package/dist/modules/devices/local/Device.d.ts +2 -0
  26. package/dist/modules/devices/local/Device.js +7 -1
  27. package/dist/modules/devices/local/Device.js.map +1 -1
  28. package/dist/modules/index.d.ts +8 -0
  29. package/dist/modules/index.js +8 -0
  30. package/dist/modules/index.js.map +1 -1
  31. package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +2 -2
  32. package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -1
  33. package/dist/modules/sync/DatawalletModificationMapper.d.ts +1 -1
  34. package/dist/modules/sync/DatawalletModificationMapper.js +6 -3
  35. package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -1
  36. package/dist/modules/sync/SyncController.d.ts +17 -4
  37. package/dist/modules/sync/SyncController.js +154 -24
  38. package/dist/modules/sync/SyncController.js.map +1 -1
  39. package/dist/modules/sync/SynchronizedCollection.d.ts +2 -1
  40. package/dist/modules/sync/SynchronizedCollection.js +18 -9
  41. package/dist/modules/sync/SynchronizedCollection.js.map +1 -1
  42. package/dist/modules/sync/backbone/BackboneDatawalletModification.d.ts +1 -0
  43. package/dist/modules/sync/backbone/CreateDatawalletModifications.d.ts +1 -0
  44. package/dist/modules/sync/backbone/FinalizeSyncRun.d.ts +15 -9
  45. package/dist/modules/sync/backbone/GetDatawallet.d.ts +3 -0
  46. package/dist/modules/sync/backbone/GetDatawallet.js +3 -0
  47. package/dist/modules/sync/backbone/GetDatawallet.js.map +1 -0
  48. package/dist/modules/sync/backbone/StartSyncRun.d.ts +8 -0
  49. package/dist/modules/sync/backbone/StartSyncRun.js +6 -1
  50. package/dist/modules/sync/backbone/StartSyncRun.js.map +1 -1
  51. package/dist/modules/sync/backbone/SyncClient.d.ts +21 -6
  52. package/dist/modules/sync/backbone/SyncClient.js +19 -6
  53. package/dist/modules/sync/backbone/SyncClient.js.map +1 -1
  54. package/dist/modules/sync/local/DatawalletModification.d.ts +2 -0
  55. package/dist/modules/sync/local/DatawalletModification.js +5 -0
  56. package/dist/modules/sync/local/DatawalletModification.js.map +1 -1
  57. package/dist/modules/sync/migrations/DeviceMigrations.d.ts +6 -0
  58. package/dist/modules/sync/migrations/DeviceMigrations.js +24 -0
  59. package/dist/modules/sync/migrations/DeviceMigrations.js.map +1 -0
  60. package/dist/modules/sync/migrations/IdentityMigrations.d.ts +6 -0
  61. package/dist/modules/sync/migrations/IdentityMigrations.js +14 -0
  62. package/dist/modules/sync/migrations/IdentityMigrations.js.map +1 -0
  63. package/lib-web/nmshd.transport.js +577 -198
  64. package/lib-web/nmshd.transport.js.map +1 -1
  65. package/lib-web/nmshd.transport.min.js +1 -1
  66. package/lib-web/nmshd.transport.min.js.map +1 -1
  67. package/package.json +14 -14
@@ -15,11 +15,11 @@ exports.buildInformation = void 0;
15
15
  const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
16
16
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
17
17
  exports.buildInformation = {
18
- version: "1.0.8",
19
- build: "11",
20
- date: "2021-11-15T06:28:52+00:00",
21
- commit: "e46782eb96bb3ebea587713bb3afeb1e83b0b645",
22
- dependencies: {"@js-soft/docdb-access-abstractions":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/simple-logger":"1.0.0","@js-soft/ts-utils":"1.0.1","axios":"^0.24.0","deep-equal":"^2.0.5","fast-json-patch":"^3.1.0","form-data":"^4.0.0","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^2.1.1","qs":"^6.10.1","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1","uuid":"^8.3.2"},
18
+ version: "1.1.0",
19
+ build: "12",
20
+ date: "2021-11-24T08:13:17+00:00",
21
+ commit: "79449175787ac5c327066c6846fba4deb209606e",
22
+ dependencies: {"@js-soft/docdb-access-abstractions":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/simple-logger":"1.0.0","@js-soft/ts-utils":"1.1.1","axios":"^0.24.0","deep-equal":"^2.0.5","fast-json-patch":"^3.1.0","form-data":"^4.0.0","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^2.1.1","qs":"^6.10.1","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1","uuid":"^8.3.2"},
23
23
  libraries: {
24
24
  crypto: crypto_1.buildInformation,
25
25
  serval: ts_serval_1.buildInformation
@@ -572,6 +572,19 @@ var DbCollectionName;
572
572
 
573
573
  /***/ }),
574
574
 
575
+ /***/ "./dist/core/DependencyOverrides.js":
576
+ /*!******************************************!*\
577
+ !*** ./dist/core/DependencyOverrides.js ***!
578
+ \******************************************/
579
+ /***/ ((__unused_webpack_module, exports) => {
580
+
581
+ "use strict";
582
+
583
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
584
+ //# sourceMappingURL=DependencyOverrides.js.map
585
+
586
+ /***/ }),
587
+
575
588
  /***/ "./dist/core/Transport.js":
576
589
  /*!********************************!*\
577
590
  !*** ./dist/core/Transport.js ***!
@@ -595,30 +608,8 @@ const TransportLoggerFactory_1 = __webpack_require__(/*! ./TransportLoggerFactor
595
608
  let log;
596
609
  class Transport {
597
610
  constructor(databaseConnection, customConfig, loggerFactory = new simple_logger_1.SimpleLoggerFactory()) {
598
- this.defaultConfig = {
599
- debug: false,
600
- platformClientId: "",
601
- platformClientSecret: "",
602
- platformTimeout: 60000,
603
- platformMaxRedirects: 10,
604
- platformMaxUnencryptedFileSize: 10 * 1024 * 1024,
605
- baseUrl: "",
606
- useGateway: true,
607
- realm: Identity_1.Realm.Prod,
608
- datawalletEnabled: false,
609
- httpAgent: {
610
- keepAlive: true,
611
- maxSockets: 5,
612
- maxFreeSockets: 2
613
- },
614
- httpsAgent: {
615
- keepAlive: true,
616
- maxSockets: 5,
617
- maxFreeSockets: 2
618
- }
619
- };
620
611
  this.databaseConnection = databaseConnection;
621
- this._config = lodash_1.default.defaultsDeep({}, customConfig, this.defaultConfig);
612
+ this._config = lodash_1.default.defaultsDeep({}, customConfig, Transport.defaultConfig);
622
613
  TransportLoggerFactory_1.TransportLoggerFactory.init(loggerFactory);
623
614
  log = TransportLoggerFactory_1.TransportLoggerFactory.getLogger(Transport);
624
615
  if (!this._config.platformClientId) {
@@ -630,6 +621,9 @@ class Transport {
630
621
  if (!this._config.baseUrl) {
631
622
  throw TransportErrors_1.TransportErrors.general.baseUrlNotSet().logWith(log);
632
623
  }
624
+ if (this._config.supportedDatawalletVersion < 1) {
625
+ throw TransportErrors_1.TransportErrors.general.invalidDatawalletVersion().logWith(log);
626
+ }
633
627
  }
634
628
  get config() {
635
629
  return this._config;
@@ -649,6 +643,28 @@ class Transport {
649
643
  }
650
644
  }
651
645
  exports.Transport = Transport;
646
+ Transport.defaultConfig = {
647
+ supportedDatawalletVersion: 1,
648
+ debug: false,
649
+ platformClientId: "",
650
+ platformClientSecret: "",
651
+ platformTimeout: 60000,
652
+ platformMaxRedirects: 10,
653
+ platformMaxUnencryptedFileSize: 10 * 1024 * 1024,
654
+ baseUrl: "",
655
+ realm: Identity_1.Realm.Prod,
656
+ datawalletEnabled: false,
657
+ httpAgent: {
658
+ keepAlive: true,
659
+ maxSockets: 5,
660
+ maxFreeSockets: 2
661
+ },
662
+ httpsAgent: {
663
+ keepAlive: true,
664
+ maxSockets: 5,
665
+ maxFreeSockets: 2
666
+ }
667
+ };
652
668
  //# sourceMappingURL=Transport.js.map
653
669
 
654
670
  /***/ }),
@@ -990,6 +1006,15 @@ class Datawallet {
990
1006
  throw new Error(`Given type '${type}' is not supported.`);
991
1007
  }
992
1008
  }
1009
+ insufficientSupportedDatawalletVersion(supportedVersion, requiredVersion) {
1010
+ return new CoreError_1.CoreError("error.transport.datawallet.insufficientSupportedDatawalletVersion", `The SupportedDatawalletVersion '${supportedVersion}' is too low. A minimum version of '${requiredVersion}' is required.`);
1011
+ }
1012
+ currentBiggerThanTarget(current, target) {
1013
+ return new CoreError_1.CoreError("error.transport.datawallet.currentBiggerThanTarget", `The current datawallet version '${current}' is bigger than the target version '${target}'.`);
1014
+ }
1015
+ noMigrationAvailable(version) {
1016
+ return new CoreError_1.CoreError("error.core.datawallet.noMigrationAvailable", `There is no migration available for the datawallet version '${version}'.`);
1017
+ }
993
1018
  }
994
1019
  class Files {
995
1020
  plaintextHashMismatch() {
@@ -1020,6 +1045,9 @@ class Tokens {
1020
1045
  }
1021
1046
  }
1022
1047
  class General {
1048
+ invalidDatawalletVersion() {
1049
+ return new CoreError_1.CoreError("error.transport.general.invalidDatawalletVersion", "The given identity version is invalid. The value must be 0 or higher.");
1050
+ }
1023
1051
  baseUrlNotSet() {
1024
1052
  return new CoreError_1.CoreError("error.transport.general.baseUrlNotSet", "The baseUrl was not set.");
1025
1053
  }
@@ -1478,7 +1506,7 @@ class RESTClient {
1478
1506
  }
1479
1507
  };
1480
1508
  if (this.config.platformAdditionalHeaders) {
1481
- defaults.headers = this.config.platformAdditionalHeaders;
1509
+ defaults.headers = lodash_1.default.defaultsDeep({}, defaults.headers, this.config.platformAdditionalHeaders);
1482
1510
  }
1483
1511
  if (typeof http_1.Agent !== "undefined" && typeof https_1.Agent !== "undefined") {
1484
1512
  defaults.httpAgent = this.createHTTPAgent();
@@ -2059,6 +2087,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
2059
2087
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2060
2088
  };
2061
2089
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2090
+ __exportStar(__webpack_require__(/*! ./Authenticator */ "./dist/core/backbone/Authenticator.js"), exports);
2062
2091
  __exportStar(__webpack_require__(/*! ./BackboneIds */ "./dist/core/backbone/BackboneIds.js"), exports);
2063
2092
  __exportStar(__webpack_require__(/*! ./ClientResult */ "./dist/core/backbone/ClientResult.js"), exports);
2064
2093
  __exportStar(__webpack_require__(/*! ./Paginator */ "./dist/core/backbone/Paginator.js"), exports);
@@ -2096,6 +2125,7 @@ __exportStar(__webpack_require__(/*! ./CoreSerializable */ "./dist/core/CoreSeri
2096
2125
  __exportStar(__webpack_require__(/*! ./CoreSerializableAsync */ "./dist/core/CoreSerializableAsync.js"), exports);
2097
2126
  __exportStar(__webpack_require__(/*! ./CoreSynchronizable */ "./dist/core/CoreSynchronizable.js"), exports);
2098
2127
  __exportStar(__webpack_require__(/*! ./CoreUtil */ "./dist/core/CoreUtil.js"), exports);
2128
+ __exportStar(__webpack_require__(/*! ./DependencyOverrides */ "./dist/core/DependencyOverrides.js"), exports);
2099
2129
  __exportStar(__webpack_require__(/*! ./Transport */ "./dist/core/Transport.js"), exports);
2100
2130
  __exportStar(__webpack_require__(/*! ./TransportContext */ "./dist/core/TransportContext.js"), exports);
2101
2131
  __exportStar(__webpack_require__(/*! ./TransportController */ "./dist/core/TransportController.js"), exports);
@@ -2607,10 +2637,11 @@ const Identity_1 = __webpack_require__(/*! ./data/Identity */ "./dist/modules/ac
2607
2637
  const IdentityController_1 = __webpack_require__(/*! ./IdentityController */ "./dist/modules/accounts/IdentityController.js");
2608
2638
  const IdentityUtil_1 = __webpack_require__(/*! ./IdentityUtil */ "./dist/modules/accounts/IdentityUtil.js");
2609
2639
  class AccountController {
2610
- constructor(_transport, _db, _config) {
2640
+ constructor(_transport, _db, _config, dependencyOverrides = {}) {
2611
2641
  this._transport = _transport;
2612
2642
  this._db = _db;
2613
2643
  this._config = _config;
2644
+ this.dependencyOverrides = dependencyOverrides;
2614
2645
  this._dbClosed = false;
2615
2646
  this.autoSync = true;
2616
2647
  this._authenticator = new Authenticator_1.Authenticator(this);
@@ -2695,6 +2726,7 @@ class AccountController {
2695
2726
  await this.initControllers();
2696
2727
  if (identityCreated) {
2697
2728
  await this.devices.addExistingDevice(device);
2729
+ await this.synchronization.setInititalDatawalletVersion(this._config.supportedDatawalletVersion);
2698
2730
  }
2699
2731
  else if (deviceUpdated) {
2700
2732
  await this.syncDatawallet();
@@ -2712,7 +2744,6 @@ class AccountController {
2712
2744
  }
2713
2745
  async initControllers() {
2714
2746
  this._log.trace("Initializing controllers...");
2715
- this.synchronization = await new SyncController_1.SyncController(this, this.unpushedDatawalletModifications, this.config.datawalletEnabled).init();
2716
2747
  this.relationshipSecrets = await new RelationshipSecretController_1.RelationshipSecretController(this).init();
2717
2748
  this.devices = await new DevicesController_1.DevicesController(this).init();
2718
2749
  this.certificates = await new CertificateController_1.CertificateController(this).init();
@@ -2723,6 +2754,7 @@ class AccountController {
2723
2754
  this.relationshipTemplates = await new RelationshipTemplateController_1.RelationshipTemplateController(this, this.relationshipSecrets).init();
2724
2755
  this.messages = await new MessageController_1.MessageController(this).init();
2725
2756
  this.tokens = await new TokenController_1.TokenController(this).init();
2757
+ this.synchronization = await new SyncController_1.SyncController(this, this.dependencyOverrides, this.unpushedDatawalletModifications, this.config.datawalletEnabled).init();
2726
2758
  this._log.trace("Initialization of controllers finished.");
2727
2759
  }
2728
2760
  disableAutoSync() {
@@ -2815,7 +2847,8 @@ class AccountController {
2815
2847
  publicKey: deviceKeypair.publicKey,
2816
2848
  type: deviceInfo.type,
2817
2849
  certificate: "",
2818
- username: deviceResponse.device.username
2850
+ username: deviceResponse.device.username,
2851
+ datawalletVersion: this._config.supportedDatawalletVersion
2819
2852
  });
2820
2853
  // Initialize required controllers
2821
2854
  await Promise.all([this.identity.init(identity), this.activeDevice.init(privBaseDevice, device)]);
@@ -2901,9 +2934,9 @@ class AccountController {
2901
2934
  async getSynchronizedCollection(collectionName) {
2902
2935
  const collection = await this.db.getCollection(collectionName);
2903
2936
  if (!this.config.datawalletEnabled) {
2904
- return new SynchronizedCollection_1.SynchronizedCollection(collection);
2937
+ return new SynchronizedCollection_1.SynchronizedCollection(collection, this.config.supportedDatawalletVersion);
2905
2938
  }
2906
- return new SynchronizedCollection_1.SynchronizedCollection(collection, this.unpushedDatawalletModifications);
2939
+ return new SynchronizedCollection_1.SynchronizedCollection(collection, this.config.supportedDatawalletVersion, this.unpushedDatawalletModifications);
2907
2940
  }
2908
2941
  }
2909
2942
  exports.AccountController = AccountController;
@@ -4443,10 +4476,15 @@ class DeviceController extends core_1.TransportController {
4443
4476
  throw e;
4444
4477
  }
4445
4478
  }
4446
- async update(name, description) {
4447
- this.device.name = name;
4448
- this.device.description = description;
4449
- await this.parent.info.set("device", this.device);
4479
+ async update(update) {
4480
+ if (update.name)
4481
+ this.device.name = update.name;
4482
+ if (update.description)
4483
+ this.device.description = update.description;
4484
+ if (update.datawalletVersion)
4485
+ this.device.datawalletVersion = update.datawalletVersion;
4486
+ await this.parent.devices.update(this.device);
4487
+ await this.parent.info.set("device", this.device.toJSON());
4450
4488
  }
4451
4489
  async sign(content) {
4452
4490
  const privateKeyContainer = await this.secrets.loadSecret(DeviceSecretController_1.DeviceSecretType.DeviceSignature);
@@ -4884,7 +4922,8 @@ let Device = Device_1 = class Device extends core_1.CoreSynchronizable {
4884
4922
  (0, ts_simple_nameof_1.nameof)((d) => d.createdByDevice),
4885
4923
  (0, ts_simple_nameof_1.nameof)((d) => d.lastLoginAt),
4886
4924
  (0, ts_simple_nameof_1.nameof)((d) => d.username),
4887
- (0, ts_simple_nameof_1.nameof)((d) => d.initialPassword)
4925
+ (0, ts_simple_nameof_1.nameof)((d) => d.initialPassword),
4926
+ (0, ts_simple_nameof_1.nameof)((d) => d.datawalletVersion)
4888
4927
  ];
4889
4928
  this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((d) => d.name), (0, ts_simple_nameof_1.nameof)((d) => d.description)];
4890
4929
  }
@@ -4952,6 +4991,11 @@ __decorate([
4952
4991
  (0, ts_serval_1.serialize)(),
4953
4992
  __metadata("design:type", Boolean)
4954
4993
  ], Device.prototype, "isAdmin", void 0);
4994
+ __decorate([
4995
+ (0, ts_serval_1.validate)({ nullable: true }),
4996
+ (0, ts_serval_1.serialize)(),
4997
+ __metadata("design:type", Number)
4998
+ ], Device.prototype, "datawalletVersion", void 0);
4955
4999
  Device = Device_1 = __decorate([
4956
5000
  (0, ts_serval_1.type)("Device")
4957
5001
  ], Device);
@@ -6032,6 +6076,14 @@ __exportStar(__webpack_require__(/*! ./relationshipTemplates/transmission/Relati
6032
6076
  __exportStar(__webpack_require__(/*! ./secrets/data/SecretContainerCipher */ "./dist/modules/secrets/data/SecretContainerCipher.js"), exports);
6033
6077
  __exportStar(__webpack_require__(/*! ./secrets/data/SecretContainerPlain */ "./dist/modules/secrets/data/SecretContainerPlain.js"), exports);
6034
6078
  __exportStar(__webpack_require__(/*! ./secrets/SecretController */ "./dist/modules/secrets/SecretController.js"), exports);
6079
+ __exportStar(__webpack_require__(/*! ./sync/backbone/BackboneDatawalletModification */ "./dist/modules/sync/backbone/BackboneDatawalletModification.js"), exports);
6080
+ __exportStar(__webpack_require__(/*! ./sync/backbone/BackboneExternalEvent */ "./dist/modules/sync/backbone/BackboneExternalEvent.js"), exports);
6081
+ __exportStar(__webpack_require__(/*! ./sync/backbone/CreateDatawalletModifications */ "./dist/modules/sync/backbone/CreateDatawalletModifications.js"), exports);
6082
+ __exportStar(__webpack_require__(/*! ./sync/backbone/FinalizeSyncRun */ "./dist/modules/sync/backbone/FinalizeSyncRun.js"), exports);
6083
+ __exportStar(__webpack_require__(/*! ./sync/backbone/GetDatawallet */ "./dist/modules/sync/backbone/GetDatawallet.js"), exports);
6084
+ __exportStar(__webpack_require__(/*! ./sync/backbone/GetDatawalletModifications */ "./dist/modules/sync/backbone/GetDatawalletModifications.js"), exports);
6085
+ __exportStar(__webpack_require__(/*! ./sync/backbone/StartSyncRun */ "./dist/modules/sync/backbone/StartSyncRun.js"), exports);
6086
+ __exportStar(__webpack_require__(/*! ./sync/backbone/SyncClient */ "./dist/modules/sync/backbone/SyncClient.js"), exports);
6035
6087
  __exportStar(__webpack_require__(/*! ./sync/ChangedItems */ "./dist/modules/sync/ChangedItems.js"), exports);
6036
6088
  __exportStar(__webpack_require__(/*! ./sync/DatawalletModificationsProcessor */ "./dist/modules/sync/DatawalletModificationsProcessor.js"), exports);
6037
6089
  __exportStar(__webpack_require__(/*! ./sync/ExternalEventsProcessor */ "./dist/modules/sync/ExternalEventsProcessor.js"), exports);
@@ -7042,7 +7094,7 @@ class RelationshipTemplateController extends TransportController_1.TransportCont
7042
7094
  const templateKey = await this.secrets.createTemplateKey();
7043
7095
  const templateContent = await RelationshipTemplateContent_1.RelationshipTemplateContent.from({
7044
7096
  content: parameters.content,
7045
- identity: this.parent.identity,
7097
+ identity: this.parent.identity.identity,
7046
7098
  templateKey: templateKey
7047
7099
  });
7048
7100
  const secretKey = await core_1.CoreCrypto.generateSecretKey();
@@ -7066,7 +7118,7 @@ class RelationshipTemplateController extends TransportController_1.TransportCont
7066
7118
  createdBy: this.parent.identity.address,
7067
7119
  createdByDevice: this.parent.activeDevice.id,
7068
7120
  expiresAt: parameters.expiresAt,
7069
- identity: this.parent.identity,
7121
+ identity: this.parent.identity.identity,
7070
7122
  maxNumberOfRelationships: (_a = parameters.maxNumberOfRelationships) !== null && _a !== void 0 ? _a : undefined,
7071
7123
  templateKey: templateKey
7072
7124
  });
@@ -9667,7 +9719,7 @@ exports.DatawalletModificationMapper = void 0;
9667
9719
  const core_1 = __webpack_require__(/*! ../../core */ "./dist/core/index.js");
9668
9720
  const DatawalletModification_1 = __webpack_require__(/*! ./local/DatawalletModification */ "./dist/modules/sync/local/DatawalletModification.js");
9669
9721
  class DatawalletModificationMapper {
9670
- static async fromBackboneDatawalletModification(backboneDatawalletModification, decryptedPayload) {
9722
+ static async fromBackboneDatawalletModification(backboneDatawalletModification, decryptedPayload, datawalletVersion) {
9671
9723
  let type;
9672
9724
  switch (backboneDatawalletModification.type) {
9673
9725
  case "Create":
@@ -9708,16 +9760,19 @@ class DatawalletModificationMapper {
9708
9760
  payloadCategory: payloadCategory,
9709
9761
  collection: backboneDatawalletModification.collection,
9710
9762
  type: type,
9711
- payload: decryptedPayload
9763
+ payload: decryptedPayload,
9764
+ datawalletVersion: datawalletVersion
9712
9765
  });
9713
9766
  }
9714
9767
  static toCreateDatawalletModificationsRequestItem(datawalletModification, encryptedPayload) {
9768
+ var _a;
9715
9769
  return {
9716
9770
  objectIdentifier: datawalletModification.objectIdentifier.toString(),
9717
9771
  payloadCategory: datawalletModification.payloadCategory,
9718
9772
  collection: datawalletModification.collection,
9719
9773
  type: datawalletModification.type,
9720
- encryptedPayload: encryptedPayload
9774
+ encryptedPayload: encryptedPayload,
9775
+ datawalletVersion: (_a = datawalletModification.datawalletVersion) !== null && _a !== void 0 ? _a : 0
9721
9776
  };
9722
9777
  }
9723
9778
  }
@@ -10032,15 +10087,26 @@ const DatawalletModificationMapper_1 = __webpack_require__(/*! ./DatawalletModif
10032
10087
  const DatawalletModificationsProcessor_1 = __webpack_require__(/*! ./DatawalletModificationsProcessor */ "./dist/modules/sync/DatawalletModificationsProcessor.js");
10033
10088
  const ExternalEventsProcessor_1 = __webpack_require__(/*! ./ExternalEventsProcessor */ "./dist/modules/sync/ExternalEventsProcessor.js");
10034
10089
  const DatawalletModification_1 = __webpack_require__(/*! ./local/DatawalletModification */ "./dist/modules/sync/local/DatawalletModification.js");
10090
+ const DeviceMigrations_1 = __webpack_require__(/*! ./migrations/DeviceMigrations */ "./dist/modules/sync/migrations/DeviceMigrations.js");
10091
+ const IdentityMigrations_1 = __webpack_require__(/*! ./migrations/IdentityMigrations */ "./dist/modules/sync/migrations/IdentityMigrations.js");
10035
10092
  class SyncController extends core_1.TransportController {
10036
- constructor(parent, unpushedDatawalletModifications, datawalletEnabled) {
10093
+ constructor(parent, dependencyOverrides, unpushedDatawalletModifications, datawalletEnabled) {
10094
+ var _a;
10037
10095
  super(core_1.ControllerName.Sync, parent);
10038
10096
  this.unpushedDatawalletModifications = unpushedDatawalletModifications;
10039
10097
  this.datawalletEnabled = datawalletEnabled;
10098
+ this.client = (_a = dependencyOverrides.syncClient) !== null && _a !== void 0 ? _a : new SyncClient_1.SyncClient(this.config, this.parent.authenticator);
10099
+ this.identityMigrations = new IdentityMigrations_1.IdentityMigrations(this.parent);
10100
+ this.deviceMigrations = new DeviceMigrations_1.DeviceMigrations(this.parent);
10101
+ }
10102
+ get cacheFetcher() {
10103
+ if (!this._cacheFetcher) {
10104
+ this._cacheFetcher = new DatawalletModificationsProcessor_1.CacheFetcher(this.parent.files, this.parent.messages, this.parent.relationshipTemplates, this.parent.relationships, this.parent.tokens);
10105
+ }
10106
+ return this._cacheFetcher;
10040
10107
  }
10041
10108
  async init() {
10042
10109
  await super.init();
10043
- this.client = new SyncClient_1.SyncClient(this.config, this.parent.authenticator);
10044
10110
  this.syncInfo = await this.db.getMap("SyncInfo");
10045
10111
  return this;
10046
10112
  }
@@ -10069,33 +10135,120 @@ class SyncController extends core_1.TransportController {
10069
10135
  if (whatToSync === "OnlyDatawallet") {
10070
10136
  return await this.syncDatawallet();
10071
10137
  }
10072
- const syncRunWasStarted = await this.startSyncRun();
10073
- if (!syncRunWasStarted) {
10074
- await this.syncDatawallet();
10075
- await this.setLastCompletedSyncTime();
10076
- return new ChangedItems_1.ChangedItems();
10077
- }
10078
- await this.applyIncomingDatawalletModifications();
10079
- const result = await this.applyIncomingExternalEvents();
10080
- await this.finalizeSyncRun(result.results);
10138
+ const externalEventSyncResult = await this.syncExternalEvents();
10081
10139
  await this.setLastCompletedSyncTime();
10082
- if (result.results.some((r) => r.errorCode !== undefined)) {
10083
- throw new core_1.CoreError("error.transport.errorWhileApplyingExternalEvents", result.results
10140
+ if (externalEventSyncResult.externalEventResults.some((r) => r.errorCode !== undefined)) {
10141
+ throw new core_1.CoreError("error.transport.errorWhileApplyingExternalEvents", externalEventSyncResult.externalEventResults
10084
10142
  .filter((r) => r.errorCode !== undefined)
10085
10143
  .map((r) => r.errorCode)
10086
10144
  .join(" | ")).logWith(this.log);
10087
10145
  }
10088
- return result.changedItems;
10146
+ return externalEventSyncResult.changedItems;
10147
+ }
10148
+ async syncExternalEvents() {
10149
+ const syncRunWasStarted = await this.startExternalEventsSyncRun();
10150
+ if (!syncRunWasStarted) {
10151
+ await this.syncDatawallet();
10152
+ return {
10153
+ changedItems: new ChangedItems_1.ChangedItems(),
10154
+ externalEventResults: []
10155
+ };
10156
+ }
10157
+ await this.applyIncomingDatawalletModifications();
10158
+ const result = await this.applyIncomingExternalEvents();
10159
+ await this.finalizeExternalEventsSyncRun(result.externalEventResults);
10160
+ return result;
10089
10161
  }
10090
10162
  async syncDatawallet() {
10091
10163
  if (!this.datawalletEnabled) {
10092
10164
  return;
10093
10165
  }
10166
+ const identityDatawalletVersion = await this.getIdentityDatawalletVersion();
10167
+ if (this.config.supportedDatawalletVersion < identityDatawalletVersion) {
10168
+ // This means that the datawallet of the identity was upgraded by another device with a higher version.
10169
+ // It is necesssary to update the current device.
10170
+ throw core_1.TransportErrors.datawallet
10171
+ .insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion, identityDatawalletVersion)
10172
+ .logWith(this.log);
10173
+ }
10094
10174
  this.log.trace("Synchronization of Datawallet events started...");
10095
- await this.applyIncomingDatawalletModifications();
10096
- await this.pushLocalDatawalletModifications();
10097
- await this.setLastCompletedDatawalletSyncTime();
10175
+ try {
10176
+ await this.applyIncomingDatawalletModifications();
10177
+ await this.pushLocalDatawalletModifications();
10178
+ await this.setLastCompletedDatawalletSyncTime();
10179
+ }
10180
+ catch (e) {
10181
+ const outdatedErrorCode = "error.platform.validation.datawallet.insufficientSupportedDatawalletVersion";
10182
+ if (!(e instanceof core_1.RequestError) || e.code !== outdatedErrorCode)
10183
+ throw e;
10184
+ throw core_1.TransportErrors.datawallet
10185
+ .insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion, identityDatawalletVersion)
10186
+ .logWith(this.log);
10187
+ }
10098
10188
  this.log.trace("Synchronization of Datawallet events ended...");
10189
+ await this.checkDatawalletVersion(identityDatawalletVersion);
10190
+ }
10191
+ async checkDatawalletVersion(identityDatawalletVersion) {
10192
+ var _a;
10193
+ if (this.config.supportedDatawalletVersion < identityDatawalletVersion) {
10194
+ throw core_1.TransportErrors.datawallet
10195
+ .insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion, identityDatawalletVersion)
10196
+ .logWith(this.log);
10197
+ }
10198
+ if (this.config.supportedDatawalletVersion > identityDatawalletVersion) {
10199
+ await this.upgradeIdentityDatawalletVersion(identityDatawalletVersion, this.config.supportedDatawalletVersion);
10200
+ }
10201
+ const deviceDatawalletVersion = (_a = this.parent.activeDevice.device.datawalletVersion) !== null && _a !== void 0 ? _a : 0;
10202
+ if (deviceDatawalletVersion < identityDatawalletVersion) {
10203
+ await this.upgradeDeviceDatawalletVersion(deviceDatawalletVersion, this.config.supportedDatawalletVersion);
10204
+ }
10205
+ }
10206
+ async upgradeIdentityDatawalletVersion(identityDatawalletVersion, targetDatawalletVersion) {
10207
+ if (identityDatawalletVersion === targetDatawalletVersion)
10208
+ return;
10209
+ if (this.config.supportedDatawalletVersion < targetDatawalletVersion) {
10210
+ throw core_1.TransportErrors.datawallet
10211
+ .insufficientSupportedDatawalletVersion(targetDatawalletVersion, identityDatawalletVersion)
10212
+ .logWith(this.log);
10213
+ }
10214
+ if (identityDatawalletVersion > targetDatawalletVersion) {
10215
+ throw core_1.TransportErrors.datawallet
10216
+ .currentBiggerThanTarget(identityDatawalletVersion, targetDatawalletVersion)
10217
+ .logWith(this.log);
10218
+ }
10219
+ while (identityDatawalletVersion < targetDatawalletVersion) {
10220
+ identityDatawalletVersion++;
10221
+ await this.startDatawalletVersionUpgradeSyncRun();
10222
+ const migrationFunction = this.identityMigrations[`v${identityDatawalletVersion}`];
10223
+ if (!migrationFunction) {
10224
+ throw core_1.TransportErrors.datawallet.noMigrationAvailable(identityDatawalletVersion).logWith(this.log);
10225
+ }
10226
+ await migrationFunction.call(this.identityMigrations);
10227
+ await this.finalizeDatawalletVersionUpgradeSyncRun(identityDatawalletVersion);
10228
+ }
10229
+ }
10230
+ async upgradeDeviceDatawalletVersion(deviceDatawalletVersion, targetDatawalletVersion) {
10231
+ if (deviceDatawalletVersion === targetDatawalletVersion)
10232
+ return;
10233
+ if (this.config.supportedDatawalletVersion < targetDatawalletVersion) {
10234
+ throw core_1.TransportErrors.datawallet
10235
+ .insufficientSupportedDatawalletVersion(targetDatawalletVersion, deviceDatawalletVersion)
10236
+ .logWith(this.log);
10237
+ }
10238
+ if (deviceDatawalletVersion > targetDatawalletVersion) {
10239
+ throw core_1.TransportErrors.datawallet
10240
+ .currentBiggerThanTarget(deviceDatawalletVersion, targetDatawalletVersion)
10241
+ .logWith(this.log);
10242
+ }
10243
+ while (deviceDatawalletVersion < targetDatawalletVersion) {
10244
+ deviceDatawalletVersion++;
10245
+ const migrationFunction = this.deviceMigrations[`v${deviceDatawalletVersion}`];
10246
+ if (!migrationFunction) {
10247
+ throw core_1.TransportErrors.datawallet.noMigrationAvailable(deviceDatawalletVersion).logWith(this.log);
10248
+ }
10249
+ await migrationFunction.call(this.deviceMigrations);
10250
+ await this.parent.activeDevice.update({ datawalletVersion: deviceDatawalletVersion });
10251
+ }
10099
10252
  }
10100
10253
  async applyIncomingDatawalletModifications() {
10101
10254
  const getDatawalletModificationsResult = await this.client.getDatawalletModifications({
@@ -10107,7 +10260,7 @@ class SyncController extends core_1.TransportController {
10107
10260
  }
10108
10261
  const incomingModifications = await this.decryptDatawalletModifications(encryptedIncomingModifications);
10109
10262
  this.log.trace(`${incomingModifications.length} incoming modifications found`);
10110
- const datawalletModificationsProcessor = new DatawalletModificationsProcessor_1.DatawalletModificationsProcessor(incomingModifications, new DatawalletModificationsProcessor_1.CacheFetcher(this.parent.files, this.parent.messages, this.parent.relationshipTemplates, this.parent.relationships, this.parent.tokens), this._db, core_1.TransportLoggerFactory.getLogger(DatawalletModificationsProcessor_1.DatawalletModificationsProcessor));
10263
+ const datawalletModificationsProcessor = new DatawalletModificationsProcessor_1.DatawalletModificationsProcessor(incomingModifications, this.cacheFetcher, this._db, core_1.TransportLoggerFactory.getLogger(DatawalletModificationsProcessor_1.DatawalletModificationsProcessor));
10111
10264
  await datawalletModificationsProcessor.execute();
10112
10265
  this.log.trace(`${incomingModifications.length} incoming modifications executed`, incomingModifications);
10113
10266
  await this.updateLocalDatawalletModificationIndex(encryptedIncomingModifications.sort(descending)[0].index);
@@ -10116,7 +10269,7 @@ class SyncController extends core_1.TransportController {
10116
10269
  const decryptedModifications = [];
10117
10270
  for (const encryptedModification of encryptedModifications) {
10118
10271
  const decryptedPayload = await this.parent.activeDevice.secrets.decryptDatawalletModificationPayload(encryptedModification.encryptedPayload, encryptedModification.index);
10119
- const decryptedModification = await DatawalletModificationMapper_1.DatawalletModificationMapper.fromBackboneDatawalletModification(encryptedModification, decryptedPayload);
10272
+ const decryptedModification = await DatawalletModificationMapper_1.DatawalletModificationMapper.fromBackboneDatawalletModification(encryptedModification, decryptedPayload, this.config.supportedDatawalletVersion);
10120
10273
  decryptedModifications.push(decryptedModification);
10121
10274
  }
10122
10275
  return decryptedModifications;
@@ -10155,15 +10308,29 @@ class SyncController extends core_1.TransportController {
10155
10308
  await this.unpushedDatawalletModifications.delete({ localId: localModificationId.toString() });
10156
10309
  }
10157
10310
  }
10158
- async startSyncRun() {
10311
+ async setInititalDatawalletVersion(version) {
10312
+ await this.startDatawalletVersionUpgradeSyncRun();
10313
+ await this.finalizeDatawalletVersionUpgradeSyncRun(version);
10314
+ }
10315
+ async getIdentityDatawalletVersion() {
10316
+ const datawalletInfo = (await this.client.getDatawallet()).value;
10317
+ return datawalletInfo.version;
10318
+ }
10319
+ async startExternalEventsSyncRun() {
10159
10320
  var _a;
10160
- const result = await this.client.startSyncRun();
10321
+ const result = await this.client.startSyncRun({ type: StartSyncRun_1.SyncRunType.ExternalEventSync });
10161
10322
  if (result.value.status === StartSyncRun_1.StartSyncRunStatus.NoNewEvents) {
10162
10323
  return false;
10163
10324
  }
10164
10325
  this.currentSyncRun = (_a = result.value.syncRun) !== null && _a !== void 0 ? _a : undefined;
10165
10326
  return this.currentSyncRun !== undefined;
10166
10327
  }
10328
+ async startDatawalletVersionUpgradeSyncRun() {
10329
+ var _a;
10330
+ const result = await this.client.startSyncRun({ type: StartSyncRun_1.SyncRunType.DatawalletVersionUpgrade });
10331
+ this.currentSyncRun = (_a = result.value.syncRun) !== null && _a !== void 0 ? _a : undefined;
10332
+ return this.currentSyncRun !== undefined;
10333
+ }
10167
10334
  async applyIncomingExternalEvents() {
10168
10335
  const getExternalEventsResult = await this.client.getExternalEventsOfSyncRun(this.currentSyncRun.id.toString());
10169
10336
  if (getExternalEventsResult.isError) {
@@ -10172,14 +10339,17 @@ class SyncController extends core_1.TransportController {
10172
10339
  const externalEvents = await getExternalEventsResult.value.collect();
10173
10340
  const externalEventProcessor = new ExternalEventsProcessor_1.ExternalEventsProcessor(this.parent.messages, this.parent.relationships, externalEvents);
10174
10341
  await externalEventProcessor.execute();
10175
- return { results: externalEventProcessor.results, changedItems: externalEventProcessor.changedItems };
10342
+ return {
10343
+ externalEventResults: externalEventProcessor.results,
10344
+ changedItems: externalEventProcessor.changedItems
10345
+ };
10176
10346
  }
10177
- async finalizeSyncRun(externalEventResults) {
10347
+ async finalizeExternalEventsSyncRun(externalEventResults) {
10178
10348
  if (!this.currentSyncRun) {
10179
10349
  throw new Error("There is no active sync run to finalize");
10180
10350
  }
10181
10351
  const { backboneModifications, localModificationIds } = await this.prepareLocalDatawalletModificationsForPush();
10182
- await this.client.finalizeSyncRun(this.currentSyncRun.id.toString(), {
10352
+ await this.client.finalizeExternalEventSync(this.currentSyncRun.id.toString(), {
10183
10353
  datawalletModifications: backboneModifications,
10184
10354
  externalEventResults: externalEventResults
10185
10355
  });
@@ -10189,6 +10359,21 @@ class SyncController extends core_1.TransportController {
10189
10359
  await this.updateLocalDatawalletModificationIndex(newDatawalletModificationIndex);
10190
10360
  this.currentSyncRun = undefined;
10191
10361
  }
10362
+ async finalizeDatawalletVersionUpgradeSyncRun(newDatawalletVersion) {
10363
+ if (!this.currentSyncRun) {
10364
+ throw new Error("There is no active sync run to finalize");
10365
+ }
10366
+ const { backboneModifications, localModificationIds } = await this.prepareLocalDatawalletModificationsForPush();
10367
+ await this.client.finalizeDatawalletVersionUpgrade(this.currentSyncRun.id.toString(), {
10368
+ newDatawalletVersion,
10369
+ datawalletModifications: backboneModifications
10370
+ });
10371
+ await this.deleteUnpushedDatawalletModifications(localModificationIds);
10372
+ const oldDatawalletModificationIndex = await this.getLocalDatawalletModificationIndex();
10373
+ const newDatawalletModificationIndex = (oldDatawalletModificationIndex || -1) + backboneModifications.length;
10374
+ await this.updateLocalDatawalletModificationIndex(newDatawalletModificationIndex);
10375
+ this.currentSyncRun = undefined;
10376
+ }
10192
10377
  async getLocalDatawalletModificationIndex() {
10193
10378
  const index = await this.syncInfo.get("localDatawalletModificationIndex");
10194
10379
  return index;
@@ -10258,8 +10443,9 @@ const CoreSerializableAsync_1 = __webpack_require__(/*! ../../core/CoreSerializa
10258
10443
  const TransportIds_1 = __webpack_require__(/*! ../../core/TransportIds */ "./dist/core/TransportIds.js");
10259
10444
  const DatawalletModification_1 = __webpack_require__(/*! ../sync/local/DatawalletModification */ "./dist/modules/sync/local/DatawalletModification.js");
10260
10445
  class SynchronizedCollection {
10261
- constructor(parent, datawalletModifications) {
10446
+ constructor(parent, datawalletVersion, datawalletModifications) {
10262
10447
  this.parent = parent;
10448
+ this.datawalletVersion = datawalletVersion;
10263
10449
  this.datawalletModifications = datawalletModifications;
10264
10450
  this.name = parent.name;
10265
10451
  this.databaseType = parent.databaseType;
@@ -10280,7 +10466,8 @@ class SynchronizedCollection {
10280
10466
  collection: this.name,
10281
10467
  objectIdentifier: objectIdentifier,
10282
10468
  payloadCategory: DatawalletModification_1.DatawalletModificationCategory.TechnicalData,
10283
- payload: technicalModificationPayload
10469
+ payload: technicalModificationPayload,
10470
+ datawalletVersion: this.datawalletVersion
10284
10471
  }));
10285
10472
  }
10286
10473
  if (Object.getOwnPropertyNames(metadataModificationPayload).length !== 0) {
@@ -10290,7 +10477,8 @@ class SynchronizedCollection {
10290
10477
  collection: this.name,
10291
10478
  objectIdentifier: objectIdentifier,
10292
10479
  payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Metadata,
10293
- payload: metadataModificationPayload
10480
+ payload: metadataModificationPayload,
10481
+ datawalletVersion: this.datawalletVersion
10294
10482
  }));
10295
10483
  }
10296
10484
  if (Object.getOwnPropertyNames(userdataModificationPayload).length !== 0) {
@@ -10300,7 +10488,8 @@ class SynchronizedCollection {
10300
10488
  collection: this.name,
10301
10489
  objectIdentifier: objectIdentifier,
10302
10490
  payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Userdata,
10303
- payload: userdataModificationPayload
10491
+ payload: userdataModificationPayload,
10492
+ datawalletVersion: this.datawalletVersion
10304
10493
  }));
10305
10494
  }
10306
10495
  await this.parent.create(newObject);
@@ -10334,7 +10523,8 @@ class SynchronizedCollection {
10334
10523
  collection: this.name,
10335
10524
  objectIdentifier: objectIdentifier,
10336
10525
  payloadCategory: DatawalletModification_1.DatawalletModificationCategory.TechnicalData,
10337
- payload: payload
10526
+ payload: payload,
10527
+ datawalletVersion: this.datawalletVersion
10338
10528
  }));
10339
10529
  }
10340
10530
  if (haveMetadataPropertiesChanged) {
@@ -10345,7 +10535,8 @@ class SynchronizedCollection {
10345
10535
  collection: this.name,
10346
10536
  objectIdentifier: objectIdentifier,
10347
10537
  payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Metadata,
10348
- payload: payload
10538
+ payload: payload,
10539
+ datawalletVersion: this.datawalletVersion
10349
10540
  }));
10350
10541
  }
10351
10542
  if (haveUserdataPropertiesChanged) {
@@ -10356,7 +10547,8 @@ class SynchronizedCollection {
10356
10547
  collection: this.name,
10357
10548
  objectIdentifier: objectIdentifier,
10358
10549
  payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Userdata,
10359
- payload: payload
10550
+ payload: payload,
10551
+ datawalletVersion: this.datawalletVersion
10360
10552
  }));
10361
10553
  }
10362
10554
  if (hasCacheChanged) {
@@ -10364,7 +10556,8 @@ class SynchronizedCollection {
10364
10556
  localId: await TransportIds_1.TransportIds.datawalletModification.generate(),
10365
10557
  type: DatawalletModification_1.DatawalletModificationType.CacheChanged,
10366
10558
  collection: this.name,
10367
- objectIdentifier: objectIdentifier
10559
+ objectIdentifier: objectIdentifier,
10560
+ datawalletVersion: this.datawalletVersion
10368
10561
  }));
10369
10562
  }
10370
10563
  return await this.parent.update(oldDoc, newObject);
@@ -10377,7 +10570,8 @@ class SynchronizedCollection {
10377
10570
  localId: await TransportIds_1.TransportIds.datawalletModification.generate(),
10378
10571
  type: DatawalletModification_1.DatawalletModificationType.Delete,
10379
10572
  collection: this.name,
10380
- objectIdentifier: object.id
10573
+ objectIdentifier: object.id,
10574
+ datawalletVersion: this.datawalletVersion
10381
10575
  }));
10382
10576
  return await this.parent.delete({ id: object.id.toString() });
10383
10577
  }
@@ -10402,6 +10596,84 @@ exports.SynchronizedCollection = SynchronizedCollection;
10402
10596
 
10403
10597
  /***/ }),
10404
10598
 
10599
+ /***/ "./dist/modules/sync/backbone/BackboneDatawalletModification.js":
10600
+ /*!**********************************************************************!*\
10601
+ !*** ./dist/modules/sync/backbone/BackboneDatawalletModification.js ***!
10602
+ \**********************************************************************/
10603
+ /***/ ((__unused_webpack_module, exports) => {
10604
+
10605
+ "use strict";
10606
+
10607
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10608
+ //# sourceMappingURL=BackboneDatawalletModification.js.map
10609
+
10610
+ /***/ }),
10611
+
10612
+ /***/ "./dist/modules/sync/backbone/BackboneExternalEvent.js":
10613
+ /*!*************************************************************!*\
10614
+ !*** ./dist/modules/sync/backbone/BackboneExternalEvent.js ***!
10615
+ \*************************************************************/
10616
+ /***/ ((__unused_webpack_module, exports) => {
10617
+
10618
+ "use strict";
10619
+
10620
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10621
+ //# sourceMappingURL=BackboneExternalEvent.js.map
10622
+
10623
+ /***/ }),
10624
+
10625
+ /***/ "./dist/modules/sync/backbone/CreateDatawalletModifications.js":
10626
+ /*!*********************************************************************!*\
10627
+ !*** ./dist/modules/sync/backbone/CreateDatawalletModifications.js ***!
10628
+ \*********************************************************************/
10629
+ /***/ ((__unused_webpack_module, exports) => {
10630
+
10631
+ "use strict";
10632
+
10633
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10634
+ //# sourceMappingURL=CreateDatawalletModifications.js.map
10635
+
10636
+ /***/ }),
10637
+
10638
+ /***/ "./dist/modules/sync/backbone/FinalizeSyncRun.js":
10639
+ /*!*******************************************************!*\
10640
+ !*** ./dist/modules/sync/backbone/FinalizeSyncRun.js ***!
10641
+ \*******************************************************/
10642
+ /***/ ((__unused_webpack_module, exports) => {
10643
+
10644
+ "use strict";
10645
+
10646
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10647
+ //# sourceMappingURL=FinalizeSyncRun.js.map
10648
+
10649
+ /***/ }),
10650
+
10651
+ /***/ "./dist/modules/sync/backbone/GetDatawallet.js":
10652
+ /*!*****************************************************!*\
10653
+ !*** ./dist/modules/sync/backbone/GetDatawallet.js ***!
10654
+ \*****************************************************/
10655
+ /***/ ((__unused_webpack_module, exports) => {
10656
+
10657
+ "use strict";
10658
+
10659
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10660
+ //# sourceMappingURL=GetDatawallet.js.map
10661
+
10662
+ /***/ }),
10663
+
10664
+ /***/ "./dist/modules/sync/backbone/GetDatawalletModifications.js":
10665
+ /*!******************************************************************!*\
10666
+ !*** ./dist/modules/sync/backbone/GetDatawalletModifications.js ***!
10667
+ \******************************************************************/
10668
+ /***/ ((__unused_webpack_module, exports) => {
10669
+
10670
+ "use strict";
10671
+
10672
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10673
+ //# sourceMappingURL=GetDatawalletModifications.js.map
10674
+
10675
+ /***/ }),
10676
+
10405
10677
  /***/ "./dist/modules/sync/backbone/StartSyncRun.js":
10406
10678
  /*!****************************************************!*\
10407
10679
  !*** ./dist/modules/sync/backbone/StartSyncRun.js ***!
@@ -10411,7 +10683,12 @@ exports.SynchronizedCollection = SynchronizedCollection;
10411
10683
  "use strict";
10412
10684
 
10413
10685
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10414
- exports.StartSyncRunStatus = void 0;
10686
+ exports.StartSyncRunStatus = exports.SyncRunType = void 0;
10687
+ var SyncRunType;
10688
+ (function (SyncRunType) {
10689
+ SyncRunType["ExternalEventSync"] = "ExternalEventSync";
10690
+ SyncRunType["DatawalletVersionUpgrade"] = "DatawalletVersionUpgrade";
10691
+ })(SyncRunType = exports.SyncRunType || (exports.SyncRunType = {}));
10415
10692
  var StartSyncRunStatus;
10416
10693
  (function (StartSyncRunStatus) {
10417
10694
  StartSyncRunStatus["Created"] = "Created";
@@ -10433,20 +10710,33 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
10433
10710
  exports.SyncClient = void 0;
10434
10711
  const core_1 = __webpack_require__(/*! ../../../core */ "./dist/core/index.js");
10435
10712
  class SyncClient extends core_1.RESTClientAuthenticate {
10436
- async startSyncRun() {
10437
- return await this.post("/api/v1/SyncRuns", {});
10713
+ constructor(config, authenticator) {
10714
+ super(config, authenticator, {
10715
+ headers: {
10716
+ "x-supported-datawallet-version": config.supportedDatawalletVersion.toString()
10717
+ }
10718
+ });
10438
10719
  }
10439
- async finalizeSyncRun(id, request) {
10440
- return await this.put(`/api/v1/SyncRuns/${id}/Finalize`, request);
10720
+ async startSyncRun(request) {
10721
+ return await this.post("/api/v1/SyncRuns", request);
10722
+ }
10723
+ async finalizeExternalEventSync(id, request) {
10724
+ return await this.put(`/api/v1/SyncRuns/${id}/FinalizeExternalEventSync`, request);
10725
+ }
10726
+ async finalizeDatawalletVersionUpgrade(id, request) {
10727
+ return await this.put(`/api/v1/SyncRuns/${id}/FinalizeDatawalletVersionUpgrade`, request);
10441
10728
  }
10442
10729
  async getExternalEventsOfSyncRun(syncRunId) {
10443
10730
  return await this.getPaged(`/api/v1/SyncRuns/${syncRunId}/ExternalEvents`, {});
10444
10731
  }
10732
+ async getDatawallet() {
10733
+ return await this.get("/api/v1/Datawallet");
10734
+ }
10445
10735
  async getDatawalletModifications(request) {
10446
- return await this.getPaged("/api/v1/DatawalletModifications", request);
10736
+ return await this.getPaged("/api/v1/Datawallet/Modifications", request);
10447
10737
  }
10448
10738
  async createDatawalletModifications(request) {
10449
- return await this.post("/api/v1/DatawalletModifications", request);
10739
+ return await this.post("/api/v1/Datawallet/Modifications", request);
10450
10740
  }
10451
10741
  }
10452
10742
  exports.SyncClient = SyncClient;
@@ -10527,6 +10817,11 @@ __decorate([
10527
10817
  (0, ts_serval_1.serialize)(),
10528
10818
  __metadata("design:type", Object)
10529
10819
  ], DatawalletModification.prototype, "payload", void 0);
10820
+ __decorate([
10821
+ (0, ts_serval_1.validate)({ nullable: true }),
10822
+ (0, ts_serval_1.serialize)(),
10823
+ __metadata("design:type", Number)
10824
+ ], DatawalletModification.prototype, "datawalletVersion", void 0);
10530
10825
  DatawalletModification = DatawalletModification_1 = __decorate([
10531
10826
  (0, ts_serval_1.type)("DatawalletModification")
10532
10827
  ], DatawalletModification);
@@ -10535,6 +10830,64 @@ exports.DatawalletModification = DatawalletModification;
10535
10830
 
10536
10831
  /***/ }),
10537
10832
 
10833
+ /***/ "./dist/modules/sync/migrations/DeviceMigrations.js":
10834
+ /*!**********************************************************!*\
10835
+ !*** ./dist/modules/sync/migrations/DeviceMigrations.js ***!
10836
+ \**********************************************************/
10837
+ /***/ ((__unused_webpack_module, exports) => {
10838
+
10839
+ "use strict";
10840
+
10841
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10842
+ exports.DeviceMigrations = void 0;
10843
+ class DeviceMigrations {
10844
+ constructor(accountController) {
10845
+ this.accountController = accountController;
10846
+ }
10847
+ async v1() {
10848
+ const query = { cache: { $exists: false } };
10849
+ const synchronizableToId = (c) => c.id.toString();
10850
+ const files = await this.accountController.files.getFiles(query);
10851
+ await this.accountController.files.updateCache(files.map(synchronizableToId));
10852
+ const messages = await this.accountController.messages.getMessages(query);
10853
+ await this.accountController.messages.updateCache(messages.map(synchronizableToId));
10854
+ const relationships = await this.accountController.relationships.getRelationships(query);
10855
+ await this.accountController.relationships.updateCache(relationships.map(synchronizableToId));
10856
+ const templates = await this.accountController.relationshipTemplates.getRelationshipTemplates(query);
10857
+ await this.accountController.relationshipTemplates.updateCache(templates.map(synchronizableToId));
10858
+ const tokens = await this.accountController.tokens.getTokens(query);
10859
+ await this.accountController.tokens.updateCache(tokens.map(synchronizableToId));
10860
+ }
10861
+ }
10862
+ exports.DeviceMigrations = DeviceMigrations;
10863
+ //# sourceMappingURL=DeviceMigrations.js.map
10864
+
10865
+ /***/ }),
10866
+
10867
+ /***/ "./dist/modules/sync/migrations/IdentityMigrations.js":
10868
+ /*!************************************************************!*\
10869
+ !*** ./dist/modules/sync/migrations/IdentityMigrations.js ***!
10870
+ \************************************************************/
10871
+ /***/ ((__unused_webpack_module, exports) => {
10872
+
10873
+ "use strict";
10874
+
10875
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10876
+ exports.IdentityMigrations = void 0;
10877
+ class IdentityMigrations {
10878
+ constructor(accountController) {
10879
+ this.accountController = accountController;
10880
+ }
10881
+ v1() {
10882
+ // no upgrade steps necessary for v1
10883
+ return Promise.resolve();
10884
+ }
10885
+ }
10886
+ exports.IdentityMigrations = IdentityMigrations;
10887
+ //# sourceMappingURL=IdentityMigrations.js.map
10888
+
10889
+ /***/ }),
10890
+
10538
10891
  /***/ "./dist/modules/tokens/AnonymousTokenController.js":
10539
10892
  /*!*********************************************************!*\
10540
10893
  !*** ./dist/modules/tokens/AnonymousTokenController.js ***!
@@ -11746,95 +12099,33 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
11746
12099
  /*!******************************************************************!*\
11747
12100
  !*** ./node_modules/@js-soft/ts-utils/dist/eventBus/EventBus.js ***!
11748
12101
  \******************************************************************/
11749
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12102
+ /***/ ((__unused_webpack_module, exports) => {
11750
12103
 
11751
12104
  "use strict";
11752
12105
 
11753
12106
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11754
- exports.EventBus = void 0;
11755
- __webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
11756
- const eventemitter2_1 = __webpack_require__(/*! eventemitter2 */ "./node_modules/eventemitter2/lib/eventemitter2.js");
11757
- const Reflection_1 = __webpack_require__(/*! ./reflection/Reflection */ "./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Reflection.js");
11758
- const SubscriptionTargetInfo_1 = __webpack_require__(/*! ./SubscriptionTargetInfo */ "./node_modules/@js-soft/ts-utils/dist/eventBus/SubscriptionTargetInfo.js");
12107
+ exports.getEventNamespaceFromObject = exports.EventBus = void 0;
11759
12108
  class EventBus {
11760
- emitter;
11761
- constructor() {
11762
- this.emitter = new eventemitter2_1.EventEmitter2({ wildcard: true, maxListeners: 50, verboseMemoryLeak: true });
11763
- }
11764
- subscribe(subscriptionTarget, handler) {
11765
- this.registerHandler(subscriptionTarget, handler);
11766
- }
11767
- subscribeOnce(subscriptionTarget, handler) {
11768
- this.registerHandler(subscriptionTarget, handler, true);
11769
- }
11770
- registerHandler(subscriptionTarget, handler, isOneTimeHandler = false) {
11771
- const subscriptionTargetInfo = SubscriptionTargetInfo_1.SubscriptionTargetInfo.from(subscriptionTarget);
11772
- const handlerWrapper = (event) => {
11773
- if (!subscriptionTargetInfo.isCompatibleWith(event)) {
11774
- return;
11775
- }
11776
- handler(event);
11777
- if (isOneTimeHandler) {
11778
- this.emitter.off(subscriptionTargetInfo.namespace, handlerWrapper);
11779
- }
11780
- };
11781
- this.emitter.on(subscriptionTargetInfo.namespace, handlerWrapper);
11782
- }
11783
- async publish(event) {
11784
- let namespace = getEventNamespaceFromObject(event);
11785
- if (!namespace) {
11786
- throw Error("The event needs a namespace. Use the EventNamespaceDecorator in order to define a namespace for a event.");
11787
- }
11788
- this.emitter.emit(namespace, event);
11789
- }
11790
12109
  }
11791
12110
  exports.EventBus = EventBus;
11792
12111
  function getEventNamespaceFromObject(targetObject) {
11793
- var namespaceDecorator = (0, Reflection_1.getCustomClassDecoratorValue)("namespace", targetObject.constructor);
11794
- if (!namespaceDecorator) {
11795
- throw new Error("Event Type is not defined");
11796
- }
11797
- return namespaceDecorator;
12112
+ return targetObject.namespace;
11798
12113
  }
12114
+ exports.getEventNamespaceFromObject = getEventNamespaceFromObject;
11799
12115
  //# sourceMappingURL=EventBus.js.map
11800
12116
 
11801
12117
  /***/ }),
11802
12118
 
11803
- /***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/EventNamespaceDecorator.js":
11804
- /*!*********************************************************************************!*\
11805
- !*** ./node_modules/@js-soft/ts-utils/dist/eventBus/EventNamespaceDecorator.js ***!
11806
- \*********************************************************************************/
11807
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11808
-
11809
- "use strict";
11810
-
11811
- Object.defineProperty(exports, "__esModule", ({ value: true }));
11812
- exports.EventNamespace = void 0;
11813
- const Constants_1 = __webpack_require__(/*! ./reflection/Constants */ "./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Constants.js");
11814
- function EventNamespace(name) {
11815
- return (target) => {
11816
- if (!name) {
11817
- name = target.name;
11818
- }
11819
- Reflect.defineMetadata(`${Constants_1.CUSTOM_METADATA_NAMESPACE}:namespace`, name, target);
11820
- };
11821
- }
11822
- exports.EventNamespace = EventNamespace;
11823
- //# sourceMappingURL=EventNamespaceDecorator.js.map
11824
-
11825
- /***/ }),
11826
-
11827
12119
  /***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/SubscriptionTargetInfo.js":
11828
12120
  /*!********************************************************************************!*\
11829
12121
  !*** ./node_modules/@js-soft/ts-utils/dist/eventBus/SubscriptionTargetInfo.js ***!
11830
12122
  \********************************************************************************/
11831
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12123
+ /***/ ((__unused_webpack_module, exports) => {
11832
12124
 
11833
12125
  "use strict";
11834
12126
 
11835
12127
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11836
12128
  exports.SubscriptionTargetInfo = void 0;
11837
- const Reflection_1 = __webpack_require__(/*! ./reflection/Reflection */ "./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Reflection.js");
11838
12129
  class SubscriptionTargetInfo {
11839
12130
  namespace;
11840
12131
  constructor(namespace) {
@@ -11844,9 +12135,7 @@ class SubscriptionTargetInfo {
11844
12135
  if (target instanceof Function) {
11845
12136
  return new ConstructorSubscriptionTargetInfo(target);
11846
12137
  }
11847
- else {
11848
- return new NamespaceSubscriptionTargetInfo(target);
11849
- }
12138
+ return new NamespaceSubscriptionTargetInfo(target);
11850
12139
  }
11851
12140
  }
11852
12141
  exports.SubscriptionTargetInfo = SubscriptionTargetInfo;
@@ -11864,21 +12153,86 @@ class NamespaceSubscriptionTargetInfo extends SubscriptionTargetInfo {
11864
12153
  constructor(namespace) {
11865
12154
  super(namespace);
11866
12155
  }
11867
- isCompatibleWith(event) {
12156
+ isCompatibleWith(_event) {
11868
12157
  return true;
11869
12158
  }
11870
12159
  }
11871
12160
  function getEventNamespaceFromClass(targetClass) {
11872
- var namespaceDecorator = (0, Reflection_1.getCustomClassDecoratorValue)("namespace", targetClass);
11873
- if (!namespaceDecorator) {
11874
- throw new Error("Event Type is not defined");
11875
- }
11876
- return namespaceDecorator;
12161
+ return targetClass.namespace;
11877
12162
  }
11878
12163
  //# sourceMappingURL=SubscriptionTargetInfo.js.map
11879
12164
 
11880
12165
  /***/ }),
11881
12166
 
12167
+ /***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js":
12168
+ /*!*********************************************************************************************!*\
12169
+ !*** ./node_modules/@js-soft/ts-utils/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js ***!
12170
+ \*********************************************************************************************/
12171
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12172
+
12173
+ "use strict";
12174
+
12175
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
12176
+ exports.EventEmitter2EventBus = void 0;
12177
+ const eventemitter2_1 = __webpack_require__(/*! eventemitter2 */ "./node_modules/eventemitter2/lib/eventemitter2.js");
12178
+ __webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
12179
+ const EventBus_1 = __webpack_require__(/*! ../EventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/EventBus.js");
12180
+ const SubscriptionTargetInfo_1 = __webpack_require__(/*! ../SubscriptionTargetInfo */ "./node_modules/@js-soft/ts-utils/dist/eventBus/SubscriptionTargetInfo.js");
12181
+ class EventEmitter2EventBus {
12182
+ emitter;
12183
+ wrappers = new Map();
12184
+ nextId = 0;
12185
+ constructor() {
12186
+ this.emitter = new eventemitter2_1.EventEmitter2({ wildcard: true, maxListeners: 50, verboseMemoryLeak: true });
12187
+ }
12188
+ subscribe(subscriptionTarget, handler) {
12189
+ return this.registerHandler(subscriptionTarget, handler);
12190
+ }
12191
+ subscribeOnce(subscriptionTarget, handler) {
12192
+ return this.registerHandler(subscriptionTarget, handler, true);
12193
+ }
12194
+ unsubscribe(subscriptionTarget, subscriptionId) {
12195
+ return this.unregisterHandler(subscriptionTarget, subscriptionId);
12196
+ }
12197
+ registerHandler(subscriptionTarget, handler, isOneTimeHandler = false) {
12198
+ const subscriptionTargetInfo = SubscriptionTargetInfo_1.SubscriptionTargetInfo.from(subscriptionTarget);
12199
+ const handlerId = this.nextId++;
12200
+ const handlerWrapper = (event) => {
12201
+ if (!subscriptionTargetInfo.isCompatibleWith(event)) {
12202
+ return;
12203
+ }
12204
+ handler(event);
12205
+ if (isOneTimeHandler) {
12206
+ this.unsubscribe(subscriptionTarget, handlerId);
12207
+ }
12208
+ };
12209
+ this.wrappers.set(handlerId, handlerWrapper);
12210
+ this.emitter.on(subscriptionTargetInfo.namespace, handlerWrapper);
12211
+ return handlerId;
12212
+ }
12213
+ unregisterHandler(subscriptionTarget, handlerId) {
12214
+ const subscriptionTargetInfo = SubscriptionTargetInfo_1.SubscriptionTargetInfo.from(subscriptionTarget);
12215
+ const handlerWrapper = this.wrappers.get(handlerId);
12216
+ if (!handlerWrapper) {
12217
+ return false;
12218
+ }
12219
+ this.emitter.off(subscriptionTargetInfo.namespace, handlerWrapper);
12220
+ this.wrappers.delete(handlerId);
12221
+ return true;
12222
+ }
12223
+ publish(event) {
12224
+ const namespace = (0, EventBus_1.getEventNamespaceFromObject)(event);
12225
+ if (!namespace) {
12226
+ throw Error("The event needs a namespace. Use the EventNamespace-decorator in order to define a namespace for a event.");
12227
+ }
12228
+ this.emitter.emit(namespace, event);
12229
+ }
12230
+ }
12231
+ exports.EventEmitter2EventBus = EventEmitter2EventBus;
12232
+ //# sourceMappingURL=EventEmitter2EventBus.js.map
12233
+
12234
+ /***/ }),
12235
+
11882
12236
  /***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/index.js":
11883
12237
  /*!***************************************************************!*\
11884
12238
  !*** ./node_modules/@js-soft/ts-utils/dist/eventBus/index.js ***!
@@ -11899,52 +12253,77 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11899
12253
  };
11900
12254
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11901
12255
  __exportStar(__webpack_require__(/*! ./EventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/EventBus.js"), exports);
11902
- __exportStar(__webpack_require__(/*! ./EventNamespaceDecorator */ "./node_modules/@js-soft/ts-utils/dist/eventBus/EventNamespaceDecorator.js"), exports);
12256
+ __exportStar(__webpack_require__(/*! ./eventEmitter2/EventEmitter2EventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js"), exports);
11903
12257
  //# sourceMappingURL=index.js.map
11904
12258
 
11905
12259
  /***/ }),
11906
12260
 
11907
- /***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Constants.js":
11908
- /*!******************************************************************************!*\
11909
- !*** ./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Constants.js ***!
11910
- \******************************************************************************/
11911
- /***/ ((__unused_webpack_module, exports) => {
12261
+ /***/ "./node_modules/@js-soft/ts-utils/dist/events/DataEvent.js":
12262
+ /*!*****************************************************************!*\
12263
+ !*** ./node_modules/@js-soft/ts-utils/dist/events/DataEvent.js ***!
12264
+ \*****************************************************************/
12265
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11912
12266
 
11913
12267
  "use strict";
11914
12268
 
11915
12269
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11916
- exports.CUSTOM_METADATA_NAMESPACE = void 0;
11917
- exports.CUSTOM_METADATA_NAMESPACE = "custom:annotations";
11918
- //# sourceMappingURL=Constants.js.map
12270
+ exports.DataEvent = void 0;
12271
+ const Event_1 = __webpack_require__(/*! ./Event */ "./node_modules/@js-soft/ts-utils/dist/events/Event.js");
12272
+ class DataEvent extends Event_1.Event {
12273
+ data;
12274
+ constructor(namespace, data) {
12275
+ super(namespace);
12276
+ this.data = data;
12277
+ }
12278
+ }
12279
+ exports.DataEvent = DataEvent;
12280
+ //# sourceMappingURL=DataEvent.js.map
11919
12281
 
11920
12282
  /***/ }),
11921
12283
 
11922
- /***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Reflection.js":
11923
- /*!*******************************************************************************!*\
11924
- !*** ./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Reflection.js ***!
11925
- \*******************************************************************************/
11926
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12284
+ /***/ "./node_modules/@js-soft/ts-utils/dist/events/Event.js":
12285
+ /*!*************************************************************!*\
12286
+ !*** ./node_modules/@js-soft/ts-utils/dist/events/Event.js ***!
12287
+ \*************************************************************/
12288
+ /***/ ((__unused_webpack_module, exports) => {
11927
12289
 
11928
12290
  "use strict";
11929
12291
 
11930
12292
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11931
- exports.getCustomClassDecorators = exports.getCustomClassDecoratorValue = void 0;
11932
- const Constants_1 = __webpack_require__(/*! ./Constants */ "./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Constants.js");
11933
- function getCustomClassDecoratorValue(decoratorKey, targetClass) {
11934
- var decorators = getCustomClassDecorators(targetClass);
11935
- var decorator = decorators.find(d => d.key.endsWith(decoratorKey));
11936
- return decorator ? decorator.value : undefined;
11937
- }
11938
- exports.getCustomClassDecoratorValue = getCustomClassDecoratorValue;
11939
- function getCustomClassDecorators(targetClass) {
11940
- const keys = Reflect.getMetadataKeys(targetClass);
11941
- let decorators = keys
11942
- .filter(key => key.toString().startsWith(Constants_1.CUSTOM_METADATA_NAMESPACE))
11943
- .map(key => { return { key: key, value: Reflect.getMetadata(key, targetClass) }; });
11944
- return decorators;
12293
+ exports.Event = void 0;
12294
+ class Event {
12295
+ namespace;
12296
+ constructor(namespace) {
12297
+ this.namespace = namespace;
12298
+ }
11945
12299
  }
11946
- exports.getCustomClassDecorators = getCustomClassDecorators;
11947
- //# sourceMappingURL=Reflection.js.map
12300
+ exports.Event = Event;
12301
+ //# sourceMappingURL=Event.js.map
12302
+
12303
+ /***/ }),
12304
+
12305
+ /***/ "./node_modules/@js-soft/ts-utils/dist/events/index.js":
12306
+ /*!*************************************************************!*\
12307
+ !*** ./node_modules/@js-soft/ts-utils/dist/events/index.js ***!
12308
+ \*************************************************************/
12309
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12310
+
12311
+ "use strict";
12312
+
12313
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12314
+ if (k2 === undefined) k2 = k;
12315
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12316
+ }) : (function(o, m, k, k2) {
12317
+ if (k2 === undefined) k2 = k;
12318
+ o[k2] = m[k];
12319
+ }));
12320
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12321
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
12322
+ };
12323
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
12324
+ __exportStar(__webpack_require__(/*! ./DataEvent */ "./node_modules/@js-soft/ts-utils/dist/events/DataEvent.js"), exports);
12325
+ __exportStar(__webpack_require__(/*! ./Event */ "./node_modules/@js-soft/ts-utils/dist/events/Event.js"), exports);
12326
+ //# sourceMappingURL=index.js.map
11948
12327
 
11949
12328
  /***/ }),
11950
12329
 
@@ -11968,11 +12347,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11968
12347
  };
11969
12348
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11970
12349
  __exportStar(__webpack_require__(/*! ./eventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/index.js"), exports);
11971
- __exportStar(__webpack_require__(/*! ./result */ "./node_modules/@js-soft/ts-utils/dist/result/index.js"), exports);
12350
+ __exportStar(__webpack_require__(/*! ./events */ "./node_modules/@js-soft/ts-utils/dist/events/index.js"), exports);
11972
12351
  __exportStar(__webpack_require__(/*! ./logDecorator */ "./node_modules/@js-soft/ts-utils/dist/logDecorator.js"), exports);
11973
12352
  __exportStar(__webpack_require__(/*! ./measureExcecutionTime */ "./node_modules/@js-soft/ts-utils/dist/measureExcecutionTime.js"), exports);
11974
12353
  __exportStar(__webpack_require__(/*! ./randomString */ "./node_modules/@js-soft/ts-utils/dist/randomString.js"), exports);
11975
12354
  __exportStar(__webpack_require__(/*! ./Range */ "./node_modules/@js-soft/ts-utils/dist/Range.js"), exports);
12355
+ __exportStar(__webpack_require__(/*! ./result */ "./node_modules/@js-soft/ts-utils/dist/result/index.js"), exports);
11976
12356
  __exportStar(__webpack_require__(/*! ./sleep */ "./node_modules/@js-soft/ts-utils/dist/sleep.js"), exports);
11977
12357
  //# sourceMappingURL=index.js.map
11978
12358
 
@@ -11988,10 +12368,11 @@ __exportStar(__webpack_require__(/*! ./sleep */ "./node_modules/@js-soft/ts-util
11988
12368
 
11989
12369
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11990
12370
  exports.log = void 0;
11991
- function log(target, propertyName, propertyDesciptor) {
12371
+ /* eslint-disable no-console */
12372
+ function log(_target, propertyName, propertyDesciptor) {
11992
12373
  const method = propertyDesciptor.value;
11993
12374
  propertyDesciptor.value = function (...args) {
11994
- const params = args.map(a => JSON.stringify(a)).join();
12375
+ const params = args.map((a) => JSON.stringify(a)).join();
11995
12376
  try {
11996
12377
  const result = method.apply(this, args);
11997
12378
  const r = JSON.stringify(result);
@@ -12006,7 +12387,6 @@ function log(target, propertyName, propertyDesciptor) {
12006
12387
  return propertyDesciptor;
12007
12388
  }
12008
12389
  exports.log = log;
12009
- ;
12010
12390
  //# sourceMappingURL=logDecorator.js.map
12011
12391
 
12012
12392
  /***/ }),
@@ -12021,7 +12401,8 @@ exports.log = log;
12021
12401
 
12022
12402
  Object.defineProperty(exports, "__esModule", ({ value: true }));
12023
12403
  exports.measureExcecutionTime = void 0;
12024
- function measureExcecutionTime(target, propertyName, propertyDesciptor) {
12404
+ /* eslint-disable no-console */
12405
+ function measureExcecutionTime(_target, _propertyName, propertyDesciptor) {
12025
12406
  const method = propertyDesciptor.value;
12026
12407
  propertyDesciptor.value = async function (...args) {
12027
12408
  const t0 = Date.now();
@@ -12033,7 +12414,6 @@ function measureExcecutionTime(target, propertyName, propertyDesciptor) {
12033
12414
  return propertyDesciptor;
12034
12415
  }
12035
12416
  exports.measureExcecutionTime = measureExcecutionTime;
12036
- ;
12037
12417
  //# sourceMappingURL=measureExcecutionTime.js.map
12038
12418
 
12039
12419
  /***/ }),
@@ -12051,13 +12431,12 @@ exports.randomString = void 0;
12051
12431
  function randomString(length, characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
12052
12432
  let result = "";
12053
12433
  const charactersLength = characters.length;
12054
- for (var i = 0; i < length; i++) {
12434
+ for (let i = 0; i < length; i++) {
12055
12435
  result += characters.charAt(Math.floor(Math.random() * charactersLength));
12056
12436
  }
12057
12437
  return result;
12058
12438
  }
12059
12439
  exports.randomString = randomString;
12060
- ;
12061
12440
  //# sourceMappingURL=randomString.js.map
12062
12441
 
12063
12442
  /***/ }),