UNPKG

@salesforce/source-deploy-retrieve

Version:

JavaScript library to run Salesforce metadata deploys and retrieves

41 lines 2.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DecomposedExternalServiceRegistrationFinalizer = void 0; /* * Copyright (c) 2025, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ 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