exupery-core-async 0.1.10 → 0.1.11
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
+
import { Safe_Command_Result } from "./Safe_Command_Result";
|
|
2
3
|
export interface Unsafe_Command_Result<E> {
|
|
3
4
|
map_exception<NE>(handle_exception: ($: E) => NE): Unsafe_Command_Result<NE>;
|
|
4
|
-
|
|
5
|
+
catch<NE>(handle_exception: ($: E) => Safe_Command_Result): Safe_Command_Result;
|
|
5
6
|
then(handle: () => Unsafe_Command_Result<E>): Unsafe_Command_Result<E>;
|
|
6
|
-
|
|
7
|
+
then_dictionary<E2>($: _et.Dictionary<Unsafe_Command_Result<E2>>, aggregate_exceptions: ($: _et.Dictionary<E2>) => E): Unsafe_Command_Result<E>;
|
|
7
8
|
__start(on_success: () => void, on_exception: ($: E) => void): void;
|
|
8
9
|
}
|
|
@@ -4,9 +4,7 @@ export interface Unsafe_Query_Result<T, E> {
|
|
|
4
4
|
map<NT>(handle_value: ($: T) => NT): Unsafe_Query_Result<NT, E>;
|
|
5
5
|
map_exception<NE>(handle_exception: ($: E) => NE): Unsafe_Query_Result<T, NE>;
|
|
6
6
|
then<NT>(handle_value: ($: T) => Unsafe_Query_Result<NT, E>): Unsafe_Query_Result<NT, E>;
|
|
7
|
-
if_exception_then<NE>(handle_exception: ($: E) => Unsafe_Query_Result<T, NE>): Unsafe_Query_Result<T, NE>;
|
|
8
7
|
catch(handle_exception: ($: E) => T): Safe_Query_Result<T>;
|
|
9
|
-
catch_and_map<NT>(handle_value: ($: T) => NT, handle_exception: ($: E) => NT): Safe_Query_Result<NT>;
|
|
10
8
|
execute_unsafe_command(handle_value: ($: T) => Unsafe_Command_Result<E>): Unsafe_Command_Result<E>;
|
|
11
9
|
__start(on_value: ($: T) => void, on_exception: ($: E) => void): void;
|
|
12
10
|
}
|
|
@@ -31,20 +31,11 @@ class Unsafe_Command_Result_Class {
|
|
|
31
31
|
constructor(executer) {
|
|
32
32
|
this.executer = executer;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
'execute': (new_on_success
|
|
37
|
-
this.executer.execute(() => {
|
|
38
|
-
handle().__start(new_on_success, new_on_exception);
|
|
39
|
-
}, new_on_exception);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
if_exception_then(handle_exception) {
|
|
44
|
-
return new Unsafe_Command_Result_Class({
|
|
45
|
-
'execute': (new_on_success, new_on_exception) => {
|
|
34
|
+
catch(handle_exception) {
|
|
35
|
+
return (0, execute_safe_command_1.__execute_safe_command)({
|
|
36
|
+
'execute': (new_on_success) => {
|
|
46
37
|
this.executer.execute(new_on_success, ($) => {
|
|
47
|
-
handle_exception($).__start(new_on_success
|
|
38
|
+
handle_exception($).__start(new_on_success);
|
|
48
39
|
});
|
|
49
40
|
}
|
|
50
41
|
});
|
|
@@ -58,7 +49,16 @@ class Unsafe_Command_Result_Class {
|
|
|
58
49
|
}
|
|
59
50
|
});
|
|
60
51
|
}
|
|
61
|
-
|
|
52
|
+
then(handle) {
|
|
53
|
+
return new Unsafe_Command_Result_Class({
|
|
54
|
+
'execute': (new_on_success, new_on_exception) => {
|
|
55
|
+
this.executer.execute(() => {
|
|
56
|
+
handle().__start(new_on_success, new_on_exception);
|
|
57
|
+
}, new_on_exception);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
then_dictionary($, aggregate_exceptions) {
|
|
62
62
|
let exceptions = {};
|
|
63
63
|
return __execute_unsafe_command({
|
|
64
64
|
'execute': (on_success, on_exception) => {
|
|
@@ -83,16 +83,6 @@ class Unsafe_Command_Result_Class {
|
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
catch(handle_exception) {
|
|
87
|
-
return (0, execute_safe_command_1.__execute_safe_command)({
|
|
88
|
-
'execute': (on_success) => {
|
|
89
|
-
this.executer.execute(on_success, ($) => {
|
|
90
|
-
handle_exception($);
|
|
91
|
-
on_success();
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
86
|
__start(on_success, on_exception) {
|
|
97
87
|
this.executer.execute(on_success, on_exception);
|
|
98
88
|
}
|
package/dist/run_unsafe_query.js
CHANGED
|
@@ -25,15 +25,6 @@ class Unsafe_Query_Result_Class {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
if_exception_then(handle_exception) {
|
|
29
|
-
return new Unsafe_Query_Result_Class({
|
|
30
|
-
'execute': (new_on_value, new_on_exception) => {
|
|
31
|
-
this.executer.execute(new_on_value, ($) => {
|
|
32
|
-
handle_exception($).__start(new_on_value, new_on_exception);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
28
|
map_exception(handle_exception) {
|
|
38
29
|
return new Unsafe_Query_Result_Class({
|
|
39
30
|
'execute': (on_value, on_exception) => {
|
|
@@ -52,17 +43,6 @@ class Unsafe_Query_Result_Class {
|
|
|
52
43
|
}
|
|
53
44
|
});
|
|
54
45
|
}
|
|
55
|
-
catch_and_map(handle_value, handle_exception) {
|
|
56
|
-
return (0, run_safe_query_1.__run_safe_query)({
|
|
57
|
-
'execute': (on_value) => {
|
|
58
|
-
this.executer.execute(($) => {
|
|
59
|
-
on_value(handle_value($));
|
|
60
|
-
}, ($) => {
|
|
61
|
-
on_value(handle_exception($));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
46
|
execute_unsafe_command(handle_value) {
|
|
67
47
|
return (0, execute_unsafe_command_1.__execute_unsafe_command)({
|
|
68
48
|
'execute': (on_success, on_exception) => {
|