exupery-core-async 0.1.25 → 0.1.26

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.
Files changed (26) hide show
  1. package/dist/Guaranteed_Procedure_Context.d.ts +4 -0
  2. package/dist/Guaranteed_Query_Result.d.ts +20 -0
  3. package/dist/Unguaranteed_Procedure_Context.d.ts +24 -0
  4. package/dist/{Unsafe_Query_Result.d.ts → Unguaranteed_Query_Result.d.ts} +9 -9
  5. package/dist/index.d.ts +23 -23
  6. package/dist/index.js +23 -23
  7. package/dist/initialize_guaranteed_procedure_context.d.ts +12 -0
  8. package/dist/{initialize_safe_procedure_context.js → initialize_guaranteed_procedure_context.js} +10 -10
  9. package/dist/{initialize_unsafe_procedure_context.d.ts → initialize_unguaranteed_procedure_context.d.ts} +3 -3
  10. package/dist/{initialize_unsafe_procedure_context.js → initialize_unguaranteed_procedure_context.js} +24 -24
  11. package/dist/merge_2_guaranteed_query_results.d.ts +6 -0
  12. package/dist/{merge_2_safe_query_results.js → merge_2_guaranteed_query_results.js} +4 -4
  13. package/dist/{run_safe_query.d.ts → run_guaranteed_query.d.ts} +2 -2
  14. package/dist/{run_safe_query.js → run_guaranteed_query.js} +14 -14
  15. package/dist/{run_unsafe_query.d.ts → run_unguaranteed_query.d.ts} +2 -2
  16. package/dist/{run_unsafe_query.js → run_unguaranteed_query.js} +14 -14
  17. package/package.json +1 -1
  18. package/dist/Safe_Procedure_Context.d.ts +0 -4
  19. package/dist/Safe_Query_Result.d.ts +0 -20
  20. package/dist/Unsafe_Procedure_Context.d.ts +0 -24
  21. package/dist/initialize_safe_procedure_context.d.ts +0 -12
  22. package/dist/merge_2_safe_query_results.d.ts +0 -6
  23. /package/dist/{Safe_Procedure_Context.js → Guaranteed_Procedure_Context.js} +0 -0
  24. /package/dist/{Safe_Query_Result.js → Guaranteed_Query_Result.js} +0 -0
  25. /package/dist/{Unsafe_Procedure_Context.js → Unguaranteed_Procedure_Context.js} +0 -0
  26. /package/dist/{Unsafe_Query_Result.js → Unguaranteed_Query_Result.js} +0 -0
@@ -0,0 +1,4 @@
1
+ export interface Guaranteed_Procedure_Context {
2
+ execute(handle: ($i: Guaranteed_Procedure_Context) => Guaranteed_Procedure_Context): Guaranteed_Procedure_Context;
3
+ __start(on_finished: () => void): void;
4
+ }
@@ -0,0 +1,20 @@
1
+ import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
2
+ import { Ungaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
3
+ /**
4
+ * A value that will asynchronously become available.
5
+ * Similar to the concept of a promise, but with a smaller API.
6
+ */
7
+ export interface Guaranteed_Query_Result<T> {
8
+ map<NT>(handle_value: ($: T) => NT): Guaranteed_Query_Result<NT>;
9
+ /**
10
+ * maps the current async value into a new async value
11
+ * @param handle_value callback that transforms the actual value into a new Async_Value
12
+ */
13
+ then<NT>(handle_value: ($: T) => Guaranteed_Query_Result<NT>): Guaranteed_Query_Result<NT>;
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>;
16
+ /**
17
+ * This method is only to be used by resources
18
+ */
19
+ __start(on_value: ($: T) => void): void;
20
+ }
@@ -0,0 +1,24 @@
1
+ import * as _et from 'exupery-core-types';
2
+ import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
3
+ export interface Ungaranteed_Procedure_Context<E> {
4
+ /**
5
+ *
6
+ * executes a command when an exception has occurred,
7
+ * but stays in the ungaranteed context
8
+ *
9
+ * this is useful when you want to do some cleanup
10
+ * or logging in case of an exception,
11
+ * but still want to propagate the exception further
12
+ *
13
+ * note that this is different from `catch`,
14
+ * which would switch to the guaranteed context
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>;
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>;
23
+ __start(on_success: () => void, on_exception: ($: E) => void): void;
24
+ }
@@ -1,11 +1,11 @@
1
- import { Safe_Procedure_Context } from "./Safe_Procedure_Context";
2
- import { Safe_Query_Result } from "./Safe_Query_Result";
3
- import { Unsafe_Procedure_Context } from "./Unsafe_Procedure_Context";
4
- export interface Unsafe_Query_Result<T, E> {
5
- map<NT>(handle_value: ($: T) => NT): Unsafe_Query_Result<NT, E>;
6
- map_exception<NE>(handle_exception: ($: E) => NE): Unsafe_Query_Result<T, NE>;
7
- then<NT>(handle_value: ($: T) => Unsafe_Query_Result<NT, E>): Unsafe_Query_Result<NT, E>;
8
- catch(handle_exception: ($: E) => Safe_Query_Result<T>): Safe_Query_Result<T>;
1
+ import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
2
+ import { Guaranteed_Query_Result } from "./Guaranteed_Query_Result";
3
+ import { Ungaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
4
+ export interface Unguaranteed_Query_Result<T, E> {
5
+ map<NT>(handle_value: ($: T) => NT): Unguaranteed_Query_Result<NT, E>;
6
+ map_exception<NE>(handle_exception: ($: E) => NE): Unguaranteed_Query_Result<T, NE>;
7
+ then<NT>(handle_value: ($: T) => Unguaranteed_Query_Result<NT, E>): Unguaranteed_Query_Result<NT, E>;
8
+ catch(handle_exception: ($: E) => Guaranteed_Query_Result<T>): Guaranteed_Query_Result<T>;
9
9
  /**
10
10
  * processes the queried data by executing a command.
11
11
  *
@@ -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: ($i: Safe_Procedure_Context, $: E) => Safe_Procedure_Context, map_exception: ($: E) => NE, handle_value: ($i: Unsafe_Procedure_Context<NE>, $: T) => Unsafe_Procedure_Context<NE>): Unsafe_Procedure_Context<NE>;
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>;
23
23
  __start(on_value: ($: T) => void, on_exception: ($: E) => void): void;
24
24
  }
package/dist/index.d.ts CHANGED
@@ -1,31 +1,31 @@
1
- export * from "./Safe_Procedure_Context";
2
- export * from "./Unsafe_Procedure_Context";
3
- export * from "./Safe_Query_Result";
4
- export * from "./Unsafe_Query_Result";
5
- export * from "./merge_2_safe_query_results";
6
- export * from "./run_safe_query";
7
- export * from "./run_unsafe_query";
8
- export * from "./initialize_safe_procedure_context";
9
- export * from "./initialize_unsafe_procedure_context";
10
- import { Safe_Procedure_Context } from "./Safe_Procedure_Context";
11
- import { Unsafe_Procedure_Context } from "./Unsafe_Procedure_Context";
12
- import { Safe_Query_Result } from "./Safe_Query_Result";
13
- import { Unsafe_Query_Result } from "./Unsafe_Query_Result";
1
+ export * from "./Guaranteed_Procedure_Context";
2
+ export * from "./Unguaranteed_Procedure_Context";
3
+ export * from "./Guaranteed_Query_Result";
4
+ export * from "./Unguaranteed_Query_Result";
5
+ export * from "./merge_2_guaranteed_query_results";
6
+ export * from "./run_guaranteed_query";
7
+ export * from "./run_unguaranteed_query";
8
+ export * from "./initialize_guaranteed_procedure_context";
9
+ export * from "./initialize_unguaranteed_procedure_context";
10
+ import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
11
+ import { Ungaranteed_Procedure_Context } from "./Unguaranteed_Procedure_Context";
12
+ import { Guaranteed_Query_Result } from "./Guaranteed_Query_Result";
13
+ import { Unguaranteed_Query_Result } from "./Unguaranteed_Query_Result";
14
14
  export declare const query: {
15
- safe: {
16
- 'create result': <T>($: T) => Safe_Query_Result<T>;
15
+ guaranteed: {
16
+ 'create result': <T>($: T) => Guaranteed_Query_Result<T>;
17
17
  };
18
- unsafe: {
19
- 'create result': <T, E>($: T) => Unsafe_Query_Result<T, E>;
20
- 'raise exception': <T, E>($: E) => Unsafe_Query_Result<T, E>;
18
+ unguaranteed: {
19
+ 'create result': <T, E>($: T) => Unguaranteed_Query_Result<T, E>;
20
+ 'raise exception': <T, E>($: E) => Unguaranteed_Query_Result<T, E>;
21
21
  };
22
22
  };
23
23
  export declare const command: {
24
- safe: {
25
- initialize: () => Safe_Procedure_Context;
24
+ guaranteed: {
25
+ initialize: () => Guaranteed_Procedure_Context;
26
26
  };
27
- unsafe: {
28
- initialize: <E>() => Unsafe_Procedure_Context<E>;
29
- 'raise exception': <E>($: E) => Unsafe_Procedure_Context<E>;
27
+ unguaranteed: {
28
+ initialize: <E>() => Ungaranteed_Procedure_Context<E>;
29
+ 'raise exception': <E>($: E) => Ungaranteed_Procedure_Context<E>;
30
30
  };
31
31
  };
package/dist/index.js CHANGED
@@ -15,39 +15,39 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.command = exports.query = void 0;
18
- __exportStar(require("./Safe_Procedure_Context"), exports);
19
- __exportStar(require("./Unsafe_Procedure_Context"), exports);
20
- __exportStar(require("./Safe_Query_Result"), exports);
21
- __exportStar(require("./Unsafe_Query_Result"), exports);
22
- __exportStar(require("./merge_2_safe_query_results"), exports);
23
- __exportStar(require("./run_safe_query"), exports);
24
- __exportStar(require("./run_unsafe_query"), exports);
25
- __exportStar(require("./initialize_safe_procedure_context"), exports);
26
- __exportStar(require("./initialize_unsafe_procedure_context"), exports);
27
- const initialize_safe_procedure_context_1 = require("./initialize_safe_procedure_context");
28
- const initialize_unsafe_procedure_context_1 = require("./initialize_unsafe_procedure_context");
29
- const run_safe_query_1 = require("./run_safe_query");
30
- const run_unsafe_query_1 = require("./run_unsafe_query");
18
+ __exportStar(require("./Guaranteed_Procedure_Context"), exports);
19
+ __exportStar(require("./Unguaranteed_Procedure_Context"), exports);
20
+ __exportStar(require("./Guaranteed_Query_Result"), exports);
21
+ __exportStar(require("./Unguaranteed_Query_Result"), exports);
22
+ __exportStar(require("./merge_2_guaranteed_query_results"), exports);
23
+ __exportStar(require("./run_guaranteed_query"), exports);
24
+ __exportStar(require("./run_unguaranteed_query"), exports);
25
+ __exportStar(require("./initialize_guaranteed_procedure_context"), exports);
26
+ __exportStar(require("./initialize_unguaranteed_procedure_context"), exports);
27
+ const initialize_guaranteed_procedure_context_1 = require("./initialize_guaranteed_procedure_context");
28
+ const initialize_unguaranteed_procedure_context_1 = require("./initialize_unguaranteed_procedure_context");
29
+ const run_guaranteed_query_1 = require("./run_guaranteed_query");
30
+ const run_unguaranteed_query_1 = require("./run_unguaranteed_query");
31
31
  exports.query = {
32
- 'safe': {
32
+ 'guaranteed': {
33
33
  'create result': ($) => {
34
- return (0, run_safe_query_1.__run_safe_query)({
34
+ return (0, run_guaranteed_query_1.__run_guaranteed_query)({
35
35
  'execute': (on_value) => {
36
36
  on_value($);
37
37
  }
38
38
  });
39
39
  }
40
40
  },
41
- 'unsafe': {
41
+ 'unguaranteed': {
42
42
  'create result': ($) => {
43
- return (0, run_unsafe_query_1.__run_unsafe_query)({
43
+ return (0, run_unguaranteed_query_1.__run_unguaranteed_query)({
44
44
  'execute': (on_value) => {
45
45
  on_value($);
46
46
  }
47
47
  });
48
48
  },
49
49
  'raise exception': ($) => {
50
- return (0, run_unsafe_query_1.__run_unsafe_query)({
50
+ return (0, run_unguaranteed_query_1.__run_unguaranteed_query)({
51
51
  'execute': (on_value, on_exception) => {
52
52
  on_exception($);
53
53
  }
@@ -56,13 +56,13 @@ exports.query = {
56
56
  },
57
57
  };
58
58
  exports.command = {
59
- 'safe': {
60
- 'initialize': initialize_safe_procedure_context_1.initialize_safe_procedure_context
59
+ 'guaranteed': {
60
+ 'initialize': initialize_guaranteed_procedure_context_1.initialize_guaranteed_procedure_context
61
61
  },
62
- 'unsafe': {
63
- 'initialize': initialize_unsafe_procedure_context_1.initialize_unsafe_procedure_context,
62
+ 'unguaranteed': {
63
+ 'initialize': initialize_unguaranteed_procedure_context_1.initialize_unguaranteed_procedure_context,
64
64
  'raise exception': ($) => {
65
- return (0, initialize_unsafe_procedure_context_1.__execute_unsafe_action)({
65
+ return (0, initialize_unguaranteed_procedure_context_1.__execute_unguaranteed_action)({
66
66
  'execute': (on_success, on_exception) => {
67
67
  on_exception($);
68
68
  }
@@ -0,0 +1,12 @@
1
+ import { Guaranteed_Procedure_Context } from "./Guaranteed_Procedure_Context";
2
+ type Executer = {
3
+ 'execute': (on_finished: () => void) => void;
4
+ };
5
+ /**
6
+ * returns an {@link Async_Value }
7
+ * @param executer the function that produces the eventual value
8
+ * @returns
9
+ */
10
+ export declare function __execute_guaranteed_action(executer: Executer): Guaranteed_Procedure_Context;
11
+ export declare const initialize_guaranteed_procedure_context: () => Guaranteed_Procedure_Context;
12
+ export {};
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initialize_safe_procedure_context = void 0;
4
- exports.__execute_safe_action = __execute_safe_action;
5
- class Safe_Command_Result_Class {
3
+ exports.initialize_guaranteed_procedure_context = void 0;
4
+ exports.__execute_guaranteed_action = __execute_guaranteed_action;
5
+ class Guaranteed_Procedure_Context_Class {
6
6
  constructor(executer) {
7
7
  this.executer = executer;
8
8
  }
9
9
  execute(handle) {
10
- return __execute_safe_action({
10
+ return __execute_guaranteed_action({
11
11
  'execute': (on_finished) => {
12
12
  this.executer.execute(() => {
13
- handle((0, exports.initialize_safe_procedure_context)()).__start(on_finished);
13
+ handle((0, exports.initialize_guaranteed_procedure_context)()).__start(on_finished);
14
14
  });
15
15
  }
16
16
  });
@@ -24,14 +24,14 @@ class Safe_Command_Result_Class {
24
24
  * @param executer the function that produces the eventual value
25
25
  * @returns
26
26
  */
27
- function __execute_safe_action(executer) {
28
- return new Safe_Command_Result_Class(executer);
27
+ function __execute_guaranteed_action(executer) {
28
+ return new Guaranteed_Procedure_Context_Class(executer);
29
29
  }
30
- const initialize_safe_procedure_context = () => {
31
- return new Safe_Command_Result_Class({
30
+ const initialize_guaranteed_procedure_context = () => {
31
+ return new Guaranteed_Procedure_Context_Class({
32
32
  'execute': (on_finished) => {
33
33
  on_finished(); //nothing to do, call on_finished immediately
34
34
  }
35
35
  });
36
36
  };
37
- exports.initialize_safe_procedure_context = initialize_safe_procedure_context;
37
+ exports.initialize_guaranteed_procedure_context = initialize_guaranteed_procedure_context;
@@ -1,4 +1,4 @@
1
- import { Unsafe_Procedure_Context } from "./Unsafe_Procedure_Context";
1
+ import { Ungaranteed_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_unsafe_action<E>(executer: Executer<E>): Unsafe_Procedure_Context<E>;
17
- export declare const initialize_unsafe_procedure_context: <E>() => Unsafe_Procedure_Context<E>;
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>;
18
18
  export {};
@@ -23,35 +23,35 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.initialize_unsafe_procedure_context = void 0;
27
- exports.__execute_unsafe_action = __execute_unsafe_action;
26
+ exports.initialize_unguaranteed_procedure_context = void 0;
27
+ exports.__execute_unguaranteed_action = __execute_unguaranteed_action;
28
28
  const _ei = __importStar(require("exupery-core-internals"));
29
- const initialize_safe_procedure_context_1 = require("./initialize_safe_procedure_context");
29
+ const initialize_guaranteed_procedure_context_1 = require("./initialize_guaranteed_procedure_context");
30
30
  const create_asynchronous_processes_monitor_1 = require("./create_asynchronous_processes_monitor");
31
- class Unsafe_Command_Result_Class {
31
+ class Unguaranteed_Command_Result_Class {
32
32
  constructor(executer) {
33
33
  this.executer = executer;
34
34
  }
35
- process_exception(handle, map) {
36
- return new Unsafe_Command_Result_Class({
35
+ process_exception_deprecated(handle, map) {
36
+ return new Unguaranteed_Command_Result_Class({
37
37
  'execute': (new_on_success, new_on_exception) => {
38
38
  this.executer.execute(new_on_success, ($) => {
39
- handle((0, initialize_safe_procedure_context_1.initialize_safe_procedure_context)(), $).__start(() => new_on_exception(map($)));
39
+ handle((0, initialize_guaranteed_procedure_context_1.initialize_guaranteed_procedure_context)(), $).__start(() => new_on_exception(map($)));
40
40
  });
41
41
  }
42
42
  });
43
43
  }
44
44
  catch(handle_exception) {
45
- return (0, initialize_safe_procedure_context_1.__execute_safe_action)({
45
+ return (0, initialize_guaranteed_procedure_context_1.__execute_guaranteed_action)({
46
46
  'execute': (new_on_success) => {
47
47
  this.executer.execute(new_on_success, ($) => {
48
- handle_exception((0, initialize_safe_procedure_context_1.initialize_safe_procedure_context)(), $).__start(new_on_success);
48
+ handle_exception((0, initialize_guaranteed_procedure_context_1.initialize_guaranteed_procedure_context)(), $).__start(new_on_success);
49
49
  });
50
50
  }
51
51
  });
52
52
  }
53
53
  throw_exception($) {
54
- return __execute_unsafe_action({
54
+ return __execute_unguaranteed_action({
55
55
  'execute': (on_finished, on_exception) => {
56
56
  this.executer.execute(() => {
57
57
  on_exception($);
@@ -59,27 +59,27 @@ class Unsafe_Command_Result_Class {
59
59
  }
60
60
  });
61
61
  }
62
- execute_unsafe(handle) {
63
- return new Unsafe_Command_Result_Class({
62
+ execute_unguaranteed(handle) {
63
+ return new Unguaranteed_Command_Result_Class({
64
64
  'execute': (new_on_success, new_on_exception) => {
65
65
  this.executer.execute(() => {
66
- handle((0, exports.initialize_unsafe_procedure_context)()).__start(new_on_success, new_on_exception);
66
+ handle((0, exports.initialize_unguaranteed_procedure_context)()).__start(new_on_success, new_on_exception);
67
67
  }, new_on_exception);
68
68
  }
69
69
  });
70
70
  }
71
71
  execute(handle) {
72
- return new Unsafe_Command_Result_Class({
72
+ return new Unguaranteed_Command_Result_Class({
73
73
  'execute': (new_on_success, new_on_exception) => {
74
74
  this.executer.execute(() => {
75
- handle((0, initialize_safe_procedure_context_1.initialize_safe_procedure_context)()).__start(new_on_success);
75
+ handle((0, initialize_guaranteed_procedure_context_1.initialize_guaranteed_procedure_context)()).__start(new_on_success);
76
76
  }, new_on_exception);
77
77
  }
78
78
  });
79
79
  }
80
- execute_dictionary_unsafe($, aggregate_exceptions) {
80
+ execute_dictionary_unguaranteed($, aggregate_exceptions) {
81
81
  let exceptions = {};
82
- return __execute_unsafe_action({
82
+ return __execute_unguaranteed_action({
83
83
  'execute': (on_success, on_exception) => {
84
84
  (0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
85
85
  $.map(($, key) => {
@@ -102,9 +102,9 @@ class Unsafe_Command_Result_Class {
102
102
  }
103
103
  });
104
104
  }
105
- execute_multiple_unsafe($, aggregate_exceptions) {
105
+ execute_multiple_unguaranteed($, aggregate_exceptions) {
106
106
  let exceptions = [];
107
- return __execute_unsafe_action({
107
+ return __execute_unguaranteed_action({
108
108
  'execute': (on_success, on_exception) => {
109
109
  (0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
110
110
  $.map(($) => {
@@ -136,14 +136,14 @@ class Unsafe_Command_Result_Class {
136
136
  * @param executer the function that produces the eventual value
137
137
  * @returns
138
138
  */
139
- function __execute_unsafe_action(executer) {
140
- return new Unsafe_Command_Result_Class(executer);
139
+ function __execute_unguaranteed_action(executer) {
140
+ return new Unguaranteed_Command_Result_Class(executer);
141
141
  }
142
- const initialize_unsafe_procedure_context = () => {
143
- return new Unsafe_Command_Result_Class({
142
+ const initialize_unguaranteed_procedure_context = () => {
143
+ return new Unguaranteed_Command_Result_Class({
144
144
  'execute': (on_success, on_exception) => {
145
145
  on_success(); //nothing to do, call on_finished immediately
146
146
  }
147
147
  });
148
148
  };
149
- exports.initialize_unsafe_procedure_context = initialize_unsafe_procedure_context;
149
+ exports.initialize_unguaranteed_procedure_context = initialize_unguaranteed_procedure_context;
@@ -0,0 +1,6 @@
1
+ import { Guaranteed_Query_Result } from "./Guaranteed_Query_Result";
2
+ export type Sync_Tuple_2<T1, T2> = {
3
+ readonly 'first': T1;
4
+ readonly 'second': T2;
5
+ };
6
+ export declare function merge_2_unguaranteed_query_results<T1, T2>(first: Guaranteed_Query_Result<T1>, second: Guaranteed_Query_Result<T2>): Guaranteed_Query_Result<Sync_Tuple_2<T1, T2>>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.merge_2_safe_query_results = merge_2_safe_query_results;
4
- const run_safe_query_1 = require("./run_safe_query");
5
- function merge_2_safe_query_results(first, second) {
6
- return (0, run_safe_query_1.__run_safe_query)({
3
+ exports.merge_2_unguaranteed_query_results = merge_2_unguaranteed_query_results;
4
+ const run_guaranteed_query_1 = require("./run_guaranteed_query");
5
+ function merge_2_unguaranteed_query_results(first, second) {
6
+ return (0, run_guaranteed_query_1.__run_guaranteed_query)({
7
7
  'execute': (on_value) => {
8
8
  let element_1_is_set = false;
9
9
  let element_2_is_set = false;
@@ -1,4 +1,4 @@
1
- import { Safe_Query_Result } from "./Safe_Query_Result";
1
+ import { Guaranteed_Query_Result } from "./Guaranteed_Query_Result";
2
2
  type Executer<T> = {
3
3
  'execute': (on_value: ($: T) => void) => void;
4
4
  };
@@ -7,5 +7,5 @@ type Executer<T> = {
7
7
  * @param executer the function that produces the eventual value
8
8
  * @returns
9
9
  */
10
- export declare function __run_safe_query<T>(executer: Executer<T>): Safe_Query_Result<T>;
10
+ export declare function __run_guaranteed_query<T>(executer: Executer<T>): Guaranteed_Query_Result<T>;
11
11
  export {};
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__run_safe_query = __run_safe_query;
4
- const initialize_safe_procedure_context_1 = require("./initialize_safe_procedure_context");
5
- const initialize_unsafe_procedure_context_1 = require("./initialize_unsafe_procedure_context");
6
- class Safe_Query_Result_Class {
3
+ exports.__run_guaranteed_query = __run_guaranteed_query;
4
+ const initialize_guaranteed_procedure_context_1 = require("./initialize_guaranteed_procedure_context");
5
+ const initialize_unguaranteed_procedure_context_1 = require("./initialize_unguaranteed_procedure_context");
6
+ class Guaranteed_Query_Result_Class {
7
7
  constructor(executer) {
8
8
  this.executer = executer;
9
9
  }
10
10
  map(handle_value) {
11
- return __run_safe_query({
11
+ return __run_guaranteed_query({
12
12
  'execute': (on_value) => {
13
13
  this.executer.execute((value) => {
14
14
  on_value(handle_value(value));
@@ -17,7 +17,7 @@ class Safe_Query_Result_Class {
17
17
  });
18
18
  }
19
19
  then(handle_value) {
20
- return __run_safe_query({
20
+ return __run_guaranteed_query({
21
21
  'execute': (on_value) => {
22
22
  this.executer.execute((value) => {
23
23
  handle_value(value).__start(on_value);
@@ -25,20 +25,20 @@ class Safe_Query_Result_Class {
25
25
  }
26
26
  });
27
27
  }
28
- process_safe(handle_value) {
29
- return (0, initialize_safe_procedure_context_1.__execute_safe_action)({
28
+ process_guaranteed(handle_value) {
29
+ return (0, initialize_guaranteed_procedure_context_1.__execute_guaranteed_action)({
30
30
  'execute': (on_success) => {
31
31
  this.executer.execute((value) => {
32
- handle_value((0, initialize_safe_procedure_context_1.initialize_safe_procedure_context)(), value).__start(on_success);
32
+ handle_value((0, initialize_guaranteed_procedure_context_1.initialize_guaranteed_procedure_context)(), value).__start(on_success);
33
33
  });
34
34
  }
35
35
  });
36
36
  }
37
- process_unsafe(handle_value) {
38
- return (0, initialize_unsafe_procedure_context_1.__execute_unsafe_action)({
37
+ process_unguaranteed(handle_value) {
38
+ return (0, initialize_unguaranteed_procedure_context_1.__execute_unguaranteed_action)({
39
39
  'execute': (on_success, on_exception) => {
40
40
  this.executer.execute((value) => {
41
- handle_value((0, initialize_unsafe_procedure_context_1.initialize_unsafe_procedure_context)(), value).__start(on_success, on_exception);
41
+ handle_value((0, initialize_unguaranteed_procedure_context_1.initialize_unguaranteed_procedure_context)(), value).__start(on_success, on_exception);
42
42
  });
43
43
  }
44
44
  });
@@ -52,6 +52,6 @@ class Safe_Query_Result_Class {
52
52
  * @param executer the function that produces the eventual value
53
53
  * @returns
54
54
  */
55
- function __run_safe_query(executer) {
56
- return new Safe_Query_Result_Class(executer);
55
+ function __run_guaranteed_query(executer) {
56
+ return new Guaranteed_Query_Result_Class(executer);
57
57
  }
@@ -1,4 +1,4 @@
1
- import { Unsafe_Query_Result } from "./Unsafe_Query_Result";
1
+ import { Unguaranteed_Query_Result } from "./Unguaranteed_Query_Result";
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,5 +13,5 @@ type Executer<T, E> = {
13
13
  * @param executer the function that produces the eventual value
14
14
  * @returns
15
15
  */
16
- export declare function __run_unsafe_query<T, E>(executer: Executer<T, E>): Unsafe_Query_Result<T, E>;
16
+ export declare function __run_unguaranteed_query<T, E>(executer: Executer<T, E>): Unguaranteed_Query_Result<T, E>;
17
17
  export {};
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__run_unsafe_query = __run_unsafe_query;
4
- const run_safe_query_1 = require("./run_safe_query");
5
- const initialize_safe_procedure_context_1 = require("./initialize_safe_procedure_context");
6
- const initialize_unsafe_procedure_context_1 = require("./initialize_unsafe_procedure_context");
7
- class Unsafe_Query_Result_Class {
3
+ exports.__run_unguaranteed_query = __run_unguaranteed_query;
4
+ const run_guaranteed_query_1 = require("./run_guaranteed_query");
5
+ const initialize_guaranteed_procedure_context_1 = require("./initialize_guaranteed_procedure_context");
6
+ const initialize_unguaranteed_procedure_context_1 = require("./initialize_unguaranteed_procedure_context");
7
+ class Unguaranteed_Query_Result_Class {
8
8
  constructor(executer) {
9
9
  this.executer = executer;
10
10
  }
11
11
  map(handle_value) {
12
- return new Unsafe_Query_Result_Class({
12
+ return new Unguaranteed_Query_Result_Class({
13
13
  'execute': (on_value, on_exception) => {
14
14
  this.executer.execute(($) => {
15
15
  on_value(handle_value($));
@@ -18,7 +18,7 @@ class Unsafe_Query_Result_Class {
18
18
  });
19
19
  }
20
20
  then(handle_value) {
21
- return new Unsafe_Query_Result_Class({
21
+ return new Unguaranteed_Query_Result_Class({
22
22
  'execute': (new_on_value, new_on_exception) => {
23
23
  this.executer.execute(($) => {
24
24
  handle_value($).__start(new_on_value, new_on_exception);
@@ -27,7 +27,7 @@ class Unsafe_Query_Result_Class {
27
27
  });
28
28
  }
29
29
  map_exception(handle_exception) {
30
- return new Unsafe_Query_Result_Class({
30
+ return new Unguaranteed_Query_Result_Class({
31
31
  'execute': (on_value, on_exception) => {
32
32
  this.executer.execute(on_value, ($) => {
33
33
  on_exception(handle_exception($));
@@ -36,7 +36,7 @@ class Unsafe_Query_Result_Class {
36
36
  });
37
37
  }
38
38
  catch(handle_exception) {
39
- return (0, run_safe_query_1.__run_safe_query)({
39
+ return (0, run_guaranteed_query_1.__run_guaranteed_query)({
40
40
  'execute': (on_value) => {
41
41
  this.executer.execute(on_value, ($) => {
42
42
  handle_exception($).__start(on_value);
@@ -45,12 +45,12 @@ class Unsafe_Query_Result_Class {
45
45
  });
46
46
  }
47
47
  process(handle_exception, map_exception, handle_value) {
48
- return (0, initialize_unsafe_procedure_context_1.__execute_unsafe_action)({
48
+ return (0, initialize_unguaranteed_procedure_context_1.__execute_unguaranteed_action)({
49
49
  'execute': (on_success, on_exception) => {
50
50
  this.executer.execute((value) => {
51
- handle_value((0, initialize_unsafe_procedure_context_1.initialize_unsafe_procedure_context)(), value).__start(on_success, on_exception);
51
+ handle_value((0, initialize_unguaranteed_procedure_context_1.initialize_unguaranteed_procedure_context)(), value).__start(on_success, on_exception);
52
52
  }, (exception) => {
53
- handle_exception((0, initialize_safe_procedure_context_1.initialize_safe_procedure_context)(), exception).__start(() => on_exception(map_exception(exception)));
53
+ handle_exception((0, initialize_guaranteed_procedure_context_1.initialize_guaranteed_procedure_context)(), exception).__start(() => on_exception(map_exception(exception)));
54
54
  });
55
55
  }
56
56
  });
@@ -64,6 +64,6 @@ class Unsafe_Query_Result_Class {
64
64
  * @param executer the function that produces the eventual value
65
65
  * @returns
66
66
  */
67
- function __run_unsafe_query(executer) {
68
- return new Unsafe_Query_Result_Class(executer);
67
+ function __run_unguaranteed_query(executer) {
68
+ return new Unguaranteed_Query_Result_Class(executer);
69
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-async",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "async types for Exupery",
@@ -1,4 +0,0 @@
1
- export interface Safe_Procedure_Context {
2
- execute(handle: ($i: Safe_Procedure_Context) => Safe_Procedure_Context): Safe_Procedure_Context;
3
- __start(on_finished: () => void): void;
4
- }
@@ -1,20 +0,0 @@
1
- import { Safe_Procedure_Context } from "./Safe_Procedure_Context";
2
- import { Unsafe_Procedure_Context } from "./Unsafe_Procedure_Context";
3
- /**
4
- * A value that will asynchronously become available.
5
- * Similar to the concept of a promise, but with a smaller API.
6
- */
7
- export interface Safe_Query_Result<T> {
8
- map<NT>(handle_value: ($: T) => NT): Safe_Query_Result<NT>;
9
- /**
10
- * maps the current async value into a new async value
11
- * @param handle_value callback that transforms the actual value into a new Async_Value
12
- */
13
- then<NT>(handle_value: ($: T) => Safe_Query_Result<NT>): Safe_Query_Result<NT>;
14
- process_safe(handle_value: ($i: Safe_Procedure_Context, $: T) => Safe_Procedure_Context): Safe_Procedure_Context;
15
- process_unsafe<E>(handle_value: ($i: Unsafe_Procedure_Context<E>, $: T) => Unsafe_Procedure_Context<E>): Unsafe_Procedure_Context<E>;
16
- /**
17
- * This method is only to be used by resources
18
- */
19
- __start(on_value: ($: T) => void): void;
20
- }
@@ -1,24 +0,0 @@
1
- import * as _et from 'exupery-core-types';
2
- import { Safe_Procedure_Context } from "./Safe_Procedure_Context";
3
- export interface Unsafe_Procedure_Context<E> {
4
- /**
5
- *
6
- * executes a command when an exception has occurred,
7
- * but stays in the unsafe context
8
- *
9
- * this is useful when you want to do some cleanup
10
- * or logging in case of an exception,
11
- * but still want to propagate the exception further
12
- *
13
- * note that this is different from `catch`,
14
- * which would switch to the safe context
15
- */
16
- process_exception<NE>(handle: ($i: Safe_Procedure_Context, $: E) => Safe_Procedure_Context, map: ($: E) => NE): Unsafe_Procedure_Context<NE>;
17
- throw_exception<E>($: E): Unsafe_Procedure_Context<E>;
18
- catch(handle_exception: ($i: Safe_Procedure_Context, $: E) => Safe_Procedure_Context): Safe_Procedure_Context;
19
- execute_unsafe(handle: ($i: Unsafe_Procedure_Context<E>) => Unsafe_Procedure_Context<E>): Unsafe_Procedure_Context<E>;
20
- execute(handle: ($i: Safe_Procedure_Context) => Safe_Procedure_Context): Unsafe_Procedure_Context<E>;
21
- execute_dictionary_unsafe<E2>($: _et.Dictionary<Unsafe_Procedure_Context<E2>>, aggregate_exceptions: ($: _et.Dictionary<E2>) => E): Unsafe_Procedure_Context<E>;
22
- execute_multiple_unsafe<E2>($: _et.Array<Unsafe_Procedure_Context<E2>>, aggregate_exceptions: ($: _et.Array<E2>) => E): Unsafe_Procedure_Context<E>;
23
- __start(on_success: () => void, on_exception: ($: E) => void): void;
24
- }
@@ -1,12 +0,0 @@
1
- import { Safe_Procedure_Context } from "./Safe_Procedure_Context";
2
- type Executer = {
3
- 'execute': (on_finished: () => void) => void;
4
- };
5
- /**
6
- * returns an {@link Async_Value }
7
- * @param executer the function that produces the eventual value
8
- * @returns
9
- */
10
- export declare function __execute_safe_action(executer: Executer): Safe_Procedure_Context;
11
- export declare const initialize_safe_procedure_context: () => Safe_Procedure_Context;
12
- export {};
@@ -1,6 +0,0 @@
1
- import { Safe_Query_Result } from "./Safe_Query_Result";
2
- export type Sync_Tuple_2<T1, T2> = {
3
- readonly 'first': T1;
4
- readonly 'second': T2;
5
- };
6
- export declare function merge_2_safe_query_results<T1, T2>(first: Safe_Query_Result<T1>, second: Safe_Query_Result<T2>): Safe_Query_Result<Sync_Tuple_2<T1, T2>>;