@salesforce/source-deploy-retrieve 10.5.6 → 10.6.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 (146) hide show
  1. package/lib/src/client/deployMessages.d.ts +20 -0
  2. package/lib/src/client/deployMessages.js +146 -0
  3. package/lib/src/client/deployMessages.js.map +1 -0
  4. package/lib/src/client/diagnosticUtil.d.ts +4 -8
  5. package/lib/src/client/diagnosticUtil.js +53 -112
  6. package/lib/src/client/diagnosticUtil.js.map +1 -1
  7. package/lib/src/client/index.d.ts +2 -2
  8. package/lib/src/client/index.js.map +1 -1
  9. package/lib/src/client/metadataApiDeploy.d.ts +4 -21
  10. package/lib/src/client/metadataApiDeploy.js +66 -200
  11. package/lib/src/client/metadataApiDeploy.js.map +1 -1
  12. package/lib/src/client/metadataApiRetrieve.d.ts +6 -12
  13. package/lib/src/client/metadataApiRetrieve.js +62 -165
  14. package/lib/src/client/metadataApiRetrieve.js.map +1 -1
  15. package/lib/src/client/metadataTransfer.d.ts +6 -6
  16. package/lib/src/client/metadataTransfer.js +58 -52
  17. package/lib/src/client/metadataTransfer.js.map +1 -1
  18. package/lib/src/client/retrieveExtract.d.ts +15 -0
  19. package/lib/src/client/retrieveExtract.js +130 -0
  20. package/lib/src/client/retrieveExtract.js.map +1 -0
  21. package/lib/src/client/types.d.ts +10 -4
  22. package/lib/src/client/types.js +1 -0
  23. package/lib/src/client/types.js.map +1 -1
  24. package/lib/src/collections/componentSet.d.ts +6 -3
  25. package/lib/src/collections/componentSet.js +31 -23
  26. package/lib/src/collections/componentSet.js.map +1 -1
  27. package/lib/src/collections/componentSetBuilder.d.ts +10 -1
  28. package/lib/src/collections/componentSetBuilder.js +139 -133
  29. package/lib/src/collections/componentSetBuilder.js.map +1 -1
  30. package/lib/src/collections/types.d.ts +2 -1
  31. package/lib/src/collections/types.js +2 -1
  32. package/lib/src/collections/types.js.map +1 -1
  33. package/lib/src/common/types.d.ts +2 -2
  34. package/lib/src/convert/convertContext/convertContext.d.ts +13 -0
  35. package/lib/src/convert/convertContext/convertContext.js +27 -0
  36. package/lib/src/convert/convertContext/convertContext.js.map +1 -0
  37. package/lib/src/convert/convertContext/decompositionFinalizer.d.ts +19 -0
  38. package/lib/src/convert/convertContext/decompositionFinalizer.js +27 -0
  39. package/lib/src/convert/convertContext/decompositionFinalizer.js.map +1 -0
  40. package/lib/src/convert/convertContext/nonDecompositionFinalizer.d.ts +42 -0
  41. package/lib/src/convert/convertContext/nonDecompositionFinalizer.js +167 -0
  42. package/lib/src/convert/convertContext/nonDecompositionFinalizer.js.map +1 -0
  43. package/lib/src/convert/convertContext/recompositionFinalizer.d.ts +29 -0
  44. package/lib/src/convert/convertContext/recompositionFinalizer.js +122 -0
  45. package/lib/src/convert/convertContext/recompositionFinalizer.js.map +1 -0
  46. package/lib/src/convert/convertContext/transactionFinalizer.d.ts +5 -0
  47. package/lib/src/convert/convertContext/transactionFinalizer.js +7 -0
  48. package/lib/src/convert/convertContext/transactionFinalizer.js.map +1 -0
  49. package/lib/src/convert/metadataConverter.d.ts +3 -3
  50. package/lib/src/convert/metadataConverter.js +37 -27
  51. package/lib/src/convert/metadataConverter.js.map +1 -1
  52. package/lib/src/convert/replacements.d.ts +1 -1
  53. package/lib/src/convert/streams.d.ts +10 -8
  54. package/lib/src/convert/streams.js +40 -31
  55. package/lib/src/convert/streams.js.map +1 -1
  56. package/lib/src/convert/transformers/baseMetadataTransformer.d.ts +3 -3
  57. package/lib/src/convert/transformers/baseMetadataTransformer.js +3 -3
  58. package/lib/src/convert/transformers/baseMetadataTransformer.js.map +1 -1
  59. package/lib/src/convert/transformers/decomposedMetadataTransformer.d.ts +2 -10
  60. package/lib/src/convert/transformers/decomposedMetadataTransformer.js +172 -164
  61. package/lib/src/convert/transformers/decomposedMetadataTransformer.js.map +1 -1
  62. package/lib/src/convert/transformers/defaultMetadataTransformer.d.ts +1 -1
  63. package/lib/src/convert/transformers/defaultMetadataTransformer.js +9 -9
  64. package/lib/src/convert/transformers/defaultMetadataTransformer.js.map +1 -1
  65. package/lib/src/convert/transformers/metadataTransformerFactory.d.ts +2 -2
  66. package/lib/src/convert/transformers/metadataTransformerFactory.js +1 -1
  67. package/lib/src/convert/transformers/metadataTransformerFactory.js.map +1 -1
  68. package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.d.ts +1 -1
  69. package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.js +7 -7
  70. package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.js.map +1 -1
  71. package/lib/src/convert/transformers/staticResourceMetadataTransformer.d.ts +2 -2
  72. package/lib/src/convert/transformers/staticResourceMetadataTransformer.js +4 -4
  73. package/lib/src/convert/transformers/staticResourceMetadataTransformer.js.map +1 -1
  74. package/lib/src/convert/types.d.ts +13 -1
  75. package/lib/src/registry/coverage.js +10 -10
  76. package/lib/src/registry/coverage.js.map +1 -1
  77. package/lib/src/registry/presets/decomposeCustomLabelsBeta.json +43 -0
  78. package/lib/src/registry/presets/decomposePermissionSetBeta.json +186 -0
  79. package/lib/src/registry/presets/decomposeSharingRulesBeta.json +81 -0
  80. package/lib/src/registry/presets/decomposeWorkflowBeta.json +103 -0
  81. package/lib/src/registry/registry.d.ts +1 -1
  82. package/lib/src/registry/registry.js +2 -2
  83. package/lib/src/registry/registry.js.map +1 -1
  84. package/lib/src/registry/registryAccess.d.ts +2 -1
  85. package/lib/src/registry/registryAccess.js +6 -3
  86. package/lib/src/registry/registryAccess.js.map +1 -1
  87. package/lib/src/registry/standardvalueset.js +2 -2
  88. package/lib/src/registry/standardvalueset.js.map +1 -1
  89. package/lib/src/registry/types.d.ts +1 -1
  90. package/lib/src/registry/variants.d.ts +12 -0
  91. package/lib/src/registry/variants.js +71 -0
  92. package/lib/src/registry/variants.js.map +1 -0
  93. package/lib/src/resolve/adapters/baseSourceAdapter.d.ts +3 -13
  94. package/lib/src/resolve/adapters/baseSourceAdapter.js +61 -61
  95. package/lib/src/resolve/adapters/baseSourceAdapter.js.map +1 -1
  96. package/lib/src/resolve/adapters/bundleSourceAdapter.d.ts +1 -1
  97. package/lib/src/resolve/adapters/decomposedSourceAdapter.d.ts +2 -2
  98. package/lib/src/resolve/adapters/decomposedSourceAdapter.js +13 -12
  99. package/lib/src/resolve/adapters/decomposedSourceAdapter.js.map +1 -1
  100. package/lib/src/resolve/adapters/defaultSourceAdapter.d.ts +1 -1
  101. package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.d.ts +2 -2
  102. package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.js +10 -10
  103. package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.js.map +1 -1
  104. package/lib/src/resolve/adapters/matchingContentSourceAdapter.d.ts +1 -2
  105. package/lib/src/resolve/adapters/matchingContentSourceAdapter.js +4 -7
  106. package/lib/src/resolve/adapters/matchingContentSourceAdapter.js.map +1 -1
  107. package/lib/src/resolve/adapters/mixedContentSourceAdapter.d.ts +1 -1
  108. package/lib/src/resolve/adapters/sourceAdapterFactory.d.ts +2 -1
  109. package/lib/src/resolve/adapters/sourceAdapterFactory.js +6 -16
  110. package/lib/src/resolve/adapters/sourceAdapterFactory.js.map +1 -1
  111. package/lib/src/resolve/connectionResolver.d.ts +1 -1
  112. package/lib/src/resolve/connectionResolver.js +9 -16
  113. package/lib/src/resolve/connectionResolver.js.map +1 -1
  114. package/lib/src/resolve/forceIgnore.d.ts +1 -1
  115. package/lib/src/resolve/manifestResolver.d.ts +1 -1
  116. package/lib/src/resolve/manifestResolver.js +39 -35
  117. package/lib/src/resolve/manifestResolver.js.map +1 -1
  118. package/lib/src/resolve/metadataResolver.d.ts +2 -47
  119. package/lib/src/resolve/metadataResolver.js +206 -215
  120. package/lib/src/resolve/metadataResolver.js.map +1 -1
  121. package/lib/src/resolve/sourceComponent.d.ts +3 -4
  122. package/lib/src/resolve/sourceComponent.js +17 -42
  123. package/lib/src/resolve/sourceComponent.js.map +1 -1
  124. package/lib/src/resolve/treeContainers.js +5 -14
  125. package/lib/src/resolve/treeContainers.js.map +1 -1
  126. package/lib/src/resolve/types.d.ts +2 -2
  127. package/lib/src/utils/decomposed.d.ts +7 -0
  128. package/lib/src/utils/decomposed.js +19 -0
  129. package/lib/src/utils/decomposed.js.map +1 -0
  130. package/lib/src/utils/filePathGenerator.js +2 -2
  131. package/lib/src/utils/filePathGenerator.js.map +1 -1
  132. package/lib/src/utils/fileSystemHandler.d.ts +1 -1
  133. package/lib/src/utils/index.d.ts +1 -1
  134. package/lib/src/utils/index.js +2 -1
  135. package/lib/src/utils/index.js.map +1 -1
  136. package/lib/src/utils/path.d.ts +17 -2
  137. package/lib/src/utils/path.js +44 -1
  138. package/lib/src/utils/path.js.map +1 -1
  139. package/package.json +5 -8
  140. package/LICENSE +0 -29
  141. package/lib/src/convert/convertContext.d.ts +0 -92
  142. package/lib/src/convert/convertContext.js +0 -304
  143. package/lib/src/convert/convertContext.js.map +0 -1
  144. package/lib/src/convert/transformers/index.d.ts +0 -1
  145. package/lib/src/convert/transformers/index.js +0 -12
  146. package/lib/src/convert/transformers/index.js.map +0 -1
@@ -6,14 +6,13 @@
6
6
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ComponentSetBuilder = void 0;
10
- /* eslint complexity: ["error", 22] */
9
+ exports.entryToTypeAndName = exports.ComponentSetBuilder = void 0;
11
10
  const path = require("node:path");
12
11
  const core_1 = require("@salesforce/core");
13
12
  const fs = require("graceful-fs");
14
13
  const minimatch = require("minimatch");
15
- const collections_1 = require("../collections");
16
- const registry_1 = require("../registry");
14
+ const componentSet_1 = require("../collections/componentSet");
15
+ const registryAccess_1 = require("../registry/registryAccess");
17
16
  ;
18
17
  const messages = new core_1.Messages('@salesforce/source-deploy-retrieve', 'sdr', new Map([["md_request_fail", "Metadata API request failed: %s"], ["error_convert_invalid_format", "Invalid conversion format '%s'"], ["error_could_not_infer_type", "%s: Could not infer a metadata type"], ["error_unexpected_child_type", "Unexpected child metadata [%s] found for parent type [%s]"], ["noParent", "Could not find parent type for %s (%s)"], ["error_expected_source_files", "%s: Expected source files for type '%s'"], ["error_failed_convert", "Component conversion failed: %s"], ["error_merge_metadata_target_unsupported", "Merge convert for metadata target format currently unsupported"], ["error_missing_adapter", "Missing adapter '%s' for metadata type '%s'"], ["error_missing_transformer", "Missing transformer '%s' for metadata type '%s'"], ["error_missing_type_definition", "Missing metadata type definition in registry for id '%s'."], ["error_missing_child_type_definition", "Type %s does not have a child type definition %s."], ["noChildTypes", "No child types found in registry for %s (reading %s at %s)"], ["error_no_metadata_xml_ignore", "Metadata xml file %s is forceignored but is required for %s."], ["noSourceIgnore", "%s metadata types require source files, but %s is forceignored."], ["noSourceIgnore.actions", "- Metadata types with content are composed of two files: a content file (ie MyApexClass.cls) and a -meta.xml file (i.e MyApexClass.cls-meta.xml). You must include both files in your .forceignore file. Or try appending \u201C\\*\u201D to your existing .forceignore entry.\n\nSee <https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm> for examples"], ["error_path_not_found", "%s: File or folder not found"], ["noContentFound", "SourceComponent %s (metadata type = %s) is missing its content file."], ["noContentFound.actions", ["Ensure the content file exists in the expected location.", "If the content file is in your .forceignore file, ensure the meta-xml file is also ignored to completely exclude it."]], ["error_parsing_xml", "SourceComponent %s (metadata type = %s) does not have an associated metadata xml to parse"], ["error_expected_file_path", "%s: path is to a directory, expected a file"], ["error_expected_directory_path", "%s: path is to a file, expected a directory"], ["error_directory_not_found_or_not_directory", "%s: path is not a directory"], ["error_no_directory_stream", "%s doesn't support readable streams on directories."], ["error_no_source_to_deploy", "No source-backed components present in the package."], ["error_no_components_to_retrieve", "No components in the package to retrieve."], ["error_static_resource_expected_archive_type", "A StaticResource directory must have a content type of application/zip or application/jar - found %s for %s."], ["error_static_resource_missing_resource_file", "A StaticResource must have an associated .resource file, missing %s.resource-meta.xml"], ["error_no_job_id", "The %s operation is missing a job ID. Initialize an operation with an ID, or start a new job."], ["missingApiVersion", "Could not determine an API version to use for the generated manifest. Tried looking for sourceApiVersion in sfdx-project.json, apiVersion from config vars, and the highest apiVersion from the APEX REST endpoint. Using API version 58.0 as a last resort."], ["invalid_xml_parsing", "error parsing %s due to:\\n message: %s\\n line: %s\\n code: %s"], ["zipBufferError", "Zip buffer was not created during conversion"], ["undefinedComponentSet", "Unable to construct a componentSet. Check the logs for more information."], ["replacementsFileNotRead", "The file \"%s\" specified in the \"replacements\" property of sfdx-project.json could not be read."], ["unsupportedBundleType", "Unsupported Bundle Type: %s"], ["filePathGeneratorNoTypeSupport", "Type not supported for filepath generation: %s"], ["missingFolderType", "The registry has %s as is inFolder but it does not have a folderType"], ["tooManyFiles", "Multiple files found for path: %s."], ["cantGetName", "Unable to calculate fullName from path: %s (%s)"], ["missingMetaFileSuffix", "The metadata registry is configured incorrectly for %s. Expected a metaFileSuffix."], ["uniqueIdElementNotInRegistry", "No uniqueIdElement found in registry for %s (reading %s at %s)."], ["uniqueIdElementNotInChild", "The uniqueIdElement %s was not found the child (reading %s at %s)."], ["suggest_type_header", "A metadata type lookup for \"%s\" found the following close matches:"], ["suggest_type_did_you_mean", "-- Did you mean \".%s%s\" instead for the \"%s\" metadata type?"], ["suggest_type_more_suggestions", "Additional suggestions:\nConfirm the file name, extension, and directory names are correct. Validate against the registry at:\n<https://github.com/forcedotcom/source-deploy-retrieve/blob/main/src/registry/metadataRegistry.json>\n\nIf the type is not listed in the registry, check that it has Metadata API support via the Metadata Coverage Report:\n<https://developer.salesforce.com/docs/metadata-coverage>\n\nIf the type is available via Metadata API but not in the registry\n\n- Open an issue <https://github.com/forcedotcom/cli/issues>\n- Add the type via PR. Instructions: <https://github.com/forcedotcom/source-deploy-retrieve/blob/main/contributing/metadata.md>"]]));
19
18
  class ComponentSetBuilder {
@@ -25,178 +24,185 @@ class ComponentSetBuilder {
25
24
  *
26
25
  * @param options: options for creating a ComponentSet
27
26
  */
28
- // eslint-disable-next-line complexity
29
27
  static async build(options) {
30
28
  const logger = core_1.Logger.childFromRoot('componentSetBuilder');
31
29
  let componentSet;
32
- /**
33
- * A map used when building a ComponentSet from metadata type/name pairs
34
- * key = a metadata type, e.g. `ApexClass`
35
- * value = an array of metadata names, e.g. `['foo_*', 'BarClass']`
36
- */
37
- const mdMap = new Map();
38
- const { sourcepath, manifest, metadata, packagenames, apiversion, sourceapiversion, org } = options;
30
+ const { sourcepath, manifest, metadata, packagenames, apiversion, sourceapiversion, org, projectDir } = options;
31
+ const registryAccess = new registryAccess_1.RegistryAccess(undefined, projectDir);
39
32
  try {
40
33
  if (sourcepath) {
41
34
  logger.debug(`Building ComponentSet from sourcepath: ${sourcepath.join(', ')}`);
42
- const fsPaths = sourcepath.map((filepath) => {
43
- if (!fs.existsSync(filepath)) {
44
- throw new core_1.SfError(messages.getMessage('error_path_not_found', [filepath]));
45
- }
46
- return path.resolve(filepath);
35
+ const fsPaths = sourcepath.map(validateAndResolvePath);
36
+ componentSet = componentSet_1.ComponentSet.fromSource({
37
+ fsPaths,
38
+ registry: registryAccess,
47
39
  });
48
- componentSet = collections_1.ComponentSet.fromSource({ fsPaths });
49
40
  }
50
41
  // Return empty ComponentSet and use packageNames in the connection via `.retrieve` options
51
42
  if (packagenames) {
52
43
  logger.debug(`Building ComponentSet for packagenames: ${packagenames.toString()}`);
53
- componentSet ??= new collections_1.ComponentSet();
44
+ componentSet ??= new componentSet_1.ComponentSet(undefined, registryAccess);
54
45
  }
55
46
  // Resolve manifest with source in package directories.
56
47
  if (manifest) {
57
48
  logger.debug(`Building ComponentSet from manifest: ${manifest.manifestPath}`);
58
- if (!fs.existsSync(manifest.manifestPath)) {
59
- throw new core_1.SfError(messages.getMessage('error_path_not_found', [manifest.manifestPath]));
60
- }
61
- const directoryPaths = manifest.directoryPaths;
62
- logger.debug(`Searching in packageDir: ${directoryPaths.join(', ')} for matching metadata`);
63
- componentSet = await collections_1.ComponentSet.fromManifest({
49
+ assertFileExists(manifest.manifestPath);
50
+ logger.debug(`Searching in packageDir: ${manifest.directoryPaths.join(', ')} for matching metadata`);
51
+ componentSet = await componentSet_1.ComponentSet.fromManifest({
64
52
  manifestPath: manifest.manifestPath,
65
- resolveSourcePaths: directoryPaths,
53
+ resolveSourcePaths: manifest.directoryPaths,
66
54
  forceAddWildcards: true,
67
55
  destructivePre: manifest.destructiveChangesPre,
68
56
  destructivePost: manifest.destructiveChangesPost,
57
+ registry: registryAccess,
69
58
  });
70
59
  }
71
60
  // Resolve metadata entries with source in package directories.
72
61
  if (metadata) {
73
62
  logger.debug(`Building ComponentSet from metadata: ${metadata.metadataEntries.toString()}`);
74
- const registry = new registry_1.RegistryAccess();
75
- const compSetFilter = new collections_1.ComponentSet();
76
- componentSet ??= new collections_1.ComponentSet();
77
63
  const directoryPaths = metadata.directoryPaths;
64
+ componentSet ??= new componentSet_1.ComponentSet(undefined, registryAccess);
65
+ const componentSetFilter = new componentSet_1.ComponentSet(undefined, registryAccess);
78
66
  // Build a Set of metadata entries
79
- metadata.metadataEntries.forEach((rawEntry) => {
80
- const [mdType, mdName] = rawEntry.split(':').map((entry) => entry.trim());
81
- // The registry will throw if it doesn't know what this type is.
82
- registry.getTypeByName(mdType);
83
- // Add metadata entries to a map for possible use with an org connection below.
84
- const mdMapEntry = mdMap.get(mdType);
85
- if (mdMapEntry) {
86
- mdMapEntry.push(mdName);
87
- }
88
- else {
89
- mdMap.set(mdType, [mdName]);
90
- }
91
- // this '.*' is a surprisingly valid way to specify a metadata, especially a DEB :sigh:
92
- // https://github.com/salesforcecli/plugin-deploy-retrieve/blob/main/test/nuts/digitalExperienceBundle/constants.ts#L140
93
- // because we're filtering from what we have locally, this won't allow you to retrieve new metadata (on the server only) using the partial wildcard
94
- // to do that, you'd need check the size of the CS created below, see if it's 0, and then query the org for the metadata that matches the regex
95
- // but building a CS from a metadata argument doesn't require an org, so we can't do that here
96
- if (mdName?.includes('*') && mdName?.length > 1 && !mdName.includes('.*')) {
97
- // get all components of the type, and then filter by the regex of the fullName
98
- collections_1.ComponentSet.fromSource({
99
- fsPaths: directoryPaths,
100
- include: new collections_1.ComponentSet([{ type: mdType, fullName: collections_1.ComponentSet.WILDCARD }]),
101
- })
102
- .getSourceComponents()
103
- .toArray()
104
- // using minimatch versus RegExp provides better (more expected) matching results
105
- .filter((cs) => minimatch(cs.fullName, mdName))
106
- .map((match) => {
107
- compSetFilter.add(match);
108
- componentSet?.add(match);
109
- });
110
- }
111
- else {
112
- const entry = {
113
- type: mdType,
114
- fullName: !mdName ? '*' : mdName,
115
- };
116
- // Add to the filtered ComponentSet for resolved source paths,
117
- // and the unfiltered ComponentSet to build the correct manifest.
118
- compSetFilter.add(entry);
119
- componentSet?.add(entry);
120
- }
121
- });
67
+ metadata.metadataEntries
68
+ .map((0, exports.entryToTypeAndName)(registryAccess))
69
+ .flatMap(typeAndNameToMetadataComponents({ directoryPaths, registry: registryAccess }))
70
+ .map(addToComponentSet(componentSet))
71
+ .map(addToComponentSet(componentSetFilter));
122
72
  logger.debug(`Searching for matching metadata in directories: ${directoryPaths.join(', ')}`);
123
- const resolvedComponents = collections_1.ComponentSet.fromSource({ fsPaths: directoryPaths, include: compSetFilter });
73
+ const resolvedComponents = componentSet_1.ComponentSet.fromSource({
74
+ fsPaths: directoryPaths,
75
+ include: componentSetFilter,
76
+ registry: registryAccess,
77
+ });
124
78
  componentSet.forceIgnoredPaths = resolvedComponents.forceIgnoredPaths;
125
- for (const comp of resolvedComponents) {
126
- componentSet.add(comp);
127
- }
79
+ resolvedComponents.toArray().map(addToComponentSet(componentSet));
128
80
  }
129
81
  // Resolve metadata entries with an org connection
130
82
  if (org) {
131
- componentSet ??= new collections_1.ComponentSet();
132
- let debugMsg = `Building ComponentSet from targetUsername: ${org.username}`;
133
- // *** Default Filter ***
134
- // exclude components based on the results of componentFilter function
135
- // components with namespacePrefix where org.exclude includes manageableState (to exclude managed packages)
136
- // components with namespacePrefix where manageableState equals undefined (to exclude components e.g. InstalledPackage)
137
- // components where org.exclude includes manageableState (to exclude packages without namespacePrefix e.g. unlocked packages)
138
- let componentFilter = (component) => !component?.manageableState || !org.exclude?.includes(component.manageableState);
139
- if (metadata) {
140
- debugMsg += ` filtered by metadata: ${metadata.metadataEntries.toString()}`;
141
- componentFilter = (component) => {
142
- if (component.type && component.fullName) {
143
- const mdMapEntry = mdMap.get(component.type);
144
- // using minimatch versus RegExp provides better (more expected) matching results
145
- return !!mdMapEntry && mdMapEntry.some((mdName) => minimatch(component.fullName, mdName));
146
- }
147
- return false;
148
- };
149
- }
150
- logger.debug(debugMsg);
151
- const fromConnection = await collections_1.ComponentSet.fromConnection({
83
+ componentSet ??= new componentSet_1.ComponentSet(undefined, registryAccess);
84
+ logger.debug(`Building ComponentSet from targetUsername: ${org.username} ${metadata ? `filtered by metadata: ${metadata.metadataEntries.toString()}` : ''}`);
85
+ const mdMap = metadata
86
+ ? buildMapFromComponents(metadata.metadataEntries.map((0, exports.entryToTypeAndName)(registryAccess)))
87
+ : new Map();
88
+ const fromConnection = await componentSet_1.ComponentSet.fromConnection({
152
89
  usernameOrConnection: (await core_1.StateAggregator.getInstance()).aliases.getUsername(org.username) ?? org.username,
153
- componentFilter,
90
+ componentFilter: getOrgComponentFilter(org, mdMap, metadata),
154
91
  metadataTypes: mdMap.size ? Array.from(mdMap.keys()) : undefined,
92
+ registry: registryAccess,
155
93
  });
156
- for (const comp of fromConnection) {
157
- componentSet.add(comp);
158
- }
94
+ fromConnection.toArray().map(addToComponentSet(componentSet));
159
95
  }
160
96
  }
161
97
  catch (e) {
162
- if (e.message.includes('Missing metadata type definition in registry for id')) {
163
- // to remain generic to catch missing metadata types regardless of parameters, split on '
164
- // example message : Missing metadata type definition in registry for id 'NonExistentType'
165
- const issueType = e.message.split("'")[1];
166
- throw new core_1.SfError(`The specified metadata type is unsupported: [${issueType}]`);
167
- }
168
- else {
169
- throw e;
170
- }
171
- }
172
- // This is only for debug output of matched files based on the command flags.
173
- // It will log up to 20 file matches.
174
- if (logger.shouldLog(20) && componentSet?.size) {
175
- logger.debug(`Matching metadata files (${componentSet.size}):`);
176
- const components = componentSet.getSourceComponents().toArray();
177
- for (let i = 0; i < componentSet.size; i++) {
178
- if (components[i]?.content) {
179
- logger.debug(components[i].content);
180
- }
181
- else if (components[i]?.xml) {
182
- logger.debug(components[i].xml);
183
- }
184
- if (i > 18) {
185
- logger.debug(`(showing 20 of ${componentSet.size} matches)`);
186
- break;
187
- }
188
- }
98
+ return componentSetBuilderErrorHandler(e);
189
99
  }
190
100
  // there should have been a componentSet created by this point.
191
- if (componentSet === undefined) {
192
- throw new core_1.SfError('undefinedComponentSet');
193
- }
101
+ componentSet = assertComponentSetIsNotUndefined(componentSet);
194
102
  componentSet.apiVersion ??= apiversion;
195
103
  componentSet.sourceApiVersion ??= sourceapiversion;
196
- logger.debug(`ComponentSet apiVersion = ${componentSet.apiVersion}`);
197
- logger.debug(`ComponentSet sourceApiVersion = ${componentSet.sourceApiVersion}`);
104
+ logComponents(logger, componentSet);
198
105
  return componentSet;
199
106
  }
200
107
  }
201
108
  exports.ComponentSetBuilder = ComponentSetBuilder;
109
+ const addToComponentSet = (cs) => (cmp) => {
110
+ cs.add(cmp);
111
+ return cmp;
112
+ };
113
+ const componentSetBuilderErrorHandler = (e) => {
114
+ if (e instanceof Error && e.message.includes('Missing metadata type definition in registry for id')) {
115
+ // to remain generic to catch missing metadata types regardless of parameters, split on '
116
+ // example message : Missing metadata type definition in registry for id 'NonExistentType'
117
+ const issueType = e.message.split("'")[1];
118
+ throw new core_1.SfError(`The specified metadata type is unsupported: [${issueType}]`);
119
+ }
120
+ else {
121
+ throw e;
122
+ }
123
+ };
124
+ const validateAndResolvePath = (filepath) => path.resolve(assertFileExists(filepath));
125
+ const assertFileExists = (filepath) => {
126
+ if (!fs.existsSync(filepath)) {
127
+ throw new core_1.SfError(messages.getMessage('error_path_not_found', [filepath]));
128
+ }
129
+ return filepath;
130
+ };
131
+ const assertComponentSetIsNotUndefined = (componentSet) => {
132
+ if (componentSet === undefined) {
133
+ throw new core_1.SfError('undefinedComponentSet');
134
+ }
135
+ return componentSet;
136
+ };
137
+ /** This is only for debug output of matched files based on the command flags.
138
+ * It will log up to 20 file matches. */
139
+ const logComponents = (logger, componentSet) => {
140
+ logger.debug(`Matching metadata files (${componentSet.size}):`);
141
+ const components = componentSet.getSourceComponents().toArray();
142
+ components
143
+ .slice(0, 20)
144
+ .map((cmp) => cmp.content ?? cmp.xml ?? cmp.fullName)
145
+ .map((m) => logger.debug(m));
146
+ if (components.length > 20)
147
+ logger.debug(`(showing 20 of ${componentSet.size} matches)`);
148
+ logger.debug(`ComponentSet apiVersion = ${componentSet.apiVersion}`);
149
+ logger.debug(`ComponentSet sourceApiVersion = ${componentSet.sourceApiVersion}`);
150
+ };
151
+ const getOrgComponentFilter = (org, mdMap, metadata) => metadata
152
+ ? (component) => {
153
+ if (component.type && component.fullName) {
154
+ const mdMapEntry = mdMap.get(component.type);
155
+ // using minimatch versus RegExp provides better (more expected) matching results
156
+ return (!!mdMapEntry &&
157
+ mdMapEntry.some((mdName) => typeof component.fullName === 'string' && minimatch(component.fullName, mdName)));
158
+ }
159
+ return false;
160
+ }
161
+ : // *** Default Filter ***
162
+ // exclude components based on the results of componentFilter function
163
+ // components with namespacePrefix where org.exclude includes manageableState (to exclude managed packages)
164
+ // components with namespacePrefix where manageableState equals undefined (to exclude components e.g. InstalledPackage)
165
+ // components where org.exclude includes manageableState (to exclude packages without namespacePrefix e.g. unlocked packages)
166
+ (component) => !component?.manageableState || !org.exclude?.includes(component.manageableState);
167
+ // The registry will throw if it doesn't know what this type is.
168
+ const entryToTypeAndName = (reg) => (rawEntry) => {
169
+ // split on the first colon, and then join the rest back together to support names that include colons
170
+ const [typeName, ...name] = rawEntry.split(':').map((entry) => entry.trim());
171
+ const type = reg.getTypeByName(typeName);
172
+ const parent = reg.getParentType(typeName);
173
+ // If a user is requesting a child type that is unaddressable (more common with custom registries to create proper behavior)
174
+ // throw an error letting them know to use the entire parent instead
175
+ // or if they're requesting a COFT, unadressable without parent, don't throw because the parent could be requested - we don't know at this point
176
+ if (type.isAddressable === false && parent !== undefined && !type.unaddressableWithoutParent) {
177
+ throw new Error(`Cannot use this type, instead use ${parent.name}`);
178
+ }
179
+ return { type, metadataName: name.length ? name.join(':') : '*' };
180
+ };
181
+ exports.entryToTypeAndName = entryToTypeAndName;
182
+ const typeAndNameToMetadataComponents = (context) => ({ type, metadataName }) =>
183
+ // this '.*' is a surprisingly valid way to specify a metadata, especially a DEB :sigh:
184
+ // https://github.com/salesforcecli/plugin-deploy-retrieve/blob/main/test/nuts/digitalExperienceBundle/constants.ts#L140
185
+ // because we're filtering from what we have locally, this won't allow you to retrieve new metadata (on the server only) using the partial wildcard
186
+ // to do that, you'd need check the size of the CS created below, see if it's 0, and then query the org for the metadata that matches the regex
187
+ // but building a CS from a metadata argument doesn't require an org, so we can't do that here
188
+ metadataName?.includes('*') && metadataName.length > 1 && !metadataName.includes('.*')
189
+ ? // get all components of the type, and then filter by the regex of the fullName
190
+ componentSet_1.ComponentSet.fromSource({
191
+ fsPaths: context.directoryPaths,
192
+ include: new componentSet_1.ComponentSet([{ type, fullName: componentSet_1.ComponentSet.WILDCARD }], context.registry),
193
+ registry: context.registry,
194
+ })
195
+ .getSourceComponents()
196
+ .toArray()
197
+ // using minimatch versus RegExp provides better (more expected) matching results
198
+ .filter((cs) => minimatch(cs.fullName, metadataName))
199
+ : [{ type, fullName: metadataName }];
200
+ // TODO: use Map.groupBy when it's available
201
+ const buildMapFromComponents = (components) => {
202
+ const mdMap = new Map();
203
+ components.map((cmp) => {
204
+ mdMap.set(cmp.type.name, [...(mdMap.get(cmp.type.name) ?? []), cmp.metadataName]);
205
+ });
206
+ return mdMap;
207
+ };
202
208
  //# sourceMappingURL=componentSetBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"componentSetBuilder.js","sourceRoot":"","sources":["../../../src/collections/componentSetBuilder.ts"],"names":[],"mappings":";AAAA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I,EAAE,QAAQ,EAAE,2BAAY,CAAC,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;YACxF,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;aACC,mBAAmB,EAAE;aACrB,OAAO,EAAE;YACV,iFAAiF;aAChF,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;AAE3C,4CAA4C;AAC5C,MAAM,sBAAsB,GAAG,CAAC,UAAyC,EAAe,EAAE;IACxF,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACrB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Connection } from '@salesforce/core';
2
- import { OptionalTreeRegistryOptions, XML_NS_KEY } from '../common';
2
+ import { OptionalTreeRegistryOptions } from '../common/types';
3
+ import { XML_NS_KEY } from '../common/constants';
3
4
  import { FileProperties } from '../client/types';
4
5
  import { ComponentSet } from './componentSet';
5
6
  export interface PackageTypeMembers {
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DestructiveChangesType = void 0;
4
- const common_1 = require("../common");
4
+ const constants_1 = require("../common/constants");
5
+ // TODO NEXT MAJOR: use a string union type
5
6
  var DestructiveChangesType;
6
7
  (function (DestructiveChangesType) {
7
8
  DestructiveChangesType["POST"] = "post";
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/collections/types.ts"],"names":[],"mappings":";;;AAOA,sCAAoE;AAkBpE,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,qCAAW,CAAA;AACb,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/collections/types.ts"],"names":[],"mappings":";;;AAQA,mDAAiD;AAkBjD,2CAA2C;AAC3C,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,qCAAW,CAAA;AACb,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC"}
@@ -1,5 +1,5 @@
1
- import { RegistryAccess } from '../registry';
2
- import { TreeContainer } from '../resolve';
1
+ import { RegistryAccess } from '../registry/registryAccess';
2
+ import { TreeContainer } from '../resolve/treeContainers';
3
3
  /**
4
4
  * File system path to a source file of a metadata component.
5
5
  */
@@ -0,0 +1,13 @@
1
+ import { WriterFormat } from '../types';
2
+ import { RecompositionFinalizer } from './recompositionFinalizer';
3
+ import { NonDecompositionFinalizer } from './nonDecompositionFinalizer';
4
+ import { DecompositionFinalizer } from './decompositionFinalizer';
5
+ /**
6
+ * A state manager over the course of a single metadata conversion call.
7
+ */
8
+ export declare class ConvertContext {
9
+ readonly decomposition: DecompositionFinalizer;
10
+ readonly recomposition: RecompositionFinalizer;
11
+ readonly nonDecomposition: NonDecompositionFinalizer;
12
+ executeFinalizers(defaultDirectory?: string): AsyncIterable<WriterFormat[]>;
13
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConvertContext = void 0;
4
+ const recompositionFinalizer_1 = require("./recompositionFinalizer");
5
+ const nonDecompositionFinalizer_1 = require("./nonDecompositionFinalizer");
6
+ const decompositionFinalizer_1 = require("./decompositionFinalizer");
7
+ const transactionFinalizer_1 = require("./transactionFinalizer");
8
+ /**
9
+ * A state manager over the course of a single metadata conversion call.
10
+ */
11
+ class ConvertContext {
12
+ constructor() {
13
+ this.decomposition = new decompositionFinalizer_1.DecompositionFinalizer();
14
+ this.recomposition = new recompositionFinalizer_1.RecompositionFinalizer();
15
+ this.nonDecomposition = new nonDecompositionFinalizer_1.NonDecompositionFinalizer();
16
+ }
17
+ // eslint-disable-next-line @typescript-eslint/require-await
18
+ async *executeFinalizers(defaultDirectory) {
19
+ for (const member of Object.values(this)) {
20
+ if (member instanceof transactionFinalizer_1.ConvertTransactionFinalizer) {
21
+ yield member.finalize(defaultDirectory);
22
+ }
23
+ }
24
+ }
25
+ }
26
+ exports.ConvertContext = ConvertContext;
27
+ //# sourceMappingURL=convertContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertContext.js","sourceRoot":"","sources":["../../../../src/convert/convertContext/convertContext.ts"],"names":[],"mappings":";;;AAOA,qEAAkE;AAClE,2EAAwE;AACxE,qEAAkE;AAClE,iEAAqE;AAErE;;GAEG;AACH,MAAa,cAAc;IAA3B;QACkB,kBAAa,GAAG,IAAI,+CAAsB,EAAE,CAAC;QAC7C,kBAAa,GAAG,IAAI,+CAAsB,EAAE,CAAC;QAC7C,qBAAgB,GAAG,IAAI,qDAAyB,EAAE,CAAC;IAUrE,CAAC;IARC,4DAA4D;IACrD,KAAK,CAAC,CAAC,iBAAiB,CAAC,gBAAyB;QACvD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,IAAI,MAAM,YAAY,kDAA2B,EAAE,CAAC;gBAClD,MAAM,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAbD,wCAaC"}
@@ -0,0 +1,19 @@
1
+ import { MetadataComponent } from '../../resolve/types';
2
+ import { WriteInfo, WriterFormat } from '../types';
3
+ import { ConvertTransactionFinalizer } from './transactionFinalizer';
4
+ export type DecompositionStateValue = {
5
+ /** mark it true if the merge has been found. Absence of a value means "it wasn't found yet'" */
6
+ foundMerge?: true;
7
+ writeInfo?: WriteInfo;
8
+ origin?: MetadataComponent;
9
+ };
10
+ export type DecompositionState = Map<string, DecompositionStateValue>;
11
+ /**
12
+ * Creates write infos for any children that haven't been written yet. Children may
13
+ * delay being written in order to find potential existing children to merge
14
+ * with in the conversion pipeline.
15
+ */
16
+ export declare class DecompositionFinalizer extends ConvertTransactionFinalizer<DecompositionState> {
17
+ transactionState: DecompositionState;
18
+ finalize(): Promise<WriterFormat[]>;
19
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecompositionFinalizer = void 0;
4
+ const transactionFinalizer_1 = require("./transactionFinalizer");
5
+ /** DecompositionStateValue has all props as optional. The makes writeInfo and origin required */
6
+ const hasFullDecompositionInfo = (value) => Boolean(value[1].writeInfo) && Boolean(value[1].origin);
7
+ /**
8
+ * Creates write infos for any children that haven't been written yet. Children may
9
+ * delay being written in order to find potential existing children to merge
10
+ * with in the conversion pipeline.
11
+ */
12
+ class DecompositionFinalizer extends transactionFinalizer_1.ConvertTransactionFinalizer {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.transactionState = new Map();
16
+ }
17
+ // eslint-disable-next-line @typescript-eslint/require-await
18
+ async finalize() {
19
+ return (Array.from(this.transactionState.entries())
20
+ .filter(hasFullDecompositionInfo)
21
+ // return `false` and the undefined
22
+ .filter(([, value]) => !value.foundMerge)
23
+ .map(([, value]) => ({ component: value.origin?.parent ?? value.origin, writeInfos: [value.writeInfo] })));
24
+ }
25
+ }
26
+ exports.DecompositionFinalizer = DecompositionFinalizer;
27
+ //# sourceMappingURL=decompositionFinalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decompositionFinalizer.js","sourceRoot":"","sources":["../../../../src/convert/convertContext/decompositionFinalizer.ts"],"names":[],"mappings":";;;AAQA,iEAAqE;AAUrE,mGAAmG;AACnG,MAAM,wBAAwB,GAAG,CAC/B,KAAwC,EAC0D,EAAE,CACpG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAa,sBAAuB,SAAQ,kDAA+C;IAA3F;;QACS,qBAAgB,GAAuB,IAAI,GAAG,EAAmC,CAAC;IAY3F,CAAC;IAVC,4DAA4D;IACrD,KAAK,CAAC,QAAQ;QACnB,OAAO,CACL,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;aACxC,MAAM,CAAC,wBAAwB,CAAC;YACjC,mCAAmC;aAClC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;aACxC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAC5G,CAAC;IACJ,CAAC;CACF;AAbD,wDAaC"}
@@ -0,0 +1,42 @@
1
+ import { JsonMap } from '@salesforce/ts-types';
2
+ import { NodeFSTreeContainer, TreeContainer } from '../../resolve/treeContainers';
3
+ import { SourceComponent } from '../../resolve/sourceComponent';
4
+ import { WriterFormat } from '../types';
5
+ import { ConvertTransactionFinalizer } from './transactionFinalizer';
6
+ type NonDecompositionState = {
7
+ childrenByUniqueElement: Map<string, JsonMap>;
8
+ exampleComponent?: SourceComponent;
9
+ };
10
+ /**
11
+ * Merges child components that share the same parent in the conversion pipeline
12
+ * into a single file.
13
+ *
14
+ * Inserts unclaimed child components into the parent that belongs to the default package
15
+ */
16
+ export declare class NonDecompositionFinalizer extends ConvertTransactionFinalizer<NonDecompositionState> {
17
+ transactionState: NonDecompositionState;
18
+ protected mergeMap: Map<string, Map<string, JsonMap>>;
19
+ protected parentComponentMap: Map<string, SourceComponent>;
20
+ protected tree: TreeContainer | undefined;
21
+ finalize(defaultDirectory: string, tree?: NodeFSTreeContainer): Promise<WriterFormat[]>;
22
+ private initChildMapping;
23
+ /**
24
+ * check both top-level maps and make sure there are defaults
25
+ */
26
+ private ensureDefaults;
27
+ /**
28
+ * Returns all the components of the incoming type in the project.
29
+ *
30
+ * Some components are not resolved during component resolution.
31
+ * This typically only happens when a specific source path was resolved. This is problematic for
32
+ * nondecomposed metadata types (like CustomLabels) because we need to know the location of each
33
+ * child type before recomposing the final xml.
34
+ * The labels could belong in any of the files OR need to go in the default location which already contains labels
35
+ */
36
+ private getAllComponentsOfType;
37
+ /**
38
+ * Populate the mergeMap with all the children of all the local components
39
+ */
40
+ private initMergeMap;
41
+ }
42
+ export {};