@salesforce/source-tracking 0.4.2 → 0.4.3
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 +13 -0
- package/lib/shared/guards.d.ts +2 -1
- package/lib/shared/guards.js +5 -1
- package/lib/sourceTracking.d.ts +2 -0
- package/lib/sourceTracking.js +25 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
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
|
+
### [0.4.3](https://github.com/forcedotcom/source-tracking/compare/v0.4.2...v0.4.3) (2021-11-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* emit warnings for types not pulled ([fdeabbf](https://github.com/forcedotcom/source-tracking/commit/fdeabbfb11bb4ba1fd17931adedc49f9cb5ae658))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* don't pull remote changes where type isn't in SDR registry ([46250ee](https://github.com/forcedotcom/source-tracking/commit/46250eef09e29dfa0d06af984bbfcc3e88765968))
|
|
16
|
+
* don't pull things not in the registry ([38136bb](https://github.com/forcedotcom/source-tracking/commit/38136bbbf1e44c8e58bc06621957819913273b4e))
|
|
17
|
+
|
|
5
18
|
### [0.4.2](https://github.com/forcedotcom/source-tracking/compare/v0.4.1...v0.4.2) (2021-10-28)
|
|
6
19
|
|
|
7
20
|
### [0.4.1](https://github.com/forcedotcom/source-tracking/compare/v0.4.0...v0.4.1) (2021-10-28)
|
package/lib/shared/guards.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { SourceComponent } from '@salesforce/source-deploy-retrieve';
|
|
1
|
+
import { SourceComponent, MetadataMember } from '@salesforce/source-deploy-retrieve';
|
|
2
2
|
export declare const stringGuard: (input: string | undefined) => input is string;
|
|
3
3
|
export declare const sourceComponentGuard: (input: SourceComponent | undefined) => input is SourceComponent;
|
|
4
|
+
export declare const metadataMemberGuard: (input: MetadataMember | undefined) => input is MetadataMember;
|
package/lib/shared/guards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sourceComponentGuard = exports.stringGuard = void 0;
|
|
3
|
+
exports.metadataMemberGuard = exports.sourceComponentGuard = exports.stringGuard = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
6
|
* All rights reserved.
|
|
@@ -16,4 +16,8 @@ const sourceComponentGuard = (input) => {
|
|
|
16
16
|
return input instanceof source_deploy_retrieve_1.SourceComponent;
|
|
17
17
|
};
|
|
18
18
|
exports.sourceComponentGuard = sourceComponentGuard;
|
|
19
|
+
const metadataMemberGuard = (input) => {
|
|
20
|
+
return input !== undefined && typeof input.fullName === 'string' && typeof input.type === 'string';
|
|
21
|
+
};
|
|
22
|
+
exports.metadataMemberGuard = metadataMemberGuard;
|
|
19
23
|
//# sourceMappingURL=guards.js.map
|
package/lib/sourceTracking.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class SourceTracking extends AsyncCreatable {
|
|
|
21
21
|
private packagesDirs;
|
|
22
22
|
private username;
|
|
23
23
|
private logger;
|
|
24
|
+
private registry;
|
|
24
25
|
private localRepo;
|
|
25
26
|
private remoteSourceTrackingService;
|
|
26
27
|
private forceIgnore;
|
|
@@ -107,6 +108,7 @@ export declare class SourceTracking extends AsyncCreatable {
|
|
|
107
108
|
*/
|
|
108
109
|
private populateTypesAndNames;
|
|
109
110
|
private getLocalStatusRows;
|
|
111
|
+
private registrySupportsType;
|
|
110
112
|
/**
|
|
111
113
|
* uses SDR to translate remote metadata records into local file paths
|
|
112
114
|
*/
|
package/lib/sourceTracking.js
CHANGED
|
@@ -28,6 +28,7 @@ const functions_1 = require("./shared/functions");
|
|
|
28
28
|
class SourceTracking extends kit_1.AsyncCreatable {
|
|
29
29
|
constructor(options) {
|
|
30
30
|
super(options);
|
|
31
|
+
this.registry = new source_deploy_retrieve_1.RegistryAccess();
|
|
31
32
|
this.orgId = options.org.getOrgId();
|
|
32
33
|
this.username = options.org.getUsername();
|
|
33
34
|
this.projectPath = options.project.getPath();
|
|
@@ -147,7 +148,10 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
147
148
|
await this.ensureRemoteTracking();
|
|
148
149
|
const remoteChanges = await this.remoteSourceTrackingService.retrieveUpdates();
|
|
149
150
|
this.logger.debug('remoteChanges', remoteChanges);
|
|
150
|
-
const filteredChanges = remoteChanges
|
|
151
|
+
const filteredChanges = remoteChanges
|
|
152
|
+
.filter(remoteFilterByState[options.state])
|
|
153
|
+
// skip any remote types not in the registry. Will emit node warnings
|
|
154
|
+
.filter((rce) => this.registrySupportsType(rce.type));
|
|
151
155
|
if (options.format === 'ChangeResult') {
|
|
152
156
|
return filteredChanges.map((change) => (0, remoteSourceTrackingService_1.remoteChangeElementToChangeResult)(change));
|
|
153
157
|
}
|
|
@@ -456,6 +460,13 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
456
460
|
results = results.concat(localAdds.flatMap((item) => this.localChangesToOutputRow(item, 'add')), localModifies.flatMap((item) => this.localChangesToOutputRow(item, 'modify')), localDeletes.flatMap((item) => this.localChangesToOutputRow(item, 'delete')));
|
|
457
461
|
return results;
|
|
458
462
|
}
|
|
463
|
+
registrySupportsType(type) {
|
|
464
|
+
if (this.registry.findType((metadataType) => metadataType.name === type)) {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
process.emitWarning(`Unable to find type ${type} in registry`);
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
459
470
|
/**
|
|
460
471
|
* uses SDR to translate remote metadata records into local file paths
|
|
461
472
|
*/
|
|
@@ -464,12 +475,19 @@ class SourceTracking extends kit_1.AsyncCreatable {
|
|
|
464
475
|
return [];
|
|
465
476
|
}
|
|
466
477
|
this.logger.debug('populateFilePaths for change elements', elements);
|
|
467
|
-
// component set generated from an array of
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
478
|
+
// component set generated from an array of MetadataMember from all the remote changes
|
|
479
|
+
// but exclude the ones that aren't in the registry
|
|
480
|
+
const remoteChangesAsMetadataMember = elements
|
|
481
|
+
.map((element) => {
|
|
482
|
+
if (typeof element.type === 'string' && typeof element.name === 'string') {
|
|
483
|
+
return {
|
|
484
|
+
type: element.type,
|
|
485
|
+
fullName: element.name,
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
})
|
|
489
|
+
.filter(guards_1.metadataMemberGuard);
|
|
490
|
+
const remoteChangesAsComponentSet = new source_deploy_retrieve_1.ComponentSet(remoteChangesAsMetadataMember);
|
|
473
491
|
this.logger.debug(` the generated component set has ${remoteChangesAsComponentSet.size.toString()} items`);
|
|
474
492
|
if (remoteChangesAsComponentSet.size < elements.length) {
|
|
475
493
|
// iterate the elements to see which ones didn't make it into the component set
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/source-tracking",
|
|
3
3
|
"description": "API for tracking local and remote Salesforce metadata changes",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"sinon": "^10.0.0",
|
|
86
86
|
"ts-node": "^10.1.0",
|
|
87
87
|
"ts-prune": "^0.10.0",
|
|
88
|
-
"typescript": "^4.
|
|
88
|
+
"typescript": "^4.4.4"
|
|
89
89
|
},
|
|
90
90
|
"oclif": {
|
|
91
91
|
"commands": "./lib/commands",
|