exupery-core-async 0.1.26 → 0.1.28

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,5 +1,5 @@
1
1
  import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
2
- import { Ungaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
2
+ import { Unguaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
3
3
  /**
4
4
  * A value that will asynchronously become available.
5
5
  * Similar to the concept of a promise, but with a smaller API.
@@ -12,7 +12,7 @@ export interface Guaranteed_Query_Result<T> {
12
12
  */
13
13
  then<NT>(handle_value: ($: T) => Guaranteed_Query_Result<NT>): Guaranteed_Query_Result<NT>;
14
14
  process_guaranteed(handle_value: ($i: Guaranteed_Procedure_Context, $: T) => Guaranteed_Procedure_Context): Guaranteed_Procedure_Context;
15
- process_unguaranteed<E>(handle_value: ($i: Ungaranteed_Procedure_Context<E>, $: T) => Ungaranteed_Procedure_Context<E>): Ungaranteed_Procedure_Context<E>;
15
+ process_unguaranteed<E>(handle_value: ($i: Unguaranteed_Procedure_Context<E>, $: T) => Unguaranteed_Procedure_Context<E>): Unguaranteed_Procedure_Context<E>;
16
16
  /**
17
17
  * This method is only to be used by resources
18
18
  */
@@ -1,6 +1,6 @@
1
1
  import * as _et from 'exupery-core-types';
2
2
  import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
3
- export interface Ungaranteed_Procedure_Context<E> {
3
+ export interface Unguaranteed_Procedure_Context<E> {
4
4
  /**
5
5
  *
6
6
  * executes a command when an exception has occurred,
@@ -13,12 +13,13 @@ export interface Ungaranteed_Procedure_Context<E> {
13
13
  * note that this is different from `catch`,
14
14
  * which would switch to the guaranteed context
15
15
  */
16
- process_exception_deprecated<NE>(handle: ($i: Guaranteed_Procedure_Context, $: E) => Guaranteed_Procedure_Context, map: ($: E) => NE): Ungaranteed_Procedure_Context<NE>;
17
- throw_exception<E>($: E): Ungaranteed_Procedure_Context<E>;
16
+ process_exception_deprecated<NE>(handle: ($i: Guaranteed_Procedure_Context, $: E) => Guaranteed_Procedure_Context, map: ($: E) => NE): Unguaranteed_Procedure_Context<NE>;
17
+ throw_exception<E>($: E): Unguaranteed_Procedure_Context<E>;
18
18
  catch(handle_exception: ($i: Guaranteed_Procedure_Context, $: E) => Guaranteed_Procedure_Context): Guaranteed_Procedure_Context;
19
- execute_unguaranteed(handle: ($i: Ungaranteed_Procedure_Context<E>) => Ungaranteed_Procedure_Context<E>): Ungaranteed_Procedure_Context<E>;
20
- execute(handle: ($i: Guaranteed_Procedure_Context) => Guaranteed_Procedure_Context): Ungaranteed_Procedure_Context<E>;
21
- execute_dictionary_unguaranteed<E2>($: _et.Dictionary<Ungaranteed_Procedure_Context<E2>>, aggregate_exceptions: ($: _et.Dictionary<E2>) => E): Ungaranteed_Procedure_Context<E>;
22
- execute_multiple_unguaranteed<E2>($: _et.Array<Ungaranteed_Procedure_Context<E2>>, aggregate_exceptions: ($: _et.Array<E2>) => E): Ungaranteed_Procedure_Context<E>;
19
+ execute_unguaranteed(executer: ($i: Unguaranteed_Procedure_Context<E>) => Unguaranteed_Procedure_Context<E>): Unguaranteed_Procedure_Context<E>;
20
+ execute_foreign<NE>(executer: ($i: Unguaranteed_Procedure_Context<NE>) => Unguaranteed_Procedure_Context<NE>, handle_exception: ($i: Guaranteed_Procedure_Context, $: NE) => Guaranteed_Procedure_Context, map: ($: NE) => E): Unguaranteed_Procedure_Context<E>;
21
+ execute(executer: ($i: Guaranteed_Procedure_Context) => Guaranteed_Procedure_Context): Unguaranteed_Procedure_Context<E>;
22
+ execute_dictionary_unguaranteed<E2>($: _et.Dictionary<Unguaranteed_Procedure_Context<E2>>, aggregate_exceptions: ($: _et.Dictionary<E2>) => E): Unguaranteed_Procedure_Context<E>;
23
+ execute_multiple_unguaranteed<E2>($: _et.Array<Unguaranteed_Procedure_Context<E2>>, aggregate_exceptions: ($: _et.Array<E2>) => E): Unguaranteed_Procedure_Context<E>;
23
24
  __start(on_success: () => void, on_exception: ($: E) => void): void;
24
25
  }
@@ -1,6 +1,6 @@
1
1
  import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
2
2
  import { Guaranteed_Query_Result } from "./Guaranteed_Query_Result";
3
- import { Ungaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
3
+ import { Unguaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
4
4
  export interface Unguaranteed_Query_Result<T, E> {
5
5
  map<NT>(handle_value: ($: T) => NT): Unguaranteed_Query_Result<NT, E>;
6
6
  map_exception<NE>(handle_exception: ($: E) => NE): Unguaranteed_Query_Result<T, NE>;
@@ -19,6 +19,6 @@ export interface Unguaranteed_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: ($i: Guaranteed_Procedure_Context, $: E) => Guaranteed_Procedure_Context, map_exception: ($: E) => NE, handle_value: ($i: Ungaranteed_Procedure_Context<NE>, $: T) => Ungaranteed_Procedure_Context<NE>): Ungaranteed_Procedure_Context<NE>;
22
+ process<NE>(handle_exception: ($i: Guaranteed_Procedure_Context, $: E) => Guaranteed_Procedure_Context, map_exception: ($: E) => NE, handle_value: ($i: Unguaranteed_Procedure_Context<NE>, $: T) => Unguaranteed_Procedure_Context<NE>): Unguaranteed_Procedure_Context<NE>;
23
23
  __start(on_value: ($: T) => void, on_exception: ($: E) => void): void;
24
24
  }
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export * from "./run_unguaranteed_query";
8
8
  export * from "./initialize_guaranteed_procedure_context";
9
9
  export * from "./initialize_unguaranteed_procedure_context";
10
10
  import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
11
- import { Ungaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
11
+ import { Unguaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
12
12
  import { Guaranteed_Query_Result } from "./Guaranteed_Query_Result";
13
13
  import { Unguaranteed_Query_Result } from "./Unguaranteed_Query_Result";
14
14
  export declare const query: {
@@ -25,7 +25,7 @@ export declare const command: {
25
25
  initialize: () => Guaranteed_Procedure_Context;
26
26
  };
27
27
  unguaranteed: {
28
- initialize: <E>() => Ungaranteed_Procedure_Context<E>;
29
- 'raise exception': <E>($: E) => Ungaranteed_Procedure_Context<E>;
28
+ initialize: <E>() => Unguaranteed_Procedure_Context<E>;
29
+ 'raise exception': <E>($: E) => Unguaranteed_Procedure_Context<E>;
30
30
  };
31
31
  };
@@ -1,4 +1,4 @@
1
- import { Ungaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
1
+ import { Unguaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
2
2
  /**
3
3
  * this function contains the body in which the async value or exception is executed
4
4
  * after the execution, either the on_value or on_exception callback will be called
@@ -13,6 +13,6 @@ type Executer<E> = {
13
13
  * @param executer the function that produces the eventual value
14
14
  * @returns
15
15
  */
16
- export declare function __execute_unguaranteed_action<E>(executer: Executer<E>): Ungaranteed_Procedure_Context<E>;
17
- export declare const initialize_unguaranteed_procedure_context: <E>() => Ungaranteed_Procedure_Context<E>;
16
+ export declare function __execute_unguaranteed_action<E>(executer: Executer<E>): Unguaranteed_Procedure_Context<E>;
17
+ export declare const initialize_unguaranteed_procedure_context: <E>() => Unguaranteed_Procedure_Context<E>;
18
18
  export {};
@@ -68,6 +68,19 @@ class Unguaranteed_Command_Result_Class {
68
68
  }
69
69
  });
70
70
  }
71
+ execute_foreign(executer, handle_exception, map_exception) {
72
+ return new Unguaranteed_Command_Result_Class({
73
+ 'execute': (new_on_success, new_on_exception) => {
74
+ this.executer.execute(() => {
75
+ executer((0, exports.initialize_unguaranteed_procedure_context)()).__start(new_on_success, ($) => {
76
+ handle_exception((0, initialize_guaranteed_procedure_context_1.initialize_guaranteed_procedure_context)(), $).__start(() => {
77
+ new_on_exception(map_exception($));
78
+ });
79
+ });
80
+ }, new_on_exception);
81
+ }
82
+ });
83
+ }
71
84
  execute(handle) {
72
85
  return new Unguaranteed_Command_Result_Class({
73
86
  'execute': (new_on_success, new_on_exception) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-async",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "async types for Exupery",