exupery-core-async 0.1.22 → 0.1.24

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,4 +1,4 @@
1
1
  export interface Safe_Command_Result {
2
- then(handle: (init: Safe_Command_Result) => Safe_Command_Result): Safe_Command_Result;
2
+ execute(handle: ($i: Safe_Command_Result) => Safe_Command_Result): Safe_Command_Result;
3
3
  __start(on_finished: () => void): void;
4
4
  }
@@ -11,8 +11,8 @@ export interface Safe_Query_Result<T> {
11
11
  * @param handle_value callback that transforms the actual value into a new Async_Value
12
12
  */
13
13
  then<NT>(handle_value: ($: T) => Safe_Query_Result<NT>): Safe_Query_Result<NT>;
14
- process_safe(handle_value: ($: T, init: Safe_Command_Result) => Safe_Command_Result): Safe_Command_Result;
15
- process_unsafe<E>(handle_value: ($: T, init: Unsafe_Command_Result<E>) => Unsafe_Command_Result<E>): Unsafe_Command_Result<E>;
14
+ process_safe(handle_value: ($i: Safe_Command_Result, $: T) => Safe_Command_Result): Safe_Command_Result;
15
+ process_unsafe<E>(handle_value: ($i: Unsafe_Command_Result<E>, $: T) => Unsafe_Command_Result<E>): Unsafe_Command_Result<E>;
16
16
  /**
17
17
  * This method is only to be used by resources
18
18
  */
@@ -13,12 +13,12 @@ export interface Unsafe_Command_Result<E> {
13
13
  * note that this is different from `catch`,
14
14
  * which would switch to the safe context
15
15
  */
16
- process_exception<NE>(handle: ($: E, init: Safe_Command_Result) => Safe_Command_Result, map: ($: E) => NE): Unsafe_Command_Result<NE>;
16
+ process_exception<NE>(handle: ($i: Safe_Command_Result, $: E) => Safe_Command_Result, map: ($: E) => NE): Unsafe_Command_Result<NE>;
17
17
  throw_exception<E>($: E): Unsafe_Command_Result<E>;
18
- catch(handle_exception: ($: E, init: Safe_Command_Result) => Safe_Command_Result): Safe_Command_Result;
19
- then(handle: (init: Unsafe_Command_Result<E>) => Unsafe_Command_Result<E>): Unsafe_Command_Result<E>;
20
- then_safe(handle: (init: Safe_Command_Result) => Safe_Command_Result): Unsafe_Command_Result<E>;
21
- then_dictionary<E2>($: _et.Dictionary<Unsafe_Command_Result<E2>>, aggregate_exceptions: ($: _et.Dictionary<E2>) => E): Unsafe_Command_Result<E>;
22
- then_multiple<E2>($: _et.Array<Unsafe_Command_Result<E2>>, aggregate_exceptions: ($: _et.Array<E2>) => E): Unsafe_Command_Result<E>;
18
+ catch(handle_exception: ($i: Safe_Command_Result, $: E) => Safe_Command_Result): Safe_Command_Result;
19
+ execute_unsafe(handle: ($i: Unsafe_Command_Result<E>) => Unsafe_Command_Result<E>): Unsafe_Command_Result<E>;
20
+ execute(handle: ($i: Safe_Command_Result) => Safe_Command_Result): Unsafe_Command_Result<E>;
21
+ execute_dictionary_unsafe<E2>($: _et.Dictionary<Unsafe_Command_Result<E2>>, aggregate_exceptions: ($: _et.Dictionary<E2>) => E): Unsafe_Command_Result<E>;
22
+ execute_multiple_unsafe<E2>($: _et.Array<Unsafe_Command_Result<E2>>, aggregate_exceptions: ($: _et.Array<E2>) => E): Unsafe_Command_Result<E>;
23
23
  __start(on_success: () => void, on_exception: ($: E) => void): void;
24
24
  }
@@ -19,6 +19,6 @@ export interface Unsafe_Query_Result<T, E> {
19
19
  * @param map_exception the handler that will map the exception of the query into a new exception value of the command's exception type
20
20
  *
21
21
  */
22
- process<NE>(handle_exception: ($: E, init: Safe_Command_Result) => Safe_Command_Result, map_exception: ($: E) => NE, handle_value: ($: T, init: Unsafe_Command_Result<NE>) => Unsafe_Command_Result<NE>): Unsafe_Command_Result<NE>;
22
+ process<NE>(handle_exception: ($i: Safe_Command_Result, $: E) => Safe_Command_Result, map_exception: ($: E) => NE, handle_value: ($i: Unsafe_Command_Result<NE>, $: T) => Unsafe_Command_Result<NE>): Unsafe_Command_Result<NE>;
23
23
  __start(on_value: ($: T) => void, on_exception: ($: E) => void): void;
24
24
  }
@@ -6,7 +6,7 @@ class Safe_Command_Result_Class {
6
6
  constructor(executer) {
7
7
  this.executer = executer;
8
8
  }
9
- then(handle) {
9
+ execute(handle) {
10
10
  return __execute_safe_command({
11
11
  'execute': (on_finished) => {
12
12
  this.executer.execute(() => {
@@ -36,7 +36,7 @@ class Unsafe_Command_Result_Class {
36
36
  return new Unsafe_Command_Result_Class({
37
37
  'execute': (new_on_success, new_on_exception) => {
38
38
  this.executer.execute(new_on_success, ($) => {
39
- handle($, (0, execute_safe_command_1.initialize_safe_command)()).__start(() => new_on_exception(map($)));
39
+ handle((0, execute_safe_command_1.initialize_safe_command)(), $).__start(() => new_on_exception(map($)));
40
40
  });
41
41
  }
42
42
  });
@@ -45,7 +45,7 @@ class Unsafe_Command_Result_Class {
45
45
  return (0, execute_safe_command_1.__execute_safe_command)({
46
46
  'execute': (new_on_success) => {
47
47
  this.executer.execute(new_on_success, ($) => {
48
- handle_exception($, (0, execute_safe_command_1.initialize_safe_command)()).__start(new_on_success);
48
+ handle_exception((0, execute_safe_command_1.initialize_safe_command)(), $).__start(new_on_success);
49
49
  });
50
50
  }
51
51
  });
@@ -59,7 +59,7 @@ class Unsafe_Command_Result_Class {
59
59
  }
60
60
  });
61
61
  }
62
- then(handle) {
62
+ execute_unsafe(handle) {
63
63
  return new Unsafe_Command_Result_Class({
64
64
  'execute': (new_on_success, new_on_exception) => {
65
65
  this.executer.execute(() => {
@@ -68,7 +68,7 @@ class Unsafe_Command_Result_Class {
68
68
  }
69
69
  });
70
70
  }
71
- then_safe(handle) {
71
+ execute(handle) {
72
72
  return new Unsafe_Command_Result_Class({
73
73
  'execute': (new_on_success, new_on_exception) => {
74
74
  this.executer.execute(() => {
@@ -77,7 +77,7 @@ class Unsafe_Command_Result_Class {
77
77
  }
78
78
  });
79
79
  }
80
- then_dictionary($, aggregate_exceptions) {
80
+ execute_dictionary_unsafe($, aggregate_exceptions) {
81
81
  let exceptions = {};
82
82
  return __execute_unsafe_command({
83
83
  'execute': (on_success, on_exception) => {
@@ -102,7 +102,7 @@ class Unsafe_Command_Result_Class {
102
102
  }
103
103
  });
104
104
  }
105
- then_multiple($, aggregate_exceptions) {
105
+ execute_multiple_unsafe($, aggregate_exceptions) {
106
106
  let exceptions = [];
107
107
  return __execute_unsafe_command({
108
108
  'execute': (on_success, on_exception) => {
@@ -29,7 +29,7 @@ class Safe_Query_Result_Class {
29
29
  return (0, execute_safe_command_1.__execute_safe_command)({
30
30
  'execute': (on_success) => {
31
31
  this.executer.execute((value) => {
32
- handle_value(value, (0, execute_safe_command_1.initialize_safe_command)()).__start(on_success);
32
+ handle_value((0, execute_safe_command_1.initialize_safe_command)(), value).__start(on_success);
33
33
  });
34
34
  }
35
35
  });
@@ -38,7 +38,7 @@ class Safe_Query_Result_Class {
38
38
  return (0, execute_unsafe_command_1.__execute_unsafe_command)({
39
39
  'execute': (on_success, on_exception) => {
40
40
  this.executer.execute((value) => {
41
- handle_value(value, (0, execute_unsafe_command_1.initialize_unsafe_command)()).__start(on_success, on_exception);
41
+ handle_value((0, execute_unsafe_command_1.initialize_unsafe_command)(), value).__start(on_success, on_exception);
42
42
  });
43
43
  }
44
44
  });
@@ -48,9 +48,9 @@ class Unsafe_Query_Result_Class {
48
48
  return (0, execute_unsafe_command_1.__execute_unsafe_command)({
49
49
  'execute': (on_success, on_exception) => {
50
50
  this.executer.execute((value) => {
51
- handle_value(value, (0, execute_unsafe_command_1.initialize_unsafe_command)()).__start(on_success, on_exception);
51
+ handle_value((0, execute_unsafe_command_1.initialize_unsafe_command)(), value).__start(on_success, on_exception);
52
52
  }, (exception) => {
53
- handle_exception(exception, (0, execute_safe_command_1.initialize_safe_command)()).__start(() => on_exception(map_exception(exception)));
53
+ handle_exception((0, execute_safe_command_1.initialize_safe_command)(), exception).__start(() => on_exception(map_exception(exception)));
54
54
  });
55
55
  }
56
56
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-async",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "async types for Exupery",