@fnet/cli 0.121.0 → 0.125.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 (55) hide show
  1. package/dist/fnet/index.js +1 -1
  2. package/dist/fnode/{index.BccmKJid.js → index.B1OhKt7p.js} +1 -1
  3. package/dist/fnode/{index.C297FGrE.js → index.BgwaIU1c.js} +1 -1
  4. package/dist/fnode/index.js +1 -1
  5. package/package.json +1 -1
  6. package/template/fnet/node/package.json.njk +3 -1
  7. package/template/fnet/node/src/default/blocks/assign.js.njk +18 -6
  8. package/template/fnet/node/src/default/blocks/call.js.njk +8 -5
  9. package/template/fnet/node/src/default/blocks/for.js.njk +4 -0
  10. package/template/fnet/node/src/default/blocks/form.js.njk +3 -3
  11. package/template/fnet/node/src/default/blocks/jump.js.njk +5 -1
  12. package/template/fnet/node/src/default/blocks/modules.js.njk +9 -4
  13. package/template/fnet/node/src/default/blocks/raise.js.njk +4 -0
  14. package/template/fnet/node/src/default/blocks/return.js.njk +5 -1
  15. package/template/fnet/{bun/src/default/blocks/jump.js.njk → node/src/default/blocks/signal.js.njk} +12 -8
  16. package/template/fnet/node/src/default/blocks/steps.js.njk +6 -0
  17. package/template/fnet/node/src/default/blocks/switch.js.njk +5 -0
  18. package/template/fnet/node/src/default/blocks/tryexcept.js.njk +5 -1
  19. package/template/fnet/node/src/default/blocks/{operation.js.njk → wait.js.njk} +13 -4
  20. package/template/fnet/node/src/default/macros/block-assign.js.njk +3 -0
  21. package/template/fnet/node/src/default/macros/block-next.js.njk +1 -1
  22. package/template/fnet/node/src/default/macros/block-signal.js.njk +3 -0
  23. package/template/fnet/node/src/default/workflow.js.njk +4 -1
  24. package/template/fnode/bun/package.json.njk +3 -1
  25. package/template/fnode/node/package.json.njk +3 -1
  26. package/template/fnet/bun/src/app/index.html.njk +0 -67
  27. package/template/fnet/bun/src/app/index.js.njk +0 -36
  28. package/template/fnet/bun/src/cli/index.js.njk +0 -45
  29. package/template/fnet/bun/src/default/blocks/assign.js.njk +0 -40
  30. package/template/fnet/bun/src/default/blocks/call.js.njk +0 -93
  31. package/template/fnet/bun/src/default/blocks/for.js.njk +0 -81
  32. package/template/fnet/bun/src/default/blocks/form.js.njk +0 -65
  33. package/template/fnet/bun/src/default/blocks/modules.js.njk +0 -50
  34. package/template/fnet/bun/src/default/blocks/operation.js.njk +0 -24
  35. package/template/fnet/bun/src/default/blocks/raise.js.njk +0 -25
  36. package/template/fnet/bun/src/default/blocks/return.js.njk +0 -27
  37. package/template/fnet/bun/src/default/blocks/steps.js.njk +0 -56
  38. package/template/fnet/bun/src/default/blocks/switch.js.njk +0 -68
  39. package/template/fnet/bun/src/default/blocks/tryexcept.js.njk +0 -79
  40. package/template/fnet/bun/src/default/engine.js.njk +0 -79
  41. package/template/fnet/bun/src/default/input.args.js.njk +0 -122
  42. package/template/fnet/bun/src/default/macros/block-body-header.js.njk +0 -7
  43. package/template/fnet/bun/src/default/macros/block-entry-args.js.njk +0 -2
  44. package/template/fnet/bun/src/default/macros/block-footer.js.njk +0 -3
  45. package/template/fnet/bun/src/default/macros/block-header.js.njk +0 -14
  46. package/template/fnet/bun/src/default/macros/block-library-header.js.njk +0 -19
  47. package/template/fnet/bun/src/default/macros/block-modules-header.js.njk +0 -8
  48. package/template/fnet/bun/src/default/macros/block-modules.js.njk +0 -29
  49. package/template/fnet/bun/src/default/macros/block-next-header.js.njk +0 -6
  50. package/template/fnet/bun/src/default/macros/block-next.js.njk +0 -21
  51. package/template/fnet/bun/src/default/macros/block-run-form.js.njk +0 -32
  52. package/template/fnet/bun/src/default/macros/block-run-header.js.njk +0 -39
  53. package/template/fnet/bun/src/default/macros/page.js.njk +0 -8
  54. package/template/fnet/bun/src/default/macros/workflow-header.js.njk +0 -7
  55. package/template/fnet/bun/src/default/workflow.js.njk +0 -117
@@ -44,7 +44,9 @@
44
44
  }
45
45
  },
46
46
  {% endif %}
47
-
47
+ "flownet": {
48
+ "type": "node",
49
+ },
48
50
  {% if atom.doc.repo.url %}
49
51
  "repository": {
50
52
  "type": "{{atom.doc.repo.type or 'git'}}",
@@ -44,7 +44,9 @@
44
44
  }
45
45
  },
46
46
  {% endif %}
47
-
47
+ "flownet": {
48
+ "type": "node",
49
+ },
48
50
  {% if atom.doc.repo.url %}
49
51
  "repository": {
50
52
  "type": "{{atom.doc.repo.type or 'git'}}",
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>{{atom.doc.title or atom.doc.name}}</title>
8
-
9
- {% if atom.doc.features.css.options.extract===true %}
10
- <link rel="stylesheet" href="./index.css" />
11
- {% endif %}
12
-
13
- {% if atom.doc.features.app.format==='iife' %}
14
- <script src="./index.js"></script>
15
- {% endif %}
16
-
17
- </head>
18
- <body style="height:100vh;margin:0;padding:0;background-color: #eeeeee;">
19
- <div id="container" style="height:100%;"></div>
20
- {% if atom.doc.features.app.export===true %}
21
- {% if atom.doc.features.app.format==='esm' %}
22
- <script type="module">
23
- import { createApp } from "./index.js";
24
- const run = createApp({container: document.getElementById("container")});
25
- {% if atom.doc.features.app.props %}
26
- const dispose=run({{ atom.doc.features.app.props | dump | safe }});
27
- {% else %}
28
- const dispose=run();
29
- {% endif %}
30
- </script>
31
- {% endif %}
32
-
33
- {% if atom.doc.features.app.format==='iife' %}
34
- <script>
35
- const { createApp } = window['{{atom.doc.bundleName}}'];
36
- const run = createApp({container: document.getElementById("container")});
37
- {% if atom.doc.features.app.props %}
38
- const dispose=run({{ atom.doc.features.app.props | dump | safe }});
39
- {% else %}
40
- const dispose=run();
41
- {% endif %}
42
- </script>
43
- {% endif %}
44
- {% endif %}
45
-
46
- {% if atom.doc.features.workbox_enabled %}
47
- {% if atom.doc.features.rollup_output.app.workbox.enabled %}
48
- <!-- Service Worker Registration -->
49
- <script>
50
- if ('serviceWorker' in navigator) {
51
- window.addEventListener('load', () => {
52
- navigator
53
- .serviceWorker
54
- .register('./sw.js', {scope: './'}) // Optionally add scope
55
- .then((registration) => {
56
- console.log('Service Worker registered with scope:', registration.scope);
57
- })
58
- .catch((error) => {
59
- console.log('Service Worker registration failed:', error);
60
- });
61
- });
62
- }
63
- </script>
64
- {% endif%}
65
- {% endif%}
66
- </body>
67
- </html>
@@ -1,36 +0,0 @@
1
- {% if atom.doc.features.app.enabled===true %}
2
-
3
- import { default as Engine } from "../default/{{ atom.doc.features.app_default_entry_file or atom.doc.features.main_default_entry_file }}";
4
-
5
- {% if atom.doc.features.app.export===true %}
6
- {% if atom.doc.features.app.extend===true %}
7
- import { default as init } from '../../../app';
8
- {% endif %}
9
- const createApp = ({ container }) => {
10
- {% if atom.doc.features.app.extend===true %}
11
- return init({container,Engine});
12
- {% else %}
13
- return (props) => {
14
- const engine = new Engine();
15
- engine.run({ ...props, container }).catch((error) => {
16
- console.log(error.message)
17
- });
18
- }
19
- {% endif %}
20
- };
21
- export { createApp };
22
- {% else %}
23
- {% if atom.doc.features.app.extend===true %}
24
- import { default as run } from '../../../app';
25
- run({ Engine }).catch((error) => {
26
- console.log(error.message)
27
- });
28
- {% else %}
29
- const engine = new Engine();
30
- engine.run().catch((error) => {
31
- console.log(error.message)
32
- });
33
- {% endif %}
34
- {% endif %}
35
-
36
- {% endif %}
@@ -1,45 +0,0 @@
1
- {% if atom.doc.features.cli.enabled===true %}
2
- import argv from '../default/input.args.js';
3
- import { schema as inputSchema } from '../default/validate_input.js';
4
- import { default as Engine } from '../default/{{atom.doc.features.cli_default_entry_file or atom.doc.features.main_default_entry_file}}';
5
-
6
- {% if atom.doc.features.cli.extend===true %}
7
- {# TYPE 1 #}
8
- import { default as runExtended } from '../../../cli';
9
-
10
- const run = async () => {
11
- return await runExtended(await argv(),{ Engine });
12
- };
13
-
14
- run()
15
- .then(() => {
16
- {# process.exit(0); #}
17
- })
18
- .catch((error) => {
19
- console.error(error.message);
20
- process.exit(1);
21
- });
22
- {% else %}
23
- {# TYPE 2 #}
24
- const run = async () => {
25
- const engine = new Engine();
26
- return await engine.run(await argv());
27
- };
28
-
29
- run()
30
- .then((result) => {
31
- if (typeof result !== 'undefined')
32
- {
33
- // TODO: REMOVE THIS LINE
34
- const stdout_format=process.argv.slice(2).indexOf()!==-1? process.argv.slice(2)[process.argv.slice(2).indexOf('--stdout_format')+1]:null;
35
- if(stdout_format==='json') console.log(JSON.stringify(result,null,2));
36
- else console.log(result);
37
- }
38
- {# process.exit(0); #}
39
- })
40
- .catch((error) => {
41
- console.error(error.message);
42
- process.exit(1);
43
- });
44
- {% endif %}
45
- {% endif %}
@@ -1,40 +0,0 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- {% include "src/default/macros/block-next-header.js.njk" %}
4
-
5
- {% include "src/default/macros/block-modules-header.js.njk" %}
6
-
7
- export default function Block(context){
8
-
9
- {% include "src/default/macros/block-body-header.js.njk" %}
10
-
11
- this.run= function (){
12
-
13
- {% include "src/default/macros/block-entry-args.js.njk" %}
14
-
15
- return new Promise(async (resolve,reject)=>{
16
-
17
- {% include "src/default/macros/block-run-header.js.njk" %}
18
-
19
- {% include "src/default/macros/page.js.njk" %}
20
-
21
- {% include "src/default/macros/block-modules.js.njk" %}
22
-
23
- {% for assign in context.transform.assign %}
24
- flow.set({{assign.key | safe}},{{assign.value | safe}});
25
- {% endfor%}
26
-
27
- {% if context.transform.return %}
28
- resolve({type:'return',value: {{context.transform.return | safe}}});
29
- {% elseif context.next %}
30
- {% include "src/default/macros/block-next.js.njk" %}
31
- {% else %}
32
- resolve();
33
- {% endif %}
34
- });
35
- }
36
-
37
- Object.freeze(this);
38
- }
39
-
40
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,93 +0,0 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- {% include "src/default/macros/block-next-header.js.njk" %}
4
-
5
- {% include "src/default/macros/block-library-header.js.njk" %}
6
-
7
- {% include "src/default/macros/block-modules-header.js.njk" %}
8
-
9
- export default function Block(context){
10
-
11
- {% include "src/default/macros/block-body-header.js.njk" %}
12
-
13
- this.run= function (){
14
-
15
- {% include "src/default/macros/block-entry-args.js.njk" %}
16
-
17
- return new Promise(async (resolve,reject)=>{
18
-
19
- try{
20
- {% include "src/default/macros/block-run-header.js.njk" %}
21
-
22
- {% include "src/default/macros/page.js.njk" %}
23
-
24
- {% include "src/default/macros/block-modules.js.njk" %}
25
-
26
- {% if context.next and context.transform.operation==='wait-for-next' %}
27
- flow.waitForNext({
28
- key:'{{indexKey}}',
29
- next: new Promise((resolve,reject) => {
30
- {% include "src/default/macros/block-next.js.njk" %}
31
- })
32
- });
33
- {% endif %}
34
-
35
- {% if context.lib.type==='atom'%}
36
- const lib=LIBRARY;
37
- {% elseif context.lib.type==='subworkflow' %}
38
- const lib={{context.lib.codeKey}};
39
- {% elseif target.atom.protocol==='use:' %}
40
- const lib={{context.transform.call}};
41
- {% else %}
42
- const lib=undefined;
43
- throw new Error('Couldn file lib.');
44
- {% endif %}
45
-
46
- {% if context.lib.atom.doc.subtype==='workflow'%}
47
- const Workflow=lib;
48
- const workflow=new Workflow({app:engine.app,caller:c});
49
- const callLib = workflow.run.bind(workflow);
50
- {% elseif context.lib.type==='subworkflow'%}
51
- const Workflow=lib;
52
- const workflow=new Workflow({engine,flow,caller:c});
53
- const callLib = workflow.run.bind(workflow);
54
- {% else %}
55
- const callLib = lib;
56
- {% endif %}
57
-
58
- {% if context.transform.args %}
59
- {% if context.lib.type==='subworkflow' %}
60
- const callArgs ={ params: {{ context.transform.args | safe }} };
61
- {% else %}
62
- const callArgs ={{ context.transform.args | safe }} ;
63
- {% endif %}
64
-
65
- const result = Array.isArray(callArgs)? await callLib.apply(_this,callArgs): await callLib.call(_this,callArgs);
66
-
67
- {% else %}
68
- const result = await callLib.call(_this);
69
- {% endif %}
70
-
71
- {% for assign in context.transform.result %}
72
- flow.set({{assign.key | safe}},{{assign.value | safe}});
73
- {% endfor%}
74
-
75
- {% if context.transform.return %}
76
- resolve({type:'return',value: {{context.transform.return | safe}}});
77
- {% elseif context.next and context.transform.operation!=='wait-for-next'%}
78
- {% include "src/default/macros/block-next.js.njk" %}
79
- {% elseif not context.next%}
80
- resolve();
81
- {% endif %}
82
- }
83
- catch(error){
84
- onError? onError(error) : reject(error);
85
- {# reject(error); #}
86
- }
87
- });
88
- }
89
-
90
- Object.freeze(this);
91
- }
92
-
93
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,81 +0,0 @@
1
-
2
- {% include "src/default/macros/block-header.js.njk" %}
3
-
4
- {% include "src/default/macros/block-next-header.js.njk" %}
5
-
6
- {% include "src/default/macros/block-modules-header.js.njk" %}
7
-
8
- {% if childs.length %}
9
- {% if not childs[0].definition.dynamic %}
10
- // FIRST CHILD: {{childs[0].indexKey}}
11
- import {{childs[0].codeKey}} from "./{{childs[0].codeKey}}";
12
- {% endif %}
13
- {% endif%}
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(async (resolve,reject)=>{
24
-
25
- {% include "src/default/macros/block-run-header.js.njk" %}
26
-
27
- {% include "src/default/macros/page.js.njk" %}
28
-
29
- {% include "src/default/macros/block-modules.js.njk" %}
30
-
31
- {% if childs.length %}
32
- {% if childs[0].definition.dynamic %}
33
- // FIRST CHILD: {{childs[0].indexKey}}
34
- const { default: {{childs[0].codeKey}} } = await import("./{{childs[0].codeKey}}");
35
- {% endif %}
36
- {% endif%}
37
-
38
- for await(const {{context.transform.for.value | safe}} of {{context.transform.for.in | safe}}){
39
- c.for={ {{context.transform.for.value | safe}} };
40
-
41
- {% if childs.length %}
42
- let current= new {{childs[0].codeKey}}({ parent:_this, engine, flow, caller:c });
43
- let currentArgs=args;
44
-
45
- do {
46
-
47
- {% if workflow.parent.context.atom.doc.features.print_runners %}
48
- console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
49
- {% endif %}
50
-
51
- const nextBlock= typeof currentArgs==='undefined'? await current.run()
52
- : Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
53
-
54
- if(nextBlock?.type==='return') return resolve(nextBlock);
55
- else if(nextBlock?.type!=='block') break;
56
-
57
- if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
58
- return resolve(nextBlock);
59
-
60
- current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, onError, error });
61
- currentArgs=nextBlock.input;
62
-
63
- } while(true);
64
-
65
- {% endif %}
66
- }
67
-
68
- {% if context.transform.return %}
69
- resolve({type:'return',value: {{context.transform.return | safe}}});
70
- {% elseif context.next %}
71
- {% include "src/default/macros/block-next.js.njk" %}
72
- {% else %}
73
- resolve();
74
- {% endif %}
75
- });
76
- }
77
-
78
- Object.freeze(this);
79
- }
80
-
81
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,65 +0,0 @@
1
- import React from "react";
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-library-header.js.njk" %}
8
-
9
- {% include "src/default/macros/block-modules-header.js.njk" %}
10
-
11
- export default function Block(context){
12
-
13
- {% include "src/default/macros/block-body-header.js.njk" %}
14
-
15
- this.run= function (){
16
-
17
- {% include "src/default/macros/block-entry-args.js.njk" %}
18
-
19
- return new Promise(async (resolve,reject)=>{
20
-
21
- try{
22
- {% include "src/default/macros/block-run-header.js.njk" %}
23
-
24
- {% include "src/default/macros/page.js.njk" %}
25
-
26
- {% include "src/default/macros/block-modules.js.njk" %}
27
-
28
- flow.waitForNext({
29
- key:'{{indexKey}}',
30
- next: async () => {
31
- {% if context.transform.return %}
32
- resolve({type:'return',value: {{context.transform.return | safe}}});
33
- {% elseif context.next %}
34
- {% include "src/default/macros/block-next.js.njk" %}
35
- {% else %}
36
- resolve();
37
- {% endif %}
38
- }
39
- });
40
-
41
- {% if context.lib.type==='atom'%}
42
- const formLib=LIBRARY;
43
- {% elseif context.lib.type==='subworkflow' %}
44
- const formLib={{context.lib.codeKey}};
45
- {% else %}
46
- const formLib=undefined;
47
- throw new Error('Couldnt find form.');
48
- {% endif %}
49
-
50
- {% include "src/default/macros/block-run-form.js.njk" %}
51
-
52
- {% if context.transform.operation==='continue-for-next' %}
53
- flow.continueForNext({key:'{{indexKey}}'});
54
- {% endif %}
55
- }
56
- catch(error){
57
- reject(error);
58
- }
59
- });
60
- }
61
-
62
- Object.freeze(this);
63
- }
64
-
65
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,50 +0,0 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- {% include "src/default/macros/block-next-header.js.njk" %}
4
-
5
- {% include "src/default/macros/block-modules-header.js.njk" %}
6
-
7
- export default function Block(context){
8
-
9
- {% include "src/default/macros/block-body-header.js.njk" %}
10
-
11
- this.run= function (){
12
-
13
- {% include "src/default/macros/block-entry-args.js.njk" %}
14
-
15
- return new Promise(async (resolve,reject)=>{
16
-
17
- try{
18
- {% include "src/default/macros/block-run-header.js.njk" %}
19
-
20
- {% include "src/default/macros/page.js.njk" %}
21
-
22
- {% if context.next and context.transform.operation==='wait-for-next' %}
23
- flow.waitForNext({
24
- key:'{{indexKey}}',
25
- next: new Promise((resolve,reject) => {
26
- {% include "src/default/macros/block-next.js.njk" %}
27
- })
28
- });
29
- {% endif %}
30
-
31
- {% include "src/default/macros/block-modules.js.njk" %}
32
-
33
- {% if context.transform.return %}
34
- resolve({type:'return',value: {{context.transform.return | safe}}});
35
- {% elseif context.next and context.transform.operation!=='wait-for-next'%}
36
- {% include "src/default/macros/block-next.js.njk" %}
37
- {% elseif not context.next%}
38
- resolve();
39
- {% endif %}
40
- }
41
- catch(error){
42
- reject(error);
43
- }
44
- });
45
- }
46
-
47
- Object.freeze(this);
48
- }
49
-
50
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,24 +0,0 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- export default function Block(context){
4
-
5
- {% include "src/default/macros/block-body-header.js.njk" %}
6
-
7
- this.run= function (){
8
-
9
- {% include "src/default/macros/block-entry-args.js.njk" %}
10
-
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.transform.operation==='continue-for-next' %}
17
- await flow.continueForNext({key:'{{indexKey}}'});
18
- resolve();
19
- {% endif %}
20
- });
21
- }
22
- }
23
-
24
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,25 +0,0 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- export default function Block(context){
4
-
5
- {% include "src/default/macros/block-body-header.js.njk" %}
6
-
7
- this.run= function (){
8
-
9
- {% include "src/default/macros/block-entry-args.js.njk" %}
10
-
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
- const raise = {{context.transform.raise | safe}};
17
-
18
- onError? onError(new Error(raise?.message||raise||"Unknown error")) : reject(new Error(raise?.message||raise||"Unknown error"));
19
- });
20
- }
21
-
22
- Object.freeze(this);
23
- }
24
-
25
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,27 +0,0 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- export default function Block(context){
4
-
5
- {% include "src/default/macros/block-body-header.js.njk" %}
6
-
7
- this.run= function (){
8
-
9
- {% include "src/default/macros/block-entry-args.js.njk" %}
10
-
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
- const value = {{context.transform.return | safe}};
17
-
18
- flow.result={value: value};
19
-
20
- resolve();
21
- });
22
- }
23
-
24
- Object.freeze(this);
25
- }
26
-
27
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,56 +0,0 @@
1
- {% include "src/default/macros/block-header.js.njk" %}
2
-
3
- {% include "src/default/macros/block-next-header.js.njk" %}
4
-
5
- export default function Block(context){
6
-
7
- {% include "src/default/macros/block-body-header.js.njk" %}
8
-
9
- this.run= function (){
10
-
11
- {% include "src/default/macros/block-entry-args.js.njk" %}
12
-
13
- return new Promise(async (resolve,reject)=>{
14
-
15
- {% include "src/default/macros/block-run-header.js.njk" %}
16
-
17
- {% if context.next %}
18
-
19
- // NEXT : {{context.next.indexKey}}
20
- {% if context.next.definition.dynamic %}
21
- const { default: {{context.next.codeKey}} } = await import("./{{context.next.codeKey}}");
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
- const nextBlock= typeof currentArgs==='undefined'? await current.run()
34
- : Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
35
-
36
- if(nextBlock?.type==='return') return resolve(nextBlock);
37
- else if(nextBlock?.type!=='block') break;
38
-
39
- if(nextBlock.toType.ParentTypeId!==_this.constructor.TypeId)
40
- return resolve(nextBlock);
41
-
42
- current=new nextBlock.toType({ parent:_this, engine, flow, caller:c, onError, error });
43
- currentArgs=nextBlock.input;
44
-
45
- } while(true);
46
-
47
- {% endif %}
48
-
49
- resolve();
50
- });
51
- }
52
-
53
- Object.freeze(this);
54
- }
55
-
56
- {% include "src/default/macros/block-footer.js.njk" %}