@fnet/cli 0.3.15 → 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.
- package/dist/fnet/index.js +9 -9
- package/package.json +1 -1
- package/template/fnet/node/src/default/blocks/assign.js.njk +10 -48
- package/template/fnet/node/src/default/blocks/call.js.njk +110 -156
- package/template/fnet/node/src/default/blocks/for.js.njk +59 -95
- package/template/fnet/node/src/default/blocks/form.js.njk +21 -59
- package/template/fnet/node/src/default/blocks/http.js.njk +125 -147
- package/template/fnet/node/src/default/blocks/modules.js.njk +10 -52
- package/template/fnet/node/src/default/blocks/new.js.njk +40 -85
- package/template/fnet/node/src/default/blocks/next.js.njk +10 -32
- package/template/fnet/node/src/default/blocks/output.js.njk +10 -48
- package/template/fnet/node/src/default/blocks/parallel.js.njk +60 -106
- package/template/fnet/node/src/default/blocks/pipeline.js.njk +100 -137
- package/template/fnet/node/src/default/blocks/raise.js.njk +9 -25
- package/template/fnet/node/src/default/blocks/retry.js.njk +63 -87
- package/template/fnet/node/src/default/blocks/return.js.njk +13 -25
- package/template/fnet/node/src/default/blocks/schedule.js.njk +56 -73
- package/template/fnet/node/src/default/blocks/signal.js.njk +10 -32
- package/template/fnet/node/src/default/blocks/steps.js.njk +32 -55
- package/template/fnet/node/src/default/blocks/switch.js.njk +37 -74
- package/template/fnet/node/src/default/blocks/tryexcept.js.njk +58 -52
- package/template/fnet/node/src/default/blocks/wait.js.njk +10 -30
- package/template/fnet/node/src/default/macros/block-body-header.js.njk +1 -1
- package/template/fnet/node/src/default/macros/block-next.js.njk +0 -1
- package/template/fnet/node/src/default/types/block.js.njk +133 -0
- package/template/fnet/node/src/default/workflow.js.njk +1 -1
|
@@ -1,157 +1,135 @@
|
|
|
1
|
-
{%
|
|
2
|
-
|
|
3
|
-
{%
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{% endif %}
|
|
33
|
-
|
|
34
|
-
// Create HTTP context for modules
|
|
35
|
-
const httpContext = { url, method, headers, timeout, params: {% if context.transform.http.params %}params{% else %}undefined{% endif %}, body: {% if context.transform.http.body !== undefined %}body{% else %}undefined{% endif %} };
|
|
36
|
-
|
|
37
|
-
// If any property is a module function (m::), call it with HTTP context
|
|
38
|
-
if (typeof url === 'function') {
|
|
39
|
-
url = await url(httpContext);
|
|
40
|
-
}
|
|
1
|
+
{% set assign=true %}
|
|
2
|
+
{% set signal=true %}
|
|
3
|
+
{% set resolve=true %}
|
|
4
|
+
{% set result=true %}
|
|
5
|
+
|
|
6
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
7
|
+
|
|
8
|
+
{% call block.header() %}
|
|
9
|
+
{% endcall %}
|
|
10
|
+
|
|
11
|
+
{% call block.definition() %}
|
|
12
|
+
|
|
13
|
+
// HTTP configuration
|
|
14
|
+
let url = {{ context.transform.http.url | safe }};
|
|
15
|
+
let method = "{{ context.transform.http.method }}";
|
|
16
|
+
let headers = {{ context.transform.http.headers | dump | safe }};
|
|
17
|
+
let timeout = {{ context.transform.http.timeout }};
|
|
18
|
+
{% if context.transform.http.body !== undefined %}
|
|
19
|
+
let body = {% if context.transform.http.body is string %}{{ context.transform.http.body | safe }}{% else %}{{ context.transform.http.body | dump | safe }}{% endif %};
|
|
20
|
+
{% endif %}
|
|
21
|
+
{% if context.transform.http.params %}
|
|
22
|
+
let params = {{ context.transform.http.params | dump | safe }};
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
// Create HTTP context for modules
|
|
26
|
+
const httpContext = { url, method, headers, timeout, params: {% if context.transform.http.params %}params{% else %}undefined{% endif %}, body: {% if context.transform.http.body !== undefined %}body{% else %}undefined{% endif %} };
|
|
27
|
+
|
|
28
|
+
// If any property is a module function (m::), call it with HTTP context
|
|
29
|
+
if (typeof url === 'function') {
|
|
30
|
+
url = await url(httpContext);
|
|
31
|
+
}
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
if (typeof method === 'function') {
|
|
34
|
+
method = await method(httpContext);
|
|
35
|
+
}
|
|
45
36
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
if (typeof headers === 'function') {
|
|
38
|
+
headers = await headers(httpContext);
|
|
39
|
+
}
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
if (typeof timeout === 'function') {
|
|
42
|
+
timeout = await timeout(httpContext);
|
|
43
|
+
}
|
|
53
44
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
{% if context.transform.http.params %}
|
|
46
|
+
if (typeof params === 'function') {
|
|
47
|
+
params = await params(httpContext);
|
|
48
|
+
}
|
|
49
|
+
{% endif %}
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
fetchOptions.body = body;
|
|
93
|
-
}
|
|
51
|
+
{% if context.transform.http.body !== undefined %}
|
|
52
|
+
if (typeof body === 'function') {
|
|
53
|
+
body = await body(httpContext);
|
|
54
|
+
}
|
|
55
|
+
{% endif %}
|
|
56
|
+
|
|
57
|
+
// Build URL with query parameters if provided
|
|
58
|
+
let finalUrl = url;
|
|
59
|
+
{% if context.transform.http.params %}
|
|
60
|
+
if (params && Object.keys(params).length > 0) {
|
|
61
|
+
const queryString = new URLSearchParams(params).toString();
|
|
62
|
+
finalUrl = url + (url.includes('?') ? '&' : '?') + queryString;
|
|
63
|
+
}
|
|
64
|
+
{% endif %}
|
|
65
|
+
|
|
66
|
+
// Prepare fetch options
|
|
67
|
+
const fetchOptions = {
|
|
68
|
+
method: method,
|
|
69
|
+
headers: headers
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Add body if present (and not GET/HEAD)
|
|
73
|
+
{% if context.transform.http.body %}
|
|
74
|
+
if (body !== undefined && method !== 'GET' && method !== 'HEAD') {
|
|
75
|
+
// Auto JSON.stringify if body is object
|
|
76
|
+
if (typeof body === 'object' && body !== null) {
|
|
77
|
+
fetchOptions.body = JSON.stringify(body);
|
|
78
|
+
// Auto set Content-Type if not already set
|
|
79
|
+
if (!fetchOptions.headers['Content-Type'] && !fetchOptions.headers['content-type']) {
|
|
80
|
+
fetchOptions.headers['Content-Type'] = 'application/json';
|
|
94
81
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
} else {
|
|
83
|
+
fetchOptions.body = body;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
{% endif %}
|
|
87
|
+
|
|
88
|
+
// Create abort controller for timeout
|
|
89
|
+
const controller = new AbortController();
|
|
90
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
91
|
+
fetchOptions.signal = controller.signal;
|
|
92
|
+
|
|
93
|
+
let result;
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
// Execute HTTP request
|
|
97
|
+
const response = await fetch(finalUrl, fetchOptions);
|
|
98
|
+
clearTimeout(timeoutId);
|
|
99
|
+
|
|
100
|
+
// Check if response is successful (2xx)
|
|
101
|
+
if (!response.ok) {
|
|
102
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Parse response based on Content-Type
|
|
106
|
+
const contentType = response.headers.get('content-type');
|
|
107
|
+
|
|
108
|
+
if (contentType && contentType.includes('application/json')) {
|
|
109
|
+
result = await response.json();
|
|
110
|
+
} else if (contentType && contentType.includes('text/')) {
|
|
111
|
+
result = await response.text();
|
|
112
|
+
} else {
|
|
113
|
+
// Try JSON first, fallback to text
|
|
102
114
|
try {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// Check if response is successful (2xx)
|
|
108
|
-
if (!response.ok) {
|
|
109
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Parse response based on Content-Type
|
|
113
|
-
const contentType = response.headers.get('content-type');
|
|
114
|
-
let result;
|
|
115
|
-
|
|
116
|
-
if (contentType && contentType.includes('application/json')) {
|
|
117
|
-
result = await response.json();
|
|
118
|
-
} else if (contentType && contentType.includes('text/')) {
|
|
119
|
-
result = await response.text();
|
|
120
|
-
} else {
|
|
121
|
-
// Try JSON first, fallback to text
|
|
122
|
-
try {
|
|
123
|
-
result = await response.json();
|
|
124
|
-
} catch (e) {
|
|
125
|
-
result = await response.text();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Store result in flow variable
|
|
130
|
-
flow.set('result', result);
|
|
131
|
-
|
|
132
|
-
{% include "src/default/macros/block-assign.js.njk" %}
|
|
133
|
-
|
|
134
|
-
} catch (error) {
|
|
135
|
-
clearTimeout(timeoutId);
|
|
136
|
-
|
|
137
|
-
// Handle timeout error
|
|
138
|
-
if (error.name === 'AbortError') {
|
|
139
|
-
const timeoutError = new Error(`HTTP request timeout after ${timeout}ms: ${finalUrl}`);
|
|
140
|
-
onError ? onError(timeoutError) : reject(timeoutError);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Handle other errors
|
|
145
|
-
onError ? onError(error) : reject(error);
|
|
146
|
-
return;
|
|
115
|
+
result = await response.json();
|
|
116
|
+
} catch (e) {
|
|
117
|
+
result = await response.text();
|
|
147
118
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
119
|
+
}
|
|
120
|
+
} catch (error) {
|
|
121
|
+
clearTimeout(timeoutId);
|
|
122
|
+
|
|
123
|
+
// Handle timeout error
|
|
124
|
+
if (error.name === 'AbortError') {
|
|
125
|
+
const timeoutError = new Error(`HTTP request timeout after ${timeout}ms: ${finalUrl}`);
|
|
126
|
+
return reject(timeoutError);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Handle other errors
|
|
130
|
+
return reject(error);
|
|
153
131
|
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
{% include "src/default/macros/block-footer.js.njk" %}
|
|
132
|
+
{% endcall %}
|
|
157
133
|
|
|
134
|
+
{% call block.footer()%}
|
|
135
|
+
{% endcall %}
|
|
@@ -1,57 +1,15 @@
|
|
|
1
|
-
{%
|
|
1
|
+
{% set assign=true %}
|
|
2
|
+
{% set signal=true %}
|
|
3
|
+
{% set resolve=true %}
|
|
2
4
|
|
|
3
|
-
{%
|
|
5
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
4
6
|
|
|
5
|
-
{%
|
|
7
|
+
{% call block.header() %}
|
|
8
|
+
{% endcall %}
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
{% call block.definition() %}
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
{% endcall %}
|
|
10
13
|
|
|
11
|
-
|
|
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.wait==='next' %}
|
|
23
|
-
flow.waitForNext({
|
|
24
|
-
key:'{{indexKey}}',
|
|
25
|
-
next: async () => {
|
|
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
|
-
|
|
34
|
-
{% include "src/default/macros/block-assign.js.njk" %}
|
|
35
|
-
|
|
36
|
-
{% include "src/default/macros/block-signal.js.njk" %}
|
|
37
|
-
|
|
38
|
-
{% if context.transform.return %}
|
|
39
|
-
resolve({type:'return',value: {{context.transform.return | safe}}});
|
|
40
|
-
{% elseif context.next and context.transform.wait!=='next'%}
|
|
41
|
-
{% include "src/default/macros/block-next.js.njk" %}
|
|
42
|
-
{% elseif not context.next%}
|
|
43
|
-
resolve();
|
|
44
|
-
{% endif %}
|
|
45
|
-
|
|
46
|
-
{% include "src/default/macros/block-run-footer.js.njk" %}
|
|
47
|
-
}
|
|
48
|
-
catch(error){
|
|
49
|
-
reject(error);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
Object.freeze(this);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
{% include "src/default/macros/block-footer.js.njk" %}
|
|
14
|
+
{% call block.footer()%}
|
|
15
|
+
{% endcall %}
|
|
@@ -1,87 +1,42 @@
|
|
|
1
|
-
{%
|
|
2
|
-
|
|
3
|
-
{%
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
{% set assign=true %}
|
|
2
|
+
{% set signal=true %}
|
|
3
|
+
{% set resolve=true %}
|
|
4
|
+
{% set result=true %}
|
|
5
|
+
|
|
6
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
7
|
+
|
|
8
|
+
{% call block.header() %}
|
|
9
|
+
{% include "src/default/macros/block-library-header.js.njk" %}
|
|
10
|
+
{% endcall %}
|
|
11
|
+
|
|
12
|
+
{% call block.definition() %}
|
|
13
|
+
|
|
14
|
+
{# NEW: Check if 'new' keyword is present for constructor call #}
|
|
15
|
+
{% if context.transform.new !== undefined %}
|
|
16
|
+
{# Constructor instantiation with 'new' keyword #}
|
|
17
|
+
{% if context.lib.type==='atom' and context.lib.atom.protocol!=='use:' %}
|
|
18
|
+
const LibClass=LIBRARY;
|
|
19
|
+
{% elseif context.lib.atom.protocol==='use:' %}
|
|
20
|
+
{# For use:e:: protocol, call value is the class name (e.g., use:e::Map → Map) #}
|
|
21
|
+
const LibClass={{context.transform.import}};
|
|
22
|
+
if(!LibClass) throw new Error('[use] Couldnt find class.');
|
|
23
|
+
{% else %}
|
|
24
|
+
throw new Error('Cannot instantiate: unsupported lib type.');
|
|
25
|
+
{% endif %}
|
|
26
|
+
|
|
27
|
+
{# Create instance with constructor args #}
|
|
28
|
+
{% if context.transform.new %}
|
|
29
|
+
const constructorArgs = {{ context.transform.new | safe }};
|
|
30
|
+
const instance = Array.isArray(constructorArgs) ? new LibClass(...constructorArgs) : new LibClass(constructorArgs);
|
|
31
|
+
{% else %}
|
|
32
|
+
const instance = new LibClass();
|
|
33
|
+
{% endif %}
|
|
34
|
+
|
|
35
|
+
{% endif %}
|
|
36
|
+
|
|
37
|
+
const result = instance;
|
|
12
38
|
|
|
13
|
-
|
|
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.wait==='next' %}
|
|
27
|
-
flow.waitForNext({
|
|
28
|
-
key:'{{indexKey}}',
|
|
29
|
-
next: async () => {
|
|
30
|
-
{% include "src/default/macros/block-next.js.njk" %}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
{% endif %}
|
|
34
|
-
|
|
35
|
-
{# NEW: Check if 'new' keyword is present for constructor call #}
|
|
36
|
-
{% if context.transform.new !== undefined %}
|
|
37
|
-
{# Constructor instantiation with 'new' keyword #}
|
|
38
|
-
{% if context.lib.type==='atom' and context.lib.atom.protocol!=='use:' %}
|
|
39
|
-
const LibClass=LIBRARY;
|
|
40
|
-
{% elseif context.lib.atom.protocol==='use:' %}
|
|
41
|
-
{# For use:e:: protocol, call value is the class name (e.g., use:e::Map → Map) #}
|
|
42
|
-
const LibClass={{context.transform.import}};
|
|
43
|
-
if(!LibClass) throw new Error('[use] Couldnt find class.');
|
|
44
|
-
{% else %}
|
|
45
|
-
throw new Error('Cannot instantiate: unsupported lib type.');
|
|
46
|
-
{% endif %}
|
|
47
|
-
|
|
48
|
-
{# Create instance with constructor args #}
|
|
49
|
-
{% if context.transform.new %}
|
|
50
|
-
const constructorArgs = {{ context.transform.new | safe }};
|
|
51
|
-
const instance = Array.isArray(constructorArgs) ? new LibClass(...constructorArgs) : new LibClass(constructorArgs);
|
|
52
|
-
{% else %}
|
|
53
|
-
const instance = new LibClass();
|
|
54
|
-
{% endif %}
|
|
55
|
-
|
|
56
|
-
{% endif %}
|
|
57
|
-
|
|
58
|
-
const result = instance;
|
|
59
|
-
|
|
60
|
-
{% for assign in context.transform.result %}
|
|
61
|
-
flow.set({{assign.key | safe}},{{assign.value | safe}});
|
|
62
|
-
{% endfor%}
|
|
63
|
-
|
|
64
|
-
{% include "src/default/macros/block-assign.js.njk" %}
|
|
65
|
-
|
|
66
|
-
{% include "src/default/macros/block-signal.js.njk" %}
|
|
67
|
-
|
|
68
|
-
{% if context.transform.return %}
|
|
69
|
-
resolve({type:'return',value: {{context.transform.return | safe}}});
|
|
70
|
-
{% elseif context.next and context.transform.wait!=='next'%}
|
|
71
|
-
{% include "src/default/macros/block-next.js.njk" %}
|
|
72
|
-
{% elseif not context.next%}
|
|
73
|
-
resolve();
|
|
74
|
-
{% endif %}
|
|
75
|
-
|
|
76
|
-
{% include "src/default/macros/block-run-footer.js.njk" %}
|
|
77
|
-
}
|
|
78
|
-
catch(error){
|
|
79
|
-
onError? onError(error) : reject(error);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
Object.freeze(this);
|
|
85
|
-
}
|
|
39
|
+
{% endcall %}
|
|
86
40
|
|
|
87
|
-
{%
|
|
41
|
+
{% call block.footer()%}
|
|
42
|
+
{% endcall %}
|
|
@@ -1,37 +1,15 @@
|
|
|
1
|
-
{%
|
|
1
|
+
{% set assign=true %}
|
|
2
|
+
{% set signal=true %}
|
|
3
|
+
{% set resolve=true %}
|
|
2
4
|
|
|
3
|
-
{%
|
|
5
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{% include "src/default/macros/block-body-header.js.njk" %}
|
|
7
|
+
{% call block.header() %}
|
|
8
|
+
{% endcall %}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{% include "src/default/macros/block-entry-args.js.njk" %}
|
|
10
|
+
{% call block.definition() %}
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
{% include "src/default/macros/block-run-header.js.njk" %}
|
|
15
|
-
|
|
16
|
-
{% include "src/default/macros/page.js.njk" %}
|
|
17
|
-
|
|
18
|
-
{% include "src/default/macros/block-assign.js.njk" %}
|
|
12
|
+
{% endcall %}
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{% if context.transform.return %}
|
|
23
|
-
resolve({type:'return',value: {{context.transform.return | safe}}});
|
|
24
|
-
{% elseif context.next %}
|
|
25
|
-
{% include "src/default/macros/block-next.js.njk" %}
|
|
26
|
-
{% else %}
|
|
27
|
-
resolve();
|
|
28
|
-
{% endif %}
|
|
29
|
-
|
|
30
|
-
{% include "src/default/macros/block-run-footer.js.njk" %}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
Object.freeze(this);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
{% include "src/default/macros/block-footer.js.njk" %}
|
|
14
|
+
{% call block.footer()%}
|
|
15
|
+
{% endcall %}
|
|
@@ -1,53 +1,15 @@
|
|
|
1
|
-
{%
|
|
1
|
+
{% set assign=true %}
|
|
2
|
+
{% set signal=true %}
|
|
3
|
+
{% set resolve=true %}
|
|
2
4
|
|
|
3
|
-
{%
|
|
5
|
+
{% import "src/default/types/block.js.njk" as block with context %}
|
|
4
6
|
|
|
5
|
-
{%
|
|
7
|
+
{% call block.header() %}
|
|
8
|
+
{% endcall %}
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
{% call block.definition() %}
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
{% endcall %}
|
|
10
13
|
|
|
11
|
-
|
|
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
|
-
{% if context.next and context.transform.wait==='next' %}
|
|
24
|
-
flow.waitForNext({
|
|
25
|
-
key:'{{indexKey}}',
|
|
26
|
-
next: async () => {
|
|
27
|
-
{% include "src/default/macros/block-next.js.njk" %}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
{% endif %}
|
|
31
|
-
|
|
32
|
-
{% for assign in context.transform.assign %}
|
|
33
|
-
flow.set({{assign.key | safe}},{{assign.value | safe}});
|
|
34
|
-
{% endfor%}
|
|
35
|
-
|
|
36
|
-
{% include "src/default/macros/block-signal.js.njk" %}
|
|
37
|
-
|
|
38
|
-
{% if context.transform.return %}
|
|
39
|
-
resolve({type:'return',value: {{context.transform.return | safe}}});
|
|
40
|
-
{% elseif context.next and context.transform.wait!=='next'%}
|
|
41
|
-
{% include "src/default/macros/block-next.js.njk" %}
|
|
42
|
-
{% elseif not context.next%}
|
|
43
|
-
resolve();
|
|
44
|
-
{% endif %}
|
|
45
|
-
|
|
46
|
-
{% include "src/default/macros/block-run-footer.js.njk" %}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
Object.freeze(this);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
{% include "src/default/macros/block-footer.js.njk" %}
|
|
14
|
+
{% call block.footer()%}
|
|
15
|
+
{% endcall %}
|