@tramvai/tokens-child-app 4.18.5 → 4.19.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.
package/lib/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { ActionsRegistry } from '@tramvai/tokens-common';
6
6
  import type { LazyComponentWrapper } from '@tramvai/react';
7
7
  import type { StoreClass } from '@tramvai/state';
8
8
  import type { ChunkExtractor } from '@loadable/server';
9
- import type { ChildAppLoader, ChildAppDiManager, ChildAppPreloadManager, ChildAppCommandLineRunner, ChildAppRequestConfig, WrapperProps, RootStateSubscription, ChildAppStateManager, ChildAppFinalConfig, ChildAppRenderManager, ChildAppResolutionConfig, ResolutionConfig } from './types';
9
+ import type { ChildAppLoader, ChildAppDiManager, ChildAppPreloadManager, ChildAppCommandLineRunner, ChildAppRequestConfig, WrapperProps, RootStateSubscription, ChildAppStateManager, ChildAppFinalConfig, ChildAppRenderManager, ChildAppResolutionConfig, ResolutionConfig, HostProvidedContracts, ChildAppContractManager } from './types';
10
10
  export * from './types';
11
11
  /**
12
12
  * @public
@@ -132,6 +132,15 @@ export declare const IS_CHILD_APP_DI_TOKEN: (false & {
132
132
  }) | (true & {
133
133
  __type?: "base token" | undefined;
134
134
  });
135
+ /**
136
+ * @private
137
+ * @description boolean flag indicating that current child-app version support contracts
138
+ */
139
+ export declare const IS_CHILD_APP_CONTRACTS_COMPATIBLE_TOKEN: (false & {
140
+ __type?: "base token" | undefined;
141
+ }) | (true & {
142
+ __type?: "base token" | undefined;
143
+ });
135
144
  /**
136
145
  * @private
137
146
  * @description Manages Singleton-Scope DIs for every child app
@@ -179,6 +188,10 @@ export declare const CHILD_APP_COMMAND_LINE_RUNNER_TOKEN: ChildAppCommandLineRun
179
188
  * @description Stores the common server-dehydrated state for all of child apps
180
189
  */
181
190
  export declare const CHILD_APP_COMMON_INITIAL_STATE_TOKEN: Record<string, {
191
+ /**
192
+ * @public
193
+ * @description CommandLineRunner steps specific for child app
194
+ */
182
195
  stores: Record<string, any>;
183
196
  } & {
184
197
  __type?: "base token" | undefined;
@@ -271,4 +284,13 @@ export declare const CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN: ({
271
284
  } & {
272
285
  __type?: "base token" | undefined;
273
286
  });
287
+ export declare const CHILD_APP_CONTRACT_MANAGER: ChildAppContractManager & {
288
+ __type?: "base token" | undefined;
289
+ };
290
+ export declare const HOST_PROVIDED_CONTRACTS: HostProvidedContracts & {
291
+ __type?: "multi token" | undefined;
292
+ };
293
+ export declare const CHILD_REQUIRED_CONTRACTS: import("./types").Contracts & {
294
+ __type?: "multi token" | undefined;
295
+ };
274
296
  //# sourceMappingURL=index.d.ts.map
package/lib/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createToken } from '@tinkoff/dippy';
1
+ import { createToken, Scope } from '@tinkoff/dippy';
2
2
 
3
3
  const multiOptions = { multi: true };
4
4
  /**
@@ -78,6 +78,11 @@ const CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN = createToken('child-app root di b
78
78
  * @description boolean flag indicating that current di if for a child-app
79
79
  */
80
80
  const IS_CHILD_APP_DI_TOKEN = createToken('child-app isChildApp Di');
81
+ /**
82
+ * @private
83
+ * @description boolean flag indicating that current child-app version support contracts
84
+ */
85
+ const IS_CHILD_APP_CONTRACTS_COMPATIBLE_TOKEN = createToken('child-app contracts compatible');
81
86
  /**
82
87
  * @private
83
88
  * @description Manages Singleton-Scope DIs for every child app
@@ -153,6 +158,9 @@ const CHILD_APP_RENDER_CHILDREN_TOKEN = createToken('child-app render children')
153
158
  * - allow full access - `{ mode: 'blacklist', list: [] }`
154
159
  * - block any access - `{ mode: 'whitelist', list: [] }`
155
160
  */
156
- const CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN = createToken('child-app root di access mode');
161
+ const CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN = createToken('child-app root di access mode', { scope: Scope.SINGLETON });
162
+ const CHILD_APP_CONTRACT_MANAGER = createToken('child-app contract manager', { scope: Scope.SINGLETON });
163
+ const HOST_PROVIDED_CONTRACTS = createToken('child-app host provided contracts', { multi: true, scope: Scope.SINGLETON });
164
+ const CHILD_REQUIRED_CONTRACTS = createToken('child-app child required contracts', { multi: true, scope: Scope.SINGLETON });
157
165
 
158
- export { CHILD_APP_ACTIONS_REGISTRY_TOKEN, CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_COMMON_INITIAL_STATE_TOKEN, CHILD_APP_DI_MANAGER_TOKEN, CHILD_APP_INTERNAL_ACTION_TOKEN, CHILD_APP_INTERNAL_CHUNK_EXTRACTOR, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_INTERNAL_RENDER_TOKEN, CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN, CHILD_APP_LOADER_TOKEN, CHILD_APP_PAGE_COMPONENTS_TOKEN, CHILD_APP_PAGE_SERVICE_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN, CHILD_APP_RENDER_CHILDREN_TOKEN, CHILD_APP_RENDER_MANAGER_TOKEN, CHILD_APP_RESOLUTION_CONFIGS_TOKEN, CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN, CHILD_APP_RESOLVE_BASE_URL_TOKEN, CHILD_APP_RESOLVE_CONFIG_TOKEN, CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN, CHILD_APP_SINGLETON_DI_MANAGER_TOKEN, CHILD_APP_STATE_MANAGER_TOKEN, IS_CHILD_APP_DI_TOKEN, commandLineListTokens };
166
+ export { CHILD_APP_ACTIONS_REGISTRY_TOKEN, CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_COMMON_INITIAL_STATE_TOKEN, CHILD_APP_CONTRACT_MANAGER, CHILD_APP_DI_MANAGER_TOKEN, CHILD_APP_INTERNAL_ACTION_TOKEN, CHILD_APP_INTERNAL_CHUNK_EXTRACTOR, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_INTERNAL_RENDER_TOKEN, CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN, CHILD_APP_LOADER_TOKEN, CHILD_APP_PAGE_COMPONENTS_TOKEN, CHILD_APP_PAGE_SERVICE_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN, CHILD_APP_RENDER_CHILDREN_TOKEN, CHILD_APP_RENDER_MANAGER_TOKEN, CHILD_APP_RESOLUTION_CONFIGS_TOKEN, CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN, CHILD_APP_RESOLVE_BASE_URL_TOKEN, CHILD_APP_RESOLVE_CONFIG_TOKEN, CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN, CHILD_APP_SINGLETON_DI_MANAGER_TOKEN, CHILD_APP_STATE_MANAGER_TOKEN, CHILD_REQUIRED_CONTRACTS, HOST_PROVIDED_CONTRACTS, IS_CHILD_APP_CONTRACTS_COMPATIBLE_TOKEN, IS_CHILD_APP_DI_TOKEN, commandLineListTokens };
package/lib/index.js CHANGED
@@ -82,6 +82,11 @@ const CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN = dippy.createToken('child-app roo
82
82
  * @description boolean flag indicating that current di if for a child-app
83
83
  */
84
84
  const IS_CHILD_APP_DI_TOKEN = dippy.createToken('child-app isChildApp Di');
85
+ /**
86
+ * @private
87
+ * @description boolean flag indicating that current child-app version support contracts
88
+ */
89
+ const IS_CHILD_APP_CONTRACTS_COMPATIBLE_TOKEN = dippy.createToken('child-app contracts compatible');
85
90
  /**
86
91
  * @private
87
92
  * @description Manages Singleton-Scope DIs for every child app
@@ -157,11 +162,15 @@ const CHILD_APP_RENDER_CHILDREN_TOKEN = dippy.createToken('child-app render chil
157
162
  * - allow full access - `{ mode: 'blacklist', list: [] }`
158
163
  * - block any access - `{ mode: 'whitelist', list: [] }`
159
164
  */
160
- const CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN = dippy.createToken('child-app root di access mode');
165
+ const CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN = dippy.createToken('child-app root di access mode', { scope: dippy.Scope.SINGLETON });
166
+ const CHILD_APP_CONTRACT_MANAGER = dippy.createToken('child-app contract manager', { scope: dippy.Scope.SINGLETON });
167
+ const HOST_PROVIDED_CONTRACTS = dippy.createToken('child-app host provided contracts', { multi: true, scope: dippy.Scope.SINGLETON });
168
+ const CHILD_REQUIRED_CONTRACTS = dippy.createToken('child-app child required contracts', { multi: true, scope: dippy.Scope.SINGLETON });
161
169
 
162
170
  exports.CHILD_APP_ACTIONS_REGISTRY_TOKEN = CHILD_APP_ACTIONS_REGISTRY_TOKEN;
163
171
  exports.CHILD_APP_COMMAND_LINE_RUNNER_TOKEN = CHILD_APP_COMMAND_LINE_RUNNER_TOKEN;
164
172
  exports.CHILD_APP_COMMON_INITIAL_STATE_TOKEN = CHILD_APP_COMMON_INITIAL_STATE_TOKEN;
173
+ exports.CHILD_APP_CONTRACT_MANAGER = CHILD_APP_CONTRACT_MANAGER;
165
174
  exports.CHILD_APP_DI_MANAGER_TOKEN = CHILD_APP_DI_MANAGER_TOKEN;
166
175
  exports.CHILD_APP_INTERNAL_ACTION_TOKEN = CHILD_APP_INTERNAL_ACTION_TOKEN;
167
176
  exports.CHILD_APP_INTERNAL_CHUNK_EXTRACTOR = CHILD_APP_INTERNAL_CHUNK_EXTRACTOR;
@@ -183,5 +192,8 @@ exports.CHILD_APP_RESOLVE_CONFIG_TOKEN = CHILD_APP_RESOLVE_CONFIG_TOKEN;
183
192
  exports.CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN = CHILD_APP_ROOT_DI_ACCESS_MODE_TOKEN;
184
193
  exports.CHILD_APP_SINGLETON_DI_MANAGER_TOKEN = CHILD_APP_SINGLETON_DI_MANAGER_TOKEN;
185
194
  exports.CHILD_APP_STATE_MANAGER_TOKEN = CHILD_APP_STATE_MANAGER_TOKEN;
195
+ exports.CHILD_REQUIRED_CONTRACTS = CHILD_REQUIRED_CONTRACTS;
196
+ exports.HOST_PROVIDED_CONTRACTS = HOST_PROVIDED_CONTRACTS;
197
+ exports.IS_CHILD_APP_CONTRACTS_COMPATIBLE_TOKEN = IS_CHILD_APP_CONTRACTS_COMPATIBLE_TOKEN;
186
198
  exports.IS_CHILD_APP_DI_TOKEN = IS_CHILD_APP_DI_TOKEN;
187
199
  exports.commandLineListTokens = commandLineListTokens;
package/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType } from 'react';
2
- import type { Container, Provider } from '@tinkoff/dippy';
2
+ import type { Container, Provider, TokenInterface } from '@tinkoff/dippy';
3
3
  import type { CommandLines, CommandLineDescription, ModuleType, ExtendedModule, Action, TramvaiAction } from '@tramvai/core';
4
4
  import type { Route } from '@tinkoff/router';
5
5
  export interface ChildApp {
@@ -94,5 +94,15 @@ export interface RootStateSubscription {
94
94
  stores: Array<Store | OptionalStore>;
95
95
  listener: (state: Record<string, any>) => void;
96
96
  }
97
+ export interface ChildAppContractManager {
98
+ registerChildContracts(childDi: Container): void;
99
+ }
100
+ export type Contract = TokenInterface;
101
+ export type Contracts = Contract[];
102
+ export type ChildRequiredContracts = Contracts;
103
+ export type HostProvidedContracts = {
104
+ childAppName?: string;
105
+ providedContracts: Contracts;
106
+ };
97
107
  export {};
98
108
  //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-child-app",
3
- "version": "4.18.5",
3
+ "version": "4.19.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -20,12 +20,12 @@
20
20
  "registry": "https://registry.npmjs.org/"
21
21
  },
22
22
  "peerDependencies": {
23
- "@tinkoff/dippy": "0.10.6",
24
- "@tinkoff/router": "0.4.57",
25
- "@tramvai/core": "4.18.5",
26
- "@tramvai/react": "4.18.5",
27
- "@tramvai/state": "4.18.5",
28
- "@tramvai/tokens-common": "4.18.5",
23
+ "@tinkoff/dippy": "0.10.7",
24
+ "@tinkoff/router": "0.4.58",
25
+ "@tramvai/core": "4.19.0",
26
+ "@tramvai/react": "4.19.0",
27
+ "@tramvai/state": "4.19.0",
28
+ "@tramvai/tokens-common": "4.19.0",
29
29
  "@loadable/server": "*",
30
30
  "react": ">=16.14.0"
31
31
  },