exupery-core-async 0.3.21 → 0.3.23
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/algorithms/procedure/create_procedure_promise.d.ts +1 -1
- package/dist/algorithms/query/create_query_promise.d.ts +1 -1
- package/dist/algorithms/query/create_query_promise.js +23 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/shorthands.d.ts +4 -4
- package/dist/shorthands.js +12 -12
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _et from "exupery-core-types";
|
|
2
2
|
/**
|
|
3
|
-
* this function contains the body in which the async value or
|
|
3
|
+
* this function contains the body in which the async value or error is executed
|
|
4
4
|
* after the execution, either the on_value or on_error callback will be called
|
|
5
5
|
* @param on_value the callback to call when a value is produced
|
|
6
6
|
* @param on_error the callback to call when an error is produced
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _et from "exupery-core-types";
|
|
2
2
|
/**
|
|
3
|
-
* this function contains the body in which the async value or
|
|
3
|
+
* this function contains the body in which the async value or error is executed
|
|
4
4
|
* after the execution, either the on_value or on_error callback will be called
|
|
5
5
|
* @param on_value the callback to call when a value is produced
|
|
6
6
|
* @param on_error the callback to call when an error is produced
|
|
@@ -14,16 +14,16 @@ class Query_Result_Promise_Class {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
map_error(handle_error) {
|
|
18
18
|
return new Query_Result_Promise_Class({
|
|
19
19
|
'execute': (on_value, on_error) => {
|
|
20
20
|
this.executer.execute(on_value, ($) => {
|
|
21
|
-
on_error(
|
|
21
|
+
on_error(handle_error($));
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
process_result(processor) {
|
|
27
27
|
return new Query_Result_Promise_Class({
|
|
28
28
|
'execute': (on_value, on_error) => {
|
|
29
29
|
this.executer.execute(($) => {
|
|
@@ -32,6 +32,26 @@ class Query_Result_Promise_Class {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
process_error(processor) {
|
|
36
|
+
return new Query_Result_Promise_Class({
|
|
37
|
+
'execute': (on_value, on_error) => {
|
|
38
|
+
this.executer.execute(on_value, ($) => {
|
|
39
|
+
processor($).__extract_data(on_value, on_error);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
process(processors) {
|
|
45
|
+
return new Query_Result_Promise_Class({
|
|
46
|
+
'execute': (on_value, on_error) => {
|
|
47
|
+
this.executer.execute(($) => {
|
|
48
|
+
processors.result($).__extract_data(on_value, on_error);
|
|
49
|
+
}, ($) => {
|
|
50
|
+
processors.error($).__extract_data(on_value, on_error);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
35
55
|
__start(on_value, on_error) {
|
|
36
56
|
this.executer.execute(on_value, on_error);
|
|
37
57
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _et from "exupery-core-types";
|
|
2
2
|
export * from "./types/Basic_Query";
|
|
3
3
|
export * from "./algorithms/query/create_query_promise";
|
|
4
|
+
export * from "./algorithms/query/create_query_primed_with_resources";
|
|
5
|
+
export * from "./algorithms/query/create_query";
|
|
4
6
|
export * from "./algorithms/procedure/create_procedure";
|
|
5
7
|
export * from "./algorithms/procedure/create_procedure_promise";
|
|
6
8
|
export * from "./algorithms/procedure/create_procedure_primed_with_resources";
|
|
@@ -20,5 +22,5 @@ export * from "./query/transform_query";
|
|
|
20
22
|
export * from "./query/query_dictionary";
|
|
21
23
|
export declare const query: {
|
|
22
24
|
'create result': <T, E>($: T) => _et.Query_Promise<T, E>;
|
|
23
|
-
'raise
|
|
25
|
+
'raise error': <T, E>($: E) => _et.Query_Promise<T, E>;
|
|
24
26
|
};
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,8 @@ exports.query = void 0;
|
|
|
19
19
|
__exportStar(require("./types/Basic_Query"), exports);
|
|
20
20
|
//functions
|
|
21
21
|
__exportStar(require("./algorithms/query/create_query_promise"), exports);
|
|
22
|
+
__exportStar(require("./algorithms/query/create_query_primed_with_resources"), exports);
|
|
23
|
+
__exportStar(require("./algorithms/query/create_query"), exports);
|
|
22
24
|
__exportStar(require("./algorithms/procedure/create_procedure"), exports);
|
|
23
25
|
__exportStar(require("./algorithms/procedure/create_procedure_promise"), exports);
|
|
24
26
|
__exportStar(require("./algorithms/procedure/create_procedure_primed_with_resources"), exports);
|
|
@@ -47,7 +49,7 @@ exports.query = {
|
|
|
47
49
|
}
|
|
48
50
|
});
|
|
49
51
|
},
|
|
50
|
-
'raise
|
|
52
|
+
'raise error': ($) => {
|
|
51
53
|
return (0, create_query_promise_1.__create_query_promise)({
|
|
52
54
|
'execute': (on_value, on_error) => {
|
|
53
55
|
on_error($);
|
package/dist/shorthands.d.ts
CHANGED
|
@@ -17,17 +17,17 @@ export declare namespace p {
|
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
19
|
* @param the_array up[]
|
|
20
|
-
* @param
|
|
20
|
+
* @param aggregate_errors gt
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
|
23
|
-
const array: <Error, Element_Error>(the_array: _et.Array<_et.Procedure_Promise<Element_Error>>,
|
|
23
|
+
const array: <Error, Element_Error>(the_array: _et.Array<_et.Procedure_Promise<Element_Error>>, aggregate_errors: _et.Transformer_Without_Parameters<_et.Array<Element_Error>, Error>) => _et.Procedure_Promise<Error>;
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
* @param the_dictionary dict<up>
|
|
27
|
-
* @param
|
|
27
|
+
* @param aggregate_errors gt
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
|
-
const dictionary: <Error, Element_Error>(the_dictionary: _et.Dictionary<_et.Procedure_Promise<Element_Error>>,
|
|
30
|
+
const dictionary: <Error, Element_Error>(the_dictionary: _et.Dictionary<_et.Procedure_Promise<Element_Error>>, aggregate_errors: _et.Transformer_Without_Parameters<_et.Dictionary<Element_Error>, Error>) => _et.Procedure_Promise<Error>;
|
|
31
31
|
}
|
|
32
32
|
export declare namespace q {
|
|
33
33
|
/**
|
package/dist/shorthands.js
CHANGED
|
@@ -71,29 +71,29 @@ var p;
|
|
|
71
71
|
/**
|
|
72
72
|
*
|
|
73
73
|
* @param the_array up[]
|
|
74
|
-
* @param
|
|
74
|
+
* @param aggregate_errors gt
|
|
75
75
|
* @returns
|
|
76
76
|
*/
|
|
77
|
-
p.array = (the_array,
|
|
77
|
+
p.array = (the_array, aggregate_errors) => {
|
|
78
78
|
return (0, create_procedure_promise_1.__create_procedure_promise)({
|
|
79
79
|
'execute': (on_success, on_error) => {
|
|
80
|
-
const
|
|
80
|
+
const errors = [];
|
|
81
81
|
(0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
|
|
82
82
|
the_array.map(($) => {
|
|
83
83
|
monitor['report process started']();
|
|
84
84
|
$.__start(() => {
|
|
85
85
|
monitor['report process finished']();
|
|
86
86
|
}, (e) => {
|
|
87
|
-
|
|
87
|
+
errors.push(e);
|
|
88
88
|
monitor['report process finished']();
|
|
89
89
|
});
|
|
90
90
|
});
|
|
91
91
|
}, () => {
|
|
92
|
-
if (
|
|
92
|
+
if (errors.length === 0) {
|
|
93
93
|
on_success();
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
on_error(
|
|
96
|
+
on_error(aggregate_errors(_ei.array_literal(errors)));
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -102,29 +102,29 @@ var p;
|
|
|
102
102
|
/**
|
|
103
103
|
*
|
|
104
104
|
* @param the_dictionary dict<up>
|
|
105
|
-
* @param
|
|
105
|
+
* @param aggregate_errors gt
|
|
106
106
|
* @returns
|
|
107
107
|
*/
|
|
108
|
-
p.dictionary = (the_dictionary,
|
|
108
|
+
p.dictionary = (the_dictionary, aggregate_errors) => {
|
|
109
109
|
return (0, create_procedure_promise_1.__create_procedure_promise)({
|
|
110
110
|
'execute': (on_success, on_error) => {
|
|
111
|
-
const
|
|
111
|
+
const errors = {};
|
|
112
112
|
(0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
|
|
113
113
|
the_dictionary.map(($, key) => {
|
|
114
114
|
monitor['report process started']();
|
|
115
115
|
$.__start(() => {
|
|
116
116
|
monitor['report process finished']();
|
|
117
117
|
}, (e) => {
|
|
118
|
-
|
|
118
|
+
errors[key] = e;
|
|
119
119
|
monitor['report process finished']();
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
}, () => {
|
|
123
|
-
if (Object.keys(
|
|
123
|
+
if (Object.keys(errors).length === 0) {
|
|
124
124
|
on_success();
|
|
125
125
|
}
|
|
126
126
|
else {
|
|
127
|
-
on_error(
|
|
127
|
+
on_error(aggregate_errors(_ei.dictionary_literal(errors)));
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}
|