@salesforce/source-testkit 1.2.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 +6 -0
- package/lib/assertions.js +4 -7
- package/lib/autoFetchQuery.d.ts +3 -0
- package/lib/autoFetchQuery.js +29 -0
- package/lib/executionLog.js +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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
|
+
|
|
5
11
|
### [1.2.1](https://github.com/salesforcecli/source-testkit/compare/v1.2.0...v1.2.1) (2022-06-18)
|
|
6
12
|
|
|
7
13
|
### Bug Fixes
|
package/lib/assertions.js
CHANGED
|
@@ -15,8 +15,8 @@ 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
|
-
const SOQL_QUERY_LIMIT = 50000;
|
|
20
20
|
/**
|
|
21
21
|
* Assertions is a class that is designed to encapsulate common assertions we want to
|
|
22
22
|
* make during NUT testings
|
|
@@ -335,9 +335,8 @@ class Assertions {
|
|
|
335
335
|
(0, chai_1.expect)(someAreNotUpdated, 'expect some SourceMembers to not be updated').to.be.true;
|
|
336
336
|
}
|
|
337
337
|
async retrieveSourceMembers(globs, ignore = []) {
|
|
338
|
-
var _a;
|
|
339
338
|
const query = 'SELECT Id,MemberName,MemberType,RevisionCounter FROM SourceMember';
|
|
340
|
-
const result =
|
|
339
|
+
const result = this.connection ? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.connection, true) : undefined;
|
|
341
340
|
const all = await this.doGlob(globs);
|
|
342
341
|
const ignoreFiles = await this.doGlob(ignore, false);
|
|
343
342
|
const toTrack = all.filter((file) => !ignoreFiles.includes(file));
|
|
@@ -363,15 +362,13 @@ class Assertions {
|
|
|
363
362
|
});
|
|
364
363
|
}
|
|
365
364
|
async retrieveApexTestResults() {
|
|
366
|
-
var _a;
|
|
367
365
|
const query = 'SELECT TestTimestamp, ApexClassId FROM ApexTestResult';
|
|
368
|
-
const result =
|
|
366
|
+
const result = this.connection ? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.connection, true) : undefined;
|
|
369
367
|
return (result === null || result === void 0 ? void 0 : result.records) || [];
|
|
370
368
|
}
|
|
371
369
|
async retrieveApexClasses(classNames) {
|
|
372
|
-
var _a;
|
|
373
370
|
const query = 'SELECT Name,Id FROM ApexClass';
|
|
374
|
-
const result =
|
|
371
|
+
const result = this.connection ? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.connection, true) : undefined;
|
|
375
372
|
const records = (result === null || result === void 0 ? void 0 : result.records) || [];
|
|
376
373
|
return classNames ? records.filter((r) => classNames.includes(r.Name)) : records;
|
|
377
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,9 +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 =
|
|
54
|
+
const result = this.context.connection
|
|
55
|
+
? await (0, autoFetchQuery_1.autoFetchQuery)(query, this.context.connection, true)
|
|
56
|
+
: undefined;
|
|
55
57
|
return (result === null || result === void 0 ? void 0 : result.records) || [];
|
|
56
58
|
}
|
|
57
59
|
}
|
package/package.json
CHANGED