@salesforce/plugin-custom-metadata 1.0.12 → 1.1.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 (38) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +37 -37
  3. package/lib/commands/force/cmdt/create.d.ts +4 -4
  4. package/lib/commands/force/cmdt/create.js +84 -80
  5. package/lib/commands/force/cmdt/create.js.map +1 -1
  6. package/lib/commands/force/cmdt/field/create.d.ts +3 -3
  7. package/lib/commands/force/cmdt/field/create.js +102 -89
  8. package/lib/commands/force/cmdt/field/create.js.map +1 -1
  9. package/lib/commands/force/cmdt/generate.d.ts +6 -6
  10. package/lib/commands/force/cmdt/generate.js +256 -243
  11. package/lib/commands/force/cmdt/generate.js.map +1 -1
  12. package/lib/commands/force/cmdt/record/create.d.ts +6 -6
  13. package/lib/commands/force/cmdt/record/create.js +130 -124
  14. package/lib/commands/force/cmdt/record/create.js.map +1 -1
  15. package/lib/commands/force/cmdt/record/insert.d.ts +5 -5
  16. package/lib/commands/force/cmdt/record/insert.js +105 -105
  17. package/lib/commands/force/cmdt/record/insert.js.map +1 -1
  18. package/lib/index.js +3 -3
  19. package/lib/lib/helpers/createUtil.js +14 -10
  20. package/lib/lib/helpers/createUtil.js.map +1 -1
  21. package/lib/lib/helpers/fileWriter.d.ts +2 -0
  22. package/lib/lib/helpers/fileWriter.js +5 -3
  23. package/lib/lib/helpers/fileWriter.js.map +1 -1
  24. package/lib/lib/helpers/metadataUtil.d.ts +2 -2
  25. package/lib/lib/helpers/metadataUtil.js +22 -15
  26. package/lib/lib/helpers/metadataUtil.js.map +1 -1
  27. package/lib/lib/helpers/validationUtil.js +9 -6
  28. package/lib/lib/helpers/validationUtil.js.map +1 -1
  29. package/lib/lib/interfaces/createConfig.js +3 -3
  30. package/lib/lib/interfaces/customField.js +3 -3
  31. package/lib/lib/interfaces/errorMessage.js +3 -3
  32. package/lib/lib/interfaces/record.js +3 -3
  33. package/lib/lib/interfaces/saveResults.js +3 -3
  34. package/lib/lib/templates/templates.d.ts +2 -0
  35. package/lib/lib/templates/templates.js +64 -23
  36. package/lib/lib/templates/templates.js.map +1 -1
  37. package/oclif.manifest.json +1 -1
  38. package/package.json +19 -19
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.1.0](https://github.com/salesforcecli/plugin-custom-metadata/compare/v1.0.12...v1.1.0) (2022-04-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * bump deps ([d33c882](https://github.com/salesforcecli/plugin-custom-metadata/commit/d33c882817d296a7e039a78641553bcb00685727))
11
+
5
12
  ### [1.0.12](https://github.com/salesforcecli/plugin-custom-metadata/compare/v1.0.11...v1.0.12) (2021-04-06)
6
13
 
7
14
 
package/README.md CHANGED
@@ -108,13 +108,13 @@ OPTIONS
108
108
 
109
109
  EXAMPLES
110
110
  Create a custom metadata type with developer name 'MyCustomType'; this name will also be used as the label:
111
- $ sfdx force:cmdt:create --typename MyCustomType
111
+ $ sfdx force:cmdt:create --typename MyCustomType
112
112
  Create a protected custom metadata type with a specific label:
113
- $ sfdx force:cmdt:create --typename MyCustomType --label "Custom Type" --plurallabel "Custom Types" --visibility
113
+ $ sfdx force:cmdt:create --typename MyCustomType --label "Custom Type" --plurallabel "Custom Types" --visibility
114
114
  Protected
115
115
  ```
116
116
 
117
- _See code: [src/commands/force/cmdt/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.12/src/commands/force/cmdt/create.ts)_
117
+ _See code: [src/commands/force/cmdt/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.1.0/src/commands/force/cmdt/create.ts)_
118
118
 
119
119
  ## `sfdx force:cmdt:field:create -n <string> -f Checkbox|Date|DateTime|Email|Number|Percent|Phone|Picklist|Text|TextArea|LongTextArea|Url [-p <array>] [-s <number>] [-l <string>] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
120
120
 
@@ -144,7 +144,7 @@ OPTIONS
144
144
  comma-separated list of picklist values; required for Picklist fields
145
145
 
146
146
  -s, --decimalplaces=decimalplaces
147
- number of decimal places to use for Number or Percent fields
147
+ [default: 0] number of decimal places to use for Number or Percent fields
148
148
 
149
149
  --json
150
150
  format output as json
@@ -154,14 +154,14 @@ OPTIONS
154
154
 
155
155
  EXAMPLES
156
156
  Create a metadata file for a custom checkbox field:
157
- $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Checkbox
157
+ $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Checkbox
158
158
  Create a metadata file for a custom picklist field:
159
- $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Picklist --picklistvalues "A,B,C"
159
+ $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Picklist --picklistvalues "A,B,C"
160
160
  Create a metadata file for a custom number field:
161
- $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Number --decimalplaces 2
161
+ $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Number --decimalplaces 2
162
162
  ```
163
163
 
164
- _See code: [src/commands/force/cmdt/field/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.12/src/commands/force/cmdt/field/create.ts)_
164
+ _See code: [src/commands/force/cmdt/field/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.1.0/src/commands/force/cmdt/field/create.ts)_
165
165
 
166
166
  ## `sfdx force:cmdt:generate -n <string> -s <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public] [-i] [-d <directory>] [-r <directory>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
167
167
 
@@ -189,10 +189,10 @@ OPTIONS
189
189
  -p, --plurallabel=plurallabel plural version of the label value;
190
190
  if blank, uses label
191
191
 
192
- -r, --recordsoutputdir=recordsoutputdir [default:
193
- force-app/main/default/customMetadat
194
- a/] directory to store newly-created
195
- custom metadata record files
192
+ -r, --recordsoutputdir=recordsoutputdir [default: force-app/main/default/cus
193
+ tomMetadata/] directory to store
194
+ newly-created custom metadata record
195
+ files
196
196
 
197
197
  -s, --sobjectname=sobjectname (required) API name of the sObject
198
198
  source for custom metadata
@@ -214,27 +214,27 @@ OPTIONS
214
214
 
215
215
  EXAMPLES
216
216
  Generate a custom metadata type from an sObject in the default target org:
217
- $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c
218
- Generate a custom metadata type from an sObject in the specified target org; ignore unsupported field types instead of
219
- converting them to text:
220
- $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c --ignoreunsupported --targetusername
217
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c
218
+ Generate a custom metadata type from an sObject in the specified target org; ignore unsupported field types instead of
219
+ converting them to text:
220
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c --ignoreunsupported --targetusername
221
221
  'alias or user email of the org containing the source type'
222
222
  Generate a protected custom metadata type from an sObject in the default target org:
223
- $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomObject__c --visibility Protected
223
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomObject__c --visibility Protected
224
224
  Generate a protected custom metadata type with a specific label from an sObject in the default target org:
225
- $ sfdx force:cmdt:generate --devname MyCMDT --label "My CMDT" --plurallabel "My CMDTs" --sobjectname
225
+ $ sfdx force:cmdt:generate --devname MyCMDT --label "My CMDT" --plurallabel "My CMDTs" --sobjectname
226
226
  SourceCustomSetting__c --visibility Protected
227
- Generate a custom metadata type from an sObject in the default target org; put the resulting type metadata file in the
228
- specified directory:
229
- $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --typeoutputdir
227
+ Generate a custom metadata type from an sObject in the default target org; put the resulting type metadata file in the
228
+ specified directory:
229
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --typeoutputdir
230
230
  'path/to/my/cmdt/directory'
231
231
  Generate a custom metadata type from an sObject in the default target org; put the resulting record metadata file(s)
232
232
  in the specified directory:
233
- $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --recordsoutputdir
233
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --recordsoutputdir
234
234
  'path/to/my/cmdt/record/directory'
235
235
  ```
236
236
 
237
- _See code: [src/commands/force/cmdt/generate.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.12/src/commands/force/cmdt/generate.ts)_
237
+ _See code: [src/commands/force/cmdt/generate.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.1.0/src/commands/force/cmdt/generate.ts)_
238
238
 
239
239
  ## `sfdx force:cmdt:record:create [name=value...] -t <string> -n <string> [-l <string>] [-p <string>] [-i <directory>] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
240
240
 
@@ -246,10 +246,10 @@ USAGE
246
246
  [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
247
247
 
248
248
  OPTIONS
249
- -d, --outputdir=outputdir [default:
250
- force-app/main/default/customMetadat
251
- a] directory to store newly-created
252
- custom metadata record files
249
+ -d, --outputdir=outputdir [default: force-app/main/default/cus
250
+ tomMetadata] directory to store
251
+ newly-created custom metadata record
252
+ files
253
253
 
254
254
  -i, --inputdir=inputdir [default:
255
255
  force-app/main/default/objects]
@@ -273,15 +273,15 @@ OPTIONS
273
273
 
274
274
  EXAMPLES
275
275
  Create a record metadata file for custom metadata type 'MyCMT' with values specified for two custom fields:
276
- $ sfdx force:cmdt:record:create --typename MyCMT__mdt --recordname MyRecord My_Custom_Field_1=Foo
276
+ $ sfdx force:cmdt:record:create --typename MyCMT__mdt --recordname MyRecord My_Custom_Field_1=Foo
277
277
  My_Custom_Field_2=Bar
278
278
  Create a protected record metadata file for custom metadata type 'MyCMT' with a specific label and values specified
279
279
  for two custom fields:
280
- $ sfdx force:cmdt:record:create --typename MyCMT__mdt --recordname MyRecord --label "My Record" --protected true
280
+ $ sfdx force:cmdt:record:create --typename MyCMT__mdt --recordname MyRecord --label "My Record" --protected true
281
281
  My_Custom_Field_1=Foo My_Custom_Field_2=Bar
282
282
  ```
283
283
 
284
- _See code: [src/commands/force/cmdt/record/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.12/src/commands/force/cmdt/record/create.ts)_
284
+ _See code: [src/commands/force/cmdt/record/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.1.0/src/commands/force/cmdt/record/create.ts)_
285
285
 
286
286
  ## `sfdx force:cmdt:record:insert -f <string> -t <string> [-i <directory>] [-d <directory>] [-n <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
287
287
 
@@ -293,10 +293,10 @@ USAGE
293
293
  [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
294
294
 
295
295
  OPTIONS
296
- -d, --outputdir=outputdir [default:
297
- force-app/main/default/customMetadat
298
- a] directory to store newly-created
299
- custom metadata record files
296
+ -d, --outputdir=outputdir [default: force-app/main/default/cus
297
+ tomMetadata] directory to store
298
+ newly-created custom metadata record
299
+ files
300
300
 
301
301
  -f, --filepath=filepath (required) path to the CSV file
302
302
 
@@ -319,14 +319,14 @@ OPTIONS
319
319
  EXAMPLES
320
320
  Create record metadata files for type 'My_CMDT_Name' (from your local project) based on values in a CSV file, using
321
321
  'Name' as the column that specifies the record name:
322
- $ sfdx force:cmdt:record:insert --filepath path/to/my.csv --typename My_CMDT_Name
322
+ $ sfdx force:cmdt:record:insert --filepath path/to/my.csv --typename My_CMDT_Name
323
323
  Create record metadata files for type 'My_CMDT_Name' (from the specified directory) based on values in a CSV file,
324
324
  using 'PrimaryKey' as the column that specifies the record name:
325
- $ sfdx force:cmdt:record:insert --filepath path/to/my.csv --typename My_CMDT_Name --inputdir
325
+ $ sfdx force:cmdt:record:insert --filepath path/to/my.csv --typename My_CMDT_Name --inputdir
326
326
  "path/to/my/cmdt/directory" --namecolumn "PrimaryKey"
327
327
  ```
328
328
 
329
- _See code: [src/commands/force/cmdt/record/insert.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.12/src/commands/force/cmdt/record/insert.ts)_
329
+ _See code: [src/commands/force/cmdt/record/insert.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.1.0/src/commands/force/cmdt/record/insert.ts)_
330
330
  <!-- commandsstop -->
331
331
 
332
332
  <!-- debugging-your-plugin -->
@@ -8,11 +8,11 @@ export default class Create extends SfdxCommand {
8
8
  name: string;
9
9
  }[];
10
10
  protected static flagsConfig: {
11
- typename: flags.Discriminated<flags.Option<string>>;
12
- label: flags.Discriminated<flags.Option<string>>;
13
- plurallabel: flags.Discriminated<flags.Option<string>>;
11
+ typename: flags.Discriminated<flags.String>;
12
+ label: flags.Discriminated<flags.String>;
13
+ plurallabel: flags.Discriminated<flags.String>;
14
14
  visibility: flags.Discriminated<flags.Enum<string>>;
15
- outputdir: flags.Discriminated<flags.Option<string>>;
15
+ outputdir: flags.Discriminated<flags.String>;
16
16
  };
17
17
  protected static requiresProject: boolean;
18
18
  run(): Promise<AnyJson>;
@@ -1,96 +1,100 @@
1
1
  "use strict";
2
2
  /*
3
- * Copyright (c) 2018-2020, salesforce.com, inc.
3
+ * Copyright (c) 2020, salesforce.com, inc.
4
4
  * 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
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const command_1 = require("@salesforce/command");
10
+ const core_1 = require("@salesforce/core");
10
11
  const fileWriter_1 = require("../../../lib/helpers/fileWriter");
11
12
  const validationUtil_1 = require("../../../lib/helpers/validationUtil");
12
13
  const templates_1 = require("../../../lib/templates/templates");
13
14
  // Initialize Messages with the current plugin directory
14
- command_1.core.Messages.importMessagesDirectory(__dirname);
15
+ core_1.Messages.importMessagesDirectory(__dirname);
15
16
  // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
16
17
  // or any library that is using the messages framework can also be loaded this way.
17
- const messages = command_1.core.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'createType');
18
- let Create = /** @class */ (() => {
19
- class Create extends command_1.SfdxCommand {
20
- async run() {
21
- const typename = this.flags.typename; // this should become the new file name
22
- const label = this.flags.label || this.flags.typename.replace('__mdt', ''); // If a label is not provided default using the dev name. trim __mdt out
23
- const pluralLabel = this.flags.plurallabel || label;
24
- const visibility = this.flags.visibility || 'Public';
25
- const dir = this.flags.outputdir || '';
26
- const templates = new templates_1.Templates();
27
- const fileWriter = new fileWriter_1.FileWriter();
28
- let saveResults;
29
- const validator = new validationUtil_1.ValidationUtil();
30
- if (!validator.validateMetadataTypeName(typename)) {
31
- throw new command_1.core.SfdxError(messages.getMessage('errorNotValidAPIName', [typename]));
32
- }
33
- if (!validator.validateLessThanForty(label)) {
34
- throw new command_1.core.SfdxError(messages.getMessage('errorNotValidLabelName', [label]));
35
- }
36
- if (!validator.validateLessThanForty(pluralLabel)) {
37
- throw new command_1.core.SfdxError(messages.getMessage('errorNotValidPluralLabelName', [pluralLabel]));
38
- }
39
- const objectXML = templates.createObjectXML({ label, pluralLabel }, visibility);
40
- saveResults = await fileWriter.writeTypeFile(command_1.core.fs, dir, typename, objectXML);
41
- this.ux.log(messages.getMessage('targetDirectory', [saveResults.dir]));
42
- this.ux.log(messages.getMessage(saveResults.updated ? 'fileUpdate' : 'fileCreated', [saveResults.fileName]));
43
- return {
44
- typename,
45
- label,
46
- pluralLabel,
47
- visibility
48
- };
18
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'createType');
19
+ class Create extends command_1.SfdxCommand {
20
+ async run() {
21
+ const typename = this.flags.typename; // this should become the new file name
22
+ const label = this.flags.label || this.flags.typename.replace('__mdt', ''); // If a label is not provided default using the dev name. trim __mdt out
23
+ const pluralLabel = this.flags.plurallabel || label;
24
+ const visibility = this.flags.visibility || 'Public';
25
+ const dir = this.flags.outputdir || '';
26
+ const templates = new templates_1.Templates();
27
+ const fileWriter = new fileWriter_1.FileWriter();
28
+ let saveResults;
29
+ const validator = new validationUtil_1.ValidationUtil();
30
+ if (!validator.validateMetadataTypeName(typename)) {
31
+ throw new core_1.SfdxError(messages.getMessage('errorNotValidAPIName', [typename]));
49
32
  }
33
+ if (!validator.validateLessThanForty(label)) {
34
+ throw new core_1.SfdxError(messages.getMessage('errorNotValidLabelName', [label]));
35
+ }
36
+ if (!validator.validateLessThanForty(pluralLabel)) {
37
+ throw new core_1.SfdxError(messages.getMessage('errorNotValidPluralLabelName', [pluralLabel]));
38
+ }
39
+ const objectXML = templates.createObjectXML({ label, pluralLabel }, visibility);
40
+ saveResults = await fileWriter.writeTypeFile(core_1.fs, dir, typename, objectXML);
41
+ this.ux.log(messages.getMessage('targetDirectory', [saveResults.dir]));
42
+ this.ux.log(messages.getMessage(saveResults.updated ? 'fileUpdate' : 'fileCreated', [
43
+ saveResults.fileName,
44
+ ]));
45
+ return {
46
+ typename,
47
+ label,
48
+ pluralLabel,
49
+ visibility,
50
+ };
50
51
  }
51
- Create.description = messages.getMessage('commandDescription');
52
- Create.longDescription = messages.getMessage('commandLongDescription');
53
- Create.examples = [
54
- messages.getMessage('exampleCaption1'),
55
- ' $ sfdx force:cmdt:create --typename MyCustomType',
56
- messages.getMessage('exampleCaption2'),
57
- ' $ sfdx force:cmdt:create --typename MyCustomType --label "' + messages.getMessage('labelFlagExample') + '" ' +
58
- '--plurallabel "' + messages.getMessage('plurallabelFlagExample') + '" --visibility Protected'
59
- ];
60
- Create.args = [{ name: 'file' }];
61
- Create.flagsConfig = {
62
- typename: command_1.flags.string({
63
- char: 'n',
64
- description: messages.getMessage('nameFlagDescription'),
65
- longDescription: messages.getMessage('nameFlagLongDescription'),
66
- required: true
67
- }),
68
- label: command_1.flags.string({
69
- char: 'l',
70
- description: messages.getMessage('labelFlagDescription'),
71
- longDescription: messages.getMessage('labelFlagLongDescription')
72
- }),
73
- plurallabel: command_1.flags.string({
74
- char: 'p',
75
- description: messages.getMessage('plurallabelFlagDescription'),
76
- longDescription: messages.getMessage('plurallabelFlagLongDescription')
77
- }),
78
- visibility: command_1.flags.enum({
79
- char: 'v',
80
- description: messages.getMessage('visibilityFlagDescription'),
81
- longDescription: messages.getMessage('visibilityFlagLongDescription'),
82
- options: ['PackageProtected', 'Protected', 'Public'],
83
- default: 'Public'
84
- }),
85
- outputdir: command_1.flags.directory({
86
- char: 'd',
87
- description: messages.getMessage('outputDirectoryFlagDescription'),
88
- longDescription: messages.getMessage('outputDirectoryFlagLongDescription')
89
- })
90
- };
91
- // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
92
- Create.requiresProject = true;
93
- return Create;
94
- })();
52
+ }
95
53
  exports.default = Create;
54
+ Create.description = messages.getMessage('commandDescription');
55
+ Create.longDescription = messages.getMessage('commandLongDescription');
56
+ Create.examples = [
57
+ messages.getMessage('exampleCaption1'),
58
+ ' $ sfdx force:cmdt:create --typename MyCustomType',
59
+ messages.getMessage('exampleCaption2'),
60
+ ' $ sfdx force:cmdt:create --typename MyCustomType --label "' +
61
+ messages.getMessage('labelFlagExample') +
62
+ '" ' +
63
+ '--plurallabel "' +
64
+ messages.getMessage('plurallabelFlagExample') +
65
+ '" --visibility Protected',
66
+ ];
67
+ Create.args = [{ name: 'file' }];
68
+ Create.flagsConfig = {
69
+ typename: command_1.flags.string({
70
+ char: 'n',
71
+ description: messages.getMessage('nameFlagDescription'),
72
+ longDescription: messages.getMessage('nameFlagLongDescription'),
73
+ required: true,
74
+ }),
75
+ label: command_1.flags.string({
76
+ char: 'l',
77
+ description: messages.getMessage('labelFlagDescription'),
78
+ longDescription: messages.getMessage('labelFlagLongDescription'),
79
+ }),
80
+ plurallabel: command_1.flags.string({
81
+ char: 'p',
82
+ description: messages.getMessage('plurallabelFlagDescription'),
83
+ longDescription: messages.getMessage('plurallabelFlagLongDescription'),
84
+ }),
85
+ visibility: command_1.flags.enum({
86
+ char: 'v',
87
+ description: messages.getMessage('visibilityFlagDescription'),
88
+ longDescription: messages.getMessage('visibilityFlagLongDescription'),
89
+ options: ['PackageProtected', 'Protected', 'Public'],
90
+ default: 'Public',
91
+ }),
92
+ outputdir: command_1.flags.directory({
93
+ char: 'd',
94
+ description: messages.getMessage('outputDirectoryFlagDescription'),
95
+ longDescription: messages.getMessage('outputDirectoryFlagLongDescription'),
96
+ }),
97
+ };
98
+ // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
99
+ Create.requiresProject = true;
96
100
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/force/cmdt/create.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iDAA+D;AAE/D,gEAA6D;AAC7D,wEAAqE;AAErE,gEAA6D;AAE7D,wDAAwD;AACxD,cAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAEjD,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,YAAY,CAAC,CAAC;AAEhG;IAAA,MAAqB,MAAO,SAAQ,qBAAW;QAiDpC,KAAK,CAAC,GAAG;YACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,uCAAuC;YAC7E,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CA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BAAqB,CAAC;QACvD,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;QAC/D,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,KAAK,EAAE,eAAK,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;QACxD,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;KACjE,CAAC;IACF,WAAW,EAAE,eAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC;QAC9D,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,gCAAgC,CAAC;KACvE,CAAC;IACF,UAAU,EAAE,eAAK,CAAC,IAAI,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC;QAC7D,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;QACrE,OAAO,EAAE,CAAC,kBAAkB,EAAE,WAAW,EAAE,QAAQ,CAAC;QACpD,OAAO,EAAE,QAAQ;KAClB,CAAC;IACF,SAAS,EAAE,eAAK,CAAC,SAAS,CAAC;QACzB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,gCAAgC,CAAC;QAClE,eAAe,EAAE,QAAQ,CAAC,UAAU,CAClC,oCAAoC,CACrC;KACF,CAAC;CACH,CAAC;AAEF,uGAAuG;AACtF,sBAAe,GAAG,IAAI,CAAC"}
@@ -8,12 +8,12 @@ export default class Create extends SfdxCommand {
8
8
  name: string;
9
9
  }[];
10
10
  protected static flagsConfig: {
11
- fieldname: flags.Discriminated<flags.Option<string>>;
11
+ fieldname: flags.Discriminated<flags.String>;
12
12
  fieldtype: flags.Discriminated<flags.Enum<string>>;
13
13
  picklistvalues: flags.Discriminated<flags.Array<string>>;
14
14
  decimalplaces: flags.Discriminated<flags.Number>;
15
- label: flags.Discriminated<flags.Option<string>>;
16
- outputdir: flags.Discriminated<flags.Option<string>>;
15
+ label: flags.Discriminated<flags.String>;
16
+ outputdir: flags.Discriminated<flags.String>;
17
17
  };
18
18
  protected static requiresProject: boolean;
19
19
  run(): Promise<AnyJson>;
@@ -1,105 +1,118 @@
1
1
  "use strict";
2
2
  /*
3
- * Copyright (c) 2018-2020, salesforce.com, inc.
3
+ * Copyright (c) 2020, salesforce.com, inc.
4
4
  * 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
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const command_1 = require("@salesforce/command");
10
+ const core_1 = require("@salesforce/core");
10
11
  const fileWriter_1 = require("../../../../lib/helpers/fileWriter");
11
12
  const validationUtil_1 = require("../../../../lib/helpers/validationUtil");
12
13
  const templates_1 = require("../../../../lib/templates/templates");
13
14
  // Initialize Messages with the current plugin directory
14
- command_1.core.Messages.importMessagesDirectory(__dirname);
15
+ core_1.Messages.importMessagesDirectory(__dirname);
15
16
  // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
16
17
  // or any library that is using the messages framework can also be loaded this way.
17
- const messages = command_1.core.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'createField');
18
- let Create = /** @class */ (() => {
19
- class Create extends command_1.SfdxCommand {
20
- async run() {
21
- const fieldName = this.flags.fieldname; // this should become the new file name
22
- const label = this.flags.label || this.flags.fieldname;
23
- const fieldtype = this.flags.fieldtype;
24
- const picklistvalues = this.flags.picklistvalues || [];
25
- const decimalplaces = this.flags.decimalplaces || 0;
26
- const dir = this.flags.outputdir || '';
27
- let saveResults;
28
- const validator = new validationUtil_1.ValidationUtil();
29
- if (!validator.validateAPIName(fieldName)) {
30
- throw new command_1.core.SfdxError(messages.getMessage('invalidCustomFieldError', [fieldName]));
31
- }
32
- if (fieldtype === 'Picklist' && picklistvalues.length === 0) {
33
- throw new command_1.core.SfdxError(messages.getMessage('picklistValuesNotSuppliedError'));
34
- }
35
- if (decimalplaces < 0) {
36
- throw new command_1.core.SfdxError(messages.getMessage('invalidDecimalError'));
37
- }
38
- const templates = new templates_1.Templates();
39
- const data = templates.createDefaultTypeStructure(fieldName, fieldtype, label, picklistvalues, decimalplaces);
40
- const fieldXML = templates.createFieldXML(data, false);
41
- const writer = new fileWriter_1.FileWriter();
42
- saveResults = await writer.writeFieldFile(command_1.core.fs, dir, fieldName, fieldXML);
43
- this.ux.log(messages.getMessage('targetDirectory', [saveResults.dir]));
44
- this.ux.log(messages.getMessage(saveResults.updated ? 'fileUpdate' : 'fileCreated', [saveResults.fileName]));
45
- // Return an object to be displayed with --json
46
- return {
47
- fieldName,
48
- label,
49
- fieldtype
50
- };
18
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'createField');
19
+ class Create extends command_1.SfdxCommand {
20
+ async run() {
21
+ const fieldName = this.flags.fieldname; // this should become the new file name
22
+ const label = this.flags.label || this.flags.fieldname;
23
+ const fieldtype = this.flags.fieldtype;
24
+ const picklistvalues = this.flags.picklistvalues || [];
25
+ const decimalplaces = this.flags.decimalplaces || 0;
26
+ const dir = this.flags.outputdir || '';
27
+ let saveResults;
28
+ const validator = new validationUtil_1.ValidationUtil();
29
+ if (!validator.validateAPIName(fieldName)) {
30
+ throw new core_1.SfdxError(messages.getMessage('invalidCustomFieldError', [fieldName]));
51
31
  }
32
+ if (fieldtype === 'Picklist' && picklistvalues.length === 0) {
33
+ throw new core_1.SfdxError(messages.getMessage('picklistValuesNotSuppliedError'));
34
+ }
35
+ if (decimalplaces < 0) {
36
+ throw new core_1.SfdxError(messages.getMessage('invalidDecimalError'));
37
+ }
38
+ const templates = new templates_1.Templates();
39
+ const data = templates.createDefaultTypeStructure(fieldName, fieldtype, label, picklistvalues, decimalplaces);
40
+ const fieldXML = templates.createFieldXML(data, false);
41
+ const writer = new fileWriter_1.FileWriter();
42
+ saveResults = await writer.writeFieldFile(core_1.fs, dir, fieldName, fieldXML);
43
+ this.ux.log(messages.getMessage('targetDirectory', [saveResults.dir]));
44
+ this.ux.log(messages.getMessage(saveResults.updated ? 'fileUpdate' : 'fileCreated', [
45
+ saveResults.fileName,
46
+ ]));
47
+ // Return an object to be displayed with --json
48
+ return {
49
+ fieldName,
50
+ label,
51
+ fieldtype,
52
+ };
52
53
  }
53
- Create.description = messages.getMessage('commandDescription');
54
- Create.longDescription = messages.getMessage('commandLongDescription');
55
- Create.examples = [
56
- messages.getMessage('exampleCaption1'),
57
- ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Checkbox',
58
- messages.getMessage('exampleCaption2'),
59
- ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Picklist --picklistvalues "A,B,C"',
60
- messages.getMessage('exampleCaption3'),
61
- ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Number --decimalplaces 2'
62
- ];
63
- Create.args = [{ name: 'file' }];
64
- Create.flagsConfig = {
65
- fieldname: command_1.flags.string({
66
- char: 'n',
67
- required: true,
68
- description: messages.getMessage('nameFlagDescription'),
69
- longDescription: messages.getMessage('nameFlagLongDescription')
70
- }),
71
- fieldtype: command_1.flags.enum({
72
- char: 'f',
73
- required: true,
74
- description: messages.getMessage('fieldTypeDescription'),
75
- longDescription: messages.getMessage('nameFlagLongDescription'),
76
- options: ['Checkbox', 'Date', 'DateTime', 'Email', 'Number', 'Percent', 'Phone', 'Picklist', 'Text', 'TextArea', 'LongTextArea', 'Url']
77
- }),
78
- picklistvalues: command_1.flags.array({
79
- char: 'p',
80
- description: messages.getMessage('picklistValuesFlagDescription'),
81
- longDescription: messages.getMessage('picklistValuesFlagLongDescription')
82
- }),
83
- decimalplaces: command_1.flags.number({
84
- char: 's',
85
- description: messages.getMessage('decimalplacesFlagDescription'),
86
- longDescription: messages.getMessage('decimalplacesFlagLongDescription'),
87
- default: 0
88
- }),
89
- label: command_1.flags.string({
90
- char: 'l',
91
- description: messages.getMessage('labelFlagDescription'),
92
- longDescription: messages.getMessage('labelFlagLongDescription')
93
- }),
94
- outputdir: command_1.flags.directory({
95
- char: 'd',
96
- description: messages.getMessage('outputDirectoryFlagDescription'),
97
- longDescription: messages.getMessage('outputDirectoryFlagLongDescription')
98
- })
99
- };
100
- // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
101
- Create.requiresProject = true;
102
- return Create;
103
- })();
54
+ }
104
55
  exports.default = Create;
56
+ Create.description = messages.getMessage('commandDescription');
57
+ Create.longDescription = messages.getMessage('commandLongDescription');
58
+ Create.examples = [
59
+ messages.getMessage('exampleCaption1'),
60
+ ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Checkbox',
61
+ messages.getMessage('exampleCaption2'),
62
+ ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Picklist --picklistvalues "A,B,C"',
63
+ messages.getMessage('exampleCaption3'),
64
+ ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Number --decimalplaces 2',
65
+ ];
66
+ Create.args = [{ name: 'file' }];
67
+ Create.flagsConfig = {
68
+ fieldname: command_1.flags.string({
69
+ char: 'n',
70
+ required: true,
71
+ description: messages.getMessage('nameFlagDescription'),
72
+ longDescription: messages.getMessage('nameFlagLongDescription'),
73
+ }),
74
+ fieldtype: command_1.flags.enum({
75
+ char: 'f',
76
+ required: true,
77
+ description: messages.getMessage('fieldTypeDescription'),
78
+ longDescription: messages.getMessage('nameFlagLongDescription'),
79
+ options: [
80
+ 'Checkbox',
81
+ 'Date',
82
+ 'DateTime',
83
+ 'Email',
84
+ 'Number',
85
+ 'Percent',
86
+ 'Phone',
87
+ 'Picklist',
88
+ 'Text',
89
+ 'TextArea',
90
+ 'LongTextArea',
91
+ 'Url',
92
+ ],
93
+ }),
94
+ picklistvalues: command_1.flags.array({
95
+ char: 'p',
96
+ description: messages.getMessage('picklistValuesFlagDescription'),
97
+ longDescription: messages.getMessage('picklistValuesFlagLongDescription'),
98
+ }),
99
+ decimalplaces: command_1.flags.number({
100
+ char: 's',
101
+ description: messages.getMessage('decimalplacesFlagDescription'),
102
+ longDescription: messages.getMessage('decimalplacesFlagLongDescription'),
103
+ default: 0,
104
+ }),
105
+ label: command_1.flags.string({
106
+ char: 'l',
107
+ description: messages.getMessage('labelFlagDescription'),
108
+ longDescription: messages.getMessage('labelFlagLongDescription'),
109
+ }),
110
+ outputdir: command_1.flags.directory({
111
+ char: 'd',
112
+ description: messages.getMessage('outputDirectoryFlagDescription'),
113
+ longDescription: messages.getMessage('outputDirectoryFlagLongDescription'),
114
+ }),
115
+ };
116
+ // Set this to true if your command requires a project workspace; 'requiresProject' is false by default
117
+ Create.requiresProject = true;
105
118
  //# sourceMappingURL=create.js.map