@pdfbutler/migration-cli 0.0.27 → 0.0.29
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 +332 -45
- package/lib/commands/butler/pb/admincredentials.js +37 -37
- package/lib/commands/butler/pb/admincredentials.js.map +1 -1
- package/lib/commands/butler/pb/adminsettings.d.ts +1 -2
- package/lib/commands/butler/pb/adminsettings.js +32 -32
- package/lib/commands/butler/pb/adminsettings.js.map +1 -1
- package/lib/commands/butler/pb/export.d.ts +12 -4
- package/lib/commands/butler/pb/export.js +333 -200
- package/lib/commands/butler/pb/export.js.map +1 -1
- package/lib/commands/butler/pb/exportdatasource.d.ts +28 -0
- package/lib/commands/butler/pb/exportdatasource.js +163 -0
- package/lib/commands/butler/pb/exportdatasource.js.map +1 -0
- package/lib/commands/butler/pb/exportpack.d.ts +15 -0
- package/lib/commands/butler/pb/exportpack.js +282 -68
- package/lib/commands/butler/pb/exportpack.js.map +1 -1
- package/lib/commands/butler/pb/import.d.ts +17 -3
- package/lib/commands/butler/pb/import.js +403 -192
- package/lib/commands/butler/pb/import.js.map +1 -1
- package/lib/commands/butler/pb/importdatasource.d.ts +31 -0
- package/lib/commands/butler/pb/importdatasource.js +252 -0
- package/lib/commands/butler/pb/importdatasource.js.map +1 -0
- package/lib/commands/butler/pb/importpack.d.ts +23 -0
- package/lib/commands/butler/pb/importpack.js +391 -69
- package/lib/commands/butler/pb/importpack.js.map +1 -1
- package/lib/commands/butler/sb/export/signtemplate.d.ts +23 -0
- package/lib/commands/butler/sb/export/signtemplate.js +111 -0
- package/lib/commands/butler/sb/export/signtemplate.js.map +1 -0
- package/lib/commands/butler/sb/import/signtemplate.d.ts +23 -0
- package/lib/commands/butler/sb/import/signtemplate.js +108 -0
- package/lib/commands/butler/sb/import/signtemplate.js.map +1 -0
- package/lib/utils/authentication.d.ts +3 -1
- package/lib/utils/authentication.js +13 -17
- package/lib/utils/authentication.js.map +1 -1
- package/lib/utils/constants.d.ts +134 -89
- package/lib/utils/constants.js +65 -20
- package/lib/utils/constants.js.map +1 -1
- package/lib/utils/extract-templates.d.ts +1 -0
- package/lib/utils/extract-templates.js +89 -0
- package/lib/utils/extract-templates.js.map +1 -0
- package/lib/utils/id-map.d.ts +1 -0
- package/lib/utils/id-map.js +22 -0
- package/lib/utils/id-map.js.map +1 -0
- package/lib/utils/ids.d.ts +2 -0
- package/lib/utils/ids.js +21 -0
- package/lib/utils/ids.js.map +1 -0
- package/lib/utils/logger.d.ts +2 -1
- package/lib/utils/logger.js +15 -7
- package/lib/utils/logger.js.map +1 -1
- package/lib/utils/pack-docconfigs.d.ts +4 -0
- package/lib/utils/pack-docconfigs.js +77 -0
- package/lib/utils/pack-docconfigs.js.map +1 -0
- package/messages/butler.pb.export.md +4 -0
- package/messages/butler.pb.exportdatasource.md +51 -0
- package/messages/butler.pb.exportpack.md +24 -0
- package/messages/butler.pb.import.md +4 -0
- package/messages/butler.pb.importdatasource.md +51 -0
- package/messages/butler.pb.importpack.md +24 -0
- package/messages/butler.sb.export.signtemplate.md +35 -0
- package/messages/butler.sb.import.signtemplate.md +35 -0
- package/oclif.manifest.json +437 -46
- package/package.json +223 -215
package/lib/utils/constants.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CUT = exports.PATTERN = exports.RESULT = exports.MESSAGE = exports.ERROR = exports.PATH = void 0;
|
|
4
4
|
exports.PATH = {
|
|
5
|
-
IMPORT_EXCEL: 'config/xls/import-config',
|
|
6
|
-
IMPORT_WORD: 'config/import-config',
|
|
7
|
-
IMPORT_PPTX: 'config/pptx/import-config',
|
|
8
|
-
IMPORT_PDF: 'config/pdf/import-config',
|
|
9
|
-
IMPORT_EMAIL: 'config/import-config',
|
|
10
|
-
IMPORT_CSV: 'config/csv/import-config',
|
|
11
5
|
EXPORT_DOC_CONFIG: '/cadmus_core/DocConfig/Export2/',
|
|
6
|
+
EXPORT_SIGN_TEMPLATE: '/services/apexrest/cadmus_sign2/SignRequestTemplate/Export/',
|
|
7
|
+
IMPORT_SIGN_TEMPLATE: '/services/apexrest/cadmus_sign2/SignRequestTemplate/Import/',
|
|
8
|
+
EXPORT_DATA_SOURCE: '/services/apexrest/cadmus_core/DataSource/Export/',
|
|
9
|
+
IMPORT_DATA_SOURCE: '/services/apexrest/cadmus_core/DataSource/Import',
|
|
12
10
|
IMPORT_PACK: '/services/apexrest/cadmus_core/Pack/Import',
|
|
13
11
|
EXPORT_PACK: '/services/apexrest/cadmus_core/Pack/Export/',
|
|
14
12
|
ADMIN: '/services/apexrest/cadmus_core/Manage/Admin',
|
|
@@ -16,18 +14,18 @@ exports.PATH = {
|
|
|
16
14
|
exports.ERROR = {
|
|
17
15
|
UNSUPPORTED_RECORD_TYPE: 'Unsupported record type',
|
|
18
16
|
CONNECTION_FAILED: 'Connection to Salesforce failed.',
|
|
19
|
-
UNKNOWN_SERVER: 'An unexpected error occurred. Please contact support.',
|
|
20
17
|
NO_AUTH_PARAMS: 'Authentication parameters missing. Provide either username or session and instance.',
|
|
21
18
|
NO_MATCHING_DOC_CONFIGS: 'No matching DocConfig IDs found.',
|
|
22
19
|
NO_MATCHING_FILES: 'No matching files found',
|
|
23
20
|
EXPORT_FAILED: 'DocConfig export failed. Check the IDs and try again.',
|
|
24
21
|
URL_NOT_FOUND: 'Could not find a matching URL.',
|
|
25
|
-
|
|
22
|
+
URL_NOT_FOUND_VERSION_TOO_LOW: 'Could not find a matching URL. Verify that you have PDFButler version greater than v1.440.',
|
|
26
23
|
ID_NOT_EXIST: 'No rows found for the given ID.',
|
|
27
24
|
PACK_NOT_EXIST: 'Cannot find the Pack with Customer Pack ID: [PACK_ID].',
|
|
28
25
|
EMPTY_INSTANCE: 'Instance URL (--instance) cannot be empty.',
|
|
29
26
|
EMPTY_SESSION: 'Session ID (--session) cannot be empty.',
|
|
30
27
|
EMPTY_INSTANCE_AND_SESSION: 'Both Session ID and Instance URL cannot be empty.',
|
|
28
|
+
INVALID_INSTANCE_OR_ORG_UNAVAILABLE: 'Received a non-API response from Salesforce. Verify that --instance is correct and the org is available.',
|
|
31
29
|
BLANK_PACK_FLAG: 'Flag "pack" cannot be blank.',
|
|
32
30
|
READING_FOLDER: 'Error reading folder: [MESSAGE].',
|
|
33
31
|
READING_FILES: 'Failed to read files from folder: [FOLDER].',
|
|
@@ -40,24 +38,27 @@ exports.ERROR = {
|
|
|
40
38
|
SAVING: 'Error while saving file: [MESSAGE].',
|
|
41
39
|
FAILED_TO_SAVE_FILE: 'Failed to save the file.',
|
|
42
40
|
OUT_FLAG_REQUIRED: 'The flag "out" cannot be empty.',
|
|
43
|
-
EMPTY_PACK: 'Exported pack data for Pack ID [PACK] is empty.',
|
|
44
41
|
IMPORT_SETTINGS: 'Failed while importing settings. Error: [MESSAGE].',
|
|
45
42
|
IMPORT_CREDENTIALS: 'Failed to import user credentials. Error: [MESSAGE].',
|
|
46
43
|
BLANK_BACKEND: 'One or more DocConfigs have no backend.',
|
|
47
44
|
USER_NO_PERMISSIONS: 'User does not have read/write permissions.',
|
|
45
|
+
NO_MATCHING_DATA_SOURCES: 'No matching DataSource IDs found.',
|
|
46
|
+
EXPORT_DATA_SOURCE_FAILED: 'DataSource export failed. Check the IDs and try again.',
|
|
47
|
+
IMPORT_DATA_SOURCE_FAILED: 'DataSource import failed. Check the JSON and try again.',
|
|
48
|
+
EXPORT_SIGN_TEMPLATE_FAILED: 'Sign Request Template export failed. Check the IDs and try again.',
|
|
49
|
+
IMPORT_SIGN_TEMPLATE_FAILED: 'Sign Request Template import failed. Check the JSON and try again.',
|
|
50
|
+
PACK_JSON_PARSE_FAILED: 'Failed to parse exported pack JSON: [FILE].',
|
|
51
|
+
DOC_CONFIG_NOT_EXIST: 'Cannot find the DocConfig with ID: [DOC_CONFIG_ID].',
|
|
52
|
+
EXPORTPACK_DOC_CONFIG_FLAGS_REQUIRED: 'For DocConfig backend export, provide --auth-env-var, --endpoint and --stage.',
|
|
48
53
|
};
|
|
49
54
|
exports.MESSAGE = {
|
|
50
|
-
CREATION_CONNECTION: 'Creating connection with the Salesforce org...',
|
|
51
|
-
AUTHORIZATION: 'Authorizing with username: [VALUE].',
|
|
52
|
-
RUN_AUTH_COMMAND: 'Run "sf org login web" before authenticating with the target.',
|
|
53
55
|
CHECK_SESSION_INSTANCE: 'Verify that the session is valid and the instance is correct.',
|
|
54
56
|
CONNECTED_TO_ORG: 'Connected to [USERNAME] (Org ID: [ORG_ID]).',
|
|
55
57
|
CONNECTED_TO_INSTANCE: 'Connected to instance: [INSTANCE_URL].',
|
|
56
58
|
SPLITTED_DOC_CONFIGS: 'DocConfig IDs after splitting: [VALUE].',
|
|
57
59
|
EXPORTED_DOC_CONFIGS: 'Exported DocConfigs: [VALUE].',
|
|
58
|
-
FOLDER_CREATED: 'Folder structure created at: [VALUE].',
|
|
59
60
|
DOC_CONFIG_NO_BACKEND: 'DocConfig with ID [VALUE] has no backend.',
|
|
60
|
-
|
|
61
|
+
BACKEND_DATA_ARCHIVED_PROGRESS: 'Exported backend data has been archived. ([EXPORTED]/[TOTAL])',
|
|
61
62
|
USER_HAS_PERMISSIONS: 'User has read/write permissions.',
|
|
62
63
|
ARCHIVE_UNZIPPED: 'Archive unzipped and stored locally.',
|
|
63
64
|
ARCHIVE_RECORDED: 'Archive stored locally.',
|
|
@@ -66,30 +67,73 @@ exports.MESSAGE = {
|
|
|
66
67
|
SAVE_AS_ZIP: 'Saving as ZIP...',
|
|
67
68
|
SAVE_BACKEND: 'Saving backend only.',
|
|
68
69
|
PARTIAL_EXPORT_ACTIVE: 'Partial export active. DocConfigs without backend will not be exported.',
|
|
69
|
-
TRY_GET_DOC_CONFIG_BACKEND: 'Retrieving backend for DocConfig ID: [VALUE].',
|
|
70
70
|
START_EXPORT_BACKEND: 'Starting backend export for DocConfigs.',
|
|
71
|
+
BACKEND_RETRIEVAL_START: 'Starting backend retrieval for DocConfig IDs ([COUNT]): [IDS].',
|
|
72
|
+
BACKEND_RETRIEVING: 'Retrieving backend ([INDEX]/[COUNT]): [ID].',
|
|
73
|
+
BACKEND_RETRIEVED: 'Retrieved backend ([INDEX]/[COUNT]): [ID].',
|
|
71
74
|
RETRIEVING_ITEMS: 'Retrieving items from directory...',
|
|
72
75
|
MISSING_PACKS: 'Missing packs: [PACKS].',
|
|
73
76
|
USERNAME: 'Username: [USERNAME].',
|
|
74
77
|
PACKS_TO_IMPORT: 'Packs to import: [PACKS].',
|
|
75
78
|
PACKS_TO_EXPORT: 'Packs to export: [PACKS].',
|
|
76
79
|
FOLDER_TO_RETRIEVE: 'Retrieving from folder: [FOLDER].',
|
|
77
|
-
FOLDER_TO_OUTPUT: 'Output folder: [FOLDER].',
|
|
78
80
|
FILES_IN_FOLDER: 'Files found: [FILES].',
|
|
79
81
|
SUCCESS_DATA_WRITTEN: 'Data successfully written to the Salesforce org.',
|
|
80
82
|
SUCCESS_IMPORT_PACK: 'Successfully imported [PACK]',
|
|
81
83
|
ENDPOINT_URL: 'Endpoint base URL: [URL].',
|
|
82
|
-
FINAL_URL: 'Final URL: [URL].',
|
|
83
84
|
CALL_SERVICE: 'Calling external service...',
|
|
84
85
|
SAVING_TO_DIRECTORY: 'Saving to directory...',
|
|
85
|
-
|
|
86
|
-
FILE_PATH: 'File path: [PATH].',
|
|
87
|
-
SUCCESS_EXPORT_TO: 'Data successfully exported to: [PATH].',
|
|
86
|
+
SUCCESS_EXPORT: 'Data successfully exported.',
|
|
88
87
|
TRY_EXPORT_PACK: 'Trying to export pack with ID: [PACK].',
|
|
88
|
+
DOC_CONFIG_EXPORT_MODE: 'DocConfig export mode: [MODE].',
|
|
89
|
+
DOC_CONFIGS_TO_EXPORT: 'DocConfigs to export: [DOC_CONFIGS].',
|
|
90
|
+
TRY_EXPORT_DOC_CONFIG: 'Trying to export DocConfig with ID: [DOC_CONFIG].',
|
|
91
|
+
DOC_CONFIGS_TO_IMPORT: 'DocConfigs to import: [DOC_CONFIGS].',
|
|
92
|
+
TRY_IMPORT_DOC_CONFIG: 'Trying to import DocConfig with ID: [DOC_CONFIG].',
|
|
93
|
+
NO_DOC_CONFIGS_IN_PACK: 'No DocConfigs found for mode "[MODE]" in exported pack [PACK].',
|
|
89
94
|
USED_SHORT_PATH: 'Using short paths.',
|
|
90
95
|
SENDING_TO_ENDPOINT: 'Sending data to endpoint: [URL].',
|
|
91
96
|
SUCCESS_IMPORT_SETTINGS: 'Settings imported successfully.',
|
|
92
97
|
SUCCESS_IMPORT_CREDENTIALS: 'User credentials imported successfully.',
|
|
98
|
+
NEW_TEMPLATES_FOUND: 'New Templates Found: [VALUE]. Continuing Recursive Export...',
|
|
99
|
+
UNDEFINED: 'undefined',
|
|
100
|
+
START_IMPORT_MAIN: 'Starting import process for DocConfig ([INDEX]/[COUNT]):\n[ID]',
|
|
101
|
+
FOUND_TEMPLATES: 'Templates found: [COUNT].',
|
|
102
|
+
NO_TEMPLATES_FOUND: 'No templates found for main DocConfig.',
|
|
103
|
+
IMPORT_TEMPLATES_SFDC: 'Importing template SFDC configs...',
|
|
104
|
+
IMPORT_TEMPLATES_ZIP: 'Importing template backends...',
|
|
105
|
+
IMPORT_MAIN_SFDC: 'Importing main DocConfig SFDC...',
|
|
106
|
+
UPDATE_MAIN_WITH_TEMPLATE_IDS: 'Updating main DocConfig with cloned template IDs.',
|
|
107
|
+
DOC_CONFIG_ID_MAPPED_BLOCK: '[ENTITY] ID mapped:\n{\n Old Customer Document Config Id:\n\t[OLD_ID]\n New Customer Document Config Id:\n\t[NEW_ID]\n}',
|
|
108
|
+
IMPORTING_ZIP_WITH_ID: 'Importing DocConfig Backend:\n[ID]',
|
|
109
|
+
IMPORTING_ZIP_PROGRESS: 'Importing Template Backend ([INDEX]/[COUNT]):\n[ID]',
|
|
110
|
+
JSON_PARSE_FAILED: 'Failed to parse JSON at [PATH].',
|
|
111
|
+
TEMPLATES_DETECTED_WARNING: 'Templates detected for Doc Config [ID]: [TEMPLATES]. To prevent errors, run import command with -m | --templates flag.',
|
|
112
|
+
CLONE_LINKED_ORGS_WARNING: 'Be careful: without -c | --clone, you can migrate data only between linked orgs (e.g., TEST => PROD).',
|
|
113
|
+
START_SPLIT_DATA_SOURCES: 'Parsing DataSource IDs...',
|
|
114
|
+
SPLITTED_DATA_SOURCES_LIST: 'DataSource IDs: [VALUE].',
|
|
115
|
+
MISSING_DATA_SOURCES: "Can't find files for DataSource IDs: [VALUE].",
|
|
116
|
+
ALL_DATA_SOURCES_FOUND: 'All DataSource files found.',
|
|
117
|
+
EXPORTED_DATA_SOURCES_SUCCESS: 'Exported DataSources: [VALUE].',
|
|
118
|
+
EXPORTING_SIGN_REQUEST_TEMPLATE: 'Exporting Sign Request Template [INDEX]/[TOTAL]: [ID].',
|
|
119
|
+
IMPORTING_SIGN_REQUEST_TEMPLATE: 'Importing Sign Request Template [INDEX]/[TOTAL]: [ID].',
|
|
120
|
+
IMPORT_SIGN_REQUEST_TEMPLATE_FAILED: 'Import Sign Request Template failed for ID: [ID].',
|
|
121
|
+
EXPORT_SIGN_REQUEST_TEMPLATE_FAILED: 'Export Sign Request Template failed for ID: [ID].',
|
|
122
|
+
IMPORTING_DATA_SOURCE: 'Importing DataSource [INDEX]/[TOTAL]: [ID].',
|
|
123
|
+
IMPORTING_PARENT_DATA_SOURCE: 'Importing Parent DataSource [INDEX]/[TOTAL]: [ID].',
|
|
124
|
+
IMPORT_DATA_SOURCE_SUCCESS: 'DataSource import succeeded for ID: [ID].',
|
|
125
|
+
IMPORT_DATA_SOURCE_FAILED: 'DataSource import failed for ID: [ID].',
|
|
126
|
+
PARENT_DATA_SOURCES_FOUND: 'Parent DataSources find ([VALUE]).',
|
|
127
|
+
PDFBUTLER_MIN_VERSION: 'Ensure PDF Butler package version is at least v1.505.',
|
|
128
|
+
IMPORTED_DATA_SOURCES_SUCCESS: 'Imported DataSources: [VALUE].',
|
|
129
|
+
EXPORTING_DATA_SOURCE: 'Exporting DataSource ([INDEX]/[TOTAL]):\n[ID].',
|
|
130
|
+
EXPORTING_PARENT_DATA_SOURCE: 'Exporting Parent DataSource ([INDEX]/[TOTAL]):\n[ID].',
|
|
131
|
+
FETCH_DATA_SUCCESS: 'DataSource export succeeded.',
|
|
132
|
+
FETCH_DATA_FAILED: 'DataSource export failed for ID: [ID].',
|
|
133
|
+
PARENT_DATA_SOURCE_DETECTED_INFO: 'Parent DataSource detected for [ID]: [PARENT_ID].',
|
|
134
|
+
PARENT_DATA_SOURCE_DETECTED_WARN: 'If it is not exported, import may fail. Use -p | --export-parents to automatically export related DataSources.',
|
|
135
|
+
PARENT_DATA_SOURCE_FILE_NOT_FOUND: 'Parent DataSource file not found: [PATH].',
|
|
136
|
+
PARENT_CHAIN_CYCLE_DETECTED: 'Cycle detected in parent chain at DataSource ID: [ID].',
|
|
93
137
|
};
|
|
94
138
|
exports.RESULT = {
|
|
95
139
|
FAILED: 'FAILED',
|
|
@@ -98,6 +142,7 @@ exports.RESULT = {
|
|
|
98
142
|
};
|
|
99
143
|
exports.PATTERN = {
|
|
100
144
|
DOC_CONFIG: /([\w-]{36})/,
|
|
145
|
+
DATA_SOURCE_ID: /^[a-zA-Z0-9]{15,18}(?:_[a-zA-Z0-9]{15,18})?$/,
|
|
101
146
|
};
|
|
102
147
|
exports.CUT = {
|
|
103
148
|
AFTER: 150,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG;IAClB,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG;IAClB,iBAAiB,EAAE,iCAAiC;IACpD,oBAAoB,EAAE,6DAA6D;IACnF,oBAAoB,EAAE,6DAA6D;IACnF,kBAAkB,EAAE,mDAAmD;IACvE,kBAAkB,EAAE,kDAAkD;IACtE,WAAW,EAAE,4CAA4C;IACzD,WAAW,EAAE,6CA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O,GAAG;IACrB,UAAU,EAAE,aAAa;IACzB,cAAc,EAAE,8CAA8C;CACtD,CAAC;AAEE,QAAA,GAAG,GAAG;IACjB,KAAK,EAAE,GAAG;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function extractTemplateIds(dir: string): Promise<string[]>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.extractTemplateIds = extractTemplateIds;
|
|
37
|
+
const node_fs_1 = require("node:fs");
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const logger_1 = require("./logger");
|
|
40
|
+
const constants_1 = require("./constants");
|
|
41
|
+
const isTemplateRecord = (value) => {
|
|
42
|
+
if (!value || typeof value !== 'object')
|
|
43
|
+
return false;
|
|
44
|
+
const record = value;
|
|
45
|
+
return typeof record.recordType === 'string' && typeof record.documentConfigTemplateId === 'string';
|
|
46
|
+
};
|
|
47
|
+
async function extractTemplateIds(dir) {
|
|
48
|
+
const templateIds = new Set();
|
|
49
|
+
const validRecordTypes = ['DOCUMENT_V3', 'DOCUMENT_V2', 'DOCUMENT'];
|
|
50
|
+
const configTypesPath = path.join(dir, 'ConfigTypes');
|
|
51
|
+
const walk = async (currentPath) => {
|
|
52
|
+
let items;
|
|
53
|
+
try {
|
|
54
|
+
items = await node_fs_1.promises.readdir(currentPath, { withFileTypes: true });
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
// ConfigTypes might not exist in every export
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const tasks = items.map(async (item) => {
|
|
61
|
+
const fullPath = path.join(currentPath, item.name);
|
|
62
|
+
if (item.isDirectory()) {
|
|
63
|
+
await walk(fullPath);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!item.isFile() || !item.name.endsWith('.json'))
|
|
67
|
+
return;
|
|
68
|
+
try {
|
|
69
|
+
const content = await node_fs_1.promises.readFile(fullPath, 'utf8');
|
|
70
|
+
const json = JSON.parse(content);
|
|
71
|
+
const records = Array.isArray(json) ? json : [json];
|
|
72
|
+
for (const rec of records) {
|
|
73
|
+
if (!isTemplateRecord(rec))
|
|
74
|
+
continue;
|
|
75
|
+
if (!validRecordTypes.includes(rec.recordType))
|
|
76
|
+
continue;
|
|
77
|
+
templateIds.add(rec.documentConfigTemplateId);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (e) {
|
|
81
|
+
logger_1.Logger.error(constants_1.MESSAGE.JSON_PARSE_FAILED.replace('[PATH]', fullPath));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
await Promise.all(tasks);
|
|
85
|
+
};
|
|
86
|
+
await walk(configTypesPath);
|
|
87
|
+
return Array.from(templateIds);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=extract-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-templates.js","sourceRoot":"","sources":["../../src/utils/extract-templates.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,gDA2CC;AA5DD,qCAAyC;AAEzC,gDAAkC;AAClC,qCAAkC;AAClC,2CAAsC;AAOtC,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAA2B,EAAE;IACnE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,OAAO,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,wBAAwB,KAAK,QAAQ,CAAC;AACtG,CAAC,CAAC;AAEK,KAAK,UAAU,kBAAkB,CAAC,GAAW;IAClD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,MAAM,gBAAgB,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IAEtD,MAAM,IAAI,GAAG,KAAK,EAAE,WAAmB,EAAiB,EAAE;QACxD,IAAI,KAAe,CAAC;QACp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AAK,CAAC,mBAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;YACtE,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,MAAM,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const applyIdMap: (value: unknown, idMap: Record<string, string>) => unknown;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyIdMap = void 0;
|
|
4
|
+
const applyIdMap = (value, idMap) => {
|
|
5
|
+
if (Array.isArray(value)) {
|
|
6
|
+
return value.map((item) => (0, exports.applyIdMap)(item, idMap));
|
|
7
|
+
}
|
|
8
|
+
if (value && typeof value === 'object') {
|
|
9
|
+
const entries = Object.entries(value);
|
|
10
|
+
const next = {};
|
|
11
|
+
for (const [key, val] of entries) {
|
|
12
|
+
next[key] = (0, exports.applyIdMap)(val, idMap);
|
|
13
|
+
}
|
|
14
|
+
return next;
|
|
15
|
+
}
|
|
16
|
+
if (typeof value === 'string' && idMap[value]) {
|
|
17
|
+
return idMap[value];
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
exports.applyIdMap = applyIdMap;
|
|
22
|
+
//# sourceMappingURL=id-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-map.js","sourceRoot":"","sources":["../../src/utils/id-map.ts"],"names":[],"mappings":";;;AAAO,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,KAA6B,EAAW,EAAE;IACnF,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC;QACjE,MAAM,IAAI,GAA4B,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAA,kBAAU,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAnBW,QAAA,UAAU,cAmBrB"}
|
package/lib/utils/ids.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseCommaSeparatedValues = exports.parseDocConfigIds = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const parseDocConfigIds = (value) => {
|
|
6
|
+
const docConfigIds = value
|
|
7
|
+
.split(constants_1.PATTERN.DOC_CONFIG)
|
|
8
|
+
.map((docId) => docId.trim())
|
|
9
|
+
.filter((docId) => docId.length >= 36);
|
|
10
|
+
if (docConfigIds.length === 0) {
|
|
11
|
+
throw new Error(constants_1.ERROR.NO_MATCHING_DOC_CONFIGS);
|
|
12
|
+
}
|
|
13
|
+
return docConfigIds;
|
|
14
|
+
};
|
|
15
|
+
exports.parseDocConfigIds = parseDocConfigIds;
|
|
16
|
+
const parseCommaSeparatedValues = (value) => value
|
|
17
|
+
.split(',')
|
|
18
|
+
.map((item) => item.trim())
|
|
19
|
+
.filter((item) => item.length > 0);
|
|
20
|
+
exports.parseCommaSeparatedValues = parseCommaSeparatedValues;
|
|
21
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/utils/ids.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEtC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAY,EAAE;IAC3D,MAAM,YAAY,GAAG,KAAK;SACvB,KAAK,CAAC,mBAAO,CAAC,UAAU,CAAC;SACzB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAEzC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,iBAAK,CAAC,uBAAuB,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B;AAEK,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAY,EAAE,CACnE,KAAK;KACF,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAJ1B,QAAA,yBAAyB,6BAIC"}
|
package/lib/utils/logger.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export type LogType = 'info' | 'error' | 'success';
|
|
1
|
+
export type LogType = 'info' | 'warn' | 'error' | 'success';
|
|
2
2
|
export declare class Logger {
|
|
3
3
|
private static readonly COLORS;
|
|
4
4
|
static info(message: string, isShow?: boolean): void;
|
|
5
5
|
static error(message: string, isShow?: boolean): void;
|
|
6
|
+
static warn(message: string, isShow?: boolean): void;
|
|
6
7
|
static success(message: string, isShow?: boolean): void;
|
|
7
8
|
private static log;
|
|
8
9
|
}
|
package/lib/utils/logger.js
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Logger = void 0;
|
|
4
4
|
class Logger {
|
|
5
|
+
static COLORS = {
|
|
6
|
+
blue: '\x1b[34m',
|
|
7
|
+
green: '\x1b[32m',
|
|
8
|
+
yellow: '\x1b[33m',
|
|
9
|
+
red: '\x1b[31m',
|
|
10
|
+
reset: '\x1b[0m',
|
|
11
|
+
};
|
|
5
12
|
static info(message, isShow = true) {
|
|
6
13
|
Logger.log(message, 'info', isShow);
|
|
7
14
|
}
|
|
8
15
|
static error(message, isShow = true) {
|
|
9
16
|
Logger.log(message, 'error', isShow);
|
|
10
17
|
}
|
|
18
|
+
static warn(message, isShow = true) {
|
|
19
|
+
Logger.log(message, 'warn', isShow);
|
|
20
|
+
}
|
|
11
21
|
static success(message, isShow = true) {
|
|
12
22
|
Logger.log(message, 'success', isShow);
|
|
13
23
|
}
|
|
@@ -25,19 +35,17 @@ class Logger {
|
|
|
25
35
|
prefix = '[SUCCESS]';
|
|
26
36
|
color = Logger.COLORS.green;
|
|
27
37
|
break;
|
|
38
|
+
case 'warn':
|
|
39
|
+
prefix = '[WARN]';
|
|
40
|
+
color = Logger.COLORS.yellow;
|
|
41
|
+
break;
|
|
28
42
|
default:
|
|
29
43
|
prefix = '[INFO]';
|
|
30
44
|
color = Logger.COLORS.blue;
|
|
31
45
|
break;
|
|
32
46
|
}
|
|
33
|
-
|
|
47
|
+
process.stdout.write(`${color}${prefix} ${message}${Logger.COLORS.reset}\n`);
|
|
34
48
|
}
|
|
35
49
|
}
|
|
36
50
|
exports.Logger = Logger;
|
|
37
|
-
Logger.COLORS = {
|
|
38
|
-
blue: '\x1b[34m',
|
|
39
|
-
green: '\x1b[32m',
|
|
40
|
-
red: '\x1b[31m',
|
|
41
|
-
reset: '\x1b[0m',
|
|
42
|
-
};
|
|
43
51
|
//# sourceMappingURL=logger.js.map
|
package/lib/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;AAEA,MAAa,MAAM;IACT,MAAM,CAAU,MAAM,GAAG;QAC/B,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,UAAU;QAClB,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,SAAS;KACjB,CAAC;IAEK,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;QAC/C,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;QAChD,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;QAC/C,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,MAAM,GAAG,IAAI;QAClD,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAEO,MAAM,CAAC,GAAG,CAAC,OAAe,EAAE,OAAgB,MAAM,EAAE,MAAM,GAAG,IAAI;QACvE,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,IAAI,MAAc,CAAC;QACnB,IAAI,KAAa,CAAC;QAElB,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,OAAO;gBACV,MAAM,GAAG,SAAS,CAAC;gBACnB,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;gBAC1B,MAAM;YACR,KAAK,SAAS;gBACZ,MAAM,GAAG,WAAW,CAAC;gBACrB,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC5B,MAAM;YACR,KAAK,MAAM;gBACT,MAAM,GAAG,QAAQ,CAAC;gBAClB,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC7B,MAAM;YACR;gBACE,MAAM,GAAG,QAAQ,CAAC;gBAClB,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;gBAC3B,MAAM;QACV,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,MAAM,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;IAC/E,CAAC;;AAnDH,wBAoDC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type DocConfigExportMode = 'none' | 'pack' | 'lead' | 'full';
|
|
2
|
+
export declare const getPackDocConfigIds: (payload: unknown) => string[];
|
|
3
|
+
export declare const getLeadDocConfigIds: (payload: unknown) => string[];
|
|
4
|
+
export declare const getDocConfigIdsByMode: (payload: unknown, mode: DocConfigExportMode) => string[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDocConfigIdsByMode = exports.getLeadDocConfigIds = exports.getPackDocConfigIds = void 0;
|
|
4
|
+
const collectValuesByKey = (value, key, result) => {
|
|
5
|
+
if (Array.isArray(value)) {
|
|
6
|
+
for (const item of value) {
|
|
7
|
+
collectValuesByKey(item, key, result);
|
|
8
|
+
}
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (value == null || typeof value !== 'object') {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const record = value;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(record, key)) {
|
|
16
|
+
result.push(record[key]);
|
|
17
|
+
}
|
|
18
|
+
for (const nestedValue of Object.values(record)) {
|
|
19
|
+
collectValuesByKey(nestedValue, key, result);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const getPackDocConfigIds = (payload) => {
|
|
23
|
+
const packDocConfigs = [];
|
|
24
|
+
collectValuesByKey(payload, 'packDocConfigs', packDocConfigs);
|
|
25
|
+
const ids = new Set();
|
|
26
|
+
for (const item of packDocConfigs) {
|
|
27
|
+
if (!Array.isArray(item))
|
|
28
|
+
continue;
|
|
29
|
+
for (const config of item) {
|
|
30
|
+
if (config == null || typeof config !== 'object')
|
|
31
|
+
continue;
|
|
32
|
+
const id = config.CustomerDocumentConfigId__c;
|
|
33
|
+
if (typeof id === 'string' && id.trim().length > 0) {
|
|
34
|
+
ids.add(id.trim());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return Array.from(ids);
|
|
39
|
+
};
|
|
40
|
+
exports.getPackDocConfigIds = getPackDocConfigIds;
|
|
41
|
+
const getLeadDocConfigIds = (payload) => {
|
|
42
|
+
const packs = [];
|
|
43
|
+
collectValuesByKey(payload, 'pack', packs);
|
|
44
|
+
const ids = new Set();
|
|
45
|
+
for (const item of packs) {
|
|
46
|
+
const packList = Array.isArray(item) ? item : [item];
|
|
47
|
+
for (const pack of packList) {
|
|
48
|
+
if (pack == null || typeof pack !== 'object')
|
|
49
|
+
continue;
|
|
50
|
+
const id = pack.CustomerDocumentConfigId__c;
|
|
51
|
+
if (typeof id === 'string' && id.trim().length > 0) {
|
|
52
|
+
ids.add(id.trim());
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return Array.from(ids);
|
|
57
|
+
};
|
|
58
|
+
exports.getLeadDocConfigIds = getLeadDocConfigIds;
|
|
59
|
+
const getDocConfigIdsByMode = (payload, mode) => {
|
|
60
|
+
if (mode === 'none') {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
const ids = new Set();
|
|
64
|
+
if (mode === 'pack' || mode === 'full') {
|
|
65
|
+
for (const id of (0, exports.getPackDocConfigIds)(payload)) {
|
|
66
|
+
ids.add(id);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (mode === 'lead' || mode === 'full') {
|
|
70
|
+
for (const id of (0, exports.getLeadDocConfigIds)(payload)) {
|
|
71
|
+
ids.add(id);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return Array.from(ids);
|
|
75
|
+
};
|
|
76
|
+
exports.getDocConfigIdsByMode = getDocConfigIdsByMode;
|
|
77
|
+
//# sourceMappingURL=pack-docconfigs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-docconfigs.js","sourceRoot":"","sources":["../../src/utils/pack-docconfigs.ts"],"names":[],"mappings":";;;AAIA,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAE,GAAW,EAAE,MAAiB,EAAQ,EAAE;IAClF,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACxC,CAAC;QACD,OAAO;IACT,CAAC;IAED,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,KAAmB,CAAC;IACnC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CA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mB,EAAC,OAAO,CAAC,EAAE,CAAC;YAC9C,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC;AApBW,QAAA,qBAAqB,yBAoBhC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Export PDF Butler DataSource records from your organization.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Use this command to export DataSource records from a Salesforce org and save them locally as JSON.
|
|
8
|
+
|
|
9
|
+
# flags.target.summary
|
|
10
|
+
|
|
11
|
+
The Salesforce org username credentials to connect to the target org.
|
|
12
|
+
|
|
13
|
+
# flags.id.summary
|
|
14
|
+
|
|
15
|
+
The DataSource ID to export. For bulk export, enter multiple IDs separated by whitespaces.
|
|
16
|
+
|
|
17
|
+
# flags.folder.summary
|
|
18
|
+
|
|
19
|
+
The output folder path where the exported DataSource JSON files will be saved.
|
|
20
|
+
|
|
21
|
+
# flags.auth-env-var.summary
|
|
22
|
+
|
|
23
|
+
PDF Butler credentials for backend authentication.
|
|
24
|
+
|
|
25
|
+
# flags.endpoint.summary
|
|
26
|
+
|
|
27
|
+
PDF Butler endpoint URL.
|
|
28
|
+
|
|
29
|
+
# flags.stage.summary
|
|
30
|
+
|
|
31
|
+
CADMUS stage for backend operations.
|
|
32
|
+
|
|
33
|
+
# flags.logs.summary
|
|
34
|
+
|
|
35
|
+
Enable detailed logs for the export process.
|
|
36
|
+
|
|
37
|
+
# flags.parents.summary
|
|
38
|
+
|
|
39
|
+
Automatically export parent DataSources recursively when detected (without prompt).
|
|
40
|
+
|
|
41
|
+
# flags.session.summary
|
|
42
|
+
|
|
43
|
+
Salesforce Session ID for authentication.
|
|
44
|
+
|
|
45
|
+
# flags.instance.summary
|
|
46
|
+
|
|
47
|
+
Salesforce Instance URL for authentication.
|
|
48
|
+
|
|
49
|
+
# examples
|
|
50
|
+
|
|
51
|
+
- <%= config.bin %> <%= command.id %>
|
|
@@ -35,6 +35,30 @@ Out.
|
|
|
35
35
|
|
|
36
36
|
Logs.
|
|
37
37
|
|
|
38
|
+
# flags.auth-env-var.summary
|
|
39
|
+
|
|
40
|
+
Auth env var.
|
|
41
|
+
|
|
42
|
+
# flags.endpoint.summary
|
|
43
|
+
|
|
44
|
+
Endpoint URL.
|
|
45
|
+
|
|
46
|
+
# flags.stage.summary
|
|
47
|
+
|
|
48
|
+
Stage.
|
|
49
|
+
|
|
50
|
+
# flags.unzip.summary
|
|
51
|
+
|
|
52
|
+
Unzip backend archives.
|
|
53
|
+
|
|
54
|
+
# flags.templates.summary
|
|
55
|
+
|
|
56
|
+
Include template DocConfigs.
|
|
57
|
+
|
|
58
|
+
# flags.docconfig.summary
|
|
59
|
+
|
|
60
|
+
Export related DocConfigs mode: none | pack | lead | full.
|
|
61
|
+
|
|
38
62
|
# flags.session.summary
|
|
39
63
|
|
|
40
64
|
Session Id.
|