exupery-core-types 0.3.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.
@@ -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 });
@@ -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
@@ -3,3 +3,7 @@ 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
@@ -19,3 +19,7 @@ __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.3.0",
3
+ "version": "0.3.1",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "core types for Exupery",