@salesforce/source-tracking 7.4.10 → 7.5.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/lib/shared/functions.d.ts +3 -2
- package/lib/shared/functions.js +1 -2
- package/lib/shared/guards.d.ts +1 -3
- package/lib/shared/guards.js +1 -5
- package/lib/shared/local/functions.d.ts +0 -1
- package/lib/shared/local/functions.js +2 -4
- package/lib/shared/local/localShadowRepo.js +3 -27
- package/lib/shared/local/moveDetection.d.ts +1 -4
- package/lib/shared/local/moveDetection.js +5 -14
- package/lib/shared/localComponentSetArray.js +1 -1
- package/lib/shared/metadataKeys.d.ts +3 -3
- package/lib/shared/metadataKeys.js +12 -15
- package/lib/shared/remote/expectedSourceMembers.d.ts +3 -2
- package/lib/shared/remote/expectedSourceMembers.js +3 -2
- package/lib/shared/remote/fileOperations.d.ts +1 -2
- package/lib/shared/remote/fileOperations.js +37 -5
- package/lib/shared/remote/orgQueries.d.ts +0 -1
- package/lib/shared/remote/orgQueries.js +3 -4
- package/lib/shared/remote/remoteSourceTrackingService.d.ts +6 -4
- package/lib/shared/remote/remoteSourceTrackingService.js +62 -22
- package/lib/shared/remoteChangeIgnoring.d.ts +2 -2
- package/lib/shared/remoteChangeIgnoring.js +5 -24
- package/lib/shared/types.d.ts +2 -1
- package/lib/sourceTracking.d.ts +2 -0
- package/lib/sourceTracking.js +43 -22
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -9
|
@@ -14,14 +14,47 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
17
50
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
51
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
52
|
};
|
|
20
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
54
|
exports.remoteChangeElementToChangeResult = exports.RemoteSourceTrackingService = void 0;
|
|
22
55
|
const node_path_1 = __importDefault(require("node:path"));
|
|
23
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
24
56
|
const node_os_1 = require("node:os");
|
|
57
|
+
const fs = __importStar(require("graceful-fs"));
|
|
25
58
|
const ts_retry_promise_1 = require("ts-retry-promise");
|
|
26
59
|
const core_1 = require("@salesforce/core");
|
|
27
60
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -86,8 +119,8 @@ class RemoteSourceTrackingService {
|
|
|
86
119
|
static async delete(orgId) {
|
|
87
120
|
const fileToDelete = (0, fileOperations_1.getFilePath)(orgId);
|
|
88
121
|
// the file might not exist, in which case we don't need to delete it
|
|
89
|
-
if (
|
|
90
|
-
await
|
|
122
|
+
if (fs.existsSync(fileToDelete)) {
|
|
123
|
+
await fs.promises.unlink(fileToDelete);
|
|
91
124
|
}
|
|
92
125
|
return node_path_1.default.isAbsolute(fileToDelete) ? fileToDelete : node_path_1.default.join(process.cwd(), fileToDelete);
|
|
93
126
|
}
|
|
@@ -95,16 +128,18 @@ class RemoteSourceTrackingService {
|
|
|
95
128
|
* pass in a series of SDR FilResponses .\
|
|
96
129
|
* it sets their last retrieved revision to the current revision counter from the server.
|
|
97
130
|
*/
|
|
98
|
-
async syncSpecifiedElements(elements) {
|
|
131
|
+
async syncSpecifiedElements(registry, elements) {
|
|
99
132
|
if (elements.length === 0) {
|
|
100
133
|
return;
|
|
101
134
|
}
|
|
102
|
-
const quietLogger = elements.length > 100
|
|
135
|
+
const quietLogger = elements.length > 100
|
|
136
|
+
? this.logger.silent?.bind(this.logger) ?? (() => { })
|
|
137
|
+
: this.logger.debug.bind(this.logger);
|
|
103
138
|
quietLogger(`Syncing ${elements.length} Revisions by key`);
|
|
104
139
|
// this can be super-repetitive on a large ExperienceBundle where there is an element for each file but only one Revision for the entire bundle
|
|
105
140
|
// any item in an aura/LWC bundle needs to represent the top (bundle) level and the file itself
|
|
106
141
|
// so we de-dupe via a set
|
|
107
|
-
Array.from(new Set(elements.flatMap((element) => (0, metadataKeys_1.getMetadataKeyFromFileResponse)(element)))).map((metadataKey) => {
|
|
142
|
+
Array.from(new Set(elements.flatMap((element) => (0, metadataKeys_1.getMetadataKeyFromFileResponse)(registry)(element)))).map((metadataKey) => {
|
|
108
143
|
const revision = this.sourceMembers.get(metadataKey) ?? this.sourceMembers.get(decodeURI(metadataKey));
|
|
109
144
|
if (!revision) {
|
|
110
145
|
this.logger.warn(`found no matching revision for ${metadataKey}`);
|
|
@@ -187,14 +222,14 @@ class RemoteSourceTrackingService {
|
|
|
187
222
|
* @param expectedMemberNames Array of metadata names to poll
|
|
188
223
|
* @param pollingTimeout maximum amount of time in seconds to poll for SourceMembers
|
|
189
224
|
*/
|
|
190
|
-
async pollForSourceTracking(expectedMembers) {
|
|
225
|
+
async pollForSourceTracking(registry, expectedMembers) {
|
|
191
226
|
if (core_1.envVars.getBoolean('SF_DISABLE_SOURCE_MEMBER_POLLING')) {
|
|
192
227
|
return this.logger.warn('Not polling for SourceMembers since SF_DISABLE_SOURCE_MEMBER_POLLING = true.');
|
|
193
228
|
}
|
|
194
229
|
if (expectedMembers.length === 0) {
|
|
195
230
|
return;
|
|
196
231
|
}
|
|
197
|
-
const outstandingSourceMembers = (0, expectedSourceMembers_1.calculateExpectedSourceMembers)(expectedMembers);
|
|
232
|
+
const outstandingSourceMembers = (0, expectedSourceMembers_1.calculateExpectedSourceMembers)(registry, expectedMembers);
|
|
198
233
|
const originalOutstandingSize = outstandingSourceMembers.size;
|
|
199
234
|
// this will be the absolute timeout from the start of the poll. We can also exit early if it doesn't look like more results are coming in
|
|
200
235
|
let highestRevisionSoFar = this.serverMaxRevisionCounter;
|
|
@@ -302,7 +337,9 @@ ${formatSourceMemberWarnings(outstandingSourceMembers)}`),
|
|
|
302
337
|
if (sourceMembers.length === 0) {
|
|
303
338
|
return;
|
|
304
339
|
}
|
|
305
|
-
const quietLogger = sourceMembers.length > 100
|
|
340
|
+
const quietLogger = sourceMembers.length > 100
|
|
341
|
+
? this.logger.silent?.bind(this.logger) ?? (() => { })
|
|
342
|
+
: this.logger.debug.bind(this.logger);
|
|
306
343
|
quietLogger(`Upserting ${sourceMembers.length} SourceMembers to maxRevision.json`);
|
|
307
344
|
// Update the serverMaxRevisionCounter to the highest RevisionCounter
|
|
308
345
|
this.serverMaxRevisionCounter = Math.max(this.serverMaxRevisionCounter, ...sourceMembers.map((m) => m.RevisionCounter));
|
|
@@ -334,7 +371,7 @@ ${formatSourceMemberWarnings(outstandingSourceMembers)}`),
|
|
|
334
371
|
throw new core_1.SfError(messages.getMessage('NonSourceTrackedOrgError'), 'NonSourceTrackedOrgError');
|
|
335
372
|
}
|
|
336
373
|
this.logger = core_1.Logger.getRawRootLogger().child({ name: this.constructor.name });
|
|
337
|
-
if (
|
|
374
|
+
if (fs.existsSync(this.filePath)) {
|
|
338
375
|
// read the file contents and turn it into the map
|
|
339
376
|
const rawContents = await (0, fileOperations_1.readFileContents)(this.filePath);
|
|
340
377
|
if (rawContents.serverMaxRevisionCounter && rawContents.sourceMembers) {
|
|
@@ -370,18 +407,21 @@ exports.RemoteSourceTrackingService = RemoteSourceTrackingService;
|
|
|
370
407
|
* pass in an RCE, and this will return a pullable ChangeResult.
|
|
371
408
|
* Useful for correcing bundle types where the files show change results with types but aren't resolvable
|
|
372
409
|
*/
|
|
373
|
-
const remoteChangeElementToChangeResult = (
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
})
|
|
410
|
+
const remoteChangeElementToChangeResult = (registry) => {
|
|
411
|
+
const mappings = (0, metadataKeys_1.getMappingsForSourceMemberTypesToMetadataType)(registry);
|
|
412
|
+
return (rce) => ({
|
|
413
|
+
...rce,
|
|
414
|
+
...(mappings.has(rce.type)
|
|
415
|
+
? {
|
|
416
|
+
// SNOWFLAKE: EmailTemplateFolder is treated as an alias for EmailFolder so it has a mapping.
|
|
417
|
+
// The name must be handled differently than with bundle types.
|
|
418
|
+
name: rce.type === 'EmailTemplateFolder' ? rce.name : rce.name.split('/')[0],
|
|
419
|
+
type: mappings.get(rce.type),
|
|
420
|
+
}
|
|
421
|
+
: {}),
|
|
422
|
+
origin: 'remote', // we know they're remote
|
|
423
|
+
});
|
|
424
|
+
};
|
|
385
425
|
exports.remoteChangeElementToChangeResult = remoteChangeElementToChangeResult;
|
|
386
426
|
/**
|
|
387
427
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ForceIgnore, MetadataMember } from '@salesforce/source-deploy-retrieve';
|
|
1
|
+
import { ForceIgnore, MetadataMember, RegistryAccess } from '@salesforce/source-deploy-retrieve';
|
|
2
2
|
import { ChangeResult } from './types';
|
|
3
3
|
import { ChangeResultWithNameAndType } from './types';
|
|
4
|
-
export declare const removeIgnored: (changeResults: ChangeResult[], forceIgnore: ForceIgnore, defaultPkgDir: string) => MetadataMember[];
|
|
4
|
+
export declare const removeIgnored: (changeResults: ChangeResult[], forceIgnore: ForceIgnore, defaultPkgDir: string, registry: RegistryAccess) => MetadataMember[];
|
|
5
5
|
export declare const ensureNameAndType: (cr: ChangeResult) => ChangeResultWithNameAndType;
|
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureNameAndType = exports.removeIgnored = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2025, Salesforce, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
20
4
|
const sfError_1 = require("@salesforce/core/sfError");
|
|
21
5
|
const filePathGenerator_1 = require("@salesforce/source-deploy-retrieve/lib/src/utils/filePathGenerator");
|
|
22
6
|
const guards_1 = require("./guards");
|
|
23
7
|
const functions_1 = require("./functions");
|
|
24
|
-
const removeIgnored = (changeResults, forceIgnore, defaultPkgDir) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.filter((mc) => !(0, filePathGenerator_1.filePathsFromMetadataComponent)(mc, defaultPkgDir).some((0, functions_1.forceIgnoreDenies)(forceIgnore)))
|
|
30
|
-
.map(metadataComponentToMetadataMember);
|
|
31
|
-
};
|
|
8
|
+
const removeIgnored = (changeResults, forceIgnore, defaultPkgDir, registry) => changeResults
|
|
9
|
+
.map(exports.ensureNameAndType)
|
|
10
|
+
.map((0, functions_1.changeResultToMetadataComponent)(registry))
|
|
11
|
+
.filter((mc) => !(0, filePathGenerator_1.filePathsFromMetadataComponent)(mc, defaultPkgDir).some((0, functions_1.forceIgnoreDenies)(forceIgnore)))
|
|
12
|
+
.map(metadataComponentToMetadataMember);
|
|
32
13
|
exports.removeIgnored = removeIgnored;
|
|
33
14
|
const metadataComponentToMetadataMember = (mc) => ({
|
|
34
15
|
type: mc.type.name,
|
package/lib/shared/types.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type ConflictResponse = {
|
|
|
39
39
|
type: string;
|
|
40
40
|
filePath: string;
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
type SourceConflictErrorType = {
|
|
43
43
|
name: 'SourceConflictError';
|
|
44
44
|
} & SfError<ConflictResponse[]>;
|
|
45
45
|
export declare class SourceConflictError extends SfError<ConflictResponse[]> implements SourceConflictErrorType {
|
|
@@ -54,3 +54,4 @@ export type SourceMemberPollingEvent = {
|
|
|
54
54
|
consecutiveEmptyResults: number;
|
|
55
55
|
};
|
|
56
56
|
export type ChangeResultWithNameAndType = ChangeResult & Required<Pick<ChangeResult, 'name' | 'type'>>;
|
|
57
|
+
export {};
|
package/lib/sourceTracking.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export type SourceTrackingOptions = {
|
|
|
18
18
|
* If you're using STL as part of a long running process (ex: vscode extensions), set this to false
|
|
19
19
|
*/
|
|
20
20
|
ignoreLocalCache?: boolean;
|
|
21
|
+
/** pass in an instance of SDR's RegistryAccess. If not provided, a new one will be created */
|
|
22
|
+
registry?: RegistryAccess;
|
|
21
23
|
};
|
|
22
24
|
type RemoteChangesResults = {
|
|
23
25
|
componentSetFromNonDeletes: ComponentSet;
|
package/lib/sourceTracking.js
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.SourceTracking = void 0;
|
|
7
37
|
/*
|
|
@@ -19,7 +49,7 @@ exports.SourceTracking = void 0;
|
|
|
19
49
|
* See the License for the specific language governing permissions and
|
|
20
50
|
* limitations under the License.
|
|
21
51
|
*/
|
|
22
|
-
const
|
|
52
|
+
const fs = __importStar(require("node:fs"));
|
|
23
53
|
const node_path_1 = require("node:path");
|
|
24
54
|
const core_1 = require("@salesforce/core");
|
|
25
55
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -27,7 +57,6 @@ const ts_types_1 = require("@salesforce/ts-types");
|
|
|
27
57
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
28
58
|
// this is not exported by SDR (see the comments in SDR regarding its limitations)
|
|
29
59
|
const filePathGenerator_1 = require("@salesforce/source-deploy-retrieve/lib/src/utils/filePathGenerator");
|
|
30
|
-
const performance_1 = require("@oclif/core/performance");
|
|
31
60
|
const remoteSourceTrackingService_1 = require("./shared/remote/remoteSourceTrackingService");
|
|
32
61
|
const localShadowRepo_1 = require("./shared/local/localShadowRepo");
|
|
33
62
|
const conflicts_1 = require("./shared/conflicts");
|
|
@@ -72,7 +101,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
72
101
|
this.ignoreConflicts = options.ignoreConflicts ?? false;
|
|
73
102
|
this.ignoreLocalCache = options.ignoreLocalCache ?? false;
|
|
74
103
|
this.subscribeSDREvents = options.subscribeSDREvents ?? false;
|
|
75
|
-
this.registry = new source_deploy_retrieve_1.RegistryAccess(undefined, this.projectPath);
|
|
104
|
+
this.registry = options.registry ?? new source_deploy_retrieve_1.RegistryAccess(undefined, this.projectPath);
|
|
76
105
|
}
|
|
77
106
|
async init() {
|
|
78
107
|
await this.maybeSubscribeLifecycleEvents();
|
|
@@ -126,7 +155,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
126
155
|
const componentSet = new source_deploy_retrieve_1.ComponentSet(applyIgnore ? sourceBackedComponents.filter(noFileIsIgnored(this.forceIgnore)) : sourceBackedComponents, this.registry);
|
|
127
156
|
// there may be remote adds not in the SBC. So we add those manually
|
|
128
157
|
(applyIgnore
|
|
129
|
-
? (0, remoteChangeIgnoring_1.removeIgnored)(changeResults, this.forceIgnore, this.project.getDefaultPackage().fullPath)
|
|
158
|
+
? (0, remoteChangeIgnoring_1.removeIgnored)(changeResults, this.forceIgnore, this.project.getDefaultPackage().fullPath, this.registry)
|
|
130
159
|
: changeResults.map(functions_1.remoteChangeToMetadataMember)).map((mm) => {
|
|
131
160
|
componentSet.add(mm);
|
|
132
161
|
});
|
|
@@ -203,11 +232,11 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
203
232
|
// skip any remote types not in the registry. Will emit warnings
|
|
204
233
|
.filter((rce) => (0, metadataKeys_1.registrySupportsType)(this.registry)(rce.type));
|
|
205
234
|
if (options.format === 'ChangeResult') {
|
|
206
|
-
return filteredChanges.map(remoteSourceTrackingService_1.remoteChangeElementToChangeResult);
|
|
235
|
+
return filteredChanges.map((0, remoteSourceTrackingService_1.remoteChangeElementToChangeResult)(this.registry));
|
|
207
236
|
}
|
|
208
237
|
if (options.format === 'ChangeResultWithPaths') {
|
|
209
238
|
return (0, populateFilePaths_1.populateFilePaths)({
|
|
210
|
-
elements: filteredChanges.map(remoteSourceTrackingService_1.remoteChangeElementToChangeResult),
|
|
239
|
+
elements: filteredChanges.map((0, remoteSourceTrackingService_1.remoteChangeElementToChangeResult)(this.registry)),
|
|
211
240
|
packageDirPaths: this.project.getPackageDirectories().map((pkgDir) => pkgDir.fullPath),
|
|
212
241
|
registry: this.registry,
|
|
213
242
|
});
|
|
@@ -265,7 +294,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
265
294
|
// delete the files
|
|
266
295
|
await Promise.all(filenames.map((filename) => sourceComponentByFileName.get(filename)?.type.id === 'customlabel' && nonDecomposedLabels
|
|
267
296
|
? (0, functions_2.deleteCustomLabels)(filename, changesToDelete.filter(functions_3.sourceComponentIsCustomLabel))
|
|
268
|
-
:
|
|
297
|
+
: fs.promises.unlink(filename)));
|
|
269
298
|
// update the tracking files. We're simulating SDR-style fileResponse
|
|
270
299
|
await Promise.all([
|
|
271
300
|
this.updateLocalTracking({ deletedFiles: filenames }),
|
|
@@ -285,8 +314,6 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
285
314
|
*/
|
|
286
315
|
async updateLocalTracking(options) {
|
|
287
316
|
this.logger.trace('start: updateLocalTracking', options);
|
|
288
|
-
const marker = performance_1.Performance.mark('@salesforce/source-tracking', 'SourceTracking.updateLocalTracking');
|
|
289
|
-
marker?.addDetails({ nonDeletes: options.files?.length ?? 0, deletes: options.deletedFiles?.length ?? 0 });
|
|
290
317
|
await this.ensureLocalTracking();
|
|
291
318
|
this.logger.trace('files', options.files);
|
|
292
319
|
// relative paths make smaller trees AND isogit wants them relative
|
|
@@ -313,7 +340,6 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
313
340
|
deletedFiles: relativeOptions.deletedFiles.concat((await this.localRepo.getDeleteFilenames()).filter((deployedFile) => bundlesWithDeletedFiles.some((0, functions_2.folderContainsPath)(deployedFile)) &&
|
|
314
341
|
!relativeOptions.files.includes(deployedFile))),
|
|
315
342
|
});
|
|
316
|
-
marker?.stop();
|
|
317
343
|
this.logger.trace('done: updateLocalTracking', options);
|
|
318
344
|
}
|
|
319
345
|
/**
|
|
@@ -321,16 +347,13 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
321
347
|
* Optional skip polling for the SourceMembers to exist on the server and be updated in local files
|
|
322
348
|
*/
|
|
323
349
|
async updateRemoteTracking(fileResponses, skipPolling = false) {
|
|
324
|
-
const marker = performance_1.Performance.mark('@salesforce/source-tracking', 'SourceTracking.updateRemoteTracking');
|
|
325
|
-
marker?.addDetails({ fileResponseCount: fileResponses.length, skipPolling });
|
|
326
350
|
// false to explicitly NOT query until we do the polling
|
|
327
351
|
await this.ensureRemoteTracking(false);
|
|
328
352
|
if (!skipPolling) {
|
|
329
353
|
// poll to make sure we have the updates before syncing the ones from metadataKeys
|
|
330
|
-
await this.remoteSourceTrackingService.pollForSourceTracking(fileResponses);
|
|
354
|
+
await this.remoteSourceTrackingService.pollForSourceTracking(this.registry, fileResponses);
|
|
331
355
|
}
|
|
332
|
-
await this.remoteSourceTrackingService.syncSpecifiedElements(fileResponses);
|
|
333
|
-
marker?.stop();
|
|
356
|
+
await this.remoteSourceTrackingService.syncSpecifiedElements(this.registry, fileResponses);
|
|
334
357
|
}
|
|
335
358
|
async reReadLocalTrackingCache() {
|
|
336
359
|
await this.localRepo.getStatus(true);
|
|
@@ -417,7 +440,6 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
417
440
|
* Compares local and remote changes to detect conflicts
|
|
418
441
|
*/
|
|
419
442
|
async getConflicts() {
|
|
420
|
-
const marker = performance_1.Performance.mark('@salesforce/source-tracking', 'SourceTracking.getConflicts');
|
|
421
443
|
// we're going to need have both initialized
|
|
422
444
|
await Promise.all([this.ensureRemoteTracking(), this.ensureLocalTracking()]);
|
|
423
445
|
// Strategy: check local changes first (since it'll be faster) to avoid callout
|
|
@@ -447,7 +469,6 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
447
469
|
forceIgnore: this.forceIgnore,
|
|
448
470
|
registry: this.registry,
|
|
449
471
|
});
|
|
450
|
-
marker?.stop();
|
|
451
472
|
return result;
|
|
452
473
|
}
|
|
453
474
|
/**
|
|
@@ -550,7 +571,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
550
571
|
// reserve the right to do something more sophisticated in the future
|
|
551
572
|
// via async for figuring out hypothetical filenames (ex: getting default packageDir)
|
|
552
573
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
553
|
-
async remoteChangesToOutputRows(input
|
|
574
|
+
async remoteChangesToOutputRows(input) {
|
|
554
575
|
this.logger.debug('converting ChangeResult to a row', input);
|
|
555
576
|
this.forceIgnore ??= source_deploy_retrieve_1.ForceIgnore.findAndCreate(this.project.getDefaultPackage().path);
|
|
556
577
|
const baseObject = {
|
|
@@ -570,7 +591,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
570
591
|
// when the file doesn't exist locally, there are no filePaths
|
|
571
592
|
// SDR can generate the hypothetical place it *would* go and check that
|
|
572
593
|
if ((0, guards_1.isChangeResultWithNameAndType)(input)) {
|
|
573
|
-
const ignored = (0, filePathGenerator_1.filePathsFromMetadataComponent)((0, functions_1.changeResultToMetadataComponent)(registry)(input)).some((0, functions_2.forceIgnoreDenies)(this.forceIgnore));
|
|
594
|
+
const ignored = (0, filePathGenerator_1.filePathsFromMetadataComponent)((0, functions_1.changeResultToMetadataComponent)(this.registry)(input)).some((0, functions_2.forceIgnoreDenies)(this.forceIgnore));
|
|
574
595
|
return [
|
|
575
596
|
{
|
|
576
597
|
...baseObject,
|