@codingame/monaco-vscode-user-data-sync-service-override 37.2.0 → 37.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common.d.ts +2 -0
- package/common.js +36 -0
- package/index.d.ts +1 -2
- package/index.js +1 -35
- package/package.json +11 -3
- package/session.d.ts +1 -0
- package/session.js +2 -0
- package/vscode/src/vs/platform/userDataSync/common/promptsSync/promptsSync.js +2 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js +7 -7
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestMerge.js +18 -53
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.js +9 -9
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLocalStoreService.js +4 -4
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js +7 -7
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.js +11 -9
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.js +77 -77
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.js +10 -10
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.js +7 -4
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.js +44 -44
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js +40 -35
package/common.d.ts
ADDED
package/common.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
+
import { IUserDataSyncLocalStoreService, IUserDataSyncResourceProviderService, IUserDataSyncLogService, IUserDataSyncService, IUserDataSyncEnablementService, IUserDataSyncStoreService, IUserDataSyncStoreManagementService, IUserDataAutoSyncService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
4
|
+
import { UserDataSyncAccountService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js';
|
|
5
|
+
import { IUserDataSyncAccountService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service';
|
|
6
|
+
import { UserDataSyncMachinesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncMachines';
|
|
7
|
+
import { IUserDataSyncMachinesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncMachines.service';
|
|
8
|
+
import { UserDataSyncStoreService, UserDataSyncStoreManagementService } from '@codingame/monaco-vscode-api/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 '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataSync/common/userDataSync.service';
|
|
17
|
+
import getServiceOverride$1 from '@codingame/monaco-vscode-user-data-profile-service-override';
|
|
18
|
+
|
|
19
|
+
function getServiceOverride() {
|
|
20
|
+
return {
|
|
21
|
+
...getServiceOverride$1(),
|
|
22
|
+
[IUserDataAutoSyncService.toString()]: new SyncDescriptor(UserDataAutoSyncService, [], true),
|
|
23
|
+
[IUserDataSyncStoreManagementService.toString()]: new SyncDescriptor(UserDataSyncStoreManagementService, [], true),
|
|
24
|
+
[IUserDataSyncStoreService.toString()]: new SyncDescriptor(UserDataSyncStoreService, [], true),
|
|
25
|
+
[IUserDataSyncEnablementService.toString()]: new SyncDescriptor(WebUserDataSyncEnablementService, [], true),
|
|
26
|
+
[IUserDataSyncService.toString()]: new SyncDescriptor(UserDataSyncService, [], true),
|
|
27
|
+
[IUserDataSyncLogService.toString()]: new SyncDescriptor(UserDataSyncLogService, [], true),
|
|
28
|
+
[IUserDataSyncAccountService.toString()]: new SyncDescriptor(UserDataSyncAccountService, [], true),
|
|
29
|
+
[IUserDataSyncMachinesService.toString()]: new SyncDescriptor(UserDataSyncMachinesService, [], true),
|
|
30
|
+
[IUserDataSyncResourceProviderService.toString()]: new SyncDescriptor(UserDataSyncResourceProviderService, [], true),
|
|
31
|
+
[IUserDataSyncLocalStoreService.toString()]: new SyncDescriptor(UserDataSyncLocalStoreService, [], true),
|
|
32
|
+
[IUserDataSyncWorkbenchService.toString()]: new SyncDescriptor(UserDataSyncWorkbenchService, [], true)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { getServiceOverride as default };
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getServiceOverride(): IEditorOverrideServices;
|
|
1
|
+
export { default } from "./common.js";
|
package/index.js
CHANGED
|
@@ -1,37 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
import { IUserDataSyncLocalStoreService, IUserDataSyncResourceProviderService, IUserDataSyncLogService, IUserDataSyncService, IUserDataSyncEnablementService, IUserDataSyncStoreService, IUserDataSyncStoreManagementService, IUserDataAutoSyncService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
4
|
-
import { UserDataSyncAccountService } from './vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js';
|
|
5
|
-
import { IUserDataSyncAccountService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service';
|
|
6
|
-
import { UserDataSyncMachinesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncMachines';
|
|
7
|
-
import { IUserDataSyncMachinesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncMachines.service';
|
|
8
|
-
import { UserDataSyncStoreService, UserDataSyncStoreManagementService } from '@codingame/monaco-vscode-api/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 '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataSync/common/userDataSync.service';
|
|
17
|
-
import getServiceOverride$1 from '@codingame/monaco-vscode-user-data-profile-service-override';
|
|
2
|
+
export { default } from './common.js';
|
|
18
3
|
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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-user-data-sync-service-override",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - user-data-sync service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "37.
|
|
19
|
-
"@codingame/monaco-vscode-user-data-profile-service-override": "37.
|
|
18
|
+
"@codingame/monaco-vscode-api": "37.3.0",
|
|
19
|
+
"@codingame/monaco-vscode-user-data-profile-service-override": "37.3.0"
|
|
20
20
|
},
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"module": "index.js",
|
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
"types": "./vscode/src/*.d.ts",
|
|
33
33
|
"default": "./vscode/src/*.js"
|
|
34
34
|
},
|
|
35
|
+
"./session": {
|
|
36
|
+
"types": "./session.d.ts",
|
|
37
|
+
"default": "./session.js"
|
|
38
|
+
},
|
|
39
|
+
"./common": {
|
|
40
|
+
"types": "./common.d.ts",
|
|
41
|
+
"default": "./common.js"
|
|
42
|
+
},
|
|
35
43
|
"./*": {
|
|
36
44
|
"types": "./*.d.ts",
|
|
37
45
|
"default": "./*.js"
|
package/session.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./common.js";
|
package/session.js
ADDED
|
@@ -129,10 +129,10 @@ let PromptsSynchronizer = class PromptsSynchronizer extends AbstractSynchroniser
|
|
|
129
129
|
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
130
130
|
}
|
|
131
131
|
async applyResult(remoteUserData, lastSyncUserData, resourcePreviews, force) {
|
|
132
|
-
const accptedResourcePreviews =
|
|
132
|
+
const accptedResourcePreviews = resourcePreviews.map(([resourcePreview, acceptResult]) => ({
|
|
133
133
|
...resourcePreview,
|
|
134
134
|
acceptResult
|
|
135
|
-
}))
|
|
135
|
+
}));
|
|
136
136
|
if (accptedResourcePreviews.every((
|
|
137
137
|
{
|
|
138
138
|
localChange,
|
|
@@ -479,24 +479,24 @@ class AutoSync extends Disposable {
|
|
|
479
479
|
if (this.manifest === null && (await this.userDataSyncService.hasPreviouslySynced())) {
|
|
480
480
|
if (this.hasSyncServiceChanged()) {
|
|
481
481
|
if (await this.hasDefaultServiceChanged()) {
|
|
482
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
482
|
+
throw ( new UserDataAutoSyncError(( localize(2919, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
|
|
483
483
|
} else {
|
|
484
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
484
|
+
throw ( new UserDataAutoSyncError(( localize(2920, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
|
|
485
485
|
}
|
|
486
486
|
} else {
|
|
487
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
487
|
+
throw ( new UserDataAutoSyncError(( localize(2921, "Cannot sync because syncing is turned off in the cloud")), UserDataSyncErrorCode.TurnedOff));
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
const sessionId = this.storageService.get(sessionIdKey, StorageScope.APPLICATION);
|
|
491
491
|
if (sessionId && this.manifest && sessionId !== this.manifest.session) {
|
|
492
492
|
if (this.hasSyncServiceChanged()) {
|
|
493
493
|
if (await this.hasDefaultServiceChanged()) {
|
|
494
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
494
|
+
throw ( new UserDataAutoSyncError(( localize(2919, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
|
|
495
495
|
} else {
|
|
496
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
496
|
+
throw ( new UserDataAutoSyncError(( localize(2920, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
|
|
497
497
|
}
|
|
498
498
|
} else {
|
|
499
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
499
|
+
throw ( new UserDataAutoSyncError(( localize(2922, "Cannot sync because current session is expired")), UserDataSyncErrorCode.SessionExpired));
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
const machines = await this.userDataSyncMachinesService.getMachines(this.manifest || undefined);
|
|
@@ -506,7 +506,7 @@ class AutoSync extends Disposable {
|
|
|
506
506
|
const currentMachine = machines.find(machine => machine.isCurrent);
|
|
507
507
|
if (currentMachine?.disabled) {
|
|
508
508
|
throw ( new UserDataAutoSyncError(( localize(
|
|
509
|
-
|
|
509
|
+
2923,
|
|
510
510
|
"Cannot sync because syncing is turned off on this machine from another machine."
|
|
511
511
|
)), UserDataSyncErrorCode.TurnedOff));
|
|
512
512
|
}
|
|
@@ -2,25 +2,14 @@
|
|
|
2
2
|
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
3
3
|
|
|
4
4
|
function merge(local, remote, lastSync, ignored) {
|
|
5
|
-
const localResult = {
|
|
6
|
-
|
|
7
|
-
removed: [],
|
|
8
|
-
updated: []
|
|
9
|
-
};
|
|
10
|
-
let remoteResult = {
|
|
11
|
-
added: [],
|
|
12
|
-
removed: [],
|
|
13
|
-
updated: []
|
|
14
|
-
};
|
|
5
|
+
const localResult = { added: [], removed: [], updated: [] };
|
|
6
|
+
let remoteResult = { added: [], removed: [], updated: [] };
|
|
15
7
|
if (!remote) {
|
|
16
|
-
const added = local.filter((
|
|
17
|
-
{
|
|
18
|
-
id
|
|
19
|
-
}
|
|
20
|
-
) => !ignored.includes(id));
|
|
8
|
+
const added = local.filter(({ id }) => !ignored.includes(id));
|
|
21
9
|
if (added.length) {
|
|
22
10
|
remoteResult.added = added;
|
|
23
|
-
}
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
24
13
|
remoteResult = null;
|
|
25
14
|
}
|
|
26
15
|
return {
|
|
@@ -44,7 +33,8 @@ function merge(local, remote, lastSync, ignored) {
|
|
|
44
33
|
if (localToRemote.updated.includes(id)) {
|
|
45
34
|
localResult.updated.push(remoteProfile);
|
|
46
35
|
}
|
|
47
|
-
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
48
38
|
localResult.added.push(remoteProfile);
|
|
49
39
|
}
|
|
50
40
|
}
|
|
@@ -74,54 +64,29 @@ function merge(local, remote, lastSync, ignored) {
|
|
|
74
64
|
if (remoteResult.added.length === 0 && remoteResult.removed.length === 0 && remoteResult.updated.length === 0) {
|
|
75
65
|
remoteResult = null;
|
|
76
66
|
}
|
|
77
|
-
return {
|
|
78
|
-
local: localResult,
|
|
79
|
-
remote: remoteResult
|
|
80
|
-
};
|
|
67
|
+
return { local: localResult, remote: remoteResult };
|
|
81
68
|
}
|
|
82
69
|
function compare(from, to, ignoredProfiles) {
|
|
83
|
-
from = from ? from.filter((
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
) => !ignoredProfiles.includes(id)) : [];
|
|
88
|
-
to = to.filter((
|
|
89
|
-
{
|
|
90
|
-
id
|
|
91
|
-
}
|
|
92
|
-
) => !ignoredProfiles.includes(id));
|
|
93
|
-
const fromKeys = ( from.map((
|
|
94
|
-
{
|
|
95
|
-
id
|
|
96
|
-
}
|
|
97
|
-
) => id));
|
|
98
|
-
const toKeys = ( to.map((
|
|
99
|
-
{
|
|
100
|
-
id
|
|
101
|
-
}
|
|
102
|
-
) => id));
|
|
70
|
+
from = from ? from.filter(({ id }) => !ignoredProfiles.includes(id)) : [];
|
|
71
|
+
to = to.filter(({ id }) => !ignoredProfiles.includes(id));
|
|
72
|
+
const fromKeys = from.map(({ id }) => id);
|
|
73
|
+
const toKeys = to.map(({ id }) => id);
|
|
103
74
|
const added = toKeys.filter(key => !fromKeys.includes(key));
|
|
104
75
|
const removed = fromKeys.filter(key => !toKeys.includes(key));
|
|
105
76
|
const updated = [];
|
|
106
|
-
for (const {
|
|
107
|
-
id,
|
|
108
|
-
name,
|
|
109
|
-
icon,
|
|
110
|
-
useDefaultFlags
|
|
111
|
-
} of from) {
|
|
77
|
+
for (const { id, name, icon, useDefaultFlags } of from) {
|
|
112
78
|
if (removed.includes(id)) {
|
|
113
79
|
continue;
|
|
114
80
|
}
|
|
115
81
|
const toProfile = to.find(p => p.id === id);
|
|
116
|
-
if (!toProfile
|
|
82
|
+
if (!toProfile
|
|
83
|
+
|| toProfile.name !== name
|
|
84
|
+
|| toProfile.icon !== icon
|
|
85
|
+
|| !equals(toProfile.useDefaultFlags, useDefaultFlags)) {
|
|
117
86
|
updated.push(id);
|
|
118
87
|
}
|
|
119
88
|
}
|
|
120
|
-
return {
|
|
121
|
-
added,
|
|
122
|
-
removed,
|
|
123
|
-
updated
|
|
124
|
-
};
|
|
89
|
+
return { added, removed, updated };
|
|
125
90
|
}
|
|
126
91
|
|
|
127
92
|
export { merge };
|
|
@@ -200,20 +200,20 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
200
200
|
}
|
|
201
201
|
if (localChange !== Change.None) {
|
|
202
202
|
await this.backupLocal(stringifyLocalProfiles(this.getLocalUserDataProfiles(), false));
|
|
203
|
-
await Promise.all(
|
|
203
|
+
await Promise.all(local.removed.map(async profile => {
|
|
204
204
|
this.logService.trace(`${this.syncResourceLogLabel}: Removing '${profile.name}' profile...`);
|
|
205
205
|
await this.userDataProfilesService.removeProfile(profile);
|
|
206
206
|
this.logService.info(`${this.syncResourceLogLabel}: Removed profile '${profile.name}'.`);
|
|
207
|
-
}))
|
|
208
|
-
await Promise.all(
|
|
207
|
+
}));
|
|
208
|
+
await Promise.all(local.added.map(async profile => {
|
|
209
209
|
this.logService.trace(`${this.syncResourceLogLabel}: Creating '${profile.name}' profile...`);
|
|
210
210
|
await this.userDataProfilesService.createProfile(profile.id, profile.name, {
|
|
211
211
|
icon: profile.icon,
|
|
212
212
|
useDefaultFlags: profile.useDefaultFlags
|
|
213
213
|
});
|
|
214
214
|
this.logService.info(`${this.syncResourceLogLabel}: Created profile '${profile.name}'.`);
|
|
215
|
-
}))
|
|
216
|
-
await Promise.all(
|
|
215
|
+
}));
|
|
216
|
+
await Promise.all(local.updated.map(async profile => {
|
|
217
217
|
const localProfile = this.userDataProfilesService.profiles.find(p => p.id === profile.id);
|
|
218
218
|
if (localProfile) {
|
|
219
219
|
this.logService.trace(`${this.syncResourceLogLabel}: Updating '${profile.name}' profile...`);
|
|
@@ -228,7 +228,7 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
228
228
|
`${this.syncResourceLogLabel}: Could not find profile with id '${profile.id}' to update.`
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
|
-
}))
|
|
231
|
+
}));
|
|
232
232
|
}
|
|
233
233
|
if (remoteChange !== Change.None) {
|
|
234
234
|
this.logService.trace(`${this.syncResourceLogLabel}: Updating remote profiles...`);
|
|
@@ -280,7 +280,7 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
280
280
|
try {
|
|
281
281
|
remoteUserData = await this.updateRemoteProfiles(remoteProfiles, force ? null : remoteUserData.ref);
|
|
282
282
|
this.logService.info(
|
|
283
|
-
`${this.syncResourceLogLabel}: Updated remote profiles.${canAddRemoteProfiles && remote?.added.length ? ` Added: ${JSON.stringify(
|
|
283
|
+
`${this.syncResourceLogLabel}: Updated remote profiles.${canAddRemoteProfiles && remote?.added.length ? ` Added: ${JSON.stringify(remote.added.map(e => e.name))}.` : ""}${remote?.updated.length ? ` Updated: ${JSON.stringify(remote.updated.map(e => e.name))}.` : ""}${remote?.removed.length ? ` Removed: ${JSON.stringify(remote.removed.map(e => e.name))}.` : ""}`
|
|
284
284
|
);
|
|
285
285
|
} catch (error) {
|
|
286
286
|
if (addedCollections.length) {
|
|
@@ -325,10 +325,10 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
325
325
|
};
|
|
326
326
|
UserDataProfilesManifestSynchroniser = ( __decorate([( __param(2, IUserDataProfilesService)), ( __param(3, IFileService)), ( __param(4, IEnvironmentService)), ( __param(5, IStorageService)), ( __param(6, IUserDataSyncStoreService)), ( __param(7, IUserDataSyncLocalStoreService)), ( __param(8, IUserDataSyncLogService)), ( __param(9, IConfigurationService)), ( __param(10, IUserDataSyncEnablementService)), ( __param(11, ITelemetryService)), ( __param(12, IUriIdentityService))], UserDataProfilesManifestSynchroniser));
|
|
327
327
|
function stringifyLocalProfiles(profiles, format) {
|
|
328
|
-
const result =
|
|
328
|
+
const result = [...profiles].sort((a, b) => a.name.localeCompare(b.name)).map(p => ({
|
|
329
329
|
id: p.id,
|
|
330
330
|
name: p.name
|
|
331
|
-
}))
|
|
331
|
+
}));
|
|
332
332
|
return format ? toFormattedString(result, {}) : JSON.stringify(result);
|
|
333
333
|
}
|
|
334
334
|
function parseUserDataProfilesManifest(syncData) {
|
|
@@ -71,10 +71,10 @@ let UserDataSyncLocalStoreService = class UserDataSyncLocalStoreService extends
|
|
|
71
71
|
const stat = await this.fileService.resolve(folder);
|
|
72
72
|
if (stat.children) {
|
|
73
73
|
const all = stat.children.filter(stat => stat.isFile && !stat.name.startsWith("lastSync")).sort().reverse();
|
|
74
|
-
return
|
|
74
|
+
return all.map(stat => ({
|
|
75
75
|
ref: stat.name,
|
|
76
76
|
created: this.getCreationTime(stat)
|
|
77
|
-
}))
|
|
77
|
+
}));
|
|
78
78
|
}
|
|
79
79
|
} catch (error) {
|
|
80
80
|
if (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {
|
|
@@ -124,10 +124,10 @@ let UserDataSyncLocalStoreService = class UserDataSyncLocalStoreService extends
|
|
|
124
124
|
if (remaining < 10) {
|
|
125
125
|
toDelete = toDelete.slice(10 - remaining);
|
|
126
126
|
}
|
|
127
|
-
await Promises.settled(
|
|
127
|
+
await Promises.settled(toDelete.map(async stat => {
|
|
128
128
|
this.logService.info("Deleting from backup", stat.resource.path);
|
|
129
129
|
await this.fileService.del(stat.resource);
|
|
130
|
-
}))
|
|
130
|
+
}));
|
|
131
131
|
}
|
|
132
132
|
} catch (e) {
|
|
133
133
|
this.logService.error(e);
|
|
@@ -13,7 +13,7 @@ let UserDataSyncLogService = class UserDataSyncLogService extends AbstractLogger
|
|
|
13
13
|
this.logger = this._register(
|
|
14
14
|
loggerService.createLogger(joinPath(environmentService.logsHome, `${USER_DATA_SYNC_LOG_ID}.log`), {
|
|
15
15
|
id: USER_DATA_SYNC_LOG_ID,
|
|
16
|
-
name: ( localize(
|
|
16
|
+
name: ( localize(2929, "Settings Sync"))
|
|
17
17
|
})
|
|
18
18
|
);
|
|
19
19
|
}
|
|
@@ -87,17 +87,17 @@ let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderServ
|
|
|
87
87
|
const content = await this.userDataSyncLocalStoreService.resolveResourceContent("machines", refs[0].ref, undefined, location);
|
|
88
88
|
if (content) {
|
|
89
89
|
const machinesData = JSON.parse(content);
|
|
90
|
-
return
|
|
90
|
+
return machinesData.machines.map(m => ({
|
|
91
91
|
...m,
|
|
92
92
|
isCurrent: false
|
|
93
|
-
}))
|
|
93
|
+
}));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
return [];
|
|
97
97
|
}
|
|
98
98
|
async getRemoteSyncResourceHandles(syncResource, profile) {
|
|
99
99
|
const handles = await this.userDataSyncStoreService.getAllResourceRefs(syncResource, profile?.collection);
|
|
100
|
-
return
|
|
100
|
+
return handles.map((
|
|
101
101
|
{
|
|
102
102
|
created,
|
|
103
103
|
ref
|
|
@@ -113,11 +113,11 @@ let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderServ
|
|
|
113
113
|
ref,
|
|
114
114
|
node: undefined
|
|
115
115
|
})
|
|
116
|
-
}))
|
|
116
|
+
}));
|
|
117
117
|
}
|
|
118
118
|
async getLocalSyncResourceHandles(syncResource, profile, location) {
|
|
119
119
|
const handles = await this.userDataSyncLocalStoreService.getAllResourceRefs(syncResource, profile?.collection, location);
|
|
120
|
-
return
|
|
120
|
+
return handles.map((
|
|
121
121
|
{
|
|
122
122
|
created,
|
|
123
123
|
ref
|
|
@@ -133,7 +133,7 @@ let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderServ
|
|
|
133
133
|
node: undefined,
|
|
134
134
|
location
|
|
135
135
|
})
|
|
136
|
-
}))
|
|
136
|
+
}));
|
|
137
137
|
}
|
|
138
138
|
resolveUserDataSyncResource(
|
|
139
139
|
{
|
|
@@ -580,7 +580,7 @@ let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderServ
|
|
|
580
580
|
this.logService.error(error);
|
|
581
581
|
}
|
|
582
582
|
throw ( new UserDataSyncError(( localize(
|
|
583
|
-
|
|
583
|
+
2931,
|
|
584
584
|
"Cannot parse sync data as it is not compatible with the current version."
|
|
585
585
|
)), UserDataSyncErrorCode.IncompatibleRemoteContent, syncResource));
|
|
586
586
|
}
|
|
@@ -289,15 +289,17 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
289
289
|
}
|
|
290
290
|
async syncProfile(profileSynchronizer, manifestOrLatestData, preview, executionId, token) {
|
|
291
291
|
const errors = await profileSynchronizer.sync(manifestOrLatestData, preview, executionId, token);
|
|
292
|
-
return
|
|
292
|
+
return errors.map(([syncResource, error]) => ({
|
|
293
293
|
profile: profileSynchronizer.profile,
|
|
294
294
|
syncResource,
|
|
295
295
|
error
|
|
296
|
-
}))
|
|
296
|
+
}));
|
|
297
297
|
}
|
|
298
298
|
async stop() {
|
|
299
299
|
if (this.status !== SyncStatus.Idle) {
|
|
300
|
-
await Promise.allSettled(
|
|
300
|
+
await Promise.allSettled(
|
|
301
|
+
this.getActiveProfileSynchronizers().map(profileSynchronizer => profileSynchronizer.stop())
|
|
302
|
+
);
|
|
301
303
|
}
|
|
302
304
|
}
|
|
303
305
|
async resolveContent(resource) {
|
|
@@ -438,14 +440,14 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
438
440
|
}
|
|
439
441
|
async cleanUpRemoteData() {
|
|
440
442
|
const remoteProfiles = await this.userDataSyncResourceProviderService.getRemoteSyncedProfiles();
|
|
441
|
-
const remoteProfileCollections =
|
|
443
|
+
const remoteProfileCollections = remoteProfiles.map(profile => profile.collection);
|
|
442
444
|
const allCollections = await this.userDataSyncStoreService.getAllCollections();
|
|
443
445
|
const redundantCollections = allCollections.filter(c => !remoteProfileCollections.includes(c));
|
|
444
446
|
if (redundantCollections.length) {
|
|
445
447
|
this.logService.info(`Deleting ${redundantCollections.length} redundant collections on server`);
|
|
446
|
-
await Promise.allSettled(
|
|
448
|
+
await Promise.allSettled(redundantCollections.map(
|
|
447
449
|
collectionId => this.userDataSyncStoreService.deleteCollection(collectionId)
|
|
448
|
-
))
|
|
450
|
+
));
|
|
449
451
|
this.logService.info(`Deleted redundant collections on server`);
|
|
450
452
|
}
|
|
451
453
|
const updatedRemoteProfiles = remoteProfiles.filter(profile => allCollections.includes(profile.collection));
|
|
@@ -554,7 +556,7 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
554
556
|
}
|
|
555
557
|
}
|
|
556
558
|
updateConflicts() {
|
|
557
|
-
const conflicts =
|
|
559
|
+
const conflicts = this.getActiveProfileSynchronizers().map(synchronizer => synchronizer.conflicts).flat();
|
|
558
560
|
if (!equals(
|
|
559
561
|
this._conflicts,
|
|
560
562
|
conflicts,
|
|
@@ -624,7 +626,7 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
624
626
|
UserDataSyncService = ( __decorate([( __param(0, IFileService)), ( __param(1, IUserDataSyncStoreService)), ( __param(2, IUserDataSyncStoreManagementService)), ( __param(3, IInstantiationService)), ( __param(4, IUserDataSyncLogService)), ( __param(5, ITelemetryService)), ( __param(6, IStorageService)), ( __param(7, IUserDataSyncEnablementService)), ( __param(8, IUserDataProfilesService)), ( __param(9, IUserDataSyncResourceProviderService)), ( __param(10, IUserDataSyncLocalStoreService))], UserDataSyncService));
|
|
625
627
|
let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
|
|
626
628
|
get enabled() {
|
|
627
|
-
return
|
|
629
|
+
return this._enabled.sort((a, b) => a[1] - b[1]).map(([synchronizer]) => synchronizer);
|
|
628
630
|
}
|
|
629
631
|
get disabled() {
|
|
630
632
|
return ALL_SYNC_RESOURCES.filter(
|
|
@@ -874,7 +876,7 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
|
|
|
874
876
|
return this.setStatus(SyncStatus.Idle);
|
|
875
877
|
}
|
|
876
878
|
updateConflicts() {
|
|
877
|
-
const conflicts =
|
|
879
|
+
const conflicts = this.enabled.filter(s => s.status === SyncStatus.HasConflicts).filter(s => s.conflicts.conflicts.length > 0).map(s => s.conflicts);
|
|
878
880
|
if (!equals(
|
|
879
881
|
this._conflicts,
|
|
880
882
|
conflicts,
|
|
@@ -39,11 +39,11 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
39
39
|
case UserDataSyncErrorCode.LocalTooManyRequests:
|
|
40
40
|
{
|
|
41
41
|
const message = isWeb ? ( localize(
|
|
42
|
-
|
|
42
|
+
20741,
|
|
43
43
|
"Settings sync is suspended temporarily because the current device is making too many requests. Please reload {0} to resume.",
|
|
44
44
|
this.productService.nameLong
|
|
45
45
|
)) : ( localize(
|
|
46
|
-
|
|
46
|
+
20742,
|
|
47
47
|
"Settings sync is suspended temporarily because the current device is making too many requests. Please restart {0} to resume.",
|
|
48
48
|
this.productService.nameLong
|
|
49
49
|
));
|
|
@@ -53,11 +53,11 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
53
53
|
actions: {
|
|
54
54
|
primary: [toAction({
|
|
55
55
|
id: "Show Sync Logs",
|
|
56
|
-
label: ( localize(
|
|
56
|
+
label: ( localize(20743, "Show Log")),
|
|
57
57
|
run: () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID)
|
|
58
58
|
}), toAction({
|
|
59
59
|
id: "Restart",
|
|
60
|
-
label: isWeb ? ( localize(
|
|
60
|
+
label: isWeb ? ( localize(20744, "Reload")) : ( localize(20745, "Restart")),
|
|
61
61
|
run: () => this.hostService.restart()
|
|
62
62
|
})]
|
|
63
63
|
}
|
|
@@ -66,19 +66,19 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
66
66
|
}
|
|
67
67
|
case UserDataSyncErrorCode.TooManyRequests:
|
|
68
68
|
{
|
|
69
|
-
const operationId = error.operationId ? ( localize(
|
|
69
|
+
const operationId = error.operationId ? ( localize(20746, "Operation Id: {0}", error.operationId)) : undefined;
|
|
70
70
|
const message = ( localize(
|
|
71
|
-
|
|
71
|
+
20747,
|
|
72
72
|
"Settings sync is disabled because the current device is making too many requests. Please wait for 10 minutes and turn on sync."
|
|
73
73
|
));
|
|
74
74
|
this.notificationService.notify({
|
|
75
75
|
severity: Severity.Error,
|
|
76
76
|
message: operationId ? `${message} ${operationId}` : message,
|
|
77
|
-
source: error.operationId ? ( localize(
|
|
77
|
+
source: error.operationId ? ( localize(20748, "Settings Sync. Operation Id: {0}", error.operationId)) : undefined,
|
|
78
78
|
actions: {
|
|
79
79
|
primary: [toAction({
|
|
80
80
|
id: "Show Sync Logs",
|
|
81
|
-
label: ( localize(
|
|
81
|
+
label: ( localize(20743, "Show Log")),
|
|
82
82
|
run: () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID)
|
|
83
83
|
})]
|
|
84
84
|
}
|