sfdx-hardis 4.44.2 → 4.45.0
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/CHANGELOG.md +10 -0
- package/defaults/templates/files/CongaTemplates.json +10 -0
- package/defaults/templates/sfdmu/CongaConfig.json +26 -0
- package/lib/commands/hardis/org/configure/data.d.ts +10 -0
- package/lib/commands/hardis/org/configure/data.js +116 -67
- package/lib/commands/hardis/org/configure/data.js.map +1 -1
- package/lib/commands/hardis/org/configure/files.d.ts +6 -0
- package/lib/commands/hardis/org/configure/files.js +62 -21
- package/lib/commands/hardis/org/configure/files.js.map +1 -1
- package/lib/commands/hardis/org/files/import.d.ts +18 -0
- package/lib/commands/hardis/org/files/import.js +78 -0
- package/lib/commands/hardis/org/files/import.js.map +1 -0
- package/lib/common/gitProvider/gitlab.js +6 -1
- package/lib/common/gitProvider/gitlab.js.map +1 -1
- package/lib/common/utils/filesUtils.d.ts +17 -0
- package/lib/common/utils/filesUtils.js +113 -1
- package/lib/common/utils/filesUtils.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`
|
|
6
6
|
|
|
7
|
+
## [4.45.0] 2024-07-14
|
|
8
|
+
|
|
9
|
+
- New command **hardis:org:files:import** to import files exported using **hardis:org:files:export**
|
|
10
|
+
- Template management for SFDMU & files import/export
|
|
11
|
+
- Update JSON schema to add `v60` in autoCleanTypes
|
|
12
|
+
|
|
13
|
+
## [4.44.3] 2024-07-12
|
|
14
|
+
|
|
15
|
+
- Set **GITLAB_API_REJECT_UNAUTHORIZED=false** to avoid SSH rejections from Gitlab API
|
|
16
|
+
|
|
7
17
|
## [4.44.2] 2024-07-09
|
|
8
18
|
|
|
9
19
|
- New config **skipCodeCoverage**, to use only in branch scoped config to not check for code coverage (Use with caution because won't work when deploying to production !)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sfdxHardisLabel": "Conga Template files for Conga configuration",
|
|
3
|
+
"sfdxHardisDescription": "Export attachments related to conga templates",
|
|
4
|
+
"soqlQuery": "SELECT Id,Name,APXTConga4__Key__c FROM APXTConga4__Conga_Template__c",
|
|
5
|
+
"fileTypes": "all",
|
|
6
|
+
"outputFolderNameField": "APXTConga4__Key__c",
|
|
7
|
+
"outputFileNameFormat": "title",
|
|
8
|
+
"overwriteParentRecords": true,
|
|
9
|
+
"overwriteFiles": true
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sfdxHardisLabel": "Conga Configuration",
|
|
3
|
+
"sfdxHardisDescription": "Will export/import Conga config (Templates, Queries, Email Templates, Solutions)",
|
|
4
|
+
"objects": [
|
|
5
|
+
{
|
|
6
|
+
"query": "SELECT all FROM APXTConga4__Conga_Template__c",
|
|
7
|
+
"operation": "Upsert",
|
|
8
|
+
"externalId": "APXTConga4__Key__c"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"query": "SELECT all FROM APXTConga4__Conga_Merge_Query__c",
|
|
12
|
+
"operation": "Upsert",
|
|
13
|
+
"externalId": "APXTConga4__Key__c"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"query": "SELECT all FROM APXTConga4__Conga_Email_Template__c",
|
|
17
|
+
"operation": "Upsert",
|
|
18
|
+
"externalId": "APXTConga4__Key__c"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"query": "SELECT all FROM APXTConga4__Conga_Solution__c",
|
|
22
|
+
"operation": "Upsert",
|
|
23
|
+
"externalId": "Name"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -12,5 +12,15 @@ export default class ConfigureData extends SfdxCommand {
|
|
|
12
12
|
protected static requiresUsername: boolean;
|
|
13
13
|
protected static requiresProject: boolean;
|
|
14
14
|
protected static requiresSfdxPlugins: string[];
|
|
15
|
+
additionalFiles: any;
|
|
16
|
+
dataPath: string;
|
|
17
|
+
sfdmuConfig: any;
|
|
18
|
+
importInScratchOrgs: boolean;
|
|
15
19
|
run(): Promise<AnyJson>;
|
|
20
|
+
private generateConfigurationFiles;
|
|
21
|
+
private buildExportJsonInfo;
|
|
22
|
+
private promptExportInfo;
|
|
23
|
+
private selectTemplate;
|
|
24
|
+
private buildExportJsonInfoFromTemplate;
|
|
25
|
+
private promptImportInScratchOrgs;
|
|
16
26
|
}
|
|
@@ -12,58 +12,66 @@ const dataUtils_1 = require("../../../../common/utils/dataUtils");
|
|
|
12
12
|
const prompts_1 = require("../../../../common/utils/prompts");
|
|
13
13
|
const websocketClient_1 = require("../../../../common/websocketClient");
|
|
14
14
|
const config_1 = require("../../../../config");
|
|
15
|
+
const settings_1 = require("../../../../settings");
|
|
15
16
|
// Initialize Messages with the current plugin directory
|
|
16
17
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
18
|
// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
|
|
18
19
|
// or any library that is using the messages framework can also be loaded this way.
|
|
19
20
|
const messages = core_1.Messages.loadMessages("sfdx-hardis", "org");
|
|
20
21
|
class ConfigureData extends command_1.SfdxCommand {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.additionalFiles = [];
|
|
25
|
+
}
|
|
21
26
|
/* jscpd:ignore-end */
|
|
22
27
|
async run() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
28
|
+
const template = await this.selectTemplate();
|
|
29
|
+
if (template === "blank") {
|
|
30
|
+
// Request info to build sfdmu workspace
|
|
31
|
+
await this.buildExportJsonInfo();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
await this.buildExportJsonInfoFromTemplate(template);
|
|
35
|
+
}
|
|
36
|
+
// Check if not already existing
|
|
37
|
+
const { exportJsonFile, sfdmuProjectFolder } = await this.generateConfigurationFiles();
|
|
38
|
+
await this.promptImportInScratchOrgs(sfdmuProjectFolder);
|
|
39
|
+
// Set bac initial cwd
|
|
40
|
+
const message = c.cyan(`Successfully initialized sfdmu project ${c.green(sfdmuProjectFolder)}, with ${c.green("export.json")} file.
|
|
41
|
+
You can now configure it using SFDMU documentation: https://help.sfdmu.com/plugin-basics/basic-usage/minimal-configuration
|
|
42
|
+
If you don't have unique field to identify an object, use composite external ids: https://help.sfdmu.com/full-documentation/advanced-features/composite-external-id-keys
|
|
43
|
+
`);
|
|
44
|
+
(0, utils_1.uxLog)(this, message);
|
|
45
|
+
// Trigger command to open SFDMU config file in VsCode extension
|
|
46
|
+
websocketClient_1.WebSocketClient.requestOpenFile(exportJsonFile);
|
|
47
|
+
return { outputString: message };
|
|
48
|
+
}
|
|
49
|
+
async generateConfigurationFiles() {
|
|
50
|
+
const sfdmuProjectFolder = path.join(dataUtils_1.dataFolderRoot, this.dataPath);
|
|
51
|
+
if (fs.existsSync(sfdmuProjectFolder)) {
|
|
52
|
+
throw new core_1.SfdxError(`[sfdx-hardis]${c.red(`Folder ${c.bold(sfdmuProjectFolder)} already exists`)}`);
|
|
53
|
+
}
|
|
54
|
+
// Create folder & export.json
|
|
55
|
+
await fs.ensureDir(sfdmuProjectFolder);
|
|
56
|
+
const exportJsonFile = path.join(sfdmuProjectFolder, "export.json");
|
|
57
|
+
await fs.writeFile(exportJsonFile, JSON.stringify(this.sfdmuConfig, null, 2));
|
|
58
|
+
(0, utils_1.uxLog)(this, "Generated SFDMU config file " + exportJsonFile);
|
|
59
|
+
for (const additionalFile of this.additionalFiles) {
|
|
60
|
+
const additionalFileFull = path.join(sfdmuProjectFolder, additionalFile.path);
|
|
61
|
+
await fs.writeFile(additionalFileFull, additionalFile.text);
|
|
62
|
+
(0, utils_1.uxLog)(this, c.cyan(additionalFile.message + ": ") + c.yellow(additionalFileFull));
|
|
63
|
+
websocketClient_1.WebSocketClient.requestOpenFile(additionalFileFull);
|
|
64
|
+
}
|
|
65
|
+
return { exportJsonFile, sfdmuProjectFolder };
|
|
66
|
+
}
|
|
67
|
+
async buildExportJsonInfo() {
|
|
68
|
+
const resp = await this.promptExportInfo();
|
|
59
69
|
// Collect / reformat data
|
|
60
|
-
|
|
70
|
+
this.dataPath = pascalcase(resp.dataPath);
|
|
61
71
|
const sfdxHardisLabel = resp.sfdxHardisLabel;
|
|
62
72
|
const sfdxHardisDescription = resp.sfdxHardisDescription;
|
|
63
|
-
const importInScratchOrgs = resp.importInScratchOrgs;
|
|
64
73
|
const additionalConfig = resp.additional || [];
|
|
65
|
-
|
|
66
|
-
const sfdmuConfig = {
|
|
74
|
+
this.sfdmuConfig = {
|
|
67
75
|
sfdxHardisLabel: sfdxHardisLabel,
|
|
68
76
|
sfdxHardisDescription: sfdxHardisDescription,
|
|
69
77
|
objects: [
|
|
@@ -77,7 +85,7 @@ class ConfigureData extends command_1.SfdxCommand {
|
|
|
77
85
|
// Manage badwords filter option
|
|
78
86
|
if (additionalConfig.includes("badwordsFilter")) {
|
|
79
87
|
const badwordsFileName = "badwords.json";
|
|
80
|
-
sfdmuConfig.objects[0] = [
|
|
88
|
+
this.sfdmuConfig.objects[0] = [
|
|
81
89
|
{
|
|
82
90
|
query: "SELECT all FROM Lead",
|
|
83
91
|
operation: "Readonly",
|
|
@@ -102,45 +110,86 @@ class ConfigureData extends command_1.SfdxCommand {
|
|
|
102
110
|
const badwordsSample = {
|
|
103
111
|
badwords: ["write", "your", "bad", "words", "and expressions", "here"],
|
|
104
112
|
};
|
|
105
|
-
additionalFiles.push({
|
|
113
|
+
this.additionalFiles.push({
|
|
106
114
|
path: badwordsFileName,
|
|
107
115
|
text: JSON.stringify(badwordsSample, null, 2),
|
|
108
116
|
message: "Sample badwords file has been generated and needs to be updated",
|
|
109
117
|
});
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
}
|
|
121
|
+
async promptExportInfo() {
|
|
122
|
+
return await (0, prompts_1.prompts)([
|
|
123
|
+
{
|
|
124
|
+
type: "text",
|
|
125
|
+
name: "dataPath",
|
|
126
|
+
message: c.cyanBright('Please input the SFDMU folder name (PascalCase format). Ex: "ProductsActive"'),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: "text",
|
|
130
|
+
name: "sfdxHardisLabel",
|
|
131
|
+
message: c.cyanBright('Please input the SFDMU config label. Ex: "Active Products"'),
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: "text",
|
|
135
|
+
name: "sfdxHardisDescription",
|
|
136
|
+
message: c.cyanBright('Please input the SFDMU config description. Ex: "Active products are used for scratch org initialization and in deployments"'),
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "multiselect",
|
|
140
|
+
name: "additional",
|
|
141
|
+
message: c.cyanBright("Please select additional options if you need them. If not, just select nothing and continue"),
|
|
142
|
+
choices: [
|
|
143
|
+
{
|
|
144
|
+
title: "Bad words detector",
|
|
145
|
+
description: "Can detect a list of bad words in records",
|
|
146
|
+
value: "badwordsFilter",
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
async selectTemplate() {
|
|
153
|
+
const templateChoices = [];
|
|
154
|
+
const templatesFolder = path.join(settings_1.PACKAGE_ROOT_DIR, "defaults/templates/sfdmu");
|
|
155
|
+
const templateFiles = fs.readdirSync(templatesFolder);
|
|
156
|
+
for (const templateFile of templateFiles) {
|
|
157
|
+
const templateName = path.basename(templateFile).replace(".json", "");
|
|
158
|
+
templateChoices.push({
|
|
159
|
+
title: templateName,
|
|
160
|
+
value: path.join(templatesFolder, templateFile),
|
|
161
|
+
description: `sfdx-hardis template for ${templateName}`,
|
|
162
|
+
});
|
|
127
163
|
}
|
|
128
|
-
|
|
129
|
-
|
|
164
|
+
const defaultTemplateChoice = { title: "Blank template", value: "blank", description: "Configure your data import/export from scratch :)" };
|
|
165
|
+
const templateResp = await (0, prompts_1.prompts)({
|
|
166
|
+
type: "select",
|
|
167
|
+
name: "template",
|
|
168
|
+
message: c.cyanBright("Please select a SFDMU template, or the blank one"),
|
|
169
|
+
choices: [...[defaultTemplateChoice], ...templateChoices],
|
|
170
|
+
});
|
|
171
|
+
return templateResp.template;
|
|
172
|
+
}
|
|
173
|
+
async buildExportJsonInfoFromTemplate(templateFile) {
|
|
174
|
+
const templateName = path.basename(templateFile).replace(".json", "");
|
|
175
|
+
this.dataPath = pascalcase(templateName);
|
|
176
|
+
this.sfdmuConfig = JSON.parse(fs.readFileSync(templateFile, "utf-8"));
|
|
177
|
+
}
|
|
178
|
+
async promptImportInScratchOrgs(sfdmuProjectFolder) {
|
|
179
|
+
const importResp = await (0, prompts_1.prompts)({
|
|
180
|
+
type: "confirm",
|
|
181
|
+
name: "importInScratchOrgs",
|
|
182
|
+
message: c.cyanBright("Do you want this SFDMU config to be used to import data when initializing a new scratch org ?"),
|
|
183
|
+
default: false,
|
|
184
|
+
});
|
|
185
|
+
this.importInScratchOrgs = importResp.importInScratchOrgs === true;
|
|
130
186
|
// Manage dataPackages if importInScratchOrgs is true
|
|
131
|
-
if (importInScratchOrgs === true) {
|
|
187
|
+
if (this.importInScratchOrgs === true) {
|
|
132
188
|
const config = await (0, config_1.getConfig)("project");
|
|
133
189
|
const dataPackages = config.dataPackages || [];
|
|
134
190
|
dataPackages.push({ dataPath: sfdmuProjectFolder.replace(/\\/g, "/"), importInScratchOrgs: true });
|
|
135
191
|
await (0, config_1.setConfig)("project", { dataPackages: dataPackages });
|
|
136
192
|
}
|
|
137
|
-
// Set bac initial cwd
|
|
138
|
-
const message = c.cyan(`Successfully initialized sfdmu project ${c.green(sfdmuProjectFolder)}, with ${c.green("export.json")} file.
|
|
139
|
-
You can now configure it using SFDMU documentation: https://help.sfdmu.com/plugin-basics/basic-usage/minimal-configuration
|
|
140
|
-
If you don't have unique field to identify an object, use composite external ids: https://help.sfdmu.com/full-documentation/advanced-features/composite-external-id-keys
|
|
141
|
-
`);
|
|
142
|
-
(0, utils_1.uxLog)(this, message);
|
|
143
|
-
return { outputString: message };
|
|
144
193
|
}
|
|
145
194
|
}
|
|
146
195
|
ConfigureData.title = "Configure Data project";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/org/configure/data.ts"],"names":[],"mappings":";;AAAA,wBAAwB;AACxB,iDAAyD;AACzD,2CAAuD;AAEvD,2BAA2B;AAC3B,+BAA+B;AAC/B,yCAAyC;AACzC,6BAA6B;AAC7B,oDAAiD;AACjD,kEAAoE;AACpE,8DAA2D;AAC3D,wEAAqE;AACrE,+CAA0D;
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/org/configure/data.ts"],"names":[],"mappings":";;AAAA,wBAAwB;AACxB,iDAAyD;AACzD,2CAAuD;AAEvD,2BAA2B;AAC3B,+BAA+B;AAC/B,yCAAyC;AACzC,6BAA6B;AAC7B,oDAAiD;AACjD,kEAAoE;AACpE,8DAA2D;AAC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AAa"}
|
|
@@ -11,5 +11,11 @@ export default class ConfigureData extends SfdxCommand {
|
|
|
11
11
|
};
|
|
12
12
|
protected static requiresUsername: boolean;
|
|
13
13
|
protected static requiresProject: boolean;
|
|
14
|
+
exportConfig: any;
|
|
15
|
+
filesExportPath: any;
|
|
14
16
|
run(): Promise<AnyJson>;
|
|
17
|
+
private createConfigFiles;
|
|
18
|
+
private selectTemplate;
|
|
19
|
+
private buildExportJsonInfo;
|
|
20
|
+
private buildExportJsonInfoFromTemplate;
|
|
15
21
|
}
|
|
@@ -11,6 +11,8 @@ const utils_1 = require("../../../../common/utils");
|
|
|
11
11
|
const filesUtils_1 = require("../../../../common/utils/filesUtils");
|
|
12
12
|
const filesUtils_2 = require("../../../../common/utils/filesUtils");
|
|
13
13
|
const websocketClient_1 = require("../../../../common/websocketClient");
|
|
14
|
+
const settings_1 = require("../../../../settings");
|
|
15
|
+
const prompts_1 = require("../../../../common/utils/prompts");
|
|
14
16
|
// Initialize Messages with the current plugin directory
|
|
15
17
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
18
|
// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
|
|
@@ -19,7 +21,58 @@ const messages = core_1.Messages.loadMessages("sfdx-hardis", "org");
|
|
|
19
21
|
class ConfigureData extends command_1.SfdxCommand {
|
|
20
22
|
/* jscpd:ignore-end */
|
|
21
23
|
async run() {
|
|
22
|
-
|
|
24
|
+
const template = await this.selectTemplate();
|
|
25
|
+
if (template === "blank") {
|
|
26
|
+
// Request info to build sfdmu workspace
|
|
27
|
+
await this.buildExportJsonInfo();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
await this.buildExportJsonInfoFromTemplate(template);
|
|
31
|
+
}
|
|
32
|
+
// Check if not already existing
|
|
33
|
+
const { exportJsonFile, filesProjectFolder } = await this.createConfigFiles();
|
|
34
|
+
// Trigger command to open SFDMU config file in VsCode extension
|
|
35
|
+
websocketClient_1.WebSocketClient.requestOpenFile(exportJsonFile);
|
|
36
|
+
// Set bac initial cwd
|
|
37
|
+
const message = c.cyan(`Successfully initialized files export project ${c.green(filesProjectFolder)}, with ${c.green("export.json")} file.
|
|
38
|
+
You can now call it using ${c.white("sfdx hardis:org:files:export")}
|
|
39
|
+
`);
|
|
40
|
+
(0, utils_1.uxLog)(this, message);
|
|
41
|
+
return { outputString: message };
|
|
42
|
+
}
|
|
43
|
+
async createConfigFiles() {
|
|
44
|
+
const filesProjectFolder = path.join(filesUtils_1.filesFolderRoot, this.filesExportPath);
|
|
45
|
+
if (fs.existsSync(filesProjectFolder)) {
|
|
46
|
+
throw new core_1.SfdxError(`[sfdx-hardis]${c.red(`Folder ${c.bold(filesProjectFolder)} already exists`)}`);
|
|
47
|
+
}
|
|
48
|
+
// Create folder & export.json
|
|
49
|
+
await fs.ensureDir(filesProjectFolder);
|
|
50
|
+
const exportJsonFile = path.join(filesProjectFolder, "export.json");
|
|
51
|
+
await fs.writeFile(exportJsonFile, JSON.stringify(this.exportConfig, null, 2));
|
|
52
|
+
return { exportJsonFile, filesProjectFolder };
|
|
53
|
+
}
|
|
54
|
+
async selectTemplate() {
|
|
55
|
+
const templateFileChoices = [];
|
|
56
|
+
const templatesFilesFolder = path.join(settings_1.PACKAGE_ROOT_DIR, "defaults/templates/files");
|
|
57
|
+
const templateFiles = fs.readdirSync(templatesFilesFolder);
|
|
58
|
+
for (const templateFile of templateFiles) {
|
|
59
|
+
const templateName = path.basename(templateFile).replace(".json", "");
|
|
60
|
+
templateFileChoices.push({
|
|
61
|
+
title: templateName,
|
|
62
|
+
value: path.join(templatesFilesFolder, templateFile),
|
|
63
|
+
description: `sfdx-hardis template for ${templateName}`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const defaultTemplateChoice = { title: "Blank template", value: "blank", description: "Configure your files import/export from scratch :)" };
|
|
67
|
+
const templateResp = await (0, prompts_1.prompts)({
|
|
68
|
+
type: "select",
|
|
69
|
+
name: "template",
|
|
70
|
+
message: c.cyanBright("Please select a Files import/export template, or the blank one"),
|
|
71
|
+
choices: [...[defaultTemplateChoice], ...templateFileChoices],
|
|
72
|
+
});
|
|
73
|
+
return templateResp.template;
|
|
74
|
+
}
|
|
75
|
+
async buildExportJsonInfo() {
|
|
23
76
|
const defaultConfig = {
|
|
24
77
|
sfdxHardisLabel: "",
|
|
25
78
|
sfdxHardisDescription: "",
|
|
@@ -30,27 +83,15 @@ class ConfigureData extends command_1.SfdxCommand {
|
|
|
30
83
|
overwriteParentRecords: true,
|
|
31
84
|
overwriteFiles: false,
|
|
32
85
|
};
|
|
33
|
-
|
|
86
|
+
this.exportConfig = await (0, filesUtils_2.promptFilesExportConfiguration)(defaultConfig, false);
|
|
34
87
|
// Collect / reformat data
|
|
35
|
-
|
|
36
|
-
delete exportConfig.filesExportPath;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Create folder & export.json
|
|
43
|
-
await fs.ensureDir(filesProjectFolder);
|
|
44
|
-
const exportJsonFile = path.join(filesProjectFolder, "export.json");
|
|
45
|
-
await fs.writeFile(exportJsonFile, JSON.stringify(exportConfig, null, 2));
|
|
46
|
-
// Trigger command to open SFDMU config file in VsCode extension
|
|
47
|
-
websocketClient_1.WebSocketClient.requestOpenFile(exportJsonFile);
|
|
48
|
-
// Set bac initial cwd
|
|
49
|
-
const message = c.cyan(`Successfully initialized files export project ${c.green(filesProjectFolder)}, with ${c.green("export.json")} file.
|
|
50
|
-
You can now call it using ${c.white("sfdx hardis:org:files:export")}
|
|
51
|
-
`);
|
|
52
|
-
(0, utils_1.uxLog)(this, message);
|
|
53
|
-
return { outputString: message };
|
|
88
|
+
this.filesExportPath = pascalcase(this.exportConfig.filesExportPath);
|
|
89
|
+
delete this.exportConfig.filesExportPath;
|
|
90
|
+
}
|
|
91
|
+
async buildExportJsonInfoFromTemplate(templateFile) {
|
|
92
|
+
const templateName = path.basename(templateFile).replace(".json", "");
|
|
93
|
+
this.filesExportPath = pascalcase(templateName);
|
|
94
|
+
this.exportConfig = JSON.parse(fs.readFileSync(templateFile, "utf-8"));
|
|
54
95
|
}
|
|
55
96
|
}
|
|
56
97
|
ConfigureData.title = "Configure File export project";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/org/configure/files.ts"],"names":[],"mappings":";;AAAA,wBAAwB;AACxB,iDAAyD;AACzD,2CAAuD;AAEvD,2BAA2B;AAC3B,+BAA+B;AAC/B,yCAAyC;AACzC,6BAA6B;AAC7B,oDAAiD;AACjD,oEAAsE;AACtE,oEAAqF;AACrF,wEAAqE;
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/org/configure/files.ts"],"names":[],"mappings":";;AAAA,wBAAwB;AACxB,iDAAyD;AACzD,2CAAuD;AAEvD,2BAA2B;AAC3B,+BAA+B;AAC/B,yCAAyC;AACzC,6BAA6B;AAC7B,oDAAiD;AACjD,oEAAsE;AACtE,oEAAqF;AACrF,wEAAqE;AACrE,mDAAwD;AACxD,8DAA2D;AAE3D,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAE7D,MAAqB,aAAc,SAAQ,qBAAW;IAqCpD,sBAAsB;IAEf,KAAK,CAAC,GAAG;QACd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAE7C,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,wCAAwC;YACxC,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC,+BAA+B,CAAC,QAAQ,CAAC,CAAC;QACvD,CAAC;QAED,gCAAgC;QAChC,MAAM,EAAE,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@salesforce/command";
|
|
2
|
+
import { AnyJson } from "@salesforce/ts-types";
|
|
3
|
+
export default class FilesImport extends SfdxCommand {
|
|
4
|
+
static title: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
protected static flagsConfig: {
|
|
8
|
+
path: flags.Discriminated<flags.String>;
|
|
9
|
+
overwrite: flags.Discriminated<flags.Boolean<boolean>>;
|
|
10
|
+
debug: flags.Discriminated<flags.Boolean<boolean>>;
|
|
11
|
+
websocket: flags.Discriminated<flags.String>;
|
|
12
|
+
skipauth: flags.Discriminated<flags.Boolean<boolean>>;
|
|
13
|
+
};
|
|
14
|
+
protected static requiresUsername: boolean;
|
|
15
|
+
protected static requiresProject: boolean;
|
|
16
|
+
protected handleOverwrite: any;
|
|
17
|
+
run(): Promise<AnyJson>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* jscpd:ignore-start */
|
|
4
|
+
const command_1 = require("@salesforce/command");
|
|
5
|
+
const core_1 = require("@salesforce/core");
|
|
6
|
+
const c = require("chalk");
|
|
7
|
+
const utils_1 = require("../../../../common/utils");
|
|
8
|
+
const filesUtils_1 = require("../../../../common/utils/filesUtils");
|
|
9
|
+
const prompts_1 = require("../../../../common/utils/prompts");
|
|
10
|
+
// Initialize Messages with the current plugin directory
|
|
11
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
12
|
+
// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
|
|
13
|
+
// or any library that is using the messages framework can also be loaded this way.
|
|
14
|
+
const messages = core_1.Messages.loadMessages("sfdx-hardis", "org");
|
|
15
|
+
class FilesImport extends command_1.SfdxCommand {
|
|
16
|
+
/* jscpd:ignore-end */
|
|
17
|
+
async run() {
|
|
18
|
+
var _a;
|
|
19
|
+
let filesPath = this.flags.path || null;
|
|
20
|
+
this.handleOverwrite = ((_a = this.flags) === null || _a === void 0 ? void 0 : _a.overwrite) === true;
|
|
21
|
+
// Identify files workspace if not defined
|
|
22
|
+
if (filesPath == null) {
|
|
23
|
+
filesPath = await (0, filesUtils_1.selectFilesWorkspace)({ selectFilesLabel: "Please select a files workspace to IMPORT" });
|
|
24
|
+
}
|
|
25
|
+
if (!utils_1.isCI) {
|
|
26
|
+
const handleOverwriteRes = await (0, prompts_1.prompts)({
|
|
27
|
+
type: "confirm",
|
|
28
|
+
name: "value",
|
|
29
|
+
message: "Do you want to overwrite the existing files with the same name ? (doubles the number of used API calls)",
|
|
30
|
+
});
|
|
31
|
+
this.handleOverwrite = handleOverwriteRes.value;
|
|
32
|
+
}
|
|
33
|
+
const importOptions = { handleOverwrite: this.handleOverwrite };
|
|
34
|
+
// Import files into org
|
|
35
|
+
const importResult = await new filesUtils_1.FilesImporter(filesPath, this.org.getConnection(), importOptions, this).processImport();
|
|
36
|
+
// Output message
|
|
37
|
+
const message = `Successfully imported files from project ${c.green(filesPath)} from org ${c.green(this.org.getUsername())}`;
|
|
38
|
+
(0, utils_1.uxLog)(this, c.cyan(message));
|
|
39
|
+
return { outputString: message, importResult: importResult };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
FilesImport.title = "Import files";
|
|
43
|
+
FilesImport.description = `Import file attachments into a Salesforce org
|
|
44
|
+
|
|
45
|
+
See article below to see how to Export them.
|
|
46
|
+
|
|
47
|
+
[](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)
|
|
48
|
+
`;
|
|
49
|
+
FilesImport.examples = ["$ sfdx hardis:org:files:import"];
|
|
50
|
+
FilesImport.flagsConfig = {
|
|
51
|
+
path: command_1.flags.string({
|
|
52
|
+
char: "p",
|
|
53
|
+
description: "Path to the file export project",
|
|
54
|
+
}),
|
|
55
|
+
overwrite: command_1.flags.boolean({
|
|
56
|
+
char: "o",
|
|
57
|
+
description: "Override existing files (doubles the number of API calls)",
|
|
58
|
+
}),
|
|
59
|
+
debug: command_1.flags.boolean({
|
|
60
|
+
char: "d",
|
|
61
|
+
default: false,
|
|
62
|
+
description: messages.getMessage("debugMode"),
|
|
63
|
+
}),
|
|
64
|
+
websocket: command_1.flags.string({
|
|
65
|
+
description: messages.getMessage("websocket"),
|
|
66
|
+
}),
|
|
67
|
+
skipauth: command_1.flags.boolean({
|
|
68
|
+
description: "Skip authentication check when a default username is required",
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
// Comment this out if your command does not require an org username
|
|
72
|
+
FilesImport.requiresUsername = true;
|
|
73
|
+
// Comment this out if your command does not support a hub org username
|
|
74
|
+
// protected static requiresDevhubUsername = true;
|
|
75
|
+
// Set this to true if your command requires a project workspace; 'requiresProject' is false by default
|
|
76
|
+
FilesImport.requiresProject = false;
|
|
77
|
+
exports.default = FilesImport;
|
|
78
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/org/files/import.ts"],"names":[],"mappings":";;AAAA,wBAAwB;AACxB,iDAAyD;AACzD,2CAA4C;AAE5C,2BAA2B;AAC3B,oDAAuD;AACvD,oEAA0F;AAC1F,8DAA2D;AAE3D,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAE7D,MAAqB,WAAY,SAAQ,qBAAW;IA4ClD,sBAAsB;IAEf,KAAK,CAAC,GAAG;;QACd,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,eAAe,GAAG,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,MAAK,IAAI,CAAC;QAEtD,0CAA0C;QAC1C,IAAI,SAAS,IAAI,IA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QACvB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,2DAA2D;KACzE,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;KAC9C,CAAC;IACF,SAAS,EAAE,eAAK,CAAC,MAAM,CAAC;QACtB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;KAC9C,CAAC;IACF,QAAQ,EAAE,eAAK,CAAC,OAAO,CAAC;QACtB,WAAW,EAAE,+DAA+D;KAC7E,CAAC;CACH,CAAC;AAEF,oEAAoE;AACnD,4BAAgB,GAAG,IAAI,CAAC;AAEzC,uEAAuE;AACvE,kDAAkD;AAElD,uGAAuG;AACtF,2BAAe,GAAG,KAAK,CAAC;kBAzCtB,WAAW"}
|
|
@@ -7,12 +7,17 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
const gitProviderRoot_1 = require("./gitProviderRoot");
|
|
8
8
|
class GitlabProvider extends gitProviderRoot_1.GitProviderRoot {
|
|
9
9
|
constructor() {
|
|
10
|
+
var _a;
|
|
10
11
|
super();
|
|
11
12
|
// Gitlab URL is always provided by default CI variables
|
|
12
13
|
this.serverUrl = process.env.CI_SERVER_URL;
|
|
13
14
|
// It's better to have a project token defined in a CI_SFDX_HARDIS_GITLAB_TOKEN variable, to have the rights to act on Pull Requests
|
|
14
15
|
this.token = process.env.CI_SFDX_HARDIS_GITLAB_TOKEN || process.env.ACCESS_TOKEN;
|
|
15
|
-
this.gitlabApi = new node_1.Gitlab({
|
|
16
|
+
this.gitlabApi = new node_1.Gitlab({
|
|
17
|
+
host: this.serverUrl,
|
|
18
|
+
token: this.token,
|
|
19
|
+
rejectUnauthorized: ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.GITLAB_API_REJECT_UNAUTHORIZED) === "false" ? false : true,
|
|
20
|
+
});
|
|
16
21
|
}
|
|
17
22
|
getLabel() {
|
|
18
23
|
return "sfdx-hardis Gitlab connector";
|