@tramvai/module-common 2.7.1 → 2.10.2

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.
package/lib/index.es.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import eachObj from '@tinkoff/utils/object/each';
3
- import { createBundle, Scope, Module, commandLineListTokens, COMMAND_LINE_RUNNER_TOKEN, COMMAND_LINES_TOKEN, DI_TOKEN, ACTION_PARAMETERS, ACTIONS_LIST_TOKEN, provide, IS_DI_CHILD_CONTAINER_TOKEN, BUNDLE_LIST_TOKEN } from '@tramvai/core';
3
+ import { createBundle, Scope, Module, commandLineListTokens, COMMAND_LINE_RUNNER_TOKEN, COMMAND_LINES_TOKEN, DI_TOKEN, isTramvaiAction, ACTION_PARAMETERS, ACTIONS_LIST_TOKEN, provide as provide$1, IS_DI_CHILD_CONTAINER_TOKEN, BUNDLE_LIST_TOKEN } from '@tramvai/core';
4
4
  import { EnvironmentModule } from '@tramvai/module-environment';
5
5
  import { CookieModule } from '@tramvai/module-cookie';
6
6
  export { COOKIE_MANAGER_TOKEN } from '@tramvai/module-cookie';
7
7
  import { LogModule } from '@tramvai/module-log';
8
8
  import { Hooks } from '@tinkoff/hook-runner';
9
- import { REQUEST_MANAGER_TOKEN, REQUEST, COMBINE_REDUCERS, CONTEXT_TOKEN, RESPONSE_MANAGER_TOKEN, RESPONSE, ACTION_EXECUTION_TOKEN, LOGGER_TOKEN, PUBSUB_FACTORY_TOKEN, PUBSUB_TOKEN, ROOT_PUBSUB_TOKEN, ACTION_REGISTRY_TOKEN, ACTION_CONDITIONALS, STORE_TOKEN, ACTION_PAGE_RUNNER_TOKEN, DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN, STORE_MIDDLEWARE, INITIAL_APP_STATE_TOKEN, CLEAR_CACHE_TOKEN, CREATE_CACHE_TOKEN, REGISTER_CLEAR_CACHE_TOKEN, HOOK_TOKEN, COMPONENT_REGISTRY_TOKEN, BUNDLE_MANAGER_TOKEN, ADDITIONAL_BUNDLE_TOKEN } from '@tramvai/tokens-common';
9
+ import { REQUEST_MANAGER_TOKEN, REQUEST, COMBINE_REDUCERS, CONTEXT_TOKEN, RESPONSE_MANAGER_TOKEN, RESPONSE, ACTION_EXECUTION_TOKEN, ROOT_EXECUTION_CONTEXT_TOKEN, LOGGER_TOKEN, EXECUTION_CONTEXT_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, PUBSUB_FACTORY_TOKEN, PUBSUB_TOKEN, ROOT_PUBSUB_TOKEN, ACTION_REGISTRY_TOKEN, ACTION_CONDITIONALS, STORE_TOKEN, ACTION_PAGE_RUNNER_TOKEN, DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN, STORE_MIDDLEWARE, INITIAL_APP_STATE_TOKEN, CLEAR_CACHE_TOKEN, CREATE_CACHE_TOKEN, REGISTER_CLEAR_CACHE_TOKEN, HOOK_TOKEN, COMPONENT_REGISTRY_TOKEN, BUNDLE_MANAGER_TOKEN, ADDITIONAL_BUNDLE_TOKEN } from '@tramvai/tokens-common';
10
10
  export * from '@tramvai/tokens-common';
11
11
  import { __lazyErrorHandler } from '@tramvai/react';
12
12
  import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponent } from '@tramvai/experiments';
@@ -18,9 +18,9 @@ import { format } from '@tinkoff/url';
18
18
  import isEmpty from '@tinkoff/utils/is/empty';
19
19
  import values from '@tinkoff/utils/object/values';
20
20
  import { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
21
- import { createChildContainer, Scope as Scope$1, createToken } from '@tinkoff/dippy';
21
+ import { createChildContainer, provide, Scope as Scope$1, createToken } from '@tinkoff/dippy';
22
22
  import noop from '@tinkoff/utils/function/noop';
23
- import { isSilentError } from '@tinkoff/errors';
23
+ import { isSilentError, ConditionFailError, ExecutionAbortError } from '@tinkoff/errors';
24
24
  import { PubSub } from '@tinkoff/pubsub';
25
25
  import identity from '@tinkoff/utils/function/identity';
26
26
  import objectMap from '@tinkoff/utils/object/map';
@@ -30,6 +30,7 @@ import toArray from '@tinkoff/utils/array/toArray';
30
30
  import LRU from '@tinkoff/lru-cache-nano';
31
31
  import { SERVER_MODULE_PAPI_PRIVATE_ROUTE } from '@tramvai/tokens-server';
32
32
  import { createPapiMethod } from '@tramvai/papi';
33
+ import { AbortController } from 'node-abort-controller';
33
34
  import { jsx } from 'react/jsx-runtime';
34
35
  import { EXTEND_RENDER } from '@tramvai/tokens-render';
35
36
  import { CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, commandLineListTokens as commandLineListTokens$1 } from '@tramvai/tokens-child-app';
@@ -375,14 +376,17 @@ const resolveDi = (type, status, diContainer, providers) => {
375
376
  return di;
376
377
  };
377
378
  class CommandLineRunner {
378
- constructor({ lines, rootDi, logger, metrics, }) {
379
+ constructor({ lines, rootDi, logger, metrics, executionContextManager, }) {
380
+ this.executionContextByDi = new WeakMap();
379
381
  this.lines = lines;
380
382
  this.rootDi = rootDi;
381
383
  this.log = logger('command:command-line-runner');
382
384
  this.metrics = metrics;
385
+ this.executionContextManager = executionContextManager;
383
386
  }
384
387
  run(type, status, providers, customDi) {
385
388
  const di = customDi !== null && customDi !== void 0 ? customDi : resolveDi(type, status, this.rootDi, providers);
389
+ const rootExecutionContext = di.get({ token: ROOT_EXECUTION_CONTEXT_TOKEN, optional: true });
386
390
  this.log.debug({
387
391
  event: 'command-run',
388
392
  type,
@@ -394,13 +398,25 @@ class CommandLineRunner {
394
398
  const doneMetric = this.createDurationMetric();
395
399
  // eslint-disable-next-line promise/no-nesting
396
400
  return Promise.resolve()
397
- .then(() => this.createLineChain(di, line))
401
+ .then(() => {
402
+ return this.executionContextManager.withContext(rootExecutionContext, `command-line:${line.toString()}`, async (executionContext) => {
403
+ this.executionContextByDi.set(di, executionContext);
404
+ await this.createLineChain(di, line);
405
+ });
406
+ })
398
407
  .finally(() => doneMetric({ line: line.toString() }));
399
408
  });
400
409
  }, Promise.resolve())
401
410
  // После завершения цепочки отдаем context выполнения
411
+ .finally(() => {
412
+ this.executionContextByDi.delete(di);
413
+ })
402
414
  .then(() => di));
403
415
  }
416
+ resolveExecutionContextFromDi(di) {
417
+ var _a;
418
+ return (_a = this.executionContextByDi.get(di)) !== null && _a !== void 0 ? _a : null;
419
+ }
404
420
  createLineChain(di, line) {
405
421
  let lineInstance;
406
422
  try {
@@ -511,7 +527,7 @@ let CommandModule = class CommandModule {
511
527
  CommandModule = __decorate([
512
528
  Module({
513
529
  providers: [
514
- {
530
+ provide({
515
531
  // Раннер процессов
516
532
  provide: COMMAND_LINE_RUNNER_TOKEN,
517
533
  scope: Scope$1.SINGLETON,
@@ -524,14 +540,27 @@ CommandModule = __decorate([
524
540
  token: METRICS_MODULE_TOKEN,
525
541
  optional: true,
526
542
  },
543
+ executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
527
544
  },
528
- },
529
- {
545
+ }),
546
+ provide({
547
+ provide: COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
548
+ useFactory: ({ di, commandLineRunner, }) => {
549
+ return () => {
550
+ return commandLineRunner.resolveExecutionContextFromDi(di);
551
+ };
552
+ },
553
+ deps: {
554
+ di: DI_TOKEN,
555
+ commandLineRunner: COMMAND_LINE_RUNNER_TOKEN,
556
+ },
557
+ }),
558
+ provide({
530
559
  // Дефолтный список команл
531
560
  provide: COMMAND_LINES_TOKEN,
532
561
  scope: Scope$1.SINGLETON,
533
562
  useValue: lines$1,
534
- },
563
+ }),
535
564
  ],
536
565
  })
537
566
  ], CommandModule);
@@ -583,14 +612,19 @@ const actionTramvaiReducer = createReducer('actionTramvai', initalState).on(acti
583
612
  serverState: payload,
584
613
  }));
585
614
 
615
+ /**
616
+ * @deprecated only for compatibility with legacy createAction
617
+ */
586
618
  const actionType = {
587
619
  global: 'global',
588
620
  local: 'local',
589
621
  };
590
622
 
623
+ const DEFAULT_CONDITIONS = {};
591
624
  class ActionChecker {
592
625
  // eslint-disable-next-line max-params
593
626
  constructor(globalConditionals, payload, parameters, executionState, type) {
627
+ var _a;
594
628
  this.globalConditionals = globalConditionals;
595
629
  this.payload = payload;
596
630
  this.parameters = parameters;
@@ -604,7 +638,7 @@ class ActionChecker {
604
638
  // если экшен был уже выполнен, то считаем, что его не нужно больше выполнять
605
639
  this.status = executionState.status !== 'success';
606
640
  }
607
- this.conditions = parameters.conditions;
641
+ this.conditions = (_a = parameters.conditions) !== null && _a !== void 0 ? _a : DEFAULT_CONDITIONS;
608
642
  }
609
643
  check() {
610
644
  this.globalConditionals.forEach((filter) => {
@@ -634,12 +668,16 @@ class ActionChecker {
634
668
  }
635
669
  }
636
670
 
671
+ const EMPTY_DEPS = {};
672
+ const DEFAULT_PAYLOAD = {};
637
673
  const getParameters = (action) => action[ACTION_PARAMETERS];
638
674
  class ActionExecution {
639
- constructor({ actionConditionals, store, context, di, transformAction, }) {
675
+ constructor({ store, context, di, executionContextManager, actionConditionals, transformAction, }) {
640
676
  this.actionConditionals = flatten(actionConditionals !== null && actionConditionals !== void 0 ? actionConditionals : []);
641
677
  this.context = context;
678
+ this.store = store;
642
679
  this.di = di;
680
+ this.executionContextManager = executionContextManager;
643
681
  this.execution = new Map();
644
682
  this.transformAction = transformAction || identity;
645
683
  const initialState = store.getState(actionTramvaiReducer);
@@ -649,32 +687,63 @@ class ActionExecution {
649
687
  }, initialState.serverState);
650
688
  }
651
689
  }
652
- run(action, payload, type = actionType.local) {
653
- // TODO выпилить после перевода всех экшенов к виду Action
654
- this.transformAction(action);
655
- const parameters = getParameters(action);
656
- const executionState = this.getExecutionState(parameters);
690
+ async runInContext(executionContext, action, ...params) {
691
+ var _a;
692
+ let parameters;
693
+ const payload = (_a = params[0]) !== null && _a !== void 0 ? _a : DEFAULT_PAYLOAD;
694
+ // TODO: replace type with pure context usage
695
+ const type = (executionContext === null || executionContext === void 0 ? void 0 : executionContext.values.pageActions) === true ? actionType.global : actionType.local;
696
+ // TODO: remove else branch after migration to new declareAction
697
+ if (isTramvaiAction(action)) {
698
+ parameters = action;
699
+ }
700
+ else {
701
+ this.transformAction(action);
702
+ parameters = getParameters(action);
703
+ }
704
+ const executionState = this.getExecutionState(parameters.name);
657
705
  if (!this.canExecuteAction(payload, parameters, executionState, type)) {
658
- return Promise.resolve();
706
+ switch (parameters.conditionsFailResult) {
707
+ case 'reject':
708
+ // TODO: pass condition that has failed
709
+ return Promise.reject(new ConditionFailError());
710
+ default:
711
+ return Promise.resolve();
712
+ }
659
713
  }
660
- const deps = parameters.deps ? this.di.getOfDeps(parameters.deps) : {};
661
714
  executionState.status = 'pending';
662
- return Promise.resolve()
663
- .then(() => action(this.context, payload, deps))
664
- .then((data) => {
665
- executionState.status = 'success';
666
- return data;
667
- })
668
- .catch((err) => {
669
- executionState.status = 'failed';
670
- throw err;
715
+ return this.executionContextManager.withContext(executionContext, {
716
+ name: parameters.name,
717
+ values: (executionContext === null || executionContext === void 0 ? void 0 : executionContext.values.pageActions) === true ? { pageActions: false } : undefined,
718
+ }, (executionActionContext) => {
719
+ const context = this.createActionContext(executionContext, executionActionContext, parameters);
720
+ return Promise.resolve()
721
+ .then(() => {
722
+ // TODO: do not execute action if context.abortSignal is aborted
723
+ if (isTramvaiAction(action)) {
724
+ return action.fn.apply(context, params);
725
+ }
726
+ return action(this.context, payload, context.deps);
727
+ })
728
+ .then((data) => {
729
+ executionState.status = 'success';
730
+ return data;
731
+ })
732
+ .catch((err) => {
733
+ executionState.status = 'failed';
734
+ throw err;
735
+ });
671
736
  });
672
737
  }
673
- getExecutionState(parameters) {
674
- let executionState = this.execution.get(parameters.name);
738
+ async run(action, ...params) {
739
+ return this.runInContext(null, action, ...params);
740
+ }
741
+ getExecutionState(name) {
742
+ let executionState = this.execution.get(name);
743
+ // TODO: probably do not need to create executionState on client as it is not used
675
744
  if (!executionState) {
676
745
  executionState = { status: 'pending', state: {} };
677
- this.execution.set(parameters.name, executionState);
746
+ this.execution.set(name, executionState);
678
747
  }
679
748
  return executionState;
680
749
  }
@@ -682,6 +751,16 @@ class ActionExecution {
682
751
  const actionChecker = new ActionChecker(this.actionConditionals, payload, parameters, executionState, type);
683
752
  return actionChecker.check();
684
753
  }
754
+ createActionContext(parentExecutionContext, actionExecutionContext, parameters) {
755
+ return {
756
+ abortSignal: actionExecutionContext === null || actionExecutionContext === void 0 ? void 0 : actionExecutionContext.abortSignal,
757
+ executeAction: this.runInContext.bind(this, actionExecutionContext),
758
+ deps: parameters.deps ? this.di.getOfDeps(parameters.deps) : EMPTY_DEPS,
759
+ actionType: (parentExecutionContext === null || parentExecutionContext === void 0 ? void 0 : parentExecutionContext.values.pageActions) ? 'page' : 'standalone',
760
+ dispatch: this.store.dispatch,
761
+ getState: this.store.getState,
762
+ };
763
+ }
685
764
  }
686
765
 
687
766
  const GLOBAL_PARAMETER = '@@global';
@@ -711,56 +790,59 @@ class ActionRegistry {
711
790
  }
712
791
  }
713
792
 
714
- const payload = {};
715
793
  class ActionPageRunner {
716
- constructor({ store, actionExecution, limitTime, logger }) {
717
- this.store = store;
718
- this.actionExecution = actionExecution;
719
- this.limitTime = limitTime;
720
- this.log = logger('action:action-page-runner');
794
+ constructor(deps) {
795
+ this.deps = deps;
796
+ this.log = deps.logger('action:action-page-runner');
721
797
  }
722
798
  // TODO stopRunAtError нужен только для редиректов на стороне сервера в экшенах. И нужно пересмотреть реализацию редиректов
723
799
  runActions(actions, stopRunAtError = () => false) {
724
- return new Promise((resolve, reject) => {
725
- const timeoutMarker = setTimeout(() => {
726
- this.log.warn(`page actions has exceeded timeout of ${this.limitTime}ms, ignore some results of execution`);
727
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
728
- endChecker();
729
- }, this.limitTime);
730
- const endChecker = () => {
731
- clearTimeout(timeoutMarker);
732
- const result = {};
733
- this.actionExecution.execution.forEach((value, key) => {
734
- // достаем значения экшенов, которые успешно выполнились, остальные выполнятся на клиенте
735
- if (value.status === 'success') {
736
- result[key] = value;
737
- }
738
- });
739
- this.syncStateActions(result);
740
- resolve();
741
- };
742
- const actionMapper = (action) => {
743
- return Promise.resolve()
744
- .then(() => this.actionExecution.run(action, payload, actionType.global))
745
- .catch((error) => {
746
- const parameters = action[ACTION_PARAMETERS];
747
- this.log.error({
748
- error,
749
- event: `action-execution-error`,
750
- message: `${parameters.name} execution error`,
800
+ return this.deps.executionContextManager.withContext(this.deps.commandLineExecutionContext(), { name: 'pageActions', values: { pageActions: true } }, (executionContext, abortController) => {
801
+ return new Promise((resolve, reject) => {
802
+ const timeoutMarker = setTimeout(() => {
803
+ this.log.warn(`page actions has exceeded timeout of ${this.deps.limitTime}ms, ignore some results of execution`);
804
+ abortController.abort();
805
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
806
+ endChecker();
807
+ }, this.deps.limitTime);
808
+ const endChecker = () => {
809
+ clearTimeout(timeoutMarker);
810
+ const result = {};
811
+ // TODO: dehydrate only actions on first level as inner actions are running on client despite their execution on server
812
+ this.deps.actionExecution.execution.forEach((value, key) => {
813
+ // достаем значения экшенов, которые успешно выполнились, остальные выполнятся на клиенте
814
+ if (value.status === 'success') {
815
+ result[key] = value;
816
+ }
751
817
  });
752
- if (stopRunAtError(error)) {
753
- clearTimeout(timeoutMarker);
754
- reject(error);
755
- }
756
- });
757
- };
758
- // eslint-disable-next-line promise/catch-or-return
759
- Promise.all(actions.map(actionMapper)).then(endChecker);
818
+ this.syncStateActions(result);
819
+ resolve();
820
+ };
821
+ const actionMapper = (action) => {
822
+ return Promise.resolve()
823
+ .then(() => this.deps.actionExecution.runInContext(executionContext, action))
824
+ .catch((error) => {
825
+ if (!isSilentError(error)) {
826
+ const parameters = isTramvaiAction(action) ? action : action[ACTION_PARAMETERS];
827
+ this.log.error({
828
+ error,
829
+ event: `action-execution-error`,
830
+ message: `${parameters.name} execution error`,
831
+ });
832
+ }
833
+ if (stopRunAtError(error)) {
834
+ clearTimeout(timeoutMarker);
835
+ reject(error);
836
+ }
837
+ });
838
+ };
839
+ // eslint-disable-next-line promise/catch-or-return
840
+ Promise.all(actions.map(actionMapper)).then(endChecker);
841
+ });
760
842
  });
761
843
  }
762
844
  syncStateActions(success) {
763
- return this.store.dispatch(actionServerStateEvent(success));
845
+ return this.deps.store.dispatch(actionServerStateEvent(success));
764
846
  }
765
847
  }
766
848
 
@@ -829,7 +911,7 @@ ActionModule = __decorate([
829
911
  useClass: ActionRegistry,
830
912
  deps: { actionsList: ACTIONS_LIST_TOKEN },
831
913
  },
832
- provide({
914
+ provide$1({
833
915
  provide: ACTION_EXECUTION_TOKEN,
834
916
  scope: Scope.REQUEST,
835
917
  useClass: ActionExecution,
@@ -838,23 +920,26 @@ ActionModule = __decorate([
838
920
  context: CONTEXT_TOKEN,
839
921
  store: STORE_TOKEN,
840
922
  di: DI_TOKEN,
923
+ executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
841
924
  transformAction: {
842
925
  token: 'actionTransformAction',
843
926
  optional: true,
844
927
  },
845
928
  },
846
929
  }),
847
- {
930
+ provide$1({
848
931
  provide: ACTION_PAGE_RUNNER_TOKEN,
849
932
  scope: Scope.REQUEST,
850
933
  useClass: ActionPageRunner,
851
934
  deps: {
852
935
  actionExecution: ACTION_EXECUTION_TOKEN,
936
+ executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
937
+ commandLineExecutionContext: COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
853
938
  store: STORE_TOKEN,
854
939
  limitTime: 'limitActionGlobalTimeRun',
855
940
  logger: LOGGER_TOKEN,
856
941
  },
857
- },
942
+ }),
858
943
  {
859
944
  provide: 'limitActionGlobalTimeRun',
860
945
  useValue: 500,
@@ -996,6 +1081,58 @@ CacheModule = __decorate([
996
1081
  })
997
1082
  ], CacheModule);
998
1083
 
1084
+ const EMPTY_VALUES = {};
1085
+ const normalizeOptions = (nameOrOptions) => {
1086
+ return typeof nameOrOptions === 'string' ? { name: nameOrOptions } : nameOrOptions;
1087
+ };
1088
+ class ExecutionContextManager {
1089
+ async withContext(parentContext, nameOrOptions, cb) {
1090
+ const options = normalizeOptions(nameOrOptions);
1091
+ const { name, values: selfValues = EMPTY_VALUES } = options;
1092
+ const contextName = parentContext ? `${parentContext.name}.${name}` : name;
1093
+ if (parentContext === null || parentContext === void 0 ? void 0 : parentContext.abortSignal.aborted) {
1094
+ throw new ExecutionAbortError({
1095
+ message: `Execution aborted in context "${contextName}"`,
1096
+ contextName,
1097
+ });
1098
+ }
1099
+ const abortController = new AbortController();
1100
+ let abortListener;
1101
+ let values = selfValues;
1102
+ if (parentContext) {
1103
+ values = {
1104
+ ...parentContext.values,
1105
+ ...selfValues,
1106
+ };
1107
+ abortListener = () => {
1108
+ abortController.abort();
1109
+ };
1110
+ // abort child context AbortController if parent AbortController was aborted
1111
+ parentContext.abortSignal.addEventListener('abort', abortListener);
1112
+ }
1113
+ const context = {
1114
+ name: contextName,
1115
+ abortSignal: abortController.signal,
1116
+ values,
1117
+ };
1118
+ try {
1119
+ const result = await cb(context, abortController);
1120
+ return result;
1121
+ }
1122
+ catch (error) {
1123
+ if (!error.executionContextName) {
1124
+ error.executionContextName = context.name;
1125
+ }
1126
+ throw error;
1127
+ }
1128
+ finally {
1129
+ if (abortListener) {
1130
+ parentContext.abortSignal.removeEventListener('abort', abortListener);
1131
+ }
1132
+ }
1133
+ }
1134
+ }
1135
+
999
1136
  let CommonModule = class CommonModule {
1000
1137
  };
1001
1138
  CommonModule = __decorate([
@@ -1013,13 +1150,13 @@ CommonModule = __decorate([
1013
1150
  CacheModule,
1014
1151
  ],
1015
1152
  providers: [
1016
- provide({
1153
+ provide$1({
1017
1154
  // Инстанс хук системы
1018
1155
  provide: HOOK_TOKEN,
1019
1156
  scope: Scope.SINGLETON,
1020
1157
  useClass: Hooks,
1021
1158
  }),
1022
- provide({
1159
+ provide$1({
1023
1160
  // Регистр ui компонентов
1024
1161
  provide: COMPONENT_REGISTRY_TOKEN,
1025
1162
  scope: Scope.SINGLETON,
@@ -1028,7 +1165,7 @@ CommonModule = __decorate([
1028
1165
  componentList: { token: 'componentDefaultList', optional: true },
1029
1166
  },
1030
1167
  }),
1031
- provide({
1168
+ provide$1({
1032
1169
  // Управление бандлами, хранение и получение
1033
1170
  provide: BUNDLE_MANAGER_TOKEN,
1034
1171
  scope: Scope.SINGLETON,
@@ -1054,7 +1191,7 @@ CommonModule = __decorate([
1054
1191
  logger: LOGGER_TOKEN,
1055
1192
  },
1056
1193
  }),
1057
- provide({
1194
+ provide$1({
1058
1195
  // Клиентский контекст исполнения
1059
1196
  provide: CONTEXT_TOKEN,
1060
1197
  scope: Scope.REQUEST,
@@ -1066,6 +1203,10 @@ CommonModule = __decorate([
1066
1203
  store: STORE_TOKEN,
1067
1204
  },
1068
1205
  }),
1206
+ provide$1({
1207
+ provide: EXECUTION_CONTEXT_MANAGER_TOKEN,
1208
+ useClass: ExecutionContextManager,
1209
+ }),
1069
1210
  ...providers$2,
1070
1211
  ],
1071
1212
  })
@@ -1074,7 +1215,7 @@ CommonModule = __decorate([
1074
1215
  const providers = [];
1075
1216
 
1076
1217
  const stateProviders = [
1077
- provide({
1218
+ provide$1({
1078
1219
  provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1079
1220
  multi: true,
1080
1221
  useValue: [DISPATCHER_TOKEN, STORE_TOKEN, CONTEXT_TOKEN],
@@ -1100,12 +1241,12 @@ const lines = {
1100
1241
  client: command,
1101
1242
  };
1102
1243
  const commandProviders = [
1103
- provide({
1244
+ provide$1({
1104
1245
  provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1105
1246
  multi: true,
1106
1247
  useValue: COMMAND_LINE_RUNNER_TOKEN,
1107
1248
  }),
1108
- provide({
1249
+ provide$1({
1109
1250
  provide: COMMAND_LINES_TOKEN,
1110
1251
  scope: Scope.SINGLETON,
1111
1252
  useValue: lines,
@@ -1113,7 +1254,7 @@ const commandProviders = [
1113
1254
  ];
1114
1255
 
1115
1256
  const actionsProviders = [
1116
- provide({
1257
+ provide$1({
1117
1258
  provide: CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN,
1118
1259
  multi: true,
1119
1260
  useValue: [ACTION_EXECUTION_TOKEN, ACTION_PAGE_RUNNER_TOKEN],
@@ -1134,7 +1275,7 @@ CommonChildAppModule = __decorate([
1134
1275
  ...stateProviders,
1135
1276
  ...commandProviders,
1136
1277
  ...actionsProviders,
1137
- provide({
1278
+ provide$1({
1138
1279
  provide: EXTEND_RENDER,
1139
1280
  multi: true,
1140
1281
  useFactory: ({ context }) => {
@@ -1151,4 +1292,4 @@ CommonChildAppModule = __decorate([
1151
1292
  })
1152
1293
  ], CommonChildAppModule);
1153
1294
 
1154
- export { ActionExecution, CommandModule, CommonChildAppModule, CommonModule, alwaysCondition, createConsumerContext, onlyBrowser, onlyServer, pageBrowser, pageServer };
1295
+ export { ActionExecution, CommandModule, CommonChildAppModule, CommonModule, ExecutionContextManager, alwaysCondition, createConsumerContext, onlyBrowser, onlyServer, pageBrowser, pageServer };