@salesforce/source-deploy-retrieve
Version:
JavaScript library to run Salesforce metadata deploys and retrieves
50 lines • 2.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DecomposedExternalServiceRegistrationFinalizer = void 0;
/*
* Copyright 2025, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const node_path_1 = require("node:path");
const ts_types_1 = require("@salesforce/ts-types");
const streams_1 = require("../streams");
const transactionFinalizer_1 = require("./transactionFinalizer");
class DecomposedExternalServiceRegistrationFinalizer extends transactionFinalizer_1.ConvertTransactionFinalizer {
/** to support custom presets (the only way this code should get hit at all pass in the type from a transformer that has registry access */
externalServiceRegistration;
transactionState = {
esrRecords: new Map(),
};
// eslint-disable-next-line class-methods-use-this
defaultDir;
finalize(defaultDirectory) {
this.defaultDir = defaultDirectory;
const writerFormats = [];
this.transactionState.esrRecords.forEach((esrRecord, parent) => writerFormats.push({
component: {
type: (0, ts_types_1.ensure)(this.externalServiceRegistration, 'DecomposedESRFinalizer should have set .ESR'),
fullName: (0, ts_types_1.ensureString)(parent),
},
writeInfos: [
{
output: (0, node_path_1.join)((0, ts_types_1.ensure)(this.externalServiceRegistration?.directoryName, 'directory name missing'), `${parent}.externalServiceRegistration`),
source: new streams_1.JsToXml({ ExternalServiceRegistration: { ...esrRecord } }),
},
],
}));
return Promise.resolve(writerFormats);
}
}
exports.DecomposedExternalServiceRegistrationFinalizer = DecomposedExternalServiceRegistrationFinalizer;
//# sourceMappingURL=decomposedExternalServiceRegistrationFinalizer.js.map