exupery-core-async 0.3.42 → 0.3.44

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.
@@ -15,7 +15,10 @@ export declare namespace p {
15
15
  const serie: <Error>(array: _et.Array<_et.Command_Promise<Error>>) => _et.Command_Promise<Error>;
16
16
  }
17
17
  namespace dictionary {
18
- const parallel: <Error, Entry_Error>(dictionary: _et.Dictionary<_et.Command_Promise<Entry_Error>>, aggregate_errors: _et.Transformer_Without_Parameters<_et.Dictionary<Entry_Error>, Error>) => _et.Command_Promise<Error>;
18
+ namespace parallel {
19
+ const direct: <T, Error, Entry_Error>(dictionary: _et.Dictionary<T>, callback: (value: T, key: string) => _et.Command_Promise<Entry_Error>, aggregate_errors: _et.Transformer_Without_Parameters<_et.Dictionary<Entry_Error>, Error>) => _et.Command_Promise<Error>;
20
+ const query: <T, Error, Entry_Error>(query: _et.Query_Promise<_et.Dictionary<T>, Error>, callback: (value: T, key: string) => _et.Command_Promise<Entry_Error>, aggregate_errors: _et.Transformer_Without_Parameters<_et.Dictionary<Entry_Error>, Error>) => _et.Command_Promise<Error>;
21
+ }
19
22
  const serie: <Error, Entry_Error>(dictionary: _et.Dictionary<_et.Command_Promise<Entry_Error>>, transform_error: _et.Transformer_Without_Parameters<_et.Key_Value_Pair<Entry_Error>, Error>) => _et.Command_Promise<Error>;
20
23
  const parallel_without_transforming_the_error: <Error, Entry_Error>(dictionary: _et.Dictionary<_et.Command_Promise<Entry_Error>>) => _et.Command_Promise<_et.Dictionary<Entry_Error>>;
21
24
  }
@@ -145,31 +145,61 @@ var p;
145
145
  })(list = p.list || (p.list = {}));
146
146
  let dictionary;
147
147
  (function (dictionary_1) {
148
- dictionary_1.parallel = (dictionary, aggregate_errors) => {
149
- return (0, create_command_promise_1.__create_command_promise)({
150
- 'execute': (on_success, on_error) => {
151
- const errors = {};
152
- (0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
153
- dictionary.map(($, key) => {
154
- monitor['report process started']();
155
- $.__start(() => {
156
- monitor['report process finished']();
157
- }, (e) => {
158
- errors[key] = e;
159
- monitor['report process finished']();
148
+ let parallel;
149
+ (function (parallel) {
150
+ parallel.direct = (dictionary, callback, aggregate_errors) => {
151
+ return (0, create_command_promise_1.__create_command_promise)({
152
+ 'execute': (on_success, on_error) => {
153
+ const errors = {};
154
+ (0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
155
+ dictionary.map(($, key) => {
156
+ monitor['report process started']();
157
+ callback($, key).__start(() => {
158
+ monitor['report process finished']();
159
+ }, (e) => {
160
+ errors[key] = e;
161
+ monitor['report process finished']();
162
+ });
160
163
  });
164
+ }, () => {
165
+ if (Object.keys(errors).length === 0) {
166
+ on_success();
167
+ }
168
+ else {
169
+ on_error(aggregate_errors(_ei.dictionary_literal(errors)));
170
+ }
161
171
  });
162
- }, () => {
163
- if (Object.keys(errors).length === 0) {
164
- on_success();
165
- }
166
- else {
167
- on_error(aggregate_errors(_ei.dictionary_literal(errors)));
168
- }
169
- });
170
- }
171
- });
172
- };
172
+ }
173
+ });
174
+ };
175
+ parallel.query = (query, callback, aggregate_errors) => {
176
+ return (0, create_command_promise_1.__create_command_promise)({
177
+ 'execute': (on_success, on_error) => {
178
+ const errors = {};
179
+ (0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
180
+ query.__start((dictionary) => {
181
+ dictionary.map(($, key) => {
182
+ monitor['report process started']();
183
+ callback($, key).__start(() => {
184
+ monitor['report process finished']();
185
+ }, (e) => {
186
+ errors[key] = e;
187
+ monitor['report process finished']();
188
+ });
189
+ });
190
+ }, on_error);
191
+ }, () => {
192
+ if (Object.keys(errors).length === 0) {
193
+ on_success();
194
+ }
195
+ else {
196
+ on_error(aggregate_errors(_ei.dictionary_literal(errors)));
197
+ }
198
+ });
199
+ }
200
+ });
201
+ };
202
+ })(parallel = dictionary_1.parallel || (dictionary_1.parallel = {}));
173
203
  dictionary_1.serie = (dictionary, transform_error) => {
174
204
  return (0, create_command_promise_1.__create_command_promise)({
175
205
  'execute': (on_success, on_error) => {
@@ -21,9 +21,7 @@ const __create_command = (handler) => {
21
21
  handler($).__start(on_success, (error) => {
22
22
  on_error(transform_error(error));
23
23
  });
24
- }, (error) => {
25
- on_error(transform_error(error));
26
- });
24
+ }, on_error);
27
25
  }
28
26
  });
29
27
  },
@@ -34,9 +32,7 @@ const __create_command = (handler) => {
34
32
  handler($).__start(on_success, (error) => {
35
33
  on_error(transform_error(error));
36
34
  });
37
- }, (error) => {
38
- on_error(transform_error(error));
39
- });
35
+ }, on_error);
40
36
  }
41
37
  });
42
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-async",
3
- "version": "0.3.42",
3
+ "version": "0.3.44",
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.3.1"
25
+ "exupery-core-internals": "^0.3.2"
26
26
  }
27
27
  }