@salesforce/source-testkit 1.1.1 → 1.2.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 +18 -0
- package/lib/assertions.js +4 -9
- package/lib/autoFetchQuery.d.ts +3 -0
- package/lib/autoFetchQuery.js +29 -0
- package/lib/executionLog.js +4 -5
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.2.2](https://github.com/salesforcecli/source-testkit/compare/v1.2.1...v1.2.2) (2022-06-18)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- shared autoFetchQuery ([1c23a9f](https://github.com/salesforcecli/source-testkit/commit/1c23a9f84eaaa548558b4deb71ae621497a9e922))
|
|
10
|
+
|
|
11
|
+
### [1.2.1](https://github.com/salesforcecli/source-testkit/compare/v1.2.0...v1.2.1) (2022-06-18)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- remove autofetch queries that were set to 50k ([5854728](https://github.com/salesforcecli/source-testkit/commit/58547288360792b9ac2af11f4be4959c4828ede5))
|
|
16
|
+
|
|
17
|
+
## [1.2.0](https://github.com/salesforcecli/source-testkit/compare/v1.1.1...v1.2.0) (2022-06-08)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- bump core and regular testkit ([59701f8](https://github.com/salesforcecli/source-testkit/commit/59701f8da94028bc39fb34fc0ae2b0b32d582bef))
|
|
22
|
+
|
|
5
23
|
### [1.1.1](https://github.com/salesforcecli/source-testkit/compare/v1.1.0...v1.1.1) (2022-06-06)
|
|
6
24
|
|
|
7
25
|
### Bug Fixes
|
package/lib/assertions.js
CHANGED
|
@@ -15,6 +15,7 @@ const fg = require("fast-glob");
|
|
|
15
15
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
16
16
|
const debug_1 = require("debug");
|
|
17
17
|
const fileTracker_1 = require("./fileTracker");
|
|
18
|
+
const autoFetchQuery_1 = require("./autoFetchQuery");
|
|
18
19
|
(0, chai_1.use)(chaiEach);
|
|
19
20
|
/**
|
|
20
21
|
* Assertions is a class that is designed to encapsulate common assertions we want to
|
|
@@ -334,12 +335,8 @@ class Assertions {
|
|
|
334
335
|
(0, chai_1.expect)(someAreNotUpdated, 'expect some SourceMembers to not be updated').to.be.true;
|
|
335
336
|
}
|
|
336
337
|
async retrieveSourceMembers(globs, ignore = []) {
|
|
337
|
-
var _a;
|
|
338
338
|
const query = 'SELECT Id,MemberName,MemberType,RevisionCounter FROM SourceMember';
|
|
339
|
-
const result =
|
|
340
|
-
autoFetch: true,
|
|
341
|
-
maxFetch: 50000,
|
|
342
|
-
}));
|
|
339
|
+
const result = this.connection ? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.connection, true) : undefined;
|
|
343
340
|
const all = await this.doGlob(globs);
|
|
344
341
|
const ignoreFiles = await this.doGlob(ignore, false);
|
|
345
342
|
const toTrack = all.filter((file) => !ignoreFiles.includes(file));
|
|
@@ -365,15 +362,13 @@ class Assertions {
|
|
|
365
362
|
});
|
|
366
363
|
}
|
|
367
364
|
async retrieveApexTestResults() {
|
|
368
|
-
var _a;
|
|
369
365
|
const query = 'SELECT TestTimestamp, ApexClassId FROM ApexTestResult';
|
|
370
|
-
const result =
|
|
366
|
+
const result = this.connection ? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.connection, true) : undefined;
|
|
371
367
|
return (result === null || result === void 0 ? void 0 : result.records) || [];
|
|
372
368
|
}
|
|
373
369
|
async retrieveApexClasses(classNames) {
|
|
374
|
-
var _a;
|
|
375
370
|
const query = 'SELECT Name,Id FROM ApexClass';
|
|
376
|
-
const result =
|
|
371
|
+
const result = this.connection ? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.connection, true) : undefined;
|
|
377
372
|
const records = (result === null || result === void 0 ? void 0 : result.records) || [];
|
|
378
373
|
return classNames ? records.filter((r) => classNames.includes(r.Name)) : records;
|
|
379
374
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.autoFetchQuery = void 0;
|
|
10
|
+
const autoFetchQuery = async (query, conn, useTooling = false, maxFetch = 50000) => {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const records = [];
|
|
13
|
+
const res = (useTooling ? conn.tooling : conn)
|
|
14
|
+
.query(query)
|
|
15
|
+
.on('record', (rec) => records.push(rec))
|
|
16
|
+
.on('error', (err) => reject(err))
|
|
17
|
+
.on('end', () => {
|
|
18
|
+
var _a;
|
|
19
|
+
resolve({
|
|
20
|
+
done: true,
|
|
21
|
+
totalSize: (_a = res.totalSize) !== null && _a !== void 0 ? _a : 0,
|
|
22
|
+
records,
|
|
23
|
+
});
|
|
24
|
+
})
|
|
25
|
+
.run({ autoFetch: true, maxFetch });
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.autoFetchQuery = autoFetchQuery;
|
|
29
|
+
//# sourceMappingURL=autoFetchQuery.js.map
|
package/lib/executionLog.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ExecutionLog = void 0;
|
|
10
10
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
11
|
+
const autoFetchQuery_1 = require("./autoFetchQuery");
|
|
11
12
|
/**
|
|
12
13
|
* This class maintains a map of command execution history.
|
|
13
14
|
*
|
|
@@ -49,12 +50,10 @@ class ExecutionLog {
|
|
|
49
50
|
return sorted[0];
|
|
50
51
|
}
|
|
51
52
|
async querySourceMembers() {
|
|
52
|
-
var _a;
|
|
53
53
|
const query = 'SELECT Id,MemberName,MemberType,RevisionCounter FROM SourceMember';
|
|
54
|
-
const result =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}));
|
|
54
|
+
const result = this.context.connection
|
|
55
|
+
? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.context.connection, true)
|
|
56
|
+
: undefined;
|
|
58
57
|
return (result === null || result === void 0 ? void 0 : result.records) || [];
|
|
59
58
|
}
|
|
60
59
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/source-testkit",
|
|
3
3
|
"description": "testkit for running NUTs for source related commands",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"!lib/**/*.map"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@salesforce/cli-plugins-testkit": "^2.
|
|
34
|
-
"@salesforce/core": "^3.
|
|
33
|
+
"@salesforce/cli-plugins-testkit": "^2.2.0",
|
|
34
|
+
"@salesforce/core": "^3.20.1",
|
|
35
35
|
"@salesforce/kit": "^1.5.42",
|
|
36
36
|
"@salesforce/source-deploy-retrieve": "^6.0.2",
|
|
37
37
|
"@salesforce/ts-types": "^1.5.20",
|