exupery-core-internals 0.3.4 → 0.3.6
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/create_data_preparation_result.d.ts +10 -0
- package/dist/create_data_preparation_result.js +55 -0
- package/dist/imp/public/procedural_builder.d.ts +1 -0
- package/dist/imp/public/procedural_builder.js +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/refinement.d.ts +0 -5
- package/dist/refinement.js +0 -50
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _et from "exupery-core-types";
|
|
2
|
+
/**
|
|
3
|
+
* this function contains the body in which the async value or error is executed
|
|
4
|
+
* after the execution, either the on_result or on_error callback will be called
|
|
5
|
+
* @param on_result the callback to call when a value is produced
|
|
6
|
+
* @param on_error the callback to call when an error is produced
|
|
7
|
+
*/
|
|
8
|
+
type Executer<Output, Error> = (on_result: ($: Output) => void, on_error: ($: Error) => void) => void;
|
|
9
|
+
export declare function __create_data_preparation_result<T, E>(executer: Executer<T, E>): _et.Data_Preparation_Result<T, E>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__create_data_preparation_result = __create_data_preparation_result;
|
|
4
|
+
class Data_Preparation_Result_Class {
|
|
5
|
+
constructor(executer) {
|
|
6
|
+
this.executer = executer;
|
|
7
|
+
}
|
|
8
|
+
transform(transformer) {
|
|
9
|
+
return new Data_Preparation_Result_Class((on_result, on_error) => {
|
|
10
|
+
this.executer(($) => {
|
|
11
|
+
on_result(transformer($));
|
|
12
|
+
}, on_error);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
transform_error_temp(transform_error) {
|
|
16
|
+
return new Data_Preparation_Result_Class((on_result, on_error) => {
|
|
17
|
+
this.executer(on_result, ($) => {
|
|
18
|
+
on_error(transform_error($));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
process_without_error_transformation(processor) {
|
|
23
|
+
return new Data_Preparation_Result_Class((on_result, on_error) => {
|
|
24
|
+
this.executer(($) => {
|
|
25
|
+
processor($).__extract_data(on_result, on_error);
|
|
26
|
+
}, on_error);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
process(processor, transform_error) {
|
|
30
|
+
return new Data_Preparation_Result_Class((on_result, on_error) => {
|
|
31
|
+
this.executer(($) => {
|
|
32
|
+
processor($).__extract_data(on_result, (processor_error) => {
|
|
33
|
+
on_error(transform_error(processor_error));
|
|
34
|
+
});
|
|
35
|
+
}, on_error);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
rework_error_temp(rework_error, transform_rework_error) {
|
|
39
|
+
return new Data_Preparation_Result_Class((on_result, on_error) => {
|
|
40
|
+
this.executer(on_result, ($) => {
|
|
41
|
+
rework_error($).__extract_data((new_target_error) => {
|
|
42
|
+
on_error(new_target_error);
|
|
43
|
+
}, (rework_error) => {
|
|
44
|
+
on_error(transform_rework_error(rework_error));
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
__extract_data(on_result, on_error) {
|
|
50
|
+
this.executer(on_result, on_error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function __create_data_preparation_result(executer) {
|
|
54
|
+
return new Data_Preparation_Result_Class(executer);
|
|
55
|
+
}
|
|
@@ -6,6 +6,7 @@ export type Procedural_Dictionary_Builder<Entry> = {
|
|
|
6
6
|
export declare const create_procedural_dictionary_builder: <Entry>() => Procedural_Dictionary_Builder<Entry>;
|
|
7
7
|
export type Procedural_List_Builder<Item> = {
|
|
8
8
|
'add item': (item: Item) => void;
|
|
9
|
+
'add list': (list: _et.Array<Item>) => void;
|
|
9
10
|
'get list': () => _et.Array<Item>;
|
|
10
11
|
};
|
|
11
12
|
export declare const create_procedural_list_builder: <Item>() => Procedural_List_Builder<Item>;
|
|
@@ -21,6 +21,11 @@ const create_procedural_list_builder = () => {
|
|
|
21
21
|
'add item': (item) => {
|
|
22
22
|
items.push(item);
|
|
23
23
|
},
|
|
24
|
+
'add list': (list) => {
|
|
25
|
+
list.__for_each(($) => {
|
|
26
|
+
items.push($);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
24
29
|
'get list': () => {
|
|
25
30
|
return (0, array_literal_1.array_literal)(items);
|
|
26
31
|
},
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -24,4 +24,4 @@ __exportStar(require("./imp/public/panic"), exports);
|
|
|
24
24
|
__exportStar(require("./imp/public/procedural_builder"), exports);
|
|
25
25
|
__exportStar(require("./imp/public/set"), exports);
|
|
26
26
|
__exportStar(require("./imp/public/switch_state"), exports);
|
|
27
|
-
__exportStar(require("./
|
|
27
|
+
__exportStar(require("./create_data_preparation_result"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exupery-core-internals",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "Corno",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"url": "https://github.com/corno/exupery-core/issues"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"exupery-core-types": "^0.3.
|
|
18
|
+
"exupery-core-types": "^0.3.33"
|
|
19
19
|
},
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
21
|
"types": "dist/index.d.ts",
|
package/dist/refinement.d.ts
DELETED
package/dist/refinement.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.refinement = void 0;
|
|
4
|
-
var refinement;
|
|
5
|
-
(function (refinement) {
|
|
6
|
-
refinement.failed = (error) => {
|
|
7
|
-
return {
|
|
8
|
-
'process': (success, error_handler) => {
|
|
9
|
-
error_handler(error);
|
|
10
|
-
},
|
|
11
|
-
'transform': (success, error_handler) => {
|
|
12
|
-
return error_handler(error);
|
|
13
|
-
},
|
|
14
|
-
'with_result': (success) => {
|
|
15
|
-
return refinement.failed(error);
|
|
16
|
-
},
|
|
17
|
-
'map': (handle_value, handle_error) => {
|
|
18
|
-
return refinement.failed(handle_error(error));
|
|
19
|
-
},
|
|
20
|
-
'map_result': (handle_value) => {
|
|
21
|
-
return refinement.failed(error);
|
|
22
|
-
},
|
|
23
|
-
'transform_error': (handle_error) => {
|
|
24
|
-
return refinement.failed(handle_error(error));
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
refinement.successful = (value) => {
|
|
29
|
-
return {
|
|
30
|
-
'process': (success, error_handler) => {
|
|
31
|
-
success(value);
|
|
32
|
-
},
|
|
33
|
-
'transform': (success, error_handler) => {
|
|
34
|
-
return success(value);
|
|
35
|
-
},
|
|
36
|
-
'with_result': (success) => {
|
|
37
|
-
return success(value);
|
|
38
|
-
},
|
|
39
|
-
'map': (handle_value, handle_error) => {
|
|
40
|
-
return refinement.successful(handle_value(value));
|
|
41
|
-
},
|
|
42
|
-
'map_result': (handle_value) => {
|
|
43
|
-
return refinement.successful(handle_value(value));
|
|
44
|
-
},
|
|
45
|
-
'transform_error': (handle_error) => {
|
|
46
|
-
return refinement.successful(value);
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
})(refinement || (exports.refinement = refinement = {}));
|