@514labs/moose-lib 0.6.338 → 0.6.339
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/dist/moose-runner.js +6 -36
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +6 -36
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/moose-runner.mjs
CHANGED
|
@@ -2515,7 +2515,6 @@ init_commons();
|
|
|
2515
2515
|
init_cluster_utils();
|
|
2516
2516
|
init_internal();
|
|
2517
2517
|
init_json();
|
|
2518
|
-
init_compiler_config();
|
|
2519
2518
|
import { Readable as Readable2 } from "stream";
|
|
2520
2519
|
import { KafkaJS as KafkaJS2 } from "@514labs/kafka-javascript";
|
|
2521
2520
|
import { Buffer as Buffer2 } from "buffer";
|
|
@@ -2793,26 +2792,6 @@ var sendMessageMetrics = (logger2, metrics) => {
|
|
|
2793
2792
|
metrics.count_out = 0;
|
|
2794
2793
|
setTimeout(() => sendMessageMetrics(logger2, metrics), 1e3);
|
|
2795
2794
|
};
|
|
2796
|
-
async function loadStreamingFunctionPrecompiled(functionFilePath) {
|
|
2797
|
-
let streamingFunctionImport;
|
|
2798
|
-
try {
|
|
2799
|
-
const useCompiled2 = shouldUseCompiled();
|
|
2800
|
-
const sourceDir = getSourceDir();
|
|
2801
|
-
let actualPath = functionFilePath;
|
|
2802
|
-
if (useCompiled2) {
|
|
2803
|
-
const sourceDirPattern = `/${sourceDir}/`;
|
|
2804
|
-
actualPath = functionFilePath.replace(sourceDirPattern, `/.moose/compiled/${sourceDir}/`).replace(/\.ts$/, ".js");
|
|
2805
|
-
streamingFunctionImport = await loadModule(actualPath);
|
|
2806
|
-
} else {
|
|
2807
|
-
const pathWithoutExt = actualPath.replace(/\.(ts|js)$/, "");
|
|
2808
|
-
streamingFunctionImport = __require(pathWithoutExt);
|
|
2809
|
-
}
|
|
2810
|
-
} catch (e) {
|
|
2811
|
-
cliLog({ action: "Function", message: `${e}`, message_type: "Error" });
|
|
2812
|
-
throw e;
|
|
2813
|
-
}
|
|
2814
|
-
return streamingFunctionImport.default;
|
|
2815
|
-
}
|
|
2816
2795
|
async function loadStreamingFunction(sourceTopic, targetTopic) {
|
|
2817
2796
|
const transformFunctions = await getStreamingFunctions();
|
|
2818
2797
|
const transformFunctionKey = `${topicNameToStreamName(sourceTopic)}_${targetTopic ? topicNameToStreamName(targetTopic) : "<no-target>"}`;
|
|
@@ -2856,21 +2835,12 @@ var startConsumer = async (args, logger2, metrics, _parallelism, consumer, produ
|
|
|
2856
2835
|
logger2.log(
|
|
2857
2836
|
`Starting consumer group '${streamingFuncId}' with source topic: ${args.sourceTopic.name} and target topic: ${args.targetTopic?.name || "none"}`
|
|
2858
2837
|
);
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
);
|
|
2866
|
-
streamingFunctions = result.functions;
|
|
2867
|
-
fieldMutations = result.fieldMutations;
|
|
2868
|
-
} else {
|
|
2869
|
-
streamingFunctions = [
|
|
2870
|
-
[await loadStreamingFunctionPrecompiled(args.functionFilePath), {}]
|
|
2871
|
-
];
|
|
2872
|
-
fieldMutations = void 0;
|
|
2873
|
-
}
|
|
2838
|
+
const result = await loadStreamingFunction(
|
|
2839
|
+
args.sourceTopic,
|
|
2840
|
+
args.targetTopic
|
|
2841
|
+
);
|
|
2842
|
+
const streamingFunctions = result.functions;
|
|
2843
|
+
const fieldMutations = result.fieldMutations;
|
|
2874
2844
|
await consumer.subscribe({
|
|
2875
2845
|
topics: [args.sourceTopic.name]
|
|
2876
2846
|
// Use full topic name for Kafka operations
|