@fnet/cli 0.122.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 (49) hide show
  1. package/dist/fnet/index.js +1 -1
  2. package/package.json +1 -1
  3. package/template/fnet/node/src/default/blocks/assign.js.njk +18 -6
  4. package/template/fnet/node/src/default/blocks/call.js.njk +6 -8
  5. package/template/fnet/node/src/default/blocks/for.js.njk +4 -0
  6. package/template/fnet/node/src/default/blocks/form.js.njk +3 -8
  7. package/template/fnet/node/src/default/blocks/jump.js.njk +5 -1
  8. package/template/fnet/node/src/default/blocks/modules.js.njk +9 -4
  9. package/template/fnet/node/src/default/blocks/raise.js.njk +3 -3
  10. package/template/fnet/node/src/default/blocks/return.js.njk +5 -1
  11. package/template/fnet/{bun/src/default/blocks/jump.js.njk → node/src/default/blocks/signal.js.njk} +12 -8
  12. package/template/fnet/node/src/default/blocks/steps.js.njk +6 -0
  13. package/template/fnet/node/src/default/blocks/switch.js.njk +5 -0
  14. package/template/fnet/node/src/default/blocks/tryexcept.js.njk +5 -1
  15. package/template/fnet/{bun/src/default/blocks/operation.js.njk → node/src/default/blocks/wait.js.njk} +13 -4
  16. package/template/fnet/node/src/default/macros/block-assign.js.njk +3 -0
  17. package/template/fnet/node/src/default/macros/block-next.js.njk +1 -1
  18. package/template/fnet/node/src/default/macros/block-signal.js.njk +3 -0
  19. package/template/fnet/node/src/default/workflow.js.njk +4 -1
  20. package/template/fnet/bun/src/app/index.html.njk +0 -67
  21. package/template/fnet/bun/src/app/index.js.njk +0 -36
  22. package/template/fnet/bun/src/cli/index.js.njk +0 -45
  23. package/template/fnet/bun/src/default/blocks/assign.js.njk +0 -40
  24. package/template/fnet/bun/src/default/blocks/call.js.njk +0 -97
  25. package/template/fnet/bun/src/default/blocks/for.js.njk +0 -81
  26. package/template/fnet/bun/src/default/blocks/form.js.njk +0 -70
  27. package/template/fnet/bun/src/default/blocks/modules.js.njk +0 -50
  28. package/template/fnet/bun/src/default/blocks/raise.js.njk +0 -29
  29. package/template/fnet/bun/src/default/blocks/return.js.njk +0 -27
  30. package/template/fnet/bun/src/default/blocks/steps.js.njk +0 -56
  31. package/template/fnet/bun/src/default/blocks/switch.js.njk +0 -68
  32. package/template/fnet/bun/src/default/blocks/tryexcept.js.njk +0 -79
  33. package/template/fnet/bun/src/default/engine.js.njk +0 -79
  34. package/template/fnet/bun/src/default/input.args.js.njk +0 -122
  35. package/template/fnet/bun/src/default/macros/block-body-header.js.njk +0 -7
  36. package/template/fnet/bun/src/default/macros/block-entry-args.js.njk +0 -2
  37. package/template/fnet/bun/src/default/macros/block-footer.js.njk +0 -3
  38. package/template/fnet/bun/src/default/macros/block-header.js.njk +0 -14
  39. package/template/fnet/bun/src/default/macros/block-library-header.js.njk +0 -19
  40. package/template/fnet/bun/src/default/macros/block-modules-header.js.njk +0 -8
  41. package/template/fnet/bun/src/default/macros/block-modules.js.njk +0 -29
  42. package/template/fnet/bun/src/default/macros/block-next-header.js.njk +0 -6
  43. package/template/fnet/bun/src/default/macros/block-next.js.njk +0 -21
  44. package/template/fnet/bun/src/default/macros/block-run-form.js.njk +0 -32
  45. package/template/fnet/bun/src/default/macros/block-run-header.js.njk +0 -39
  46. package/template/fnet/bun/src/default/macros/page.js.njk +0 -8
  47. package/template/fnet/bun/src/default/macros/workflow-header.js.njk +0 -7
  48. package/template/fnet/bun/src/default/workflow.js.njk +0 -117
  49. package/template/fnet/node/src/default/blocks/operation.js.njk +0 -24
@@ -1,6 +0,0 @@
1
- {% if context.next %}
2
- {% if not context.next.definition.dynamic %}
3
- // NEXT : {{context.next.indexKey}}
4
- import { default as {{context.next.codeKey}} } from "./{{context.next.codeKey}}";
5
- {% endif %}
6
- {% endif %}
@@ -1,21 +0,0 @@
1
- {% if context.next %}
2
-
3
- // NEXT : {{context.next.indexKey}}
4
- {% if context.next.definition.dynamic %}
5
- const { default: {{context.next.codeKey}} } = await import("./{{context.next.codeKey}}");
6
- {% endif %}
7
-
8
-
9
- return resolve ({
10
- type: 'block',
11
- from: _this,
12
- fromType: _this.constructor,
13
- fromClosure: c,
14
- toType:{{context.next.codeKey}},
15
- onError,
16
- {% if context.transform.output %}
17
- input: {{context.transform.output | safe}},
18
- {% endif %}
19
- });
20
-
21
- {% endif %}
@@ -1,32 +0,0 @@
1
- {% if context.transform.props %}
2
- const formProps ={{context.transform.props | safe}} ;
3
- {% else %}
4
- const formProps={};
5
- {% endif %}
6
-
7
- function actionClick(){
8
- flow.continueForNext({key:'{{indexKey}}'});
9
- }
10
-
11
- formProps.form=form;
12
-
13
- formProps.actionClick=actionClick;
14
-
15
- function Form(){
16
- React.useEffect(()=>{
17
-
18
- {% if workflow.parent.context.atom.doc.features.print_form_mounts %}
19
- console.log('MOUNT:','{{indexKey}}');
20
- {% endif %}
21
-
22
- return ()=>{
23
- {% if workflow.parent.context.atom.doc.features.print_form_mounts %}
24
- console.log('UNMOUNT:','{{indexKey}}');
25
- {% endif %}
26
- }
27
- },[]);
28
-
29
- return React.createElement(formLib,formProps);
30
- }
31
-
32
- engine.setActiveForm({ form: Form, props:formProps });
@@ -1,39 +0,0 @@
1
- {# variables #}
2
- const v=flow.get();
3
-
4
- {# module #}
5
- {% if hasModules %}
6
- const m={};
7
- {% else %}
8
- const m = null;
9
- {% endif %}
10
-
11
- {# form #}
12
- {% if type === 'form' %}
13
- const form={};
14
- {% else %}
15
- const form=null;
16
- {% endif %}
17
-
18
- {# closure #}
19
- const c={ caller, resolve, reject, args, get form(){return form||caller?.form}, get module(){return m||caller?.module} };
20
-
21
- {% if workflow.parent.context.atom.doc.features.print_steps %}
22
- console.log(new Date().toLocaleString(),'{{indexKey}}');
23
- {% endif %}
24
-
25
- {% if definition.debugger %}
26
- debugger;
27
- {% endif %}
28
-
29
- {% if context.transform.print %}
30
- print({{context.transform.print | safe}});
31
- {% endif%}
32
-
33
- {% if context.transform.assert %}
34
- assert({{context.transform.assert | safe}});
35
- {% endif%}
36
-
37
- {% if context.transform.sleep %}
38
- await sleep({{context.transform.sleep}});
39
- {% endif %}
@@ -1,8 +0,0 @@
1
- {% if context.transform.page %}
2
- const page= {{context.transform.page | safe}};
3
-
4
- {% if definition.page.title %}
5
- document? document.title=page.title:undefined;
6
- {% endif %}
7
-
8
- {% endif %}
@@ -1,7 +0,0 @@
1
- // WORKFLOW: {{ indexKey }}
2
-
3
- import Object from "../core/object";
4
-
5
- {% if context.transform.print %}
6
- import print from "../core/print";
7
- {% endif %}
@@ -1,117 +0,0 @@
1
- {% include "src/default/macros/workflow-header.js.njk" %}
2
-
3
- {% if context.next %}
4
- {% if not context.next.definition.dynamic %}
5
- // NEXT: {{context.next.indexKey}}
6
- import {{context.next.codeKey}} from "./blocks/{{context.next.codeKey}}";
7
- {% endif %}
8
- {% endif %}
9
-
10
- export default class Workflow extends Object {
11
-
12
- #waitContext;
13
-
14
- constructor(context) {
15
- super(context);
16
-
17
- this.engine=context.engine;
18
- }
19
-
20
- async init(context) {
21
-
22
- {% if context.transform.params %}
23
- const params = context?.params;
24
-
25
- {% for param in context.transform.params %}
26
- {% if param.hasDefault%}
27
- {% if param.type ==='string'%}
28
- this.set('{{param.key}}', params?.hasOwnProperty('{{param.key}}')? params['{{param.key}}']:'{{param.default}}');
29
- {% else %}
30
- this.set('{{param.key}}', params?.hasOwnProperty('{{param.key}}')? params['{{param.key}}']:{{param.default | dump}});
31
- {% endif %}
32
- {% else %}
33
- this.set('{{param.key}}',this.getValue(params,'{{param.key}}'));
34
- {% endif %}
35
- {% endfor%}
36
-
37
- this.set('$params',params);
38
-
39
- {% endif %}
40
- }
41
-
42
- waitForNext(context){
43
- this.#waitContext=context;
44
- }
45
-
46
- async continueForNext(context){
47
- const next=this.#waitContext?.next;
48
- this.#waitContext=undefined;
49
- next && await next();
50
- }
51
-
52
- async run(context) {
53
-
54
- {% if workflow.parent.context.atom.doc.features.print_steps %}
55
- console.log(new Date().toLocaleString(),'{{indexKey}}');
56
- {% endif %}
57
-
58
- {% if definition.debugger %}
59
- debugger;
60
- {% endif %}
61
-
62
- {% if context.transform.print %}
63
- print({{context.transform.print | safe}});
64
- {% endif%}
65
-
66
- {% if context.transform.assert %}
67
- assert({{context.transform.assert | safe}});
68
- {% endif%}
69
-
70
- {% if context.transform.sleep %}
71
- await sleep({{context.transform.sleep}});
72
- {% endif %}
73
-
74
- await this.init(context);
75
-
76
- {% if context.next %}
77
-
78
- {% if context.next.definition.dynamic %}
79
- // NEXT : {{context.next.indexKey}}
80
- const { default: {{context.next.codeKey}} } = await import("./blocks/{{context.next.codeKey}}");
81
- {% endif %}
82
-
83
- {# closure #}
84
- const c={};
85
-
86
- let current=new {{context.next.codeKey}}({ parent:this, engine:this.engine, flow:this, caller:c });
87
- let currentArgs;
88
-
89
- do {
90
-
91
- {% if workflow.parent.context.atom.doc.features.print_runners %}
92
- console.log(new Date().toLocaleString(),' * ', this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
93
- {% endif %}
94
-
95
- const nextBlock= typeof currentArgs==='undefined'? await current.run()
96
- : Array.isArray(currentArgs)? await current.run.apply(current,currentArgs) : await current.run.call(current, currentArgs) ;
97
-
98
-
99
- if(nextBlock?.type==='return') return nextBlock;
100
- else if(nextBlock?.type!=='block') break;
101
-
102
- if(nextBlock.toType.ParentTypeId!==this.constructor.TypeId)
103
- throw new Error('Unknown situation');
104
-
105
- current=new nextBlock.toType({ parent:this, engine:this.engine, flow:this, caller:c });
106
- currentArgs=nextBlock.input;
107
-
108
- } while(true);
109
-
110
- {% endif %}
111
-
112
- return this.result;
113
- }
114
- }
115
-
116
- Workflow.TypeId="{{typeId}}";
117
- Workflow.IndexKey="{{indexKey}}";
@@ -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" %}