exupery-core-async 0.1.9 → 0.1.10

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,7 @@
1
+ import { Unsafe_Command_Result } from "./Unsafe_Command_Result";
1
2
  export interface Safe_Command_Result {
2
3
  then(handle: () => Safe_Command_Result): Safe_Command_Result;
4
+ cast_to_unsafe<E>(): Unsafe_Command_Result<E>;
5
+ throw_exception<E>($: E): Unsafe_Command_Result<E>;
3
6
  __start(on_finished: () => void): void;
4
7
  }
@@ -1,4 +1,5 @@
1
1
  import { Safe_Query_Result } from "./Safe_Query_Result";
2
+ import { Unsafe_Command_Result } from "./Unsafe_Command_Result";
2
3
  export interface Unsafe_Query_Result<T, E> {
3
4
  map<NT>(handle_value: ($: T) => NT): Unsafe_Query_Result<NT, E>;
4
5
  map_exception<NE>(handle_exception: ($: E) => NE): Unsafe_Query_Result<T, NE>;
@@ -6,5 +7,6 @@ export interface Unsafe_Query_Result<T, E> {
6
7
  if_exception_then<NE>(handle_exception: ($: E) => Unsafe_Query_Result<T, NE>): Unsafe_Query_Result<T, NE>;
7
8
  catch(handle_exception: ($: E) => T): Safe_Query_Result<T>;
8
9
  catch_and_map<NT>(handle_value: ($: T) => NT, handle_exception: ($: E) => NT): Safe_Query_Result<NT>;
10
+ execute_unsafe_command(handle_value: ($: T) => Unsafe_Command_Result<E>): Unsafe_Command_Result<E>;
9
11
  __start(on_value: ($: T) => void, on_exception: ($: E) => void): void;
10
12
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.__execute_safe_command = __execute_safe_command;
4
+ const execute_unsafe_command_1 = require("./execute_unsafe_command");
4
5
  class Safe_Command_Result_Class {
5
6
  constructor(executer) {
6
7
  this.executer = executer;
@@ -14,6 +15,24 @@ class Safe_Command_Result_Class {
14
15
  }
15
16
  });
16
17
  }
18
+ cast_to_unsafe() {
19
+ return (0, execute_unsafe_command_1.__execute_unsafe_command)({
20
+ 'execute': (on_finished) => {
21
+ this.executer.execute(() => {
22
+ on_finished();
23
+ });
24
+ }
25
+ });
26
+ }
27
+ throw_exception($) {
28
+ return (0, execute_unsafe_command_1.__execute_unsafe_command)({
29
+ 'execute': (on_finished, on_exception) => {
30
+ this.executer.execute(() => {
31
+ on_exception($);
32
+ });
33
+ }
34
+ });
35
+ }
17
36
  __start(on_finished) {
18
37
  this.executer.execute(on_finished);
19
38
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.__run_unsafe_query = __run_unsafe_query;
4
4
  const run_safe_query_1 = require("./run_safe_query");
5
+ const execute_unsafe_command_1 = require("./execute_unsafe_command");
5
6
  class Unsafe_Query_Result_Class {
6
7
  constructor(executer) {
7
8
  this.executer = executer;
@@ -62,6 +63,15 @@ class Unsafe_Query_Result_Class {
62
63
  }
63
64
  });
64
65
  }
66
+ execute_unsafe_command(handle_value) {
67
+ return (0, execute_unsafe_command_1.__execute_unsafe_command)({
68
+ 'execute': (on_success, on_exception) => {
69
+ this.executer.execute((value) => {
70
+ handle_value(value).__start(on_success, on_exception);
71
+ }, on_exception);
72
+ }
73
+ });
74
+ }
65
75
  __start(on_value, on_exception) {
66
76
  this.executer.execute(on_value, on_exception);
67
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-async",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "async types for Exupery",