@codingame/monaco-vscode-user-data-sync-service-override 19.1.3 → 20.0.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/package.json +14 -14
- package/vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js +7 -7
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.d.ts +2 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.js +2 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.d.ts +2 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.js +49 -23
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.js +78 -78
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.js +8 -8
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.js +32 -32
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js +27 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-user-data-sync-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.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,19 +15,19 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-158b9837-fc78-5d9c-86f5-9134e4358643-common": "
|
|
19
|
-
"@codingame/monaco-vscode-249dc928-1da3-51c1-82d0-45e0ba9d08a1-common": "
|
|
20
|
-
"@codingame/monaco-vscode-34a0ffd3-b9f5-5699-b43b-38af5732f38a-common": "
|
|
21
|
-
"@codingame/monaco-vscode-4a316137-39d1-5d77-8b53-112db3547c1e-common": "
|
|
22
|
-
"@codingame/monaco-vscode-897bebad-39df-57cb-8a57-36a271d038be-common": "
|
|
23
|
-
"@codingame/monaco-vscode-
|
|
24
|
-
"@codingame/monaco-vscode-
|
|
25
|
-
"@codingame/monaco-vscode-
|
|
26
|
-
"@codingame/monaco-vscode-
|
|
27
|
-
"@codingame/monaco-vscode-dbfe5f85-b426-55ed-a79b-5f811b395762-common": "
|
|
28
|
-
"@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common": "
|
|
29
|
-
"@codingame/monaco-vscode-f22e7e55-aee8-5b52-a6bc-950efd9f5890-common": "
|
|
30
|
-
"@codingame/monaco-vscode-user-data-profile-service-override": "
|
|
18
|
+
"@codingame/monaco-vscode-158b9837-fc78-5d9c-86f5-9134e4358643-common": "20.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-249dc928-1da3-51c1-82d0-45e0ba9d08a1-common": "20.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-34a0ffd3-b9f5-5699-b43b-38af5732f38a-common": "20.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-4a316137-39d1-5d77-8b53-112db3547c1e-common": "20.0.0",
|
|
22
|
+
"@codingame/monaco-vscode-897bebad-39df-57cb-8a57-36a271d038be-common": "20.0.0",
|
|
23
|
+
"@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common": "20.0.0",
|
|
24
|
+
"@codingame/monaco-vscode-a8d3bd74-e63e-5327-96e8-4f931661e329-common": "20.0.0",
|
|
25
|
+
"@codingame/monaco-vscode-api": "20.0.0",
|
|
26
|
+
"@codingame/monaco-vscode-d941ac7b-412f-57e3-b1bf-f6b0eb253b21-common": "20.0.0",
|
|
27
|
+
"@codingame/monaco-vscode-dbfe5f85-b426-55ed-a79b-5f811b395762-common": "20.0.0",
|
|
28
|
+
"@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common": "20.0.0",
|
|
29
|
+
"@codingame/monaco-vscode-f22e7e55-aee8-5b52-a6bc-950efd9f5890-common": "20.0.0",
|
|
30
|
+
"@codingame/monaco-vscode-user-data-profile-service-override": "20.0.0"
|
|
31
31
|
},
|
|
32
32
|
"main": "index.js",
|
|
33
33
|
"module": "index.js",
|
|
@@ -406,28 +406,28 @@ class AutoSync extends Disposable {
|
|
|
406
406
|
if (this.manifest === null && (await this.userDataSyncService.hasPreviouslySynced())) {
|
|
407
407
|
if (this.hasSyncServiceChanged()) {
|
|
408
408
|
if (await this.hasDefaultServiceChanged()) {
|
|
409
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
409
|
+
throw ( new UserDataAutoSyncError(( localize(2406, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
|
|
410
410
|
}
|
|
411
411
|
else {
|
|
412
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
412
|
+
throw ( new UserDataAutoSyncError(( localize(2407, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
else {
|
|
416
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
416
|
+
throw ( new UserDataAutoSyncError(( localize(2408, "Cannot sync because syncing is turned off in the cloud")), UserDataSyncErrorCode.TurnedOff));
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
const sessionId = this.storageService.get(sessionIdKey, StorageScope.APPLICATION);
|
|
420
420
|
if (sessionId && this.manifest && sessionId !== this.manifest.session) {
|
|
421
421
|
if (this.hasSyncServiceChanged()) {
|
|
422
422
|
if (await this.hasDefaultServiceChanged()) {
|
|
423
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
423
|
+
throw ( new UserDataAutoSyncError(( localize(2406, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
|
|
424
424
|
}
|
|
425
425
|
else {
|
|
426
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
426
|
+
throw ( new UserDataAutoSyncError(( localize(2407, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
else {
|
|
430
|
-
throw ( new UserDataAutoSyncError(( localize(
|
|
430
|
+
throw ( new UserDataAutoSyncError(( localize(2409, "Cannot sync because current session is expired")), UserDataSyncErrorCode.SessionExpired));
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
const machines = await this.userDataSyncMachinesService.getMachines(this.manifest || undefined);
|
|
@@ -437,7 +437,7 @@ class AutoSync extends Disposable {
|
|
|
437
437
|
const currentMachine = machines.find(machine => machine.isCurrent);
|
|
438
438
|
if (currentMachine?.disabled) {
|
|
439
439
|
throw ( new UserDataAutoSyncError(( localize(
|
|
440
|
-
|
|
440
|
+
2410,
|
|
441
441
|
"Cannot sync because syncing is turned off on this machine from another machine."
|
|
442
442
|
)), UserDataSyncErrorCode.TurnedOff));
|
|
443
443
|
}
|
|
@@ -9,7 +9,7 @@ import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/plat
|
|
|
9
9
|
import { IUserDataProfile } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
10
10
|
import { IUserDataProfilesService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile.service";
|
|
11
11
|
import { AbstractSynchroniser, IAcceptResult, IMergeResult, IResourcePreview } from "@codingame/monaco-vscode-249dc928-1da3-51c1-82d0-45e0ba9d08a1-common/vscode/vs/platform/userDataSync/common/abstractSynchronizer";
|
|
12
|
-
import { IRemoteUserData, ISyncData, ISyncUserDataProfile,
|
|
12
|
+
import { IRemoteUserData, ISyncData, ISyncUserDataProfile, IUserData, IUserDataSynchroniser } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync";
|
|
13
13
|
import { IUserDataSyncLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
14
14
|
import { IUserDataSyncEnablementService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
15
15
|
import { IUserDataSyncLocalStoreService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
@@ -40,7 +40,7 @@ export declare class UserDataProfilesManifestSynchroniser extends AbstractSynchr
|
|
|
40
40
|
readonly acceptedResource: URI;
|
|
41
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
42
|
getLastSyncedProfiles(): Promise<ISyncUserDataProfile[] | null>;
|
|
43
|
-
getRemoteSyncedProfiles(
|
|
43
|
+
getRemoteSyncedProfiles(refOrLatestData: string | IUserData | null): Promise<ISyncUserDataProfile[] | null>;
|
|
44
44
|
protected generateSyncPreview(remoteUserData: IRemoteUserData, lastSyncUserData: IRemoteUserData | null, isRemoteDataFromCurrentMachine: boolean): Promise<IUserDataProfilesManifestResourcePreview[]>;
|
|
45
45
|
protected hasRemoteChanged(lastSyncUserData: IRemoteUserData): Promise<boolean>;
|
|
46
46
|
protected getMergeResult(resourcePreview: IUserDataProfilesManifestResourcePreview, token: CancellationToken): Promise<IMergeResult>;
|
|
@@ -29,9 +29,9 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
29
29
|
const lastSyncUserData = await this.getLastSyncUserData();
|
|
30
30
|
return lastSyncUserData?.syncData ? parseUserDataProfilesManifest(lastSyncUserData.syncData) : null;
|
|
31
31
|
}
|
|
32
|
-
async getRemoteSyncedProfiles(
|
|
32
|
+
async getRemoteSyncedProfiles(refOrLatestData) {
|
|
33
33
|
const lastSyncUserData = await this.getLastSyncUserData();
|
|
34
|
-
const remoteUserData = await this.getLatestRemoteUserData(
|
|
34
|
+
const remoteUserData = await this.getLatestRemoteUserData(refOrLatestData, lastSyncUserData);
|
|
35
35
|
return remoteUserData?.syncData ? parseUserDataProfilesManifest(remoteUserData.syncData) : null;
|
|
36
36
|
}
|
|
37
37
|
async generateSyncPreview(remoteUserData, lastSyncUserData, isRemoteDataFromCurrentMachine) {
|
|
@@ -10,7 +10,7 @@ import { USER_DATA_SYNC_LOG_ID } from '@codingame/monaco-vscode-api/vscode/vs/pl
|
|
|
10
10
|
let UserDataSyncLogService = class UserDataSyncLogService extends AbstractLogger {
|
|
11
11
|
constructor(loggerService, environmentService) {
|
|
12
12
|
super();
|
|
13
|
-
this.logger = this._register(loggerService.createLogger(joinPath(environmentService.logsHome, `${USER_DATA_SYNC_LOG_ID}.log`), { id: USER_DATA_SYNC_LOG_ID, name: ( localize(
|
|
13
|
+
this.logger = this._register(loggerService.createLogger(joinPath(environmentService.logsHome, `${USER_DATA_SYNC_LOG_ID}.log`), { id: USER_DATA_SYNC_LOG_ID, name: ( localize(2416, "Settings Sync")) }));
|
|
14
14
|
}
|
|
15
15
|
trace(message, ...args) {
|
|
16
16
|
this.logger.trace(message, ...args);
|
|
@@ -459,7 +459,7 @@ let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderServ
|
|
|
459
459
|
this.logService.error(error);
|
|
460
460
|
}
|
|
461
461
|
throw ( new UserDataSyncError(( localize(
|
|
462
|
-
|
|
462
|
+
2418,
|
|
463
463
|
"Cannot parse sync data as it is not compatible with the current version."
|
|
464
464
|
)), UserDataSyncErrorCode.IncompatibleRemoteContent, syncResource));
|
|
465
465
|
}
|
|
@@ -10,7 +10,7 @@ import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
10
10
|
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
11
11
|
import { IUserDataProfile } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
12
12
|
import { IUserDataProfilesService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile.service";
|
|
13
|
-
import { IUserDataManualSyncTask, IUserDataSyncResourceConflicts, IUserDataSyncResourceError, IUserDataSyncResource, ISyncResourceHandle, IUserDataSyncTask, ISyncUserDataProfile, IUserDataManifest, IUserDataSynchroniser, SyncResource, SyncStatus, UserDataSyncError } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync";
|
|
13
|
+
import { IUserDataManualSyncTask, IUserDataSyncResourceConflicts, IUserDataSyncResourceError, IUserDataSyncResource, ISyncResourceHandle, IUserDataSyncTask, ISyncUserDataProfile, IUserDataManifest, IUserDataSynchroniser, SyncResource, SyncStatus, UserDataSyncError, IUserDataSyncLatestData } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync";
|
|
14
14
|
import { IUserDataSyncLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
15
15
|
import { IUserDataSyncResourceProviderService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
16
16
|
import { IUserDataSyncService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
|
|
@@ -113,7 +113,7 @@ declare class ProfileSynchronizer extends Disposable {
|
|
|
113
113
|
protected registerSynchronizer(syncResource: SyncResource): void;
|
|
114
114
|
private deRegisterSynchronizer;
|
|
115
115
|
createSynchronizer(syncResource: Exclude<SyncResource, SyncResource.WorkspaceState>): IUserDataSynchroniser & IDisposable;
|
|
116
|
-
sync(
|
|
116
|
+
sync(manifestOrLatestData: IUserDataManifest | IUserDataSyncLatestData | null, preview: boolean, executionId: string, token: CancellationToken): Promise<[
|
|
117
117
|
SyncResource,
|
|
118
118
|
UserDataSyncError
|
|
119
119
|
][]>;
|
|
@@ -26,7 +26,7 @@ import { SnippetsSynchroniser } from '@codingame/monaco-vscode-a022e9a8-b522-5ea
|
|
|
26
26
|
import { TasksSynchroniser } from '@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common/vscode/vs/platform/userDataSync/common/tasksSync';
|
|
27
27
|
import { McpSynchroniser } from './mcpSync.js';
|
|
28
28
|
import { UserDataProfilesManifestSynchroniser } from './userDataProfilesManifestSync.js';
|
|
29
|
-
import { SyncStatus, createSyncHeaders, UserDataSyncError, UserDataSyncErrorCode, SyncResource, ALL_SYNC_RESOURCES, USER_DATA_SYNC_CONFIGURATION_SCOPE,
|
|
29
|
+
import { SyncStatus, createSyncHeaders, UserDataSyncError, UserDataSyncErrorCode, UserDataSyncStoreError, SyncResource, ALL_SYNC_RESOURCES, USER_DATA_SYNC_CONFIGURATION_SCOPE, isUserDataManifest } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
30
30
|
import { IUserDataSyncStoreService, IUserDataSyncStoreManagementService, IUserDataSyncLogService, IUserDataSyncEnablementService, IUserDataSyncResourceProviderService, IUserDataSyncLocalStoreService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
31
31
|
|
|
32
32
|
const LAST_SYNC_TIME_KEY = 'sync.lastSyncTime';
|
|
@@ -116,14 +116,28 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
116
116
|
const startTime = ( new Date()).getTime();
|
|
117
117
|
const executionId = generateUuid();
|
|
118
118
|
const syncHeaders = createSyncHeaders(executionId);
|
|
119
|
-
let
|
|
119
|
+
let latestUserDataOrManifest;
|
|
120
120
|
try {
|
|
121
|
-
|
|
121
|
+
latestUserDataOrManifest = await this.userDataSyncStoreService.getLatestData(syncHeaders);
|
|
122
122
|
}
|
|
123
123
|
catch (error) {
|
|
124
124
|
const userDataSyncError = UserDataSyncError.toUserDataSyncError(error);
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
this.telemetryService.publicLog2('sync.download.latest', {
|
|
126
|
+
code: userDataSyncError.code,
|
|
127
|
+
serverCode: userDataSyncError instanceof UserDataSyncStoreError ? String(userDataSyncError.serverCode) : undefined,
|
|
128
|
+
url: userDataSyncError instanceof UserDataSyncStoreError ? userDataSyncError.url : undefined,
|
|
129
|
+
resource: userDataSyncError.resource,
|
|
130
|
+
executionId,
|
|
131
|
+
service: ( this.userDataSyncStoreManagementService.userDataSyncStore.url.toString())
|
|
132
|
+
});
|
|
133
|
+
try {
|
|
134
|
+
latestUserDataOrManifest = await this.userDataSyncStoreService.manifest(null, syncHeaders);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
const userDataSyncError = UserDataSyncError.toUserDataSyncError(error);
|
|
138
|
+
reportUserDataSyncError(userDataSyncError, executionId, this.userDataSyncStoreManagementService, this.telemetryService);
|
|
139
|
+
throw userDataSyncError;
|
|
140
|
+
}
|
|
127
141
|
}
|
|
128
142
|
await this.resetLocal();
|
|
129
143
|
const that = this;
|
|
@@ -131,19 +145,19 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
131
145
|
return {
|
|
132
146
|
id: executionId,
|
|
133
147
|
async merge() {
|
|
134
|
-
return that.sync(
|
|
148
|
+
return that.sync(latestUserDataOrManifest, true, executionId, cancellableToken.token);
|
|
135
149
|
},
|
|
136
150
|
async apply() {
|
|
137
151
|
try {
|
|
138
152
|
try {
|
|
139
|
-
await that.applyManualSync(
|
|
153
|
+
await that.applyManualSync(latestUserDataOrManifest, executionId, cancellableToken.token);
|
|
140
154
|
}
|
|
141
155
|
catch (error) {
|
|
142
156
|
if (UserDataSyncError.toUserDataSyncError(error).code === UserDataSyncErrorCode.MethodNotFound) {
|
|
143
157
|
that.logService.info('Client is making invalid requests. Cleaning up data...');
|
|
144
158
|
await that.cleanUpRemoteData();
|
|
145
159
|
that.logService.info('Applying manual sync again...');
|
|
146
|
-
await that.applyManualSync(
|
|
160
|
+
await that.applyManualSync(latestUserDataOrManifest, executionId, cancellableToken.token);
|
|
147
161
|
}
|
|
148
162
|
else {
|
|
149
163
|
throw error;
|
|
@@ -164,21 +178,21 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
164
178
|
}
|
|
165
179
|
};
|
|
166
180
|
}
|
|
167
|
-
async sync(
|
|
181
|
+
async sync(manifestOrLatestData, preview, executionId, token) {
|
|
168
182
|
this._syncErrors = [];
|
|
169
183
|
try {
|
|
170
184
|
if (this.status !== SyncStatus.HasConflicts) {
|
|
171
185
|
this.setStatus(SyncStatus.Syncing);
|
|
172
186
|
}
|
|
173
187
|
const defaultProfileSynchronizer = this.getOrCreateActiveProfileSynchronizer(this.userDataProfilesService.defaultProfile, undefined);
|
|
174
|
-
this._syncErrors.push(...(await this.syncProfile(defaultProfileSynchronizer,
|
|
188
|
+
this._syncErrors.push(...(await this.syncProfile(defaultProfileSynchronizer, manifestOrLatestData, preview, executionId, token)));
|
|
175
189
|
const userDataProfileManifestSynchronizer = defaultProfileSynchronizer.enabled.find(s => s.resource === SyncResource.Profiles);
|
|
176
190
|
if (userDataProfileManifestSynchronizer) {
|
|
177
191
|
const syncProfiles = (await userDataProfileManifestSynchronizer.getLastSyncedProfiles()) || [];
|
|
178
192
|
if (token.isCancellationRequested) {
|
|
179
193
|
return;
|
|
180
194
|
}
|
|
181
|
-
await this.syncRemoteProfiles(syncProfiles,
|
|
195
|
+
await this.syncRemoteProfiles(syncProfiles, manifestOrLatestData, preview, executionId, token);
|
|
182
196
|
}
|
|
183
197
|
}
|
|
184
198
|
finally {
|
|
@@ -211,7 +225,7 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
211
225
|
this.activeProfileSynchronizers.delete(key);
|
|
212
226
|
}
|
|
213
227
|
}
|
|
214
|
-
async applyManualSync(
|
|
228
|
+
async applyManualSync(manifestOrLatestData, executionId, token) {
|
|
215
229
|
try {
|
|
216
230
|
this.setStatus(SyncStatus.Syncing);
|
|
217
231
|
const profileSynchronizers = this.getActiveProfileSynchronizers();
|
|
@@ -229,18 +243,18 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
229
243
|
if (!userDataProfileManifestSynchronizer) {
|
|
230
244
|
return;
|
|
231
245
|
}
|
|
232
|
-
const remoteProfiles = (await userDataProfileManifestSynchronizer.getRemoteSyncedProfiles(
|
|
246
|
+
const remoteProfiles = (await userDataProfileManifestSynchronizer.getRemoteSyncedProfiles(getRefOrUserData(manifestOrLatestData, undefined, SyncResource.Profiles) ?? null)) || [];
|
|
233
247
|
const remoteProfilesToSync = remoteProfiles.filter(remoteProfile => profileSynchronizers.every(s => s.profile.id !== remoteProfile.id));
|
|
234
248
|
if (remoteProfilesToSync.length) {
|
|
235
|
-
await this.syncRemoteProfiles(remoteProfilesToSync,
|
|
249
|
+
await this.syncRemoteProfiles(remoteProfilesToSync, manifestOrLatestData, false, executionId, token);
|
|
236
250
|
}
|
|
237
251
|
}
|
|
238
252
|
finally {
|
|
239
253
|
this.setStatus(SyncStatus.Idle);
|
|
240
254
|
}
|
|
241
255
|
}
|
|
242
|
-
async syncProfile(profileSynchronizer,
|
|
243
|
-
const errors = await profileSynchronizer.sync(
|
|
256
|
+
async syncProfile(profileSynchronizer, manifestOrLatestData, preview, executionId, token) {
|
|
257
|
+
const errors = await profileSynchronizer.sync(manifestOrLatestData, preview, executionId, token);
|
|
244
258
|
return ( errors.map(
|
|
245
259
|
([syncResource, error]) => ({ profile: profileSynchronizer.profile, syncResource, error })
|
|
246
260
|
));
|
|
@@ -453,7 +467,7 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
453
467
|
}
|
|
454
468
|
const userDataProfileManifestSynchronizer = disposables.add(this.instantiationService.createInstance(UserDataProfilesManifestSynchroniser, profile, undefined));
|
|
455
469
|
const manifest = await this.userDataSyncStoreService.manifest(null);
|
|
456
|
-
const syncProfiles = (await userDataProfileManifestSynchronizer.getRemoteSyncedProfiles(manifest?.latest ?? null)) || [];
|
|
470
|
+
const syncProfiles = (await userDataProfileManifestSynchronizer.getRemoteSyncedProfiles(manifest?.latest?.profiles ?? null)) || [];
|
|
457
471
|
const syncProfile = syncProfiles.find(syncProfile => syncProfile.id === profile.id);
|
|
458
472
|
if (syncProfile) {
|
|
459
473
|
const profileSynchronizer = disposables.add(this.instantiationService.createInstance(ProfileSynchronizer, profile, syncProfile.collection));
|
|
@@ -644,7 +658,7 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
|
|
|
644
658
|
case SyncResource.Profiles: return this.instantiationService.createInstance(UserDataProfilesManifestSynchroniser, this.profile, this.collection);
|
|
645
659
|
}
|
|
646
660
|
}
|
|
647
|
-
async sync(
|
|
661
|
+
async sync(manifestOrLatestData, preview, executionId, token) {
|
|
648
662
|
if (token.isCancellationRequested) {
|
|
649
663
|
return [];
|
|
650
664
|
}
|
|
@@ -655,8 +669,7 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
|
|
|
655
669
|
try {
|
|
656
670
|
const syncErrors = [];
|
|
657
671
|
const syncHeaders = createSyncHeaders(executionId);
|
|
658
|
-
const
|
|
659
|
-
const userDataSyncConfiguration = preview ? await this.getUserDataSyncConfiguration(resourceManifest) : this.getLocalUserDataSyncConfiguration();
|
|
672
|
+
const userDataSyncConfiguration = preview ? await this.getUserDataSyncConfiguration(manifestOrLatestData) : this.getLocalUserDataSyncConfiguration();
|
|
660
673
|
for (const synchroniser of synchronizers) {
|
|
661
674
|
if (token.isCancellationRequested) {
|
|
662
675
|
return [];
|
|
@@ -665,7 +678,8 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
|
|
|
665
678
|
return [];
|
|
666
679
|
}
|
|
667
680
|
try {
|
|
668
|
-
|
|
681
|
+
const refOrUserData = getRefOrUserData(manifestOrLatestData, this.collection, synchroniser.resource) ?? null;
|
|
682
|
+
await synchroniser.sync(refOrUserData, preview, userDataSyncConfiguration, syncHeaders);
|
|
669
683
|
}
|
|
670
684
|
catch (e) {
|
|
671
685
|
const userDataSyncError = UserDataSyncError.toUserDataSyncError(e);
|
|
@@ -727,14 +741,14 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
|
|
|
727
741
|
}
|
|
728
742
|
}
|
|
729
743
|
}
|
|
730
|
-
async getUserDataSyncConfiguration(
|
|
744
|
+
async getUserDataSyncConfiguration(manifestOrLatestData) {
|
|
731
745
|
if (!this.profile.isDefault) {
|
|
732
746
|
return {};
|
|
733
747
|
}
|
|
734
748
|
const local = this.getLocalUserDataSyncConfiguration();
|
|
735
749
|
const settingsSynchronizer = this.enabled.find(synchronizer => synchronizer instanceof SettingsSynchroniser);
|
|
736
750
|
if (settingsSynchronizer) {
|
|
737
|
-
const remote = await settingsSynchronizer.getRemoteUserDataSyncConfiguration(
|
|
751
|
+
const remote = await settingsSynchronizer.getRemoteUserDataSyncConfiguration(getRefOrUserData(manifestOrLatestData, this.collection, SyncResource.Settings) ?? null);
|
|
738
752
|
return { ...local, ...remote };
|
|
739
753
|
}
|
|
740
754
|
return local;
|
|
@@ -819,5 +833,17 @@ function reportUserDataSyncError(userDataSyncError, executionId, userDataSyncSto
|
|
|
819
833
|
service: ( userDataSyncStoreManagementService.userDataSyncStore.url.toString())
|
|
820
834
|
});
|
|
821
835
|
}
|
|
836
|
+
function getRefOrUserData(manifestOrLatestData, collection, resource) {
|
|
837
|
+
if (isUserDataManifest(manifestOrLatestData)) {
|
|
838
|
+
if (collection) {
|
|
839
|
+
return manifestOrLatestData?.collections?.[collection]?.latest?.[resource];
|
|
840
|
+
}
|
|
841
|
+
return manifestOrLatestData?.latest?.[resource];
|
|
842
|
+
}
|
|
843
|
+
if (collection) {
|
|
844
|
+
return manifestOrLatestData?.collections?.[collection]?.resources?.[resource];
|
|
845
|
+
}
|
|
846
|
+
return manifestOrLatestData?.resources?.[resource];
|
|
847
|
+
}
|
|
822
848
|
|
|
823
849
|
export { UserDataSyncService };
|
|
@@ -32,12 +32,12 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
32
32
|
switch (error.code) {
|
|
33
33
|
case UserDataSyncErrorCode.LocalTooManyRequests: {
|
|
34
34
|
const message = isWeb ? ( localize(
|
|
35
|
-
|
|
35
|
+
12163,
|
|
36
36
|
"Settings sync is suspended temporarily because the current device is making too many requests. Please reload {0} to resume.",
|
|
37
37
|
this.productService.nameLong
|
|
38
38
|
))
|
|
39
39
|
: ( localize(
|
|
40
|
-
|
|
40
|
+
12164,
|
|
41
41
|
"Settings sync is suspended temporarily because the current device is making too many requests. Please restart {0} to resume.",
|
|
42
42
|
this.productService.nameLong
|
|
43
43
|
));
|
|
@@ -48,12 +48,12 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
48
48
|
primary: [
|
|
49
49
|
toAction({
|
|
50
50
|
id: 'Show Sync Logs',
|
|
51
|
-
label: ( localize(
|
|
51
|
+
label: ( localize(12165, "Show Log")),
|
|
52
52
|
run: () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID)
|
|
53
53
|
}),
|
|
54
54
|
toAction({
|
|
55
55
|
id: 'Restart',
|
|
56
|
-
label: isWeb ? ( localize(
|
|
56
|
+
label: isWeb ? ( localize(12166, "Reload")) : ( localize(12167, "Restart")),
|
|
57
57
|
run: () => this.hostService.restart()
|
|
58
58
|
})
|
|
59
59
|
]
|
|
@@ -62,20 +62,20 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
case UserDataSyncErrorCode.TooManyRequests: {
|
|
65
|
-
const operationId = error.operationId ? ( localize(
|
|
65
|
+
const operationId = error.operationId ? ( localize(12168, "Operation Id: {0}", error.operationId)) : undefined;
|
|
66
66
|
const message = ( localize(
|
|
67
|
-
|
|
67
|
+
12169,
|
|
68
68
|
"Settings sync is disabled because the current device is making too many requests. Please wait for 10 minutes and turn on sync."
|
|
69
69
|
));
|
|
70
70
|
this.notificationService.notify({
|
|
71
71
|
severity: Severity.Error,
|
|
72
72
|
message: operationId ? `${message} ${operationId}` : message,
|
|
73
|
-
source: error.operationId ? ( localize(
|
|
73
|
+
source: error.operationId ? ( localize(12170, "Settings Sync. Operation Id: {0}", error.operationId)) : undefined,
|
|
74
74
|
actions: {
|
|
75
75
|
primary: [
|
|
76
76
|
toAction({
|
|
77
77
|
id: 'Show Sync Logs',
|
|
78
|
-
label: ( localize(
|
|
78
|
+
label: ( localize(12165, "Show Log")),
|
|
79
79
|
run: () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID)
|
|
80
80
|
})
|
|
81
81
|
]
|