@tramvai/core 2.103.1 → 2.104.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.
|
@@ -1,8 +1,39 @@
|
|
|
1
|
+
import { ACTION_PARAMETERS } from '@tramvai/types-actions-state-context';
|
|
2
|
+
import { AbortController } from 'node-abort-controller';
|
|
3
|
+
|
|
1
4
|
function declareAction(action) {
|
|
2
|
-
|
|
5
|
+
var _a;
|
|
6
|
+
// fallback to support compatibility with createAction
|
|
7
|
+
const fn = (context, payload, deps) => {
|
|
8
|
+
const abortController = new AbortController();
|
|
9
|
+
return action.fn.apply({
|
|
10
|
+
executeAction: context.executeAction,
|
|
11
|
+
dispatch: context.dispatch,
|
|
12
|
+
getState: context.getState,
|
|
13
|
+
actionType: 'standalone',
|
|
14
|
+
abortController,
|
|
15
|
+
abortSignal: abortController.signal,
|
|
16
|
+
deps,
|
|
17
|
+
}, payload);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(fn, 'name', {
|
|
20
|
+
value: action.name,
|
|
21
|
+
writable: true,
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
});
|
|
25
|
+
// without backward compatibility we need just
|
|
26
|
+
// { ...action, tramvaiActionVersion: 2 }
|
|
27
|
+
return Object.assign(fn, {
|
|
3
28
|
...action,
|
|
4
29
|
tramvaiActionVersion: 2,
|
|
5
|
-
|
|
30
|
+
// fallback to support compatibility with createAction
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
[ACTION_PARAMETERS]: {
|
|
33
|
+
...action,
|
|
34
|
+
conditions: (_a = action.conditions) !== null && _a !== void 0 ? _a : {},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
6
37
|
}
|
|
7
38
|
function isTramvaiAction(action) {
|
|
8
39
|
return 'tramvaiActionVersion' in action && action.tramvaiActionVersion === 2;
|
|
@@ -2,11 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var typesActionsStateContext = require('@tramvai/types-actions-state-context');
|
|
6
|
+
var nodeAbortController = require('node-abort-controller');
|
|
7
|
+
|
|
5
8
|
function declareAction(action) {
|
|
6
|
-
|
|
9
|
+
var _a;
|
|
10
|
+
// fallback to support compatibility with createAction
|
|
11
|
+
const fn = (context, payload, deps) => {
|
|
12
|
+
const abortController = new nodeAbortController.AbortController();
|
|
13
|
+
return action.fn.apply({
|
|
14
|
+
executeAction: context.executeAction,
|
|
15
|
+
dispatch: context.dispatch,
|
|
16
|
+
getState: context.getState,
|
|
17
|
+
actionType: 'standalone',
|
|
18
|
+
abortController,
|
|
19
|
+
abortSignal: abortController.signal,
|
|
20
|
+
deps,
|
|
21
|
+
}, payload);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(fn, 'name', {
|
|
24
|
+
value: action.name,
|
|
25
|
+
writable: true,
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
});
|
|
29
|
+
// without backward compatibility we need just
|
|
30
|
+
// { ...action, tramvaiActionVersion: 2 }
|
|
31
|
+
return Object.assign(fn, {
|
|
7
32
|
...action,
|
|
8
33
|
tramvaiActionVersion: 2,
|
|
9
|
-
|
|
34
|
+
// fallback to support compatibility with createAction
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
[typesActionsStateContext.ACTION_PARAMETERS]: {
|
|
37
|
+
...action,
|
|
38
|
+
conditions: (_a = action.conditions) !== null && _a !== void 0 ? _a : {},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
10
41
|
}
|
|
11
42
|
function isTramvaiAction(action) {
|
|
12
43
|
return 'tramvaiActionVersion' in action && action.tramvaiActionVersion === 2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.104.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@tinkoff/utils": "^2.1.2",
|
|
22
|
-
"@tramvai/tokens-common": "2.
|
|
23
|
-
"@tramvai/tokens-core": "2.
|
|
24
|
-
"@tramvai/types-actions-state-context": "2.
|
|
22
|
+
"@tramvai/tokens-common": "2.104.2",
|
|
23
|
+
"@tramvai/tokens-core": "2.104.2",
|
|
24
|
+
"@tramvai/types-actions-state-context": "2.104.2",
|
|
25
25
|
"@tinkoff/dippy": "0.8.15",
|
|
26
|
+
"node-abort-controller": "^3.0.1",
|
|
26
27
|
"tslib": "^2.4.0"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|