bulkyard 1.1.0 → 1.2.1
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/lib/commands/bulkyard/init.d.ts +15 -0
- package/lib/commands/bulkyard/init.js +61 -0
- package/lib/commands/bulkyard/init.js.map +1 -0
- package/lib/core/extractor.js +82 -20
- package/lib/core/extractor.js.map +1 -1
- package/messages/bulkyard.init.md +37 -0
- package/oclif.lock +8 -28
- package/oclif.manifest.json +65 -1
- package/package.json +2 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
/** Return type for the `bulkyard init` command. */
|
|
3
|
+
export type InitCommandResult = {
|
|
4
|
+
outputFile: string;
|
|
5
|
+
};
|
|
6
|
+
export default class Init extends SfCommand<InitCommandResult> {
|
|
7
|
+
static readonly summary: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly examples: string[];
|
|
10
|
+
static readonly flags: {
|
|
11
|
+
'output-file': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<InitCommandResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { existsSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
4
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
5
|
+
const messages = Messages.loadMessages('bulkyard', 'bulkyard.init');
|
|
6
|
+
const TEMPLATE = `# bulkyard config file
|
|
7
|
+
# See: https://github.com/jessegarrido/bulkyard
|
|
8
|
+
|
|
9
|
+
# Path to the SQLite database file used for extract and load operations.
|
|
10
|
+
database: bulkyard.db
|
|
11
|
+
|
|
12
|
+
# List of Salesforce objects to process.
|
|
13
|
+
objects:
|
|
14
|
+
# --- Extract example ---
|
|
15
|
+
# Extracts Account records into the "Account" table in the database.
|
|
16
|
+
- object: Account
|
|
17
|
+
query: SELECT Id, Name, Industry FROM Account
|
|
18
|
+
|
|
19
|
+
# --- Load example (commented out) ---
|
|
20
|
+
# Upserts Contact records from the "Contact" table back into Salesforce.
|
|
21
|
+
# - object: Contact
|
|
22
|
+
# operation: upsert
|
|
23
|
+
# externalIdField: Id
|
|
24
|
+
|
|
25
|
+
# Each object entry supports the following fields:
|
|
26
|
+
# object (required) Salesforce object API name (e.g. Account, Contact)
|
|
27
|
+
# query (extract) SOQL query to execute
|
|
28
|
+
# operation (load) Bulk API operation: insert, update, upsert, or delete
|
|
29
|
+
# externalIdField (load) External ID field, required for upsert
|
|
30
|
+
# table (optional) SQLite table name override (defaults to the object name)
|
|
31
|
+
`;
|
|
32
|
+
export default class Init extends SfCommand {
|
|
33
|
+
static summary = messages.getMessage('summary');
|
|
34
|
+
static description = messages.getMessage('description');
|
|
35
|
+
static examples = messages.getMessages('examples');
|
|
36
|
+
static flags = {
|
|
37
|
+
'output-file': Flags.string({
|
|
38
|
+
char: 'o',
|
|
39
|
+
summary: messages.getMessage('flags.output-file.summary'),
|
|
40
|
+
default: 'bulkyard.config.yml',
|
|
41
|
+
}),
|
|
42
|
+
force: Flags.boolean({
|
|
43
|
+
char: 'f',
|
|
44
|
+
summary: messages.getMessage('flags.force.summary'),
|
|
45
|
+
default: false,
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
async run() {
|
|
49
|
+
const { flags } = await this.parse(Init);
|
|
50
|
+
const outputFile = flags['output-file'];
|
|
51
|
+
if (existsSync(outputFile) && !flags.force) {
|
|
52
|
+
throw new SfError(messages.getMessage('error.alreadyExists', [outputFile]), 'AlreadyExistsError', [
|
|
53
|
+
'Use --force to overwrite the existing file.',
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
writeFileSync(outputFile, TEMPLATE, 'utf8');
|
|
57
|
+
this.log(messages.getMessage('info.created', [outputFile]));
|
|
58
|
+
return { outputFile };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/bulkyard/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAErD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAKpE,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBhB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAA4B;IACrD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC;YAC1B,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC;YACzD,OAAO,EAAE,qBAAqB;SAC/B,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;YACnD,OAAO,EAAE,KAAK;SACf,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;QAExC,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAC3C,MAAM,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,oBAAoB,EAAE;gBAChG,6CAA6C;aAC9C,CAAC,CAAC;QACL,CAAC;QAED,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAE5D,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC"}
|
package/lib/core/extractor.js
CHANGED
|
@@ -1,29 +1,91 @@
|
|
|
1
|
+
import { parse } from 'csv-parse/sync';
|
|
2
|
+
const BATCH_SIZE = 1000;
|
|
3
|
+
const POLL_INTERVAL_MS = 2000;
|
|
4
|
+
const POLL_TIMEOUT_MS = 600_000;
|
|
5
|
+
// Recursive rather than looping to satisfy no-constant-condition and no-await-in-loop.
|
|
6
|
+
async function waitForJobCompletion(conn, jobId, deadline) {
|
|
7
|
+
if (Date.now() > deadline) {
|
|
8
|
+
throw new Error(`Bulk query job timed out after ${POLL_TIMEOUT_MS / 1000}s`);
|
|
9
|
+
}
|
|
10
|
+
const jobUrl = `${conn.instanceUrl}/services/data/v${conn.getApiVersion()}/jobs/query/${jobId}`;
|
|
11
|
+
const info = await conn.requestGet(jobUrl);
|
|
12
|
+
if (info.state === 'JobComplete')
|
|
13
|
+
return;
|
|
14
|
+
if (info.state === 'Failed' || info.state === 'Aborted') {
|
|
15
|
+
const detail = info.errorMessage ? `: ${info.errorMessage}` : '';
|
|
16
|
+
throw new Error(`Bulk query job ${info.state}${detail}`);
|
|
17
|
+
}
|
|
18
|
+
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
19
|
+
return waitForJobCompletion(conn, jobId, deadline);
|
|
20
|
+
}
|
|
21
|
+
function parseCsvPage(csvText) {
|
|
22
|
+
// csv-parse uses snake_case option names
|
|
23
|
+
// eslint-disable-next-line camelcase
|
|
24
|
+
return parse(csvText, { columns: true, skip_empty_lines: true, cast: (v) => (v === '' ? null : v) });
|
|
25
|
+
}
|
|
1
26
|
export async function extractObject(conn, db, objConfig) {
|
|
2
27
|
const tableName = objConfig.table ?? objConfig.object;
|
|
3
28
|
try {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
if (records.length === 0) {
|
|
7
|
-
return { object: objConfig.object, table: tableName, recordCount: 0, success: true };
|
|
8
|
-
}
|
|
9
|
-
const firstRecord = records[0];
|
|
10
|
-
const recordKeys = Object.keys(firstRecord).filter((k) => k !== 'attributes');
|
|
29
|
+
const apiVersion = conn.getApiVersion();
|
|
30
|
+
const jobsUrl = `${conn.instanceUrl}/services/data/v${apiVersion}/jobs/query`;
|
|
11
31
|
const describeResult = await conn.describe(objConfig.object);
|
|
12
32
|
const fieldMap = new Map(describeResult.fields.map((f) => [f.name, f.type]));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
db.createTable(tableName, columns);
|
|
18
|
-
const cleanRecords = records.map((rec) => {
|
|
19
|
-
const cleaned = {};
|
|
20
|
-
for (const key of recordKeys) {
|
|
21
|
-
cleaned[key] = rec[key];
|
|
22
|
-
}
|
|
23
|
-
return cleaned;
|
|
33
|
+
// Create the bulk query job
|
|
34
|
+
const jobInfo = await conn.requestPost(jobsUrl, {
|
|
35
|
+
operation: 'query',
|
|
36
|
+
query: objConfig.query,
|
|
24
37
|
});
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
// Poll until the job is complete
|
|
39
|
+
await waitForJobCompletion(conn, jobInfo.id, Date.now() + POLL_TIMEOUT_MS);
|
|
40
|
+
// Fetch result pages one at a time using the Sforce-Locator header.
|
|
41
|
+
// Using fetch directly (rather than conn.bulk2.query's streaming abstraction) because
|
|
42
|
+
// jsforce's QueryJobV2.result() pipes multiple locator pages to the same stream with
|
|
43
|
+
// {end: true}, closing it after the first page and silently dropping subsequent pages.
|
|
44
|
+
const resultsBaseUrl = `${jobsUrl}/${jobInfo.id}/results`;
|
|
45
|
+
const authHeaders = {
|
|
46
|
+
Authorization: `Bearer ${conn.accessToken}`,
|
|
47
|
+
Accept: 'text/csv',
|
|
48
|
+
};
|
|
49
|
+
let locator = null;
|
|
50
|
+
let recordKeys = null;
|
|
51
|
+
let buffer = [];
|
|
52
|
+
let totalCount = 0;
|
|
53
|
+
do {
|
|
54
|
+
const url = locator ? `${resultsBaseUrl}?locator=${encodeURIComponent(locator)}` : resultsBaseUrl;
|
|
55
|
+
// eslint-disable-next-line no-await-in-loop
|
|
56
|
+
const response = await fetch(url, { headers: authHeaders });
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
// eslint-disable-next-line no-await-in-loop
|
|
59
|
+
const body = await response.text();
|
|
60
|
+
throw new Error(`Failed to fetch results page (${response.status}): ${body}`);
|
|
61
|
+
}
|
|
62
|
+
locator = response.headers.get('sforce-locator');
|
|
63
|
+
// eslint-disable-next-line no-await-in-loop
|
|
64
|
+
const csvText = await response.text();
|
|
65
|
+
if (!csvText.trim())
|
|
66
|
+
continue;
|
|
67
|
+
const rows = parseCsvPage(csvText);
|
|
68
|
+
for (const row of rows) {
|
|
69
|
+
if (recordKeys === null) {
|
|
70
|
+
recordKeys = Object.keys(row);
|
|
71
|
+
const columns = recordKeys.map((key) => ({
|
|
72
|
+
name: key,
|
|
73
|
+
sfType: fieldMap.get(key) ?? 'string',
|
|
74
|
+
}));
|
|
75
|
+
db.createTable(tableName, columns);
|
|
76
|
+
}
|
|
77
|
+
buffer.push(row);
|
|
78
|
+
totalCount++;
|
|
79
|
+
if (buffer.length >= BATCH_SIZE) {
|
|
80
|
+
db.insertRecords(tableName, recordKeys, buffer);
|
|
81
|
+
buffer = [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} while (locator && locator !== 'null');
|
|
85
|
+
if (buffer.length > 0 && recordKeys !== null) {
|
|
86
|
+
db.insertRecords(tableName, recordKeys, buffer);
|
|
87
|
+
}
|
|
88
|
+
return { object: objConfig.object, table: tableName, recordCount: totalCount, success: true };
|
|
27
89
|
}
|
|
28
90
|
catch (err) {
|
|
29
91
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../src/core/extractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../src/core/extractor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAkBvC,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,eAAe,GAAG,OAAO,CAAC;AAKhC,uFAAuF;AACvF,KAAK,UAAU,oBAAoB,CAAC,IAAgB,EAAE,KAAa,EAAE,QAAgB;IACnF,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,kCAAkC,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,mBAAmB,IAAI,CAAC,aAAa,EAAE,eAAe,KAAK,EAAE,CAAC;IAChG,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAe,MAAM,CAAC,CAAC;IACzD,IAAI,IAAI,CAAC,KAAK,K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EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChG,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACxG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Generate an annotated bulkyard YAML config file.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Scaffolds a starter config file with commented examples for both extract and load operations. The generated file includes an active Account extract example and a commented-out Contact load example, with annotations explaining every field.
|
|
8
|
+
|
|
9
|
+
# examples
|
|
10
|
+
|
|
11
|
+
- Generate a default bulkyard.config.yml config file:
|
|
12
|
+
|
|
13
|
+
<%= config.bin %> <%= command.id %>
|
|
14
|
+
|
|
15
|
+
- Generate a config file at a custom path:
|
|
16
|
+
|
|
17
|
+
<%= config.bin %> <%= command.id %> --output-file my-config.yml
|
|
18
|
+
|
|
19
|
+
- Overwrite an existing config file:
|
|
20
|
+
|
|
21
|
+
<%= config.bin %> <%= command.id %> --force
|
|
22
|
+
|
|
23
|
+
# flags.output-file.summary
|
|
24
|
+
|
|
25
|
+
Path to write the generated config file.
|
|
26
|
+
|
|
27
|
+
# flags.force.summary
|
|
28
|
+
|
|
29
|
+
Overwrite the output file if it already exists.
|
|
30
|
+
|
|
31
|
+
# info.created
|
|
32
|
+
|
|
33
|
+
Created config file: %s
|
|
34
|
+
|
|
35
|
+
# error.alreadyExists
|
|
36
|
+
|
|
37
|
+
File already exists: %s. Use --force to overwrite.
|
package/oclif.lock
CHANGED
|
@@ -3234,6 +3234,11 @@ csstype@^3.0.2:
|
|
|
3234
3234
|
resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz"
|
|
3235
3235
|
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
|
3236
3236
|
|
|
3237
|
+
csv-parse@^5:
|
|
3238
|
+
version "5.6.0"
|
|
3239
|
+
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.6.0.tgz#219beace2a3e9f28929999d2aa417d3fb3071c7f"
|
|
3240
|
+
integrity sha512-l3nz3euub2QMg5ouu5U09Ew9Wf6/wQ8I++ch1loQ0ljmzhmfZYrH9fflS22i/PQEvsPvxCwxgz5q7UB8K1JO4Q==
|
|
3241
|
+
|
|
3237
3242
|
csv-parse@^5.5.2:
|
|
3238
3243
|
version "5.5.5"
|
|
3239
3244
|
resolved "https://registry.npmjs.org/csv-parse/-/csv-parse-5.5.5.tgz"
|
|
@@ -6951,16 +6956,7 @@ stack-utils@^2.0.6:
|
|
|
6951
6956
|
dependencies:
|
|
6952
6957
|
escape-string-regexp "^2.0.0"
|
|
6953
6958
|
|
|
6954
|
-
"string-width-cjs@npm:string-width@^4.2.0":
|
|
6955
|
-
version "4.2.3"
|
|
6956
|
-
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
|
6957
|
-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
|
6958
|
-
dependencies:
|
|
6959
|
-
emoji-regex "^8.0.0"
|
|
6960
|
-
is-fullwidth-code-point "^3.0.0"
|
|
6961
|
-
strip-ansi "^6.0.1"
|
|
6962
|
-
|
|
6963
|
-
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
|
|
6959
|
+
"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:
|
|
6964
6960
|
version "4.2.3"
|
|
6965
6961
|
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
|
|
6966
6962
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
|
@@ -7028,14 +7024,7 @@ string_decoder@~1.1.1:
|
|
|
7028
7024
|
dependencies:
|
|
7029
7025
|
safe-buffer "~5.1.0"
|
|
7030
7026
|
|
|
7031
|
-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
|
|
7032
|
-
version "6.0.1"
|
|
7033
|
-
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
|
7034
|
-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
|
7035
|
-
dependencies:
|
|
7036
|
-
ansi-regex "^5.0.1"
|
|
7037
|
-
|
|
7038
|
-
strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
|
7027
|
+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
|
7039
7028
|
version "6.0.1"
|
|
7040
7029
|
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
|
|
7041
7030
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
|
@@ -7626,7 +7615,7 @@ workerpool@6.2.1:
|
|
|
7626
7615
|
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz"
|
|
7627
7616
|
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
|
|
7628
7617
|
|
|
7629
|
-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
|
|
7618
|
+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
|
|
7630
7619
|
version "7.0.0"
|
|
7631
7620
|
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
|
|
7632
7621
|
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
|
@@ -7644,15 +7633,6 @@ wrap-ansi@^6.2.0:
|
|
|
7644
7633
|
string-width "^4.1.0"
|
|
7645
7634
|
strip-ansi "^6.0.0"
|
|
7646
7635
|
|
|
7647
|
-
wrap-ansi@^7.0.0:
|
|
7648
|
-
version "7.0.0"
|
|
7649
|
-
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
|
|
7650
|
-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
|
7651
|
-
dependencies:
|
|
7652
|
-
ansi-styles "^4.0.0"
|
|
7653
|
-
string-width "^4.1.0"
|
|
7654
|
-
strip-ansi "^6.0.0"
|
|
7655
|
-
|
|
7656
7636
|
wrap-ansi@^8.1.0:
|
|
7657
7637
|
version "8.1.0"
|
|
7658
7638
|
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"
|
package/oclif.manifest.json
CHANGED
|
@@ -115,6 +115,70 @@
|
|
|
115
115
|
"extract:bulkyard"
|
|
116
116
|
]
|
|
117
117
|
},
|
|
118
|
+
"bulkyard:init": {
|
|
119
|
+
"aliases": [],
|
|
120
|
+
"args": {},
|
|
121
|
+
"description": "Scaffolds a starter config file with commented examples for both extract and load operations. The generated file includes an active Account extract example and a commented-out Contact load example, with annotations explaining every field.",
|
|
122
|
+
"examples": [
|
|
123
|
+
"Generate a default bulkyard.config.yml config file:\n<%= config.bin %> <%= command.id %>",
|
|
124
|
+
"Generate a config file at a custom path:\n<%= config.bin %> <%= command.id %> --output-file my-config.yml",
|
|
125
|
+
"Overwrite an existing config file:\n<%= config.bin %> <%= command.id %> --force"
|
|
126
|
+
],
|
|
127
|
+
"flags": {
|
|
128
|
+
"json": {
|
|
129
|
+
"description": "Format output as json.",
|
|
130
|
+
"helpGroup": "GLOBAL",
|
|
131
|
+
"name": "json",
|
|
132
|
+
"allowNo": false,
|
|
133
|
+
"type": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"flags-dir": {
|
|
136
|
+
"helpGroup": "GLOBAL",
|
|
137
|
+
"name": "flags-dir",
|
|
138
|
+
"summary": "Import flag values from a directory.",
|
|
139
|
+
"hasDynamicHelp": false,
|
|
140
|
+
"multiple": false,
|
|
141
|
+
"type": "option"
|
|
142
|
+
},
|
|
143
|
+
"output-file": {
|
|
144
|
+
"char": "o",
|
|
145
|
+
"name": "output-file",
|
|
146
|
+
"summary": "Path to write the generated config file.",
|
|
147
|
+
"default": "bulkyard.config.yml",
|
|
148
|
+
"hasDynamicHelp": false,
|
|
149
|
+
"multiple": false,
|
|
150
|
+
"type": "option"
|
|
151
|
+
},
|
|
152
|
+
"force": {
|
|
153
|
+
"char": "f",
|
|
154
|
+
"name": "force",
|
|
155
|
+
"summary": "Overwrite the output file if it already exists.",
|
|
156
|
+
"allowNo": false,
|
|
157
|
+
"type": "boolean"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"hasDynamicHelp": false,
|
|
161
|
+
"hiddenAliases": [],
|
|
162
|
+
"id": "bulkyard:init",
|
|
163
|
+
"pluginAlias": "bulkyard",
|
|
164
|
+
"pluginName": "bulkyard",
|
|
165
|
+
"pluginType": "core",
|
|
166
|
+
"strict": true,
|
|
167
|
+
"summary": "Generate an annotated bulkyard YAML config file.",
|
|
168
|
+
"enableJsonFlag": true,
|
|
169
|
+
"isESM": true,
|
|
170
|
+
"relativePath": [
|
|
171
|
+
"lib",
|
|
172
|
+
"commands",
|
|
173
|
+
"bulkyard",
|
|
174
|
+
"init.js"
|
|
175
|
+
],
|
|
176
|
+
"aliasPermutations": [],
|
|
177
|
+
"permutations": [
|
|
178
|
+
"bulkyard:init",
|
|
179
|
+
"init:bulkyard"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
118
182
|
"bulkyard:load": {
|
|
119
183
|
"aliases": [],
|
|
120
184
|
"args": {},
|
|
@@ -248,5 +312,5 @@
|
|
|
248
312
|
]
|
|
249
313
|
}
|
|
250
314
|
},
|
|
251
|
-
"version": "1.1
|
|
315
|
+
"version": "1.2.1"
|
|
252
316
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bulkyard",
|
|
3
3
|
"description": "A Salesforce CLI plugin for bulk data extraction and loading via local SQLite3 databases.",
|
|
4
|
-
"version": "1.1
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@oclif/core": "^4",
|
|
7
7
|
"@salesforce/core": "^8",
|
|
8
8
|
"@salesforce/sf-plugins-core": "^12",
|
|
9
9
|
"better-sqlite3": "^9",
|
|
10
|
+
"csv-parse": "^5",
|
|
10
11
|
"js-yaml": "^4.1.1"
|
|
11
12
|
},
|
|
12
13
|
"devDependencies": {
|