exupery-core-async 0.3.10 → 0.3.12
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/procedure/dictionary_sequence.d.ts +6 -0
- package/dist/procedure/dictionary_sequence.js +61 -0
- package/dist/procedure/execute_with_async_data.d.ts +2 -0
- package/dist/procedure/execute_with_async_data.js +14 -0
- package/dist/procedure/sequence.d.ts +1 -5
- package/dist/procedure/sequence.js +3 -41
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ export * from "./algorithms/procedure/initialize_procedure";
|
|
|
5
5
|
export * from "./shorthands";
|
|
6
6
|
export * from "./procedure/assert_async";
|
|
7
7
|
export * from "./procedure/assert_sync";
|
|
8
|
+
export * from "./procedure/execute_with_async_data";
|
|
8
9
|
export * from "./procedure/conditional_async";
|
|
9
10
|
export * from "./procedure/conditional_multiple";
|
|
10
11
|
export * from "./procedure/conditional_sync";
|
|
12
|
+
export * from "./procedure/dictionary_sequence";
|
|
11
13
|
export * from "./procedure/sequence";
|
|
12
14
|
export * from "./procedure/three_steps";
|
|
13
15
|
export * from "./procedure/two_steps";
|
package/dist/index.js
CHANGED
|
@@ -24,9 +24,11 @@ __exportStar(require("./shorthands"), exports);
|
|
|
24
24
|
// procedure exports
|
|
25
25
|
__exportStar(require("./procedure/assert_async"), exports);
|
|
26
26
|
__exportStar(require("./procedure/assert_sync"), exports);
|
|
27
|
+
__exportStar(require("./procedure/execute_with_async_data"), exports);
|
|
27
28
|
__exportStar(require("./procedure/conditional_async"), exports);
|
|
28
29
|
__exportStar(require("./procedure/conditional_multiple"), exports);
|
|
29
30
|
__exportStar(require("./procedure/conditional_sync"), exports);
|
|
31
|
+
__exportStar(require("./procedure/dictionary_sequence"), exports);
|
|
30
32
|
__exportStar(require("./procedure/sequence"), exports);
|
|
31
33
|
__exportStar(require("./procedure/three_steps"), exports);
|
|
32
34
|
__exportStar(require("./procedure/two_steps"), exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.dictionary_sequence = void 0;
|
|
27
|
+
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
29
|
+
const op_dictionary_to_list_based_on_insertion_order = (dict) => {
|
|
30
|
+
const temp = [];
|
|
31
|
+
dict.map(($, key) => {
|
|
32
|
+
temp.push({ key, value: $ });
|
|
33
|
+
});
|
|
34
|
+
return _ei.array_literal(temp);
|
|
35
|
+
};
|
|
36
|
+
const dictionary_sequence = (steps) => {
|
|
37
|
+
return (0, initialize_procedure_1.__create_procedure)({
|
|
38
|
+
'execute': (on_success, on_exception) => {
|
|
39
|
+
const as_list = op_dictionary_to_list_based_on_insertion_order(steps);
|
|
40
|
+
let current = 0;
|
|
41
|
+
const do_next = () => {
|
|
42
|
+
as_list.__get_element_at(current).transform(($) => {
|
|
43
|
+
const key = $.key;
|
|
44
|
+
current += 1;
|
|
45
|
+
$.value.__start(() => {
|
|
46
|
+
do_next();
|
|
47
|
+
}, ($) => {
|
|
48
|
+
on_exception({
|
|
49
|
+
'error': $,
|
|
50
|
+
'step': key,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}, () => {
|
|
54
|
+
on_success();
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
do_next();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
exports.dictionary_sequence = dictionary_sequence;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute_with_async_data = void 0;
|
|
4
|
+
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
5
|
+
const execute_with_async_data = (procedure, query) => {
|
|
6
|
+
return (0, initialize_procedure_1.__create_procedure)({
|
|
7
|
+
'execute': (on_success, on_exception) => {
|
|
8
|
+
query.__start((query_result) => {
|
|
9
|
+
procedure(query_result).__start(on_success, on_exception);
|
|
10
|
+
}, on_exception);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
exports.execute_with_async_data = execute_with_async_data;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
import * as _et from 'exupery-core-types';
|
|
2
|
-
export
|
|
3
|
-
'error': Err;
|
|
4
|
-
'step': string;
|
|
5
|
-
};
|
|
6
|
-
export declare const sequence: <Err>(steps: _et.Dictionary<_et.Procedure_Promise<Err>>) => _et.Procedure_Promise<Sequence_Error<Err>>;
|
|
2
|
+
export declare const sequence: <Error>(steps: _et.Array<_et.Procedure_Promise<Error>>) => _et.Procedure_Promise<Error>;
|
|
@@ -1,55 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.sequence = void 0;
|
|
27
|
-
const _ei = __importStar(require("exupery-core-internals"));
|
|
28
4
|
const initialize_procedure_1 = require("../algorithms/procedure/initialize_procedure");
|
|
29
|
-
const op_dictionary_to_list_based_on_insertion_order = (dict) => {
|
|
30
|
-
const temp = [];
|
|
31
|
-
dict.map(($, key) => {
|
|
32
|
-
temp.push({ key, value: $ });
|
|
33
|
-
});
|
|
34
|
-
return _ei.array_literal(temp);
|
|
35
|
-
};
|
|
36
5
|
const sequence = (steps) => {
|
|
37
6
|
return (0, initialize_procedure_1.__create_procedure)({
|
|
38
7
|
'execute': (on_success, on_exception) => {
|
|
39
|
-
const as_list = op_dictionary_to_list_based_on_insertion_order(steps);
|
|
40
8
|
let current = 0;
|
|
41
9
|
const do_next = () => {
|
|
42
|
-
|
|
43
|
-
const key = $.key;
|
|
10
|
+
steps.__get_element_at(current).transform(($) => {
|
|
44
11
|
current += 1;
|
|
45
|
-
$.
|
|
12
|
+
$.__start(() => {
|
|
46
13
|
do_next();
|
|
47
|
-
},
|
|
48
|
-
on_exception({
|
|
49
|
-
'error': $,
|
|
50
|
-
'step': key,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
14
|
+
}, on_exception);
|
|
53
15
|
}, () => {
|
|
54
16
|
on_success();
|
|
55
17
|
});
|