@tramvai/tokens-child-app 1.46.5
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/README.md +3 -0
- package/lib/index.d.ts +112 -0
- package/lib/index.es.js +114 -0
- package/lib/index.js +137 -0
- package/lib/types.d.ts +88 -0
- package/package.json +30 -0
package/README.md
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Action, Command } from '@tramvai/core';
|
|
2
|
+
import type { ComponentType } from 'react';
|
|
3
|
+
import type { ChildAppLoader, ChildAppDiManager, ChildAppPreloadManager, ChildAppCommandLineRunner, ChildAppRequestConfig, WrapperProps, RootStateSubscription, ChildAppStateManager, ChildAppFinalConfig, ChildAppRenderManager, ChildAppResolutionConfig, ResolutionConfig } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
* @description CommandLineRunner steps specific for child app
|
|
8
|
+
*/
|
|
9
|
+
export declare const commandLineListTokens: {
|
|
10
|
+
customerStart: Command;
|
|
11
|
+
resolveUserDeps: Command;
|
|
12
|
+
resolvePageDeps: Command;
|
|
13
|
+
clear: Command;
|
|
14
|
+
spaTransition: Command;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
* @description Contains child app configs that was used to figure out how to load child apps
|
|
19
|
+
*/
|
|
20
|
+
export declare const CHILD_APP_RESOLUTION_CONFIGS_TOKEN: ChildAppResolutionConfig[];
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
* @description async function to execute any preload action before any child-app starts execute
|
|
24
|
+
*/
|
|
25
|
+
export declare const CHILD_APP_PRELOAD_EXTERNAL_CONFIG_TOKEN: () => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
* @description Used to resolve resolution config for a specific child-app
|
|
29
|
+
*/
|
|
30
|
+
export declare const CHILD_APP_GET_RESOLUTION_CONFIG_TOKEN: (config: ChildAppRequestConfig) => ResolutionConfig;
|
|
31
|
+
/**
|
|
32
|
+
* @public
|
|
33
|
+
* @description Used to resolve external config with urls to external code entries
|
|
34
|
+
*/
|
|
35
|
+
export declare const CHILD_APP_RESOLVE_CONFIG_TOKEN: (config: ChildAppRequestConfig) => ChildAppFinalConfig;
|
|
36
|
+
/**
|
|
37
|
+
* @public
|
|
38
|
+
* @description Base url for external urls for child apps on client
|
|
39
|
+
*/
|
|
40
|
+
export declare const CHILD_APP_RESOLVE_BASE_URL_TOKEN: string;
|
|
41
|
+
/**
|
|
42
|
+
* @public
|
|
43
|
+
* @description Allows to preload child app for the specific page
|
|
44
|
+
*/
|
|
45
|
+
export declare const CHILD_APP_PRELOAD_MANAGER_TOKEN: ChildAppPreloadManager;
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
* @description Contains child app config that was used to load current child app
|
|
49
|
+
*/
|
|
50
|
+
export declare const CHILD_APP_INTERNAL_CONFIG_TOKEN: ChildAppFinalConfig;
|
|
51
|
+
/**
|
|
52
|
+
* @public
|
|
53
|
+
* @description Actions of child app
|
|
54
|
+
*/
|
|
55
|
+
export declare const CHILD_APP_INTERNAL_ACTION_TOKEN: Action<any, any, any>;
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
* @description Subscription on a root state updates
|
|
59
|
+
*/
|
|
60
|
+
export declare const CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN: RootStateSubscription;
|
|
61
|
+
/**
|
|
62
|
+
* @public
|
|
63
|
+
* @description Allows to recreate token implementation the same way as in root di, but specific to child-app di
|
|
64
|
+
*/
|
|
65
|
+
export declare const CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN: any;
|
|
66
|
+
/**
|
|
67
|
+
* @private
|
|
68
|
+
* @description boolean flag indicating that current di if for a child-app
|
|
69
|
+
*/
|
|
70
|
+
export declare const IS_CHILD_APP_DI_TOKEN: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* @private
|
|
73
|
+
* @description Manages Singleton-Scope DIs for every child app
|
|
74
|
+
*/
|
|
75
|
+
export declare const CHILD_APP_SINGLETON_DI_MANAGER_TOKEN: ChildAppDiManager;
|
|
76
|
+
/**
|
|
77
|
+
* @private
|
|
78
|
+
* @description Manages Request-Scope DIs for every child app
|
|
79
|
+
*/
|
|
80
|
+
export declare const CHILD_APP_DI_MANAGER_TOKEN: ChildAppDiManager;
|
|
81
|
+
/**
|
|
82
|
+
* @private
|
|
83
|
+
* @description Bridge from React render to di providers for child apps
|
|
84
|
+
*/
|
|
85
|
+
export declare const CHILD_APP_RENDER_MANAGER_TOKEN: ChildAppRenderManager;
|
|
86
|
+
/**
|
|
87
|
+
* @private
|
|
88
|
+
* @description Manages state dehydration for child-app
|
|
89
|
+
*/
|
|
90
|
+
export declare const CHILD_APP_STATE_MANAGER_TOKEN: ChildAppStateManager;
|
|
91
|
+
/**
|
|
92
|
+
* @private
|
|
93
|
+
* @description Manages loading child-app resources from the external place
|
|
94
|
+
*/
|
|
95
|
+
export declare const CHILD_APP_LOADER_TOKEN: ChildAppLoader;
|
|
96
|
+
/**
|
|
97
|
+
* @private
|
|
98
|
+
* @description Implements CommandLineRunner for child apps
|
|
99
|
+
*/
|
|
100
|
+
export declare const CHILD_APP_COMMAND_LINE_RUNNER_TOKEN: ChildAppCommandLineRunner;
|
|
101
|
+
/**
|
|
102
|
+
* @private
|
|
103
|
+
* @description Stores the common server-dehydrated state for all of child apps
|
|
104
|
+
*/
|
|
105
|
+
export declare const CHILD_APP_COMMON_INITIAL_STATE_TOKEN: Record<string, {
|
|
106
|
+
stores: Record<string, any>;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* @private
|
|
110
|
+
* @description Used as render function for a child app. Usually implemented as a wrapper over child app render itself with an additional logic for di and connections to root app
|
|
111
|
+
*/
|
|
112
|
+
export declare const CHILD_APP_INTERNAL_RENDER_TOKEN: ComponentType<WrapperProps<any>>;
|
package/lib/index.es.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createToken } from '@tinkoff/dippy';
|
|
2
|
+
|
|
3
|
+
const multiOptions = { multi: true };
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
* @description CommandLineRunner steps specific for child app
|
|
7
|
+
*/
|
|
8
|
+
const commandLineListTokens = {
|
|
9
|
+
// section: client processing
|
|
10
|
+
customerStart: createToken('child-app customer_start', multiOptions),
|
|
11
|
+
resolveUserDeps: createToken('child-app resolve_user_deps', multiOptions),
|
|
12
|
+
resolvePageDeps: createToken('child-app resolve_page_deps', multiOptions),
|
|
13
|
+
// section: clear data
|
|
14
|
+
clear: createToken('child-app clear', multiOptions),
|
|
15
|
+
// section: spa transitions
|
|
16
|
+
spaTransition: createToken('child-app spa_transition', multiOptions),
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
* @description Contains child app configs that was used to figure out how to load child apps
|
|
21
|
+
*/
|
|
22
|
+
const CHILD_APP_RESOLUTION_CONFIGS_TOKEN = createToken('child-app resolve configs');
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
* @description async function to execute any preload action before any child-app starts execute
|
|
26
|
+
*/
|
|
27
|
+
const CHILD_APP_PRELOAD_EXTERNAL_CONFIG_TOKEN = createToken('child-app preload external config');
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
* @description Used to resolve resolution config for a specific child-app
|
|
31
|
+
*/
|
|
32
|
+
const CHILD_APP_GET_RESOLUTION_CONFIG_TOKEN = createToken('child-app get resolution config');
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
* @description Used to resolve external config with urls to external code entries
|
|
36
|
+
*/
|
|
37
|
+
const CHILD_APP_RESOLVE_CONFIG_TOKEN = createToken('child-app resolve external config');
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
* @description Base url for external urls for child apps on client
|
|
41
|
+
*/
|
|
42
|
+
const CHILD_APP_RESOLVE_BASE_URL_TOKEN = createToken('child-app resolve external base url');
|
|
43
|
+
/**
|
|
44
|
+
* @public
|
|
45
|
+
* @description Allows to preload child app for the specific page
|
|
46
|
+
*/
|
|
47
|
+
const CHILD_APP_PRELOAD_MANAGER_TOKEN = createToken('child-app preload manager');
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
* @description Contains child app config that was used to load current child app
|
|
51
|
+
*/
|
|
52
|
+
const CHILD_APP_INTERNAL_CONFIG_TOKEN = createToken('child-app current config');
|
|
53
|
+
/**
|
|
54
|
+
* @public
|
|
55
|
+
* @description Actions of child app
|
|
56
|
+
*/
|
|
57
|
+
const CHILD_APP_INTERNAL_ACTION_TOKEN = createToken('child-app action', multiOptions);
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
* @description Subscription on a root state updates
|
|
61
|
+
*/
|
|
62
|
+
const CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN = createToken('child-app root state subscription', multiOptions);
|
|
63
|
+
/**
|
|
64
|
+
* @public
|
|
65
|
+
* @description Allows to recreate token implementation the same way as in root di, but specific to child-app di
|
|
66
|
+
*/
|
|
67
|
+
const CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN = createToken('child-app root di borrow', multiOptions);
|
|
68
|
+
/**
|
|
69
|
+
* @private
|
|
70
|
+
* @description boolean flag indicating that current di if for a child-app
|
|
71
|
+
*/
|
|
72
|
+
const IS_CHILD_APP_DI_TOKEN = createToken('child-app isChildApp Di');
|
|
73
|
+
/**
|
|
74
|
+
* @private
|
|
75
|
+
* @description Manages Singleton-Scope DIs for every child app
|
|
76
|
+
*/
|
|
77
|
+
const CHILD_APP_SINGLETON_DI_MANAGER_TOKEN = createToken('child-app singleton di manager');
|
|
78
|
+
/**
|
|
79
|
+
* @private
|
|
80
|
+
* @description Manages Request-Scope DIs for every child app
|
|
81
|
+
*/
|
|
82
|
+
const CHILD_APP_DI_MANAGER_TOKEN = createToken('child-app di manager');
|
|
83
|
+
/**
|
|
84
|
+
* @private
|
|
85
|
+
* @description Bridge from React render to di providers for child apps
|
|
86
|
+
*/
|
|
87
|
+
const CHILD_APP_RENDER_MANAGER_TOKEN = createToken('child-app render manager');
|
|
88
|
+
/**
|
|
89
|
+
* @private
|
|
90
|
+
* @description Manages state dehydration for child-app
|
|
91
|
+
*/
|
|
92
|
+
const CHILD_APP_STATE_MANAGER_TOKEN = createToken('child-app state manager');
|
|
93
|
+
/**
|
|
94
|
+
* @private
|
|
95
|
+
* @description Manages loading child-app resources from the external place
|
|
96
|
+
*/
|
|
97
|
+
const CHILD_APP_LOADER_TOKEN = createToken('child-app loader');
|
|
98
|
+
/**
|
|
99
|
+
* @private
|
|
100
|
+
* @description Implements CommandLineRunner for child apps
|
|
101
|
+
*/
|
|
102
|
+
const CHILD_APP_COMMAND_LINE_RUNNER_TOKEN = createToken('child-app command runner');
|
|
103
|
+
/**
|
|
104
|
+
* @private
|
|
105
|
+
* @description Stores the common server-dehydrated state for all of child apps
|
|
106
|
+
*/
|
|
107
|
+
const CHILD_APP_COMMON_INITIAL_STATE_TOKEN = createToken('child-app initialAppState');
|
|
108
|
+
/**
|
|
109
|
+
* @private
|
|
110
|
+
* @description Used as render function for a child app. Usually implemented as a wrapper over child app render itself with an additional logic for di and connections to root app
|
|
111
|
+
*/
|
|
112
|
+
const CHILD_APP_INTERNAL_RENDER_TOKEN = createToken('child-app render');
|
|
113
|
+
|
|
114
|
+
export { CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_COMMON_INITIAL_STATE_TOKEN, CHILD_APP_DI_MANAGER_TOKEN, CHILD_APP_GET_RESOLUTION_CONFIG_TOKEN, CHILD_APP_INTERNAL_ACTION_TOKEN, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_INTERNAL_RENDER_TOKEN, CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN, CHILD_APP_LOADER_TOKEN, CHILD_APP_PRELOAD_EXTERNAL_CONFIG_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN, CHILD_APP_RENDER_MANAGER_TOKEN, CHILD_APP_RESOLUTION_CONFIGS_TOKEN, CHILD_APP_RESOLVE_BASE_URL_TOKEN, CHILD_APP_RESOLVE_CONFIG_TOKEN, CHILD_APP_SINGLETON_DI_MANAGER_TOKEN, CHILD_APP_STATE_MANAGER_TOKEN, IS_CHILD_APP_DI_TOKEN, commandLineListTokens };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dippy = require('@tinkoff/dippy');
|
|
6
|
+
|
|
7
|
+
const multiOptions = { multi: true };
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
* @description CommandLineRunner steps specific for child app
|
|
11
|
+
*/
|
|
12
|
+
const commandLineListTokens = {
|
|
13
|
+
// section: client processing
|
|
14
|
+
customerStart: dippy.createToken('child-app customer_start', multiOptions),
|
|
15
|
+
resolveUserDeps: dippy.createToken('child-app resolve_user_deps', multiOptions),
|
|
16
|
+
resolvePageDeps: dippy.createToken('child-app resolve_page_deps', multiOptions),
|
|
17
|
+
// section: clear data
|
|
18
|
+
clear: dippy.createToken('child-app clear', multiOptions),
|
|
19
|
+
// section: spa transitions
|
|
20
|
+
spaTransition: dippy.createToken('child-app spa_transition', multiOptions),
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
* @description Contains child app configs that was used to figure out how to load child apps
|
|
25
|
+
*/
|
|
26
|
+
const CHILD_APP_RESOLUTION_CONFIGS_TOKEN = dippy.createToken('child-app resolve configs');
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
* @description async function to execute any preload action before any child-app starts execute
|
|
30
|
+
*/
|
|
31
|
+
const CHILD_APP_PRELOAD_EXTERNAL_CONFIG_TOKEN = dippy.createToken('child-app preload external config');
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
* @description Used to resolve resolution config for a specific child-app
|
|
35
|
+
*/
|
|
36
|
+
const CHILD_APP_GET_RESOLUTION_CONFIG_TOKEN = dippy.createToken('child-app get resolution config');
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
* @description Used to resolve external config with urls to external code entries
|
|
40
|
+
*/
|
|
41
|
+
const CHILD_APP_RESOLVE_CONFIG_TOKEN = dippy.createToken('child-app resolve external config');
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
* @description Base url for external urls for child apps on client
|
|
45
|
+
*/
|
|
46
|
+
const CHILD_APP_RESOLVE_BASE_URL_TOKEN = dippy.createToken('child-app resolve external base url');
|
|
47
|
+
/**
|
|
48
|
+
* @public
|
|
49
|
+
* @description Allows to preload child app for the specific page
|
|
50
|
+
*/
|
|
51
|
+
const CHILD_APP_PRELOAD_MANAGER_TOKEN = dippy.createToken('child-app preload manager');
|
|
52
|
+
/**
|
|
53
|
+
* @public
|
|
54
|
+
* @description Contains child app config that was used to load current child app
|
|
55
|
+
*/
|
|
56
|
+
const CHILD_APP_INTERNAL_CONFIG_TOKEN = dippy.createToken('child-app current config');
|
|
57
|
+
/**
|
|
58
|
+
* @public
|
|
59
|
+
* @description Actions of child app
|
|
60
|
+
*/
|
|
61
|
+
const CHILD_APP_INTERNAL_ACTION_TOKEN = dippy.createToken('child-app action', multiOptions);
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
* @description Subscription on a root state updates
|
|
65
|
+
*/
|
|
66
|
+
const CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN = dippy.createToken('child-app root state subscription', multiOptions);
|
|
67
|
+
/**
|
|
68
|
+
* @public
|
|
69
|
+
* @description Allows to recreate token implementation the same way as in root di, but specific to child-app di
|
|
70
|
+
*/
|
|
71
|
+
const CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN = dippy.createToken('child-app root di borrow', multiOptions);
|
|
72
|
+
/**
|
|
73
|
+
* @private
|
|
74
|
+
* @description boolean flag indicating that current di if for a child-app
|
|
75
|
+
*/
|
|
76
|
+
const IS_CHILD_APP_DI_TOKEN = dippy.createToken('child-app isChildApp Di');
|
|
77
|
+
/**
|
|
78
|
+
* @private
|
|
79
|
+
* @description Manages Singleton-Scope DIs for every child app
|
|
80
|
+
*/
|
|
81
|
+
const CHILD_APP_SINGLETON_DI_MANAGER_TOKEN = dippy.createToken('child-app singleton di manager');
|
|
82
|
+
/**
|
|
83
|
+
* @private
|
|
84
|
+
* @description Manages Request-Scope DIs for every child app
|
|
85
|
+
*/
|
|
86
|
+
const CHILD_APP_DI_MANAGER_TOKEN = dippy.createToken('child-app di manager');
|
|
87
|
+
/**
|
|
88
|
+
* @private
|
|
89
|
+
* @description Bridge from React render to di providers for child apps
|
|
90
|
+
*/
|
|
91
|
+
const CHILD_APP_RENDER_MANAGER_TOKEN = dippy.createToken('child-app render manager');
|
|
92
|
+
/**
|
|
93
|
+
* @private
|
|
94
|
+
* @description Manages state dehydration for child-app
|
|
95
|
+
*/
|
|
96
|
+
const CHILD_APP_STATE_MANAGER_TOKEN = dippy.createToken('child-app state manager');
|
|
97
|
+
/**
|
|
98
|
+
* @private
|
|
99
|
+
* @description Manages loading child-app resources from the external place
|
|
100
|
+
*/
|
|
101
|
+
const CHILD_APP_LOADER_TOKEN = dippy.createToken('child-app loader');
|
|
102
|
+
/**
|
|
103
|
+
* @private
|
|
104
|
+
* @description Implements CommandLineRunner for child apps
|
|
105
|
+
*/
|
|
106
|
+
const CHILD_APP_COMMAND_LINE_RUNNER_TOKEN = dippy.createToken('child-app command runner');
|
|
107
|
+
/**
|
|
108
|
+
* @private
|
|
109
|
+
* @description Stores the common server-dehydrated state for all of child apps
|
|
110
|
+
*/
|
|
111
|
+
const CHILD_APP_COMMON_INITIAL_STATE_TOKEN = dippy.createToken('child-app initialAppState');
|
|
112
|
+
/**
|
|
113
|
+
* @private
|
|
114
|
+
* @description Used as render function for a child app. Usually implemented as a wrapper over child app render itself with an additional logic for di and connections to root app
|
|
115
|
+
*/
|
|
116
|
+
const CHILD_APP_INTERNAL_RENDER_TOKEN = dippy.createToken('child-app render');
|
|
117
|
+
|
|
118
|
+
exports.CHILD_APP_COMMAND_LINE_RUNNER_TOKEN = CHILD_APP_COMMAND_LINE_RUNNER_TOKEN;
|
|
119
|
+
exports.CHILD_APP_COMMON_INITIAL_STATE_TOKEN = CHILD_APP_COMMON_INITIAL_STATE_TOKEN;
|
|
120
|
+
exports.CHILD_APP_DI_MANAGER_TOKEN = CHILD_APP_DI_MANAGER_TOKEN;
|
|
121
|
+
exports.CHILD_APP_GET_RESOLUTION_CONFIG_TOKEN = CHILD_APP_GET_RESOLUTION_CONFIG_TOKEN;
|
|
122
|
+
exports.CHILD_APP_INTERNAL_ACTION_TOKEN = CHILD_APP_INTERNAL_ACTION_TOKEN;
|
|
123
|
+
exports.CHILD_APP_INTERNAL_CONFIG_TOKEN = CHILD_APP_INTERNAL_CONFIG_TOKEN;
|
|
124
|
+
exports.CHILD_APP_INTERNAL_RENDER_TOKEN = CHILD_APP_INTERNAL_RENDER_TOKEN;
|
|
125
|
+
exports.CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN = CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN;
|
|
126
|
+
exports.CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN = CHILD_APP_INTERNAL_ROOT_STATE_SUBSCRIPTION_TOKEN;
|
|
127
|
+
exports.CHILD_APP_LOADER_TOKEN = CHILD_APP_LOADER_TOKEN;
|
|
128
|
+
exports.CHILD_APP_PRELOAD_EXTERNAL_CONFIG_TOKEN = CHILD_APP_PRELOAD_EXTERNAL_CONFIG_TOKEN;
|
|
129
|
+
exports.CHILD_APP_PRELOAD_MANAGER_TOKEN = CHILD_APP_PRELOAD_MANAGER_TOKEN;
|
|
130
|
+
exports.CHILD_APP_RENDER_MANAGER_TOKEN = CHILD_APP_RENDER_MANAGER_TOKEN;
|
|
131
|
+
exports.CHILD_APP_RESOLUTION_CONFIGS_TOKEN = CHILD_APP_RESOLUTION_CONFIGS_TOKEN;
|
|
132
|
+
exports.CHILD_APP_RESOLVE_BASE_URL_TOKEN = CHILD_APP_RESOLVE_BASE_URL_TOKEN;
|
|
133
|
+
exports.CHILD_APP_RESOLVE_CONFIG_TOKEN = CHILD_APP_RESOLVE_CONFIG_TOKEN;
|
|
134
|
+
exports.CHILD_APP_SINGLETON_DI_MANAGER_TOKEN = CHILD_APP_SINGLETON_DI_MANAGER_TOKEN;
|
|
135
|
+
exports.CHILD_APP_STATE_MANAGER_TOKEN = CHILD_APP_STATE_MANAGER_TOKEN;
|
|
136
|
+
exports.IS_CHILD_APP_DI_TOKEN = IS_CHILD_APP_DI_TOKEN;
|
|
137
|
+
exports.commandLineListTokens = commandLineListTokens;
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Container, Provider } from '@tinkoff/dippy';
|
|
2
|
+
import type { CommandLines, CommandLineDescription, ModuleType, ExtendedModule, Action } from '@tramvai/core';
|
|
3
|
+
export interface ChildApp {
|
|
4
|
+
name: string;
|
|
5
|
+
modules?: (ModuleType | ExtendedModule)[];
|
|
6
|
+
actions?: Action[];
|
|
7
|
+
providers: Provider[];
|
|
8
|
+
}
|
|
9
|
+
export interface ChildAppRequestConfig {
|
|
10
|
+
name: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
tag?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ChildAppExternalConfig {
|
|
15
|
+
server: {
|
|
16
|
+
entry: string;
|
|
17
|
+
};
|
|
18
|
+
client: {
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
entry: string;
|
|
21
|
+
};
|
|
22
|
+
css?: {
|
|
23
|
+
entry?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ChildAppReactConfig extends ChildAppRequestConfig {
|
|
27
|
+
props?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
export interface ResolutionConfig extends Partial<ChildAppExternalConfig> {
|
|
30
|
+
version: string;
|
|
31
|
+
withoutCss?: boolean;
|
|
32
|
+
baseUrl?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ChildAppResolutionConfig {
|
|
35
|
+
name: string;
|
|
36
|
+
byTag: {
|
|
37
|
+
latest: ResolutionConfig;
|
|
38
|
+
[key: string]: ResolutionConfig;
|
|
39
|
+
};
|
|
40
|
+
baseUrl?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ChildAppFinalConfig extends Required<ChildAppRequestConfig>, ChildAppExternalConfig {
|
|
43
|
+
key: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ChildAppPreloadManager {
|
|
46
|
+
preload(config: ChildAppRequestConfig): Promise<void>;
|
|
47
|
+
isPreloaded(config: ChildAppRequestConfig): boolean;
|
|
48
|
+
runPreloaded(): Promise<void>;
|
|
49
|
+
clearPreloaded(): Promise<void>;
|
|
50
|
+
getPreloadedList(): ChildAppRequestConfig[];
|
|
51
|
+
}
|
|
52
|
+
export interface ChildAppRenderManager {
|
|
53
|
+
getChildDi(request: ChildAppRequestConfig): [Container | null, Promise<Container | null> | null];
|
|
54
|
+
flush(): Promise<boolean>;
|
|
55
|
+
clear(): void;
|
|
56
|
+
}
|
|
57
|
+
export interface ChildAppLoader {
|
|
58
|
+
load(config: ChildAppFinalConfig): Promise<ChildApp | void>;
|
|
59
|
+
get(config: ChildAppFinalConfig): ChildApp | void;
|
|
60
|
+
init(config: ChildAppFinalConfig): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export interface ChildAppStateManager {
|
|
63
|
+
registerChildApp(config: ChildAppFinalConfig): void;
|
|
64
|
+
getState(): any;
|
|
65
|
+
}
|
|
66
|
+
export interface ChildAppDiManager {
|
|
67
|
+
getChildDi(config: ChildAppFinalConfig): Container | null;
|
|
68
|
+
forEachChildDi(callback: (di: Container) => void): void;
|
|
69
|
+
}
|
|
70
|
+
export interface ChildAppCommandLineRunner {
|
|
71
|
+
run(type: keyof CommandLines, status: keyof CommandLineDescription, config: ChildAppFinalConfig): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export interface WrapperProps<T> {
|
|
74
|
+
di: Container;
|
|
75
|
+
props: T;
|
|
76
|
+
}
|
|
77
|
+
declare type Store = {
|
|
78
|
+
storeName: string;
|
|
79
|
+
} | string;
|
|
80
|
+
declare type OptionalStore = {
|
|
81
|
+
store: Store;
|
|
82
|
+
optional?: boolean;
|
|
83
|
+
};
|
|
84
|
+
export interface RootStateSubscription {
|
|
85
|
+
stores: Array<Store | OptionalStore>;
|
|
86
|
+
listener: (state: Record<string, any>) => void | Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tramvai/tokens-child-app",
|
|
3
|
+
"version": "1.46.5",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib"
|
|
9
|
+
],
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git@github.com:TinkoffCreditSystems/tramvai.git"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tramvai-build --for-publish",
|
|
17
|
+
"watch": "tsc -w",
|
|
18
|
+
"build-for-publish": "true"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"registry": "https://registry.npmjs.org/"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@tinkoff/dippy": "0.7.36",
|
|
25
|
+
"@tramvai/core": "1.46.5",
|
|
26
|
+
"@tramvai/tokens-common": "1.46.5",
|
|
27
|
+
"react": ">=16.8.0"
|
|
28
|
+
},
|
|
29
|
+
"module": "lib/index.es.js"
|
|
30
|
+
}
|