@pdfbutler/migration-cli 0.0.26 → 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.d.ts +0 -5
- package/lib/commands/butler/pb/admincredentials.js +46 -115
- package/lib/commands/butler/pb/admincredentials.js.map +1 -1
- package/lib/commands/butler/pb/adminsettings.d.ts +1 -7
- package/lib/commands/butler/pb/adminsettings.js +41 -110
- package/lib/commands/butler/pb/adminsettings.js.map +1 -1
- package/lib/commands/butler/pb/export.d.ts +10 -8
- package/lib/commands/butler/pb/export.js +302 -312
- 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.d.ts +0 -5
- package/lib/commands/butler/pb/exportpack.js +60 -142
- package/lib/commands/butler/pb/exportpack.js.map +1 -1
- package/lib/commands/butler/pb/import.d.ts +16 -9
- package/lib/commands/butler/pb/import.js +400 -267
- 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.d.ts +0 -5
- package/lib/commands/butler/pb/importpack.js +57 -138
- 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 +4 -0
- package/lib/utils/authentication.js +69 -0
- package/lib/utils/authentication.js.map +1 -0
- package/lib/utils/constants.d.ts +137 -0
- package/lib/utils/constants.js +141 -0
- package/lib/utils/constants.js.map +1 -0
- 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 +9 -0
- package/lib/utils/logger.js +51 -0
- package/lib/utils/logger.js.map +1 -0
- 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 +321 -48
- package/package.json +223 -215
|
@@ -16,81 +16,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
/* eslint-disable no-console */
|
|
17
17
|
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
18
18
|
const core_1 = require("@salesforce/core");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const ERROR_VERSION = 'Verify that you have PDFButler version greater than v1.440.';
|
|
23
|
-
const MSG_CONNECTION_FAILED = 'Connection to Salesforce has been failed.';
|
|
24
|
-
const MSG_CREATION_CONNECTION = 'Creating Connection with the Salesforce org.';
|
|
25
|
-
const MSG_AUTHORIZATION = 'Authorization with the username: [VALUE].';
|
|
26
|
-
const MSG_NO_AUTH_PARAMS = 'No authentication parameters provided. Please provide either username or session and instance parameters.';
|
|
27
|
-
const MSG_RUN_AUTH_COMMAND = 'Run the command "sf org login web" before authenticating with the target.';
|
|
28
|
-
const MSG_CHECK_SESSION_INSTANCE = 'Check if the session is up to date and if the instance is correct.';
|
|
19
|
+
const logger_1 = require("../../../utils/logger");
|
|
20
|
+
const constants_1 = require("../../../utils/constants");
|
|
21
|
+
const authentication_1 = require("../../../utils/authentication");
|
|
29
22
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
30
23
|
const messages = core_1.Messages.loadMessages('@pdfbutler/migration-cli', 'butler.pb.adminsettings');
|
|
31
24
|
class ButlerPbAdminsettings extends sf_plugins_core_1.SfCommand {
|
|
32
|
-
static
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
else if (!this.isBlank(session) && this.isBlank(instance)) {
|
|
65
|
-
this.log('Instance URL (--instance) cannot be empty', 'error');
|
|
66
|
-
}
|
|
67
|
-
else if (this.isBlank(session) && !this.isBlank(instance)) {
|
|
68
|
-
this.log('Session Id (--session) cannot be empty', 'error');
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.log('Session Id and Instance URL (--session and --instance) cannot be empty', 'error');
|
|
72
|
-
}
|
|
73
|
-
this.log(MSG_CHECK_SESSION_INSTANCE, 'error');
|
|
74
|
-
throw new Error(MSG_CONNECTION_FAILED);
|
|
75
|
-
}
|
|
76
|
-
static async authenticate(username, session, instance) {
|
|
77
|
-
let connection;
|
|
78
|
-
if (this.isBlank(username) && (this.isBlank(session) || this.isBlank(instance))) {
|
|
79
|
-
throw new Error(MSG_NO_AUTH_PARAMS);
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
if (this.isBlank(session) || this.isBlank(instance)) {
|
|
83
|
-
connection = await this.authenticateWithTarget(username);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
connection = await this.authenticateWitsSession(session, instance);
|
|
87
|
-
}
|
|
88
|
-
return connection;
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
throw new Error(MSG_CONNECTION_FAILED);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
25
|
+
static summary = messages.getMessage('summary');
|
|
26
|
+
static description = messages.getMessage('description');
|
|
27
|
+
static examples = messages.getMessages('examples');
|
|
28
|
+
static flags = {
|
|
29
|
+
url: sf_plugins_core_1.Flags.url({
|
|
30
|
+
summary: messages.getMessage('flags.url.summary'),
|
|
31
|
+
char: 'u',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
region: sf_plugins_core_1.Flags.string({
|
|
35
|
+
summary: messages.getMessage('flags.region.summary'),
|
|
36
|
+
char: 'r',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
stage: sf_plugins_core_1.Flags.string({
|
|
40
|
+
summary: messages.getMessage('flags.stage.summary'),
|
|
41
|
+
char: 's',
|
|
42
|
+
required: true,
|
|
43
|
+
}),
|
|
44
|
+
target: sf_plugins_core_1.Flags.string({
|
|
45
|
+
summary: messages.getMessage('flags.target.summary'),
|
|
46
|
+
char: 't',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
session: sf_plugins_core_1.Flags.string({
|
|
50
|
+
summary: messages.getMessage('flags.session.summary'),
|
|
51
|
+
}),
|
|
52
|
+
instance: sf_plugins_core_1.Flags.string({
|
|
53
|
+
summary: messages.getMessage('flags.instance.summary'),
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
94
56
|
async run() {
|
|
95
57
|
const { flags } = await this.parse(ButlerPbAdminsettings);
|
|
96
58
|
const targetUsername = flags.target;
|
|
@@ -102,54 +64,23 @@ class ButlerPbAdminsettings extends sf_plugins_core_1.SfCommand {
|
|
|
102
64
|
stage: flags.stage,
|
|
103
65
|
};
|
|
104
66
|
try {
|
|
105
|
-
const connection = await
|
|
106
|
-
|
|
107
|
-
await connection.apex.post(
|
|
108
|
-
|
|
67
|
+
const connection = await (0, authentication_1.authenticate)(targetUsername, session, instance);
|
|
68
|
+
logger_1.Logger.info(constants_1.MESSAGE.SENDING_TO_ENDPOINT.replace('[URL]', JSON.stringify(data, null, 2)));
|
|
69
|
+
await connection.apex.post(constants_1.PATH.ADMIN, data, { headers: { 'Content-Type': 'application/json' } });
|
|
70
|
+
logger_1.Logger.success(constants_1.MESSAGE.SUCCESS_IMPORT_SETTINGS);
|
|
109
71
|
return { success: true };
|
|
110
72
|
}
|
|
111
73
|
catch (error) {
|
|
112
74
|
const message = error instanceof Error ? error.message : String(error);
|
|
113
|
-
if (message.includes(
|
|
114
|
-
|
|
75
|
+
if (message.includes(constants_1.ERROR.URL_NOT_FOUND)) {
|
|
76
|
+
logger_1.Logger.error(constants_1.ERROR.URL_NOT_FOUND_VERSION_TOO_LOW);
|
|
115
77
|
}
|
|
116
78
|
else {
|
|
117
|
-
|
|
79
|
+
logger_1.Logger.error(constants_1.ERROR.IMPORT_SETTINGS.replace('[MESSAGE]', message));
|
|
118
80
|
}
|
|
119
81
|
return { success: false };
|
|
120
82
|
}
|
|
121
83
|
}
|
|
122
84
|
}
|
|
123
|
-
ButlerPbAdminsettings.summary = messages.getMessage('summary');
|
|
124
|
-
ButlerPbAdminsettings.description = messages.getMessage('description');
|
|
125
|
-
ButlerPbAdminsettings.examples = messages.getMessages('examples');
|
|
126
|
-
ButlerPbAdminsettings.flags = {
|
|
127
|
-
url: sf_plugins_core_1.Flags.url({
|
|
128
|
-
summary: messages.getMessage('flags.url.summary'),
|
|
129
|
-
char: 'u',
|
|
130
|
-
required: true,
|
|
131
|
-
}),
|
|
132
|
-
region: sf_plugins_core_1.Flags.string({
|
|
133
|
-
summary: messages.getMessage('flags.region.summary'),
|
|
134
|
-
char: 'r',
|
|
135
|
-
required: true,
|
|
136
|
-
}),
|
|
137
|
-
stage: sf_plugins_core_1.Flags.string({
|
|
138
|
-
summary: messages.getMessage('flags.stage.summary'),
|
|
139
|
-
char: 's',
|
|
140
|
-
required: true,
|
|
141
|
-
}),
|
|
142
|
-
target: sf_plugins_core_1.Flags.string({
|
|
143
|
-
summary: messages.getMessage('flags.target.summary'),
|
|
144
|
-
char: 't',
|
|
145
|
-
required: false,
|
|
146
|
-
}),
|
|
147
|
-
session: sf_plugins_core_1.Flags.string({
|
|
148
|
-
summary: messages.getMessage('flags.session.summary'),
|
|
149
|
-
}),
|
|
150
|
-
instance: sf_plugins_core_1.Flags.string({
|
|
151
|
-
summary: messages.getMessage('flags.instance.summary'),
|
|
152
|
-
}),
|
|
153
|
-
};
|
|
154
85
|
exports.default = ButlerPbAdminsettings;
|
|
155
86
|
//# sourceMappingURL=adminsettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adminsettings.js","sourceRoot":"","sources":["../../../../src/commands/butler/pb/adminsettings.ts"],"names":[],"mappings":";;AAAA,uDAAuD;AACvD,wDAAwD;AACxD,4DAA4D;AAC5D,+BAA+B;AAC/B,2DAA2D;AAC3D,0DAA0D;AAC1D,qEAAqE;AACrE,sDAAsD;AACtD,+DAA+D;AAC/D,kDAAkD;AAClD,qDAAqD;AACrD,qCAAqC;AACrC,uDAAuD;AACvD,+BAA+B;AAC/B,iEAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"adminsettings.js","sourceRoot":"","sources":["../../../../src/commands/butler/pb/adminsettings.ts"],"names":[],"mappings":";;AAAA,uDAAuD;AACvD,wDAAwD;AACxD,4DAA4D;AAC5D,+BAA+B;AAC/B,2DAA2D;AAC3D,0DAA0D;AAC1D,qEAAqE;AACrE,sDAAsD;AACtD,+DAA+D;AAC/D,kDAAkD;AAClD,qDAAqD;AACrD,qCAAqC;AACrC,uDAAuD;AACvD,+BAA+B;AAC/B,iEAA+D;AAC/D,2CAA4C;AAC5C,2CAAwC;AACxC,iDAAwD;AACxD,2DAAsD;AAEtD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,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AC;YACpD,CAAC;iBAAM,CAAC;gBACN,eAAM,CAAC,KAAK,CAAC,iBAAK,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;;AApEH,wCAqEC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
4
2
|
export type ButlerPbExportResult = {
|
|
5
3
|
path: string;
|
|
@@ -15,7 +13,7 @@ export default class ButlerPbExport extends SfCommand<Buffer> {
|
|
|
15
13
|
out: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
14
|
backend: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
15
|
'auth-env-var': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
|
-
endpoint: import("@oclif/core/lib/interfaces").OptionFlag<import("url").URL | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
+
endpoint: import("@oclif/core/lib/interfaces").OptionFlag<import("node:url").URL | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
17
|
stage: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
18
|
unzip: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
19
|
logs: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -24,15 +22,19 @@ export default class ButlerPbExport extends SfCommand<Buffer> {
|
|
|
24
22
|
instance: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
25
23
|
cut: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
24
|
shortpaths: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
25
|
+
templates: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
27
26
|
};
|
|
28
27
|
private static isLogsActive;
|
|
28
|
+
private processedIds;
|
|
29
29
|
private static getDocConfigIds;
|
|
30
|
-
private static isBlank;
|
|
31
|
-
private static log;
|
|
32
|
-
private static authenticateWithTarget;
|
|
33
|
-
private static authenticateWitsSession;
|
|
34
|
-
private static authenticate;
|
|
35
30
|
private static getDocConfigs;
|
|
36
31
|
private static convertBufferToUtf8;
|
|
32
|
+
private static logPermissionStatus;
|
|
33
|
+
private static getDocConfigResponse;
|
|
34
|
+
private static fetchBackendZips;
|
|
35
|
+
private static writeBackendOnly;
|
|
36
|
+
private static processZipMapUnzip;
|
|
37
|
+
private static processZipMapZip;
|
|
38
|
+
private static processZipMap;
|
|
37
39
|
run(): Promise<Buffer>;
|
|
38
40
|
}
|