@salesforce/source-tracking 7.4.10-dev.0 → 7.5.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/lib/index.js +13 -4
- package/lib/shared/conflicts.js +13 -4
- package/lib/shared/functions.d.ts +3 -2
- package/lib/shared/functions.js +14 -6
- package/lib/shared/guards.d.ts +1 -3
- package/lib/shared/guards.js +14 -9
- package/lib/shared/local/functions.d.ts +0 -1
- package/lib/shared/local/functions.js +15 -8
- package/lib/shared/local/localShadowRepo.js +16 -31
- package/lib/shared/local/moveDetection.d.ts +1 -4
- package/lib/shared/local/moveDetection.js +18 -18
- package/lib/shared/local/types.js +13 -4
- package/lib/shared/localComponentSetArray.js +14 -5
- package/lib/shared/metadataKeys.d.ts +3 -3
- package/lib/shared/metadataKeys.js +25 -19
- package/lib/shared/populateFilePaths.js +13 -4
- package/lib/shared/populateTypesAndNames.js +13 -4
- package/lib/shared/remote/expectedSourceMembers.d.ts +3 -2
- package/lib/shared/remote/expectedSourceMembers.js +16 -6
- package/lib/shared/remote/fileOperations.d.ts +1 -2
- package/lib/shared/remote/fileOperations.js +50 -9
- package/lib/shared/remote/orgQueries.d.ts +0 -1
- package/lib/shared/remote/orgQueries.js +16 -8
- package/lib/shared/remote/remoteSourceTrackingService.d.ts +6 -4
- package/lib/shared/remote/remoteSourceTrackingService.js +75 -26
- package/lib/shared/remote/types.js +13 -4
- package/lib/shared/remoteChangeIgnoring.d.ts +2 -2
- package/lib/shared/remoteChangeIgnoring.js +5 -15
- package/lib/shared/types.d.ts +2 -1
- package/lib/shared/types.js +13 -4
- package/lib/sourceTracking.d.ts +2 -0
- package/lib/sourceTracking.js +56 -26
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -11
- package/LICENSE +0 -29
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { type RegistryAccess } from '@salesforce/source-deploy-retrieve';
|
|
2
|
+
import { type RemoteSyncInput } from '../types';
|
|
3
|
+
export declare const calculateExpectedSourceMembers: (registry: RegistryAccess, expectedMembers: RemoteSyncInput[]) => Map<string, RemoteSyncInput>;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the
|
|
6
|
-
*
|
|
3
|
+
* Copyright 2025, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
7
16
|
*/
|
|
8
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
18
|
exports.calculateExpectedSourceMembers = void 0;
|
|
@@ -49,8 +58,9 @@ const excludedKeys = [
|
|
|
49
58
|
'CustomTab###standard-mailapp',
|
|
50
59
|
'ApexEmailNotifications###apexEmailNotifications',
|
|
51
60
|
];
|
|
52
|
-
const calculateExpectedSourceMembers = (expectedMembers) => {
|
|
61
|
+
const calculateExpectedSourceMembers = (registry, expectedMembers) => {
|
|
53
62
|
const outstandingSourceMembers = new Map();
|
|
63
|
+
const getKeys = (0, metadataKeys_1.getMetadataKeyFromFileResponse)(registry);
|
|
54
64
|
expectedMembers
|
|
55
65
|
.filter((fileResponse) =>
|
|
56
66
|
// unchanged files will never be in the sourceMembers. Not really sure why SDR returns them.
|
|
@@ -75,7 +85,7 @@ const calculateExpectedSourceMembers = (expectedMembers) => {
|
|
|
75
85
|
!fileResponse.type.startsWith('Workflow') &&
|
|
76
86
|
!isSpecialAuraXml(fileResponse.filePath))
|
|
77
87
|
.map((member) => {
|
|
78
|
-
(
|
|
88
|
+
getKeys(member)
|
|
79
89
|
// remove some individual members known to not work with tracking even when their type does
|
|
80
90
|
.filter((key) =>
|
|
81
91
|
// CustomObject could have been re-added by the key generator from one of its fields
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RemoteChangeElement } from '../types';
|
|
2
|
-
import { ContentsV0, ContentsV1, MemberRevision
|
|
2
|
+
import { ContentsV0, ContentsV1, MemberRevision } from './types';
|
|
3
3
|
export declare const FILENAME = "maxRevision.json";
|
|
4
4
|
export declare const getFilePath: (orgId: string) => string;
|
|
5
5
|
export declare const readFileContents: (filePath: string) => Promise<ContentsV1 | Record<string, never>>;
|
|
@@ -10,4 +10,3 @@ export declare const writeTrackingFile: ({ filePath, maxCounter, members, }: {
|
|
|
10
10
|
maxCounter: number;
|
|
11
11
|
members: Map<string, MemberRevision>;
|
|
12
12
|
}) => Promise<void>;
|
|
13
|
-
export declare const toLegacyMemberRevision: ([, member]: [string, MemberRevision]) => [key: string, MemberRevisionLegacy];
|
|
@@ -1,17 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
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
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
39
|
+
exports.writeTrackingFile = exports.upgradeFileContents = exports.revisionToRemoteChangeElement = exports.readFileContents = exports.getFilePath = exports.FILENAME = void 0;
|
|
7
40
|
/*
|
|
8
|
-
* Copyright
|
|
9
|
-
*
|
|
10
|
-
* Licensed under the
|
|
11
|
-
*
|
|
41
|
+
* Copyright 2025, Salesforce, Inc.
|
|
42
|
+
*
|
|
43
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
44
|
+
* you may not use this file except in compliance with the License.
|
|
45
|
+
* You may obtain a copy of the License at
|
|
46
|
+
*
|
|
47
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
48
|
+
*
|
|
49
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
50
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
51
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
52
|
+
* See the License for the specific language governing permissions and
|
|
53
|
+
* limitations under the License.
|
|
12
54
|
*/
|
|
13
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
14
55
|
const node_path_1 = __importDefault(require("node:path"));
|
|
56
|
+
const fs = __importStar(require("graceful-fs"));
|
|
15
57
|
const kit_1 = require("@salesforce/kit");
|
|
16
58
|
const core_1 = require("@salesforce/core");
|
|
17
59
|
const functions_1 = require("../functions");
|
|
@@ -20,7 +62,7 @@ const getFilePath = (orgId) => node_path_1.default.join('.sf', 'orgs', orgId, ex
|
|
|
20
62
|
exports.getFilePath = getFilePath;
|
|
21
63
|
const readFileContents = async (filePath) => {
|
|
22
64
|
try {
|
|
23
|
-
const contents = await
|
|
65
|
+
const contents = await fs.promises.readFile(filePath, 'utf8');
|
|
24
66
|
const parsedContents = (0, kit_1.parseJsonMap)(contents, filePath);
|
|
25
67
|
if (parsedContents.fileVersion === 1) {
|
|
26
68
|
return parsedContents;
|
|
@@ -78,7 +120,7 @@ const writeTrackingFile = async ({ filePath, maxCounter, members, }) => {
|
|
|
78
120
|
: {
|
|
79
121
|
fileVersion: 0,
|
|
80
122
|
serverMaxRevisionCounter: maxCounter,
|
|
81
|
-
sourceMembers: Object.fromEntries(Array.from(members.entries()).map(
|
|
123
|
+
sourceMembers: Object.fromEntries(Array.from(members.entries()).map(toLegacyMemberRevision)),
|
|
82
124
|
};
|
|
83
125
|
await lockResult.writeAndUnlock(JSON.stringify(contents, null, 4));
|
|
84
126
|
};
|
|
@@ -92,5 +134,4 @@ const toLegacyMemberRevision = ([, member]) => [
|
|
|
92
134
|
isNameObsolete: member.IsNameObsolete,
|
|
93
135
|
},
|
|
94
136
|
];
|
|
95
|
-
exports.toLegacyMemberRevision = toLegacyMemberRevision;
|
|
96
137
|
//# sourceMappingURL=fileOperations.js.map
|
|
@@ -15,4 +15,3 @@ export declare const querySourceMembersFrom: ({ conn, fromRevision, queryCache,
|
|
|
15
15
|
/** if you don't pass in a logger, you get no log output */
|
|
16
16
|
logger?: PinoLogger;
|
|
17
17
|
}) => Promise<SourceMember[]>;
|
|
18
|
-
export declare const queryFn: (conn: Connection, query: string) => Promise<SourceMember[]>;
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.querySourceMembersFrom = exports.querySourceMembersTo = exports.calculateTimeout = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the
|
|
8
|
-
*
|
|
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.
|
|
9
18
|
*/
|
|
10
19
|
const core_1 = require("@salesforce/core");
|
|
11
20
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -27,7 +36,7 @@ exports.calculateTimeout = calculateTimeout;
|
|
|
27
36
|
/** exported only for spy/mock */
|
|
28
37
|
const querySourceMembersTo = async (conn, toRevision) => {
|
|
29
38
|
const query = `SELECT ${types_1.SOURCE_MEMBER_FIELDS.join(', ')} FROM SourceMember WHERE RevisionCounter <= ${toRevision}`;
|
|
30
|
-
return
|
|
39
|
+
return queryFn(conn, query);
|
|
31
40
|
};
|
|
32
41
|
exports.querySourceMembersTo = querySourceMembersTo;
|
|
33
42
|
const querySourceMembersFrom = async ({ conn, fromRevision, queryCache, userQueryCache, logger, }) => {
|
|
@@ -42,7 +51,7 @@ const querySourceMembersFrom = async ({ conn, fromRevision, queryCache, userQuer
|
|
|
42
51
|
// because `serverMaxRevisionCounter` is always updated, we need to select > to catch the most recent change
|
|
43
52
|
const query = `SELECT ${types_1.SOURCE_MEMBER_FIELDS.join(', ')} FROM SourceMember WHERE RevisionCounter > ${fromRevision}`;
|
|
44
53
|
logger?.debug(`Query: ${query}`);
|
|
45
|
-
const queryResult = await
|
|
54
|
+
const queryResult = await queryFn(conn, query);
|
|
46
55
|
if (userQueryCache) {
|
|
47
56
|
await updateCacheWithUnknownUsers(conn, queryResult, userQueryCache);
|
|
48
57
|
}
|
|
@@ -62,7 +71,6 @@ const queryFn = async (conn, query) => {
|
|
|
62
71
|
throw core_1.SfError.wrap(error);
|
|
63
72
|
}
|
|
64
73
|
};
|
|
65
|
-
exports.queryFn = queryFn;
|
|
66
74
|
/** A series of workarounds for server-side bugs. Each bug should be filed against a team, with a WI, so we know when these are fixed and can be removed */
|
|
67
75
|
const sourceMemberCorrections = (sourceMember) => {
|
|
68
76
|
if (sourceMember.MemberType === 'QuickActionDefinition') {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Logger, Org } from '@salesforce/core';
|
|
2
|
+
import { RegistryAccess } from '@salesforce/source-deploy-retrieve';
|
|
2
3
|
import { ChangeResult, RemoteChangeElement, RemoteSyncInput } from '../types';
|
|
3
4
|
export type PinoLogger = ReturnType<(typeof Logger)['getRawRootLogger']>;
|
|
4
5
|
/** Options for RemoteSourceTrackingService.getInstance */
|
|
5
|
-
|
|
6
|
+
type RemoteSourceTrackingServiceOptions = {
|
|
6
7
|
org: Org;
|
|
7
8
|
projectPath: string;
|
|
8
9
|
};
|
|
@@ -39,7 +40,7 @@ export declare class RemoteSourceTrackingService {
|
|
|
39
40
|
* pass in a series of SDR FilResponses .\
|
|
40
41
|
* it sets their last retrieved revision to the current revision counter from the server.
|
|
41
42
|
*/
|
|
42
|
-
syncSpecifiedElements(elements: RemoteSyncInput[]): Promise<void>;
|
|
43
|
+
syncSpecifiedElements(registry: RegistryAccess, elements: RemoteSyncInput[]): Promise<void>;
|
|
43
44
|
/**
|
|
44
45
|
* Resets source tracking state by first clearing all tracked data, then
|
|
45
46
|
* queries and synchronizes SourceMembers from the associated org.
|
|
@@ -66,7 +67,7 @@ export declare class RemoteSourceTrackingService {
|
|
|
66
67
|
* @param expectedMemberNames Array of metadata names to poll
|
|
67
68
|
* @param pollingTimeout maximum amount of time in seconds to poll for SourceMembers
|
|
68
69
|
*/
|
|
69
|
-
pollForSourceTracking(expectedMembers: RemoteSyncInput[]): Promise<void>;
|
|
70
|
+
pollForSourceTracking(registry: RegistryAccess, expectedMembers: RemoteSyncInput[]): Promise<void>;
|
|
70
71
|
/**
|
|
71
72
|
* Adds the given SourceMembers to the list of tracked MemberRevisions, optionally updating
|
|
72
73
|
* the lastRetrievedFromServer field (sync), and persists the changes to maxRevision.json.
|
|
@@ -82,4 +83,5 @@ export declare class RemoteSourceTrackingService {
|
|
|
82
83
|
* pass in an RCE, and this will return a pullable ChangeResult.
|
|
83
84
|
* Useful for correcing bundle types where the files show change results with types but aren't resolvable
|
|
84
85
|
*/
|
|
85
|
-
export declare const remoteChangeElementToChangeResult: (rce: RemoteChangeElement) => ChangeResult;
|
|
86
|
+
export declare const remoteChangeElementToChangeResult: (registry: RegistryAccess) => ((rce: RemoteChangeElement) => ChangeResult);
|
|
87
|
+
export {};
|
|
@@ -1,18 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the
|
|
6
|
-
*
|
|
3
|
+
* Copyright 2025, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
7
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
|
+
})();
|
|
8
50
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
51
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
52
|
};
|
|
11
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
54
|
exports.remoteChangeElementToChangeResult = exports.RemoteSourceTrackingService = void 0;
|
|
13
55
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
56
|
const node_os_1 = require("node:os");
|
|
57
|
+
const fs = __importStar(require("graceful-fs"));
|
|
16
58
|
const ts_retry_promise_1 = require("ts-retry-promise");
|
|
17
59
|
const core_1 = require("@salesforce/core");
|
|
18
60
|
const kit_1 = require("@salesforce/kit");
|
|
@@ -77,8 +119,8 @@ class RemoteSourceTrackingService {
|
|
|
77
119
|
static async delete(orgId) {
|
|
78
120
|
const fileToDelete = (0, fileOperations_1.getFilePath)(orgId);
|
|
79
121
|
// the file might not exist, in which case we don't need to delete it
|
|
80
|
-
if (
|
|
81
|
-
await
|
|
122
|
+
if (fs.existsSync(fileToDelete)) {
|
|
123
|
+
await fs.promises.unlink(fileToDelete);
|
|
82
124
|
}
|
|
83
125
|
return node_path_1.default.isAbsolute(fileToDelete) ? fileToDelete : node_path_1.default.join(process.cwd(), fileToDelete);
|
|
84
126
|
}
|
|
@@ -86,16 +128,18 @@ class RemoteSourceTrackingService {
|
|
|
86
128
|
* pass in a series of SDR FilResponses .\
|
|
87
129
|
* it sets their last retrieved revision to the current revision counter from the server.
|
|
88
130
|
*/
|
|
89
|
-
async syncSpecifiedElements(elements) {
|
|
131
|
+
async syncSpecifiedElements(registry, elements) {
|
|
90
132
|
if (elements.length === 0) {
|
|
91
133
|
return;
|
|
92
134
|
}
|
|
93
|
-
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);
|
|
94
138
|
quietLogger(`Syncing ${elements.length} Revisions by key`);
|
|
95
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
|
|
96
140
|
// any item in an aura/LWC bundle needs to represent the top (bundle) level and the file itself
|
|
97
141
|
// so we de-dupe via a set
|
|
98
|
-
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) => {
|
|
99
143
|
const revision = this.sourceMembers.get(metadataKey) ?? this.sourceMembers.get(decodeURI(metadataKey));
|
|
100
144
|
if (!revision) {
|
|
101
145
|
this.logger.warn(`found no matching revision for ${metadataKey}`);
|
|
@@ -178,14 +222,14 @@ class RemoteSourceTrackingService {
|
|
|
178
222
|
* @param expectedMemberNames Array of metadata names to poll
|
|
179
223
|
* @param pollingTimeout maximum amount of time in seconds to poll for SourceMembers
|
|
180
224
|
*/
|
|
181
|
-
async pollForSourceTracking(expectedMembers) {
|
|
225
|
+
async pollForSourceTracking(registry, expectedMembers) {
|
|
182
226
|
if (core_1.envVars.getBoolean('SF_DISABLE_SOURCE_MEMBER_POLLING')) {
|
|
183
227
|
return this.logger.warn('Not polling for SourceMembers since SF_DISABLE_SOURCE_MEMBER_POLLING = true.');
|
|
184
228
|
}
|
|
185
229
|
if (expectedMembers.length === 0) {
|
|
186
230
|
return;
|
|
187
231
|
}
|
|
188
|
-
const outstandingSourceMembers = (0, expectedSourceMembers_1.calculateExpectedSourceMembers)(expectedMembers);
|
|
232
|
+
const outstandingSourceMembers = (0, expectedSourceMembers_1.calculateExpectedSourceMembers)(registry, expectedMembers);
|
|
189
233
|
const originalOutstandingSize = outstandingSourceMembers.size;
|
|
190
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
|
|
191
235
|
let highestRevisionSoFar = this.serverMaxRevisionCounter;
|
|
@@ -293,7 +337,9 @@ ${formatSourceMemberWarnings(outstandingSourceMembers)}`),
|
|
|
293
337
|
if (sourceMembers.length === 0) {
|
|
294
338
|
return;
|
|
295
339
|
}
|
|
296
|
-
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);
|
|
297
343
|
quietLogger(`Upserting ${sourceMembers.length} SourceMembers to maxRevision.json`);
|
|
298
344
|
// Update the serverMaxRevisionCounter to the highest RevisionCounter
|
|
299
345
|
this.serverMaxRevisionCounter = Math.max(this.serverMaxRevisionCounter, ...sourceMembers.map((m) => m.RevisionCounter));
|
|
@@ -325,7 +371,7 @@ ${formatSourceMemberWarnings(outstandingSourceMembers)}`),
|
|
|
325
371
|
throw new core_1.SfError(messages.getMessage('NonSourceTrackedOrgError'), 'NonSourceTrackedOrgError');
|
|
326
372
|
}
|
|
327
373
|
this.logger = core_1.Logger.getRawRootLogger().child({ name: this.constructor.name });
|
|
328
|
-
if (
|
|
374
|
+
if (fs.existsSync(this.filePath)) {
|
|
329
375
|
// read the file contents and turn it into the map
|
|
330
376
|
const rawContents = await (0, fileOperations_1.readFileContents)(this.filePath);
|
|
331
377
|
if (rawContents.serverMaxRevisionCounter && rawContents.sourceMembers) {
|
|
@@ -361,18 +407,21 @@ exports.RemoteSourceTrackingService = RemoteSourceTrackingService;
|
|
|
361
407
|
* pass in an RCE, and this will return a pullable ChangeResult.
|
|
362
408
|
* Useful for correcing bundle types where the files show change results with types but aren't resolvable
|
|
363
409
|
*/
|
|
364
|
-
const remoteChangeElementToChangeResult = (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
})
|
|
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
|
+
};
|
|
376
425
|
exports.remoteChangeElementToChangeResult = remoteChangeElementToChangeResult;
|
|
377
426
|
/**
|
|
378
427
|
*
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the
|
|
6
|
-
*
|
|
3
|
+
* Copyright 2025, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
7
16
|
*/
|
|
8
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
18
|
exports.SOURCE_MEMBER_FIELDS = void 0;
|
|
@@ -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,25 +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 (c) 2023, salesforce.com, inc.
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
* Licensed under the BSD 3-Clause license.
|
|
8
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
-
*/
|
|
10
|
-
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
11
4
|
const sfError_1 = require("@salesforce/core/sfError");
|
|
12
5
|
const filePathGenerator_1 = require("@salesforce/source-deploy-retrieve/lib/src/utils/filePathGenerator");
|
|
13
6
|
const guards_1 = require("./guards");
|
|
14
7
|
const functions_1 = require("./functions");
|
|
15
|
-
const removeIgnored = (changeResults, forceIgnore, defaultPkgDir) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.filter((mc) => !(0, filePathGenerator_1.filePathsFromMetadataComponent)(mc, defaultPkgDir).some((0, functions_1.forceIgnoreDenies)(forceIgnore)))
|
|
21
|
-
.map(metadataComponentToMetadataMember);
|
|
22
|
-
};
|
|
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);
|
|
23
13
|
exports.removeIgnored = removeIgnored;
|
|
24
14
|
const metadataComponentToMetadataMember = (mc) => ({
|
|
25
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/shared/types.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the
|
|
6
|
-
*
|
|
3
|
+
* Copyright 2025, Salesforce, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
7
16
|
*/
|
|
8
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
18
|
exports.SourceConflictError = void 0;
|
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;
|