@objectstack/service-automation 9.7.0 → 9.9.0
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 +32 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -975
- package/dist/index.d.ts +42 -975
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -728,7 +728,7 @@ var _AutomationEngine = class _AutomationEngine {
|
|
|
728
728
|
if (!skipBubble) {
|
|
729
729
|
await this.bubbleToParent(run, output);
|
|
730
730
|
}
|
|
731
|
-
return { success: true, output, durationMs };
|
|
731
|
+
return { success: true, output, durationMs, successMessage: flow.successMessage };
|
|
732
732
|
} catch (err) {
|
|
733
733
|
if (isSuspendSignal(err)) {
|
|
734
734
|
const durationMs2 = Date.now() - run.startTime;
|
|
@@ -777,7 +777,7 @@ var _AutomationEngine = class _AutomationEngine {
|
|
|
777
777
|
if (!skipBubble) {
|
|
778
778
|
await this.failAncestors(run.context, errorMessage);
|
|
779
779
|
}
|
|
780
|
-
return { success: false, error: errorMessage, durationMs };
|
|
780
|
+
return { success: false, error: errorMessage, durationMs, errorMessage: flow.errorMessage };
|
|
781
781
|
}
|
|
782
782
|
} finally {
|
|
783
783
|
this.resuming.delete(runId);
|
|
@@ -2351,8 +2351,34 @@ function registerScreenNodes(engine, ctx) {
|
|
|
2351
2351
|
supportsPause: true,
|
|
2352
2352
|
isAsync: true
|
|
2353
2353
|
}),
|
|
2354
|
-
async execute(node,
|
|
2354
|
+
async execute(node, variables, context) {
|
|
2355
2355
|
const cfg = node.config ?? {};
|
|
2356
|
+
const interp = (v) => {
|
|
2357
|
+
if (v == null) return void 0;
|
|
2358
|
+
const r = interpolate(v, variables, context);
|
|
2359
|
+
return r == null ? void 0 : String(r);
|
|
2360
|
+
};
|
|
2361
|
+
const objectName = typeof cfg.objectName === "string" && cfg.objectName.trim() ? cfg.objectName.trim() : void 0;
|
|
2362
|
+
if (objectName) {
|
|
2363
|
+
const defaults = cfg.defaults && typeof cfg.defaults === "object" ? interpolate(cfg.defaults, variables, context) : void 0;
|
|
2364
|
+
const idVariable = typeof cfg.idVariable === "string" && cfg.idVariable.trim() ? cfg.idVariable.trim() : void 0;
|
|
2365
|
+
return {
|
|
2366
|
+
success: true,
|
|
2367
|
+
suspend: true,
|
|
2368
|
+
screen: {
|
|
2369
|
+
nodeId: node.id,
|
|
2370
|
+
kind: "object-form",
|
|
2371
|
+
title: interp(cfg.title) ?? node.label ?? objectName,
|
|
2372
|
+
description: interp(cfg.description),
|
|
2373
|
+
objectName,
|
|
2374
|
+
mode: cfg.mode === "edit" ? "edit" : "create",
|
|
2375
|
+
recordId: cfg.recordId != null ? interp(cfg.recordId) : void 0,
|
|
2376
|
+
defaults,
|
|
2377
|
+
idVariable,
|
|
2378
|
+
fields: []
|
|
2379
|
+
}
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2356
2382
|
const rawFields = Array.isArray(cfg.fields) ? cfg.fields : [];
|
|
2357
2383
|
const hasFields = rawFields.length > 0;
|
|
2358
2384
|
const shouldPause = cfg.waitForInput === true || hasFields && cfg.waitForInput !== false;
|
|
@@ -2365,7 +2391,7 @@ function registerScreenNodes(engine, ctx) {
|
|
|
2365
2391
|
type: f.type != null ? String(f.type) : void 0,
|
|
2366
2392
|
required: f.required === true,
|
|
2367
2393
|
options: Array.isArray(f.options) ? f.options : void 0,
|
|
2368
|
-
defaultValue: f.defaultValue,
|
|
2394
|
+
defaultValue: f.defaultValue !== void 0 ? interpolate(f.defaultValue, variables, context) : void 0,
|
|
2369
2395
|
placeholder: f.placeholder != null ? String(f.placeholder) : void 0
|
|
2370
2396
|
})).filter((f) => f.name.length > 0);
|
|
2371
2397
|
return {
|
|
@@ -2373,8 +2399,8 @@ function registerScreenNodes(engine, ctx) {
|
|
|
2373
2399
|
suspend: true,
|
|
2374
2400
|
screen: {
|
|
2375
2401
|
nodeId: node.id,
|
|
2376
|
-
title: cfg.title ?? node.label ?? "Input",
|
|
2377
|
-
description: cfg.description,
|
|
2402
|
+
title: interp(cfg.title) ?? node.label ?? "Input",
|
|
2403
|
+
description: interp(cfg.description),
|
|
2378
2404
|
fields
|
|
2379
2405
|
}
|
|
2380
2406
|
};
|