@fnet/cli 0.133.0 → 0.133.1
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/fbin/index.js +14 -1
- package/dist/fnet/index.0jcm9pn5.js +1 -0
- package/dist/fnet/index.2084z2ed.js +2 -0
- package/dist/fnet/index.33f1ggpr.js +1 -0
- package/dist/fnet/index.3exge2js.js +1 -0
- package/dist/fnet/index.3kfx538h.js +1 -0
- package/dist/fnet/index.490y87nc.js +1 -0
- package/dist/fnet/index.4g9yezkq.js +1 -0
- package/dist/fnet/index.4jkat7r4.js +1 -0
- package/dist/fnet/index.7crx8ky1.js +1 -0
- package/dist/fnet/index.7vw06nrn.js +1 -0
- package/dist/fnet/index.9567fa9x.js +1 -0
- package/dist/fnet/index.gh75wt1m.js +1 -0
- package/dist/fnet/index.hzsfswvp.js +1 -0
- package/dist/fnet/index.jgpc3grc.js +1 -0
- package/dist/fnet/index.js +19 -1
- package/dist/fnet/index.p0zb7e1b.js +1 -0
- package/dist/fnet/index.r19p3bpa.js +2 -0
- package/dist/fnet/index.r82rtnmz.js +1 -0
- package/dist/fnet/index.s662t98v.js +1 -0
- package/dist/fnet/index.w74dpnpn.js +1 -0
- package/dist/fnet/index.xeaw5xa9.js +1 -0
- package/dist/fnet/index.zm4kesg6.js +1 -0
- package/dist/fnode/index.05n3mvs9.js +2 -0
- package/dist/fnode/index.2hc9tbyx.js +1 -0
- package/dist/fnode/index.2pnjg6dc.js +1 -0
- package/dist/fnode/index.9qgtmxq3.js +2 -0
- package/dist/fnode/index.b1q7y05p.js +1 -0
- package/dist/fnode/index.bhapgrs7.js +1 -0
- package/dist/fnode/index.cvxrf34y.js +2 -0
- package/dist/fnode/index.dp9wyahp.js +1 -0
- package/dist/fnode/index.eqxmcpdc.js +1 -0
- package/dist/fnode/index.f2tb0x3t.js +1 -0
- package/dist/fnode/index.fbzv6wwf.js +1 -0
- package/dist/fnode/index.gazd9raq.js +1 -0
- package/dist/fnode/index.hv4s25f0.js +3 -0
- package/dist/fnode/index.j5z7dtsx.js +1 -0
- package/dist/fnode/index.js +9 -1
- package/dist/fnode/index.kb4e4bxf.js +1 -0
- package/dist/fnode/index.qn0schqp.js +1 -0
- package/dist/fnode/index.rht29phd.js +1 -0
- package/dist/fnode/index.rzsfmek6.js +3 -0
- package/dist/fnode/index.s0nk6cv8.js +4 -0
- package/dist/fnode/index.s66v6wt4.js +1 -0
- package/dist/fnode/index.sv7v0y60.js +1 -0
- package/dist/fnode/index.tgkhgnrp.js +1 -0
- package/dist/fnode/index.vq706f75.js +1 -0
- package/dist/fnode/index.y8pvdcny.js +1 -0
- package/dist/fnode/index.z4vz93ww.js +1 -0
- package/dist/frun/index.js +1 -1
- package/dist/fservice/index.js +18 -1
- package/dist/fservice/index.q01yvaz0.js +2 -0
- package/package.json +21 -18
- package/readme.md +62 -15
- package/template/fnet/core/object.js +10 -10
- package/template/fnet/node/package.json.njk +6 -3
- package/template/fnet/node/src/cli/index.js.njk +5 -315
- package/template/fnet/node/src/cli/index.js.v1.njk +318 -0
- package/template/fnet/node/src/cli/v2/core/args-parser.njk +10 -0
- package/template/fnet/node/src/cli/v2/core/imports.njk +31 -0
- package/template/fnet/node/src/cli/v2/core/run-wrapper.njk +25 -0
- package/template/fnet/node/src/cli/v2/index.js.njk +184 -0
- package/template/fnet/node/src/cli/v2/modes/default/extend.njk +11 -0
- package/template/fnet/node/src/cli/v2/modes/default/standard.njk +20 -0
- package/template/fnet/node/src/cli/v2/modes/http/builtin.njk +66 -0
- package/template/fnet/node/src/cli/v2/modes/http/imports.njk +9 -0
- package/template/fnet/node/src/cli/v2/modes/http/index.njk +12 -0
- package/template/fnet/node/src/cli/v2/modes/mcp/imports.njk +33 -0
- package/template/fnet/node/src/cli/v2/modes/mcp/index.njk +30 -0
- package/template/fnet/node/src/cli/v2/modes/mcp/server-setup.njk +15 -0
- package/template/fnet/node/src/cli/v2/modes/mcp/tool-handlers.njk +46 -0
- package/template/fnet/node/src/cli/v2/modes/mcp/transport-http.njk +222 -0
- package/template/fnet/node/src/cli/v2/modes/mcp/transport-stdio.njk +9 -0
- package/template/fnet/node/src/cli/v2/modes/pipeline/imports.njk +9 -0
- package/template/fnet/node/src/cli/v2/modes/pipeline/index.njk +113 -0
- package/template/fnet/node/src/cli/v2/modes/webhook/imports.njk +9 -0
- package/template/fnet/node/src/cli/v2/modes/webhook/index.njk +127 -0
- package/template/fnet/node/src/cli/v2/modes/websocket/imports.njk +15 -0
- package/template/fnet/node/src/cli/v2/modes/websocket/index.njk +104 -0
- package/template/fnet/node/src/default/blocks/assign.js.njk +10 -48
- package/template/fnet/node/src/default/blocks/call.js.njk +110 -156
- package/template/fnet/node/src/default/blocks/for.js.njk +58 -74
- package/template/fnet/node/src/default/blocks/form.js.njk +21 -59
- package/template/fnet/node/src/default/blocks/http.js.njk +135 -0
- package/template/fnet/node/src/default/blocks/modules.js.njk +10 -52
- package/template/fnet/node/src/default/blocks/new.js.njk +40 -85
- package/template/fnet/node/src/default/blocks/next.js.njk +10 -32
- package/template/fnet/node/src/default/blocks/output.js.njk +10 -48
- package/template/fnet/node/src/default/blocks/parallel.js.njk +64 -0
- package/template/fnet/node/src/default/blocks/pipeline.js.njk +109 -0
- package/template/fnet/node/src/default/blocks/raise.js.njk +9 -25
- package/template/fnet/node/src/default/blocks/retry.js.njk +70 -0
- package/template/fnet/node/src/default/blocks/return.js.njk +13 -25
- package/template/fnet/node/src/default/blocks/schedule.js.njk +66 -0
- package/template/fnet/node/src/default/blocks/signal.js.njk +10 -32
- package/template/fnet/node/src/default/blocks/steps.js.njk +32 -48
- package/template/fnet/node/src/default/blocks/switch.js.njk +37 -67
- package/template/fnet/node/src/default/blocks/tryexcept.js.njk +58 -52
- package/template/fnet/node/src/default/blocks/wait.js.njk +10 -30
- package/template/fnet/node/src/default/input.args.js.njk +5 -2
- package/template/fnet/node/src/default/macros/block-body-header.js.njk +1 -1
- package/template/fnet/node/src/default/macros/block-header.js.njk +0 -3
- package/template/fnet/node/src/default/macros/block-next.js.njk +1 -1
- package/template/fnet/node/src/default/macros/block-run-footer.js.njk +1 -1
- package/template/fnet/node/src/default/macros/block-run-header.js.njk +14 -2
- package/template/fnet/node/src/default/macros/page.js.njk +1 -1
- package/template/fnet/node/src/default/types/block.js.njk +133 -0
- package/template/fnet/node/src/default/workflow.js.njk +8 -6
- package/template/fnode/node/package.json.njk +5 -4
- package/template/fnode/node/src/cli/index.js.njk +3 -397
- package/template/fnode/node/src/cli/index.js.v1.njk +464 -0
- package/template/fnode/node/src/cli/v2/core/args-parser.njk +10 -0
- package/template/fnode/node/src/cli/v2/core/imports.njk +29 -0
- package/template/fnode/node/src/cli/v2/core/run-wrapper.njk +25 -0
- package/template/fnode/node/src/cli/v2/index.js.njk +184 -0
- package/template/fnode/node/src/cli/v2/modes/default/extend.njk +11 -0
- package/template/fnode/node/src/cli/v2/modes/default/standard.njk +19 -0
- package/template/fnode/node/src/cli/v2/modes/http/builtin.njk +61 -0
- package/template/fnode/node/src/cli/v2/modes/http/imports.njk +9 -0
- package/template/fnode/node/src/cli/v2/modes/http/index.njk +12 -0
- package/template/fnode/node/src/cli/v2/modes/mcp/imports.njk +33 -0
- package/template/fnode/node/src/cli/v2/modes/mcp/index.njk +30 -0
- package/template/fnode/node/src/cli/v2/modes/mcp/server-setup.njk +15 -0
- package/template/fnode/node/src/cli/v2/modes/mcp/tool-handlers.njk +41 -0
- package/template/fnode/node/src/cli/v2/modes/mcp/transport-http.njk +212 -0
- package/template/fnode/node/src/cli/v2/modes/mcp/transport-stdio.njk +9 -0
- package/template/fnode/node/src/cli/v2/modes/pipeline/imports.njk +9 -0
- package/template/fnode/node/src/cli/v2/modes/pipeline/index.njk +103 -0
- package/template/fnode/node/src/cli/v2/modes/webhook/imports.njk +9 -0
- package/template/fnode/node/src/cli/v2/modes/webhook/index.njk +122 -0
- package/template/fnode/node/src/cli/v2/modes/websocket/imports.njk +15 -0
- package/template/fnode/node/src/cli/v2/modes/websocket/index.njk +99 -0
- package/template/fnode/node/src/default/input.args.js.njk +6 -2
- package/dist/fnet/index.-SGbq2cI.js +0 -1
- package/dist/fnet/index.B5XE4ChJ.js +0 -1
- package/dist/fnet/index.Bft2w7m3.js +0 -1
- package/dist/fnet/index.BuYxdKtK.js +0 -1
- package/dist/fnet/index.C0YpfQ5j.js +0 -1
- package/dist/fnet/index.C2S9JYhS.js +0 -1
- package/dist/fnet/index.C7saWH6d.js +0 -1
- package/dist/fnet/index.CDct_kkF.js +0 -1
- package/dist/fnet/index.CMC8mlye.js +0 -1
- package/dist/fnet/index.CmMM-Ek9.js +0 -1
- package/dist/fnet/index.CuMyez3E.js +0 -1
- package/dist/fnet/index.CzAV0S36.js +0 -1
- package/dist/fnet/index.D2N9YZmA.js +0 -1
- package/dist/fnet/index.D3p7pncT.js +0 -1
- package/dist/fnet/index.DG8TqL-1.js +0 -1
- package/dist/fnet/index.DI3yyTtl.js +0 -1
- package/dist/fnet/index.DOYkqsYT.js +0 -1
- package/dist/fnet/index.DWpw12No.js +0 -1
- package/dist/fnet/index.DrwlOzAe.js +0 -1
- package/dist/fnet/index.Q-CYRcna.js +0 -1
- package/dist/fnet/index.W6RYgypK.js +0 -1
- package/dist/fnet/index.xd8c7XMr.js +0 -1
- package/dist/fnode/index.-SGbq2cI.js +0 -1
- package/dist/fnode/index.B5XE4ChJ.js +0 -1
- package/dist/fnode/index.B8gal9up.js +0 -1
- package/dist/fnode/index.BU1440aO.js +0 -1
- package/dist/fnode/index.BcGYSPne.js +0 -1
- package/dist/fnode/index.Bft2w7m3.js +0 -1
- package/dist/fnode/index.BuYxdKtK.js +0 -1
- package/dist/fnode/index.C2S9JYhS.js +0 -1
- package/dist/fnode/index.C7saWH6d.js +0 -1
- package/dist/fnode/index.CDct_kkF.js +0 -1
- package/dist/fnode/index.CMC8mlye.js +0 -1
- package/dist/fnode/index.CmMM-Ek9.js +0 -1
- package/dist/fnode/index.CuMyez3E.js +0 -1
- package/dist/fnode/index.CzAV0S36.js +0 -1
- package/dist/fnode/index.D2N9YZmA.js +0 -1
- package/dist/fnode/index.D3p7pncT.js +0 -1
- package/dist/fnode/index.DG8TqL-1.js +0 -1
- package/dist/fnode/index.DI3yyTtl.js +0 -1
- package/dist/fnode/index.DWpw12No.js +0 -1
- package/dist/fnode/index.DrwlOzAe.js +0 -1
- package/dist/fnode/index.N_a5FdgA.js +0 -1
- package/dist/fnode/index.Q-CYRcna.js +0 -1
- package/dist/fnode/index.UNoFg95r.js +0 -1
- package/dist/fnode/index.W6RYgypK.js +0 -1
- package/dist/fnode/index.xd8c7XMr.js +0 -1
- package/template/fnet/core/print.js +0 -1
- package/template/fnet/node/src/default/macros/workflow-header.js.njk +0 -7
|
@@ -1,74 +1,80 @@
|
|
|
1
|
+
{% set assign=true %}
|
|
2
|
+
{% set signal=true %}
|
|
3
|
+
{% set resolve=true %}
|
|
1
4
|
|
|
2
|
-
{%
|
|
5
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
3
6
|
|
|
4
|
-
{
|
|
7
|
+
{% call block.header() %}
|
|
8
|
+
{% for child in childs %}
|
|
9
|
+
{% if not child.definition.dynamic %}
|
|
10
|
+
// CHILD: {{child.indexKey}}
|
|
11
|
+
import {{child.codeKey}} from "./{{child.codeKey}}.js";
|
|
12
|
+
{% endif %}
|
|
13
|
+
{% endfor%}
|
|
14
|
+
{% endcall %}
|
|
5
15
|
|
|
6
|
-
{%
|
|
16
|
+
{% call block.definition() %}
|
|
17
|
+
|
|
18
|
+
try{
|
|
7
19
|
|
|
8
|
-
{%
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {{child.codeKey}} from "./{{child.codeKey}}.js";
|
|
12
|
-
{% endif %}
|
|
13
|
-
{% endfor%}
|
|
20
|
+
{% if context.try.definition.dynamic %}
|
|
21
|
+
const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}.js");
|
|
22
|
+
{% endif %}
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
let current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c, error });
|
|
25
|
+
let currentArgs=args;
|
|
16
26
|
|
|
17
|
-
|
|
27
|
+
do {
|
|
18
28
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
30
|
+
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
31
|
+
{% endif %}
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{% include "src/default/macros/block-run-header.js.njk" %}
|
|
33
|
+
const nextBlock= typeof currentArgs==='undefined'? await current.run()
|
|
34
|
+
: Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
if(nextBlock?.type==='return') return resolve(nextBlock);
|
|
37
|
+
else if(nextBlock?.type!=='block') break;
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
try{
|
|
32
|
-
|
|
33
|
-
const onError=error=>{
|
|
34
|
-
{% if context.except.definition.dynamic %}
|
|
35
|
-
const { default: {{context.except.codeKey}} } = await import("./{{context.except.codeKey}}.js");
|
|
36
|
-
{% endif %}
|
|
39
|
+
if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
|
|
40
|
+
return resolve(nextBlock);
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, error });
|
|
43
|
+
currentArgs=nextBlock.input;
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
} while(true);
|
|
46
|
+
}
|
|
47
|
+
catch(error){
|
|
48
|
+
|
|
49
|
+
{% if context.except.definition.dynamic %}
|
|
50
|
+
const { default: {{context.except.codeKey}} } = await import("./{{context.except.codeKey}}.js");
|
|
51
|
+
{% endif %}
|
|
52
|
+
|
|
53
|
+
let current=new {{context.except.codeKey}}({ parent:_this, engine, flow, caller:c , error });
|
|
54
|
+
let currentArgs=args;
|
|
43
55
|
|
|
44
|
-
|
|
45
|
-
};
|
|
56
|
+
do {
|
|
46
57
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c ,onError, error });
|
|
58
|
+
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
59
|
+
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
60
|
+
{% endif %}
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{% endif %}
|
|
62
|
+
const nextBlock= typeof currentArgs==='undefined'? await current.run()
|
|
63
|
+
: Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
catch({{context.except.context.transform.as | safe}}){
|
|
60
|
-
throw new Error('Error must not reach here!');
|
|
61
|
-
}
|
|
65
|
+
if(nextBlock?.type==='return') return resolve(nextBlock);
|
|
66
|
+
else if(nextBlock?.type!=='block') break;
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
|
|
69
|
+
return resolve(nextBlock);
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, error });
|
|
72
|
+
currentArgs=nextBlock.input;
|
|
66
73
|
|
|
67
|
-
|
|
68
|
-
});
|
|
74
|
+
} while(true);
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
|
|
72
|
-
}
|
|
77
|
+
{% endcall %}
|
|
73
78
|
|
|
74
|
-
{%
|
|
79
|
+
{% call block.footer()%}
|
|
80
|
+
{% endcall %}
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
{%
|
|
1
|
+
{% set assign=true %}
|
|
2
|
+
{% set signal=true %}
|
|
3
|
+
{% set resolve=true %}
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
{% call block.header() %}
|
|
8
|
+
{% endcall %}
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
{% include "src/default/macros/block-entry-args.js.njk" %}
|
|
10
|
+
{% call block.definition() %}
|
|
11
|
+
{% endcall %}
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{% include "src/default/macros/page.js.njk" %}
|
|
15
|
-
|
|
16
|
-
{% if context.next and context.transform.wait==='next' %}
|
|
17
|
-
flow.waitForNext({
|
|
18
|
-
key:'{{indexKey}}',
|
|
19
|
-
next: async () => {
|
|
20
|
-
{% include "src/default/macros/block-next.js.njk" %}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
{% endif %}
|
|
24
|
-
|
|
25
|
-
{% for assign in context.transform.assign %}
|
|
26
|
-
flow.set({{assign.key | safe}},{{assign.value | safe}});
|
|
27
|
-
{% endfor%}
|
|
28
|
-
|
|
29
|
-
{% include "src/default/macros/block-run-footer.js.njk" %}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
{% include "src/default/macros/block-footer.js.njk" %}
|
|
13
|
+
{% call block.footer()%}
|
|
14
|
+
{% endcall %}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{% if atom.doc.features.project.format === 'esm' %}
|
|
2
|
-
import fnetArgs from '@fnet/args';
|
|
2
|
+
import fnetArgs,{argsParser} from '@fnet/args';
|
|
3
3
|
import validate,{schema as inputSchema} from "./validate_input.js";
|
|
4
4
|
|
|
5
5
|
{% elif atom.doc.features.project.format === 'cjs' %}
|
|
6
|
-
const fnetArgs = require('@fnet/args');
|
|
6
|
+
const {default:fnetArgs,argsParser} = require('@fnet/args');
|
|
7
7
|
const validate,{schema as inputSchema} = require("./validate_input.js");
|
|
8
8
|
{% endif %}
|
|
9
9
|
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
return await fnetArgs({schema,initial,validate,packageCallback});
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
export { argsParser };
|
|
78
79
|
{% elif atom.doc.features.project.format === 'cjs' %}
|
|
79
80
|
|
|
80
81
|
module.exports = async () => {
|
|
@@ -119,4 +120,6 @@
|
|
|
119
120
|
|
|
120
121
|
return await fnetArgs({schema,initial,validate,packageCallback});
|
|
121
122
|
};
|
|
123
|
+
|
|
124
|
+
module.exports.argsParser = argsParser;
|
|
122
125
|
{% endif %}
|
|
@@ -16,13 +16,25 @@ const form=null;
|
|
|
16
16
|
{% endif %}
|
|
17
17
|
|
|
18
18
|
{# closure #}
|
|
19
|
-
const c={
|
|
19
|
+
const c={
|
|
20
|
+
caller,
|
|
21
|
+
resolve,
|
|
22
|
+
reject,
|
|
23
|
+
args,
|
|
24
|
+
get form(){return form||caller?.form},
|
|
25
|
+
get module(){return m||caller?.module},
|
|
26
|
+
get for(){
|
|
27
|
+
// Proxy pattern for nested loop variable resolution with closure semantics
|
|
28
|
+
// Inner loops shadow outer loops, but parent scope is accessible via fallback
|
|
29
|
+
return caller?.for || {};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
20
32
|
|
|
21
33
|
{% if workflow.parent.context.atom.doc.features.print_steps %}
|
|
22
34
|
console.log(new Date().toLocaleString(),'{{indexKey}}');
|
|
23
35
|
{% endif %}
|
|
24
36
|
|
|
25
|
-
{% if
|
|
37
|
+
{% if context.transform.debugger %}
|
|
26
38
|
debugger;
|
|
27
39
|
{% endif %}
|
|
28
40
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{% macro header() %}
|
|
2
|
+
|
|
3
|
+
{% include "src/default/macros/block-header.js.njk" %}
|
|
4
|
+
|
|
5
|
+
{% include "src/default/macros/block-next-header.js.njk" %}
|
|
6
|
+
|
|
7
|
+
{% include "src/default/macros/block-modules-header.js.njk" %}
|
|
8
|
+
|
|
9
|
+
{{ caller() }}
|
|
10
|
+
|
|
11
|
+
{% endmacro %}
|
|
12
|
+
|
|
13
|
+
{% macro definition() %}
|
|
14
|
+
|
|
15
|
+
export default function Block(context){
|
|
16
|
+
|
|
17
|
+
{% include "src/default/macros/block-body-header.js.njk" %}
|
|
18
|
+
|
|
19
|
+
this.run= function (){
|
|
20
|
+
|
|
21
|
+
{% include "src/default/macros/block-entry-args.js.njk" %}
|
|
22
|
+
|
|
23
|
+
return new Promise((resolve,reject)=>{
|
|
24
|
+
|
|
25
|
+
(async () => {
|
|
26
|
+
try{
|
|
27
|
+
{% include "src/default/macros/block-run-header.js.njk" %}
|
|
28
|
+
|
|
29
|
+
{% include "src/default/macros/page.js.njk" %}
|
|
30
|
+
|
|
31
|
+
{% include "src/default/macros/block-modules.js.njk" %}
|
|
32
|
+
|
|
33
|
+
{% if (context.next and context.transform.wait==='next') or waitForNext === true %}
|
|
34
|
+
flow.waitForNext({
|
|
35
|
+
key:'{{indexKey}}',
|
|
36
|
+
next: async () => {
|
|
37
|
+
{% if context.transform.return %}
|
|
38
|
+
resolve({type:'return',value: {{context.transform.return | safe}}});
|
|
39
|
+
{% elseif context.next %}
|
|
40
|
+
{% include "src/default/macros/block-next.js.njk" %}
|
|
41
|
+
{% else %}
|
|
42
|
+
resolve();
|
|
43
|
+
{% endif %}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
{% endif %}
|
|
47
|
+
|
|
48
|
+
{{ caller() }}
|
|
49
|
+
|
|
50
|
+
{% if result === true %}
|
|
51
|
+
{% for assign in context.transform.result %}
|
|
52
|
+
flow.set({{assign.key | safe}},{{assign.value | safe}});
|
|
53
|
+
{% endfor%}
|
|
54
|
+
{% endif %}
|
|
55
|
+
|
|
56
|
+
{% if assign === true %}
|
|
57
|
+
{% include "src/default/macros/block-assign.js.njk" %}
|
|
58
|
+
{% endif %}
|
|
59
|
+
|
|
60
|
+
{% if signal === true %}
|
|
61
|
+
{% include "src/default/macros/block-signal.js.njk" %}
|
|
62
|
+
{% endif %}
|
|
63
|
+
|
|
64
|
+
{% if resolve === true %}
|
|
65
|
+
{% if context.transform.return %}
|
|
66
|
+
resolve({type:'return',value: {{context.transform.return | safe}}});
|
|
67
|
+
{% elseif context.next and context.transform.wait!=='next'%}
|
|
68
|
+
{% include "src/default/macros/block-next.js.njk" %}
|
|
69
|
+
{% elseif not context.next%}
|
|
70
|
+
resolve();
|
|
71
|
+
{% endif %}
|
|
72
|
+
{% endif %}
|
|
73
|
+
|
|
74
|
+
{% include "src/default/macros/block-run-footer.js.njk" %}
|
|
75
|
+
}
|
|
76
|
+
catch(error){
|
|
77
|
+
reject(error);
|
|
78
|
+
}
|
|
79
|
+
})();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Object.freeze(this);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
{% endmacro %}
|
|
87
|
+
|
|
88
|
+
{% macro footer() %}
|
|
89
|
+
{% include "src/default/macros/block-footer.js.njk" %}
|
|
90
|
+
{{ caller() }}
|
|
91
|
+
{% endmacro %}
|
|
92
|
+
|
|
93
|
+
{% macro runner({ step: null }) %}
|
|
94
|
+
{% if step.definition.dynamic %}
|
|
95
|
+
const { default: {{step.codeKey}} } = await import("./{{step.codeKey}}.js");
|
|
96
|
+
{% endif %}
|
|
97
|
+
|
|
98
|
+
let current=new {{step.codeKey}}({ parent:_this, engine, flow, caller:c, error });
|
|
99
|
+
let currentArgs=args;
|
|
100
|
+
|
|
101
|
+
do {
|
|
102
|
+
|
|
103
|
+
const nextBlock= typeof currentArgs==='undefined'? await current.run()
|
|
104
|
+
: Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
|
|
105
|
+
|
|
106
|
+
if(nextBlock?.type==='return') return resolve(nextBlock);
|
|
107
|
+
else if(nextBlock?.type!=='block') break;
|
|
108
|
+
|
|
109
|
+
if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
|
|
110
|
+
return resolve(nextBlock);
|
|
111
|
+
|
|
112
|
+
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, error });
|
|
113
|
+
currentArgs=nextBlock.input;
|
|
114
|
+
|
|
115
|
+
} while(true);
|
|
116
|
+
{% endmacro %}
|
|
117
|
+
|
|
118
|
+
{# USAGE #}
|
|
119
|
+
{#
|
|
120
|
+
|
|
121
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
122
|
+
|
|
123
|
+
{% call block.header() %}
|
|
124
|
+
{% endcall %}
|
|
125
|
+
|
|
126
|
+
{% call block.definition() %}
|
|
127
|
+
|
|
128
|
+
{% endcall %}
|
|
129
|
+
|
|
130
|
+
{% call block.footer()%}
|
|
131
|
+
{% endcall %}
|
|
132
|
+
|
|
133
|
+
#}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
// WORKFLOW: {{ indexKey }}
|
|
2
|
+
|
|
3
|
+
import Object from "../core/object.js";
|
|
2
4
|
|
|
3
5
|
{% if context.next %}
|
|
4
6
|
{% if not context.next.definition.dynamic %}
|
|
@@ -60,7 +62,7 @@ export default class Workflow extends Object {
|
|
|
60
62
|
console.log(new Date().toLocaleString(),'{{indexKey}}');
|
|
61
63
|
{% endif %}
|
|
62
64
|
|
|
63
|
-
{% if
|
|
65
|
+
{% if context.transform.debugger %}
|
|
64
66
|
debugger;
|
|
65
67
|
{% endif %}
|
|
66
68
|
|
|
@@ -96,10 +98,10 @@ export default class Workflow extends Object {
|
|
|
96
98
|
if(nextBlock?.type==='return') return nextBlock;
|
|
97
99
|
else if(nextBlock?.type!=='block') break;
|
|
98
100
|
|
|
99
|
-
if(nextBlock.toType.ParentTypeId!==this.constructor.TypeId)
|
|
101
|
+
if(nextBlock.toType.ParentTypeId!==this.constructor.TypeId)
|
|
100
102
|
throw new Error('Unknown situation');
|
|
101
|
-
|
|
102
|
-
current=new nextBlock.toType({ parent:this, engine:this.engine, flow:this, caller:c });
|
|
103
|
+
|
|
104
|
+
current=new nextBlock.toType({ parent:this, engine:this.engine, flow:this, caller:c, error:nextBlock.error });
|
|
103
105
|
currentArgs=nextBlock.input;
|
|
104
106
|
|
|
105
107
|
} while(true);
|
|
@@ -108,7 +110,7 @@ export default class Workflow extends Object {
|
|
|
108
110
|
|
|
109
111
|
|
|
110
112
|
{% if context.transform.print %}
|
|
111
|
-
|
|
113
|
+
console.log({{context.transform.print | safe}});
|
|
112
114
|
{% endif%}
|
|
113
115
|
|
|
114
116
|
{% if context.transform.assert %}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
{% if atom.doc['npm::description'] %}
|
|
14
14
|
"description": "{{atom.doc['npm::description'] | safe}}",
|
|
15
15
|
{% endif %}
|
|
16
|
-
|
|
17
16
|
{% if atom.doc.features.project.format ==='cjs' %}
|
|
18
17
|
{% if atom.doc.features.rollup_output.esm.enabled === true%}
|
|
19
18
|
"main": "dist/default/esm/index.js",
|
|
@@ -72,14 +71,14 @@
|
|
|
72
71
|
{% if atom.doc.features.cli.enabled %}
|
|
73
72
|
{% if atom.doc.features.project.format ==='cjs' %}
|
|
74
73
|
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs"
|
|
75
|
-
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
74
|
+
{% if atom.doc.features.cli.mcp.enabled === true %}
|
|
76
75
|
,"mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
|
|
77
76
|
,"mcp-inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.dir}}/index.cjs --cli-mode=mcp"
|
|
78
77
|
{% endif %}
|
|
79
78
|
{% else %}
|
|
80
79
|
,"cli": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}}"
|
|
81
|
-
,"cli:dev": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}}"
|
|
82
|
-
{% if atom.doc.features.cli.mcp.enabled===true %}
|
|
80
|
+
,"cli:dev": "NODE_PRESERVE_SYMLINKS=1 bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}}"
|
|
81
|
+
{% if atom.doc.features.cli.mcp.enabled === true %}
|
|
83
82
|
,"cli:mcp": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
|
|
84
83
|
,"cli:mcp:inspect": "bunx @modelcontextprotocol/inspector bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.output.file}} --cli-mode=mcp"
|
|
85
84
|
,"cli:mcp:dev": "bun {{atom.doc.features.cli.node_options}} {{atom.doc.features.cli.input.file}} --cli-mode=mcp"
|
|
@@ -89,6 +88,8 @@
|
|
|
89
88
|
,"cli:compile": "fbin compile {{atom.doc.features.cli.output.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
90
89
|
,"cli:compile:dev": "fbin compile {{atom.doc.features.cli.input.file}} -o .bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
91
90
|
,"cli:install": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
91
|
+
,"cli:install:symlink": "fbin install ./.bin/{{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes --symlink"
|
|
92
|
+
,"cli:uninstall": "fbin uninstall {{atom.doc['npm::bin'] or atom.doc['name'] or atom['id']}} --yes"
|
|
92
93
|
{% endif %}
|
|
93
94
|
|
|
94
95
|
{% if atom.doc.features.app.enabled %}
|