pwi-plata-type 0.4.107 → 0.4.108

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pwi-plata-type",
3
- "version": "0.4.107",
3
+ "version": "0.4.108",
4
4
  "main": "__BUILD__/index",
5
5
  "types": "src/@types/exported.d.ts",
6
6
  "bin": {
@@ -1,7 +1,26 @@
1
+ interface PlataProcess extends Cluster.PlataEvents {}
2
+
1
3
  declare namespace Cluster {
2
- type GetActions<T extends Dictionary<any>> = {
3
- [K in keyof T]: { action: K, msg: T[K] }
4
- }[keyof T]
4
+ type GetActionsObject<T extends Dictionary<any>> = {
5
+ [K in keyof T]: { action: K, msg: T[K] }
6
+ }
7
+
8
+ type GetActions<T extends Dictionary<any>> = GetActionsObject<T>[keyof T]
9
+
10
+ type GetEmitFuncionsArgs<T extends Dictionary<any>> = {
11
+ [K in keyof T]: [event: K, response: T[K]]
12
+ }[keyof T]
13
+
14
+ type GetOnFuncionsArgs<T extends Dictionary<any>> = {
15
+ [K in keyof T]: [event: K, listener: (r: T[K]) => void | Promise<void>]
16
+ }[keyof T]
17
+
18
+
19
+ interface PlataEvents {
20
+ emit(...args: GetEmitFuncionsArgs<PlataClusterActions> | GetActions<UserClusterActions>)
21
+ on(...args: GetOnFuncionsArgs<PlataClusterActions> | GetOnFuncionsArgs<UserClusterActions>)
22
+ once(...args: GetOnFuncionsArgs<PlataClusterActions> | GetOnFuncionsArgs<UserClusterActions>)
23
+ }
5
24
 
6
25
  type Actions = GetActions<PlataClusterActions> | GetActions<UserClusterActions>
7
26
  }
@@ -47,6 +47,10 @@ type RemovePlataResultOnPromiseAll<T> =
47
47
 
48
48
  interface PlataRuntime {}
49
49
 
50
+ interface PlataProcess {
51
+
52
+ }
53
+
50
54
  interface Plata extends PlataRuntime {
51
55
  cluster: {
52
56
  isPrimary: true,
@@ -66,6 +70,8 @@ interface Plata extends PlataRuntime {
66
70
 
67
71
  declare const Plata: Plata
68
72
 
73
+ declare const process: NodeJS.Process & PlataProcess
74
+
69
75
  interface EnvConfig {
70
76
  env: PlataEnv
71
77
  }
@@ -10,7 +10,7 @@
10
10
  "resolveJsonModule": true,
11
11
  "strictNullChecks": true,
12
12
  "sourceMap": true,
13
- "types": [ "node", "pwi-plata-type" ],
13
+ "types": [ "pwi-plata-type", "node" ],
14
14
  "noEmit": true,
15
15
  "skipLibCheck": true,
16
16
  "forceConsistentCasingInFileNames": true,