1 |
|
2 |
|
3 | /**
|
4 | * Command execution context, it is available for {@link
|
5 | * rpc.clientRequests} hooks.
|
6 | *
|
7 | * @see chat-service.hooks.CommandsHooks
|
8 | * @memberof chat-service
|
9 | * @interface
|
10 | */
|
11 | class ExecInfo {
|
12 | /**
|
13 | * Service instance.
|
14 | * @name chat-service.ExecInfo#server
|
15 | * @type ChatService
|
16 | */
|
17 |
|
18 | /**
|
19 | * User name.
|
20 | * @name chat-service.ExecInfo#userName
|
21 | * @type string|null
|
22 | */
|
23 |
|
24 | /**
|
25 | * Socket id.
|
26 | * @name chat-service.ExecInfo#id
|
27 | * @type string|null
|
28 | */
|
29 |
|
30 | /**
|
31 | * Bypass permissions.
|
32 | * @name chat-service.ExecInfo#bypassPermissions
|
33 | * @type boolean
|
34 | * @default false
|
35 | * @see chat-service.ServiceAPI#execUserCommand
|
36 | */
|
37 |
|
38 | /**
|
39 | * If command is executed from a server side.
|
40 | * @name chat-service.ExecInfo#isLocalCall
|
41 | * @type boolean
|
42 | * @default false
|
43 | * @see chat-service.ServiceAPI#execUserCommand
|
44 | */
|
45 |
|
46 | /**
|
47 | * Don't call command hooks if `true`.
|
48 | * @name chat-service.ExecInfo#bypassHooks
|
49 | * @type boolean
|
50 | * @default false
|
51 | * @see chat-service.ServiceAPI#execUserCommand
|
52 | */
|
53 |
|
54 | /**
|
55 | * Command's error.
|
56 | * @name chat-service.ExecInfo#error
|
57 | * @type Error|null
|
58 | * @default null
|
59 | */
|
60 |
|
61 | /**
|
62 | * Command's results.
|
63 | * @name chat-service.ExecInfo#results
|
64 | * @type {Array<Object>}
|
65 | * @default null
|
66 | */
|
67 |
|
68 | /**
|
69 | * Command's arguments.
|
70 | * @name chat-service.ExecInfo#args
|
71 | * @type {Array<Object>}
|
72 | * @default []
|
73 | */
|
74 |
|
75 | /**
|
76 | * Additional arguments, passed after command arguments. Can be used
|
77 | * as additional hooks parameters.
|
78 | * @name chat-service.ExecInfo#restArgs
|
79 | * @type {Array<Object>}
|
80 | * @default []
|
81 | */
|
82 |
|
83 | /**
|
84 | * Custom data set by hooks.
|
85 | * @name chat-service.ExecInfo#data
|
86 | * @type {Object}
|
87 | * @default {}
|
88 | */
|
89 |
|
90 | constructor () {
|
91 | this.args = []
|
92 | this.bypassHooks = false
|
93 | this.bypassPermissions = null
|
94 | this.data = {}
|
95 | this.error = null
|
96 | this.id = null
|
97 | this.isLocalCall = false
|
98 | this.restArgs = []
|
99 | this.results = null
|
100 | this.server = null
|
101 | this.userName = null
|
102 | }
|
103 |
|
104 | }
|
105 |
|
106 | module.exports = ExecInfo
|