@salesforce/plugin-custom-metadata 1.0.11 → 2.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 (54) hide show
  1. package/CHANGELOG.md +23 -7
  2. package/LICENSE.txt +2 -2
  3. package/README.md +153 -149
  4. package/lib/commands/force/cmdt/create.d.ts +12 -6
  5. package/lib/commands/force/cmdt/create.js +80 -82
  6. package/lib/commands/force/cmdt/create.js.map +1 -1
  7. package/lib/commands/force/cmdt/field/create.d.ts +10 -5
  8. package/lib/commands/force/cmdt/field/create.js +98 -90
  9. package/lib/commands/force/cmdt/field/create.js.map +1 -1
  10. package/lib/commands/force/cmdt/generate.d.ts +12 -8
  11. package/lib/commands/force/cmdt/generate.js +199 -257
  12. package/lib/commands/force/cmdt/generate.js.map +1 -1
  13. package/lib/commands/force/cmdt/record/create.d.ts +20 -9
  14. package/lib/commands/force/cmdt/record/create.js +123 -125
  15. package/lib/commands/force/cmdt/record/create.js.map +1 -1
  16. package/lib/commands/force/cmdt/record/insert.d.ts +7 -7
  17. package/lib/commands/force/cmdt/record/insert.js +97 -109
  18. package/lib/commands/force/cmdt/record/insert.js.map +1 -1
  19. package/lib/index.js +3 -3
  20. package/lib/lib/helpers/createUtil.d.ts +10 -6
  21. package/lib/lib/helpers/createUtil.js +50 -98
  22. package/lib/lib/helpers/createUtil.js.map +1 -1
  23. package/lib/lib/helpers/fileWriter.d.ts +13 -11
  24. package/lib/lib/helpers/fileWriter.js +19 -27
  25. package/lib/lib/helpers/fileWriter.js.map +1 -1
  26. package/lib/lib/helpers/metadataUtil.d.ts +25 -51
  27. package/lib/lib/helpers/metadataUtil.js +58 -127
  28. package/lib/lib/helpers/metadataUtil.js.map +1 -1
  29. package/lib/lib/helpers/validationUtil.d.ts +25 -26
  30. package/lib/lib/helpers/validationUtil.js +69 -43
  31. package/lib/lib/helpers/validationUtil.js.map +1 -1
  32. package/lib/lib/interfaces/createConfig.d.ts +3 -2
  33. package/lib/lib/interfaces/createConfig.js +3 -3
  34. package/lib/lib/templates/templates.d.ts +10 -99
  35. package/lib/lib/templates/templates.js +52 -40
  36. package/lib/lib/templates/templates.js.map +1 -1
  37. package/messages/createField.json +22 -31
  38. package/messages/generate.json +38 -51
  39. package/messages/template.json +2 -2
  40. package/messages/validation.json +5 -0
  41. package/oclif.manifest.json +1 -1
  42. package/package.json +57 -46
  43. package/lib/lib/interfaces/customField.d.ts +0 -7
  44. package/lib/lib/interfaces/customField.js +0 -9
  45. package/lib/lib/interfaces/customField.js.map +0 -1
  46. package/lib/lib/interfaces/errorMessage.d.ts +0 -4
  47. package/lib/lib/interfaces/errorMessage.js +0 -9
  48. package/lib/lib/interfaces/errorMessage.js.map +0 -1
  49. package/lib/lib/interfaces/record.d.ts +0 -3
  50. package/lib/lib/interfaces/record.js +0 -9
  51. package/lib/lib/interfaces/record.js.map +0 -1
  52. package/lib/lib/interfaces/saveResults.d.ts +0 -5
  53. package/lib/lib/interfaces/saveResults.js +0 -9
  54. package/lib/lib/interfaces/saveResults.js.map +0 -1
@@ -1,279 +1,221 @@
1
1
  "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
2
4
  /*
3
- * Copyright (c) 2018-2020, salesforce.com, inc.
5
+ * Copyright (c) 2020, salesforce.com, inc.
4
6
  * All rights reserved.
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
9
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
10
+ const fs = require("fs");
11
+ const path = require("path");
9
12
  const command_1 = require("@salesforce/command");
10
13
  const core_1 = require("@salesforce/core");
11
14
  const kit_1 = require("@salesforce/kit");
12
- const ts_types_1 = require("@salesforce/ts-types");
13
- const util_1 = require("util");
14
15
  const createUtil_1 = require("../../../lib/helpers/createUtil");
15
16
  const fileWriter_1 = require("../../../lib/helpers/fileWriter");
16
17
  const metadataUtil_1 = require("../../../lib/helpers/metadataUtil");
17
18
  const validationUtil_1 = require("../../../lib/helpers/validationUtil");
18
19
  const templates_1 = require("../../../lib/templates/templates");
19
20
  // Initialize Messages with the current plugin directory
20
- command_1.core.Messages.importMessagesDirectory(__dirname);
21
+ core_1.Messages.importMessagesDirectory(__dirname);
21
22
  // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
22
23
  // or any library that is using the messages framework can also be loaded this way.
23
- const messages = command_1.core.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'generate');
24
- let Generate = /** @class */ (() => {
25
- class Generate extends command_1.SfdxCommand {
26
- async run() {
27
- // this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
28
- const conn = this.org.getConnection();
29
- // to validate different flags provided by the user
30
- const validator = new validationUtil_1.ValidationUtil();
31
- const objname = this.flags.sobjectname;
32
- const cmdttype = this.flags.devname;
33
- const sourceuser = this.flags.targetusername;
34
- const ignoreFields = this.flags.ignoreunsupported;
35
- let username;
36
- let sourceOrgConn;
37
- let describeObj;
38
- // check whether username or alias is provided as targetusername
39
- if (!util_1.isNullOrUndefined(sourceuser)) {
40
- if (sourceuser.substr(sourceuser.length - 4) !== '.com') {
41
- username = await core_1.Aliases.fetch(sourceuser); // if alias is provided get the corresponding username
42
- if (username === undefined) {
43
- throw core_1.SfdxError.create('@salesforce/plugin-custom-metadata', 'generate', 'sourceusernameError', [sourceuser]);
44
- }
45
- }
46
- else {
47
- username = sourceuser;
48
- }
49
- }
50
- if (!util_1.isNullOrUndefined(username)) {
51
- try {
52
- // connect to source org if source user name provided
53
- sourceOrgConn = await command_1.core.Connection.create({
54
- authInfo: await command_1.core.AuthInfo.create({ username })
55
- });
56
- }
57
- catch (err) {
58
- const errMsg = messages.getMessage('sourceuserAuthenticationError', [sourceuser, err.message]);
59
- throw new core_1.SfdxError(errMsg, 'sourceuserAuthenticationError');
60
- }
61
- }
62
- if (!validator.validateAPIName(objname)) {
63
- throw core_1.SfdxError.create('@salesforce/plugin-custom-metadata', 'generate', 'sobjectnameFlagError', [objname]);
64
- }
65
- let devName;
66
- if (!validator.validateMetadataTypeName(cmdttype)) {
67
- throw core_1.SfdxError.create('@salesforce/plugin-custom-metadata', 'generate', 'typenameFlagError', [cmdttype]);
68
- }
69
- if (cmdttype.endsWith('__mdt') || cmdttype.endsWith('__MDT')) {
70
- devName = cmdttype.substring(0, cmdttype.indexOf('__mdt'));
71
- }
72
- else {
73
- devName = cmdttype;
74
- }
75
- let metadataUtil;
76
- // get defined only if there is source username provided
77
- if (!sourceOrgConn) {
78
- metadataUtil = new metadataUtil_1.MetadataUtil(conn);
79
- }
80
- else {
81
- metadataUtil = new metadataUtil_1.MetadataUtil(sourceOrgConn);
82
- }
83
- // use default target org connection to get object describe if no source is provided.
84
- describeObj = await metadataUtil.describeObj(objname);
85
- // throw error if the object doesnot exist(empty json as response from the describe call.)
86
- if (kit_1.isEmpty(describeObj)) {
87
- const errMsg = messages.getMessage('sobjectnameNoResultError', [objname]);
88
- throw new core_1.SfdxError(errMsg, 'sobjectnameNoResultError');
89
- }
90
- // check for custom setting
91
- if (describeObj['customSettingsType'] !== undefined) {
92
- // if custom setting check for type and visbility
93
- if (!metadataUtil.validCustomSettingType(describeObj)) {
94
- const errMsg = messages.getMessage('customSettingTypeError', [objname]);
95
- throw new core_1.SfdxError(errMsg, 'customSettingTypeError');
96
- }
24
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'generate');
25
+ class Generate extends command_1.SfdxCommand {
26
+ // eslint-disable-next-line @typescript-eslint/member-ordering
27
+ async run() {
28
+ var _b, _c;
29
+ const conn = this.org.getConnection();
30
+ const objname = this.flags.sobjectname;
31
+ const devName = this.flags.devname;
32
+ const ignoreFields = this.flags.ignoreunsupported;
33
+ // use default target org connection to get object describe if no source is provided.
34
+ const describeObj = await conn.metadata.read('CustomObject', objname);
35
+ // throw error if the object doesnot exist(empty json as response from the describe call.)
36
+ if ((0, kit_1.isEmpty)(describeObj.fields)) {
37
+ const errMsg = messages.getMessage('sobjectnameNoResultError', [objname]);
38
+ throw new core_1.SfError(errMsg, 'sobjectnameNoResultError');
39
+ }
40
+ // check for custom setting
41
+ if (describeObj.customSettingsType) {
42
+ // if custom setting check for type and visbility
43
+ if (!(0, metadataUtil_1.validCustomSettingType)(describeObj)) {
44
+ const errMsg = messages.getMessage('customSettingTypeError', [objname]);
45
+ throw new core_1.SfError(errMsg, 'customSettingTypeError');
97
46
  }
98
- const visibility = this.flags.visibility || 'Public';
99
- const label = this.flags.label || devName;
100
- const pluralLabel = this.flags.plurallabel || label;
101
- const outputDir = this.flags.typeoutputdir || 'force-app/main/default/objects/';
102
- const recordsOutputDir = this.flags.recordsoutputdir || 'force-app/main/default/customMetadata';
103
- try {
104
- this.ux.startSpinner('custom metadata generation in progress');
105
- // create custom metadata type
106
- const templates = new templates_1.Templates();
107
- const objectXML = templates.createObjectXML({ label, pluralLabel }, visibility);
108
- const fileWriter = new fileWriter_1.FileWriter();
109
- await fileWriter.writeTypeFile(command_1.core.fs, outputDir, devName, objectXML);
110
- // get all the field details before creating feild metadata
111
- const describeAllFields = metadataUtil.describeObjFields(describeObj);
112
- let sObjectRecords;
113
- // query records from source
114
- sObjectRecords = await metadataUtil.queryRecords(describeObj);
115
- if (sObjectRecords.errorCode && sObjectRecords.errorCode !== null) {
116
- const errMsg = messages.getMessage('queryError', [objname, ts_types_1.asString(sObjectRecords.errorMsg)]);
117
- throw new core_1.SfdxError(errMsg, 'queryError');
118
- }
119
- // check for Geo Location fields before hand and create two different fields for longitude and latitude.
120
- const fields = ts_types_1.ensureJsonArray(describeAllFields);
121
- fields.map(field => {
122
- if (field['type'] === 'Location') {
123
- const lat = {
124
- fullName: 'Lat_' + field['fullName'],
125
- label: 'Lat ' + field['label'],
126
- required: field['required'],
127
- trackHistory: field['trackHistory'],
128
- trackTrending: field['trackTrending'],
129
- type: 'Text',
130
- length: '40'
131
- };
132
- fields.push(lat);
133
- const long = {
134
- fullName: 'Long_' + field['fullName'],
135
- label: 'Long_' + field['label'],
136
- required: field['required'],
137
- trackHistory: field['trackHistory'],
138
- trackTrending: field['trackTrending'],
139
- type: 'Text',
140
- length: '40'
141
- };
142
- fields.push(long);
143
- }
47
+ }
48
+ const visibility = this.flags.visibility;
49
+ const label = (_b = this.flags.label) !== null && _b !== void 0 ? _b : devName;
50
+ const pluralLabel = (_c = this.flags.plurallabel) !== null && _c !== void 0 ? _c : label;
51
+ const outputDir = this.flags.typeoutputdir;
52
+ const recordsOutputDir = this.flags.recordsoutputdir;
53
+ try {
54
+ this.ux.startSpinner('creating the CMDT object');
55
+ // create custom metadata type
56
+ const templates = new templates_1.Templates();
57
+ const objectXML = templates.createObjectXML({ label, pluralLabel }, visibility);
58
+ const fileWriter = new fileWriter_1.FileWriter();
59
+ await fileWriter.writeTypeFile(fs, outputDir, devName, objectXML);
60
+ this.ux.setSpinnerStatus('creating the CMDT fields');
61
+ // get all the field details before creating field metadata
62
+ const fields = (0, metadataUtil_1.describeObjFields)(describeObj)
63
+ // added type check here to skip the creation of un supported fields
64
+ .filter((f) => !ignoreFields || templates.canConvert(f['type']))
65
+ .flatMap((f) =>
66
+ // check for Geo Location fields before hand and create two different fields for longitude and latitude.
67
+ f.type !== 'Location' ? [f] : convertLocationFieldToText(f));
68
+ // create custom metdata fields
69
+ await Promise.all(fields.map((f) => fileWriter.writeFieldFile(fs, path.join(outputDir, `${devName}__mdt`), f.fullName, templates.createFieldXML(f, !ignoreFields))));
70
+ this.ux.setSpinnerStatus('creating the CMDT records');
71
+ const createUtil = new createUtil_1.CreateUtil();
72
+ // if customMetadata folder does not exist, create it
73
+ await fs.promises.mkdir(recordsOutputDir, { recursive: true });
74
+ const fieldDirPath = path.join(outputDir, `${devName}__mdt`, 'fields');
75
+ const fileNames = await fs.promises.readdir(fieldDirPath);
76
+ const fileData = await createUtil.getFileData(fieldDirPath, fileNames);
77
+ // query records from source
78
+ const sObjectRecords = await conn.query(getSoqlQuery(describeObj));
79
+ await Promise.all(sObjectRecords.records.map((rec) => {
80
+ const record = (0, metadataUtil_1.cleanQueryResponse)(rec, describeObj);
81
+ const lblName = rec['Name'];
82
+ const recordName = (0, validationUtil_1.isValidMetadataRecordName)(lblName) ? lblName : lblName.replace(/ +/g, '_');
83
+ return createUtil.createRecord({
84
+ typename: devName,
85
+ recordname: recordName,
86
+ label: lblName,
87
+ inputdir: outputDir,
88
+ outputdir: recordsOutputDir,
89
+ protected: visibility !== 'Public',
90
+ varargs: record,
91
+ fileData,
92
+ ignorefields: ignoreFields,
144
93
  });
145
- // create custom metdata fields
146
- for (const field of fields) {
147
- // added type check here to skip the creation of geo location field and un supported fields as we are adding it as lat and long field above.
148
- if ((templates.canConvert(field['type']) || !ignoreFields) && field['type'] !== 'Location') {
149
- const recordname = field['fullName'];
150
- const fieldXML = templates.createFieldXML(field, !ignoreFields);
151
- const targetDir = `${outputDir}${devName}__mdt`;
152
- await fileWriter.writeFieldFile(command_1.core.fs, targetDir, recordname, fieldXML);
153
- }
154
- }
155
- const createUtil = new createUtil_1.CreateUtil();
156
- // if customMetadata folder does not exist, create it
157
- await command_1.core.fs.mkdirp(recordsOutputDir);
158
- const security = (visibility !== 'Public');
159
- const typename = devName;
160
- const fieldDirPath = `${fileWriter.createDir(outputDir)}${typename}__mdt/fields`;
161
- const fileNames = await command_1.core.fs.readdir(fieldDirPath);
162
- const fileData = await createUtil.getFileData(fieldDirPath, fileNames);
163
- for (const rec of sObjectRecords.records) {
164
- const record = metadataUtil.cleanQueryResponse(rec, describeObj);
165
- const lblName = rec['Name'];
166
- let recordName = rec['Name'];
167
- if (!validator.validateMetadataRecordName(rec['Name'])) {
168
- recordName = recordName.replace(/ +/g, '_');
169
- }
170
- await createUtil.createRecord({
171
- typename,
172
- recordname: recordName,
173
- label: lblName,
174
- inputdir: outputDir,
175
- outputdir: recordsOutputDir,
176
- protected: security,
177
- varargs: record,
178
- fileData,
179
- ignorefields: ignoreFields
180
- });
181
- }
182
- this.ux.stopSpinner('custom metadata type and records creation in completed');
183
- this.ux.log(`Congrats! Created a ${devName} custom metadata type with ${sObjectRecords.records.length} records!`);
184
- }
185
- catch (e) {
186
- await command_1.core.fs.remove(`${outputDir}${devName}__mdt`);
187
- const fileNames = await command_1.core.fs.readdir(recordsOutputDir);
188
- for (const file of fileNames) {
189
- if (file.startsWith(devName)) {
190
- try {
191
- await command_1.core.fs.unlink(`${recordsOutputDir}/${file}`);
192
- }
193
- catch (e) {
194
- this.ux.log(e.message);
195
- }
196
- }
197
- }
198
- this.ux.stopSpinner('generate command failed to run');
199
- const errMsg = messages.getMessage('generateError', [e.message]);
200
- throw new core_1.SfdxError(errMsg, 'generateError');
94
+ }));
95
+ this.ux.stopSpinner('custom metadata type and records creation in completed');
96
+ this.ux.log(`Congrats! Created a ${devName} custom metadata type with ${sObjectRecords.records.length} records!`);
97
+ }
98
+ catch (e) {
99
+ const targetDir = `${outputDir}${devName}__mdt`;
100
+ // dir might not exist if we never got to the creation step
101
+ if (fs.existsSync(targetDir)) {
102
+ await fs.promises.rm(targetDir, { recursive: true });
201
103
  }
202
- return { outputDir, recordsOutputDir };
104
+ await Promise.all((await fs.promises.readdir(recordsOutputDir))
105
+ .filter((f) => f.startsWith(devName))
106
+ .map((f) => fs.promises.unlink(path.join(recordsOutputDir, f))));
107
+ this.ux.stopSpinner('generate command failed to run');
108
+ const errMsg = messages.getMessage('generateError', [e instanceof Error ? e.message : 'unknown error']);
109
+ throw new core_1.SfError(errMsg, 'generateError');
203
110
  }
111
+ return { outputDir, recordsOutputDir };
204
112
  }
205
- Generate.description = messages.getMessage('commandDescription');
206
- Generate.longDescription = messages.getMessage('commandLongDescription');
207
- Generate.examples = [
208
- messages.getMessage('exampleCaption1'),
209
- ' $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c',
210
- messages.getMessage('exampleCaption2'),
211
- ' $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c --ignoreunsupported --targetusername \'' + messages.getMessage('targetusernameFlagExample') + '\'',
212
- messages.getMessage('exampleCaption3'),
213
- ' $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomObject__c --visibility Protected',
214
- messages.getMessage('exampleCaption4'),
215
- ' $ sfdx force:cmdt:generate --devname MyCMDT --label "' + messages.getMessage('labelFlagExample') + '" ' +
216
- '--plurallabel "' + messages.getMessage('plurallabelFlagExample') + '" --sobjectname SourceCustomSetting__c --visibility Protected',
217
- messages.getMessage('exampleCaption5'),
218
- ' $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --typeoutputdir \'' + messages.getMessage('typeoutputdirFlagExample') + '\'',
219
- messages.getMessage('exampleCaption6'),
220
- ' $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --recordsoutputdir \'' + messages.getMessage('recordsoutputdirFlagExample') + '\''
221
- ];
222
- Generate.args = [{ name: 'file' }];
223
- Generate.flagsConfig = {
224
- // flag with a value (-n, --name=VALUE)
225
- devname: command_1.flags.string({
226
- char: 'n',
227
- required: true,
228
- description: messages.getMessage('devnameFlagDescription'),
229
- longDescription: messages.getMessage('devnameFlagLongDescription')
230
- }),
231
- label: command_1.flags.string({
232
- char: 'l',
233
- description: messages.getMessage('labelFlagDescription'),
234
- longDescription: messages.getMessage('labelFlagLongDescription')
235
- }),
236
- plurallabel: command_1.flags.string({
237
- char: 'p',
238
- description: messages.getMessage('plurallabelFlagDescription'),
239
- longDescription: messages.getMessage('plurallabelFlagLongDescription')
240
- }),
241
- visibility: command_1.flags.enum({
242
- char: 'v',
243
- description: messages.getMessage('visibilityFlagDescription'),
244
- longDescription: messages.getMessage('visibilityFlagLongDescription'),
245
- options: ['PackageProtected', 'Protected', 'Public'],
246
- default: 'Public'
247
- }),
248
- sobjectname: command_1.flags.string({
249
- char: 's',
250
- required: true,
251
- description: messages.getMessage('sobjectnameFlagDescription'),
252
- longDescription: messages.getMessage('sobjectnameFlagLongDescription')
253
- }),
254
- ignoreunsupported: command_1.flags.boolean({
255
- char: 'i',
256
- description: messages.getMessage('ignoreUnsupportedFlagDescription'),
257
- longDescription: messages.getMessage('ignoreUnsupportedFlagLongDescription')
258
- }),
259
- typeoutputdir: command_1.flags.directory({
260
- char: 'd',
261
- description: messages.getMessage('typeoutputdirFlagDescription'),
262
- longDescription: messages.getMessage('typeoutputdirFlagLongDescription'),
263
- default: 'force-app/main/default/objects/'
264
- }),
265
- recordsoutputdir: command_1.flags.directory({
266
- char: 'r',
267
- description: messages.getMessage('recordsoutputdirFlagDescription'),
268
- longDescription: messages.getMessage('recordsoutputdirFlagLongDescription'),
269
- default: 'force-app/main/default/customMetadata/'
270
- })
271
- };
272
- // Comment this out if your command does not require an org username
273
- Generate.requiresUsername = true;
274
- // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
275
- Generate.requiresProject = true;
276
- return Generate;
277
- })();
113
+ }
278
114
  exports.default = Generate;
115
+ _a = Generate;
116
+ Generate.description = messages.getMessage('commandDescription');
117
+ Generate.longDescription = messages.getMessage('commandLongDescription');
118
+ Generate.examples = [
119
+ messages.getMessage('exampleCaption1'),
120
+ ' $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c',
121
+ messages.getMessage('exampleCaption2'),
122
+ " $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c --ignoreunsupported --targetusername '" +
123
+ messages.getMessage('targetusernameFlagExample') +
124
+ "'",
125
+ messages.getMessage('exampleCaption3'),
126
+ ' $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomObject__c --visibility Protected',
127
+ messages.getMessage('exampleCaption4'),
128
+ ' $ sfdx force:cmdt:generate --devname MyCMDT --label "' +
129
+ messages.getMessage('labelFlagExample') +
130
+ '" ' +
131
+ '--plurallabel "' +
132
+ messages.getMessage('plurallabelFlagExample') +
133
+ '" --sobjectname SourceCustomSetting__c --visibility Protected',
134
+ messages.getMessage('exampleCaption5'),
135
+ " $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --typeoutputdir '" +
136
+ messages.getMessage('typeoutputdirFlagExample') +
137
+ "'",
138
+ messages.getMessage('exampleCaption6'),
139
+ " $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --recordsoutputdir '" +
140
+ messages.getMessage('recordsoutputdirFlagExample') +
141
+ "'",
142
+ ];
143
+ Generate.args = [{ name: 'file' }];
144
+ Generate.flagsConfig = {
145
+ // flag with a value (-n, --name=VALUE)
146
+ devname: command_1.flags.string({
147
+ char: 'n',
148
+ required: true,
149
+ description: messages.getMessage('devnameFlagDescription'),
150
+ longDescription: messages.getMessage('devnameFlagLongDescription'),
151
+ parse: async (input) => Promise.resolve((0, validationUtil_1.validateMetadataTypeName)(input)),
152
+ }),
153
+ label: command_1.flags.string({
154
+ char: 'l',
155
+ description: messages.getMessage('labelFlagDescription'),
156
+ longDescription: messages.getMessage('labelFlagLongDescription'),
157
+ }),
158
+ plurallabel: command_1.flags.string({
159
+ char: 'p',
160
+ description: messages.getMessage('plurallabelFlagDescription'),
161
+ longDescription: messages.getMessage('plurallabelFlagLongDescription'),
162
+ }),
163
+ visibility: command_1.flags.enum({
164
+ char: 'v',
165
+ description: messages.getMessage('visibilityFlagDescription'),
166
+ longDescription: messages.getMessage('visibilityFlagLongDescription'),
167
+ options: ['PackageProtected', 'Protected', 'Public'],
168
+ default: 'Public',
169
+ }),
170
+ sobjectname: command_1.flags.string({
171
+ char: 's',
172
+ required: true,
173
+ description: messages.getMessage('sobjectnameFlagDescription'),
174
+ longDescription: messages.getMessage('sobjectnameFlagLongDescription'),
175
+ parse: async (sobjectname) => Promise.resolve((0, validationUtil_1.validateAPIName)(sobjectname)),
176
+ }),
177
+ ignoreunsupported: command_1.flags.boolean({
178
+ char: 'i',
179
+ description: messages.getMessage('ignoreUnsupportedFlagDescription'),
180
+ longDescription: messages.getMessage('ignoreUnsupportedFlagLongDescription'),
181
+ }),
182
+ typeoutputdir: command_1.flags.directory({
183
+ char: 'd',
184
+ description: messages.getMessage('typeoutputdirFlagDescription'),
185
+ longDescription: messages.getMessage('typeoutputdirFlagLongDescription'),
186
+ default: path.join('force-app', 'main', 'default', 'objects'),
187
+ }),
188
+ recordsoutputdir: command_1.flags.directory({
189
+ char: 'r',
190
+ description: messages.getMessage('recordsoutputdirFlagDescription'),
191
+ longDescription: messages.getMessage('recordsoutputdirFlagLongDescription'),
192
+ default: path.join('force-app', 'main', 'default', 'customMetadata'),
193
+ }),
194
+ };
195
+ Generate.requiresUsername = true;
196
+ Generate.requiresProject = true;
197
+ const getSoqlQuery = (describeResult) => {
198
+ const fieldNames = describeResult.fields
199
+ .map((field) => {
200
+ return field.fullName;
201
+ })
202
+ .join(',');
203
+ // Added Name hardcoded as Name field is not retrieved as part of object describe.
204
+ return `SELECT Name, ${fieldNames} FROM ${describeResult.fullName}`;
205
+ };
206
+ const convertLocationFieldToText = (field) => {
207
+ const baseTextField = {
208
+ required: field['required'],
209
+ trackHistory: field['trackHistory'],
210
+ trackTrending: field['trackTrending'],
211
+ type: 'Text',
212
+ length: 40,
213
+ summaryFilterItems: [],
214
+ };
215
+ return ['Lat_', 'Long_'].map((prefix) => ({
216
+ ...baseTextField,
217
+ fullName: `${prefix}${field.fullName}`,
218
+ label: `${prefix}${field.label}`,
219
+ }));
220
+ };
279
221
  //# sourceMappingURL=generate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/commands/force/cmdt/generate.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iDAA+D;AAC/D,2CAAsD;AACtD,yCAA0C;AAC1C,mDAA0E;AAC1E,+BAAyC;AACzC,gEAA6D;AAC7D,gEAA6D;AAC7D,oEAAiE;AACjE,wEAAqE;AACrE,gEAA6D;AAE7D,wDAAwD;AACxD,cAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC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M,0BAA0B,GAAG,CAAC,KAAkB,EAAiB,EAAE;IACvE,MAAM,aAAa,GAAG;QACpB,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC;QAC3B,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC;QACnC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;QACrC,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,EAAE;KACvB,CAAC;IACF,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxC,GAAG,aAAa;QAChB,QAAQ,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE;QACtC,KAAK,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE;KACjC,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -1,21 +1,32 @@
1
1
  import { flags, SfdxCommand } from '@salesforce/command';
2
- import { AnyJson } from '@salesforce/ts-types';
2
+ import { CustomField } from 'jsforce/api/metadata';
3
+ interface CmdtRecordCreateResponse {
4
+ typename: string;
5
+ recordname: string;
6
+ label: string;
7
+ inputdir: string;
8
+ outputdir: string;
9
+ protectedFlag: boolean;
10
+ varargs: Record<string, unknown>;
11
+ fileData: CustomField[];
12
+ }
3
13
  export default class Create extends SfdxCommand {
4
14
  static description: string;
5
15
  static longDescription: string;
6
16
  static examples: string[];
7
17
  protected static flagsConfig: {
8
- typename: flags.Discriminated<flags.Option<string>>;
9
- recordname: flags.Discriminated<flags.Option<string>>;
10
- label: flags.Discriminated<flags.Option<string>>;
11
- protected: flags.Discriminated<flags.Option<string>>;
12
- inputdir: flags.Discriminated<flags.Option<string>>;
13
- outputdir: flags.Discriminated<flags.Option<string>>;
18
+ typename: flags.Discriminated<flags.String>;
19
+ recordname: flags.Discriminated<flags.String>;
20
+ label: flags.Discriminated<flags.String>;
21
+ protected: flags.Discriminated<flags.String>;
22
+ inputdir: flags.Discriminated<flags.String>;
23
+ outputdir: flags.Discriminated<flags.String>;
14
24
  };
15
25
  protected static varargs: {
16
26
  required: boolean;
17
- validator: (name: any, value: any) => void;
27
+ validator: (name: string) => void;
18
28
  };
19
29
  protected static requiresProject: boolean;
20
- run(): Promise<AnyJson>;
30
+ run(): Promise<CmdtRecordCreateResponse>;
21
31
  }
32
+ export {};