@teamkeel/functions-runtime 0.413.4 → 0.413.6
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 +36 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +36 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2441,18 +2441,39 @@ var selectOne = /* @__PURE__ */ __name((name, options) => {
|
|
|
2441
2441
|
}, "selectOne");
|
|
2442
2442
|
|
|
2443
2443
|
// src/flows/ui/page.ts
|
|
2444
|
-
|
|
2444
|
+
async function page(options, data) {
|
|
2445
2445
|
const content = options.content;
|
|
2446
|
-
|
|
2446
|
+
let hasValidationErrors = false;
|
|
2447
|
+
const contentUiConfig = await Promise.all(
|
|
2448
|
+
content.map(async (c) => {
|
|
2449
|
+
const isInput = "__type" in c && c.__type == "input";
|
|
2450
|
+
const hasData = data && c.uiConfig.name in data;
|
|
2451
|
+
if (isInput && hasData && c.validate) {
|
|
2452
|
+
const validationError = await c.validate(data[c.uiConfig.name]);
|
|
2453
|
+
if (typeof validationError === "string") {
|
|
2454
|
+
hasValidationErrors = true;
|
|
2455
|
+
return {
|
|
2456
|
+
...c.uiConfig,
|
|
2457
|
+
validationError
|
|
2458
|
+
};
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
return c.uiConfig;
|
|
2462
|
+
}).filter(Boolean)
|
|
2463
|
+
);
|
|
2447
2464
|
return {
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2465
|
+
page: {
|
|
2466
|
+
__type: "ui.page",
|
|
2467
|
+
stage: options.stage,
|
|
2468
|
+
title: options.title,
|
|
2469
|
+
description: options.description,
|
|
2470
|
+
content: contentUiConfig,
|
|
2471
|
+
actions: options.actions
|
|
2472
|
+
},
|
|
2473
|
+
hasValidationErrors
|
|
2454
2474
|
};
|
|
2455
|
-
}
|
|
2475
|
+
}
|
|
2476
|
+
__name(page, "page");
|
|
2456
2477
|
|
|
2457
2478
|
// src/flows/disrupts.ts
|
|
2458
2479
|
var FlowDisrupt = class {
|
|
@@ -2666,10 +2687,14 @@ function createFlowContext(runId, data, spanId) {
|
|
|
2666
2687
|
type: "UI" /* UI */,
|
|
2667
2688
|
startTime: /* @__PURE__ */ new Date()
|
|
2668
2689
|
}).returningAll().executeTakeFirst();
|
|
2669
|
-
throw new UIRenderDisrupt(step?.id, page(options));
|
|
2690
|
+
throw new UIRenderDisrupt(step?.id, (await page(options, null)).page);
|
|
2670
2691
|
}
|
|
2671
2692
|
if (!data) {
|
|
2672
|
-
throw new UIRenderDisrupt(step?.id, page(options));
|
|
2693
|
+
throw new UIRenderDisrupt(step?.id, (await page(options, null)).page);
|
|
2694
|
+
}
|
|
2695
|
+
const p = await page(options, data);
|
|
2696
|
+
if (p.hasValidationErrors) {
|
|
2697
|
+
throw new UIRenderDisrupt(step?.id, p.page);
|
|
2673
2698
|
}
|
|
2674
2699
|
await db.updateTable("keel.flow_step").set({
|
|
2675
2700
|
status: "COMPLETED" /* COMPLETED */,
|