Spaces:
Running
Running
File size: 606 Bytes
b39afbe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/**
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
* All rights reserved.
*/
//@ts-check
// @ts-ignore
async function runBlock(ctx, block_name, args, outputs = {}) {
try {
const app = ctx.app;
if (!app) {
throw new Error('[runBlock] app not found in ctx');
}
const blocks = app.blocks;
if (!blocks) {
throw new Error('[runBlock] blocks not found in app');
}
const result = await blocks.runBlock(ctx, block_name, args, outputs);
return result;
} catch (err) {
throw new Error(`Error running block ${block_name}: ${err}`);
}
}
export { runBlock };
|