sf-git-merge-driver 1.4.0-dev-159.21331490438-1 → 1.4.0-dev-159.21333506338-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -3
- package/lib/merger/MergeOrchestrator.d.ts +0 -1
- package/lib/merger/MergeOrchestrator.js +0 -16
- package/lib/merger/MergeOrchestrator.js.map +1 -1
- package/lib/merger/nodes/TextArrayMergeNode.js +9 -24
- package/lib/merger/nodes/TextArrayMergeNode.js.map +1 -1
- package/lib/merger/nodes/nodeUtils.d.ts +2 -0
- package/lib/merger/nodes/nodeUtils.js +7 -0
- package/lib/merger/nodes/nodeUtils.js.map +1 -1
- package/lib/merger/strategies/AbstractMergeStrategy.d.ts +8 -0
- package/lib/merger/strategies/AbstractMergeStrategy.js +21 -0
- package/lib/merger/strategies/AbstractMergeStrategy.js.map +1 -0
- package/lib/merger/strategies/AllPresentStrategy.d.ts +2 -3
- package/lib/merger/strategies/AllPresentStrategy.js +8 -20
- package/lib/merger/strategies/AllPresentStrategy.js.map +1 -1
- package/lib/merger/strategies/LocalAndOtherStrategy.d.ts +2 -3
- package/lib/merger/strategies/LocalAndOtherStrategy.js +5 -25
- package/lib/merger/strategies/LocalAndOtherStrategy.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -166,6 +166,15 @@ You can check if the merge driver is enabled by running the following command:
|
|
|
166
166
|
grep "merge=salesforce-source" .git/info/attributes
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
+
## Behavior when the merge driver does not know the key
|
|
170
|
+
|
|
171
|
+
If the merge driver encounters a list of elements (like fields in a profile, or permissions in a permission set) but does not know which field acts as the "key" (unique identifier) for that type, it will fallback to standard conflict behavior.
|
|
172
|
+
This means you might see a conflict block containing the entire array instead of a smart merge of individual elements.
|
|
173
|
+
|
|
174
|
+
**If you encounter this behavior for a Salesforce metadata type the driver is supposed to handle, please open an issue!** We can add the missing key definition to support smart merging for that type.
|
|
175
|
+
|
|
176
|
+
**If you encounter this behavior for a Salesforce metadata type the driver does not already handle, please open an issue!** We can evaluate how to support smart merging for that type.
|
|
177
|
+
|
|
169
178
|
## Troubleshooting
|
|
170
179
|
|
|
171
180
|
The plugin uses the [Salesforce CLI logging system](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_log_messages.htm) to log information.
|
|
@@ -279,7 +288,7 @@ EXAMPLES
|
|
|
279
288
|
$ sf git merge driver install
|
|
280
289
|
```
|
|
281
290
|
|
|
282
|
-
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.
|
|
291
|
+
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.21333506338-1/src/commands/git/merge/driver/install.ts)_
|
|
283
292
|
|
|
284
293
|
## `sf git merge driver run`
|
|
285
294
|
|
|
@@ -323,7 +332,7 @@ EXAMPLES
|
|
|
323
332
|
- output-file is the path to the file where the merged content will be written
|
|
324
333
|
```
|
|
325
334
|
|
|
326
|
-
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.
|
|
335
|
+
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.21333506338-1/src/commands/git/merge/driver/run.ts)_
|
|
327
336
|
|
|
328
337
|
## `sf git merge driver uninstall`
|
|
329
338
|
|
|
@@ -353,7 +362,7 @@ EXAMPLES
|
|
|
353
362
|
$ sf git merge driver uninstall
|
|
354
363
|
```
|
|
355
364
|
|
|
356
|
-
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.
|
|
365
|
+
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.0-dev-159.21333506338-1/src/commands/git/merge/driver/uninstall.ts)_
|
|
357
366
|
<!-- commandsstop -->
|
|
358
367
|
## Changelog
|
|
359
368
|
|
|
@@ -8,6 +8,5 @@ export declare class MergeOrchestrator {
|
|
|
8
8
|
private readonly nodeFactory;
|
|
9
9
|
constructor(config: MergeConfig, nodeFactory?: MergeNodeFactory);
|
|
10
10
|
merge(ancestor: JsonValue, local: JsonValue, other: JsonValue, attribute?: string, rootKey?: RootKeyInfo): MergeResult;
|
|
11
|
-
private buildEarlyResult;
|
|
12
11
|
mergeObject(ancestor: JsonObject | JsonArray, local: JsonObject | JsonArray, other: JsonObject | JsonArray): MergeResult;
|
|
13
12
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { deepEqual } from 'fast-equals';
|
|
2
|
-
import { noConflict } from '../types/mergeResult.js';
|
|
3
|
-
import { MergeScenario } from '../types/mergeScenario.js';
|
|
4
1
|
import { getScenario } from './MergeScenarioFactory.js';
|
|
5
2
|
import { defaultNodeFactory, } from './nodes/MergeNodeFactory.js';
|
|
6
|
-
import { toJsonArray } from './nodes/nodeUtils.js';
|
|
7
3
|
import { getScenarioStrategy } from './strategies/ScenarioStrategyFactory.js';
|
|
8
4
|
export class MergeOrchestrator {
|
|
9
5
|
config;
|
|
@@ -14,11 +10,6 @@ export class MergeOrchestrator {
|
|
|
14
10
|
}
|
|
15
11
|
merge(ancestor, local, other, attribute, rootKey) {
|
|
16
12
|
const scenario = getScenario(ancestor, local, other);
|
|
17
|
-
if (scenario === MergeScenario.ALL) {
|
|
18
|
-
if (deepEqual(ancestor, local) && deepEqual(local, other)) {
|
|
19
|
-
return this.buildEarlyResult(local, rootKey);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
13
|
const strategy = getScenarioStrategy(scenario);
|
|
23
14
|
const context = {
|
|
24
15
|
config: this.config,
|
|
@@ -31,13 +22,6 @@ export class MergeOrchestrator {
|
|
|
31
22
|
};
|
|
32
23
|
return strategy.execute(context);
|
|
33
24
|
}
|
|
34
|
-
buildEarlyResult(value, rootKey) {
|
|
35
|
-
const content = toJsonArray(value);
|
|
36
|
-
if (rootKey) {
|
|
37
|
-
return noConflict([{ [rootKey.name]: content }]);
|
|
38
|
-
}
|
|
39
|
-
return noConflict(content);
|
|
40
|
-
}
|
|
41
25
|
mergeObject(ancestor, local, other) {
|
|
42
26
|
return this.merge(ancestor, local, other);
|
|
43
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MergeOrchestrator.js","sourceRoot":"","sources":["../../src/merger/MergeOrchestrator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MergeOrchestrator.js","sourceRoot":"","sources":["../../src/merger/MergeOrchestrator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EACL,kBAAkB,GAEnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAE7E,MAAM,OAAO,iBAAiB;IAET;IACA;IAFnB,YACmB,MAAmB,EACnB,cAAgC,kBAAkB;QADlD,WAAM,GAAN,MAAM,CAAa;QACnB,gBAAW,GAAX,WAAW,CAAuC;IAClE,CAAC;IAEJ,KAAK,CACH,QAAmB,EACnB,KAAgB,EAChB,KAAgB,EAChB,SAAkB,EAClB,OAAqB;QAErB,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;QACpD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAE9C,MAAM,OAAO,GAAiB;YAC5B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ;YACR,KAAK;YACL,KAAK;YACL,SAAS;YACT,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO;SACR,CAAA;QAED,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAClC,CAAC;IAED,WAAW,CACT,QAAgC,EAChC,KAA6B,EAC7B,KAA6B;QAE7B,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IAC3C,CAAC;CACF"}
|
|
@@ -23,30 +23,15 @@ export class TextArrayMergeNode {
|
|
|
23
23
|
merge(_config) {
|
|
24
24
|
const localSet = new Set(this.local);
|
|
25
25
|
const otherSet = new Set(this.other);
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
for (const item of this.local) {
|
|
37
|
-
if (seen.has(item))
|
|
38
|
-
continue;
|
|
39
|
-
seen.add(item);
|
|
40
|
-
resultItems.push(item);
|
|
41
|
-
}
|
|
42
|
-
for (const item of this.other) {
|
|
43
|
-
if (seen.has(item))
|
|
44
|
-
continue;
|
|
45
|
-
seen.add(item);
|
|
46
|
-
resultItems.push(item);
|
|
47
|
-
}
|
|
48
|
-
resultItems.sort(compareItems);
|
|
49
|
-
const merged = resultItems.map(item => generateObj(item, this.attribute));
|
|
26
|
+
const ancestorSet = new Set(this.ancestor);
|
|
27
|
+
const resultItems = new Set([
|
|
28
|
+
...this.ancestor.filter(item => localSet.has(item) && otherSet.has(item)),
|
|
29
|
+
...this.local.filter(item => !ancestorSet.has(item)),
|
|
30
|
+
...this.other.filter(item => !ancestorSet.has(item)),
|
|
31
|
+
]);
|
|
32
|
+
const merged = [...resultItems]
|
|
33
|
+
.sort(compareItems)
|
|
34
|
+
.map(item => generateObj(item, this.attribute));
|
|
50
35
|
return noConflict(merged);
|
|
51
36
|
}
|
|
52
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArrayMergeNode.js","sourceRoot":"","sources":["../../../src/merger/nodes/TextArrayMergeNode.ts"],"names":[],"mappings":"AAGA,OA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AW,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;QAEjD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { JsonArray, JsonObject, JsonValue } from '../../types/jsonTypes.js';
|
|
2
2
|
import type { MergeResult } from '../../types/mergeResult.js';
|
|
3
|
+
import type { RootKeyInfo } from '../MergeContext.js';
|
|
3
4
|
export declare const ensureArray: (value: JsonValue) => JsonArray;
|
|
4
5
|
export declare const getUniqueSortedProps: (...objects: (JsonObject | JsonArray)[]) => string[];
|
|
5
6
|
export declare const generateObj: (value: JsonValue | null, attrib: string) => JsonObject;
|
|
6
7
|
export declare const extractContent: (arr: JsonArray) => JsonObject | JsonArray;
|
|
7
8
|
export declare const wrapWithRootKey: (result: MergeResult, rootKeyName: string) => MergeResult;
|
|
8
9
|
export declare const toJsonArray: (inputObj: JsonObject | JsonArray) => JsonArray;
|
|
10
|
+
export declare const buildEarlyResult: (value: JsonValue, rootKey?: RootKeyInfo) => MergeResult;
|
|
@@ -28,4 +28,11 @@ export const toJsonArray = (inputObj) => flatMap(getUniqueSortedProps(inputObj),
|
|
|
28
28
|
}
|
|
29
29
|
return generateObj(inputObjOfAttr, attribute);
|
|
30
30
|
});
|
|
31
|
+
export const buildEarlyResult = (value, rootKey) => {
|
|
32
|
+
const content = toJsonArray(value);
|
|
33
|
+
if (rootKey) {
|
|
34
|
+
return noConflict([{ [rootKey.name]: content }]);
|
|
35
|
+
}
|
|
36
|
+
return noConflict(content);
|
|
37
|
+
};
|
|
31
38
|
//# sourceMappingURL=nodeUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeUtils.js","sourceRoot":"","sources":["../../../src/merger/nodes/nodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR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IAED,OAAO,WAAW,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;AAC/C,CAAC,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAgB,EAChB,OAAqB,EACR,EAAE;IACf,MAAM,OAAO,GAAG,WAAW,CAAC,KAA+B,CAAC,CAAA;IAC5D,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,CAAC,CAAA;AAC5B,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JsonArray, JsonObject } from '../../types/jsonTypes.js';
|
|
2
|
+
import type { MergeResult } from '../../types/mergeResult.js';
|
|
3
|
+
import type { MergeContext } from '../MergeContext.js';
|
|
4
|
+
import type { ScenarioStrategy } from './ScenarioStrategy.js';
|
|
5
|
+
export declare abstract class AbstractMergeStrategy implements ScenarioStrategy {
|
|
6
|
+
abstract execute(context: MergeContext): MergeResult;
|
|
7
|
+
protected mergeChildren(context: MergeContext, ancestor?: JsonObject | JsonArray): MergeResult;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { combineResults } from '../../types/mergeResult.js';
|
|
2
|
+
import { getUniqueSortedProps, wrapWithRootKey } from '../nodes/nodeUtils.js';
|
|
3
|
+
export class AbstractMergeStrategy {
|
|
4
|
+
mergeChildren(context, ancestor) {
|
|
5
|
+
const local = context.local;
|
|
6
|
+
const other = context.other;
|
|
7
|
+
const props = getUniqueSortedProps(ancestor ?? {}, local, other);
|
|
8
|
+
const results = [];
|
|
9
|
+
for (const key of props) {
|
|
10
|
+
const childNode = context.nodeFactory.createNode(ancestor?.[key], local[key], other[key], key);
|
|
11
|
+
const childResult = childNode.merge(context.config);
|
|
12
|
+
results.push(childResult);
|
|
13
|
+
}
|
|
14
|
+
const result = combineResults(results);
|
|
15
|
+
if (context.rootKey) {
|
|
16
|
+
return wrapWithRootKey(result, context.rootKey.name);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=AbstractMergeStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractMergeStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AbstractMergeStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAE3D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG7E,MAAM,OAAgB,qBAAqB;IAG/B,aAAa,CACrB,OAAqB,EACrB,QAAiC;QAEjC,MAAM,KAAK,GAAG,OAAO,CAAC,KAA+B,CAAA;QACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAA+B,CAAA;QAErD,MAAM,KAAK,GAAG,oBAAoB,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;QAChE,MAAM,OAAO,GAAkB,EAAE,CAAA;QAEjC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAC7C,QAAmC,EAAE,CAAC,GAAG,CAAC,EAC3C,KAAK,CAAC,GAAG,CAAC,EACV,KAAK,CAAC,GAAG,CAAC,EACV,GAAG,CACJ,CAAA;YACD,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACnD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC3B,CAAC;QAED,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;QACtC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACtD,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { MergeResult } from '../../types/mergeResult.js';
|
|
2
2
|
import type { MergeContext } from '../MergeContext.js';
|
|
3
|
-
import
|
|
4
|
-
export declare class AllPresentStrategy
|
|
3
|
+
import { AbstractMergeStrategy } from './AbstractMergeStrategy.js';
|
|
4
|
+
export declare class AllPresentStrategy extends AbstractMergeStrategy {
|
|
5
5
|
execute(context: MergeContext): MergeResult;
|
|
6
|
-
private mergeChildren;
|
|
7
6
|
}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { deepEqual } from 'fast-equals';
|
|
2
|
+
import { buildEarlyResult } from '../nodes/nodeUtils.js';
|
|
3
|
+
import { AbstractMergeStrategy } from './AbstractMergeStrategy.js';
|
|
4
|
+
export class AllPresentStrategy extends AbstractMergeStrategy {
|
|
4
5
|
execute(context) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
6
|
+
if (deepEqual(context.ancestor, context.local) &&
|
|
7
|
+
deepEqual(context.local, context.other)) {
|
|
8
|
+
return buildEarlyResult(context.local, context.rootKey);
|
|
8
9
|
}
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
mergeChildren(context) {
|
|
12
|
-
const ancestor = context.ancestor;
|
|
13
|
-
const local = context.local;
|
|
14
|
-
const other = context.other;
|
|
15
|
-
const props = getUniqueSortedProps(ancestor, local, other);
|
|
16
|
-
const results = [];
|
|
17
|
-
for (const key of props) {
|
|
18
|
-
const childNode = context.nodeFactory.createNode(ancestor[key], local[key], other[key], key);
|
|
19
|
-
const childResult = childNode.merge(context.config);
|
|
20
|
-
results.push(childResult);
|
|
21
|
-
}
|
|
22
|
-
return combineResults(results);
|
|
10
|
+
return this.mergeChildren(context, context.ancestor);
|
|
23
11
|
}
|
|
24
12
|
}
|
|
25
13
|
//# sourceMappingURL=AllPresentStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllPresentStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AllPresentStrategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AllPresentStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/AllPresentStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAElE,MAAM,OAAO,kBAAmB,SAAQ,qBAAqB;IAC3D,OAAO,CAAC,OAAqB;QAC3B,IACE,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;YAC1C,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EACvC,CAAC;YACD,OAAO,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CACvB,OAAO,EACP,OAAO,CAAC,QAAkC,CAC3C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { MergeResult } from '../../types/mergeResult.js';
|
|
2
2
|
import type { MergeContext } from '../MergeContext.js';
|
|
3
|
-
import
|
|
4
|
-
export declare class LocalAndOtherStrategy
|
|
3
|
+
import { AbstractMergeStrategy } from './AbstractMergeStrategy.js';
|
|
4
|
+
export declare class LocalAndOtherStrategy extends AbstractMergeStrategy {
|
|
5
5
|
execute(context: MergeContext): MergeResult;
|
|
6
|
-
private mergeChildren;
|
|
7
6
|
}
|
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
import { deepEqual } from 'fast-equals';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export class LocalAndOtherStrategy {
|
|
2
|
+
import { buildEarlyResult } from '../nodes/nodeUtils.js';
|
|
3
|
+
import { AbstractMergeStrategy } from './AbstractMergeStrategy.js';
|
|
4
|
+
export class LocalAndOtherStrategy extends AbstractMergeStrategy {
|
|
5
5
|
execute(context) {
|
|
6
6
|
const local = context.local;
|
|
7
7
|
const other = context.other;
|
|
8
8
|
if (deepEqual(local, other)) {
|
|
9
|
-
|
|
10
|
-
if (context.rootKey) {
|
|
11
|
-
return noConflict([{ [context.rootKey.name]: content }]);
|
|
12
|
-
}
|
|
13
|
-
return noConflict(content);
|
|
9
|
+
return buildEarlyResult(local, context.rootKey);
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
if (context.rootKey) {
|
|
17
|
-
return wrapWithRootKey(result, context.rootKey.name);
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
mergeChildren(context) {
|
|
22
|
-
const local = context.local;
|
|
23
|
-
const other = context.other;
|
|
24
|
-
const props = getUniqueSortedProps({}, local, other);
|
|
25
|
-
const results = [];
|
|
26
|
-
for (const key of props) {
|
|
27
|
-
const childNode = context.nodeFactory.createNode(undefined, local[key], other[key], key);
|
|
28
|
-
const childResult = childNode.merge(context.config);
|
|
29
|
-
results.push(childResult);
|
|
30
|
-
}
|
|
31
|
-
return combineResults(results);
|
|
11
|
+
return this.mergeChildren(context, undefined);
|
|
32
12
|
}
|
|
33
13
|
}
|
|
34
14
|
//# sourceMappingURL=LocalAndOtherStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAndOtherStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/LocalAndOtherStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"LocalAndOtherStrategy.js","sourceRoot":"","sources":["../../../src/merger/strategies/LocalAndOtherStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAElE,MAAM,OAAO,qBAAsB,SAAQ,qBAAqB;IAC9D,OAAO,CAAC,OAAqB;QAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,KAA+B,CAAA;QACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAA+B,CAAA;QAErD,IAAI,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;QACjD,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAC/C,CAAC;CACF"}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sf-git-merge-driver",
|
|
3
|
-
"version": "1.4.0-dev-159.
|
|
3
|
+
"version": "1.4.0-dev-159.21333506338-1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "sf-git-merge-driver",
|
|
9
|
-
"version": "1.4.0-dev-159.
|
|
9
|
+
"version": "1.4.0-dev-159.21333506338-1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@oclif/core": "^4.8.0",
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sf-git-merge-driver",
|
|
3
3
|
"description": "Git merge driver for Salesforce metadata XML files - automatically resolves merge conflicts in profiles, permission sets, and 50+ metadata types",
|
|
4
|
-
"version": "1.4.0-dev-159.
|
|
4
|
+
"version": "1.4.0-dev-159.21333506338-1",
|
|
5
5
|
"exports": "./lib/driver/MergeDriver.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Sébastien Colladon (colladonsebastien@gmail.com)",
|