exupery-core-types 0.2.0 → 0.3.1

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/Array.d.ts CHANGED
@@ -20,7 +20,7 @@ export interface Array<T> {
20
20
  * This method is only to be used by resources
21
21
  *
22
22
  */
23
- __get_length(): number;
23
+ __get_number_of_elements(): number;
24
24
  /**
25
25
  * This method is only to be used by resources
26
26
  *
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A circular dependency is a function without parameters returning the specified type
3
+ * it makes it possible to do the evaluation only when the function is called
4
+ * useful for lazy evaluation
5
+ */
6
+ export type Circular_Dependency<T> = {
7
+ 'get circular dependent': () => T;
8
+ };
@@ -19,7 +19,7 @@ export interface Dictionary<T> {
19
19
  * This method is only to be used by resources
20
20
  * iterates over all entries in a sorted manner
21
21
  */
22
- to_array(compare: Compare_Function<T>): Array<Key_Value_Pair<T>>;
22
+ deprecated_to_array(compare: Compare_Function<T>): Array<Key_Value_Pair<T>>;
23
23
  /**
24
24
  * This method is only to be used by resources
25
25
  * returns an {@link Optional_Value } of type T reflecting wether the entry existed or not
@@ -27,7 +27,5 @@ export interface Dictionary<T> {
27
27
  * @param key
28
28
  */
29
29
  __get_entry(key: string): Optional_Value<T>;
30
- __add_entry_if_not_exists(key: string, value: T): Dictionary<T>;
31
- __add_entry_overwrite_if_exists(key: string, value: T): Dictionary<T>;
32
- __remove_entry_if_exists(key: string): Dictionary<T>;
30
+ __get_number_of_entries(): number;
33
31
  }
@@ -0,0 +1,4 @@
1
+ export type Guaranteed_Procedure<Parameters, Resources> = ($: Parameters, $r: Resources) => Guaranteed_Procedure_Promise;
2
+ export type Guaranteed_Procedure_Promise = {
3
+ __start: (on_finished: () => void) => void;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ export type Guaranteed_Query<Parameters, Result, Resources> = ($: Parameters, $r: Resources) => Guaranteed_Query_Promise<Result>;
2
+ /**
3
+ * A value that will asynchronously become available.
4
+ * Similar to the concept of a promise, but with a smaller API.
5
+ */
6
+ export type Guaranteed_Query_Promise<Result> = {
7
+ map<NT>(handle_value: ($: Result) => NT): Guaranteed_Query_Promise<NT>;
8
+ /**
9
+ * maps the current async value into a new async value
10
+ * @param handle_value callback that transforms the actual value into a new Async_Value
11
+ */
12
+ then<NT>(handle_value: ($: Result) => Guaranteed_Query_Promise<NT>): Guaranteed_Query_Promise<NT>;
13
+ /**
14
+ * This method is only to be used by resources
15
+ */
16
+ __start(on_finished: ($: Result) => void): void;
17
+ };
18
+ export type Basic_Guaranteed_Query_Promise<Result> = {
19
+ __start: (on_finished: (result: Result) => void) => void;
20
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/Lookup.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import { Optional_Value } from "./Optional_Value";
2
2
  /**
3
3
  * A lookup is similar to a Dictionary, but much more basic.
4
- * There are only operations to retrieve entries
4
+ * There is only 1 operation: __get_entry.
5
5
  */
6
6
  export interface Lookup<T> {
7
7
  /**
8
- * This method is only to be used by resources
9
8
  * returns an {@link Optional_Value } of type T reflecting wether the entry existed or not
10
9
  *
11
10
  * @param key
@@ -0,0 +1,13 @@
1
+ export interface Refinement_Result<T, E> {
2
+ /**
3
+ * @param set what to do when the value was set, returns the new type
4
+ * @param not_set what to do when the value was not set, returns the new type
5
+ */
6
+ process(success: ($: T) => void, exception: ($: E) => void): void;
7
+ map<NT, NE>(handle_value: ($: T) => NT, handle_exception: ($: E) => NE): Refinement_Result<NT, NE>;
8
+ map_result<NT>(handle_value: ($: T) => NT): Refinement_Result<NT, E>;
9
+ transform<NT>(handle_value: ($: T) => NT, handle_exception: ($: E) => NT): NT;
10
+ with_result<NT>(handle_value: ($: T) => Refinement_Result<NT, E>): Refinement_Result<NT, E>;
11
+ }
12
+ export type Refiner_With_Parameters<In, Parameters, Out, Error> = ($: In, $p: Parameters) => Refinement_Result<Out, Error>;
13
+ export type Refiner_Without_Parameters<In, Out, Error> = ($: In) => Refinement_Result<Out, Error>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export type Transformer_With_Parameters<In, Parameters, Out> = ($: In, $p: Parameters) => Out;
2
+ export type Transformer_Without_Parameters<In, Out> = ($: In) => Out;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export type Unguaranteed_Procedure<Parameters, Error, Resources> = ($: Parameters, $r: Resources) => Unguaranteed_Procedure_Promise<Error>;
2
+ export type Unguaranteed_Procedure_Promise<Error> = {
3
+ __start: (on_success: () => void, on_error: (error: Error) => void) => void;
4
+ map_error<NE>(handle_error: (error: Error) => NE): Unguaranteed_Procedure_Promise<NE>;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { Guaranteed_Query_Promise } from "./Guaranteed_Query";
2
+ export type Unguaranteed_Query<Parameters, Result, Error, Resources> = ($: Parameters, $r: Resources) => Unguaranteed_Query_Promise<Result, Error>;
3
+ export type Unguaranteed_Query_Promise<Result, Error> = {
4
+ map_<NT>(handle_value: ($: Result) => NT): Unguaranteed_Query_Promise<NT, Error>;
5
+ map_exception_<NE>(handle_exception: ($: Error) => NE): Unguaranteed_Query_Promise<Result, NE>;
6
+ then<NT>(handle_value: ($: Result) => Guaranteed_Query_Promise<NT>): Unguaranteed_Query_Promise<NT, Error>;
7
+ then_unguaranteed<NT>(handle_value: ($: Result) => Unguaranteed_Query_Promise<NT, Error>): Unguaranteed_Query_Promise<NT, Error>;
8
+ catch_(handle_exception: ($: Error) => Guaranteed_Query_Promise<Result>): Guaranteed_Query_Promise<Result>;
9
+ __start(on_success: ($: Result) => void, on_error: ($: Error) => void): void;
10
+ };
11
+ export type Basic_Unguaranteed_Query_Promise<Result, Error> = {
12
+ __start: (on_success: (result: Result) => void, on_error: (error: Error) => void) => void;
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export * from "./Array";
2
- export * from "./Computed_Value";
2
+ export * from "./Circular_Dependency";
3
3
  export * from "./Dictionary";
4
4
  export * from "./Lookup";
5
5
  export * from "./Optional_Value";
6
+ export * from "./Guaranteed_Procedure";
7
+ export * from "./Unguaranteed_Procedure";
8
+ export * from "./Guaranteed_Query";
9
+ export * from "./Unguaranteed_Query";
package/dist/index.js CHANGED
@@ -15,7 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Array"), exports);
18
- __exportStar(require("./Computed_Value"), exports);
18
+ __exportStar(require("./Circular_Dependency"), exports);
19
19
  __exportStar(require("./Dictionary"), exports);
20
20
  __exportStar(require("./Lookup"), exports);
21
21
  __exportStar(require("./Optional_Value"), exports);
22
+ __exportStar(require("./Guaranteed_Procedure"), exports);
23
+ __exportStar(require("./Unguaranteed_Procedure"), exports);
24
+ __exportStar(require("./Guaranteed_Query"), exports);
25
+ __exportStar(require("./Unguaranteed_Query"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-types",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "core types for Exupery",
@@ -1,8 +0,0 @@
1
- /**
2
- * A computed value is a function without paramters returning the specified type
3
- * it makes it possible to do the evaluation only when the function is called
4
- * useful for lazy evaluation or when side effects are needed
5
- */
6
- export type Computed_Value<T> = {
7
- 'compute': () => T;
8
- };