exupery-core-async 0.1.39 → 0.1.41

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.
package/dist/new.d.ts CHANGED
@@ -1,13 +1,10 @@
1
1
  import * as _ei from 'exupery-core-internals';
2
+ import * as _et from 'exupery-core-types';
2
3
  import { Guaranteed_Procedure, Guaranteed_Procedure_Initializer } from "./procedure/Guaranteed_Procedure";
3
4
  import { Unguaranteed_Procedure_Initializer, Unguaranteed_Procedure } from "./procedure/Unguaranteed_Procedure";
4
5
  import { Unguaranteed_Query_Initializer } from "./query/Unguaranteed_Query";
5
6
  import { Guaranteed_Query_Initializer } from "./query/Guaranteed_Query";
6
7
  export type Error_Handler<Error> = (error: Error) => void;
7
- export type Guaranteed_Transformation_With_Parameters<In, Parameters, Out> = ($: In, $p: Parameters) => Out;
8
- export type Guaranteed_Transformation_Without_Parameters<In, Out> = ($: In) => Out;
9
- export type Unguaranteed_Transformation_With_Parameters<In, Parameters, Out, Error> = ($: In, $p: Parameters) => _ei.Unguaranteed_Transformation_Result<Out, Error>;
10
- export type Unguaranteed_Transformation_Without_Parameters<In, Out, Error> = ($: In) => _ei.Unguaranteed_Transformation_Result<Out, Error>;
11
8
  export declare namespace Unguaranteed {
12
9
  type Query<Result, Error> = {
13
10
  __start: (on_success: (result: Result) => void, on_error: (error: Error) => void) => void;
@@ -19,18 +16,18 @@ export declare namespace Guaranteed {
19
16
  };
20
17
  }
21
18
  export declare namespace ut {
22
- const u: <In, Out, Error>(the_transformation: Unguaranteed_Transformation_Without_Parameters<In, Out, Error>) => Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
23
- const g: <In, Out, Error>(the_transformation: Guaranteed_Transformation_Without_Parameters<In, Out>) => Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
19
+ const u: <In, Out, Error>(the_transformation: _ei.Unguaranteed_Transformation_Without_Parameters<In, Out, Error>) => _ei.Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
20
+ const g: <In, Out, Error>(the_transformation: _ei.Guaranteed_Transformation_Without_Parameters<In, Out>) => _ei.Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
24
21
  }
25
22
  export declare namespace gt {
26
- const g: <In, Out>(the_transformation: Guaranteed_Transformation_Without_Parameters<In, Out>) => Guaranteed_Transformation_Without_Parameters<In, Out>;
23
+ const g: <In, Out>(the_transformation: _ei.Guaranteed_Transformation_Without_Parameters<In, Out>) => _ei.Guaranteed_Transformation_Without_Parameters<In, Out>;
27
24
  }
28
25
  /**
29
26
  *
30
27
  * @param action a_my_action
31
28
  * @param error_transform ($) => ....
32
29
  */
33
- export declare const eh: <Parameters, Error>(action: Guaranteed_Procedure_Initializer<Parameters>, error_transform: Guaranteed_Transformation_Without_Parameters<Error, Parameters>) => Error_Handler<Error>;
30
+ export declare const eh: <Parameters, Error>(action: Guaranteed_Procedure_Initializer<Parameters>, error_transform: _ei.Guaranteed_Transformation_Without_Parameters<Error, Parameters>) => Error_Handler<Error>;
34
31
  export declare namespace u {
35
32
  namespace a {
36
33
  /**
@@ -42,7 +39,7 @@ export declare namespace u {
42
39
  *
43
40
  * @param action a_my_action
44
41
  */
45
- const u: <Parameters, Error, Action_Error>(action: Unguaranteed_Procedure_Initializer<Parameters, Action_Error>, error_transform: Guaranteed_Transformation_Without_Parameters<Action_Error, Error>, error_handler?: Error_Handler<Action_Error>) => Unguaranteed_Procedure_Initializer<Parameters, Error>;
42
+ const u: <Parameters, Error, Action_Error>(action: Unguaranteed_Procedure_Initializer<Parameters, Action_Error>, error_transform: _ei.Guaranteed_Transformation_Without_Parameters<Action_Error, Error>, error_handler?: Error_Handler<Action_Error>) => Unguaranteed_Procedure_Initializer<Parameters, Error>;
46
43
  }
47
44
  namespace q {
48
45
  const fixed: <Query_Result, Error>(query_result: Query_Result) => Unguaranteed.Query<Query_Result, Error>;
@@ -55,14 +52,14 @@ export declare namespace u {
55
52
  * @param error_handler eh(...)
56
53
  * @returns
57
54
  */
58
- const u: <Result_After_Transformation, Error, Parameters, Query_Result, Query_Error>(the_query: Unguaranteed_Query_Initializer<Parameters, Query_Result, Query_Error>, parameters: Unguaranteed.Query<Parameters, Error>, result_transformation: Unguaranteed_Transformation_Without_Parameters<Query_Result, Result_After_Transformation, Error>, error_transform: Guaranteed_Transformation_Without_Parameters<Query_Error, Error>, error_handler?: Error_Handler<Query_Error>) => Unguaranteed.Query<Result_After_Transformation, Error>;
55
+ const u: <Result_After_Transformation, Error, Parameters, Query_Result, Query_Error>(the_query: Unguaranteed_Query_Initializer<Parameters, Query_Result, Query_Error>, parameters: Unguaranteed.Query<Parameters, Error>, result_transformation: _ei.Unguaranteed_Transformation_Without_Parameters<Query_Result, Result_After_Transformation, Error>, error_transform: _ei.Guaranteed_Transformation_Without_Parameters<Query_Error, Error>, error_handler?: Error_Handler<Query_Error>) => Unguaranteed.Query<Result_After_Transformation, Error>;
59
56
  /**
60
57
  * guaranteed query
61
58
  * @param the_query q_my_query
62
59
  * @param parameters u.q.*()
63
60
  * @param result_transformation ($) => ...
64
61
  */
65
- const g: <Result_After_Transformation, Error, Parameters, Query_Result>(the_query: Guaranteed_Query_Initializer<Parameters, Query_Result>, parameters: Unguaranteed.Query<Parameters, Error>, result_transformation: Unguaranteed_Transformation_Without_Parameters<Query_Result, Result_After_Transformation, Error>) => Unguaranteed.Query<Result_After_Transformation, Error>;
62
+ const g: <Result_After_Transformation, Error, Parameters, Query_Result>(the_query: Guaranteed_Query_Initializer<Parameters, Query_Result>, parameters: Unguaranteed.Query<Parameters, Error>, result_transformation: _ei.Unguaranteed_Transformation_Without_Parameters<Query_Result, Result_After_Transformation, Error>) => Unguaranteed.Query<Result_After_Transformation, Error>;
66
63
  }
67
64
  namespace t {
68
65
  /**
@@ -72,12 +69,12 @@ export declare namespace u {
72
69
  * @param error_handler eh()
73
70
  * @returns
74
71
  */
75
- const u: <In, Out, Error, Transformation_Error>(the_transformation: Unguaranteed_Transformation_Without_Parameters<In, Out, Transformation_Error>, error_transform: Guaranteed_Transformation_Without_Parameters<Transformation_Error, Error>, error_handler?: Error_Handler<Transformation_Error>) => Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
72
+ const u: <In, Out, Error, Transformation_Error>(the_transformation: _ei.Unguaranteed_Transformation_Without_Parameters<In, Out, Transformation_Error>, error_transform: _ei.Guaranteed_Transformation_Without_Parameters<Transformation_Error, Error>, error_handler?: Error_Handler<Transformation_Error>) => _ei.Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
76
73
  /**
77
74
  *
78
75
  * @param the_transformation ($) => ...
79
76
  */
80
- const g: <In, Out, Error>(the_transformation: Guaranteed_Transformation_Without_Parameters<In, Out>) => Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
77
+ const g: <In, Out, Error>(the_transformation: _ei.Guaranteed_Transformation_Without_Parameters<In, Out>) => _ei.Unguaranteed_Transformation_Without_Parameters<In, Out, Error>;
81
78
  }
82
79
  namespace p {
83
80
  /**
@@ -87,6 +84,8 @@ export declare namespace u {
87
84
  */
88
85
  const action: <Error, Parameters>(action: Unguaranteed_Procedure_Initializer<Parameters, Error>, query: Unguaranteed.Query<Parameters, Error>) => Unguaranteed_Procedure<Error>;
89
86
  const sequence: <Error>(steps: Unguaranteed_Procedure<Error>[]) => Unguaranteed_Procedure<Error>;
87
+ const array: <Error, Element_Error>(the_array: _et.Array<Unguaranteed_Procedure<Element_Error>>, aggregate_exceptions: _ei.Guaranteed_Transformation_Without_Parameters<_et.Array<Element_Error>, Error>) => Unguaranteed_Procedure<Error>;
88
+ const dictionary: <Error, Element_Error>(the_dictionary: _et.Dictionary<Unguaranteed_Procedure<Element_Error>>, aggregate_exceptions: _ei.Guaranteed_Transformation_Without_Parameters<_et.Dictionary<Element_Error>, Error>) => Unguaranteed_Procedure<Error>;
90
89
  }
91
90
  }
92
91
  export declare namespace g {
@@ -95,7 +94,7 @@ export declare namespace g {
95
94
  }
96
95
  namespace q {
97
96
  const fixed: <Query_Result>(query_result: Query_Result) => Guaranteed.Query<Query_Result>;
98
- const g: <Result_After_Transformation, Parameters, Query_Result>(the_query: Guaranteed_Query_Initializer<Parameters, Query_Result>, parameters: Guaranteed.Query<Parameters>, result_transformation: Guaranteed_Transformation_Without_Parameters<Query_Result, Result_After_Transformation>) => Guaranteed.Query<Result_After_Transformation>;
97
+ const g: <Result_After_Transformation, Parameters, Query_Result>(the_query: Guaranteed_Query_Initializer<Parameters, Query_Result>, parameters: Guaranteed.Query<Parameters>, result_transformation: _ei.Guaranteed_Transformation_Without_Parameters<Query_Result, Result_After_Transformation>) => Guaranteed.Query<Result_After_Transformation>;
99
98
  }
100
99
  namespace p {
101
100
  const action: <Parameters>(action: Guaranteed_Procedure_Initializer<Parameters>, query: Guaranteed.Query<Parameters>) => Guaranteed_Procedure;
package/dist/new.js CHANGED
@@ -27,6 +27,7 @@ exports.g = exports.u = exports.eh = exports.gt = exports.ut = void 0;
27
27
  const _ei = __importStar(require("exupery-core-internals"));
28
28
  const initialize_unguaranteed_procedure_1 = require("./procedure/initialize_unguaranteed_procedure");
29
29
  const initialize_guaranteed_procedure_1 = require("./procedure/initialize_guaranteed_procedure");
30
+ const create_asynchronous_processes_monitor_1 = require("./create_asynchronous_processes_monitor");
30
31
  var ut;
31
32
  (function (ut) {
32
33
  ut.u = (the_transformation) => {
@@ -204,6 +205,56 @@ var u;
204
205
  }
205
206
  };
206
207
  };
208
+ p.array = (the_array, aggregate_exceptions) => {
209
+ return {
210
+ __start: (on_success, on_error) => {
211
+ const exceptions = [];
212
+ (0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
213
+ the_array.map(($) => {
214
+ monitor['report process started']();
215
+ $.__start(() => {
216
+ monitor['report process finished']();
217
+ }, (e) => {
218
+ exceptions.push(e);
219
+ monitor['report process finished']();
220
+ });
221
+ });
222
+ }, () => {
223
+ if (exceptions.length === 0) {
224
+ on_success();
225
+ }
226
+ else {
227
+ on_error(aggregate_exceptions(_ei.array_literal(exceptions)));
228
+ }
229
+ });
230
+ }
231
+ };
232
+ };
233
+ p.dictionary = (the_dictionary, aggregate_exceptions) => {
234
+ return {
235
+ __start: (on_success, on_error) => {
236
+ const exceptions = {};
237
+ (0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
238
+ the_dictionary.map(($, key) => {
239
+ monitor['report process started']();
240
+ $.__start(() => {
241
+ monitor['report process finished']();
242
+ }, (e) => {
243
+ exceptions[key] = e;
244
+ monitor['report process finished']();
245
+ });
246
+ });
247
+ }, () => {
248
+ if (Object.keys(exceptions).length === 0) {
249
+ on_success();
250
+ }
251
+ else {
252
+ on_error(aggregate_exceptions(_ei.dictionary_literal(exceptions)));
253
+ }
254
+ });
255
+ }
256
+ };
257
+ };
207
258
  })(p = u_1.p || (u_1.p = {}));
208
259
  })(u || (exports.u = u = {}));
209
260
  var g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-async",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "async types for Exupery",
@@ -22,6 +22,6 @@
22
22
  "url": "git+https://github.com/corno/exupery-core.git"
23
23
  },
24
24
  "dependencies": {
25
- "exupery-core-internals": "^0.1.11"
25
+ "exupery-core-internals": "^0.1.12"
26
26
  }
27
27
  }