@tramvai/module-common 1.8.5 → 1.9.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.
Files changed (2) hide show
  1. package/lib/index.js +24 -28
  2. package/package.json +10 -10
package/lib/index.js CHANGED
@@ -72,7 +72,7 @@ class BundleManager {
72
72
  this.actionRegistry.add(pageComponent, component.actions);
73
73
  }
74
74
  }
75
- eachObj__default['default']((component, name) => {
75
+ eachObj__default["default"]((component, name) => {
76
76
  this.componentRegistry.add(name, component, bundle.name);
77
77
  }, bundle.components);
78
78
  if (bundle.actions) {
@@ -98,7 +98,7 @@ const DEFAULT_BUNDLE = '__default';
98
98
  class ComponentRegistry {
99
99
  constructor({ componentList } = {}) {
100
100
  this.components = {
101
- [DEFAULT_BUNDLE]: Object.assign({}, ...flatten__default['default'](componentList !== null && componentList !== void 0 ? componentList : [])),
101
+ [DEFAULT_BUNDLE]: Object.assign({}, ...flatten__default["default"](componentList !== null && componentList !== void 0 ? componentList : [])),
102
102
  };
103
103
  }
104
104
  add(name, component, bundle = DEFAULT_BUNDLE) {
@@ -111,7 +111,7 @@ class ComponentRegistry {
111
111
  return bundleComponents[name] || this.components[DEFAULT_BUNDLE][name];
112
112
  }
113
113
  getComponentParam(param, defaultValue, component, bundle) {
114
- return pathOr__default['default']([param], defaultValue, this.get(component, bundle));
114
+ return pathOr__default["default"]([param], defaultValue, this.get(component, bundle));
115
115
  }
116
116
  }
117
117
 
@@ -156,7 +156,7 @@ class RequestManager {
156
156
  return this.request.cookies;
157
157
  }
158
158
  getClientIp() {
159
- return this.getHeader('x-real-ip') || pathOr__default['default'](['connection', 'remoteAddress'], '', this.request);
159
+ return this.getHeader('x-real-ip') || pathOr__default["default"](['connection', 'remoteAddress'], '', this.request);
160
160
  }
161
161
  getHost() {
162
162
  if (typeof window === 'undefined') {
@@ -225,17 +225,17 @@ class ResponseManager {
225
225
  }
226
226
  getHeader(key) {
227
227
  if (key === 'set-cookie') {
228
- return values__default['default'](this.cookies);
228
+ return values__default["default"](this.cookies);
229
229
  }
230
230
  return this.headers[key];
231
231
  }
232
232
  getHeaders() {
233
- if (isEmpty__default['default'](this.cookies)) {
233
+ if (isEmpty__default["default"](this.cookies)) {
234
234
  return this.headers;
235
235
  }
236
236
  return {
237
237
  ...this.headers,
238
- 'Set-Cookie': values__default['default'](this.cookies),
238
+ 'Set-Cookie': values__default["default"](this.cookies),
239
239
  };
240
240
  }
241
241
  setHeader(key, value) {
@@ -435,7 +435,7 @@ class CommandLineRunner {
435
435
  }
436
436
  createDurationMetric() {
437
437
  if (!this.metrics) {
438
- return noop__default['default'];
438
+ return noop__default["default"];
439
439
  }
440
440
  // Мы должны только один раз создавать инстанс метрики
441
441
  if (!this.metricsInstance) {
@@ -608,14 +608,14 @@ class ActionChecker {
608
608
  const getParameters = (action) => action[core.ACTION_PARAMETERS];
609
609
  class ActionExecution {
610
610
  constructor({ actionConditionals, store, context, di, transformAction, }) {
611
- this.actionConditionals = flatten__default['default'](actionConditionals !== null && actionConditionals !== void 0 ? actionConditionals : []);
611
+ this.actionConditionals = flatten__default["default"](actionConditionals !== null && actionConditionals !== void 0 ? actionConditionals : []);
612
612
  this.context = context;
613
613
  this.di = di;
614
614
  this.execution = new Map();
615
- this.transformAction = transformAction || identity__default['default'];
615
+ this.transformAction = transformAction || identity__default["default"];
616
616
  const initialState = store.getState(actionTramvaiReducer);
617
617
  if (initialState && initialState.serverState) {
618
- objectMap__default['default']((value, key) => {
618
+ objectMap__default["default"]((value, key) => {
619
619
  this.execution.set(key, value);
620
620
  }, initialState.serverState);
621
621
  }
@@ -658,14 +658,14 @@ class ActionExecution {
658
658
  const GLOBAL_PARAMETER = '@@global';
659
659
  class ActionRegistry {
660
660
  constructor({ actionsList }) {
661
- this.actions = new Map([[GLOBAL_PARAMETER, flatten__default['default'](actionsList)]]);
661
+ this.actions = new Map([[GLOBAL_PARAMETER, flatten__default["default"](actionsList)]]);
662
662
  }
663
663
  add(type, actions) {
664
- const normalized = toArray__default['default'](actions);
665
- this.actions.set(type, uniq__default['default'](this.actions.has(type) ? [...this.actions.get(type), ...normalized] : normalized));
664
+ const normalized = toArray__default["default"](actions);
665
+ this.actions.set(type, uniq__default["default"](this.actions.has(type) ? [...this.actions.get(type), ...normalized] : normalized));
666
666
  }
667
667
  get(type, addingActions) {
668
- return uniq__default['default']([...(this.actions.get(type) || []), ...(addingActions || [])]);
668
+ return uniq__default["default"]([...(this.actions.get(type) || []), ...(addingActions || [])]);
669
669
  }
670
670
  getGlobal() {
671
671
  return this.actions.get(GLOBAL_PARAMETER);
@@ -675,9 +675,9 @@ class ActionRegistry {
675
675
  this.actions.delete(type);
676
676
  return;
677
677
  }
678
- const normalized = toArray__default['default'](actions);
678
+ const normalized = toArray__default["default"](actions);
679
679
  if (this.actions.has(type)) {
680
- this.actions.set(type, difference__default['default'](this.actions.get(type), normalized));
680
+ this.actions.set(type, difference__default["default"](this.actions.get(type), normalized));
681
681
  }
682
682
  }
683
683
  }
@@ -847,7 +847,7 @@ StateModule = tslib.__decorate([
847
847
  {
848
848
  provide: tokensCommon.DISPATCHER_TOKEN,
849
849
  scope: core.Scope.SINGLETON,
850
- useFactory: ({ stores }) => state.createDispatcher({ stores: stores && flatten__default['default'](stores) }),
850
+ useFactory: ({ stores }) => state.createDispatcher({ stores: stores && flatten__default["default"](stores) }),
851
851
  deps: {
852
852
  stores: {
853
853
  token: tokensCommon.COMBINE_REDUCERS,
@@ -860,7 +860,7 @@ StateModule = tslib.__decorate([
860
860
  scope: core.Scope.REQUEST,
861
861
  useFactory: ({ dispatcher, initialState, middlewares }) => dispatcher.createContext({}, initialState, [
862
862
  state.devTools.middleware(),
863
- ...flatten__default['default'](middlewares || []),
863
+ ...flatten__default["default"](middlewares || []),
864
864
  ]),
865
865
  deps: {
866
866
  dispatcher: tokensCommon.DISPATCHER_TOKEN,
@@ -885,9 +885,9 @@ StateModule = tslib.__decorate([
885
885
  ], StateModule);
886
886
 
887
887
  // @ts-ignore
888
- LRU__default['default'].prototype.clear = LRU__default['default'].prototype.reset;
888
+ LRU__default["default"].prototype.clear = LRU__default["default"].prototype.reset;
889
889
  const cacheFactory = (type, ...args) => {
890
- return new LRU__default['default'](...args);
890
+ return new LRU__default["default"](...args);
891
891
  };
892
892
 
893
893
  const papiClearCache = ({ clearCache, logger, }) => {
@@ -1006,7 +1006,7 @@ exports.CommonModule = tslib.__decorate([
1006
1006
  useFactory: ({ additionalBundleList, ...bundleManagerDeps }) => {
1007
1007
  var _a;
1008
1008
  (_a = additionalBundleList) === null || _a === void 0 ? void 0 : _a.forEach((bundles) => {
1009
- eachObj__default['default']((bundle, name) => {
1009
+ eachObj__default["default"]((bundle, name) => {
1010
1010
  const bundleAlreadyExists = name in bundleManagerDeps.bundleList;
1011
1011
  if (!bundleAlreadyExists) {
1012
1012
  // eslint-disable-next-line no-param-reassign
@@ -1044,17 +1044,13 @@ exports.CommonModule = tslib.__decorate([
1044
1044
 
1045
1045
  Object.defineProperty(exports, 'COOKIE_MANAGER_TOKEN', {
1046
1046
  enumerable: true,
1047
- get: function () {
1048
- return moduleCookie.COOKIE_MANAGER_TOKEN;
1049
- }
1047
+ get: function () { return moduleCookie.COOKIE_MANAGER_TOKEN; }
1050
1048
  });
1051
1049
  exports.ActionExecution = ActionExecution;
1052
1050
  exports.createConsumerContext = createConsumerContext;
1053
1051
  Object.keys(tokensCommon).forEach(function (k) {
1054
1052
  if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
1055
1053
  enumerable: true,
1056
- get: function () {
1057
- return tokensCommon[k];
1058
- }
1054
+ get: function () { return tokensCommon[k]; }
1059
1055
  });
1060
1056
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "1.8.5",
3
+ "version": "1.9.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -30,20 +30,20 @@
30
30
  "@tinkoff/errors": "0.2.18",
31
31
  "@tinkoff/pubsub": "0.4.22",
32
32
  "@tinkoff/url": "0.7.36",
33
- "@tramvai/module-cookie": "1.8.5",
34
- "@tramvai/module-environment": "1.8.5",
35
- "@tramvai/module-log": "1.8.5",
36
- "@tramvai/tokens-common": "1.8.5",
33
+ "@tramvai/module-cookie": "1.9.0",
34
+ "@tramvai/module-environment": "1.9.0",
35
+ "@tramvai/module-log": "1.9.0",
36
+ "@tramvai/tokens-common": "1.9.0",
37
37
  "@tinkoff/hook-runner": "0.3.20",
38
38
  "lru-cache": "^6.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@tinkoff/utils": "^2.1.2",
42
- "@tramvai/core": "1.8.5",
43
- "@tramvai/papi": "1.8.5",
44
- "@tramvai/state": "1.8.5",
45
- "@tramvai/tokens-metrics": "1.8.5",
46
- "@tramvai/tokens-server": "1.8.5",
42
+ "@tramvai/core": "1.9.0",
43
+ "@tramvai/papi": "1.9.0",
44
+ "@tramvai/state": "1.9.0",
45
+ "@tramvai/tokens-metrics": "1.9.0",
46
+ "@tramvai/tokens-server": "1.9.0",
47
47
  "@tinkoff/dippy": "0.7.35",
48
48
  "tslib": "^2.0.3"
49
49
  },