@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
39 lines • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryLogger = void 0;
/*
* Copyright 2026, 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_stream_1 = require("node:stream");
const unwrapArray_1 = require("../util/unwrapArray");
const filters_1 = require("./filters");
/**
* Used by test setup to keep UT from writing to disk.
*/
class MemoryLogger extends node_stream_1.Writable {
loggedData = [];
constructor() {
super({ objectMode: true });
}
_write(chunk, encoding, callback) {
const filteredChunk = (0, unwrapArray_1.unwrapArray)((0, filters_1.filterSecrets)([chunk]));
this.loggedData.push(typeof filteredChunk === 'string'
? JSON.parse(filteredChunk)
: filteredChunk);
callback();
}
}
exports.MemoryLogger = MemoryLogger;
//# sourceMappingURL=memoryLogger.js.map