@codingame/monaco-vscode-user-data-sync-service-override 11.1.2 → 12.0.1
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/index.d.ts +2 -1
- package/index.js +37 -1
- package/package.json +32 -9
- package/vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.d.ts +54 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js +37 -53
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestMerge.d.ts +17 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestMerge.js +1 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.d.ts +62 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.js +18 -17
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.d.ts +23 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js +4 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncEnablementService.d.ts +31 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncEnablementService.js +9 -7
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLocalStoreService.d.ts +25 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLocalStoreService.js +5 -4
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLog.d.ts +15 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js +7 -6
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.d.ts +67 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js +48 -47
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.d.ts +129 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.js +71 -69
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js +28 -25
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.d.ts +97 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.js +341 -392
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.js +39 -43
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.js +5 -4
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.js +186 -211
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncEnablementService.d.ts +8 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncEnablementService.js +4 -1
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.d.ts +150 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js +128 -120
- package/vscode/src/vs/workbench/services/userDataSync/browser/webUserDataSyncEnablementService.d.ts +11 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/webUserDataSyncEnablementService.js +4 -1
- package/userDataSync.js +0 -36
package/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export default function getServiceOverride(): IEditorOverrideServices;
|
package/index.js
CHANGED
|
@@ -1 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
+
import { IUserDataAutoSyncService, IUserDataSyncStoreManagementService, IUserDataSyncStoreService, IUserDataSyncEnablementService, IUserDataSyncService, IUserDataSyncLogService, IUserDataSyncResourceProviderService, IUserDataSyncLocalStoreService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
4
|
+
import { UserDataSyncAccountService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js';
|
|
5
|
+
import { IUserDataSyncAccountService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service';
|
|
6
|
+
import { UserDataSyncMachinesService } from '@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common/vscode/vs/platform/userDataSync/common/userDataSyncMachines';
|
|
7
|
+
import { IUserDataSyncMachinesService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncMachines.service';
|
|
8
|
+
import { UserDataSyncStoreManagementService, UserDataSyncStoreService } from '@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common/vscode/vs/platform/userDataSync/common/userDataSyncStoreService';
|
|
9
|
+
import { UserDataAutoSyncService } from './vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js';
|
|
10
|
+
import { WebUserDataSyncEnablementService } from './vscode/src/vs/workbench/services/userDataSync/browser/webUserDataSyncEnablementService.js';
|
|
11
|
+
import { UserDataSyncService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncService.js';
|
|
12
|
+
import { UserDataSyncLogService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js';
|
|
13
|
+
import { UserDataSyncResourceProviderService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js';
|
|
14
|
+
import { UserDataSyncLocalStoreService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncLocalStoreService.js';
|
|
15
|
+
import { UserDataSyncWorkbenchService } from './vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js';
|
|
16
|
+
import { IUserDataSyncWorkbenchService } from 'vscode/vscode/vs/workbench/services/userDataSync/common/userDataSync.service';
|
|
17
|
+
import getServiceOverride$1 from '@codingame/monaco-vscode-user-data-profile-service-override';
|
|
18
|
+
import './vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js';
|
|
19
|
+
|
|
20
|
+
function getServiceOverride() {
|
|
21
|
+
return {
|
|
22
|
+
...getServiceOverride$1(),
|
|
23
|
+
[IUserDataAutoSyncService.toString()]: new SyncDescriptor(UserDataAutoSyncService, [], true),
|
|
24
|
+
[IUserDataSyncStoreManagementService.toString()]: new SyncDescriptor(UserDataSyncStoreManagementService, [], true),
|
|
25
|
+
[IUserDataSyncStoreService.toString()]: new SyncDescriptor(UserDataSyncStoreService, [], true),
|
|
26
|
+
[IUserDataSyncEnablementService.toString()]: new SyncDescriptor(WebUserDataSyncEnablementService, [], true),
|
|
27
|
+
[IUserDataSyncService.toString()]: new SyncDescriptor(UserDataSyncService, [], true),
|
|
28
|
+
[IUserDataSyncLogService.toString()]: new SyncDescriptor(UserDataSyncLogService, [], true),
|
|
29
|
+
[IUserDataSyncAccountService.toString()]: new SyncDescriptor(UserDataSyncAccountService, [], true),
|
|
30
|
+
[IUserDataSyncMachinesService.toString()]: new SyncDescriptor(UserDataSyncMachinesService, [], true),
|
|
31
|
+
[IUserDataSyncResourceProviderService.toString()]: new SyncDescriptor(UserDataSyncResourceProviderService, [], true),
|
|
32
|
+
[IUserDataSyncLocalStoreService.toString()]: new SyncDescriptor(UserDataSyncLocalStoreService, [], true),
|
|
33
|
+
[IUserDataSyncWorkbenchService.toString()]: new SyncDescriptor(UserDataSyncWorkbenchService, [], true)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-user-data-sync-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - user-data-sync service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,29 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-22790577-4553-50b6-978d-0acc75c394cc-common": "12.0.1",
|
|
19
|
+
"@codingame/monaco-vscode-3607c442-ae7a-594b-b840-038378c24fef-common": "12.0.1",
|
|
20
|
+
"@codingame/monaco-vscode-4a316137-39d1-5d77-8b53-112db3547c1e-common": "12.0.1",
|
|
21
|
+
"@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common": "12.0.1",
|
|
22
|
+
"@codingame/monaco-vscode-897bebad-39df-57cb-8a57-36a271d038be-common": "12.0.1",
|
|
23
|
+
"@codingame/monaco-vscode-9e888134-1a6f-58d9-b0e6-0fc047448366-common": "12.0.1",
|
|
24
|
+
"@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common": "12.0.1",
|
|
25
|
+
"@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common": "12.0.1",
|
|
26
|
+
"@codingame/monaco-vscode-a7c9ae3c-16d2-5d17-86b2-981be7094566-common": "12.0.1",
|
|
27
|
+
"@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common": "12.0.1",
|
|
28
|
+
"@codingame/monaco-vscode-f48982c4-9e82-55e2-b800-20e6d1e6096f-common": "12.0.1",
|
|
29
|
+
"@codingame/monaco-vscode-user-data-profile-service-override": "12.0.1",
|
|
30
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@codingame/monaco-vscode-2a94c04a-b85b-5669-b06b-89c1bfa11cb9-common": "12.0.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"@codingame/monaco-vscode-2a94c04a-b85b-5669-b06b-89c1bfa11cb9-common": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
17
40
|
"main": "index.js",
|
|
18
41
|
"module": "index.js",
|
|
19
42
|
"types": "index.d.ts",
|
|
@@ -22,12 +45,12 @@
|
|
|
22
45
|
"default": "./index.js"
|
|
23
46
|
},
|
|
24
47
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
48
|
+
"default": "./vscode/src/*.js",
|
|
49
|
+
"types": "./vscode/src/*.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"./*": {
|
|
52
|
+
"default": "./*.js",
|
|
53
|
+
"types": "./*.d.ts"
|
|
26
54
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.2",
|
|
30
|
-
"@codingame/monaco-vscode-user-data-profile-service-override": "11.1.2",
|
|
31
|
-
"@codingame/monaco-vscode-user-data-profile-user-data-sync-common": "11.1.2"
|
|
32
55
|
}
|
|
33
56
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IProductService } from "vscode/vscode/vs/platform/product/common/productService.service";
|
|
4
|
+
import { IStorageService } from "vscode/vscode/vs/platform/storage/common/storage.service";
|
|
5
|
+
import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
6
|
+
import { UserDataSyncError } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync";
|
|
7
|
+
import { IUserDataSyncLogService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
8
|
+
import { IUserDataAutoSyncService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
9
|
+
import { IUserDataSyncService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
10
|
+
import { IUserDataSyncEnablementService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
11
|
+
import { IUserDataSyncStoreService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
12
|
+
import { IUserDataSyncStoreManagementService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
13
|
+
import { IUserDataSyncAccountService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service";
|
|
14
|
+
import { IUserDataSyncMachinesService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSyncMachines.service";
|
|
15
|
+
export declare class UserDataAutoSyncService extends Disposable implements IUserDataAutoSyncService {
|
|
16
|
+
private readonly userDataSyncStoreManagementService;
|
|
17
|
+
private readonly userDataSyncStoreService;
|
|
18
|
+
private readonly userDataSyncEnablementService;
|
|
19
|
+
private readonly userDataSyncService;
|
|
20
|
+
private readonly logService;
|
|
21
|
+
private readonly userDataSyncAccountService;
|
|
22
|
+
private readonly telemetryService;
|
|
23
|
+
private readonly userDataSyncMachinesService;
|
|
24
|
+
private readonly storageService;
|
|
25
|
+
_serviceBrand: any;
|
|
26
|
+
private readonly autoSync;
|
|
27
|
+
private successiveFailures;
|
|
28
|
+
private lastSyncTriggerTime;
|
|
29
|
+
private readonly syncTriggerDelayer;
|
|
30
|
+
private suspendUntilRestart;
|
|
31
|
+
private readonly _onError;
|
|
32
|
+
readonly onError: Event<UserDataSyncError>;
|
|
33
|
+
private lastSyncUrl;
|
|
34
|
+
private get syncUrl();
|
|
35
|
+
private set syncUrl(value);
|
|
36
|
+
private previousProductQuality;
|
|
37
|
+
private get productQuality();
|
|
38
|
+
private set productQuality(value);
|
|
39
|
+
constructor(productService: IProductService, userDataSyncStoreManagementService: IUserDataSyncStoreManagementService, userDataSyncStoreService: IUserDataSyncStoreService, userDataSyncEnablementService: IUserDataSyncEnablementService, userDataSyncService: IUserDataSyncService, logService: IUserDataSyncLogService, userDataSyncAccountService: IUserDataSyncAccountService, telemetryService: ITelemetryService, userDataSyncMachinesService: IUserDataSyncMachinesService, storageService: IStorageService);
|
|
40
|
+
private updateAutoSync;
|
|
41
|
+
protected startAutoSync(): boolean;
|
|
42
|
+
private isAutoSyncEnabled;
|
|
43
|
+
turnOn(): Promise<void>;
|
|
44
|
+
turnOff(everywhere: boolean, softTurnOffOnError?: boolean, donotRemoveMachine?: boolean): Promise<void>;
|
|
45
|
+
private updateEnablement;
|
|
46
|
+
private hasProductQualityChanged;
|
|
47
|
+
private onDidFinishSync;
|
|
48
|
+
private disableMachineEventually;
|
|
49
|
+
private hasToDisableMachineEventually;
|
|
50
|
+
private stopDisableMachineEventually;
|
|
51
|
+
private sources;
|
|
52
|
+
triggerSync(sources: string[], skipIfSyncedRecently: boolean, disableCache: boolean): Promise<void>;
|
|
53
|
+
protected getSyncTriggerDelayTime(): number;
|
|
54
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { ThrottledDelayer, timeout, disposableTimeout, createCancelablePromise } from 'vscode/vscode/vs/base/common/async';
|
|
3
4
|
import { toLocalISOString } from 'vscode/vscode/vs/base/common/date';
|
|
4
5
|
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
@@ -10,9 +11,10 @@ import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
|
10
11
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
11
12
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
12
13
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
14
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
13
15
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
14
16
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
15
|
-
import { UserDataSyncError, UserDataAutoSyncError } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
17
|
+
import { UserDataSyncError, UserDataAutoSyncError, UserDataSyncErrorCode } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
16
18
|
import { IUserDataSyncStoreManagementService, IUserDataSyncStoreService, IUserDataSyncEnablementService, IUserDataSyncService, IUserDataSyncLogService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
17
19
|
import { IUserDataSyncAccountService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service';
|
|
18
20
|
import { IUserDataSyncMachinesService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncMachines.service';
|
|
@@ -23,26 +25,26 @@ const storeUrlKey = 'sync.storeUrl';
|
|
|
23
25
|
const productQualityKey = 'sync.productQuality';
|
|
24
26
|
let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
|
|
25
27
|
get syncUrl() {
|
|
26
|
-
const value = this.storageService.get(storeUrlKey,
|
|
28
|
+
const value = this.storageService.get(storeUrlKey, StorageScope.APPLICATION);
|
|
27
29
|
return value ? ( URI.parse(value)) : undefined;
|
|
28
30
|
}
|
|
29
31
|
set syncUrl(syncUrl) {
|
|
30
32
|
if (syncUrl) {
|
|
31
|
-
this.storageService.store(storeUrlKey, ( syncUrl.toString()),
|
|
33
|
+
this.storageService.store(storeUrlKey, ( syncUrl.toString()), StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
32
34
|
}
|
|
33
35
|
else {
|
|
34
|
-
this.storageService.remove(storeUrlKey,
|
|
36
|
+
this.storageService.remove(storeUrlKey, StorageScope.APPLICATION);
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
get productQuality() {
|
|
38
|
-
return this.storageService.get(productQualityKey,
|
|
40
|
+
return this.storageService.get(productQualityKey, StorageScope.APPLICATION);
|
|
39
41
|
}
|
|
40
42
|
set productQuality(productQuality) {
|
|
41
43
|
if (productQuality) {
|
|
42
|
-
this.storageService.store(productQualityKey, productQuality,
|
|
44
|
+
this.storageService.store(productQualityKey, productQuality, StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
43
45
|
}
|
|
44
46
|
else {
|
|
45
|
-
this.storageService.remove(productQualityKey,
|
|
47
|
+
this.storageService.remove(productQualityKey, StorageScope.APPLICATION);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
constructor(productService, userDataSyncStoreManagementService, userDataSyncStoreService, userDataSyncEnablementService, userDataSyncService, logService, userDataSyncAccountService, telemetryService, userDataSyncMachinesService, storageService) {
|
|
@@ -158,7 +160,7 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
|
|
|
158
160
|
await this.userDataSyncMachinesService.removeCurrentMachine();
|
|
159
161
|
}
|
|
160
162
|
this.updateEnablement(false);
|
|
161
|
-
this.storageService.remove(sessionIdKey,
|
|
163
|
+
this.storageService.remove(sessionIdKey, StorageScope.APPLICATION);
|
|
162
164
|
if (everywhere) {
|
|
163
165
|
this.telemetryService.publicLog2('sync/turnOffEveryWhere');
|
|
164
166
|
await this.userDataSyncService.reset();
|
|
@@ -195,43 +197,43 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
|
|
|
195
197
|
if (userDataSyncError instanceof UserDataAutoSyncError) {
|
|
196
198
|
this.telemetryService.publicLog2(`autosync/error`, { code: userDataSyncError.code, service: ( this.userDataSyncStoreManagementService.userDataSyncStore.url.toString()) });
|
|
197
199
|
}
|
|
198
|
-
if (userDataSyncError.code ===
|
|
200
|
+
if (userDataSyncError.code === UserDataSyncErrorCode.SessionExpired) {
|
|
199
201
|
await this.turnOff(false, true );
|
|
200
202
|
this.logService.info('Auto Sync: Turned off sync because current session is expired');
|
|
201
203
|
}
|
|
202
|
-
else if (userDataSyncError.code ===
|
|
204
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.TurnedOff) {
|
|
203
205
|
await this.turnOff(false, true );
|
|
204
206
|
this.logService.info('Auto Sync: Turned off sync because sync is turned off in the cloud');
|
|
205
207
|
}
|
|
206
|
-
else if (userDataSyncError.code ===
|
|
208
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.LocalTooManyRequests) {
|
|
207
209
|
this.suspendUntilRestart = true;
|
|
208
210
|
this.logService.info('Auto Sync: Suspended sync because of making too many requests to server');
|
|
209
211
|
this.updateAutoSync();
|
|
210
212
|
}
|
|
211
|
-
else if (userDataSyncError.code ===
|
|
213
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.TooManyRequests) {
|
|
212
214
|
await this.turnOff(false, true , true );
|
|
213
215
|
this.disableMachineEventually();
|
|
214
216
|
this.logService.info('Auto Sync: Turned off sync because of making too many requests to server');
|
|
215
217
|
}
|
|
216
|
-
else if (userDataSyncError.code ===
|
|
218
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.MethodNotFound) {
|
|
217
219
|
await this.turnOff(false, true );
|
|
218
220
|
this.logService.info('Auto Sync: Turned off sync because current client is making requests to server that are not supported');
|
|
219
221
|
}
|
|
220
|
-
else if (userDataSyncError.code ===
|
|
222
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.UpgradeRequired || userDataSyncError.code === UserDataSyncErrorCode.Gone) {
|
|
221
223
|
await this.turnOff(false, true , true );
|
|
222
224
|
this.disableMachineEventually();
|
|
223
225
|
this.logService.info('Auto Sync: Turned off sync because current client is not compatible with server. Requires client upgrade.');
|
|
224
226
|
}
|
|
225
|
-
else if (userDataSyncError.code ===
|
|
227
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.IncompatibleLocalContent) {
|
|
226
228
|
await this.turnOff(false, true );
|
|
227
229
|
this.logService.info(`Auto Sync: Turned off sync because server has ${userDataSyncError.resource} content with newer version than of client. Requires client upgrade.`);
|
|
228
230
|
}
|
|
229
|
-
else if (userDataSyncError.code ===
|
|
231
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.IncompatibleRemoteContent) {
|
|
230
232
|
await this.turnOff(false, true );
|
|
231
233
|
this.logService.info(`Auto Sync: Turned off sync because server has ${userDataSyncError.resource} content with older version than of client. Requires server reset.`);
|
|
232
234
|
}
|
|
233
|
-
else if (userDataSyncError.code ===
|
|
234
|
-
if (isWeb && userDataSyncError.code ===
|
|
235
|
+
else if (userDataSyncError.code === UserDataSyncErrorCode.ServiceChanged || userDataSyncError.code === UserDataSyncErrorCode.DefaultServiceChanged) {
|
|
236
|
+
if (isWeb && userDataSyncError.code === UserDataSyncErrorCode.DefaultServiceChanged && !this.hasProductQualityChanged()) {
|
|
235
237
|
await this.turnOff(false, true );
|
|
236
238
|
this.logService.info('Auto Sync: Turned off sync because default sync service is changed.');
|
|
237
239
|
}
|
|
@@ -248,7 +250,7 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
|
|
|
248
250
|
this._onError.fire(userDataSyncError);
|
|
249
251
|
}
|
|
250
252
|
async disableMachineEventually() {
|
|
251
|
-
this.storageService.store(disableMachineEventuallyKey, true,
|
|
253
|
+
this.storageService.store(disableMachineEventuallyKey, true, StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
252
254
|
await timeout(1000 * 60 * 10);
|
|
253
255
|
if (!this.hasToDisableMachineEventually()) {
|
|
254
256
|
return;
|
|
@@ -259,10 +261,10 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
|
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
hasToDisableMachineEventually() {
|
|
262
|
-
return this.storageService.getBoolean(disableMachineEventuallyKey,
|
|
264
|
+
return this.storageService.getBoolean(disableMachineEventuallyKey, StorageScope.APPLICATION, false);
|
|
263
265
|
}
|
|
264
266
|
stopDisableMachineEventually() {
|
|
265
|
-
this.storageService.remove(disableMachineEventuallyKey,
|
|
267
|
+
this.storageService.remove(disableMachineEventuallyKey, StorageScope.APPLICATION);
|
|
266
268
|
}
|
|
267
269
|
async triggerSync(sources, skipIfSyncedRecently, disableCache) {
|
|
268
270
|
if (this.autoSync.value === undefined) {
|
|
@@ -381,7 +383,7 @@ class AutoSync extends Disposable {
|
|
|
381
383
|
catch (e) {
|
|
382
384
|
this.logService.error(e);
|
|
383
385
|
error = e;
|
|
384
|
-
if (UserDataSyncError.toUserDataSyncError(e).code ===
|
|
386
|
+
if (UserDataSyncError.toUserDataSyncError(e).code === UserDataSyncErrorCode.MethodNotFound) {
|
|
385
387
|
try {
|
|
386
388
|
this.logService.info('Auto Sync: Client is making invalid requests. Cleaning up data...');
|
|
387
389
|
await this.userDataSyncService.cleanUpRemoteData();
|
|
@@ -406,46 +408,28 @@ class AutoSync extends Disposable {
|
|
|
406
408
|
if (this.manifest === null && (await this.userDataSyncService.hasPreviouslySynced())) {
|
|
407
409
|
if (this.hasSyncServiceChanged()) {
|
|
408
410
|
if (await this.hasDefaultServiceChanged()) {
|
|
409
|
-
throw ( new UserDataAutoSyncError(
|
|
410
|
-
localize(3496, "Cannot sync because default service has changed"),
|
|
411
|
-
"DefaultServiceChanged"
|
|
412
|
-
));
|
|
411
|
+
throw ( new UserDataAutoSyncError(( localize(2230, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
|
|
413
412
|
}
|
|
414
413
|
else {
|
|
415
|
-
throw ( new UserDataAutoSyncError(
|
|
416
|
-
localize(3497, "Cannot sync because sync service has changed"),
|
|
417
|
-
"ServiceChanged"
|
|
418
|
-
));
|
|
414
|
+
throw ( new UserDataAutoSyncError(( localize(2231, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
|
|
419
415
|
}
|
|
420
416
|
}
|
|
421
417
|
else {
|
|
422
|
-
throw ( new UserDataAutoSyncError(
|
|
423
|
-
localize(3498, "Cannot sync because syncing is turned off in the cloud"),
|
|
424
|
-
"TurnedOff"
|
|
425
|
-
));
|
|
418
|
+
throw ( new UserDataAutoSyncError(( localize(2232, "Cannot sync because syncing is turned off in the cloud")), UserDataSyncErrorCode.TurnedOff));
|
|
426
419
|
}
|
|
427
420
|
}
|
|
428
|
-
const sessionId = this.storageService.get(sessionIdKey,
|
|
421
|
+
const sessionId = this.storageService.get(sessionIdKey, StorageScope.APPLICATION);
|
|
429
422
|
if (sessionId && this.manifest && sessionId !== this.manifest.session) {
|
|
430
423
|
if (this.hasSyncServiceChanged()) {
|
|
431
424
|
if (await this.hasDefaultServiceChanged()) {
|
|
432
|
-
throw ( new UserDataAutoSyncError(
|
|
433
|
-
localize(3496, "Cannot sync because default service has changed"),
|
|
434
|
-
"DefaultServiceChanged"
|
|
435
|
-
));
|
|
425
|
+
throw ( new UserDataAutoSyncError(( localize(2230, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
|
|
436
426
|
}
|
|
437
427
|
else {
|
|
438
|
-
throw ( new UserDataAutoSyncError(
|
|
439
|
-
localize(3497, "Cannot sync because sync service has changed"),
|
|
440
|
-
"ServiceChanged"
|
|
441
|
-
));
|
|
428
|
+
throw ( new UserDataAutoSyncError(( localize(2231, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
|
|
442
429
|
}
|
|
443
430
|
}
|
|
444
431
|
else {
|
|
445
|
-
throw ( new UserDataAutoSyncError(
|
|
446
|
-
localize(3499, "Cannot sync because current session is expired"),
|
|
447
|
-
"SessionExpired"
|
|
448
|
-
));
|
|
432
|
+
throw ( new UserDataAutoSyncError(( localize(2233, "Cannot sync because current session is expired")), UserDataSyncErrorCode.SessionExpired));
|
|
449
433
|
}
|
|
450
434
|
}
|
|
451
435
|
const machines = await this.userDataSyncMachinesService.getMachines(this.manifest || undefined);
|
|
@@ -454,10 +438,10 @@ class AutoSync extends Disposable {
|
|
|
454
438
|
}
|
|
455
439
|
const currentMachine = machines.find(machine => machine.isCurrent);
|
|
456
440
|
if (currentMachine?.disabled) {
|
|
457
|
-
throw ( new UserDataAutoSyncError(localize(
|
|
458
|
-
|
|
441
|
+
throw ( new UserDataAutoSyncError(( localize(
|
|
442
|
+
2234,
|
|
459
443
|
"Cannot sync because syncing is turned off on this machine from another machine."
|
|
460
|
-
),
|
|
444
|
+
)), UserDataSyncErrorCode.TurnedOff));
|
|
461
445
|
}
|
|
462
446
|
const startTime = ( new Date()).getTime();
|
|
463
447
|
await this.syncTask.run();
|
|
@@ -469,12 +453,12 @@ class AutoSync extends Disposable {
|
|
|
469
453
|
catch (error) {
|
|
470
454
|
throw ( new UserDataAutoSyncError(
|
|
471
455
|
toErrorMessage(error),
|
|
472
|
-
error instanceof UserDataSyncError ? error.code :
|
|
456
|
+
error instanceof UserDataSyncError ? error.code : UserDataSyncErrorCode.Unknown
|
|
473
457
|
));
|
|
474
458
|
}
|
|
475
459
|
}
|
|
476
460
|
if (this.manifest && this.manifest.session !== sessionId) {
|
|
477
|
-
this.storageService.store(sessionIdKey, this.manifest.session,
|
|
461
|
+
this.storageService.store(sessionIdKey, this.manifest.session, StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
478
462
|
}
|
|
479
463
|
if (token.isCancellationRequested) {
|
|
480
464
|
return;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IUserDataProfile } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
2
|
+
import { ISyncUserDataProfile } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync";
|
|
3
|
+
interface IRelaxedMergeResult {
|
|
4
|
+
local: {
|
|
5
|
+
added: ISyncUserDataProfile[];
|
|
6
|
+
removed: IUserDataProfile[];
|
|
7
|
+
updated: ISyncUserDataProfile[];
|
|
8
|
+
};
|
|
9
|
+
remote: {
|
|
10
|
+
added: IUserDataProfile[];
|
|
11
|
+
removed: ISyncUserDataProfile[];
|
|
12
|
+
updated: IUserDataProfile[];
|
|
13
|
+
} | null;
|
|
14
|
+
}
|
|
15
|
+
export type IMergeResult = Required<IRelaxedMergeResult>;
|
|
16
|
+
export declare function merge(local: IUserDataProfile[], remote: ISyncUserDataProfile[] | null, lastSync: ISyncUserDataProfile[] | null, ignored: string[]): IMergeResult;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
3
|
+
import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
|
+
import { IEnvironmentService } from "vscode/vscode/vs/platform/environment/common/environment.service";
|
|
5
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
6
|
+
import { IStorageService } from "vscode/vscode/vs/platform/storage/common/storage.service";
|
|
7
|
+
import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
8
|
+
import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
9
|
+
import { IUserDataProfile } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
10
|
+
import { IUserDataProfilesService } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service";
|
|
11
|
+
import { AbstractSynchroniser, IAcceptResult, IMergeResult, IResourcePreview } from "@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common/vscode/vs/platform/userDataSync/common/abstractSynchronizer";
|
|
12
|
+
import { IRemoteUserData, IUserDataSynchroniser, ISyncUserDataProfile, ISyncData, IUserDataResourceManifest } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync";
|
|
13
|
+
import { IUserDataSyncLogService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
14
|
+
import { IUserDataSyncEnablementService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
15
|
+
import { IUserDataSyncLocalStoreService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
16
|
+
import { IUserDataSyncStoreService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
17
|
+
interface IUserDataProfileManifestResourceMergeResult extends IAcceptResult {
|
|
18
|
+
readonly local: {
|
|
19
|
+
added: ISyncUserDataProfile[];
|
|
20
|
+
removed: IUserDataProfile[];
|
|
21
|
+
updated: ISyncUserDataProfile[];
|
|
22
|
+
};
|
|
23
|
+
readonly remote: {
|
|
24
|
+
added: IUserDataProfile[];
|
|
25
|
+
removed: ISyncUserDataProfile[];
|
|
26
|
+
updated: IUserDataProfile[];
|
|
27
|
+
} | null;
|
|
28
|
+
}
|
|
29
|
+
interface IUserDataProfilesManifestResourcePreview extends IResourcePreview {
|
|
30
|
+
readonly previewResult: IUserDataProfileManifestResourceMergeResult;
|
|
31
|
+
readonly remoteProfiles: ISyncUserDataProfile[] | null;
|
|
32
|
+
}
|
|
33
|
+
export declare class UserDataProfilesManifestSynchroniser extends AbstractSynchroniser implements IUserDataSynchroniser {
|
|
34
|
+
private readonly userDataProfilesService;
|
|
35
|
+
protected readonly version: number;
|
|
36
|
+
readonly previewResource: URI;
|
|
37
|
+
readonly baseResource: URI;
|
|
38
|
+
readonly localResource: URI;
|
|
39
|
+
readonly remoteResource: URI;
|
|
40
|
+
readonly acceptedResource: URI;
|
|
41
|
+
constructor(profile: IUserDataProfile, collection: string | undefined, userDataProfilesService: IUserDataProfilesService, fileService: IFileService, environmentService: IEnvironmentService, storageService: IStorageService, userDataSyncStoreService: IUserDataSyncStoreService, userDataSyncLocalStoreService: IUserDataSyncLocalStoreService, logService: IUserDataSyncLogService, configurationService: IConfigurationService, userDataSyncEnablementService: IUserDataSyncEnablementService, telemetryService: ITelemetryService, uriIdentityService: IUriIdentityService);
|
|
42
|
+
getLastSyncedProfiles(): Promise<ISyncUserDataProfile[] | null>;
|
|
43
|
+
getRemoteSyncedProfiles(manifest: IUserDataResourceManifest | null): Promise<ISyncUserDataProfile[] | null>;
|
|
44
|
+
protected generateSyncPreview(remoteUserData: IRemoteUserData, lastSyncUserData: IRemoteUserData | null, isRemoteDataFromCurrentMachine: boolean): Promise<IUserDataProfilesManifestResourcePreview[]>;
|
|
45
|
+
protected hasRemoteChanged(lastSyncUserData: IRemoteUserData): Promise<boolean>;
|
|
46
|
+
protected getMergeResult(resourcePreview: IUserDataProfilesManifestResourcePreview, token: CancellationToken): Promise<IMergeResult>;
|
|
47
|
+
protected getAcceptResult(resourcePreview: IUserDataProfilesManifestResourcePreview, resource: URI, content: string | null | undefined, token: CancellationToken): Promise<IAcceptResult>;
|
|
48
|
+
private acceptLocal;
|
|
49
|
+
private acceptRemote;
|
|
50
|
+
protected applyResult(remoteUserData: IRemoteUserData, lastSyncUserData: IRemoteUserData | null, resourcePreviews: [
|
|
51
|
+
IUserDataProfilesManifestResourcePreview,
|
|
52
|
+
IUserDataProfileManifestResourceMergeResult
|
|
53
|
+
][], force: boolean): Promise<void>;
|
|
54
|
+
updateRemoteProfiles(profiles: ISyncUserDataProfile[], ref: string | null): Promise<IRemoteUserData>;
|
|
55
|
+
hasLocalData(): Promise<boolean>;
|
|
56
|
+
resolveContent(uri: URI): Promise<string | null>;
|
|
57
|
+
private getLocalUserDataProfiles;
|
|
58
|
+
private stringifyRemoteProfiles;
|
|
59
|
+
}
|
|
60
|
+
export declare function stringifyLocalProfiles(profiles: IUserDataProfile[], format: boolean): string;
|
|
61
|
+
export declare function parseUserDataProfilesManifest(syncData: ISyncData): ISyncUserDataProfile[];
|
|
62
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
3
|
+
import { toFormattedString } from '@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common/vscode/vs/base/common/jsonFormatter';
|
|
3
4
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
4
5
|
import { IEnvironmentService } from 'vscode/vscode/vs/platform/environment/common/environment.service';
|
|
5
6
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
@@ -7,14 +8,14 @@ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storag
|
|
|
7
8
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
8
9
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
9
10
|
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
10
|
-
import { AbstractSynchroniser } from 'vscode/vscode/vs/platform/userDataSync/common/abstractSynchronizer';
|
|
11
|
+
import { AbstractSynchroniser } from '@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common/vscode/vs/platform/userDataSync/common/abstractSynchronizer';
|
|
11
12
|
import { merge } from './userDataProfilesManifestMerge.js';
|
|
12
|
-
import { USER_DATA_SYNC_SCHEME, UserDataSyncError } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
13
|
+
import { SyncResource, USER_DATA_SYNC_SCHEME, Change, UserDataSyncError, UserDataSyncErrorCode } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
13
14
|
import { IUserDataSyncStoreService, IUserDataSyncLocalStoreService, IUserDataSyncLogService, IUserDataSyncEnablementService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
14
15
|
|
|
15
16
|
let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchroniser extends AbstractSynchroniser {
|
|
16
17
|
constructor(profile, collection, userDataProfilesService, fileService, environmentService, storageService, userDataSyncStoreService, userDataSyncLocalStoreService, logService, configurationService, userDataSyncEnablementService, telemetryService, uriIdentityService) {
|
|
17
|
-
super({ syncResource:
|
|
18
|
+
super({ syncResource: SyncResource.Profiles, profile }, collection, fileService, environmentService, storageService, userDataSyncStoreService, userDataSyncLocalStoreService, userDataSyncEnablementService, telemetryService, logService, configurationService, uriIdentityService);
|
|
18
19
|
this.userDataProfilesService = userDataProfilesService;
|
|
19
20
|
this.version = 2;
|
|
20
21
|
this.previewResource = this.extUri.joinPath(this.syncPreviewFolder, 'profiles.json');
|
|
@@ -41,8 +42,8 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
41
42
|
const previewResult = {
|
|
42
43
|
local, remote,
|
|
43
44
|
content: lastSyncProfiles ? this.stringifyRemoteProfiles(lastSyncProfiles) : null,
|
|
44
|
-
localChange: local.added.length > 0 || local.removed.length > 0 || local.updated.length > 0 ?
|
|
45
|
-
remoteChange: remote !== null ?
|
|
45
|
+
localChange: local.added.length > 0 || local.removed.length > 0 || local.updated.length > 0 ? Change.Modified : Change.None,
|
|
46
|
+
remoteChange: remote !== null ? Change.Modified : Change.None,
|
|
46
47
|
};
|
|
47
48
|
const localContent = stringifyLocalProfiles(localProfiles, false);
|
|
48
49
|
return [{
|
|
@@ -89,8 +90,8 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
89
90
|
content: resourcePreview.localContent,
|
|
90
91
|
local,
|
|
91
92
|
remote,
|
|
92
|
-
localChange: local.added.length > 0 || local.removed.length > 0 || local.updated.length > 0 ?
|
|
93
|
-
remoteChange: remote !== null ?
|
|
93
|
+
localChange: local.added.length > 0 || local.removed.length > 0 || local.updated.length > 0 ? Change.Modified : Change.None,
|
|
94
|
+
remoteChange: remote !== null ? Change.Modified : Change.None,
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
async acceptRemote(resourcePreview) {
|
|
@@ -111,8 +112,8 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
111
112
|
content: resourcePreview.remoteContent,
|
|
112
113
|
local,
|
|
113
114
|
remote,
|
|
114
|
-
localChange: local.added.length > 0 || local.removed.length > 0 || local.updated.length > 0 ?
|
|
115
|
-
remoteChange: remote !== null ?
|
|
115
|
+
localChange: local.added.length > 0 || local.removed.length > 0 || local.updated.length > 0 ? Change.Modified : Change.None,
|
|
116
|
+
remoteChange: remote !== null ? Change.Modified : Change.None,
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
119
|
else {
|
|
@@ -120,24 +121,24 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
120
121
|
content: resourcePreview.remoteContent,
|
|
121
122
|
local: { added: [], removed: [], updated: [] },
|
|
122
123
|
remote: null,
|
|
123
|
-
localChange:
|
|
124
|
-
remoteChange:
|
|
124
|
+
localChange: Change.None,
|
|
125
|
+
remoteChange: Change.None,
|
|
125
126
|
};
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
async applyResult(remoteUserData, lastSyncUserData, resourcePreviews, force) {
|
|
129
130
|
const { local, remote, localChange, remoteChange } = resourcePreviews[0][1];
|
|
130
|
-
if (localChange ===
|
|
131
|
+
if (localChange === Change.None && remoteChange === Change.None) {
|
|
131
132
|
this.logService.info(`${this.syncResourceLogLabel}: No changes found during synchronizing profiles.`);
|
|
132
133
|
}
|
|
133
134
|
const remoteProfiles = resourcePreviews[0][0].remoteProfiles || [];
|
|
134
135
|
if (remoteProfiles.length + (remote?.added.length ?? 0) - (remote?.removed.length ?? 0) > 20) {
|
|
135
136
|
throw ( new UserDataSyncError(
|
|
136
137
|
'Too many profiles to sync. Please remove some profiles and try again.',
|
|
137
|
-
|
|
138
|
+
UserDataSyncErrorCode.LocalTooManyProfiles
|
|
138
139
|
));
|
|
139
140
|
}
|
|
140
|
-
if (localChange !==
|
|
141
|
+
if (localChange !== Change.None) {
|
|
141
142
|
await this.backupLocal(stringifyLocalProfiles(this.getLocalUserDataProfiles(), false));
|
|
142
143
|
await Promise.all(( local.removed.map(async (profile) => {
|
|
143
144
|
this.logService.trace(`${this.syncResourceLogLabel}: Removing '${profile.name}' profile...`);
|
|
@@ -161,7 +162,7 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
161
162
|
}
|
|
162
163
|
})));
|
|
163
164
|
}
|
|
164
|
-
if (remoteChange !==
|
|
165
|
+
if (remoteChange !== Change.None) {
|
|
165
166
|
this.logService.trace(`${this.syncResourceLogLabel}: Updating remote profiles...`);
|
|
166
167
|
const addedCollections = [];
|
|
167
168
|
const canAddRemoteProfiles = remoteProfiles.length + (remote?.added.length ?? 0) <= 20;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IUserDataSyncLogService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
4
|
+
import { IUserDataSyncStoreService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
5
|
+
import { IUserDataSyncAccountService } from "vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service";
|
|
6
|
+
export interface IUserDataSyncAccount {
|
|
7
|
+
readonly authenticationProviderId: string;
|
|
8
|
+
readonly token: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class UserDataSyncAccountService extends Disposable implements IUserDataSyncAccountService {
|
|
11
|
+
private readonly userDataSyncStoreService;
|
|
12
|
+
private readonly logService;
|
|
13
|
+
_serviceBrand: any;
|
|
14
|
+
private _account;
|
|
15
|
+
get account(): IUserDataSyncAccount | undefined;
|
|
16
|
+
private _onDidChangeAccount;
|
|
17
|
+
readonly onDidChangeAccount: Event<IUserDataSyncAccount | undefined>;
|
|
18
|
+
private _onTokenFailed;
|
|
19
|
+
readonly onTokenFailed: Event<boolean>;
|
|
20
|
+
private wasTokenFailed;
|
|
21
|
+
constructor(userDataSyncStoreService: IUserDataSyncStoreService, logService: IUserDataSyncLogService);
|
|
22
|
+
updateAccount(account: IUserDataSyncAccount | undefined): Promise<void>;
|
|
23
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
4
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { UserDataSyncErrorCode } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
4
6
|
import { IUserDataSyncStoreService, IUserDataSyncLogService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
5
7
|
|
|
6
8
|
let UserDataSyncAccountService = class UserDataSyncAccountService extends Disposable {
|
|
@@ -17,7 +19,7 @@ let UserDataSyncAccountService = class UserDataSyncAccountService extends Dispos
|
|
|
17
19
|
this._register(userDataSyncStoreService.onTokenFailed(code => {
|
|
18
20
|
this.logService.info('Settings Sync auth token failed', this.account?.authenticationProviderId, this.wasTokenFailed, code);
|
|
19
21
|
this.updateAccount(undefined);
|
|
20
|
-
if (code ===
|
|
22
|
+
if (code === UserDataSyncErrorCode.Forbidden) {
|
|
21
23
|
this._onTokenFailed.fire(true );
|
|
22
24
|
}
|
|
23
25
|
else {
|