@salesforce/source-tracking 1.0.2 → 1.1.2
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.2](https://github.com/forcedotcom/source-tracking/compare/v1.1.1...v1.1.2) (2022-03-02)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- more metadata polling exclusions based on telemetry ([ae5adf3](https://github.com/forcedotcom/source-tracking/commit/ae5adf34600676f54c0e5efa2f5e7c96e2fd10f6))
|
|
10
|
+
|
|
11
|
+
### [1.1.1](https://github.com/forcedotcom/source-tracking/compare/v1.1.0...v1.1.1) (2022-02-23)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- message formatting for GA ([194ba4b](https://github.com/forcedotcom/source-tracking/commit/194ba4b4bd08a26e7f7c5c6ef28dc1fb20acc1de))
|
|
16
|
+
|
|
17
|
+
## [1.1.0](https://github.com/forcedotcom/source-tracking/compare/v1.0.2...v1.1.0) (2022-02-16)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- smarter polling ([3d5bb05](https://github.com/forcedotcom/source-tracking/commit/3d5bb05ccf05127304037ec6085660be5da8fe24))
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
- handle lwc in a pkgDir of the same name ([621d8cf](https://github.com/forcedotcom/source-tracking/commit/621d8cfc00f2eb4ded160802b2076e140d0a2d06))
|
|
26
|
+
- increase max-fetch default ([9854ed8](https://github.com/forcedotcom/source-tracking/commit/9854ed8677c13d0b2d818355660ab71c144e6a3e))
|
|
27
|
+
- lastIndexOf handles foo/lwc/foo ([8632ee6](https://github.com/forcedotcom/source-tracking/commit/8632ee61f88faf32024e99f1c5590f6b134a3b08))
|
|
28
|
+
- smarter polling and excluded files ([6df02a7](https://github.com/forcedotcom/source-tracking/commit/6df02a716e238e38b699b98f638ef42ed8cedeca))
|
|
29
|
+
|
|
5
30
|
### [1.0.2](https://github.com/forcedotcom/source-tracking/compare/v1.0.1...v1.0.2) (2022-01-25)
|
|
6
31
|
|
|
7
32
|
### Bug Fixes
|
package/lib/compatibility.js
CHANGED
|
@@ -53,16 +53,17 @@ const throwIfInvalid = ({ org, projectPath, toValidate, command, }) => {
|
|
|
53
53
|
}
|
|
54
54
|
// We expected it to be the toolbelt version but it is using the new tracking files
|
|
55
55
|
if (toValidate === 'toolbelt') {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
// some of the toolbelt commands aren't using SfdxCommand and the SfdxError actions won't be automatically displayed
|
|
57
|
+
throw new core_1.SfdxError(`${messages.getMessage('sourceTrackingFileVersionMismatch', ['new'])}\n\nTry this:\n${messages.getMessage('useOtherVersion', ['new', (0, exports.replaceRenamedCommands)(command, true)])}.\n${messages.getMessage('clearSuggestion', [
|
|
58
|
+
'new',
|
|
59
|
+
(0, exports.replaceRenamedCommands)('sfdx force:source:tracking:clear', true),
|
|
60
|
+
])}.`, 'SourceTrackingFileVersionMismatch');
|
|
60
61
|
}
|
|
61
62
|
// We expected it to be the plugin-source version but it is using the old tracking files
|
|
62
63
|
if (toValidate === 'plugin-source') {
|
|
63
64
|
throw new core_1.SfdxError(messages.getMessage('sourceTrackingFileVersionMismatch', ['old']), 'SourceTrackingFileVersionMismatch', [
|
|
64
|
-
messages.getMessage('useOtherVersion', ['old', (0, exports.replaceRenamedCommands)(command
|
|
65
|
-
messages.getMessage('clearSuggestion', ['old', 'sfdx force:source:tracking:clear']),
|
|
65
|
+
messages.getMessage('useOtherVersion', ['old', (0, exports.replaceRenamedCommands)(command)]),
|
|
66
|
+
messages.getMessage('clearSuggestion', ['old', (0, exports.replaceRenamedCommands)('sfdx force:source:tracking:clear')]),
|
|
66
67
|
]);
|
|
67
68
|
}
|
|
68
69
|
};
|
|
@@ -81,10 +82,10 @@ const replaceRenamedCommands = (input, reverse = false) => {
|
|
|
81
82
|
};
|
|
82
83
|
exports.replaceRenamedCommands = replaceRenamedCommands;
|
|
83
84
|
const renames = new Map([
|
|
84
|
-
['force:source:status', 'force:source:
|
|
85
|
-
['force:source:push', 'force:source:
|
|
86
|
-
['force:source:pull', 'force:source:
|
|
87
|
-
['force:source:tracking:reset', 'force:source:
|
|
88
|
-
['force:source:tracking:clear', 'force:source:
|
|
85
|
+
['force:source:status', 'force:source:legacy:status'],
|
|
86
|
+
['force:source:push', 'force:source:legacy:push'],
|
|
87
|
+
['force:source:pull', 'force:source:legacy:pull'],
|
|
88
|
+
['force:source:tracking:reset', 'force:source:legacy:tracking:reset'],
|
|
89
|
+
['force:source:tracking:clear', 'force:source:legacy:tracking:clear'],
|
|
89
90
|
]);
|
|
90
91
|
//# sourceMappingURL=compatibility.js.map
|
|
@@ -7,12 +7,13 @@ exports.mappingsForSourceMemberTypesToMetadataType = exports.getMetadataKeyFromF
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const path_1 = require("path");
|
|
11
11
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
12
12
|
const functions_1 = require("./functions");
|
|
13
|
-
//
|
|
13
|
+
// See UT for examples of the complexity this must handle
|
|
14
|
+
// keys always use forward slashes, even on Windows
|
|
14
15
|
const pathAfterFullName = (fileResponse) => fileResponse && fileResponse.filePath
|
|
15
|
-
? fileResponse.filePath.
|
|
16
|
+
? (0, path_1.join)((0, path_1.dirname)(fileResponse.filePath).substring((0, path_1.dirname)(fileResponse.filePath).lastIndexOf(fileResponse.fullName)), (0, path_1.basename)(fileResponse.filePath)).replace(/\\/gi, '/')
|
|
16
17
|
: '';
|
|
17
18
|
const registry = new source_deploy_retrieve_1.RegistryAccess();
|
|
18
19
|
// only compute once
|
|
@@ -25,7 +26,7 @@ const reverseAliasTypes = new Map(aliasTypes.map(([alias, type]) => [type, alias
|
|
|
25
26
|
const getMetadataKeyFromFileResponse = (fileResponse) => {
|
|
26
27
|
// also create an element for the parent object
|
|
27
28
|
if (fileResponse.type === 'CustomField' && fileResponse.filePath) {
|
|
28
|
-
const splits =
|
|
29
|
+
const splits = (0, path_1.normalize)(fileResponse.filePath).split(path_1.sep);
|
|
29
30
|
const objectFolderIndex = splits.indexOf('objects');
|
|
30
31
|
return [
|
|
31
32
|
(0, functions_1.getMetadataKey)('CustomObject', splits[objectFolderIndex + 1]),
|
|
@@ -58,6 +58,12 @@ export declare class RemoteSourceTrackingService extends ConfigFile<RemoteSource
|
|
|
58
58
|
static getInstance(options: RemoteSourceTrackingService.Options): Promise<RemoteSourceTrackingService>;
|
|
59
59
|
static getFileName(): string;
|
|
60
60
|
static getFilePath(orgId: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Delete the RemoteSourceTracking for a given org.
|
|
63
|
+
*
|
|
64
|
+
* @param orgId
|
|
65
|
+
* @returns the path of the deleted source tracking file
|
|
66
|
+
*/
|
|
61
67
|
static delete(orgId: string): Promise<string>;
|
|
62
68
|
/**
|
|
63
69
|
* Initializes the service with existing remote source tracking data, or sets
|
|
@@ -119,6 +125,7 @@ export declare class RemoteSourceTrackingService extends ConfigFile<RemoteSource
|
|
|
119
125
|
* @param pollingTimeout maximum amount of time in seconds to poll for SourceMembers
|
|
120
126
|
*/
|
|
121
127
|
pollForSourceTracking(expectedMembers: RemoteSyncInput[]): Promise<void>;
|
|
128
|
+
private calculateExpectedSourceMembers;
|
|
122
129
|
private calculateTimeout;
|
|
123
130
|
private querySourceMembersFrom;
|
|
124
131
|
private querySourceMembersTo;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/* eslint-disable no-underscore-dangle */
|
|
9
9
|
/* eslint-disable @typescript-eslint/member-ordering */
|
|
10
|
+
var _a;
|
|
10
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
12
|
exports.remoteChangeElementToChangeResult = exports.RemoteSourceTrackingService = void 0;
|
|
12
13
|
const path = require("path");
|
|
@@ -16,6 +17,12 @@ const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
|
16
17
|
const kit_1 = require("@salesforce/kit");
|
|
17
18
|
const metadataKeys_1 = require("./metadataKeys");
|
|
18
19
|
const functions_1 = require("./functions");
|
|
20
|
+
/*
|
|
21
|
+
* after some results have returned, how many times should we poll for missing sourcemembers
|
|
22
|
+
* even when there is a longer timeout remaining (because the deployment is very large)
|
|
23
|
+
*/
|
|
24
|
+
const POLLING_DELAY_MS = 1000;
|
|
25
|
+
const CONSECUTIVE_EMPTY_POLLING_RESULT_LIMIT = ((_a = kit_1.env.getNumber('SFDX_SOURCE_MEMBER_POLLING_TIMEOUT')) !== null && _a !== void 0 ? _a : 120) / kit_1.Duration.milliseconds(POLLING_DELAY_MS).seconds;
|
|
19
26
|
/**
|
|
20
27
|
* This service handles source tracking of metadata between a local project and an org.
|
|
21
28
|
* Source tracking state is persisted to .sfdx/orgs/<orgId>/maxRevision.json.
|
|
@@ -82,6 +89,12 @@ class RemoteSourceTrackingService extends core_1.ConfigFile {
|
|
|
82
89
|
static getFilePath(orgId) {
|
|
83
90
|
return path.join('.sfdx', 'orgs', orgId, RemoteSourceTrackingService.getFileName());
|
|
84
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Delete the RemoteSourceTracking for a given org.
|
|
94
|
+
*
|
|
95
|
+
* @param orgId
|
|
96
|
+
* @returns the path of the deleted source tracking file
|
|
97
|
+
*/
|
|
85
98
|
static async delete(orgId) {
|
|
86
99
|
const fileToDelete = RemoteSourceTrackingService.getFilePath(orgId);
|
|
87
100
|
// the file might not exist, in which case we don't need to delete it
|
|
@@ -199,13 +212,9 @@ class RemoteSourceTrackingService extends core_1.ConfigFile {
|
|
|
199
212
|
// Called during a source:tracking:reset
|
|
200
213
|
this.setServerMaxRevision(0);
|
|
201
214
|
this.initSourceMembers();
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
members = await this.querySourceMembersFrom({ fromRevision: 0 });
|
|
208
|
-
}
|
|
215
|
+
const members = toRevision != null
|
|
216
|
+
? await this.querySourceMembersTo(toRevision)
|
|
217
|
+
: await this.querySourceMembersFrom({ fromRevision: 0 });
|
|
209
218
|
await this.trackSourceMembers(members, true);
|
|
210
219
|
return members.map((member) => (0, functions_1.getMetadataKey)(member.MemberType, member.MemberName));
|
|
211
220
|
}
|
|
@@ -253,18 +262,20 @@ class RemoteSourceTrackingService extends core_1.ConfigFile {
|
|
|
253
262
|
}
|
|
254
263
|
let serverMaxRevisionCounter = this.getServerMaxRevision();
|
|
255
264
|
sourceMembers.forEach((change) => {
|
|
265
|
+
var _a;
|
|
256
266
|
// try accessing the sourceMembers object at the index of the change's name
|
|
257
267
|
// if it exists, we'll update the fields - if it doesn't, we'll create and insert it
|
|
258
268
|
const key = (0, functions_1.getMetadataKey)(change.MemberType, change.MemberName);
|
|
259
|
-
|
|
260
|
-
|
|
269
|
+
const sourceMember = (_a = this.getSourceMember(key)) !== null && _a !== void 0 ? _a : {
|
|
270
|
+
serverRevisionCounter: change.RevisionCounter,
|
|
271
|
+
lastRetrievedFromServer: null,
|
|
272
|
+
memberType: change.MemberType,
|
|
273
|
+
isNameObsolete: change.IsNameObsolete,
|
|
274
|
+
};
|
|
275
|
+
if (sourceMember.lastRetrievedFromServer) {
|
|
261
276
|
// We are already tracking this element so we'll update it
|
|
262
277
|
if (!quiet) {
|
|
263
|
-
|
|
264
|
-
if (sync) {
|
|
265
|
-
msg += ' and syncing';
|
|
266
|
-
}
|
|
267
|
-
this.logger.debug(msg);
|
|
278
|
+
this.logger.debug(`Updating ${key} to RevisionCounter: ${change.RevisionCounter}${sync ? ' and syncing' : ''}`);
|
|
268
279
|
}
|
|
269
280
|
sourceMember.serverRevisionCounter = change.RevisionCounter;
|
|
270
281
|
sourceMember.isNameObsolete = change.IsNameObsolete;
|
|
@@ -272,18 +283,8 @@ class RemoteSourceTrackingService extends core_1.ConfigFile {
|
|
|
272
283
|
else {
|
|
273
284
|
// We are not yet tracking it so we'll insert a new record
|
|
274
285
|
if (!quiet) {
|
|
275
|
-
|
|
276
|
-
if (sync) {
|
|
277
|
-
msg += ' and syncing';
|
|
278
|
-
}
|
|
279
|
-
this.logger.debug(msg);
|
|
286
|
+
this.logger.debug(`Inserting ${key} with RevisionCounter: ${change.RevisionCounter}${sync ? ' and syncing' : ''}`);
|
|
280
287
|
}
|
|
281
|
-
sourceMember = {
|
|
282
|
-
serverRevisionCounter: change.RevisionCounter,
|
|
283
|
-
lastRetrievedFromServer: null,
|
|
284
|
-
memberType: change.MemberType,
|
|
285
|
-
isNameObsolete: change.IsNameObsolete,
|
|
286
|
-
};
|
|
287
288
|
}
|
|
288
289
|
// If we are syncing changes then we need to update the lastRetrievedFromServer field to
|
|
289
290
|
// match the RevisionCounter from the SourceMember.
|
|
@@ -348,59 +349,59 @@ class RemoteSourceTrackingService extends core_1.ConfigFile {
|
|
|
348
349
|
this.logger.warn('Not polling for SourceMembers since SFDX_DISABLE_SOURCE_MEMBER_POLLING = true.');
|
|
349
350
|
return;
|
|
350
351
|
}
|
|
351
|
-
|
|
352
|
+
const outstandingSourceMembers = this.calculateExpectedSourceMembers(expectedMembers);
|
|
353
|
+
if (expectedMembers.length === 0 || outstandingSourceMembers.size === 0) {
|
|
352
354
|
// Don't bother polling if we're not matching SourceMembers
|
|
353
355
|
return;
|
|
354
356
|
}
|
|
355
|
-
const
|
|
356
|
-
//
|
|
357
|
-
expectedMembers
|
|
358
|
-
.filter((fileResponse) => {
|
|
359
|
-
var _a;
|
|
360
|
-
// unchanged files will never be in the sourceMembers. Not really sure why SDR returns them.
|
|
361
|
-
return fileResponse.state !== source_deploy_retrieve_1.ComponentStatus.Unchanged &&
|
|
362
|
-
// if a listView is the only change inside an object, the object won't have a sourceMember change. We won't wait for those to be found
|
|
363
|
-
fileResponse.type !== 'CustomObject' &&
|
|
364
|
-
// aura meta.xml aren't tracked as SourceMembers
|
|
365
|
-
!((_a = fileResponse.filePath) === null || _a === void 0 ? void 0 : _a.endsWith('.cmp-meta.xml'));
|
|
366
|
-
})
|
|
367
|
-
.map((member) => {
|
|
368
|
-
(0, metadataKeys_1.getMetadataKeyFromFileResponse)(member).map((key) => outstandingSourceMembers.set(key, member));
|
|
369
|
-
});
|
|
370
|
-
const originalSize = outstandingSourceMembers.size;
|
|
371
|
-
const fromRevision = this.getServerMaxRevision();
|
|
357
|
+
const originalOutstandingSize = outstandingSourceMembers.size;
|
|
358
|
+
// 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
|
|
372
359
|
const pollingTimeout = this.calculateTimeout(outstandingSourceMembers.size);
|
|
373
|
-
this.
|
|
360
|
+
let highestRevisionSoFar = this.getServerMaxRevision();
|
|
374
361
|
let pollAttempts = 0;
|
|
362
|
+
let consecutiveEmptyResults = 0;
|
|
363
|
+
let someResultsReturned = false;
|
|
364
|
+
this.logger.debug(`Polling for ${outstandingSourceMembers.size} SourceMembers from revision ${highestRevisionSoFar} with timeout of ${pollingTimeout.seconds}s`);
|
|
375
365
|
const poll = async () => {
|
|
376
366
|
pollAttempts += 1; // not used to stop polling, but for debug logging
|
|
377
|
-
// get sourceMembers since
|
|
367
|
+
// get sourceMembers added since our most recent max
|
|
368
|
+
// use the "new highest" revision from the last poll that returned results
|
|
378
369
|
const queriedMembers = await this.querySourceMembersFrom({
|
|
379
|
-
fromRevision,
|
|
370
|
+
fromRevision: highestRevisionSoFar,
|
|
380
371
|
quiet: pollAttempts !== 1,
|
|
381
372
|
useCache: false,
|
|
382
373
|
});
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
374
|
+
if (queriedMembers.length) {
|
|
375
|
+
queriedMembers.map((member) => {
|
|
376
|
+
// remove anything returned from the query list
|
|
377
|
+
outstandingSourceMembers.delete((0, functions_1.getMetadataKey)(member.MemberType, member.MemberName));
|
|
378
|
+
highestRevisionSoFar = Math.max(highestRevisionSoFar, member.RevisionCounter);
|
|
379
|
+
});
|
|
380
|
+
consecutiveEmptyResults = 0;
|
|
381
|
+
// flips on the first batch of results
|
|
382
|
+
someResultsReturned = true;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
consecutiveEmptyResults++;
|
|
386
|
+
}
|
|
387
|
+
this.logger.debug(`[${pollAttempts}] Found ${originalOutstandingSize - outstandingSourceMembers.size} of ${originalOutstandingSize} expected SourceMembers`);
|
|
388
388
|
// update but don't sync
|
|
389
389
|
await this.trackSourceMembers(queriedMembers, false);
|
|
390
390
|
// exit if all have returned
|
|
391
391
|
if (outstandingSourceMembers.size === 0) {
|
|
392
392
|
return;
|
|
393
393
|
}
|
|
394
|
-
if (
|
|
395
|
-
|
|
396
|
-
? `Still looking for SourceMembers: ${Array.from(outstandingSourceMembers.keys()).join(',')}`
|
|
397
|
-
: `Still looking for ${outstandingSourceMembers.size} Source Members`);
|
|
394
|
+
if (someResultsReturned && consecutiveEmptyResults >= CONSECUTIVE_EMPTY_POLLING_RESULT_LIMIT) {
|
|
395
|
+
throw new ts_retry_promise_1.NotRetryableError(`Polling found no results for ${consecutiveEmptyResults} consecutive attempts`);
|
|
398
396
|
}
|
|
397
|
+
this.logger.debug(outstandingSourceMembers.size < 20
|
|
398
|
+
? `Still looking for SourceMembers: ${Array.from(outstandingSourceMembers.keys()).join(',')}`
|
|
399
|
+
: `Still looking for ${outstandingSourceMembers.size} Source Members`);
|
|
399
400
|
throw new Error();
|
|
400
401
|
};
|
|
401
402
|
const pollingFunction = (0, ts_retry_promise_1.retryDecorator)(poll, {
|
|
402
|
-
timeout: pollingTimeout
|
|
403
|
-
delay:
|
|
403
|
+
timeout: pollingTimeout.milliseconds,
|
|
404
|
+
delay: POLLING_DELAY_MS,
|
|
404
405
|
retries: 'INFINITELY',
|
|
405
406
|
});
|
|
406
407
|
try {
|
|
@@ -408,27 +409,96 @@ class RemoteSourceTrackingService extends core_1.ConfigFile {
|
|
|
408
409
|
this.logger.debug(`Retrieved all SourceMember data after ${pollAttempts} attempts`);
|
|
409
410
|
}
|
|
410
411
|
catch {
|
|
411
|
-
this.logger.warn(`Polling for SourceMembers timed out after ${pollAttempts} attempts`);
|
|
412
|
+
this.logger.warn(`Polling for SourceMembers timed out after ${pollAttempts} attempts (last ${consecutiveEmptyResults} were empty) )`);
|
|
412
413
|
if (outstandingSourceMembers.size < 51) {
|
|
413
414
|
this.logger.debug(`Could not find ${outstandingSourceMembers.size} SourceMembers: ${Array.from(outstandingSourceMembers).join(',')}`);
|
|
414
415
|
}
|
|
415
416
|
else {
|
|
416
417
|
this.logger.debug(`Could not find SourceMembers for ${outstandingSourceMembers.size} components`);
|
|
417
418
|
}
|
|
419
|
+
void core_1.Lifecycle.getInstance().emitTelemetry({
|
|
420
|
+
eventName: 'sourceMemberPollingTimeout',
|
|
421
|
+
library: 'SourceTracking',
|
|
422
|
+
timeoutSeconds: pollingTimeout.seconds,
|
|
423
|
+
attempts: pollAttempts,
|
|
424
|
+
consecutiveEmptyResults,
|
|
425
|
+
missingQuantity: outstandingSourceMembers.size,
|
|
426
|
+
deploymentSize: expectedMembers.length,
|
|
427
|
+
types: [...new Set(Array.from(outstandingSourceMembers.values()).map((member) => member.type))]
|
|
428
|
+
.sort()
|
|
429
|
+
.join(','),
|
|
430
|
+
members: Array.from(outstandingSourceMembers.keys()).join(','),
|
|
431
|
+
});
|
|
418
432
|
}
|
|
419
433
|
}
|
|
434
|
+
calculateExpectedSourceMembers(expectedMembers) {
|
|
435
|
+
const outstandingSourceMembers = new Map();
|
|
436
|
+
// filter known Source tracking issues
|
|
437
|
+
expectedMembers
|
|
438
|
+
.filter((fileResponse) => {
|
|
439
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
440
|
+
// unchanged files will never be in the sourceMembers. Not really sure why SDR returns them.
|
|
441
|
+
return fileResponse.state !== source_deploy_retrieve_1.ComponentStatus.Unchanged &&
|
|
442
|
+
// if a listView is the only change inside an object, the object won't have a sourceMember change. We won't wait for those to be found
|
|
443
|
+
// we don't know which email folder type might be there, so don't require either
|
|
444
|
+
// Portal doesn't support source tracking, according to the coverage report
|
|
445
|
+
![
|
|
446
|
+
'CustomObject',
|
|
447
|
+
'EmailFolder',
|
|
448
|
+
'EmailTemplateFolder',
|
|
449
|
+
'StandardValueSet',
|
|
450
|
+
'Portal',
|
|
451
|
+
'StandardValueSetTranslation',
|
|
452
|
+
'SharingRules',
|
|
453
|
+
'SharingCriteriaRule',
|
|
454
|
+
'GlobalValueSetTranslation',
|
|
455
|
+
'AssignmentRules',
|
|
456
|
+
].includes(fileResponse.type) &&
|
|
457
|
+
// don't wait for standard fields on standard objects
|
|
458
|
+
!(fileResponse.type === 'CustomField' && !((_a = fileResponse.filePath) === null || _a === void 0 ? void 0 : _a.includes('__c'))) &&
|
|
459
|
+
// they're settings to mdapi, and FooSettings in sourceMembers
|
|
460
|
+
!fileResponse.type.includes('Settings') &&
|
|
461
|
+
// mdapi encodes these, sourceMembers don't have encoding
|
|
462
|
+
!((fileResponse.type === 'Layout' || fileResponse.type === 'BusinessProcess') &&
|
|
463
|
+
((_b = fileResponse.filePath) === null || _b === void 0 ? void 0 : _b.includes('%'))) &&
|
|
464
|
+
// namespaced labels and CMDT don't resolve correctly
|
|
465
|
+
!(['CustomLabels', 'CustomMetadata'].includes(fileResponse.type) && ((_c = fileResponse.filePath) === null || _c === void 0 ? void 0 : _c.includes('__'))) &&
|
|
466
|
+
// don't wait on workflow children
|
|
467
|
+
!fileResponse.type.startsWith('Workflow') &&
|
|
468
|
+
// aura xml aren't tracked as SourceMembers
|
|
469
|
+
!((_d = fileResponse.filePath) === null || _d === void 0 ? void 0 : _d.endsWith('.cmp-meta.xml')) &&
|
|
470
|
+
!((_e = fileResponse.filePath) === null || _e === void 0 ? void 0 : _e.endsWith('.tokens-meta.xml')) &&
|
|
471
|
+
!((_f = fileResponse.filePath) === null || _f === void 0 ? void 0 : _f.endsWith('.evt-meta.xml')) &&
|
|
472
|
+
!((_g = fileResponse.filePath) === null || _g === void 0 ? void 0 : _g.endsWith('.app-meta.xml')) &&
|
|
473
|
+
!((_h = fileResponse.filePath) === null || _h === void 0 ? void 0 : _h.endsWith('.intf-meta.xml'));
|
|
474
|
+
})
|
|
475
|
+
.map((member) => {
|
|
476
|
+
(0, metadataKeys_1.getMetadataKeyFromFileResponse)(member)
|
|
477
|
+
// remove some individual members known to not work with tracking even when their type does
|
|
478
|
+
.filter((key) =>
|
|
479
|
+
// CustomObject could have been re-added by the key generator from one of its fields
|
|
480
|
+
!key.startsWith('CustomObject') &&
|
|
481
|
+
key !== 'Profile__Standard' &&
|
|
482
|
+
key !== 'CustomTab__standard-home' &&
|
|
483
|
+
key !== 'AssignmentRules__Case' &&
|
|
484
|
+
key !== 'ListView__CollaborationGroup.All_ChatterGroups')
|
|
485
|
+
.map((key) => outstandingSourceMembers.set(key, member));
|
|
486
|
+
});
|
|
487
|
+
return outstandingSourceMembers;
|
|
488
|
+
}
|
|
420
489
|
calculateTimeout(memberCount) {
|
|
421
|
-
|
|
490
|
+
var _a;
|
|
491
|
+
const overriddenTimeout = (_a = kit_1.env.getNumber('SFDX_SOURCE_MEMBER_POLLING_TIMEOUT', 0)) !== null && _a !== void 0 ? _a : 0;
|
|
422
492
|
if (overriddenTimeout > 0) {
|
|
423
493
|
this.logger.debug(`Overriding SourceMember polling timeout to ${overriddenTimeout}`);
|
|
424
|
-
return overriddenTimeout;
|
|
494
|
+
return kit_1.Duration.seconds(overriddenTimeout);
|
|
425
495
|
}
|
|
426
496
|
// Calculate a polling timeout for SourceMembers based on the number of
|
|
427
497
|
// member names being polled plus a buffer of 5 seconds. This will
|
|
428
498
|
// wait 50s for each 1000 components, plus 5s.
|
|
429
499
|
const pollingTimeout = Math.ceil(memberCount * 0.05) + 5;
|
|
430
500
|
this.logger.debug(`Computed SourceMember polling timeout of ${pollingTimeout}s`);
|
|
431
|
-
return pollingTimeout;
|
|
501
|
+
return kit_1.Duration.seconds(pollingTimeout);
|
|
432
502
|
}
|
|
433
503
|
async querySourceMembersFrom({ fromRevision, quiet = false, useCache = true, } = {}) {
|
|
434
504
|
const rev = fromRevision != null ? fromRevision : this.getServerMaxRevision();
|
|
@@ -460,7 +530,7 @@ class RemoteSourceTrackingService extends core_1.ConfigFile {
|
|
|
460
530
|
this.logger.debug(query);
|
|
461
531
|
}
|
|
462
532
|
try {
|
|
463
|
-
const results = await this.org.getConnection().tooling.autoFetchQuery(query);
|
|
533
|
+
const results = await this.org.getConnection().tooling.autoFetchQuery(query, { maxFetch: 50000 });
|
|
464
534
|
return results.records;
|
|
465
535
|
}
|
|
466
536
|
catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sourceTrackingFileVersionMismatch": "This project uses the %s version of source tracking files.",
|
|
3
3
|
"clearSuggestion": "Clear the %s version of the tracking files by running '%s'",
|
|
4
|
-
"useOtherVersion": "Use the %s version of the command, '%s'
|
|
4
|
+
"useOtherVersion": "Use the %s version of the command, '%s' with your existing tracking files."
|
|
5
5
|
}
|
package/package.json
CHANGED