@tramvai/tokens-core 3.21.0 → 3.24.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/command.d.ts CHANGED
@@ -16,33 +16,80 @@ export declare const COMMAND_LINES_TOKEN: CommandLines & {
16
16
  __type?: "base token" | undefined;
17
17
  };
18
18
  export declare const commandLineListTokens: {
19
+ /**
20
+ * @server Singleton services initialization (e.g. app server creation)
21
+ * @browser First stage after `platform.js` loaded and executed (prefer fast and synchronous actions, critical for earlier initialization)
22
+ * @scope Singleton
23
+ */
19
24
  init: Command & {
20
25
  __type?: "multi token" | undefined;
21
26
  };
27
+ /**
28
+ * @server Singleton services running (e.g. app server start)
29
+ * @browser Useful for usage in browser environment (first place where customer lines will be executed)
30
+ * @scope Singleton
31
+ */
22
32
  listen: Command & {
23
33
  __type?: "multi token" | undefined;
24
34
  };
35
+ /**
36
+ * @server First stage of client request processing (prefer fast and synchronous actions, critical for next stages)
37
+ * @browser Stage for any actions which should be executed only once in browser session (client router will be hydrated here)
38
+ * @scope Request
39
+ */
25
40
  customerStart: Command & {
26
41
  __type?: "multi token" | undefined;
27
42
  };
43
+ /**
44
+ * @server Stage for resolving user info (e.g. authentication, and current router.navigate for current url will be executed here)
45
+ * @browser Stage for for resolving user info, will be executed at page initialization and for SPA-navigations
46
+ * @scope Request
47
+ */
28
48
  resolveUserDeps: Command & {
29
49
  __type?: "multi token" | undefined;
30
50
  };
51
+ /**
52
+ * @server Stage for resolving page data (page actions will be executed here)
53
+ * @browser Stage for for resolving page data, will be executed at page initialization and for SPA-navigations
54
+ * @scope Request
55
+ */
31
56
  resolvePageDeps: Command & {
32
57
  __type?: "multi token" | undefined;
33
58
  };
59
+ /**
60
+ * @server Stage when all data is ready (page HTML will be generated here)
61
+ * @browser Will be executed only once at page initialization (app HTML will be hydrated here)
62
+ * @scope Request
63
+ */
34
64
  generatePage: Command & {
35
65
  __type?: "multi token" | undefined;
36
66
  };
67
+ /**
68
+ * @server Stage when all data is ready (page HTML will be generated here)
69
+ * @browser Stage for any actions which should be executed after hydration (e.g. state modification, unfinished and `browserOnly` page actions will be executed here)
70
+ * @scope Request
71
+ */
37
72
  clear: Command & {
38
73
  __type?: "multi token" | undefined;
39
74
  };
75
+ /**
76
+ * @browser Stage when SPA-transition started (if `ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN` are changed to `before`, next page actions will be executed here)
77
+ * @scope Request
78
+ */
40
79
  spaTransition: Command & {
41
80
  __type?: "multi token" | undefined;
42
81
  };
82
+ /**
83
+ * @browser Stage after SPA-transition is finished (by default, next page actions will be executed here)
84
+ * @scope Request
85
+ */
43
86
  afterSpaTransition: Command & {
44
87
  __type?: "multi token" | undefined;
45
88
  };
89
+ /**
90
+ * @server Singleton services cleanup (e.g. app server close)
91
+ * @scope Singleton
92
+ */
46
93
  close: Command & {
47
94
  __type?: "multi token" | undefined;
48
95
  };
package/lib/command.es.js CHANGED
@@ -1,23 +1,70 @@
1
- import { createToken } from '@tinkoff/dippy';
1
+ import { createToken, Scope } from '@tinkoff/dippy';
2
2
 
3
3
  const multiOptions = { multi: true };
4
4
  const COMMAND_LINE_RUNNER_TOKEN = createToken('commandLineRunner');
5
5
  const COMMAND_LINES_TOKEN = createToken('commandLines');
6
6
  const commandLineListTokens = {
7
7
  // Block: Initializing
8
- init: createToken('init', multiOptions),
9
- listen: createToken('listen', multiOptions),
8
+ /**
9
+ * @server Singleton services initialization (e.g. app server creation)
10
+ * @browser First stage after `platform.js` loaded and executed (prefer fast and synchronous actions, critical for earlier initialization)
11
+ * @scope Singleton
12
+ */
13
+ init: createToken('init', { multi: true, scope: Scope.SINGLETON }),
14
+ /**
15
+ * @server Singleton services running (e.g. app server start)
16
+ * @browser Useful for usage in browser environment (first place where customer lines will be executed)
17
+ * @scope Singleton
18
+ */
19
+ listen: createToken('listen', { multi: true, scope: Scope.SINGLETON }),
10
20
  // Block: Request handling
21
+ /**
22
+ * @server First stage of client request processing (prefer fast and synchronous actions, critical for next stages)
23
+ * @browser Stage for any actions which should be executed only once in browser session (client router will be hydrated here)
24
+ * @scope Request
25
+ */
11
26
  customerStart: createToken('customer_start', multiOptions),
27
+ /**
28
+ * @server Stage for resolving user info (e.g. authentication, and current router.navigate for current url will be executed here)
29
+ * @browser Stage for for resolving user info, will be executed at page initialization and for SPA-navigations
30
+ * @scope Request
31
+ */
12
32
  resolveUserDeps: createToken('resolve_user_deps', multiOptions),
33
+ /**
34
+ * @server Stage for resolving page data (page actions will be executed here)
35
+ * @browser Stage for for resolving page data, will be executed at page initialization and for SPA-navigations
36
+ * @scope Request
37
+ */
13
38
  resolvePageDeps: createToken('resolve_page_deps', multiOptions),
39
+ /**
40
+ * @server Stage when all data is ready (page HTML will be generated here)
41
+ * @browser Will be executed only once at page initialization (app HTML will be hydrated here)
42
+ * @scope Request
43
+ */
14
44
  generatePage: createToken('generate_page', multiOptions),
45
+ /**
46
+ * @server Stage when all data is ready (page HTML will be generated here)
47
+ * @browser Stage for any actions which should be executed after hydration (e.g. state modification, unfinished and `browserOnly` page actions will be executed here)
48
+ * @scope Request
49
+ */
15
50
  clear: createToken('clear', multiOptions),
16
51
  // Block: Client navigations
52
+ /**
53
+ * @browser Stage when SPA-transition started (if `ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN` are changed to `before`, next page actions will be executed here)
54
+ * @scope Request
55
+ */
17
56
  spaTransition: createToken('spa_transition', multiOptions),
57
+ /**
58
+ * @browser Stage after SPA-transition is finished (by default, next page actions will be executed here)
59
+ * @scope Request
60
+ */
18
61
  afterSpaTransition: createToken('after_spa_transition', multiOptions),
19
62
  // Block: Server stop
20
- close: createToken('close', multiOptions),
63
+ /**
64
+ * @server Singleton services cleanup (e.g. app server close)
65
+ * @scope Singleton
66
+ */
67
+ close: createToken('close', { multi: true, scope: Scope.SINGLETON }),
21
68
  };
22
69
 
23
70
  export { COMMAND_LINES_TOKEN, COMMAND_LINE_RUNNER_TOKEN, commandLineListTokens };
package/lib/command.js CHANGED
@@ -9,19 +9,66 @@ const COMMAND_LINE_RUNNER_TOKEN = dippy.createToken('commandLineRunner');
9
9
  const COMMAND_LINES_TOKEN = dippy.createToken('commandLines');
10
10
  const commandLineListTokens = {
11
11
  // Block: Initializing
12
- init: dippy.createToken('init', multiOptions),
13
- listen: dippy.createToken('listen', multiOptions),
12
+ /**
13
+ * @server Singleton services initialization (e.g. app server creation)
14
+ * @browser First stage after `platform.js` loaded and executed (prefer fast and synchronous actions, critical for earlier initialization)
15
+ * @scope Singleton
16
+ */
17
+ init: dippy.createToken('init', { multi: true, scope: dippy.Scope.SINGLETON }),
18
+ /**
19
+ * @server Singleton services running (e.g. app server start)
20
+ * @browser Useful for usage in browser environment (first place where customer lines will be executed)
21
+ * @scope Singleton
22
+ */
23
+ listen: dippy.createToken('listen', { multi: true, scope: dippy.Scope.SINGLETON }),
14
24
  // Block: Request handling
25
+ /**
26
+ * @server First stage of client request processing (prefer fast and synchronous actions, critical for next stages)
27
+ * @browser Stage for any actions which should be executed only once in browser session (client router will be hydrated here)
28
+ * @scope Request
29
+ */
15
30
  customerStart: dippy.createToken('customer_start', multiOptions),
31
+ /**
32
+ * @server Stage for resolving user info (e.g. authentication, and current router.navigate for current url will be executed here)
33
+ * @browser Stage for for resolving user info, will be executed at page initialization and for SPA-navigations
34
+ * @scope Request
35
+ */
16
36
  resolveUserDeps: dippy.createToken('resolve_user_deps', multiOptions),
37
+ /**
38
+ * @server Stage for resolving page data (page actions will be executed here)
39
+ * @browser Stage for for resolving page data, will be executed at page initialization and for SPA-navigations
40
+ * @scope Request
41
+ */
17
42
  resolvePageDeps: dippy.createToken('resolve_page_deps', multiOptions),
43
+ /**
44
+ * @server Stage when all data is ready (page HTML will be generated here)
45
+ * @browser Will be executed only once at page initialization (app HTML will be hydrated here)
46
+ * @scope Request
47
+ */
18
48
  generatePage: dippy.createToken('generate_page', multiOptions),
49
+ /**
50
+ * @server Stage when all data is ready (page HTML will be generated here)
51
+ * @browser Stage for any actions which should be executed after hydration (e.g. state modification, unfinished and `browserOnly` page actions will be executed here)
52
+ * @scope Request
53
+ */
19
54
  clear: dippy.createToken('clear', multiOptions),
20
55
  // Block: Client navigations
56
+ /**
57
+ * @browser Stage when SPA-transition started (if `ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN` are changed to `before`, next page actions will be executed here)
58
+ * @scope Request
59
+ */
21
60
  spaTransition: dippy.createToken('spa_transition', multiOptions),
61
+ /**
62
+ * @browser Stage after SPA-transition is finished (by default, next page actions will be executed here)
63
+ * @scope Request
64
+ */
22
65
  afterSpaTransition: dippy.createToken('after_spa_transition', multiOptions),
23
66
  // Block: Server stop
24
- close: dippy.createToken('close', multiOptions),
67
+ /**
68
+ * @server Singleton services cleanup (e.g. app server close)
69
+ * @scope Singleton
70
+ */
71
+ close: dippy.createToken('close', { multi: true, scope: dippy.Scope.SINGLETON }),
25
72
  };
26
73
 
27
74
  exports.COMMAND_LINES_TOKEN = COMMAND_LINES_TOKEN;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-core",
3
- "version": "3.21.0",
3
+ "version": "3.24.0",
4
4
  "description": "Tramvai core tokens",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -18,10 +18,10 @@
18
18
  "watch": "tsc -w"
19
19
  },
20
20
  "dependencies": {
21
- "@tramvai/types-actions-state-context": "3.21.0"
21
+ "@tramvai/types-actions-state-context": "3.24.0"
22
22
  },
23
23
  "peerDependencies": {
24
- "@tinkoff/dippy": "0.9.1",
24
+ "@tinkoff/dippy": "0.9.2",
25
25
  "tslib": "^2.4.0"
26
26
  },
27
27
  "license": "Apache-2.0"