Comparing version 0.5.3 to 0.6.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.6.0](https://github.com/ai-labs-team/mgFx/compare/mgfx@0.5.3...mgfx@0.6.0) (2020-04-03) | ||
### Features | ||
* core: expose Process on `environment` ([b86491e](https://github.com/ai-labs-team/mgFx/commit/b86491e)) | ||
## [0.5.3](https://github.com/ai-labs-team/mgFx/compare/mgfx@0.5.2...mgfx@0.5.3) (2020-04-02) | ||
@@ -8,0 +19,0 @@ |
@@ -32,2 +32,3 @@ /** | ||
context: ContextOf<S>; | ||
process: Omit<Process, 'input' | 'spec' | 'context'>; | ||
}; | ||
@@ -39,3 +40,3 @@ /** | ||
*/ | ||
export declare type EnvironmentInitializer<S extends Spec = Spec> = (process: Pick<Process, 'id' | 'context'>) => Environment<S>; | ||
export declare type EnvironmentInitializer<S extends Spec = Spec> = (process: Pick<Process<S>, 'id' | 'context' | 'input'>) => Environment<S>; | ||
/** | ||
@@ -42,0 +43,0 @@ * A 'run' function is used by various components; it accepts a Process object (created by calling a Task's Definition |
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -31,8 +42,12 @@ /** | ||
const middleware = middleware_1.makeContainer(); | ||
const environmentInitializer = parentProcess => ({ | ||
runChild: process => process | ||
.pipe(fluture_1.map(childProcess => (Object.assign(Object.assign({}, childProcess), { parentId: parentProcess.id, context: parentProcess.context })))) | ||
.pipe(self.run), | ||
context: parentProcess.context ? parentProcess.context.values : {} | ||
}); | ||
const environmentInitializer = process => { | ||
const { input, context } = process, rest = __rest(process, ["input", "context"]); | ||
return { | ||
process: rest, | ||
runChild: child => child | ||
.pipe(fluture_1.map(childProcess => (Object.assign(Object.assign({}, childProcess), { parentId: process.id, context })))) | ||
.pipe(self.run), | ||
context: context ? context.values : {} | ||
}; | ||
}; | ||
const self = { | ||
@@ -42,10 +57,9 @@ use: middleware.use, | ||
.pre(process) | ||
.pipe(fluture_1.chain(process => fluture_1.parallel(Infinity)([ | ||
validator_1.validateInput(process.spec.input, process.input), | ||
validator_1.validateContext(process.spec.context, process.context) | ||
]) | ||
.pipe(fluture_1.chain(_ => config.dispatch(process))) | ||
.pipe(fluture_1.chain(output => validator_1.validateOutput(process.spec.output, output))) | ||
.pipe(future => middleware.apply.post(future, process)))) | ||
.pipe(fluenture_1.fluent), | ||
.pipe(fluenture_1.fluent) | ||
.chain(process => validator_1.validateContext(process.spec.context, process.context) | ||
.pipe(fluenture_1.fluent) | ||
.both(validator_1.validateInput(process.spec.input, process.input)) | ||
.and(config.dispatch(process)) | ||
.chain(output => validator_1.validateOutput(process.spec.output, output)) | ||
.pipe(future => middleware.apply.post(future, process))), | ||
serve: ({ spec, implementation }) => config.provide(spec, exports.encaseImplementation(implementation), environmentInitializer), | ||
@@ -52,0 +66,0 @@ serveModule: module => { |
@@ -68,5 +68,3 @@ import { CustomError } from 'ts-custom-error'; | ||
values: T; | ||
}) => FutureInstance<never, T> | FutureInstance<ContextValidationError<any, string>, { | ||
values: T; | ||
}>; | ||
}) => FutureInstance<ContextValidationError<any, any>, T>; | ||
//# sourceMappingURL=validator.d.ts.map |
@@ -66,4 +66,4 @@ "use strict"; | ||
}); | ||
return fluture_1.parallel(validatorKeys.length)(validations).pipe(fluture_1.map(_ => context)); | ||
return fluture_1.parallel(validatorKeys.length)(validations).pipe(fluture_1.and(fluture_1.resolve(context))); | ||
}; | ||
//# sourceMappingURL=validator.js.map |
{ | ||
"name": "mgfx", | ||
"description": "Managed Side-Effects for JavaScript", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"files": [ | ||
@@ -32,3 +32,3 @@ "dist" | ||
}, | ||
"gitHead": "24dcc2ca860ee0a3f7996d793318aac797968b5e" | ||
"gitHead": "15ba4b6d699e5e9d7c88bf07ed4ae3ecf5eb373e" | ||
} |
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
61951
823