@jbrowse/mobx-state-tree 5.5.0 → 5.6.2
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/README.md +18 -0
- package/dist/core/action.d.ts +1 -1
- package/dist/core/action.js +228 -0
- package/dist/core/action.js.map +1 -1
- package/dist/core/actionContext.js +42 -0
- package/dist/core/actionContext.js.map +1 -1
- package/dist/core/flow.d.ts +1 -1
- package/dist/core/flow.js +180 -0
- package/dist/core/flow.js.map +1 -1
- package/dist/core/json-patch.js +133 -0
- package/dist/core/json-patch.js.map +1 -1
- package/dist/core/mst-operations.js +885 -0
- package/dist/core/mst-operations.js.map +1 -1
- package/dist/core/node/BaseNode.js +152 -0
- package/dist/core/node/BaseNode.js.map +1 -1
- package/dist/core/node/Hook.js +15 -0
- package/dist/core/node/Hook.js.map +1 -1
- package/dist/core/node/create-node.js +41 -0
- package/dist/core/node/create-node.js.map +1 -1
- package/dist/core/node/identifier-cache.js +115 -0
- package/dist/core/node/identifier-cache.js.map +1 -1
- package/dist/core/node/livelinessChecking.js +38 -0
- package/dist/core/node/livelinessChecking.js.map +1 -1
- package/dist/core/node/node-utils.js +165 -0
- package/dist/core/node/node-utils.js.map +1 -1
- package/dist/core/node/object-node.js +545 -0
- package/dist/core/node/object-node.js.map +1 -1
- package/dist/core/node/scalar-node.js +89 -0
- package/dist/core/node/scalar-node.js.map +1 -1
- package/dist/core/process.d.ts +1 -1
- package/dist/core/process.js +39 -0
- package/dist/core/process.js.map +1 -1
- package/dist/core/type/type-checker.js +154 -0
- package/dist/core/type/type-checker.js.map +1 -1
- package/dist/core/type/type.d.ts +1 -1
- package/dist/core/type/type.js +251 -0
- package/dist/core/type/type.js.map +1 -1
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +60 -0
- package/dist/internal.js.map +1 -1
- package/dist/middlewares/create-action-tracking-middleware.js +81 -0
- package/dist/middlewares/create-action-tracking-middleware.js.map +1 -1
- package/dist/middlewares/createActionTrackingMiddleware2.js +133 -0
- package/dist/middlewares/createActionTrackingMiddleware2.js.map +1 -1
- package/dist/middlewares/on-action.js +215 -0
- package/dist/middlewares/on-action.js.map +1 -1
- package/dist/mobx-state-tree.js +83 -6750
- package/dist/mobx-state-tree.module.js +83 -6672
- package/dist/types/complex-types/array.d.ts +1 -1
- package/dist/types/complex-types/array.js +352 -0
- package/dist/types/complex-types/array.js.map +1 -1
- package/dist/types/complex-types/map.d.ts +1 -1
- package/dist/types/complex-types/map.js +361 -0
- package/dist/types/complex-types/map.js.map +1 -1
- package/dist/types/complex-types/model.js +477 -0
- package/dist/types/complex-types/model.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +38 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/primitives.js +182 -0
- package/dist/types/primitives.js.map +1 -1
- package/dist/types/utility-types/custom.js +110 -0
- package/dist/types/utility-types/custom.js.map +1 -1
- package/dist/types/utility-types/enumeration.js +34 -0
- package/dist/types/utility-types/enumeration.js.map +1 -1
- package/dist/types/utility-types/frozen.js +97 -0
- package/dist/types/utility-types/frozen.js.map +1 -1
- package/dist/types/utility-types/identifier.js +129 -0
- package/dist/types/utility-types/identifier.js.map +1 -1
- package/dist/types/utility-types/late.js +109 -0
- package/dist/types/utility-types/late.js.map +1 -1
- package/dist/types/utility-types/lazy.js +76 -0
- package/dist/types/utility-types/lazy.js.map +1 -1
- package/dist/types/utility-types/literal.js +63 -0
- package/dist/types/utility-types/literal.js.map +1 -1
- package/dist/types/utility-types/maybe.js +30 -0
- package/dist/types/utility-types/maybe.js.map +1 -1
- package/dist/types/utility-types/optional.js +140 -0
- package/dist/types/utility-types/optional.js.map +1 -1
- package/dist/types/utility-types/reference.d.ts +2 -2
- package/dist/types/utility-types/reference.js +392 -0
- package/dist/types/utility-types/reference.js.map +1 -1
- package/dist/types/utility-types/refinement.js +85 -0
- package/dist/types/utility-types/refinement.js.map +1 -1
- package/dist/types/utility-types/resilient.d.ts +18 -0
- package/dist/types/utility-types/resilient.js +120 -0
- package/dist/types/utility-types/resilient.js.map +1 -0
- package/dist/types/utility-types/snapshotProcessor.js +161 -0
- package/dist/types/utility-types/snapshotProcessor.js.map +1 -1
- package/dist/types/utility-types/union.d.ts +1 -0
- package/dist/types/utility-types/union.js +245 -0
- package/dist/types/utility-types/union.js.map +1 -1
- package/dist/utils.js +483 -0
- package/dist/utils.js.map +1 -1
- package/package.json +26 -24
- package/changelog.md +0 -677
- package/dist/mobx-state-tree.umd.js +0 -6756
package/README.md
CHANGED
|
@@ -13,3 +13,21 @@ Fork of mobx-state-tree v5.4.2 for use in jbrowse
|
|
|
13
13
|
- remove unused dependencies
|
|
14
14
|
- updated tslint to eslint and typescript-eslint
|
|
15
15
|
- attempted to make it a dual CJS/'pure ESM' package but did not work quite yet, using main (CJS) and module (ESM-ish) fields for now since dual build causes trouble with both being imported in vite
|
|
16
|
+
- added `types.resilient` - wraps a type so that instantiation errors are caught
|
|
17
|
+
and a fallback type is used instead of crashing the entire state tree. This is
|
|
18
|
+
useful for arrays or maps that may contain unknown or invalid entries (e.g.
|
|
19
|
+
plugin types that are not installed). It takes a primary type, a fallback type,
|
|
20
|
+
and a `createFallbackSnapshot` callback that receives the error and original
|
|
21
|
+
snapshot. Note: `isValidSnapshot` always returns success for resilient types,
|
|
22
|
+
meaning any value is considered a valid snapshot. Validation is deferred to
|
|
23
|
+
instantiation time, where failures are caught and routed to the fallback
|
|
24
|
+
- dramatically shorter error messages with large type trees
|
|
25
|
+
|
|
26
|
+
## Publishing
|
|
27
|
+
|
|
28
|
+
[Trusted publishing](https://docs.npmjs.com/about-trusted-publishing) via GitHub
|
|
29
|
+
Actions.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm version patch # or minor/major
|
|
33
|
+
```
|
package/dist/core/action.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare function getParentActionContext(parentContext: IMiddlewareEvent |
|
|
|
49
49
|
* @internal
|
|
50
50
|
* @hidden
|
|
51
51
|
*/
|
|
52
|
-
export declare function createActionInvoker<T extends FunctionWithFlag>(target: IAnyStateTreeNode, name: string, fn: T): () => any;
|
|
52
|
+
export declare function createActionInvoker<T extends FunctionWithFlag>(target: IAnyStateTreeNode, name: string, fn: T): (...args: any[]) => any;
|
|
53
53
|
/**
|
|
54
54
|
* Middleware can be used to intercept any action is invoked on the subtree where it is attached.
|
|
55
55
|
* If a tree is protected (by default), this means that any mutation of the tree will pass through your middleware.
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentActionContext = getCurrentActionContext;
|
|
4
|
+
exports.getNextActionId = getNextActionId;
|
|
5
|
+
exports.runWithActionContext = runWithActionContext;
|
|
6
|
+
exports.getParentActionContext = getParentActionContext;
|
|
7
|
+
exports.createActionInvoker = createActionInvoker;
|
|
8
|
+
exports.addMiddleware = addMiddleware;
|
|
9
|
+
exports.decorate = decorate;
|
|
10
|
+
const mobx_1 = require("mobx");
|
|
11
|
+
const internal_ts_1 = require("../internal.js");
|
|
12
|
+
let nextActionId = 1;
|
|
13
|
+
let currentActionContext;
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
function getCurrentActionContext() {
|
|
19
|
+
return currentActionContext;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
function getNextActionId() {
|
|
26
|
+
return nextActionId++;
|
|
27
|
+
}
|
|
28
|
+
// TODO: optimize away entire action context if there is no middleware in tree?
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
function runWithActionContext(context, fn) {
|
|
34
|
+
const node = (0, internal_ts_1.getStateTreeNode)(context.context);
|
|
35
|
+
if (context.type === "action") {
|
|
36
|
+
node.assertAlive({
|
|
37
|
+
actionContext: context
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const baseIsRunningAction = node._isRunningAction;
|
|
41
|
+
node._isRunningAction = true;
|
|
42
|
+
const previousContext = currentActionContext;
|
|
43
|
+
currentActionContext = context;
|
|
44
|
+
try {
|
|
45
|
+
return runMiddleWares(node, context, fn);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
currentActionContext = previousContext;
|
|
49
|
+
node._isRunningAction = baseIsRunningAction;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
* @hidden
|
|
55
|
+
*/
|
|
56
|
+
function getParentActionContext(parentContext) {
|
|
57
|
+
if (!parentContext) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
if (parentContext.type === "action") {
|
|
61
|
+
return parentContext;
|
|
62
|
+
}
|
|
63
|
+
return parentContext.parentActionEvent;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
* @hidden
|
|
68
|
+
*/
|
|
69
|
+
function createActionInvoker(target, name, fn) {
|
|
70
|
+
const res = function (...args) {
|
|
71
|
+
const id = getNextActionId();
|
|
72
|
+
const parentContext = currentActionContext;
|
|
73
|
+
const parentActionContext = getParentActionContext(parentContext);
|
|
74
|
+
return runWithActionContext({
|
|
75
|
+
type: "action",
|
|
76
|
+
name,
|
|
77
|
+
id,
|
|
78
|
+
args,
|
|
79
|
+
context: target,
|
|
80
|
+
tree: (0, internal_ts_1.getRoot)(target),
|
|
81
|
+
rootId: parentContext ? parentContext.rootId : id,
|
|
82
|
+
parentId: parentContext ? parentContext.id : 0,
|
|
83
|
+
allParentIds: parentContext
|
|
84
|
+
? [...parentContext.allParentIds, parentContext.id]
|
|
85
|
+
: [],
|
|
86
|
+
parentEvent: parentContext,
|
|
87
|
+
parentActionEvent: parentActionContext
|
|
88
|
+
}, fn);
|
|
89
|
+
};
|
|
90
|
+
res._isMSTAction = true;
|
|
91
|
+
res._isFlowAction = fn._isFlowAction;
|
|
92
|
+
return res;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Middleware can be used to intercept any action is invoked on the subtree where it is attached.
|
|
96
|
+
* If a tree is protected (by default), this means that any mutation of the tree will pass through your middleware.
|
|
97
|
+
*
|
|
98
|
+
* For more details, see the [middleware docs](concepts/middleware.md)
|
|
99
|
+
*
|
|
100
|
+
* @param target Node to apply the middleware to.
|
|
101
|
+
* @param middleware Middleware to apply.
|
|
102
|
+
* @returns A callable function to dispose the middleware.
|
|
103
|
+
*/
|
|
104
|
+
function addMiddleware(target, handler, includeHooks = true) {
|
|
105
|
+
const node = (0, internal_ts_1.getStateTreeNode)(target);
|
|
106
|
+
if ((0, internal_ts_1.devMode)()) {
|
|
107
|
+
if (!node.isProtectionEnabled) {
|
|
108
|
+
(0, internal_ts_1.warnError)("It is recommended to protect the state tree before attaching action middleware, as otherwise it cannot be guaranteed that all changes are passed through middleware. See `protect`");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return node.addMiddleWare(handler, includeHooks);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Binds middleware to a specific action.
|
|
115
|
+
*
|
|
116
|
+
* Example:
|
|
117
|
+
* ```ts
|
|
118
|
+
* type.actions(self => {
|
|
119
|
+
* function takeA____() {
|
|
120
|
+
* self.toilet.donate()
|
|
121
|
+
* self.wipe()
|
|
122
|
+
* self.wipe()
|
|
123
|
+
* self.toilet.flush()
|
|
124
|
+
* }
|
|
125
|
+
* return {
|
|
126
|
+
* takeA____: decorate(atomic, takeA____)
|
|
127
|
+
* }
|
|
128
|
+
* })
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @param handler
|
|
132
|
+
* @param fn
|
|
133
|
+
* @param includeHooks
|
|
134
|
+
* @returns The original function
|
|
135
|
+
*/
|
|
136
|
+
function decorate(handler, fn, includeHooks = true) {
|
|
137
|
+
const middleware = { handler, includeHooks };
|
|
138
|
+
fn.$mst_middleware = fn.$mst_middleware || [];
|
|
139
|
+
fn.$mst_middleware.push(middleware);
|
|
140
|
+
return fn;
|
|
141
|
+
}
|
|
142
|
+
class CollectedMiddlewares {
|
|
143
|
+
arrayIndex = 0;
|
|
144
|
+
inArrayIndex = 0;
|
|
145
|
+
middlewares = [];
|
|
146
|
+
constructor(node, fn) {
|
|
147
|
+
// we just push middleware arrays into an array of arrays to avoid making copies
|
|
148
|
+
if (fn.$mst_middleware) {
|
|
149
|
+
this.middlewares.push(fn.$mst_middleware);
|
|
150
|
+
}
|
|
151
|
+
let n = node;
|
|
152
|
+
// Find all middlewares. Optimization: cache this?
|
|
153
|
+
while (n) {
|
|
154
|
+
if (n.middlewares) {
|
|
155
|
+
this.middlewares.push(n.middlewares);
|
|
156
|
+
}
|
|
157
|
+
n = n.parent;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
get isEmpty() {
|
|
161
|
+
return this.middlewares.length <= 0;
|
|
162
|
+
}
|
|
163
|
+
getNextMiddleware() {
|
|
164
|
+
const array = this.middlewares[this.arrayIndex];
|
|
165
|
+
if (!array) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const item = array[this.inArrayIndex++];
|
|
169
|
+
if (!item) {
|
|
170
|
+
this.arrayIndex++;
|
|
171
|
+
this.inArrayIndex = 0;
|
|
172
|
+
return this.getNextMiddleware();
|
|
173
|
+
}
|
|
174
|
+
return item;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function runMiddleWares(node, baseCall, originalFn) {
|
|
178
|
+
const middlewares = new CollectedMiddlewares(node, originalFn);
|
|
179
|
+
// Short circuit
|
|
180
|
+
if (middlewares.isEmpty) {
|
|
181
|
+
return (0, mobx_1.action)(originalFn)(...baseCall.args);
|
|
182
|
+
}
|
|
183
|
+
let result = null;
|
|
184
|
+
function runNextMiddleware(call) {
|
|
185
|
+
const middleware = middlewares.getNextMiddleware();
|
|
186
|
+
const handler = middleware && middleware.handler;
|
|
187
|
+
if (!handler) {
|
|
188
|
+
return (0, mobx_1.action)(originalFn)(...call.args);
|
|
189
|
+
}
|
|
190
|
+
// skip hooks if asked to
|
|
191
|
+
if (!middleware.includeHooks && internal_ts_1.Hook[call.name]) {
|
|
192
|
+
return runNextMiddleware(call);
|
|
193
|
+
}
|
|
194
|
+
let nextInvoked = false;
|
|
195
|
+
function next(call2, callback) {
|
|
196
|
+
nextInvoked = true;
|
|
197
|
+
// the result can contain
|
|
198
|
+
// - the non manipulated return value from an action
|
|
199
|
+
// - the non manipulated abort value
|
|
200
|
+
// - one of the above but manipulated through the callback function
|
|
201
|
+
result = runNextMiddleware(call2);
|
|
202
|
+
if (callback) {
|
|
203
|
+
result = callback(result);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
let abortInvoked = false;
|
|
207
|
+
function abort(value) {
|
|
208
|
+
abortInvoked = true;
|
|
209
|
+
// overwrite the result
|
|
210
|
+
// can be manipulated through middlewares earlier in the queue using the callback fn
|
|
211
|
+
result = value;
|
|
212
|
+
}
|
|
213
|
+
handler(call, next, abort);
|
|
214
|
+
if ((0, internal_ts_1.devMode)()) {
|
|
215
|
+
if (!nextInvoked && !abortInvoked) {
|
|
216
|
+
const node2 = (0, internal_ts_1.getStateTreeNode)(call.tree);
|
|
217
|
+
throw (0, internal_ts_1.fail)(`Neither the next() nor the abort() callback within the middleware ${handler.name} for the action: "${call.name}" on the node: ${node2.type.name} was invoked.`);
|
|
218
|
+
}
|
|
219
|
+
else if (nextInvoked && abortInvoked) {
|
|
220
|
+
const node2 = (0, internal_ts_1.getStateTreeNode)(call.tree);
|
|
221
|
+
throw (0, internal_ts_1.fail)(`The next() and abort() callback within the middleware ${handler.name} for the action: "${call.name}" on the node: ${node2.type.name} were invoked.`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
return runNextMiddleware(baseCall);
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=action.js.map
|
package/dist/core/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/core/action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/core/action.ts"],"names":[],"mappings":";;AAqEA,0DAEC;AAMD,0CAEC;AAOD,oDAmBC;AAMD,wDAUC;AAMD,kDAgCC;AAYD,sCAcC;AAyBD,4BASC;AA3ND,+BAA2C;AAE3C,gDAOuB;AAqDvB,IAAI,YAAY,GAAG,CAAC,CAAA;AACpB,IAAI,oBAAkD,CAAA;AAEtD;;;GAGG;AACH,SAAgB,uBAAuB;IACrC,OAAO,oBAAoB,CAAA;AAC7B,CAAC;AAED;;;GAGG;AACH,SAAgB,eAAe;IAC7B,OAAO,YAAY,EAAE,CAAA;AACvB,CAAC;AAED,+EAA+E;AAC/E;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,OAAyB,EAAE,EAAY;IAC1E,MAAM,IAAI,GAAG,IAAA,8BAAgB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAE9C,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,WAAW,CAAC;YACf,aAAa,EAAE,OAAO;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,CAAA;IACjD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAA;IAC5B,MAAM,eAAe,GAAG,oBAAoB,CAAA;IAC5C,oBAAoB,GAAG,OAAO,CAAA;IAC9B,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAA;IAC1C,CAAC;YAAS,CAAC;QACT,oBAAoB,GAAG,eAAe,CAAA;QACtC,IAAI,CAAC,gBAAgB,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AAC,IAAI,gBAAgB,CACrJ,CAAA;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRunningActionContext = getRunningActionContext;
|
|
4
|
+
exports.isActionContextChildOf = isActionContextChildOf;
|
|
5
|
+
exports.isActionContextThisOrChildOf = isActionContextThisOrChildOf;
|
|
6
|
+
const action_ts_1 = require("./action.js");
|
|
7
|
+
/**
|
|
8
|
+
* Returns the currently executing MST action context, or undefined if none.
|
|
9
|
+
*/
|
|
10
|
+
function getRunningActionContext() {
|
|
11
|
+
let current = (0, action_ts_1.getCurrentActionContext)();
|
|
12
|
+
while (current && current.type !== "action") {
|
|
13
|
+
current = current.parentActionEvent;
|
|
14
|
+
}
|
|
15
|
+
return current;
|
|
16
|
+
}
|
|
17
|
+
function _isActionContextThisOrChildOf(actionContext, sameOrParent, includeSame) {
|
|
18
|
+
const parentId = typeof sameOrParent === "number" ? sameOrParent : sameOrParent.id;
|
|
19
|
+
let current = includeSame
|
|
20
|
+
? actionContext
|
|
21
|
+
: actionContext.parentActionEvent;
|
|
22
|
+
while (current) {
|
|
23
|
+
if (current.id === parentId) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
current = current.parentActionEvent;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns if the given action context is a parent of this action context.
|
|
32
|
+
*/
|
|
33
|
+
function isActionContextChildOf(actionContext, parent) {
|
|
34
|
+
return _isActionContextThisOrChildOf(actionContext, parent, false);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns if the given action context is this or a parent of this action context.
|
|
38
|
+
*/
|
|
39
|
+
function isActionContextThisOrChildOf(actionContext, parentOrThis) {
|
|
40
|
+
return _isActionContextThisOrChildOf(actionContext, parentOrThis, true);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=actionContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionContext.js","sourceRoot":"","sources":["../../src/core/actionContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actionContext.js","sourceRoot":"","sources":["../../src/core/actionContext.ts"],"names":[],"mappings":";;AAyBA,0DAMC;AAyBD,wDAKC;AAKD,oEAKC;AAtED,2CAAqD;AAqBrD;;GAEG;AACH,SAAgB,uBAAuB;IACrC,IAAI,OAAO,GAAG,IAAA,mCAAuB,GAAE,CAAA;IACvC,OAAO,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAA;IACrC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,6BAA6B,CACpC,aAA6B,EAC7B,YAAwD,EACxD,WAAoB;IAEpB,MAAM,QAAQ,GACZ,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAA;IAEnE,IAAI,OAAO,GAAkD,WAAW;QACtE,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAAA;IACnC,OAAO,OAAO,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAA;IACrC,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CACpC,aAA6B,EAC7B,MAAkD;IAElD,OAAO,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AACpE,CAAC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAC1C,aAA6B,EAC7B,YAAwD;IAExD,OAAO,6BAA6B,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;AACzE,CAAC"}
|
package/dist/core/flow.d.ts
CHANGED
|
@@ -66,4 +66,4 @@ export declare function toGenerator<R>(p: Promise<R>): Generator<Promise<R>, R,
|
|
|
66
66
|
* @internal
|
|
67
67
|
* @hidden
|
|
68
68
|
*/
|
|
69
|
-
export declare function createFlowSpawner(name: string, generator: FunctionWithFlag): (this: any) => Promise<unknown>;
|
|
69
|
+
export declare function createFlowSpawner(name: string, generator: FunctionWithFlag): (this: any, ...flowArgs: any[]) => Promise<unknown>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flow = flow;
|
|
4
|
+
exports.castFlowReturn = castFlowReturn;
|
|
5
|
+
exports.toGeneratorFunction = toGeneratorFunction;
|
|
6
|
+
exports.toGenerator = toGenerator;
|
|
7
|
+
exports.createFlowSpawner = createFlowSpawner;
|
|
8
|
+
const utils_ts_1 = require("../utils.js");
|
|
9
|
+
const action_ts_1 = require("./action.js");
|
|
10
|
+
/**
|
|
11
|
+
* See [asynchronous actions](concepts/async-actions.md).
|
|
12
|
+
*
|
|
13
|
+
* @returns The flow as a promise.
|
|
14
|
+
*/
|
|
15
|
+
function flow(generator) {
|
|
16
|
+
return createFlowSpawner(generator.name, generator);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Not needed since TS3.6.
|
|
20
|
+
* Used for TypeScript to make flows that return a promise return the actual promise result.
|
|
21
|
+
*
|
|
22
|
+
* @param val
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
function castFlowReturn(val) {
|
|
26
|
+
return val;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @experimental
|
|
30
|
+
* experimental api - might change on minor/patch releases
|
|
31
|
+
*
|
|
32
|
+
* Convert a promise-returning function to a generator-returning one.
|
|
33
|
+
* This is intended to allow for usage of `yield*` in async actions to
|
|
34
|
+
* retain the promise return type.
|
|
35
|
+
*
|
|
36
|
+
* Example:
|
|
37
|
+
* ```ts
|
|
38
|
+
* function getDataAsync(input: string): Promise<number> { ... }
|
|
39
|
+
* const getDataGen = toGeneratorFunction(getDataAsync);
|
|
40
|
+
*
|
|
41
|
+
* const someModel.actions(self => ({
|
|
42
|
+
* someAction: flow(function*() {
|
|
43
|
+
* // value is typed as number
|
|
44
|
+
* const value = yield* getDataGen("input value");
|
|
45
|
+
* ...
|
|
46
|
+
* })
|
|
47
|
+
* }))
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
function toGeneratorFunction(p) {
|
|
51
|
+
return function* (...args) {
|
|
52
|
+
return (yield p(...args));
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @experimental
|
|
57
|
+
* experimental api - might change on minor/patch releases
|
|
58
|
+
*
|
|
59
|
+
* Convert a promise to a generator yielding that promise
|
|
60
|
+
* This is intended to allow for usage of `yield*` in async actions to
|
|
61
|
+
* retain the promise return type.
|
|
62
|
+
*
|
|
63
|
+
* Example:
|
|
64
|
+
* ```ts
|
|
65
|
+
* function getDataAsync(input: string): Promise<number> { ... }
|
|
66
|
+
*
|
|
67
|
+
* const someModel.actions(self => ({
|
|
68
|
+
* someAction: flow(function*() {
|
|
69
|
+
* // value is typed as number
|
|
70
|
+
* const value = yield* toGenerator(getDataAsync("input value"));
|
|
71
|
+
* ...
|
|
72
|
+
* })
|
|
73
|
+
* }))
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
function* toGenerator(p) {
|
|
77
|
+
return (yield p);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
* @hidden
|
|
82
|
+
*/
|
|
83
|
+
function createFlowSpawner(name, generator) {
|
|
84
|
+
const spawner = function flowSpawner(...flowArgs) {
|
|
85
|
+
// Implementation based on https://github.com/tj/co/blob/master/index.js
|
|
86
|
+
const runId = (0, action_ts_1.getNextActionId)();
|
|
87
|
+
const parentContext = (0, action_ts_1.getCurrentActionContext)();
|
|
88
|
+
if (!parentContext) {
|
|
89
|
+
throw (0, utils_ts_1.fail)("a mst flow must always have a parent context");
|
|
90
|
+
}
|
|
91
|
+
const parentActionContext = (0, action_ts_1.getParentActionContext)(parentContext);
|
|
92
|
+
if (!parentActionContext) {
|
|
93
|
+
throw (0, utils_ts_1.fail)("a mst flow must always have a parent action context");
|
|
94
|
+
}
|
|
95
|
+
const contextBase = {
|
|
96
|
+
name,
|
|
97
|
+
id: runId,
|
|
98
|
+
tree: parentContext.tree,
|
|
99
|
+
context: parentContext.context,
|
|
100
|
+
parentId: parentContext.id,
|
|
101
|
+
allParentIds: [...parentContext.allParentIds, parentContext.id],
|
|
102
|
+
rootId: parentContext.rootId,
|
|
103
|
+
parentEvent: parentContext,
|
|
104
|
+
parentActionEvent: parentActionContext
|
|
105
|
+
};
|
|
106
|
+
function wrap(fn, type, arg) {
|
|
107
|
+
fn.$mst_middleware = spawner.$mst_middleware; // pick up any middleware attached to the flow
|
|
108
|
+
return (0, action_ts_1.runWithActionContext)({
|
|
109
|
+
...contextBase,
|
|
110
|
+
type,
|
|
111
|
+
args: [arg]
|
|
112
|
+
}, fn);
|
|
113
|
+
}
|
|
114
|
+
return new Promise(function (resolve, reject) {
|
|
115
|
+
let gen;
|
|
116
|
+
const init = function asyncActionInit(...initArgs) {
|
|
117
|
+
gen = generator(...initArgs);
|
|
118
|
+
onFulfilled(undefined); // kick off the flow
|
|
119
|
+
};
|
|
120
|
+
init.$mst_middleware = spawner.$mst_middleware;
|
|
121
|
+
(0, action_ts_1.runWithActionContext)({
|
|
122
|
+
...contextBase,
|
|
123
|
+
type: "flow_spawn",
|
|
124
|
+
args: flowArgs
|
|
125
|
+
}, init);
|
|
126
|
+
function onFulfilled(res) {
|
|
127
|
+
let ret;
|
|
128
|
+
try {
|
|
129
|
+
// prettier-ignore
|
|
130
|
+
const cancelError = wrap((_r) => { ret = gen.next(_r); }, "flow_resume", res);
|
|
131
|
+
if (cancelError instanceof Error) {
|
|
132
|
+
ret = gen.throw(cancelError);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
// prettier-ignore
|
|
137
|
+
(0, utils_ts_1.setImmediateWithFallback)(() => {
|
|
138
|
+
wrap((_r) => { reject(e); }, "flow_throw", e);
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
next(ret);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
function onRejected(err) {
|
|
146
|
+
let ret;
|
|
147
|
+
try {
|
|
148
|
+
// prettier-ignore
|
|
149
|
+
wrap((_r) => { ret = gen.throw(_r); }, "flow_resume_error", err); // or yieldError?
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
// prettier-ignore
|
|
153
|
+
(0, utils_ts_1.setImmediateWithFallback)(() => {
|
|
154
|
+
wrap((_r) => { reject(e); }, "flow_throw", e);
|
|
155
|
+
});
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
next(ret);
|
|
159
|
+
}
|
|
160
|
+
function next(ret) {
|
|
161
|
+
if (ret.done) {
|
|
162
|
+
// prettier-ignore
|
|
163
|
+
(0, utils_ts_1.setImmediateWithFallback)(() => {
|
|
164
|
+
wrap((r) => { resolve(r); }, "flow_return", ret.value);
|
|
165
|
+
});
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// TODO: support more type of values? See https://github.com/tj/co/blob/249bbdc72da24ae44076afd716349d2089b31c4c/index.js#L100
|
|
169
|
+
if (!ret.value || typeof ret.value.then !== "function") {
|
|
170
|
+
// istanbul ignore next
|
|
171
|
+
throw (0, utils_ts_1.fail)("Only promises can be yielded to `async`, got: " + ret);
|
|
172
|
+
}
|
|
173
|
+
return ret.value.then(onFulfilled, onRejected);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
spawner._isFlowAction = true;
|
|
178
|
+
return spawner;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=flow.js.map
|
package/dist/core/flow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.js","sourceRoot":"","sources":["../../src/core/flow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flow.js","sourceRoot":"","sources":["../../src/core/flow.ts"],"names":[],"mappings":";;AAoBA,oBAIC;AASD,wCAEC;AAwBD,kDAMC;AAuBD,kCAEC;AAMD,8CA2GC;AA3MD,0CAA4D;AAC5D,2CAKoB;AASpB;;;;GAIG;AACH,SAAgB,IAAI,CAClB,SAAiE;IAEjE,OAAO,iBAAiB,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAQ,CAAA;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAAI,GAAM;IACtC,OAAO,GAAU,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,mBAAmB,CACjC,CAAgC;IAEhC,OAAO,QAAQ,CAAC,EAAE,GAAG,IAAU;QAC7B,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAM,CAAA;IAChC,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAe,CAAC,CAAC,WAAW,CAAI,CAAa;IAC3C,OAAO,CAAC,MAAM,CAAC,CAAM,CAAA;AACvB,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,IAAY,EAAE,SAA2B;IACzE,MAAM,OAAO,GAAG,SAAS,WAAW,CAAY,GAAG,QAAe;QAChE,wEAAwE;QACxE,MAAM,KAAK,GAAG,IAAA,2BAAe,GAAE,CAAA;QAC/B,MAAM,aAAa,GAAG,IAAA,mCAAuB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