@nmshd/transport 1.0.8 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildInformation.js +5 -5
- package/dist/core/DependencyOverrides.d.ts +4 -0
- package/dist/core/DependencyOverrides.js +3 -0
- package/dist/core/DependencyOverrides.js.map +1 -0
- package/dist/core/Transport.d.ts +2 -3
- package/dist/core/Transport.js +26 -23
- package/dist/core/Transport.js.map +1 -1
- package/dist/core/TransportErrors.d.ts +4 -0
- package/dist/core/TransportErrors.js +12 -0
- package/dist/core/TransportErrors.js.map +1 -1
- package/dist/core/backbone/RESTClient.js +1 -1
- package/dist/core/backbone/RESTClient.js.map +1 -1
- package/dist/core/backbone/index.d.ts +1 -0
- package/dist/core/backbone/index.js +1 -0
- package/dist/core/backbone/index.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/modules/accounts/AccountController.d.ts +3 -1
- package/dist/modules/accounts/AccountController.js +8 -9
- package/dist/modules/accounts/AccountController.js.map +1 -1
- package/dist/modules/accounts/IdentityController.d.ts +3 -7
- package/dist/modules/accounts/IdentityController.js +1 -15
- package/dist/modules/accounts/IdentityController.js.map +1 -1
- package/dist/modules/accounts/data/Identity.d.ts +13 -11
- package/dist/modules/accounts/data/Identity.js +16 -6
- package/dist/modules/accounts/data/Identity.js.map +1 -1
- package/dist/modules/devices/DeviceController.d.ts +5 -1
- package/dist/modules/devices/DeviceController.js +9 -4
- package/dist/modules/devices/DeviceController.js.map +1 -1
- package/dist/modules/devices/local/Device.d.ts +2 -0
- package/dist/modules/devices/local/Device.js +7 -1
- package/dist/modules/devices/local/Device.js.map +1 -1
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.js +8 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js +2 -2
- package/dist/modules/relationshipTemplates/RelationshipTemplateController.js.map +1 -1
- package/dist/modules/sync/DatawalletModificationMapper.d.ts +1 -1
- package/dist/modules/sync/DatawalletModificationMapper.js +6 -3
- package/dist/modules/sync/DatawalletModificationMapper.js.map +1 -1
- package/dist/modules/sync/SyncController.d.ts +17 -4
- package/dist/modules/sync/SyncController.js +154 -24
- package/dist/modules/sync/SyncController.js.map +1 -1
- package/dist/modules/sync/SynchronizedCollection.d.ts +2 -1
- package/dist/modules/sync/SynchronizedCollection.js +18 -9
- package/dist/modules/sync/SynchronizedCollection.js.map +1 -1
- package/dist/modules/sync/backbone/BackboneDatawalletModification.d.ts +1 -0
- package/dist/modules/sync/backbone/CreateDatawalletModifications.d.ts +1 -0
- package/dist/modules/sync/backbone/FinalizeSyncRun.d.ts +15 -9
- package/dist/modules/sync/backbone/GetDatawallet.d.ts +3 -0
- package/dist/modules/sync/backbone/GetDatawallet.js +3 -0
- package/dist/modules/sync/backbone/GetDatawallet.js.map +1 -0
- package/dist/modules/sync/backbone/StartSyncRun.d.ts +8 -0
- package/dist/modules/sync/backbone/StartSyncRun.js +6 -1
- package/dist/modules/sync/backbone/StartSyncRun.js.map +1 -1
- package/dist/modules/sync/backbone/SyncClient.d.ts +21 -6
- package/dist/modules/sync/backbone/SyncClient.js +19 -6
- package/dist/modules/sync/backbone/SyncClient.js.map +1 -1
- package/dist/modules/sync/local/DatawalletModification.d.ts +2 -0
- package/dist/modules/sync/local/DatawalletModification.js +5 -0
- package/dist/modules/sync/local/DatawalletModification.js.map +1 -1
- package/dist/modules/sync/migrations/DeviceMigrations.d.ts +6 -0
- package/dist/modules/sync/migrations/DeviceMigrations.js +24 -0
- package/dist/modules/sync/migrations/DeviceMigrations.js.map +1 -0
- package/dist/modules/sync/migrations/IdentityMigrations.d.ts +6 -0
- package/dist/modules/sync/migrations/IdentityMigrations.js +14 -0
- package/dist/modules/sync/migrations/IdentityMigrations.js.map +1 -0
- package/lib-web/nmshd.transport.js +655 -247
- package/lib-web/nmshd.transport.js.map +1 -1
- package/lib-web/nmshd.transport.min.js +1 -1
- package/lib-web/nmshd.transport.min.js.map +1 -1
- package/package.json +20 -20
|
@@ -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.
|
|
19
|
-
build: "
|
|
20
|
-
date: "2021-
|
|
21
|
-
commit: "
|
|
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.
|
|
18
|
+
version: "1.1.3",
|
|
19
|
+
build: "15",
|
|
20
|
+
date: "2021-12-28T16:36:51+00:00",
|
|
21
|
+
commit: "d926ace865b9799f0fdc997dfeefe087f158fa26",
|
|
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.2.0","qs":"^6.10.2","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,
|
|
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() {
|
|
@@ -2796,11 +2828,7 @@ class AccountController {
|
|
|
2796
2828
|
}
|
|
2797
2829
|
const identity = await Identity_1.Identity.from({
|
|
2798
2830
|
address: core_1.CoreAddress.from(deviceResponse.address),
|
|
2799
|
-
createdAt: core_1.CoreDate.from(deviceResponse.createdAt),
|
|
2800
|
-
description: "",
|
|
2801
|
-
name: "",
|
|
2802
2831
|
realm: realm,
|
|
2803
|
-
type: "unknown" /* UNKNOWN */,
|
|
2804
2832
|
publicKey: identityKeypair.publicKey
|
|
2805
2833
|
});
|
|
2806
2834
|
const deviceId = core_1.CoreId.from(deviceResponse.device.id);
|
|
@@ -2815,7 +2843,8 @@ class AccountController {
|
|
|
2815
2843
|
publicKey: deviceKeypair.publicKey,
|
|
2816
2844
|
type: deviceInfo.type,
|
|
2817
2845
|
certificate: "",
|
|
2818
|
-
username: deviceResponse.device.username
|
|
2846
|
+
username: deviceResponse.device.username,
|
|
2847
|
+
datawalletVersion: this._config.supportedDatawalletVersion
|
|
2819
2848
|
});
|
|
2820
2849
|
// Initialize required controllers
|
|
2821
2850
|
await Promise.all([this.identity.init(identity), this.activeDevice.init(privBaseDevice, device)]);
|
|
@@ -2901,9 +2930,9 @@ class AccountController {
|
|
|
2901
2930
|
async getSynchronizedCollection(collectionName) {
|
|
2902
2931
|
const collection = await this.db.getCollection(collectionName);
|
|
2903
2932
|
if (!this.config.datawalletEnabled) {
|
|
2904
|
-
return new SynchronizedCollection_1.SynchronizedCollection(collection);
|
|
2933
|
+
return new SynchronizedCollection_1.SynchronizedCollection(collection, this.config.supportedDatawalletVersion);
|
|
2905
2934
|
}
|
|
2906
|
-
return new SynchronizedCollection_1.SynchronizedCollection(collection, this.unpushedDatawalletModifications);
|
|
2935
|
+
return new SynchronizedCollection_1.SynchronizedCollection(collection, this.config.supportedDatawalletVersion, this.unpushedDatawalletModifications);
|
|
2907
2936
|
}
|
|
2908
2937
|
}
|
|
2909
2938
|
exports.AccountController = AccountController;
|
|
@@ -2937,18 +2966,6 @@ class IdentityController extends core_1.TransportController {
|
|
|
2937
2966
|
get realm() {
|
|
2938
2967
|
return this._identity.realm;
|
|
2939
2968
|
}
|
|
2940
|
-
get name() {
|
|
2941
|
-
return this._identity.name;
|
|
2942
|
-
}
|
|
2943
|
-
get description() {
|
|
2944
|
-
return this._identity.description;
|
|
2945
|
-
}
|
|
2946
|
-
get createdAt() {
|
|
2947
|
-
return this._identity.createdAt;
|
|
2948
|
-
}
|
|
2949
|
-
get type() {
|
|
2950
|
-
return this._identity.type;
|
|
2951
|
-
}
|
|
2952
2969
|
get identity() {
|
|
2953
2970
|
return this._identity;
|
|
2954
2971
|
}
|
|
@@ -2963,9 +2980,7 @@ class IdentityController extends core_1.TransportController {
|
|
|
2963
2980
|
isMe(address) {
|
|
2964
2981
|
return this.address.equals(address);
|
|
2965
2982
|
}
|
|
2966
|
-
async update(
|
|
2967
|
-
this.identity.name = name;
|
|
2968
|
-
this.identity.description = description;
|
|
2983
|
+
async update() {
|
|
2969
2984
|
await this.parent.info.set("identity", this.identity);
|
|
2970
2985
|
}
|
|
2971
2986
|
async sign(content) {
|
|
@@ -3112,7 +3127,13 @@ var Realm;
|
|
|
3112
3127
|
})(Realm = exports.Realm || (exports.Realm = {}));
|
|
3113
3128
|
let Identity = Identity_1 = class Identity extends CoreSerializableAsync_1.CoreSerializableAsync {
|
|
3114
3129
|
static async from(value) {
|
|
3115
|
-
|
|
3130
|
+
const identity = await super.fromT(value, Identity_1);
|
|
3131
|
+
// TODO: Remove these default values once we're sure that nobody is accessing the deprecated properties anymore
|
|
3132
|
+
identity.name = "";
|
|
3133
|
+
identity.description = "";
|
|
3134
|
+
identity.type = "unknown";
|
|
3135
|
+
identity.createdAt = CoreDate_1.CoreDate.from("2020-01-01T00:00:00Z");
|
|
3136
|
+
return identity;
|
|
3116
3137
|
}
|
|
3117
3138
|
};
|
|
3118
3139
|
__decorate([
|
|
@@ -3131,22 +3152,26 @@ __decorate([
|
|
|
3131
3152
|
__metadata("design:type", String)
|
|
3132
3153
|
], Identity.prototype, "realm", void 0);
|
|
3133
3154
|
__decorate([
|
|
3134
|
-
(0, ts_serval_1.validate)(),
|
|
3155
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
3135
3156
|
(0, ts_serval_1.serialize)(),
|
|
3136
3157
|
__metadata("design:type", String)
|
|
3137
3158
|
], Identity.prototype, "name", void 0);
|
|
3138
3159
|
__decorate([
|
|
3139
|
-
(0, ts_serval_1.validate)(),
|
|
3160
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
3140
3161
|
(0, ts_serval_1.serialize)(),
|
|
3141
3162
|
__metadata("design:type", String)
|
|
3142
3163
|
], Identity.prototype, "description", void 0);
|
|
3143
3164
|
__decorate([
|
|
3144
|
-
(0, ts_serval_1.validate)(),
|
|
3165
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
3145
3166
|
(0, ts_serval_1.serialize)(),
|
|
3146
|
-
__metadata("design:type", CoreDate_1.CoreDate
|
|
3167
|
+
__metadata("design:type", CoreDate_1.CoreDate
|
|
3168
|
+
/**
|
|
3169
|
+
* @deprecated
|
|
3170
|
+
*/
|
|
3171
|
+
)
|
|
3147
3172
|
], Identity.prototype, "createdAt", void 0);
|
|
3148
3173
|
__decorate([
|
|
3149
|
-
(0, ts_serval_1.validate)(),
|
|
3174
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
3150
3175
|
(0, ts_serval_1.serialize)(),
|
|
3151
3176
|
__metadata("design:type", String)
|
|
3152
3177
|
], Identity.prototype, "type", void 0);
|
|
@@ -4443,10 +4468,15 @@ class DeviceController extends core_1.TransportController {
|
|
|
4443
4468
|
throw e;
|
|
4444
4469
|
}
|
|
4445
4470
|
}
|
|
4446
|
-
async update(
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4471
|
+
async update(update) {
|
|
4472
|
+
if (update.name)
|
|
4473
|
+
this.device.name = update.name;
|
|
4474
|
+
if (update.description)
|
|
4475
|
+
this.device.description = update.description;
|
|
4476
|
+
if (update.datawalletVersion)
|
|
4477
|
+
this.device.datawalletVersion = update.datawalletVersion;
|
|
4478
|
+
await this.parent.devices.update(this.device);
|
|
4479
|
+
await this.parent.info.set("device", this.device.toJSON());
|
|
4450
4480
|
}
|
|
4451
4481
|
async sign(content) {
|
|
4452
4482
|
const privateKeyContainer = await this.secrets.loadSecret(DeviceSecretController_1.DeviceSecretType.DeviceSignature);
|
|
@@ -4884,7 +4914,8 @@ let Device = Device_1 = class Device extends core_1.CoreSynchronizable {
|
|
|
4884
4914
|
(0, ts_simple_nameof_1.nameof)((d) => d.createdByDevice),
|
|
4885
4915
|
(0, ts_simple_nameof_1.nameof)((d) => d.lastLoginAt),
|
|
4886
4916
|
(0, ts_simple_nameof_1.nameof)((d) => d.username),
|
|
4887
|
-
(0, ts_simple_nameof_1.nameof)((d) => d.initialPassword)
|
|
4917
|
+
(0, ts_simple_nameof_1.nameof)((d) => d.initialPassword),
|
|
4918
|
+
(0, ts_simple_nameof_1.nameof)((d) => d.datawalletVersion)
|
|
4888
4919
|
];
|
|
4889
4920
|
this.userdataProperties = [(0, ts_simple_nameof_1.nameof)((d) => d.name), (0, ts_simple_nameof_1.nameof)((d) => d.description)];
|
|
4890
4921
|
}
|
|
@@ -4952,6 +4983,11 @@ __decorate([
|
|
|
4952
4983
|
(0, ts_serval_1.serialize)(),
|
|
4953
4984
|
__metadata("design:type", Boolean)
|
|
4954
4985
|
], Device.prototype, "isAdmin", void 0);
|
|
4986
|
+
__decorate([
|
|
4987
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
4988
|
+
(0, ts_serval_1.serialize)(),
|
|
4989
|
+
__metadata("design:type", Number)
|
|
4990
|
+
], Device.prototype, "datawalletVersion", void 0);
|
|
4955
4991
|
Device = Device_1 = __decorate([
|
|
4956
4992
|
(0, ts_serval_1.type)("Device")
|
|
4957
4993
|
], Device);
|
|
@@ -6032,6 +6068,14 @@ __exportStar(__webpack_require__(/*! ./relationshipTemplates/transmission/Relati
|
|
|
6032
6068
|
__exportStar(__webpack_require__(/*! ./secrets/data/SecretContainerCipher */ "./dist/modules/secrets/data/SecretContainerCipher.js"), exports);
|
|
6033
6069
|
__exportStar(__webpack_require__(/*! ./secrets/data/SecretContainerPlain */ "./dist/modules/secrets/data/SecretContainerPlain.js"), exports);
|
|
6034
6070
|
__exportStar(__webpack_require__(/*! ./secrets/SecretController */ "./dist/modules/secrets/SecretController.js"), exports);
|
|
6071
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/BackboneDatawalletModification */ "./dist/modules/sync/backbone/BackboneDatawalletModification.js"), exports);
|
|
6072
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/BackboneExternalEvent */ "./dist/modules/sync/backbone/BackboneExternalEvent.js"), exports);
|
|
6073
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/CreateDatawalletModifications */ "./dist/modules/sync/backbone/CreateDatawalletModifications.js"), exports);
|
|
6074
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/FinalizeSyncRun */ "./dist/modules/sync/backbone/FinalizeSyncRun.js"), exports);
|
|
6075
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/GetDatawallet */ "./dist/modules/sync/backbone/GetDatawallet.js"), exports);
|
|
6076
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/GetDatawalletModifications */ "./dist/modules/sync/backbone/GetDatawalletModifications.js"), exports);
|
|
6077
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/StartSyncRun */ "./dist/modules/sync/backbone/StartSyncRun.js"), exports);
|
|
6078
|
+
__exportStar(__webpack_require__(/*! ./sync/backbone/SyncClient */ "./dist/modules/sync/backbone/SyncClient.js"), exports);
|
|
6035
6079
|
__exportStar(__webpack_require__(/*! ./sync/ChangedItems */ "./dist/modules/sync/ChangedItems.js"), exports);
|
|
6036
6080
|
__exportStar(__webpack_require__(/*! ./sync/DatawalletModificationsProcessor */ "./dist/modules/sync/DatawalletModificationsProcessor.js"), exports);
|
|
6037
6081
|
__exportStar(__webpack_require__(/*! ./sync/ExternalEventsProcessor */ "./dist/modules/sync/ExternalEventsProcessor.js"), exports);
|
|
@@ -7042,7 +7086,7 @@ class RelationshipTemplateController extends TransportController_1.TransportCont
|
|
|
7042
7086
|
const templateKey = await this.secrets.createTemplateKey();
|
|
7043
7087
|
const templateContent = await RelationshipTemplateContent_1.RelationshipTemplateContent.from({
|
|
7044
7088
|
content: parameters.content,
|
|
7045
|
-
identity: this.parent.identity,
|
|
7089
|
+
identity: this.parent.identity.identity,
|
|
7046
7090
|
templateKey: templateKey
|
|
7047
7091
|
});
|
|
7048
7092
|
const secretKey = await core_1.CoreCrypto.generateSecretKey();
|
|
@@ -7066,7 +7110,7 @@ class RelationshipTemplateController extends TransportController_1.TransportCont
|
|
|
7066
7110
|
createdBy: this.parent.identity.address,
|
|
7067
7111
|
createdByDevice: this.parent.activeDevice.id,
|
|
7068
7112
|
expiresAt: parameters.expiresAt,
|
|
7069
|
-
identity: this.parent.identity,
|
|
7113
|
+
identity: this.parent.identity.identity,
|
|
7070
7114
|
maxNumberOfRelationships: (_a = parameters.maxNumberOfRelationships) !== null && _a !== void 0 ? _a : undefined,
|
|
7071
7115
|
templateKey: templateKey
|
|
7072
7116
|
});
|
|
@@ -9667,7 +9711,7 @@ exports.DatawalletModificationMapper = void 0;
|
|
|
9667
9711
|
const core_1 = __webpack_require__(/*! ../../core */ "./dist/core/index.js");
|
|
9668
9712
|
const DatawalletModification_1 = __webpack_require__(/*! ./local/DatawalletModification */ "./dist/modules/sync/local/DatawalletModification.js");
|
|
9669
9713
|
class DatawalletModificationMapper {
|
|
9670
|
-
static async fromBackboneDatawalletModification(backboneDatawalletModification, decryptedPayload) {
|
|
9714
|
+
static async fromBackboneDatawalletModification(backboneDatawalletModification, decryptedPayload, datawalletVersion) {
|
|
9671
9715
|
let type;
|
|
9672
9716
|
switch (backboneDatawalletModification.type) {
|
|
9673
9717
|
case "Create":
|
|
@@ -9708,16 +9752,19 @@ class DatawalletModificationMapper {
|
|
|
9708
9752
|
payloadCategory: payloadCategory,
|
|
9709
9753
|
collection: backboneDatawalletModification.collection,
|
|
9710
9754
|
type: type,
|
|
9711
|
-
payload: decryptedPayload
|
|
9755
|
+
payload: decryptedPayload,
|
|
9756
|
+
datawalletVersion: datawalletVersion
|
|
9712
9757
|
});
|
|
9713
9758
|
}
|
|
9714
9759
|
static toCreateDatawalletModificationsRequestItem(datawalletModification, encryptedPayload) {
|
|
9760
|
+
var _a;
|
|
9715
9761
|
return {
|
|
9716
9762
|
objectIdentifier: datawalletModification.objectIdentifier.toString(),
|
|
9717
9763
|
payloadCategory: datawalletModification.payloadCategory,
|
|
9718
9764
|
collection: datawalletModification.collection,
|
|
9719
9765
|
type: datawalletModification.type,
|
|
9720
|
-
encryptedPayload: encryptedPayload
|
|
9766
|
+
encryptedPayload: encryptedPayload,
|
|
9767
|
+
datawalletVersion: (_a = datawalletModification.datawalletVersion) !== null && _a !== void 0 ? _a : 0
|
|
9721
9768
|
};
|
|
9722
9769
|
}
|
|
9723
9770
|
}
|
|
@@ -10032,15 +10079,26 @@ const DatawalletModificationMapper_1 = __webpack_require__(/*! ./DatawalletModif
|
|
|
10032
10079
|
const DatawalletModificationsProcessor_1 = __webpack_require__(/*! ./DatawalletModificationsProcessor */ "./dist/modules/sync/DatawalletModificationsProcessor.js");
|
|
10033
10080
|
const ExternalEventsProcessor_1 = __webpack_require__(/*! ./ExternalEventsProcessor */ "./dist/modules/sync/ExternalEventsProcessor.js");
|
|
10034
10081
|
const DatawalletModification_1 = __webpack_require__(/*! ./local/DatawalletModification */ "./dist/modules/sync/local/DatawalletModification.js");
|
|
10082
|
+
const DeviceMigrations_1 = __webpack_require__(/*! ./migrations/DeviceMigrations */ "./dist/modules/sync/migrations/DeviceMigrations.js");
|
|
10083
|
+
const IdentityMigrations_1 = __webpack_require__(/*! ./migrations/IdentityMigrations */ "./dist/modules/sync/migrations/IdentityMigrations.js");
|
|
10035
10084
|
class SyncController extends core_1.TransportController {
|
|
10036
|
-
constructor(parent, unpushedDatawalletModifications, datawalletEnabled) {
|
|
10085
|
+
constructor(parent, dependencyOverrides, unpushedDatawalletModifications, datawalletEnabled) {
|
|
10086
|
+
var _a;
|
|
10037
10087
|
super(core_1.ControllerName.Sync, parent);
|
|
10038
10088
|
this.unpushedDatawalletModifications = unpushedDatawalletModifications;
|
|
10039
10089
|
this.datawalletEnabled = datawalletEnabled;
|
|
10090
|
+
this.client = (_a = dependencyOverrides.syncClient) !== null && _a !== void 0 ? _a : new SyncClient_1.SyncClient(this.config, this.parent.authenticator);
|
|
10091
|
+
this.identityMigrations = new IdentityMigrations_1.IdentityMigrations(this.parent);
|
|
10092
|
+
this.deviceMigrations = new DeviceMigrations_1.DeviceMigrations(this.parent);
|
|
10093
|
+
}
|
|
10094
|
+
get cacheFetcher() {
|
|
10095
|
+
if (!this._cacheFetcher) {
|
|
10096
|
+
this._cacheFetcher = new DatawalletModificationsProcessor_1.CacheFetcher(this.parent.files, this.parent.messages, this.parent.relationshipTemplates, this.parent.relationships, this.parent.tokens);
|
|
10097
|
+
}
|
|
10098
|
+
return this._cacheFetcher;
|
|
10040
10099
|
}
|
|
10041
10100
|
async init() {
|
|
10042
10101
|
await super.init();
|
|
10043
|
-
this.client = new SyncClient_1.SyncClient(this.config, this.parent.authenticator);
|
|
10044
10102
|
this.syncInfo = await this.db.getMap("SyncInfo");
|
|
10045
10103
|
return this;
|
|
10046
10104
|
}
|
|
@@ -10069,33 +10127,120 @@ class SyncController extends core_1.TransportController {
|
|
|
10069
10127
|
if (whatToSync === "OnlyDatawallet") {
|
|
10070
10128
|
return await this.syncDatawallet();
|
|
10071
10129
|
}
|
|
10072
|
-
const
|
|
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);
|
|
10130
|
+
const externalEventSyncResult = await this.syncExternalEvents();
|
|
10081
10131
|
await this.setLastCompletedSyncTime();
|
|
10082
|
-
if (
|
|
10083
|
-
throw new core_1.CoreError("error.transport.errorWhileApplyingExternalEvents",
|
|
10132
|
+
if (externalEventSyncResult.externalEventResults.some((r) => r.errorCode !== undefined)) {
|
|
10133
|
+
throw new core_1.CoreError("error.transport.errorWhileApplyingExternalEvents", externalEventSyncResult.externalEventResults
|
|
10084
10134
|
.filter((r) => r.errorCode !== undefined)
|
|
10085
10135
|
.map((r) => r.errorCode)
|
|
10086
10136
|
.join(" | ")).logWith(this.log);
|
|
10087
10137
|
}
|
|
10088
|
-
return
|
|
10138
|
+
return externalEventSyncResult.changedItems;
|
|
10139
|
+
}
|
|
10140
|
+
async syncExternalEvents() {
|
|
10141
|
+
const syncRunWasStarted = await this.startExternalEventsSyncRun();
|
|
10142
|
+
if (!syncRunWasStarted) {
|
|
10143
|
+
await this.syncDatawallet();
|
|
10144
|
+
return {
|
|
10145
|
+
changedItems: new ChangedItems_1.ChangedItems(),
|
|
10146
|
+
externalEventResults: []
|
|
10147
|
+
};
|
|
10148
|
+
}
|
|
10149
|
+
await this.applyIncomingDatawalletModifications();
|
|
10150
|
+
const result = await this.applyIncomingExternalEvents();
|
|
10151
|
+
await this.finalizeExternalEventsSyncRun(result.externalEventResults);
|
|
10152
|
+
return result;
|
|
10089
10153
|
}
|
|
10090
10154
|
async syncDatawallet() {
|
|
10091
10155
|
if (!this.datawalletEnabled) {
|
|
10092
10156
|
return;
|
|
10093
10157
|
}
|
|
10158
|
+
const identityDatawalletVersion = await this.getIdentityDatawalletVersion();
|
|
10159
|
+
if (this.config.supportedDatawalletVersion < identityDatawalletVersion) {
|
|
10160
|
+
// This means that the datawallet of the identity was upgraded by another device with a higher version.
|
|
10161
|
+
// It is necesssary to update the current device.
|
|
10162
|
+
throw core_1.TransportErrors.datawallet
|
|
10163
|
+
.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion, identityDatawalletVersion)
|
|
10164
|
+
.logWith(this.log);
|
|
10165
|
+
}
|
|
10094
10166
|
this.log.trace("Synchronization of Datawallet events started...");
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10167
|
+
try {
|
|
10168
|
+
await this.applyIncomingDatawalletModifications();
|
|
10169
|
+
await this.pushLocalDatawalletModifications();
|
|
10170
|
+
await this.setLastCompletedDatawalletSyncTime();
|
|
10171
|
+
}
|
|
10172
|
+
catch (e) {
|
|
10173
|
+
const outdatedErrorCode = "error.platform.validation.datawallet.insufficientSupportedDatawalletVersion";
|
|
10174
|
+
if (!(e instanceof core_1.RequestError) || e.code !== outdatedErrorCode)
|
|
10175
|
+
throw e;
|
|
10176
|
+
throw core_1.TransportErrors.datawallet
|
|
10177
|
+
.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion, identityDatawalletVersion)
|
|
10178
|
+
.logWith(this.log);
|
|
10179
|
+
}
|
|
10098
10180
|
this.log.trace("Synchronization of Datawallet events ended...");
|
|
10181
|
+
await this.checkDatawalletVersion(identityDatawalletVersion);
|
|
10182
|
+
}
|
|
10183
|
+
async checkDatawalletVersion(identityDatawalletVersion) {
|
|
10184
|
+
var _a;
|
|
10185
|
+
if (this.config.supportedDatawalletVersion < identityDatawalletVersion) {
|
|
10186
|
+
throw core_1.TransportErrors.datawallet
|
|
10187
|
+
.insufficientSupportedDatawalletVersion(this.config.supportedDatawalletVersion, identityDatawalletVersion)
|
|
10188
|
+
.logWith(this.log);
|
|
10189
|
+
}
|
|
10190
|
+
if (this.config.supportedDatawalletVersion > identityDatawalletVersion) {
|
|
10191
|
+
await this.upgradeIdentityDatawalletVersion(identityDatawalletVersion, this.config.supportedDatawalletVersion);
|
|
10192
|
+
}
|
|
10193
|
+
const deviceDatawalletVersion = (_a = this.parent.activeDevice.device.datawalletVersion) !== null && _a !== void 0 ? _a : 0;
|
|
10194
|
+
if (deviceDatawalletVersion < identityDatawalletVersion) {
|
|
10195
|
+
await this.upgradeDeviceDatawalletVersion(deviceDatawalletVersion, this.config.supportedDatawalletVersion);
|
|
10196
|
+
}
|
|
10197
|
+
}
|
|
10198
|
+
async upgradeIdentityDatawalletVersion(identityDatawalletVersion, targetDatawalletVersion) {
|
|
10199
|
+
if (identityDatawalletVersion === targetDatawalletVersion)
|
|
10200
|
+
return;
|
|
10201
|
+
if (this.config.supportedDatawalletVersion < targetDatawalletVersion) {
|
|
10202
|
+
throw core_1.TransportErrors.datawallet
|
|
10203
|
+
.insufficientSupportedDatawalletVersion(targetDatawalletVersion, identityDatawalletVersion)
|
|
10204
|
+
.logWith(this.log);
|
|
10205
|
+
}
|
|
10206
|
+
if (identityDatawalletVersion > targetDatawalletVersion) {
|
|
10207
|
+
throw core_1.TransportErrors.datawallet
|
|
10208
|
+
.currentBiggerThanTarget(identityDatawalletVersion, targetDatawalletVersion)
|
|
10209
|
+
.logWith(this.log);
|
|
10210
|
+
}
|
|
10211
|
+
while (identityDatawalletVersion < targetDatawalletVersion) {
|
|
10212
|
+
identityDatawalletVersion++;
|
|
10213
|
+
await this.startDatawalletVersionUpgradeSyncRun();
|
|
10214
|
+
const migrationFunction = this.identityMigrations[`v${identityDatawalletVersion}`];
|
|
10215
|
+
if (!migrationFunction) {
|
|
10216
|
+
throw core_1.TransportErrors.datawallet.noMigrationAvailable(identityDatawalletVersion).logWith(this.log);
|
|
10217
|
+
}
|
|
10218
|
+
await migrationFunction.call(this.identityMigrations);
|
|
10219
|
+
await this.finalizeDatawalletVersionUpgradeSyncRun(identityDatawalletVersion);
|
|
10220
|
+
}
|
|
10221
|
+
}
|
|
10222
|
+
async upgradeDeviceDatawalletVersion(deviceDatawalletVersion, targetDatawalletVersion) {
|
|
10223
|
+
if (deviceDatawalletVersion === targetDatawalletVersion)
|
|
10224
|
+
return;
|
|
10225
|
+
if (this.config.supportedDatawalletVersion < targetDatawalletVersion) {
|
|
10226
|
+
throw core_1.TransportErrors.datawallet
|
|
10227
|
+
.insufficientSupportedDatawalletVersion(targetDatawalletVersion, deviceDatawalletVersion)
|
|
10228
|
+
.logWith(this.log);
|
|
10229
|
+
}
|
|
10230
|
+
if (deviceDatawalletVersion > targetDatawalletVersion) {
|
|
10231
|
+
throw core_1.TransportErrors.datawallet
|
|
10232
|
+
.currentBiggerThanTarget(deviceDatawalletVersion, targetDatawalletVersion)
|
|
10233
|
+
.logWith(this.log);
|
|
10234
|
+
}
|
|
10235
|
+
while (deviceDatawalletVersion < targetDatawalletVersion) {
|
|
10236
|
+
deviceDatawalletVersion++;
|
|
10237
|
+
const migrationFunction = this.deviceMigrations[`v${deviceDatawalletVersion}`];
|
|
10238
|
+
if (!migrationFunction) {
|
|
10239
|
+
throw core_1.TransportErrors.datawallet.noMigrationAvailable(deviceDatawalletVersion).logWith(this.log);
|
|
10240
|
+
}
|
|
10241
|
+
await migrationFunction.call(this.deviceMigrations);
|
|
10242
|
+
await this.parent.activeDevice.update({ datawalletVersion: deviceDatawalletVersion });
|
|
10243
|
+
}
|
|
10099
10244
|
}
|
|
10100
10245
|
async applyIncomingDatawalletModifications() {
|
|
10101
10246
|
const getDatawalletModificationsResult = await this.client.getDatawalletModifications({
|
|
@@ -10107,7 +10252,7 @@ class SyncController extends core_1.TransportController {
|
|
|
10107
10252
|
}
|
|
10108
10253
|
const incomingModifications = await this.decryptDatawalletModifications(encryptedIncomingModifications);
|
|
10109
10254
|
this.log.trace(`${incomingModifications.length} incoming modifications found`);
|
|
10110
|
-
const datawalletModificationsProcessor = new DatawalletModificationsProcessor_1.DatawalletModificationsProcessor(incomingModifications,
|
|
10255
|
+
const datawalletModificationsProcessor = new DatawalletModificationsProcessor_1.DatawalletModificationsProcessor(incomingModifications, this.cacheFetcher, this._db, core_1.TransportLoggerFactory.getLogger(DatawalletModificationsProcessor_1.DatawalletModificationsProcessor));
|
|
10111
10256
|
await datawalletModificationsProcessor.execute();
|
|
10112
10257
|
this.log.trace(`${incomingModifications.length} incoming modifications executed`, incomingModifications);
|
|
10113
10258
|
await this.updateLocalDatawalletModificationIndex(encryptedIncomingModifications.sort(descending)[0].index);
|
|
@@ -10116,7 +10261,7 @@ class SyncController extends core_1.TransportController {
|
|
|
10116
10261
|
const decryptedModifications = [];
|
|
10117
10262
|
for (const encryptedModification of encryptedModifications) {
|
|
10118
10263
|
const decryptedPayload = await this.parent.activeDevice.secrets.decryptDatawalletModificationPayload(encryptedModification.encryptedPayload, encryptedModification.index);
|
|
10119
|
-
const decryptedModification = await DatawalletModificationMapper_1.DatawalletModificationMapper.fromBackboneDatawalletModification(encryptedModification, decryptedPayload);
|
|
10264
|
+
const decryptedModification = await DatawalletModificationMapper_1.DatawalletModificationMapper.fromBackboneDatawalletModification(encryptedModification, decryptedPayload, this.config.supportedDatawalletVersion);
|
|
10120
10265
|
decryptedModifications.push(decryptedModification);
|
|
10121
10266
|
}
|
|
10122
10267
|
return decryptedModifications;
|
|
@@ -10155,15 +10300,29 @@ class SyncController extends core_1.TransportController {
|
|
|
10155
10300
|
await this.unpushedDatawalletModifications.delete({ localId: localModificationId.toString() });
|
|
10156
10301
|
}
|
|
10157
10302
|
}
|
|
10158
|
-
async
|
|
10303
|
+
async setInititalDatawalletVersion(version) {
|
|
10304
|
+
await this.startDatawalletVersionUpgradeSyncRun();
|
|
10305
|
+
await this.finalizeDatawalletVersionUpgradeSyncRun(version);
|
|
10306
|
+
}
|
|
10307
|
+
async getIdentityDatawalletVersion() {
|
|
10308
|
+
const datawalletInfo = (await this.client.getDatawallet()).value;
|
|
10309
|
+
return datawalletInfo.version;
|
|
10310
|
+
}
|
|
10311
|
+
async startExternalEventsSyncRun() {
|
|
10159
10312
|
var _a;
|
|
10160
|
-
const result = await this.client.startSyncRun();
|
|
10313
|
+
const result = await this.client.startSyncRun({ type: StartSyncRun_1.SyncRunType.ExternalEventSync });
|
|
10161
10314
|
if (result.value.status === StartSyncRun_1.StartSyncRunStatus.NoNewEvents) {
|
|
10162
10315
|
return false;
|
|
10163
10316
|
}
|
|
10164
10317
|
this.currentSyncRun = (_a = result.value.syncRun) !== null && _a !== void 0 ? _a : undefined;
|
|
10165
10318
|
return this.currentSyncRun !== undefined;
|
|
10166
10319
|
}
|
|
10320
|
+
async startDatawalletVersionUpgradeSyncRun() {
|
|
10321
|
+
var _a;
|
|
10322
|
+
const result = await this.client.startSyncRun({ type: StartSyncRun_1.SyncRunType.DatawalletVersionUpgrade });
|
|
10323
|
+
this.currentSyncRun = (_a = result.value.syncRun) !== null && _a !== void 0 ? _a : undefined;
|
|
10324
|
+
return this.currentSyncRun !== undefined;
|
|
10325
|
+
}
|
|
10167
10326
|
async applyIncomingExternalEvents() {
|
|
10168
10327
|
const getExternalEventsResult = await this.client.getExternalEventsOfSyncRun(this.currentSyncRun.id.toString());
|
|
10169
10328
|
if (getExternalEventsResult.isError) {
|
|
@@ -10172,14 +10331,17 @@ class SyncController extends core_1.TransportController {
|
|
|
10172
10331
|
const externalEvents = await getExternalEventsResult.value.collect();
|
|
10173
10332
|
const externalEventProcessor = new ExternalEventsProcessor_1.ExternalEventsProcessor(this.parent.messages, this.parent.relationships, externalEvents);
|
|
10174
10333
|
await externalEventProcessor.execute();
|
|
10175
|
-
return {
|
|
10334
|
+
return {
|
|
10335
|
+
externalEventResults: externalEventProcessor.results,
|
|
10336
|
+
changedItems: externalEventProcessor.changedItems
|
|
10337
|
+
};
|
|
10176
10338
|
}
|
|
10177
|
-
async
|
|
10339
|
+
async finalizeExternalEventsSyncRun(externalEventResults) {
|
|
10178
10340
|
if (!this.currentSyncRun) {
|
|
10179
10341
|
throw new Error("There is no active sync run to finalize");
|
|
10180
10342
|
}
|
|
10181
10343
|
const { backboneModifications, localModificationIds } = await this.prepareLocalDatawalletModificationsForPush();
|
|
10182
|
-
await this.client.
|
|
10344
|
+
await this.client.finalizeExternalEventSync(this.currentSyncRun.id.toString(), {
|
|
10183
10345
|
datawalletModifications: backboneModifications,
|
|
10184
10346
|
externalEventResults: externalEventResults
|
|
10185
10347
|
});
|
|
@@ -10189,6 +10351,21 @@ class SyncController extends core_1.TransportController {
|
|
|
10189
10351
|
await this.updateLocalDatawalletModificationIndex(newDatawalletModificationIndex);
|
|
10190
10352
|
this.currentSyncRun = undefined;
|
|
10191
10353
|
}
|
|
10354
|
+
async finalizeDatawalletVersionUpgradeSyncRun(newDatawalletVersion) {
|
|
10355
|
+
if (!this.currentSyncRun) {
|
|
10356
|
+
throw new Error("There is no active sync run to finalize");
|
|
10357
|
+
}
|
|
10358
|
+
const { backboneModifications, localModificationIds } = await this.prepareLocalDatawalletModificationsForPush();
|
|
10359
|
+
await this.client.finalizeDatawalletVersionUpgrade(this.currentSyncRun.id.toString(), {
|
|
10360
|
+
newDatawalletVersion,
|
|
10361
|
+
datawalletModifications: backboneModifications
|
|
10362
|
+
});
|
|
10363
|
+
await this.deleteUnpushedDatawalletModifications(localModificationIds);
|
|
10364
|
+
const oldDatawalletModificationIndex = await this.getLocalDatawalletModificationIndex();
|
|
10365
|
+
const newDatawalletModificationIndex = (oldDatawalletModificationIndex || -1) + backboneModifications.length;
|
|
10366
|
+
await this.updateLocalDatawalletModificationIndex(newDatawalletModificationIndex);
|
|
10367
|
+
this.currentSyncRun = undefined;
|
|
10368
|
+
}
|
|
10192
10369
|
async getLocalDatawalletModificationIndex() {
|
|
10193
10370
|
const index = await this.syncInfo.get("localDatawalletModificationIndex");
|
|
10194
10371
|
return index;
|
|
@@ -10258,8 +10435,9 @@ const CoreSerializableAsync_1 = __webpack_require__(/*! ../../core/CoreSerializa
|
|
|
10258
10435
|
const TransportIds_1 = __webpack_require__(/*! ../../core/TransportIds */ "./dist/core/TransportIds.js");
|
|
10259
10436
|
const DatawalletModification_1 = __webpack_require__(/*! ../sync/local/DatawalletModification */ "./dist/modules/sync/local/DatawalletModification.js");
|
|
10260
10437
|
class SynchronizedCollection {
|
|
10261
|
-
constructor(parent, datawalletModifications) {
|
|
10438
|
+
constructor(parent, datawalletVersion, datawalletModifications) {
|
|
10262
10439
|
this.parent = parent;
|
|
10440
|
+
this.datawalletVersion = datawalletVersion;
|
|
10263
10441
|
this.datawalletModifications = datawalletModifications;
|
|
10264
10442
|
this.name = parent.name;
|
|
10265
10443
|
this.databaseType = parent.databaseType;
|
|
@@ -10280,7 +10458,8 @@ class SynchronizedCollection {
|
|
|
10280
10458
|
collection: this.name,
|
|
10281
10459
|
objectIdentifier: objectIdentifier,
|
|
10282
10460
|
payloadCategory: DatawalletModification_1.DatawalletModificationCategory.TechnicalData,
|
|
10283
|
-
payload: technicalModificationPayload
|
|
10461
|
+
payload: technicalModificationPayload,
|
|
10462
|
+
datawalletVersion: this.datawalletVersion
|
|
10284
10463
|
}));
|
|
10285
10464
|
}
|
|
10286
10465
|
if (Object.getOwnPropertyNames(metadataModificationPayload).length !== 0) {
|
|
@@ -10290,7 +10469,8 @@ class SynchronizedCollection {
|
|
|
10290
10469
|
collection: this.name,
|
|
10291
10470
|
objectIdentifier: objectIdentifier,
|
|
10292
10471
|
payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Metadata,
|
|
10293
|
-
payload: metadataModificationPayload
|
|
10472
|
+
payload: metadataModificationPayload,
|
|
10473
|
+
datawalletVersion: this.datawalletVersion
|
|
10294
10474
|
}));
|
|
10295
10475
|
}
|
|
10296
10476
|
if (Object.getOwnPropertyNames(userdataModificationPayload).length !== 0) {
|
|
@@ -10300,7 +10480,8 @@ class SynchronizedCollection {
|
|
|
10300
10480
|
collection: this.name,
|
|
10301
10481
|
objectIdentifier: objectIdentifier,
|
|
10302
10482
|
payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Userdata,
|
|
10303
|
-
payload: userdataModificationPayload
|
|
10483
|
+
payload: userdataModificationPayload,
|
|
10484
|
+
datawalletVersion: this.datawalletVersion
|
|
10304
10485
|
}));
|
|
10305
10486
|
}
|
|
10306
10487
|
await this.parent.create(newObject);
|
|
@@ -10334,7 +10515,8 @@ class SynchronizedCollection {
|
|
|
10334
10515
|
collection: this.name,
|
|
10335
10516
|
objectIdentifier: objectIdentifier,
|
|
10336
10517
|
payloadCategory: DatawalletModification_1.DatawalletModificationCategory.TechnicalData,
|
|
10337
|
-
payload: payload
|
|
10518
|
+
payload: payload,
|
|
10519
|
+
datawalletVersion: this.datawalletVersion
|
|
10338
10520
|
}));
|
|
10339
10521
|
}
|
|
10340
10522
|
if (haveMetadataPropertiesChanged) {
|
|
@@ -10345,7 +10527,8 @@ class SynchronizedCollection {
|
|
|
10345
10527
|
collection: this.name,
|
|
10346
10528
|
objectIdentifier: objectIdentifier,
|
|
10347
10529
|
payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Metadata,
|
|
10348
|
-
payload: payload
|
|
10530
|
+
payload: payload,
|
|
10531
|
+
datawalletVersion: this.datawalletVersion
|
|
10349
10532
|
}));
|
|
10350
10533
|
}
|
|
10351
10534
|
if (haveUserdataPropertiesChanged) {
|
|
@@ -10356,7 +10539,8 @@ class SynchronizedCollection {
|
|
|
10356
10539
|
collection: this.name,
|
|
10357
10540
|
objectIdentifier: objectIdentifier,
|
|
10358
10541
|
payloadCategory: DatawalletModification_1.DatawalletModificationCategory.Userdata,
|
|
10359
|
-
payload: payload
|
|
10542
|
+
payload: payload,
|
|
10543
|
+
datawalletVersion: this.datawalletVersion
|
|
10360
10544
|
}));
|
|
10361
10545
|
}
|
|
10362
10546
|
if (hasCacheChanged) {
|
|
@@ -10364,7 +10548,8 @@ class SynchronizedCollection {
|
|
|
10364
10548
|
localId: await TransportIds_1.TransportIds.datawalletModification.generate(),
|
|
10365
10549
|
type: DatawalletModification_1.DatawalletModificationType.CacheChanged,
|
|
10366
10550
|
collection: this.name,
|
|
10367
|
-
objectIdentifier: objectIdentifier
|
|
10551
|
+
objectIdentifier: objectIdentifier,
|
|
10552
|
+
datawalletVersion: this.datawalletVersion
|
|
10368
10553
|
}));
|
|
10369
10554
|
}
|
|
10370
10555
|
return await this.parent.update(oldDoc, newObject);
|
|
@@ -10377,7 +10562,8 @@ class SynchronizedCollection {
|
|
|
10377
10562
|
localId: await TransportIds_1.TransportIds.datawalletModification.generate(),
|
|
10378
10563
|
type: DatawalletModification_1.DatawalletModificationType.Delete,
|
|
10379
10564
|
collection: this.name,
|
|
10380
|
-
objectIdentifier: object.id
|
|
10565
|
+
objectIdentifier: object.id,
|
|
10566
|
+
datawalletVersion: this.datawalletVersion
|
|
10381
10567
|
}));
|
|
10382
10568
|
return await this.parent.delete({ id: object.id.toString() });
|
|
10383
10569
|
}
|
|
@@ -10402,6 +10588,84 @@ exports.SynchronizedCollection = SynchronizedCollection;
|
|
|
10402
10588
|
|
|
10403
10589
|
/***/ }),
|
|
10404
10590
|
|
|
10591
|
+
/***/ "./dist/modules/sync/backbone/BackboneDatawalletModification.js":
|
|
10592
|
+
/*!**********************************************************************!*\
|
|
10593
|
+
!*** ./dist/modules/sync/backbone/BackboneDatawalletModification.js ***!
|
|
10594
|
+
\**********************************************************************/
|
|
10595
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10596
|
+
|
|
10597
|
+
"use strict";
|
|
10598
|
+
|
|
10599
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10600
|
+
//# sourceMappingURL=BackboneDatawalletModification.js.map
|
|
10601
|
+
|
|
10602
|
+
/***/ }),
|
|
10603
|
+
|
|
10604
|
+
/***/ "./dist/modules/sync/backbone/BackboneExternalEvent.js":
|
|
10605
|
+
/*!*************************************************************!*\
|
|
10606
|
+
!*** ./dist/modules/sync/backbone/BackboneExternalEvent.js ***!
|
|
10607
|
+
\*************************************************************/
|
|
10608
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10609
|
+
|
|
10610
|
+
"use strict";
|
|
10611
|
+
|
|
10612
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10613
|
+
//# sourceMappingURL=BackboneExternalEvent.js.map
|
|
10614
|
+
|
|
10615
|
+
/***/ }),
|
|
10616
|
+
|
|
10617
|
+
/***/ "./dist/modules/sync/backbone/CreateDatawalletModifications.js":
|
|
10618
|
+
/*!*********************************************************************!*\
|
|
10619
|
+
!*** ./dist/modules/sync/backbone/CreateDatawalletModifications.js ***!
|
|
10620
|
+
\*********************************************************************/
|
|
10621
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10622
|
+
|
|
10623
|
+
"use strict";
|
|
10624
|
+
|
|
10625
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10626
|
+
//# sourceMappingURL=CreateDatawalletModifications.js.map
|
|
10627
|
+
|
|
10628
|
+
/***/ }),
|
|
10629
|
+
|
|
10630
|
+
/***/ "./dist/modules/sync/backbone/FinalizeSyncRun.js":
|
|
10631
|
+
/*!*******************************************************!*\
|
|
10632
|
+
!*** ./dist/modules/sync/backbone/FinalizeSyncRun.js ***!
|
|
10633
|
+
\*******************************************************/
|
|
10634
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10635
|
+
|
|
10636
|
+
"use strict";
|
|
10637
|
+
|
|
10638
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10639
|
+
//# sourceMappingURL=FinalizeSyncRun.js.map
|
|
10640
|
+
|
|
10641
|
+
/***/ }),
|
|
10642
|
+
|
|
10643
|
+
/***/ "./dist/modules/sync/backbone/GetDatawallet.js":
|
|
10644
|
+
/*!*****************************************************!*\
|
|
10645
|
+
!*** ./dist/modules/sync/backbone/GetDatawallet.js ***!
|
|
10646
|
+
\*****************************************************/
|
|
10647
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10648
|
+
|
|
10649
|
+
"use strict";
|
|
10650
|
+
|
|
10651
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10652
|
+
//# sourceMappingURL=GetDatawallet.js.map
|
|
10653
|
+
|
|
10654
|
+
/***/ }),
|
|
10655
|
+
|
|
10656
|
+
/***/ "./dist/modules/sync/backbone/GetDatawalletModifications.js":
|
|
10657
|
+
/*!******************************************************************!*\
|
|
10658
|
+
!*** ./dist/modules/sync/backbone/GetDatawalletModifications.js ***!
|
|
10659
|
+
\******************************************************************/
|
|
10660
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10661
|
+
|
|
10662
|
+
"use strict";
|
|
10663
|
+
|
|
10664
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10665
|
+
//# sourceMappingURL=GetDatawalletModifications.js.map
|
|
10666
|
+
|
|
10667
|
+
/***/ }),
|
|
10668
|
+
|
|
10405
10669
|
/***/ "./dist/modules/sync/backbone/StartSyncRun.js":
|
|
10406
10670
|
/*!****************************************************!*\
|
|
10407
10671
|
!*** ./dist/modules/sync/backbone/StartSyncRun.js ***!
|
|
@@ -10411,7 +10675,12 @@ exports.SynchronizedCollection = SynchronizedCollection;
|
|
|
10411
10675
|
"use strict";
|
|
10412
10676
|
|
|
10413
10677
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10414
|
-
exports.StartSyncRunStatus = void 0;
|
|
10678
|
+
exports.StartSyncRunStatus = exports.SyncRunType = void 0;
|
|
10679
|
+
var SyncRunType;
|
|
10680
|
+
(function (SyncRunType) {
|
|
10681
|
+
SyncRunType["ExternalEventSync"] = "ExternalEventSync";
|
|
10682
|
+
SyncRunType["DatawalletVersionUpgrade"] = "DatawalletVersionUpgrade";
|
|
10683
|
+
})(SyncRunType = exports.SyncRunType || (exports.SyncRunType = {}));
|
|
10415
10684
|
var StartSyncRunStatus;
|
|
10416
10685
|
(function (StartSyncRunStatus) {
|
|
10417
10686
|
StartSyncRunStatus["Created"] = "Created";
|
|
@@ -10433,20 +10702,33 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
10433
10702
|
exports.SyncClient = void 0;
|
|
10434
10703
|
const core_1 = __webpack_require__(/*! ../../../core */ "./dist/core/index.js");
|
|
10435
10704
|
class SyncClient extends core_1.RESTClientAuthenticate {
|
|
10436
|
-
|
|
10437
|
-
|
|
10705
|
+
constructor(config, authenticator) {
|
|
10706
|
+
super(config, authenticator, {
|
|
10707
|
+
headers: {
|
|
10708
|
+
"x-supported-datawallet-version": config.supportedDatawalletVersion.toString()
|
|
10709
|
+
}
|
|
10710
|
+
});
|
|
10438
10711
|
}
|
|
10439
|
-
async
|
|
10440
|
-
return await this.
|
|
10712
|
+
async startSyncRun(request) {
|
|
10713
|
+
return await this.post("/api/v1/SyncRuns", request);
|
|
10714
|
+
}
|
|
10715
|
+
async finalizeExternalEventSync(id, request) {
|
|
10716
|
+
return await this.put(`/api/v1/SyncRuns/${id}/FinalizeExternalEventSync`, request);
|
|
10717
|
+
}
|
|
10718
|
+
async finalizeDatawalletVersionUpgrade(id, request) {
|
|
10719
|
+
return await this.put(`/api/v1/SyncRuns/${id}/FinalizeDatawalletVersionUpgrade`, request);
|
|
10441
10720
|
}
|
|
10442
10721
|
async getExternalEventsOfSyncRun(syncRunId) {
|
|
10443
10722
|
return await this.getPaged(`/api/v1/SyncRuns/${syncRunId}/ExternalEvents`, {});
|
|
10444
10723
|
}
|
|
10724
|
+
async getDatawallet() {
|
|
10725
|
+
return await this.get("/api/v1/Datawallet");
|
|
10726
|
+
}
|
|
10445
10727
|
async getDatawalletModifications(request) {
|
|
10446
|
-
return await this.getPaged("/api/v1/
|
|
10728
|
+
return await this.getPaged("/api/v1/Datawallet/Modifications", request);
|
|
10447
10729
|
}
|
|
10448
10730
|
async createDatawalletModifications(request) {
|
|
10449
|
-
return await this.post("/api/v1/
|
|
10731
|
+
return await this.post("/api/v1/Datawallet/Modifications", request);
|
|
10450
10732
|
}
|
|
10451
10733
|
}
|
|
10452
10734
|
exports.SyncClient = SyncClient;
|
|
@@ -10527,6 +10809,11 @@ __decorate([
|
|
|
10527
10809
|
(0, ts_serval_1.serialize)(),
|
|
10528
10810
|
__metadata("design:type", Object)
|
|
10529
10811
|
], DatawalletModification.prototype, "payload", void 0);
|
|
10812
|
+
__decorate([
|
|
10813
|
+
(0, ts_serval_1.validate)({ nullable: true }),
|
|
10814
|
+
(0, ts_serval_1.serialize)(),
|
|
10815
|
+
__metadata("design:type", Number)
|
|
10816
|
+
], DatawalletModification.prototype, "datawalletVersion", void 0);
|
|
10530
10817
|
DatawalletModification = DatawalletModification_1 = __decorate([
|
|
10531
10818
|
(0, ts_serval_1.type)("DatawalletModification")
|
|
10532
10819
|
], DatawalletModification);
|
|
@@ -10535,6 +10822,64 @@ exports.DatawalletModification = DatawalletModification;
|
|
|
10535
10822
|
|
|
10536
10823
|
/***/ }),
|
|
10537
10824
|
|
|
10825
|
+
/***/ "./dist/modules/sync/migrations/DeviceMigrations.js":
|
|
10826
|
+
/*!**********************************************************!*\
|
|
10827
|
+
!*** ./dist/modules/sync/migrations/DeviceMigrations.js ***!
|
|
10828
|
+
\**********************************************************/
|
|
10829
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10830
|
+
|
|
10831
|
+
"use strict";
|
|
10832
|
+
|
|
10833
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10834
|
+
exports.DeviceMigrations = void 0;
|
|
10835
|
+
class DeviceMigrations {
|
|
10836
|
+
constructor(accountController) {
|
|
10837
|
+
this.accountController = accountController;
|
|
10838
|
+
}
|
|
10839
|
+
async v1() {
|
|
10840
|
+
const query = { cache: { $exists: false } };
|
|
10841
|
+
const synchronizableToId = (c) => c.id.toString();
|
|
10842
|
+
const files = await this.accountController.files.getFiles(query);
|
|
10843
|
+
await this.accountController.files.updateCache(files.map(synchronizableToId));
|
|
10844
|
+
const messages = await this.accountController.messages.getMessages(query);
|
|
10845
|
+
await this.accountController.messages.updateCache(messages.map(synchronizableToId));
|
|
10846
|
+
const relationships = await this.accountController.relationships.getRelationships(query);
|
|
10847
|
+
await this.accountController.relationships.updateCache(relationships.map(synchronizableToId));
|
|
10848
|
+
const templates = await this.accountController.relationshipTemplates.getRelationshipTemplates(query);
|
|
10849
|
+
await this.accountController.relationshipTemplates.updateCache(templates.map(synchronizableToId));
|
|
10850
|
+
const tokens = await this.accountController.tokens.getTokens(query);
|
|
10851
|
+
await this.accountController.tokens.updateCache(tokens.map(synchronizableToId));
|
|
10852
|
+
}
|
|
10853
|
+
}
|
|
10854
|
+
exports.DeviceMigrations = DeviceMigrations;
|
|
10855
|
+
//# sourceMappingURL=DeviceMigrations.js.map
|
|
10856
|
+
|
|
10857
|
+
/***/ }),
|
|
10858
|
+
|
|
10859
|
+
/***/ "./dist/modules/sync/migrations/IdentityMigrations.js":
|
|
10860
|
+
/*!************************************************************!*\
|
|
10861
|
+
!*** ./dist/modules/sync/migrations/IdentityMigrations.js ***!
|
|
10862
|
+
\************************************************************/
|
|
10863
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
10864
|
+
|
|
10865
|
+
"use strict";
|
|
10866
|
+
|
|
10867
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10868
|
+
exports.IdentityMigrations = void 0;
|
|
10869
|
+
class IdentityMigrations {
|
|
10870
|
+
constructor(accountController) {
|
|
10871
|
+
this.accountController = accountController;
|
|
10872
|
+
}
|
|
10873
|
+
v1() {
|
|
10874
|
+
// no upgrade steps necessary for v1
|
|
10875
|
+
return Promise.resolve();
|
|
10876
|
+
}
|
|
10877
|
+
}
|
|
10878
|
+
exports.IdentityMigrations = IdentityMigrations;
|
|
10879
|
+
//# sourceMappingURL=IdentityMigrations.js.map
|
|
10880
|
+
|
|
10881
|
+
/***/ }),
|
|
10882
|
+
|
|
10538
10883
|
/***/ "./dist/modules/tokens/AnonymousTokenController.js":
|
|
10539
10884
|
/*!*********************************************************!*\
|
|
10540
10885
|
!*** ./dist/modules/tokens/AnonymousTokenController.js ***!
|
|
@@ -11746,95 +12091,33 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
11746
12091
|
/*!******************************************************************!*\
|
|
11747
12092
|
!*** ./node_modules/@js-soft/ts-utils/dist/eventBus/EventBus.js ***!
|
|
11748
12093
|
\******************************************************************/
|
|
11749
|
-
/***/ ((__unused_webpack_module, exports
|
|
12094
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
11750
12095
|
|
|
11751
12096
|
"use strict";
|
|
11752
12097
|
|
|
11753
12098
|
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");
|
|
12099
|
+
exports.getEventNamespaceFromObject = exports.EventBus = void 0;
|
|
11759
12100
|
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
12101
|
}
|
|
11791
12102
|
exports.EventBus = EventBus;
|
|
11792
12103
|
function getEventNamespaceFromObject(targetObject) {
|
|
11793
|
-
|
|
11794
|
-
if (!namespaceDecorator) {
|
|
11795
|
-
throw new Error("Event Type is not defined");
|
|
11796
|
-
}
|
|
11797
|
-
return namespaceDecorator;
|
|
12104
|
+
return targetObject.namespace;
|
|
11798
12105
|
}
|
|
12106
|
+
exports.getEventNamespaceFromObject = getEventNamespaceFromObject;
|
|
11799
12107
|
//# sourceMappingURL=EventBus.js.map
|
|
11800
12108
|
|
|
11801
12109
|
/***/ }),
|
|
11802
12110
|
|
|
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
12111
|
/***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/SubscriptionTargetInfo.js":
|
|
11828
12112
|
/*!********************************************************************************!*\
|
|
11829
12113
|
!*** ./node_modules/@js-soft/ts-utils/dist/eventBus/SubscriptionTargetInfo.js ***!
|
|
11830
12114
|
\********************************************************************************/
|
|
11831
|
-
/***/ ((__unused_webpack_module, exports
|
|
12115
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
11832
12116
|
|
|
11833
12117
|
"use strict";
|
|
11834
12118
|
|
|
11835
12119
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11836
12120
|
exports.SubscriptionTargetInfo = void 0;
|
|
11837
|
-
const Reflection_1 = __webpack_require__(/*! ./reflection/Reflection */ "./node_modules/@js-soft/ts-utils/dist/eventBus/reflection/Reflection.js");
|
|
11838
12121
|
class SubscriptionTargetInfo {
|
|
11839
12122
|
namespace;
|
|
11840
12123
|
constructor(namespace) {
|
|
@@ -11844,9 +12127,7 @@ class SubscriptionTargetInfo {
|
|
|
11844
12127
|
if (target instanceof Function) {
|
|
11845
12128
|
return new ConstructorSubscriptionTargetInfo(target);
|
|
11846
12129
|
}
|
|
11847
|
-
|
|
11848
|
-
return new NamespaceSubscriptionTargetInfo(target);
|
|
11849
|
-
}
|
|
12130
|
+
return new NamespaceSubscriptionTargetInfo(target);
|
|
11850
12131
|
}
|
|
11851
12132
|
}
|
|
11852
12133
|
exports.SubscriptionTargetInfo = SubscriptionTargetInfo;
|
|
@@ -11864,21 +12145,86 @@ class NamespaceSubscriptionTargetInfo extends SubscriptionTargetInfo {
|
|
|
11864
12145
|
constructor(namespace) {
|
|
11865
12146
|
super(namespace);
|
|
11866
12147
|
}
|
|
11867
|
-
isCompatibleWith(
|
|
12148
|
+
isCompatibleWith(_event) {
|
|
11868
12149
|
return true;
|
|
11869
12150
|
}
|
|
11870
12151
|
}
|
|
11871
12152
|
function getEventNamespaceFromClass(targetClass) {
|
|
11872
|
-
|
|
11873
|
-
if (!namespaceDecorator) {
|
|
11874
|
-
throw new Error("Event Type is not defined");
|
|
11875
|
-
}
|
|
11876
|
-
return namespaceDecorator;
|
|
12153
|
+
return targetClass.namespace;
|
|
11877
12154
|
}
|
|
11878
12155
|
//# sourceMappingURL=SubscriptionTargetInfo.js.map
|
|
11879
12156
|
|
|
11880
12157
|
/***/ }),
|
|
11881
12158
|
|
|
12159
|
+
/***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js":
|
|
12160
|
+
/*!*********************************************************************************************!*\
|
|
12161
|
+
!*** ./node_modules/@js-soft/ts-utils/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js ***!
|
|
12162
|
+
\*********************************************************************************************/
|
|
12163
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12164
|
+
|
|
12165
|
+
"use strict";
|
|
12166
|
+
|
|
12167
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12168
|
+
exports.EventEmitter2EventBus = void 0;
|
|
12169
|
+
const eventemitter2_1 = __webpack_require__(/*! eventemitter2 */ "./node_modules/eventemitter2/lib/eventemitter2.js");
|
|
12170
|
+
__webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
|
|
12171
|
+
const EventBus_1 = __webpack_require__(/*! ../EventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/EventBus.js");
|
|
12172
|
+
const SubscriptionTargetInfo_1 = __webpack_require__(/*! ../SubscriptionTargetInfo */ "./node_modules/@js-soft/ts-utils/dist/eventBus/SubscriptionTargetInfo.js");
|
|
12173
|
+
class EventEmitter2EventBus {
|
|
12174
|
+
emitter;
|
|
12175
|
+
wrappers = new Map();
|
|
12176
|
+
nextId = 0;
|
|
12177
|
+
constructor() {
|
|
12178
|
+
this.emitter = new eventemitter2_1.EventEmitter2({ wildcard: true, maxListeners: 50, verboseMemoryLeak: true });
|
|
12179
|
+
}
|
|
12180
|
+
subscribe(subscriptionTarget, handler) {
|
|
12181
|
+
return this.registerHandler(subscriptionTarget, handler);
|
|
12182
|
+
}
|
|
12183
|
+
subscribeOnce(subscriptionTarget, handler) {
|
|
12184
|
+
return this.registerHandler(subscriptionTarget, handler, true);
|
|
12185
|
+
}
|
|
12186
|
+
unsubscribe(subscriptionTarget, subscriptionId) {
|
|
12187
|
+
return this.unregisterHandler(subscriptionTarget, subscriptionId);
|
|
12188
|
+
}
|
|
12189
|
+
registerHandler(subscriptionTarget, handler, isOneTimeHandler = false) {
|
|
12190
|
+
const subscriptionTargetInfo = SubscriptionTargetInfo_1.SubscriptionTargetInfo.from(subscriptionTarget);
|
|
12191
|
+
const handlerId = this.nextId++;
|
|
12192
|
+
const handlerWrapper = (event) => {
|
|
12193
|
+
if (!subscriptionTargetInfo.isCompatibleWith(event)) {
|
|
12194
|
+
return;
|
|
12195
|
+
}
|
|
12196
|
+
handler(event);
|
|
12197
|
+
if (isOneTimeHandler) {
|
|
12198
|
+
this.unsubscribe(subscriptionTarget, handlerId);
|
|
12199
|
+
}
|
|
12200
|
+
};
|
|
12201
|
+
this.wrappers.set(handlerId, handlerWrapper);
|
|
12202
|
+
this.emitter.on(subscriptionTargetInfo.namespace, handlerWrapper);
|
|
12203
|
+
return handlerId;
|
|
12204
|
+
}
|
|
12205
|
+
unregisterHandler(subscriptionTarget, handlerId) {
|
|
12206
|
+
const subscriptionTargetInfo = SubscriptionTargetInfo_1.SubscriptionTargetInfo.from(subscriptionTarget);
|
|
12207
|
+
const handlerWrapper = this.wrappers.get(handlerId);
|
|
12208
|
+
if (!handlerWrapper) {
|
|
12209
|
+
return false;
|
|
12210
|
+
}
|
|
12211
|
+
this.emitter.off(subscriptionTargetInfo.namespace, handlerWrapper);
|
|
12212
|
+
this.wrappers.delete(handlerId);
|
|
12213
|
+
return true;
|
|
12214
|
+
}
|
|
12215
|
+
publish(event) {
|
|
12216
|
+
const namespace = (0, EventBus_1.getEventNamespaceFromObject)(event);
|
|
12217
|
+
if (!namespace) {
|
|
12218
|
+
throw Error("The event needs a namespace. Use the EventNamespace-decorator in order to define a namespace for a event.");
|
|
12219
|
+
}
|
|
12220
|
+
this.emitter.emit(namespace, event);
|
|
12221
|
+
}
|
|
12222
|
+
}
|
|
12223
|
+
exports.EventEmitter2EventBus = EventEmitter2EventBus;
|
|
12224
|
+
//# sourceMappingURL=EventEmitter2EventBus.js.map
|
|
12225
|
+
|
|
12226
|
+
/***/ }),
|
|
12227
|
+
|
|
11882
12228
|
/***/ "./node_modules/@js-soft/ts-utils/dist/eventBus/index.js":
|
|
11883
12229
|
/*!***************************************************************!*\
|
|
11884
12230
|
!*** ./node_modules/@js-soft/ts-utils/dist/eventBus/index.js ***!
|
|
@@ -11899,52 +12245,77 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11899
12245
|
};
|
|
11900
12246
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11901
12247
|
__exportStar(__webpack_require__(/*! ./EventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/EventBus.js"), exports);
|
|
11902
|
-
__exportStar(__webpack_require__(/*! ./
|
|
12248
|
+
__exportStar(__webpack_require__(/*! ./eventEmitter2/EventEmitter2EventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/eventEmitter2/EventEmitter2EventBus.js"), exports);
|
|
11903
12249
|
//# sourceMappingURL=index.js.map
|
|
11904
12250
|
|
|
11905
12251
|
/***/ }),
|
|
11906
12252
|
|
|
11907
|
-
/***/ "./node_modules/@js-soft/ts-utils/dist/
|
|
11908
|
-
|
|
11909
|
-
!*** ./node_modules/@js-soft/ts-utils/dist/
|
|
11910
|
-
|
|
11911
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
12253
|
+
/***/ "./node_modules/@js-soft/ts-utils/dist/events/DataEvent.js":
|
|
12254
|
+
/*!*****************************************************************!*\
|
|
12255
|
+
!*** ./node_modules/@js-soft/ts-utils/dist/events/DataEvent.js ***!
|
|
12256
|
+
\*****************************************************************/
|
|
12257
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11912
12258
|
|
|
11913
12259
|
"use strict";
|
|
11914
12260
|
|
|
11915
12261
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11916
|
-
exports.
|
|
11917
|
-
|
|
11918
|
-
|
|
12262
|
+
exports.DataEvent = void 0;
|
|
12263
|
+
const Event_1 = __webpack_require__(/*! ./Event */ "./node_modules/@js-soft/ts-utils/dist/events/Event.js");
|
|
12264
|
+
class DataEvent extends Event_1.Event {
|
|
12265
|
+
data;
|
|
12266
|
+
constructor(namespace, data) {
|
|
12267
|
+
super(namespace);
|
|
12268
|
+
this.data = data;
|
|
12269
|
+
}
|
|
12270
|
+
}
|
|
12271
|
+
exports.DataEvent = DataEvent;
|
|
12272
|
+
//# sourceMappingURL=DataEvent.js.map
|
|
11919
12273
|
|
|
11920
12274
|
/***/ }),
|
|
11921
12275
|
|
|
11922
|
-
/***/ "./node_modules/@js-soft/ts-utils/dist/
|
|
11923
|
-
|
|
11924
|
-
!*** ./node_modules/@js-soft/ts-utils/dist/
|
|
11925
|
-
|
|
11926
|
-
/***/ ((__unused_webpack_module, exports
|
|
12276
|
+
/***/ "./node_modules/@js-soft/ts-utils/dist/events/Event.js":
|
|
12277
|
+
/*!*************************************************************!*\
|
|
12278
|
+
!*** ./node_modules/@js-soft/ts-utils/dist/events/Event.js ***!
|
|
12279
|
+
\*************************************************************/
|
|
12280
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
11927
12281
|
|
|
11928
12282
|
"use strict";
|
|
11929
12283
|
|
|
11930
12284
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11931
|
-
exports.
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
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;
|
|
12285
|
+
exports.Event = void 0;
|
|
12286
|
+
class Event {
|
|
12287
|
+
namespace;
|
|
12288
|
+
constructor(namespace) {
|
|
12289
|
+
this.namespace = namespace;
|
|
12290
|
+
}
|
|
11945
12291
|
}
|
|
11946
|
-
exports.
|
|
11947
|
-
//# sourceMappingURL=
|
|
12292
|
+
exports.Event = Event;
|
|
12293
|
+
//# sourceMappingURL=Event.js.map
|
|
12294
|
+
|
|
12295
|
+
/***/ }),
|
|
12296
|
+
|
|
12297
|
+
/***/ "./node_modules/@js-soft/ts-utils/dist/events/index.js":
|
|
12298
|
+
/*!*************************************************************!*\
|
|
12299
|
+
!*** ./node_modules/@js-soft/ts-utils/dist/events/index.js ***!
|
|
12300
|
+
\*************************************************************/
|
|
12301
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
12302
|
+
|
|
12303
|
+
"use strict";
|
|
12304
|
+
|
|
12305
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12306
|
+
if (k2 === undefined) k2 = k;
|
|
12307
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12308
|
+
}) : (function(o, m, k, k2) {
|
|
12309
|
+
if (k2 === undefined) k2 = k;
|
|
12310
|
+
o[k2] = m[k];
|
|
12311
|
+
}));
|
|
12312
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
12313
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
12314
|
+
};
|
|
12315
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12316
|
+
__exportStar(__webpack_require__(/*! ./DataEvent */ "./node_modules/@js-soft/ts-utils/dist/events/DataEvent.js"), exports);
|
|
12317
|
+
__exportStar(__webpack_require__(/*! ./Event */ "./node_modules/@js-soft/ts-utils/dist/events/Event.js"), exports);
|
|
12318
|
+
//# sourceMappingURL=index.js.map
|
|
11948
12319
|
|
|
11949
12320
|
/***/ }),
|
|
11950
12321
|
|
|
@@ -11968,11 +12339,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11968
12339
|
};
|
|
11969
12340
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11970
12341
|
__exportStar(__webpack_require__(/*! ./eventBus */ "./node_modules/@js-soft/ts-utils/dist/eventBus/index.js"), exports);
|
|
11971
|
-
__exportStar(__webpack_require__(/*! ./
|
|
12342
|
+
__exportStar(__webpack_require__(/*! ./events */ "./node_modules/@js-soft/ts-utils/dist/events/index.js"), exports);
|
|
11972
12343
|
__exportStar(__webpack_require__(/*! ./logDecorator */ "./node_modules/@js-soft/ts-utils/dist/logDecorator.js"), exports);
|
|
11973
12344
|
__exportStar(__webpack_require__(/*! ./measureExcecutionTime */ "./node_modules/@js-soft/ts-utils/dist/measureExcecutionTime.js"), exports);
|
|
11974
12345
|
__exportStar(__webpack_require__(/*! ./randomString */ "./node_modules/@js-soft/ts-utils/dist/randomString.js"), exports);
|
|
11975
12346
|
__exportStar(__webpack_require__(/*! ./Range */ "./node_modules/@js-soft/ts-utils/dist/Range.js"), exports);
|
|
12347
|
+
__exportStar(__webpack_require__(/*! ./result */ "./node_modules/@js-soft/ts-utils/dist/result/index.js"), exports);
|
|
11976
12348
|
__exportStar(__webpack_require__(/*! ./sleep */ "./node_modules/@js-soft/ts-utils/dist/sleep.js"), exports);
|
|
11977
12349
|
//# sourceMappingURL=index.js.map
|
|
11978
12350
|
|
|
@@ -11988,10 +12360,11 @@ __exportStar(__webpack_require__(/*! ./sleep */ "./node_modules/@js-soft/ts-util
|
|
|
11988
12360
|
|
|
11989
12361
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11990
12362
|
exports.log = void 0;
|
|
11991
|
-
|
|
12363
|
+
/* eslint-disable no-console */
|
|
12364
|
+
function log(_target, propertyName, propertyDesciptor) {
|
|
11992
12365
|
const method = propertyDesciptor.value;
|
|
11993
12366
|
propertyDesciptor.value = function (...args) {
|
|
11994
|
-
const params = args.map(a => JSON.stringify(a)).join();
|
|
12367
|
+
const params = args.map((a) => JSON.stringify(a)).join();
|
|
11995
12368
|
try {
|
|
11996
12369
|
const result = method.apply(this, args);
|
|
11997
12370
|
const r = JSON.stringify(result);
|
|
@@ -12006,7 +12379,6 @@ function log(target, propertyName, propertyDesciptor) {
|
|
|
12006
12379
|
return propertyDesciptor;
|
|
12007
12380
|
}
|
|
12008
12381
|
exports.log = log;
|
|
12009
|
-
;
|
|
12010
12382
|
//# sourceMappingURL=logDecorator.js.map
|
|
12011
12383
|
|
|
12012
12384
|
/***/ }),
|
|
@@ -12021,7 +12393,8 @@ exports.log = log;
|
|
|
12021
12393
|
|
|
12022
12394
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12023
12395
|
exports.measureExcecutionTime = void 0;
|
|
12024
|
-
|
|
12396
|
+
/* eslint-disable no-console */
|
|
12397
|
+
function measureExcecutionTime(_target, _propertyName, propertyDesciptor) {
|
|
12025
12398
|
const method = propertyDesciptor.value;
|
|
12026
12399
|
propertyDesciptor.value = async function (...args) {
|
|
12027
12400
|
const t0 = Date.now();
|
|
@@ -12033,7 +12406,6 @@ function measureExcecutionTime(target, propertyName, propertyDesciptor) {
|
|
|
12033
12406
|
return propertyDesciptor;
|
|
12034
12407
|
}
|
|
12035
12408
|
exports.measureExcecutionTime = measureExcecutionTime;
|
|
12036
|
-
;
|
|
12037
12409
|
//# sourceMappingURL=measureExcecutionTime.js.map
|
|
12038
12410
|
|
|
12039
12411
|
/***/ }),
|
|
@@ -12051,13 +12423,12 @@ exports.randomString = void 0;
|
|
|
12051
12423
|
function randomString(length, characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
|
|
12052
12424
|
let result = "";
|
|
12053
12425
|
const charactersLength = characters.length;
|
|
12054
|
-
for (
|
|
12426
|
+
for (let i = 0; i < length; i++) {
|
|
12055
12427
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
12056
12428
|
}
|
|
12057
12429
|
return result;
|
|
12058
12430
|
}
|
|
12059
12431
|
exports.randomString = randomString;
|
|
12060
|
-
;
|
|
12061
12432
|
//# sourceMappingURL=randomString.js.map
|
|
12062
12433
|
|
|
12063
12434
|
/***/ }),
|
|
@@ -37812,8 +38183,7 @@ var Duration = /*#__PURE__*/function () {
|
|
|
37812
38183
|
|
|
37813
38184
|
var i = Math.trunc(own);
|
|
37814
38185
|
built[k] = i;
|
|
37815
|
-
accumulated[k] = own - i; //
|
|
37816
|
-
// plus anything further down the chain that should be rolled up in to this
|
|
38186
|
+
accumulated[k] = (own * 1000 - i * 1000) / 1000; // plus anything further down the chain that should be rolled up in to this
|
|
37817
38187
|
|
|
37818
38188
|
for (var down in vals) {
|
|
37819
38189
|
if (orderedUnits$1.indexOf(down) > orderedUnits$1.indexOf(k)) {
|
|
@@ -39574,14 +39944,19 @@ function dateTimeFromMatches(matches) {
|
|
|
39574
39944
|
}
|
|
39575
39945
|
};
|
|
39576
39946
|
|
|
39577
|
-
var zone;
|
|
39947
|
+
var zone = null;
|
|
39948
|
+
var specificOffset;
|
|
39578
39949
|
|
|
39579
|
-
if (!isUndefined(matches.
|
|
39580
|
-
zone = new FixedOffsetZone(matches.Z);
|
|
39581
|
-
} else if (!isUndefined(matches.z)) {
|
|
39950
|
+
if (!isUndefined(matches.z)) {
|
|
39582
39951
|
zone = IANAZone.create(matches.z);
|
|
39583
|
-
}
|
|
39584
|
-
|
|
39952
|
+
}
|
|
39953
|
+
|
|
39954
|
+
if (!isUndefined(matches.Z)) {
|
|
39955
|
+
if (!zone) {
|
|
39956
|
+
zone = new FixedOffsetZone(matches.Z);
|
|
39957
|
+
}
|
|
39958
|
+
|
|
39959
|
+
specificOffset = matches.Z;
|
|
39585
39960
|
}
|
|
39586
39961
|
|
|
39587
39962
|
if (!isUndefined(matches.q)) {
|
|
@@ -39613,7 +39988,7 @@ function dateTimeFromMatches(matches) {
|
|
|
39613
39988
|
|
|
39614
39989
|
return r;
|
|
39615
39990
|
}, {});
|
|
39616
|
-
return [vals, zone];
|
|
39991
|
+
return [vals, zone, specificOffset];
|
|
39617
39992
|
}
|
|
39618
39993
|
|
|
39619
39994
|
var dummyDateTimeCache = null;
|
|
@@ -39685,9 +40060,10 @@ function explainFromTokens(locale, input, format) {
|
|
|
39685
40060
|
_match = match(input, regex, handlers),
|
|
39686
40061
|
rawMatches = _match[0],
|
|
39687
40062
|
matches = _match[1],
|
|
39688
|
-
_ref6 = matches ? dateTimeFromMatches(matches) : [null, null],
|
|
40063
|
+
_ref6 = matches ? dateTimeFromMatches(matches) : [null, null, undefined],
|
|
39689
40064
|
result = _ref6[0],
|
|
39690
|
-
zone = _ref6[1]
|
|
40065
|
+
zone = _ref6[1],
|
|
40066
|
+
specificOffset = _ref6[2];
|
|
39691
40067
|
|
|
39692
40068
|
if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) {
|
|
39693
40069
|
throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");
|
|
@@ -39700,7 +40076,8 @@ function explainFromTokens(locale, input, format) {
|
|
|
39700
40076
|
rawMatches: rawMatches,
|
|
39701
40077
|
matches: matches,
|
|
39702
40078
|
result: result,
|
|
39703
|
-
zone: zone
|
|
40079
|
+
zone: zone,
|
|
40080
|
+
specificOffset: specificOffset
|
|
39704
40081
|
};
|
|
39705
40082
|
}
|
|
39706
40083
|
}
|
|
@@ -39708,9 +40085,10 @@ function parseFromTokens(locale, input, format) {
|
|
|
39708
40085
|
var _explainFromTokens = explainFromTokens(locale, input, format),
|
|
39709
40086
|
result = _explainFromTokens.result,
|
|
39710
40087
|
zone = _explainFromTokens.zone,
|
|
40088
|
+
specificOffset = _explainFromTokens.specificOffset,
|
|
39711
40089
|
invalidReason = _explainFromTokens.invalidReason;
|
|
39712
40090
|
|
|
39713
|
-
return [result, zone, invalidReason];
|
|
40091
|
+
return [result, zone, specificOffset, invalidReason];
|
|
39714
40092
|
}
|
|
39715
40093
|
|
|
39716
40094
|
var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
@@ -39998,14 +40376,15 @@ function adjustTime(inst, dur) {
|
|
|
39998
40376
|
// by handling the zone options
|
|
39999
40377
|
|
|
40000
40378
|
|
|
40001
|
-
function parseDataToDateTime(parsed, parsedZone, opts, format, text) {
|
|
40379
|
+
function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {
|
|
40002
40380
|
var setZone = opts.setZone,
|
|
40003
40381
|
zone = opts.zone;
|
|
40004
40382
|
|
|
40005
40383
|
if (parsed && Object.keys(parsed).length !== 0) {
|
|
40006
40384
|
var interpretationZone = parsedZone || zone,
|
|
40007
40385
|
inst = DateTime.fromObject(parsed, _extends({}, opts, {
|
|
40008
|
-
zone: interpretationZone
|
|
40386
|
+
zone: interpretationZone,
|
|
40387
|
+
specificOffset: specificOffset
|
|
40009
40388
|
}));
|
|
40010
40389
|
return setZone ? inst : inst.setZone(zone);
|
|
40011
40390
|
} else {
|
|
@@ -40550,7 +40929,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
40550
40929
|
}
|
|
40551
40930
|
|
|
40552
40931
|
var tsNow = Settings.now(),
|
|
40553
|
-
offsetProvis = zoneToUse.offset(tsNow),
|
|
40932
|
+
offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow),
|
|
40554
40933
|
normalized = normalizeObject(obj, normalizeUnit),
|
|
40555
40934
|
containsOrdinal = !isUndefined(normalized.ordinal),
|
|
40556
40935
|
containsGregorYear = !isUndefined(normalized.year),
|
|
@@ -40754,12 +41133,13 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
40754
41133
|
_parseFromTokens = parseFromTokens(localeToUse, text, fmt),
|
|
40755
41134
|
vals = _parseFromTokens[0],
|
|
40756
41135
|
parsedZone = _parseFromTokens[1],
|
|
40757
|
-
|
|
41136
|
+
specificOffset = _parseFromTokens[2],
|
|
41137
|
+
invalid = _parseFromTokens[3];
|
|
40758
41138
|
|
|
40759
41139
|
if (invalid) {
|
|
40760
41140
|
return DateTime.invalid(invalid);
|
|
40761
41141
|
} else {
|
|
40762
|
-
return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text);
|
|
41142
|
+
return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text, specificOffset);
|
|
40763
41143
|
}
|
|
40764
41144
|
}
|
|
40765
41145
|
/**
|
|
@@ -42397,7 +42777,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
42397
42777
|
}
|
|
42398
42778
|
}
|
|
42399
42779
|
|
|
42400
|
-
var VERSION = "2.
|
|
42780
|
+
var VERSION = "2.2.0";
|
|
42401
42781
|
|
|
42402
42782
|
exports.DateTime = DateTime;
|
|
42403
42783
|
exports.Duration = Duration;
|
|
@@ -43251,6 +43631,7 @@ var arrayPrefixGenerators = {
|
|
|
43251
43631
|
};
|
|
43252
43632
|
|
|
43253
43633
|
var isArray = Array.isArray;
|
|
43634
|
+
var split = String.prototype.split;
|
|
43254
43635
|
var push = Array.prototype.push;
|
|
43255
43636
|
var pushToArray = function (arr, valueOrArray) {
|
|
43256
43637
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
@@ -43287,6 +43668,8 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
|
|
43287
43668
|
|| typeof v === 'bigint';
|
|
43288
43669
|
};
|
|
43289
43670
|
|
|
43671
|
+
var sentinel = {};
|
|
43672
|
+
|
|
43290
43673
|
var stringify = function stringify(
|
|
43291
43674
|
object,
|
|
43292
43675
|
prefix,
|
|
@@ -43306,8 +43689,23 @@ var stringify = function stringify(
|
|
|
43306
43689
|
) {
|
|
43307
43690
|
var obj = object;
|
|
43308
43691
|
|
|
43309
|
-
|
|
43310
|
-
|
|
43692
|
+
var tmpSc = sideChannel;
|
|
43693
|
+
var step = 0;
|
|
43694
|
+
var findFlag = false;
|
|
43695
|
+
while ((tmpSc = tmpSc.get(sentinel)) !== undefined && !findFlag) {
|
|
43696
|
+
// Where object last appeared in the ref tree
|
|
43697
|
+
var pos = tmpSc.get(object);
|
|
43698
|
+
step += 1;
|
|
43699
|
+
if (typeof pos !== 'undefined') {
|
|
43700
|
+
if (pos === step) {
|
|
43701
|
+
throw new RangeError('Cyclic object value');
|
|
43702
|
+
} else {
|
|
43703
|
+
findFlag = true; // Break while
|
|
43704
|
+
}
|
|
43705
|
+
}
|
|
43706
|
+
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
|
43707
|
+
step = 0;
|
|
43708
|
+
}
|
|
43311
43709
|
}
|
|
43312
43710
|
|
|
43313
43711
|
if (typeof filter === 'function') {
|
|
@@ -43334,6 +43732,14 @@ var stringify = function stringify(
|
|
|
43334
43732
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
43335
43733
|
if (encoder) {
|
|
43336
43734
|
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
43735
|
+
if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
|
43736
|
+
var valuesArray = split.call(String(obj), ',');
|
|
43737
|
+
var valuesJoined = '';
|
|
43738
|
+
for (var i = 0; i < valuesArray.length; ++i) {
|
|
43739
|
+
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
|
43740
|
+
}
|
|
43741
|
+
return [formatter(keyValue) + '=' + valuesJoined];
|
|
43742
|
+
}
|
|
43337
43743
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
43338
43744
|
}
|
|
43339
43745
|
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
@@ -43356,8 +43762,8 @@ var stringify = function stringify(
|
|
|
43356
43762
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
43357
43763
|
}
|
|
43358
43764
|
|
|
43359
|
-
for (var
|
|
43360
|
-
var key = objKeys[
|
|
43765
|
+
for (var j = 0; j < objKeys.length; ++j) {
|
|
43766
|
+
var key = objKeys[j];
|
|
43361
43767
|
var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
|
|
43362
43768
|
|
|
43363
43769
|
if (skipNulls && value === null) {
|
|
@@ -43368,8 +43774,9 @@ var stringify = function stringify(
|
|
|
43368
43774
|
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix
|
|
43369
43775
|
: prefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
43370
43776
|
|
|
43371
|
-
sideChannel.set(object,
|
|
43777
|
+
sideChannel.set(object, step);
|
|
43372
43778
|
var valueSideChannel = getSideChannel();
|
|
43779
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
43373
43780
|
pushToArray(values, stringify(
|
|
43374
43781
|
value,
|
|
43375
43782
|
keyPrefix,
|
|
@@ -43710,6 +44117,7 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
|
43710
44117
|
|
|
43711
44118
|
i += 1;
|
|
43712
44119
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
|
44120
|
+
/* eslint operator-linebreak: [2, "before"] */
|
|
43713
44121
|
out += hexTable[0xF0 | (c >> 18)]
|
|
43714
44122
|
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
43715
44123
|
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|