@simplysf/simply-data 2.4.6 → 2.4.7

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/README.md CHANGED
@@ -78,7 +78,7 @@ FLAG DESCRIPTIONS
78
78
  Setup and Configuration" permission — the command warns and proceeds rather than failing.
79
79
  ```
80
80
 
81
- _See code: [lib/commands/simply/data/file/upload.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-data@2.4.6/packages/simply-data/lib/commands/simply/data/file/upload.js)_
81
+ _See code: [lib/commands/simply/data/file/upload.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-data@2.4.7/packages/simply-data/lib/commands/simply/data/file/upload.js)_
82
82
 
83
83
  ## `sf simply data files download`
84
84
 
@@ -140,7 +140,7 @@ FLAG DESCRIPTIONS
140
140
  Provide a WHERE clause to allow the plugin to specify which ContentVersion records should be downloaded.
141
141
  ```
142
142
 
143
- _See code: [lib/commands/simply/data/files/download.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-data@2.4.6/packages/simply-data/lib/commands/simply/data/files/download.js)_
143
+ _See code: [lib/commands/simply/data/files/download.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-data@2.4.7/packages/simply-data/lib/commands/simply/data/files/download.js)_
144
144
 
145
145
  ## `sf simply data files upload`
146
146
 
@@ -206,7 +206,7 @@ FLAG DESCRIPTIONS
206
206
  quasi concurrent uploads. Please note that setting this value too high can cause performance issues.
207
207
  ```
208
208
 
209
- _See code: [lib/commands/simply/data/files/upload.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-data@2.4.6/packages/simply-data/lib/commands/simply/data/files/upload.js)_
209
+ _See code: [lib/commands/simply/data/files/upload.js](https://github.com/SimplySF/simply-plugins/blob/@simplysf/simply-data@2.4.7/packages/simply-data/lib/commands/simply/data/files/upload.js)_
210
210
  <!-- commandsstop -->
211
211
 
212
212
  ## License
@@ -1,5 +1,5 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { ContentVersion } from '../../../../common/contentVersionTypes.js';
2
+ import { type ContentVersion } from '@simplysf/simply-data-core';
3
3
  /** Uploads a single local file to a Salesforce org as a `ContentVersion`. */
4
4
  export default class DataFileUpload extends SfCommand<ContentVersion> {
5
5
  static readonly summary: string;
@@ -16,9 +16,8 @@
16
16
  import { Messages } from '@salesforce/core';
17
17
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
18
  import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
19
- import { uploadContentVersion } from '../../../../common/contentVersionUtils.js';
19
+ import { uploadContentVersion, REQUESTS_PER_UPLOAD } from '@simplysf/simply-data-core';
20
20
  import { apiBudgetFlags, assertApiBudget } from '../../../../common/apiBudgetFlag.js';
21
- import { REQUESTS_PER_UPLOAD } from '../../../../common/apiCost.js';
22
21
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
23
22
  const messages = Messages.loadMessages('@simplysf/simply-data', 'simply.data.file.upload');
24
23
  /** Uploads a single local file to a Salesforce org as a `ContentVersion`. */
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../../src/commands/simply/data/file/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGpE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MA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
20
20
  import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
21
21
  import { createCsvFileWriter } from '@simplysf/simply-core';
22
- import { downloadContentVersion } from '../../../../common/contentVersionUtils.js';
22
+ import { downloadContentVersion, REQUESTS_PER_DOWNLOAD, requestsForQuery, } from '@simplysf/simply-data-core';
23
23
  import { apiBudgetFlags, assertApiBudget } from '../../../../common/apiBudgetFlag.js';
24
- import { REQUESTS_PER_DOWNLOAD, requestsForQuery } from '../../../../common/apiCost.js';
25
24
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
26
25
  const messages = Messages.loadMessages('@simplysf/simply-data', 'simply.data.files.download');
27
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"download.js","sourceRoot":"","sources":["../../../../../src/commands/simply/data/files/download.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,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,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGxF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,uBAAuB,EAAE,4BAA4B,CAAC,CAAC;AAE9F;;;;;;;GAOG;AACH,MAAM,CAAC,OAA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,CAAC;YAC7D,KAAK,aAAa,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;gBAChC,IAAI,CAAC;oBACH,sBAAsB,CAAC,QAAQ,GAAG,MAAM,sBAAsB,CAC5D,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,CACX,CAAC;oBACF,MAAM,aAAa,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBACpD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,sBAAsB,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC7C,MAAM,WAAW,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC;QAC7B,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAE5D,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC"}
@@ -20,10 +20,8 @@ import { Messages } from '@salesforce/core';
20
20
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
21
21
  import { requireConnection, targetOrgFlags } from '@simplysf/simply-plugin-kit';
22
22
  import { createCsvFileWriter } from '@simplysf/simply-core';
23
- import { uploadContentVersion } from '../../../../common/contentVersionUtils.js';
23
+ import { uploadContentVersion, countCsvRows, REQUESTS_PER_UPLOAD, } from '@simplysf/simply-data-core';
24
24
  import { apiBudgetFlags, assertApiBudget } from '../../../../common/apiBudgetFlag.js';
25
- import { countCsvRows } from '../../../../common/countCsvRows.js';
26
- import { REQUESTS_PER_UPLOAD } from '../../../../common/apiCost.js';
27
25
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
28
26
  const messages = Messages.loadMessages('@simplysf/simply-data', 'simply.data.files.upload');
29
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sourceR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AI,EAAE,CAAC;IACtB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simplysf/simply-data",
3
3
  "description": "Utilities for working with data",
4
- "version": "2.4.6",
4
+ "version": "2.4.7",
5
5
  "author": "@ClayChipps",
6
6
  "homepage": "https://github.com/SimplySF/simply-plugins",
7
7
  "bugs": "https://github.com/SimplySF/simply-plugins/issues",
@@ -66,6 +66,7 @@
66
66
  "@salesforce/kit": "^3.2.6",
67
67
  "@salesforce/sf-plugins-core": "^12.2.16",
68
68
  "@simplysf/simply-core": "^1.5.1",
69
+ "@simplysf/simply-data-core": "^0.1.0",
69
70
  "@simplysf/simply-plugin-kit": "^1.0.6",
70
71
  "csv-parse": "^7.0.2",
71
72
  "p-queue": "^9.2.0"
@@ -203,5 +204,5 @@
203
204
  "output": []
204
205
  }
205
206
  },
206
- "gitHead": "5bbe406ea2cb1a4123440ada47d8e728e60f46b6"
207
+ "gitHead": "b6d7016ab3aa2f61112880cded5b0a91a5deeb31"
207
208
  }
@@ -1,23 +0,0 @@
1
- /**
2
- * API requests consumed per file uploaded.
3
- *
4
- * **Two, not one.** Salesforce's create response returns only the new `ContentVersion` id, so
5
- * `uploadContentVersion` follows it with a query for `ContentDocumentId`. Both count toward the
6
- * org's daily allocation. Counting one per file here would under-budget every upload by half.
7
- */
8
- export declare const REQUESTS_PER_UPLOAD = 2;
9
- /** API requests consumed per file downloaded — a single GET of the `VersionData` blob. */
10
- export declare const REQUESTS_PER_DOWNLOAD = 1;
11
- /**
12
- * Records jsforce returns per query round trip before it has to fetch another batch.
13
- *
14
- * Used to estimate how many requests a record query costs on top of the per-file work.
15
- */
16
- export declare const QUERY_BATCH_SIZE = 2000;
17
- /**
18
- * Estimate the API requests a record query costs, including its `queryMore` round trips.
19
- *
20
- * @param recordCount - How many records the query returns.
21
- * @returns The number of requests, at least 1.
22
- */
23
- export declare function requestsForQuery(recordCount: number): number;
@@ -1,41 +0,0 @@
1
- /*
2
- * Copyright (c) 2026, Clay Chipps.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * API requests consumed per file uploaded.
18
- *
19
- * **Two, not one.** Salesforce's create response returns only the new `ContentVersion` id, so
20
- * `uploadContentVersion` follows it with a query for `ContentDocumentId`. Both count toward the
21
- * org's daily allocation. Counting one per file here would under-budget every upload by half.
22
- */
23
- export const REQUESTS_PER_UPLOAD = 2;
24
- /** API requests consumed per file downloaded — a single GET of the `VersionData` blob. */
25
- export const REQUESTS_PER_DOWNLOAD = 1;
26
- /**
27
- * Records jsforce returns per query round trip before it has to fetch another batch.
28
- *
29
- * Used to estimate how many requests a record query costs on top of the per-file work.
30
- */
31
- export const QUERY_BATCH_SIZE = 2000;
32
- /**
33
- * Estimate the API requests a record query costs, including its `queryMore` round trips.
34
- *
35
- * @param recordCount - How many records the query returns.
36
- * @returns The number of requests, at least 1.
37
- */
38
- export function requestsForQuery(recordCount) {
39
- return Math.max(1, Math.ceil(recordCount / QUERY_BATCH_SIZE));
40
- }
41
- //# sourceMappingURL=apiCost.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiCost.js","sourceRoot":"","sources":["../../src/common/apiCost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,0FAA0F;AAC1F,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC;AAChE,CAAC"}
@@ -1,40 +0,0 @@
1
- /** The subset of `ContentVersion` fields used when downloading/uploading files. */
2
- export type ContentVersion = {
3
- ContentDocumentId: string;
4
- ContentSize: string;
5
- Description: string;
6
- FileExtension: string;
7
- FileType: string;
8
- FirstPublishLocationId: string;
9
- Id: string;
10
- IsLatest: string;
11
- PathOnClient: string;
12
- Title: string;
13
- };
14
- /** Request body for creating a `ContentVersion` via the multipart `sobjects/ContentVersion` endpoint. */
15
- export type ContentVersionCreateRequest = {
16
- FirstPublishLocationId?: string;
17
- PathOnClient: string;
18
- Title?: string;
19
- };
20
- /** Response body returned by the `sobjects/ContentVersion` create endpoint. */
21
- export type ContentVersionCreateResult = {
22
- id: string;
23
- success: boolean;
24
- errors: string[];
25
- name: string;
26
- message: string;
27
- };
28
- /** A `ContentVersion` targeted for download, plus the outcome once the download is attempted. */
29
- export type ContentVersionDownload = ContentVersion & {
30
- Error?: string;
31
- FilePath?: string;
32
- };
33
- /** A local file queued for upload as a `ContentVersion`, plus the outcome once uploaded. */
34
- export type ContentVersionToUpload = {
35
- ContentDocumentId?: string;
36
- Error?: string;
37
- FirstPublishLocationId?: string;
38
- PathOnClient: string;
39
- Title: string;
40
- };
@@ -1,17 +0,0 @@
1
- /*
2
- * Copyright (c) 2026, Clay Chipps.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export {};
17
- //# sourceMappingURL=contentVersionTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contentVersionTypes.js","sourceRoot":"","sources":["../../src/common/contentVersionTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -1,30 +0,0 @@
1
- import { Connection } from '@salesforce/core';
2
- import { ContentVersion, ContentVersionDownload } from './contentVersionTypes.js';
3
- /**
4
- * Download a `ContentVersion`'s file data to a local directory.
5
- *
6
- * @param targetOrgConnection - The org connection to download from.
7
- * @param contentVersionDownload - The `ContentVersion` to download; its `Id`, `Title`,
8
- * `ContentDocumentId`, and `FileExtension` are used to build the output file path.
9
- * @param downloadDirectory - The local directory to write the file into.
10
- * @returns The local path the file was written to.
11
- * @throws {SfError} If the org returns a non-2xx response, before any file is created.
12
- */
13
- export declare function downloadContentVersion(targetOrgConnection: Connection, contentVersionDownload: ContentVersionDownload, downloadDirectory: string): Promise<string>;
14
- /**
15
- * Upload a local file as a new `ContentVersion`.
16
- *
17
- * Only the file's name is sent to the org as `PathOnClient`, not the local path it was read from.
18
- * Salesforce derives `FileExtension` and `FileType` from that value, so the name is all it needs —
19
- * and sending the rest would publish the uploader's local directory layout into the org, where it
20
- * is visible to anyone who can query `ContentVersion`.
21
- *
22
- * @param targetOrgConnection - The org connection to upload to.
23
- * @param filePath - The local filesystem path of the file to upload. Stays local.
24
- * @param title - The `ContentVersion` title. Defaults to the file's name.
25
- * @param firstPublishLocationId - The ID of the record/library to attach the resulting
26
- * `ContentDocument` to, if any.
27
- * @returns The created `ContentVersion`, re-queried to include `ContentDocumentId`.
28
- * @throws {SfError} If the org returns a non-2xx response.
29
- */
30
- export declare function uploadContentVersion(targetOrgConnection: Connection, filePath: string, title?: string, firstPublishLocationId?: string): Promise<ContentVersion>;
@@ -1,147 +0,0 @@
1
- /*
2
- * Copyright (c) 2026, Clay Chipps.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import fs from 'node:fs';
17
- import path from 'node:path';
18
- import stream, { Readable } from 'node:stream';
19
- import { SfError } from '@salesforce/core';
20
- import { contentVersionMultipart } from './multipart.js';
21
- /** How much of an error response body to include in a thrown error before truncating. */
22
- const MAX_ERROR_BODY_LENGTH = 2000;
23
- /** Matches the `api-usage=used/limit` portion of a `Sforce-Limit-Info` response header. */
24
- const API_USAGE_PATTERN = /api-usage=(?<used>\d+)\/(?<limit>\d+)/;
25
- /**
26
- * Feed a raw `fetch` response's `Sforce-Limit-Info` header back into the connection.
27
- *
28
- * Salesforce reports API consumption on every REST response, and jsforce normally parses it into
29
- * `connection.limitInfo`. These two functions call `fetch` directly, so jsforce never sees their
30
- * responses and the readings would otherwise be lost — leaving `limitInfo` stale at whatever the
31
- * last jsforce-issued request reported, which for an upload run is "nothing at all".
32
- *
33
- * Keeping it current costs one header parse and makes the reading available to the API budget
34
- * check and to any later running check.
35
- *
36
- * @param connection - The connection whose `limitInfo` should be updated.
37
- * @param response - The response to read the header from.
38
- */
39
- function recordApiUsage(connection, response) {
40
- const match = API_USAGE_PATTERN.exec(response.headers.get('sforce-limit-info') ?? '');
41
- if (match?.groups) {
42
- connection.limitInfo = {
43
- apiUsage: {
44
- used: Number.parseInt(match.groups.used, 10),
45
- limit: Number.parseInt(match.groups.limit, 10),
46
- },
47
- };
48
- }
49
- }
50
- /**
51
- * Turn a non-2xx response into an `SfError`.
52
- *
53
- * `fetch` — unlike the `got` client this replaced — resolves successfully for 4xx and 5xx, so every
54
- * call site has to check `response.ok` itself. Missing one is how an HTML error page ends up
55
- * written to disk with a `.pdf` extension.
56
- *
57
- * @param response - The failed response. Its body is consumed.
58
- * @param context - What was being attempted, used as the error message prefix.
59
- * @returns An `SfError` carrying the status and as much of the body as is useful.
60
- */
61
- async function responseError(response, context) {
62
- let body = '';
63
- try {
64
- body = (await response.text()).slice(0, MAX_ERROR_BODY_LENGTH);
65
- }
66
- catch {
67
- // A body we can't read is not worth failing differently over; the status still tells the story.
68
- }
69
- return new SfError(`${context} failed with HTTP ${response.status} ${response.statusText}${body ? `: ${body}` : ''}`, 'ContentVersionRequestError');
70
- }
71
- /**
72
- * Download a `ContentVersion`'s file data to a local directory.
73
- *
74
- * @param targetOrgConnection - The org connection to download from.
75
- * @param contentVersionDownload - The `ContentVersion` to download; its `Id`, `Title`,
76
- * `ContentDocumentId`, and `FileExtension` are used to build the output file path.
77
- * @param downloadDirectory - The local directory to write the file into.
78
- * @returns The local path the file was written to.
79
- * @throws {SfError} If the org returns a non-2xx response, before any file is created.
80
- */
81
- export async function downloadContentVersion(targetOrgConnection, contentVersionDownload, downloadDirectory) {
82
- const filePath = `${downloadDirectory}/${contentVersionDownload.ContentDocumentId}_${contentVersionDownload.Title.replaceAll(' ', '_')}.${contentVersionDownload.FileExtension}`;
83
- const response = await fetch(`${targetOrgConnection.baseUrl()}/sobjects/ContentVersion/${contentVersionDownload.Id}/VersionData`, {
84
- headers: {
85
- Authorization: `Bearer ${targetOrgConnection.accessToken}`,
86
- },
87
- });
88
- recordApiUsage(targetOrgConnection, response);
89
- // Checked before the write stream is opened, so a failed download leaves nothing behind.
90
- if (!response.ok) {
91
- throw await responseError(response, `Download of ContentVersion ${contentVersionDownload.Id}`);
92
- }
93
- if (!response.body) {
94
- throw new SfError(`Download of ContentVersion ${contentVersionDownload.Id} returned an empty response body.`, 'ContentVersionRequestError');
95
- }
96
- await stream.promises.pipeline(Readable.fromWeb(response.body), fs.createWriteStream(filePath));
97
- return filePath;
98
- }
99
- /**
100
- * Upload a local file as a new `ContentVersion`.
101
- *
102
- * Only the file's name is sent to the org as `PathOnClient`, not the local path it was read from.
103
- * Salesforce derives `FileExtension` and `FileType` from that value, so the name is all it needs —
104
- * and sending the rest would publish the uploader's local directory layout into the org, where it
105
- * is visible to anyone who can query `ContentVersion`.
106
- *
107
- * @param targetOrgConnection - The org connection to upload to.
108
- * @param filePath - The local filesystem path of the file to upload. Stays local.
109
- * @param title - The `ContentVersion` title. Defaults to the file's name.
110
- * @param firstPublishLocationId - The ID of the record/library to attach the resulting
111
- * `ContentDocument` to, if any.
112
- * @returns The created `ContentVersion`, re-queried to include `ContentDocumentId`.
113
- * @throws {SfError} If the org returns a non-2xx response.
114
- */
115
- export async function uploadContentVersion(targetOrgConnection, filePath, title, firstPublishLocationId) {
116
- // Check that we have access to the file
117
- await fs.promises.access(filePath, fs.constants.F_OK);
118
- const fileName = path.basename(filePath);
119
- const contentVersionCreateRequest = {
120
- FirstPublishLocationId: firstPublishLocationId,
121
- PathOnClient: fileName,
122
- Title: title ?? fileName,
123
- };
124
- const { contentType, createBody } = contentVersionMultipart({
125
- entity: contentVersionCreateRequest,
126
- filePath,
127
- filename: fileName,
128
- });
129
- const response = await fetch(`${targetOrgConnection.baseUrl()}/sobjects/ContentVersion`, {
130
- method: 'POST',
131
- // `duplex: 'half'` is required by undici whenever the body is a stream.
132
- body: Readable.toWeb(createBody()),
133
- duplex: 'half',
134
- headers: {
135
- Authorization: `Bearer ${targetOrgConnection.accessToken}`,
136
- 'Content-Type': contentType,
137
- },
138
- });
139
- recordApiUsage(targetOrgConnection, response);
140
- if (!response.ok) {
141
- throw await responseError(response, `Upload of "${filePath}"`);
142
- }
143
- const data = (await response.json());
144
- const queryResult = await targetOrgConnection.singleRecordQuery(`SELECT ContentDocumentId, FileExtension, Id, Title FROM ContentVersion WHERE Id='${data.id}'`);
145
- return queryResult;
146
- }
147
- //# sourceMappingURL=contentVersionUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contentVersionUtils.js","sourceRoot":"","sources":["../../src/common/contentVersionUtils.ts"],"names":[],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B,CAC7D,oFAAoF,IAAI,CAAC,EAAE,GAAG,CAC/F,CAAC;IAEF,OAAO,WAA6B,CAAC;AACvC,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Count the data rows in a CSV, excluding its header.
3
- *
4
- * Parses rather than counting newlines: a quoted field may contain line breaks, so `\n` counting
5
- * over-reports and would budget for uploads that never happen. The parser options match the ones
6
- * the upload itself uses, so the count and the work cannot disagree.
7
- *
8
- * This reads the file a second time rather than buffering the parsed rows. The trade is a cheap
9
- * sequential local read against unbounded memory on exactly the large inputs where checking the
10
- * budget matters most.
11
- *
12
- * @param filePath - Path to the CSV.
13
- * @returns The number of data rows.
14
- */
15
- export declare function countCsvRows(filePath: string): Promise<number>;
@@ -1,42 +0,0 @@
1
- /*
2
- * Copyright (c) 2026, Clay Chipps.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import fs from 'node:fs';
17
- import { parse } from 'csv-parse';
18
- /**
19
- * Count the data rows in a CSV, excluding its header.
20
- *
21
- * Parses rather than counting newlines: a quoted field may contain line breaks, so `\n` counting
22
- * over-reports and would budget for uploads that never happen. The parser options match the ones
23
- * the upload itself uses, so the count and the work cannot disagree.
24
- *
25
- * This reads the file a second time rather than buffering the parsed rows. The trade is a cheap
26
- * sequential local read against unbounded memory on exactly the large inputs where checking the
27
- * budget matters most.
28
- *
29
- * @param filePath - Path to the CSV.
30
- * @returns The number of data rows.
31
- */
32
- export async function countCsvRows(filePath) {
33
- const parser = fs.createReadStream(filePath).pipe(parse({ bom: true, columns: true }));
34
- let rows = 0;
35
- for await (const record of parser) {
36
- // The record itself is not needed, only that the parser produced one.
37
- void record;
38
- rows++;
39
- }
40
- return rows;
41
- }
42
- //# sourceMappingURL=countCsvRows.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"countCsvRows.js","sourceRoot":"","sources":["../../src/common/countCsvRows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAEvF,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;QAClC,sEAAsE;QACtE,KAAK,MAAM,CAAC;QACZ,IAAI,EAAE,CAAC;IACT,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,58 +0,0 @@
1
- import { Readable } from 'node:stream';
2
- /**
3
- * Generate a multipart boundary.
4
- *
5
- * The boundary must not appear anywhere in the encoded body. Rather than scanning the file to
6
- * prove that, we use 128 bits of randomness, which makes an accidental collision less likely than
7
- * a disk error corrupting the upload anyway.
8
- *
9
- * @returns A boundary string, comfortably under the 70-character limit.
10
- */
11
- export declare function createBoundary(): string;
12
- /**
13
- * Escape a filename for inclusion in a `Content-Disposition` header.
14
- *
15
- * Applies the same normalization the WHATWG `FormData` serializer does. Without it, a file named
16
- * `my"file.pdf` would close the quoted string early, and one containing a newline could inject a
17
- * header. The `form-data` package this replaced did neither.
18
- *
19
- * @param filename - The raw filename.
20
- * @returns The filename with `"`, CR, and LF percent-encoded.
21
- */
22
- export declare function escapeHeaderFilename(filename: string): string;
23
- /** A multipart request body, plus the `Content-Type` header value that describes it. */
24
- export type ContentVersionMultipart = {
25
- /** The generated (or supplied) boundary. */
26
- boundary: string;
27
- /** The value for the request's `Content-Type` header, including the boundary. */
28
- contentType: string;
29
- /**
30
- * Build the request body.
31
- *
32
- * This is a factory rather than a stream because a stream can only be consumed once, and a
33
- * retried upload needs a fresh body. Each call re-opens the file.
34
- */
35
- createBody: () => Readable;
36
- };
37
- /**
38
- * Build the `multipart/form-data` body for a `ContentVersion` create request.
39
- *
40
- * The shape here matches Salesforce's documented example exactly, including the trailing semicolon
41
- * after `name="entity_content"` and the absence of a `filename` on that part. That absence is the
42
- * reason this is hand-built rather than delegated to the platform's `FormData`: a `FormData` part
43
- * carrying `Content-Type: application/json` is necessarily a `Blob`, and a `Blob` part always
44
- * serializes with a filename.
45
- *
46
- * @param options - The entity metadata, the file to attach, and an optional fixed boundary.
47
- * @param options.entity - Serialized as the JSON `entity_content` part.
48
- * @param options.filePath - Path of the file streamed as the `VersionData` part.
49
- * @param options.filename - Filename advertised for the `VersionData` part.
50
- * @param options.boundary - Boundary to use. Defaults to a random one; pass a fixed value in tests.
51
- * @returns The boundary, the `Content-Type` header value, and a body factory.
52
- */
53
- export declare function contentVersionMultipart(options: {
54
- entity: unknown;
55
- filePath: string;
56
- filename: string;
57
- boundary?: string;
58
- }): ContentVersionMultipart;
@@ -1,92 +0,0 @@
1
- /*
2
- * Copyright (c) 2026, Clay Chipps.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import crypto from 'node:crypto';
17
- import fs from 'node:fs';
18
- import { Readable } from 'node:stream';
19
- /**
20
- * Prefix for generated boundaries. Salesforce caps a boundary at 70 characters, so this plus the
21
- * 32 hex characters appended to it has to stay under that.
22
- */
23
- const BOUNDARY_PREFIX = 'simplyBoundary';
24
- /** CRLF, which is what RFC 2046 requires between multipart headers and parts — not a bare `\n`. */
25
- const CRLF = '\r\n';
26
- /**
27
- * Generate a multipart boundary.
28
- *
29
- * The boundary must not appear anywhere in the encoded body. Rather than scanning the file to
30
- * prove that, we use 128 bits of randomness, which makes an accidental collision less likely than
31
- * a disk error corrupting the upload anyway.
32
- *
33
- * @returns A boundary string, comfortably under the 70-character limit.
34
- */
35
- export function createBoundary() {
36
- return `${BOUNDARY_PREFIX}${crypto.randomBytes(16).toString('hex')}`;
37
- }
38
- /**
39
- * Escape a filename for inclusion in a `Content-Disposition` header.
40
- *
41
- * Applies the same normalization the WHATWG `FormData` serializer does. Without it, a file named
42
- * `my"file.pdf` would close the quoted string early, and one containing a newline could inject a
43
- * header. The `form-data` package this replaced did neither.
44
- *
45
- * @param filename - The raw filename.
46
- * @returns The filename with `"`, CR, and LF percent-encoded.
47
- */
48
- export function escapeHeaderFilename(filename) {
49
- return filename.replaceAll('\r', '%0D').replaceAll('\n', '%0A').replaceAll('"', '%22');
50
- }
51
- /**
52
- * Build the `multipart/form-data` body for a `ContentVersion` create request.
53
- *
54
- * The shape here matches Salesforce's documented example exactly, including the trailing semicolon
55
- * after `name="entity_content"` and the absence of a `filename` on that part. That absence is the
56
- * reason this is hand-built rather than delegated to the platform's `FormData`: a `FormData` part
57
- * carrying `Content-Type: application/json` is necessarily a `Blob`, and a `Blob` part always
58
- * serializes with a filename.
59
- *
60
- * @param options - The entity metadata, the file to attach, and an optional fixed boundary.
61
- * @param options.entity - Serialized as the JSON `entity_content` part.
62
- * @param options.filePath - Path of the file streamed as the `VersionData` part.
63
- * @param options.filename - Filename advertised for the `VersionData` part.
64
- * @param options.boundary - Boundary to use. Defaults to a random one; pass a fixed value in tests.
65
- * @returns The boundary, the `Content-Type` header value, and a body factory.
66
- */
67
- export function contentVersionMultipart(options) {
68
- const boundary = options.boundary ?? createBoundary();
69
- const entityJson = JSON.stringify(options.entity);
70
- const filename = escapeHeaderFilename(options.filename);
71
- const header = Buffer.from(`--${boundary}${CRLF}` +
72
- `Content-Disposition: form-data; name="entity_content";${CRLF}` +
73
- `Content-Type: application/json${CRLF}${CRLF}` +
74
- `${entityJson}${CRLF}` +
75
- `--${boundary}${CRLF}` +
76
- `Content-Type: application/octet-stream${CRLF}` +
77
- `Content-Disposition: form-data; name="VersionData"; filename="${filename}"${CRLF}${CRLF}`, 'utf8');
78
- const footer = Buffer.from(`${CRLF}--${boundary}--${CRLF}`, 'utf8');
79
- const createBody = () => Readable.from((async function* body() {
80
- yield header;
81
- yield* fs.createReadStream(options.filePath);
82
- yield footer;
83
- })());
84
- return {
85
- boundary,
86
- // Unquoted, matching what `form-data` and jsforce emit. RFC 2046 permits quoting, but the
87
- // unquoted form is the one known to work against this endpoint.
88
- contentType: `multipart/form-data; boundary=${boundary}`,
89
- createBody,
90
- };
91
- }
92
- //# sourceMappingURL=multipart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../src/common/multipart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;GAGG;AACH,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEzC,mGAAmG;AACnG,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,GAAG,eAAe,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AACvE,CAAC;AAED;;;;;;;;;GASG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