@modern-js/plugin 0.0.0-next-20221209080421 → 0.0.0-next-20221209142400
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/CHANGELOG.md +4 -4
- package/dist/js/modern/farrow-pipeline/pipeline.js +3 -1
- package/dist/js/modern/manager/async.js +3 -1
- package/dist/js/modern/manager/sync.js +3 -1
- package/dist/js/modern/waterfall/async.js +3 -1
- package/dist/js/modern/waterfall/sync.js +3 -1
- package/dist/js/modern/workflow/async.js +3 -1
- package/dist/js/modern/workflow/parallel.js +3 -1
- package/dist/js/modern/workflow/sync.js +3 -1
- package/dist/js/node/farrow-pipeline/pipeline.js +3 -1
- package/dist/js/node/manager/async.js +3 -1
- package/dist/js/node/manager/sync.js +3 -1
- package/dist/js/node/waterfall/async.js +3 -1
- package/dist/js/node/waterfall/sync.js +3 -1
- package/dist/js/node/workflow/async.js +3 -1
- package/dist/js/node/workflow/parallel.js +3 -1
- package/dist/js/node/workflow/sync.js +3 -1
- package/dist/types/farrow-pipeline/context.d.ts +1 -1
- package/dist/types/farrow-pipeline/counter.d.ts +3 -3
- package/dist/types/farrow-pipeline/pipeline.d.ts +7 -7
- package/dist/types/manager/async.d.ts +3 -3
- package/dist/types/manager/sync.d.ts +3 -3
- package/dist/types/manager/types.d.ts +8 -8
- package/dist/types/waterfall/async.d.ts +6 -6
- package/dist/types/waterfall/sync.d.ts +6 -6
- package/dist/types/workflow/async.d.ts +3 -3
- package/dist/types/workflow/parallel.d.ts +1 -1
- package/dist/types/workflow/sync.d.ts +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# @modern-js/plugin
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20221209142400
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- dda38c9c3: chore: v2
|
|
8
8
|
|
|
9
9
|
### Patch Changes
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- b8bbe036c: feat: change type logic
|
|
12
12
|
feat: 修改类型相关的逻辑
|
|
13
|
-
-
|
|
13
|
+
- f17974937: fix: the sortPlugins api not work
|
|
14
14
|
|
|
15
15
|
fix: sortPlugins 没有真实生效
|
|
16
16
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
/**
|
|
5
7
|
* modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
|
|
6
8
|
* license at https://github.com/farrow-js/farrow/blob/master/LICENSE
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
import { generateRunner, DEFAULT_OPTIONS } from "./sync";
|
|
5
7
|
import { checkPlugins, isObject, hasOwnProperty, sortPlugins, includePlugin } from "./shared";
|
|
6
8
|
const ASYNC_PLUGIN_SYMBOL = 'ASYNC_PLUGIN_SYMBOL';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
import { isPipeline, createPipeline } from "../farrow-pipeline";
|
|
5
7
|
import { isWaterfall, createWaterfall, isAsyncWaterfall, createAsyncWaterfall } from "../waterfall";
|
|
6
8
|
import { isWorkflow, createWorkflow, isAsyncWorkflow, createAsyncWorkflow, isParallelWorkflow, createParallelWorkflow } from "../workflow";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
import { createAsyncPipeline } from "../farrow-pipeline";
|
|
5
7
|
const ASYNC_WATERFALL_SYMBOL = Symbol.for('MODERN_ASYNC_WATERFALL');
|
|
6
8
|
export const getAsyncBrook = input => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
import { createPipeline } from "../farrow-pipeline";
|
|
5
7
|
const WATERFALL_SYMBOL = Symbol.for('MODERN_WATERFALL');
|
|
6
8
|
export const getBrook = input => {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
import { createAsyncPipeline } from "../farrow-pipeline";
|
|
5
7
|
const ASYNC_WORKFLOW_SYMBOL = Symbol.for('MODERN_ASYNC_WORKFLOW');
|
|
6
8
|
export const isAsyncWorkflow = input => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WORKFLOW_SYMBOL]);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
import { createPipeline } from "../farrow-pipeline";
|
|
5
7
|
const PARALLEL_WORKFLOW_SYMBOL = Symbol.for('MODERN_PARALLEL_WORKFLOW');
|
|
6
8
|
export const isParallelWorkflow = input => Boolean(input === null || input === void 0 ? void 0 : input[PARALLEL_WORKFLOW_SYMBOL]);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
6
|
import { createPipeline } from "../farrow-pipeline";
|
|
5
7
|
const WORKFLOW_SYMBOL = Symbol.for('MODERN_WORKFLOW');
|
|
6
8
|
export const createWorkflow = () => {
|
|
@@ -15,7 +15,9 @@ var _context = require("./context");
|
|
|
15
15
|
var _counter = require("./counter");
|
|
16
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
21
|
const isPipeline = input => Boolean(input === null || input === void 0 ? void 0 : input[PipelineSymbol]);
|
|
20
22
|
exports.isPipeline = isPipeline;
|
|
21
23
|
const PipelineSymbol = Symbol.for('MODERN_PIPELINE');
|
|
@@ -8,7 +8,9 @@ var _sync = require("./sync");
|
|
|
8
8
|
var _shared = require("./shared");
|
|
9
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
14
|
const ASYNC_PLUGIN_SYMBOL = 'ASYNC_PLUGIN_SYMBOL';
|
|
13
15
|
const createAsyncManager = (hooks, api) => {
|
|
14
16
|
let index = 0;
|
|
@@ -10,7 +10,9 @@ var _workflow = require("../workflow");
|
|
|
10
10
|
var _shared = require("./shared");
|
|
11
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
16
|
const SYNC_PLUGIN_SYMBOL = 'SYNC_PLUGIN_SYMBOL';
|
|
15
17
|
const DEFAULT_OPTIONS = {
|
|
16
18
|
name: 'untitled',
|
|
@@ -7,7 +7,9 @@ exports.isAsyncWaterfall = exports.getAsyncBrook = exports.createAsyncWaterfall
|
|
|
7
7
|
var _farrowPipeline = require("../farrow-pipeline");
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
13
|
const ASYNC_WATERFALL_SYMBOL = Symbol.for('MODERN_ASYNC_WATERFALL');
|
|
12
14
|
const getAsyncBrook = input => {
|
|
13
15
|
if (typeof input === 'function') {
|
|
@@ -7,7 +7,9 @@ exports.isWaterfall = exports.getBrook = exports.createWaterfall = void 0;
|
|
|
7
7
|
var _farrowPipeline = require("../farrow-pipeline");
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
13
|
const WATERFALL_SYMBOL = Symbol.for('MODERN_WATERFALL');
|
|
12
14
|
const getBrook = input => {
|
|
13
15
|
if (typeof input === 'function') {
|
|
@@ -7,7 +7,9 @@ exports.isAsyncWorkflow = exports.createAsyncWorkflow = void 0;
|
|
|
7
7
|
var _farrowPipeline = require("../farrow-pipeline");
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
13
|
const ASYNC_WORKFLOW_SYMBOL = Symbol.for('MODERN_ASYNC_WORKFLOW');
|
|
12
14
|
const isAsyncWorkflow = input => Boolean(input === null || input === void 0 ? void 0 : input[ASYNC_WORKFLOW_SYMBOL]);
|
|
13
15
|
exports.isAsyncWorkflow = isAsyncWorkflow;
|
|
@@ -7,7 +7,9 @@ exports.isParallelWorkflow = exports.createParallelWorkflow = void 0;
|
|
|
7
7
|
var _farrowPipeline = require("../farrow-pipeline");
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
13
|
const PARALLEL_WORKFLOW_SYMBOL = Symbol.for('MODERN_PARALLEL_WORKFLOW');
|
|
12
14
|
const isParallelWorkflow = input => Boolean(input === null || input === void 0 ? void 0 : input[PARALLEL_WORKFLOW_SYMBOL]);
|
|
13
15
|
exports.isParallelWorkflow = isParallelWorkflow;
|
|
@@ -7,7 +7,9 @@ exports.isWorkflow = exports.createWorkflow = void 0;
|
|
|
7
7
|
var _farrowPipeline = require("../farrow-pipeline");
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
13
|
const WORKFLOW_SYMBOL = Symbol.for('MODERN_WORKFLOW');
|
|
12
14
|
const createWorkflow = () => {
|
|
13
15
|
const pipeline = (0, _farrowPipeline.createPipeline)();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
|
|
3
3
|
* license at https://github.com/farrow-js/farrow/blob/master/LICENSE
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type Context<T = any> = {
|
|
6
6
|
create: (value: T) => Context<T>;
|
|
7
7
|
use: () => {
|
|
8
8
|
value: T;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* modified from https://github.com/farrow-js/farrow/tree/master/packages/farrow-pipeline
|
|
3
3
|
* license at https://github.com/farrow-js/farrow/blob/master/LICENSE
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
5
|
+
export type Next<I = unknown, O = unknown> = (input?: I) => O;
|
|
6
|
+
export type CounterCallback<I = unknown, O = unknown> = (index: number, input: I, next: Next<I, O>) => O;
|
|
7
|
+
export type Counter<I = unknown, O = unknown> = {
|
|
8
8
|
start: (input: I) => O;
|
|
9
9
|
dispatch: (index: number, input: I) => O;
|
|
10
10
|
};
|
|
@@ -7,23 +7,23 @@ import { Next } from './counter';
|
|
|
7
7
|
export type { Next };
|
|
8
8
|
export { createContext };
|
|
9
9
|
export type { Context };
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type Middleware<I = unknown, O = unknown> = (input: I, next: Next<I, O>) => O;
|
|
11
|
+
export type Middlewares<I = unknown, O = unknown> = Middleware<I, O>[];
|
|
12
12
|
export declare const isPipeline: (input: any) => input is Pipeline<unknown, unknown>;
|
|
13
13
|
declare const PipelineSymbol: unique symbol;
|
|
14
|
-
export
|
|
14
|
+
export type RunPipelineOptions<I = unknown, O = unknown> = {
|
|
15
15
|
onLast?: (input: I) => O;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type MiddlewareInput<I = unknown, O = unknown> = Middleware<I, O> | {
|
|
18
18
|
middleware: Middleware<I, O>;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type Pipeline<I = unknown, O = unknown> = {
|
|
21
21
|
[PipelineSymbol]: true;
|
|
22
22
|
use: (...inputs: MiddlewareInput<I, O>[]) => Pipeline<I, O>;
|
|
23
23
|
run: (input: I, options?: RunPipelineOptions<I, O>) => O;
|
|
24
24
|
middleware: Middleware<I, O>;
|
|
25
25
|
};
|
|
26
26
|
export declare const createPipeline: <I, O>() => Pipeline<I, O>;
|
|
27
|
-
export
|
|
28
|
-
export
|
|
27
|
+
export type MaybeAsync<T> = T | Promise<T>;
|
|
28
|
+
export type AsyncPipeline<I = unknown, O = unknown> = Pipeline<I, MaybeAsync<O>>;
|
|
29
29
|
export declare const createAsyncPipeline: <I, O>() => AsyncPipeline<I, O>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ToRunners, ToThreads, CommonAPI, PluginOptions } from './types';
|
|
2
2
|
/** Setup function of async plugin. */
|
|
3
|
-
export
|
|
3
|
+
export type AsyncSetup<Hooks, API = Record<string, never>> = (api: API & CommonAPI<Hooks>) => Partial<ToThreads<Hooks>> | Promise<Partial<ToThreads<Hooks>> | void> | void;
|
|
4
4
|
declare const ASYNC_PLUGIN_SYMBOL = "ASYNC_PLUGIN_SYMBOL";
|
|
5
|
-
export
|
|
5
|
+
export type AsyncPlugin<Hooks, API> = {
|
|
6
6
|
ASYNC_PLUGIN_SYMBOL: typeof ASYNC_PLUGIN_SYMBOL;
|
|
7
7
|
} & Required<PluginOptions<Hooks, AsyncSetup<Hooks, API>>>;
|
|
8
|
-
export
|
|
8
|
+
export type AsyncManager<Hooks, API> = {
|
|
9
9
|
/**
|
|
10
10
|
* Create a sync plugin.
|
|
11
11
|
* @param setup the setup function.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Hook, CommonAPI, ToRunners, ToThreads, PluginOptions } from './types';
|
|
2
2
|
/** Setup function of sync plugin. */
|
|
3
|
-
export
|
|
3
|
+
export type Setup<Hooks, API = Record<string, never>> = (api: API) => Partial<ToThreads<Hooks>> | void;
|
|
4
4
|
declare const SYNC_PLUGIN_SYMBOL = "SYNC_PLUGIN_SYMBOL";
|
|
5
|
-
export
|
|
5
|
+
export type Plugin<Hooks, API> = {
|
|
6
6
|
SYNC_PLUGIN_SYMBOL: typeof SYNC_PLUGIN_SYMBOL;
|
|
7
7
|
} & Required<PluginOptions<Hooks, Setup<Hooks, API>>>;
|
|
8
|
-
export
|
|
8
|
+
export type Manager<Hooks, API> = {
|
|
9
9
|
/**
|
|
10
10
|
* Create a sync plugin.
|
|
11
11
|
* @param setup the setup function.
|
|
@@ -2,18 +2,18 @@ import type { Pipeline, MaybeAsync, Middleware, AsyncPipeline } from '../farrow-
|
|
|
2
2
|
import type { Brook, Waterfall, AsyncBrook, AsyncWaterfall } from '../waterfall';
|
|
3
3
|
import type { Worker, Workflow, AsyncWorker, AsyncWorkflow, ParallelWorkflow } from '../workflow';
|
|
4
4
|
/** All hook types. */
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type Hook = Waterfall<any> | AsyncWaterfall<any> | Workflow<any, any> | AsyncWorkflow<any, any> | ParallelWorkflow<any> | Pipeline<any, any> | AsyncPipeline<any, any>;
|
|
6
|
+
export type HooksMap = Record<string, Hook>;
|
|
7
7
|
/** Extract the type of callback function from a hook. */
|
|
8
|
-
export
|
|
8
|
+
export type ToThread<P extends Hook> = P extends Workflow<infer I, infer O> ? Worker<I, O> : P extends AsyncWorkflow<infer I, infer O> ? AsyncWorker<I, O> : P extends ParallelWorkflow<infer I, infer O> ? AsyncWorker<I, O> : P extends Waterfall<infer I> ? Brook<I> : P extends AsyncWaterfall<infer I> ? AsyncBrook<I> : P extends Pipeline<infer I, infer O> ? Middleware<I, O> : P extends AsyncPipeline<infer I, infer O> ? Middleware<I, MaybeAsync<O>> : never;
|
|
9
9
|
/** Extract types of callback function from hooks. */
|
|
10
|
-
export
|
|
10
|
+
export type ToThreads<PS> = { [K in keyof PS]: PS[K] extends Hook ? ToThread<PS[K]> : PS[K] extends void ? void : never };
|
|
11
11
|
/** Extract run method from a hook. */
|
|
12
|
-
export
|
|
12
|
+
export type RunnerFromHook<P extends Hook> = P extends Waterfall<infer I> ? Waterfall<I>['run'] : P extends AsyncWaterfall<infer I> ? AsyncWaterfall<I>['run'] : P extends Workflow<infer I, infer O> ? Workflow<I, O>['run'] : P extends AsyncWorkflow<infer I, infer O> ? AsyncWorkflow<I, O>['run'] : P extends ParallelWorkflow<infer I, infer O> ? ParallelWorkflow<I, O>['run'] : P extends Pipeline<infer I, infer O> ? Pipeline<I, O>['run'] : P extends AsyncPipeline<infer I, infer O> ? AsyncPipeline<I, O>['run'] : never;
|
|
13
13
|
/** Extract all run methods from hooks. */
|
|
14
|
-
export
|
|
14
|
+
export type ToRunners<PS> = { [K in keyof PS]: PS[K] extends Hook ? RunnerFromHook<PS[K]> : PS[K] extends void ? void : never };
|
|
15
15
|
/** All options to define a plugin. */
|
|
16
|
-
export
|
|
16
|
+
export type PluginOptions<Hooks, Setup = undefined, ExtendHooks = Record<string, unknown>, PluginHooks = any, PluginSetup = any> = {
|
|
17
17
|
name?: string;
|
|
18
18
|
pre?: string[];
|
|
19
19
|
post?: string[];
|
|
@@ -24,6 +24,6 @@ export declare type PluginOptions<Hooks, Setup = undefined, ExtendHooks = Record
|
|
|
24
24
|
registerHook?: Partial<Hooks & ExtendHooks>;
|
|
25
25
|
};
|
|
26
26
|
/** Common api of setup function. */
|
|
27
|
-
export
|
|
27
|
+
export type CommonAPI<Hooks> = {
|
|
28
28
|
useHookRunners: () => ToRunners<Hooks>;
|
|
29
29
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { MaybeAsync } from '../farrow-pipeline';
|
|
2
2
|
declare const ASYNC_WATERFALL_SYMBOL: unique symbol;
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type AsyncBrook<I = unknown> = (I: I) => MaybeAsync<I>;
|
|
4
|
+
export type AsyncBrookInput<I = unknown> = AsyncBrook<I> | {
|
|
5
5
|
middleware: AsyncBrook<I>;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type AsyncBrooks<I = unknown> = AsyncBrook<I>[];
|
|
8
|
+
export type AsyncBrookInputs<I = unknown> = AsyncBrookInput<I>[];
|
|
9
9
|
export declare const getAsyncBrook: <I>(input: AsyncBrookInput<I>) => AsyncBrook<I>;
|
|
10
|
-
export
|
|
10
|
+
export type RunAsyncWaterfallOptions<I = unknown> = {
|
|
11
11
|
onLast?: AsyncBrook<I>;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type AsyncWaterfall<I> = {
|
|
14
14
|
run: (input: I, options?: RunAsyncWaterfallOptions<I>) => MaybeAsync<I>;
|
|
15
15
|
use: (...I: AsyncBrookInputs<I>) => AsyncWaterfall<I>;
|
|
16
16
|
middleware: AsyncBrook<I>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
declare const WATERFALL_SYMBOL: unique symbol;
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type Brook<I = unknown> = (I: I) => I;
|
|
3
|
+
export type BrookInput<I = unknown> = Brook<I> | {
|
|
4
4
|
middleware: Brook<I>;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type Brooks<I = unknown> = Brook<I>[];
|
|
7
|
+
export type BrookInputs<I = unknown> = BrookInput<I>[];
|
|
8
8
|
export declare const getBrook: <I>(input: BrookInput<I>) => Brook<I>;
|
|
9
|
-
export
|
|
9
|
+
export type RunWaterfallOptions<I = unknown> = {
|
|
10
10
|
onLast?: Brook<I>;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Waterfall<I = void> = {
|
|
13
13
|
run: (input: I, options?: RunWaterfallOptions<I>) => I;
|
|
14
14
|
use: (...I: BrookInputs<I>) => Waterfall<I>;
|
|
15
15
|
middleware: Brook<I>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MaybeAsync } from '../farrow-pipeline';
|
|
2
2
|
declare const ASYNC_WORKFLOW_SYMBOL: unique symbol;
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type AsyncWorker<I, O> = (I: I) => MaybeAsync<O>;
|
|
4
|
+
export type AsyncWorkers<I, O> = AsyncWorker<I, O>[];
|
|
5
|
+
export type AsyncWorkflow<I, O> = {
|
|
6
6
|
run: (input: I) => MaybeAsync<O[]>;
|
|
7
7
|
use: (...I: AsyncWorkers<I, O>) => AsyncWorkflow<I, O>;
|
|
8
8
|
[ASYNC_WORKFLOW_SYMBOL]: true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AsyncWorkers } from './async';
|
|
2
2
|
declare const PARALLEL_WORKFLOW_SYMBOL: unique symbol;
|
|
3
|
-
export
|
|
3
|
+
export type ParallelWorkflow<I, O = any> = {
|
|
4
4
|
run: (input: I) => Promise<O[]>;
|
|
5
5
|
use: (...I: AsyncWorkers<I, O>) => ParallelWorkflow<I, O>;
|
|
6
6
|
[PARALLEL_WORKFLOW_SYMBOL]: true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const WORKFLOW_SYMBOL: unique symbol;
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type Worker<I, O> = (I: I) => O;
|
|
3
|
+
export type Workers<I, O> = Worker<I, O>[];
|
|
4
|
+
export type Workflow<I, O> = {
|
|
5
5
|
run: (input: I) => O[];
|
|
6
6
|
use: (...I: Workers<I, O>) => Workflow<I, O>;
|
|
7
7
|
[WORKFLOW_SYMBOL]: true;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-next-
|
|
14
|
+
"version": "0.0.0-next-20221209142400",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@types/node": "^14",
|
|
37
37
|
"typescript": "^4",
|
|
38
38
|
"jest": "^27",
|
|
39
|
-
"@scripts/build": "0.0.0-next-
|
|
40
|
-
"@scripts/jest-config": "0.0.0-next-
|
|
39
|
+
"@scripts/build": "0.0.0-next-20221209142400",
|
|
40
|
+
"@scripts/jest-config": "0.0.0-next-20221209142400"
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
43
|
"publishConfig": {
|