@salesforce/plugin-deploy-retrieve 3.7.10 → 3.8.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.
package/README.md CHANGED
@@ -64,6 +64,7 @@ sf plugins
64
64
 
65
65
  - [`sf project convert mdapi`](#sf-project-convert-mdapi)
66
66
  - [`sf project convert source`](#sf-project-convert-source)
67
+ - [`sf project convert source-behavior`](#sf-project-convert-source-behavior)
67
68
  - [`sf project delete source`](#sf-project-delete-source)
68
69
  - [`sf project delete tracking`](#sf-project-delete-tracking)
69
70
  - [`sf project deploy cancel`](#sf-project-deploy-cancel)
@@ -140,7 +141,7 @@ FLAG DESCRIPTIONS
140
141
  If you specify this parameter, don’t specify --metadata or --source-dir.
141
142
  ```
142
143
 
143
- _See code: [src/commands/project/convert/mdapi.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/convert/mdapi.ts)_
144
+ _See code: [src/commands/project/convert/mdapi.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/convert/mdapi.ts)_
144
145
 
145
146
  ## `sf project convert source`
146
147
 
@@ -152,7 +153,7 @@ USAGE
152
153
  [-p <value> | -x <value> | -m <value>]
153
154
 
154
155
  FLAGS
155
- -d, --output-dir=<value> [default: metadataPackage_1716916326517] Output directory to store the Metadata
156
+ -d, --output-dir=<value> [default: metadataPackage_1716992749510] Output directory to store the Metadata
156
157
  API–formatted files in.
157
158
  -m, --metadata=<value>... Metadata component names to convert.
158
159
  -n, --package-name=<value> Name of the package to associate with the metadata-formatted files.
@@ -213,7 +214,64 @@ FLAG DESCRIPTIONS
213
214
  Override the api version used for api requests made by this command
214
215
  ```
215
216
 
216
- _See code: [src/commands/project/convert/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/convert/source.ts)_
217
+ _See code: [src/commands/project/convert/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/convert/source.ts)_
218
+
219
+ ## `sf project convert source-behavior`
220
+
221
+ Enable a behavior of your project source files, and then update your Salesforce DX project to implement the behavior.
222
+
223
+ ```
224
+ USAGE
225
+ $ sf project convert source-behavior -b
226
+ decomposeCustomLabelsBeta|decomposePermissionSetBeta|decomposeSharingRulesBeta|decomposeWorkflowBeta [--json]
227
+ [--flags-dir <value>] [--dry-run] [--preserve-temp-dir] [-o <value>]
228
+
229
+ FLAGS
230
+ -b, --behavior=<option> (required) Behavior to enable; the values correspond to the possible values of the
231
+ "sourceBehaviorOption" option in the "sfdx-project.json" file.
232
+ <options: decomposeCustomLabelsBeta|decomposePermissionSetBeta|decomposeSharingRulesBeta|dec
233
+ omposeWorkflowBeta>
234
+ -o, --target-org=<value>
235
+ --dry-run Display what the command would do, but don't make any actual changes.
236
+ --preserve-temp-dir Don't delete the metadata API format temporary directory that this command creates. Useful
237
+ for debugging.
238
+
239
+ GLOBAL FLAGS
240
+ --flags-dir=<value> Import flag values from a directory.
241
+ --json Format output as json.
242
+
243
+ DESCRIPTION
244
+ Enable a behavior of your project source files, and then update your Salesforce DX project to implement the behavior.
245
+
246
+ Specifically, this command updates the "sourceBehaviorOption" option in the "sfdx-project.json" file and then converts
247
+ the associated local source files in your project as needed.
248
+
249
+ For example, run this command with the "--behavior decomposePermissionSetBeta" flag to start decomposing permission
250
+ sets when you deploy or retrieve them. Decomposing means breaking up the monolithic metadata API format XML file that
251
+ corresponds to a metadata component into smaller XML files and directories based on its subtypes. Permission sets are
252
+ not decomposed by default; you must opt-in to start decomposing them by using this command. When the command finishes,
253
+ your "sfdx-project.json" file is updated to always decompose permission sets, and the existing permission set files in
254
+ your local package directories are converted into the new decomposed format. You run this command only once for a
255
+ given behavior change.
256
+
257
+ For more information about the possible values for the --behavior flag, see the "sourceBehaviorOptions" section in the
258
+ https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm topic.
259
+
260
+ EXAMPLES
261
+ Update your Salesforce DX project to decompose custom labels:
262
+
263
+ $ sf project convert source-behavior --behavior decomposeCustomLabelsBeta
264
+
265
+ Display what the command would do, but don't change any existing files:
266
+
267
+ $ sf project convert source-behavior --behavior decomposeCustomLabelsBeta --dry-run
268
+
269
+ Keep the temporary directory that contains the interim metadata API formatted files:
270
+
271
+ $ sf project convert source-behavior --behavior decomposeCustomLabelsBeta --dry-run --preserve-temp-dir
272
+ ```
273
+
274
+ _See code: [src/commands/project/convert/source-behavior.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/convert/source-behavior.ts)_
217
275
 
218
276
  ## `sf project delete source`
219
277
 
@@ -353,7 +411,7 @@ FLAG DESCRIPTIONS
353
411
  - Separate the test names with spaces: --tests Test1 Test2 "Test With Space"
354
412
  ```
355
413
 
356
- _See code: [src/commands/project/delete/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/delete/source.ts)_
414
+ _See code: [src/commands/project/delete/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/delete/source.ts)_
357
415
 
358
416
  ## `sf project delete tracking`
359
417
 
@@ -390,7 +448,7 @@ EXAMPLES
390
448
  $ sf project delete tracking --target-org my-scratch
391
449
  ```
392
450
 
393
- _See code: [src/commands/project/delete/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/delete/tracking.ts)_
451
+ _See code: [src/commands/project/delete/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/delete/tracking.ts)_
394
452
 
395
453
  ## `sf project deploy cancel`
396
454
 
@@ -466,7 +524,7 @@ FLAG DESCRIPTIONS
466
524
  project deploy report".
467
525
  ```
468
526
 
469
- _See code: [src/commands/project/deploy/cancel.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/deploy/cancel.ts)_
527
+ _See code: [src/commands/project/deploy/cancel.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/deploy/cancel.ts)_
470
528
 
471
529
  ## `sf project deploy preview`
472
530
 
@@ -552,7 +610,7 @@ FLAG DESCRIPTIONS
552
610
  All child components are included. If you specify this flag, don’t specify --metadata or --source-dir.
553
611
  ```
554
612
 
555
- _See code: [src/commands/project/deploy/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/deploy/preview.ts)_
613
+ _See code: [src/commands/project/deploy/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/deploy/preview.ts)_
556
614
 
557
615
  ## `sf project deploy quick`
558
616
 
@@ -640,7 +698,7 @@ FLAG DESCRIPTIONS
640
698
  deploy report".
641
699
  ```
642
700
 
643
- _See code: [src/commands/project/deploy/quick.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/deploy/quick.ts)_
701
+ _See code: [src/commands/project/deploy/quick.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/deploy/quick.ts)_
644
702
 
645
703
  ## `sf project deploy report`
646
704
 
@@ -736,7 +794,7 @@ FLAG DESCRIPTIONS
736
794
  --coverage-formatters lcov --coverage-formatters clover
737
795
  ```
738
796
 
739
- _See code: [src/commands/project/deploy/report.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/deploy/report.ts)_
797
+ _See code: [src/commands/project/deploy/report.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/deploy/report.ts)_
740
798
 
741
799
  ## `sf project deploy resume`
742
800
 
@@ -821,7 +879,7 @@ FLAG DESCRIPTIONS
821
879
  --coverage-formatters lcov --coverage-formatters clover
822
880
  ```
823
881
 
824
- _See code: [src/commands/project/deploy/resume.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/deploy/resume.ts)_
882
+ _See code: [src/commands/project/deploy/resume.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/deploy/resume.ts)_
825
883
 
826
884
  ## `sf project deploy start`
827
885
 
@@ -1042,7 +1100,7 @@ FLAG DESCRIPTIONS
1042
1100
  --coverage-formatters lcov --coverage-formatters clover
1043
1101
  ```
1044
1102
 
1045
- _See code: [src/commands/project/deploy/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/deploy/start.ts)_
1103
+ _See code: [src/commands/project/deploy/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/deploy/start.ts)_
1046
1104
 
1047
1105
  ## `sf project deploy validate`
1048
1106
 
@@ -1217,7 +1275,7 @@ FLAG DESCRIPTIONS
1217
1275
  --coverage-formatters lcov --coverage-formatters clover
1218
1276
  ```
1219
1277
 
1220
- _See code: [src/commands/project/deploy/validate.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/deploy/validate.ts)_
1278
+ _See code: [src/commands/project/deploy/validate.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/deploy/validate.ts)_
1221
1279
 
1222
1280
  ## `sf project generate manifest`
1223
1281
 
@@ -1294,7 +1352,7 @@ EXAMPLES
1294
1352
  $ sf project generate manifest --from-org test@myorg.com --include-packages unlocked
1295
1353
  ```
1296
1354
 
1297
- _See code: [src/commands/project/generate/manifest.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/generate/manifest.ts)_
1355
+ _See code: [src/commands/project/generate/manifest.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/generate/manifest.ts)_
1298
1356
 
1299
1357
  ## `sf project list ignored`
1300
1358
 
@@ -1336,7 +1394,7 @@ EXAMPLES
1336
1394
  $ sf project list ignored --source-dir package.xml
1337
1395
  ```
1338
1396
 
1339
- _See code: [src/commands/project/list/ignored.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/list/ignored.ts)_
1397
+ _See code: [src/commands/project/list/ignored.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/list/ignored.ts)_
1340
1398
 
1341
1399
  ## `sf project reset tracking`
1342
1400
 
@@ -1385,7 +1443,7 @@ EXAMPLES
1385
1443
  $ sf project reset tracking --revision 30
1386
1444
  ```
1387
1445
 
1388
- _See code: [src/commands/project/reset/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/reset/tracking.ts)_
1446
+ _See code: [src/commands/project/reset/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/reset/tracking.ts)_
1389
1447
 
1390
1448
  ## `sf project retrieve preview`
1391
1449
 
@@ -1442,7 +1500,7 @@ FLAG DESCRIPTIONS
1442
1500
  Overrides your default org.
1443
1501
  ```
1444
1502
 
1445
- _See code: [src/commands/project/retrieve/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/retrieve/preview.ts)_
1503
+ _See code: [src/commands/project/retrieve/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/retrieve/preview.ts)_
1446
1504
 
1447
1505
  ## `sf project retrieve start`
1448
1506
 
@@ -1593,6 +1651,6 @@ FLAG DESCRIPTIONS
1593
1651
  If you specify this parameter, don’t specify --metadata or --source-dir.
1594
1652
  ```
1595
1653
 
1596
- _See code: [src/commands/project/retrieve/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.7.10/src/commands/project/retrieve/start.ts)_
1654
+ _See code: [src/commands/project/retrieve/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3.8.0/src/commands/project/retrieve/start.ts)_
1597
1655
 
1598
1656
  <!-- commandsstop -->
@@ -0,0 +1,21 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { PRESETS_PROP } from '../../../utils/convertBehavior.js';
3
+ export type SourceBehaviorResult = {
4
+ [PRESETS_PROP]: string[];
5
+ deletedFiles: string[];
6
+ createdFiles: string[];
7
+ };
8
+ export default class ConvertSourceBehavior extends SfCommand<SourceBehaviorResult> {
9
+ static readonly summary: string;
10
+ static readonly description: string;
11
+ static readonly examples: string[];
12
+ static readonly state = "beta";
13
+ static readonly requiresProject = true;
14
+ static readonly flags: {
15
+ behavior: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
16
+ 'dry-run': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
17
+ 'preserve-temp-dir': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
18
+ 'target-org': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
19
+ };
20
+ run(): Promise<SourceBehaviorResult>;
21
+ }
@@ -0,0 +1,74 @@
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 { rm, readFile, writeFile } from 'node:fs/promises';
8
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
9
+ import { Messages } from '@salesforce/core';
10
+ import { getValidatedProjectJson, TMP_DIR, convertToMdapi, DRY_RUN_DIR, PRESETS_PROP, PRESET_CHOICES, getPackageDirectoriesForPreset, convertBackToSource, } from '../../../utils/convertBehavior.js';
11
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
12
+ const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'convert.source-behavior');
13
+ export default class ConvertSourceBehavior extends SfCommand {
14
+ static summary = messages.getMessage('summary');
15
+ static description = messages.getMessage('description');
16
+ static examples = messages.getMessages('examples');
17
+ static state = 'beta';
18
+ static requiresProject = true;
19
+ static flags = {
20
+ behavior: Flags.option({
21
+ summary: messages.getMessage('flags.behavior.summary'),
22
+ char: 'b',
23
+ required: true,
24
+ options: PRESET_CHOICES,
25
+ })(),
26
+ 'dry-run': Flags.boolean({
27
+ summary: messages.getMessage('flags.dry-run.summary'),
28
+ }),
29
+ 'preserve-temp-dir': Flags.boolean({
30
+ summary: messages.getMessage('flags.preserve-temp-dir.summary'),
31
+ }),
32
+ 'target-org': Flags.optionalOrg(),
33
+ };
34
+ async run() {
35
+ const { flags } = await this.parse(ConvertSourceBehavior);
36
+ if (await flags['target-org']?.supportsSourceTracking()) {
37
+ throw messages.createError('error.trackingNotSupported');
38
+ }
39
+ const projectJson = getValidatedProjectJson(flags.behavior, this.project);
40
+ const [backupPjsonContents, packageDirsWithDecomposable] = await Promise.all([
41
+ flags['dry-run'] ? readFile(projectJson.getPath()) : '',
42
+ getPackageDirectoriesForPreset(this.project, flags.behavior),
43
+ ]);
44
+ const filesToDelete = await convertToMdapi(packageDirsWithDecomposable);
45
+ // flip the preset in the sfdx-project.json, even for dry-run, since the registry will need for conversions
46
+ projectJson.set(PRESETS_PROP, [...(projectJson.get(PRESETS_PROP) ?? []), flags.behavior]);
47
+ await projectJson.write();
48
+ this.info(`sfdx-project.json ${PRESETS_PROP} is now [${projectJson.get(PRESETS_PROP).join(',')}]`);
49
+ // delete the “original” files that no longer work because of project update
50
+ await Promise.all(flags['dry-run'] ? [] : filesToDelete.map((f) => rm(f)));
51
+ const createdFiles = await convertBackToSource({
52
+ packageDirsWithPreset: packageDirsWithDecomposable,
53
+ projectDir: this.project.getPath(),
54
+ dryRun: flags['dry-run'],
55
+ });
56
+ if (!flags['preserve-temp-dir']) {
57
+ await rm(TMP_DIR, { recursive: true });
58
+ }
59
+ this.table(filesToDelete.map((f) => ({ value: f })), { value: { header: flags['dry-run'] ? 'Files that would have been deleted if not --dry-run' : 'Deleted Files' } });
60
+ this.log();
61
+ this.table(createdFiles.map((f) => ({ value: f })), { value: { header: 'Created Files' } });
62
+ if (flags['dry-run']) {
63
+ // put it back how it was
64
+ await writeFile(projectJson.getPath(), backupPjsonContents);
65
+ this.logSuccess(messages.getMessage('success.dryRun', [DRY_RUN_DIR]));
66
+ }
67
+ return {
68
+ createdFiles,
69
+ deletedFiles: filesToDelete,
70
+ sourceBehaviorOptions: projectJson.get(PRESETS_PROP),
71
+ };
72
+ }
73
+ }
74
+ //# sourceMappingURL=source-behavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-behavior.js","sourceRoot":"","sources":["../../../../src/commands/project/convert/source-behavior.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,OAAO,EACP,cAAc,EACd,WAAW,EACX,YAAY,EACZ,cAAc,EACd,8BAA8B,EAC9B,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,yBAAyB,CAAC,CAAC;AAQxG,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,SAA+B;IACzE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,KAAK,GAAG,MAAM,CAAC;IAC/B,MAA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AAK,CACR,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EACvC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,CACvC,CAAC;QACF,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;YACrB,yBAAyB;YACzB,MAAM,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,mBAAmB,CAAC,CAAC;YAC5D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO;YACL,YAAY;YACZ,YAAY,EAAE,aAAa;YAC3B,qBAAqB,EAAE,WAAW,CAAC,GAAG,CAAW,YAAY,CAAC;SAC/D,CAAC;IACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { SfProject, SfProjectJson } from '@salesforce/core';
2
+ import { ComponentSet } from '@salesforce/source-deploy-retrieve';
3
+ export type ComponentSetAndPackageDirPath = {
4
+ packageDirPath: string;
5
+ cs: ComponentSet;
6
+ };
7
+ export declare const PRESETS_PROP = "sourceBehaviorOptions";
8
+ export declare const PRESET_CHOICES: string[];
9
+ export declare const TMP_DIR: string;
10
+ export declare const DRY_RUN_DIR = "DRY-RUN-RESULTS";
11
+ /** returns packageDirectories and ComponentsSets where there is metadata of the type we'll change the behavior for */
12
+ export declare const getPackageDirectoriesForPreset: (project: SfProject, preset: string) => Promise<ComponentSetAndPackageDirPath[]>;
13
+ /** converts the composed metadata to mdapi format in a temp dir */
14
+ export declare const convertToMdapi: (packageDirsWithDecomposable: ComponentSetAndPackageDirPath[]) => Promise<string[]>;
15
+ /** get the LOCAL project json, throws if not present OR the preset already exists */
16
+ export declare const getValidatedProjectJson: (preset: string, project: SfProject) => SfProjectJson;
17
+ /** converts the temporary mdapi back to source, return a list of the created files */
18
+ export declare const convertBackToSource: ({ packageDirsWithPreset, projectDir, dryRun, }: {
19
+ packageDirsWithPreset: ComponentSetAndPackageDirPath[];
20
+ projectDir: string;
21
+ /** if provided, will output the results into a separate directory outside the project's packageDirectories */
22
+ dryRun: boolean;
23
+ }) => Promise<string[]>;
24
+ export declare const getTypesFromPreset: (preset: string) => Promise<string[]>;
@@ -0,0 +1,126 @@
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 { existsSync, readdirSync } from 'node:fs';
8
+ // import { platform } from 'node:os';
9
+ import { readFile, readdir } from 'node:fs/promises';
10
+ import { join, resolve } from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
12
+ import { SfError, Messages } from '@salesforce/core';
13
+ import { ComponentSetBuilder, MetadataConverter, RegistryAccess, } from '@salesforce/source-deploy-retrieve';
14
+ import { isString } from '@salesforce/ts-types';
15
+ // TODO: there could be a cleaner way to read this
16
+ const PRESET_DIR = fileURLToPath(join(import.meta.resolve('@salesforce/source-deploy-retrieve'), '..', 'registry', 'presets'));
17
+ export const PRESETS_PROP = 'sourceBehaviorOptions';
18
+ export const PRESET_CHOICES = (await readdir(PRESET_DIR)).map((f) => f.replace('.json', ''));
19
+ export const TMP_DIR = process.env.SF_MDAPI_TEMP_DIR ?? 'decompositionConverterTempDir';
20
+ export const DRY_RUN_DIR = 'DRY-RUN-RESULTS';
21
+ /** returns packageDirectories and ComponentsSets where there is metadata of the type we'll change the behavior for */
22
+ export const getPackageDirectoriesForPreset = async (project, preset) => {
23
+ const projectDir = project.getPath();
24
+ const output = (await Promise.all(project
25
+ .getPackageDirectories()
26
+ .map((pd) => pd.path)
27
+ .map(componentSetFromPackageDirectory(projectDir)(await getTypesFromPreset(preset)))))
28
+ .filter(componentSetIsNonEmpty)
29
+ // we do this after filtering componentSets to reduce false positives (ex: dir does not have main/default but also has nothing to decompose)
30
+ .map(validateMainDefault(projectDir));
31
+ if (output.length === 0) {
32
+ loadMessages().createError('error.noTargetTypes', [preset]);
33
+ }
34
+ return output;
35
+ };
36
+ /** converts the composed metadata to mdapi format in a temp dir */
37
+ export const convertToMdapi = async (packageDirsWithDecomposable) => (await Promise.all(packageDirsWithDecomposable.map(async (pd) => {
38
+ // convert to the mdapi targetDir
39
+ await new MetadataConverter().convert(pd.cs, 'metadata', {
40
+ type: 'directory',
41
+ outputDirectory: join(TMP_DIR, pd.packageDirPath),
42
+ genUniqueDir: false,
43
+ });
44
+ return getComponentSetFiles(pd.cs);
45
+ })))
46
+ .flat()
47
+ .map((f) => resolve(f));
48
+ /** get the LOCAL project json, throws if not present OR the preset already exists */
49
+ export const getValidatedProjectJson = (preset, project) => {
50
+ const projectJson = project.getSfProjectJson(false);
51
+ if (projectJson.get(PRESETS_PROP)?.includes(preset)) {
52
+ throw SfError.create({
53
+ name: 'sourceBehaviorOptionAlreadyExists',
54
+ message: `sourceBehaviorOption ${preset} already exists in sfdx-project.json`,
55
+ });
56
+ }
57
+ return projectJson;
58
+ };
59
+ /** converts the temporary mdapi back to source, return a list of the created files */
60
+ export const convertBackToSource = async ({ packageDirsWithPreset, projectDir, dryRun, }) => [
61
+ ...new Set((await convertToSource({
62
+ packageDirsWithPreset,
63
+ projectDir,
64
+ dryRunDir: dryRun ? DRY_RUN_DIR : undefined,
65
+ }))
66
+ .flatMap((cr) => cr.converted ?? [])
67
+ // we can't use walkContent because there's a conditional inside it
68
+ .flatMap(getSourceComponentFiles)
69
+ .filter(isString)),
70
+ ];
71
+ const getSourceComponentFiles = (c) => [c.xml, ...(c.content ? fullPathsFromDir(c.content) : [])].filter(isString);
72
+ const fullPathsFromDir = (dir) => readdirSync(dir, { withFileTypes: true }).map((d) => join(d.path, d.name));
73
+ /** build a component set from the original project for each pkgDir */
74
+ const componentSetFromPackageDirectory = (projectDir) => (metadataEntries) => async (packageDir) => ({
75
+ packageDirPath: packageDir,
76
+ cs: await ComponentSetBuilder.build({
77
+ metadata: {
78
+ metadataEntries,
79
+ directoryPaths: [packageDir],
80
+ },
81
+ projectDir,
82
+ }),
83
+ });
84
+ const convertToSource = async ({ packageDirsWithPreset, projectDir, dryRunDir, }) => {
85
+ // mdapi=>source convert the target dir back to the project
86
+ // it's a new converter because the project has changed and it should reload the project's registry.
87
+ const converter = new MetadataConverter(new RegistryAccess(undefined, projectDir));
88
+ return Promise.all(packageDirsWithPreset.map(async (pd) => converter.convert(
89
+ // componentSet based on each mdapi folder
90
+ await ComponentSetBuilder.build({ sourcepath: [join(TMP_DIR, pd.packageDirPath)], projectDir }), 'source', dryRunDir
91
+ ? // dryRun outputs to a dir outside the real packageDirs folder to avoid changing real stuff
92
+ {
93
+ type: 'directory',
94
+ outputDirectory: join(projectDir, dryRunDir),
95
+ packageName: pd.packageDirPath,
96
+ genUniqueDir: false,
97
+ }
98
+ : {
99
+ type: 'merge',
100
+ mergeWith: (await ComponentSetBuilder.build({
101
+ sourcepath: [pd.packageDirPath],
102
+ projectDir,
103
+ })).getSourceComponents(),
104
+ defaultDirectory: join(projectDir, pd.packageDirPath),
105
+ })));
106
+ };
107
+ export const getTypesFromPreset = async (preset) => Object.values(JSON.parse(await readFile(join(PRESET_DIR, `${preset}.json`), 'utf-8')).types).map((t) => t.name);
108
+ /** convert will put things in /main/default. If the packageDirs aren't configured that way, we don't want to make a mess.
109
+ * See https://salesforce.quip.com/va5IAgXmTMWF for details on that issue */
110
+ const validateMainDefault = (projectDir) => (i) => {
111
+ if (!existsSync(join(projectDir, i.packageDirPath, 'main', 'default'))) {
112
+ throw loadMessages().createError('error.packageDirectoryNeedsMainDefault', [i.packageDirPath], [i.packageDirPath]);
113
+ }
114
+ return i;
115
+ };
116
+ const getComponentSetFiles = (cs) => cs
117
+ .getSourceComponents()
118
+ .toArray()
119
+ .flatMap((c) => [c.xml, ...c.walkContent()])
120
+ .filter(isString);
121
+ const loadMessages = () => {
122
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
123
+ return Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'convert.source-behavior');
124
+ };
125
+ const componentSetIsNonEmpty = (i) => i.cs.size > 0;
126
+ //# sourceMappingURL=convertBehavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertBehavior.js","sourceRoot":"","sources":["../../src/utils/convertBehavior.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAA4B,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAEL,mBAAmB,EAEnB,iBAAiB,EAEjB,cAAc,GAEf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,kDAAkD;AAClD,MAAM,UAAU,GAAG,aAAa,CAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,oCAAoC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAC7F,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG,uBAAuB,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,+BAA+B,CAAC;AACxF,MAAM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,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;KAC3C,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEtB,MAAM,YAAY,GAAG,GAAqB,EAAE;IAC1C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,QAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,yBAAyB,CAAC,CAAC;AAChG,CAAC,CAAC;AACF,MAAM,sBAAsB,GAAG,CAAC,CAAgC,EAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC"}
@@ -0,0 +1,70 @@
1
+ # summary
2
+
3
+ Enable a behavior of your project source files, and then update your Salesforce DX project to implement the behavior.
4
+
5
+ # description
6
+
7
+ Specifically, this command updates the "sourceBehaviorOption" option in the "sfdx-project.json" file and then converts the associated local source files in your project as needed.
8
+
9
+ For example, run this command with the "--behavior decomposePermissionSetBeta" flag to start decomposing permission sets when you deploy or retrieve them. Decomposing means breaking up the monolithic metadata API format XML file that corresponds to a metadata component into smaller XML files and directories based on its subtypes. Permission sets are not decomposed by default; you must opt-in to start decomposing them by using this command. When the command finishes, your "sfdx-project.json" file is updated to always decompose permission sets, and the existing permission set files in your local package directories are converted into the new decomposed format. You run this command only once for a given behavior change.
10
+
11
+ For more information about the possible values for the --behavior flag, see the "sourceBehaviorOptions" section in the https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm topic.
12
+
13
+ # flags.behavior.summary
14
+
15
+ Behavior to enable; the values correspond to the possible values of the "sourceBehaviorOption" option in the "sfdx-project.json" file.
16
+
17
+ # examples
18
+
19
+ - Update your Salesforce DX project to decompose custom labels:
20
+
21
+ <%= config.bin %> <%= command.id %> --behavior decomposeCustomLabelsBeta
22
+
23
+ - Display what the command would do, but don't change any existing files:
24
+
25
+ <%= config.bin %> <%= command.id %> --behavior decomposeCustomLabelsBeta --dry-run
26
+
27
+ - Keep the temporary directory that contains the interim metadata API formatted files:
28
+
29
+ <%= config.bin %> <%= command.id %> --behavior decomposeCustomLabelsBeta --dry-run --preserve-temp-dir
30
+
31
+ # flags.dry-run.summary
32
+
33
+ Display what the command would do, but don't make any actual changes.
34
+
35
+ # flags.dry-run.description
36
+
37
+ Doesn't modify the existing files in your project, including the "sfdx-project.json" file. Instead, the command lists the files that would be deleted, explains the modifications to the "sfdx-project.json" file, and outputs the resulting modifications to a new directory named `DRY-RUN-RESULTS` for review.
38
+
39
+ # flags.preserve-temp-dir.summary
40
+
41
+ Don't delete the metadata API format temporary directory that this command creates. Useful for debugging.
42
+
43
+ # error.trackingNotSupported
44
+
45
+ Your project has a default org (target-org) that uses source tracking. This operation will cause changes to the local project source files that can't be properly tracked.
46
+
47
+ # error.trackingNotSupported.actions
48
+
49
+ - Retrieve any changes or data you need from the org that you haven't already retrieved.
50
+ - Delete the org ("sf org delete scratch" or "sf org delete sandbox").
51
+ - Run this command again.
52
+ - Create a new org ("sf org create scratch" or "sf org create sandbox") and deploy the modified source.
53
+
54
+ # error.packageDirectoryNeedsMainDefault
55
+
56
+ The package directory %s doesn't have a main/default structure.
57
+ This command moves metadata into a main/default structure, but your package directories aren't ready for it.
58
+
59
+ # error.packageDirectoryNeedsMainDefault.actions
60
+
61
+ - Update %s to have all its metadata inside a main/default directory structure.
62
+ - Run the command again.
63
+
64
+ # success.dryRun
65
+
66
+ Files were created in %s outside your package directories for you to inspect.
67
+
68
+ # error.noTargetTypes
69
+
70
+ The project doesn't contain any package directories with metadata that matches the specified behavior %s.