@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
package/CHANGELOG.md CHANGED
@@ -2,24 +2,40 @@
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
+ ## [2.0.0](https://github.com/salesforcecli/plugin-custom-metadata/compare/v1.0.12...v2.0.0) (2022-06-03)
6
+
7
+ ### Features
8
+
9
+ - bin/dev ([99555d1](https://github.com/salesforcecli/plugin-custom-metadata/commit/99555d1009d4e4abb2959abe60bf308a7293829b))
10
+ - bump deps ([d33c882](https://github.com/salesforcecli/plugin-custom-metadata/commit/d33c882817d296a7e039a78641553bcb00685727))
11
+ - interfaces for command return types ([68dd30b](https://github.com/salesforcecli/plugin-custom-metadata/commit/68dd30bff5052ed3bd9910a329c20f230b4227d1))
12
+
13
+ ### Bug Fixes
14
+
15
+ - error name ([84dffb3](https://github.com/salesforcecli/plugin-custom-metadata/commit/84dffb35e722ce677aadf5cc5126d8f5814f00bc))
16
+ - trailing slashes bug on field writers ([5166a84](https://github.com/salesforcecli/plugin-custom-metadata/commit/5166a84f104dc818c6acd571b14f7097fae2c06d))
17
+
18
+ ### [1.0.12](https://github.com/salesforcecli/plugin-custom-metadata/compare/v1.0.11...v1.0.12) (2021-04-06)
19
+
20
+ ### Bug Fixes
21
+
22
+ - leif .yml merge [skip-validate-pr] ([9177fdc](https://github.com/salesforcecli/plugin-custom-metadata/commit/9177fdc23b42f6cd1c96ee1d34cf74093994c407))
23
+
5
24
  ### [1.0.11](https://github.com/salesforcecli/plugin-custom-metadata/compare/v1.0.10...v1.0.11) (2020-12-10)
6
25
 
7
26
  ### [1.0.10](https://github.com/salesforcecli/plugin-custom-metadata/compare/v1.0.8...v1.0.10) (2020-08-27)
8
27
 
9
-
10
28
  ### Features
11
29
 
12
- * use npm-release-management-orb ([7154761](https://github.com/salesforcecli/plugin-custom-metadata/commit/7154761d3f0cfedc223f3a38cb7c8970f616bf22))
30
+ - use npm-release-management-orb ([7154761](https://github.com/salesforcecli/plugin-custom-metadata/commit/7154761d3f0cfedc223f3a38cb7c8970f616bf22))
13
31
 
14
32
  # 1.0.0 (2020-06-02)
15
33
 
16
-
17
34
  ### Features
18
35
 
19
- * initial release ([e7f004d](https://github.com/salesforcecli/plugin-custom-metadata/commit/e7f004dffa0bc7e9a29002f7d9383712a4787d17))
20
-
36
+ - initial release ([e7f004d](https://github.com/salesforcecli/plugin-custom-metadata/commit/e7f004dffa0bc7e9a29002f7d9383712a4787d17))
21
37
 
22
38
  ### Reverts
23
39
 
24
- * Revert "add in testing for metadata call" ([cb981e7](https://github.com/salesforcecli/plugin-custom-metadata/commit/cb981e70b646d65eb2b037751f7631d0f11e2498))
25
- * Revert "fix tslint" ([f180242](https://github.com/salesforcecli/plugin-custom-metadata/commit/f1802429bdf16e67dd69d94b586bc6dbf85873b7))
40
+ - Revert "add in testing for metadata call" ([cb981e7](https://github.com/salesforcecli/plugin-custom-metadata/commit/cb981e70b646d65eb2b037751f7631d0f11e2498))
41
+ - Revert "fix tslint" ([f180242](https://github.com/salesforcecli/plugin-custom-metadata/commit/f1802429bdf16e67dd69d94b586bc6dbf85873b7))
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
1
+ Copyright (c) 2022, Salesforce.com, Inc.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -9,4 +9,4 @@ Redistribution and use in source and binary forms, with or without modification,
9
9
 
10
10
  * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
11
 
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Custom Metadata Plugin
2
- ==============
1
+ # Custom Metadata Plugin
3
2
 
4
3
  Tools for working with custom metadata types and their records.
5
4
 
@@ -19,7 +18,7 @@ sfdx plugins:install custom-metadata@x.y.z
19
18
 
20
19
  ## Issues
21
20
 
22
- Please report any issues at https://github.com/forcedotcom/cli/issues
21
+ Please report any issues at <https://github.com/forcedotcom/cli/issues>
23
22
 
24
23
  ## Contributing
25
24
 
@@ -38,7 +37,7 @@ Please report any issues at https://github.com/forcedotcom/cli/issues
38
37
  ### CLA
39
38
 
40
39
  External contributors will be required to sign a Contributor's License
41
- Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
40
+ Agreement. You can do so by going to <https://cla.salesforce.com/sign-cla>.
42
41
 
43
42
  ### Build
44
43
 
@@ -53,11 +52,11 @@ yarn install
53
52
  yarn build
54
53
  ```
55
54
 
56
- To use your plugin, run using the local `./bin/run` or `./bin/run.cmd` file.
55
+ To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
57
56
 
58
57
  ```bash
59
58
  # Run using local run file.
60
- ./bin/run force:cmdt
59
+ ./bin/dev force:cmdt
61
60
  ```
62
61
 
63
62
  There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
@@ -70,12 +69,14 @@ sfdx plugins
70
69
  ```
71
70
 
72
71
  # Commands
72
+
73
73
  <!-- commands -->
74
- * [`sfdx force:cmdt:create -n <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcecmdtcreate--n-string--l-string--p-string--v-packageprotectedprotectedpublic--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
75
- * [`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]`](#sfdx-forcecmdtfieldcreate--n-string--f-checkboxdatedatetimeemailnumberpercentphonepicklisttexttextarealongtextareaurl--p-array--s-number--l-string--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
76
- * [`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]`](#sfdx-forcecmdtgenerate--n-string--s-string--l-string--p-string--v-packageprotectedprotectedpublic--i--d-directory--r-directory--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
77
- * [`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]`](#sfdx-forcecmdtrecordcreate-namevalue--t-string--n-string--l-string--p-string--i-directory--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
78
- * [`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]`](#sfdx-forcecmdtrecordinsert--f-string--t-string--i-directory--d-directory--n-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
74
+
75
+ - [`sfdx force:cmdt:create -n <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcecmdtcreate--n-string--l-string--p-string--v-packageprotectedprotectedpublic--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
76
+ - [`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]`](#sfdx-forcecmdtfieldcreate--n-string--f-checkboxdatedatetimeemailnumberpercentphonepicklisttexttextarealongtextareaurl--p-array--s-number--l-string--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
77
+ - [`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]`](#sfdx-forcecmdtgenerate--n-string--s-string--l-string--p-string--v-packageprotectedprotectedpublic--i--d-directory--r-directory--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
78
+ - [`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]`](#sfdx-forcecmdtrecordcreate-namevalue--t-string--n-string--l-string--p-string--i-directory--d-directory---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
79
+ - [`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]`](#sfdx-forcecmdtrecordinsert--f-string--t-string--i-directory--d-directory--n-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
79
80
 
80
81
  ## `sfdx force:cmdt:create -n <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public] [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
81
82
 
@@ -83,38 +84,37 @@ creates a new custom metadata type in the current project
83
84
 
84
85
  ```
85
86
  USAGE
86
- $ sfdx force:cmdt:create -n <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public] [-d
87
- <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
87
+ $ sfdx force:cmdt:create -n <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public] [-d
88
+ <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
88
89
 
89
- OPTIONS
90
- -d, --outputdir=outputdir directory to store the newly-created
90
+ FLAGS
91
+ -d, --outputdir=<value> directory to store the newly-created
91
92
  custom metadata type files
92
-
93
- -l, --label=label label for the custom metadata type
94
-
95
- -n, --typename=typename (required) unique object name for
93
+ -l, --label=<value> label for the custom metadata type
94
+ -n, --typename=<value> (required) unique object name for
96
95
  the custom metadata type
97
-
98
- -p, --plurallabel=plurallabel plural version of the label value;
96
+ -p, --plurallabel=<value> plural version of the label value;
99
97
  if blank, uses label
100
-
101
98
  -v, --visibility=(PackageProtected|Protected|Public) [default: Public] visibility of the
102
99
  custom metadata type
103
-
104
100
  --json format output as json
105
-
106
101
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
107
102
  this command invocation
108
103
 
104
+ DESCRIPTION
105
+ creates a new custom metadata type in the current project
106
+
109
107
  EXAMPLES
110
108
  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
109
+
110
+ $ sfdx force:cmdt:create --typename MyCustomType
111
+
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
114
- Protected
113
+
114
+ $ sfdx force:cmdt:create --typename MyCustomType --label "Custom Type" --plurallabel "Custom Types" --visibility Protected
115
115
  ```
116
116
 
117
- _See code: [src/commands/force/cmdt/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.11/src/commands/force/cmdt/create.ts)_
117
+ _See code: [src/commands/force/cmdt/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v2.0.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
 
@@ -122,28 +122,28 @@ generate a custom metadata field based on the field type provided
122
122
 
123
123
  ```
124
124
  USAGE
125
- $ sfdx force:cmdt:field:create -n <string> -f
126
- Checkbox|Date|DateTime|Email|Number|Percent|Phone|Picklist|Text|TextArea|LongTextArea|Url [-p <array>] [-s <number>]
127
- [-l <string>] [-d <directory>] [--json] [--loglevel
128
- trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
125
+ $ sfdx force:cmdt:field:create -n <string> -f
126
+ Checkbox|Date|DateTime|Email|Number|Percent|Phone|Picklist|Text|TextArea|LongTextArea|Url [-p <array>] [-s <number>]
127
+ [-l <string>] [-d <directory>] [--json] [--loglevel
128
+ trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
129
129
 
130
- OPTIONS
131
- -d, --outputdir=outputdir
130
+ FLAGS
131
+ -d, --outputdir=<value>
132
132
  directory to store newly-created field definition files
133
133
 
134
134
  -f, --fieldtype=(Checkbox|Date|DateTime|Email|Number|Percent|Phone|Picklist|Text|TextArea|LongTextArea|Url)
135
135
  (required) type of field
136
136
 
137
- -l, --label=label
137
+ -l, --label=<value>
138
138
  label for the field
139
139
 
140
- -n, --fieldname=fieldname
140
+ -n, --fieldname=<value>
141
141
  (required) unique name for the field
142
142
 
143
- -p, --picklistvalues=picklistvalues
143
+ -p, --picklistvalues=<value>
144
144
  comma-separated list of picklist values; required for Picklist fields
145
145
 
146
- -s, --decimalplaces=decimalplaces
146
+ -s, --decimalplaces=<value>
147
147
  number of decimal places to use for Number or Percent fields
148
148
 
149
149
  --json
@@ -152,16 +152,24 @@ OPTIONS
152
152
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)
153
153
  [default: warn] logging level for this command invocation
154
154
 
155
+ DESCRIPTION
156
+ generate a custom metadata field based on the field type provided
157
+
155
158
  EXAMPLES
156
159
  Create a metadata file for a custom checkbox field:
157
- $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Checkbox
160
+
161
+ $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Checkbox
162
+
158
163
  Create a metadata file for a custom picklist field:
159
- $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Picklist --picklistvalues "A,B,C"
164
+
165
+ $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Picklist --picklistvalues "A,B,C"
166
+
160
167
  Create a metadata file for a custom number field:
161
- $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Number --decimalplaces 2
168
+
169
+ $ sfdx force:cmdt:field:create --fieldname MyField --fieldtype Number --decimalplaces 2
162
170
  ```
163
171
 
164
- _See code: [src/commands/force/cmdt/field/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.11/src/commands/force/cmdt/field/create.ts)_
172
+ _See code: [src/commands/force/cmdt/field/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v2.0.0/src/commands/force/cmdt/field/create.ts)_
165
173
 
166
174
  ## `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
175
 
@@ -169,72 +177,68 @@ generates a custom metadata type and all its records for the provided sObject
169
177
 
170
178
  ```
171
179
  USAGE
172
- $ sfdx force:cmdt:generate -n <string> -s <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public]
173
- [-i] [-d <directory>] [-r <directory>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
174
- trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
180
+ $ sfdx force:cmdt:generate -n <string> -s <string> [-l <string>] [-p <string>] [-v PackageProtected|Protected|Public]
181
+ [-i] [-d <directory>] [-r <directory>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
182
+ trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
175
183
 
176
- OPTIONS
177
- -d, --typeoutputdir=typeoutputdir [default:
178
- force-app/main/default/objects/]
184
+ FLAGS
185
+ -d, --typeoutputdir=<value> [default:
186
+ force-app/main/default/objects]
179
187
  directory to store newly-created
180
188
  custom metadata type files
181
-
182
189
  -i, --ignoreunsupported ignore unsupported field types
183
-
184
- -l, --label=label label for the custom metadata type
185
-
186
- -n, --devname=devname (required) name of the custom
190
+ -l, --label=<value> label for the custom metadata type
191
+ -n, --devname=<value> (required) name of the custom
187
192
  metadata type
188
-
189
- -p, --plurallabel=plurallabel plural version of the label value;
193
+ -p, --plurallabel=<value> plural version of the label value;
190
194
  if blank, uses label
191
-
192
- -r, --recordsoutputdir=recordsoutputdir [default:
193
- force-app/main/default/customMetadat
194
- a/] directory to store newly-created
195
- custom metadata record files
196
-
197
- -s, --sobjectname=sobjectname (required) API name of the sObject
195
+ -r, --recordsoutputdir=<value> [default: force-app/main/default/cus
196
+ tomMetadata] directory to store
197
+ newly-created custom metadata record
198
+ files
199
+ -s, --sobjectname=<value> (required) API name of the sObject
198
200
  source for custom metadata
199
201
  generation
200
-
201
- -u, --targetusername=targetusername username or alias for the target
202
+ -u, --targetusername=<value> username or alias for the target
202
203
  org; overrides default target org
203
-
204
204
  -v, --visibility=(PackageProtected|Protected|Public) [default: Public] visibility of the
205
205
  custom metadata type
206
-
207
- --apiversion=apiversion override the api version used for
206
+ --apiversion=<value> override the api version used for
208
207
  api requests made by this command
209
-
210
208
  --json format output as json
211
-
212
209
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
213
210
  this command invocation
214
211
 
212
+ DESCRIPTION
213
+ generates a custom metadata type and all its records for the provided sObject
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
221
- 'alias or user email of the org containing the source type'
217
+
218
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c
219
+
220
+ Generate a custom metadata type from an sObject in the specified target org; ignore unsupported field types instead of converting them to text:
221
+
222
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname MySourceObject__c --ignoreunsupported --targetusername 'alias or user email of the org containing the source type'
223
+
222
224
  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
225
+
226
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomObject__c --visibility Protected
227
+
224
228
  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
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
230
- 'path/to/my/cmdt/directory'
231
- Generate a custom metadata type from an sObject in the default target org; put the resulting record metadata file(s)
232
- in the specified directory:
233
- $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --recordsoutputdir
234
- 'path/to/my/cmdt/record/directory'
229
+
230
+ $ sfdx force:cmdt:generate --devname MyCMDT --label "My CMDT" --plurallabel "My CMDTs" --sobjectname SourceCustomSetting__c --visibility Protected
231
+
232
+ Generate a custom metadata type from an sObject in the default target org; put the resulting type metadata file in the specified directory:
233
+
234
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --typeoutputdir 'path/to/my/cmdt/directory'
235
+
236
+ Generate a custom metadata type from an sObject in the default target org; put the resulting record metadata file(s) in the specified directory:
237
+
238
+ $ sfdx force:cmdt:generate --devname MyCMDT --sobjectname SourceCustomSetting__c --recordsoutputdir 'path/to/my/cmdt/record/directory'
235
239
  ```
236
240
 
237
- _See code: [src/commands/force/cmdt/generate.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.11/src/commands/force/cmdt/generate.ts)_
241
+ _See code: [src/commands/force/cmdt/generate.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v2.0.0/src/commands/force/cmdt/generate.ts)_
238
242
 
239
243
  ## `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
244
 
@@ -242,46 +246,43 @@ create a new record for a given custom metadata type in the current project
242
246
 
243
247
  ```
244
248
  USAGE
245
- $ sfdx force:cmdt:record:create [name=value...] -t <string> -n <string> [-l <string>] [-p <string>] [-i <directory>]
246
- [-d <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
247
-
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
253
-
254
- -i, --inputdir=inputdir [default:
249
+ $ sfdx force:cmdt:record:create [name=value...] -t <string> -n <string> [-l <string>] [-p <string>] [-i <directory>] [-d
250
+ <directory>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
251
+
252
+ FLAGS
253
+ -d, --outputdir=<value> [default: force-app/main/default/cus
254
+ tomMetadata] directory to store
255
+ newly-created custom metadata record
256
+ files
257
+ -i, --inputdir=<value> [default:
255
258
  force-app/main/default/objects]
256
259
  directory to pull the custom
257
260
  metadata type definition from
258
-
259
- -l, --label=label label for the new record
260
-
261
- -n, --recordname=recordname (required) name for the new record
262
-
263
- -p, --protected=true|false [default: false] protect the record
261
+ -l, --label=<value> label for the new record
262
+ -n, --recordname=<value> (required) name for the new record
263
+ -p, --protected=<option> [default: false] protect the record
264
264
  when it is in a managed package
265
-
266
- -t, --typename=typename (required) API name of the custom
265
+ <options: true|false>
266
+ -t, --typename=<value> (required) API name of the custom
267
267
  metadata type to create a record for
268
-
269
268
  --json format output as json
270
-
271
269
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
272
270
  this command invocation
273
271
 
272
+ DESCRIPTION
273
+ create a new record for a given custom metadata type in the current project
274
+
274
275
  EXAMPLES
275
276
  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
277
- My_Custom_Field_2=Bar
278
- Create a protected record metadata file for custom metadata type 'MyCMT' with a specific label and values specified
279
- for two custom fields:
280
- $ sfdx force:cmdt:record:create --typename MyCMT__mdt --recordname MyRecord --label "My Record" --protected true
281
- My_Custom_Field_1=Foo My_Custom_Field_2=Bar
277
+
278
+ $ sfdx force:cmdt:record:create --typename MyCMT__mdt --recordname MyRecord My_Custom_Field_1=Foo My_Custom_Field_2=Bar
279
+
280
+ Create a protected record metadata file for custom metadata type 'MyCMT' with a specific label and values specified for two custom fields:
281
+
282
+ $ sfdx force:cmdt:record:create --typename MyCMT__mdt --recordname MyRecord --label "My Record" --protected true My_Custom_Field_1=Foo My_Custom_Field_2=Bar
282
283
  ```
283
284
 
284
- _See code: [src/commands/force/cmdt/record/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.11/src/commands/force/cmdt/record/create.ts)_
285
+ _See code: [src/commands/force/cmdt/record/create.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v2.0.0/src/commands/force/cmdt/record/create.ts)_
285
286
 
286
287
  ## `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
288
 
@@ -289,67 +290,70 @@ create new custom metadata type records from a CSV file
289
290
 
290
291
  ```
291
292
  USAGE
292
- $ sfdx force:cmdt:record:insert -f <string> -t <string> [-i <directory>] [-d <directory>] [-n <string>] [--json]
293
- [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
294
-
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
300
-
301
- -f, --filepath=filepath (required) path to the CSV file
302
-
303
- -i, --inputdir=inputdir [default:
293
+ $ sfdx force:cmdt:record:insert -f <string> -t <string> [-i <directory>] [-d <directory>] [-n <string>] [--json] [--loglevel
294
+ trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
295
+
296
+ FLAGS
297
+ -d, --outputdir=<value> [default: force-app/main/default/cus
298
+ tomMetadata] directory to store
299
+ newly-created custom metadata record
300
+ files
301
+ -f, --filepath=<value> (required) path to the CSV file
302
+ -i, --inputdir=<value> [default:
304
303
  force-app/main/default/objects]
305
304
  directory to pull the custom
306
305
  metadata type definition from
307
-
308
- -n, --namecolumn=namecolumn [default: Name] column that is used
306
+ -n, --namecolumn=<value> [default: Name] column that is used
309
307
  to determine the name of the record
310
-
311
- -t, --typename=typename (required) API name of the custom
308
+ -t, --typename=<value> (required) API name of the custom
312
309
  metadata type
313
-
314
310
  --json format output as json
315
-
316
311
  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
317
312
  this command invocation
318
313
 
314
+ DESCRIPTION
315
+ create new custom metadata type records from a CSV file
316
+
319
317
  EXAMPLES
320
- Create record metadata files for type 'My_CMDT_Name' (from your local project) based on values in a CSV file, using
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
323
- Create record metadata files for type 'My_CMDT_Name' (from the specified directory) based on values in a CSV file,
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
326
- "path/to/my/cmdt/directory" --namecolumn "PrimaryKey"
318
+ Create record metadata files for type 'My_CMDT_Name' (from your local project) based on values in a CSV file, using 'Name' as the column that specifies the record name:
319
+
320
+ $ sfdx force:cmdt:record:insert --filepath path/to/my.csv --typename My_CMDT_Name
321
+
322
+ Create record metadata files for type 'My_CMDT_Name' (from the specified directory) based on values in a CSV file, using 'PrimaryKey' as the column that specifies the record name:
323
+
324
+ $ sfdx force:cmdt:record:insert --filepath path/to/my.csv --typename My_CMDT_Name --inputdir "path/to/my/cmdt/directory" --namecolumn "PrimaryKey"
327
325
  ```
328
326
 
329
- _See code: [src/commands/force/cmdt/record/insert.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v1.0.11/src/commands/force/cmdt/record/insert.ts)_
327
+ _See code: [src/commands/force/cmdt/record/insert.ts](https://github.com/salesforcecli/plugin-custom-metadata/blob/v2.0.0/src/commands/force/cmdt/record/insert.ts)_
328
+
330
329
  <!-- commandsstop -->
331
330
 
332
331
  <!-- debugging-your-plugin -->
332
+
333
333
  # Debugging your plugin
334
+
334
335
  We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the `.vscode` directory of this plugin is a `launch.json` config file, which allows you to attach a debugger to the node process when running your commands.
335
336
 
336
- To debug the `hello:org` command:
337
+ To debug the `hello:org` command:
338
+
337
339
  1. Start the inspector
338
-
339
- If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
340
+
341
+ If you linked your plugin to the sfdx cli, call your command with the `dev-suspend` switch:
342
+
340
343
  ```sh-session
341
- $ sfdx hello:org -u myOrg@example.com --dev-suspend
344
+ sfdx hello:org -u myOrg@example.com --dev-suspend
342
345
  ```
343
-
344
- Alternatively, to call your command using the `bin/run` script, set the `NODE_OPTIONS` environment variable to `--inspect-brk` when starting the debugger:
346
+
347
+ Alternatively, to call your command using the `bin/dev` script, set the `NODE_OPTIONS` environment variable to `--inspect-brk` when starting the debugger:
348
+
345
349
  ```sh-session
346
- $ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
350
+ NODE_OPTIONS=--inspect-brk bin/dev hello:org -u myOrg@example.com
347
351
  ```
348
352
 
349
353
  2. Set some breakpoints in your command code
350
354
  3. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
351
355
  4. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
352
- 5. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
356
+ 5. Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
353
357
  6. Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).
354
- <br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
355
- Congrats, you are debugging!
358
+ <br><img src=".images/vscodeScreenshot.png" width="480" height="278"><br>
359
+ Congrats, you are debugging!
@@ -1,5 +1,10 @@
1
1
  import { flags, SfdxCommand } from '@salesforce/command';
2
- import { AnyJson } from '@salesforce/ts-types';
2
+ interface CmdtCreateResponse {
3
+ typename: string;
4
+ label: string;
5
+ pluralLabel: string;
6
+ visibility: string;
7
+ }
3
8
  export default class Create extends SfdxCommand {
4
9
  static description: string;
5
10
  static longDescription: string;
@@ -8,12 +13,13 @@ export default class Create extends SfdxCommand {
8
13
  name: string;
9
14
  }[];
10
15
  protected static flagsConfig: {
11
- typename: flags.Discriminated<flags.Option<string>>;
12
- label: flags.Discriminated<flags.Option<string>>;
13
- plurallabel: flags.Discriminated<flags.Option<string>>;
16
+ typename: flags.Discriminated<flags.String>;
17
+ label: flags.Discriminated<flags.String>;
18
+ plurallabel: flags.Discriminated<flags.String>;
14
19
  visibility: flags.Discriminated<flags.Enum<string>>;
15
- outputdir: flags.Discriminated<flags.Option<string>>;
20
+ outputdir: flags.Discriminated<flags.String>;
16
21
  };
17
22
  protected static requiresProject: boolean;
18
- run(): Promise<AnyJson>;
23
+ run(): Promise<CmdtCreateResponse>;
19
24
  }
25
+ export {};