@tramvai/module-common 2.39.3 → 2.44.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.
@@ -3,13 +3,13 @@ import type { CONTEXT_TOKEN, ActionCondition, STORE_TOKEN, ActionExecution as In
3
3
  import type { TramvaiAction } from '@tramvai/types-actions-state-context';
4
4
  import type { ExtractDependencyType } from '@tinkoff/dippy';
5
5
  export declare const getParameters: (action: Action) => ActionParameters<any, any>;
6
- declare type ExecutionStatus = 'success' | 'failed' | 'pending' | 'forbidden';
6
+ type ExecutionStatus = 'success' | 'failed' | 'pending' | 'forbidden';
7
7
  export interface ExecutionState {
8
8
  status: ExecutionStatus;
9
9
  forbiddenBy?: string;
10
10
  state: Record<string, any>;
11
11
  }
12
- declare type TransformAction = <T>(action: T) => T;
12
+ type TransformAction = <T>(action: T) => T;
13
13
  export declare class ActionExecution implements Interface {
14
14
  execution: Map<string, ExecutionState>;
15
15
  private actionConditionals;
@@ -8,4 +8,4 @@ export declare const actionType: {
8
8
  /**
9
9
  * @deprecated only for compatibility with legacy createAction
10
10
  */
11
- export declare type ActionType = keyof typeof actionType;
11
+ export type ActionType = keyof typeof actionType;
@@ -1,8 +1,8 @@
1
1
  import type { BUNDLE_MANAGER_TOKEN, DISPATCHER_TOKEN, ActionsRegistry, LOGGER_TOKEN } from '@tramvai/tokens-common';
2
2
  import type { Bundle, ExtractDependencyType } from '@tramvai/core';
3
3
  import type { ComponentRegistry } from '../componentRegistry/componentRegistry';
4
- declare type Interface = typeof BUNDLE_MANAGER_TOKEN;
5
- declare type Deps = {
4
+ type Interface = typeof BUNDLE_MANAGER_TOKEN;
5
+ type Deps = {
6
6
  bundleList: Record<string, () => Promise<{
7
7
  default: Bundle;
8
8
  }>>;
@@ -2,7 +2,7 @@ import type { CommandLineDescription, CommandLine, CommandLines } from '@tramvai
2
2
  import type { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
3
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
- declare type Deps = {
5
+ type Deps = {
6
6
  lines: CommandLines;
7
7
  rootDi: Container;
8
8
  logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
@@ -1,5 +1,5 @@
1
1
  import type { COMPONENT_REGISTRY_TOKEN } from '@tramvai/tokens-common';
2
- declare type Interface = typeof COMPONENT_REGISTRY_TOKEN;
2
+ type Interface = typeof COMPONENT_REGISTRY_TOKEN;
3
3
  export declare class ComponentRegistry implements Interface {
4
4
  components: Record<string, any>;
5
5
  constructor({ componentList }?: {
@@ -2,5 +2,5 @@ export declare const P_LOW = 3;
2
2
  declare const P_NORMAL = 5;
3
3
  declare const P_HIGH = 7;
4
4
  declare const P_IMPORTANT = 10;
5
- export declare type Priority = typeof P_LOW | typeof P_NORMAL | typeof P_HIGH | typeof P_IMPORTANT;
5
+ export type Priority = typeof P_LOW | typeof P_NORMAL | typeof P_HIGH | typeof P_IMPORTANT;
6
6
  export {};
@@ -3,8 +3,8 @@ import type { Event, Reducer } from '@tramvai/state';
3
3
  import type { Action, TramvaiAction } from '@tramvai/core';
4
4
  import type { STORE_TOKEN, PUBSUB_TOKEN, CONTEXT_TOKEN, DISPATCHER_CONTEXT_TOKEN } from '@tramvai/tokens-common';
5
5
  import type { PlatformAction } from './typings';
6
- declare type ContextType = typeof CONTEXT_TOKEN;
7
- declare type Deps = {
6
+ type ContextType = typeof CONTEXT_TOKEN;
7
+ type Deps = {
8
8
  di: Container;
9
9
  dispatcherContext: ExtractDependencyType<typeof DISPATCHER_CONTEXT_TOKEN>;
10
10
  pubsub: ExtractDependencyType<typeof PUBSUB_TOKEN>;
@@ -11,7 +11,7 @@ export * from '@tramvai/tokens-common';
11
11
  import isObject from '@tinkoff/utils/is/object';
12
12
  import isArray from '@tinkoff/utils/is/array';
13
13
  import { resolveLazyComponent, __lazyErrorHandler } from '@tramvai/react';
14
- import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponent } from '@tramvai/experiments';
14
+ import { fileSystemPagesEnabled, getAllFileSystemPages, getAllFileSystemLayouts, fileSystemPageToLayoutKey, isFileSystemPageComponent } from '@tramvai/experiments';
15
15
  import pathOr from '@tinkoff/utils/object/pathOr';
16
16
  import flatten from '@tinkoff/utils/array/flatten';
17
17
  import { FASTIFY_REQUEST, FASTIFY_RESPONSE } from '@tramvai/tokens-server-private';
@@ -45,13 +45,24 @@ class BundleManager {
45
45
  if (fileSystemPagesEnabled()) {
46
46
  const log = logger('file-system-pages:bundle-manager');
47
47
  const components = getAllFileSystemPages();
48
+ const layouts = getAllFileSystemLayouts();
48
49
  const componentsDefaultBundle = createBundle({
49
50
  name: FS_PAGES_DEFAULT_BUNDLE,
50
- components,
51
+ components: {
52
+ ...Object.keys(layouts).reduce((result, key) => {
53
+ // eslint-disable-next-line no-param-reassign
54
+ result[fileSystemPageToLayoutKey(key)] = layouts[key];
55
+ return result;
56
+ }, {}),
57
+ ...components,
58
+ },
51
59
  });
52
60
  this.bundles[FS_PAGES_DEFAULT_BUNDLE] = () => Promise.resolve({
53
61
  default: componentsDefaultBundle,
54
62
  });
63
+ for (const key in componentsDefaultBundle.components) {
64
+ this.componentRegistry.add(key, componentsDefaultBundle.components[key], FS_PAGES_DEFAULT_BUNDLE);
65
+ }
55
66
  log.debug({
56
67
  event: 'create default bundle with file-system pages',
57
68
  components: Object.keys(components),
package/lib/index.es.js CHANGED
@@ -11,7 +11,7 @@ export * from '@tramvai/tokens-common';
11
11
  import isObject from '@tinkoff/utils/is/object';
12
12
  import isArray from '@tinkoff/utils/is/array';
13
13
  import { resolveLazyComponent, __lazyErrorHandler } from '@tramvai/react';
14
- import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponent } from '@tramvai/experiments';
14
+ import { fileSystemPagesEnabled, getAllFileSystemPages, getAllFileSystemLayouts, fileSystemPageToLayoutKey, isFileSystemPageComponent } from '@tramvai/experiments';
15
15
  import pathOr from '@tinkoff/utils/object/pathOr';
16
16
  import flatten from '@tinkoff/utils/array/flatten';
17
17
  import { createEvent, createReducer, convertAction, createDispatcher, devTools, Provider } from '@tramvai/state';
@@ -47,13 +47,24 @@ class BundleManager {
47
47
  if (fileSystemPagesEnabled()) {
48
48
  const log = logger('file-system-pages:bundle-manager');
49
49
  const components = getAllFileSystemPages();
50
+ const layouts = getAllFileSystemLayouts();
50
51
  const componentsDefaultBundle = createBundle({
51
52
  name: FS_PAGES_DEFAULT_BUNDLE,
52
- components,
53
+ components: {
54
+ ...Object.keys(layouts).reduce((result, key) => {
55
+ // eslint-disable-next-line no-param-reassign
56
+ result[fileSystemPageToLayoutKey(key)] = layouts[key];
57
+ return result;
58
+ }, {}),
59
+ ...components,
60
+ },
53
61
  });
54
62
  this.bundles[FS_PAGES_DEFAULT_BUNDLE] = () => Promise.resolve({
55
63
  default: componentsDefaultBundle,
56
64
  });
65
+ for (const key in componentsDefaultBundle.components) {
66
+ this.componentRegistry.add(key, componentsDefaultBundle.components[key], FS_PAGES_DEFAULT_BUNDLE);
67
+ }
57
68
  log.debug({
58
69
  event: 'create default bundle with file-system pages',
59
70
  components: Object.keys(components),
package/lib/index.js CHANGED
@@ -66,13 +66,24 @@ class BundleManager {
66
66
  if (experiments.fileSystemPagesEnabled()) {
67
67
  const log = logger('file-system-pages:bundle-manager');
68
68
  const components = experiments.getAllFileSystemPages();
69
+ const layouts = experiments.getAllFileSystemLayouts();
69
70
  const componentsDefaultBundle = core.createBundle({
70
71
  name: FS_PAGES_DEFAULT_BUNDLE,
71
- components,
72
+ components: {
73
+ ...Object.keys(layouts).reduce((result, key) => {
74
+ // eslint-disable-next-line no-param-reassign
75
+ result[experiments.fileSystemPageToLayoutKey(key)] = layouts[key];
76
+ return result;
77
+ }, {}),
78
+ ...components,
79
+ },
72
80
  });
73
81
  this.bundles[FS_PAGES_DEFAULT_BUNDLE] = () => Promise.resolve({
74
82
  default: componentsDefaultBundle,
75
83
  });
84
+ for (const key in componentsDefaultBundle.components) {
85
+ this.componentRegistry.add(key, componentsDefaultBundle.components[key], FS_PAGES_DEFAULT_BUNDLE);
86
+ }
76
87
  log.debug({
77
88
  event: 'create default bundle with file-system pages',
78
89
  components: Object.keys(components),
@@ -1,4 +1,4 @@
1
- declare type Request = Record<string, any>;
1
+ type Request = Record<string, any>;
2
2
  export declare const setRequest: import("@tramvai/types-actions-state-context").EventCreator1<Request, Request>;
3
3
  export declare const RequestManagerStore: import("@tramvai/state").Reducer<Request, "requestManager">;
4
4
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { Url } from '@tinkoff/url';
2
2
  import type { REQUEST_MANAGER_TOKEN } from '@tramvai/tokens-common';
3
3
  import type { FASTIFY_REQUEST } from '@tramvai/tokens-server-private';
4
- declare type Interface = typeof REQUEST_MANAGER_TOKEN;
4
+ type Interface = typeof REQUEST_MANAGER_TOKEN;
5
5
  export declare class RequestManager implements Interface {
6
6
  private request;
7
7
  private url;
@@ -1,5 +1,5 @@
1
1
  import type { RESPONSE_MANAGER_TOKEN } from '@tramvai/tokens-common';
2
- declare type Interface = typeof RESPONSE_MANAGER_TOKEN;
2
+ type Interface = typeof RESPONSE_MANAGER_TOKEN;
3
3
  export declare class ResponseManager implements Interface {
4
4
  private body;
5
5
  private headers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "2.39.3",
3
+ "version": "2.44.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -33,27 +33,27 @@
33
33
  "@tinkoff/lru-cache-nano": "^7.8.1",
34
34
  "@tinkoff/pubsub": "0.5.5",
35
35
  "@tinkoff/url": "0.8.4",
36
- "@tramvai/experiments": "2.39.3",
37
- "@tramvai/module-cookie": "2.39.3",
38
- "@tramvai/module-environment": "2.39.3",
39
- "@tramvai/module-log": "2.39.3",
40
- "@tramvai/tokens-child-app": "2.39.3",
41
- "@tramvai/tokens-common": "2.39.3",
42
- "@tramvai/tokens-render": "2.39.3",
43
- "@tramvai/tokens-server-private": "2.39.3",
36
+ "@tramvai/experiments": "2.44.2",
37
+ "@tramvai/module-cookie": "2.44.2",
38
+ "@tramvai/module-environment": "2.44.2",
39
+ "@tramvai/module-log": "2.44.2",
40
+ "@tramvai/tokens-child-app": "2.44.2",
41
+ "@tramvai/tokens-common": "2.44.2",
42
+ "@tramvai/tokens-render": "2.44.2",
43
+ "@tramvai/tokens-server-private": "2.44.2",
44
44
  "hoist-non-react-statics": "^3.3.1",
45
45
  "node-abort-controller": "^3.0.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@tinkoff/dippy": "0.8.9",
49
49
  "@tinkoff/utils": "^2.1.2",
50
- "@tramvai/cli": "2.39.3",
51
- "@tramvai/core": "2.39.3",
52
- "@tramvai/papi": "2.39.3",
53
- "@tramvai/react": "2.39.3",
54
- "@tramvai/state": "2.39.3",
55
- "@tramvai/tokens-metrics": "2.39.3",
56
- "@tramvai/tokens-server": "2.39.3",
50
+ "@tramvai/cli": "2.44.2",
51
+ "@tramvai/core": "2.44.2",
52
+ "@tramvai/papi": "2.44.2",
53
+ "@tramvai/react": "2.44.2",
54
+ "@tramvai/state": "2.44.2",
55
+ "@tramvai/tokens-metrics": "2.44.2",
56
+ "@tramvai/tokens-server": "2.44.2",
57
57
  "react": ">=16.14.0",
58
58
  "tslib": "^2.4.0"
59
59
  },