@salesforce/source-deploy-retrieve 13.14.6-d360.0 → 13.15.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.
- package/lib/src/client/metadataApiDeploy.js +1 -1
- package/lib/src/client/metadataApiDeploy.js.map +1 -1
- package/lib/src/client/metadataApiRetrieve.js +1 -1
- package/lib/src/client/metadataApiRetrieve.js.map +1 -1
- package/lib/src/client/metadataTransfer.js +1 -1
- package/lib/src/client/metadataTransfer.js.map +1 -1
- package/lib/src/client/transports/transportPipeline.js +1 -1
- package/lib/src/client/transports/transportPipeline.js.map +1 -1
- package/lib/src/collections/componentSet.d.ts +0 -27
- package/lib/src/collections/componentSet.js +2 -50
- package/lib/src/collections/componentSet.js.map +1 -1
- package/lib/src/collections/componentSetBuilder.d.ts +0 -5
- package/lib/src/collections/componentSetBuilder.js +1 -8
- package/lib/src/collections/componentSetBuilder.js.map +1 -1
- package/lib/src/collections/index.d.ts +0 -1
- package/lib/src/collections/index.js +1 -3
- package/lib/src/collections/index.js.map +1 -1
- package/lib/src/convert/convertContext/profileMetadataFinalizer.js +34 -2
- package/lib/src/convert/convertContext/profileMetadataFinalizer.js.map +1 -1
- package/lib/src/convert/convertContext/recompositionFinalizer.js +1 -1
- package/lib/src/convert/convertContext/recompositionFinalizer.js.map +1 -1
- package/lib/src/convert/metadataConverter.js +1 -1
- package/lib/src/convert/metadataConverter.js.map +1 -1
- package/lib/src/convert/replacements.js +1 -1
- package/lib/src/convert/replacements.js.map +1 -1
- package/lib/src/convert/streams.js +1 -1
- package/lib/src/convert/streams.js.map +1 -1
- package/lib/src/convert/transformers/computeAppMetadataTransformer.js +1 -1
- package/lib/src/convert/transformers/computeAppMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/decomposedMetadataTransformer.js +1 -1
- package/lib/src/convert/transformers/decomposedMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/defaultMetadataTransformer.js +1 -1
- package/lib/src/convert/transformers/defaultMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/enrichmentMetadataTransformer.d.ts +16 -0
- package/lib/src/convert/transformers/enrichmentMetadataTransformer.js +67 -0
- package/lib/src/convert/transformers/enrichmentMetadataTransformer.js.map +1 -0
- package/lib/src/convert/transformers/metadataTransformerFactory.js +4 -4
- package/lib/src/convert/transformers/metadataTransformerFactory.js.map +1 -1
- package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.js +1 -1
- package/lib/src/convert/transformers/nonDecomposedMetadataTransformer.js.map +1 -1
- package/lib/src/convert/transformers/staticResourceMetadataTransformer.js +1 -1
- package/lib/src/convert/transformers/staticResourceMetadataTransformer.js.map +1 -1
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/registry/levenshtein.js +1 -1
- package/lib/src/registry/levenshtein.js.map +1 -1
- package/lib/src/registry/metadataRegistry.json +28 -238
- package/lib/src/registry/registryAccess.d.ts +21 -0
- package/lib/src/registry/registryAccess.js +27 -1
- package/lib/src/registry/registryAccess.js.map +1 -1
- package/lib/src/registry/types.d.ts +17 -7
- package/lib/src/registry/types.js.map +1 -1
- package/lib/src/registry/variants.js +1 -1
- package/lib/src/registry/variants.js.map +1 -1
- package/lib/src/resolve/adapters/baseSourceAdapter.js +1 -1
- package/lib/src/resolve/adapters/baseSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/decomposedSourceAdapter.js +1 -1
- package/lib/src/resolve/adapters/decomposedSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.js +1 -1
- package/lib/src/resolve/adapters/digitalExperienceSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/enrichmentSourceAdapter.d.ts +20 -0
- package/lib/src/resolve/adapters/enrichmentSourceAdapter.js +46 -0
- package/lib/src/resolve/adapters/enrichmentSourceAdapter.js.map +1 -0
- package/lib/src/resolve/adapters/index.d.ts +0 -1
- package/lib/src/resolve/adapters/index.js +1 -3
- package/lib/src/resolve/adapters/index.js.map +1 -1
- package/lib/src/resolve/adapters/matchingContentSourceAdapter.js +1 -1
- package/lib/src/resolve/adapters/matchingContentSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/mixedContentSourceAdapter.js +1 -1
- package/lib/src/resolve/adapters/mixedContentSourceAdapter.js.map +1 -1
- package/lib/src/resolve/adapters/sourceAdapterFactory.js +4 -4
- package/lib/src/resolve/adapters/sourceAdapterFactory.js.map +1 -1
- package/lib/src/resolve/adapters/uiBundlesSourceAdapter.js +1 -1
- package/lib/src/resolve/adapters/uiBundlesSourceAdapter.js.map +1 -1
- package/lib/src/resolve/connectionResolver.js +1 -1
- package/lib/src/resolve/connectionResolver.js.map +1 -1
- package/lib/src/resolve/metadataResolver.js +29 -3
- package/lib/src/resolve/metadataResolver.js.map +1 -1
- package/lib/src/resolve/sourceComponent.js +1 -1
- package/lib/src/resolve/sourceComponent.js.map +1 -1
- package/lib/src/resolve/treeContainers.js +1 -1
- package/lib/src/resolve/treeContainers.js.map +1 -1
- package/lib/src/utils/filePathGenerator.js +4 -2
- package/lib/src/utils/filePathGenerator.js.map +1 -1
- package/lib/src/utils/path.js +1 -1
- package/lib/src/utils/path.js.map +1 -1
- package/messages/sdr.md +4 -28
- package/package.json +1 -1
- package/lib/src/collections/d360Dependencies.d.ts +0 -55
- package/lib/src/collections/d360Dependencies.js +0 -445
- package/lib/src/collections/d360Dependencies.js.map +0 -1
- package/lib/src/convert/transformers/d360MetadataTransformer.d.ts +0 -37
- package/lib/src/convert/transformers/d360MetadataTransformer.js +0 -213
- package/lib/src/convert/transformers/d360MetadataTransformer.js.map +0 -1
- package/lib/src/resolve/adapters/d360SourceAdapter.d.ts +0 -86
- package/lib/src/resolve/adapters/d360SourceAdapter.js +0 -180
- package/lib/src/resolve/adapters/d360SourceAdapter.js.map +0 -1
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeSidecars = exports.D360MetadataTransformer = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2026, Salesforce, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
const promises_1 = require("node:fs/promises");
|
|
20
|
-
const node_path_1 = require("node:path");
|
|
21
|
-
const node_stream_1 = require("node:stream");
|
|
22
|
-
const logger_1 = require("@salesforce/core/logger");
|
|
23
|
-
const messages_1 = require("@salesforce/core/messages");
|
|
24
|
-
const sfError_1 = require("@salesforce/core/sfError");
|
|
25
|
-
const constants_1 = require("../../common/constants");
|
|
26
|
-
const d360SourceAdapter_1 = require("../../resolve/adapters/d360SourceAdapter");
|
|
27
|
-
const manifestResolver_1 = require("../../resolve/manifestResolver");
|
|
28
|
-
const replacements_1 = require("../replacements");
|
|
29
|
-
const baseMetadataTransformer_1 = require("./baseMetadataTransformer");
|
|
30
|
-
;
|
|
31
|
-
const messages = new messages_1.Messages('@salesforce/source-deploy-retrieve', 'sdr', new Map([["md_request_fail", "Metadata API request failed: %s"], ["error_retry_limit_exceeded", "Exceeded maximum of %s consecutive retryable errors. Last error: %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_profile_singleton_conflict", "Profile %s has conflicting values for singleton tag %s in source paths %s and %s."], ["error_invalid_test_level", "TestLevel cannot be '%s' unless API version is %s or later"], ["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_transport_provider", "No transport provider is registered for '%s' required by %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_attempting_zip_slip", "Entry '%s' in static resource '%s' resolves to a location outside the extraction directory ('%s')."], ["error_static_resource_symlink", "Entry '%s' in static resource '%s' would be written through a symbolic link ('%s'). Writing through symbolic links is not allowed because it can place files outside the extraction directory ('%s')."], ["error_retrieve_symlink", "File '%s' would be written through a symbolic link ('%s'). Writing through symbolic links is not allowed during retrieve because it can place files outside the project directory ('%s')."], ["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>"], ["error_directory_name_path_traversal", "The directoryName '%s' for metadata type '%s' contains path segments that resolve outside the project root. Verify your registryCustomizations in sfdx-project.json do not contain directory traversal sequences."], ["error_write_path_outside_root", "The write path '%s' resolves outside the root destination '%s'. This may indicate a path traversal attempt via registryCustomizations."], ["warning_jwt_api_version", "This org uses JWT-based access tokens, which require API version 68.0 or later for SOAP metadata operations. The current API version is %s, so metadata listing may return empty or incomplete results. To resolve, update sourceApiVersion in sfdx-project.json to 68.0 or higher."], ["type_name_suggestions", "Confirm the metadata type name is 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>"], ["warning_d360_outside_root", "%s was skipped. A %s is only read from a d360 folder, as d360/%s/<name>.json or d360/dataspace/<dataspace>/%s/<name>.json"], ["warning_d360_peer_not_found", "%s deploys together with %s, but that component wasn't found in %s, so the deploy doesn't include it. Components that deploy together are only looked up in the same d360 folder."], ["warning_d360_peer_ignored", "%s deploys together with %s, but .forceignore excludes %s, so the deploy doesn't include it."], ["error_d360_outside_root", "%s: A %s must be stored under a d360 folder, as d360/%s/<name>.json or d360/dataspace/<dataspace>/%s/<name>.json"], ["error_d360_delete_unsupported", "D360 components can't be deleted: %s. Leave them out of the delete and try again."], ["error_d360_invalid_sidecar", "%s: The sidecar %s isn't valid JSON, so the components it deploys together with can't be read. Retrieve the component again to restore it."], ["error_d360_missing_sidecar", "%s: The %s sidecar %s is missing. A D360 component deploys as its .json file together with its .meta.json sidecar. Retrieve the component again to restore it."]]));
|
|
32
|
-
/**
|
|
33
|
-
* Transformer for any D360 dataspace-scoped type. It is type-agnostic — it operates purely on
|
|
34
|
-
* the `d360/dataspace/<dataspace>/<typeDir>/` path shape and the sidecar convention, so it applies
|
|
35
|
-
* unchanged to every dataspace-scoped type; onboarding a new one is a registry change, not a code change.
|
|
36
|
-
*
|
|
37
|
-
* Each component is a PAIR of generic `.json` files nested under a
|
|
38
|
-
* `d360/dataspace/<dataspace>/<typeDir>/` wrapper: the payload `<name>.json` (the component's
|
|
39
|
-
* content) and a `<name>.meta.json` sidecar (`{ componentType, componentName, dataspaceName,
|
|
40
|
-
* deploysWith, dependsOn }`). The stock `calculateRelativePath` would collapse the path to
|
|
41
|
-
* `<typeDir>/<name>.json` (dropping the `d360/dataspace/<ds>/` prefix), so this transformer instead
|
|
42
|
-
* preserves the whole path from `d360` down and co-writes the sidecar. The layout is identical in
|
|
43
|
-
* both directions:
|
|
44
|
-
*
|
|
45
|
-
* - source format: `main/default/d360/dataspace/<ds>/<typeDir>/<name>.json` (+ `.meta.json`)
|
|
46
|
-
* - metadata format: `d360/dataspace/<ds>/<typeDir>/<name>.json` (+ `.meta.json`)
|
|
47
|
-
*/
|
|
48
|
-
class D360MetadataTransformer extends baseMetadataTransformer_1.BaseMetadataTransformer {
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/require-await, class-methods-use-this
|
|
50
|
-
async toMetadataFormat(component) {
|
|
51
|
-
// The org rejects a payload deployed without its sidecar, so stop here with a clearer message.
|
|
52
|
-
const sidecar = component.content?.replace(/\.json$/, d360SourceAdapter_1.METADATA_SIDECAR_SUFFIX);
|
|
53
|
-
if (sidecar && !component.tree.exists(sidecar)) {
|
|
54
|
-
throw new sfError_1.SfError(messages.getMessage('error_d360_missing_sidecar', [component.content, component.type.name, sidecar]), 'ExpectedSourceFilesError');
|
|
55
|
-
}
|
|
56
|
-
return getWriteInfos(component, 'metadata');
|
|
57
|
-
}
|
|
58
|
-
async toSourceFormat({ component, mergeWith, }) {
|
|
59
|
-
const infos = getWriteInfos(component, 'source', mergeWith);
|
|
60
|
-
const { defaultDirectory } = this;
|
|
61
|
-
const scope = await getRequestedScope(component, this.registry);
|
|
62
|
-
const sidecars = new Map(getSidecars(component).map((sidecar) => [getSourceDestination(sidecar, component, mergeWith), sidecar]));
|
|
63
|
-
return Promise.all(infos.map(async (info) => {
|
|
64
|
-
const sidecar = sidecars.get(info.output);
|
|
65
|
-
// A relative output is written under the default directory, an absolute one where it points.
|
|
66
|
-
const localPath = (0, node_path_1.isAbsolute)(info.output)
|
|
67
|
-
? info.output
|
|
68
|
-
: defaultDirectory
|
|
69
|
-
? (0, node_path_1.join)(defaultDirectory, info.output)
|
|
70
|
-
: undefined;
|
|
71
|
-
return sidecar && localPath
|
|
72
|
-
? mergeWithLocalSidecar((await component.tree.readFile(sidecar)).toString('utf8'), info, localPath, scope)
|
|
73
|
-
: info;
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.D360MetadataTransformer = D360MetadataTransformer;
|
|
78
|
-
/** The `<name>.meta.json` sidecar of each payload file the component has one for. */
|
|
79
|
-
const getSidecars = (component) => component
|
|
80
|
-
.walkContent()
|
|
81
|
-
.map((path) => path.replace(/\.json$/, d360SourceAdapter_1.METADATA_SIDECAR_SUFFIX))
|
|
82
|
-
.filter((sidecar) => sidecar.endsWith(d360SourceAdapter_1.METADATA_SIDECAR_SUFFIX) && component.tree.exists(sidecar));
|
|
83
|
-
const getWriteInfos = (component, targetFormat, mergeWith) =>
|
|
84
|
-
// walkContent() yields only the payload file(s), so their sidecars are added to write both halves of each pair.
|
|
85
|
-
[...component.walkContent(), ...getSidecars(component)].map((path) => ({
|
|
86
|
-
source: (0, replacements_1.getReplacementStreamForReadable)(component, path),
|
|
87
|
-
output: targetFormat === 'source'
|
|
88
|
-
? getSourceDestination(path, component, mergeWith)
|
|
89
|
-
: getD360Destination(path, targetFormat, component),
|
|
90
|
-
}));
|
|
91
|
-
/**
|
|
92
|
-
* Where a retrieved file goes in the project. A component already in the project is written over its
|
|
93
|
-
* own files, wherever they are; a new one goes under the default directory.
|
|
94
|
-
*/
|
|
95
|
-
const getSourceDestination = (path, component, mergeWith) => {
|
|
96
|
-
if (!mergeWith?.content) {
|
|
97
|
-
return getD360Destination(path, 'source', component);
|
|
98
|
-
}
|
|
99
|
-
return path.endsWith(d360SourceAdapter_1.METADATA_SIDECAR_SUFFIX)
|
|
100
|
-
? mergeWith.content.replace(/\.json$/, d360SourceAdapter_1.METADATA_SIDECAR_SUFFIX)
|
|
101
|
-
: mergeWith.content;
|
|
102
|
-
};
|
|
103
|
-
/** The `package.xml` an org returns next to the retrieved files. It lists what the retrieve asked for. */
|
|
104
|
-
const RETRIEVE_MANIFEST = 'package.xml';
|
|
105
|
-
/** A retrieve's manifest is read once, however many components it returned. */
|
|
106
|
-
const requestedMembersByTree = new WeakMap();
|
|
107
|
-
const readRequestedMembers = (tree, manifestPath, registry) => {
|
|
108
|
-
const byPath = requestedMembersByTree.get(tree) ?? new Map();
|
|
109
|
-
requestedMembersByTree.set(tree, byPath);
|
|
110
|
-
const cached = byPath.get(manifestPath);
|
|
111
|
-
if (cached) {
|
|
112
|
-
return cached;
|
|
113
|
-
}
|
|
114
|
-
const members = new manifestResolver_1.ManifestResolver(tree, registry)
|
|
115
|
-
.resolve(manifestPath)
|
|
116
|
-
.then(({ components }) => components)
|
|
117
|
-
.catch((error) => {
|
|
118
|
-
logger_1.Logger.childFromRoot('D360MetadataTransformer').debug(`Can't read ${manifestPath}, so D360 sidecars are merged by their peers only: ${error.message}`);
|
|
119
|
-
return [];
|
|
120
|
-
});
|
|
121
|
-
byPath.set(manifestPath, members);
|
|
122
|
-
return members;
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Read from the manifest next to the retrieved `d360` folder. With no manifest, or when the
|
|
126
|
-
* component wasn't asked for itself (it came back as a peer), nothing is known about the request.
|
|
127
|
-
*/
|
|
128
|
-
const getRequestedScope = async (component, registry) => {
|
|
129
|
-
const root = component.content ? (0, d360SourceAdapter_1.getD360Location)(component.content, component.type.directoryName)?.root : undefined;
|
|
130
|
-
const manifestPath = root ? (0, node_path_1.join)((0, node_path_1.dirname)(root), RETRIEVE_MANIFEST) : undefined;
|
|
131
|
-
if (!manifestPath || !component.tree.exists(manifestPath)) {
|
|
132
|
-
return { bareName: false, dataspaces: [] };
|
|
133
|
-
}
|
|
134
|
-
const names = (await readRequestedMembers(component.tree, manifestPath, registry))
|
|
135
|
-
.filter((member) => member.type.name === component.type.name)
|
|
136
|
-
.map((member) => member.fullName);
|
|
137
|
-
return {
|
|
138
|
-
bareName: names.includes(component.fullName),
|
|
139
|
-
dataspaces: names
|
|
140
|
-
.map(d360SourceAdapter_1.parseDataspaceQualifiedName)
|
|
141
|
-
.filter((parsed) => parsed?.name === component.fullName)
|
|
142
|
-
.map((parsed) => parsed.dataspace),
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Merge a retrieved sidecar into the one already in the project, if any. The retrieved sidecar is
|
|
147
|
-
* written unchanged when there is no local one, when the component was asked for by its bare name,
|
|
148
|
-
* or when nothing in the local one needs keeping.
|
|
149
|
-
*/
|
|
150
|
-
const mergeWithLocalSidecar = async (retrieved, info, localPath, scope) => {
|
|
151
|
-
if (scope.bareName) {
|
|
152
|
-
return info;
|
|
153
|
-
}
|
|
154
|
-
let local;
|
|
155
|
-
try {
|
|
156
|
-
local = await (0, promises_1.readFile)(localPath, 'utf8');
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
return info;
|
|
160
|
-
}
|
|
161
|
-
const merged = (0, exports.mergeSidecars)(local, retrieved, scope.dataspaces);
|
|
162
|
-
return merged === retrieved ? info : { output: info.output, source: node_stream_1.Readable.from(merged) };
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* A component outside any dataspace (e.g. a Data Lake Object) has one sidecar on disk but can be
|
|
166
|
-
* retrieved once per dataspace, and each retrieve only reports the peers of the dataspace it was run
|
|
167
|
-
* for. Rather than letting the latest retrieve overwrite the others, keep the existing peers of every
|
|
168
|
-
* dataspace the new retrieve didn't cover and take the rest from the new sidecar.
|
|
169
|
-
*
|
|
170
|
-
* A dataspace is covered when the new sidecar has a peer in it, or when the retrieve asked for it in
|
|
171
|
-
* `requestedDataspaces`. The second catches a dataspace with no peers left in the org, whose old
|
|
172
|
-
* peers must go.
|
|
173
|
-
*/
|
|
174
|
-
const mergeSidecars = (existingJson, incomingJson, requestedDataspaces = []) => {
|
|
175
|
-
let existing;
|
|
176
|
-
let incoming;
|
|
177
|
-
try {
|
|
178
|
-
existing = JSON.parse(existingJson);
|
|
179
|
-
incoming = JSON.parse(incomingJson);
|
|
180
|
-
}
|
|
181
|
-
catch {
|
|
182
|
-
return incomingJson;
|
|
183
|
-
}
|
|
184
|
-
const incomingPeers = incoming.deploysWith ?? [];
|
|
185
|
-
const covered = new Set([incoming.dataspaceName, ...requestedDataspaces, ...incomingPeers.map((ref) => ref.dataspaceName)].filter(Boolean));
|
|
186
|
-
const keyOf = (ref) => `${ref.componentType ?? ''}|${ref.dataspaceName ?? ''}|${ref.name ?? ''}`;
|
|
187
|
-
const incomingKeys = new Set(incomingPeers.map(keyOf));
|
|
188
|
-
const kept = (existing.deploysWith ?? []).filter((ref) => ref.dataspaceName && !covered.has(ref.dataspaceName) && !incomingKeys.has(keyOf(ref)));
|
|
189
|
-
if (!kept.length) {
|
|
190
|
-
return incomingJson;
|
|
191
|
-
}
|
|
192
|
-
return `${JSON.stringify({ ...incoming, deploysWith: [...kept, ...incomingPeers] }, null, 2)}\n`;
|
|
193
|
-
};
|
|
194
|
-
exports.mergeSidecars = mergeSidecars;
|
|
195
|
-
/**
|
|
196
|
-
* Build the destination path preserving the `d360/dataspace/<ds>/<typeDir>/<name>.json` structure.
|
|
197
|
-
* Source format is rooted under `main/default`; metadata format keeps it at the package root.
|
|
198
|
-
*/
|
|
199
|
-
const getD360Destination = (source, targetFormat, component) => {
|
|
200
|
-
const base = targetFormat === 'source' ? constants_1.DEFAULT_PACKAGE_ROOT_SFDX : '';
|
|
201
|
-
// The adapter only resolves files under a `d360` folder, so this is a guard, not an expected path.
|
|
202
|
-
const relative = (0, d360SourceAdapter_1.getD360RelativePath)(source, component.type.directoryName);
|
|
203
|
-
if (!relative) {
|
|
204
|
-
throw new sfError_1.SfError(messages.getMessage('error_d360_outside_root', [
|
|
205
|
-
source,
|
|
206
|
-
component.type.name,
|
|
207
|
-
component.type.directoryName,
|
|
208
|
-
component.type.directoryName,
|
|
209
|
-
]), 'ExpectedSourceFilesError');
|
|
210
|
-
}
|
|
211
|
-
return (0, node_path_1.join)(base, relative);
|
|
212
|
-
};
|
|
213
|
-
//# sourceMappingURL=d360MetadataTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"d360MetadataTransformer.js","sourceRoot":"","sources":["../../../../src/convert/transformers/d360MetadataTransformer.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,+CAA4C;AAC5C,yCAAsD;AACtD,6CAAuC;AACvC,oDAAiD;AACjD,wDAAqD;AACrD,sDAAmD;AACnD,sDAAmE;AAEnE,gFAKkD;AAClD,qEAAkE;AAIlE,kDAAkE;AAGlE,uEAAoE;;AAGpE,MAAM,QAAQ,OAAG,mBAAQ,CAAc,oCAAoC,EAAE,KAAK,wiRAAC,CAAC;AAEpF;;;;;;;;;;;;;;;GAeG;AACH,MAAa,uBAAwB,SAAQ,iDAAuB;IAClE,oFAAoF;IAC7E,KAAK,CAAC,gBAAgB,CAAC,SAA0B;QACtD,+FAA+F;QAC/F,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,2CAAuB,CAAC,CAAC;QAC/E,IAAI,OAAO,IAAI,CAAC,SAAS,C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E,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,iBAAO,CACf,QAAQ,CAAC,UAAU,CAAC,yBAAyB,EAAE;YAC7C,MAAM;YACN,SAAS,CAAC,IAAI,CAAC,IAAI;YACnB,SAAS,CAAC,IAAI,CAAC,aAAa;YAC5B,SAAS,CAAC,IAAI,CAAC,aAAa;SAC7B,CAAC,EACF,0BAA0B,CAC3B,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,gBAAI,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { SourcePath } from '../../common/types';
|
|
2
|
-
import { MetadataType } from '../../registry/types';
|
|
3
|
-
import { MetadataXml } from '../types';
|
|
4
|
-
import { SourceComponent } from '../sourceComponent';
|
|
5
|
-
import { TreeContainer } from '../treeContainers';
|
|
6
|
-
import { MixedContentSourceAdapter } from './mixedContentSourceAdapter';
|
|
7
|
-
/** Filename suffix of the per-component metadata sidecar (`<name>.meta.json`). */
|
|
8
|
-
export declare const METADATA_SIDECAR_SUFFIX = ".meta.json";
|
|
9
|
-
/** Folder every D360 component is stored under, on disk and in the metadata package. */
|
|
10
|
-
export declare const D360_ROOT = "d360";
|
|
11
|
-
/** Where a D360 file sits in its `d360` folder. */
|
|
12
|
-
export type D360Location = {
|
|
13
|
-
/** The `d360` folder itself. */
|
|
14
|
-
root: SourcePath;
|
|
15
|
-
/** The dataspace the file is in, or undefined when it is outside every dataspace. */
|
|
16
|
-
dataspace?: string;
|
|
17
|
-
/** The path from the `d360` folder down. */
|
|
18
|
-
relativePath: SourcePath;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Where a file of the type stored in `typeDir` sits in its `d360` folder. The path must be
|
|
22
|
-
* `.../d360/<typeDir>/<file>` or `.../d360/dataspace/<dataspace>/<typeDir>/<file>`; any other shape
|
|
23
|
-
* returns undefined.
|
|
24
|
-
*/
|
|
25
|
-
export declare const getD360Location: (fsPath: SourcePath, typeDir: string) => D360Location | undefined;
|
|
26
|
-
/** The part of a path from its `d360` folder down. See {@link getD360Location}. */
|
|
27
|
-
export declare const getD360RelativePath: (fsPath: SourcePath, typeDir: string) => SourcePath | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* The payload path of a component in a `d360` folder: `<root>/<typeDir>/<name>.json`, or
|
|
30
|
-
* `<root>/dataspace/<dataspace>/<typeDir>/<name>.json` for a component in a dataspace.
|
|
31
|
-
*/
|
|
32
|
-
export declare const getD360ContentPath: (root: SourcePath, type: Pick<MetadataType, "directoryName">, name: string, dataspace?: string) => SourcePath;
|
|
33
|
-
/** The dataspace folders in a `d360` folder. */
|
|
34
|
-
export declare const getD360Dataspaces: (tree: TreeContainer, root: SourcePath) => string[];
|
|
35
|
-
/** The fullName of a component in a dataspace: `<dataspace>.<name>`. */
|
|
36
|
-
export declare const toDataspaceQualifiedName: (dataspace: string, name: string) => string;
|
|
37
|
-
/** Split `<dataspace>.<name>` into its parts, or return undefined when the name has no dataspace. */
|
|
38
|
-
export declare const parseDataspaceQualifiedName: (fullName: string) => {
|
|
39
|
-
dataspace: string;
|
|
40
|
-
name: string;
|
|
41
|
-
} | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Handles any D360 dataspace-scoped type whose layout nests a pair of JSON files per
|
|
44
|
-
* component under a `d360/dataspace/<dataspace>/<typeDir>/` wrapper. This adapter is type-agnostic:
|
|
45
|
-
* it derives everything from the path shape and the registered type, so onboarding a new
|
|
46
|
-
* dataspace-scoped type is a registry change (a type entry + directory mapping), never a code change.
|
|
47
|
-
*
|
|
48
|
-
* Each component is TWO files: the payload `<name>.json` (the component's definition) and a sidecar
|
|
49
|
-
* `<name>.meta.json` (`{ componentType, componentName, dataspaceName, deploysWith, dependsOn }`).
|
|
50
|
-
* There is no `-meta.xml`. The payload file is the component's content; the sidecar rides along as an
|
|
51
|
-
* extra file (written by the transformer) and is NOT resolved as a separate component.
|
|
52
|
-
*
|
|
53
|
-
* The component fullName is dataspace-scoped: `<dataspace>.<name>` (matching how the CLI
|
|
54
|
-
* addresses it, e.g. `<ComponentType>:<dataspace>.<name>`), where `<dataspace>` is the path
|
|
55
|
-
* segment immediately above the type's directory.
|
|
56
|
-
*
|
|
57
|
-
* __Example Structure__ (`<typeDir>` is the registered `directoryName` of any dataspace-scoped type):
|
|
58
|
-
*
|
|
59
|
-
*```text
|
|
60
|
-
* d360/dataspace/
|
|
61
|
-
* ├── <dataspace>/
|
|
62
|
-
* | ├── <typeDir>/
|
|
63
|
-
* | | ├── <name>.json -> <ComponentType>:<dataspace>.<name>
|
|
64
|
-
* | | ├── <name>.meta.json -> sidecar (not its own component)
|
|
65
|
-
*```
|
|
66
|
-
*/
|
|
67
|
-
export declare class D360SourceAdapter extends MixedContentSourceAdapter {
|
|
68
|
-
protected metadataWithContent: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* The single JSON file IS the content, not a root metadata xml. Returning undefined here
|
|
71
|
-
* (and from {@link getRootMetadataXmlPath}) ensures the base `getComponent` does NOT
|
|
72
|
-
* pre-build a SourceComponent with a plain, non-dataspace-scoped name — instead `populate`
|
|
73
|
-
* builds it with the correct `<dataspace>.<name>` fullName.
|
|
74
|
-
*/
|
|
75
|
-
protected parseAsRootMetadataXml(): MetadataXml | undefined;
|
|
76
|
-
protected getRootMetadataXmlPath(): SourcePath | undefined;
|
|
77
|
-
protected populate(trigger: SourcePath, component?: SourceComponent): SourceComponent | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Build `<dataspace>.<name>` from a path shaped like
|
|
80
|
-
* `.../d360/dataspace/<dataspace>/<typeDir>/<name>.json`. Types that aren't dataspace-scoped
|
|
81
|
-
* sit directly under `d360/<typeDir>/` and keep their bare `<name>`. Only the `.json` suffix is
|
|
82
|
-
* removed, so a name with dots in it, such as a relationship
|
|
83
|
-
* `<sourceObject>.<sourceField>_<targetObject>.<targetField>`, is kept whole.
|
|
84
|
-
*/
|
|
85
|
-
private calculateD360Name;
|
|
86
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.D360SourceAdapter = exports.parseDataspaceQualifiedName = exports.toDataspaceQualifiedName = exports.getD360Dataspaces = exports.getD360ContentPath = exports.getD360RelativePath = exports.getD360Location = exports.D360_ROOT = exports.METADATA_SIDECAR_SUFFIX = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2026, Salesforce, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
const node_path_1 = require("node:path");
|
|
20
|
-
const lifecycle_1 = require("@salesforce/core/lifecycle");
|
|
21
|
-
const messages_1 = require("@salesforce/core/messages");
|
|
22
|
-
const sfError_1 = require("@salesforce/core/sfError");
|
|
23
|
-
const sourceComponent_1 = require("../sourceComponent");
|
|
24
|
-
const mixedContentSourceAdapter_1 = require("./mixedContentSourceAdapter");
|
|
25
|
-
;
|
|
26
|
-
const messages = new messages_1.Messages('@salesforce/source-deploy-retrieve', 'sdr', new Map([["md_request_fail", "Metadata API request failed: %s"], ["error_retry_limit_exceeded", "Exceeded maximum of %s consecutive retryable errors. Last error: %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_profile_singleton_conflict", "Profile %s has conflicting values for singleton tag %s in source paths %s and %s."], ["error_invalid_test_level", "TestLevel cannot be '%s' unless API version is %s or later"], ["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_transport_provider", "No transport provider is registered for '%s' required by %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_attempting_zip_slip", "Entry '%s' in static resource '%s' resolves to a location outside the extraction directory ('%s')."], ["error_static_resource_symlink", "Entry '%s' in static resource '%s' would be written through a symbolic link ('%s'). Writing through symbolic links is not allowed because it can place files outside the extraction directory ('%s')."], ["error_retrieve_symlink", "File '%s' would be written through a symbolic link ('%s'). Writing through symbolic links is not allowed during retrieve because it can place files outside the project directory ('%s')."], ["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>"], ["error_directory_name_path_traversal", "The directoryName '%s' for metadata type '%s' contains path segments that resolve outside the project root. Verify your registryCustomizations in sfdx-project.json do not contain directory traversal sequences."], ["error_write_path_outside_root", "The write path '%s' resolves outside the root destination '%s'. This may indicate a path traversal attempt via registryCustomizations."], ["warning_jwt_api_version", "This org uses JWT-based access tokens, which require API version 68.0 or later for SOAP metadata operations. The current API version is %s, so metadata listing may return empty or incomplete results. To resolve, update sourceApiVersion in sfdx-project.json to 68.0 or higher."], ["type_name_suggestions", "Confirm the metadata type name is 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>"], ["warning_d360_outside_root", "%s was skipped. A %s is only read from a d360 folder, as d360/%s/<name>.json or d360/dataspace/<dataspace>/%s/<name>.json"], ["warning_d360_peer_not_found", "%s deploys together with %s, but that component wasn't found in %s, so the deploy doesn't include it. Components that deploy together are only looked up in the same d360 folder."], ["warning_d360_peer_ignored", "%s deploys together with %s, but .forceignore excludes %s, so the deploy doesn't include it."], ["error_d360_outside_root", "%s: A %s must be stored under a d360 folder, as d360/%s/<name>.json or d360/dataspace/<dataspace>/%s/<name>.json"], ["error_d360_delete_unsupported", "D360 components can't be deleted: %s. Leave them out of the delete and try again."], ["error_d360_invalid_sidecar", "%s: The sidecar %s isn't valid JSON, so the components it deploys together with can't be read. Retrieve the component again to restore it."], ["error_d360_missing_sidecar", "%s: The %s sidecar %s is missing. A D360 component deploys as its .json file together with its .meta.json sidecar. Retrieve the component again to restore it."]]));
|
|
27
|
-
/** Filename suffix of the per-component metadata sidecar (`<name>.meta.json`). */
|
|
28
|
-
exports.METADATA_SIDECAR_SUFFIX = '.meta.json';
|
|
29
|
-
/** Folder every D360 component is stored under, on disk and in the metadata package. */
|
|
30
|
-
exports.D360_ROOT = 'd360';
|
|
31
|
-
/** Folder that wraps dataspace-scoped components: `d360/dataspace/<dataspace>/<typeDir>/`. */
|
|
32
|
-
const DATASPACE_FOLDER = 'dataspace';
|
|
33
|
-
/**
|
|
34
|
-
* Where a file of the type stored in `typeDir` sits in its `d360` folder. The path must be
|
|
35
|
-
* `.../d360/<typeDir>/<file>` or `.../d360/dataspace/<dataspace>/<typeDir>/<file>`; any other shape
|
|
36
|
-
* returns undefined.
|
|
37
|
-
*/
|
|
38
|
-
const getD360Location = (fsPath, typeDir) => {
|
|
39
|
-
const parts = fsPath.split(node_path_1.sep);
|
|
40
|
-
const typeIndex = parts.lastIndexOf(typeDir);
|
|
41
|
-
if (typeIndex < 1) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const inDataspace = parts[typeIndex - 2] === DATASPACE_FOLDER && parts[typeIndex - 3] === exports.D360_ROOT;
|
|
45
|
-
const rootIndex = inDataspace ? typeIndex - 3 : typeIndex - 1;
|
|
46
|
-
if (parts[rootIndex] !== exports.D360_ROOT) {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
root: parts.slice(0, rootIndex + 1).join(node_path_1.sep),
|
|
51
|
-
dataspace: inDataspace ? parts[typeIndex - 1] : undefined,
|
|
52
|
-
relativePath: parts.slice(rootIndex).join(node_path_1.sep),
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
exports.getD360Location = getD360Location;
|
|
56
|
-
/** The part of a path from its `d360` folder down. See {@link getD360Location}. */
|
|
57
|
-
const getD360RelativePath = (fsPath, typeDir) => (0, exports.getD360Location)(fsPath, typeDir)?.relativePath;
|
|
58
|
-
exports.getD360RelativePath = getD360RelativePath;
|
|
59
|
-
/**
|
|
60
|
-
* The payload path of a component in a `d360` folder: `<root>/<typeDir>/<name>.json`, or
|
|
61
|
-
* `<root>/dataspace/<dataspace>/<typeDir>/<name>.json` for a component in a dataspace.
|
|
62
|
-
*/
|
|
63
|
-
const getD360ContentPath = (root, type, name, dataspace) => {
|
|
64
|
-
const file = `${name}.json`;
|
|
65
|
-
return dataspace
|
|
66
|
-
? (0, node_path_1.join)(root, DATASPACE_FOLDER, dataspace, type.directoryName, file)
|
|
67
|
-
: (0, node_path_1.join)(root, type.directoryName, file);
|
|
68
|
-
};
|
|
69
|
-
exports.getD360ContentPath = getD360ContentPath;
|
|
70
|
-
/** The dataspace folders in a `d360` folder. */
|
|
71
|
-
const getD360Dataspaces = (tree, root) => {
|
|
72
|
-
const folder = (0, node_path_1.join)(root, DATASPACE_FOLDER);
|
|
73
|
-
return tree.exists(folder) && tree.isDirectory(folder) ? tree.readDirectory(folder) : [];
|
|
74
|
-
};
|
|
75
|
-
exports.getD360Dataspaces = getD360Dataspaces;
|
|
76
|
-
/** Joins the dataspace and the component name in a dataspace-scoped fullName: `<dataspace>.<name>`. */
|
|
77
|
-
const DATASPACE_NAME_SEPARATOR = '.';
|
|
78
|
-
/** The fullName of a component in a dataspace: `<dataspace>.<name>`. */
|
|
79
|
-
const toDataspaceQualifiedName = (dataspace, name) => `${dataspace}${DATASPACE_NAME_SEPARATOR}${name}`;
|
|
80
|
-
exports.toDataspaceQualifiedName = toDataspaceQualifiedName;
|
|
81
|
-
/** Split `<dataspace>.<name>` into its parts, or return undefined when the name has no dataspace. */
|
|
82
|
-
const parseDataspaceQualifiedName = (fullName) => {
|
|
83
|
-
const index = fullName.indexOf(DATASPACE_NAME_SEPARATOR);
|
|
84
|
-
return index > 0 && index < fullName.length - 1
|
|
85
|
-
? { dataspace: fullName.slice(0, index), name: fullName.slice(index + 1) }
|
|
86
|
-
: undefined;
|
|
87
|
-
};
|
|
88
|
-
exports.parseDataspaceQualifiedName = parseDataspaceQualifiedName;
|
|
89
|
-
/**
|
|
90
|
-
* Handles any D360 dataspace-scoped type whose layout nests a pair of JSON files per
|
|
91
|
-
* component under a `d360/dataspace/<dataspace>/<typeDir>/` wrapper. This adapter is type-agnostic:
|
|
92
|
-
* it derives everything from the path shape and the registered type, so onboarding a new
|
|
93
|
-
* dataspace-scoped type is a registry change (a type entry + directory mapping), never a code change.
|
|
94
|
-
*
|
|
95
|
-
* Each component is TWO files: the payload `<name>.json` (the component's definition) and a sidecar
|
|
96
|
-
* `<name>.meta.json` (`{ componentType, componentName, dataspaceName, deploysWith, dependsOn }`).
|
|
97
|
-
* There is no `-meta.xml`. The payload file is the component's content; the sidecar rides along as an
|
|
98
|
-
* extra file (written by the transformer) and is NOT resolved as a separate component.
|
|
99
|
-
*
|
|
100
|
-
* The component fullName is dataspace-scoped: `<dataspace>.<name>` (matching how the CLI
|
|
101
|
-
* addresses it, e.g. `<ComponentType>:<dataspace>.<name>`), where `<dataspace>` is the path
|
|
102
|
-
* segment immediately above the type's directory.
|
|
103
|
-
*
|
|
104
|
-
* __Example Structure__ (`<typeDir>` is the registered `directoryName` of any dataspace-scoped type):
|
|
105
|
-
*
|
|
106
|
-
*```text
|
|
107
|
-
* d360/dataspace/
|
|
108
|
-
* ├── <dataspace>/
|
|
109
|
-
* | ├── <typeDir>/
|
|
110
|
-
* | | ├── <name>.json -> <ComponentType>:<dataspace>.<name>
|
|
111
|
-
* | | ├── <name>.meta.json -> sidecar (not its own component)
|
|
112
|
-
*```
|
|
113
|
-
*/
|
|
114
|
-
class D360SourceAdapter extends mixedContentSourceAdapter_1.MixedContentSourceAdapter {
|
|
115
|
-
// Each component is a single JSON file; there is no separate metadata xml.
|
|
116
|
-
metadataWithContent = false;
|
|
117
|
-
/**
|
|
118
|
-
* The single JSON file IS the content, not a root metadata xml. Returning undefined here
|
|
119
|
-
* (and from {@link getRootMetadataXmlPath}) ensures the base `getComponent` does NOT
|
|
120
|
-
* pre-build a SourceComponent with a plain, non-dataspace-scoped name — instead `populate`
|
|
121
|
-
* builds it with the correct `<dataspace>.<name>` fullName.
|
|
122
|
-
*/
|
|
123
|
-
// eslint-disable-next-line class-methods-use-this
|
|
124
|
-
parseAsRootMetadataXml() {
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
// eslint-disable-next-line class-methods-use-this
|
|
128
|
-
getRootMetadataXmlPath() {
|
|
129
|
-
return undefined;
|
|
130
|
-
}
|
|
131
|
-
populate(trigger, component) {
|
|
132
|
-
const contentPath = this.trimPathToContent(trigger);
|
|
133
|
-
// The `<name>.meta.json` sidecar is part of its sibling payload component, not a component of
|
|
134
|
-
// its own. Skip it here so resolution never yields a spurious component; the transformer emits
|
|
135
|
-
// the sidecar alongside the payload. Without this, the sidecar would resolve as a second component.
|
|
136
|
-
if (contentPath.endsWith(exports.METADATA_SIDECAR_SUFFIX)) {
|
|
137
|
-
return undefined;
|
|
138
|
-
}
|
|
139
|
-
if (!contentPath || !this.tree.exists(contentPath)) {
|
|
140
|
-
throw new sfError_1.SfError(messages.getMessage('error_expected_source_files', [trigger, this.type.name]), 'ExpectedSourceFilesError');
|
|
141
|
-
}
|
|
142
|
-
// The package path of a D360 component is its path from the `d360` folder down. A file outside
|
|
143
|
-
// that folder, such as a test fixture in a folder that shares the type's name, has no package path.
|
|
144
|
-
// It is skipped with a warning, so it is never sent or written wrongly and the rest of the project
|
|
145
|
-
// still resolves.
|
|
146
|
-
const { directoryName, name: typeName } = this.type;
|
|
147
|
-
if (!(0, exports.getD360RelativePath)(contentPath, directoryName)) {
|
|
148
|
-
void lifecycle_1.Lifecycle.getInstance().emitWarning(messages.getMessage('warning_d360_outside_root', [contentPath, typeName, directoryName, directoryName]));
|
|
149
|
-
return undefined;
|
|
150
|
-
}
|
|
151
|
-
const name = this.calculateD360Name(contentPath);
|
|
152
|
-
if (component) {
|
|
153
|
-
component.content = contentPath;
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
component = new sourceComponent_1.SourceComponent({
|
|
157
|
-
name,
|
|
158
|
-
type: this.type,
|
|
159
|
-
content: contentPath,
|
|
160
|
-
}, this.tree, this.forceIgnore);
|
|
161
|
-
}
|
|
162
|
-
return component;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Build `<dataspace>.<name>` from a path shaped like
|
|
166
|
-
* `.../d360/dataspace/<dataspace>/<typeDir>/<name>.json`. Types that aren't dataspace-scoped
|
|
167
|
-
* sit directly under `d360/<typeDir>/` and keep their bare `<name>`. Only the `.json` suffix is
|
|
168
|
-
* removed, so a name with dots in it, such as a relationship
|
|
169
|
-
* `<sourceObject>.<sourceField>_<targetObject>.<targetField>`, is kept whole.
|
|
170
|
-
*/
|
|
171
|
-
calculateD360Name(contentPath) {
|
|
172
|
-
const pathParts = contentPath.split(node_path_1.sep);
|
|
173
|
-
const typeFolderIndex = pathParts.lastIndexOf(this.type.directoryName);
|
|
174
|
-
const isDataspaceScoped = typeFolderIndex > 1 && pathParts[typeFolderIndex - 2] === DATASPACE_FOLDER;
|
|
175
|
-
const shortName = (0, node_path_1.basename)(contentPath, (0, node_path_1.extname)(contentPath));
|
|
176
|
-
return isDataspaceScoped ? (0, exports.toDataspaceQualifiedName)(pathParts[typeFolderIndex - 1], shortName) : shortName;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
exports.D360SourceAdapter = D360SourceAdapter;
|
|
180
|
-
//# sourceMappingURL=d360SourceAdapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"d360SourceAdapter.js","sourceRoot":"","sources":["../../../../src/resolve/adapters/d360SourceAdapter.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yCAA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