@salesforce/plugin-custom-metadata 2.0.9 → 2.0.12

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 (80) hide show
  1. package/README.md +0 -1
  2. package/lib/commands/generate/cmdt/field.d.ts +23 -0
  3. package/lib/commands/generate/cmdt/field.js +100 -0
  4. package/lib/commands/generate/cmdt/field.js.map +1 -0
  5. package/lib/commands/generate/cmdt/fromorg.d.ts +26 -0
  6. package/lib/commands/generate/cmdt/fromorg.js +184 -0
  7. package/lib/commands/generate/cmdt/fromorg.js.map +1 -0
  8. package/lib/commands/generate/cmdt/object.d.ts +23 -0
  9. package/lib/commands/generate/cmdt/object.js +79 -0
  10. package/lib/commands/generate/cmdt/object.js.map +1 -0
  11. package/lib/commands/generate/cmdt/record.d.ts +29 -0
  12. package/lib/commands/generate/cmdt/record.js +111 -0
  13. package/lib/commands/generate/cmdt/record.js.map +1 -0
  14. package/lib/commands/generate/cmdt/records.d.ts +18 -0
  15. package/lib/commands/generate/cmdt/records.js +105 -0
  16. package/lib/commands/generate/cmdt/records.js.map +1 -0
  17. package/lib/shared/helpers/createUtil.d.ts +51 -0
  18. package/lib/shared/helpers/createUtil.js +168 -0
  19. package/lib/shared/helpers/createUtil.js.map +1 -0
  20. package/lib/shared/helpers/fileWriter.d.ts +24 -0
  21. package/lib/shared/helpers/fileWriter.js +59 -0
  22. package/lib/shared/helpers/fileWriter.js.map +1 -0
  23. package/lib/{lib → shared}/helpers/metadataUtil.d.ts +1 -1
  24. package/lib/{lib → shared}/helpers/metadataUtil.js +1 -1
  25. package/lib/shared/helpers/metadataUtil.js.map +1 -0
  26. package/lib/{lib → shared}/helpers/validationUtil.d.ts +0 -0
  27. package/lib/{lib → shared}/helpers/validationUtil.js +0 -0
  28. package/lib/shared/helpers/validationUtil.js.map +1 -0
  29. package/lib/{lib → shared}/interfaces/createConfig.d.ts +3 -2
  30. package/lib/{lib → shared}/interfaces/createConfig.js +0 -0
  31. package/lib/shared/interfaces/createConfig.js.map +1 -0
  32. package/lib/shared/templates/templates.d.ts +20 -0
  33. package/lib/shared/templates/templates.js +208 -0
  34. package/lib/shared/templates/templates.js.map +1 -0
  35. package/messages/field.md +79 -0
  36. package/messages/fromorg.md +87 -0
  37. package/messages/object.md +73 -0
  38. package/messages/record.md +53 -0
  39. package/messages/records.md +49 -0
  40. package/messages/template.md +3 -0
  41. package/messages/validation.md +11 -0
  42. package/oclif.manifest.json +1 -1
  43. package/package.json +20 -22
  44. package/schemas/generate-cmdt-fromorg.json +19 -0
  45. package/schemas/generate-cmdt-record.json +378 -0
  46. package/schemas/generate-cmdt-records.json +406 -0
  47. package/lib/commands/force/cmdt/create.d.ts +0 -25
  48. package/lib/commands/force/cmdt/create.js +0 -94
  49. package/lib/commands/force/cmdt/create.js.map +0 -1
  50. package/lib/commands/force/cmdt/field/create.d.ts +0 -25
  51. package/lib/commands/force/cmdt/field/create.js +0 -113
  52. package/lib/commands/force/cmdt/field/create.js.map +0 -1
  53. package/lib/commands/force/cmdt/generate.d.ts +0 -27
  54. package/lib/commands/force/cmdt/generate.js +0 -219
  55. package/lib/commands/force/cmdt/generate.js.map +0 -1
  56. package/lib/commands/force/cmdt/record/create.d.ts +0 -32
  57. package/lib/commands/force/cmdt/record/create.js +0 -140
  58. package/lib/commands/force/cmdt/record/create.js.map +0 -1
  59. package/lib/commands/force/cmdt/record/insert.d.ts +0 -16
  60. package/lib/commands/force/cmdt/record/insert.js +0 -110
  61. package/lib/commands/force/cmdt/record/insert.js.map +0 -1
  62. package/lib/lib/helpers/createUtil.d.ts +0 -62
  63. package/lib/lib/helpers/createUtil.js +0 -170
  64. package/lib/lib/helpers/createUtil.js.map +0 -1
  65. package/lib/lib/helpers/fileWriter.d.ts +0 -27
  66. package/lib/lib/helpers/fileWriter.js +0 -63
  67. package/lib/lib/helpers/fileWriter.js.map +0 -1
  68. package/lib/lib/helpers/metadataUtil.js.map +0 -1
  69. package/lib/lib/helpers/validationUtil.js.map +0 -1
  70. package/lib/lib/interfaces/createConfig.js.map +0 -1
  71. package/lib/lib/templates/templates.d.ts +0 -37
  72. package/lib/lib/templates/templates.js +0 -221
  73. package/lib/lib/templates/templates.js.map +0 -1
  74. package/messages/createField.json +0 -24
  75. package/messages/createRecord.json +0 -32
  76. package/messages/createType.json +0 -33
  77. package/messages/generate.json +0 -40
  78. package/messages/insertRecord.json +0 -26
  79. package/messages/template.json +0 -3
  80. package/messages/validation.json +0 -5
@@ -0,0 +1,406 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/CreateConfigs",
4
+ "definitions": {
5
+ "CreateConfigs": {
6
+ "type": "array",
7
+ "items": {
8
+ "$ref": "#/definitions/CreateConfig"
9
+ }
10
+ },
11
+ "CreateConfig": {
12
+ "type": "object",
13
+ "properties": {
14
+ "typename": {
15
+ "type": "string"
16
+ },
17
+ "recordname": {
18
+ "type": "string"
19
+ },
20
+ "label": {
21
+ "type": "string"
22
+ },
23
+ "inputdir": {
24
+ "type": "string"
25
+ },
26
+ "outputdir": {
27
+ "type": "string"
28
+ },
29
+ "protected": {
30
+ "type": "boolean"
31
+ },
32
+ "varargs": {
33
+ "$ref": "#/definitions/Record"
34
+ },
35
+ "fileData": {
36
+ "type": "array",
37
+ "items": {
38
+ "$ref": "#/definitions/CustomField"
39
+ }
40
+ },
41
+ "ignorefields": {
42
+ "type": "boolean"
43
+ }
44
+ },
45
+ "required": ["typename", "recordname", "label", "inputdir", "outputdir"],
46
+ "additionalProperties": false
47
+ },
48
+ "Record": {
49
+ "type": "object",
50
+ "properties": {
51
+ "Id": {
52
+ "type": "string"
53
+ },
54
+ "attributes": {
55
+ "type": "object",
56
+ "properties": {
57
+ "type": {
58
+ "type": "string"
59
+ },
60
+ "url": {
61
+ "type": "string"
62
+ }
63
+ },
64
+ "required": ["type", "url"]
65
+ }
66
+ }
67
+ },
68
+ "CustomField": {
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "properties": {
72
+ "businessOwnerGroup": {
73
+ "type": ["string", "null"]
74
+ },
75
+ "businessOwnerUser": {
76
+ "type": ["string", "null"]
77
+ },
78
+ "businessStatus": {
79
+ "type": ["string", "null"]
80
+ },
81
+ "caseSensitive": {
82
+ "type": ["boolean", "null"]
83
+ },
84
+ "complianceGroup": {
85
+ "type": ["string", "null"]
86
+ },
87
+ "customDataType": {
88
+ "type": ["string", "null"]
89
+ },
90
+ "defaultValue": {
91
+ "type": ["string", "null"]
92
+ },
93
+ "deleteConstraint": {
94
+ "type": ["string", "null"]
95
+ },
96
+ "deprecated": {
97
+ "type": ["boolean", "null"]
98
+ },
99
+ "description": {
100
+ "type": ["string", "null"]
101
+ },
102
+ "displayFormat": {
103
+ "type": ["string", "null"]
104
+ },
105
+ "encryptionScheme": {
106
+ "type": ["string", "null"]
107
+ },
108
+ "escapeMarkup": {
109
+ "type": ["boolean", "null"]
110
+ },
111
+ "externalDeveloperName": {
112
+ "type": ["string", "null"]
113
+ },
114
+ "externalId": {
115
+ "type": ["boolean", "null"]
116
+ },
117
+ "fieldManageability": {
118
+ "type": ["string", "null"]
119
+ },
120
+ "formula": {
121
+ "type": ["string", "null"]
122
+ },
123
+ "formulaTreatBlanksAs": {
124
+ "type": ["string", "null"]
125
+ },
126
+ "inlineHelpText": {
127
+ "type": ["string", "null"]
128
+ },
129
+ "isAIPredictionField": {
130
+ "type": ["boolean", "null"]
131
+ },
132
+ "isConvertLeadDisabled": {
133
+ "type": ["boolean", "null"]
134
+ },
135
+ "isFilteringDisabled": {
136
+ "type": ["boolean", "null"]
137
+ },
138
+ "isNameField": {
139
+ "type": ["boolean", "null"]
140
+ },
141
+ "isSortingDisabled": {
142
+ "type": ["boolean", "null"]
143
+ },
144
+ "label": {
145
+ "type": ["string", "null"]
146
+ },
147
+ "length": {
148
+ "type": ["number", "null"]
149
+ },
150
+ "lookupFilter": {
151
+ "anyOf": [
152
+ {
153
+ "$ref": "#/definitions/LookupFilter"
154
+ },
155
+ {
156
+ "type": "null"
157
+ }
158
+ ]
159
+ },
160
+ "maskChar": {
161
+ "type": ["string", "null"]
162
+ },
163
+ "maskType": {
164
+ "type": ["string", "null"]
165
+ },
166
+ "metadataRelationshipControllingField": {
167
+ "type": ["string", "null"]
168
+ },
169
+ "populateExistingRows": {
170
+ "type": ["boolean", "null"]
171
+ },
172
+ "precision": {
173
+ "type": ["number", "null"]
174
+ },
175
+ "referenceTargetField": {
176
+ "type": ["string", "null"]
177
+ },
178
+ "referenceTo": {
179
+ "type": ["string", "null"]
180
+ },
181
+ "relationshipLabel": {
182
+ "type": ["string", "null"]
183
+ },
184
+ "relationshipName": {
185
+ "type": ["string", "null"]
186
+ },
187
+ "relationshipOrder": {
188
+ "type": ["number", "null"]
189
+ },
190
+ "reparentableMasterDetail": {
191
+ "type": ["boolean", "null"]
192
+ },
193
+ "required": {
194
+ "type": ["boolean", "null"]
195
+ },
196
+ "restrictedAdminField": {
197
+ "type": ["boolean", "null"]
198
+ },
199
+ "scale": {
200
+ "type": ["number", "null"]
201
+ },
202
+ "securityClassification": {
203
+ "type": ["string", "null"]
204
+ },
205
+ "startingNumber": {
206
+ "type": ["number", "null"]
207
+ },
208
+ "stripMarkup": {
209
+ "type": ["boolean", "null"]
210
+ },
211
+ "summarizedField": {
212
+ "type": ["string", "null"]
213
+ },
214
+ "summaryFilterItems": {
215
+ "type": "array",
216
+ "items": {
217
+ "$ref": "#/definitions/FilterItem"
218
+ }
219
+ },
220
+ "summaryForeignKey": {
221
+ "type": ["string", "null"]
222
+ },
223
+ "summaryOperation": {
224
+ "type": ["string", "null"]
225
+ },
226
+ "trackFeedHistory": {
227
+ "type": ["boolean", "null"]
228
+ },
229
+ "trackHistory": {
230
+ "type": ["boolean", "null"]
231
+ },
232
+ "trackTrending": {
233
+ "type": ["boolean", "null"]
234
+ },
235
+ "translateData": {
236
+ "type": ["boolean", "null"]
237
+ },
238
+ "type": {
239
+ "type": ["string", "null"]
240
+ },
241
+ "unique": {
242
+ "type": ["boolean", "null"]
243
+ },
244
+ "valueSet": {
245
+ "anyOf": [
246
+ {
247
+ "$ref": "#/definitions/ValueSet"
248
+ },
249
+ {
250
+ "type": "null"
251
+ }
252
+ ]
253
+ },
254
+ "visibleLines": {
255
+ "type": ["number", "null"]
256
+ },
257
+ "writeRequiresMasterRead": {
258
+ "type": ["boolean", "null"]
259
+ },
260
+ "fullName": {
261
+ "type": ["string", "null"]
262
+ }
263
+ },
264
+ "required": ["summaryFilterItems"]
265
+ },
266
+ "LookupFilter": {
267
+ "type": "object",
268
+ "properties": {
269
+ "active": {
270
+ "type": "boolean"
271
+ },
272
+ "booleanFilter": {
273
+ "type": ["string", "null"]
274
+ },
275
+ "description": {
276
+ "type": ["string", "null"]
277
+ },
278
+ "errorMessage": {
279
+ "type": ["string", "null"]
280
+ },
281
+ "filterItems": {
282
+ "type": "array",
283
+ "items": {
284
+ "$ref": "#/definitions/FilterItem"
285
+ }
286
+ },
287
+ "infoMessage": {
288
+ "type": ["string", "null"]
289
+ },
290
+ "isOptional": {
291
+ "type": "boolean"
292
+ }
293
+ },
294
+ "required": ["active", "filterItems", "isOptional"],
295
+ "additionalProperties": false
296
+ },
297
+ "FilterItem": {
298
+ "type": "object",
299
+ "properties": {
300
+ "field": {
301
+ "type": "string"
302
+ },
303
+ "operation": {
304
+ "type": "string"
305
+ },
306
+ "value": {
307
+ "type": ["string", "null"]
308
+ },
309
+ "valueField": {
310
+ "type": ["string", "null"]
311
+ }
312
+ },
313
+ "required": ["field", "operation"],
314
+ "additionalProperties": false
315
+ },
316
+ "ValueSet": {
317
+ "type": "object",
318
+ "properties": {
319
+ "controllingField": {
320
+ "type": ["string", "null"]
321
+ },
322
+ "restricted": {
323
+ "type": ["boolean", "null"]
324
+ },
325
+ "valueSetDefinition": {
326
+ "anyOf": [
327
+ {
328
+ "$ref": "#/definitions/ValueSetValuesDefinition"
329
+ },
330
+ {
331
+ "type": "null"
332
+ }
333
+ ]
334
+ },
335
+ "valueSetName": {
336
+ "type": ["string", "null"]
337
+ },
338
+ "valueSettings": {
339
+ "type": "array",
340
+ "items": {
341
+ "$ref": "#/definitions/ValueSettings"
342
+ }
343
+ }
344
+ },
345
+ "required": ["valueSettings"],
346
+ "additionalProperties": false
347
+ },
348
+ "ValueSetValuesDefinition": {
349
+ "type": "object",
350
+ "properties": {
351
+ "sorted": {
352
+ "type": "boolean"
353
+ },
354
+ "value": {
355
+ "type": "array",
356
+ "items": {
357
+ "$ref": "#/definitions/CustomValue"
358
+ }
359
+ }
360
+ },
361
+ "required": ["sorted", "value"],
362
+ "additionalProperties": false
363
+ },
364
+ "CustomValue": {
365
+ "type": "object",
366
+ "additionalProperties": false,
367
+ "properties": {
368
+ "color": {
369
+ "type": ["string", "null"]
370
+ },
371
+ "default": {
372
+ "type": "boolean"
373
+ },
374
+ "description": {
375
+ "type": ["string", "null"]
376
+ },
377
+ "isActive": {
378
+ "type": ["boolean", "null"]
379
+ },
380
+ "label": {
381
+ "type": ["string", "null"]
382
+ },
383
+ "fullName": {
384
+ "type": ["string", "null"]
385
+ }
386
+ },
387
+ "required": ["default"]
388
+ },
389
+ "ValueSettings": {
390
+ "type": "object",
391
+ "properties": {
392
+ "controllingFieldValue": {
393
+ "type": "array",
394
+ "items": {
395
+ "type": "string"
396
+ }
397
+ },
398
+ "valueName": {
399
+ "type": "string"
400
+ }
401
+ },
402
+ "required": ["controllingFieldValue", "valueName"],
403
+ "additionalProperties": false
404
+ }
405
+ }
406
+ }
@@ -1,25 +0,0 @@
1
- import { flags, SfdxCommand } from '@salesforce/command';
2
- interface CmdtCreateResponse {
3
- typename: string;
4
- label: string;
5
- pluralLabel: string;
6
- visibility: string;
7
- }
8
- export default class Create extends SfdxCommand {
9
- static description: string;
10
- static longDescription: string;
11
- static examples: string[];
12
- static args: {
13
- name: string;
14
- }[];
15
- protected static flagsConfig: {
16
- typename: flags.Discriminated<flags.String>;
17
- label: flags.Discriminated<flags.String>;
18
- plurallabel: flags.Discriminated<flags.String>;
19
- visibility: flags.Discriminated<flags.Enum<string>>;
20
- outputdir: flags.Discriminated<flags.String>;
21
- };
22
- protected static requiresProject: boolean;
23
- run(): Promise<CmdtCreateResponse>;
24
- }
25
- export {};
@@ -1,94 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /*
5
- * Copyright (c) 2020, salesforce.com, inc.
6
- * All rights reserved.
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
9
- */
10
- const fs = require("fs");
11
- const command_1 = require("@salesforce/command");
12
- const core_1 = require("@salesforce/core");
13
- const fileWriter_1 = require("../../../lib/helpers/fileWriter");
14
- const validationUtil_1 = require("../../../lib/helpers/validationUtil");
15
- const templates_1 = require("../../../lib/templates/templates");
16
- // Initialize Messages with the current plugin directory
17
- core_1.Messages.importMessagesDirectory(__dirname);
18
- // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
19
- // or any library that is using the messages framework can also be loaded this way.
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
- };
41
- }
42
- }
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;
94
- //# sourceMappingURL=create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/force/cmdt/create.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAA4C;AAC5C,gEAA6D;AAC7D,wEAAsG;AACtG,gEAA6D;AAE7D,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,YAAY,CAAC,CAAC;AAQ3F,MAAqB,MAAO,SAAQ,qBAAW;IAyD7C,8DAA8D;IACvD,KAAK,CAAC,GAAG;;QACd,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAkB,CAAC,CAAC,uCAAuC;QACvF,MAAM,KAAK,GAAG,MAAC,IAAI,CAAC,KAAK,CAAC,KAAgB,mCAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,wEAAwE;QACrJ,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAoB,CAAC;QACnD,MAAM,WAAW,GAAG,MAAC,IAAI,CAAC,KAAK,CAAC,WAAsB,mCAAI,KAAK,CAAC;QAChE,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;QAClC,MAAM,UAAU,GAAG,IAAI,uBAAU,EAAE,CAAC;QAEpC,MAAM,SAAS,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;QAChF,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,SAAmB,EAAE,QAAQ,EAAE,SAAS,CAAC,C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U,CAAC,oCAAoC,CAAC;QAC1E,OAAO,EAAE,EAAE;KACZ,CAAC;CACH,CAAC;AAEe,sBAAe,GAAG,IAAI,CAAC"}
@@ -1,25 +0,0 @@
1
- import { flags, SfdxCommand } from '@salesforce/command';
2
- interface CmdtFieldCreateResponse {
3
- fieldName: string;
4
- label: string;
5
- fieldtype: string;
6
- }
7
- export default class Create extends SfdxCommand {
8
- static description: string;
9
- static longDescription: string;
10
- static examples: string[];
11
- static args: {
12
- name: string;
13
- }[];
14
- protected static flagsConfig: {
15
- fieldname: flags.Discriminated<flags.String>;
16
- fieldtype: flags.Discriminated<flags.Enum<string>>;
17
- picklistvalues: flags.Discriminated<flags.Array<string>>;
18
- decimalplaces: flags.Discriminated<flags.Number>;
19
- label: flags.Discriminated<flags.String>;
20
- outputdir: flags.Discriminated<flags.String>;
21
- };
22
- protected static requiresProject: boolean;
23
- run(): Promise<CmdtFieldCreateResponse>;
24
- }
25
- export {};
@@ -1,113 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /*
5
- * Copyright (c) 2020, salesforce.com, inc.
6
- * All rights reserved.
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
9
- */
10
- const fs = require("fs");
11
- const command_1 = require("@salesforce/command");
12
- const core_1 = require("@salesforce/core");
13
- const fileWriter_1 = require("../../../../lib/helpers/fileWriter");
14
- const validationUtil_1 = require("../../../../lib/helpers/validationUtil");
15
- const templates_1 = require("../../../../lib/templates/templates");
16
- // Initialize Messages with the current plugin directory
17
- core_1.Messages.importMessagesDirectory(__dirname);
18
- // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
19
- // or any library that is using the messages framework can also be loaded this way.
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'));
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
- };
45
- }
46
- }
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;
113
- //# sourceMappingURL=create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../src/commands/force/cmdt/field/create.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,iDAAyD;AACzD,2CAAqD;AACrD,mEAAgE;AAChE,2EAAyE;AACzE,mEAAgE;AAEhE,wDAAwD;AACxD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAE5C,iGAAiG;AACjG,mFAAmF;AACnF,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,aAAa,CAAC,CAAC;AAO5F,MAAqB,MAA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