Skip to content

Commit 341965a

Browse files
authored
Merge pull request #851 from salesforcecli/devScripts2024-03-04
refactor: devScripts update
2 parents fd1b837 + f6e64eb commit 341965a

File tree

6 files changed

+217
-260
lines changed

6 files changed

+217
-260
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"devDependencies": {
123123
"@oclif/plugin-command-snapshot": "^5.0.9",
124124
"@salesforce/cli-plugins-testkit": "^5.1.10",
125-
"@salesforce/dev-scripts": "^8.4.1",
125+
"@salesforce/dev-scripts": "^8.4.2",
126126
"@salesforce/plugin-command-reference": "^3.0.69",
127127
"@types/chai-as-promised": "^7.1.8",
128128
"chai-as-promised": "^7.1.1",

src/batcher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import { stringify } from 'csv-stringify/sync';
1414
import parse from 'csv-parse';
1515
import { Batch, BatchInfo, BulkIngestBatchResult, BulkOperation, Job, JobInfo } from 'jsforce/lib/api/bulk.js';
1616
// max rows per file in Bulk 1.0
17-
const BATCH_RECORDS_LIMIT = 10000;
17+
const BATCH_RECORDS_LIMIT = 10_000;
1818
/// max characters/bytes per file in Bulk 1.0
19-
const BATCH_BYTES_LIMIT = 10000000;
19+
const BATCH_BYTES_LIMIT = 10_000_000;
2020
const POLL_FREQUENCY_MS = 5000;
2121

2222
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
@@ -272,7 +272,7 @@ export class Batcher {
272272
overallInfo = true;
273273
}
274274
this.ux.log(messages.getMessage('BatchQueued', [batchNum, batchInfo.id]));
275-
newBatch.poll(POLL_FREQUENCY_MS, waitMins * 60000);
275+
newBatch.poll(POLL_FREQUENCY_MS, waitMins * 60_000);
276276
}
277277
);
278278
// we're using an async method on an event listener which doesn't fit the .on method parameter types

src/bulkDataRequestCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export abstract class BulkDataRequestCache extends TTLConfig<TTLConfig.Options,
7171
const key = this.getLatestKey();
7272
if (key) {
7373
// key definitely exists because it came from the cache
74-
const entry = this.get(key)!;
74+
const entry = this.get(key);
7575

7676
return {
7777
jobInfo: { id: entry.jobId },

test/commands/batcher.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,27 @@ describe('batcher', () => {
9898
});
9999
it('Should create another batch after 10000 records', async () => {
100100
inStream.push(`name , field1, field2${os.EOL}`);
101-
for (let i = 0; i < 10005; i++) {
101+
for (let i = 0; i < 10_005; i++) {
102102
inStream.push(`obj1,val1,val2${os.EOL}`);
103103
}
104104
inStream.push(null);
105105
const batches = splitIntoBatches(inStream);
106106
const result = await batches;
107107
expect(result.length).to.equal(2);
108-
expect(result[0].length).to.equal(10000);
108+
expect(result[0].length).to.equal(10_000);
109109
expect(result[1].length).to.equal(5);
110110
expect(exitSpy.notCalled).to.equal(true);
111111
});
112112
it('Should not create another batch for exactly 10000 records', async () => {
113113
inStream.push(`name , field1, field2${os.EOL}`);
114-
for (let i = 0; i < 10000; i++) {
114+
for (let i = 0; i < 10_000; i++) {
115115
inStream.push(`obj1,val1,val2${os.EOL}`);
116116
}
117117
inStream.push(null);
118118
const batches = splitIntoBatches(inStream);
119119
const result = await batches;
120120
expect(result.length).to.equal(1);
121-
expect(result[0].length).to.equal(10000);
121+
expect(result[0].length).to.equal(10_000);
122122
expect(exitSpy.notCalled).to.equal(true);
123123
});
124124
it('Should create another batch after 10MB of data', async () => {

test/test-files/soqlQuery.exemplars.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ export const soqlQueryExemplars = {
13981398
type: 'AggregateResult',
13991399
},
14001400
Name: 'Edge Communications',
1401-
expr0: 139000000,
1401+
expr0: 139_000_000,
14021402
},
14031403
{
14041404
attributes: {
@@ -1412,28 +1412,28 @@ export const soqlQueryExemplars = {
14121412
type: 'AggregateResult',
14131413
},
14141414
Name: 'United Oil & Gas Corp.',
1415-
expr0: 5600000000,
1415+
expr0: 5_600_000_000,
14161416
},
14171417
{
14181418
attributes: {
14191419
type: 'AggregateResult',
14201420
},
14211421
Name: 'Pyramid Construction Inc.',
1422-
expr0: 950000000,
1422+
expr0: 950_000_000,
14231423
},
14241424
{
14251425
attributes: {
14261426
type: 'AggregateResult',
14271427
},
14281428
Name: 'Grand Hotels & Resorts Ltd',
1429-
expr0: 500000000,
1429+
expr0: 500_000_000,
14301430
},
14311431
{
14321432
attributes: {
14331433
type: 'AggregateResult',
14341434
},
14351435
Name: 'Dickenson plc',
1436-
expr0: 50000000,
1436+
expr0: 50_000_000,
14371437
},
14381438
{
14391439
attributes: {
@@ -1447,7 +1447,7 @@ export const soqlQueryExemplars = {
14471447
type: 'AggregateResult',
14481448
},
14491449
Name: 'Burlington Textiles Corp of America',
1450-
expr0: 350000000,
1450+
expr0: 350_000_000,
14511451
},
14521452
{
14531453
attributes: {
@@ -1468,14 +1468,14 @@ export const soqlQueryExemplars = {
14681468
type: 'AggregateResult',
14691469
},
14701470
Name: 'Express Logistics and Transport',
1471-
expr0: 950000000,
1471+
expr0: 950_000_000,
14721472
},
14731473
{
14741474
attributes: {
14751475
type: 'AggregateResult',
14761476
},
14771477
Name: 'GenePoint',
1478-
expr0: 30000000,
1478+
expr0: 30_000_000,
14791479
},
14801480
{
14811481
attributes: {
@@ -2189,7 +2189,7 @@ export const soqlQueryExemplars = {
21892189
type: 'AggregateResult',
21902190
},
21912191
Name: 'Edge Communications',
2192-
expr0: 139000000,
2192+
expr0: 139_000_000,
21932193
},
21942194
{
21952195
attributes: {
@@ -2203,28 +2203,28 @@ export const soqlQueryExemplars = {
22032203
type: 'AggregateResult',
22042204
},
22052205
Name: 'United Oil & Gas Corp.',
2206-
expr0: 5600000000,
2206+
expr0: 5_600_000_000,
22072207
},
22082208
{
22092209
attributes: {
22102210
type: 'AggregateResult',
22112211
},
22122212
Name: 'Pyramid Construction Inc.',
2213-
expr0: 950000000,
2213+
expr0: 950_000_000,
22142214
},
22152215
{
22162216
attributes: {
22172217
type: 'AggregateResult',
22182218
},
22192219
Name: 'Grand Hotels & Resorts Ltd',
2220-
expr0: 500000000,
2220+
expr0: 500_000_000,
22212221
},
22222222
{
22232223
attributes: {
22242224
type: 'AggregateResult',
22252225
},
22262226
Name: 'Dickenson plc',
2227-
expr0: 50000000,
2227+
expr0: 50_000_000,
22282228
},
22292229
{
22302230
attributes: {
@@ -2238,7 +2238,7 @@ export const soqlQueryExemplars = {
22382238
type: 'AggregateResult',
22392239
},
22402240
Name: 'Burlington Textiles Corp of America',
2241-
expr0: 350000000,
2241+
expr0: 350_000_000,
22422242
},
22432243
{
22442244
attributes: {
@@ -2259,14 +2259,14 @@ export const soqlQueryExemplars = {
22592259
type: 'AggregateResult',
22602260
},
22612261
Name: 'Express Logistics and Transport',
2262-
expr0: 950000000,
2262+
expr0: 950_000_000,
22632263
},
22642264
{
22652265
attributes: {
22662266
type: 'AggregateResult',
22672267
},
22682268
Name: 'GenePoint',
2269-
expr0: 30000000,
2269+
expr0: 30_000_000,
22702270
},
22712271
{
22722272
attributes: {

0 commit comments

Comments
 (0)