@tramvai/module-common 2.73.1 → 2.74.0

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.
@@ -40,6 +40,9 @@ class ActionExecution {
40
40
  this.transformAction(action);
41
41
  parameters = getParameters(action);
42
42
  }
43
+ if (!parameters) {
44
+ throw new Error('Cannot resolve internal data for action. Make sure you are using the result of `declareAction` call as an action');
45
+ }
43
46
  const executionState = this.getExecutionState(parameters.name);
44
47
  if (!this.canExecuteAction(payload, parameters, executionState, type)) {
45
48
  switch (parameters.conditionsFailResult) {
@@ -40,6 +40,9 @@ class ActionExecution {
40
40
  this.transformAction(action);
41
41
  parameters = getParameters(action);
42
42
  }
43
+ if (!parameters) {
44
+ throw new Error('Cannot resolve internal data for action. Make sure you are using the result of `declareAction` call as an action');
45
+ }
43
46
  const executionState = this.getExecutionState(parameters.name);
44
47
  if (!this.canExecuteAction(payload, parameters, executionState, type)) {
45
48
  switch (parameters.conditionsFailResult) {
@@ -50,6 +50,9 @@ class ActionExecution {
50
50
  this.transformAction(action);
51
51
  parameters = getParameters(action);
52
52
  }
53
+ if (!parameters) {
54
+ throw new Error('Cannot resolve internal data for action. Make sure you are using the result of `declareAction` call as an action');
55
+ }
53
56
  const executionState = this.getExecutionState(parameters.name);
54
57
  if (!this.canExecuteAction(payload, parameters, executionState, type)) {
55
58
  switch (parameters.conditionsFailResult) {
@@ -12,12 +12,13 @@ class ActionPageRunner {
12
12
  return Promise.resolve()
13
13
  .then(() => this.deps.actionExecution.runInContext(executionContext, action))
14
14
  .catch((error) => {
15
+ var _a;
15
16
  if (!isSilentError(error)) {
16
17
  const parameters = isTramvaiAction(action) ? action : action[ACTION_PARAMETERS];
17
18
  this.log.error({
18
19
  error,
19
20
  event: `action-execution-error`,
20
- message: `${parameters.name} execution error`,
21
+ message: `${(_a = parameters === null || parameters === void 0 ? void 0 : parameters.name) !== null && _a !== void 0 ? _a : 'uknown'} execution error`,
21
22
  });
22
23
  }
23
24
  if (stopRunAtError(error)) {
@@ -34,12 +34,13 @@ class ActionPageRunner {
34
34
  return Promise.resolve()
35
35
  .then(() => this.deps.actionExecution.runInContext(executionContext, action))
36
36
  .catch((error) => {
37
+ var _a;
37
38
  if (!isSilentError(error)) {
38
39
  const parameters = isTramvaiAction(action) ? action : action[ACTION_PARAMETERS];
39
40
  this.log.error({
40
41
  error,
41
42
  event: `action-execution-error`,
42
- message: `${parameters.name} execution error`,
43
+ message: `${(_a = parameters === null || parameters === void 0 ? void 0 : parameters.name) !== null && _a !== void 0 ? _a : 'unknown'} execution error`,
43
44
  });
44
45
  }
45
46
  if (stopRunAtError(error)) {
@@ -38,12 +38,13 @@ class ActionPageRunner {
38
38
  return Promise.resolve()
39
39
  .then(() => this.deps.actionExecution.runInContext(executionContext, action))
40
40
  .catch((error) => {
41
+ var _a;
41
42
  if (!errors.isSilentError(error)) {
42
43
  const parameters = core.isTramvaiAction(action) ? action : action[core.ACTION_PARAMETERS];
43
44
  this.log.error({
44
45
  error,
45
46
  event: `action-execution-error`,
46
- message: `${parameters.name} execution error`,
47
+ message: `${(_a = parameters === null || parameters === void 0 ? void 0 : parameters.name) !== null && _a !== void 0 ? _a : 'unknown'} execution error`,
47
48
  });
48
49
  }
49
50
  if (stopRunAtError(error)) {
@@ -1,13 +1,13 @@
1
- import type { Action } from '@tramvai/core';
1
+ import type { PageAction } from '@tramvai/core';
2
2
  import type { ActionsRegistry as Interface } from '@tramvai/tokens-common';
3
3
  export declare const GLOBAL_PARAMETER = "@@global";
4
4
  export declare class ActionRegistry implements Interface {
5
5
  private actions;
6
6
  constructor({ actionsList }: {
7
- actionsList: Action[];
7
+ actionsList: PageAction[];
8
8
  });
9
- add(type: string, actions: Action | Action[]): void;
10
- get(type: string, addingActions?: Action[]): Action[];
11
- getGlobal(): Action[] | undefined;
12
- remove(type: string, actions?: Action | Action[]): void;
9
+ add(type: string, actions: PageAction | PageAction[]): void;
10
+ get(type: string, addingActions?: PageAction[]): PageAction[];
11
+ getGlobal(): PageAction[] | undefined;
12
+ remove(type: string, actions?: PageAction | PageAction[]): void;
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "2.73.1",
3
+ "version": "2.74.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -32,28 +32,28 @@
32
32
  "@tinkoff/lru-cache-nano": "^7.8.1",
33
33
  "@tinkoff/pubsub": "0.5.6",
34
34
  "@tinkoff/url": "0.8.5",
35
- "@tramvai/experiments": "2.73.1",
36
- "@tramvai/module-cookie": "2.73.1",
37
- "@tramvai/module-environment": "2.73.1",
38
- "@tramvai/module-log": "2.73.1",
39
- "@tramvai/tokens-child-app": "2.73.1",
40
- "@tramvai/tokens-core-private": "2.73.1",
41
- "@tramvai/tokens-common": "2.73.1",
42
- "@tramvai/tokens-render": "2.73.1",
43
- "@tramvai/tokens-server-private": "2.73.1",
44
- "@tramvai/types-actions-state-context": "2.73.1",
35
+ "@tramvai/experiments": "2.74.0",
36
+ "@tramvai/module-cookie": "2.74.0",
37
+ "@tramvai/module-environment": "2.74.0",
38
+ "@tramvai/module-log": "2.74.0",
39
+ "@tramvai/tokens-child-app": "2.74.0",
40
+ "@tramvai/tokens-core-private": "2.74.0",
41
+ "@tramvai/tokens-common": "2.74.0",
42
+ "@tramvai/tokens-render": "2.74.0",
43
+ "@tramvai/tokens-server-private": "2.74.0",
44
+ "@tramvai/types-actions-state-context": "2.74.0",
45
45
  "hoist-non-react-statics": "^3.3.1",
46
46
  "node-abort-controller": "^3.0.1"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@tinkoff/dippy": "0.8.13",
50
50
  "@tinkoff/utils": "^2.1.2",
51
- "@tramvai/cli": "2.73.1",
52
- "@tramvai/core": "2.73.1",
53
- "@tramvai/papi": "2.73.1",
54
- "@tramvai/react": "2.73.1",
55
- "@tramvai/state": "2.73.1",
56
- "@tramvai/tokens-server": "2.73.1",
51
+ "@tramvai/cli": "2.74.0",
52
+ "@tramvai/core": "2.74.0",
53
+ "@tramvai/papi": "2.74.0",
54
+ "@tramvai/react": "2.74.0",
55
+ "@tramvai/state": "2.74.0",
56
+ "@tramvai/tokens-server": "2.74.0",
57
57
  "react": ">=16.14.0",
58
58
  "tslib": "^2.4.0"
59
59
  },