@tramvai/module-common 2.70.1 → 2.72.3

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.
Files changed (123) hide show
  1. package/lib/CommonModule.browser.js +100 -0
  2. package/lib/CommonModule.es.js +100 -0
  3. package/lib/CommonModule.js +106 -0
  4. package/lib/actions/ActionModule.browser.js +79 -0
  5. package/lib/actions/ActionModule.es.js +79 -0
  6. package/lib/actions/ActionModule.js +82 -0
  7. package/lib/actions/actionChecker.browser.js +52 -0
  8. package/lib/actions/actionChecker.es.js +52 -0
  9. package/lib/actions/actionChecker.js +56 -0
  10. package/lib/actions/actionExecution.browser.js +107 -0
  11. package/lib/actions/actionExecution.es.js +107 -0
  12. package/lib/actions/actionExecution.js +118 -0
  13. package/lib/actions/actionPageRunner.browser.browser.js +33 -0
  14. package/lib/actions/actionPageRunner.es.js +61 -0
  15. package/lib/actions/actionPageRunner.js +65 -0
  16. package/lib/actions/actionRegistry.browser.js +33 -0
  17. package/lib/actions/actionRegistry.es.js +33 -0
  18. package/lib/actions/actionRegistry.js +45 -0
  19. package/lib/actions/actionTramvaiReducer.browser.js +10 -0
  20. package/lib/actions/actionTramvaiReducer.es.js +10 -0
  21. package/lib/actions/actionTramvaiReducer.js +15 -0
  22. package/lib/actions/conditions/always.browser.js +10 -0
  23. package/lib/actions/conditions/always.es.js +10 -0
  24. package/lib/actions/conditions/always.js +14 -0
  25. package/lib/actions/conditions/helpers.browser.js +4 -0
  26. package/lib/actions/conditions/helpers.es.js +4 -0
  27. package/lib/actions/conditions/helpers.js +9 -0
  28. package/lib/actions/conditions/onlyBrowser.browser.js +12 -0
  29. package/lib/actions/conditions/onlyBrowser.es.js +12 -0
  30. package/lib/actions/conditions/onlyBrowser.js +16 -0
  31. package/lib/actions/conditions/onlyServer.browser.js +12 -0
  32. package/lib/actions/conditions/onlyServer.es.js +12 -0
  33. package/lib/actions/conditions/onlyServer.js +16 -0
  34. package/lib/actions/conditions/pageBrowser.browser.js +13 -0
  35. package/lib/actions/conditions/pageBrowser.es.js +13 -0
  36. package/lib/actions/conditions/pageBrowser.js +17 -0
  37. package/lib/actions/conditions/pageServer.browser.js +13 -0
  38. package/lib/actions/conditions/pageServer.es.js +13 -0
  39. package/lib/actions/conditions/pageServer.js +17 -0
  40. package/lib/actions/constants.browser.js +9 -0
  41. package/lib/actions/constants.es.js +9 -0
  42. package/lib/actions/constants.js +13 -0
  43. package/lib/bundleManager/bundleManager.browser.js +105 -0
  44. package/lib/bundleManager/bundleManager.es.js +105 -0
  45. package/lib/bundleManager/bundleManager.js +115 -0
  46. package/lib/cache/CacheModule.browser.js +58 -0
  47. package/lib/cache/CacheModule.es.js +58 -0
  48. package/lib/cache/CacheModule.js +62 -0
  49. package/lib/cache/cacheFactory.browser.js +7 -0
  50. package/lib/cache/cacheFactory.es.js +7 -0
  51. package/lib/cache/cacheFactory.js +15 -0
  52. package/lib/cache/clientProviders.browser.js +3 -0
  53. package/lib/cache/papi.es.js +18 -0
  54. package/lib/cache/papi.js +22 -0
  55. package/lib/cache/serverProviders.es.js +18 -0
  56. package/lib/cache/serverProviders.js +22 -0
  57. package/lib/child-app/ChildAppModule.browser.js +38 -0
  58. package/lib/child-app/ChildAppModule.es.js +38 -0
  59. package/lib/child-app/ChildAppModule.js +40 -0
  60. package/lib/child-app/actions.browser.js +19 -0
  61. package/lib/child-app/actions.es.js +19 -0
  62. package/lib/child-app/actions.js +23 -0
  63. package/lib/child-app/clientProviders.browser.js +18 -0
  64. package/lib/child-app/command.browser.js +35 -0
  65. package/lib/child-app/command.es.js +35 -0
  66. package/lib/child-app/command.js +40 -0
  67. package/lib/child-app/serverProviders.es.js +3 -0
  68. package/lib/child-app/serverProviders.js +7 -0
  69. package/lib/child-app/state.browser.js +13 -0
  70. package/lib/child-app/state.es.js +13 -0
  71. package/lib/child-app/state.js +17 -0
  72. package/lib/command/CommandModule.browser.js +52 -0
  73. package/lib/command/CommandModule.es.js +52 -0
  74. package/lib/command/CommandModule.js +54 -0
  75. package/lib/command/commandLineRunner.browser.js +147 -0
  76. package/lib/command/commandLineRunner.es.js +147 -0
  77. package/lib/command/commandLineRunner.js +151 -0
  78. package/lib/command/defaultLines.browser.js +25 -0
  79. package/lib/command/defaultLines.es.js +25 -0
  80. package/lib/command/defaultLines.js +29 -0
  81. package/lib/componentRegistry/componentRegistry.browser.js +25 -0
  82. package/lib/componentRegistry/componentRegistry.es.js +25 -0
  83. package/lib/componentRegistry/componentRegistry.js +34 -0
  84. package/lib/createConsumerContext/createConsumerContext.browser.js +62 -0
  85. package/lib/createConsumerContext/createConsumerContext.es.js +62 -0
  86. package/lib/createConsumerContext/createConsumerContext.js +67 -0
  87. package/lib/executionContext/executionContextManager.browser.js +57 -0
  88. package/lib/executionContext/executionContextManager.es.js +57 -0
  89. package/lib/executionContext/executionContextManager.js +61 -0
  90. package/lib/index.browser.js +13 -1300
  91. package/lib/index.es.js +13 -1318
  92. package/lib/index.js +38 -1341
  93. package/lib/providers/clientProviders.browser.js +22 -0
  94. package/lib/providers/serverProviders.es.js +3 -0
  95. package/lib/providers/serverProviders.js +7 -0
  96. package/lib/pubsub/PubSubModule.browser.js +44 -0
  97. package/lib/pubsub/PubSubModule.es.js +44 -0
  98. package/lib/pubsub/PubSubModule.js +46 -0
  99. package/lib/requestManager/RequestManagerModule.browser.browser.js +38 -0
  100. package/lib/requestManager/RequestManagerModule.es.js +35 -0
  101. package/lib/requestManager/RequestManagerModule.js +37 -0
  102. package/lib/requestManager/RequestManagerStore.browser.js +8 -0
  103. package/lib/requestManager/RequestManagerStore.es.js +8 -0
  104. package/lib/requestManager/RequestManagerStore.js +13 -0
  105. package/lib/requestManager/requestManager.browser.js +57 -0
  106. package/lib/requestManager/requestManager.es.js +57 -0
  107. package/lib/requestManager/requestManager.js +61 -0
  108. package/lib/requestManager/sharedProviders.browser.js +23 -0
  109. package/lib/requestManager/sharedProviders.es.js +23 -0
  110. package/lib/requestManager/sharedProviders.js +27 -0
  111. package/lib/responseManager/ResponseManagerModule.browser.browser.js +21 -0
  112. package/lib/responseManager/ResponseManagerModule.es.js +13 -0
  113. package/lib/responseManager/ResponseManagerModule.js +15 -0
  114. package/lib/responseManager/responseManager.browser.js +52 -0
  115. package/lib/responseManager/responseManager.es.js +52 -0
  116. package/lib/responseManager/responseManager.js +61 -0
  117. package/lib/responseManager/sharedProviders.browser.js +13 -0
  118. package/lib/responseManager/sharedProviders.es.js +13 -0
  119. package/lib/responseManager/sharedProviders.js +17 -0
  120. package/lib/state/StateModule.browser.js +54 -0
  121. package/lib/state/StateModule.es.js +54 -0
  122. package/lib/state/StateModule.js +60 -0
  123. package/package.json +24 -25
@@ -0,0 +1,52 @@
1
+ import isEmpty from '@tinkoff/utils/is/empty';
2
+ import values from '@tinkoff/utils/object/values';
3
+
4
+ class ResponseManager {
5
+ constructor() {
6
+ this.body = '';
7
+ this.headers = {};
8
+ this.cookies = {};
9
+ this.status = 200;
10
+ }
11
+ getBody() {
12
+ return this.body;
13
+ }
14
+ setBody(value) {
15
+ this.body = value;
16
+ }
17
+ getHeader(key) {
18
+ if (key === 'set-cookie') {
19
+ return values(this.cookies);
20
+ }
21
+ return this.headers[key];
22
+ }
23
+ getHeaders() {
24
+ if (isEmpty(this.cookies)) {
25
+ return this.headers;
26
+ }
27
+ return {
28
+ ...this.headers,
29
+ 'Set-Cookie': values(this.cookies),
30
+ };
31
+ }
32
+ setHeader(key, value) {
33
+ this.headers[key] = value;
34
+ }
35
+ getCookie(key) {
36
+ return this.cookies[key];
37
+ }
38
+ getCookies() {
39
+ return this.cookies;
40
+ }
41
+ setCookie(key, value) {
42
+ this.cookies[key] = value;
43
+ }
44
+ setStatus(status) {
45
+ this.status = status;
46
+ }
47
+ getStatus() {
48
+ return this.status;
49
+ }
50
+ }
51
+
52
+ export { ResponseManager };
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var isEmpty = require('@tinkoff/utils/is/empty');
6
+ var values = require('@tinkoff/utils/object/values');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
11
+ var values__default = /*#__PURE__*/_interopDefaultLegacy(values);
12
+
13
+ class ResponseManager {
14
+ constructor() {
15
+ this.body = '';
16
+ this.headers = {};
17
+ this.cookies = {};
18
+ this.status = 200;
19
+ }
20
+ getBody() {
21
+ return this.body;
22
+ }
23
+ setBody(value) {
24
+ this.body = value;
25
+ }
26
+ getHeader(key) {
27
+ if (key === 'set-cookie') {
28
+ return values__default["default"](this.cookies);
29
+ }
30
+ return this.headers[key];
31
+ }
32
+ getHeaders() {
33
+ if (isEmpty__default["default"](this.cookies)) {
34
+ return this.headers;
35
+ }
36
+ return {
37
+ ...this.headers,
38
+ 'Set-Cookie': values__default["default"](this.cookies),
39
+ };
40
+ }
41
+ setHeader(key, value) {
42
+ this.headers[key] = value;
43
+ }
44
+ getCookie(key) {
45
+ return this.cookies[key];
46
+ }
47
+ getCookies() {
48
+ return this.cookies;
49
+ }
50
+ setCookie(key, value) {
51
+ this.cookies[key] = value;
52
+ }
53
+ setStatus(status) {
54
+ this.status = status;
55
+ }
56
+ getStatus() {
57
+ return this.status;
58
+ }
59
+ }
60
+
61
+ exports.ResponseManager = ResponseManager;
@@ -0,0 +1,13 @@
1
+ import { provide, Scope } from '@tramvai/core';
2
+ import { RESPONSE_MANAGER_TOKEN } from '@tramvai/tokens-common';
3
+ import { ResponseManager } from './responseManager.browser.js';
4
+
5
+ const sharedProviders = [
6
+ provide({
7
+ provide: RESPONSE_MANAGER_TOKEN,
8
+ scope: Scope.REQUEST,
9
+ useClass: ResponseManager,
10
+ }),
11
+ ];
12
+
13
+ export { sharedProviders };
@@ -0,0 +1,13 @@
1
+ import { provide, Scope } from '@tramvai/core';
2
+ import { RESPONSE_MANAGER_TOKEN } from '@tramvai/tokens-common';
3
+ import { ResponseManager } from './responseManager.es.js';
4
+
5
+ const sharedProviders = [
6
+ provide({
7
+ provide: RESPONSE_MANAGER_TOKEN,
8
+ scope: Scope.REQUEST,
9
+ useClass: ResponseManager,
10
+ }),
11
+ ];
12
+
13
+ export { sharedProviders };
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@tramvai/core');
6
+ var tokensCommon = require('@tramvai/tokens-common');
7
+ var responseManager = require('./responseManager.js');
8
+
9
+ const sharedProviders = [
10
+ core.provide({
11
+ provide: tokensCommon.RESPONSE_MANAGER_TOKEN,
12
+ scope: core.Scope.REQUEST,
13
+ useClass: responseManager.ResponseManager,
14
+ }),
15
+ ];
16
+
17
+ exports.sharedProviders = sharedProviders;
@@ -0,0 +1,54 @@
1
+ import { __decorate } from 'tslib';
2
+ import { Module, provide, Scope } from '@tramvai/core';
3
+ import flatten from '@tinkoff/utils/array/flatten';
4
+ import { createDispatcher, devTools } from '@tramvai/state';
5
+ import { DISPATCHER_TOKEN, COMBINE_REDUCERS, DISPATCHER_CONTEXT_TOKEN, STORE_MIDDLEWARE, INITIAL_APP_STATE_TOKEN, STORE_TOKEN } from '@tramvai/tokens-common';
6
+
7
+ let StateModule = class StateModule {
8
+ };
9
+ StateModule = __decorate([
10
+ Module({
11
+ providers: [
12
+ provide({
13
+ provide: DISPATCHER_TOKEN,
14
+ scope: Scope.SINGLETON,
15
+ useFactory: ({ stores }) => createDispatcher({ stores: stores && flatten(stores) }),
16
+ deps: {
17
+ stores: {
18
+ token: COMBINE_REDUCERS,
19
+ optional: true,
20
+ },
21
+ },
22
+ }),
23
+ provide({
24
+ provide: DISPATCHER_CONTEXT_TOKEN,
25
+ scope: Scope.REQUEST,
26
+ useFactory: ({ dispatcher, initialState, middlewares }) => {
27
+ return dispatcher.createContext({}, initialState, [
28
+ devTools.middleware(),
29
+ ...flatten(middlewares || []),
30
+ ]);
31
+ },
32
+ deps: {
33
+ dispatcher: DISPATCHER_TOKEN,
34
+ middlewares: { token: STORE_MIDDLEWARE, optional: true },
35
+ initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
36
+ },
37
+ }),
38
+ provide({
39
+ provide: STORE_TOKEN,
40
+ scope: Scope.REQUEST,
41
+ useFactory: ({ dispatcherContext }) => ({
42
+ getState: dispatcherContext.getState.bind(dispatcherContext),
43
+ dispatch: dispatcherContext.dispatch.bind(dispatcherContext),
44
+ subscribe: dispatcherContext.subscribe.bind(dispatcherContext),
45
+ }),
46
+ deps: {
47
+ dispatcherContext: DISPATCHER_CONTEXT_TOKEN,
48
+ },
49
+ }),
50
+ ],
51
+ })
52
+ ], StateModule);
53
+
54
+ export { StateModule };
@@ -0,0 +1,54 @@
1
+ import { __decorate } from 'tslib';
2
+ import { Module, provide, Scope } from '@tramvai/core';
3
+ import flatten from '@tinkoff/utils/array/flatten';
4
+ import { createDispatcher, devTools } from '@tramvai/state';
5
+ import { DISPATCHER_TOKEN, COMBINE_REDUCERS, DISPATCHER_CONTEXT_TOKEN, STORE_MIDDLEWARE, INITIAL_APP_STATE_TOKEN, STORE_TOKEN } from '@tramvai/tokens-common';
6
+
7
+ let StateModule = class StateModule {
8
+ };
9
+ StateModule = __decorate([
10
+ Module({
11
+ providers: [
12
+ provide({
13
+ provide: DISPATCHER_TOKEN,
14
+ scope: Scope.SINGLETON,
15
+ useFactory: ({ stores }) => createDispatcher({ stores: stores && flatten(stores) }),
16
+ deps: {
17
+ stores: {
18
+ token: COMBINE_REDUCERS,
19
+ optional: true,
20
+ },
21
+ },
22
+ }),
23
+ provide({
24
+ provide: DISPATCHER_CONTEXT_TOKEN,
25
+ scope: Scope.REQUEST,
26
+ useFactory: ({ dispatcher, initialState, middlewares }) => {
27
+ return dispatcher.createContext({}, initialState, [
28
+ devTools.middleware(),
29
+ ...flatten(middlewares || []),
30
+ ]);
31
+ },
32
+ deps: {
33
+ dispatcher: DISPATCHER_TOKEN,
34
+ middlewares: { token: STORE_MIDDLEWARE, optional: true },
35
+ initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
36
+ },
37
+ }),
38
+ provide({
39
+ provide: STORE_TOKEN,
40
+ scope: Scope.REQUEST,
41
+ useFactory: ({ dispatcherContext }) => ({
42
+ getState: dispatcherContext.getState.bind(dispatcherContext),
43
+ dispatch: dispatcherContext.dispatch.bind(dispatcherContext),
44
+ subscribe: dispatcherContext.subscribe.bind(dispatcherContext),
45
+ }),
46
+ deps: {
47
+ dispatcherContext: DISPATCHER_CONTEXT_TOKEN,
48
+ },
49
+ }),
50
+ ],
51
+ })
52
+ ], StateModule);
53
+
54
+ export { StateModule };
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var core = require('@tramvai/core');
7
+ var flatten = require('@tinkoff/utils/array/flatten');
8
+ var state = require('@tramvai/state');
9
+ var tokensCommon = require('@tramvai/tokens-common');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
14
+
15
+ exports.StateModule = class StateModule {
16
+ };
17
+ exports.StateModule = tslib.__decorate([
18
+ core.Module({
19
+ providers: [
20
+ core.provide({
21
+ provide: tokensCommon.DISPATCHER_TOKEN,
22
+ scope: core.Scope.SINGLETON,
23
+ useFactory: ({ stores }) => state.createDispatcher({ stores: stores && flatten__default["default"](stores) }),
24
+ deps: {
25
+ stores: {
26
+ token: tokensCommon.COMBINE_REDUCERS,
27
+ optional: true,
28
+ },
29
+ },
30
+ }),
31
+ core.provide({
32
+ provide: tokensCommon.DISPATCHER_CONTEXT_TOKEN,
33
+ scope: core.Scope.REQUEST,
34
+ useFactory: ({ dispatcher, initialState, middlewares }) => {
35
+ return dispatcher.createContext({}, initialState, [
36
+ state.devTools.middleware(),
37
+ ...flatten__default["default"](middlewares || []),
38
+ ]);
39
+ },
40
+ deps: {
41
+ dispatcher: tokensCommon.DISPATCHER_TOKEN,
42
+ middlewares: { token: tokensCommon.STORE_MIDDLEWARE, optional: true },
43
+ initialState: { token: tokensCommon.INITIAL_APP_STATE_TOKEN, optional: true },
44
+ },
45
+ }),
46
+ core.provide({
47
+ provide: tokensCommon.STORE_TOKEN,
48
+ scope: core.Scope.REQUEST,
49
+ useFactory: ({ dispatcherContext }) => ({
50
+ getState: dispatcherContext.getState.bind(dispatcherContext),
51
+ dispatch: dispatcherContext.dispatch.bind(dispatcherContext),
52
+ subscribe: dispatcherContext.subscribe.bind(dispatcherContext),
53
+ }),
54
+ deps: {
55
+ dispatcherContext: tokensCommon.DISPATCHER_CONTEXT_TOKEN,
56
+ },
57
+ }),
58
+ ],
59
+ })
60
+ ], exports.StateModule);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "2.70.1",
3
+ "version": "2.72.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -23,38 +23,37 @@
23
23
  "url": "git@github.com:Tinkoff/tramvai.git"
24
24
  },
25
25
  "scripts": {
26
- "build": "tramvai-build --for-publish",
27
- "watch": "tsc -w",
28
- "build-for-publish": "true"
26
+ "build": "tramvai-build --forPublish --preserveModules",
27
+ "watch": "tsc -w"
29
28
  },
30
29
  "dependencies": {
31
- "@tinkoff/errors": "0.3.5",
32
- "@tinkoff/hook-runner": "0.4.4",
30
+ "@tinkoff/errors": "0.3.6",
31
+ "@tinkoff/hook-runner": "0.4.5",
33
32
  "@tinkoff/lru-cache-nano": "^7.8.1",
34
- "@tinkoff/pubsub": "0.5.5",
35
- "@tinkoff/url": "0.8.4",
36
- "@tramvai/experiments": "2.70.1",
37
- "@tramvai/module-cookie": "2.70.1",
38
- "@tramvai/module-environment": "2.70.1",
39
- "@tramvai/module-log": "2.70.1",
40
- "@tramvai/tokens-child-app": "2.70.1",
41
- "@tramvai/tokens-core-private": "2.70.1",
42
- "@tramvai/tokens-common": "2.70.1",
43
- "@tramvai/tokens-render": "2.70.1",
44
- "@tramvai/tokens-server-private": "2.70.1",
45
- "@tramvai/types-actions-state-context": "2.70.1",
33
+ "@tinkoff/pubsub": "0.5.6",
34
+ "@tinkoff/url": "0.8.5",
35
+ "@tramvai/experiments": "2.72.3",
36
+ "@tramvai/module-cookie": "2.72.3",
37
+ "@tramvai/module-environment": "2.72.3",
38
+ "@tramvai/module-log": "2.72.3",
39
+ "@tramvai/tokens-child-app": "2.72.3",
40
+ "@tramvai/tokens-core-private": "2.72.3",
41
+ "@tramvai/tokens-common": "2.72.3",
42
+ "@tramvai/tokens-render": "2.72.3",
43
+ "@tramvai/tokens-server-private": "2.72.3",
44
+ "@tramvai/types-actions-state-context": "2.72.3",
46
45
  "hoist-non-react-statics": "^3.3.1",
47
46
  "node-abort-controller": "^3.0.1"
48
47
  },
49
48
  "peerDependencies": {
50
- "@tinkoff/dippy": "0.8.12",
49
+ "@tinkoff/dippy": "0.8.13",
51
50
  "@tinkoff/utils": "^2.1.2",
52
- "@tramvai/cli": "2.70.1",
53
- "@tramvai/core": "2.70.1",
54
- "@tramvai/papi": "2.70.1",
55
- "@tramvai/react": "2.70.1",
56
- "@tramvai/state": "2.70.1",
57
- "@tramvai/tokens-server": "2.70.1",
51
+ "@tramvai/cli": "2.72.3",
52
+ "@tramvai/core": "2.72.3",
53
+ "@tramvai/papi": "2.72.3",
54
+ "@tramvai/react": "2.72.3",
55
+ "@tramvai/state": "2.72.3",
56
+ "@tramvai/tokens-server": "2.72.3",
58
57
  "react": ">=16.14.0",
59
58
  "tslib": "^2.4.0"
60
59
  },