@jayree/sfdx-plugin-legacy 1.0.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE.txt +12 -0
  3. package/README.md +251 -0
  4. package/lib/commands/jayree/automation/changeset/deploy.d.ts +23 -0
  5. package/lib/commands/jayree/automation/changeset/deploy.js +397 -0
  6. package/lib/commands/jayree/automation/changeset/deploy.js.map +1 -0
  7. package/lib/commands/jayree/automation/changeset/list.d.ts +11 -0
  8. package/lib/commands/jayree/automation/changeset/list.js +98 -0
  9. package/lib/commands/jayree/automation/changeset/list.js.map +1 -0
  10. package/lib/commands/jayree/automation/ltngsync/status.d.ts +22 -0
  11. package/lib/commands/jayree/automation/ltngsync/status.js +239 -0
  12. package/lib/commands/jayree/automation/ltngsync/status.js.map +1 -0
  13. package/lib/commands/jayree/packagedescription/create.d.ts +17 -0
  14. package/lib/commands/jayree/packagedescription/create.js +62 -0
  15. package/lib/commands/jayree/packagedescription/create.js.map +1 -0
  16. package/lib/commands/jayree/packagedescription/get.d.ts +16 -0
  17. package/lib/commands/jayree/packagedescription/get.js +57 -0
  18. package/lib/commands/jayree/packagedescription/get.js.map +1 -0
  19. package/lib/commands/jayree/packagedescription/remove.d.ts +16 -0
  20. package/lib/commands/jayree/packagedescription/remove.js +82 -0
  21. package/lib/commands/jayree/packagedescription/remove.js.map +1 -0
  22. package/lib/commands/jayree/packagedescription/set.d.ts +17 -0
  23. package/lib/commands/jayree/packagedescription/set.js +76 -0
  24. package/lib/commands/jayree/packagedescription/set.js.map +1 -0
  25. package/lib/hooks/changelog.d.ts +2 -0
  26. package/lib/hooks/changelog.js +123 -0
  27. package/lib/hooks/changelog.js.map +1 -0
  28. package/lib/index.d.ts +2 -0
  29. package/lib/index.js +10 -0
  30. package/lib/index.js.map +1 -0
  31. package/lib/utils/xml.d.ts +5 -0
  32. package/lib/utils/xml.js +50 -0
  33. package/lib/utils/xml.js.map +1 -0
  34. package/messages/createpackagedescription.json +5 -0
  35. package/messages/deploychangeset.json +8 -0
  36. package/messages/getpackagedescription.json +4 -0
  37. package/messages/listchangeset.json +3 -0
  38. package/messages/ltngsyncstatus.json +6 -0
  39. package/messages/removepackagedescription.json +4 -0
  40. package/messages/setpackagedescription.json +5 -0
  41. package/oclif.manifest.json +1 -0
  42. package/package.json +160 -0
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /*
7
+ * Copyright (c) 2021, jayree
8
+ * All rights reserved.
9
+ * Licensed under the BSD 3-Clause license.
10
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
11
+ */
12
+ const command_1 = require("@salesforce/command");
13
+ const core_1 = require("@salesforce/core");
14
+ const puppeteer_1 = __importDefault(require("puppeteer"));
15
+ core_1.Messages.importMessagesDirectory(__dirname);
16
+ const messages = core_1.Messages.loadMessages('@jayree/sfdx-plugin-legacy', 'ltngsyncstatus');
17
+ class LtngSyncStatus extends command_1.SfdxCommand {
18
+ async run() {
19
+ const browser = await puppeteer_1.default.launch({
20
+ headless: true,
21
+ });
22
+ let tables;
23
+ try {
24
+ const conn = this.org.getConnection();
25
+ const page = await browser.newPage();
26
+ await this.login(conn, page);
27
+ await page.goto(conn.instanceUrl + '/s2x/resetExchangeSyncUser.apexp', {
28
+ waitUntil: 'networkidle2',
29
+ });
30
+ tables = await this.gettables(page);
31
+ if ((!(tables.System['orgConfigInfo']['Connection method configured'] === 'No') ||
32
+ tables.System['orgConfigInfo']['Outlook Integration enabled'] === 'Yes') &&
33
+ this.flags.officeuser) {
34
+ let userSetup;
35
+ ({ tables, userSetup } = await this.checkUserSetup(page));
36
+ if (userSetup === 'Yes' && !this.flags.statusonly) {
37
+ ({ tables } = await this.checkUserReset(page, tables, 'Salesforce and Exchange email addresses linked'));
38
+ ({ tables } = await this.checkContactsEvents(page, tables, 'Salesforce and Exchange email addresses linked', [
39
+ 'Linked',
40
+ ]));
41
+ ({ tables } = await this.checkContactsEvents(page, tables, 'Salesforce to Exchange sync status', [
42
+ 'Initial sync completed',
43
+ 'In sync',
44
+ ]));
45
+ ({ tables } = await this.checkContactsEvents(page, tables, 'Exchange to Salesforce sync status', [
46
+ 'Initial sync completed',
47
+ 'In sync',
48
+ ]));
49
+ }
50
+ }
51
+ else {
52
+ this.flags.statusonly = true;
53
+ }
54
+ if (this.flags.statusonly) {
55
+ // eslint-disable-next-line no-unused-expressions
56
+ this.flags.officeuser ? this.ux.styledJSON(tables[this.flags.officeuser]) : this.ux.styledJSON(tables);
57
+ }
58
+ }
59
+ catch (error) {
60
+ this.ux.stopSpinner();
61
+ throw error;
62
+ }
63
+ finally {
64
+ await browser.close();
65
+ }
66
+ return tables;
67
+ }
68
+ async checkUserSetup(page) {
69
+ this.ux.startSpinner('configSetup: User assigned to active Lightning Sync configuration');
70
+ let tables = await this.checkstatus(page);
71
+ let configSetupItem;
72
+ if (tables.System['orgConfigInfo']['Users with linked Exchange and Salesforce email addresses'] !== '0') {
73
+ await page.focus('#resetExchangeSyncUser');
74
+ await page.keyboard.type(this.flags.officeuser);
75
+ tables = await this.checkstatus(page);
76
+ try {
77
+ configSetupItem =
78
+ tables[this.flags.officeuser].configSetup['User assigned to active Lightning Sync configuration'];
79
+ }
80
+ catch {
81
+ tables[this.flags.officeuser] = {
82
+ configSetup: {
83
+ 'User assigned to active Lightning Sync configuration': 'No',
84
+ },
85
+ };
86
+ configSetupItem = 'No';
87
+ }
88
+ }
89
+ else {
90
+ this.ux.stopSpinner();
91
+ throw Error('Users with linked Exchange and Salesforce email addresses: 0');
92
+ }
93
+ this.ux.stopSpinner(configSetupItem);
94
+ return { tables, userSetup: configSetupItem };
95
+ }
96
+ async checkUserReset(page, tables, itemtext) {
97
+ const userContactsItem = tables[this.flags.officeuser].userContacts[itemtext];
98
+ const userEventsItem = tables[this.flags.officeuser].userEvents[itemtext];
99
+ let status = '';
100
+ if (!['Linked'].includes(userContactsItem) || !['Linked'].includes(userEventsItem)) {
101
+ this.ux.log('userContacts/userEvents: ' + itemtext + '... ' + userContactsItem + '/' + userEventsItem);
102
+ if (await this.ux.confirm('Do you want to perform a sync reset? (yes/no)')) {
103
+ await this.resetuser(page);
104
+ itemtext = 'Reset sync status';
105
+ let configSetupItem = tables[this.flags.officeuser].configSetup[itemtext];
106
+ this.ux.startSpinner('configSetup: ' + itemtext);
107
+ do {
108
+ tables = await this.checkstatus(page);
109
+ configSetupItem = tables[this.flags.officeuser].configSetup[itemtext];
110
+ if (status !== configSetupItem && typeof configSetupItem !== 'undefined') {
111
+ status = configSetupItem;
112
+ this.ux.setSpinnerStatus(status);
113
+ }
114
+ } while (typeof configSetupItem !== 'undefined');
115
+ this.ux.stopSpinner('Reset completed');
116
+ }
117
+ }
118
+ return { tables };
119
+ }
120
+ async checkContactsEvents(page, tables, itemtext, finalstate) {
121
+ let userContactsItem = tables[this.flags.officeuser].userContacts[itemtext];
122
+ let userEventsItem = tables[this.flags.officeuser].userEvents[itemtext];
123
+ let status = '';
124
+ this.ux.startSpinner('userContacts/userEvents: ' + itemtext);
125
+ const end = Date.now() + this.flags.wait * 1000 * 60;
126
+ if (!finalstate.includes(userContactsItem) || !finalstate.includes(userEventsItem)) {
127
+ do {
128
+ tables = await this.checkstatus(page);
129
+ userContactsItem = tables[this.flags.officeuser].userContacts[itemtext];
130
+ userEventsItem = tables[this.flags.officeuser].userEvents[itemtext];
131
+ if (status !== userContactsItem + '/' + userEventsItem) {
132
+ status = userContactsItem + '/' + userEventsItem;
133
+ this.ux.setSpinnerStatus(status);
134
+ }
135
+ } while ((!finalstate.includes(userContactsItem) || !finalstate.includes(userEventsItem)) &&
136
+ !(Date.now() > end && typeof this.flags.wait !== 'undefined'));
137
+ }
138
+ if (Date.now() > end && typeof this.flags.wait !== 'undefined') {
139
+ this.ux.stopSpinner('timeout!');
140
+ }
141
+ else {
142
+ this.ux.stopSpinner(userContactsItem + '/' + userEventsItem);
143
+ }
144
+ return { tables, userContactsItem, userEventsItem };
145
+ }
146
+ async login(conn, page) {
147
+ await page.goto(conn.instanceUrl + '/secur/frontdoor.jsp?sid=' + conn.accessToken, {
148
+ waitUntil: 'networkidle2',
149
+ });
150
+ }
151
+ async resetuser(page) {
152
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
153
+ page.on('dialog', async (dialog) => {
154
+ await dialog.accept();
155
+ });
156
+ await page.evaluate(() => {
157
+ document.getElementById('thePage:theForm:thePageBlock:pageBlock:resetButton').click();
158
+ });
159
+ await page.waitForNavigation({
160
+ waitUntil: 'networkidle2',
161
+ });
162
+ }
163
+ async gettables(page) {
164
+ return await page.evaluate(() => {
165
+ const converttables = (document, tables) => {
166
+ const convertedtables = {};
167
+ tables.forEach((tableid) => {
168
+ const object = {};
169
+ if (typeof document.getElementById(tableid) !== 'undefined' && document.getElementById(tableid)) {
170
+ for (const row of document.getElementById(tableid).rows) {
171
+ if (typeof row.cells[1] !== 'undefined') {
172
+ if (typeof row.cells[1].getElementsByTagName('img')[0] !== 'undefined') {
173
+ object[row.cells[0].innerText.replace(/(:|:\t|\t)/g, '')] =
174
+ row.cells[1].getElementsByTagName('img')[0].alt;
175
+ }
176
+ else {
177
+ object[row.cells[0].innerText.replace(/(:|:\t|\t)/g, '')] = row.cells[1].innerText;
178
+ }
179
+ }
180
+ }
181
+ }
182
+ convertedtables[tableid] = object;
183
+ });
184
+ return convertedtables;
185
+ };
186
+ const returntables = {
187
+ System: converttables(document, ['orgConfigInfo', 'orgContacts', 'orgEvents']),
188
+ };
189
+ if (typeof document.getElementById('resetExchangeSyncUser') !== 'undefined' &&
190
+ document.getElementById('resetExchangeSyncUser')) {
191
+ const user = document.getElementById('resetExchangeSyncUser').value;
192
+ if (user !== '') {
193
+ returntables[user] = converttables(document, ['configSetup', 'userContacts', 'userEvents']);
194
+ }
195
+ }
196
+ return returntables;
197
+ });
198
+ }
199
+ async checkstatus(page) {
200
+ await page.evaluate(() => {
201
+ document.getElementById('thePage:theForm:thePageBlock:pageBlock:checkStatusButton').click();
202
+ });
203
+ await page.waitForNavigation({
204
+ waitUntil: 'networkidle2',
205
+ });
206
+ return this.gettables(page);
207
+ }
208
+ }
209
+ exports.default = LtngSyncStatus;
210
+ LtngSyncStatus.description = messages.getMessage('commandDescription');
211
+ LtngSyncStatus.examples = [
212
+ `$ sfdx jayree:automation:ltngsync:status -o 'Name'
213
+ configSetup: User assigned to active Lightning Sync configuration... Yes
214
+ userContacts/userEvents: Salesforce and Exchange email addresses linked... Linked/Linked
215
+ userContacts/userEvents: Salesforce to Exchange sync status... Initial sync completed/Initial sync completed
216
+ userContacts/userEvents: Exchange to Salesforce sync status... Initial sync completed/Initial sync completed
217
+ `,
218
+ ];
219
+ LtngSyncStatus.flagsConfig = {
220
+ officeuser: command_1.flags.string({
221
+ char: 'o',
222
+ description: messages.getMessage('UserFlagDescription'),
223
+ required: true,
224
+ }),
225
+ statusonly: command_1.flags.boolean({
226
+ char: 's',
227
+ description: messages.getMessage('StatusFlagDescription'),
228
+ required: false,
229
+ }),
230
+ wait: command_1.flags.integer({
231
+ char: 'w',
232
+ description: messages.getMessage('waitFlagDescription'),
233
+ required: false,
234
+ }),
235
+ };
236
+ LtngSyncStatus.requiresUsername = true;
237
+ LtngSyncStatus.supportsDevhubUsername = false;
238
+ LtngSyncStatus.requiresProject = false;
239
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../../src/commands/jayree/automation/ltngsync/status.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,iDAAyD;AACzD,2CAAwD;AAExD,0DAAkC;AAElC,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4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qCAAsB,GAAG,KAAK,CAAC;AAC/B,8BAAe,GAAG,KAAK,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { flags, SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class CreatePackageDescription extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ protected static flagsConfig: {
10
+ file: flags.Discriminated<flags.String>;
11
+ description: flags.Discriminated<flags.String>;
12
+ };
13
+ protected static requiresUsername: boolean;
14
+ protected static supportsDevhubUsername: boolean;
15
+ protected static requiresProject: boolean;
16
+ run(): Promise<AnyJson>;
17
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /*
7
+ * Copyright (c) 2021, jayree
8
+ * All rights reserved.
9
+ * Licensed under the BSD 3-Clause license.
10
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
11
+ */
12
+ const command_1 = require("@salesforce/command");
13
+ const core_1 = require("@salesforce/core");
14
+ const adm_zip_1 = __importDefault(require("adm-zip"));
15
+ const xml_1 = require("../../../utils/xml");
16
+ core_1.Messages.importMessagesDirectory(__dirname);
17
+ const messages = core_1.Messages.loadMessages('@jayree/sfdx-plugin-legacy', 'createpackagedescription');
18
+ class CreatePackageDescription extends command_1.SfdxCommand {
19
+ // eslint-disable-next-line @typescript-eslint/require-await
20
+ async run() {
21
+ const inputfile = this.args.file || this.flags.file;
22
+ const newZip = new adm_zip_1.default();
23
+ const text = this.flags.description.replace(/\\n/g, '\n');
24
+ const fileContentjs = {
25
+ Package: {
26
+ description: [text],
27
+ version: ['52.0'],
28
+ },
29
+ };
30
+ newZip.addFile('unpackaged/package.xml', Buffer.from((0, xml_1.js2Manifest)(fileContentjs)), '', 0o644);
31
+ newZip.writeZip(inputfile);
32
+ // this.ux.log(newZip.getEntries()[0].header.toString());
33
+ this.ux.log(text);
34
+ return { description: text, task: 'created' };
35
+ }
36
+ }
37
+ exports.default = CreatePackageDescription;
38
+ // hotfix to receive only one help page
39
+ // public static hidden = true;
40
+ CreatePackageDescription.description = messages.getMessage('commandDescription');
41
+ CreatePackageDescription.examples = [
42
+ `$ sfdx jayree:packagedescription:create --file FILENAME --description 'DESCRIPTION'
43
+ `,
44
+ ];
45
+ CreatePackageDescription.args = [{ name: 'file' }];
46
+ CreatePackageDescription.flagsConfig = {
47
+ file: command_1.flags.string({
48
+ char: 'f',
49
+ description: messages.getMessage('fileFlagDescription'),
50
+ required: true,
51
+ }),
52
+ description: command_1.flags.string({
53
+ char: 'd',
54
+ description: messages.getMessage('descriptionFlagDescription'),
55
+ dependsOn: ['file'],
56
+ required: true,
57
+ }),
58
+ };
59
+ CreatePackageDescription.requiresUsername = false;
60
+ CreatePackageDescription.supportsDevhubUsername = false;
61
+ CreatePackageDescription.requiresProject = false;
62
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/jayree/packagedescription/create.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,iDAAyD;AACzD,2CAA4C;AAE5C,sDAA6B;AAC7B,4CAAiD;AAEjD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,0BAA0B,CAAC,CAAC;AAEjG,MAAqB,wBAAyB,SAAQ,qBAAW;IA+B/D,4DAA4D;IACrD,KAAK,CAAC,GAAG;QACd,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACpD,MAAM,MAAM,GAAG,IAAI,iBAAM,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,IA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AC;AAC/B,wCAAe,GAAG,KAAK,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { flags, SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class GetPackageDescription extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ protected static flagsConfig: {
10
+ file: flags.Discriminated<flags.String>;
11
+ };
12
+ protected static requiresUsername: boolean;
13
+ protected static supportsDevhubUsername: boolean;
14
+ protected static requiresProject: boolean;
15
+ run(): Promise<AnyJson>;
16
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /*
7
+ * Copyright (c) 2021, jayree
8
+ * All rights reserved.
9
+ * Licensed under the BSD 3-Clause license.
10
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
11
+ */
12
+ const command_1 = require("@salesforce/command");
13
+ const core_1 = require("@salesforce/core");
14
+ const adm_zip_1 = __importDefault(require("adm-zip"));
15
+ const xml_1 = require("../../../utils/xml");
16
+ core_1.Messages.importMessagesDirectory(__dirname);
17
+ const messages = core_1.Messages.loadMessages('@jayree/sfdx-plugin-legacy', 'getpackagedescription');
18
+ class GetPackageDescription extends command_1.SfdxCommand {
19
+ // eslint-disable-next-line @typescript-eslint/require-await
20
+ async run() {
21
+ const inputfile = this.args.file || this.flags.file;
22
+ const zip = new adm_zip_1.default(inputfile);
23
+ const zipEntries = zip.getEntries();
24
+ let text;
25
+ zipEntries.forEach((zipEntry) => {
26
+ const fileName = zipEntry.entryName;
27
+ if (fileName.includes('package.xml')) {
28
+ const fileContent = zip.readAsText(fileName);
29
+ const xml = (0, xml_1.parseManifest)(fileContent);
30
+ text = xml.Package.description ? xml.Package.description.toString() : '';
31
+ this.ux.log(text);
32
+ }
33
+ });
34
+ return { description: text };
35
+ }
36
+ }
37
+ exports.default = GetPackageDescription;
38
+ // hotfix to receive only one help page
39
+ // public static hidden = true;
40
+ GetPackageDescription.description = messages.getMessage('commandDescription');
41
+ GetPackageDescription.examples = [
42
+ `$ sfdx jayree:packagedescription:get --file FILENAME
43
+ Description of Package FILENAME
44
+ `,
45
+ ];
46
+ GetPackageDescription.args = [{ name: 'file' }];
47
+ GetPackageDescription.flagsConfig = {
48
+ file: command_1.flags.string({
49
+ char: 'f',
50
+ description: messages.getMessage('fileFlagDescription'),
51
+ required: true,
52
+ }),
53
+ };
54
+ GetPackageDescription.requiresUsername = false;
55
+ GetPackageDescription.supportsDevhubUsername = false;
56
+ GetPackageDescription.requiresProject = false;
57
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/jayree/packagedescription/get.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,iDAAyD;AACzD,2CAA4C;AAE5C,sDAA6B;AAC7B,4CAAmD;AAEnD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,uBAAuB,CAAC,CAAC;AAE9F,MAAqB,qBAAsB,SAAQ,qBAAW;IA0B5D,4DAA4D;IACrD,KAAK,CAAC,GAAG;QACd,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAEpD,MAAM,GAAG,GAAG,IAAI,iBAAM,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAEpC,IAAI,IAAI,CAAC;QACT,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC9B,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC;YACpC,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBACpC,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBAC7C,MAAM,GAAG,GAAG,IAAA,mBAAa,EAAC,WAAW,CAAC,CAAC;gBACvC,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC/B,CAAC;;AA5CH,wCA6CC;AA5CC,uCAAuC;AACvC,+BAA+B;AAEjB,iCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAExD,8BAAQ,GAAG;IACvB;;KAEC;CACF,CAAC;AAEY,0BAAI,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAEvB,iCAAW,GAAG;IAC7B,IAAI,EAAE,eAAK,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;QACvD,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;AAEe,sCAAgB,GAAG,KAAK,CAAC;AACzB,4CAAsB,GAAG,KAAK,CAAC;AAC/B,qCAAe,GAAG,KAAK,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { flags, SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class RemovePackageDescription extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ protected static flagsConfig: {
10
+ file: flags.Discriminated<flags.String>;
11
+ };
12
+ protected static requiresUsername: boolean;
13
+ protected static supportsDevhubUsername: boolean;
14
+ protected static requiresProject: boolean;
15
+ run(): Promise<AnyJson>;
16
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /*
7
+ * Copyright (c) 2021, jayree
8
+ * All rights reserved.
9
+ * Licensed under the BSD 3-Clause license.
10
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
11
+ */
12
+ const command_1 = require("@salesforce/command");
13
+ const core_1 = require("@salesforce/core");
14
+ const adm_zip_1 = __importDefault(require("adm-zip"));
15
+ const xml_1 = require("../../../utils/xml");
16
+ core_1.Messages.importMessagesDirectory(__dirname);
17
+ const messages = core_1.Messages.loadMessages('@jayree/sfdx-plugin-legacy', 'removepackagedescription');
18
+ class RemovePackageDescription extends command_1.SfdxCommand {
19
+ // eslint-disable-next-line @typescript-eslint/require-await
20
+ async run() {
21
+ const inputfile = this.args.file || this.flags.file;
22
+ const newZip = new adm_zip_1.default();
23
+ const zip = new adm_zip_1.default(inputfile);
24
+ const zipEntries = zip.getEntries();
25
+ let action;
26
+ let text;
27
+ zipEntries.forEach((zipEntry) => {
28
+ const fileName = zipEntry.entryName;
29
+ const fileContent = zip.readFile(fileName);
30
+ if (fileName.includes('package.xml')) {
31
+ let fileContentjs;
32
+ const fileTXTContent = zip.readAsText(fileName);
33
+ const xml = (0, xml_1.parseManifest)(fileTXTContent);
34
+ if (xml.Package.description && xml.Package.description.length > 0) {
35
+ text = xml.Package.description.toString();
36
+ action = 'removed';
37
+ this.ux.log(action + ' description: ' + text);
38
+ fileContentjs = {
39
+ Package: {
40
+ $: { xmlns: 'http://soap.sforce.com/2006/04/metadata' },
41
+ types: xml.Package.types,
42
+ version: xml.Package.version,
43
+ },
44
+ };
45
+ newZip.addFile(fileName, Buffer.from((0, xml_1.js2Manifest)(fileContentjs)), '', 0o644);
46
+ }
47
+ else {
48
+ action = '';
49
+ this.ux.log('no description found');
50
+ }
51
+ }
52
+ else {
53
+ newZip.addFile(fileName, fileContent, '', 0o644);
54
+ }
55
+ });
56
+ if (action === 'removed') {
57
+ newZip.writeZip(inputfile);
58
+ }
59
+ // eslint-disable-next-line camelcase
60
+ return { old_description: text, task: action };
61
+ }
62
+ }
63
+ exports.default = RemovePackageDescription;
64
+ // hotfix to receive only one help page
65
+ // public static hidden = true;
66
+ RemovePackageDescription.description = messages.getMessage('commandDescription');
67
+ RemovePackageDescription.examples = [
68
+ `$ sfdx jayree:packagedescription:remove --file FILENAME
69
+ `,
70
+ ];
71
+ RemovePackageDescription.args = [{ name: 'file' }];
72
+ RemovePackageDescription.flagsConfig = {
73
+ file: command_1.flags.string({
74
+ char: 'f',
75
+ description: messages.getMessage('fileFlagDescription'),
76
+ required: true,
77
+ }),
78
+ };
79
+ RemovePackageDescription.requiresUsername = false;
80
+ RemovePackageDescription.supportsDevhubUsername = false;
81
+ RemovePackageDescription.requiresProject = false;
82
+ //# sourceMappingURL=remove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../src/commands/jayree/packagedescription/remove.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,iDAAyD;AACzD,2CAA4C;AAE5C,sDAA6B;AAC7B,4CAAgE;AAEhE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,0BAA0B,CAAC,CAAC;AAEjG,MAAqB,wBAAyB,SAAQ,qBAAW;IAyB/D,4DAA4D;IACrD,KAAK,CAAC,GAAG;QACd,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACpD,MAAM,MAAM,GAAG,IAAI,iBAAM,E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M;oBACL,MAAM,GAAG,EAAE,CAAC;oBACZ,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;iBACrC;aACF;iBAAM;gBACL,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;aAClD;QACH,CAAC,CAAC,CAAC;QACH,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;SAC5B;QAED,qCAAqC;QACrC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACjD,CAAC;;AApEH,2CAqEC;AApEC,uCAAuC;AACvC,+BAA+B;AAEjB,oCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAExD,iCAAQ,GAAG;IACvB;KACC;CACF,CAAC;AAEY,6BAAI,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAEvB,oCAAW,GAAG;IAC7B,IAAI,EAAE,eAAK,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC;QACvD,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;AAEe,yCAAgB,GAAG,KAAK,CAAC;AACzB,+CAAsB,GAAG,KAAK,CAAC;AAC/B,wCAAe,GAAG,KAAK,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { flags, SfdxCommand } from '@salesforce/command';
2
+ import { AnyJson } from '@salesforce/ts-types';
3
+ export default class SetPackageDescription extends SfdxCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static args: {
7
+ name: string;
8
+ }[];
9
+ protected static flagsConfig: {
10
+ file: flags.Discriminated<flags.String>;
11
+ description: flags.Discriminated<flags.String>;
12
+ };
13
+ protected static requiresUsername: boolean;
14
+ protected static supportsDevhubUsername: boolean;
15
+ protected static requiresProject: boolean;
16
+ run(): Promise<AnyJson>;
17
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /*
7
+ * Copyright (c) 2021, jayree
8
+ * All rights reserved.
9
+ * Licensed under the BSD 3-Clause license.
10
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
11
+ */
12
+ const command_1 = require("@salesforce/command");
13
+ const core_1 = require("@salesforce/core");
14
+ const adm_zip_1 = __importDefault(require("adm-zip"));
15
+ const xml_1 = require("../../../utils/xml");
16
+ core_1.Messages.importMessagesDirectory(__dirname);
17
+ const messages = core_1.Messages.loadMessages('@jayree/sfdx-plugin-legacy', 'setpackagedescription');
18
+ class SetPackageDescription extends command_1.SfdxCommand {
19
+ // eslint-disable-next-line @typescript-eslint/require-await
20
+ async run() {
21
+ const inputfile = this.args.file || this.flags.file;
22
+ const newZip = new adm_zip_1.default();
23
+ const zip = new adm_zip_1.default(inputfile);
24
+ const zipEntries = zip.getEntries();
25
+ const text = this.flags.description.replace(/\\n/g, '\n');
26
+ let action;
27
+ zipEntries.forEach((zipEntry) => {
28
+ const fileName = zipEntry.entryName;
29
+ const fileContent = zip.readFile(fileName);
30
+ if (fileName.includes('package.xml')) {
31
+ const fileTXTContent = zip.readAsText(fileName);
32
+ const xml = (0, xml_1.parseManifest)(fileTXTContent);
33
+ if (xml.Package.description && xml.Package.description.length > 0) {
34
+ action = 'updated';
35
+ }
36
+ else {
37
+ action = 'added';
38
+ }
39
+ xml.Package['description'] = text;
40
+ this.ux.log(action + ' description: ' + text);
41
+ newZip.addFile(fileName, Buffer.from((0, xml_1.js2Manifest)({ Package: xml.Package })), '', 0o644);
42
+ }
43
+ else {
44
+ newZip.addFile(fileName, fileContent, '', 0o644);
45
+ }
46
+ });
47
+ newZip.writeZip(inputfile);
48
+ return { description: text, task: action };
49
+ }
50
+ }
51
+ exports.default = SetPackageDescription;
52
+ // hotfix to receive only one help page
53
+ // public static hidden = true;
54
+ SetPackageDescription.description = messages.getMessage('commandDescription');
55
+ SetPackageDescription.examples = [
56
+ `$ sfdx jayree:packagedescription:set --file FILENAME --description 'NEW DESCRIPTION'
57
+ `,
58
+ ];
59
+ SetPackageDescription.args = [{ name: 'file' }];
60
+ SetPackageDescription.flagsConfig = {
61
+ file: command_1.flags.string({
62
+ char: 'f',
63
+ description: messages.getMessage('fileFlagDescription'),
64
+ required: true,
65
+ }),
66
+ description: command_1.flags.string({
67
+ char: 'd',
68
+ description: messages.getMessage('descriptionFlagDescription'),
69
+ dependsOn: ['file'],
70
+ required: true,
71
+ }),
72
+ };
73
+ SetPackageDescription.requiresUsername = false;
74
+ SetPackageDescription.supportsDevhubUsername = false;
75
+ SetPackageDescription.requiresProject = false;
76
+ //# sourceMappingURL=set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../src/commands/jayree/packagedescription/set.ts"],"names":[],"mappings":";;;;;AAAA;;;;;GAKG;AACH,iDAAyD;AACzD,2CAA4C;AAE5C,sDAA6B;AAC7B,4CAAgE;AAEhE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,uBAAuB,CAAC,CAAC;AAE9F,MAAqB,qBAAsB,SAAQ,qBAAW;IA+B5D,4DAA4D;IACrD,KAAK,CAAC,GAAG;QACd,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACpD,MAAM,MAAM,GAAG,IAAI,iBAAM,EAAE,CAAC;QAE5B,MAAM,GAAG,GAAG,IAAI,iBAAM,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,UAAU,GAAG,GAAG,CAA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