Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
defaultTransform: "camel",
ignorePaths: [/\./],
})
.collectResult({
initResult: [] as GetResponse[],
reduceResults: (result: GetResponse[], next) => {
return [...result, next["value"]];
}
})
.process(bodyStream);
const responsesResultsPromise = this._pipeline()
.parseJsonAsync([
pick({ filter: "Results" }),
pick({ filter: /^\d+\.Result\b/i }),
streamValues()
])
.collectResult({
initResult: [] as string[],
reduceResults: (result: string[], next) => {
// TODO try read it another way
const resResult = JSON.stringify(next["value"]);
return [...result, resResult];
}
})
.process(bodyStream);
const [responses, responsesResults] = await Promise.all([responsesPromise, responsesResultsPromise]);
for (let i = 0; i < responses.length; i++) {
const res = responses[i];
res.result = responsesResults[i];
const command = this._commands[i];
function compose(ctx) {
let pipeline = [
parser({jsonStreaming: true}),
streamValues()
];
if (sanityCheck(CUSTOM_PIPELINE)) {
pipeline.push(..._injectCtx(CUSTOM_PIPELINE,ctx));
} else {
console.log(`Default Pipeline setup...[Skipping custom pipeline]`);
if (CUSTOM_PIPELINE.length > 0) {
console.warn(`Something is wrong : Please review your custom pipeline`);
process.exit(12);
}
}
return pipeline;
}
export function getRestOfOutputPipeline(
bodyStream: stream.Stream,
ignoreFields: string | RegExp): RavenCommandResponsePipeline {
return RavenCommandResponsePipeline.create()
.parseJsonAsync([
ignore({ filter: ignoreFields }),
streamValues()
])
.streamKeyCaseTransform("camel");
}
function getCSVChain () {
return chain([
csvParser(),
asObjects(),
StreamValues.streamValues()
]);
}