@tramvai/module-common 4.32.2 → 4.32.6
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.
|
@@ -11,7 +11,7 @@ class ActionPageRunner {
|
|
|
11
11
|
return this.deps.executionContextManager.withContext(this.deps.commandLineExecutionContext(), { name: 'pageActions', values: { pageActions: true } }, async (executionContext, abortController) => {
|
|
12
12
|
const unregisterAbortPageActionsHookOnNavigate = this.deps.router.registerHook('beforeNavigate', function abortPageActionsOnNavigation() {
|
|
13
13
|
unregisterAbortPageActionsHookOnNavigate();
|
|
14
|
-
abortController.abort('
|
|
14
|
+
abortController.abort('Page actions were aborted because of route changing');
|
|
15
15
|
return Promise.resolve();
|
|
16
16
|
});
|
|
17
17
|
const actionMapper = (action) => {
|
|
@@ -27,7 +27,7 @@ class ActionPageRunner {
|
|
|
27
27
|
this.log.error({
|
|
28
28
|
error,
|
|
29
29
|
event: `action-execution-error`,
|
|
30
|
-
message:
|
|
30
|
+
message: `An error occurred during "${(_a = parameters === null || parameters === void 0 ? void 0 : parameters.name) !== null && _a !== void 0 ? _a : 'unknown'}" action execution`,
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
if (stopRunAtError(error)) {
|
|
@@ -13,6 +13,7 @@ class ExecutionContextManager {
|
|
|
13
13
|
if (parentContext === null || parentContext === void 0 ? void 0 : parentContext.abortSignal.aborted) {
|
|
14
14
|
throw new ExecutionAbortError({
|
|
15
15
|
message: `Execution aborted in context "${contextName}"`,
|
|
16
|
+
reason: parentContext.abortSignal.reason,
|
|
16
17
|
contextName,
|
|
17
18
|
});
|
|
18
19
|
}
|
|
@@ -24,10 +25,13 @@ class ExecutionContextManager {
|
|
|
24
25
|
...parentContext.values,
|
|
25
26
|
...selfValues,
|
|
26
27
|
};
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
// In fact, type of event will be the `Event` from `lib.dom.d.ts`
|
|
29
|
+
// but for the same reason, described in `node-abort-controller`,
|
|
30
|
+
// we do not use it here
|
|
31
|
+
abortListener = (event) => {
|
|
32
|
+
abortController.abort(event.target.reason);
|
|
29
33
|
};
|
|
30
|
-
//
|
|
34
|
+
// Abort child context `AbortController` if parent `AbortController` was aborted
|
|
31
35
|
parentContext.abortSignal.addEventListener('abort', abortListener);
|
|
32
36
|
}
|
|
33
37
|
const context = {
|
|
@@ -36,8 +40,7 @@ class ExecutionContextManager {
|
|
|
36
40
|
values,
|
|
37
41
|
};
|
|
38
42
|
try {
|
|
39
|
-
|
|
40
|
-
return result;
|
|
43
|
+
return await cb(context, abortController);
|
|
41
44
|
}
|
|
42
45
|
catch (error) {
|
|
43
46
|
if (typeof error === 'object' && !error.executionContextName) {
|
|
@@ -46,8 +49,7 @@ class ExecutionContextManager {
|
|
|
46
49
|
throw error;
|
|
47
50
|
}
|
|
48
51
|
finally {
|
|
49
|
-
|
|
50
|
-
if (abortListener && parentContext) {
|
|
52
|
+
if (abortListener !== undefined && parentContext) {
|
|
51
53
|
parentContext.abortSignal.removeEventListener('abort', abortListener);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -13,6 +13,7 @@ class ExecutionContextManager {
|
|
|
13
13
|
if (parentContext === null || parentContext === void 0 ? void 0 : parentContext.abortSignal.aborted) {
|
|
14
14
|
throw new ExecutionAbortError({
|
|
15
15
|
message: `Execution aborted in context "${contextName}"`,
|
|
16
|
+
reason: parentContext.abortSignal.reason,
|
|
16
17
|
contextName,
|
|
17
18
|
});
|
|
18
19
|
}
|
|
@@ -24,10 +25,13 @@ class ExecutionContextManager {
|
|
|
24
25
|
...parentContext.values,
|
|
25
26
|
...selfValues,
|
|
26
27
|
};
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
// In fact, type of event will be the `Event` from `lib.dom.d.ts`
|
|
29
|
+
// but for the same reason, described in `node-abort-controller`,
|
|
30
|
+
// we do not use it here
|
|
31
|
+
abortListener = (event) => {
|
|
32
|
+
abortController.abort(event.target.reason);
|
|
29
33
|
};
|
|
30
|
-
//
|
|
34
|
+
// Abort child context `AbortController` if parent `AbortController` was aborted
|
|
31
35
|
parentContext.abortSignal.addEventListener('abort', abortListener);
|
|
32
36
|
}
|
|
33
37
|
const context = {
|
|
@@ -36,8 +40,7 @@ class ExecutionContextManager {
|
|
|
36
40
|
values,
|
|
37
41
|
};
|
|
38
42
|
try {
|
|
39
|
-
|
|
40
|
-
return result;
|
|
43
|
+
return await cb(context, abortController);
|
|
41
44
|
}
|
|
42
45
|
catch (error) {
|
|
43
46
|
if (typeof error === 'object' && !error.executionContextName) {
|
|
@@ -46,8 +49,7 @@ class ExecutionContextManager {
|
|
|
46
49
|
throw error;
|
|
47
50
|
}
|
|
48
51
|
finally {
|
|
49
|
-
|
|
50
|
-
if (abortListener && parentContext) {
|
|
52
|
+
if (abortListener !== undefined && parentContext) {
|
|
51
53
|
parentContext.abortSignal.removeEventListener('abort', abortListener);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -17,6 +17,7 @@ class ExecutionContextManager {
|
|
|
17
17
|
if (parentContext === null || parentContext === void 0 ? void 0 : parentContext.abortSignal.aborted) {
|
|
18
18
|
throw new errors.ExecutionAbortError({
|
|
19
19
|
message: `Execution aborted in context "${contextName}"`,
|
|
20
|
+
reason: parentContext.abortSignal.reason,
|
|
20
21
|
contextName,
|
|
21
22
|
});
|
|
22
23
|
}
|
|
@@ -28,10 +29,13 @@ class ExecutionContextManager {
|
|
|
28
29
|
...parentContext.values,
|
|
29
30
|
...selfValues,
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
// In fact, type of event will be the `Event` from `lib.dom.d.ts`
|
|
33
|
+
// but for the same reason, described in `node-abort-controller`,
|
|
34
|
+
// we do not use it here
|
|
35
|
+
abortListener = (event) => {
|
|
36
|
+
abortController.abort(event.target.reason);
|
|
33
37
|
};
|
|
34
|
-
//
|
|
38
|
+
// Abort child context `AbortController` if parent `AbortController` was aborted
|
|
35
39
|
parentContext.abortSignal.addEventListener('abort', abortListener);
|
|
36
40
|
}
|
|
37
41
|
const context = {
|
|
@@ -40,8 +44,7 @@ class ExecutionContextManager {
|
|
|
40
44
|
values,
|
|
41
45
|
};
|
|
42
46
|
try {
|
|
43
|
-
|
|
44
|
-
return result;
|
|
47
|
+
return await cb(context, abortController);
|
|
45
48
|
}
|
|
46
49
|
catch (error) {
|
|
47
50
|
if (typeof error === 'object' && !error.executionContextName) {
|
|
@@ -50,8 +53,7 @@ class ExecutionContextManager {
|
|
|
50
53
|
throw error;
|
|
51
54
|
}
|
|
52
55
|
finally {
|
|
53
|
-
|
|
54
|
-
if (abortListener && parentContext) {
|
|
56
|
+
if (abortListener !== undefined && parentContext) {
|
|
55
57
|
parentContext.abortSignal.removeEventListener('abort', abortListener);
|
|
56
58
|
}
|
|
57
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-common",
|
|
3
|
-
"version": "4.32.
|
|
3
|
+
"version": "4.32.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -37,29 +37,29 @@
|
|
|
37
37
|
"@tinkoff/pubsub": "0.7.1",
|
|
38
38
|
"@tinkoff/url": "0.10.1",
|
|
39
39
|
"@tramvai/safe-strings": "0.7.2",
|
|
40
|
-
"@tramvai/experiments": "4.32.
|
|
41
|
-
"@tramvai/module-cookie": "4.32.
|
|
42
|
-
"@tramvai/module-environment": "4.32.
|
|
43
|
-
"@tramvai/module-log": "4.32.
|
|
44
|
-
"@tramvai/tokens-child-app": "4.32.
|
|
45
|
-
"@tramvai/tokens-core-private": "4.32.
|
|
46
|
-
"@tramvai/tokens-common": "4.32.
|
|
47
|
-
"@tramvai/tokens-render": "4.32.
|
|
48
|
-
"@tramvai/tokens-router": "4.32.
|
|
49
|
-
"@tramvai/tokens-server-private": "4.32.
|
|
50
|
-
"@tramvai/types-actions-state-context": "4.32.
|
|
40
|
+
"@tramvai/experiments": "4.32.6",
|
|
41
|
+
"@tramvai/module-cookie": "4.32.6",
|
|
42
|
+
"@tramvai/module-environment": "4.32.6",
|
|
43
|
+
"@tramvai/module-log": "4.32.6",
|
|
44
|
+
"@tramvai/tokens-child-app": "4.32.6",
|
|
45
|
+
"@tramvai/tokens-core-private": "4.32.6",
|
|
46
|
+
"@tramvai/tokens-common": "4.32.6",
|
|
47
|
+
"@tramvai/tokens-render": "4.32.6",
|
|
48
|
+
"@tramvai/tokens-router": "4.32.6",
|
|
49
|
+
"@tramvai/tokens-server-private": "4.32.6",
|
|
50
|
+
"@tramvai/types-actions-state-context": "4.32.6",
|
|
51
51
|
"hoist-non-react-statics": "^3.3.1",
|
|
52
52
|
"node-abort-controller": "^3.0.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@tinkoff/dippy": "0.10.8",
|
|
56
56
|
"@tinkoff/utils": "^2.1.2",
|
|
57
|
-
"@tramvai/cli": "4.32.
|
|
58
|
-
"@tramvai/core": "4.32.
|
|
59
|
-
"@tramvai/papi": "4.32.
|
|
60
|
-
"@tramvai/react": "4.32.
|
|
61
|
-
"@tramvai/state": "4.32.
|
|
62
|
-
"@tramvai/tokens-server": "4.32.
|
|
57
|
+
"@tramvai/cli": "4.32.6",
|
|
58
|
+
"@tramvai/core": "4.32.6",
|
|
59
|
+
"@tramvai/papi": "4.32.6",
|
|
60
|
+
"@tramvai/react": "4.32.6",
|
|
61
|
+
"@tramvai/state": "4.32.6",
|
|
62
|
+
"@tramvai/tokens-server": "4.32.6",
|
|
63
63
|
"react": ">=16.14.0",
|
|
64
64
|
"tslib": "^2.4.0"
|
|
65
65
|
},
|