@tramvai/module-common 4.41.37 → 4.41.39

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.
@@ -3,6 +3,7 @@ import { Module, provide, Scope, ACTIONS_LIST_TOKEN, DI_TOKEN, optional } from '
3
3
  import { COMBINE_REDUCERS, ACTION_REGISTRY_TOKEN, ACTION_EXECUTION_TOKEN, ACTION_CONDITIONALS, CONTEXT_TOKEN, STORE_TOKEN, EXECUTION_CONTEXT_MANAGER_TOKEN, DEFERRED_ACTIONS_MAP_TOKEN, ACTION_PAGE_RUNNER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, LIMIT_ACTION_GLOBAL_TIME_RUN, LOGGER_TOKEN } from '@tramvai/tokens-common';
4
4
  import { SERVER_RESPONSE_TASK_MANAGER, SERVER_RESPONSE_STREAM } from '@tramvai/tokens-server-private';
5
5
  import { ROUTER_TOKEN } from '@tramvai/tokens-router';
6
+ import { IS_CHILD_APP_DI_TOKEN } from '@tramvai/tokens-child-app';
6
7
  import { actionTramvaiReducer } from './actionTramvaiReducer.browser.js';
7
8
  import { ActionExecution } from './actionExecution.browser.js';
8
9
  import { ActionRegistry } from './actionRegistry.browser.js';
@@ -70,6 +71,7 @@ ActionModule = __decorate([
70
71
  responseTaskManager: optional(SERVER_RESPONSE_TASK_MANAGER),
71
72
  serverResponseStream: optional(SERVER_RESPONSE_STREAM),
72
73
  router: ROUTER_TOKEN,
74
+ isChildAppRunner: optional(IS_CHILD_APP_DI_TOKEN),
73
75
  },
74
76
  }),
75
77
  provide({
@@ -3,6 +3,7 @@ import { Module, provide, Scope, ACTIONS_LIST_TOKEN, DI_TOKEN, optional } from '
3
3
  import { COMBINE_REDUCERS, ACTION_REGISTRY_TOKEN, ACTION_EXECUTION_TOKEN, ACTION_CONDITIONALS, CONTEXT_TOKEN, STORE_TOKEN, EXECUTION_CONTEXT_MANAGER_TOKEN, DEFERRED_ACTIONS_MAP_TOKEN, ACTION_PAGE_RUNNER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, LIMIT_ACTION_GLOBAL_TIME_RUN, LOGGER_TOKEN } from '@tramvai/tokens-common';
4
4
  import { SERVER_RESPONSE_TASK_MANAGER, SERVER_RESPONSE_STREAM } from '@tramvai/tokens-server-private';
5
5
  import { ROUTER_TOKEN } from '@tramvai/tokens-router';
6
+ import { IS_CHILD_APP_DI_TOKEN } from '@tramvai/tokens-child-app';
6
7
  import { actionTramvaiReducer } from './actionTramvaiReducer.es.js';
7
8
  import { ActionExecution } from './actionExecution.es.js';
8
9
  import { ActionRegistry } from './actionRegistry.es.js';
@@ -70,6 +71,7 @@ ActionModule = __decorate([
70
71
  responseTaskManager: optional(SERVER_RESPONSE_TASK_MANAGER),
71
72
  serverResponseStream: optional(SERVER_RESPONSE_STREAM),
72
73
  router: ROUTER_TOKEN,
74
+ isChildAppRunner: optional(IS_CHILD_APP_DI_TOKEN),
73
75
  },
74
76
  }),
75
77
  provide({
@@ -7,6 +7,7 @@ var core = require('@tramvai/core');
7
7
  var tokensCommon = require('@tramvai/tokens-common');
8
8
  var tokensServerPrivate = require('@tramvai/tokens-server-private');
9
9
  var tokensRouter = require('@tramvai/tokens-router');
10
+ var tokensChildApp = require('@tramvai/tokens-child-app');
10
11
  var actionTramvaiReducer = require('./actionTramvaiReducer.js');
11
12
  var actionExecution = require('./actionExecution.js');
12
13
  var actionRegistry = require('./actionRegistry.js');
@@ -68,6 +69,7 @@ exports.ActionModule = tslib.__decorate([
68
69
  responseTaskManager: core.optional(tokensServerPrivate.SERVER_RESPONSE_TASK_MANAGER),
69
70
  serverResponseStream: core.optional(tokensServerPrivate.SERVER_RESPONSE_STREAM),
70
71
  router: tokensRouter.ROUTER_TOKEN,
72
+ isChildAppRunner: core.optional(tokensChildApp.IS_CHILD_APP_DI_TOKEN),
71
73
  },
72
74
  }),
73
75
  core.provide({
@@ -4,8 +4,10 @@ import { isTramvaiAction, ACTION_PARAMETERS } from '@tramvai/core';
4
4
  const DEFAULT_PAYLOAD = {};
5
5
  class ActionPageRunner {
6
6
  constructor(deps) {
7
+ var _a;
7
8
  this.deps = deps;
8
9
  this.log = deps.logger('action:action-page-runner');
10
+ this.isChildAppRunner = (_a = deps.isChildAppRunner) !== null && _a !== void 0 ? _a : false;
9
11
  }
10
12
  runActions(actions, stopRunAtError = () => false) {
11
13
  return this.deps.executionContextManager.withContext(this.deps.commandLineExecutionContext(), { name: 'pageActions', values: { pageActions: true } }, async (executionContext, abortController) => {
@@ -31,6 +33,11 @@ class ActionPageRunner {
31
33
  });
32
34
  }
33
35
  if (stopRunAtError(error)) {
36
+ if (process.env.NODE_ENV === 'development') {
37
+ if (this.isChildAppRunner) {
38
+ console.error(`Throwing error ${error.errorName} is not supported in Child Apps, host application command line will not be aborted!`);
39
+ }
40
+ }
34
41
  throw error;
35
42
  }
36
43
  });
@@ -6,12 +6,14 @@ import type { ActionExecution } from './actionExecution';
6
6
  export declare class ActionPageRunner {
7
7
  private deps;
8
8
  log: ReturnType<ExtractDependencyType<typeof LOGGER_TOKEN>>;
9
+ private isChildAppRunner;
9
10
  constructor(deps: {
10
11
  actionExecution: ActionExecution;
11
12
  executionContextManager: ExtractDependencyType<typeof EXECUTION_CONTEXT_MANAGER_TOKEN>;
12
13
  commandLineExecutionContext: ExtractDependencyType<typeof COMMAND_LINE_EXECUTION_CONTEXT_TOKEN>;
13
14
  logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
14
15
  router: ExtractDependencyType<typeof ROUTER_TOKEN>;
16
+ isChildAppRunner: boolean | null;
15
17
  });
16
18
  runActions(actions: Array<Action | TramvaiAction<any[], any, any>>, stopRunAtError?: (error: Error) => boolean): Promise<void>;
17
19
  }
@@ -12,6 +12,7 @@ export declare class ActionPageRunner implements ActionPageRunnerInterface {
12
12
  private deferredMap;
13
13
  private responseTaskManager;
14
14
  private serverResponseStream;
15
+ private isChildAppRunner;
15
16
  constructor(deps: {
16
17
  store: ExtractDependencyType<typeof STORE_TOKEN>;
17
18
  actionExecution: ExtractDependencyType<typeof ACTION_EXECUTION_TOKEN>;
@@ -22,6 +23,7 @@ export declare class ActionPageRunner implements ActionPageRunnerInterface {
22
23
  deferredMap: ExtractDependencyType<typeof DEFERRED_ACTIONS_MAP_TOKEN>;
23
24
  responseTaskManager: ExtractDependencyType<typeof SERVER_RESPONSE_TASK_MANAGER> | null;
24
25
  serverResponseStream: ExtractDependencyType<typeof SERVER_RESPONSE_STREAM> | null;
26
+ isChildAppRunner: boolean | null;
25
27
  });
26
28
  runActions(actions: Array<Action | TramvaiAction<any[], any, any>>, stopRunAtError?: (error: Error) => boolean): Promise<void>;
27
29
  private syncStateActions;
@@ -6,11 +6,13 @@ import { generateDeferredResolve, generateDeferredReject } from './deferred/clie
6
6
  const DEFAULT_PAYLOAD = {};
7
7
  class ActionPageRunner {
8
8
  constructor(deps) {
9
+ var _a;
9
10
  this.deps = deps;
10
11
  this.log = deps.logger('action:action-page-runner');
11
12
  this.deferredMap = deps.deferredMap;
12
13
  this.responseTaskManager = deps.responseTaskManager;
13
14
  this.serverResponseStream = deps.serverResponseStream;
15
+ this.isChildAppRunner = (_a = deps.isChildAppRunner) !== null && _a !== void 0 ? _a : false;
14
16
  }
15
17
  // TODO stopRunAtError нужен только для редиректов на стороне сервера в экшенах. И нужно пересмотреть реализацию редиректов
16
18
  runActions(actions, stopRunAtError = () => false) {
@@ -103,6 +105,11 @@ Also, the necessary network accesses may not be present.`,
103
105
  .catch((error) => {
104
106
  var _a;
105
107
  const isCriticalError = stopRunAtError(error);
108
+ if (process.env.NODE_ENV === 'development') {
109
+ if (isCriticalError && this.isChildAppRunner) {
110
+ console.error(`Throwing error ${error.errorName} is not supported in Child Apps, host application command line will not be aborted!`);
111
+ }
112
+ }
106
113
  if (!isSilentError(error)) {
107
114
  const parameters = isTramvaiAction(action) ? action : action[ACTION_PARAMETERS];
108
115
  this.log.warn({
@@ -10,11 +10,13 @@ var clientScriptsUtils = require('./deferred/clientScriptsUtils.js');
10
10
  const DEFAULT_PAYLOAD = {};
11
11
  class ActionPageRunner {
12
12
  constructor(deps) {
13
+ var _a;
13
14
  this.deps = deps;
14
15
  this.log = deps.logger('action:action-page-runner');
15
16
  this.deferredMap = deps.deferredMap;
16
17
  this.responseTaskManager = deps.responseTaskManager;
17
18
  this.serverResponseStream = deps.serverResponseStream;
19
+ this.isChildAppRunner = (_a = deps.isChildAppRunner) !== null && _a !== void 0 ? _a : false;
18
20
  }
19
21
  // TODO stopRunAtError нужен только для редиректов на стороне сервера в экшенах. И нужно пересмотреть реализацию редиректов
20
22
  runActions(actions, stopRunAtError = () => false) {
@@ -107,6 +109,11 @@ Also, the necessary network accesses may not be present.`,
107
109
  .catch((error) => {
108
110
  var _a;
109
111
  const isCriticalError = stopRunAtError(error);
112
+ if (process.env.NODE_ENV === 'development') {
113
+ if (isCriticalError && this.isChildAppRunner) {
114
+ console.error(`Throwing error ${error.errorName} is not supported in Child Apps, host application command line will not be aborted!`);
115
+ }
116
+ }
110
117
  if (!errors.isSilentError(error)) {
111
118
  const parameters = core.isTramvaiAction(action) ? action : action[core.ACTION_PARAMETERS];
112
119
  this.log.warn({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "4.41.37",
3
+ "version": "4.41.39",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -36,31 +36,31 @@
36
36
  "@tinkoff/lru-cache-nano": "^7.9.0",
37
37
  "@tinkoff/pubsub": "0.7.3",
38
38
  "@tinkoff/url": "0.10.3",
39
- "@tramvai/experiments": "4.41.37",
40
- "@tramvai/module-cookie": "4.41.37",
41
- "@tramvai/module-environment": "4.41.37",
42
- "@tramvai/module-log": "4.41.37",
39
+ "@tramvai/experiments": "4.41.39",
40
+ "@tramvai/module-cookie": "4.41.39",
41
+ "@tramvai/module-environment": "4.41.39",
42
+ "@tramvai/module-log": "4.41.39",
43
43
  "@tramvai/safe-strings": "0.7.9",
44
- "@tramvai/tokens-child-app": "4.41.37",
45
- "@tramvai/tokens-common": "4.41.37",
46
- "@tramvai/tokens-core-private": "4.41.37",
47
- "@tramvai/tokens-metrics": "4.41.37",
48
- "@tramvai/tokens-render": "4.41.37",
49
- "@tramvai/tokens-router": "4.41.37",
50
- "@tramvai/tokens-server-private": "4.41.37",
51
- "@tramvai/types-actions-state-context": "4.41.37",
44
+ "@tramvai/tokens-child-app": "4.41.39",
45
+ "@tramvai/tokens-common": "4.41.39",
46
+ "@tramvai/tokens-core-private": "4.41.39",
47
+ "@tramvai/tokens-metrics": "4.41.39",
48
+ "@tramvai/tokens-render": "4.41.39",
49
+ "@tramvai/tokens-router": "4.41.39",
50
+ "@tramvai/tokens-server-private": "4.41.39",
51
+ "@tramvai/types-actions-state-context": "4.41.39",
52
52
  "hoist-non-react-statics": "^3.3.1",
53
53
  "node-abort-controller": "^3.0.1"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@tinkoff/dippy": "0.10.11",
57
57
  "@tinkoff/utils": "^2.1.2",
58
- "@tramvai/cli": "4.41.37",
59
- "@tramvai/core": "4.41.37",
60
- "@tramvai/papi": "4.41.37",
61
- "@tramvai/react": "4.41.37",
62
- "@tramvai/state": "4.41.37",
63
- "@tramvai/tokens-server": "4.41.37",
58
+ "@tramvai/cli": "4.41.39",
59
+ "@tramvai/core": "4.41.39",
60
+ "@tramvai/papi": "4.41.39",
61
+ "@tramvai/react": "4.41.39",
62
+ "@tramvai/state": "4.41.39",
63
+ "@tramvai/tokens-server": "4.41.39",
64
64
  "react": ">=16.14.0",
65
65
  "tslib": "^2.4.0"
66
66
  },