Comparing version 0.3.0 to 0.4.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.4.0](https://github.com/ai-labs-team/mgFx/compare/mgfx@0.3.0...mgfx@0.4.0) (2020-03-31) | ||
### Features | ||
* core: improved validation handling ([306e14a](https://github.com/ai-labs-team/mgFx/commit/306e14a)) | ||
# [0.3.0](https://github.com/ai-labs-team/mgFx/compare/mgfx@0.2.2...mgfx@0.3.0) (2020-03-16) | ||
@@ -8,0 +19,0 @@ |
/// <reference types="fluture" /> | ||
import { Connector, ImplementationModule } from './connector'; | ||
import { Implementation } from './task'; | ||
import { Implementation, Spec } from './task'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Registers a single Implementation against an mgFx connector, runs a Future, and then stops the Implementation after | ||
*/ | ||
export declare const withImplementation: (connector: Connector) => (implementation: Implementation<import("./task").Spec>) => <R>(consume: (handle: any) => import("fluture").FutureInstance<any, R>) => import("fluture").FutureInstance<any, R>; | ||
export declare const withImplementation: (connector: Connector) => <S extends Spec>(implementation: Implementation<S>) => <R>(consume: (handle: any) => import("fluture").FutureInstance<any, R>) => import("fluture").FutureInstance<any, R>; | ||
/** | ||
@@ -11,0 +11,0 @@ * Like `withImplementation`, but for a module (or module-like) object containing multiple Implementations |
@@ -6,3 +6,5 @@ import { CustomError } from 'ts-custom-error'; | ||
*/ | ||
export declare class ValidationError extends CustomError { | ||
export declare class ValidationError<T> extends CustomError { | ||
readonly errors: T; | ||
constructor(errors: T); | ||
} | ||
@@ -12,3 +14,3 @@ /** | ||
*/ | ||
export declare class InputValidationError extends ValidationError { | ||
export declare class InputValidationError<T> extends ValidationError<T> { | ||
} | ||
@@ -18,3 +20,3 @@ /** | ||
*/ | ||
export declare class OutputValidationError extends ValidationError { | ||
export declare class OutputValidationError<T> extends ValidationError<T> { | ||
} | ||
@@ -24,5 +26,5 @@ /** | ||
*/ | ||
export declare class ContextValidationError extends ValidationError { | ||
readonly contextKey: string; | ||
constructor(key: string, message: any); | ||
export declare class ContextValidationError<T, K> extends ValidationError<T> { | ||
readonly contextKey: K; | ||
constructor(contextKey: K, errors: T); | ||
} | ||
@@ -37,3 +39,3 @@ /** | ||
*/ | ||
export declare type Validator<T> = (value: T) => FutureInstance<ValidationError, T>; | ||
export declare type Validator<T> = (value: T) => FutureInstance<ValidationError<any>, T>; | ||
/** | ||
@@ -54,3 +56,3 @@ * Allows Context values to be validated as individual key/value pairs, and valid context key names to be inferred and | ||
*/ | ||
export declare const validateInput: <T>(validator: Validator<T>, value: T) => FutureInstance<InputValidationError, T>; | ||
export declare const validateInput: <T>(validator: Validator<T>, value: T) => FutureInstance<InputValidationError<string>, T>; | ||
/** | ||
@@ -60,3 +62,3 @@ * Specialized application of a Validator function and value, that coerces validation failure errors to | ||
*/ | ||
export declare const validateOutput: <T>(validator: Validator<T>, value: T) => FutureInstance<OutputValidationError, T>; | ||
export declare const validateOutput: <T>(validator: Validator<T>, value: T) => FutureInstance<OutputValidationError<string>, T>; | ||
/** | ||
@@ -73,5 +75,5 @@ * Specialized application of multiple Validator functions and values contained within an object. | ||
values: T; | ||
}) => FutureInstance<never, T> | FutureInstance<ContextValidationError, { | ||
}) => FutureInstance<never, T> | FutureInstance<ContextValidationError<string, string>, { | ||
values: T; | ||
}>; | ||
//# sourceMappingURL=validator.d.ts.map |
@@ -9,2 +9,6 @@ "use strict"; | ||
class ValidationError extends ts_custom_error_1.CustomError { | ||
constructor(errors) { | ||
super(); | ||
this.errors = errors; | ||
} | ||
} | ||
@@ -28,5 +32,5 @@ exports.ValidationError = ValidationError; | ||
class ContextValidationError extends ValidationError { | ||
constructor(key, message) { | ||
super(message); | ||
this.contextKey = key; | ||
constructor(contextKey, errors) { | ||
super(errors); | ||
this.contextKey = contextKey; | ||
} | ||
@@ -33,0 +37,0 @@ } |
{ | ||
"name": "mgfx", | ||
"description": "Managed Side-Effects for JavaScript", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"files": [ | ||
@@ -31,3 +31,3 @@ "dist" | ||
}, | ||
"gitHead": "6227aa9c8ea4e676901d1760b4fd304228b50a44" | ||
"gitHead": "72a1d24dc0e65e2df4ece919f4ad0f4898452597" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
54611
767