@tramvai/module-common 5.24.0 → 5.40.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.
@@ -1,13 +1,12 @@
1
1
  import flatten from '@tinkoff/utils/array/flatten';
2
2
  import identity from '@tinkoff/utils/function/identity';
3
3
  import isPromise from '@tinkoff/utils/is/promise';
4
- import { isTramvaiAction, ACTION_PARAMETERS } from '@tramvai/core';
4
+ import { Deferred, isTramvaiAction, ACTION_PARAMETERS } from '@tramvai/core';
5
5
  import objectMap from '@tinkoff/utils/object/map';
6
6
  import { ConditionFailError } from '@tinkoff/errors';
7
7
  import { ActionChecker } from './actionChecker.browser.js';
8
8
  import { actionType } from './constants.browser.js';
9
9
  import { actionTramvaiReducer } from './actionTramvaiReducer.browser.js';
10
- import { Deferred } from './deferred/deferred.inline.browser.js';
11
10
 
12
11
  const EMPTY_DEPS = {};
13
12
  const getParameters = (action) => action[ACTION_PARAMETERS];
@@ -1,13 +1,12 @@
1
1
  import flatten from '@tinkoff/utils/array/flatten';
2
2
  import identity from '@tinkoff/utils/function/identity';
3
3
  import isPromise from '@tinkoff/utils/is/promise';
4
- import { isTramvaiAction, ACTION_PARAMETERS } from '@tramvai/core';
4
+ import { Deferred, isTramvaiAction, ACTION_PARAMETERS } from '@tramvai/core';
5
5
  import objectMap from '@tinkoff/utils/object/map';
6
6
  import { ConditionFailError } from '@tinkoff/errors';
7
7
  import { ActionChecker } from './actionChecker.es.js';
8
8
  import { actionType } from './constants.es.js';
9
9
  import { actionTramvaiReducer } from './actionTramvaiReducer.es.js';
10
- import { Deferred } from './deferred/deferred.inline.es.js';
11
10
 
12
11
  const EMPTY_DEPS = {};
13
12
  const getParameters = (action) => action[ACTION_PARAMETERS];
@@ -11,7 +11,6 @@ var errors = require('@tinkoff/errors');
11
11
  var actionChecker = require('./actionChecker.js');
12
12
  var constants = require('./constants.js');
13
13
  var actionTramvaiReducer = require('./actionTramvaiReducer.js');
14
- var deferred_inline = require('./deferred/deferred.inline.js');
15
14
 
16
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
16
 
@@ -62,7 +61,7 @@ class ActionExecution {
62
61
  const isDeferredAction = parameters.deferred;
63
62
  // will be created when spa run actions mode is "before"
64
63
  if (isDeferredAction && !this.deferredActionsMap.get(action.name)) {
65
- const deferred = new deferred_inline.Deferred();
64
+ const deferred = new core.Deferred();
66
65
  // avoid unhandled promise rejection
67
66
  deferred.promise.catch(() => { });
68
67
  this.deferredActionsMap.set(action.name, deferred);
@@ -1,7 +1,7 @@
1
1
  import { useDi } from '@tramvai/react';
2
+ import { Deferred } from '@tramvai/core';
2
3
  import { DEFERRED_ACTIONS_MAP_TOKEN } from '@tramvai/tokens-common';
3
4
  import { deserializeError } from '@tramvai/safe-strings';
4
- import { Deferred } from './deferred.inline.browser.js';
5
5
 
6
6
  function Await({ action, children, error, }) {
7
7
  const deferredMap = useDi(DEFERRED_ACTIONS_MAP_TOKEN);
@@ -1,7 +1,7 @@
1
1
  import { useDi } from '@tramvai/react';
2
+ import { Deferred } from '@tramvai/core';
2
3
  import { DEFERRED_ACTIONS_MAP_TOKEN } from '@tramvai/tokens-common';
3
4
  import { deserializeError } from '@tramvai/safe-strings';
4
- import { Deferred } from './deferred.inline.es.js';
5
5
 
6
6
  function Await({ action, children, error, }) {
7
7
  const deferredMap = useDi(DEFERRED_ACTIONS_MAP_TOKEN);
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('@tramvai/react');
6
+ var core = require('@tramvai/core');
6
7
  var tokensCommon = require('@tramvai/tokens-common');
7
8
  var safeStrings = require('@tramvai/safe-strings');
8
- var deferred_inline = require('./deferred.inline.js');
9
9
 
10
10
  function Await({ action, children, error, }) {
11
11
  const deferredMap = react.useDi(tokensCommon.DEFERRED_ACTIONS_MAP_TOKEN);
@@ -16,7 +16,7 @@ function Await({ action, children, error, }) {
16
16
  }
17
17
  // will be created when spa run actions mode is "after"
18
18
  if (!deferred) {
19
- deferred = new deferred_inline.Deferred();
19
+ deferred = new core.Deferred();
20
20
  // avoid unhandled promise rejection
21
21
  deferred.promise.catch(() => { });
22
22
  deferredMap.set(action.name, deferred);
@@ -1,7 +1,6 @@
1
- import { provide, commandLineListTokens, optional } from '@tramvai/core';
1
+ import { provide, commandLineListTokens, Deferred, optional } from '@tramvai/core';
2
2
  import { ResourceSlot, ResourceType, RESOURCES_REGISTRY, REACT_SERVER_RENDER_MODE } from '@tramvai/tokens-render';
3
3
  import { DEFERRED_ACTIONS_MAP_TOKEN } from '@tramvai/tokens-common';
4
- import { Deferred } from './deferred.inline.es.js';
5
4
  import { generateDeferredResolve, generateDeferredReject } from './clientScriptsUtils.es.js';
6
5
 
7
6
  const providers = [
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var core = require('@tramvai/core');
6
6
  var tokensRender = require('@tramvai/tokens-render');
7
7
  var tokensCommon = require('@tramvai/tokens-common');
8
- var deferred_inline = require('./deferred.inline.js');
9
8
  var clientScriptsUtils = require('./clientScriptsUtils.js');
10
9
 
11
10
  const providers = [
@@ -22,7 +21,7 @@ const providers = [
22
21
  resourcesRegistry.register({
23
22
  slot: tokensRender.ResourceSlot.HEAD_CORE_SCRIPTS,
24
23
  type: tokensRender.ResourceType.inlineScript,
25
- payload: `window.__Deferred = ${deferred_inline.Deferred}
24
+ payload: `window.__Deferred = ${core.Deferred}
26
25
  window.__TRAMVAI_DEFERRED_ACTIONS = {};`,
27
26
  });
28
27
  deferredMap.forEach((deferred, key) => {
@@ -2,7 +2,6 @@ export { CommonModule } from './CommonModule.browser.js';
2
2
  export { CommandModule } from './command/CommandModule.browser.js';
3
3
  export { ActionExecution } from './actions/actionExecution.browser.js';
4
4
  export { ActionRegistry } from './actions/actionRegistry.browser.js';
5
- export { Deferred } from './actions/deferred/deferred.inline.browser.js';
6
5
  export { Await } from './actions/deferred/await.browser.js';
7
6
  export { ExecutionContextManager } from './executionContext/executionContextManager.browser.js';
8
7
  import './actions/ActionModule.browser.js';
package/lib/index.d.ts CHANGED
@@ -2,7 +2,6 @@ export { CommonModule } from './CommonModule';
2
2
  export { CommandModule } from './command/CommandModule';
3
3
  export { ActionExecution } from './actions/actionExecution';
4
4
  export { ActionRegistry } from './actions/actionRegistry';
5
- export { Deferred } from './actions/deferred/deferred.inline';
6
5
  export { Await } from './actions/deferred/await';
7
6
  export { ExecutionContextManager } from './executionContext/executionContextManager';
8
7
  export { alwaysCondition, onlyServer, onlyBrowser, pageServer, pageBrowser, } from './actions/ActionModule';
package/lib/index.es.js CHANGED
@@ -2,7 +2,6 @@ export { CommonModule } from './CommonModule.es.js';
2
2
  export { CommandModule } from './command/CommandModule.es.js';
3
3
  export { ActionExecution } from './actions/actionExecution.es.js';
4
4
  export { ActionRegistry } from './actions/actionRegistry.es.js';
5
- export { Deferred } from './actions/deferred/deferred.inline.es.js';
6
5
  export { Await } from './actions/deferred/await.es.js';
7
6
  export { ExecutionContextManager } from './executionContext/executionContextManager.es.js';
8
7
  import './actions/ActionModule.es.js';
package/lib/index.js CHANGED
@@ -6,7 +6,6 @@ var CommonModule = require('./CommonModule.js');
6
6
  var CommandModule = require('./command/CommandModule.js');
7
7
  var actionExecution = require('./actions/actionExecution.js');
8
8
  var actionRegistry = require('./actions/actionRegistry.js');
9
- var deferred_inline = require('./actions/deferred/deferred.inline.js');
10
9
  var _await = require('./actions/deferred/await.js');
11
10
  var executionContextManager = require('./executionContext/executionContextManager.js');
12
11
  require('./actions/ActionModule.js');
@@ -33,7 +32,6 @@ Object.defineProperty(exports, 'CommandModule', {
33
32
  });
34
33
  exports.ActionExecution = actionExecution.ActionExecution;
35
34
  exports.ActionRegistry = actionRegistry.ActionRegistry;
36
- exports.Deferred = deferred_inline.Deferred;
37
35
  exports.Await = _await.Await;
38
36
  exports.ExecutionContextManager = executionContextManager.ExecutionContextManager;
39
37
  exports.createConsumerContext = createConsumerContext.createConsumerContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "5.24.0",
3
+ "version": "5.40.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -36,30 +36,30 @@
36
36
  "@tinkoff/lru-cache-nano": "^7.9.0",
37
37
  "@tinkoff/pubsub": "0.8.2",
38
38
  "@tinkoff/url": "0.11.2",
39
- "@tramvai/experiments": "5.24.0",
40
- "@tramvai/module-cookie": "5.24.0",
41
- "@tramvai/module-environment": "5.24.0",
42
- "@tramvai/module-log": "5.24.0",
39
+ "@tramvai/experiments": "5.40.0",
40
+ "@tramvai/module-cookie": "5.40.0",
41
+ "@tramvai/module-environment": "5.40.0",
42
+ "@tramvai/module-log": "5.40.0",
43
43
  "@tramvai/safe-strings": "0.8.4",
44
- "@tramvai/tokens-child-app": "5.24.0",
45
- "@tramvai/tokens-common": "5.24.0",
46
- "@tramvai/tokens-core-private": "5.24.0",
47
- "@tramvai/tokens-metrics": "5.24.0",
48
- "@tramvai/tokens-render": "5.24.0",
49
- "@tramvai/tokens-router": "5.24.0",
50
- "@tramvai/tokens-server-private": "5.24.0",
51
- "@tramvai/types-actions-state-context": "5.24.0",
44
+ "@tramvai/tokens-child-app": "5.40.0",
45
+ "@tramvai/tokens-common": "5.40.0",
46
+ "@tramvai/tokens-core-private": "5.40.0",
47
+ "@tramvai/tokens-metrics": "5.40.0",
48
+ "@tramvai/tokens-render": "5.40.0",
49
+ "@tramvai/tokens-router": "5.40.0",
50
+ "@tramvai/tokens-server-private": "5.40.0",
51
+ "@tramvai/types-actions-state-context": "5.40.0",
52
52
  "hoist-non-react-statics": "^3.3.1"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@tinkoff/dippy": "0.11.3",
56
56
  "@tinkoff/utils": "^2.1.2",
57
- "@tramvai/cli": "5.24.0",
58
- "@tramvai/core": "5.24.0",
59
- "@tramvai/papi": "5.24.0",
60
- "@tramvai/react": "5.24.0",
61
- "@tramvai/state": "5.24.0",
62
- "@tramvai/tokens-server": "5.24.0",
57
+ "@tramvai/cli": "5.40.0",
58
+ "@tramvai/core": "5.40.0",
59
+ "@tramvai/papi": "5.40.0",
60
+ "@tramvai/react": "5.40.0",
61
+ "@tramvai/state": "5.40.0",
62
+ "@tramvai/tokens-server": "5.40.0",
63
63
  "react": ">=16.14.0",
64
64
  "tslib": "^2.4.0"
65
65
  },
@@ -1,30 +0,0 @@
1
- class Deferred {
2
- constructor() {
3
- this.isResolved = () => {
4
- return typeof this.resolveData !== 'undefined';
5
- };
6
- this.isRejected = () => {
7
- return typeof this.rejectReason !== 'undefined';
8
- };
9
- this.reset = () => {
10
- this.resolveData = undefined;
11
- this.rejectReason = undefined;
12
- this.promise = this.initPromise();
13
- };
14
- this.initPromise = () => {
15
- return new Promise((resolve, reject) => {
16
- this.resolve = (value) => {
17
- this.resolveData = value;
18
- resolve(value);
19
- };
20
- this.reject = (reason) => {
21
- this.rejectReason = reason;
22
- reject(reason);
23
- };
24
- });
25
- };
26
- this.promise = this.initPromise();
27
- }
28
- }
29
-
30
- export { Deferred };
@@ -1,14 +0,0 @@
1
- import type { Deferred as IDeferred } from '@tramvai/tokens-common';
2
- export declare class Deferred implements IDeferred {
3
- promise: Promise<any>;
4
- resolve: (value: any) => void;
5
- reject: (reason: any) => void;
6
- resolveData: any;
7
- rejectReason: any;
8
- isResolved: () => boolean;
9
- isRejected: () => boolean;
10
- reset: () => void;
11
- private initPromise;
12
- constructor();
13
- }
14
- //# sourceMappingURL=deferred.inline.d.ts.map
@@ -1,30 +0,0 @@
1
- class Deferred {
2
- constructor() {
3
- this.isResolved = () => {
4
- return typeof this.resolveData !== 'undefined';
5
- };
6
- this.isRejected = () => {
7
- return typeof this.rejectReason !== 'undefined';
8
- };
9
- this.reset = () => {
10
- this.resolveData = undefined;
11
- this.rejectReason = undefined;
12
- this.promise = this.initPromise();
13
- };
14
- this.initPromise = () => {
15
- return new Promise((resolve, reject) => {
16
- this.resolve = (value) => {
17
- this.resolveData = value;
18
- resolve(value);
19
- };
20
- this.reject = (reason) => {
21
- this.rejectReason = reason;
22
- reject(reason);
23
- };
24
- });
25
- };
26
- this.promise = this.initPromise();
27
- }
28
- }
29
-
30
- export { Deferred };
@@ -1,34 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- class Deferred {
6
- constructor() {
7
- this.isResolved = () => {
8
- return typeof this.resolveData !== 'undefined';
9
- };
10
- this.isRejected = () => {
11
- return typeof this.rejectReason !== 'undefined';
12
- };
13
- this.reset = () => {
14
- this.resolveData = undefined;
15
- this.rejectReason = undefined;
16
- this.promise = this.initPromise();
17
- };
18
- this.initPromise = () => {
19
- return new Promise((resolve, reject) => {
20
- this.resolve = (value) => {
21
- this.resolveData = value;
22
- resolve(value);
23
- };
24
- this.reject = (reason) => {
25
- this.rejectReason = reason;
26
- reject(reason);
27
- };
28
- });
29
- };
30
- this.promise = this.initPromise();
31
- }
32
- }
33
-
34
- exports.Deferred = Deferred;