@tramvai/module-common 2.35.0 → 2.37.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,6 +1,5 @@
1
- import type { Action, TramvaiAction } from '@tramvai/core';
2
- import type { LOGGER_TOKEN, ActionPageRunner as ActionPageRunnerInterface, STORE_TOKEN, EXECUTION_CONTEXT_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN } from '@tramvai/tokens-common';
3
- import type { ActionExecution } from './actionExecution';
1
+ import type { Action, ExtractDependencyType, TramvaiAction } from '@tramvai/core';
2
+ import type { LOGGER_TOKEN, ActionPageRunner as ActionPageRunnerInterface, STORE_TOKEN, EXECUTION_CONTEXT_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, ACTION_EXECUTION_TOKEN } from '@tramvai/tokens-common';
4
3
  declare module '@tramvai/tokens-common' {
5
4
  interface ExecutionContextValues {
6
5
  pageActions?: boolean;
@@ -10,12 +9,12 @@ export declare class ActionPageRunner implements ActionPageRunnerInterface {
10
9
  private deps;
11
10
  private log;
12
11
  constructor(deps: {
13
- store: typeof STORE_TOKEN;
14
- actionExecution: ActionExecution;
15
- executionContextManager: typeof EXECUTION_CONTEXT_MANAGER_TOKEN;
16
- commandLineExecutionContext: typeof COMMAND_LINE_EXECUTION_CONTEXT_TOKEN;
12
+ store: ExtractDependencyType<typeof STORE_TOKEN>;
13
+ actionExecution: ExtractDependencyType<typeof ACTION_EXECUTION_TOKEN>;
14
+ executionContextManager: ExtractDependencyType<typeof EXECUTION_CONTEXT_MANAGER_TOKEN>;
15
+ commandLineExecutionContext: ExtractDependencyType<typeof COMMAND_LINE_EXECUTION_CONTEXT_TOKEN>;
17
16
  limitTime: number;
18
- logger: typeof LOGGER_TOKEN;
17
+ logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
19
18
  });
20
19
  runActions(actions: Array<Action | TramvaiAction<any[], any, any>>, stopRunAtError?: (error: Error) => boolean): Promise<void>;
21
20
  private syncStateActions;
@@ -8,6 +8,6 @@ export declare class ActionRegistry implements Interface {
8
8
  });
9
9
  add(type: string, actions: Action | Action[]): void;
10
10
  get(type: string, addingActions?: Action[]): Action[];
11
- getGlobal(): Action[];
11
+ getGlobal(): Action[] | undefined;
12
12
  remove(type: string, actions?: Action | Action[]): void;
13
13
  }
@@ -1,22 +1,23 @@
1
- import type { BUNDLE_MANAGER_TOKEN, DISPATCHER_TOKEN, ActionsRegistry } from '@tramvai/tokens-common';
2
- import type { Bundle } from '@tramvai/core';
1
+ import type { BUNDLE_MANAGER_TOKEN, DISPATCHER_TOKEN, ActionsRegistry, LOGGER_TOKEN } from '@tramvai/tokens-common';
2
+ import type { Bundle, ExtractDependencyType } from '@tramvai/core';
3
3
  import type { ComponentRegistry } from '../componentRegistry/componentRegistry';
4
4
  declare type Interface = typeof BUNDLE_MANAGER_TOKEN;
5
- export declare class BundleManager implements Interface {
6
- bundles: Record<string, () => Promise<{
5
+ declare type Deps = {
6
+ bundleList: Record<string, () => Promise<{
7
7
  default: Bundle;
8
8
  }>>;
9
- actionRegistry: ActionsRegistry;
10
9
  componentRegistry: ComponentRegistry;
11
- dispatcher: typeof DISPATCHER_TOKEN;
12
- constructor({ bundleList, componentRegistry, actionRegistry, dispatcher, logger }: {
13
- bundleList: any;
14
- componentRegistry: any;
15
- actionRegistry: any;
16
- dispatcher: any;
17
- logger: any;
18
- });
19
- get(name: string, pageComponent: string): Promise<Bundle>;
10
+ actionRegistry: ActionsRegistry;
11
+ dispatcher: ExtractDependencyType<typeof DISPATCHER_TOKEN>;
12
+ logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
13
+ };
14
+ export declare class BundleManager implements Interface {
15
+ bundles: Deps['bundleList'];
16
+ actionRegistry: Deps['actionRegistry'];
17
+ componentRegistry: Deps['componentRegistry'];
18
+ dispatcher: Deps['dispatcher'];
19
+ constructor({ bundleList, componentRegistry, actionRegistry, dispatcher, logger }: Deps);
20
+ get(name: string, pageComponent: string): Promise<Bundle | undefined>;
20
21
  has(name: string, pageComponent: string): boolean;
21
22
  private resolve;
22
23
  private loadBundle;
@@ -1,23 +1,24 @@
1
1
  import type { CommandLineDescription, CommandLine, CommandLines } from '@tramvai/core';
2
2
  import type { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
3
- import type { Container, Provider } from '@tinkoff/dippy';
3
+ import type { Container, ExtractDependencyType, Provider } from '@tinkoff/dippy';
4
4
  import type { ExecutionContext, EXECUTION_CONTEXT_MANAGER_TOKEN, LOGGER_TOKEN } from '@tramvai/tokens-common';
5
- export declare class CommandLineRunner implements CommandLine {
5
+ declare type Deps = {
6
6
  lines: CommandLines;
7
7
  rootDi: Container;
8
- log: ReturnType<typeof LOGGER_TOKEN>;
9
- metrics: typeof METRICS_MODULE_TOKEN;
10
- executionContextManager: typeof EXECUTION_CONTEXT_MANAGER_TOKEN;
8
+ logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
9
+ metrics: ExtractDependencyType<typeof METRICS_MODULE_TOKEN> | null;
10
+ executionContextManager: ExtractDependencyType<typeof EXECUTION_CONTEXT_MANAGER_TOKEN>;
11
+ };
12
+ export declare class CommandLineRunner implements CommandLine {
13
+ lines: Deps['lines'];
14
+ rootDi: Deps['rootDi'];
15
+ log: ReturnType<Deps['logger']>;
16
+ metrics: Deps['metrics'];
17
+ executionContextManager: Deps['executionContextManager'];
11
18
  private metricsInstance;
12
19
  private executionContextByDi;
13
20
  private abortControllerByDi;
14
- constructor({ lines, rootDi, logger, metrics, executionContextManager, }: {
15
- lines: CommandLines;
16
- rootDi: Container;
17
- logger: typeof LOGGER_TOKEN;
18
- metrics?: typeof METRICS_MODULE_TOKEN;
19
- executionContextManager: typeof EXECUTION_CONTEXT_MANAGER_TOKEN;
20
- });
21
+ constructor({ lines, rootDi, logger, metrics, executionContextManager }: Deps);
21
22
  run(type: keyof CommandLines, status: keyof CommandLineDescription, providers?: Provider[], customDi?: Container): Promise<Container>;
22
23
  resolveExecutionContextFromDi(di: Container): ExecutionContext | null;
23
24
  private createLineChain;
@@ -25,3 +26,4 @@ export declare class CommandLineRunner implements CommandLine {
25
26
  private createDurationMetric;
26
27
  private throwError;
27
28
  }
29
+ export {};
@@ -1,16 +1,22 @@
1
- import type { Container } from '@tinkoff/dippy';
1
+ import type { Container, ExtractDependencyType } from '@tinkoff/dippy';
2
2
  import type { Event, Reducer } from '@tramvai/state';
3
3
  import type { Action, TramvaiAction } from '@tramvai/core';
4
- import type { PUBSUB_TOKEN, CONTEXT_TOKEN } from '@tramvai/tokens-common';
4
+ import type { STORE_TOKEN, PUBSUB_TOKEN, CONTEXT_TOKEN, DISPATCHER_CONTEXT_TOKEN } from '@tramvai/tokens-common';
5
5
  import type { PlatformAction } from './typings';
6
6
  declare type ContextType = typeof CONTEXT_TOKEN;
7
- export declare class ConsumerContext implements ContextType {
7
+ declare type Deps = {
8
8
  di: Container;
9
- pubsub: typeof PUBSUB_TOKEN;
9
+ dispatcherContext: ExtractDependencyType<typeof DISPATCHER_CONTEXT_TOKEN>;
10
+ pubsub: ExtractDependencyType<typeof PUBSUB_TOKEN>;
11
+ store: ExtractDependencyType<typeof STORE_TOKEN>;
12
+ };
13
+ export declare class ConsumerContext implements ContextType {
14
+ di: Deps['di'];
15
+ pubsub: Deps['pubsub'];
10
16
  private dispatcher;
11
17
  private store;
12
18
  executeAction: (action: PlatformAction<any, any> | Action<any, any, any> | TramvaiAction<any[], any, any>, payload?: any) => Promise<any>;
13
- dispatch: <Payload>(actionOrNameEvent: string | Event<Payload>, payload?: Payload) => Promise<Payload>;
19
+ dispatch: <Payload>(actionOrNameEvent: string | Event<Payload>, payload?: Payload | undefined) => Promise<Payload>;
14
20
  dispatchWith: (createActionOrType: (...args: unknown[]) => Event | Event, options?: any) => (...args: unknown[]) => Promise<any>;
15
21
  /**
16
22
  * @deprecated
@@ -26,17 +32,7 @@ export declare class ConsumerContext implements ContextType {
26
32
  hasStore: (store: Reducer<any>) => boolean;
27
33
  registerStore: (store: Reducer<any>) => void;
28
34
  unregisterStore: (store: Reducer<any>) => void;
29
- constructor({ di, dispatcherContext, pubsub, store }: {
30
- di: any;
31
- dispatcherContext: any;
32
- pubsub: any;
33
- store: any;
34
- });
35
+ constructor({ di, dispatcherContext, pubsub, store }: Deps);
35
36
  }
36
- export declare function createConsumerContext({ di, dispatcherContext, pubsub, store }: {
37
- di: any;
38
- dispatcherContext: any;
39
- pubsub: any;
40
- store: any;
41
- }): ContextType;
37
+ export declare function createConsumerContext({ di, dispatcherContext, pubsub, store }: Deps): ContextType;
42
38
  export {};
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import eachObj from '@tinkoff/utils/object/each';
3
- import { createBundle, Scope, Module, provide, commandLineListTokens, COMMAND_LINE_RUNNER_TOKEN, COMMAND_LINES_TOKEN, DI_TOKEN, isTramvaiAction, ACTION_PARAMETERS, ACTIONS_LIST_TOKEN, IS_DI_CHILD_CONTAINER_TOKEN, BUNDLE_LIST_TOKEN } from '@tramvai/core';
3
+ import { createBundle, provide, Scope, Module, commandLineListTokens, COMMAND_LINE_RUNNER_TOKEN, COMMAND_LINES_TOKEN, DI_TOKEN, isTramvaiAction, ACTION_PARAMETERS, createToken, ACTIONS_LIST_TOKEN, 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';
@@ -8,6 +8,8 @@ import { LogModule } from '@tramvai/module-log';
8
8
  import { Hooks } from '@tinkoff/hook-runner';
9
9
  import { REQUEST_MANAGER_TOKEN, COMBINE_REDUCERS, STORE_TOKEN, RESPONSE_MANAGER_TOKEN, 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, INITIAL_APP_STATE_TOKEN, ACTION_REGISTRY_TOKEN, ACTION_CONDITIONALS, CONTEXT_TOKEN, ACTION_PAGE_RUNNER_TOKEN, DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN, STORE_MIDDLEWARE, CREATE_CACHE_TOKEN, CLEAR_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
+ import isObject from '@tinkoff/utils/is/object';
12
+ import isArray from '@tinkoff/utils/is/array';
11
13
  import { resolveLazyComponent, __lazyErrorHandler } from '@tramvai/react';
12
14
  import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponent } from '@tramvai/experiments';
13
15
  import pathOr from '@tinkoff/utils/object/pathOr';
@@ -18,7 +20,7 @@ import { format, parse } from '@tinkoff/url';
18
20
  import isEmpty from '@tinkoff/utils/is/empty';
19
21
  import values from '@tinkoff/utils/object/values';
20
22
  import { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
21
- import { createChildContainer, provide as provide$1, Scope as Scope$1, createToken } from '@tinkoff/dippy';
23
+ import { createChildContainer, provide as provide$1, Scope as Scope$1, createToken as createToken$1 } from '@tinkoff/dippy';
22
24
  import noop from '@tinkoff/utils/function/noop';
23
25
  import { isSilentError, ConditionFailError, ExecutionAbortError } from '@tinkoff/errors';
24
26
  import { PubSub } from '@tinkoff/pubsub';
@@ -77,16 +79,19 @@ class BundleManager {
77
79
  if (pageComponent && bundle.components[pageComponent]) {
78
80
  const componentOrLoader = bundle.components[pageComponent];
79
81
  const component = await resolveLazyComponent(componentOrLoader);
82
+ if (!component) {
83
+ return;
84
+ }
80
85
  // allow page components to register any other components
81
- if ('components' in component) {
86
+ if ('components' in component && isObject(component.components)) {
82
87
  eachObj((cmp, name) => {
83
88
  this.componentRegistry.add(name, cmp, pageComponent);
84
89
  }, component.components);
85
90
  }
86
- if ('actions' in component) {
91
+ if ('actions' in component && isArray(component.actions)) {
87
92
  this.actionRegistry.add(pageComponent, component.actions);
88
93
  }
89
- if ('reducers' in component) {
94
+ if ('reducers' in component && isArray(component.reducers)) {
90
95
  component.reducers.forEach((reducer) => {
91
96
  this.dispatcher.registerStore(reducer);
92
97
  });
@@ -194,19 +199,19 @@ class RequestManager {
194
199
  }
195
200
 
196
201
  const sharedProviders$1 = [
197
- {
202
+ provide({
198
203
  provide: REQUEST_MANAGER_TOKEN,
199
204
  scope: Scope.REQUEST,
200
205
  useClass: RequestManager,
201
206
  deps: {
202
207
  request: FASTIFY_REQUEST,
203
208
  },
204
- },
205
- {
209
+ }),
210
+ provide({
206
211
  provide: COMBINE_REDUCERS,
207
212
  multi: true,
208
213
  useValue: RequestManagerStore,
209
- },
214
+ }),
210
215
  ];
211
216
 
212
217
  let RequestManagerModule = class RequestManagerModule {
@@ -288,11 +293,11 @@ class ResponseManager {
288
293
  }
289
294
 
290
295
  const sharedProviders = [
291
- {
296
+ provide({
292
297
  provide: RESPONSE_MANAGER_TOKEN,
293
298
  scope: Scope.REQUEST,
294
299
  useClass: ResponseManager,
295
- },
300
+ }),
296
301
  ];
297
302
 
298
303
  let ResponseManagerModule = class ResponseManagerModule {
@@ -301,10 +306,11 @@ ResponseManagerModule = __decorate([
301
306
  Module({
302
307
  providers: [
303
308
  ...sharedProviders,
304
- {
309
+ provide({
305
310
  provide: FASTIFY_RESPONSE,
311
+ // @ts-expect-error
306
312
  useValue: {},
307
- },
313
+ }),
308
314
  ],
309
315
  })
310
316
  ], ResponseManagerModule);
@@ -340,8 +346,8 @@ class ConsumerContext {
340
346
  this.dehydrate = () => ({
341
347
  dispatcher: this.dispatcher.dehydrate(),
342
348
  });
343
- this.getState = (reducer) => {
344
- return this.store.getState(reducer);
349
+ this.getState = (...args) => {
350
+ return this.store.getState(args[0]);
345
351
  };
346
352
  this.subscribe = (...args) => {
347
353
  return this.store.subscribe(args[0], args[1]);
@@ -350,6 +356,7 @@ class ConsumerContext {
350
356
  this.registerStore = (store) => this.dispatcher.registerStore(store);
351
357
  this.unregisterStore = (store) => this.dispatcher.unregisterStore(store);
352
358
  this.store = store;
359
+ // @ts-expect-error
353
360
  this.dispatcher = dispatcherContext;
354
361
  // TODO убрать, нужно для некоторых старых сторов на платформе
355
362
  this.dispatcher.setContext(this);
@@ -380,7 +387,7 @@ const resolveDi = (type, status, diContainer, providers) => {
380
387
  return di;
381
388
  };
382
389
  class CommandLineRunner {
383
- constructor({ lines, rootDi, logger, metrics, executionContextManager, }) {
390
+ constructor({ lines, rootDi, logger, metrics, executionContextManager }) {
384
391
  this.executionContextByDi = new WeakMap();
385
392
  this.abortControllerByDi = new WeakMap();
386
393
  this.lines = lines;
@@ -455,6 +462,7 @@ class CommandLineRunner {
455
462
  // пробегаемся по всем инстансам и для текущего получаем его запись, из которой можно получить стек
456
463
  for (let i = 0; i < instances.length; i++) {
457
464
  if (instances[i] === instance) {
465
+ // @ts-expect-error
458
466
  error.stack = `${error.stack}\n---- caused by: ----\n${record.multi[i].stack || ''}`;
459
467
  }
460
468
  }
@@ -555,7 +563,7 @@ CommandModule = __decorate([
555
563
  }),
556
564
  provide$1({
557
565
  provide: COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
558
- useFactory: ({ di, commandLineRunner, }) => {
566
+ useFactory: ({ di, commandLineRunner }) => {
559
567
  return () => {
560
568
  return commandLineRunner.resolveExecutionContextFromDi(di);
561
569
  };
@@ -580,7 +588,7 @@ let PubSubModule = class PubSubModule {
580
588
  PubSubModule = __decorate([
581
589
  Module({
582
590
  providers: [
583
- {
591
+ provide({
584
592
  // Фабрика для создания pubsub
585
593
  provide: PUBSUB_FACTORY_TOKEN,
586
594
  scope: Scope.SINGLETON,
@@ -592,34 +600,35 @@ PubSubModule = __decorate([
592
600
  deps: {
593
601
  logger: LOGGER_TOKEN,
594
602
  },
595
- },
596
- {
603
+ }),
604
+ provide({
597
605
  provide: PUBSUB_TOKEN,
598
606
  scope: Scope.REQUEST,
599
607
  useFactory: ({ createPubsub }) => createPubsub(),
600
608
  deps: {
601
609
  createPubsub: PUBSUB_FACTORY_TOKEN,
602
610
  },
603
- },
604
- {
611
+ }),
612
+ provide({
605
613
  provide: ROOT_PUBSUB_TOKEN,
606
614
  scope: Scope.SINGLETON,
607
615
  useFactory: ({ createPubsub }) => createPubsub(),
608
616
  deps: {
609
617
  createPubsub: PUBSUB_FACTORY_TOKEN,
610
618
  },
611
- },
619
+ }),
612
620
  ],
613
621
  })
614
622
  ], PubSubModule);
615
623
 
616
624
  const providers$2 = [
617
- {
625
+ provide({
618
626
  provide: INITIAL_APP_STATE_TOKEN,
627
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
619
628
  useFactory: () => JSON.parse(document.getElementById('__TRAMVAI_STATE__').textContent),
620
629
  scope: Scope.REQUEST,
621
- },
622
- {
630
+ }),
631
+ provide({
623
632
  provide: commandLineListTokens.listen,
624
633
  useFactory: ({ commandLineRunner, }) => {
625
634
  return function initClientCommand() {
@@ -628,7 +637,7 @@ const providers$2 = [
628
637
  },
629
638
  deps: { commandLineRunner: COMMAND_LINE_RUNNER_TOKEN },
630
639
  multi: true,
631
- },
640
+ }),
632
641
  ];
633
642
 
634
643
  const actionServerStateEvent = createEvent('action state execution in server');
@@ -896,23 +905,24 @@ const pageBrowser = {
896
905
  },
897
906
  };
898
907
 
908
+ const LIMIT_ACTION_GLOBAL_TIME_RUN = createToken('limitActionGlobalTimeRun');
899
909
  let ActionModule = class ActionModule {
900
910
  };
901
911
  ActionModule = __decorate([
902
912
  Module({
903
913
  providers: [
904
- {
914
+ provide({
905
915
  provide: COMBINE_REDUCERS,
906
916
  multi: true,
907
917
  useValue: actionTramvaiReducer,
908
- },
909
- {
918
+ }),
919
+ provide({
910
920
  // Регистер глобальных экшенов
911
921
  provide: ACTION_REGISTRY_TOKEN,
912
922
  scope: Scope.SINGLETON,
913
923
  useClass: ActionRegistry,
914
924
  deps: { actionsList: ACTIONS_LIST_TOKEN },
915
- },
925
+ }),
916
926
  provide({
917
927
  provide: ACTION_EXECUTION_TOKEN,
918
928
  scope: Scope.REQUEST,
@@ -938,19 +948,19 @@ ActionModule = __decorate([
938
948
  executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
939
949
  commandLineExecutionContext: COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
940
950
  store: STORE_TOKEN,
941
- limitTime: 'limitActionGlobalTimeRun',
951
+ limitTime: LIMIT_ACTION_GLOBAL_TIME_RUN,
942
952
  logger: LOGGER_TOKEN,
943
953
  },
944
954
  }),
945
- {
946
- provide: 'limitActionGlobalTimeRun',
955
+ provide({
956
+ provide: LIMIT_ACTION_GLOBAL_TIME_RUN,
947
957
  useValue: 500,
948
- },
949
- {
958
+ }),
959
+ provide({
950
960
  provide: ACTION_CONDITIONALS,
951
961
  multi: true,
952
962
  useValue: [alwaysCondition, onlyServer, onlyBrowser, pageServer, pageBrowser],
953
- },
963
+ }),
954
964
  ],
955
965
  })
956
966
  ], ActionModule);
@@ -960,7 +970,7 @@ let StateModule = class StateModule {
960
970
  StateModule = __decorate([
961
971
  Module({
962
972
  providers: [
963
- {
973
+ provide({
964
974
  provide: DISPATCHER_TOKEN,
965
975
  scope: Scope.SINGLETON,
966
976
  useFactory: ({ stores }) => createDispatcher({ stores: stores && flatten(stores) }),
@@ -970,8 +980,8 @@ StateModule = __decorate([
970
980
  optional: true,
971
981
  },
972
982
  },
973
- },
974
- {
983
+ }),
984
+ provide({
975
985
  provide: DISPATCHER_CONTEXT_TOKEN,
976
986
  scope: Scope.REQUEST,
977
987
  useFactory: ({ dispatcher, initialState, middlewares }) => {
@@ -985,19 +995,19 @@ StateModule = __decorate([
985
995
  middlewares: { token: STORE_MIDDLEWARE, optional: true },
986
996
  initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
987
997
  },
988
- },
989
- {
998
+ }),
999
+ provide({
990
1000
  provide: STORE_TOKEN,
991
1001
  scope: Scope.REQUEST,
992
1002
  useFactory: ({ dispatcherContext }) => ({
993
- getState: (reducer) => dispatcherContext.getState(reducer),
994
- dispatch: (action) => dispatcherContext.dispatch(action),
995
- subscribe: (reducer, callback) => dispatcherContext.subscribe(reducer, callback),
1003
+ getState: dispatcherContext.getState.bind(dispatcherContext),
1004
+ dispatch: dispatcherContext.dispatch.bind(dispatcherContext),
1005
+ subscribe: dispatcherContext.subscribe.bind(dispatcherContext),
996
1006
  }),
997
1007
  deps: {
998
1008
  dispatcherContext: DISPATCHER_CONTEXT_TOKEN,
999
1009
  },
1000
- },
1010
+ }),
1001
1011
  ],
1002
1012
  })
1003
1013
  ], StateModule);
@@ -1008,7 +1018,7 @@ const cacheFactory = (type, options = { max: 100 }) => {
1008
1018
 
1009
1019
  const providers$1 = [];
1010
1020
 
1011
- const cachesToken = createToken('_cachesList');
1021
+ const cachesToken = createToken$1('_cachesList');
1012
1022
  let CacheModule = class CacheModule {
1013
1023
  };
1014
1024
  CacheModule = __decorate([
@@ -1103,7 +1113,8 @@ class ExecutionContextManager {
1103
1113
  throw error;
1104
1114
  }
1105
1115
  finally {
1106
- if (abortListener) {
1116
+ // @ts-expect-error
1117
+ if (abortListener && parentContext) {
1107
1118
  parentContext.abortSignal.removeEventListener('abort', abortListener);
1108
1119
  }
1109
1120
  }
@@ -1246,11 +1257,11 @@ const actionsProviders = [
1246
1257
  multi: true,
1247
1258
  useValue: [ACTION_EXECUTION_TOKEN, ACTION_PAGE_RUNNER_TOKEN],
1248
1259
  }),
1249
- {
1260
+ provide({
1250
1261
  provide: COMBINE_REDUCERS,
1251
1262
  multi: true,
1252
1263
  useValue: actionTramvaiReducer,
1253
- },
1264
+ }),
1254
1265
  ];
1255
1266
 
1256
1267
  let CommonChildAppModule = class CommonChildAppModule {