exupery-core-internals 0.3.8 → 0.3.10

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.
@@ -6,5 +6,5 @@ import * as _et from "exupery-core-types";
6
6
  * @param on_error the callback to call when an error is produced
7
7
  */
8
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>;
9
+ export declare function __create_staging_result<T, E>(executer: Executer<T, E>): _et.Staging_Result<T, E>;
10
10
  export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.__create_staging_result = __create_staging_result;
4
+ class Staging_Result_Class {
5
+ constructor(executer) {
6
+ this.executer = executer;
7
+ }
8
+ transform(transformer) {
9
+ return new Staging_Result_Class((on_result, on_error) => {
10
+ this.executer(($) => {
11
+ on_result(transformer($));
12
+ }, on_error);
13
+ });
14
+ }
15
+ transform_error_temp(error_transformer) {
16
+ return new Staging_Result_Class((on_result, on_error) => {
17
+ this.executer(on_result, ($) => {
18
+ on_error(error_transformer($));
19
+ });
20
+ });
21
+ }
22
+ stage_without_error_transformation(stager) {
23
+ return new Staging_Result_Class((on_result, on_error) => {
24
+ this.executer(($) => {
25
+ stager($).__extract_data(on_result, on_error);
26
+ }, on_error);
27
+ });
28
+ }
29
+ stage(stager, transform_error) {
30
+ return new Staging_Result_Class((on_result, on_error) => {
31
+ this.executer(($) => {
32
+ stager($).__extract_data(on_result, (stager_error) => {
33
+ on_error(transform_error(stager_error));
34
+ });
35
+ }, on_error);
36
+ });
37
+ }
38
+ rework_error_temp(error_reworker, rework_error_transformer) {
39
+ return new Staging_Result_Class((on_result, on_error) => {
40
+ this.executer(on_result, ($) => {
41
+ error_reworker($).__extract_data((new_target_error) => {
42
+ on_error(new_target_error);
43
+ }, (rework_error) => {
44
+ on_error(rework_error_transformer(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_staging_result(executer) {
54
+ return new Staging_Result_Class(executer);
55
+ }
@@ -1,5 +1,5 @@
1
1
  import * as _et from 'exupery-core-types';
2
2
  export declare namespace data_processing {
3
- const failed: <T, E>(error: E) => _et.Data_Preparation_Result<T, E>;
4
- const successful: <T, E>(value: T) => _et.Data_Preparation_Result<T, E>;
3
+ const failed: <T, E>(error: E) => _et.Staging_Result<T, E>;
4
+ const successful: <T, E>(value: T) => _et.Staging_Result<T, E>;
5
5
  }
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.data_processing = void 0;
4
- const create_data_preparation_result_1 = require("./create_data_preparation_result");
4
+ const create_staging_result_1 = require("./create_staging_result");
5
5
  var data_processing;
6
6
  (function (data_processing) {
7
7
  data_processing.failed = (error) => {
8
- return (0, create_data_preparation_result_1.__create_data_preparation_result)((on_result, on_error) => {
8
+ return (0, create_staging_result_1.__create_staging_result)((on_result, on_error) => {
9
9
  on_error(error);
10
10
  });
11
11
  };
12
12
  data_processing.successful = (value) => {
13
- return (0, create_data_preparation_result_1.__create_data_preparation_result)((on_result, on_error) => {
13
+ return (0, create_staging_result_1.__create_staging_result)((on_result, on_error) => {
14
14
  on_result(value);
15
15
  });
16
16
  };
@@ -1,4 +1,4 @@
1
- import * as pt from "exupery-core-types";
1
+ import * as _et from "exupery-core-types";
2
2
  /**
3
3
  * returns a Exupery dictionary
4
4
  *
@@ -8,4 +8,4 @@ import * as pt from "exupery-core-types";
8
8
  */
9
9
  export declare function dictionary_literal<T>(source: {
10
10
  readonly [key: string]: T;
11
- }): pt.Dictionary<T>;
11
+ }): _et.Dictionary<T>;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dictionary_literal = dictionary_literal;
4
4
  const set_1 = require("./set");
5
5
  const not_set_1 = require("./not_set");
6
- const array_literal_1 = require("./array_literal");
6
+ const list_literal_1 = require("./list_literal");
7
7
  /**
8
8
  * this is an implementation, not public by design
9
9
  */
@@ -21,7 +21,7 @@ class Dictionary {
21
21
  }
22
22
  deprecated_to_array(compare) {
23
23
  const sorted_keys = this.source.slice().sort(compare);
24
- return (0, array_literal_1.array_literal)(sorted_keys);
24
+ return (0, list_literal_1.list_literal)(sorted_keys);
25
25
  }
26
26
  __get_entry(key) {
27
27
  for (let i = 0; i !== this.source.length; i += 1) {
@@ -5,4 +5,4 @@ import * as _et from "exupery-core-types";
5
5
  * @param source An array literal
6
6
  * @returns
7
7
  */
8
- export declare function array_literal<T>(source: readonly T[]): _et.Array<T>;
8
+ export declare function list_literal<T>(source: readonly T[]): _et.List<T>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.array_literal = array_literal;
3
+ exports.list_literal = list_literal;
4
4
  const not_set_1 = require("./not_set");
5
5
  const set_1 = require("./set");
6
6
  /**
@@ -8,12 +8,12 @@ const set_1 = require("./set");
8
8
  * If you feel the need to rename this class, don't rename it to 'Array',
9
9
  * it will break the 'instanceOf Array' test
10
10
  */
11
- class Array_Class {
11
+ class List_Class {
12
12
  constructor(data) {
13
13
  this.data = data;
14
14
  }
15
15
  map($v) {
16
- return array_literal(this.data.map((entry) => {
16
+ return list_literal(this.data.map((entry) => {
17
17
  return $v(entry);
18
18
  }));
19
19
  }
@@ -42,10 +42,10 @@ class Array_Class {
42
42
  * @param source An array literal
43
43
  * @returns
44
44
  */
45
- function array_literal(source) {
45
+ function list_literal(source) {
46
46
  if (!(source instanceof Array)) {
47
- throw new Error("invalid input in 'array_literal'");
47
+ throw new Error("invalid input in 'list_literal'");
48
48
  }
49
49
  const data = source.slice(); //create a copy
50
- return new Array_Class(data);
50
+ return new List_Class(data);
51
51
  }
@@ -6,7 +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;
10
- 'get list': () => _et.Array<Item>;
9
+ 'add list': (list: _et.List<Item>) => void;
10
+ 'get list': () => _et.List<Item>;
11
11
  };
12
12
  export declare const create_procedural_list_builder: <Item>() => Procedural_List_Builder<Item>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.create_procedural_list_builder = exports.create_procedural_dictionary_builder = void 0;
4
4
  const dictionary_literal_1 = require("./dictionary_literal");
5
- const array_literal_1 = require("./array_literal");
5
+ const list_literal_1 = require("./list_literal");
6
6
  const create_procedural_dictionary_builder = () => {
7
7
  const entries = {};
8
8
  return {
@@ -27,7 +27,7 @@ const create_procedural_list_builder = () => {
27
27
  });
28
28
  },
29
29
  'get list': () => {
30
- return (0, array_literal_1.array_literal)(items);
30
+ return (0, list_literal_1.list_literal)(items);
31
31
  },
32
32
  };
33
33
  };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export * from "./imp/public/array_literal";
1
+ export * from "./imp/public/list_literal";
2
2
  export * from "./imp/public/assert_unreachable";
3
3
  export * from "./imp/public/block";
4
4
  export * from "./imp/public/change_context";
5
5
  export * from "./imp/public/dictionary_literal";
6
6
  export * from "./imp/public/not_set";
7
7
  export * from "./imp/public/panic";
8
- export * from "./imp/public/procedural_builder";
8
+ export * from "./imp/public/procedural_collection_builder";
9
9
  export * from "./imp/public/set";
10
10
  export * from "./imp/public/switch_state";
11
- export * from "./create_data_preparation_result";
11
+ export * from "./create_staging_result";
12
12
  export * from "./data_processing";
package/dist/index.js CHANGED
@@ -14,15 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./imp/public/array_literal"), exports);
17
+ __exportStar(require("./imp/public/list_literal"), exports);
18
18
  __exportStar(require("./imp/public/assert_unreachable"), exports);
19
19
  __exportStar(require("./imp/public/block"), exports);
20
20
  __exportStar(require("./imp/public/change_context"), exports);
21
21
  __exportStar(require("./imp/public/dictionary_literal"), exports);
22
22
  __exportStar(require("./imp/public/not_set"), exports);
23
23
  __exportStar(require("./imp/public/panic"), exports);
24
- __exportStar(require("./imp/public/procedural_builder"), exports);
24
+ __exportStar(require("./imp/public/procedural_collection_builder"), exports);
25
25
  __exportStar(require("./imp/public/set"), exports);
26
26
  __exportStar(require("./imp/public/switch_state"), exports);
27
- __exportStar(require("./create_data_preparation_result"), exports);
27
+ __exportStar(require("./create_staging_result"), exports);
28
28
  __exportStar(require("./data_processing"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-internals",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
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.33"
18
+ "exupery-core-types": "^0.3.41"
19
19
  },
20
20
  "main": "./dist/index.js",
21
21
  "types": "dist/index.d.ts",
@@ -1,55 +0,0 @@
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
- }