@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,70 +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
-
32
- {% for assign in context.transform.assign %}
33
- flow.set({{assign.key | safe}},{{assign.value | safe}});
34
- {% endfor%}
35
-
36
- {% if context.transform.return %}
37
- resolve({type:'return',value: {{context.transform.return | safe}}});
38
- {% elseif context.next %}
39
- {% include "src/default/macros/block-next.js.njk" %}
40
- {% else %}
41
- resolve();
42
- {% endif %}
43
- }
44
- });
45
-
46
- {% if context.lib.type==='atom'%}
47
- const formLib=LIBRARY;
48
- {% elseif context.lib.type==='subworkflow' %}
49
- const formLib={{context.lib.codeKey}};
50
- {% else %}
51
- const formLib=undefined;
52
- throw new Error('Couldnt find form.');
53
- {% endif %}
54
-
55
- {% include "src/default/macros/block-run-form.js.njk" %}
56
-
57
- {% if context.transform.operation==='continue-for-next' %}
58
- flow.continueForNext({key:'{{indexKey}}'});
59
- {% endif %}
60
- }
61
- catch(error){
62
- reject(error);
63
- }
64
- });
65
- }
66
-
67
- Object.freeze(this);
68
- }
69
-
70
- {% 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,29 +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
- {% for assign in context.transform.assign %}
19
- flow.set({{assign.key | safe}},{{assign.value | safe}});
20
- {% endfor%}
21
-
22
- onError? onError(new Error(raise?.message||raise||"Unknown error")) : reject(new Error(raise?.message||raise||"Unknown error"));
23
- });
24
- }
25
-
26
- Object.freeze(this);
27
- }
28
-
29
- {% 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" %}
@@ -1,68 +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
- {% 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
- {% 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
- try{
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
- Array.isArray(args)? current.run.apply(current,args).then(resolve):current.run.call(current,args).then(resolve);
45
- };
46
-
47
- {% if context.try.definition.dynamic %}
48
- const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}");
49
- {% endif %}
50
-
51
- const current=new {{context.try.codeKey}}({ parent:_this, engine, flow, caller:c ,onError, error });
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(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
- }
62
- });
63
- }
64
-
65
- Object.freeze(this);
66
- }
67
-
68
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,79 +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
- {% 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
- {% 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
- try{
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
- Array.isArray(args)? current.run.apply(current,args).then(resolve):current.run.call(current,args).then(resolve);
45
- };
46
-
47
- {% if context.try.definition.dynamic %}
48
- const { default: {{context.try.codeKey}} } = await import("./{{context.try.codeKey}}");
49
- {% endif %}
50
-
51
- const current=new {{context.try.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(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
-
61
- {% if context.except.definition.dynamic %}
62
- const { default: {{context.except.codeKey}} } = await import("./{{context.except.codeKey}}");
63
- {% endif %}
64
-
65
- const current=new {{context.except.codeKey}}({ parent:_this, engine, flow, caller:c });
66
-
67
- {% if workflow.parent.context.atom.doc.features.print_runners %}
68
- console.log(new Date().toLocaleString(),' * ',_this.constructor.IndexKey,' -> ',current.constructor.IndexKey);
69
- {% endif %}
70
-
71
- return resolve(Array.isArray(args)? await current.run.apply(current,args) : await current.run.call(current,args));
72
- }
73
- });
74
- }
75
-
76
- Object.freeze(this);
77
- }
78
-
79
- {% include "src/default/macros/block-footer.js.njk" %}
@@ -1,79 +0,0 @@
1
- import Object from "../core/object";
2
-
3
- import { default as Workflow } from "./{{flow.codeKey}}";
4
-
5
- {% set form_enabled = false if flow.name === 'cli' else flow.parent.context.atom.doc.features.form_enabled %}
6
-
7
- {% set form_enabled = false if flow.definition.features.server === true else form_enabled %}
8
-
9
- {% if form_enabled %}
10
- import { App } from "{{ui.package}}";
11
- {% endif %}
12
-
13
- export default class Engine extends Object {
14
-
15
- #main;
16
- {% if form_enabled %}
17
- #app;
18
- #appOwner;
19
- {% endif %}
20
-
21
- constructor(context) {
22
- super(context);
23
-
24
- this.#main = new Workflow({ engine: this });
25
-
26
- {% if form_enabled %}
27
- this.#app =context?.app || new App();
28
- this.#appOwner = !!context?.app;
29
- {% endif %}
30
- }
31
-
32
- async #init(context) {
33
- {% if form_enabled %}
34
- await this.#initApp(context);
35
- {% endif %}
36
- }
37
-
38
- {% if form_enabled %}
39
-
40
- async #initApp(context) {
41
- const container = context.params?.container;
42
- await this.#app.init({ container });
43
- }
44
-
45
- async setActiveForm(context) {
46
- const form = context.form;
47
- const props = context.props;
48
-
49
- await this.#app.setActiveForm({form,props});
50
- }
51
-
52
- get app(){
53
- return this.#app;
54
- }
55
-
56
- {% endif %}
57
-
58
- // Main entry function to run workflow
59
- async run(params) {
60
-
61
- {% if flow.parent.context.atom.doc.features.print_steps %}
62
- console.log(new Date().toLocaleString(),'{{ flow.parent.context.atom.doc.title or flow.parent.context.atom.doc.name }}');
63
- {% endif %}
64
-
65
- await this.#init({ params });
66
-
67
- const response = await this.#main.run({ params });
68
-
69
- return response?.value;
70
- }
71
-
72
- async destroy() {
73
- {% if form_enabled %}
74
- if (this.#appOwner) {
75
- await this.#app.destroy();
76
- }
77
- {% endif %}
78
- }
79
- }
@@ -1,122 +0,0 @@
1
- {% if atom.doc.features.project.format === 'esm' %}
2
- import fnetArgs from '@fnet/args';
3
- import validate,{schema as inputSchema} from "./validate_input";
4
-
5
- {% elif atom.doc.features.project.format === 'cjs' %}
6
- const fnetArgs = require('@fnet/args');
7
- const validate,{schema as inputSchema} = require("./validate_input");
8
- {% endif %}
9
-
10
- {% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
11
-
12
- const get_fargs = (argv) => {
13
- const fargsIndex = argv.indexOf('--fargs');
14
- if (fargsIndex !== -1 && argv[fargsIndex + 1]) return argv[fargsIndex + 1];
15
- {% if atom.doc.features.cli.fargs.default %}
16
- else return "{{atom.doc.features.cli.fargs.default}}";
17
- {% endif %}
18
- };
19
-
20
- const get_ftags = (argv) => {
21
- const ftags = [];
22
- for (let i = 0; i < argv.length; i++) {
23
- if (argv[i] === '--ftag' && argv[i + 1]) {
24
- ftags.push(argv[i + 1]);
25
- i++;
26
- }
27
- }
28
-
29
- {% if atom.doc.features.cli.fargs.tags %}
30
- return ftags.length > 0 ? ftags : {{atom.doc.features.cli.fargs.tags | dump | safe}};
31
- {% else %}
32
- return ftags.length > 0 ? ftags : undefined;
33
- {% endif %}
34
- };
35
-
36
- {% endif %}
37
-
38
- {% if atom.doc.features.project.format === 'esm' %}
39
-
40
- export default async () => {
41
-
42
- let schema = inputSchema;
43
- let initial;
44
-
45
- {% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
46
- const fargs = get_fargs(process.argv.slice(2));
47
- const ftags = get_ftags(process.argv.slice(2));
48
-
49
- if (fargs) {
50
- const { default: fnetConfig } = await import("@fnet/config");
51
- const config = await fnetConfig({ name: fargs, tags: ftags });
52
- if (config?.data) {
53
- initial=config.data;
54
- }
55
- }
56
- {% endif %}
57
-
58
- const packageCallback = async () => {
59
- const { default: url } = await import("node:url");
60
- const { default: path } = await import("node:path");
61
- const { default: fs } = await import("node:fs");
62
- let currentDir = path.dirname(url.fileURLToPath(import.meta.url));
63
- let firstPackageJson = path.join(currentDir, "package.json");
64
- while (currentDir !== path.parse(currentDir).root && !fs.existsSync(firstPackageJson)) {
65
- currentDir = path.dirname(currentDir);
66
- firstPackageJson = path.join(currentDir, "package.json");
67
- }
68
- if (!fs.existsSync(firstPackageJson)) return {
69
- name: "Unknown",
70
- version: "Unknown"
71
- }
72
- else return await JSON.parse(fs.readFileSync(firstPackageJson, "utf8"));
73
- };
74
-
75
- return await fnetArgs({schema,initial,validate,packageCallback});
76
- };
77
-
78
- {% elif atom.doc.features.project.format === 'cjs' %}
79
-
80
- module.exports = async () => {
81
-
82
- let schema = inputSchema;
83
- let initial;
84
-
85
- {% if atom.doc.features.cli.fargs and atom.doc.features.cli.fargs?.enabled !== false %}
86
- const fargs = get_fargs(process.argv.slice(2));
87
- const ftags = get_ftags(process.argv.slice(2));
88
-
89
- if (fargs) {
90
- const { default: fnetConfig } = await import("@fnet/config");
91
- const config = await fnetConfig({ name: fargs, tags: ftags });
92
- if (config?.data) {
93
- initial=config.data;
94
- }
95
- }
96
- {% endif %}
97
-
98
- const packageCallback = async () => {
99
- const path = require("node:path");
100
- const fs = require("node:fs");
101
-
102
- let currentDir = __dirname;
103
- let firstPackageJson = path.join(currentDir, "package.json");
104
-
105
- while (currentDir !== path.parse(currentDir).root && !fs.existsSync(firstPackageJson)) {
106
- currentDir = path.dirname(currentDir);
107
- firstPackageJson = path.join(currentDir, "package.json");
108
- }
109
-
110
- if (!fs.existsSync(firstPackageJson)) {
111
- return {
112
- name: "Unknown",
113
- version: "Unknown"
114
- };
115
- } else {
116
- return JSON.parse(fs.readFileSync(firstPackageJson, "utf8"));
117
- }
118
- };
119
-
120
- return await fnetArgs({schema,initial,validate,packageCallback});
121
- };
122
- {% endif %}
@@ -1,7 +0,0 @@
1
- if (this.constructor !== Block) throw Error(Message.USE_CONSTRUCTOR);
2
-
3
- this.context=context;
4
-
5
- const { engine, flow, caller, onError, error }=context || {};
6
-
7
- const _this=this;
@@ -1,2 +0,0 @@
1
- const args=Array.from(arguments);
2
- const input=arguments[0];
@@ -1,3 +0,0 @@
1
- Block.TypeId="{{ typeId }}";
2
- Block.ParentTypeId="{{ parent.typeId }}";
3
- Block.IndexKey="{{ indexKey }}";
@@ -1,14 +0,0 @@
1
- // BLOCK: {{indexKey}}
2
-
3
- import Message from "../../core/message";
4
- {% if context.transform.print %}
5
- import print from "../../core/print";
6
- {% endif %}
7
-
8
- {% if context.transform.sleep %}
9
- import sleep from "../../core/sleep";
10
- {% endif %}
11
-
12
- {% if context.transform.assert %}
13
- import assert from "../../core/assert";
14
- {% endif %}
@@ -1,19 +0,0 @@
1
- {% if context.lib.type==='atom'%}
2
- // LIBRARY: {{context.lib.atom.name}}
3
- {% if context.lib.atom.relativePath %}
4
- {% if context.transform.import %}
5
- import { {{ context.transform.call | safe }} as LIBRARY } from "{{context.lib.atom.relativePath}}";
6
- {% else %}
7
- import { default as LIBRARY } from "{{context.lib.atom.relativePath}}";
8
- {% endif %}
9
- {% else %}
10
- {% if context.transform.import %}
11
- import { {{ context.transform.call | safe }} as LIBRARY } from "../../libs/{{context.lib.atom.id or context.lib.atom.name}}";
12
- {% else %}
13
- import { default as LIBRARY } from "../../libs/{{context.lib.atom.id or context.lib.atom.name}}";
14
- {% endif %}
15
- {% endif %}
16
- {% elseif context.lib.type==='subworkflow' %}
17
- // LIBRARY: {{context.lib.indexKey}}
18
- import { default as {{context.lib.codeKey}} } from "../{{context.lib.codeKey}}";
19
- {% endif %}
@@ -1,8 +0,0 @@
1
- {% for child in childs %}
2
- {% if child.module===true%}
3
- {% if not child.definition.dynamic %}
4
- // MODULE : {{child.indexKey}}
5
- import { default as {{child.codeKey}} } from "./{{child.codeKey}}";
6
- {% endif %}
7
- {% endif %}
8
- {% endfor%}
@@ -1,29 +0,0 @@
1
- {% for child in childs %}
2
-
3
- {% if child.module===true%}
4
-
5
- // MODULE : {{child.indexKey}}
6
- {% if child.definition.dynamic %}
7
- const { default: {{child.codeKey}} } = await import("./{{child.codeKey}}");
8
- {% endif %}
9
-
10
- m['{{child.name}}']=async function(){
11
- const entry=new {{child.codeKey}}({engine,flow,parent:_this,caller:c,module:true});
12
- const nextBlock=await entry.run.apply(entry,arguments);
13
-
14
- if(nextBlock?.type==='return') return nextBlock.value;
15
- else if(nextBlock?.type==='block') {
16
- {% if workflow.parent.context.atom.doc.features.print_module_final_next %}
17
- console.log('MODULE FINAL NEXT:',nextBlock);
18
- {% endif %}
19
- resolve(nextBlock);
20
- }
21
- }
22
-
23
- {% if child.context.transform.export %}
24
- flow.setModule({{child.context.transform.export | safe}}, m['{{child.name}}']);
25
- {% endif %}
26
-
27
- {% endif %}
28
-
29
- {% endfor%}