@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,96 +1,94 @@
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");
9
11
  const command_1 = require("@salesforce/command");
12
+ const core_1 = require("@salesforce/core");
10
13
  const fileWriter_1 = require("../../../lib/helpers/fileWriter");
11
14
  const validationUtil_1 = require("../../../lib/helpers/validationUtil");
12
15
  const templates_1 = require("../../../lib/templates/templates");
13
16
  // Initialize Messages with the current plugin directory
14
- command_1.core.Messages.importMessagesDirectory(__dirname);
17
+ core_1.Messages.importMessagesDirectory(__dirname);
15
18
  // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
16
19
  // 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
- };
49
- }
20
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'createType');
21
+ class Create extends command_1.SfdxCommand {
22
+ // eslint-disable-next-line @typescript-eslint/member-ordering
23
+ async run() {
24
+ var _b, _c;
25
+ const typename = this.flags.typename; // this should become the new file name
26
+ const label = (_b = this.flags.label) !== null && _b !== void 0 ? _b : typename.replace('__mdt', ''); // If a label is not provided default using the dev name. trim __mdt out
27
+ const visibility = this.flags.visibility;
28
+ const pluralLabel = (_c = this.flags.plurallabel) !== null && _c !== void 0 ? _c : label;
29
+ const templates = new templates_1.Templates();
30
+ const fileWriter = new fileWriter_1.FileWriter();
31
+ const objectXML = templates.createObjectXML({ label, pluralLabel }, visibility);
32
+ const saveResults = await fileWriter.writeTypeFile(fs, this.flags.outputdir, typename, objectXML);
33
+ this.ux.log(messages.getMessage('targetDirectory', [saveResults.dir]));
34
+ this.ux.log(messages.getMessage(saveResults.updated ? 'fileUpdate' : 'fileCreated', [saveResults.fileName]));
35
+ return {
36
+ typename,
37
+ label,
38
+ pluralLabel,
39
+ visibility,
40
+ };
50
41
  }
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
- })();
42
+ }
95
43
  exports.default = Create;
44
+ _a = Create;
45
+ Create.description = messages.getMessage('commandDescription');
46
+ Create.longDescription = messages.getMessage('commandLongDescription');
47
+ Create.examples = [
48
+ messages.getMessage('exampleCaption1'),
49
+ ' $ sfdx force:cmdt:create --typename MyCustomType',
50
+ messages.getMessage('exampleCaption2'),
51
+ ' $ sfdx force:cmdt:create --typename MyCustomType --label "' +
52
+ messages.getMessage('labelFlagExample') +
53
+ '" ' +
54
+ '--plurallabel "' +
55
+ messages.getMessage('plurallabelFlagExample') +
56
+ '" --visibility Protected',
57
+ ];
58
+ Create.args = [{ name: 'file' }];
59
+ Create.flagsConfig = {
60
+ typename: command_1.flags.string({
61
+ char: 'n',
62
+ description: messages.getMessage('nameFlagDescription'),
63
+ longDescription: messages.getMessage('nameFlagLongDescription'),
64
+ required: true,
65
+ parse: async (input) => Promise.resolve((0, validationUtil_1.validateMetadataTypeName)(input)),
66
+ }),
67
+ label: command_1.flags.string({
68
+ char: 'l',
69
+ description: messages.getMessage('labelFlagDescription'),
70
+ longDescription: messages.getMessage('labelFlagLongDescription'),
71
+ parse: async (input) => Promise.resolve((0, validationUtil_1.validateLessThanForty)(input, messages.getMessage('errorNotValidLabelName', [input]))),
72
+ }),
73
+ plurallabel: command_1.flags.string({
74
+ char: 'p',
75
+ description: messages.getMessage('plurallabelFlagDescription'),
76
+ longDescription: messages.getMessage('plurallabelFlagLongDescription'),
77
+ parse: async (input) => Promise.resolve((0, validationUtil_1.validateLessThanForty)(input, messages.getMessage('errorNotValidPluralLabelName', [input]))),
78
+ }),
79
+ visibility: command_1.flags.enum({
80
+ char: 'v',
81
+ description: messages.getMessage('visibilityFlagDescription'),
82
+ longDescription: messages.getMessage('visibilityFlagLongDescription'),
83
+ options: ['PackageProtected', 'Protected', 'Public'],
84
+ default: 'Public',
85
+ }),
86
+ outputdir: command_1.flags.directory({
87
+ char: 'd',
88
+ description: messages.getMessage('outputDirectoryFlagDescription'),
89
+ longDescription: messages.getMessage('outputDirectoryFlagLongDescription'),
90
+ default: '',
91
+ }),
92
+ };
93
+ Create.requiresProject = true;
96
94
  //# 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,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,wEAAwE;YACpJ,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC;YACpD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,QAAQ,CAAC;YACrD,MAAM,GAA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,EAAE,QAAQ,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC9G,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,CAAC,oCAAoC,CAAC;QAC1E,OAAO,EAAE,EAAE;KACZ,CAAC;CACF,CAAA;AAEe,sBAAe,GAAG,IAAK,CAAA"}
@@ -1,5 +1,9 @@
1
1
  import { flags, SfdxCommand } from '@salesforce/command';
2
- import { AnyJson } from '@salesforce/ts-types';
2
+ interface CmdtFieldCreateResponse {
3
+ fieldName: string;
4
+ label: string;
5
+ fieldtype: string;
6
+ }
3
7
  export default class Create extends SfdxCommand {
4
8
  static description: string;
5
9
  static longDescription: string;
@@ -8,13 +12,14 @@ export default class Create extends SfdxCommand {
8
12
  name: string;
9
13
  }[];
10
14
  protected static flagsConfig: {
11
- fieldname: flags.Discriminated<flags.Option<string>>;
15
+ fieldname: flags.Discriminated<flags.String>;
12
16
  fieldtype: flags.Discriminated<flags.Enum<string>>;
13
17
  picklistvalues: flags.Discriminated<flags.Array<string>>;
14
18
  decimalplaces: flags.Discriminated<flags.Number>;
15
- label: flags.Discriminated<flags.Option<string>>;
16
- outputdir: flags.Discriminated<flags.Option<string>>;
19
+ label: flags.Discriminated<flags.String>;
20
+ outputdir: flags.Discriminated<flags.String>;
17
21
  };
18
22
  protected static requiresProject: boolean;
19
- run(): Promise<AnyJson>;
23
+ run(): Promise<CmdtFieldCreateResponse>;
20
24
  }
25
+ export {};
@@ -1,105 +1,113 @@
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");
9
11
  const command_1 = require("@salesforce/command");
12
+ const core_1 = require("@salesforce/core");
10
13
  const fileWriter_1 = require("../../../../lib/helpers/fileWriter");
11
14
  const validationUtil_1 = require("../../../../lib/helpers/validationUtil");
12
15
  const templates_1 = require("../../../../lib/templates/templates");
13
16
  // Initialize Messages with the current plugin directory
14
- command_1.core.Messages.importMessagesDirectory(__dirname);
17
+ core_1.Messages.importMessagesDirectory(__dirname);
15
18
  // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
16
19
  // 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
- };
20
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-custom-metadata', 'createField');
21
+ class Create extends command_1.SfdxCommand {
22
+ // eslint-disable-next-line @typescript-eslint/member-ordering
23
+ async run() {
24
+ var _b, _c;
25
+ const fieldName = this.flags.fieldname; // this should become the new file name
26
+ const label = (_b = this.flags.label) !== null && _b !== void 0 ? _b : fieldName;
27
+ const fieldtype = this.flags.fieldtype;
28
+ const picklistvalues = (_c = this.flags.picklistvalues) !== null && _c !== void 0 ? _c : [];
29
+ const decimalplaces = this.flags.decimalplaces;
30
+ if (fieldtype === 'Picklist' && picklistvalues.length === 0) {
31
+ throw new core_1.SfError(messages.getMessage('picklistValuesNotSuppliedError'));
51
32
  }
33
+ const templates = new templates_1.Templates();
34
+ const data = templates.createDefaultTypeStructure(fieldName, fieldtype, label, picklistvalues, decimalplaces);
35
+ const fieldXML = templates.createFieldXML(data, false);
36
+ const writer = new fileWriter_1.FileWriter();
37
+ const saveResults = await writer.writeFieldFile(fs, this.flags.outputdir, fieldName, fieldXML);
38
+ this.ux.log(messages.getMessage('targetDirectory', [saveResults.dir]));
39
+ this.ux.log(messages.getMessage(saveResults.updated ? 'fileUpdate' : 'fileCreated', [saveResults.fileName]));
40
+ return {
41
+ fieldName,
42
+ label,
43
+ fieldtype,
44
+ };
52
45
  }
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
- })();
46
+ }
104
47
  exports.default = Create;
48
+ _a = Create;
49
+ Create.description = messages.getMessage('commandDescription');
50
+ Create.longDescription = messages.getMessage('commandLongDescription');
51
+ Create.examples = [
52
+ messages.getMessage('exampleCaption1'),
53
+ ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Checkbox',
54
+ messages.getMessage('exampleCaption2'),
55
+ ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Picklist --picklistvalues "A,B,C"',
56
+ messages.getMessage('exampleCaption3'),
57
+ ' $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Number --decimalplaces 2',
58
+ ];
59
+ Create.args = [{ name: 'file' }];
60
+ Create.flagsConfig = {
61
+ fieldname: command_1.flags.string({
62
+ char: 'n',
63
+ required: true,
64
+ description: messages.getMessage('nameFlagDescription'),
65
+ longDescription: messages.getMessage('nameFlagLongDescription'),
66
+ parse: async (input) => Promise.resolve((0, validationUtil_1.validateAPIName)(input, messages.getMessage('invalidCustomFieldError', [input]))),
67
+ }),
68
+ fieldtype: command_1.flags.enum({
69
+ char: 'f',
70
+ required: true,
71
+ description: messages.getMessage('fieldTypeDescription'),
72
+ longDescription: messages.getMessage('nameFlagLongDescription'),
73
+ options: [
74
+ 'Checkbox',
75
+ 'Date',
76
+ 'DateTime',
77
+ 'Email',
78
+ 'Number',
79
+ 'Percent',
80
+ 'Phone',
81
+ 'Picklist',
82
+ 'Text',
83
+ 'TextArea',
84
+ 'LongTextArea',
85
+ 'Url',
86
+ ],
87
+ }),
88
+ picklistvalues: command_1.flags.array({
89
+ char: 'p',
90
+ description: messages.getMessage('picklistValuesFlagDescription'),
91
+ longDescription: messages.getMessage('picklistValuesFlagLongDescription'),
92
+ }),
93
+ decimalplaces: command_1.flags.number({
94
+ char: 's',
95
+ description: messages.getMessage('decimalplacesFlagDescription'),
96
+ longDescription: messages.getMessage('decimalplacesFlagLongDescription'),
97
+ default: 0,
98
+ min: 0,
99
+ }),
100
+ label: command_1.flags.string({
101
+ char: 'l',
102
+ description: messages.getMessage('labelFlagDescription'),
103
+ longDescription: messages.getMessage('labelFlagLongDescription'),
104
+ }),
105
+ outputdir: command_1.flags.directory({
106
+ char: 'd',
107
+ description: messages.getMessage('outputDirectoryFlagDescription'),
108
+ longDescription: messages.getMessage('outputDirectoryFlagLongDescription'),
109
+ default: '',
110
+ }),
111
+ };
112
+ Create.requiresProject = true;
105
113
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../src/commands/force/cmdt/field/create.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iDAA+D;AAE/D,mEAAgE;AAChE,2EAAwE;AAExE,mEAAgE;AAEhE,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,aAAa,CAAC,CAAC;AAEjG;IAAA,MAAqB,MAAO,SAAQ,qBAAW;QAwDpC,KAAK,CAAC,GAAG;YACZ,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,uCAAuC;YAC/E,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACvD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACvC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC;YACvD,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,CAAC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AsB,CAAC;QACxD,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;QAC/D,OAAO,EAAE;YACP,UAAU;YACV,MAAM;YACN,UAAU;YACV,OAAO;YACP,QAAQ;YACR,SAAS;YACT,OAAO;YACP,UAAU;YACV,MAAM;YACN,UAAU;YACV,cAAc;YACd,KAAK;SACN;KACF,CAAC;IACF,cAAc,EAAE,eAAK,CAAC,KAAK,CAAC;QAC1B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;QACjE,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,mCAAmC,CAAC;KAC1E,CAAC;IACF,aAAa,EAAE,eAAK,CAAC,MAAM,CAAC;QAC1B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,8BAA8B,CAAC;QAChE,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,kCAAkC,CAAC;QACxE,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,CAAC;KACP,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,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,CAAC,oCAAoC,CAAC;QAC1E,OAAO,EAAE,EAAE;KACZ,CAAC;CACF,CAAA;AAEe,sBAAe,GAAG,IAAK,CAAA"}
@@ -1,5 +1,8 @@
1
1
  import { flags, SfdxCommand } from '@salesforce/command';
2
- import { AnyJson } from '@salesforce/ts-types';
2
+ interface CmdtGenerateResponse {
3
+ outputDir: string;
4
+ recordsOutputDir: string;
5
+ }
3
6
  export default class Generate extends SfdxCommand {
4
7
  static description: string;
5
8
  static longDescription: string;
@@ -8,16 +11,17 @@ export default class Generate extends SfdxCommand {
8
11
  name: string;
9
12
  }[];
10
13
  protected static flagsConfig: {
11
- devname: flags.Discriminated<flags.Option<string>>;
12
- label: flags.Discriminated<flags.Option<string>>;
13
- plurallabel: flags.Discriminated<flags.Option<string>>;
14
+ devname: flags.Discriminated<flags.String>;
15
+ label: flags.Discriminated<flags.String>;
16
+ plurallabel: flags.Discriminated<flags.String>;
14
17
  visibility: flags.Discriminated<flags.Enum<string>>;
15
- sobjectname: flags.Discriminated<flags.Option<string>>;
18
+ sobjectname: flags.Discriminated<flags.String>;
16
19
  ignoreunsupported: flags.Discriminated<flags.Boolean<boolean>>;
17
- typeoutputdir: flags.Discriminated<flags.Option<string>>;
18
- recordsoutputdir: flags.Discriminated<flags.Option<string>>;
20
+ typeoutputdir: flags.Discriminated<flags.String>;
21
+ recordsoutputdir: flags.Discriminated<flags.String>;
19
22
  };
20
23
  protected static requiresUsername: boolean;
21
24
  protected static requiresProject: boolean;
22
- run(): Promise<AnyJson>;
25
+ run(): Promise<CmdtGenerateResponse>;
23
26
  }
27
+ export {};