Sfoglia il codice sorgente

automate documentation

master
Daniel Hübleitner 5 anni fa
parent
commit
387aa3f8eb

+ 56
- 1
.drone.yml Vedi File

@@ -2,6 +2,16 @@ kind: pipeline
2 2
 name: default
3 3
 
4 4
 steps:
5
+- name: restore cache
6
+  image: drillster/drone-volume-cache
7
+  settings:
8
+    restore: true
9
+    mount:
10
+      - ./node_modules
11
+  volumes:
12
+  - name: cache
13
+    path: /cache
14
+
5 15
 - name: npm install
6 16
   image: node:12
7 17
   commands:
@@ -12,11 +22,52 @@ steps:
12 22
   commands:
13 23
   - npm run build
14 24
 
25
+- name: rebuild cache
26
+  image: drillster/drone-volume-cache
27
+  settings:
28
+    rebuild: true
29
+    mount:
30
+      - ./node_modules
31
+  volumes:
32
+  - name: cache
33
+    path: /cache
34
+
35
+- name: show tag
36
+  image: alpine
37
+  commands:
38
+    - echo ${DRONE_BUILD_CREATED}
39
+
15 40
 - name: npm run test
16 41
   image: node:12
17 42
   commands:
18 43
   - npm run test
19 44
 
45
+- name: npm run docs
46
+  image: node:12
47
+  commands:
48
+  - npm run docs
49
+
50
+- name: git checkin docs
51
+  image: node:12
52
+  commands:
53
+  - git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
54
+  - git config --global user.name "${DRONE_COMMIT_AUTHOR}"
55
+  - git clone https://gitea.frontblock.me/fw-vendor/${DRONE_REPO_NAME}.git
56
+  - rm -rf ./${DRONE_REPO_NAME}/docs/*
57
+  - cp -r ./docs/* ./${DRONE_REPO_NAME}/docs
58
+  - ls ./${DRONE_REPO_NAME}
59
+  - cd ./${DRONE_REPO_NAME}
60
+  - git add -A
61
+  - git commit --allow-empty -m "drone tagged as version ${DRONE_BUILD_CREATED}"
62
+  - git tag ${DRONE_BUILD_CREATED}
63
+  - git status
64
+  - git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fw-vendor/${DRONE_REPO_NAME}.git master ${DRONE_BUILD_CREATED}
65
+  environment:
66
+    GIT_USER:
67
+      from_secret: git_user
68
+    GIT_PASSWORD:
69
+      from_secret: git_password
70
+
20 71
 - name: npm publish
21 72
   image: plugins/npm
22 73
   settings:
@@ -24,4 +75,8 @@ steps:
24 75
     password:
25 76
       from_secret: npm_password
26 77
     email: frontwork.me@gmail.com
27
-  
78
+  
79
+volumes:
80
+- name: cache 
81
+  host:
82
+    path: /tmp

+ 1
- 0
.gitignore Vedi File

@@ -1,5 +1,6 @@
1 1
 node_modules
2 2
 js
3
+docs
3 4
 
4 5
 src/**/*.js
5 6
 src/**/*.d.ts

+ 2
- 1
README.md Vedi File

@@ -1 +1,2 @@
1
-test test test 
1
+# Documentation
2
+docs [https://gitea.frontblock.me/fw-vendor/rpclibrary/src/branch/master/docs/README.md]

+ 0
- 5
docs/README.md Vedi File

@@ -1,5 +0,0 @@
1
-[rpclibrary](README.md) › [Globals](globals.md)
2
-
3
-# rpclibrary
4
-
5
-test test test

+ 0
- 166
docs/classes/_backend_.rpcserver.md Vedi File

@@ -1,166 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Backend"](../modules/_backend_.md) › [RPCServer](_backend_.rpcserver.md)
2
-
3
-# Class: RPCServer <**SubResType**>
4
-
5
-A Websocket-server-on-steroids with built-in RPC capabilities
6
-
7
-## Type parameters
8
-
9
-▪ **SubResType**
10
-
11
-## Hierarchy
12
-
13
-* **RPCServer**
14
-
15
-## Implements
16
-
17
-* [Destroyable](../interfaces/_interfaces_.destroyable.md)
18
-
19
-## Index
20
-
21
-### Constructors
22
-
23
-* [constructor](_backend_.rpcserver.md#constructor)
24
-
25
-### Properties
26
-
27
-* [closeHandler](_backend_.rpcserver.md#private-closehandler)
28
-* [connectionHandler](_backend_.rpcserver.md#private-connectionhandler)
29
-* [errorHandler](_backend_.rpcserver.md#private-errorhandler)
30
-* [exporters](_backend_.rpcserver.md#private-exporters)
31
-* [io](_backend_.rpcserver.md#private-io)
32
-* [port](_backend_.rpcserver.md#private-port)
33
-* [visibility](_backend_.rpcserver.md#private-visibility)
34
-* [ws](_backend_.rpcserver.md#private-ws)
35
-
36
-### Methods
37
-
38
-* [destroy](_backend_.rpcserver.md#destroy)
39
-* [initRPCs](_backend_.rpcserver.md#protected-initrpcs)
40
-* [startWebsocket](_backend_.rpcserver.md#private-startwebsocket)
41
-
42
-## Constructors
43
-
44
-###  constructor
45
-
46
-\+ **new RPCServer**(`port`: number, `exporters`: [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResType›[], `conf`: T.SocketConf): *[RPCServer](_backend_.rpcserver.md)*
47
-
48
-Defined in Backend.ts:22
49
-
50
-**`throws`** On RPC with no name
51
-
52
-**Parameters:**
53
-
54
-Name | Type | Default | Description |
55
------- | ------ | ------ | ------ |
56
-`port` | number | - | The port to listen on |
57
-`exporters` | [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResType›[] |  [] | A list of [RPCExporter](../interfaces/_interfaces_.rpcexporter.md) to publish |
58
-`conf` | T.SocketConf |   {} | A [SocketConf](../modules/_types_.md#socketconf) object with optional settings  |
59
-
60
-**Returns:** *[RPCServer](_backend_.rpcserver.md)*
61
-
62
-## Properties
63
-
64
-### `Private` closeHandler
65
-
66
-• **closeHandler**: *T.CloseHandler*
67
-
68
-Defined in Backend.ts:20
69
-
70
-___
71
-
72
-### `Private` connectionHandler
73
-
74
-• **connectionHandler**: *T.ConnectionHandler*
75
-
76
-Defined in Backend.ts:22
77
-
78
-___
79
-
80
-### `Private` errorHandler
81
-
82
-• **errorHandler**: *T.ErrorHandler*
83
-
84
-Defined in Backend.ts:21
85
-
86
-___
87
-
88
-### `Private` exporters
89
-
90
-• **exporters**: *[RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResType›[]*
91
-
92
-Defined in Backend.ts:32
93
-
94
-A list of [RPCExporter](../interfaces/_interfaces_.rpcexporter.md) to publish
95
-
96
-___
97
-
98
-### `Private` io
99
-
100
-• **io**: *any* =  bsock.createServer()
101
-
102
-Defined in Backend.ts:18
103
-
104
-___
105
-
106
-### `Private` port
107
-
108
-• **port**: *number*
109
-
110
-Defined in Backend.ts:31
111
-
112
-The port to listen on
113
-
114
-___
115
-
116
-### `Private` visibility
117
-
118
-• **visibility**: *T.Visibility*
119
-
120
-Defined in Backend.ts:19
121
-
122
-___
123
-
124
-### `Private` ws
125
-
126
-• **ws**: *Server* =  http.createServer()
127
-
128
-Defined in Backend.ts:17
129
-
130
-## Methods
131
-
132
-###  destroy
133
-
134
-▸ **destroy**(): *Promise‹void›*
135
-
136
-*Implementation of [Destroyable](../interfaces/_interfaces_.destroyable.md)*
137
-
138
-Defined in Backend.ts:89
139
-
140
-**Returns:** *Promise‹void›*
141
-
142
-___
143
-
144
-### `Protected` initRPCs
145
-
146
-▸ **initRPCs**(`socket`: [Socket](../interfaces/_interfaces_.socket.md)): *void*
147
-
148
-Defined in Backend.ts:82
149
-
150
-**Parameters:**
151
-
152
-Name | Type |
153
------- | ------ |
154
-`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
155
-
156
-**Returns:** *void*
157
-
158
-___
159
-
160
-### `Private` startWebsocket
161
-
162
-▸ **startWebsocket**(): *void*
163
-
164
-Defined in Backend.ts:66
165
-
166
-**Returns:** *void*

+ 0
- 304
docs/classes/_frontend_.rpcsocket.md Vedi File

@@ -1,304 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Frontend"](../modules/_frontend_.md) › [RPCSocket](_frontend_.rpcsocket.md)
2
-
3
-# Class: RPCSocket
4
-
5
-A websocket-on-steroids with built-in RPC capabilities
6
-
7
-## Hierarchy
8
-
9
-* **RPCSocket**
10
-
11
-## Implements
12
-
13
-* [Socket](../interfaces/_interfaces_.socket.md)
14
-
15
-## Index
16
-
17
-### Constructors
18
-
19
-* [constructor](_frontend_.rpcsocket.md#constructor)
20
-
21
-### Properties
22
-
23
-* [port](_frontend_.rpcsocket.md#port)
24
-* [server](_frontend_.rpcsocket.md#private-server)
25
-* [socket](_frontend_.rpcsocket.md#private-socket)
26
-* [tls](_frontend_.rpcsocket.md#private-tls)
27
-
28
-### Methods
29
-
30
-* [call](_frontend_.rpcsocket.md#call)
31
-* [callGenerator](_frontend_.rpcsocket.md#private-callgenerator)
32
-* [close](_frontend_.rpcsocket.md#close)
33
-* [connect](_frontend_.rpcsocket.md#connect)
34
-* [destroy](_frontend_.rpcsocket.md#destroy)
35
-* [fire](_frontend_.rpcsocket.md#fire)
36
-* [hook](_frontend_.rpcsocket.md#hook)
37
-* [hookGenerator](_frontend_.rpcsocket.md#private-hookgenerator)
38
-* [info](_frontend_.rpcsocket.md#info)
39
-* [on](_frontend_.rpcsocket.md#on)
40
-* [unhook](_frontend_.rpcsocket.md#unhook)
41
-
42
-## Constructors
43
-
44
-###  constructor
45
-
46
-\+ **new RPCSocket**(`port`: number, `server`: string, `tls`: boolean): *[RPCSocket](_frontend_.rpcsocket.md)*
47
-
48
-Defined in Frontend.ts:20
49
-
50
-**Parameters:**
51
-
52
-Name | Type | Default | Description |
53
------- | ------ | ------ | ------ |
54
-`port` | number | - | Port to connect to |
55
-`server` | string | - | Server address |
56
-`tls` | boolean | false | @default false use TLS  |
57
-
58
-**Returns:** *[RPCSocket](_frontend_.rpcsocket.md)*
59
-
60
-## Properties
61
-
62
-###  port
63
-
64
-• **port**: *number*
65
-
66
-*Implementation of [Socket](../interfaces/_interfaces_.socket.md).[port](../interfaces/_interfaces_.socket.md#port)*
67
-
68
-Defined in Frontend.ts:28
69
-
70
-Port to connect to
71
-
72
-___
73
-
74
-### `Private` server
75
-
76
-• **server**: *string*
77
-
78
-Defined in Frontend.ts:28
79
-
80
-Server address
81
-
82
-___
83
-
84
-### `Private` socket
85
-
86
-• **socket**: *[Socket](../interfaces/_interfaces_.socket.md)*
87
-
88
-Defined in Frontend.ts:20
89
-
90
-___
91
-
92
-### `Private` tls
93
-
94
-• **tls**: *boolean*
95
-
96
-Defined in Frontend.ts:28
97
-
98
-@default false use TLS
99
-
100
-## Methods
101
-
102
-###  call
103
-
104
-▸ **call**(`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹T.Any›*
105
-
106
-Defined in Frontend.ts:77
107
-
108
-Trigger a hooked handler on the server
109
-
110
-**Parameters:**
111
-
112
-Name | Type | Description |
113
------- | ------ | ------ |
114
-`rpcname` | T.Name | The function to call |
115
-`...args` | T.Any[] | other arguments  |
116
-
117
-**Returns:** *Promise‹T.Any›*
118
-
119
-___
120
-
121
-### `Private` callGenerator
122
-
123
-▸ **callGenerator**(`fnName`: T.Name, `fnArgs`: T.Arg[]): *T.AsyncFunction*
124
-
125
-Defined in Frontend.ts:126
126
-
127
-Utility [AsyncFunction](../modules/_types_.md#asyncfunction) generator
128
-
129
-**Parameters:**
130
-
131
-Name | Type | Description |
132
------- | ------ | ------ |
133
-`fnName` | T.Name | The function name |
134
-`fnArgs` | T.Arg[] | A string-list of parameters  |
135
-
136
-**Returns:** *T.AsyncFunction*
137
-
138
-___
139
-
140
-###  close
141
-
142
-▸ **close**(): *void*
143
-
144
-*Implementation of [Socket](../interfaces/_interfaces_.socket.md)*
145
-
146
-Defined in Frontend.ts:68
147
-
148
-Closes the socket. It may attempt to reconnect.
149
-
150
-**Returns:** *void*
151
-
152
-___
153
-
154
-###  connect
155
-
156
-▸ **connect**(): *Promise‹void›*
157
-
158
-Defined in Frontend.ts:93
159
-
160
-Connects to the server and attaches available RPCs to this object
161
-
162
-**Returns:** *Promise‹void›*
163
-
164
-___
165
-
166
-###  destroy
167
-
168
-▸ **destroy**(): *void*
169
-
170
-*Implementation of [Socket](../interfaces/_interfaces_.socket.md)*
171
-
172
-Defined in Frontend.ts:61
173
-
174
-Destroys the socket
175
-
176
-**Returns:** *void*
177
-
178
-___
179
-
180
-###  fire
181
-
182
-▸ **fire**(`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹void›*
183
-
184
-Defined in Frontend.ts:86
185
-
186
-An alternative to call that does not wait for confirmation and doesn't return a value.
187
-
188
-**Parameters:**
189
-
190
-Name | Type | Description |
191
------- | ------ | ------ |
192
-`rpcname` | T.Name | The function to call |
193
-`...args` | T.Any[] | other arguments  |
194
-
195
-**Returns:** *Promise‹void›*
196
-
197
-___
198
-
199
-###  hook
200
-
201
-▸ **hook**(`name`: T.Name, `handler`: function): *[Socket](../interfaces/_interfaces_.socket.md)*
202
-
203
-Defined in Frontend.ts:37
204
-
205
-Hooks a handler to a function name. Use [call](_frontend_.rpcsocket.md#call) to trigger it.
206
-
207
-**Parameters:**
208
-
209
-▪ **name**: *T.Name*
210
-
211
-The function name to listen on
212
-
213
-▪ **handler**: *function*
214
-
215
-The handler to attach
216
-
217
-▸ (...`args`: any[]): *any | Promise‹any›*
218
-
219
-**Parameters:**
220
-
221
-Name | Type |
222
------- | ------ |
223
-`...args` | any[] |
224
-
225
-**Returns:** *[Socket](../interfaces/_interfaces_.socket.md)*
226
-
227
-___
228
-
229
-### `Private` hookGenerator
230
-
231
-▸ **hookGenerator**(`fnName`: T.Name, `fnArgs`: T.Arg[]): *T.HookFunction*
232
-
233
-Defined in Frontend.ts:137
234
-
235
-Utility [HookFunction](../modules/_types_.md#hookfunction) generator
236
-
237
-**Parameters:**
238
-
239
-Name | Type | Description |
240
------- | ------ | ------ |
241
-`fnName` | T.Name | The function name |
242
-`fnArgs` | T.Arg[] | A string-list of parameters  |
243
-
244
-**Returns:** *T.HookFunction*
245
-
246
-___
247
-
248
-###  info
249
-
250
-▸ **info**(): *Promise‹any›*
251
-
252
-Defined in Frontend.ts:117
253
-
254
-Get a list of available RPCs from the server
255
-
256
-**Returns:** *Promise‹any›*
257
-
258
-___
259
-
260
-###  on
261
-
262
-▸ **on**(`type`: "error" | "close", `f`: function): *[Socket](../interfaces/_interfaces_.socket.md)*
263
-
264
-Defined in Frontend.ts:54
265
-
266
-Attach a listener to error or close events
267
-
268
-**Parameters:**
269
-
270
-▪ **type**: *"error" | "close"*
271
-
272
-'error' or 'close'
273
-
274
-▪ **f**: *function*
275
-
276
-The listener to attach
277
-
278
-▸ (`e?`: any): *void*
279
-
280
-**Parameters:**
281
-
282
-Name | Type |
283
------- | ------ |
284
-`e?` | any |
285
-
286
-**Returns:** *[Socket](../interfaces/_interfaces_.socket.md)*
287
-
288
-___
289
-
290
-###  unhook
291
-
292
-▸ **unhook**(`name`: T.Name): *[Socket](../interfaces/_interfaces_.socket.md)*
293
-
294
-Defined in Frontend.ts:45
295
-
296
-Removes a [hook](_frontend_.rpcsocket.md#hook) listener by name.
297
-
298
-**Parameters:**
299
-
300
-Name | Type | Description |
301
------- | ------ | ------ |
302
-`name` | T.Name | The function name  |
303
-
304
-**Returns:** *[Socket](../interfaces/_interfaces_.socket.md)*

+ 0
- 13
docs/globals.md Vedi File

@@ -1,13 +0,0 @@
1
-[rpclibrary](README.md) › [Globals](globals.md)
2
-
3
-# rpclibrary
4
-
5
-## Index
6
-
7
-### External modules
8
-
9
-* ["Backend"](modules/_backend_.md)
10
-* ["Frontend"](modules/_frontend_.md)
11
-* ["Interfaces"](modules/_interfaces_.md)
12
-* ["Types"](modules/_types_.md)
13
-* ["Utils"](modules/_utils_.md)

+ 0
- 29
docs/interfaces/_interfaces_.destroyable.md Vedi File

@@ -1,29 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Interfaces"](../modules/_interfaces_.md) › [Destroyable](_interfaces_.destroyable.md)
2
-
3
-# Interface: Destroyable
4
-
5
-## Hierarchy
6
-
7
-* **Destroyable**
8
-
9
-  ↳ [Socket](_interfaces_.socket.md)
10
-
11
-## Implemented by
12
-
13
-* [RPCServer](../classes/_backend_.rpcserver.md)
14
-
15
-## Index
16
-
17
-### Methods
18
-
19
-* [destroy](_interfaces_.destroyable.md#destroy)
20
-
21
-## Methods
22
-
23
-###  destroy
24
-
25
-▸ **destroy**(): *void*
26
-
27
-Defined in Interfaces.ts:26
28
-
29
-**Returns:** *void*

+ 0
- 151
docs/interfaces/_interfaces_.socket.md Vedi File

@@ -1,151 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Interfaces"](../modules/_interfaces_.md) › [Socket](_interfaces_.socket.md)
2
-
3
-# Interface: Socket
4
-
5
-Generic socket interface that can apply to bsock as well as RPCSocket
6
-
7
-## Hierarchy
8
-
9
-* [Destroyable](_interfaces_.destroyable.md)
10
-
11
-  ↳ **Socket**
12
-
13
-## Implemented by
14
-
15
-* [RPCSocket](../classes/_frontend_.rpcsocket.md)
16
-
17
-## Index
18
-
19
-### Properties
20
-
21
-* [call](_interfaces_.socket.md#call)
22
-* [fire](_interfaces_.socket.md#fire)
23
-* [hook](_interfaces_.socket.md#hook)
24
-* [on](_interfaces_.socket.md#on)
25
-* [port](_interfaces_.socket.md#port)
26
-* [unhook](_interfaces_.socket.md#unhook)
27
-
28
-### Methods
29
-
30
-* [close](_interfaces_.socket.md#close)
31
-* [destroy](_interfaces_.socket.md#destroy)
32
-
33
-## Properties
34
-
35
-###  call
36
-
37
-• **call**: *function*
38
-
39
-Defined in Interfaces.ts:19
40
-
41
-#### Type declaration:
42
-
43
-▸ (`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹T.Any›*
44
-
45
-**Parameters:**
46
-
47
-Name | Type |
48
------- | ------ |
49
-`rpcname` | T.Name |
50
-`...args` | T.Any[] |
51
-
52
-___
53
-
54
-###  fire
55
-
56
-• **fire**: *function*
57
-
58
-Defined in Interfaces.ts:20
59
-
60
-#### Type declaration:
61
-
62
-▸ (`rpcname`: T.Name, ...`args`: T.Any[]): *Promise‹T.Any›*
63
-
64
-**Parameters:**
65
-
66
-Name | Type |
67
------- | ------ |
68
-`rpcname` | T.Name |
69
-`...args` | T.Any[] |
70
-
71
-___
72
-
73
-###  hook
74
-
75
-• **hook**: *function*
76
-
77
-Defined in Interfaces.ts:17
78
-
79
-#### Type declaration:
80
-
81
-▸ (`rpcname`: T.Name, `handler`: function): *[Socket](_interfaces_.socket.md)*
82
-
83
-**Parameters:**
84
-
85
-▪ **rpcname**: *T.Name*
86
-
87
-▪ **handler**: *function*
88
-
89
-▸ (...`args`: any[]): *any | Promise‹any›*
90
-
91
-**Parameters:**
92
-
93
-Name | Type |
94
------- | ------ |
95
-`...args` | any[] |
96
-
97
-___
98
-
99
-###  on
100
-
101
-• **on**: *T.OnFunction*
102
-
103
-Defined in Interfaces.ts:21
104
-
105
-___
106
-
107
-###  port
108
-
109
-• **port**: *number*
110
-
111
-Defined in Interfaces.ts:16
112
-
113
-___
114
-
115
-###  unhook
116
-
117
-• **unhook**: *function*
118
-
119
-Defined in Interfaces.ts:18
120
-
121
-#### Type declaration:
122
-
123
-▸ (`rpcname`: T.Name): *[Socket](_interfaces_.socket.md)*
124
-
125
-**Parameters:**
126
-
127
-Name | Type |
128
------- | ------ |
129
-`rpcname` | T.Name |
130
-
131
-## Methods
132
-
133
-###  close
134
-
135
-▸ **close**(): *void*
136
-
137
-Defined in Interfaces.ts:22
138
-
139
-**Returns:** *void*
140
-
141
-___
142
-
143
-###  destroy
144
-
145
-▸ **destroy**(): *void*
146
-
147
-*Inherited from [Destroyable](_interfaces_.destroyable.md).[destroy](_interfaces_.destroyable.md#destroy)*
148
-
149
-Defined in Interfaces.ts:26
150
-
151
-**Returns:** *void*

+ 0
- 9
docs/modules/_backend_.md Vedi File

@@ -1,9 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Backend"](_backend_.md)
2
-
3
-# External module: "Backend"
4
-
5
-## Index
6
-
7
-### Classes
8
-
9
-* [RPCServer](../classes/_backend_.rpcserver.md)

+ 0
- 31
docs/modules/_frontend_.md Vedi File

@@ -1,31 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Frontend"](_frontend_.md)
2
-
3
-# External module: "Frontend"
4
-
5
-## Index
6
-
7
-### Classes
8
-
9
-* [RPCSocket](../classes/_frontend_.rpcsocket.md)
10
-
11
-### Functions
12
-
13
-* [stripAfterEquals](_frontend_.md#stripafterequals)
14
-
15
-## Functions
16
-
17
-###  stripAfterEquals
18
-
19
-▸ **stripAfterEquals**(`str`: string): *string*
20
-
21
-Defined in Frontend.ts:12
22
-
23
-Utility function to strip parameters like "a = 3" of their defaults
24
-
25
-**Parameters:**
26
-
27
-Name | Type | Description |
28
------- | ------ | ------ |
29
-`str` | string | The parameter to modify  |
30
-
31
-**Returns:** *string*

+ 0
- 11
docs/modules/_interfaces_.md Vedi File

@@ -1,11 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Interfaces"](_interfaces_.md)
2
-
3
-# External module: "Interfaces"
4
-
5
-## Index
6
-
7
-### Interfaces
8
-
9
-* [Destroyable](../interfaces/_interfaces_.destroyable.md)
10
-* [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)
11
-* [Socket](../interfaces/_interfaces_.socket.md)

+ 0
- 387
docs/modules/_types_.md Vedi File

@@ -1,387 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Types"](_types_.md)
2
-
3
-# External module: "Types"
4
-
5
-## Index
6
-
7
-### Type aliases
8
-
9
-* [Any](_types_.md#any)
10
-* [Arg](_types_.md#arg)
11
-* [AsyncFunction](_types_.md#asyncfunction)
12
-* [BaseInfo](_types_.md#baseinfo)
13
-* [CallInfo](_types_.md#callinfo)
14
-* [CallRPC](_types_.md#callrpc)
15
-* [CallbackFunction](_types_.md#callbackfunction)
16
-* [CloseHandler](_types_.md#closehandler)
17
-* [ConnectionHandler](_types_.md#connectionhandler)
18
-* [ErrorHandler](_types_.md#errorhandler)
19
-* [ErrorResponse](_types_.md#errorresponse)
20
-* [ExtendedRpcInfo](_types_.md#extendedrpcinfo)
21
-* [HookCloseFunction](_types_.md#hookclosefunction)
22
-* [HookFunction](_types_.md#hookfunction)
23
-* [HookInfo](_types_.md#hookinfo)
24
-* [HookRPC](_types_.md#hookrpc)
25
-* [Name](_types_.md#name)
26
-* [OnFunction](_types_.md#onfunction)
27
-* [Outcome](_types_.md#outcome)
28
-* [Owner](_types_.md#owner)
29
-* [RPC](_types_.md#rpc)
30
-* [RPCType](_types_.md#rpctype)
31
-* [ResponseType](_types_.md#responsetype)
32
-* [Respose](_types_.md#respose)
33
-* [RpcInfo](_types_.md#rpcinfo)
34
-* [SocketConf](_types_.md#socketconf)
35
-* [SubscriptionResponse](_types_.md#subscriptionresponse)
36
-* [SuccessResponse](_types_.md#successresponse)
37
-* [Visibility](_types_.md#visibility)
38
-
39
-## Type aliases
40
-
41
-###  Any
42
-
43
-Ƭ **Any**: *any*
44
-
45
-Defined in Types.ts:4
46
-
47
-___
48
-
49
-###  Arg
50
-
51
-Ƭ **Arg**: *string*
52
-
53
-Defined in Types.ts:5
54
-
55
-___
56
-
57
-###  AsyncFunction
58
-
59
-Ƭ **AsyncFunction**: *function*
60
-
61
-Defined in Types.ts:65
62
-
63
-#### Type declaration:
64
-
65
-▸ (...`args`: any): *Promise‹any›*
66
-
67
-**Parameters:**
68
-
69
-Name | Type |
70
------- | ------ |
71
-`...args` | any |
72
-
73
-___
74
-
75
-###  BaseInfo
76
-
77
-Ƭ **BaseInfo**: *object*
78
-
79
-Defined in Types.ts:43
80
-
81
-#### Type declaration:
82
-
83
-* **argNames**: *[Name](_types_.md#name)[]*
84
-
85
-* **name**: *[Name](_types_.md#name)*
86
-
87
-* **owner**: *[Name](_types_.md#name)*
88
-
89
-___
90
-
91
-###  CallInfo
92
-
93
-Ƭ **CallInfo**: *[BaseInfo](_types_.md#baseinfo) & object*
94
-
95
-Defined in Types.ts:54
96
-
97
-___
98
-
99
-###  CallRPC
100
-
101
-Ƭ **CallRPC**: *object | Function*
102
-
103
-Defined in Types.ts:36
104
-
105
-___
106
-
107
-###  CallbackFunction
108
-
109
-Ƭ **CallbackFunction**: *function*
110
-
111
-Defined in Types.ts:66
112
-
113
-#### Type declaration:
114
-
115
-▸ (...`args`: any): *void*
116
-
117
-**Parameters:**
118
-
119
-Name | Type |
120
------- | ------ |
121
-`...args` | any |
122
-
123
-___
124
-
125
-###  CloseHandler
126
-
127
-Ƭ **CloseHandler**: *function*
128
-
129
-Defined in Types.ts:10
130
-
131
-#### Type declaration:
132
-
133
-▸ (`socket`: [Socket](../interfaces/_interfaces_.socket.md)): *void*
134
-
135
-**Parameters:**
136
-
137
-Name | Type |
138
------- | ------ |
139
-`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
140
-
141
-___
142
-
143
-###  ConnectionHandler
144
-
145
-Ƭ **ConnectionHandler**: *function*
146
-
147
-Defined in Types.ts:8
148
-
149
-#### Type declaration:
150
-
151
-▸ (`socket`: [Socket](../interfaces/_interfaces_.socket.md)): *void*
152
-
153
-**Parameters:**
154
-
155
-Name | Type |
156
------- | ------ |
157
-`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
158
-
159
-___
160
-
161
-###  ErrorHandler
162
-
163
-Ƭ **ErrorHandler**: *function*
164
-
165
-Defined in Types.ts:9
166
-
167
-#### Type declaration:
168
-
169
-▸ (`socket`: [Socket](../interfaces/_interfaces_.socket.md), `error`: any): *void*
170
-
171
-**Parameters:**
172
-
173
-Name | Type |
174
------- | ------ |
175
-`socket` | [Socket](../interfaces/_interfaces_.socket.md) |
176
-`error` | any |
177
-
178
-___
179
-
180
-###  ErrorResponse
181
-
182
-Ƭ **ErrorResponse**: *[Respose](_types_.md#respose)‹T› & object*
183
-
184
-Defined in Types.ts:24
185
-
186
-___
187
-
188
-###  ExtendedRpcInfo
189
-
190
-Ƭ **ExtendedRpcInfo**: *[RpcInfo](_types_.md#rpcinfo) & object*
191
-
192
-Defined in Types.ts:60
193
-
194
-___
195
-
196
-###  HookCloseFunction
197
-
198
-Ƭ **HookCloseFunction**: *function*
199
-
200
-Defined in Types.ts:63
201
-
202
-#### Type declaration:
203
-
204
-▸ (`res`: [SubscriptionResponse](_types_.md#subscriptionresponse)‹T›, `rpc`: [HookRPC](_types_.md#hookrpc)‹T›): *any*
205
-
206
-**Parameters:**
207
-
208
-Name | Type |
209
------- | ------ |
210
-`res` | [SubscriptionResponse](_types_.md#subscriptionresponse)‹T› |
211
-`rpc` | [HookRPC](_types_.md#hookrpc)‹T› |
212
-
213
-___
214
-
215
-###  HookFunction
216
-
217
-Ƭ **HookFunction**: *function*
218
-
219
-Defined in Types.ts:64
220
-
221
-#### Type declaration:
222
-
223
-▸ (...`args`: any): *Promise‹[SubscriptionResponse](_types_.md#subscriptionresponse)‹T› | [ErrorResponse](_types_.md#errorresponse)›*
224
-
225
-**Parameters:**
226
-
227
-Name | Type |
228
------- | ------ |
229
-`...args` | any |
230
-
231
-___
232
-
233
-###  HookInfo
234
-
235
-Ƭ **HookInfo**: *[BaseInfo](_types_.md#baseinfo) & object*
236
-
237
-Defined in Types.ts:49
238
-
239
-___
240
-
241
-###  HookRPC
242
-
243
-Ƭ **HookRPC**: *object*
244
-
245
-Defined in Types.ts:29
246
-
247
-#### Type declaration:
248
-
249
-* **hook**: *[HookFunction](_types_.md#hookfunction)‹T›*
250
-
251
-* **name**: *[Name](_types_.md#name)*
252
-
253
-* **onCallback**? : *[CallbackFunction](_types_.md#callbackfunction)*
254
-
255
-* **onClose**? : *[HookCloseFunction](_types_.md#hookclosefunction)‹T›*
256
-
257
-___
258
-
259
-###  Name
260
-
261
-Ƭ **Name**: *[Arg](_types_.md#arg)*
262
-
263
-Defined in Types.ts:6
264
-
265
-___
266
-
267
-###  OnFunction
268
-
269
-Ƭ **OnFunction**: *function*
270
-
271
-Defined in Types.ts:62
272
-
273
-#### Type declaration:
274
-
275
-▸ (`type`: "error" | "close", `f`: function): *[Socket](../interfaces/_interfaces_.socket.md)*
276
-
277
-**Parameters:**
278
-
279
-▪ **type**: *"error" | "close"*
280
-
281
-▪ **f**: *function*
282
-
283
-▸ (`e?`: any): *void*
284
-
285
-**Parameters:**
286
-
287
-Name | Type |
288
------- | ------ |
289
-`e?` | any |
290
-
291
-___
292
-
293
-###  Outcome
294
-
295
-Ƭ **Outcome**: *"Success" | "Error"*
296
-
297
-Defined in Types.ts:19
298
-
299
-___
300
-
301
-###  Owner
302
-
303
-Ƭ **Owner**: *[Name](_types_.md#name)*
304
-
305
-Defined in Types.ts:7
306
-
307
-___
308
-
309
-###  RPC
310
-
311
-Ƭ **RPC**: *[CallRPC](_types_.md#callrpc) | [HookRPC](_types_.md#hookrpc)‹T›*
312
-
313
-Defined in Types.ts:41
314
-
315
-___
316
-
317
-###  RPCType
318
-
319
-Ƭ **RPCType**: *"Hook" | "Unhook" | "Call"*
320
-
321
-Defined in Types.ts:27
322
-
323
-___
324
-
325
-###  ResponseType
326
-
327
-Ƭ **ResponseType**: *"Subscribe" | "Success" | "Error"*
328
-
329
-Defined in Types.ts:18
330
-
331
-___
332
-
333
-###  Respose
334
-
335
-Ƭ **Respose**: *T & object*
336
-
337
-Defined in Types.ts:22
338
-
339
-___
340
-
341
-###  RpcInfo
342
-
343
-Ƭ **RpcInfo**: *[HookInfo](_types_.md#hookinfo) | [CallInfo](_types_.md#callinfo)*
344
-
345
-Defined in Types.ts:59
346
-
347
-___
348
-
349
-###  SocketConf
350
-
351
-Ƭ **SocketConf**: *object*
352
-
353
-Defined in Types.ts:11
354
-
355
-#### Type declaration:
356
-
357
-* **closeHandler**? : *[CloseHandler](_types_.md#closehandler)*
358
-
359
-* **connectionHandler**? : *[ConnectionHandler](_types_.md#connectionhandler)*
360
-
361
-* **errorHandler**? : *[ErrorHandler](_types_.md#errorhandler)*
362
-
363
-* **visibility**? : *[Visibility](_types_.md#visibility)*
364
-
365
-___
366
-
367
-###  SubscriptionResponse
368
-
369
-Ƭ **SubscriptionResponse**: *[Respose](_types_.md#respose)‹T› & object*
370
-
371
-Defined in Types.ts:25
372
-
373
-___
374
-
375
-###  SuccessResponse
376
-
377
-Ƭ **SuccessResponse**: *[Respose](_types_.md#respose)‹T› & object*
378
-
379
-Defined in Types.ts:23
380
-
381
-___
382
-
383
-###  Visibility
384
-
385
-Ƭ **Visibility**: *"127.0.0.1" | "0.0.0.0"*
386
-
387
-Defined in Types.ts:3

+ 0
- 124
docs/modules/_utils_.md Vedi File

@@ -1,124 +0,0 @@
1
-[rpclibrary](../README.md) › [Globals](../globals.md) › ["Utils"](_utils_.md)
2
-
3
-# External module: "Utils"
4
-
5
-## Index
6
-
7
-### Functions
8
-
9
-* [extractArgs](_utils_.md#const-extractargs)
10
-* [hookGenerator](_utils_.md#const-hookgenerator)
11
-* [makeSubResponse](_utils_.md#makesubresponse)
12
-* [rpcHooker](_utils_.md#rpchooker)
13
-* [rpcToRpcinfo](_utils_.md#const-rpctorpcinfo)
14
-
15
-## Functions
16
-
17
-### `Const` extractArgs
18
-
19
-▸ **extractArgs**(`f`: Function): *T.Arg[]*
20
-
21
-Defined in Utils.ts:110
22
-
23
-Extract a string list of parameters from a function
24
-
25
-**Parameters:**
26
-
27
-Name | Type | Description |
28
------- | ------ | ------ |
29
-`f` | Function | The source function  |
30
-
31
-**Returns:** *T.Arg[]*
32
-
33
-___
34
-
35
-### `Const` hookGenerator
36
-
37
-▸ **hookGenerator**(`rpc`: T.HookRPC‹any›): *function*
38
-
39
-Defined in Utils.ts:85
40
-
41
-Utility function to generate [HookFunction](_types_.md#hookfunction) from a RPC
42
-
43
-**Parameters:**
44
-
45
-Name | Type | Description |
46
------- | ------ | ------ |
47
-`rpc` | T.HookRPC‹any› | The RPC to transform |
48
-
49
-**Returns:** *function*
50
-
51
-A [HookFunction](_types_.md#hookfunction)
52
-
53
-▸ (`socket?`: I.Socket): *[HookFunction](_types_.md#hookfunction)‹T›*
54
-
55
-**Parameters:**
56
-
57
-Name | Type |
58
------- | ------ |
59
-`socket?` | I.Socket |
60
-
61
-___
62
-
63
-###  makeSubResponse
64
-
65
-▸ **makeSubResponse**(`uuid?`: undefined | string): *[SubscriptionResponse](_types_.md#subscriptionresponse)*
66
-
67
-Defined in Utils.ts:119
68
-
69
-Simple utility function to create basic [SubscriptionResponse](_types_.md#subscriptionresponse)
70
-
71
-**Parameters:**
72
-
73
-Name | Type | Description |
74
------- | ------ | ------ |
75
-`uuid?` | undefined &#124; string | optional uuid to use, otherwise defaults to uuid/v4  |
76
-
77
-**Returns:** *[SubscriptionResponse](_types_.md#subscriptionresponse)*
78
-
79
-___
80
-
81
-###  rpcHooker
82
-
83
-▸ **rpcHooker**<**SubResT**>(`socket`: [Socket](../interfaces/_interfaces_.socket.md), `exporter`: [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResT›, `makeUnique`: boolean): *T.ExtendedRpcInfo[]*
84
-
85
-Defined in Utils.ts:59
86
-
87
-Utility function to apply the RPCs of an [RPCExporter](../interfaces/_interfaces_.rpcexporter.md).
88
-
89
-**Type parameters:**
90
-
91
-▪ **SubResT**
92
-
93
-**Parameters:**
94
-
95
-Name | Type | Default | Description |
96
------- | ------ | ------ | ------ |
97
-`socket` | [Socket](../interfaces/_interfaces_.socket.md) | - | The websocket (implementation: bsock) to hook on |
98
-`exporter` | [RPCExporter](../interfaces/_interfaces_.rpcexporter.md)‹SubResT› | - | The exporter |
99
-`makeUnique` | boolean | true | @default true Attach a suffix to RPC names  |
100
-
101
-**Returns:** *T.ExtendedRpcInfo[]*
102
-
103
-___
104
-
105
-### `Const` rpcToRpcinfo
106
-
107
-▸ **rpcToRpcinfo**<**SubResT**>(`rpc`: T.RPC‹SubResT›, `owner`: T.Owner): *T.RpcInfo*
108
-
109
-Defined in Utils.ts:13
110
-
111
-Translate an RPC to RPCInfo for serialization.
112
-
113
-**Type parameters:**
114
-
115
-▪ **SubResT**
116
-
117
-**Parameters:**
118
-
119
-Name | Type | Description |
120
------- | ------ | ------ |
121
-`rpc` | T.RPC‹SubResT› | The RPC to transform |
122
-`owner` | T.Owner | The owning RPC group's name |
123
-
124
-**Returns:** *T.RpcInfo*

+ 1
- 1
package.json Vedi File

@@ -11,7 +11,7 @@
11 11
     "build": "npm run clean && tsc && npm run webpack",
12 12
     "clean": "rm -rf js",
13 13
     "test": "mocha js/test/Test.js",
14
-    "doc": "typedoc --out docs ./src --readme ./README.md --plugin typedoc-plugin-markdown "
14
+    "docs": "typedoc --out docs ./src --readme ./README.md --plugin typedoc-plugin-markdown "
15 15
   },
16 16
   "author": "",
17 17
   "license": "ISC",

Loading…
Annulla
Salva