@fnet/cli 0.3.14 → 0.4.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.
Files changed (26) hide show
  1. package/dist/fnet/index.js +12 -12
  2. package/package.json +1 -1
  3. package/template/fnet/node/src/default/blocks/assign.js.njk +10 -48
  4. package/template/fnet/node/src/default/blocks/call.js.njk +110 -156
  5. package/template/fnet/node/src/default/blocks/for.js.njk +59 -95
  6. package/template/fnet/node/src/default/blocks/form.js.njk +21 -59
  7. package/template/fnet/node/src/default/blocks/http.js.njk +125 -147
  8. package/template/fnet/node/src/default/blocks/modules.js.njk +10 -52
  9. package/template/fnet/node/src/default/blocks/new.js.njk +40 -85
  10. package/template/fnet/node/src/default/blocks/next.js.njk +10 -32
  11. package/template/fnet/node/src/default/blocks/output.js.njk +10 -48
  12. package/template/fnet/node/src/default/blocks/parallel.js.njk +60 -106
  13. package/template/fnet/node/src/default/blocks/pipeline.js.njk +100 -137
  14. package/template/fnet/node/src/default/blocks/raise.js.njk +9 -25
  15. package/template/fnet/node/src/default/blocks/retry.js.njk +63 -87
  16. package/template/fnet/node/src/default/blocks/return.js.njk +13 -25
  17. package/template/fnet/node/src/default/blocks/schedule.js.njk +56 -73
  18. package/template/fnet/node/src/default/blocks/signal.js.njk +10 -32
  19. package/template/fnet/node/src/default/blocks/steps.js.njk +32 -55
  20. package/template/fnet/node/src/default/blocks/switch.js.njk +37 -74
  21. package/template/fnet/node/src/default/blocks/tryexcept.js.njk +58 -52
  22. package/template/fnet/node/src/default/blocks/wait.js.njk +10 -30
  23. package/template/fnet/node/src/default/macros/block-body-header.js.njk +1 -1
  24. package/template/fnet/node/src/default/macros/block-next.js.njk +0 -1
  25. package/template/fnet/node/src/default/types/block.js.njk +133 -0
  26. package/template/fnet/node/src/default/workflow.js.njk +1 -1
@@ -1,83 +1,66 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- {% include "src/default/macros/block-next-header.js.njk" %}
1
+ {% set resolve=true %}
2
+
3
+ {% import "src/default/types/block.js.njk" as block with context %}
4
+
5
+ {% call block.header() %}
6
+ {% for child in childs %}
7
+ {% if not child.definition.dynamic %}
8
+ // SCHEDULED CHILD: {{child.indexKey}}
9
+ import {{child.codeKey}} from "./{{child.codeKey}}.js";
10
+ {% endif %}
11
+ {% endfor %}
12
+ {% endcall %}
13
+
14
+ {% call block.definition() %}
15
+ // Import node-cron for scheduling
16
+ const cron = await import('node-cron');
17
+
18
+ // Schedule configuration
19
+ const cronExpression = {{ context.transform.schedule.cron | safe }};
20
+ const timezone = {{ context.transform.schedule.timezone | dump | safe }};
21
+ const enabled = {{ context.transform.schedule.enabled | dump | safe }};
22
+
23
+ // Check if schedule is enabled
24
+ if (!enabled) {
25
+ // Schedule is disabled, skip to next block
26
+ {% include "src/default/macros/block-next.js.njk" %}
27
+ return;
28
+ }
4
29
 
5
- {% include "src/default/macros/block-modules-header.js.njk" %}
30
+ // Validate cron expression
31
+ if (!cron.validate(cronExpression)) {
32
+ reject(new Error(`Invalid cron expression: ${cronExpression}`));
33
+ return;
34
+ }
6
35
 
7
- {% for child in childs %}
8
- {% if not child.definition.dynamic %}
9
- // SCHEDULED CHILD: {{child.indexKey}}
10
- import {{child.codeKey}} from "./{{child.codeKey}}.js";
36
+ // Get child block (the scheduled task)
37
+ {% if childs[0] %}
38
+ const scheduledTask = new {{childs[0].codeKey}}({
39
+ parent: _this,
40
+ engine: engine,
41
+ flow: flow
42
+ });
11
43
  {% endif %}
12
- {% endfor %}
13
-
14
- export default function Block(context){
15
-
16
- {% include "src/default/macros/block-body-header.js.njk" %}
17
-
18
- this.run= function (){
19
-
20
- {% include "src/default/macros/block-entry-args.js.njk" %}
21
-
22
- return new Promise(async (resolve,reject)=>{
23
- {% include "src/default/macros/block-run-header.js.njk" %}
24
-
25
- {% include "src/default/macros/page.js.njk" %}
26
44
 
27
- // Import node-cron for scheduling
28
- const cron = await import('node-cron');
29
-
30
- // Schedule configuration
31
- const cronExpression = {{ context.transform.schedule.cron | safe }};
32
- const timezone = {{ context.transform.schedule.timezone | dump | safe }};
33
- const enabled = {{ context.transform.schedule.enabled | dump | safe }};
34
-
35
- // Check if schedule is enabled
36
- if (!enabled) {
37
- // Schedule is disabled, skip to next block
38
- {% include "src/default/macros/block-next.js.njk" %}
39
- return;
40
- }
41
-
42
- // Validate cron expression
43
- if (!cron.validate(cronExpression)) {
44
- reject(new Error(`Invalid cron expression: ${cronExpression}`));
45
- return;
46
- }
47
-
48
- // Get child block (the scheduled task)
45
+ // Schedule the task with optional timezone
46
+ const scheduleOptions = timezone ? { timezone } : {};
47
+ const task = cron.schedule(cronExpression, async () => {
48
+ try {
49
49
  {% if childs[0] %}
50
- const scheduledTask = new {{childs[0].codeKey}}({
51
- parent: _this,
52
- engine: engine,
53
- flow: flow
54
- });
50
+ await scheduledTask.run();
55
51
  {% endif %}
52
+ } catch (error) {
53
+ console.error(`Scheduled task '{{indexKey}}' failed:`, error);
54
+ }
55
+ }, scheduleOptions);
56
56
 
57
- // Schedule the task with optional timezone
58
- const scheduleOptions = timezone ? { timezone } : {};
59
- const task = cron.schedule(cronExpression, async () => {
60
- try {
61
- {% if childs[0] %}
62
- await scheduledTask.run();
63
- {% endif %}
64
- } catch (error) {
65
- console.error(`Scheduled task '{{indexKey}}' failed:`, error);
66
- }
67
- }, scheduleOptions);
57
+ // Start the scheduled task
58
+ task.start();
68
59
 
69
- // Start the scheduled task
70
- task.start();
71
-
72
- // Store task reference for potential cleanup
73
- flow.set('{{indexKey}}_task', task);
74
-
75
- {% include "src/default/macros/block-next.js.njk" %}
76
-
77
- {% include "src/default/macros/block-run-footer.js.njk" %}
78
- });
79
- }
80
- }
60
+ // Store task reference for potential cleanup
61
+ flow.set('{{indexKey}}_task', task);
81
62
 
82
- {% include "src/default/macros/block-footer.js.njk" %}
63
+ {% endcall %}
83
64
 
65
+ {% call block.footer()%}
66
+ {% endcall %}
@@ -1,37 +1,15 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
1
+ {% set assign=true %}
2
+ {% set signal=true %}
3
+ {% set resolve=true %}
2
4
 
3
- export default function Block(context){
5
+ {% import "src/default/types/block.js.njk" as block with context %}
4
6
 
5
- {% include "src/default/macros/block-body-header.js.njk" %}
7
+ {% call block.header() %}
8
+ {% endcall %}
6
9
 
7
- this.run= function (){
8
-
9
- {% include "src/default/macros/block-entry-args.js.njk" %}
10
+ {% call block.definition() %}
10
11
 
11
- return new Promise(async (resolve,reject)=>{
12
- {% include "src/default/macros/block-run-header.js.njk" %}
13
-
14
- {% include "src/default/macros/page.js.njk" %}
12
+ {% endcall %}
15
13
 
16
- {% for assign in context.transform.assign %}
17
- flow.set({{assign.key | safe}},{{assign.value | safe}});
18
- {% endfor%}
19
-
20
- {% if context.transform.return %}
21
- resolve({type:'return',value: {{context.transform.return | safe}}});
22
- {% elseif context.next and context.transform.wait!=='next'%}
23
- {% include "src/default/macros/block-next.js.njk" %}
24
- {% elseif not context.next%}
25
- resolve();
26
- {% endif %}
27
-
28
- {% if context.transform.signal==='next' %}
29
- flow.continueForNext({key:'{{indexKey}}'});
30
- {% endif %}
31
-
32
- {% include "src/default/macros/block-run-footer.js.njk" %}
33
- });
34
- }
35
- }
36
-
37
- {% include "src/default/macros/block-footer.js.njk" %}
14
+ {% call block.footer()%}
15
+ {% endcall %}
@@ -1,70 +1,47 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
1
+ {% set assign=true %}
2
+ {% set signal=true %}
3
+ {% set resolve=true %}
2
4
 
3
- {% include "src/default/macros/block-next-header.js.njk" %}
5
+ {% import "src/default/types/block.js.njk" as block with context %}
4
6
 
5
- export default function Block(context){
7
+ {% call block.header() %}
8
+ {% endcall %}
6
9
 
7
- {% include "src/default/macros/block-body-header.js.njk" %}
10
+ {% call block.definition() %}
8
11
 
9
- this.run= function (){
10
-
11
- {% include "src/default/macros/block-entry-args.js.njk" %}
12
+ {% if context.next %}
12
13
 
13
- return new Promise(async (resolve,reject)=>{
14
-
15
- {% include "src/default/macros/block-run-header.js.njk" %}
14
+ // NEXT : {{context.next.indexKey}}
15
+ {% if context.next.definition.dynamic %}
16
+ const { default: {{context.next.codeKey}} } = await import("./{{context.next.codeKey}}.js");
17
+ {% endif %}
16
18
 
17
- {% if context.next %}
19
+ let current=new {{context.next.codeKey}}({ parent:_this, engine, flow, caller:c , error });
20
+ let currentArgs=args;
18
21
 
19
- // NEXT : {{context.next.indexKey}}
20
- {% if context.next.definition.dynamic %}
21
- const { default: {{context.next.codeKey}} } = await import("./{{context.next.codeKey}}.js");
22
- {% endif %}
23
-
24
- let current=new {{context.next.codeKey}}({ parent:_this, engine, flow, caller:c ,onError, error });
25
- let currentArgs=args;
26
-
27
- do {
28
-
29
- {% if workflow.parent.context.atom.doc.features.print_runners %}
30
- console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
31
- {% endif %}
32
-
33
- try {
34
- const nextBlock= typeof currentArgs==='undefined'? await current.run()
35
- : Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
36
-
37
- if(nextBlock?.type==='return') return resolve(nextBlock);
38
- else if(nextBlock?.type!=='block') break;
39
-
40
- if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
41
- return resolve(nextBlock);
42
-
43
- current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, onError, error });
44
- currentArgs=nextBlock.input;
45
- } catch (err) {
46
- if (onError) {
47
- return onError(err);
48
- }
49
- throw err;
50
- }
51
-
52
- } while(true);
22
+ do {
53
23
 
24
+ {% if workflow.parent.context.atom.doc.features.print_runners %}
25
+ console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
54
26
  {% endif %}
55
27
 
28
+ const nextBlock= typeof currentArgs==='undefined'? await current.run()
29
+ : Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
30
+
31
+ if(nextBlock?.type==='return') return resolve(nextBlock);
32
+ else if(nextBlock?.type!=='block') break;
56
33
 
57
- {% include "src/default/macros/block-assign.js.njk" %}
34
+ if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
35
+ return resolve(nextBlock);
58
36
 
59
- {% include "src/default/macros/block-signal.js.njk" %}
37
+ current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, error });
38
+ currentArgs=nextBlock.input;
60
39
 
61
- resolve();
62
-
63
- {% include "src/default/macros/block-run-footer.js.njk" %}
64
- });
65
- }
40
+ } while(true);
66
41
 
67
- Object.freeze(this);
68
- }
42
+ {% endif %}
43
+
44
+ {% endcall %}
69
45
 
70
- {% include "src/default/macros/block-footer.js.njk" %}
46
+ {% call block.footer()%}
47
+ {% endcall %}
@@ -1,86 +1,49 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
1
+ {% set assign=true %}
2
+ {% set signal=true %}
3
+ {% set resolve=true %}
2
4
 
3
- {% if not hasDefaultCondition %}
4
- {% include "src/default/macros/block-next-header.js.njk" %}
5
- {% endif %}
5
+ {% import "src/default/types/block.js.njk" as block with context %}
6
6
 
7
- {% include "src/default/macros/block-modules-header.js.njk" %}
7
+ {% call block.header() %}
8
8
 
9
- {% for child in childs %}
10
- {% if not child.definition.dynamic %}
11
- // CHILD: {{child.indexKey}}
12
- import {{child.codeKey}} from "./{{child.codeKey}}.js";
13
- {% endif %}
14
- {% endfor%}
9
+ {% for child in childs %}
10
+ {% if not child.definition.dynamic %}
11
+ // CHILD: {{child.indexKey}}
12
+ import {{child.codeKey}} from "./{{child.codeKey}}.js";
13
+ {% endif %}
14
+ {% endfor%}
15
15
 
16
- export default function Block(context) {
16
+ {% endcall %}
17
17
 
18
- {% include "src/default/macros/block-body-header.js.njk" %}
18
+ {% call block.definition() %}
19
19
 
20
- this.run= function (){
21
-
22
- {% include "src/default/macros/block-entry-args.js.njk" %}
23
-
24
- return new Promise(async (resolve,reject)=>{
25
-
26
- {% include "src/default/macros/block-run-header.js.njk" %}
27
-
28
- {% include "src/default/macros/page.js.njk" %}
29
-
30
- {% include "src/default/macros/block-modules.js.njk" %}
31
-
32
- {% for child in childs %}
33
- {% if loop.first %}
34
- if ({{child.context.transform.condition | safe}})
35
- {% else %}
36
- {%if child.context.transform.condition %}
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}}.js");
46
- {% endif %}
47
-
48
- const current=new {{child.codeKey}}({ parent:_this, engine, flow, caller:c, onError });
49
-
50
- {% if workflow.parent.context.atom.doc.features.print_runners %}
51
- console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
52
- {% endif %}
53
-
54
- try {
55
- return resolve(Array.isArray(args)? await current.run.apply(current,args) : await current.run.call(current,args));
56
- } catch (err) {
57
- if (onError) {
58
- return onError(err);
59
- }
60
- throw err;
61
- }
62
- }
63
- {% endfor%}
64
-
65
- {% include "src/default/macros/block-assign.js.njk" %}
20
+ {% for child in childs %}
21
+ {% if loop.first %}
22
+ if ({{child.context.transform.condition | safe}})
23
+ {% else %}
24
+ {%if child.context.transform.condition %}
25
+ else if ({{child.context.transform.condition | safe}})
26
+ {% else %}
27
+ else
28
+ {% endif %}
29
+ {% endif %}
30
+ {
31
+ {% if child.definition.dynamic %}
32
+ // CHILD: {{child.indexKey}}
33
+ const { default: {{child.codeKey}} } = await import("./{{child.codeKey}}.js");
34
+ {% endif %}
66
35
 
67
- {% include "src/default/macros/block-signal.js.njk" %}
36
+ const current=new {{child.codeKey}}({ parent:_this, engine, flow, caller:c, error });
68
37
 
69
- {% if not hasDefaultCondition %}
70
- {% if context.transform.return %}
71
- resolve({type:'return',value: {{context.transform.return | safe}}});
72
- {% elseif context.next %}
73
- {% include "src/default/macros/block-next.js.njk" %}
74
- {% else %}
75
- resolve();
38
+ {% if workflow.parent.context.atom.doc.features.print_runners %}
39
+ console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
76
40
  {% endif %}
77
- {% endif %}
78
41
 
79
- {% include "src/default/macros/block-run-footer.js.njk" %}
80
- });
81
- }
42
+ return resolve(Array.isArray(args)? await current.run.apply(current,args) : await current.run.call(current,args));
43
+ }
44
+ {% endfor%}
82
45
 
83
- Object.freeze(this);
84
- }
46
+ {% endcall %}
85
47
 
86
- {% include "src/default/macros/block-footer.js.njk" %}
48
+ {% call block.footer()%}
49
+ {% endcall %}
@@ -1,74 +1,80 @@
1
+ {% set assign=true %}
2
+ {% set signal=true %}
3
+ {% set resolve=true %}
1
4
 
2
- {% include "src/default/macros/block-header.js.njk" %}
5
+ {% import "src/default/types/block.js.njk" as block with context %}
3
6
 
4
- {# {% include "src/default/macros/block-next-header.js.njk" %} #}
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
- {% include "src/default/macros/block-modules-header.js.njk" %}
16
+ {% call block.definition() %}
17
+
18
+ try{
7
19
 
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%}
20
+ {% if context.try.definition.dynamic %}
21
+ const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}.js");
22
+ {% endif %}
14
23
 
15
- export default function Block(context) {
24
+ let current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c, error });
25
+ let currentArgs=args;
16
26
 
17
- {% include "src/default/macros/block-body-header.js.njk" %}
27
+ do {
18
28
 
19
- this.run= function (){
20
-
21
- {% include "src/default/macros/block-entry-args.js.njk" %}
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
- return new Promise(async (resolve,reject)=>{
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
- {% include "src/default/macros/page.js.njk" %}
36
+ if(nextBlock?.type==='return') return resolve(nextBlock);
37
+ else if(nextBlock?.type!=='block') break;
28
38
 
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}}.js");
36
- {% endif %}
39
+ if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
40
+ return resolve(nextBlock);
37
41
 
38
- const current=new {{context.except.codeKey}}({ parent:_this, engine, flow, caller:c , error });
42
+ current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, error });
43
+ currentArgs=nextBlock.input;
39
44
 
40
- {% if workflow.parent.context.atom.doc.features.print_runners %}
41
- console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
42
- {% endif %}
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
- Array.isArray(args)? current.run.apply(current,args).then(resolve):current.run.call(current,args).then(resolve);
45
- };
56
+ do {
46
57
 
47
- {% if context.try.definition.dynamic %}
48
- const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}.js");
49
- {% endif %}
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
- {% if workflow.parent.context.atom.doc.features.print_runners %}
54
- console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
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
- resolve(Array.isArray(args)? await current.run.apply(current,args) : await current.run.call(current,args));
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
- {% include "src/default/macros/block-assign.js.njk" %}
68
+ if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
69
+ return resolve(nextBlock);
64
70
 
65
- {% include "src/default/macros/block-signal.js.njk" %}
71
+ current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, error });
72
+ currentArgs=nextBlock.input;
66
73
 
67
- {% include "src/default/macros/block-run-footer.js.njk" %}
68
- });
74
+ } while(true);
69
75
  }
70
76
 
71
- Object.freeze(this);
72
- }
77
+ {% endcall %}
73
78
 
74
- {% include "src/default/macros/block-footer.js.njk" %}
79
+ {% call block.footer()%}
80
+ {% endcall %}
@@ -1,34 +1,14 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
1
+ {% set assign=true %}
2
+ {% set signal=true %}
3
+ {% set resolve=true %}
2
4
 
3
- export default function Block(context){
5
+ {% import "src/default/types/block.js.njk" as block with context %}
4
6
 
5
- {% include "src/default/macros/block-body-header.js.njk" %}
7
+ {% call block.header() %}
8
+ {% endcall %}
6
9
 
7
- this.run= function (){
8
-
9
- {% include "src/default/macros/block-entry-args.js.njk" %}
10
+ {% call block.definition() %}
11
+ {% endcall %}
10
12
 
11
- return new Promise(async (resolve,reject)=>{
12
- {% include "src/default/macros/block-run-header.js.njk" %}
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 %}
@@ -2,6 +2,6 @@ if (this.constructor !== Block) throw Error(Message.USE_CONSTRUCTOR);
2
2
 
3
3
  this.context=context;
4
4
 
5
- const { engine, flow, caller, onError, error }=context || {};
5
+ const { engine, flow, caller, error }=context || {};
6
6
 
7
7
  const _this=this;
@@ -12,7 +12,6 @@ resolve ({
12
12
  fromType: _this.constructor,
13
13
  fromClosure: c,
14
14
  toType:{{context.next.codeKey}},
15
- onError,
16
15
  error,
17
16
  {% if context.transform.output %}
18
17
  input: {{context.transform.output | safe}},