exupery-core-async 0.3.38 → 0.3.39
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/command/actions.d.ts +23 -12
- package/dist/command/actions.js +208 -189
- package/package.json +1 -1
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
import { Basic_Command } from './creaters/create_command';
|
|
3
3
|
export declare namespace p {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
namespace assert {
|
|
5
|
+
const direct: <Error>(assertion: boolean, error_if_failed: Error) => _et.Command_Promise<Error>;
|
|
6
|
+
const query: <Error>(assertion: _et.Query_Promise<boolean, Error>, error_if_failed: Error) => _et.Command_Promise<Error>;
|
|
7
|
+
}
|
|
8
|
+
namespace conditional {
|
|
9
|
+
const direct: <Error>(precondition: boolean, procedure: _et.Command_Promise<Error>) => _et.Command_Promise<Error>;
|
|
10
|
+
const query: <Error>(precondition: _et.Query_Promise<boolean, Error>, procedure: _et.Command_Promise<Error>) => _et.Command_Promise<Error>;
|
|
11
|
+
const procedure: <Procedure_Input, Error>(precondition: _et.Process_Result<Procedure_Input, Error>, procedure: Basic_Command<Procedure_Input, Error>) => _et.Command_Promise<Error>;
|
|
12
|
+
const transformer: <Procedure_Input, Refinement_Error, Error>(precondition: _et.Refinement_Result<Procedure_Input, Refinement_Error>, error_transformer: _et.Transformer_Without_Parameters<Refinement_Error, Error>, procedure: Basic_Command<Procedure_Input, Error>) => _et.Command_Promise<Error>;
|
|
13
|
+
}
|
|
14
|
+
namespace execute {
|
|
15
|
+
const direct: <Parameters, Error>(procedure: _et.Command<Parameters, Error>, parameters: Parameters) => _et.Command_Promise<Error>;
|
|
16
|
+
const query: <Parameters, Error>(procedure: _et.Command<Parameters, Error>, query: _et.Query_Promise<Parameters, Error>) => _et.Command_Promise<Error>;
|
|
17
|
+
}
|
|
18
|
+
namespace list {
|
|
19
|
+
const parallel: <Error, Element_Error>(the_array: _et.Array<_et.Command_Promise<Element_Error>>, aggregate_errors: _et.Transformer_Without_Parameters<_et.Array<Element_Error>, Error>) => _et.Command_Promise<Error>;
|
|
20
|
+
const serie: <Error>(array: _et.Array<_et.Command_Promise<Error>>) => _et.Command_Promise<Error>;
|
|
21
|
+
}
|
|
22
|
+
namespace dictionary {
|
|
23
|
+
const parallel: <Error, Entry_Error>(dictionary: _et.Dictionary<_et.Command_Promise<Entry_Error>>, aggregate_errors: _et.Transformer_Without_Parameters<_et.Dictionary<Entry_Error>, Error>) => _et.Command_Promise<Error>;
|
|
24
|
+
const serie: <Error, Entry_Error>(dictionary: _et.Dictionary<_et.Command_Promise<Entry_Error>>, transform_error: _et.Transformer_Without_Parameters<_et.Key_Value_Pair<Entry_Error>, Error>) => _et.Command_Promise<Error>;
|
|
25
|
+
const parallel_without_transforming_the_error: <Error, Entry_Error>(dictionary: _et.Dictionary<_et.Command_Promise<Entry_Error>>) => _et.Command_Promise<_et.Dictionary<Entry_Error>>;
|
|
26
|
+
}
|
|
16
27
|
const sequence: <Error>(steps: _et.Command_Promise<Error>[]) => _et.Command_Promise<Error>;
|
|
17
28
|
}
|
package/dist/command/actions.js
CHANGED
|
@@ -29,213 +29,232 @@ const create_command_promise_1 = require("./creaters/create_command_promise");
|
|
|
29
29
|
const create_asynchronous_processes_monitor_1 = require("../create_asynchronous_processes_monitor");
|
|
30
30
|
var p;
|
|
31
31
|
(function (p) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
monitor['report process started']();
|
|
39
|
-
$.__start(() => {
|
|
40
|
-
monitor['report process finished']();
|
|
41
|
-
}, (e) => {
|
|
42
|
-
errors.push(e);
|
|
43
|
-
monitor['report process finished']();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}, () => {
|
|
47
|
-
if (errors.length === 0) {
|
|
48
|
-
on_success();
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
on_error(aggregate_errors(_ei.array_literal(errors)));
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
p.array_serie = (array) => {
|
|
58
|
-
return (0, create_command_promise_1.__create_command_promise)({
|
|
59
|
-
'execute': (on_success, on_error) => {
|
|
60
|
-
let current = 0;
|
|
61
|
-
const do_next = () => {
|
|
62
|
-
array.__get_element_at(current).transform(($) => {
|
|
63
|
-
current += 1;
|
|
64
|
-
$.__start(() => {
|
|
65
|
-
do_next();
|
|
66
|
-
}, on_error);
|
|
67
|
-
}, () => {
|
|
68
|
-
on_success();
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
do_next();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
p.assert_async = (assertion, error_if_failed) => {
|
|
76
|
-
return (0, create_command_promise_1.__create_command_promise)({
|
|
77
|
-
'execute': (on_success, on_error) => {
|
|
78
|
-
assertion.__start(($) => {
|
|
79
|
-
if ($) {
|
|
80
|
-
on_success();
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
32
|
+
let assert;
|
|
33
|
+
(function (assert) {
|
|
34
|
+
assert.direct = (assertion, error_if_failed) => {
|
|
35
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
36
|
+
'execute': (on_success, on_error) => {
|
|
37
|
+
if (!assertion) {
|
|
83
38
|
on_error(error_if_failed);
|
|
39
|
+
return;
|
|
84
40
|
}
|
|
85
|
-
|
|
86
|
-
on_error($);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
p.assert_sync = (assertion, error_if_failed) => {
|
|
92
|
-
return (0, create_command_promise_1.__create_command_promise)({
|
|
93
|
-
'execute': (on_success, on_error) => {
|
|
94
|
-
if (!assertion) {
|
|
95
|
-
on_error(error_if_failed);
|
|
96
|
-
return;
|
|
41
|
+
on_success();
|
|
97
42
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
assert.query = (assertion, error_if_failed) => {
|
|
46
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
47
|
+
'execute': (on_success, on_error) => {
|
|
48
|
+
assertion.__start(($) => {
|
|
49
|
+
if ($) {
|
|
50
|
+
on_success();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
on_error(error_if_failed);
|
|
54
|
+
}
|
|
55
|
+
}, ($) => {
|
|
56
|
+
on_error($);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
})(assert = p.assert || (p.assert = {}));
|
|
62
|
+
let conditional;
|
|
63
|
+
(function (conditional) {
|
|
64
|
+
conditional.direct = (precondition, procedure) => {
|
|
65
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
66
|
+
'execute': (on_success, on_error) => {
|
|
67
|
+
if (precondition) {
|
|
107
68
|
procedure.__start(on_success, on_error);
|
|
108
69
|
}
|
|
109
70
|
else {
|
|
110
71
|
on_success();
|
|
111
72
|
}
|
|
112
|
-
}, on_error);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
p.conditional_sync = (precondition, procedure) => {
|
|
117
|
-
return (0, create_command_promise_1.__create_command_promise)({
|
|
118
|
-
'execute': (on_success, on_error) => {
|
|
119
|
-
if (precondition) {
|
|
120
|
-
procedure.__start(on_success, on_error);
|
|
121
73
|
}
|
|
122
|
-
|
|
123
|
-
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
conditional.query = (precondition, procedure) => {
|
|
77
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
78
|
+
'execute': (on_success, on_error) => {
|
|
79
|
+
precondition.__start(($) => {
|
|
80
|
+
if ($) {
|
|
81
|
+
procedure.__start(on_success, on_error);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
on_success();
|
|
85
|
+
}
|
|
86
|
+
}, on_error);
|
|
124
87
|
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
on_error(error_transformer(e));
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
p.dictionary_serie = (dictionary, transform_error) => {
|
|
149
|
-
return (0, create_command_promise_1.__create_command_promise)({
|
|
150
|
-
'execute': (on_success, on_error) => {
|
|
151
|
-
const op_dictionary_to_list_based_on_insertion_order = (dict) => {
|
|
152
|
-
const temp = [];
|
|
153
|
-
dict.map(($, key) => {
|
|
154
|
-
temp.push({ key, value: $ });
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
conditional.procedure = (precondition, procedure) => {
|
|
91
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
92
|
+
'execute': (on_success, on_error) => {
|
|
93
|
+
precondition.__extract_data(($) => {
|
|
94
|
+
procedure($).__start(on_success, on_error);
|
|
95
|
+
}, on_error);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
conditional.transformer = (precondition, error_transformer, procedure) => {
|
|
100
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
101
|
+
'execute': (on_success, on_error) => {
|
|
102
|
+
precondition.process(($) => {
|
|
103
|
+
procedure($).__start(on_success, on_error);
|
|
104
|
+
}, (e) => {
|
|
105
|
+
on_error(error_transformer(e));
|
|
155
106
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
})(conditional = p.conditional || (p.conditional = {}));
|
|
111
|
+
let execute;
|
|
112
|
+
(function (execute) {
|
|
113
|
+
execute.direct = (procedure, parameters) => {
|
|
114
|
+
return procedure['execute with synchronous data without error transformation'](parameters);
|
|
115
|
+
};
|
|
116
|
+
execute.query = (procedure, query) => {
|
|
117
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
118
|
+
'execute': (on_success, on_error) => {
|
|
119
|
+
query.__start((query_result) => {
|
|
120
|
+
procedure['execute with synchronous data without error transformation'](query_result).__start(on_success, on_error);
|
|
121
|
+
}, on_error);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
})(execute = p.execute || (p.execute = {}));
|
|
126
|
+
let list;
|
|
127
|
+
(function (list) {
|
|
128
|
+
list.parallel = (the_array, aggregate_errors) => {
|
|
129
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
130
|
+
'execute': (on_success, on_error) => {
|
|
131
|
+
const errors = [];
|
|
132
|
+
(0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
|
|
133
|
+
the_array.map(($) => {
|
|
134
|
+
monitor['report process started']();
|
|
135
|
+
$.__start(() => {
|
|
136
|
+
monitor['report process finished']();
|
|
137
|
+
}, (e) => {
|
|
138
|
+
errors.push(e);
|
|
139
|
+
monitor['report process finished']();
|
|
140
|
+
});
|
|
171
141
|
});
|
|
172
142
|
}, () => {
|
|
173
|
-
|
|
143
|
+
if (errors.length === 0) {
|
|
144
|
+
on_success();
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
on_error(aggregate_errors(_ei.array_literal(errors)));
|
|
148
|
+
}
|
|
174
149
|
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
list.serie = (array) => {
|
|
154
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
155
|
+
'execute': (on_success, on_error) => {
|
|
156
|
+
let current = 0;
|
|
157
|
+
const do_next = () => {
|
|
158
|
+
array.__get_element_at(current).transform(($) => {
|
|
159
|
+
current += 1;
|
|
160
|
+
$.__start(() => {
|
|
161
|
+
do_next();
|
|
162
|
+
}, on_error);
|
|
163
|
+
}, () => {
|
|
164
|
+
on_success();
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
do_next();
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
})(list = p.list || (p.list = {}));
|
|
172
|
+
let dictionary;
|
|
173
|
+
(function (dictionary_1) {
|
|
174
|
+
dictionary_1.parallel = (dictionary, aggregate_errors) => {
|
|
175
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
176
|
+
'execute': (on_success, on_error) => {
|
|
177
|
+
const errors = {};
|
|
178
|
+
(0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
|
|
179
|
+
dictionary.map(($, key) => {
|
|
180
|
+
monitor['report process started']();
|
|
181
|
+
$.__start(() => {
|
|
182
|
+
monitor['report process finished']();
|
|
183
|
+
}, (e) => {
|
|
184
|
+
errors[key] = e;
|
|
185
|
+
monitor['report process finished']();
|
|
186
|
+
});
|
|
192
187
|
});
|
|
188
|
+
}, () => {
|
|
189
|
+
if (Object.keys(errors).length === 0) {
|
|
190
|
+
on_success();
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
on_error(aggregate_errors(_ei.dictionary_literal(errors)));
|
|
194
|
+
}
|
|
193
195
|
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
dictionary_1.serie = (dictionary, transform_error) => {
|
|
200
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
201
|
+
'execute': (on_success, on_error) => {
|
|
202
|
+
const op_dictionary_to_list_based_on_insertion_order = (dict) => {
|
|
203
|
+
const temp = [];
|
|
204
|
+
dict.map(($, key) => {
|
|
205
|
+
temp.push({ key, value: $ });
|
|
206
|
+
});
|
|
207
|
+
return _ei.array_literal(temp);
|
|
208
|
+
};
|
|
209
|
+
const as_list = op_dictionary_to_list_based_on_insertion_order(dictionary);
|
|
210
|
+
let current = 0;
|
|
211
|
+
const do_next = () => {
|
|
212
|
+
as_list.__get_element_at(current).transform(($) => {
|
|
213
|
+
const key = $.key;
|
|
214
|
+
current += 1;
|
|
215
|
+
$.value.__start(() => {
|
|
216
|
+
do_next();
|
|
217
|
+
}, ($) => {
|
|
218
|
+
on_error(transform_error({
|
|
219
|
+
'value': $,
|
|
220
|
+
'key': key,
|
|
221
|
+
}));
|
|
222
|
+
});
|
|
223
|
+
}, () => {
|
|
224
|
+
on_success();
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
do_next();
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
dictionary_1.parallel_without_transforming_the_error = (dictionary) => {
|
|
232
|
+
return (0, create_command_promise_1.__create_command_promise)({
|
|
233
|
+
'execute': (on_success, on_error) => {
|
|
234
|
+
const errors = {};
|
|
235
|
+
(0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
|
|
236
|
+
dictionary.map(($, key) => {
|
|
237
|
+
monitor['report process started']();
|
|
238
|
+
$.__start(() => {
|
|
239
|
+
monitor['report process finished']();
|
|
240
|
+
}, (e) => {
|
|
241
|
+
errors[key] = e;
|
|
242
|
+
monitor['report process finished']();
|
|
243
|
+
});
|
|
217
244
|
});
|
|
245
|
+
}, () => {
|
|
246
|
+
if (Object.keys(errors).length === 0) {
|
|
247
|
+
on_success();
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
on_error(_ei.dictionary_literal(errors));
|
|
251
|
+
}
|
|
218
252
|
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
on_error(_ei.dictionary_literal(errors));
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
p.execute_with_async_data = (procedure, query) => {
|
|
231
|
-
return (0, create_command_promise_1.__create_command_promise)({
|
|
232
|
-
'execute': (on_success, on_error) => {
|
|
233
|
-
query.__start((query_result) => {
|
|
234
|
-
procedure['execute with synchronous data without error transformation'](query_result).__start(on_success, on_error);
|
|
235
|
-
}, on_error);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
};
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
})(dictionary = p.dictionary || (p.dictionary = {}));
|
|
257
|
+
// Sequencing function:
|
|
239
258
|
p.sequence = (steps) => {
|
|
240
259
|
return (0, create_command_promise_1.__create_command_promise)({
|
|
241
260
|
'execute': (on_success, on_error) => {
|