exupery-core-async 0.3.8 → 0.3.9
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/algorithms/procedure/{initialize_unguaranteed_procedure.d.ts → initialize_procedure.d.ts} +1 -1
- package/dist/algorithms/procedure/{initialize_unguaranteed_procedure.js → initialize_procedure.js} +3 -3
- package/dist/algorithms/query/{create_unguaranteed_query.d.ts → create_query.d.ts} +1 -1
- package/dist/algorithms/query/{create_unguaranteed_query.js → create_query.js} +5 -24
- package/dist/index.d.ts +5 -14
- package/dist/index.js +17 -33
- package/dist/procedure/assert_async.d.ts +1 -1
- package/dist/procedure/assert_async.js +2 -2
- package/dist/procedure/assert_sync.d.ts +1 -1
- package/dist/procedure/assert_sync.js +2 -2
- package/dist/procedure/conditional_async.d.ts +2 -2
- package/dist/procedure/conditional_async.js +2 -2
- package/dist/procedure/conditional_multiple.d.ts +2 -2
- package/dist/procedure/conditional_multiple.js +2 -2
- package/dist/procedure/conditional_sync.d.ts +1 -1
- package/dist/procedure/conditional_sync.js +2 -2
- package/dist/procedure/sequence.d.ts +1 -1
- package/dist/procedure/sequence.js +2 -2
- package/dist/procedure/three_steps.d.ts +1 -1
- package/dist/procedure/three_steps.js +2 -2
- package/dist/procedure/two_steps.d.ts +1 -1
- package/dist/procedure/two_steps.js +2 -2
- package/dist/procedure/unguaranteed_procedure_dictionary.d.ts +1 -1
- package/dist/procedure/unguaranteed_procedure_dictionary.js +2 -2
- package/dist/query/transform_query.d.ts +2 -2
- package/dist/query/transform_query.js +2 -2
- package/dist/query/unguaranteed_query_dictionary.d.ts +2 -2
- package/dist/query/unguaranteed_query_dictionary.js +2 -2
- package/dist/shorthands.d.ts +8 -60
- package/dist/shorthands.js +7 -110
- package/dist/types/{Basic_Unguaranteed_Query.d.ts → Basic_Query.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/algorithms/procedure/initialize_guaranteed_procedure.d.ts +0 -11
- package/dist/algorithms/procedure/initialize_guaranteed_procedure.js +0 -19
- package/dist/algorithms/query/create_guaranteed_query.d.ts +0 -11
- package/dist/algorithms/query/create_guaranteed_query.js +0 -37
- package/dist/algorithms/query/merge_2_guaranteed_queries.d.ts +0 -6
- package/dist/algorithms/query/merge_2_guaranteed_queries.js +0 -29
- package/dist/types/Basic_Guaranteed_Query.d.ts +0 -3
- package/dist/types/Basic_Unguaranteed_Query.js +0 -2
- /package/dist/types/{Basic_Guaranteed_Query.js → Basic_Query.js} +0 -0
|
@@ -13,5 +13,5 @@ type Executer<E> = {
|
|
|
13
13
|
* @param executer the function that produces the eventual value
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
export declare function __create_unguaranteed_procedure<E>(executer: Executer<E>): _et.
|
|
16
|
+
export declare function __create_unguaranteed_procedure<E>(executer: Executer<E>): _et.Procedure_Promise<E>;
|
|
17
17
|
export {};
|
package/dist/algorithms/procedure/{initialize_unguaranteed_procedure.js → initialize_procedure.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.__create_unguaranteed_procedure = __create_unguaranteed_procedure;
|
|
4
|
-
class
|
|
4
|
+
class Procedure_Promise_Class {
|
|
5
5
|
constructor(executer) {
|
|
6
6
|
this.executer = executer;
|
|
7
7
|
}
|
|
@@ -9,7 +9,7 @@ class Unguaranteed_Procedure_Promise_Class {
|
|
|
9
9
|
this.executer.execute(on_success, on_exception);
|
|
10
10
|
}
|
|
11
11
|
map_error(handle_error) {
|
|
12
|
-
return new
|
|
12
|
+
return new Procedure_Promise_Class({
|
|
13
13
|
'execute': (on_success, on_exception) => {
|
|
14
14
|
this.executer.execute(on_success, (error) => {
|
|
15
15
|
on_exception(handle_error(error));
|
|
@@ -24,5 +24,5 @@ class Unguaranteed_Procedure_Promise_Class {
|
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
26
|
function __create_unguaranteed_procedure(executer) {
|
|
27
|
-
return new
|
|
27
|
+
return new Procedure_Promise_Class(executer);
|
|
28
28
|
}
|
|
@@ -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 __create_unguaranteed_query<T, E>(executer: Executer<T, E>): _et.
|
|
16
|
+
export declare function __create_unguaranteed_query<T, E>(executer: Executer<T, E>): _et.Query_Promise<T, E>;
|
|
17
17
|
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.__create_unguaranteed_query = __create_unguaranteed_query;
|
|
4
|
-
|
|
5
|
-
class Unguaranteed_Query_Result_Promise_Class {
|
|
4
|
+
class Query_Result_Promise_Class {
|
|
6
5
|
constructor(executer) {
|
|
7
6
|
this.executer = executer;
|
|
8
7
|
}
|
|
9
8
|
map_(handle_value) {
|
|
10
|
-
return new
|
|
9
|
+
return new Query_Result_Promise_Class({
|
|
11
10
|
'execute': (on_value, on_exception) => {
|
|
12
11
|
this.executer.execute(($) => {
|
|
13
12
|
on_value(handle_value($));
|
|
@@ -16,16 +15,7 @@ class Unguaranteed_Query_Result_Promise_Class {
|
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
17
|
then(handle_value) {
|
|
19
|
-
return new
|
|
20
|
-
'execute': (new_on_value, new_on_exception) => {
|
|
21
|
-
this.executer.execute(($) => {
|
|
22
|
-
handle_value($).__start(new_on_value);
|
|
23
|
-
}, new_on_exception);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
then_unguaranteed(handle_value) {
|
|
28
|
-
return new Unguaranteed_Query_Result_Promise_Class({
|
|
18
|
+
return new Query_Result_Promise_Class({
|
|
29
19
|
'execute': (new_on_value, new_on_exception) => {
|
|
30
20
|
this.executer.execute(($) => {
|
|
31
21
|
handle_value($).__start(new_on_value, new_on_exception);
|
|
@@ -34,7 +24,7 @@ class Unguaranteed_Query_Result_Promise_Class {
|
|
|
34
24
|
});
|
|
35
25
|
}
|
|
36
26
|
map_exception_(handle_exception) {
|
|
37
|
-
return new
|
|
27
|
+
return new Query_Result_Promise_Class({
|
|
38
28
|
'execute': (on_value, on_exception) => {
|
|
39
29
|
this.executer.execute(on_value, ($) => {
|
|
40
30
|
on_exception(handle_exception($));
|
|
@@ -42,15 +32,6 @@ class Unguaranteed_Query_Result_Promise_Class {
|
|
|
42
32
|
}
|
|
43
33
|
});
|
|
44
34
|
}
|
|
45
|
-
catch_(handle_exception) {
|
|
46
|
-
return (0, create_guaranteed_query_1.__create_guaranteed_query)({
|
|
47
|
-
'execute': (on_value) => {
|
|
48
|
-
this.executer.execute(on_value, ($) => {
|
|
49
|
-
handle_exception($).__start(on_value);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
35
|
__start(on_value, on_exception) {
|
|
55
36
|
this.executer.execute(on_value, on_exception);
|
|
56
37
|
}
|
|
@@ -61,5 +42,5 @@ class Unguaranteed_Query_Result_Promise_Class {
|
|
|
61
42
|
* @returns
|
|
62
43
|
*/
|
|
63
44
|
function __create_unguaranteed_query(executer) {
|
|
64
|
-
return new
|
|
45
|
+
return new Query_Result_Promise_Class(executer);
|
|
65
46
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import * as _et from "exupery-core-types";
|
|
2
|
-
export * from "./types/
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./algorithms/
|
|
5
|
-
export * from "./algorithms/query/create_guaranteed_query";
|
|
6
|
-
export * from "./algorithms/query/create_unguaranteed_query";
|
|
7
|
-
export * from "./algorithms/procedure/initialize_guaranteed_procedure";
|
|
8
|
-
export * from "./algorithms/procedure/initialize_unguaranteed_procedure";
|
|
2
|
+
export * from "./types/Basic_Query";
|
|
3
|
+
export * from "./algorithms/query/create_query";
|
|
4
|
+
export * from "./algorithms/procedure/initialize_procedure";
|
|
9
5
|
export * from "./shorthands";
|
|
10
6
|
export * from "./procedure/assert_async";
|
|
11
7
|
export * from "./procedure/assert_sync";
|
|
@@ -19,11 +15,6 @@ export * from "./procedure/unguaranteed_procedure_dictionary";
|
|
|
19
15
|
export * from "./query/transform_query";
|
|
20
16
|
export * from "./query/unguaranteed_query_dictionary";
|
|
21
17
|
export declare const query: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
unguaranteed: {
|
|
26
|
-
'create result': <T, E>($: T) => _et.Unguaranteed_Query_Promise<T, E>;
|
|
27
|
-
'raise exception': <T, E>($: E) => _et.Unguaranteed_Query_Promise<T, E>;
|
|
28
|
-
};
|
|
18
|
+
'create result': <T, E>($: T) => _et.Query_Promise<T, E>;
|
|
19
|
+
'raise exception': <T, E>($: E) => _et.Query_Promise<T, E>;
|
|
29
20
|
};
|
package/dist/index.js
CHANGED
|
@@ -16,14 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.query = void 0;
|
|
18
18
|
//types
|
|
19
|
-
__exportStar(require("./types/
|
|
20
|
-
__exportStar(require("./types/Basic_Guaranteed_Query"), exports);
|
|
19
|
+
__exportStar(require("./types/Basic_Query"), exports);
|
|
21
20
|
//functions
|
|
22
|
-
__exportStar(require("./algorithms/query/
|
|
23
|
-
__exportStar(require("./algorithms/
|
|
24
|
-
__exportStar(require("./algorithms/query/create_unguaranteed_query"), exports);
|
|
25
|
-
__exportStar(require("./algorithms/procedure/initialize_guaranteed_procedure"), exports);
|
|
26
|
-
__exportStar(require("./algorithms/procedure/initialize_unguaranteed_procedure"), exports);
|
|
21
|
+
__exportStar(require("./algorithms/query/create_query"), exports);
|
|
22
|
+
__exportStar(require("./algorithms/procedure/initialize_procedure"), exports);
|
|
27
23
|
__exportStar(require("./shorthands"), exports);
|
|
28
24
|
// procedure exports
|
|
29
25
|
__exportStar(require("./procedure/assert_async"), exports);
|
|
@@ -38,32 +34,20 @@ __exportStar(require("./procedure/unguaranteed_procedure_dictionary"), exports);
|
|
|
38
34
|
// query exports
|
|
39
35
|
__exportStar(require("./query/transform_query"), exports);
|
|
40
36
|
__exportStar(require("./query/unguaranteed_query_dictionary"), exports);
|
|
41
|
-
const
|
|
42
|
-
const create_unguaranteed_query_1 = require("./algorithms/query/create_unguaranteed_query");
|
|
37
|
+
const create_query_1 = require("./algorithms/query/create_query");
|
|
43
38
|
exports.query = {
|
|
44
|
-
'
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
'unguaranteed': {
|
|
54
|
-
'create result': ($) => {
|
|
55
|
-
return (0, create_unguaranteed_query_1.__create_unguaranteed_query)({
|
|
56
|
-
'execute': (on_value) => {
|
|
57
|
-
on_value($);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
'raise exception': ($) => {
|
|
62
|
-
return (0, create_unguaranteed_query_1.__create_unguaranteed_query)({
|
|
63
|
-
'execute': (on_value, on_exception) => {
|
|
64
|
-
on_exception($);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
39
|
+
'create result': ($) => {
|
|
40
|
+
return (0, create_query_1.__create_unguaranteed_query)({
|
|
41
|
+
'execute': (on_value) => {
|
|
42
|
+
on_value($);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
68
45
|
},
|
|
46
|
+
'raise exception': ($) => {
|
|
47
|
+
return (0, create_query_1.__create_unguaranteed_query)({
|
|
48
|
+
'execute': (on_value, on_exception) => {
|
|
49
|
+
on_exception($);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
69
53
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
export type Assert_Async_Error<Assertion_Error, Procedure_Error> = ['assertion error', Assertion_Error] | ['assertion failed', null] | ['procedure error', Procedure_Error];
|
|
3
|
-
export declare const assert_async: <Assertion_Error, Procedure_Error>(assertion: _et.
|
|
3
|
+
export declare const assert_async: <Assertion_Error, Procedure_Error>(assertion: _et.Query_Promise<boolean, Assertion_Error>, procedure: _et.Procedure_Promise<Procedure_Error>) => _et.Procedure_Promise<Assert_Async_Error<Assertion_Error, Procedure_Error>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assert_async = void 0;
|
|
4
|
-
const
|
|
4
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
5
5
|
const assert_async = (assertion, procedure) => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
7
7
|
'execute': (on_success, on_exception) => {
|
|
8
8
|
assertion.__start(($) => {
|
|
9
9
|
if ($) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
export type Assert_Sync_Error<Procedure_Error> = ['assertion failed', null] | ['procedure error', Procedure_Error];
|
|
3
|
-
export declare const assert_sync: <Assertion_Error, Procedure_Error>(assertion: boolean, procedure: _et.
|
|
3
|
+
export declare const assert_sync: <Assertion_Error, Procedure_Error>(assertion: boolean, procedure: _et.Procedure_Promise<Procedure_Error>) => _et.Procedure_Promise<Assert_Sync_Error<Procedure_Error>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assert_sync = void 0;
|
|
4
|
-
const
|
|
4
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
5
5
|
const assert_sync = (assertion, procedure) => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
7
7
|
'execute': (on_success, on_exception) => {
|
|
8
8
|
if (!assertion) {
|
|
9
9
|
on_exception(['assertion failed', null]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
import {
|
|
2
|
+
import { Basic_Query_Promise } from '../types/Basic_Query';
|
|
3
3
|
export type Conditional_Async_Error<Precondition_Error, Procedure_Error> = ['precondition', Precondition_Error] | ['procedure', Procedure_Error];
|
|
4
|
-
export declare const conditional_async: <Precondition_Error, Procedure_Error>(precondition:
|
|
4
|
+
export declare const conditional_async: <Precondition_Error, Procedure_Error>(precondition: Basic_Query_Promise<boolean, Precondition_Error>, procedure: _et.Procedure_Promise<Procedure_Error>) => _et.Procedure_Promise<Conditional_Async_Error<Precondition_Error, Procedure_Error>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.conditional_async = void 0;
|
|
4
|
-
const
|
|
4
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
5
5
|
const conditional_async = (precondition, procedure) => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
7
7
|
'execute': (on_success, on_exception) => {
|
|
8
8
|
precondition.__start(($) => {
|
|
9
9
|
if ($) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
import {
|
|
2
|
+
import { Basic_Query_Promise } from '../types/Basic_Query';
|
|
3
3
|
export type Conditional_Multiple_Error<Precondition_Error, Procedure_Error> = ['preconditions', _et.Dictionary<Precondition_Error>] | ['procedure', Procedure_Error];
|
|
4
|
-
export declare const conditional_multiple: <Precondition_Error, Procedure_Error>(preconditions: _et.Dictionary<
|
|
4
|
+
export declare const conditional_multiple: <Precondition_Error, Procedure_Error>(preconditions: _et.Dictionary<Basic_Query_Promise<boolean, Precondition_Error>>, procedure: _et.Procedure_Promise<Procedure_Error>) => _et.Procedure_Promise<Conditional_Multiple_Error<Precondition_Error, Procedure_Error>>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.conditional_multiple = void 0;
|
|
4
4
|
const unguaranteed_query_dictionary_1 = require("../query/unguaranteed_query_dictionary");
|
|
5
|
-
const
|
|
5
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
6
6
|
const conditional_multiple = (preconditions, procedure) => {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
8
8
|
'execute': (on_success, on_exception) => {
|
|
9
9
|
(0, unguaranteed_query_dictionary_1.unguaranteed_query_dictionary)(preconditions).__start(($) => {
|
|
10
10
|
let has_errors = false;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
export declare const conditional_sync: <Procedure_Error>(precondition: boolean, procedure: _et.
|
|
2
|
+
export declare const conditional_sync: <Procedure_Error>(precondition: boolean, procedure: _et.Procedure_Promise<Procedure_Error>) => _et.Procedure_Promise<Procedure_Error>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.conditional_sync = void 0;
|
|
4
|
-
const
|
|
4
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
5
5
|
const conditional_sync = (precondition, procedure) => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
7
7
|
'execute': (on_success, on_exception) => {
|
|
8
8
|
if (precondition) {
|
|
9
9
|
procedure.__start(on_success, on_exception);
|
|
@@ -3,4 +3,4 @@ export type Sequence_Error<Err> = {
|
|
|
3
3
|
'error': Err;
|
|
4
4
|
'step': string;
|
|
5
5
|
};
|
|
6
|
-
export declare const sequence: <Err>(steps: _et.Dictionary<_et.
|
|
6
|
+
export declare const sequence: <Err>(steps: _et.Dictionary<_et.Procedure_Promise<Err>>) => _et.Procedure_Promise<Sequence_Error<Err>>;
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.sequence = void 0;
|
|
27
27
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
|
-
const
|
|
28
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
29
29
|
const op_dictionary_to_list_based_on_insertion_order = (dict) => {
|
|
30
30
|
const temp = [];
|
|
31
31
|
dict.map(($, key) => {
|
|
@@ -34,7 +34,7 @@ const op_dictionary_to_list_based_on_insertion_order = (dict) => {
|
|
|
34
34
|
return _ei.array_literal(temp);
|
|
35
35
|
};
|
|
36
36
|
const sequence = (steps) => {
|
|
37
|
-
return (0,
|
|
37
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
38
38
|
'execute': (on_success, on_exception) => {
|
|
39
39
|
const as_list = op_dictionary_to_list_based_on_insertion_order(steps);
|
|
40
40
|
let current = 0;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
export type Three_Steps_Error<Step_1_Error, Step_2_Error, Step_3_Error> = ['step1', Step_1_Error] | ['step2', Step_2_Error] | ['step3', Step_3_Error];
|
|
3
|
-
export declare const three_steps: <Step_1_Error, Step_2_Error, Step_3_Error>(step_1: _et.
|
|
3
|
+
export declare const three_steps: <Step_1_Error, Step_2_Error, Step_3_Error>(step_1: _et.Procedure_Promise<Step_1_Error>, step_2: _et.Procedure_Promise<Step_2_Error>, step_3: _et.Procedure_Promise<Step_3_Error>) => _et.Procedure_Promise<Three_Steps_Error<Step_1_Error, Step_2_Error, Step_3_Error>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.three_steps = void 0;
|
|
4
|
-
const
|
|
4
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
5
5
|
const three_steps = (step_1, step_2, step_3) => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
7
7
|
'execute': (on_success, on_exception) => {
|
|
8
8
|
step_1.__start(() => {
|
|
9
9
|
step_2.__start(() => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
2
|
export type Two_Steps_Error<Step_1_Error, Step_2_Error> = ['step1', Step_1_Error] | ['step2', Step_2_Error];
|
|
3
|
-
export declare const two_steps: <Step_1_Error, Step_2_Error>(step_1: _et.
|
|
3
|
+
export declare const two_steps: <Step_1_Error, Step_2_Error>(step_1: _et.Procedure_Promise<Step_1_Error>, step_2: _et.Procedure_Promise<Step_2_Error>) => _et.Procedure_Promise<Two_Steps_Error<Step_1_Error, Step_2_Error>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.two_steps = void 0;
|
|
4
|
-
const
|
|
4
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
5
5
|
const two_steps = (step_1, step_2) => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
7
7
|
'execute': (on_success, on_exception) => {
|
|
8
8
|
step_1.__start(() => {
|
|
9
9
|
step_2.__start(on_success, (error) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
export declare const unguaranteed_procedure_dictionary: <Error>($: _et.Dictionary<_et.
|
|
2
|
+
export declare const unguaranteed_procedure_dictionary: <Error>($: _et.Dictionary<_et.Procedure_Promise<Error>>) => _et.Procedure_Promise<_et.Dictionary<Error>>;
|
|
@@ -25,9 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.unguaranteed_procedure_dictionary = void 0;
|
|
27
27
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
|
-
const
|
|
28
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
29
29
|
const unguaranteed_procedure_dictionary = ($) => {
|
|
30
|
-
return (0,
|
|
30
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
31
31
|
'execute': (on_success, on_exception) => {
|
|
32
32
|
let count_down = $.__get_number_of_entries();
|
|
33
33
|
let has_errors = false;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
import {
|
|
3
|
-
export declare const transform_query: <In, Out, Error>(query:
|
|
2
|
+
import { Basic_Query_Promise } from '../types/Basic_Query';
|
|
3
|
+
export declare const transform_query: <In, Out, Error>(query: Basic_Query_Promise<In, Error>, transform: ($: In) => Out) => _et.Query_Promise<Out, Error>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transform_query = void 0;
|
|
4
|
-
const
|
|
4
|
+
const create_query_1 = require("../algorithms/query/create_query");
|
|
5
5
|
const transform_query = (query, transform) => {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, create_query_1.__create_unguaranteed_query)({
|
|
7
7
|
'execute': (on_success, on_exception) => {
|
|
8
8
|
query.__start(($) => {
|
|
9
9
|
on_success(transform($));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
import {
|
|
3
|
-
export declare const unguaranteed_query_dictionary: <Result, Error>($: _et.Dictionary<
|
|
2
|
+
import { Basic_Query_Promise } from '../types/Basic_Query';
|
|
3
|
+
export declare const unguaranteed_query_dictionary: <Result, Error>($: _et.Dictionary<Basic_Query_Promise<Result, Error>>) => _et.Query_Promise<_et.Dictionary<Result>, _et.Dictionary<Error>>;
|
|
@@ -25,9 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.unguaranteed_query_dictionary = void 0;
|
|
27
27
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
|
-
const
|
|
28
|
+
const create_query_1 = require("../algorithms/query/create_query");
|
|
29
29
|
const unguaranteed_query_dictionary = ($) => {
|
|
30
|
-
return (0,
|
|
30
|
+
return (0, create_query_1.__create_unguaranteed_query)({
|
|
31
31
|
'execute': (on_success, on_exception) => {
|
|
32
32
|
let count_down = $.__get_number_of_entries();
|
|
33
33
|
let has_errors = false;
|
package/dist/shorthands.d.ts
CHANGED
|
@@ -1,85 +1,40 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
import {
|
|
3
|
-
import { Basic_Guaranteed_Query_Promise } from "./types/Basic_Guaranteed_Query";
|
|
2
|
+
import { Basic_Query_Promise } from "./types/Basic_Query";
|
|
4
3
|
import { Error_Handler } from "./types/Error_Handler";
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param action gpi
|
|
8
|
-
* @param error_transform gt
|
|
9
|
-
*/
|
|
10
|
-
export declare const eh: <Parameters, Error, Resources>(action: _et.Guaranteed_Procedure<Parameters, Resources>, error_transform: _et.Transformer_Without_Parameters<Error, Parameters>, resources: Resources) => Error_Handler<Error>;
|
|
11
|
-
export declare namespace gp {
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param action gpi
|
|
15
|
-
* @param query g.q
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
const action: <Parameters, Resources>(action: _et.Guaranteed_Procedure<Parameters, Resources>, query: Basic_Guaranteed_Query_Promise<Parameters>, $r: Resources) => _et.Guaranteed_Procedure_Promise;
|
|
19
|
-
}
|
|
20
|
-
export declare namespace gq {
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param query_result qr
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
const fixed: <Query_Result>(query_result: Query_Result) => Basic_Guaranteed_Query_Promise<Query_Result>;
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* @param the_query gqi
|
|
30
|
-
* @param parameters g.q
|
|
31
|
-
* @param result_transformation gt
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
const g: <Result_After_Transformation, Parameters, Query_Result, Resources>(the_query: _et.Guaranteed_Query<Parameters, Query_Result, Resources>, parameters: Basic_Guaranteed_Query_Promise<Parameters>, result_transformation: _et.Transformer_Without_Parameters<Query_Result, Result_After_Transformation>, resources: Resources) => Basic_Guaranteed_Query_Promise<Result_After_Transformation>;
|
|
35
|
-
}
|
|
36
|
-
export declare namespace gt {
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param the_transformation gt
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
const g: <In, Out>(the_transformation: _et.Transformer_Without_Parameters<In, Out>) => _et.Transformer_Without_Parameters<In, Out>;
|
|
43
|
-
}
|
|
44
4
|
export declare namespace up {
|
|
45
5
|
/**
|
|
46
6
|
*
|
|
47
7
|
* @param action upi
|
|
48
8
|
* @param query u.q
|
|
49
9
|
*/
|
|
50
|
-
const action: <Error, Parameters, Resources>(action: _et.
|
|
10
|
+
const action: <Error, Parameters, Resources>(action: _et.Procedure<Parameters, Error, Resources>, query: Basic_Query_Promise<Parameters, Error>, resources: Resources) => _et.Procedure_Promise<Error>;
|
|
51
11
|
/**
|
|
52
12
|
*
|
|
53
13
|
* @param steps up[]
|
|
54
14
|
* @returns
|
|
55
15
|
*/
|
|
56
|
-
const sequence: <Error>(steps: _et.
|
|
16
|
+
const sequence: <Error>(steps: _et.Procedure_Promise<Error>[]) => _et.Procedure_Promise<Error>;
|
|
57
17
|
/**
|
|
58
18
|
*
|
|
59
19
|
* @param the_array up[]
|
|
60
20
|
* @param aggregate_exceptions gt
|
|
61
21
|
* @returns
|
|
62
22
|
*/
|
|
63
|
-
const array: <Error, Element_Error>(the_array: _et.Array<_et.
|
|
23
|
+
const array: <Error, Element_Error>(the_array: _et.Array<_et.Procedure_Promise<Element_Error>>, aggregate_exceptions: _et.Transformer_Without_Parameters<_et.Array<Element_Error>, Error>) => _et.Procedure_Promise<Error>;
|
|
64
24
|
/**
|
|
65
25
|
*
|
|
66
26
|
* @param the_dictionary dict<up>
|
|
67
27
|
* @param aggregate_exceptions gt
|
|
68
28
|
* @returns
|
|
69
29
|
*/
|
|
70
|
-
const dictionary: <Error, Element_Error>(the_dictionary: _et.Dictionary<_et.
|
|
30
|
+
const dictionary: <Error, Element_Error>(the_dictionary: _et.Dictionary<_et.Procedure_Promise<Element_Error>>, aggregate_exceptions: _et.Transformer_Without_Parameters<_et.Dictionary<Element_Error>, Error>) => _et.Procedure_Promise<Error>;
|
|
71
31
|
}
|
|
72
32
|
export declare namespace upi {
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
* @param action gpi
|
|
76
|
-
*/
|
|
77
|
-
const g: <Parameters, Error, Resources>(action: _et.Guaranteed_Procedure<Parameters, Resources>, $r: Resources) => _et.Unguaranteed_Procedure<Parameters, Error, Resources>;
|
|
78
33
|
/**
|
|
79
34
|
*
|
|
80
35
|
* @param action upi
|
|
81
36
|
*/
|
|
82
|
-
const u: <Parameters, Error, Action_Error, Resources>(action: _et.
|
|
37
|
+
const u: <Parameters, Error, Action_Error, Resources>(action: _et.Procedure<Parameters, Action_Error, Resources>, error_transform: _et.Transformer_Without_Parameters<Action_Error, Error>, error_handler?: Error_Handler<Action_Error>) => _et.Procedure<Parameters, Error, Resources>;
|
|
83
38
|
}
|
|
84
39
|
export declare namespace uq {
|
|
85
40
|
/**
|
|
@@ -87,7 +42,7 @@ export declare namespace uq {
|
|
|
87
42
|
* @param query_result qr
|
|
88
43
|
* @returns
|
|
89
44
|
*/
|
|
90
|
-
const fixed: <Query_Result, Error>(query_result: Query_Result) =>
|
|
45
|
+
const fixed: <Query_Result, Error>(query_result: Query_Result) => Basic_Query_Promise<Query_Result, Error>;
|
|
91
46
|
/**
|
|
92
47
|
* unguaranteed query
|
|
93
48
|
* @param the_query uqi
|
|
@@ -97,14 +52,7 @@ export declare namespace uq {
|
|
|
97
52
|
* @param error_handler eh
|
|
98
53
|
* @returns
|
|
99
54
|
*/
|
|
100
|
-
const u: <Result_After_Transformation, Error, Parameters, Query_Result, Query_Error, Resources>(the_query: _et.
|
|
101
|
-
/**
|
|
102
|
-
* guaranteed query
|
|
103
|
-
* @param the_query gqi
|
|
104
|
-
* @param parameters u.q
|
|
105
|
-
* @param result_refinement ut
|
|
106
|
-
*/
|
|
107
|
-
const g: <Result_After_Transformation, Error, Parameters, Query_Result, Resources>(the_query: _et.Guaranteed_Query<Parameters, Query_Result, Resources>, parameters: Basic_Unguaranteed_Query_Promise<Parameters, Error>, result_refinement: _et.Refiner_Without_Parameters<Query_Result, Result_After_Transformation, Error>, resources: Resources) => Basic_Unguaranteed_Query_Promise<Result_After_Transformation, Error>;
|
|
55
|
+
const u: <Result_After_Transformation, Error, Parameters, Query_Result, Query_Error, Resources>(the_query: _et.Query<Parameters, Query_Result, Query_Error, Resources>, parameters: Basic_Query_Promise<Parameters, Error>, resources: Resources, result_refinement: _et.Refiner_Without_Parameters<Query_Result, Result_After_Transformation, Error>, error_transform: _et.Transformer_Without_Parameters<Query_Error, Error>, error_handler?: Error_Handler<Query_Error>) => Basic_Query_Promise<Result_After_Transformation, Error>;
|
|
108
56
|
}
|
|
109
57
|
export declare namespace ut {
|
|
110
58
|
/**
|
package/dist/shorthands.js
CHANGED
|
@@ -23,85 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ut = exports.uq = exports.upi = exports.up =
|
|
26
|
+
exports.ut = exports.uq = exports.upi = exports.up = void 0;
|
|
27
27
|
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
|
-
const
|
|
28
|
+
const initialize_procedure_1 = require("./algorithms/procedure/initialize_procedure");
|
|
29
29
|
const create_asynchronous_processes_monitor_1 = require("./create_asynchronous_processes_monitor");
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param action gpi
|
|
33
|
-
* @param error_transform gt
|
|
34
|
-
*/
|
|
35
|
-
const eh = (action, error_transform, resources) => {
|
|
36
|
-
return ($) => {
|
|
37
|
-
action(resources)(error_transform($)).__start(() => { });
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
exports.eh = eh;
|
|
41
|
-
var gp;
|
|
42
|
-
(function (gp) {
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param action gpi
|
|
46
|
-
* @param query g.q
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
gp.action = (action, query, $r) => {
|
|
50
|
-
return {
|
|
51
|
-
__start: (on_finished) => {
|
|
52
|
-
//run the query
|
|
53
|
-
query.__start((query_result) => {
|
|
54
|
-
//run the action
|
|
55
|
-
action($r)(query_result).__start(on_finished);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
})(gp || (exports.gp = gp = {}));
|
|
61
|
-
var gq;
|
|
62
|
-
(function (gq) {
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @param query_result qr
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
gq.fixed = (query_result) => {
|
|
69
|
-
return {
|
|
70
|
-
__start: (on_finished) => {
|
|
71
|
-
on_finished(query_result);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @param the_query gqi
|
|
78
|
-
* @param parameters g.q
|
|
79
|
-
* @param result_transformation gt
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
gq.g = (the_query, parameters, result_transformation, resources) => {
|
|
83
|
-
return {
|
|
84
|
-
__start: (on_finished) => {
|
|
85
|
-
parameters.__start((qr_in) => {
|
|
86
|
-
the_query(resources)(qr_in).__start((result) => {
|
|
87
|
-
on_finished(result_transformation(result));
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
})(gq || (exports.gq = gq = {}));
|
|
94
|
-
var gt;
|
|
95
|
-
(function (gt) {
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @param the_transformation gt
|
|
99
|
-
* @returns
|
|
100
|
-
*/
|
|
101
|
-
gt.g = (the_transformation) => {
|
|
102
|
-
return ($) => the_transformation($);
|
|
103
|
-
};
|
|
104
|
-
})(gt || (exports.gt = gt = {}));
|
|
105
30
|
var up;
|
|
106
31
|
(function (up) {
|
|
107
32
|
/**
|
|
@@ -110,7 +35,7 @@ var up;
|
|
|
110
35
|
* @param query u.q
|
|
111
36
|
*/
|
|
112
37
|
up.action = (action, query, resources) => {
|
|
113
|
-
return (0,
|
|
38
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
114
39
|
'execute': (on_success, on_error) => {
|
|
115
40
|
//run the query
|
|
116
41
|
query.__start((query_result) => {
|
|
@@ -129,7 +54,7 @@ var up;
|
|
|
129
54
|
* @returns
|
|
130
55
|
*/
|
|
131
56
|
up.sequence = (steps) => {
|
|
132
|
-
return (0,
|
|
57
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
133
58
|
'execute': (on_success, on_error) => {
|
|
134
59
|
const length = _ei.array_literal(steps).__get_number_of_elements();
|
|
135
60
|
const runStep = (index) => {
|
|
@@ -150,7 +75,7 @@ var up;
|
|
|
150
75
|
* @returns
|
|
151
76
|
*/
|
|
152
77
|
up.array = (the_array, aggregate_exceptions) => {
|
|
153
|
-
return (0,
|
|
78
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
154
79
|
'execute': (on_success, on_error) => {
|
|
155
80
|
const exceptions = [];
|
|
156
81
|
(0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
|
|
@@ -181,7 +106,7 @@ var up;
|
|
|
181
106
|
* @returns
|
|
182
107
|
*/
|
|
183
108
|
up.dictionary = (the_dictionary, aggregate_exceptions) => {
|
|
184
|
-
return (0,
|
|
109
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
185
110
|
'execute': (on_success, on_error) => {
|
|
186
111
|
const exceptions = {};
|
|
187
112
|
(0, create_asynchronous_processes_monitor_1.create_asynchronous_processes_monitor)((monitor) => {
|
|
@@ -208,23 +133,12 @@ var up;
|
|
|
208
133
|
})(up || (exports.up = up = {}));
|
|
209
134
|
var upi;
|
|
210
135
|
(function (upi) {
|
|
211
|
-
/**
|
|
212
|
-
*
|
|
213
|
-
* @param action gpi
|
|
214
|
-
*/
|
|
215
|
-
upi.g = (action, $r) => () => ($) => {
|
|
216
|
-
return (0, initialize_unguaranteed_procedure_1.__create_unguaranteed_procedure)({
|
|
217
|
-
'execute': (on_succes, on_error) => {
|
|
218
|
-
action($r)($).__start(on_succes);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
136
|
/**
|
|
223
137
|
*
|
|
224
138
|
* @param action upi
|
|
225
139
|
*/
|
|
226
140
|
upi.u = (action, error_transform, error_handler) => ($r) => ($) => {
|
|
227
|
-
return (0,
|
|
141
|
+
return (0, initialize_procedure_1.__create_unguaranteed_procedure)({
|
|
228
142
|
'execute': (on_succes, on_error) => {
|
|
229
143
|
action($r)($).__start(on_succes, (error) => {
|
|
230
144
|
if (error_handler !== undefined) {
|
|
@@ -275,23 +189,6 @@ var uq;
|
|
|
275
189
|
}
|
|
276
190
|
};
|
|
277
191
|
};
|
|
278
|
-
/**
|
|
279
|
-
* guaranteed query
|
|
280
|
-
* @param the_query gqi
|
|
281
|
-
* @param parameters u.q
|
|
282
|
-
* @param result_refinement ut
|
|
283
|
-
*/
|
|
284
|
-
uq.g = (the_query, parameters, result_refinement, resources) => {
|
|
285
|
-
return {
|
|
286
|
-
__start: (on_success, on_error) => {
|
|
287
|
-
parameters.__start((x) => {
|
|
288
|
-
the_query(resources)(x).__start(($) => {
|
|
289
|
-
result_refinement($).process((x) => on_success(x), on_error);
|
|
290
|
-
});
|
|
291
|
-
}, on_error);
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
};
|
|
295
192
|
})(uq || (exports.uq = uq = {}));
|
|
296
193
|
var ut;
|
|
297
194
|
(function (ut) {
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as _et from "exupery-core-types";
|
|
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 __create_guaranted_procedure(executer: Executer): _et.Guaranteed_Procedure_Promise;
|
|
11
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.__create_guaranted_procedure = __create_guaranted_procedure;
|
|
4
|
-
class Guaranteed_Procedure_Promise_Class {
|
|
5
|
-
constructor(executer) {
|
|
6
|
-
this.executer = executer;
|
|
7
|
-
}
|
|
8
|
-
__start(on_finished) {
|
|
9
|
-
this.executer.execute(on_finished);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* returns an {@link Async_Value }
|
|
14
|
-
* @param executer the function that produces the eventual value
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
function __create_guaranted_procedure(executer) {
|
|
18
|
-
return new Guaranteed_Procedure_Promise_Class(executer);
|
|
19
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as _et from "exupery-core-types";
|
|
2
|
-
type Executer<T> = {
|
|
3
|
-
'execute': (on_value: ($: T) => 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 __create_guaranteed_query<T>(executer: Executer<T>): _et.Guaranteed_Query_Promise<T>;
|
|
11
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.__create_guaranteed_query = __create_guaranteed_query;
|
|
4
|
-
class Guaranteed_Query_Result_Promise_Class {
|
|
5
|
-
constructor(executer) {
|
|
6
|
-
this.executer = executer;
|
|
7
|
-
}
|
|
8
|
-
map(handle_value) {
|
|
9
|
-
return __create_guaranteed_query({
|
|
10
|
-
'execute': (on_value) => {
|
|
11
|
-
this.executer.execute((value) => {
|
|
12
|
-
on_value(handle_value(value));
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
then(handle_value) {
|
|
18
|
-
return __create_guaranteed_query({
|
|
19
|
-
'execute': (on_value) => {
|
|
20
|
-
this.executer.execute((value) => {
|
|
21
|
-
handle_value(value).__start(on_value);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
__start(on_value) {
|
|
27
|
-
this.executer.execute(on_value);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* returns an {@link Async_Value }
|
|
32
|
-
* @param executer the function that produces the eventual value
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
function __create_guaranteed_query(executer) {
|
|
36
|
-
return new Guaranteed_Query_Result_Promise_Class(executer);
|
|
37
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as _et from 'exupery-core-types';
|
|
2
|
-
export type Sync_Tuple_2<T1, T2> = {
|
|
3
|
-
readonly 'first': T1;
|
|
4
|
-
readonly 'second': T2;
|
|
5
|
-
};
|
|
6
|
-
export declare function merge_2_unguaranteed_queries<T1, T2>(first: _et.Guaranteed_Query_Promise<T1>, second: _et.Guaranteed_Query_Promise<T2>): _et.Guaranteed_Query_Promise<Sync_Tuple_2<T1, T2>>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.merge_2_unguaranteed_queries = merge_2_unguaranteed_queries;
|
|
4
|
-
const create_guaranteed_query_1 = require("./create_guaranteed_query");
|
|
5
|
-
function merge_2_unguaranteed_queries(first, second) {
|
|
6
|
-
return (0, create_guaranteed_query_1.__create_guaranteed_query)({
|
|
7
|
-
'execute': (on_value) => {
|
|
8
|
-
let element_1_is_set = false;
|
|
9
|
-
let element_2_is_set = false;
|
|
10
|
-
let elem1;
|
|
11
|
-
let elem2;
|
|
12
|
-
function wrap_up() {
|
|
13
|
-
if (element_1_is_set && element_2_is_set) {
|
|
14
|
-
on_value({ first: elem1, second: elem2 });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
first.__start((val) => {
|
|
18
|
-
elem1 = val;
|
|
19
|
-
element_1_is_set = true;
|
|
20
|
-
wrap_up();
|
|
21
|
-
});
|
|
22
|
-
second.__start((val) => {
|
|
23
|
-
elem2 = val;
|
|
24
|
-
element_2_is_set = true;
|
|
25
|
-
wrap_up();
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
File without changes
|