@akala/pm 3.4.0 → 3.5.1
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/changelog.md +1 -6
- package/commands.json +137 -88
- package/dist/commands/bridge.js +2 -2
- package/dist/commands/bridge.js.map +1 -1
- package/dist/commands/proxy.d.ts +3 -0
- package/dist/commands/proxy.js +14 -0
- package/dist/commands/proxy.js.map +1 -0
- package/dist/container.d.ts +16 -12
- package/dist/fork.js +1 -2
- package/dist/fork.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +28 -42
- package/dist/index.js.map +1 -1
- package/dist/sidecar.d.ts +4 -0
- package/dist/sidecar.js +47 -0
- package/dist/sidecar.js.map +1 -0
- package/dist/state.d.ts +1 -1
- package/package.json +3 -3
- package/src/commands/bridge.json +18 -0
- package/src/commands/bridge.ts +2 -2
- package/src/commands/proxy.json +15 -0
- package/src/commands/proxy.ts +14 -0
- package/src/container.ts +16 -12
- package/src/fork.ts +1 -2
- package/src/index.ts +6 -51
- package/src/sidecar.ts +54 -0
- package/src/state.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/changelog.md
CHANGED
package/commands.json
CHANGED
@@ -2,131 +2,128 @@
|
|
2
2
|
"name": "commands",
|
3
3
|
"commands": [
|
4
4
|
{
|
5
|
-
"name": "
|
5
|
+
"name": "$init",
|
6
6
|
"inject": [],
|
7
7
|
"config": {
|
8
8
|
"fs": {
|
9
|
-
"path": "dist/commands
|
10
|
-
"source": "src/commands
|
9
|
+
"path": "dist/commands/$init.js",
|
10
|
+
"source": "src/commands/$init.ts",
|
11
11
|
"inject": [
|
12
|
-
"
|
13
|
-
"param.
|
12
|
+
"$container",
|
13
|
+
"param.0"
|
14
14
|
]
|
15
15
|
},
|
16
16
|
"": {
|
17
17
|
"inject": [
|
18
|
-
"
|
19
|
-
"param.
|
18
|
+
"$container",
|
19
|
+
"param.0"
|
20
20
|
]
|
21
21
|
},
|
22
22
|
"cli": {
|
23
|
-
"usage": "connect <name>",
|
24
23
|
"inject": [
|
25
|
-
"
|
24
|
+
"$container",
|
26
25
|
"context"
|
27
26
|
],
|
27
|
+
"usage": "cmd [config]",
|
28
28
|
"options": {
|
29
|
-
"
|
29
|
+
"config": {
|
30
30
|
"needsValue": true,
|
31
31
|
"aliases": [
|
32
|
-
"
|
32
|
+
"c"
|
33
33
|
]
|
34
|
-
},
|
35
|
-
"port": {
|
36
|
-
"needsValue": true
|
37
|
-
},
|
38
|
-
"key": {
|
39
|
-
"needsValue": true
|
40
|
-
},
|
41
|
-
"cert": {
|
42
|
-
"needsValue": true
|
43
34
|
}
|
44
35
|
}
|
45
36
|
}
|
46
37
|
}
|
47
38
|
},
|
48
39
|
{
|
49
|
-
"name": "
|
40
|
+
"name": "bridge",
|
50
41
|
"inject": [],
|
51
42
|
"config": {
|
52
43
|
"fs": {
|
53
|
-
"path": "dist/commands/config.js",
|
54
|
-
"source": "src/commands/config.ts",
|
55
44
|
"inject": [
|
56
45
|
"param.0",
|
57
46
|
"param.1"
|
58
|
-
]
|
47
|
+
],
|
48
|
+
"path": "dist/commands/bridge.js",
|
49
|
+
"source": "src/commands/bridge.ts"
|
59
50
|
},
|
60
|
-
"": {
|
51
|
+
"jsonrpc": {
|
61
52
|
"inject": [
|
62
53
|
"param.0",
|
63
|
-
"
|
54
|
+
"socket"
|
64
55
|
]
|
65
56
|
},
|
66
|
-
"
|
67
|
-
"inject": [
|
68
|
-
"param.0",
|
69
|
-
"options"
|
70
|
-
]
|
57
|
+
"": {
|
58
|
+
"inject": []
|
71
59
|
}
|
72
60
|
}
|
73
61
|
},
|
74
62
|
{
|
75
|
-
"name": "
|
63
|
+
"name": "config",
|
76
64
|
"inject": [],
|
77
65
|
"config": {
|
78
66
|
"fs": {
|
79
|
-
"path": "dist/commands/
|
80
|
-
"source": "src/commands/
|
67
|
+
"path": "dist/commands/config.js",
|
68
|
+
"source": "src/commands/config.ts",
|
81
69
|
"inject": [
|
82
70
|
"param.0",
|
83
|
-
"
|
71
|
+
"param.1"
|
84
72
|
]
|
85
73
|
},
|
86
74
|
"": {
|
87
75
|
"inject": [
|
88
76
|
"param.0",
|
89
|
-
"
|
77
|
+
"param.1"
|
90
78
|
]
|
91
79
|
},
|
92
80
|
"cli": {
|
93
81
|
"inject": [
|
94
82
|
"param.0",
|
95
|
-
"
|
83
|
+
"options"
|
96
84
|
]
|
97
85
|
}
|
98
86
|
}
|
99
87
|
},
|
100
88
|
{
|
101
|
-
"name": "
|
89
|
+
"name": "connect",
|
102
90
|
"inject": [],
|
103
91
|
"config": {
|
104
92
|
"fs": {
|
105
|
-
"path": "dist/commands
|
106
|
-
"source": "src/commands
|
93
|
+
"path": "dist/commands/connect.js",
|
94
|
+
"source": "src/commands/connect.ts",
|
107
95
|
"inject": [
|
108
|
-
"
|
109
|
-
"param.
|
96
|
+
"param.0",
|
97
|
+
"param.1"
|
110
98
|
]
|
111
99
|
},
|
112
100
|
"": {
|
113
101
|
"inject": [
|
114
|
-
"
|
115
|
-
"param.
|
102
|
+
"param.0",
|
103
|
+
"param.1"
|
116
104
|
]
|
117
105
|
},
|
118
106
|
"cli": {
|
107
|
+
"usage": "connect <name>",
|
119
108
|
"inject": [
|
120
|
-
"
|
109
|
+
"options.name",
|
121
110
|
"context"
|
122
111
|
],
|
123
|
-
"usage": "cmd [config]",
|
124
112
|
"options": {
|
125
|
-
"
|
113
|
+
"tcpPort": {
|
126
114
|
"needsValue": true,
|
127
115
|
"aliases": [
|
128
|
-
"
|
116
|
+
"tcp-port"
|
129
117
|
]
|
118
|
+
},
|
119
|
+
"port": {
|
120
|
+
"needsValue": true
|
121
|
+
},
|
122
|
+
"key": {
|
123
|
+
"needsValue": true
|
124
|
+
},
|
125
|
+
"cert": {
|
126
|
+
"needsValue": true
|
130
127
|
}
|
131
128
|
}
|
132
129
|
}
|
@@ -168,64 +165,57 @@
|
|
168
165
|
}
|
169
166
|
},
|
170
167
|
{
|
171
|
-
"name": "
|
168
|
+
"name": "install",
|
172
169
|
"inject": [],
|
173
170
|
"config": {
|
174
171
|
"fs": {
|
175
|
-
"path": "dist/commands/
|
176
|
-
"source": "src/commands/
|
172
|
+
"path": "dist/commands/install.js",
|
173
|
+
"source": "src/commands/install.ts",
|
177
174
|
"inject": [
|
178
175
|
"param.0",
|
179
|
-
"param.1",
|
180
176
|
"$container"
|
181
177
|
]
|
182
178
|
},
|
183
179
|
"": {
|
184
180
|
"inject": [
|
185
181
|
"param.0",
|
186
|
-
"param.1",
|
187
182
|
"$container"
|
188
183
|
]
|
189
184
|
},
|
190
185
|
"cli": {
|
191
186
|
"inject": [
|
192
187
|
"param.0",
|
193
|
-
"param.1",
|
194
188
|
"$container"
|
195
189
|
]
|
196
190
|
}
|
197
191
|
}
|
198
192
|
},
|
199
193
|
{
|
200
|
-
"name": "
|
194
|
+
"name": "link",
|
201
195
|
"inject": [],
|
202
196
|
"config": {
|
203
197
|
"fs": {
|
204
|
-
"path": "dist/commands/
|
205
|
-
"source": "src/commands/
|
206
|
-
"inject": [
|
198
|
+
"path": "dist/commands/link.js",
|
199
|
+
"source": "src/commands/link.ts",
|
200
|
+
"inject": [
|
201
|
+
"param.0",
|
202
|
+
"param.1",
|
203
|
+
"$container"
|
204
|
+
]
|
207
205
|
},
|
208
206
|
"": {
|
209
|
-
"inject": [
|
207
|
+
"inject": [
|
208
|
+
"param.0",
|
209
|
+
"param.1",
|
210
|
+
"$container"
|
211
|
+
]
|
210
212
|
},
|
211
213
|
"cli": {
|
212
|
-
"inject": []
|
213
|
-
}
|
214
|
-
}
|
215
|
-
},
|
216
|
-
{
|
217
|
-
"name": "name",
|
218
|
-
"inject": [],
|
219
|
-
"config": {
|
220
|
-
"fs": {
|
221
|
-
"path": "dist/commands/name.js",
|
222
|
-
"source": "src/commands/name.ts",
|
223
214
|
"inject": [
|
224
|
-
"param.0"
|
215
|
+
"param.0",
|
216
|
+
"param.1",
|
217
|
+
"$container"
|
225
218
|
]
|
226
|
-
},
|
227
|
-
"": {
|
228
|
-
"inject": []
|
229
219
|
}
|
230
220
|
}
|
231
221
|
},
|
@@ -253,25 +243,19 @@
|
|
253
243
|
}
|
254
244
|
},
|
255
245
|
{
|
256
|
-
"name": "
|
246
|
+
"name": "ls",
|
257
247
|
"inject": [],
|
258
248
|
"config": {
|
259
249
|
"fs": {
|
260
|
-
"
|
261
|
-
|
262
|
-
]
|
263
|
-
"path": "dist/commands/reload-metadata.js",
|
264
|
-
"source": "src/commands/reload-metadata.ts"
|
265
|
-
},
|
266
|
-
"jsonrpc": {
|
267
|
-
"inject": [
|
268
|
-
"connectionAsContainer"
|
269
|
-
]
|
250
|
+
"path": "dist/commands/ls.js",
|
251
|
+
"source": "src/commands/ls.ts",
|
252
|
+
"inject": []
|
270
253
|
},
|
271
254
|
"": {
|
272
|
-
"inject": [
|
273
|
-
|
274
|
-
|
255
|
+
"inject": []
|
256
|
+
},
|
257
|
+
"cli": {
|
258
|
+
"inject": []
|
275
259
|
}
|
276
260
|
}
|
277
261
|
},
|
@@ -315,6 +299,48 @@
|
|
315
299
|
}
|
316
300
|
}
|
317
301
|
},
|
302
|
+
{
|
303
|
+
"name": "name",
|
304
|
+
"inject": [],
|
305
|
+
"config": {
|
306
|
+
"fs": {
|
307
|
+
"path": "dist/commands/name.js",
|
308
|
+
"source": "src/commands/name.ts",
|
309
|
+
"inject": [
|
310
|
+
"param.0"
|
311
|
+
]
|
312
|
+
},
|
313
|
+
"": {
|
314
|
+
"inject": []
|
315
|
+
}
|
316
|
+
}
|
317
|
+
},
|
318
|
+
{
|
319
|
+
"name": "proxy",
|
320
|
+
"inject": [],
|
321
|
+
"config": {
|
322
|
+
"fs": {
|
323
|
+
"path": "dist/commands/proxy.js",
|
324
|
+
"source": "src/commands/proxy.ts",
|
325
|
+
"inject": [
|
326
|
+
"param.0",
|
327
|
+
"param.1"
|
328
|
+
]
|
329
|
+
},
|
330
|
+
"jsonrpc": {
|
331
|
+
"inject": [
|
332
|
+
"param.0",
|
333
|
+
"socket"
|
334
|
+
]
|
335
|
+
},
|
336
|
+
"": {
|
337
|
+
"inject": [
|
338
|
+
"param.0",
|
339
|
+
"param.1"
|
340
|
+
]
|
341
|
+
}
|
342
|
+
}
|
343
|
+
},
|
318
344
|
{
|
319
345
|
"name": "ready",
|
320
346
|
"inject": [],
|
@@ -343,6 +369,29 @@
|
|
343
369
|
}
|
344
370
|
}
|
345
371
|
},
|
372
|
+
{
|
373
|
+
"name": "reload-metadata",
|
374
|
+
"inject": [],
|
375
|
+
"config": {
|
376
|
+
"fs": {
|
377
|
+
"inject": [
|
378
|
+
"param.0"
|
379
|
+
],
|
380
|
+
"path": "dist/commands/reload-metadata.js",
|
381
|
+
"source": "src/commands/reload-metadata.ts"
|
382
|
+
},
|
383
|
+
"jsonrpc": {
|
384
|
+
"inject": [
|
385
|
+
"connectionAsContainer"
|
386
|
+
]
|
387
|
+
},
|
388
|
+
"": {
|
389
|
+
"inject": [
|
390
|
+
"param.0"
|
391
|
+
]
|
392
|
+
}
|
393
|
+
}
|
394
|
+
},
|
346
395
|
{
|
347
396
|
"name": "start",
|
348
397
|
"inject": [],
|
package/dist/commands/bridge.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
function default_1(connectionId, socket) {
|
4
|
-
this.
|
5
|
-
socket.pipe(this.
|
4
|
+
this.bridges[connectionId].pipe(socket);
|
5
|
+
socket.pipe(this.bridges[connectionId]);
|
6
6
|
}
|
7
7
|
exports.default = default_1;
|
8
8
|
//# sourceMappingURL=bridge.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/commands/bridge.ts"],"names":[],"mappings":";;AAIA,mBAAsC,YAAoB,EAAE,MAAqB;IAE7E,IAAI,CAAC,
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/commands/bridge.ts"],"names":[],"mappings":";;AAIA,mBAAsC,YAAoB,EAAE,MAAqB;IAE7E,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;AAC5C,CAAC;AAJD,4BAIC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const cli_1 = require("@akala/cli");
|
4
|
+
const crypto_1 = require("crypto");
|
5
|
+
async function default_1(name, socket) {
|
6
|
+
var cp = this.processes[name];
|
7
|
+
if (!cp)
|
8
|
+
throw new cli_1.ErrorWithStatus(404, `There is no such process with name ${name}`);
|
9
|
+
const connectionId = (0, crypto_1.randomUUID)();
|
10
|
+
this.bridges[connectionId] = socket;
|
11
|
+
await cp.dispatch('$bridge', connectionId);
|
12
|
+
}
|
13
|
+
exports.default = default_1;
|
14
|
+
//# sourceMappingURL=proxy.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/commands/proxy.ts"],"names":[],"mappings":";;AAAA,oCAA6C;AAE7C,mCAAoC;AAGrB,KAAK,oBAAwB,IAAY,EAAE,MAAqB;IAE3E,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE;QACH,MAAM,IAAI,qBAAe,CAAC,GAAG,EAAE,sCAAsC,IAAI,EAAE,CAAC,CAAC;IACjF,MAAM,YAAY,GAAG,IAAA,mBAAU,GAAE,CAAC;IAClC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AARD,4BAQC"}
|
package/dist/container.d.ts
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
import { Argument0, Argument1, Argument2, Argument3 } from '@akala/core';
|
2
2
|
declare namespace commands {
|
3
3
|
interface container {
|
4
|
-
dispatch(cmd: 'connect', ...args: [Argument0<typeof import('./commands/connect').default>, Argument1<typeof import('./commands/connect').default>]): ReturnType<typeof import('./commands/connect').default>;
|
5
|
-
dispatch(cmd: 'config', ...args: [Argument0<typeof import('./commands/config').default>, Argument1<typeof import('./commands/config').default>]): ReturnType<typeof import('./commands/config').default>;
|
6
|
-
dispatch(cmd: 'install', ...args: [Argument0<typeof import('./commands/install').default>]): ReturnType<typeof import('./commands/install').default>;
|
7
4
|
dispatch(cmd: '$init', ...args: [Argument1<typeof import('./commands/$init').default>]): ReturnType<typeof import('./commands/$init').default>;
|
5
|
+
dispatch(cmd: 'bridge', ...args: [Argument0<typeof import('./commands/bridge').default>, Argument1<typeof import('./commands/bridge').default>]): ReturnType<typeof import('./commands/bridge').default>;
|
6
|
+
dispatch(cmd: 'config', ...args: [Argument0<typeof import('./commands/config').default>, Argument1<typeof import('./commands/config').default>]): ReturnType<typeof import('./commands/config').default>;
|
7
|
+
dispatch(cmd: 'connect', ...args: [Argument0<typeof import('./commands/connect').default>, Argument1<typeof import('./commands/connect').default>]): ReturnType<typeof import('./commands/connect').default>;
|
8
8
|
dispatch(cmd: 'discover', ...args: [Argument0<typeof import('./commands/discover').default>, Argument1<typeof import('./commands/discover').default>]): ReturnType<typeof import('./commands/discover').default>;
|
9
|
+
dispatch(cmd: 'install', ...args: [Argument0<typeof import('./commands/install').default>]): ReturnType<typeof import('./commands/install').default>;
|
9
10
|
dispatch(cmd: 'link', ...args: [Argument0<typeof import('./commands/link').default>, Argument1<typeof import('./commands/link').default>]): ReturnType<typeof import('./commands/link').default>;
|
10
|
-
dispatch(cmd: 'ls', ...args: []): ReturnType<typeof import('./commands/ls').default>;
|
11
|
-
dispatch(cmd: 'name', ...args: [Argument0<typeof import('./commands/name').default>]): ReturnType<typeof import('./commands/name').default>;
|
12
11
|
dispatch(cmd: 'log', ...args: [Argument0<typeof import('./commands/log').default>]): ReturnType<typeof import('./commands/log').default>;
|
13
|
-
dispatch(cmd: '
|
12
|
+
dispatch(cmd: 'ls', ...args: []): ReturnType<typeof import('./commands/ls').default>;
|
14
13
|
dispatch(cmd: 'map', ...args: [Argument0<typeof import('./commands/map').default>, Argument1<typeof import('./commands/map').default>, Argument2<typeof import('./commands/map').default>, Argument3<typeof import('./commands/map').default>]): ReturnType<typeof import('./commands/map').default>;
|
14
|
+
dispatch(cmd: 'name', ...args: [Argument0<typeof import('./commands/name').default>]): ReturnType<typeof import('./commands/name').default>;
|
15
|
+
dispatch(cmd: 'proxy', ...args: [Argument0<typeof import('./commands/proxy').default>, Argument1<typeof import('./commands/proxy').default>]): ReturnType<typeof import('./commands/proxy').default>;
|
15
16
|
dispatch(cmd: 'ready', ...args: []): ReturnType<typeof import('./commands/ready').default>;
|
17
|
+
dispatch(cmd: 'reload-metadata', ...args: [Argument0<typeof import('./commands/reload-metadata').default>]): ReturnType<typeof import('./commands/reload-metadata').default>;
|
16
18
|
dispatch(cmd: 'start', ...args: [Argument1<typeof import('./commands/start').default>, Argument2<typeof import('./commands/start').default>]): ReturnType<typeof import('./commands/start').default>;
|
17
19
|
dispatch(cmd: 'status', ...args: [Argument0<typeof import('./commands/status').default>]): ReturnType<typeof import('./commands/status').default>;
|
18
20
|
dispatch(cmd: 'stop', ...args: [Argument0<typeof import('./commands/stop').default>]): ReturnType<typeof import('./commands/stop').default>;
|
@@ -20,18 +22,20 @@ declare namespace commands {
|
|
20
22
|
dispatch(cmd: 'version', ...args: [Argument0<typeof import('./commands/version').default>, Argument1<typeof import('./commands/version').default>]): ReturnType<typeof import('./commands/version').default>;
|
21
23
|
}
|
22
24
|
interface proxy {
|
23
|
-
'connect'(...args: [Argument0<typeof import('./commands/connect').default>, Argument1<typeof import('./commands/connect').default>]): ReturnType<typeof import('./commands/connect').default>;
|
24
|
-
'config'(...args: [Argument0<typeof import('./commands/config').default>, Argument1<typeof import('./commands/config').default>]): ReturnType<typeof import('./commands/config').default>;
|
25
|
-
'install'(...args: [Argument0<typeof import('./commands/install').default>]): ReturnType<typeof import('./commands/install').default>;
|
26
25
|
'$init'(...args: [Argument1<typeof import('./commands/$init').default>]): ReturnType<typeof import('./commands/$init').default>;
|
26
|
+
'bridge'(...args: [Argument0<typeof import('./commands/bridge').default>, Argument1<typeof import('./commands/bridge').default>]): ReturnType<typeof import('./commands/bridge').default>;
|
27
|
+
'config'(...args: [Argument0<typeof import('./commands/config').default>, Argument1<typeof import('./commands/config').default>]): ReturnType<typeof import('./commands/config').default>;
|
28
|
+
'connect'(...args: [Argument0<typeof import('./commands/connect').default>, Argument1<typeof import('./commands/connect').default>]): ReturnType<typeof import('./commands/connect').default>;
|
27
29
|
'discover'(...args: [Argument0<typeof import('./commands/discover').default>, Argument1<typeof import('./commands/discover').default>]): ReturnType<typeof import('./commands/discover').default>;
|
30
|
+
'install'(...args: [Argument0<typeof import('./commands/install').default>]): ReturnType<typeof import('./commands/install').default>;
|
28
31
|
'link'(...args: [Argument0<typeof import('./commands/link').default>, Argument1<typeof import('./commands/link').default>]): ReturnType<typeof import('./commands/link').default>;
|
29
|
-
'ls'(...args: []): ReturnType<typeof import('./commands/ls').default>;
|
30
|
-
'name'(...args: [Argument0<typeof import('./commands/name').default>]): ReturnType<typeof import('./commands/name').default>;
|
31
32
|
'log'(...args: [Argument0<typeof import('./commands/log').default>]): ReturnType<typeof import('./commands/log').default>;
|
32
|
-
'
|
33
|
+
'ls'(...args: []): ReturnType<typeof import('./commands/ls').default>;
|
33
34
|
'map'(...args: [Argument0<typeof import('./commands/map').default>, Argument1<typeof import('./commands/map').default>, Argument2<typeof import('./commands/map').default>, Argument3<typeof import('./commands/map').default>]): ReturnType<typeof import('./commands/map').default>;
|
35
|
+
'name'(...args: [Argument0<typeof import('./commands/name').default>]): ReturnType<typeof import('./commands/name').default>;
|
36
|
+
'proxy'(...args: [Argument0<typeof import('./commands/proxy').default>, Argument1<typeof import('./commands/proxy').default>]): ReturnType<typeof import('./commands/proxy').default>;
|
34
37
|
'ready'(...args: []): ReturnType<typeof import('./commands/ready').default>;
|
38
|
+
'reload-metadata'(...args: [Argument0<typeof import('./commands/reload-metadata').default>]): ReturnType<typeof import('./commands/reload-metadata').default>;
|
35
39
|
'start'(...args: [Argument1<typeof import('./commands/start').default>, Argument2<typeof import('./commands/start').default>]): ReturnType<typeof import('./commands/start').default>;
|
36
40
|
'status'(...args: [Argument0<typeof import('./commands/status').default>]): ReturnType<typeof import('./commands/status').default>;
|
37
41
|
'stop'(...args: [Argument0<typeof import('./commands/stop').default>]): ReturnType<typeof import('./commands/stop').default>;
|
package/dist/fork.js
CHANGED
@@ -37,7 +37,6 @@ const net_1 = require("net");
|
|
37
37
|
const core_1 = require("@akala/core");
|
38
38
|
const cli_1 = __importStar(require("@akala/cli"));
|
39
39
|
const commands_1 = require("@akala/commands");
|
40
|
-
const serve_metadata_1 = require("@akala/commands/src/serve-metadata");
|
41
40
|
var isPm = false;
|
42
41
|
cli_1.default.useMiddleware({
|
43
42
|
handle: async (c) => {
|
@@ -95,7 +94,7 @@ cli_1.default.option('program', { needsValue: true }).option('name', { needsValu
|
|
95
94
|
}
|
96
95
|
else {
|
97
96
|
const pmSocket = new net_1.Socket();
|
98
|
-
const x = await ac.connectByPreference(pmConnectInfo = (0,
|
97
|
+
const x = await ac.connectByPreference(pmConnectInfo = (0, commands_1.parseMetadata)(c.options.pmSocket, c.options.tls), { container: cliContainer });
|
99
98
|
pm = x.container;
|
100
99
|
// await new Promise<void>((resolve, reject) =>
|
101
100
|
// {
|
package/dist/fork.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fork.js","sourceRoot":"","sources":["../src/fork.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAoC;AACpC,4BAAG,CAAC,OAAO,EAAE,CAAC;AACd,2CAA4B;AAC5B,oDAAsC;AACtC,0CAAoC;AACpC,+CAA2C;AA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C,CAAC;AAEnC,IAAI,OAAO,CAAC,IAAI,IAAI,MAAM;IACtB,aAAO,CAAC,OAAO,CAAC,IAAA,gCAA0B,GAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAEpD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
@@ -16,12 +16,12 @@ export declare function connect(name: string): Promise<{
|
|
16
16
|
connect: Promise<ServeMetadata>;
|
17
17
|
container: Metadata.Container;
|
18
18
|
}>;
|
19
|
-
declare
|
19
|
+
export declare const defaultOrders: (keyof ServeMetadata)[];
|
20
|
+
export declare type SideCarConnectionPreference = {
|
20
21
|
[key in keyof SidecarMap]?: Partial<ConnectionPreference> & {
|
21
22
|
orders?: (keyof ServeMetadata)[];
|
22
23
|
};
|
23
24
|
};
|
24
|
-
export declare function sidecar(options?: Omit<ConnectionPreference, 'metadata'> | SideCarConnectionPreference | Omit<ConnectionPreference, 'metadata'> & SideCarConnectionPreference, noCache?: boolean): Sidecar;
|
25
25
|
export interface ContainerLite {
|
26
26
|
dispatch(cmd: string, ...args: unknown[]): Promise<unknown>;
|
27
27
|
}
|
@@ -33,4 +33,6 @@ export interface SidecarMap {
|
|
33
33
|
pm: pmContainer;
|
34
34
|
}
|
35
35
|
import getRandomName from './commands/name';
|
36
|
+
import sidecarSingleton, { sidecar } from "./sidecar";
|
37
|
+
export { sidecar, sidecarSingleton };
|
36
38
|
export { getRandomName };
|
package/dist/index.js
CHANGED
@@ -1,9 +1,32 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
27
|
};
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getRandomName = exports.sidecar = exports.connect = exports.pm = exports.InteractError = void 0;
|
29
|
+
exports.getRandomName = exports.sidecarSingleton = exports.sidecar = exports.defaultOrders = exports.connect = exports.pm = exports.InteractError = void 0;
|
7
30
|
const commands_1 = require("@akala/commands");
|
8
31
|
const net_1 = require("net");
|
9
32
|
const core_1 = require("@akala/core");
|
@@ -42,47 +65,10 @@ function connect(name) {
|
|
42
65
|
})();
|
43
66
|
}
|
44
67
|
exports.connect = connect;
|
45
|
-
|
46
|
-
function sidecar(options, noCache) {
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
48
|
-
return new Proxy({}, {
|
49
|
-
get(target, property) {
|
50
|
-
if (typeof (property) !== 'string')
|
51
|
-
return Reflect.get(target, property);
|
52
|
-
const orders = options && options[property] && options[property].orders || defaultOrders;
|
53
|
-
if (!options)
|
54
|
-
options = {};
|
55
|
-
if (typeof options.preferRemote == 'undefined')
|
56
|
-
options.preferRemote = !process.connected;
|
57
|
-
if (noCache || typeof (target[property]) == 'undefined')
|
58
|
-
Object.defineProperty(target, property, {
|
59
|
-
value: connect(property).then(async (meta) => {
|
60
|
-
try {
|
61
|
-
const c = await (0, commands_1.connectByPreference)(await meta.connect, Object.assign({ metadata: meta.container }, options, options && options[property]), ...orders);
|
62
|
-
return c.container;
|
63
|
-
}
|
64
|
-
catch (e) {
|
65
|
-
if (e && e.statusCode == 404 || !meta.connect) {
|
66
|
-
var c = new commands_1.Container(meta.container.name, null, (0, core_1.module)('@akala/pm').resolve('container').processor);
|
67
|
-
c.processor.useMiddleware(0, {
|
68
|
-
handle(origin, cmd, param) {
|
69
|
-
if (cmd.name.startsWith(meta.container.name + '.'))
|
70
|
-
return undefined;
|
71
|
-
return c.processor.handle(origin, Object.assign({}, cmd, { name: meta.container.name + '.' + cmd.name }), param);
|
72
|
-
}
|
73
|
-
});
|
74
|
-
meta.container.commands.forEach(cmd => c.register(cmd));
|
75
|
-
return c;
|
76
|
-
}
|
77
|
-
throw e;
|
78
|
-
}
|
79
|
-
})
|
80
|
-
});
|
81
|
-
return target[property];
|
82
|
-
}
|
83
|
-
});
|
84
|
-
}
|
85
|
-
exports.sidecar = sidecar;
|
68
|
+
exports.defaultOrders = ['ssocket', 'socket', 'wss', 'ws'];
|
86
69
|
const name_1 = __importDefault(require("./commands/name"));
|
87
70
|
exports.getRandomName = name_1.default;
|
71
|
+
const sidecar_1 = __importStar(require("./sidecar"));
|
72
|
+
exports.sidecarSingleton = sidecar_1.default;
|
73
|
+
Object.defineProperty(exports, "sidecar", { enumerable: true, get: function () { return sidecar_1.sidecar; } });
|
88
74
|
//# sourceMappingURL=index.js.map
|