@salesforce/plugin-sobject 1.0.9 → 1.1.1

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 (53) hide show
  1. package/README.md +12 -12
  2. package/lib/commands/schema/generate/field.d.ts +3 -1
  3. package/lib/commands/schema/generate/field.js +100 -126
  4. package/lib/commands/schema/generate/field.js.map +1 -1
  5. package/lib/commands/schema/generate/platformevent.js +17 -16
  6. package/lib/commands/schema/generate/platformevent.js.map +1 -1
  7. package/lib/commands/schema/generate/sobject.js +34 -31
  8. package/lib/commands/schema/generate/sobject.js.map +1 -1
  9. package/lib/shared/flags.js.map +1 -1
  10. package/lib/shared/prompts/apiName.d.ts +5 -0
  11. package/lib/shared/prompts/apiName.js +26 -0
  12. package/lib/shared/prompts/apiName.js.map +1 -0
  13. package/lib/shared/prompts/description.d.ts +3 -0
  14. package/lib/shared/prompts/description.js +15 -0
  15. package/lib/shared/prompts/description.js.map +1 -0
  16. package/lib/shared/prompts/directory.d.ts +3 -0
  17. package/lib/shared/prompts/directory.js +16 -0
  18. package/lib/shared/prompts/directory.js.map +1 -0
  19. package/lib/shared/prompts/fields/number.d.ts +4 -0
  20. package/lib/shared/prompts/fields/number.js +26 -0
  21. package/lib/shared/prompts/fields/number.js.map +1 -0
  22. package/lib/shared/prompts/fields/text.d.ts +2 -0
  23. package/lib/shared/prompts/fields/text.js +31 -0
  24. package/lib/shared/prompts/fields/text.js.map +1 -0
  25. package/lib/shared/prompts/functions.d.ts +8 -0
  26. package/lib/shared/prompts/functions.js +24 -0
  27. package/lib/shared/prompts/functions.js.map +1 -0
  28. package/lib/shared/prompts/nameField.d.ts +5 -0
  29. package/lib/shared/prompts/nameField.js +31 -0
  30. package/lib/shared/prompts/nameField.js.map +1 -0
  31. package/lib/shared/prompts/object.d.ts +8 -0
  32. package/lib/shared/prompts/object.js +23 -0
  33. package/lib/shared/prompts/object.js.map +1 -0
  34. package/lib/shared/prompts/picklist.d.ts +2 -0
  35. package/lib/shared/prompts/picklist.js +31 -0
  36. package/lib/shared/prompts/picklist.js.map +1 -0
  37. package/lib/shared/prompts/plural.d.ts +3 -0
  38. package/lib/shared/prompts/plural.js +15 -0
  39. package/lib/shared/prompts/plural.js.map +1 -0
  40. package/lib/shared/prompts/relationshipField.js +43 -55
  41. package/lib/shared/prompts/relationshipField.js.map +1 -1
  42. package/lib/shared/types.d.ts +1 -8
  43. package/messages/generate.event.md +4 -0
  44. package/messages/generate.object.md +9 -9
  45. package/messages/prompts.shared.md +3 -3
  46. package/oclif.lock +186 -75
  47. package/oclif.manifest.json +2 -6
  48. package/package.json +10 -8
  49. package/schemas/schema-generate-field.json +15 -0
  50. package/schemas/schema-generate-sobject.json +17 -14
  51. package/lib/shared/prompts/prompts.d.ts +0 -28
  52. package/lib/shared/prompts/prompts.js +0 -123
  53. package/lib/shared/prompts/prompts.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import input from '@inquirer/input';
8
+ import { Messages } from '@salesforce/core';
9
+ import { makeNameApiCompatible } from './functions.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ export const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.shared');
12
+ export const apiNamePrompt = async (label, objectType) => input({
13
+ message: messages.getMessage('apiName', [getSuffix(objectType)]),
14
+ validate: (i) => i.endsWith(getSuffix(objectType)) ? true : messages.getMessage('apiName', [getSuffix(objectType)]),
15
+ default: `${makeNameApiCompatible(label)}${getSuffix(objectType)}`,
16
+ });
17
+ const getSuffix = (objectType) => {
18
+ switch (objectType) {
19
+ case 'CustomObject':
20
+ case 'CustomField':
21
+ return '__c';
22
+ case 'PlatformEvent':
23
+ return '__e';
24
+ }
25
+ };
26
+ //# sourceMappingURL=apiName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiName.js","sourceRoot":"","sources":["../../../src/shared/prompts/apiName.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,KAAa,EAAE,UAAsB,EAAmB,EAAE,CAC5F,KAAK,CAAC;IACJ,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAChE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CACd,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACpG,OAAO,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,EAAE;CACnE,CAAC,CAAC;AAEL,MAAM,SAAS,GAAG,CAAC,UAAsB,EAAU,EAAE;IACnD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,cAAc,CAAC;QACpB,KAAK,aAAa;YAChB,OAAO,KAAK,CAAC;QACf,KAAK,eAAe;YAClB,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Messages } from '@salesforce/core';
2
+ export declare const messages: Messages<string>;
3
+ export declare const descriptionPrompt: () => Promise<string>;
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { Messages } from '@salesforce/core';
8
+ import input from '@inquirer/input';
9
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
10
+ export const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.shared');
11
+ export const descriptionPrompt = async () => input({
12
+ message: messages.getMessage('description'),
13
+ validate: (i) => (i.length ? true : messages.getMessage('error.noDescription')),
14
+ });
15
+ //# sourceMappingURL=description.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"description.js","sourceRoot":"","sources":["../../../src/shared/prompts/description.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,MAAM,iBAAiB,CAAC;AAEpC,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,IAAqB,EAAE,CAC3D,KAAK,CAAC;IACJ,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC;IAC3C,QAAQ,EAAE,CAAC,CAAS,EAAiB,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;CACvG,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type NamedPackageDir, Messages } from '@salesforce/core';
2
+ export declare const messages: Messages<string>;
3
+ export declare const directoryPrompt: (packageDirs: NamedPackageDir[]) => Promise<string>;
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { Messages } from '@salesforce/core';
8
+ import select from '@inquirer/select';
9
+ import { getDirectoriesThatContainObjects } from '../fs.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ export const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.shared');
12
+ export const directoryPrompt = async (packageDirs) => select({
13
+ message: messages.getMessage('directory'),
14
+ choices: (await getDirectoriesThatContainObjects(packageDirs.map((pd) => pd.path))).map((dir) => ({ value: dir })),
15
+ });
16
+ //# sourceMappingURL=directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../../src/shared/prompts/directory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAwB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAE5D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,WAA8B,EAAmB,EAAE,CACvF,MAAM,CAAC;IACL,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;IACzC,OAAO,EAAE,CAAC,MAAM,gCAAgC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;CACnH,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Messages } from '@salesforce/core';
2
+ export declare const messages: Messages<string>;
3
+ export declare const precisionPrompt: (type: string, scale: number | undefined) => Promise<number | undefined>;
4
+ export declare const scalePrompt: (type: string) => Promise<number | undefined>;
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import input from '@inquirer/input';
8
+ import { Messages } from '@salesforce/core';
9
+ import { integerValidation } from '../functions.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ export const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'generate.field');
12
+ export const precisionPrompt = async (type, scale) => type === 'Number' || type === 'Currency'
13
+ ? Number(await input({
14
+ message: messages.getMessage('prompts.precision'),
15
+ validate: integerValidation({ min: 1, max: 18 - (scale ?? 0) }),
16
+ default: (18 - (scale ?? 0)).toString(),
17
+ }))
18
+ : undefined;
19
+ export const scalePrompt = async (type) => type === 'Number' || type === 'Currency' || type === 'Location'
20
+ ? Number(await input({
21
+ message: messages.getMessage('prompts.scale'),
22
+ validate: integerValidation({ min: 0, max: 18 }),
23
+ default: '0',
24
+ }))
25
+ : undefined;
26
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../src/shared/prompts/fields/number.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5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promise<number | undefined>;
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import input from '@inquirer/input';
8
+ import { integerValidation } from '../functions.js';
9
+ const MAX_LONG_TEXT_LENGTH = 131072;
10
+ const MAX_TEXT_LENGTH = 255;
11
+ export const lengthPrompt = async (type) => type === 'Text'
12
+ ? Number(await input({
13
+ message: `Length (max ${MAX_TEXT_LENGTH})`,
14
+ default: MAX_TEXT_LENGTH.toString(),
15
+ validate: integerValidation({ min: 1, max: MAX_TEXT_LENGTH }),
16
+ }))
17
+ : type === 'Html' || type === 'LongTextArea'
18
+ ? Number(await input({
19
+ message: `Length (max ${MAX_LONG_TEXT_LENGTH})`,
20
+ default: MAX_LONG_TEXT_LENGTH.toString(),
21
+ validate: integerValidation({ min: 1, max: MAX_LONG_TEXT_LENGTH }),
22
+ }))
23
+ : undefined;
24
+ export const visibleLinePrompt = async (type) => type === 'Html' || type === 'LongTextArea'
25
+ ? Number(await input({
26
+ message: 'Visible Lines',
27
+ validate: integerValidation({ min: 1, max: 1000 }),
28
+ default: '5',
29
+ }))
30
+ : undefined;
31
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../src/shared/prompts/fields/text.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,IAAY,EAA+B,EAAE,CAC9E,IAAI,KAAK,MAAM;IACb,CAAC,CAAC,MAAM,CACJ,MAAM,KAAK,CAAC;QACV,OAAO,EAAE,eAAe,eAAe,GAAG;QAC1C,OAAO,EAAE,eAAe,CAAC,QAAQ,EAAE;QACnC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC;KAC9D,CAAC,CACH;IACH,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,cAAc;QAC5C,CAAC,CAAC,MAAM,CACJ,MAAM,KAAK,CAAC;YACV,OAAO,EAAE,eAAe,oBAAoB,GAAG;YAC/C,OAAO,EAAE,oBAAoB,CAAC,QAAQ,EAAE;YACxC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,oBAAoB,EAAE,CAAC;SACnE,CAAC,CACH;QACH,CAAC,CAAC,SAAS,CAAC;AAEhB,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAY,EAA+B,EAAE,CACnF,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,cAAc;IACxC,CAAC,CAAC,MAAM,CACJ,MAAM,KAAK,CAAC;QACV,OAAO,EAAE,eAAe;QACxB,QAAQ,EAAE,iBAAiB,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QAClD,OAAO,EAAE,GAAG;KACb,CAAC,CACH;IACH,CAAC,CAAC,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const makeNameApiCompatible: (input: string) => string;
2
+ export declare const integerValidation: ({ min, max }: {
3
+ min: number;
4
+ max: number;
5
+ }) => (input: string) => true | string;
6
+ export declare const toSelectOption: <T extends string>(s: T) => {
7
+ value: T;
8
+ };
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { messages } from './nameField.js';
8
+ /*
9
+ * Copyright (c) 2023, salesforce.com, inc.
10
+ * All rights reserved.
11
+ * Licensed under the BSD 3-Clause license.
12
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
13
+ */
14
+ export const makeNameApiCompatible = (input) => input.replace(/ /g, '').replace(/-/g, '_').replace(/_{2,}/g, '_');
15
+ export const integerValidation = ({ min, max }) => (input) => {
16
+ const value = Number(input);
17
+ if (value < min)
18
+ return messages.getMessage('numberValidationMin', [value, min]);
19
+ if (value > max)
20
+ return messages.getMessage('numberValidationMax', [value, max]);
21
+ return true;
22
+ };
23
+ export const toSelectOption = (s) => ({ value: s });
24
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/shared/prompts/functions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAU,EAAE,CAC7D,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,iBAAiB,GAC5B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAgC,EAAE,EAAE,CAC/C,CAAC,KAAa,EAAiB,EAAE;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,KAAK,GAAG,GAAG;QAAE,OAAO,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACjF,IAAI,KAAK,GAAG,GAAG;QAAE,OAAO,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACjF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,cAAc,GAAG,CAAmB,CAAI,EAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Messages } from '@salesforce/core';
2
+ import { NameField } from '../types.js';
3
+ export declare const messages: Messages<string>;
4
+ /** Ask about the name/type for the Name field, with a followup for AutoNumber format if AutoNumber is chosen */
5
+ export declare const nameFieldPrompts: (objectLabel: string) => Promise<NameField>;
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright (c) 2020, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { Messages } from '@salesforce/core';
8
+ import input from '@inquirer/input';
9
+ import select from '@inquirer/select';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ export const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.shared');
12
+ /** Ask about the name/type for the Name field, with a followup for AutoNumber format if AutoNumber is chosen */
13
+ export const nameFieldPrompts = async (objectLabel) => {
14
+ const label = await input({
15
+ message: messages.getMessage('nameFieldPrompts.label'),
16
+ default: `${objectLabel} Name`,
17
+ });
18
+ const type = await select({
19
+ message: messages.getMessage('nameFieldPrompts.type'),
20
+ default: 'Text',
21
+ choices: [{ value: 'Text' }, { value: 'AutoNumber' }],
22
+ });
23
+ const displayFormat = type === 'AutoNumber'
24
+ ? await input({
25
+ message: messages.getMessage('nameFieldPrompts.autoNumberFormat'),
26
+ default: `${objectLabel}-{0}`,
27
+ })
28
+ : undefined;
29
+ return { label, type, ...(type === 'AutoNumber' ? { displayFormat } : {}) };
30
+ };
31
+ //# sourceMappingURL=nameField.js.map
@@ -0,0 +1 @@
1
+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CAAC;AAC9E,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Messages, type NamedPackageDir } from '@salesforce/core';
2
+ export declare const messages: Messages<string>;
3
+ /**
4
+ *
5
+ * @param packageDirs
6
+ * @param message The message key
7
+ */
8
+ export declare const objectPrompt: (packageDirs: NamedPackageDir[], message?: string) => Promise<string>;
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import select from '@inquirer/select';
8
+ import { Messages } from '@salesforce/core';
9
+ import { getObjectDirectories } from '../fs.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ export const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.shared');
12
+ /**
13
+ *
14
+ * @param packageDirs
15
+ * @param message The message key
16
+ */
17
+ export const objectPrompt = async (packageDirs, message = messages.getMessage('object')) => select({
18
+ message,
19
+ choices: (await getObjectDirectories(packageDirs.map((pd) => pd.path)))
20
+ .sort()
21
+ .map((objDir) => ({ value: objDir, name: objDir.split('/').pop() })),
22
+ });
23
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/shared/prompts/object.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAwB,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;AAE9F;;;;GAIG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,WAA8B,EAC9B,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EACtB,EAAE,CACnB,MAAM,CAAC;IACL,OAAO;IACP,OAAO,EAAE,CAAC,MAAM,oBAAoB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;SACpE,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;CACvE,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ValueSet, CustomValue } from 'jsforce/api/metadata';
2
+ export declare const picklistPrompts: (soFar?: CustomValue[]) => Promise<Omit<ValueSet, 'valueSettings'>>;
@@ -0,0 +1,31 @@
1
+ import input from '@inquirer/input';
2
+ import { Messages } from '@salesforce/core';
3
+ /**
4
+ * recursively keep adding picklist values until the user says to stop
5
+ */
6
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
7
+ const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.shared');
8
+ export const picklistPrompts = async (soFar = []) => {
9
+ const newItem = await input({
10
+ validate: (i) => (soFar.find((v) => v.fullName === i) ? `${i} already exists` : true),
11
+ message: soFar.length === 0 ? messages.getMessage('picklist.first') : messages.getMessage('picklist.additional'),
12
+ });
13
+ return newItem === undefined || newItem === ''
14
+ ? // we're done adding items, return a ValueSet
15
+ {
16
+ valueSetDefinition: {
17
+ value: soFar,
18
+ sorted: true,
19
+ },
20
+ }
21
+ : // recurse to add another item
22
+ picklistPrompts([
23
+ ...soFar,
24
+ {
25
+ fullName: newItem,
26
+ label: newItem,
27
+ default: soFar.length === 0,
28
+ },
29
+ ]);
30
+ };
31
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AK,CAAC;iBAC5B;aACF,CAAC,CAAC;AACT,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Messages } from '@salesforce/core';
2
+ export declare const messages: Messages<string>;
3
+ export declare const pluralPrompt: (label: string) => Promise<string>;
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (c) 2023, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import input from '@inquirer/input';
8
+ import { Messages } from '@salesforce/core';
9
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
10
+ export const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.shared');
11
+ export const pluralPrompt = async (label) => input({
12
+ message: messages.getMessage('pluralLabel'),
13
+ default: `${label}s`,
14
+ });
15
+ //# sourceMappingURL=plural.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural.js","sourceRoot":"","sources":["../../../src/shared/prompts/plural.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,KAAa,EAAmB,EAAE,CACnE,KAAK,CAAC;IACJ,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC;IAC3C,OAAO,EAAE,GAAG,KAAK,GAAG;CACrB,CAAC,CAAC"}
@@ -5,71 +5,59 @@
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
7
  import path from 'node:path';
8
+ import input from '@inquirer/input';
9
+ import confirm from '@inquirer/confirm';
10
+ import select from '@inquirer/select';
8
11
  import { Messages } from '@salesforce/core';
9
- import { Prompter } from '@salesforce/sf-plugins-core';
10
12
  import { getObjectXmlByFolderAsJson } from '../fs.js';
11
- import { objectPrompt, makeNameApiCompatible } from './prompts.js';
13
+ import { objectPrompt } from './object.js';
14
+ import { makeNameApiCompatible } from './functions.js';
12
15
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
13
16
  const messages = Messages.loadMessages('@salesforce/plugin-sobject', 'prompts.relationship');
14
17
  export const relationshipFieldPrompts = async ({ type, packageDirs, childObjectFolderPath, }) => {
15
- const prompter = new Prompter();
16
18
  const childObjectXml = await getObjectXmlByFolderAsJson(childObjectFolderPath);
17
- const response = await prompter.prompt([
18
- // prompt the user to select from objects in local source
19
- await objectPrompt(packageDirs, 'referenceTo', messages.getMessage('objectPrompt')),
20
- {
21
- type: 'input',
22
- name: 'relationshipLabel',
23
- message: 'Relationship label',
24
- default: childObjectXml.pluralLabel,
25
- },
26
- {
27
- type: 'input',
28
- name: 'relationshipName',
29
- message: 'Relationship name',
30
- default: (answers) => answers.relationshipLabel ? makeNameApiCompatible(answers.relationshipLabel) : undefined,
31
- },
32
- // lookup-only
19
+ const relationshipLabel = await input({
20
+ message: 'Relationship label',
21
+ ...(childObjectXml.pluralLabel ? { default: childObjectXml.pluralLabel } : {}),
22
+ });
23
+ const relationshipName = await input({
24
+ message: 'Relationship name',
25
+ default: makeNameApiCompatible(relationshipLabel),
26
+ });
27
+ return {
28
+ referenceTo: (await objectPrompt(packageDirs, messages.getMessage('objectPrompt'))).split(path.sep).pop(),
29
+ relationshipLabel,
30
+ relationshipName,
31
+ ...(type === 'Lookup' ? { deleteConstraint: await deleteConstraintPrompt() } : {}),
32
+ ...(type === 'MasterDetail' ? await masterDetailPrompts() : {}),
33
+ };
34
+ };
35
+ const masterDetailPrompts = async () => ({
36
+ reparentableMasterDetail: await confirm({
37
+ message: messages.getMessage('reparentableMasterDetail'),
38
+ default: false,
39
+ }),
40
+ writeRequiresMasterRead: await confirm({
41
+ message: messages.getMessage('writeRequiresMasterRead'),
42
+ default: false,
43
+ }),
44
+ });
45
+ const deleteConstraintPrompt = async () => select({
46
+ message: messages.getMessage('lookupDeleteConstraint'),
47
+ default: 'setNull',
48
+ choices: [
33
49
  {
34
- type: 'list',
35
- name: 'deleteConstraint',
36
- message: messages.getMessage('lookupDeleteConstraint'),
37
- when: type === 'Lookup',
38
- default: 'SetNull',
39
- choices: [
40
- {
41
- value: 'SetNull',
42
- name: messages.getMessage('lookupDeleteConstraint.setNull'),
43
- },
44
- {
45
- value: 'Restrict',
46
- name: messages.getMessage('lookupDeleteConstraint.restrict'),
47
- },
48
- {
49
- value: 'Cascade',
50
- name: messages.getMessage('lookupDeleteConstraint.cascade'),
51
- },
52
- ],
50
+ value: 'SetNull',
51
+ name: messages.getMessage('lookupDeleteConstraint.setNull'),
53
52
  },
54
- // master-detail only
55
53
  {
56
- type: 'confirm',
57
- name: 'reparentableMasterDetail',
58
- message: messages.getMessage('reparentableMasterDetail'),
59
- when: type === 'MasterDetail',
60
- default: false,
54
+ value: 'Restrict',
55
+ name: messages.getMessage('lookupDeleteConstraint.restrict'),
61
56
  },
62
57
  {
63
- type: 'confirm',
64
- name: 'writeRequiresMasterRead',
65
- message: messages.getMessage('writeRequiresMasterRead'),
66
- when: type === 'MasterDetail',
67
- default: false,
58
+ value: 'Cascade',
59
+ name: messages.getMessage('lookupDeleteConstraint.cascade'),
68
60
  },
69
- ]);
70
- return {
71
- ...response,
72
- referenceTo: response.referenceTo?.split(path.sep).pop(),
73
- };
74
- };
61
+ ],
62
+ });
75
63
  //# sourceMappingURL=relationshipField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"relationshipField.js","sourceRoot":"","sources":["../../../src/shared/prompts/relationshipField.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,WAAW,CA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CAAC,UAAU,CAAC,wBAAwB,CAAC;YACtD,IAAI,EAAE,IAAI,KAAK,QAAQ;YACvB,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE;gBACP;oBACE,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,gCAAgC,CAAC;iBAC5D;gBACD;oBACE,KAAK,EAAE,UAAU;oBACjB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,iCAAiC,CAAC;iBAC7D;gBACD;oBACE,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,gCAAgC,CAAC;iBAC5D;aACF;SACF;QACD,qBAAqB;QACrB;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,0BAA0B;YAChC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;YACxD,IAAI,EAAE,IAAI,KAAK,cAAc;YAC7B,OAAO,EAAE,KAAK;SACf;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;YACvD,IAAI,EAAE,IAAI,KAAK,cAAc;YAC7B,OAAO,EAAE,KAAK;SACf;KACF,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,QAAQ;QACX,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;KACzD,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"relationshipField.js","sourceRoot":"","sources":["../../../src/shared/prompts/relationshipField.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,QAA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AAI,KAAK,cAAc,CAAC,CAAC,CAAC,MAAM,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,KAAK,IAE/B,EAAE,CAAC,CAAC;IACJ,wBAAwB,EAAE,MAAM,OAAO,CAAC;QACtC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;QACxD,OAAO,EAAE,KAAK;KACf,CAAC;IACF,uBAAuB,EAAE,MAAM,OAAO,CAAC;QACrC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC;QACvD,OAAO,EAAE,KAAK;KACf,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,KAAK,IAAqB,EAAE,CACzD,MAAM,CAAC;IACL,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;IACtD,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE;QACP;YACE,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,gCAAgC,CAAC;SAC5D;QACD;YACE,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,iCAAiC,CAAC;SAC7D;QACD;YACE,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,gCAAgC,CAAC;SAC5D;KACF;CACF,CAAC,CAAC"}
@@ -1,12 +1,6 @@
1
1
  import type { CustomObject, CustomField } from 'jsforce/api/metadata';
2
- /** Used to capture the types for NameField in the inquirer prompts */
3
- export type NameFieldResponse = {
4
- nameFieldType: 'Text' | 'AutoNumber';
5
- nameFieldLabel: 'string';
6
- autoNumberFormat?: string;
7
- };
8
2
  /** Used by classical CustomObject */
9
- type NameField = Pick<CustomField, 'label' | 'type' | 'displayFormat'>;
3
+ export type NameField = Pick<CustomField, 'label' | 'type' | 'displayFormat'>;
10
4
  /**
11
5
  * There are a lot of properties that we don't, and some that jsforce thinks are mandatory that aren't.
12
6
  * Many apply to the various sub-species (mdt, external, events)
@@ -22,4 +16,3 @@ type NameField = Pick<CustomField, 'label' | 'type' | 'displayFormat'>;
22
16
  export type SaveableCustomObject = Pick<CustomObject, 'label' | 'deploymentStatus' | 'description' | 'enableHistory' | 'enableActivities' | 'enableBulkApi' | 'enableFeeds' | 'enableReports' | 'enableSearch' | 'enableStreamingApi' | 'enableSharing' | 'pluralLabel' | 'sharingModel' | 'fullName'> & {
23
17
  nameField: NameField;
24
18
  };
25
- export {};
@@ -19,3 +19,7 @@ The platform event's label.
19
19
  # prompts.publishBehavior
20
20
 
21
21
  Do you want platform events to publish after a transaction completes, or immediately?
22
+
23
+ # success.field
24
+
25
+ Run this command to add a field to your event: sf schema generate field --object %s --label "Your Field"
@@ -22,14 +22,14 @@ Enable all optional features without prompting.
22
22
 
23
23
  Enables these features:
24
24
 
25
- * Search: Allows users to find the custom object's records when they search, including SOSL.
26
- * Feeds: Enables feed tracking.
27
- * Reports: Allows reporting of the data in the custom object records.
28
- * History: Enables object history tracking.
29
- * Activities: Allows users to associate tasks and scheduled calendar events related to the custom object records.
30
- * Bulk API: With Sharing and Streaming API, classifies the custom object as an Enterprise Application object.
31
- * Sharing: With Bulk API and Streaming API, classifies the custom object as an Enterprise Application object.
32
- * Streaming API: With Bulk API and Sharing, classifies the custom object as an Enterprise Application object.
25
+ - Search: Allows users to find the custom object's records when they search, including SOSL.
26
+ - Feeds: Enables feed tracking.
27
+ - Reports: Allows reporting of the data in the custom object records.
28
+ - History: Enables object history tracking.
29
+ - Activities: Allows users to associate tasks and scheduled calendar events related to the custom object records.
30
+ - Bulk API: With Sharing and Streaming API, classifies the custom object as an Enterprise Application object.
31
+ - Sharing: With Bulk API and Streaming API, classifies the custom object as an Enterprise Application object.
32
+ - Streaming API: With Bulk API and Sharing, classifies the custom object as an Enterprise Application object.
33
33
 
34
34
  # examples
35
35
 
@@ -51,7 +51,7 @@ The first time you deploy your new custom object to a source-tracking org, the o
51
51
 
52
52
  # success.field
53
53
 
54
- Run this command to add a field to your object: sf generate metadata field --object %s --label "Your Field"
54
+ Run this command to add a field to your object: sf schema generate field --object %s --label "Your Field"
55
55
 
56
56
  # prompts.sharingModel
57
57
 
@@ -8,11 +8,11 @@ Plural label:
8
8
 
9
9
  # apiName
10
10
 
11
- API name (custom objects and fields must end in "__c" and platform events in "__e"):
11
+ API name (must end in %s)
12
12
 
13
13
  # description
14
14
 
15
- Description (great developers write great descriptions):
15
+ Description (great developers write great descriptions):
16
16
 
17
17
  # error.noDescription
18
18
 
@@ -36,7 +36,7 @@ Which object is this new field for?
36
36
 
37
37
  # picklist.first
38
38
 
39
- Enter the first picklist value, which will also be the default:
39
+ Enter the first picklist value, which will also be the default:
40
40
 
41
41
  # picklist.additional
42
42