2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { equals } from '../../../base/common/objects.js';
7
>
import { IUserDataProfile, UseDefaultProfileFlags } from '../../userDataProfile/common/userDataProfile.js';
8
>
import { ISyncUserDataProfile } from './userDataSync.js';
9
>
10
>
interface IRelaxedMergeResult {
11
>
local: { added: ISyncUserDataProfile[]; removed: IUserDataProfile[]; updated: ISyncUserDataProfile[] };
12
>
remote: { added: IUserDataProfile[]; removed: ISyncUserDataProfile[]; updated: IUserDataProfile[] } | null;
13
>
}
14
>
15
>
export type IMergeResult = Required<IRelaxedMergeResult>;
16
>
17
>
interface IUserDataProfileInfo {
18
>
readonly id: string;
19
>
readonly name: string;
20
>
readonly icon?: string;
21
>
readonly useDefaultFlags?: UseDefaultProfileFlags;
22
>
}
23
>
24
>
export function merge(local: IUserDataProfile[], remote: ISyncUserDataProfile[] | null, lastSync: ISyncUserDataProfile[] | null, ignored: string[]): IMergeResult {
25
const localResult: { added: ISyncUserDataProfile[]; removed: IUserDataProfile[]; updated: ISyncUserDataProfile[] } = { added: [], removed: [], updated: [] };
26
let remoteResult: { added: IUserDataProfile[]; removed: ISyncUserDataProfile[]; updated: IUserDataProfile[] } | null = { added: [], removed: [], updated: [] };