@fnet/cli 0.119.4 → 0.120.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/package.json +1 -1
- package/template/fnet/bun/src/default/blocks/call.js.njk +2 -1
- package/template/fnet/bun/src/default/blocks/for.js.njk +1 -1
- package/template/fnet/bun/src/default/blocks/raise.js.njk +1 -1
- package/template/fnet/bun/src/default/blocks/steps.js.njk +2 -2
- package/template/fnet/bun/src/default/blocks/switch.js.njk +33 -37
- package/template/fnet/bun/src/default/blocks/tryexcept.js.njk +15 -1
- package/template/fnet/bun/src/default/macros/block-body-header.js.njk +1 -1
- package/template/fnet/bun/src/default/macros/block-next.js.njk +1 -0
- package/template/fnet/node/src/default/blocks/call.js.njk +2 -1
- package/template/fnet/node/src/default/blocks/for.js.njk +1 -1
- package/template/fnet/node/src/default/blocks/raise.js.njk +1 -1
- package/template/fnet/node/src/default/blocks/steps.js.njk +2 -2
- package/template/fnet/node/src/default/blocks/switch.js.njk +1 -1
- package/template/fnet/node/src/default/blocks/tryexcept.js.njk +17 -13
- package/template/fnet/node/src/default/macros/block-body-header.js.njk +1 -1
- package/template/fnet/node/src/default/macros/block-next.js.njk +1 -0
package/package.json
CHANGED
|
@@ -57,7 +57,7 @@ export default function Block(context) {
|
|
|
57
57
|
if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
|
|
58
58
|
return resolve(nextBlock);
|
|
59
59
|
|
|
60
|
-
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c});
|
|
60
|
+
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, onError, error });
|
|
61
61
|
currentArgs=nextBlock.withArgs;
|
|
62
62
|
|
|
63
63
|
} while(true);
|
|
@@ -15,7 +15,7 @@ export default function Block(context){
|
|
|
15
15
|
|
|
16
16
|
const raise = {{context.transform.raise | safe}};
|
|
17
17
|
|
|
18
|
-
reject(new Error(raise?.message||raise||"Unknown error"));
|
|
18
|
+
onError? onError(new Error(raise?.message||raise||"Unknown error")) : reject(new Error(raise?.message||raise||"Unknown error"));
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -21,7 +21,7 @@ export default function Block(context){
|
|
|
21
21
|
const { default: {{context.next.codeKey}} } = await import("./{{context.next.codeKey}}");
|
|
22
22
|
{% endif %}
|
|
23
23
|
|
|
24
|
-
let current=new {{context.next.codeKey}}({ parent:_this, engine, flow, caller:c });
|
|
24
|
+
let current=new {{context.next.codeKey}}({ parent:_this, engine, flow, caller:c ,onError, error });
|
|
25
25
|
let currentArgs=args;
|
|
26
26
|
|
|
27
27
|
do {
|
|
@@ -39,7 +39,7 @@ export default function Block(context){
|
|
|
39
39
|
if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
|
|
40
40
|
return resolve(nextBlock);
|
|
41
41
|
|
|
42
|
-
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c});
|
|
42
|
+
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, onError, error });
|
|
43
43
|
currentArgs=nextBlock.withArgs;
|
|
44
44
|
|
|
45
45
|
} while(true);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
{% include "src/default/macros/block-header.js.njk" %}
|
|
2
3
|
|
|
3
|
-
{%
|
|
4
|
-
{% include "src/default/macros/block-next-header.js.njk" %}
|
|
5
|
-
{% endif %}
|
|
4
|
+
{# {% include "src/default/macros/block-next-header.js.njk" %} #}
|
|
6
5
|
|
|
7
6
|
{% include "src/default/macros/block-modules-header.js.njk" %}
|
|
8
7
|
|
|
@@ -16,56 +15,53 @@
|
|
|
16
15
|
export default function Block(context) {
|
|
17
16
|
|
|
18
17
|
{% include "src/default/macros/block-body-header.js.njk" %}
|
|
19
|
-
|
|
18
|
+
|
|
20
19
|
this.run= function (){
|
|
21
20
|
|
|
22
21
|
const args=Array.from(arguments);
|
|
23
22
|
|
|
24
23
|
return new Promise(async (resolve,reject)=>{
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
{% include "src/default/macros/block-run-header.js.njk" %}
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
{% include "src/default/macros/page.js.njk" %}
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
else if ({{child.context.transform.condition | safe}})
|
|
38
|
-
{% else %}
|
|
39
|
-
else
|
|
40
|
-
{% endif %}
|
|
41
|
-
{% endif %}
|
|
42
|
-
{
|
|
43
|
-
{% if child.definition.dynamic %}
|
|
44
|
-
// CHILD: {{child.indexKey}}
|
|
45
|
-
const { default: {{child.codeKey}} } = await import("./{{child.codeKey}}");
|
|
29
|
+
{% include "src/default/macros/block-modules.js.njk" %}
|
|
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}}");
|
|
46
36
|
{% endif %}
|
|
47
37
|
|
|
48
|
-
const current=new {{
|
|
38
|
+
const current=new {{context.except.codeKey}}({ parent:_this, engine, flow, caller:c , error });
|
|
49
39
|
|
|
50
40
|
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
51
41
|
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
52
42
|
{% endif %}
|
|
53
43
|
|
|
54
|
-
return resolve(await current.run.apply(current,args));
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
44
|
+
{# return resolve(await current.run.apply(current,args)); #}
|
|
45
|
+
current.run.apply(current,args).then(resolve);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
{% if context.try.definition.dynamic %}
|
|
49
|
+
const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}");
|
|
50
|
+
{% endif %}
|
|
51
|
+
|
|
52
|
+
const current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c ,onError, error });
|
|
53
|
+
|
|
54
|
+
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
55
|
+
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
56
|
+
{% endif %}
|
|
57
|
+
|
|
58
|
+
return resolve(await current.run.apply(current,args));
|
|
59
|
+
}
|
|
60
|
+
catch({{context.except.context.transform.as | safe}}){
|
|
61
|
+
throw new Error('Error must not reach here!');
|
|
62
|
+
}
|
|
67
63
|
});
|
|
68
|
-
}
|
|
64
|
+
}
|
|
69
65
|
|
|
70
66
|
Object.freeze(this);
|
|
71
67
|
}
|
|
@@ -29,7 +29,21 @@ export default function Block(context) {
|
|
|
29
29
|
{% include "src/default/macros/block-modules.js.njk" %}
|
|
30
30
|
|
|
31
31
|
try{
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
const onError=error=>{
|
|
34
|
+
{% if context.except.definition.dynamic %}
|
|
35
|
+
const { default: {{context.except.codeKey}} } = await import("./{{context.except.codeKey}}");
|
|
36
|
+
{% endif %}
|
|
37
|
+
|
|
38
|
+
const current=new {{context.except.codeKey}}({ parent:_this, engine, flow, caller:c, onError });
|
|
39
|
+
|
|
40
|
+
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
41
|
+
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
42
|
+
{% endif %}
|
|
43
|
+
|
|
44
|
+
return resolve(await current.run.apply(current,args));
|
|
45
|
+
};
|
|
46
|
+
|
|
33
47
|
{% if context.try.definition.dynamic %}
|
|
34
48
|
const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}");
|
|
35
49
|
{% endif %}
|
|
@@ -57,7 +57,7 @@ export default function Block(context) {
|
|
|
57
57
|
if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
|
|
58
58
|
return resolve(nextBlock);
|
|
59
59
|
|
|
60
|
-
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c});
|
|
60
|
+
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, onError, error });
|
|
61
61
|
currentArgs=nextBlock.withArgs;
|
|
62
62
|
|
|
63
63
|
} while(true);
|
|
@@ -15,7 +15,7 @@ export default function Block(context){
|
|
|
15
15
|
|
|
16
16
|
const raise = {{context.transform.raise | safe}};
|
|
17
17
|
|
|
18
|
-
reject(new Error(raise?.message||raise||"Unknown error"));
|
|
18
|
+
onError? onError(new Error(raise?.message||raise||"Unknown error")) : reject(new Error(raise?.message||raise||"Unknown error"));
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -21,7 +21,7 @@ export default function Block(context){
|
|
|
21
21
|
const { default: {{context.next.codeKey}} } = await import("./{{context.next.codeKey}}");
|
|
22
22
|
{% endif %}
|
|
23
23
|
|
|
24
|
-
let current=new {{context.next.codeKey}}({ parent:_this, engine, flow, caller:c });
|
|
24
|
+
let current=new {{context.next.codeKey}}({ parent:_this, engine, flow, caller:c ,onError, error });
|
|
25
25
|
let currentArgs=args;
|
|
26
26
|
|
|
27
27
|
do {
|
|
@@ -39,7 +39,7 @@ export default function Block(context){
|
|
|
39
39
|
if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
|
|
40
40
|
return resolve(nextBlock);
|
|
41
41
|
|
|
42
|
-
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c});
|
|
42
|
+
current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, onError, error });
|
|
43
43
|
currentArgs=nextBlock.withArgs;
|
|
44
44
|
|
|
45
45
|
} while(true);
|
|
@@ -45,7 +45,7 @@ export default function Block(context) {
|
|
|
45
45
|
const { default: {{child.codeKey}} } = await import("./{{child.codeKey}}");
|
|
46
46
|
{% endif %}
|
|
47
47
|
|
|
48
|
-
const current=new {{child.codeKey}}({ parent:_this, engine, flow, caller:c });
|
|
48
|
+
const current=new {{child.codeKey}}({ parent:_this, engine, flow, caller:c, onError });
|
|
49
49
|
|
|
50
50
|
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
51
51
|
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
@@ -30,11 +30,26 @@ export default function Block(context) {
|
|
|
30
30
|
|
|
31
31
|
try{
|
|
32
32
|
|
|
33
|
+
const onError=error=>{
|
|
34
|
+
{% if context.except.definition.dynamic %}
|
|
35
|
+
const { default: {{context.except.codeKey}} } = await import("./{{context.except.codeKey}}");
|
|
36
|
+
{% endif %}
|
|
37
|
+
|
|
38
|
+
const current=new {{context.except.codeKey}}({ parent:_this, engine, flow, caller:c , error });
|
|
39
|
+
|
|
40
|
+
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
41
|
+
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
42
|
+
{% endif %}
|
|
43
|
+
|
|
44
|
+
{# return resolve(await current.run.apply(current,args)); #}
|
|
45
|
+
current.run.apply(current,args).then(resolve);
|
|
46
|
+
};
|
|
47
|
+
|
|
33
48
|
{% if context.try.definition.dynamic %}
|
|
34
49
|
const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}");
|
|
35
50
|
{% endif %}
|
|
36
51
|
|
|
37
|
-
const current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c });
|
|
52
|
+
const current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c ,onError, error });
|
|
38
53
|
|
|
39
54
|
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
40
55
|
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
@@ -43,18 +58,7 @@ export default function Block(context) {
|
|
|
43
58
|
return resolve(await current.run.apply(current,args));
|
|
44
59
|
}
|
|
45
60
|
catch({{context.except.context.transform.as | safe}}){
|
|
46
|
-
|
|
47
|
-
{% if context.except.definition.dynamic %}
|
|
48
|
-
const { default: {{context.except.codeKey}} } = await import("./{{context.except.codeKey}}");
|
|
49
|
-
{% endif %}
|
|
50
|
-
|
|
51
|
-
const current=new {{context.except.codeKey}}({ parent:_this, engine, flow, caller:c });
|
|
52
|
-
|
|
53
|
-
{% if workflow.parent.context.atom.doc.features.print_runners %}
|
|
54
|
-
console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
|
|
55
|
-
{% endif %}
|
|
56
|
-
|
|
57
|
-
return resolve(await current.run.apply(current,args));
|
|
61
|
+
throw new Error('Error must not reach here!');
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
64
|
}
|