@fnet/cli 0.111.0 → 0.111.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.
Files changed (155) hide show
  1. package/README.md +145 -0
  2. package/dist/fnet/index.DBSKvJyG.js +1 -0
  3. package/dist/fnet/index.DrwlOzAe.js +1 -0
  4. package/dist/fnet/index.js +1 -1
  5. package/dist/fnode/index.53yND1Av.js +1 -0
  6. package/dist/fnode/index.B1zLg4Y2.js +1 -0
  7. package/dist/fnode/index.B2LXSSn7.js +1 -0
  8. package/dist/fnode/index.BBrItYB9.js +1 -0
  9. package/dist/fnode/index.BSQp_bJN.js +1 -0
  10. package/dist/fnode/index.Bqzc7Bx8.js +1 -0
  11. package/dist/fnode/index.BwhWziH6.js +1 -0
  12. package/dist/fnode/index.CLlKzCGk.js +1 -0
  13. package/dist/fnode/index.Chvv_TJm.js +1 -0
  14. package/dist/fnode/index.D4KQB1ot.js +1 -0
  15. package/dist/fnode/index.DItyYiZ_.js +1 -0
  16. package/dist/fnode/index.DrwlOzAe.js +1 -0
  17. package/dist/fnode/index.js +1 -1
  18. package/dist/frun/index.js +126 -0
  19. package/package.json +8 -9
  20. package/template/fnet/bun/fnet/flows.yaml.njk +1 -0
  21. package/template/fnet/bun/fnet.yaml.njk +1 -0
  22. package/template/fnet/bun/src/app/index.html.njk +67 -0
  23. package/template/fnet/bun/src/app/index.js.njk +36 -0
  24. package/template/fnet/bun/src/cli/index.js.njk +44 -0
  25. package/template/fnet/bun/src/default/blocks/assign.js.njk +40 -0
  26. package/template/fnet/bun/src/default/blocks/call.js.njk +92 -0
  27. package/template/fnet/bun/src/default/blocks/for.js.njk +81 -0
  28. package/template/fnet/bun/src/default/blocks/form.js.njk +65 -0
  29. package/template/fnet/bun/src/default/blocks/jump.js.njk +31 -0
  30. package/template/fnet/bun/src/default/blocks/modules.js.njk +50 -0
  31. package/template/fnet/bun/src/default/blocks/operation.js.njk +24 -0
  32. package/template/fnet/bun/src/default/blocks/raise.js.njk +25 -0
  33. package/template/fnet/bun/src/default/blocks/return.js.njk +27 -0
  34. package/template/fnet/bun/src/default/blocks/steps.js.njk +56 -0
  35. package/template/fnet/bun/src/default/blocks/switch.js.njk +73 -0
  36. package/template/fnet/bun/src/default/blocks/tryexcept.js.njk +65 -0
  37. package/template/fnet/bun/src/default/engine.js.njk +79 -0
  38. package/template/fnet/bun/src/default/macros/block-body-header.js.njk +7 -0
  39. package/template/fnet/bun/src/default/macros/block-footer.js.njk +3 -0
  40. package/template/fnet/bun/src/default/macros/block-header.js.njk +14 -0
  41. package/template/fnet/bun/src/default/macros/block-library-header.js.njk +19 -0
  42. package/template/fnet/bun/src/default/macros/block-modules-header.js.njk +8 -0
  43. package/template/fnet/bun/src/default/macros/block-modules.js.njk +29 -0
  44. package/template/fnet/bun/src/default/macros/block-next-header.js.njk +6 -0
  45. package/template/fnet/bun/src/default/macros/block-next.js.njk +20 -0
  46. package/template/fnet/bun/src/default/macros/block-run-form.js.njk +32 -0
  47. package/template/fnet/bun/src/default/macros/block-run-header.js.njk +39 -0
  48. package/template/fnet/bun/src/default/macros/page.js.njk +8 -0
  49. package/template/fnet/bun/src/default/macros/workflow-header.js.njk +7 -0
  50. package/template/fnet/bun/src/default/to.args.js.njk +120 -0
  51. package/template/fnet/bun/src/default/workflow.js.njk +117 -0
  52. package/template/fnet/core/assert.js +6 -0
  53. package/template/fnet/core/message.js +3 -0
  54. package/template/fnet/core/object.js +43 -0
  55. package/template/fnet/core/print.js +1 -0
  56. package/template/fnet/core/sleep.js +5 -0
  57. package/template/fnet/node/.gitignore.njk +8 -0
  58. package/template/fnet/node/fnet/flows.yaml.njk +1 -0
  59. package/template/fnet/node/fnet.yaml.njk +1 -0
  60. package/template/fnet/node/package.json.njk +90 -0
  61. package/template/fnet/node/readme.md.njk +21 -0
  62. package/template/fnet/node/rollup.config.mjs.njk +363 -0
  63. package/template/fnet/node/rollup_config_external.njk +8 -0
  64. package/template/fnet/node/rollup_config_onwarn.njk +9 -0
  65. package/template/fnet/node/rollup_config_output_banner.njk +3 -0
  66. package/template/fnet/node/rollup_config_output_footer.njk +5 -0
  67. package/template/fnet/node/rollup_config_output_globals.njk +9 -0
  68. package/template/fnet/node/rollup_config_output_name.njk +3 -0
  69. package/template/fnet/node/rollup_config_plugins.njk +90 -0
  70. package/template/fnet/node/src/app/index.html.njk +67 -0
  71. package/template/fnet/node/src/app/index.js.njk +36 -0
  72. package/template/fnet/node/src/cli/index.js.njk +44 -0
  73. package/template/fnet/node/src/default/blocks/assign.js.njk +40 -0
  74. package/template/fnet/node/src/default/blocks/call.js.njk +92 -0
  75. package/template/fnet/node/src/default/blocks/for.js.njk +81 -0
  76. package/template/fnet/node/src/default/blocks/form.js.njk +65 -0
  77. package/template/fnet/node/src/default/blocks/jump.js.njk +31 -0
  78. package/template/fnet/node/src/default/blocks/modules.js.njk +50 -0
  79. package/template/fnet/node/src/default/blocks/operation.js.njk +24 -0
  80. package/template/fnet/node/src/default/blocks/raise.js.njk +25 -0
  81. package/template/fnet/node/src/default/blocks/return.js.njk +27 -0
  82. package/template/fnet/node/src/default/blocks/steps.js.njk +56 -0
  83. package/template/fnet/node/src/default/blocks/switch.js.njk +73 -0
  84. package/template/fnet/node/src/default/blocks/tryexcept.js.njk +65 -0
  85. package/template/fnet/node/src/default/engine.js.njk +79 -0
  86. package/template/fnet/node/src/default/macros/block-body-header.js.njk +7 -0
  87. package/template/fnet/node/src/default/macros/block-footer.js.njk +3 -0
  88. package/template/fnet/node/src/default/macros/block-header.js.njk +14 -0
  89. package/template/fnet/node/src/default/macros/block-library-header.js.njk +19 -0
  90. package/template/fnet/node/src/default/macros/block-modules-header.js.njk +8 -0
  91. package/template/fnet/node/src/default/macros/block-modules.js.njk +29 -0
  92. package/template/fnet/node/src/default/macros/block-next-header.js.njk +6 -0
  93. package/template/fnet/node/src/default/macros/block-next.js.njk +20 -0
  94. package/template/fnet/node/src/default/macros/block-run-form.js.njk +32 -0
  95. package/template/fnet/node/src/default/macros/block-run-header.js.njk +39 -0
  96. package/template/fnet/node/src/default/macros/page.js.njk +8 -0
  97. package/template/fnet/node/src/default/macros/workflow-header.js.njk +7 -0
  98. package/template/fnet/node/src/default/to.args.js.njk +120 -0
  99. package/template/fnet/node/src/default/workflow.js.njk +117 -0
  100. package/template/fnet/node/tsconfig.json.njk +16 -0
  101. package/template/fnet/project/.gitignore.njk +7 -0
  102. package/template/fnet/project/.vscode/launch.json +41 -0
  103. package/template/fnet/project/.vscode/tasks.json +46 -0
  104. package/template/fnet/project/fnet/flows.yaml.njk +4 -0
  105. package/template/fnet/project/fnet/targets.yaml.njk +7 -0
  106. package/template/fnet/project/fnet.yaml.njk +3 -0
  107. package/template/fnode/bun/.gitignore.njk +8 -0
  108. package/template/fnode/bun/build.js.njk +156 -0
  109. package/template/fnode/bun/fnode.yaml.njk +1 -0
  110. package/template/fnode/bun/package.json.njk +89 -0
  111. package/template/fnode/bun/readme.md.njk +21 -0
  112. package/template/fnode/bun/src/app/index-js-with-react-host.njk +50 -0
  113. package/template/fnode/bun/src/app/index-js-without-react-host.njk +23 -0
  114. package/template/fnode/bun/src/app/index.html.njk +67 -0
  115. package/template/fnode/bun/src/app/index.js.njk +9 -0
  116. package/template/fnode/bun/src/cli/index.js.njk +81 -0
  117. package/template/fnode/bun/src/default/engine.js.njk +17 -0
  118. package/template/fnode/bun/src/default/to.args.js.njk +120 -0
  119. package/template/fnode/bun/tsconfig.json.njk +16 -0
  120. package/template/fnode/node/.gitignore.njk +8 -0
  121. package/template/fnode/node/fnode.yaml.njk +1 -0
  122. package/template/fnode/node/package.json.njk +90 -0
  123. package/template/fnode/node/readme.md.njk +21 -0
  124. package/template/fnode/node/rollup.config.mjs.njk +363 -0
  125. package/template/fnode/node/rollup_config_external.njk +8 -0
  126. package/template/fnode/node/rollup_config_onwarn.njk +9 -0
  127. package/template/fnode/node/rollup_config_output_banner.njk +3 -0
  128. package/template/fnode/node/rollup_config_output_footer.njk +5 -0
  129. package/template/fnode/node/rollup_config_output_globals.njk +9 -0
  130. package/template/fnode/node/rollup_config_output_name.njk +3 -0
  131. package/template/fnode/node/rollup_config_plugins.njk +90 -0
  132. package/template/fnode/node/src/app/index-js-with-react-host.njk +50 -0
  133. package/template/fnode/node/src/app/index-js-without-react-host.njk +23 -0
  134. package/template/fnode/node/src/app/index.html.njk +67 -0
  135. package/template/fnode/node/src/app/index.js.njk +9 -0
  136. package/template/fnode/node/src/cli/index.js.njk +81 -0
  137. package/template/fnode/node/src/default/engine.js.njk +17 -0
  138. package/template/fnode/node/src/default/to.args.js.njk +120 -0
  139. package/template/fnode/node/tsconfig.json.njk +16 -0
  140. package/template/fnode/project/.gitignore.njk +11 -0
  141. package/template/fnode/project/.vscode/launch.json.njk +78 -0
  142. package/template/fnode/project/.vscode/tasks.json.njk +46 -0
  143. package/template/fnode/project/fnet/targets.yaml.njk +25 -0
  144. package/template/fnode/project/fnode.yaml.njk +12 -0
  145. package/template/fnode/python/.gitignore.njk +7 -0
  146. package/template/fnode/python/fnode.yaml.njk +1 -0
  147. package/template/fnode/python/package.json.njk +4 -0
  148. package/template/fnode/python/pyproject.toml.njk +3 -0
  149. package/template/fnode/python/readme.md.njk +12 -0
  150. package/template/fnode/python/setup.py.njk +19 -0
  151. package/template/fnode/python/src/cli/index.py.njk +25 -0
  152. package/template/schemas/to-npm.yaml +14 -0
  153. package/dist/fnet/index.DZbefC4O.js +0 -1
  154. package/dist/fnode/index.DrdnDArw.js +0 -1
  155. package/readme.md +0 -50
@@ -0,0 +1,44 @@
1
+ {% if atom.doc.features.cli.enabled===true %}
2
+ import argv from '../default/to.args.js';
3
+ import { default as Engine } from '../default/{{atom.doc.features.cli_default_entry_file or atom.doc.features.main_default_entry_file}}';
4
+
5
+ {% if atom.doc.features.cli.extend===true %}
6
+ {# TYPE 1 #}
7
+ import { default as runExtended } from '../../../cli';
8
+
9
+ const run = async () => {
10
+ return await runExtended(await argv(),{ Engine });
11
+ };
12
+
13
+ run()
14
+ .then(() => {
15
+ {# process.exit(0); #}
16
+ })
17
+ .catch((error) => {
18
+ console.error(error.message);
19
+ process.exit(1);
20
+ });
21
+ {% else %}
22
+ {# TYPE 2 #}
23
+ const run = async () => {
24
+ const engine = new Engine();
25
+ return await engine.run(await argv());
26
+ };
27
+
28
+ run()
29
+ .then((result) => {
30
+ if (typeof result !== 'undefined')
31
+ {
32
+ // TODO: REMOVE THIS LINE
33
+ const stdout_format=process.argv.slice(2).indexOf()!==-1? process.argv.slice(2)[process.argv.slice(2).indexOf('--stdout_format')+1]:null;
34
+ if(stdout_format==='json') console.log(JSON.stringify(result,null,2));
35
+ else console.log(result);
36
+ }
37
+ {# process.exit(0); #}
38
+ })
39
+ .catch((error) => {
40
+ console.error(error.message);
41
+ process.exit(1);
42
+ });
43
+ {% endif %}
44
+ {% endif %}
@@ -0,0 +1,40 @@
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
+ const args=Array.from(arguments);
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" %}
@@ -0,0 +1,92 @@
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
+ const args=Array.from(arguments);
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
+ reject(error);
85
+ }
86
+ });
87
+ }
88
+
89
+ Object.freeze(this);
90
+ }
91
+
92
+ {% include "src/default/macros/block-footer.js.njk" %}
@@ -0,0 +1,81 @@
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
+ const args=Array.from(arguments);
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});
61
+ currentArgs=nextBlock.withArgs;
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" %}
@@ -0,0 +1,65 @@
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
+ const args=Array.from(arguments);
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" %}
@@ -0,0 +1,31 @@
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
+ const args=Array.from(arguments);
12
+
13
+ return new Promise(async (resolve,reject)=>{
14
+ {% include "src/default/macros/block-run-header.js.njk" %}
15
+
16
+ {% include "src/default/macros/page.js.njk" %}
17
+
18
+ {% if context.transform.return %}
19
+ resolve({type:'return',value: {{context.transform.return | safe}}});
20
+ {% elseif context.next %}
21
+ {% include "src/default/macros/block-next.js.njk" %}
22
+ {% else %}
23
+ resolve();
24
+ {% endif %}
25
+ });
26
+ }
27
+
28
+ Object.freeze(this);
29
+ }
30
+
31
+ {% include "src/default/macros/block-footer.js.njk" %}
@@ -0,0 +1,50 @@
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
+ const args=Array.from(arguments);
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" %}
@@ -0,0 +1,24 @@
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
+ const args=Array.from(arguments);
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" %}
@@ -0,0 +1,25 @@
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
+ const args=Array.from(arguments);
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
+ 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" %}
@@ -0,0 +1,27 @@
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
+ const args=Array.from(arguments);
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" %}
@@ -0,0 +1,56 @@
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
+ const args=Array.from(arguments);
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 });
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});
43
+ currentArgs=nextBlock.withArgs;
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" %}
@@ -0,0 +1,73 @@
1
+ {% include "src/default/macros/block-header.js.njk" %}
2
+
3
+ {% if not hasDefaultCondition %}
4
+ {% include "src/default/macros/block-next-header.js.njk" %}
5
+ {% endif %}
6
+
7
+ {% include "src/default/macros/block-modules-header.js.njk" %}
8
+
9
+ {% for child in childs %}
10
+ {% if not child.definition.dynamic %}
11
+ // CHILD: {{child.indexKey}}
12
+ import {{child.codeKey}} from "./{{child.codeKey}}";
13
+ {% endif %}
14
+ {% endfor%}
15
+
16
+ export default function Block(context) {
17
+
18
+ {% include "src/default/macros/block-body-header.js.njk" %}
19
+
20
+ this.run= function (){
21
+
22
+ const args=Array.from(arguments);
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}}");
46
+ {% endif %}
47
+
48
+ const current=new {{child.codeKey}}({ parent:_this, engine, flow, caller:c });
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
+ return resolve(await current.run.apply(current,args));
55
+ }
56
+ {% endfor%}
57
+
58
+ {% if not hasDefaultCondition %}
59
+ {% if context.transform.return %}
60
+ resolve({type:'return',value: {{context.transform.return | safe}}});
61
+ {% elseif context.next %}
62
+ {% include "src/default/macros/block-next.js.njk" %}
63
+ {% else %}
64
+ resolve();
65
+ {% endif %}
66
+ {% endif %}
67
+ });
68
+ }
69
+
70
+ Object.freeze(this);
71
+ }
72
+
73
+ {% include "src/default/macros/block-footer.js.njk" %}
@@ -0,0 +1,65 @@
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
+ {% for child in childs %}
9
+ {% if not child.definition.dynamic %}
10
+ // CHILD: {{child.indexKey}}
11
+ import {{child.codeKey}} from "./{{child.codeKey}}";
12
+ {% endif %}
13
+ {% endfor%}
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
+ const args=Array.from(arguments);
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
+ try{
32
+
33
+ {% if context.try.definition.dynamic %}
34
+ const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}");
35
+ {% endif %}
36
+
37
+ const current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c });
38
+
39
+ {% if workflow.parent.context.atom.doc.features.print_runners %}
40
+ console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
41
+ {% endif %}
42
+
43
+ return resolve(await current.run.apply(current,args));
44
+ }
45
+ 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));
58
+ }
59
+ });
60
+ }
61
+
62
+ Object.freeze(this);
63
+ }
64
+
65
+ {% include "src/default/macros/block-footer.js.njk" %}