@codingame/monaco-vscode-user-data-sync-service-override 13.1.7 → 14.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-user-data-sync-service-override",
3
- "version": "13.1.7",
3
+ "version": "14.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,20 +15,19 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-3607c442-ae7a-594b-b840-038378c24fef-common": "13.1.7",
19
- "@codingame/monaco-vscode-411e0589-fa79-504b-b32c-80a88847b23a-common": "13.1.7",
20
- "@codingame/monaco-vscode-4a316137-39d1-5d77-8b53-112db3547c1e-common": "13.1.7",
21
- "@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common": "13.1.7",
22
- "@codingame/monaco-vscode-897bebad-39df-57cb-8a57-36a271d038be-common": "13.1.7",
23
- "@codingame/monaco-vscode-972e8507-3a64-566d-8bc0-b78993998562-common": "13.1.7",
24
- "@codingame/monaco-vscode-9e888134-1a6f-58d9-b0e6-0fc047448366-common": "13.1.7",
25
- "@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common": "13.1.7",
26
- "@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common": "13.1.7",
27
- "@codingame/monaco-vscode-a7c9ae3c-16d2-5d17-86b2-981be7094566-common": "13.1.7",
28
- "@codingame/monaco-vscode-api": "13.1.7",
29
- "@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common": "13.1.7",
30
- "@codingame/monaco-vscode-f48982c4-9e82-55e2-b800-20e6d1e6096f-common": "13.1.7",
31
- "@codingame/monaco-vscode-user-data-profile-service-override": "13.1.7"
18
+ "@codingame/monaco-vscode-3607c442-ae7a-594b-b840-038378c24fef-common": "14.0.0",
19
+ "@codingame/monaco-vscode-407531d3-fdae-5387-8c41-49ba0e9574b5-common": "14.0.0",
20
+ "@codingame/monaco-vscode-411e0589-fa79-504b-b32c-80a88847b23a-common": "14.0.0",
21
+ "@codingame/monaco-vscode-4a316137-39d1-5d77-8b53-112db3547c1e-common": "14.0.0",
22
+ "@codingame/monaco-vscode-897bebad-39df-57cb-8a57-36a271d038be-common": "14.0.0",
23
+ "@codingame/monaco-vscode-91789cdf-e3cb-5a04-aaeb-6f7df7d3d231-common": "14.0.0",
24
+ "@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common": "14.0.0",
25
+ "@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common": "14.0.0",
26
+ "@codingame/monaco-vscode-a7c9ae3c-16d2-5d17-86b2-981be7094566-common": "14.0.0",
27
+ "@codingame/monaco-vscode-api": "14.0.0",
28
+ "@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common": "14.0.0",
29
+ "@codingame/monaco-vscode-f48982c4-9e82-55e2-b800-20e6d1e6096f-common": "14.0.0",
30
+ "@codingame/monaco-vscode-user-data-profile-service-override": "14.0.0"
32
31
  },
33
32
  "main": "index.js",
34
33
  "module": "index.js",
@@ -3,7 +3,7 @@ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/l
3
3
  import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
4
4
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
5
5
  import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
6
- import { UserDataSyncError } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync";
6
+ import { UserDataSyncError, SyncOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync";
7
7
  import { IUserDataSyncLogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
8
8
  import { IUserDataAutoSyncService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
9
9
  import { IUserDataSyncService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
@@ -49,6 +49,6 @@ export declare class UserDataAutoSyncService extends Disposable implements IUser
49
49
  private hasToDisableMachineEventually;
50
50
  private stopDisableMachineEventually;
51
51
  private sources;
52
- triggerSync(sources: string[], skipIfSyncedRecently: boolean, disableCache: boolean): Promise<void>;
52
+ triggerSync(sources: string[], options?: SyncOptions): Promise<void>;
53
53
  protected getSyncTriggerDelayTime(): number;
54
54
  }
@@ -14,7 +14,7 @@ import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform
14
14
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
15
15
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
16
16
  import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
17
- import { UserDataSyncError, UserDataAutoSyncError, UserDataSyncErrorCode } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
17
+ import { UserDataSyncError, UserDataSyncErrorCode, UserDataAutoSyncError } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
18
18
  import { IUserDataSyncStoreManagementService, IUserDataSyncStoreService, IUserDataSyncEnablementService, IUserDataSyncService, IUserDataSyncLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
19
19
  import { IUserDataSyncAccountService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service';
20
20
  import { IUserDataSyncMachinesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSyncMachines.service';
@@ -71,21 +71,21 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
71
71
  this.previousProductQuality = this.productQuality;
72
72
  this.productQuality = productService.quality;
73
73
  if (this.syncUrl) {
74
- this.logService.info('Using settings sync service', ( this.syncUrl.toString()));
74
+ this.logService.info('[AutoSync] Using settings sync service', ( this.syncUrl.toString()));
75
75
  this._register(userDataSyncStoreManagementService.onDidChangeUserDataSyncStore(() => {
76
76
  if (!isEqual(this.syncUrl, userDataSyncStoreManagementService.userDataSyncStore?.url)) {
77
77
  this.lastSyncUrl = this.syncUrl;
78
78
  this.syncUrl = userDataSyncStoreManagementService.userDataSyncStore?.url;
79
79
  if (this.syncUrl) {
80
- this.logService.info('Using settings sync service', ( this.syncUrl.toString()));
80
+ this.logService.info('[AutoSync] Using settings sync service', ( this.syncUrl.toString()));
81
81
  }
82
82
  }
83
83
  }));
84
84
  if (this.userDataSyncEnablementService.isEnabled()) {
85
- this.logService.info('Auto Sync is enabled.');
85
+ this.logService.info('[AutoSync] Enabled.');
86
86
  }
87
87
  else {
88
- this.logService.info('Auto Sync is disabled.');
88
+ this.logService.info('[AutoSync] Disabled.');
89
89
  }
90
90
  this.updateAutoSync();
91
91
  if (this.hasToDisableMachineEventually()) {
@@ -93,9 +93,9 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
93
93
  }
94
94
  this._register(userDataSyncAccountService.onDidChangeAccount(() => this.updateAutoSync()));
95
95
  this._register(userDataSyncStoreService.onDidChangeDonotMakeRequestsUntil(() => this.updateAutoSync()));
96
- this._register(userDataSyncService.onDidChangeLocal(source => this.triggerSync([source], false, false)));
97
- this._register(Event.filter(this.userDataSyncEnablementService.onDidChangeResourceEnablement, ([, enabled]) => enabled)(() => this.triggerSync(['resourceEnablement'], false, false)));
98
- this._register(this.userDataSyncStoreManagementService.onDidChangeUserDataSyncStore(() => this.triggerSync(['userDataSyncStoreChanged'], false, false)));
96
+ this._register(userDataSyncService.onDidChangeLocal(source => this.triggerSync([source])));
97
+ this._register(Event.filter(this.userDataSyncEnablementService.onDidChangeResourceEnablement, ([, enabled]) => enabled)(() => this.triggerSync(['resourceEnablement'])));
98
+ this._register(this.userDataSyncStoreManagementService.onDidChangeUserDataSyncStore(() => this.triggerSync(['userDataSyncStoreChanged'])));
99
99
  }
100
100
  }
101
101
  updateAutoSync() {
@@ -136,16 +136,16 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
136
136
  startAutoSync() { return true; }
137
137
  isAutoSyncEnabled() {
138
138
  if (!this.userDataSyncEnablementService.isEnabled()) {
139
- return { enabled: false, message: 'Auto Sync: Disabled.' };
139
+ return { enabled: false, message: '[AutoSync] Disabled.' };
140
140
  }
141
141
  if (!this.userDataSyncAccountService.account) {
142
- return { enabled: false, message: 'Auto Sync: Suspended until auth token is available.' };
142
+ return { enabled: false, message: '[AutoSync] Suspended until auth token is available.' };
143
143
  }
144
144
  if (this.userDataSyncStoreService.donotMakeRequestsUntil) {
145
- return { enabled: false, message: `Auto Sync: Suspended until ${toLocalISOString(this.userDataSyncStoreService.donotMakeRequestsUntil)} because server is not accepting requests until then.` };
145
+ return { enabled: false, message: `[AutoSync] Suspended until ${toLocalISOString(this.userDataSyncStoreService.donotMakeRequestsUntil)} because server is not accepting requests until then.` };
146
146
  }
147
147
  if (this.suspendUntilRestart) {
148
- return { enabled: false, message: 'Auto Sync: Suspended until restart.' };
148
+ return { enabled: false, message: '[AutoSync] Suspended until restart.' };
149
149
  }
150
150
  return { enabled: true };
151
151
  }
@@ -162,7 +162,6 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
162
162
  this.updateEnablement(false);
163
163
  this.storageService.remove(sessionIdKey, StorageScope.APPLICATION);
164
164
  if (everywhere) {
165
- this.telemetryService.publicLog2('sync/turnOffEveryWhere');
166
165
  await this.userDataSyncService.reset();
167
166
  }
168
167
  else {
@@ -189,58 +188,56 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
189
188
  return !!this.previousProductQuality && !!this.productQuality && this.previousProductQuality !== this.productQuality;
190
189
  }
191
190
  async onDidFinishSync(error) {
191
+ this.logService.debug('[AutoSync] Sync Finished');
192
192
  if (!error) {
193
193
  this.successiveFailures = 0;
194
194
  return;
195
195
  }
196
196
  const userDataSyncError = UserDataSyncError.toUserDataSyncError(error);
197
- if (userDataSyncError instanceof UserDataAutoSyncError) {
198
- this.telemetryService.publicLog2(`autosync/error`, { code: userDataSyncError.code, service: ( this.userDataSyncStoreManagementService.userDataSyncStore.url.toString()) });
199
- }
200
197
  if (userDataSyncError.code === UserDataSyncErrorCode.SessionExpired) {
201
198
  await this.turnOff(false, true );
202
- this.logService.info('Auto Sync: Turned off sync because current session is expired');
199
+ this.logService.info('[AutoSync] Turned off sync because current session is expired');
203
200
  }
204
201
  else if (userDataSyncError.code === UserDataSyncErrorCode.TurnedOff) {
205
202
  await this.turnOff(false, true );
206
- this.logService.info('Auto Sync: Turned off sync because sync is turned off in the cloud');
203
+ this.logService.info('[AutoSync] Turned off sync because sync is turned off in the cloud');
207
204
  }
208
205
  else if (userDataSyncError.code === UserDataSyncErrorCode.LocalTooManyRequests) {
209
206
  this.suspendUntilRestart = true;
210
- this.logService.info('Auto Sync: Suspended sync because of making too many requests to server');
207
+ this.logService.info('[AutoSync] Suspended sync because of making too many requests to server');
211
208
  this.updateAutoSync();
212
209
  }
213
210
  else if (userDataSyncError.code === UserDataSyncErrorCode.TooManyRequests) {
214
211
  await this.turnOff(false, true , true );
215
212
  this.disableMachineEventually();
216
- this.logService.info('Auto Sync: Turned off sync because of making too many requests to server');
213
+ this.logService.info('[AutoSync] Turned off sync because of making too many requests to server');
217
214
  }
218
215
  else if (userDataSyncError.code === UserDataSyncErrorCode.MethodNotFound) {
219
216
  await this.turnOff(false, true );
220
- this.logService.info('Auto Sync: Turned off sync because current client is making requests to server that are not supported');
217
+ this.logService.info('[AutoSync] Turned off sync because current client is making requests to server that are not supported');
221
218
  }
222
219
  else if (userDataSyncError.code === UserDataSyncErrorCode.UpgradeRequired || userDataSyncError.code === UserDataSyncErrorCode.Gone) {
223
220
  await this.turnOff(false, true , true );
224
221
  this.disableMachineEventually();
225
- this.logService.info('Auto Sync: Turned off sync because current client is not compatible with server. Requires client upgrade.');
222
+ this.logService.info('[AutoSync] Turned off sync because current client is not compatible with server. Requires client upgrade.');
226
223
  }
227
224
  else if (userDataSyncError.code === UserDataSyncErrorCode.IncompatibleLocalContent) {
228
225
  await this.turnOff(false, true );
229
- this.logService.info(`Auto Sync: Turned off sync because server has ${userDataSyncError.resource} content with newer version than of client. Requires client upgrade.`);
226
+ this.logService.info(`[AutoSync] Turned off sync because server has ${userDataSyncError.resource} content with newer version than of client. Requires client upgrade.`);
230
227
  }
231
228
  else if (userDataSyncError.code === UserDataSyncErrorCode.IncompatibleRemoteContent) {
232
229
  await this.turnOff(false, true );
233
- this.logService.info(`Auto Sync: Turned off sync because server has ${userDataSyncError.resource} content with older version than of client. Requires server reset.`);
230
+ this.logService.info(`[AutoSync] Turned off sync because server has ${userDataSyncError.resource} content with older version than of client. Requires server reset.`);
234
231
  }
235
232
  else if (userDataSyncError.code === UserDataSyncErrorCode.ServiceChanged || userDataSyncError.code === UserDataSyncErrorCode.DefaultServiceChanged) {
236
233
  if (isWeb && userDataSyncError.code === UserDataSyncErrorCode.DefaultServiceChanged && !this.hasProductQualityChanged()) {
237
234
  await this.turnOff(false, true );
238
- this.logService.info('Auto Sync: Turned off sync because default sync service is changed.');
235
+ this.logService.info('[AutoSync] Turned off sync because default sync service is changed.');
239
236
  }
240
237
  else {
241
238
  await this.turnOff(false, true , true );
242
239
  await this.turnOn();
243
- this.logService.info('Auto Sync: Sync Service changed. Turned off auto sync, reset local state and turned on auto sync.');
240
+ this.logService.info('[AutoSync] Sync Service changed. Turned off auto sync, reset local state and turned on auto sync.');
244
241
  }
245
242
  }
246
243
  else {
@@ -266,30 +263,31 @@ let UserDataAutoSyncService = class UserDataAutoSyncService extends Disposable {
266
263
  stopDisableMachineEventually() {
267
264
  this.storageService.remove(disableMachineEventuallyKey, StorageScope.APPLICATION);
268
265
  }
269
- async triggerSync(sources, skipIfSyncedRecently, disableCache) {
266
+ async triggerSync(sources, options) {
270
267
  if (this.autoSync.value === undefined) {
271
268
  return this.syncTriggerDelayer.cancel();
272
269
  }
273
- if (skipIfSyncedRecently && this.lastSyncTriggerTime
274
- && Math.round((( new Date()).getTime() - this.lastSyncTriggerTime) / 1000) < 10) {
275
- this.logService.debug('Auto Sync: Skipped. Limited to once per 10 seconds.');
270
+ if (options?.skipIfSyncedRecently && this.lastSyncTriggerTime && ( new Date()).getTime() - this.lastSyncTriggerTime < 10_000) {
271
+ this.logService.debug('[AutoSync] Skipping because sync was triggered recently.', sources);
276
272
  return;
277
273
  }
278
274
  this.sources.push(...sources);
279
275
  return this.syncTriggerDelayer.trigger(async () => {
280
- this.logService.trace('activity sources', ...this.sources);
281
- const providerId = this.userDataSyncAccountService.account?.authenticationProviderId || '';
282
- this.telemetryService.publicLog2('sync/triggered', { sources: this.sources, providerId });
276
+ this.logService.trace('[AutoSync] Activity sources', ...this.sources);
283
277
  this.sources = [];
284
278
  if (this.autoSync.value) {
285
- await this.autoSync.value.sync('Activity', disableCache);
279
+ await this.autoSync.value.sync('Activity', !!options?.disableCache);
286
280
  }
287
281
  }, this.successiveFailures
288
- ? this.getSyncTriggerDelayTime() * 1 * Math.min(Math.pow(2, this.successiveFailures), 60)
289
- : this.getSyncTriggerDelayTime());
282
+ ? Math.min(this.getSyncTriggerDelayTime() * this.successiveFailures, 60_000)
283
+ : options?.immediately ? 0 : this.getSyncTriggerDelayTime());
290
284
  }
291
285
  getSyncTriggerDelayTime() {
292
- return 2000;
286
+ if (this.lastSyncTriggerTime && ( new Date()).getTime() - this.lastSyncTriggerTime > 10_000) {
287
+ this.logService.debug('[AutoSync] Sync immediately because last sync was triggered more than 10 seconds ago.');
288
+ return 0;
289
+ }
290
+ return 3_000;
293
291
  }
294
292
  };
295
293
  UserDataAutoSyncService = ( __decorate([
@@ -329,11 +327,11 @@ class AutoSync extends Disposable {
329
327
  this._register(toDisposable(() => {
330
328
  if (this.syncPromise) {
331
329
  this.syncPromise.cancel();
332
- this.logService.info('Auto sync: Cancelled sync that is in progress');
330
+ this.logService.info('[AutoSync] Cancelled sync that is in progress');
333
331
  this.syncPromise = undefined;
334
332
  }
335
333
  this.syncTask?.stop();
336
- this.logService.info('Auto Sync: Stopped');
334
+ this.logService.info('[AutoSync] Stopped');
337
335
  }));
338
336
  this.sync(AutoSync.INTERVAL_SYNCING, false);
339
337
  }
@@ -347,7 +345,7 @@ class AutoSync extends Disposable {
347
345
  const syncPromise = createCancelablePromise(async (token) => {
348
346
  if (this.syncPromise) {
349
347
  try {
350
- this.logService.debug('Auto Sync: Waiting until sync is finished.');
348
+ this.logService.debug('[AutoSync] Waiting until sync is finished.');
351
349
  await this.syncPromise;
352
350
  }
353
351
  catch (error) {
@@ -374,7 +372,7 @@ class AutoSync extends Disposable {
374
372
  !isEqual(current.stableUrl, previous.stableUrl));
375
373
  }
376
374
  async doSync(reason, disableCache, token) {
377
- this.logService.info(`Auto Sync: Triggered by ${reason}`);
375
+ this.logService.info(`[AutoSync] Triggered by ${reason}`);
378
376
  this._onDidStartSync.fire();
379
377
  let error;
380
378
  try {
@@ -385,9 +383,9 @@ class AutoSync extends Disposable {
385
383
  error = e;
386
384
  if (UserDataSyncError.toUserDataSyncError(e).code === UserDataSyncErrorCode.MethodNotFound) {
387
385
  try {
388
- this.logService.info('Auto Sync: Client is making invalid requests. Cleaning up data...');
386
+ this.logService.info('[AutoSync] Client is making invalid requests. Cleaning up data...');
389
387
  await this.userDataSyncService.cleanUpRemoteData();
390
- this.logService.info('Auto Sync: Retrying sync...');
388
+ this.logService.info('[AutoSync] Retrying sync...');
391
389
  await this.createAndRunSyncTask(disableCache, token);
392
390
  error = undefined;
393
391
  }
@@ -408,28 +406,28 @@ class AutoSync extends Disposable {
408
406
  if (this.manifest === null && (await this.userDataSyncService.hasPreviouslySynced())) {
409
407
  if (this.hasSyncServiceChanged()) {
410
408
  if (await this.hasDefaultServiceChanged()) {
411
- throw ( new UserDataAutoSyncError(( localize(2248, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
409
+ throw ( new UserDataAutoSyncError(( localize(2288, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
412
410
  }
413
411
  else {
414
- throw ( new UserDataAutoSyncError(( localize(2249, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
412
+ throw ( new UserDataAutoSyncError(( localize(2289, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
415
413
  }
416
414
  }
417
415
  else {
418
- throw ( new UserDataAutoSyncError(( localize(2250, "Cannot sync because syncing is turned off in the cloud")), UserDataSyncErrorCode.TurnedOff));
416
+ throw ( new UserDataAutoSyncError(( localize(2290, "Cannot sync because syncing is turned off in the cloud")), UserDataSyncErrorCode.TurnedOff));
419
417
  }
420
418
  }
421
419
  const sessionId = this.storageService.get(sessionIdKey, StorageScope.APPLICATION);
422
420
  if (sessionId && this.manifest && sessionId !== this.manifest.session) {
423
421
  if (this.hasSyncServiceChanged()) {
424
422
  if (await this.hasDefaultServiceChanged()) {
425
- throw ( new UserDataAutoSyncError(( localize(2248, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
423
+ throw ( new UserDataAutoSyncError(( localize(2288, "Cannot sync because default service has changed")), UserDataSyncErrorCode.DefaultServiceChanged));
426
424
  }
427
425
  else {
428
- throw ( new UserDataAutoSyncError(( localize(2249, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
426
+ throw ( new UserDataAutoSyncError(( localize(2289, "Cannot sync because sync service has changed")), UserDataSyncErrorCode.ServiceChanged));
429
427
  }
430
428
  }
431
429
  else {
432
- throw ( new UserDataAutoSyncError(( localize(2251, "Cannot sync because current session is expired")), UserDataSyncErrorCode.SessionExpired));
430
+ throw ( new UserDataAutoSyncError(( localize(2291, "Cannot sync because current session is expired")), UserDataSyncErrorCode.SessionExpired));
433
431
  }
434
432
  }
435
433
  const machines = await this.userDataSyncMachinesService.getMachines(this.manifest || undefined);
@@ -439,7 +437,7 @@ class AutoSync extends Disposable {
439
437
  const currentMachine = machines.find(machine => machine.isCurrent);
440
438
  if (currentMachine?.disabled) {
441
439
  throw ( new UserDataAutoSyncError(( localize(
442
- 2252,
440
+ 2292,
443
441
  "Cannot sync because syncing is turned off on this machine from another machine."
444
442
  )), UserDataSyncErrorCode.TurnedOff));
445
443
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { toFormattedString } from '@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common/vscode/vs/base/common/jsonFormatter';
3
+ import { toFormattedString } from '@codingame/monaco-vscode-407531d3-fdae-5387-8c41-49ba0e9574b5-common/vscode/vs/base/common/jsonFormatter';
4
4
  import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
5
5
  import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
6
6
  import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
@@ -2,13 +2,11 @@ import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"
2
2
  import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
3
3
  import { IEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service";
4
4
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
5
- import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
6
5
  import { SyncResource } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync";
7
6
  import { IUserDataSyncEnablementService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
8
7
  import { IUserDataSyncStoreManagementService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service";
9
8
  export declare class UserDataSyncEnablementService extends Disposable implements IUserDataSyncEnablementService {
10
9
  private readonly storageService;
11
- private readonly telemetryService;
12
10
  protected readonly environmentService: IEnvironmentService;
13
11
  private readonly userDataSyncStoreManagementService;
14
12
  _serviceBrand: any;
@@ -19,7 +17,7 @@ export declare class UserDataSyncEnablementService extends Disposable implements
19
17
  SyncResource,
20
18
  boolean
21
19
  ]>;
22
- constructor(storageService: IStorageService, telemetryService: ITelemetryService, environmentService: IEnvironmentService, userDataSyncStoreManagementService: IUserDataSyncStoreManagementService);
20
+ constructor(storageService: IStorageService, environmentService: IEnvironmentService, userDataSyncStoreManagementService: IUserDataSyncStoreManagementService);
23
21
  isEnabled(): boolean;
24
22
  canToggleEnablement(): boolean;
25
23
  setEnablement(enabled: boolean): void;
@@ -6,16 +6,14 @@ import { isWeb } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platfo
6
6
  import { IEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service';
7
7
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
8
8
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
9
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
10
9
  import { getEnablementKey, ALL_SYNC_RESOURCES } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
11
10
  import { IUserDataSyncStoreManagementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
12
11
 
13
12
  const enablementKey = 'sync.enable';
14
13
  let UserDataSyncEnablementService$1 = class UserDataSyncEnablementService extends Disposable {
15
- constructor(storageService, telemetryService, environmentService, userDataSyncStoreManagementService) {
14
+ constructor(storageService, environmentService, userDataSyncStoreManagementService) {
16
15
  super();
17
16
  this.storageService = storageService;
18
- this.telemetryService = telemetryService;
19
17
  this.environmentService = environmentService;
20
18
  this.userDataSyncStoreManagementService = userDataSyncStoreManagementService;
21
19
  this._onDidChangeEnablement = ( new Emitter());
@@ -40,7 +38,6 @@ let UserDataSyncEnablementService$1 = class UserDataSyncEnablementService extend
40
38
  if (enabled && !this.canToggleEnablement()) {
41
39
  return;
42
40
  }
43
- this.telemetryService.publicLog2(enablementKey, { enabled });
44
41
  this.storageService.store(enablementKey, enabled, StorageScope.APPLICATION, StorageTarget.MACHINE);
45
42
  }
46
43
  isResourceEnabled(resource) {
@@ -72,9 +69,8 @@ let UserDataSyncEnablementService$1 = class UserDataSyncEnablementService extend
72
69
  };
73
70
  UserDataSyncEnablementService$1 = ( __decorate([
74
71
  ( __param(0, IStorageService)),
75
- ( __param(1, ITelemetryService)),
76
- ( __param(2, IEnvironmentService)),
77
- ( __param(3, IUserDataSyncStoreManagementService))
72
+ ( __param(1, IEnvironmentService)),
73
+ ( __param(2, IUserDataSyncStoreManagementService))
78
74
  ], UserDataSyncEnablementService$1));
79
75
 
80
76
  export { UserDataSyncEnablementService$1 as UserDataSyncEnablementService };
@@ -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(2258, "Settings Sync")) }));
13
+ this.logger = this._register(loggerService.createLogger(joinPath(environmentService.logsHome, `${USER_DATA_SYNC_LOG_ID}.log`), { id: USER_DATA_SYNC_LOG_ID, name: ( localize(2298, "Settings Sync")) }));
14
14
  }
15
15
  trace(message, ...args) {
16
16
  this.logger.trace(message, ...args);
@@ -20,7 +20,7 @@ import { stringify, parseExtensions, LocalExtensionsProvider } from '@codingame/
20
20
  import { stringify as stringify$1, LocalGlobalStateProvider } from '@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common/vscode/vs/platform/userDataSync/common/globalStateSync';
21
21
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
22
22
  import { parseUserDataProfilesManifest, stringifyLocalProfiles } from './userDataProfilesManifestSync.js';
23
- import { toFormattedString } from '@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common/vscode/vs/base/common/jsonFormatter';
23
+ import { toFormattedString } from '@codingame/monaco-vscode-407531d3-fdae-5387-8c41-49ba0e9574b5-common/vscode/vs/base/common/jsonFormatter';
24
24
  import { trim } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
25
25
 
26
26
  var UserDataSyncResourceProviderService_1;
@@ -429,7 +429,7 @@ let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderServ
429
429
  this.logService.error(error);
430
430
  }
431
431
  throw ( new UserDataSyncError(( localize(
432
- 2260,
432
+ 2300,
433
433
  "Cannot parse sync data as it is not compatible with the current version."
434
434
  )), UserDataSyncErrorCode.IncompatibleRemoteContent, syncResource));
435
435
  }
@@ -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(manifest: IUserDataManifest | null, merge: boolean, executionId: string, token: CancellationToken): Promise<[
116
+ sync(manifest: IUserDataManifest | null, preview: boolean, executionId: string, token: CancellationToken): Promise<[
117
117
  SyncResource,
118
118
  UserDataSyncError
119
119
  ][]>;
@@ -121,6 +121,7 @@ declare class ProfileSynchronizer extends Disposable {
121
121
  stop(): Promise<void>;
122
122
  resetLocal(): Promise<void>;
123
123
  private getUserDataSyncConfiguration;
124
+ private getLocalUserDataSyncConfiguration;
124
125
  private setStatus;
125
126
  private updateStatus;
126
127
  private updateConflicts;
@@ -24,7 +24,7 @@ import { SettingsSynchroniser } from '@codingame/monaco-vscode-a022e9a8-b522-5ea
24
24
  import { SnippetsSynchroniser } from '@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common/vscode/vs/platform/userDataSync/common/snippetsSync';
25
25
  import { TasksSynchroniser } from '@codingame/monaco-vscode-a022e9a8-b522-5ea2-97c7-f3dda2b0b597-common/vscode/vs/platform/userDataSync/common/tasksSync';
26
26
  import { UserDataProfilesManifestSynchroniser } from './userDataProfilesManifestSync.js';
27
- import { SyncStatus, createSyncHeaders, UserDataSyncError, UserDataSyncErrorCode, SyncResource, ALL_SYNC_RESOURCES, Change, MergeState, USER_DATA_SYNC_CONFIGURATION_SCOPE, UserDataSyncStoreError } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
27
+ import { SyncStatus, createSyncHeaders, UserDataSyncError, UserDataSyncErrorCode, SyncResource, ALL_SYNC_RESOURCES, USER_DATA_SYNC_CONFIGURATION_SCOPE, UserDataSyncStoreError } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
28
28
  import { IUserDataSyncStoreService, IUserDataSyncStoreManagementService, IUserDataSyncLogService, IUserDataSyncEnablementService, IUserDataSyncResourceProviderService, IUserDataSyncLocalStoreService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
29
29
 
30
30
  const LAST_SYNC_TIME_KEY = 'sync.lastSyncTime';
@@ -162,21 +162,21 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
162
162
  }
163
163
  };
164
164
  }
165
- async sync(manifest, merge, executionId, token) {
165
+ async sync(manifest, preview, executionId, token) {
166
166
  this._syncErrors = [];
167
167
  try {
168
168
  if (this.status !== SyncStatus.HasConflicts) {
169
169
  this.setStatus(SyncStatus.Syncing);
170
170
  }
171
171
  const defaultProfileSynchronizer = this.getOrCreateActiveProfileSynchronizer(this.userDataProfilesService.defaultProfile, undefined);
172
- this._syncErrors.push(...(await this.syncProfile(defaultProfileSynchronizer, manifest, merge, executionId, token)));
172
+ this._syncErrors.push(...(await this.syncProfile(defaultProfileSynchronizer, manifest, preview, executionId, token)));
173
173
  const userDataProfileManifestSynchronizer = defaultProfileSynchronizer.enabled.find(s => s.resource === SyncResource.Profiles);
174
174
  if (userDataProfileManifestSynchronizer) {
175
175
  const syncProfiles = (await userDataProfileManifestSynchronizer.getLastSyncedProfiles()) || [];
176
176
  if (token.isCancellationRequested) {
177
177
  return;
178
178
  }
179
- await this.syncRemoteProfiles(syncProfiles, manifest, merge, executionId, token);
179
+ await this.syncRemoteProfiles(syncProfiles, manifest, preview, executionId, token);
180
180
  }
181
181
  }
182
182
  finally {
@@ -186,7 +186,7 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
186
186
  this._onSyncErrors.fire(this._syncErrors);
187
187
  }
188
188
  }
189
- async syncRemoteProfiles(remoteProfiles, manifest, merge, executionId, token) {
189
+ async syncRemoteProfiles(remoteProfiles, manifest, preview, executionId, token) {
190
190
  for (const syncProfile of remoteProfiles) {
191
191
  if (token.isCancellationRequested) {
192
192
  return;
@@ -198,7 +198,7 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
198
198
  }
199
199
  this.logService.info('Syncing profile.', syncProfile.name);
200
200
  const profileSynchronizer = this.getOrCreateActiveProfileSynchronizer(profile, syncProfile);
201
- this._syncErrors.push(...(await this.syncProfile(profileSynchronizer, manifest, merge, executionId, token)));
201
+ this._syncErrors.push(...(await this.syncProfile(profileSynchronizer, manifest, preview, executionId, token)));
202
202
  }
203
203
  for (const [key, profileSynchronizerItem] of this.activeProfileSynchronizers.entries()) {
204
204
  if (( this.userDataProfilesService.profiles.some(p => p.id === profileSynchronizerItem[0].profile.id))) {
@@ -237,8 +237,8 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
237
237
  this.setStatus(SyncStatus.Idle);
238
238
  }
239
239
  }
240
- async syncProfile(profileSynchronizer, manifest, merge, executionId, token) {
241
- const errors = await profileSynchronizer.sync(manifest, merge, executionId, token);
240
+ async syncProfile(profileSynchronizer, manifest, preview, executionId, token) {
241
+ const errors = await profileSynchronizer.sync(manifest, preview, executionId, token);
242
242
  return ( errors.map(
243
243
  ([syncResource, error]) => ({ profile: profileSynchronizer.profile, syncResource, error })
244
244
  ));
@@ -640,7 +640,7 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
640
640
  case SyncResource.Profiles: return this.instantiationService.createInstance(UserDataProfilesManifestSynchroniser, this.profile, this.collection);
641
641
  }
642
642
  }
643
- async sync(manifest, merge, executionId, token) {
643
+ async sync(manifest, preview, executionId, token) {
644
644
  if (token.isCancellationRequested) {
645
645
  return [];
646
646
  }
@@ -652,7 +652,7 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
652
652
  const syncErrors = [];
653
653
  const syncHeaders = createSyncHeaders(executionId);
654
654
  const resourceManifest = (this.collection ? manifest?.collections?.[this.collection]?.latest : manifest?.latest) ?? null;
655
- const userDataSyncConfiguration = merge ? await this.getUserDataSyncConfiguration(resourceManifest) : {};
655
+ const userDataSyncConfiguration = preview ? await this.getUserDataSyncConfiguration(resourceManifest) : this.getLocalUserDataSyncConfiguration();
656
656
  for (const synchroniser of synchronizers) {
657
657
  if (token.isCancellationRequested) {
658
658
  return [];
@@ -661,19 +661,7 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
661
661
  return [];
662
662
  }
663
663
  try {
664
- if (merge) {
665
- const preview = await synchroniser.preview(resourceManifest, userDataSyncConfiguration, syncHeaders);
666
- if (preview) {
667
- for (const resourcePreview of preview.resourcePreviews) {
668
- if ((resourcePreview.localChange !== Change.None || resourcePreview.remoteChange !== Change.None) && resourcePreview.mergeState === MergeState.Preview) {
669
- await synchroniser.merge(resourcePreview.previewResource);
670
- }
671
- }
672
- }
673
- }
674
- else {
675
- await synchroniser.sync(resourceManifest, syncHeaders);
676
- }
664
+ await synchroniser.sync(resourceManifest, preview, userDataSyncConfiguration, syncHeaders);
677
665
  }
678
666
  catch (e) {
679
667
  const userDataSyncError = UserDataSyncError.toUserDataSyncError(e);
@@ -739,7 +727,7 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
739
727
  if (!this.profile.isDefault) {
740
728
  return {};
741
729
  }
742
- const local = this.configurationService.getValue(USER_DATA_SYNC_CONFIGURATION_SCOPE);
730
+ const local = this.getLocalUserDataSyncConfiguration();
743
731
  const settingsSynchronizer = this.enabled.find(synchronizer => synchronizer instanceof SettingsSynchroniser);
744
732
  if (settingsSynchronizer) {
745
733
  const remote = await settingsSynchronizer.getRemoteUserDataSyncConfiguration(manifest);
@@ -747,6 +735,9 @@ let ProfileSynchronizer = class ProfileSynchronizer extends Disposable {
747
735
  }
748
736
  return local;
749
737
  }
738
+ getLocalUserDataSyncConfiguration() {
739
+ return this.configurationService.getValue(USER_DATA_SYNC_CONFIGURATION_SCOPE);
740
+ }
750
741
  setStatus(status) {
751
742
  if (this._status !== status) {
752
743
  this._status = status;