@pdfbutler/migration-cli 0.0.27 → 0.0.28
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 +193 -30
- 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 +10 -3
- package/lib/commands/butler/pb/export.js +295 -197
- package/lib/commands/butler/pb/export.js.map +1 -1
- package/lib/commands/butler/pb/exportdatasource.d.ts +27 -0
- package/lib/commands/butler/pb/exportdatasource.js +161 -0
- package/lib/commands/butler/pb/exportdatasource.js.map +1 -0
- package/lib/commands/butler/pb/exportpack.js +43 -46
- 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 +415 -183
- package/lib/commands/butler/pb/import.js.map +1 -1
- package/lib/commands/butler/pb/importdatasource.d.ts +30 -0
- package/lib/commands/butler/pb/importdatasource.js +250 -0
- package/lib/commands/butler/pb/importdatasource.js.map +1 -0
- package/lib/commands/butler/pb/importpack.js +38 -38
- 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 +125 -89
- package/lib/utils/constants.js +56 -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/logger.d.ts +2 -1
- package/lib/utils/logger.js +15 -7
- package/lib/utils/logger.js.map +1 -1
- package/messages/butler.pb.export.md +4 -0
- package/messages/butler.pb.exportdatasource.md +51 -0
- package/messages/butler.pb.import.md +4 -0
- package/messages/butler.pb.importdatasource.md +51 -0
- package/messages/butler.sb.export.signtemplate.md +35 -0
- package/messages/butler.sb.import.signtemplate.md +35 -0
- package/oclif.manifest.json +322 -43
- package/package.json +223 -215
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type ButlerSbImportsigntemplateResult = {
|
|
3
|
+
success: boolean;
|
|
4
|
+
};
|
|
5
|
+
export default class ButlerSbImportsigntemplate extends SfCommand<ButlerSbImportsigntemplateResult> {
|
|
6
|
+
static readonly summary: string;
|
|
7
|
+
static readonly description: string;
|
|
8
|
+
static readonly examples: string[];
|
|
9
|
+
static readonly flags: {
|
|
10
|
+
target: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
folder: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
logs: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
session: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
+
instance: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
+
};
|
|
17
|
+
private static isLogsActive;
|
|
18
|
+
private static getTemplateIds;
|
|
19
|
+
private static readTemplate;
|
|
20
|
+
private static getErrorMessage;
|
|
21
|
+
private static normalizeErrorMessage;
|
|
22
|
+
run(): Promise<ButlerSbImportsigntemplateResult>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
6
|
+
const core_1 = require("@salesforce/core");
|
|
7
|
+
const logger_1 = require("../../../../utils/logger");
|
|
8
|
+
const constants_1 = require("../../../../utils/constants");
|
|
9
|
+
const authentication_1 = require("../../../../utils/authentication");
|
|
10
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
11
|
+
const messages = core_1.Messages.loadMessages('@pdfbutler/migration-cli', 'butler.sb.import.signtemplate');
|
|
12
|
+
class ButlerSbImportsigntemplate extends sf_plugins_core_1.SfCommand {
|
|
13
|
+
static summary = messages.getMessage('summary');
|
|
14
|
+
static description = messages.getMessage('description');
|
|
15
|
+
static examples = messages.getMessages('examples');
|
|
16
|
+
static flags = {
|
|
17
|
+
target: sf_plugins_core_1.Flags.string({
|
|
18
|
+
summary: messages.getMessage('flags.target.summary'),
|
|
19
|
+
char: 't',
|
|
20
|
+
required: false,
|
|
21
|
+
}),
|
|
22
|
+
id: sf_plugins_core_1.Flags.string({
|
|
23
|
+
summary: messages.getMessage('flags.id.summary'),
|
|
24
|
+
char: 'i',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
folder: sf_plugins_core_1.Flags.string({
|
|
28
|
+
summary: messages.getMessage('flags.folder.summary'),
|
|
29
|
+
char: 'f',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
logs: sf_plugins_core_1.Flags.boolean({
|
|
33
|
+
summary: messages.getMessage('flags.logs.summary'),
|
|
34
|
+
char: 'l',
|
|
35
|
+
}),
|
|
36
|
+
session: sf_plugins_core_1.Flags.string({
|
|
37
|
+
summary: messages.getMessage('flags.session.summary'),
|
|
38
|
+
}),
|
|
39
|
+
instance: sf_plugins_core_1.Flags.string({
|
|
40
|
+
summary: messages.getMessage('flags.instance.summary'),
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
static isLogsActive = false;
|
|
44
|
+
static getTemplateIds(id) {
|
|
45
|
+
return id
|
|
46
|
+
.split(/[\s,]+/)
|
|
47
|
+
.map((item) => item.trim())
|
|
48
|
+
.filter(Boolean);
|
|
49
|
+
}
|
|
50
|
+
static async readTemplate(folder, templateId) {
|
|
51
|
+
const filePath = path.join(folder, 'signRequestTemplates', `${templateId}.json`);
|
|
52
|
+
const raw = await node_fs_1.promises.readFile(filePath, 'utf8');
|
|
53
|
+
return JSON.parse(raw);
|
|
54
|
+
}
|
|
55
|
+
static getErrorMessage(error) {
|
|
56
|
+
return error instanceof Error ? error.message : JSON.stringify(error);
|
|
57
|
+
}
|
|
58
|
+
static normalizeErrorMessage(message) {
|
|
59
|
+
const lower = message.toLowerCase();
|
|
60
|
+
const isHtmlResponse = lower.includes('<!doctype html') ||
|
|
61
|
+
lower.includes('<html') ||
|
|
62
|
+
lower.includes('<head') ||
|
|
63
|
+
lower.includes('<body') ||
|
|
64
|
+
lower.includes('<title>');
|
|
65
|
+
return isHtmlResponse ? constants_1.ERROR.INVALID_INSTANCE_OR_ORG_UNAVAILABLE : message;
|
|
66
|
+
}
|
|
67
|
+
async run() {
|
|
68
|
+
const { flags } = await this.parse(ButlerSbImportsigntemplate);
|
|
69
|
+
ButlerSbImportsigntemplate.isLogsActive = Boolean(flags.logs);
|
|
70
|
+
const target = flags.target;
|
|
71
|
+
const session = flags.session;
|
|
72
|
+
const instance = flags.instance;
|
|
73
|
+
const outputDir = flags.folder;
|
|
74
|
+
const templateIds = ButlerSbImportsigntemplate.getTemplateIds(flags.id);
|
|
75
|
+
try {
|
|
76
|
+
const connection = (await (0, authentication_1.authenticate)(target, session, instance));
|
|
77
|
+
const total = templateIds.length;
|
|
78
|
+
await templateIds.reduce(async (accPromise, templateId, index) => {
|
|
79
|
+
await accPromise;
|
|
80
|
+
logger_1.Logger.info(constants_1.MESSAGE.IMPORTING_SIGN_REQUEST_TEMPLATE
|
|
81
|
+
.replace('[INDEX]', (index + 1).toString())
|
|
82
|
+
.replace('[TOTAL]', total.toString())
|
|
83
|
+
.replace('[ID]', templateId), ButlerSbImportsigntemplate.isLogsActive);
|
|
84
|
+
try {
|
|
85
|
+
const payload = await ButlerSbImportsigntemplate.readTemplate(outputDir, templateId);
|
|
86
|
+
await connection.apex.post(constants_1.PATH.IMPORT_SIGN_TEMPLATE, payload, {
|
|
87
|
+
headers: { 'Content-Type': 'application/json' },
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
const message = ButlerSbImportsigntemplate.normalizeErrorMessage(ButlerSbImportsigntemplate.getErrorMessage(error));
|
|
92
|
+
logger_1.Logger.error(constants_1.MESSAGE.IMPORT_SIGN_REQUEST_TEMPLATE_FAILED.replace('[ID]', templateId), true);
|
|
93
|
+
logger_1.Logger.error(message, true);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}, Promise.resolve());
|
|
97
|
+
logger_1.Logger.success(constants_1.MESSAGE.SUCCESS_DATA_WRITTEN, ButlerSbImportsigntemplate.isLogsActive);
|
|
98
|
+
return { success: true };
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
logger_1.Logger.error(constants_1.ERROR.IMPORT_SIGN_TEMPLATE_FAILED, true);
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
return { success: false };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.default = ButlerSbImportsigntemplate;
|
|
108
|
+
//# sourceMappingURL=signtemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signtemplate.js","sourceRoot":"","sources":["../../../../../src/commands/butler/sb/import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0B,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;oBACrF,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAI,CAAC,oBAAoB,EAAE,OAAiB,EAAE;wBACvE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;qBAChD,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,OAAO,GAAG,0BAA0B,CAAC,qBAAqB,CAC9D,0BAA0B,CAAC,eAAe,CAAC,KAAK,CAAC,CAClD,CAAC;oBACF,eAAM,CAAC,KAAK,CAAC,mBAAO,CAAC,mCAAmC,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;oBAC5F,eAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBAC5B,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YAEtB,eAAM,CAAC,OAAO,CACZ,mBAAO,CAAC,oBAAoB,EAC5B,0BAA0B,CAAC,YAAY,CACxC,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAM,CAAC,KAAK,CAAC,iBAAK,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAC;YACtD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;;AAlHH,6CAmHC"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { Connection as JsforceConnection, Schema } from 'jsforce';
|
|
1
2
|
import { Connection as CoreConnection } from '@salesforce/core';
|
|
2
|
-
export declare function authenticate(username: string, session: string, instance: string): Promise<CoreConnection
|
|
3
|
+
export declare function authenticate(username: string, session: string, instance: string): Promise<CoreConnection | JsforceConnection<Schema>>;
|
|
4
|
+
export declare function formatAuthError(err: unknown): string;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
7
|
-
/* eslint-disable @typescript-eslint/require-await */
|
|
8
|
-
/* eslint-disable no-console */
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.authenticate =
|
|
3
|
+
exports.authenticate = authenticate;
|
|
4
|
+
exports.formatAuthError = formatAuthError;
|
|
5
|
+
const jsforce_1 = require("jsforce");
|
|
11
6
|
const core_1 = require("@salesforce/core");
|
|
12
7
|
const constants_1 = require("../utils/constants");
|
|
13
8
|
const logger_1 = require("../utils/logger");
|
|
14
|
-
const jsforce = require('jsforce');
|
|
15
9
|
function isBlank(value) {
|
|
16
|
-
return value
|
|
10
|
+
return value === undefined || value.trim() === '';
|
|
17
11
|
}
|
|
18
12
|
async function authenticateWithTarget(username) {
|
|
19
13
|
try {
|
|
@@ -25,19 +19,18 @@ async function authenticateWithTarget(username) {
|
|
|
25
19
|
return connection;
|
|
26
20
|
}
|
|
27
21
|
catch (error) {
|
|
28
|
-
logger_1.Logger.error(
|
|
22
|
+
logger_1.Logger.error(formatAuthError(error));
|
|
29
23
|
throw new Error(constants_1.ERROR.CONNECTION_FAILED);
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
26
|
async function authenticateWithSession(session, instance) {
|
|
27
|
+
await Promise.resolve();
|
|
33
28
|
if (!isBlank(instance) && !isBlank(session)) {
|
|
34
|
-
const connection = new
|
|
29
|
+
const connection = new jsforce_1.Connection({
|
|
35
30
|
instanceUrl: instance,
|
|
36
31
|
sessionId: session,
|
|
37
32
|
});
|
|
38
|
-
|
|
39
|
-
logger_1.Logger.info(constants_1.MESSAGE.CONNECTED_TO_INSTANCE.replace('[INSTANCE_URL]', instance));
|
|
40
|
-
}
|
|
33
|
+
logger_1.Logger.info(constants_1.MESSAGE.CONNECTED_TO_INSTANCE.replace('[INSTANCE_URL]', instance));
|
|
41
34
|
return connection;
|
|
42
35
|
}
|
|
43
36
|
else if (!isBlank(session) && isBlank(instance)) {
|
|
@@ -65,9 +58,12 @@ async function authenticate(username, session, instance) {
|
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
catch (err) {
|
|
68
|
-
|
|
61
|
+
const message = formatAuthError(err);
|
|
62
|
+
logger_1.Logger.error(message);
|
|
69
63
|
throw new Error(constants_1.ERROR.CONNECTION_FAILED);
|
|
70
64
|
}
|
|
71
65
|
}
|
|
72
|
-
|
|
66
|
+
function formatAuthError(err) {
|
|
67
|
+
return err instanceof Error ? err.message : JSON.stringify(err);
|
|
68
|
+
}
|
|
73
69
|
//# sourceMappingURL=authentication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/utils/authentication.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/utils/authentication.ts"],"names":[],"mappings":";;AAkDA,oCAoBC;AAED,0CAEC;AA1ED,qCAAkE;AAClE,2CAA0E;AAC1E,kDAAoD;AACpD,4CAAyC;AAEzC,SAAS,OAAO,CAAC,KAAyB;IACxC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AACpD,CAAC;AAED,KAAK,UAAU,sBAAsB,CAAC,QAAgB;IACpD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrD,MAAM,UAAU,GAAG,MAAM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
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
EXPORT_PACK: string;
|
|
11
|
-
ADMIN: string;
|
|
2
|
+
readonly EXPORT_DOC_CONFIG: "/cadmus_core/DocConfig/Export2/";
|
|
3
|
+
readonly EXPORT_SIGN_TEMPLATE: "/services/apexrest/cadmus_sign2/SignRequestTemplate/Export/";
|
|
4
|
+
readonly IMPORT_SIGN_TEMPLATE: "/services/apexrest/cadmus_sign2/SignRequestTemplate/Import/";
|
|
5
|
+
readonly EXPORT_DATA_SOURCE: "/services/apexrest/cadmus_core/DataSource/Export/";
|
|
6
|
+
readonly IMPORT_DATA_SOURCE: "/services/apexrest/cadmus_core/DataSource/Import";
|
|
7
|
+
readonly IMPORT_PACK: "/services/apexrest/cadmus_core/Pack/Import";
|
|
8
|
+
readonly EXPORT_PACK: "/services/apexrest/cadmus_core/Pack/Export/";
|
|
9
|
+
readonly ADMIN: "/services/apexrest/cadmus_core/Manage/Admin";
|
|
12
10
|
};
|
|
13
11
|
export declare const ERROR: {
|
|
14
|
-
UNSUPPORTED_RECORD_TYPE:
|
|
15
|
-
CONNECTION_FAILED:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
BLANK_PACK_FLAG:
|
|
29
|
-
READING_FOLDER:
|
|
30
|
-
READING_FILES:
|
|
31
|
-
IMPORT_FILE:
|
|
32
|
-
NO_FILES_IN_FOLDER:
|
|
33
|
-
IMPORT_PROCESS:
|
|
34
|
-
WRITE_DATA:
|
|
35
|
-
AUTH_ENV_VAR_REQUIRED:
|
|
36
|
-
WRITE_DATA_TO_PDF:
|
|
37
|
-
SAVING:
|
|
38
|
-
FAILED_TO_SAVE_FILE:
|
|
39
|
-
OUT_FLAG_REQUIRED:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
12
|
+
readonly UNSUPPORTED_RECORD_TYPE: "Unsupported record type";
|
|
13
|
+
readonly CONNECTION_FAILED: "Connection to Salesforce failed.";
|
|
14
|
+
readonly NO_AUTH_PARAMS: "Authentication parameters missing. Provide either username or session and instance.";
|
|
15
|
+
readonly NO_MATCHING_DOC_CONFIGS: "No matching DocConfig IDs found.";
|
|
16
|
+
readonly NO_MATCHING_FILES: "No matching files found";
|
|
17
|
+
readonly EXPORT_FAILED: "DocConfig export failed. Check the IDs and try again.";
|
|
18
|
+
readonly URL_NOT_FOUND: "Could not find a matching URL.";
|
|
19
|
+
readonly URL_NOT_FOUND_VERSION_TOO_LOW: "Could not find a matching URL. Verify that you have PDFButler version greater than v1.440.";
|
|
20
|
+
readonly ID_NOT_EXIST: "No rows found for the given ID.";
|
|
21
|
+
readonly PACK_NOT_EXIST: "Cannot find the Pack with Customer Pack ID: [PACK_ID].";
|
|
22
|
+
readonly EMPTY_INSTANCE: "Instance URL (--instance) cannot be empty.";
|
|
23
|
+
readonly EMPTY_SESSION: "Session ID (--session) cannot be empty.";
|
|
24
|
+
readonly EMPTY_INSTANCE_AND_SESSION: "Both Session ID and Instance URL cannot be empty.";
|
|
25
|
+
readonly INVALID_INSTANCE_OR_ORG_UNAVAILABLE: "Received a non-API response from Salesforce. Verify that --instance is correct and the org is available.";
|
|
26
|
+
readonly BLANK_PACK_FLAG: "Flag \"pack\" cannot be blank.";
|
|
27
|
+
readonly READING_FOLDER: "Error reading folder: [MESSAGE].";
|
|
28
|
+
readonly READING_FILES: "Failed to read files from folder: [FOLDER].";
|
|
29
|
+
readonly IMPORT_FILE: "Error while importing file.";
|
|
30
|
+
readonly NO_FILES_IN_FOLDER: "No files found in folder: [FOLDER].";
|
|
31
|
+
readonly IMPORT_PROCESS: "Error during import process: [MESSAGE].";
|
|
32
|
+
readonly WRITE_DATA: "Failed to write data to the target Salesforce org.";
|
|
33
|
+
readonly AUTH_ENV_VAR_REQUIRED: "\"auth-env-var\" parameter is required when endpoint is provided.";
|
|
34
|
+
readonly WRITE_DATA_TO_PDF: "Failed to write data to the PDF Butler system.";
|
|
35
|
+
readonly SAVING: "Error while saving file: [MESSAGE].";
|
|
36
|
+
readonly FAILED_TO_SAVE_FILE: "Failed to save the file.";
|
|
37
|
+
readonly OUT_FLAG_REQUIRED: "The flag \"out\" cannot be empty.";
|
|
38
|
+
readonly IMPORT_SETTINGS: "Failed while importing settings. Error: [MESSAGE].";
|
|
39
|
+
readonly IMPORT_CREDENTIALS: "Failed to import user credentials. Error: [MESSAGE].";
|
|
40
|
+
readonly BLANK_BACKEND: "One or more DocConfigs have no backend.";
|
|
41
|
+
readonly USER_NO_PERMISSIONS: "User does not have read/write permissions.";
|
|
42
|
+
readonly NO_MATCHING_DATA_SOURCES: "No matching DataSource IDs found.";
|
|
43
|
+
readonly EXPORT_DATA_SOURCE_FAILED: "DataSource export failed. Check the IDs and try again.";
|
|
44
|
+
readonly IMPORT_DATA_SOURCE_FAILED: "DataSource import failed. Check the JSON and try again.";
|
|
45
|
+
readonly EXPORT_SIGN_TEMPLATE_FAILED: "Sign Request Template export failed. Check the IDs and try again.";
|
|
46
|
+
readonly IMPORT_SIGN_TEMPLATE_FAILED: "Sign Request Template import failed. Check the JSON and try again.";
|
|
45
47
|
};
|
|
46
48
|
export declare const MESSAGE: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
49
|
+
readonly CHECK_SESSION_INSTANCE: "Verify that the session is valid and the instance is correct.";
|
|
50
|
+
readonly CONNECTED_TO_ORG: "Connected to [USERNAME] (Org ID: [ORG_ID]).";
|
|
51
|
+
readonly CONNECTED_TO_INSTANCE: "Connected to instance: [INSTANCE_URL].";
|
|
52
|
+
readonly SPLITTED_DOC_CONFIGS: "DocConfig IDs after splitting: [VALUE].";
|
|
53
|
+
readonly EXPORTED_DOC_CONFIGS: "Exported DocConfigs: [VALUE].";
|
|
54
|
+
readonly DOC_CONFIG_NO_BACKEND: "DocConfig with ID [VALUE] has no backend.";
|
|
55
|
+
readonly BACKEND_DATA_ARCHIVED_PROGRESS: "Exported backend data has been archived. ([EXPORTED]/[TOTAL])";
|
|
56
|
+
readonly USER_HAS_PERMISSIONS: "User has read/write permissions.";
|
|
57
|
+
readonly ARCHIVE_UNZIPPED: "Archive unzipped and stored locally.";
|
|
58
|
+
readonly ARCHIVE_RECORDED: "Archive stored locally.";
|
|
59
|
+
readonly FETCH_DATA: "Fetching data from the org...";
|
|
60
|
+
readonly UNZIP_FILES: "Unzipping files...";
|
|
61
|
+
readonly SAVE_AS_ZIP: "Saving as ZIP...";
|
|
62
|
+
readonly SAVE_BACKEND: "Saving backend only.";
|
|
63
|
+
readonly PARTIAL_EXPORT_ACTIVE: "Partial export active. DocConfigs without backend will not be exported.";
|
|
64
|
+
readonly START_EXPORT_BACKEND: "Starting backend export for DocConfigs.";
|
|
65
|
+
readonly BACKEND_RETRIEVAL_START: "Starting backend retrieval for DocConfig IDs ([COUNT]): [IDS].";
|
|
66
|
+
readonly BACKEND_RETRIEVING: "Retrieving backend ([INDEX]/[COUNT]): [ID].";
|
|
67
|
+
readonly BACKEND_RETRIEVED: "Retrieved backend ([INDEX]/[COUNT]): [ID].";
|
|
68
|
+
readonly RETRIEVING_ITEMS: "Retrieving items from directory...";
|
|
69
|
+
readonly MISSING_PACKS: "Missing packs: [PACKS].";
|
|
70
|
+
readonly USERNAME: "Username: [USERNAME].";
|
|
71
|
+
readonly PACKS_TO_IMPORT: "Packs to import: [PACKS].";
|
|
72
|
+
readonly PACKS_TO_EXPORT: "Packs to export: [PACKS].";
|
|
73
|
+
readonly FOLDER_TO_RETRIEVE: "Retrieving from folder: [FOLDER].";
|
|
74
|
+
readonly FILES_IN_FOLDER: "Files found: [FILES].";
|
|
75
|
+
readonly SUCCESS_DATA_WRITTEN: "Data successfully written to the Salesforce org.";
|
|
76
|
+
readonly SUCCESS_IMPORT_PACK: "Successfully imported [PACK]";
|
|
77
|
+
readonly ENDPOINT_URL: "Endpoint base URL: [URL].";
|
|
78
|
+
readonly CALL_SERVICE: "Calling external service...";
|
|
79
|
+
readonly SAVING_TO_DIRECTORY: "Saving to directory...";
|
|
80
|
+
readonly SUCCESS_EXPORT: "Data successfully exported.";
|
|
81
|
+
readonly TRY_EXPORT_PACK: "Trying to export pack with ID: [PACK].";
|
|
82
|
+
readonly USED_SHORT_PATH: "Using short paths.";
|
|
83
|
+
readonly SENDING_TO_ENDPOINT: "Sending data to endpoint: [URL].";
|
|
84
|
+
readonly SUCCESS_IMPORT_SETTINGS: "Settings imported successfully.";
|
|
85
|
+
readonly SUCCESS_IMPORT_CREDENTIALS: "User credentials imported successfully.";
|
|
86
|
+
readonly NEW_TEMPLATES_FOUND: "New Templates Found: [VALUE]. Continuing Recursive Export...";
|
|
87
|
+
readonly UNDEFINED: "undefined";
|
|
88
|
+
readonly START_IMPORT_MAIN: "Starting import process for DocConfig ([INDEX]/[COUNT]):\n[ID]";
|
|
89
|
+
readonly FOUND_TEMPLATES: "Templates found: [COUNT].";
|
|
90
|
+
readonly NO_TEMPLATES_FOUND: "No templates found for main DocConfig.";
|
|
91
|
+
readonly IMPORT_TEMPLATES_SFDC: "Importing template SFDC configs...";
|
|
92
|
+
readonly IMPORT_TEMPLATES_ZIP: "Importing template backends...";
|
|
93
|
+
readonly IMPORT_MAIN_SFDC: "Importing main DocConfig SFDC...";
|
|
94
|
+
readonly UPDATE_MAIN_WITH_TEMPLATE_IDS: "Updating main DocConfig with cloned template IDs.";
|
|
95
|
+
readonly 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}";
|
|
96
|
+
readonly IMPORTING_ZIP_WITH_ID: "Importing DocConfig Backend:\n[ID]";
|
|
97
|
+
readonly IMPORTING_ZIP_PROGRESS: "Importing Template Backend ([INDEX]/[COUNT]):\n[ID]";
|
|
98
|
+
readonly JSON_PARSE_FAILED: "Failed to parse JSON at [PATH].";
|
|
99
|
+
readonly TEMPLATES_DETECTED_WARNING: "Templates detected for Doc Config [ID]: [TEMPLATES]. To prevent errors, run import command with -m | --templates flag.";
|
|
100
|
+
readonly CLONE_LINKED_ORGS_WARNING: "Be careful: without -c | --clone, you can migrate data only between linked orgs (e.g., TEST => PROD).";
|
|
101
|
+
readonly START_SPLIT_DATA_SOURCES: "Parsing DataSource IDs...";
|
|
102
|
+
readonly SPLITTED_DATA_SOURCES_LIST: "DataSource IDs: [VALUE].";
|
|
103
|
+
readonly MISSING_DATA_SOURCES: "Can't find files for DataSource IDs: [VALUE].";
|
|
104
|
+
readonly ALL_DATA_SOURCES_FOUND: "All DataSource files found.";
|
|
105
|
+
readonly EXPORTED_DATA_SOURCES_SUCCESS: "Exported DataSources: [VALUE].";
|
|
106
|
+
readonly EXPORTING_SIGN_REQUEST_TEMPLATE: "Exporting Sign Request Template [INDEX]/[TOTAL]: [ID].";
|
|
107
|
+
readonly IMPORTING_SIGN_REQUEST_TEMPLATE: "Importing Sign Request Template [INDEX]/[TOTAL]: [ID].";
|
|
108
|
+
readonly IMPORT_SIGN_REQUEST_TEMPLATE_FAILED: "Import Sign Request Template failed for ID: [ID].";
|
|
109
|
+
readonly EXPORT_SIGN_REQUEST_TEMPLATE_FAILED: "Export Sign Request Template failed for ID: [ID].";
|
|
110
|
+
readonly IMPORTING_DATA_SOURCE: "Importing DataSource [INDEX]/[TOTAL]: [ID].";
|
|
111
|
+
readonly IMPORTING_PARENT_DATA_SOURCE: "Importing Parent DataSource [INDEX]/[TOTAL]: [ID].";
|
|
112
|
+
readonly IMPORT_DATA_SOURCE_SUCCESS: "DataSource import succeeded for ID: [ID].";
|
|
113
|
+
readonly IMPORT_DATA_SOURCE_FAILED: "DataSource import failed for ID: [ID].";
|
|
114
|
+
readonly PARENT_DATA_SOURCES_FOUND: "Parent DataSources find ([VALUE]).";
|
|
115
|
+
readonly PDFBUTLER_MIN_VERSION: "Ensure PDF Butler package version is at least v1.505.";
|
|
116
|
+
readonly IMPORTED_DATA_SOURCES_SUCCESS: "Imported DataSources: [VALUE].";
|
|
117
|
+
readonly EXPORTING_DATA_SOURCE: "Exporting DataSource ([INDEX]/[TOTAL]):\n[ID].";
|
|
118
|
+
readonly EXPORTING_PARENT_DATA_SOURCE: "Exporting Parent DataSource ([INDEX]/[TOTAL]):\n[ID].";
|
|
119
|
+
readonly FETCH_DATA_SUCCESS: "DataSource export succeeded.";
|
|
120
|
+
readonly FETCH_DATA_FAILED: "DataSource export failed for ID: [ID].";
|
|
121
|
+
readonly PARENT_DATA_SOURCE_DETECTED_INFO: "Parent DataSource detected for [ID]: [PARENT_ID].";
|
|
122
|
+
readonly PARENT_DATA_SOURCE_DETECTED_WARN: "If it is not exported, import may fail. Use -p | --export-parents to automatically export related DataSources.";
|
|
123
|
+
readonly PARENT_DATA_SOURCE_FILE_NOT_FOUND: "Parent DataSource file not found: [PATH].";
|
|
124
|
+
readonly PARENT_CHAIN_CYCLE_DETECTED: "Cycle detected in parent chain at DataSource ID: [ID].";
|
|
90
125
|
};
|
|
91
126
|
export declare const RESULT: {
|
|
92
|
-
FAILED:
|
|
93
|
-
SUCCESS:
|
|
94
|
-
SUCCESS_WITH_WARNINGS:
|
|
127
|
+
readonly FAILED: "FAILED";
|
|
128
|
+
readonly SUCCESS: "SUCCESS";
|
|
129
|
+
readonly SUCCESS_WITH_WARNINGS: "SUCCESS_WITH_WARNINGS";
|
|
95
130
|
};
|
|
96
131
|
export declare const PATTERN: {
|
|
97
|
-
DOC_CONFIG: RegExp;
|
|
132
|
+
readonly DOC_CONFIG: RegExp;
|
|
133
|
+
readonly DATA_SOURCE_ID: RegExp;
|
|
98
134
|
};
|
|
99
135
|
export declare const CUT: {
|
|
100
|
-
AFTER:
|
|
136
|
+
readonly AFTER: 150;
|
|
101
137
|
};
|
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,24 @@ 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.',
|
|
48
50
|
};
|
|
49
51
|
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
52
|
CHECK_SESSION_INSTANCE: 'Verify that the session is valid and the instance is correct.',
|
|
54
53
|
CONNECTED_TO_ORG: 'Connected to [USERNAME] (Org ID: [ORG_ID]).',
|
|
55
54
|
CONNECTED_TO_INSTANCE: 'Connected to instance: [INSTANCE_URL].',
|
|
56
55
|
SPLITTED_DOC_CONFIGS: 'DocConfig IDs after splitting: [VALUE].',
|
|
57
56
|
EXPORTED_DOC_CONFIGS: 'Exported DocConfigs: [VALUE].',
|
|
58
|
-
FOLDER_CREATED: 'Folder structure created at: [VALUE].',
|
|
59
57
|
DOC_CONFIG_NO_BACKEND: 'DocConfig with ID [VALUE] has no backend.',
|
|
60
|
-
|
|
58
|
+
BACKEND_DATA_ARCHIVED_PROGRESS: 'Exported backend data has been archived. ([EXPORTED]/[TOTAL])',
|
|
61
59
|
USER_HAS_PERMISSIONS: 'User has read/write permissions.',
|
|
62
60
|
ARCHIVE_UNZIPPED: 'Archive unzipped and stored locally.',
|
|
63
61
|
ARCHIVE_RECORDED: 'Archive stored locally.',
|
|
@@ -66,30 +64,67 @@ exports.MESSAGE = {
|
|
|
66
64
|
SAVE_AS_ZIP: 'Saving as ZIP...',
|
|
67
65
|
SAVE_BACKEND: 'Saving backend only.',
|
|
68
66
|
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
67
|
START_EXPORT_BACKEND: 'Starting backend export for DocConfigs.',
|
|
68
|
+
BACKEND_RETRIEVAL_START: 'Starting backend retrieval for DocConfig IDs ([COUNT]): [IDS].',
|
|
69
|
+
BACKEND_RETRIEVING: 'Retrieving backend ([INDEX]/[COUNT]): [ID].',
|
|
70
|
+
BACKEND_RETRIEVED: 'Retrieved backend ([INDEX]/[COUNT]): [ID].',
|
|
71
71
|
RETRIEVING_ITEMS: 'Retrieving items from directory...',
|
|
72
72
|
MISSING_PACKS: 'Missing packs: [PACKS].',
|
|
73
73
|
USERNAME: 'Username: [USERNAME].',
|
|
74
74
|
PACKS_TO_IMPORT: 'Packs to import: [PACKS].',
|
|
75
75
|
PACKS_TO_EXPORT: 'Packs to export: [PACKS].',
|
|
76
76
|
FOLDER_TO_RETRIEVE: 'Retrieving from folder: [FOLDER].',
|
|
77
|
-
FOLDER_TO_OUTPUT: 'Output folder: [FOLDER].',
|
|
78
77
|
FILES_IN_FOLDER: 'Files found: [FILES].',
|
|
79
78
|
SUCCESS_DATA_WRITTEN: 'Data successfully written to the Salesforce org.',
|
|
80
79
|
SUCCESS_IMPORT_PACK: 'Successfully imported [PACK]',
|
|
81
80
|
ENDPOINT_URL: 'Endpoint base URL: [URL].',
|
|
82
|
-
FINAL_URL: 'Final URL: [URL].',
|
|
83
81
|
CALL_SERVICE: 'Calling external service...',
|
|
84
82
|
SAVING_TO_DIRECTORY: 'Saving to directory...',
|
|
85
|
-
|
|
86
|
-
FILE_PATH: 'File path: [PATH].',
|
|
87
|
-
SUCCESS_EXPORT_TO: 'Data successfully exported to: [PATH].',
|
|
83
|
+
SUCCESS_EXPORT: 'Data successfully exported.',
|
|
88
84
|
TRY_EXPORT_PACK: 'Trying to export pack with ID: [PACK].',
|
|
89
85
|
USED_SHORT_PATH: 'Using short paths.',
|
|
90
86
|
SENDING_TO_ENDPOINT: 'Sending data to endpoint: [URL].',
|
|
91
87
|
SUCCESS_IMPORT_SETTINGS: 'Settings imported successfully.',
|
|
92
88
|
SUCCESS_IMPORT_CREDENTIALS: 'User credentials imported successfully.',
|
|
89
|
+
NEW_TEMPLATES_FOUND: 'New Templates Found: [VALUE]. Continuing Recursive Export...',
|
|
90
|
+
UNDEFINED: 'undefined',
|
|
91
|
+
START_IMPORT_MAIN: 'Starting import process for DocConfig ([INDEX]/[COUNT]):\n[ID]',
|
|
92
|
+
FOUND_TEMPLATES: 'Templates found: [COUNT].',
|
|
93
|
+
NO_TEMPLATES_FOUND: 'No templates found for main DocConfig.',
|
|
94
|
+
IMPORT_TEMPLATES_SFDC: 'Importing template SFDC configs...',
|
|
95
|
+
IMPORT_TEMPLATES_ZIP: 'Importing template backends...',
|
|
96
|
+
IMPORT_MAIN_SFDC: 'Importing main DocConfig SFDC...',
|
|
97
|
+
UPDATE_MAIN_WITH_TEMPLATE_IDS: 'Updating main DocConfig with cloned template IDs.',
|
|
98
|
+
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}',
|
|
99
|
+
IMPORTING_ZIP_WITH_ID: 'Importing DocConfig Backend:\n[ID]',
|
|
100
|
+
IMPORTING_ZIP_PROGRESS: 'Importing Template Backend ([INDEX]/[COUNT]):\n[ID]',
|
|
101
|
+
JSON_PARSE_FAILED: 'Failed to parse JSON at [PATH].',
|
|
102
|
+
TEMPLATES_DETECTED_WARNING: 'Templates detected for Doc Config [ID]: [TEMPLATES]. To prevent errors, run import command with -m | --templates flag.',
|
|
103
|
+
CLONE_LINKED_ORGS_WARNING: 'Be careful: without -c | --clone, you can migrate data only between linked orgs (e.g., TEST => PROD).',
|
|
104
|
+
START_SPLIT_DATA_SOURCES: 'Parsing DataSource IDs...',
|
|
105
|
+
SPLITTED_DATA_SOURCES_LIST: 'DataSource IDs: [VALUE].',
|
|
106
|
+
MISSING_DATA_SOURCES: "Can't find files for DataSource IDs: [VALUE].",
|
|
107
|
+
ALL_DATA_SOURCES_FOUND: 'All DataSource files found.',
|
|
108
|
+
EXPORTED_DATA_SOURCES_SUCCESS: 'Exported DataSources: [VALUE].',
|
|
109
|
+
EXPORTING_SIGN_REQUEST_TEMPLATE: 'Exporting Sign Request Template [INDEX]/[TOTAL]: [ID].',
|
|
110
|
+
IMPORTING_SIGN_REQUEST_TEMPLATE: 'Importing Sign Request Template [INDEX]/[TOTAL]: [ID].',
|
|
111
|
+
IMPORT_SIGN_REQUEST_TEMPLATE_FAILED: 'Import Sign Request Template failed for ID: [ID].',
|
|
112
|
+
EXPORT_SIGN_REQUEST_TEMPLATE_FAILED: 'Export Sign Request Template failed for ID: [ID].',
|
|
113
|
+
IMPORTING_DATA_SOURCE: 'Importing DataSource [INDEX]/[TOTAL]: [ID].',
|
|
114
|
+
IMPORTING_PARENT_DATA_SOURCE: 'Importing Parent DataSource [INDEX]/[TOTAL]: [ID].',
|
|
115
|
+
IMPORT_DATA_SOURCE_SUCCESS: 'DataSource import succeeded for ID: [ID].',
|
|
116
|
+
IMPORT_DATA_SOURCE_FAILED: 'DataSource import failed for ID: [ID].',
|
|
117
|
+
PARENT_DATA_SOURCES_FOUND: 'Parent DataSources find ([VALUE]).',
|
|
118
|
+
PDFBUTLER_MIN_VERSION: 'Ensure PDF Butler package version is at least v1.505.',
|
|
119
|
+
IMPORTED_DATA_SOURCES_SUCCESS: 'Imported DataSources: [VALUE].',
|
|
120
|
+
EXPORTING_DATA_SOURCE: 'Exporting DataSource ([INDEX]/[TOTAL]):\n[ID].',
|
|
121
|
+
EXPORTING_PARENT_DATA_SOURCE: 'Exporting Parent DataSource ([INDEX]/[TOTAL]):\n[ID].',
|
|
122
|
+
FETCH_DATA_SUCCESS: 'DataSource export succeeded.',
|
|
123
|
+
FETCH_DATA_FAILED: 'DataSource export failed for ID: [ID].',
|
|
124
|
+
PARENT_DATA_SOURCE_DETECTED_INFO: 'Parent DataSource detected for [ID]: [PARENT_ID].',
|
|
125
|
+
PARENT_DATA_SOURCE_DETECTED_WARN: 'If it is not exported, import may fail. Use -p | --export-parents to automatically export related DataSources.',
|
|
126
|
+
PARENT_DATA_SOURCE_FILE_NOT_FOUND: 'Parent DataSource file not found: [PATH].',
|
|
127
|
+
PARENT_CHAIN_CYCLE_DETECTED: 'Cycle detected in parent chain at DataSource ID: [ID].',
|
|
93
128
|
};
|
|
94
129
|
exports.RESULT = {
|
|
95
130
|
FAILED: 'FAILED',
|
|
@@ -98,6 +133,7 @@ exports.RESULT = {
|
|
|
98
133
|
};
|
|
99
134
|
exports.PATTERN = {
|
|
100
135
|
DOC_CONFIG: /([\w-]{36})/,
|
|
136
|
+
DATA_SOURCE_ID: /^[a-zA-Z0-9]{15,18}(?:_[a-zA-Z0-9]{15,18})?$/,
|
|
101
137
|
};
|
|
102
138
|
exports.CUT = {
|
|
103
139
|
AFTER: 150,
|