@teamkeel/functions-runtime 0.413.3-next.1 → 0.413.4

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/index.cjs CHANGED
@@ -2318,7 +2318,7 @@ async function handleRoute(request, config) {
2318
2318
  }
2319
2319
  __name(handleRoute, "handleRoute");
2320
2320
 
2321
- // src/handleFlow.js
2321
+ // src/handleFlow.ts
2322
2322
  var import_json_rpc_26 = require("json-rpc-2.0");
2323
2323
  var opentelemetry6 = __toESM(require("@opentelemetry/api"), 1);
2324
2324
 
@@ -2716,7 +2716,8 @@ function withTimeout(promiseFn, timeout) {
2716
2716
  }
2717
2717
  __name(withTimeout, "withTimeout");
2718
2718
 
2719
- // src/handleFlow.js
2719
+ // src/handleFlow.ts
2720
+ var import_change_case2 = require("change-case");
2720
2721
  async function handleFlow(request, config) {
2721
2722
  const activeContext = opentelemetry6.propagation.extract(
2722
2723
  opentelemetry6.context.active(),
@@ -2757,7 +2758,20 @@ async function handleFlow(request, config) {
2757
2758
  span.spanContext().spanId
2758
2759
  );
2759
2760
  const flowFunction = flows[request.method].fn;
2760
- flowConfig = flows[request.method].config;
2761
+ const rawFlowConfig = flows[request.method].config;
2762
+ flowConfig = {
2763
+ ...rawFlowConfig,
2764
+ title: rawFlowConfig.title || (0, import_change_case2.sentenceCase)(request.method || "flow"),
2765
+ stages: rawFlowConfig.stages?.map((stage) => {
2766
+ if (typeof stage === "string") {
2767
+ return {
2768
+ key: stage,
2769
+ name: stage
2770
+ };
2771
+ }
2772
+ return stage;
2773
+ })
2774
+ };
2761
2775
  const inputs = parseInputs(flowRun.input);
2762
2776
  try {
2763
2777
  await tryExecuteFlow(db, async () => {
@@ -2782,7 +2796,7 @@ async function handleFlow(request, config) {
2782
2796
  span.recordException(e);
2783
2797
  span.setStatus({
2784
2798
  code: opentelemetry6.SpanStatusCode.ERROR,
2785
- message: e.message
2799
+ message: e instanceof Error ? e.message : "unknown error"
2786
2800
  });
2787
2801
  if (e instanceof ExhuastedRetriesDisrupt) {
2788
2802
  return (0, import_json_rpc_26.createJSONRPCSuccessResponse)(request.id, {
@@ -2795,7 +2809,7 @@ async function handleFlow(request, config) {
2795
2809
  return (0, import_json_rpc_26.createJSONRPCSuccessResponse)(request.id, {
2796
2810
  runId,
2797
2811
  runCompleted: true,
2798
- error: e.message,
2812
+ error: e instanceof Error ? e.message : "unknown error",
2799
2813
  config: flowConfig
2800
2814
  });
2801
2815
  }