@simplysf/simply-data 1.3.1 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [1.4.0](https://github.com/SimplySF/simply-data/compare/1.3.1...1.4.0) (2024-05-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * add download files ([96b84cc](https://github.com/SimplySF/simply-data/commit/96b84cc7e291d186372c07ab98b932ae985c48cd))
7
+
8
+
9
+
1
10
  ## [1.3.1](https://github.com/SimplySF/simply-data/compare/1.3.0...1.3.1) (2024-05-04)
2
11
 
3
12
 
package/README.md CHANGED
@@ -57,6 +57,7 @@ sf plugins
57
57
 
58
58
  <!-- commands -->
59
59
  * [`sf simply data file upload`](#sf-simply-data-file-upload)
60
+ * [`sf simply data files download`](#sf-simply-data-files-download)
60
61
  * [`sf simply data files upload`](#sf-simply-data-files-upload)
61
62
 
62
63
  ## `sf simply data file upload`
@@ -91,7 +92,52 @@ EXAMPLES
91
92
  $ sf simply data file upload --file-path fileToUpload.txt --first-publish-location-id 0019000000DmehK --target-org myTargetOrg
92
93
  ```
93
94
 
94
- _See code: [src/commands/simply/data/file/upload.ts](https://github.com/SimplySF/simply-data/blob/1.3.1/src/commands/simply/data/file/upload.ts)_
95
+ _See code: [src/commands/simply/data/file/upload.ts](https://github.com/SimplySF/simply-data/blob/1.4.0/src/commands/simply/data/file/upload.ts)_
96
+
97
+ ## `sf simply data files download`
98
+
99
+ Download files from a Salesforce org.
100
+
101
+ ```
102
+ USAGE
103
+ $ sf simply data files download -o <value> --where-content-version <value> [--json] [--flags-dir <value>] [--api-version
104
+ <value>] [--max-parallel-jobs <value>]
105
+
106
+ FLAGS
107
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
108
+ configuration variable is already set.
109
+ --api-version=<value> Override the api version used for api requests made by this command
110
+ --max-parallel-jobs=<value> [default: 1] Maximum number of parallel jobs.
111
+ --where-content-version=<value> (required) WHERE clause for ContentVersion query.
112
+
113
+ GLOBAL FLAGS
114
+ --flags-dir=<value> Import flag values from a directory.
115
+ --json Format output as json.
116
+
117
+ DESCRIPTION
118
+ Download files from a Salesforce org.
119
+
120
+ Downloads files specified by a where clause for a ContentVersion query from a Salesforce org. By default, the plugin
121
+ uses the REST API for the download as to allow for the streaming of large files without issue. This means that each
122
+ file will use one REST API request.
123
+
124
+ EXAMPLES
125
+ $ sf simply data files download --where-content-version "IsLatest=true" --target-org myTargetOrg
126
+
127
+ $ sf simply data files download --where-content-version "IsLatest=true" --max-parallel-jobs 5 --target-org myTargetOrg
128
+
129
+ FLAG DESCRIPTIONS
130
+ --max-parallel-jobs=<value> Maximum number of parallel jobs.
131
+
132
+ By default the plugin will only process a single file download at a time. You can increase this value to allow for
133
+ quasi concurrent downloads. Please note that setting this value too high can cause performance issues.
134
+
135
+ --where-content-version=<value> WHERE clause for ContentVersion query.
136
+
137
+ Provide a WHERE clause to allow the plugin to specify which ContentVersion records should be downloaded.
138
+ ```
139
+
140
+ _See code: [src/commands/simply/data/files/download.ts](https://github.com/SimplySF/simply-data/blob/1.4.0/src/commands/simply/data/files/download.ts)_
95
141
 
96
142
  ## `sf simply data files upload`
97
143
 
@@ -136,5 +182,5 @@ FLAG DESCRIPTIONS
136
182
  quasi concurrent uploads. Please note that setting this value too high can cause performance issues.
137
183
  ```
138
184
 
139
- _See code: [src/commands/simply/data/files/upload.ts](https://github.com/SimplySF/simply-data/blob/1.3.1/src/commands/simply/data/files/upload.ts)_
185
+ _See code: [src/commands/simply/data/files/upload.ts](https://github.com/SimplySF/simply-data/blob/1.4.0/src/commands/simply/data/files/upload.ts)_
140
186
  <!-- commandsstop -->
@@ -0,0 +1,14 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export default class DataFilesDownload extends SfCommand<void> {
3
+ static readonly summary: string;
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ 'api-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
8
+ 'max-parallel-jobs': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<number, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
+ 'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
+ 'where-content-version': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
11
+ 'flags-dir': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Copyright (c) 2024, Clay Chipps; Copyright (c) 2024, Salesforce.com, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import fs from 'node:fs';
8
+ import { createObjectCsvWriter } from 'csv-writer';
9
+ import PQueue from 'p-queue';
10
+ import { Messages } from '@salesforce/core';
11
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
12
+ import { downloadContentVersion } from '../../../../common/contentVersionUtils.js';
13
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
14
+ const messages = Messages.loadMessages('@simplysf/simply-data', 'simply.data.files.download');
15
+ export default class DataFilesDownload extends SfCommand {
16
+ static summary = messages.getMessage('summary');
17
+ static description = messages.getMessage('description');
18
+ static examples = messages.getMessages('examples');
19
+ static flags = {
20
+ ...SfCommand.baseFlags,
21
+ 'api-version': Flags.orgApiVersion(),
22
+ 'max-parallel-jobs': Flags.integer({
23
+ summary: messages.getMessage('flags.max-parallel-jobs.summary'),
24
+ description: messages.getMessage('flags.max-parallel-jobs.description'),
25
+ default: 1,
26
+ }),
27
+ 'target-org': Flags.requiredOrg(),
28
+ 'where-content-version': Flags.string({
29
+ summary: messages.getMessage('flags.where-content-version.summary'),
30
+ description: messages.getMessage('flags.where-content-version.description'),
31
+ required: true,
32
+ }),
33
+ };
34
+ async run() {
35
+ const { flags } = await this.parse(DataFilesDownload);
36
+ // Authorize to the target org
37
+ const targetOrgConnection = flags['target-org']?.getConnection(flags['api-version']);
38
+ if (!targetOrgConnection) {
39
+ throw messages.createError('error.targetOrgConnectionFailed');
40
+ }
41
+ this.spinner.start('Querying for files', '\n', { stdout: true });
42
+ const result = await targetOrgConnection.query(`SELECT ContentDocumentId, ContentSize, Description, FileExtension, FileType, FirstPublishLocationId, Id, IsLatest, PathOnClient, Title FROM ContentVersion WHERE ${flags['where-content-version']}`, {
43
+ autoFetch: true,
44
+ maxFetch: this.configAggregator.getInfo('org-max-query-limit').value ?? 50_000,
45
+ scanAll: false,
46
+ });
47
+ const contentVersionDownloads = result.records;
48
+ this.spinner.start('Initializing file download', '\n', { stdout: true });
49
+ if (!fs.existsSync('download')) {
50
+ fs.mkdirSync('download');
51
+ }
52
+ const successWriter = createObjectCsvWriter({
53
+ path: 'download/success.csv',
54
+ header: [
55
+ { id: 'Id', title: 'Id' },
56
+ { id: 'ContentDocumentId', title: 'ContentDocumentId' },
57
+ { id: 'ContentSize', title: 'ContentSize' },
58
+ { id: 'Description', title: 'Description' },
59
+ { id: 'FileExtension', title: 'FileExtension' },
60
+ { id: 'FileType', title: 'FileType' },
61
+ { id: 'FirstPublishLocationId', title: 'FirstPublishLocationId' },
62
+ { id: 'IsLatest', title: 'IsLatest' },
63
+ { id: 'PathOnClient', title: 'PathOnClient' },
64
+ { id: 'Title', title: 'Title' },
65
+ { id: 'FilePath', title: 'FilePath' },
66
+ ],
67
+ });
68
+ const errorWriter = createObjectCsvWriter({
69
+ path: 'download/error.csv',
70
+ header: [
71
+ { id: 'Id', title: 'Id' },
72
+ { id: 'ContentDocumentId', title: 'ContentDocumentId' },
73
+ { id: 'ContentSize', title: 'ContentSize' },
74
+ { id: 'Description', title: 'Description' },
75
+ { id: 'FileExtension', title: 'FileExtension' },
76
+ { id: 'FileType', title: 'FileType' },
77
+ { id: 'FirstPublishLocationId', title: 'FirstPublishLocationId' },
78
+ { id: 'IsLatest', title: 'IsLatest' },
79
+ { id: 'PathOnClient', title: 'PathOnClient' },
80
+ { id: 'Title', title: 'Title' },
81
+ { id: 'Error', title: 'Error' },
82
+ ],
83
+ });
84
+ this.spinner.start('Downloading files', '\n', { stdout: true });
85
+ const downloadQueue = new PQueue({ concurrency: flags['max-parallel-jobs'] });
86
+ let count = 0;
87
+ downloadQueue.on('add', () => {
88
+ this.spinner.status = `Completed: ${count}. Size: ${downloadQueue.size} Pending: ${downloadQueue.pending}\n`;
89
+ });
90
+ downloadQueue.on('completed', () => {
91
+ count++;
92
+ this.spinner.status = `Completed: ${count}. Size: ${downloadQueue.size} Pending: ${downloadQueue.pending}\n`;
93
+ });
94
+ for await (const contentVersionDownload of contentVersionDownloads) {
95
+ void downloadQueue.add(async () => {
96
+ try {
97
+ contentVersionDownload.FilePath = await downloadContentVersion(targetOrgConnection, contentVersionDownload, 'download');
98
+ await successWriter.writeRecords([contentVersionDownload]);
99
+ }
100
+ catch (error) {
101
+ contentVersionDownload.Error = error;
102
+ await errorWriter.writeRecords([contentVersionDownload]);
103
+ }
104
+ });
105
+ }
106
+ await downloadQueue.onIdle();
107
+ this.spinner.stop();
108
+ }
109
+ }
110
+ //# sourceMappingURL=download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.js","sourceRoot":"","sources":["../../../../../src/commands/simply/data/files/download.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC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,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC"}
@@ -40,8 +40,11 @@ export default class DataFilesUpload extends SfCommand {
40
40
  throw messages.createError('error.targetOrgConnectionFailed');
41
41
  }
42
42
  this.spinner.start('Initializing file upload', '\n', { stdout: true });
43
+ if (!fs.existsSync('upload')) {
44
+ fs.mkdirSync('upload');
45
+ }
43
46
  const successWriter = createObjectCsvWriter({
44
- path: 'success.csv',
47
+ path: 'upload/success.csv',
45
48
  header: [
46
49
  { id: 'PathOnClient', title: 'PathOnClient' },
47
50
  { id: 'Title', title: 'Title' },
@@ -50,7 +53,7 @@ export default class DataFilesUpload extends SfCommand {
50
53
  ],
51
54
  });
52
55
  const errorWriter = createObjectCsvWriter({
53
- path: 'error.csv',
56
+ path: 'upload/error.csv',
54
57
  header: [
55
58
  { id: 'PathOnClient', title: 'PathOnClient' },
56
59
  { id: 'Title', title: 'Title' },
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../../src/commands/simply/data/files/upload.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAC;AAE5F,MAAM,CAAC,OAAO,OAAO,eAAgB,SA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BAChE,IAAI,CAAC;oBACH,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAC/C,mBAAmB,EACnB,sBAAsB,CAAC,YAAY,EACnC,sBAAsB,CAAC,KAAK,EAC5B,sBAAsB,CAAC,sBAAsB,CAC9C,CAAC;oBACF,sBAAsB,CAAC,iBAAiB,GAAG,cAAc,CAAC,iBAAiB,CAAC;oBAC5E,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC;gBAC7D,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,sBAAsB,CAAC,KAAK,GAAG,KAAe,CAAC;oBAC/C,MAAM,WAAW,CAAC,YAAY,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,SAAS,CAAC,MAAM,EAAE,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC"}
@@ -1,21 +1,31 @@
1
- export interface ContentVersion {
2
- ContentDocumentId?: string;
1
+ export type ContentVersion = {
2
+ ContentDocumentId: string;
3
+ ContentSize: string;
4
+ Description: string;
3
5
  FileExtension: string;
6
+ FileType: string;
7
+ FirstPublishLocationId: string;
4
8
  Id: string;
9
+ IsLatest: string;
10
+ PathOnClient: string;
5
11
  Title: string;
6
- }
7
- export interface ContentVersionCreateRequest {
12
+ };
13
+ export type ContentVersionCreateRequest = {
8
14
  FirstPublishLocationId?: string;
9
15
  PathOnClient: string;
10
16
  Title?: string;
11
- }
12
- export interface ContentVersionCreateResult {
17
+ };
18
+ export type ContentVersionCreateResult = {
13
19
  id: string;
14
20
  success: boolean;
15
21
  errors: string[];
16
22
  name: string;
17
23
  message: string;
18
- }
24
+ };
25
+ export type ContentVersionDownload = ContentVersion & {
26
+ Error?: string;
27
+ FilePath?: string;
28
+ };
19
29
  export type ContentVersionToUpload = {
20
30
  ContentDocumentId?: string;
21
31
  Error?: string;
@@ -1,3 +1,4 @@
1
1
  import { Connection } from '@salesforce/core';
2
- import { ContentVersion } from './contentVersionTypes.js';
2
+ import { ContentVersion, ContentVersionDownload } from './contentVersionTypes.js';
3
+ export declare function downloadContentVersion(targetOrgConnection: Connection, contentVersionDownload: ContentVersionDownload, downloadDirectory: string): Promise<string>;
3
4
  export declare function uploadContentVersion(targetOrgConnection: Connection, pathOnClient: string, title?: string, firstPublishLocationId?: string): Promise<ContentVersion>;
@@ -6,8 +6,18 @@
6
6
  */
7
7
  import fs from 'node:fs';
8
8
  import path from 'node:path';
9
+ import stream from 'node:stream';
9
10
  import FormData from 'form-data';
10
11
  import got from 'got';
12
+ export async function downloadContentVersion(targetOrgConnection, contentVersionDownload, downloadDirectory) {
13
+ const filePath = `${downloadDirectory}/${contentVersionDownload.ContentDocumentId}_${contentVersionDownload.Title.replaceAll(' ', '_')}.${contentVersionDownload.FileExtension}`;
14
+ await stream.promises.pipeline(got.stream(`${targetOrgConnection.baseUrl()}/sobjects/ContentVersion/${contentVersionDownload.Id}/VersionData`, {
15
+ headers: {
16
+ Authorization: `Bearer ${targetOrgConnection.accessToken}`,
17
+ },
18
+ }), fs.createWriteStream(filePath));
19
+ return filePath;
20
+ }
11
21
  export async function uploadContentVersion(targetOrgConnection, pathOnClient, title, firstPublishLocationId) {
12
22
  // Check that we have access to the file
13
23
  await fs.promises.access(pathOnClient, fs.constants.F_OK);
@@ -1 +1 @@
1
- {"version":3,"file":"contentVersionUtils.js","sourceRoot":"","sources":["../../src/common/contentVersionUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,mBAA+B,EAC/B,YAAoB,EACpB,KAAc,EACd,sBAA+B;IAE/B,wCA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B,CAAC,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAChH,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAEzG,MAAM,IAAI,GAA+B,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,EAAE;QAClH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,mBAAmB,CAAC,WAAW,EAAE;YAC1D,cAAc,EAAE,kCAAkC,IAAI,CAAC,WAAW,EAAE,GAAG;SACxE;QACD,eAAe,EAAE,IAAI;QACrB,YAAY,EAAE,MAAM;KACrB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,iBAAiB,CAC7D,oFAAoF,IAAI,CAAC,EAAE,GAAG,CAC/F,CAAC;IAEF,OAAO,WAA6B,CAAC;AACvC,CAAC"}
@@ -0,0 +1,33 @@
1
+ # summary
2
+
3
+ Download files from a Salesforce org.
4
+
5
+ # description
6
+
7
+ Downloads files specified by a where clause for a ContentVersion query from a Salesforce org. By default, the plugin uses the REST API for the download as to allow for the streaming of large files without issue. This means that each file will use one REST API request.
8
+
9
+ # flags.max-parallel-jobs.summary
10
+
11
+ Maximum number of parallel jobs.
12
+
13
+ # flags.max-parallel-jobs.description
14
+
15
+ By default the plugin will only process a single file download at a time. You can increase this value to allow for quasi concurrent downloads. Please note that setting this value too high can cause performance issues.
16
+
17
+ # flags.where-content-version.summary
18
+
19
+ WHERE clause for ContentVersion query.
20
+
21
+ # flags.where-content-version.description
22
+
23
+ Provide a WHERE clause to allow the plugin to specify which ContentVersion records should be downloaded.
24
+
25
+ # examples
26
+
27
+ - <%= config.bin %> <%= command.id %> --where-content-version "IsLatest=true" --target-org myTargetOrg
28
+
29
+ - <%= config.bin %> <%= command.id %> --where-content-version "IsLatest=true" --max-parallel-jobs 5 --target-org myTargetOrg
30
+
31
+ # error.targetOrgConnectionFailed
32
+
33
+ Unable to establish connection to the org.
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@simplysf/simply-data",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@simplysf/simply-data",
9
- "version": "1.3.1",
9
+ "version": "1.4.0",
10
10
  "license": "BSD-3-Clause",
11
11
  "dependencies": {
12
+ "@jsforce/jsforce-node": "^3.2.0",
12
13
  "@oclif/core": "^3.26.4",
13
14
  "@salesforce/core": "^7.3.3",
14
15
  "@salesforce/kit": "^3.1.1",
@@ -17,6 +18,7 @@
17
18
  "csv-writer": "^1.6.0",
18
19
  "form-data": "^4.0.0",
19
20
  "got": "13.0.0",
21
+ "nock": "^13.5.4",
20
22
  "p-queue": "^8.0.1"
21
23
  },
22
24
  "devDependencies": {
@@ -5255,18 +5257,6 @@
5255
5257
  "node": ">=18"
5256
5258
  }
5257
5259
  },
5258
- "node_modules/@jsforce/jsforce-node/node_modules/@sindresorhus/is": {
5259
- "version": "4.6.0",
5260
- "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
5261
- "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
5262
- "license": "MIT",
5263
- "engines": {
5264
- "node": ">=10"
5265
- },
5266
- "funding": {
5267
- "url": "https://github.com/sindresorhus/is?sponsor=1"
5268
- }
5269
- },
5270
5260
  "node_modules/@jsforce/jsforce-node/node_modules/@types/node": {
5271
5261
  "version": "18.19.31",
5272
5262
  "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.31.tgz",
@@ -6004,12 +5994,12 @@
6004
5994
  }
6005
5995
  },
6006
5996
  "node_modules/@sindresorhus/is": {
6007
- "version": "5.6.0",
6008
- "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz",
6009
- "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==",
5997
+ "version": "4.6.0",
5998
+ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
5999
+ "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
6010
6000
  "license": "MIT",
6011
6001
  "engines": {
6012
- "node": ">=14.16"
6002
+ "node": ">=10"
6013
6003
  },
6014
6004
  "funding": {
6015
6005
  "url": "https://github.com/sindresorhus/is?sponsor=1"
@@ -10409,6 +10399,18 @@
10409
10399
  "url": "https://github.com/sindresorhus/got?sponsor=1"
10410
10400
  }
10411
10401
  },
10402
+ "node_modules/got/node_modules/@sindresorhus/is": {
10403
+ "version": "5.6.0",
10404
+ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz",
10405
+ "integrity": "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==",
10406
+ "license": "MIT",
10407
+ "engines": {
10408
+ "node": ">=14.16"
10409
+ },
10410
+ "funding": {
10411
+ "url": "https://github.com/sindresorhus/is?sponsor=1"
10412
+ }
10413
+ },
10412
10414
  "node_modules/graceful-fs": {
10413
10415
  "version": "4.2.11",
10414
10416
  "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
@@ -11548,6 +11550,12 @@
11548
11550
  "dev": true,
11549
11551
  "license": "MIT"
11550
11552
  },
11553
+ "node_modules/json-stringify-safe": {
11554
+ "version": "5.0.1",
11555
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
11556
+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
11557
+ "license": "ISC"
11558
+ },
11551
11559
  "node_modules/json5": {
11552
11560
  "version": "2.2.3",
11553
11561
  "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
@@ -12680,6 +12688,20 @@
12680
12688
  "tslib": "^2.0.3"
12681
12689
  }
12682
12690
  },
12691
+ "node_modules/nock": {
12692
+ "version": "13.5.4",
12693
+ "resolved": "https://registry.npmjs.org/nock/-/nock-13.5.4.tgz",
12694
+ "integrity": "sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==",
12695
+ "license": "MIT",
12696
+ "dependencies": {
12697
+ "debug": "^4.1.0",
12698
+ "json-stringify-safe": "^5.0.1",
12699
+ "propagate": "^2.0.0"
12700
+ },
12701
+ "engines": {
12702
+ "node": ">= 10.13"
12703
+ }
12704
+ },
12683
12705
  "node_modules/node-fetch": {
12684
12706
  "version": "2.7.0",
12685
12707
  "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
@@ -13630,6 +13652,15 @@
13630
13652
  "integrity": "sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ==",
13631
13653
  "license": "MIT"
13632
13654
  },
13655
+ "node_modules/propagate": {
13656
+ "version": "2.0.1",
13657
+ "resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz",
13658
+ "integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==",
13659
+ "license": "MIT",
13660
+ "engines": {
13661
+ "node": ">= 8"
13662
+ }
13663
+ },
13633
13664
  "node_modules/proper-lockfile": {
13634
13665
  "version": "4.1.2",
13635
13666
  "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz",
package/oclif.lock CHANGED
@@ -5340,6 +5340,11 @@ json-stable-stringify-without-jsonify@^1.0.1:
5340
5340
  resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
5341
5341
  integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==
5342
5342
 
5343
+ json-stringify-safe@^5.0.1:
5344
+ version "5.0.1"
5345
+ resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
5346
+ integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
5347
+
5343
5348
  json5@^1.0.2:
5344
5349
  version "1.0.2"
5345
5350
  resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
@@ -5966,6 +5971,15 @@ no-case@^3.0.4:
5966
5971
  lower-case "^2.0.2"
5967
5972
  tslib "^2.0.3"
5968
5973
 
5974
+ nock@^13.5.4:
5975
+ version "13.5.4"
5976
+ resolved "https://registry.yarnpkg.com/nock/-/nock-13.5.4.tgz#8918f0addc70a63736170fef7106a9721e0dc479"
5977
+ integrity sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==
5978
+ dependencies:
5979
+ debug "^4.1.0"
5980
+ json-stringify-safe "^5.0.1"
5981
+ propagate "^2.0.0"
5982
+
5969
5983
  node-fetch@^2.6.1, node-fetch@^2.6.9:
5970
5984
  version "2.7.0"
5971
5985
  resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
@@ -6475,6 +6489,11 @@ process@^0.11.10:
6475
6489
  resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
6476
6490
  integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==
6477
6491
 
6492
+ propagate@^2.0.0:
6493
+ version "2.0.1"
6494
+ resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45"
6495
+ integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==
6496
+
6478
6497
  proper-lockfile@^4.1.2:
6479
6498
  version "4.1.2"
6480
6499
  resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-4.1.2.tgz#c8b9de2af6b2f1601067f98e01ac66baa223141f"
@@ -7101,16 +7120,7 @@ srcset@^5.0.0:
7101
7120
  resolved "https://registry.yarnpkg.com/srcset/-/srcset-5.0.0.tgz#9df6c3961b5b44a02532ce6ae4544832609e2e3f"
7102
7121
  integrity sha512-SqEZaAEhe0A6ETEa9O1IhSPC7MdvehZtCnTR0AftXk3QhY2UNgb+NApFOUPZILXk/YTDfFxMTNJOBpzrJsEdIA==
7103
7122
 
7104
- "string-width-cjs@npm:string-width@^4.2.0":
7105
- version "4.2.3"
7106
- resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
7107
- integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
7108
- dependencies:
7109
- emoji-regex "^8.0.0"
7110
- is-fullwidth-code-point "^3.0.0"
7111
- strip-ansi "^6.0.1"
7112
-
7113
- string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
7123
+ "string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
7114
7124
  version "4.2.3"
7115
7125
  resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
7116
7126
  integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -7169,14 +7179,7 @@ string_decoder@~1.1.1:
7169
7179
  dependencies:
7170
7180
  safe-buffer "~5.1.0"
7171
7181
 
7172
- "strip-ansi-cjs@npm:strip-ansi@^6.0.1":
7173
- version "6.0.1"
7174
- resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
7175
- integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
7176
- dependencies:
7177
- ansi-regex "^5.0.1"
7178
-
7179
- strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
7182
+ "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
7180
7183
  version "6.0.1"
7181
7184
  resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
7182
7185
  integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -7714,7 +7717,7 @@ workerpool@6.2.1:
7714
7717
  resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
7715
7718
  integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
7716
7719
 
7717
- "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
7720
+ "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
7718
7721
  version "7.0.0"
7719
7722
  resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
7720
7723
  integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -7732,15 +7735,6 @@ wrap-ansi@^6.2.0:
7732
7735
  string-width "^4.1.0"
7733
7736
  strip-ansi "^6.0.0"
7734
7737
 
7735
- wrap-ansi@^7.0.0:
7736
- version "7.0.0"
7737
- resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
7738
- integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
7739
- dependencies:
7740
- ansi-styles "^4.0.0"
7741
- string-width "^4.1.0"
7742
- strip-ansi "^6.0.0"
7743
-
7744
7738
  wrap-ansi@^8.1.0:
7745
7739
  version "8.1.0"
7746
7740
  resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "commands": {
3
- "simply:data:file:upload": {
3
+ "simply:data:files:download": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "Uploads a file to a Salesforce org.",
6
+ "description": "Downloads files specified by a where clause for a ContentVersion query from a Salesforce org. By default, the plugin uses the REST API for the download as to allow for the streaming of large files without issue. This means that each file will use one REST API request.",
7
7
  "examples": [
8
- "<%= config.bin %> <%= command.id %> --file-path fileToUpload.txt --target-org myTargetOrg",
9
- "<%= config.bin %> <%= command.id %> --file-path fileToUpload.txt --first-publish-location-id 0019000000DmehK --target-org myTargetOrg"
8
+ "<%= config.bin %> <%= command.id %> --where-content-version \"IsLatest=true\" --target-org myTargetOrg",
9
+ "<%= config.bin %> <%= command.id %> --where-content-version \"IsLatest=true\" --max-parallel-jobs 5 --target-org myTargetOrg"
10
10
  ],
11
11
  "flags": {
12
12
  "json": {
@@ -31,17 +31,11 @@
31
31
  "multiple": false,
32
32
  "type": "option"
33
33
  },
34
- "file-path": {
35
- "name": "file-path",
36
- "required": true,
37
- "summary": "Path to the file to upload.",
38
- "hasDynamicHelp": false,
39
- "multiple": false,
40
- "type": "option"
41
- },
42
- "first-publish-location-id": {
43
- "name": "first-publish-location-id",
44
- "summary": "Specify a record Id that the file should be linked to.",
34
+ "max-parallel-jobs": {
35
+ "description": "By default the plugin will only process a single file download at a time. You can increase this value to allow for quasi concurrent downloads. Please note that setting this value too high can cause performance issues.",
36
+ "name": "max-parallel-jobs",
37
+ "summary": "Maximum number of parallel jobs.",
38
+ "default": 1,
45
39
  "hasDynamicHelp": false,
46
40
  "multiple": false,
47
41
  "type": "option"
@@ -56,9 +50,11 @@
56
50
  "multiple": false,
57
51
  "type": "option"
58
52
  },
59
- "title": {
60
- "name": "title",
61
- "summary": "Specify the title for the file being uploaded.",
53
+ "where-content-version": {
54
+ "description": "Provide a WHERE clause to allow the plugin to specify which ContentVersion records should be downloaded.",
55
+ "name": "where-content-version",
56
+ "required": true,
57
+ "summary": "WHERE clause for ContentVersion query.",
62
58
  "hasDynamicHelp": false,
63
59
  "multiple": false,
64
60
  "type": "option"
@@ -66,12 +62,12 @@
66
62
  },
67
63
  "hasDynamicHelp": true,
68
64
  "hiddenAliases": [],
69
- "id": "simply:data:file:upload",
65
+ "id": "simply:data:files:download",
70
66
  "pluginAlias": "@simplysf/simply-data",
71
67
  "pluginName": "@simplysf/simply-data",
72
68
  "pluginType": "core",
73
69
  "strict": true,
74
- "summary": "Upload a file to a Salesforce org.",
70
+ "summary": "Download files from a Salesforce org.",
75
71
  "enableJsonFlag": true,
76
72
  "isESM": true,
77
73
  "relativePath": [
@@ -79,35 +75,35 @@
79
75
  "commands",
80
76
  "simply",
81
77
  "data",
82
- "file",
83
- "upload.js"
78
+ "files",
79
+ "download.js"
84
80
  ],
85
81
  "aliasPermutations": [],
86
82
  "permutations": [
87
- "simply:data:file:upload",
88
- "data:simply:file:upload",
89
- "data:file:simply:upload",
90
- "data:file:upload:simply",
91
- "simply:file:data:upload",
92
- "file:simply:data:upload",
93
- "file:data:simply:upload",
94
- "file:data:upload:simply",
95
- "simply:file:upload:data",
96
- "file:simply:upload:data",
97
- "file:upload:simply:data",
98
- "file:upload:data:simply",
99
- "simply:data:upload:file",
100
- "data:simply:upload:file",
101
- "data:upload:simply:file",
102
- "data:upload:file:simply",
103
- "simply:upload:data:file",
104
- "upload:simply:data:file",
105
- "upload:data:simply:file",
106
- "upload:data:file:simply",
107
- "simply:upload:file:data",
108
- "upload:simply:file:data",
109
- "upload:file:simply:data",
110
- "upload:file:data:simply"
83
+ "simply:data:files:download",
84
+ "data:simply:files:download",
85
+ "data:files:simply:download",
86
+ "data:files:download:simply",
87
+ "simply:files:data:download",
88
+ "files:simply:data:download",
89
+ "files:data:simply:download",
90
+ "files:data:download:simply",
91
+ "simply:files:download:data",
92
+ "files:simply:download:data",
93
+ "files:download:simply:data",
94
+ "files:download:data:simply",
95
+ "simply:data:download:files",
96
+ "data:simply:download:files",
97
+ "data:download:simply:files",
98
+ "data:download:files:simply",
99
+ "simply:download:data:files",
100
+ "download:simply:data:files",
101
+ "download:data:simply:files",
102
+ "download:data:files:simply",
103
+ "simply:download:files:data",
104
+ "download:simply:files:data",
105
+ "download:files:simply:data",
106
+ "download:files:data:simply"
111
107
  ]
112
108
  },
113
109
  "simply:data:files:upload": {
@@ -215,7 +211,117 @@
215
211
  "upload:files:simply:data",
216
212
  "upload:files:data:simply"
217
213
  ]
214
+ },
215
+ "simply:data:file:upload": {
216
+ "aliases": [],
217
+ "args": {},
218
+ "description": "Uploads a file to a Salesforce org.",
219
+ "examples": [
220
+ "<%= config.bin %> <%= command.id %> --file-path fileToUpload.txt --target-org myTargetOrg",
221
+ "<%= config.bin %> <%= command.id %> --file-path fileToUpload.txt --first-publish-location-id 0019000000DmehK --target-org myTargetOrg"
222
+ ],
223
+ "flags": {
224
+ "json": {
225
+ "description": "Format output as json.",
226
+ "helpGroup": "GLOBAL",
227
+ "name": "json",
228
+ "allowNo": false,
229
+ "type": "boolean"
230
+ },
231
+ "flags-dir": {
232
+ "helpGroup": "GLOBAL",
233
+ "name": "flags-dir",
234
+ "summary": "Import flag values from a directory.",
235
+ "hasDynamicHelp": false,
236
+ "multiple": false,
237
+ "type": "option"
238
+ },
239
+ "api-version": {
240
+ "description": "Override the api version used for api requests made by this command",
241
+ "name": "api-version",
242
+ "hasDynamicHelp": false,
243
+ "multiple": false,
244
+ "type": "option"
245
+ },
246
+ "file-path": {
247
+ "name": "file-path",
248
+ "required": true,
249
+ "summary": "Path to the file to upload.",
250
+ "hasDynamicHelp": false,
251
+ "multiple": false,
252
+ "type": "option"
253
+ },
254
+ "first-publish-location-id": {
255
+ "name": "first-publish-location-id",
256
+ "summary": "Specify a record Id that the file should be linked to.",
257
+ "hasDynamicHelp": false,
258
+ "multiple": false,
259
+ "type": "option"
260
+ },
261
+ "target-org": {
262
+ "char": "o",
263
+ "name": "target-org",
264
+ "noCacheDefault": true,
265
+ "required": true,
266
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
267
+ "hasDynamicHelp": true,
268
+ "multiple": false,
269
+ "type": "option"
270
+ },
271
+ "title": {
272
+ "name": "title",
273
+ "summary": "Specify the title for the file being uploaded.",
274
+ "hasDynamicHelp": false,
275
+ "multiple": false,
276
+ "type": "option"
277
+ }
278
+ },
279
+ "hasDynamicHelp": true,
280
+ "hiddenAliases": [],
281
+ "id": "simply:data:file:upload",
282
+ "pluginAlias": "@simplysf/simply-data",
283
+ "pluginName": "@simplysf/simply-data",
284
+ "pluginType": "core",
285
+ "strict": true,
286
+ "summary": "Upload a file to a Salesforce org.",
287
+ "enableJsonFlag": true,
288
+ "isESM": true,
289
+ "relativePath": [
290
+ "lib",
291
+ "commands",
292
+ "simply",
293
+ "data",
294
+ "file",
295
+ "upload.js"
296
+ ],
297
+ "aliasPermutations": [],
298
+ "permutations": [
299
+ "simply:data:file:upload",
300
+ "data:simply:file:upload",
301
+ "data:file:simply:upload",
302
+ "data:file:upload:simply",
303
+ "simply:file:data:upload",
304
+ "file:simply:data:upload",
305
+ "file:data:simply:upload",
306
+ "file:data:upload:simply",
307
+ "simply:file:upload:data",
308
+ "file:simply:upload:data",
309
+ "file:upload:simply:data",
310
+ "file:upload:data:simply",
311
+ "simply:data:upload:file",
312
+ "data:simply:upload:file",
313
+ "data:upload:simply:file",
314
+ "data:upload:file:simply",
315
+ "simply:upload:data:file",
316
+ "upload:simply:data:file",
317
+ "upload:data:simply:file",
318
+ "upload:data:file:simply",
319
+ "simply:upload:file:data",
320
+ "upload:simply:file:data",
321
+ "upload:file:simply:data",
322
+ "upload:file:data:simply"
323
+ ]
218
324
  }
219
325
  },
220
- "version": "1.3.1"
326
+ "version": "1.4.0"
221
327
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@simplysf/simply-data",
3
3
  "description": "Utilities for working with data",
4
- "version": "1.3.1",
4
+ "version": "1.4.0",
5
5
  "author": "@ClayChipps",
6
6
  "bugs": "https://github.com/SimplySF/simply-data/issues",
7
7
  "dependencies": {
8
+ "@jsforce/jsforce-node": "^3.2.0",
8
9
  "@oclif/core": "^3.26.4",
9
10
  "@salesforce/core": "^7.3.3",
10
11
  "@salesforce/kit": "^3.1.1",
@@ -13,6 +14,7 @@
13
14
  "csv-writer": "^1.6.0",
14
15
  "form-data": "^4.0.0",
15
16
  "got": "13.0.0",
17
+ "nock": "^13.5.4",
16
18
  "p-queue": "^8.0.1"
17
19
  },
18
20
  "devDependencies": {