@akala/pm 12.1.3 → 12.1.4

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
@@ -4,11 +4,11 @@
4
4
  "pm": "dist/esm/cli.js",
5
5
  "pm-fork": "dist/esm/fork.js"
6
6
  },
7
- "version": "12.1.3",
7
+ "version": "12.1.4",
8
8
  "scripts": {
9
9
  "test": "echo 1",
10
10
  "generate": "ac generate dist/esm/commands commands.json --name pm && ac generate dist/esm/cli-commands cli-commands.json --name pm",
11
- "generate-metadata": "ac generate-metadata commands.json src/container.ts",
11
+ "generate-metadata": "ac generate-metadata commands.json src/container.ts && ac generate-metadata cli-commands.json src/cli-container.ts",
12
12
  "prepack": "../../makeCjs.sh",
13
13
  "akala-install": "akala plugins add dist/esm/akala.mjs"
14
14
  },
@@ -30,8 +30,8 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "@akala/cli": "^3.0.13",
33
- "@akala/commands": "^10.0.3",
34
- "@akala/config": "^5.0.20",
33
+ "@akala/commands": "^10.0.4",
34
+ "@akala/config": "^5.0.21",
35
35
  "@akala/core": "^19.0.13",
36
36
  "@akala/json-rpc-ws": "^11.0.13",
37
37
  "reflect-metadata": "^0.2.2",
package/src/akala.mts CHANGED
@@ -1,7 +1,5 @@
1
1
  import * as path from 'path'
2
- import { Processors, NetSocketAdapter, Metadata, Container, ICommandProcessor, proxy, Triggers, Cli } from '@akala/commands';
3
- import { Socket } from 'net';
4
- import { TLSSocket } from 'tls';
2
+ import { Processors, Metadata, Container, ICommandProcessor, Triggers, Cli, connect } from '@akala/commands';
5
3
  import { platform, homedir } from 'os';
6
4
  import start from './commands/start.js'
7
5
  import { Readable } from 'stream';
@@ -9,7 +7,7 @@ import { Readable } from 'stream';
9
7
  import { spawnAsync } from './cli-helper.js';
10
8
  import State, { StateConfiguration } from './state.js';
11
9
  import { CliContext, ErrorMessage, InteractError, NamespaceMiddleware, unparse } from '@akala/cli';
12
- import { ObservableObject, Parser } from '@akala/core';
10
+ import { eachAsync, ObservableObject, Parser } from '@akala/core';
13
11
  import module from 'module'
14
12
  import commands from './container.js';
15
13
 
@@ -52,108 +50,47 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
52
50
  return start.call({ config: c.state.pm } as unknown as State, null, 'pm', { name: 'pm', ...c.options }, c);
53
51
  });
54
52
 
55
- let socket: Socket;
56
- let processor: Processors.JsonRpc;
57
- let metaContainer: Metadata.Container;
53
+ let metaContainer = commands.meta;
58
54
  let container: Container<unknown>;
59
55
  cli.preAction(async c =>
60
56
  {
61
57
  process.stdin.pause();
62
58
  process.stdin.setEncoding('utf8');
63
- if (!socket)
59
+ if (!container)
64
60
  {
65
- const netsocket = socket = new Socket();
66
- if (c.options.tls)
61
+ if (c.options.pmSock)
67
62
  {
68
- socket = new TLSSocket(socket, {});
69
- }
70
-
71
- await new Promise<void>((resolve, reject) =>
72
- {
73
- if (c.options.pmSock)
63
+ if (typeof (c.options.pmSock) == 'string')
74
64
  {
75
- if (typeof (c.options.pmSock) == 'string')
76
- {
77
- const indexOfColon = c.options.pmSock.indexOf(':');
78
- if (indexOfColon > -1)
79
- netsocket.connect(Number(c.options.pmSock.substring(indexOfColon + 1)), c.options.pmSock.substring(0, indexOfColon));
80
- else
81
- netsocket.connect(c.options.pmSock);
82
- }
83
- else
84
- netsocket.connect(c.options.pmSock as number);
65
+ container = await connect(c.options.pmSock, c.abort.signal, metaContainer);
85
66
  }
86
- else if (platform() == 'win32')
87
- netsocket.connect('\\\\?\\pipe\\pm')
88
67
  else
89
- {
90
- try
91
- {
92
- // if (c.state?.pm)
93
- // netsocket.connect(c.state.pm.mapping.pm.connect.socket[0]);
94
- // else
95
- netsocket.destroy(Object.assign(new Error(), { code: 'ENOENT' }))
96
- }
97
- catch (e)
68
+ container = await connect(new URL('jsonrpc+tcp://localhost:' + c.options.pmSock), c.abort.signal, metaContainer);
69
+ }
70
+ else if (platform() == 'win32')
71
+ container = await connect(new URL('jsonrpc+unix://\\\\?\\pipe\\pm'), c.abort.signal, metaContainer);
72
+ else
73
+ {
74
+ if (c.state?.pm?.mapping.pm?.connect)
75
+ await eachAsync(c.state.pm.mapping.pm.connect, async (config, connectionString) =>
98
76
  {
99
- if (e.code != 'MODULE_NOT_FOUND')
100
- reject(e);
101
- else
77
+ if (container)
78
+ return;
79
+ try
102
80
  {
103
- e.code = 'ENOENT';
104
- socket.destroy(e);
81
+ container = await connect(new URL(connectionString), c.abort.signal, metaContainer);
105
82
  }
106
-
107
- }
108
- }
109
- if (c.options.tls)
110
- {
111
- // socket.on('data', function (e) { console.log(e) });
112
- socket.connect({} as any);
113
- netsocket.on('error', function (e)
114
- {
115
- console.log(e);
116
- });
117
- socket.on('error', function (e)
118
- {
119
- console.log(e);
120
- });
121
- }
122
- socket.on('connect', async function ()
123
- {
124
- resolve();
125
- socket.setEncoding('utf-8');
126
- });
127
- socket.on('error', async (e: Error & { code?: string }) =>
128
- {
129
- if (c.options.help)
130
- resolve();
131
- else
132
- {
133
- if (e.code === 'ENOENT' || e.code == 'ECONNREFUSED')
83
+ catch (e)
134
84
  {
135
- // return tryLocalProcessing(c).catch(() =>
136
- // {
137
- resolve();
138
- // reject(new Error('pm is not started'));
139
- // });
85
+ if (e.code == 'ENOENT' || e.code == 'ECONNREFUSED')
86
+ return;
87
+ throw e;
140
88
  }
141
- else
142
- reject(e);
143
- }
144
- });
145
- });
146
- }
147
- if (socket.readyState == 'open')
148
- {
149
- if (!processor)
150
- processor = new Processors.JsonRpc(Processors.JsonRpc.getConnection(new NetSocketAdapter(socket)));
151
- if (!metaContainer)
152
- metaContainer = commands.meta;
153
- if (!container)
154
- {
155
- container = proxy(metaContainer, processor);
156
89
 
90
+ })
91
+ }
92
+ if (container)
93
+ {
157
94
  container.unregister(Cli.Metadata.name);
158
95
  container.register(Metadata.extractCommandMetadata(Cli.Metadata));
159
96
 
@@ -225,8 +162,6 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
225
162
  result.pipe(process.stdout);
226
163
  return new Promise((resolve) => result.on('close', resolve));
227
164
  }
228
- if (socket)
229
- socket.end();
230
165
 
231
166
  return formatResult(result, context.options.output);
232
167
  });
@@ -0,0 +1,48 @@
1
+ //eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
+ //@ts-ignore 6133
3
+ //eslint-disable-next-line @typescript-eslint/no-unused-vars
4
+ import {Arguments, Argument0, Argument1, Argument2, Argument3, Argument4, Argument5, Argument6, Argument7, Argument8, Argument9, Argument10, Argument11, Argument12, Argument13, Argument14, Argument15, Argument16, Argument17 } from '@akala/core';
5
+ import {Metadata, ICommandProcessor, Container, registerCommands} from "@akala/commands";
6
+ // eslint-disable-next-line @typescript-eslint/no-namespace
7
+ namespace cliCommands
8
+ {
9
+ export interface container
10
+ {
11
+ dispatch (cmd:'$init-akala', ...args: [Argument0<typeof import('./cli-commands/$init-akala.js').default>]): ReturnType<typeof import('./cli-commands/$init-akala.js').default>
12
+ dispatch (cmd:'connect', ...args: [Argument0<typeof import('./cli-commands/connect.js').default>, Argument1<typeof import('./cli-commands/connect.js').default>]): ReturnType<typeof import('./cli-commands/connect.js').default>
13
+ dispatch (cmd:'discover', ...args: [Argument0<typeof import('./cli-commands/discover.js').default>, Argument1<typeof import('./cli-commands/discover.js').default>]): ReturnType<typeof import('./cli-commands/discover.js').default>
14
+ dispatch (cmd:'install', ...args: [Argument0<typeof import('./cli-commands/install.js').default>]): ReturnType<typeof import('./cli-commands/install.js').default>
15
+ dispatch (cmd:'link', ...args: [Argument0<typeof import('./cli-commands/link.js').default>, Argument1<typeof import('./cli-commands/link.js').default>]): ReturnType<typeof import('./cli-commands/link.js').default>
16
+ dispatch (cmd:'log', ...args: [Argument0<typeof import('./cli-commands/log.js').default>]): ReturnType<typeof import('./cli-commands/log.js').default>
17
+ dispatch (cmd:'ls', ...args: []): ReturnType<typeof import('./cli-commands/ls.js').default>
18
+ dispatch (cmd:'map', ...args: [Argument0<typeof import('./cli-commands/map.js').default>, Argument1<typeof import('./cli-commands/map.js').default>, Argument2<typeof import('./cli-commands/map.js').default>, Argument3<typeof import('./cli-commands/map.js').default>]): ReturnType<typeof import('./cli-commands/map.js').default>
19
+ dispatch (cmd:'start', ...args: [Argument1<typeof import('./cli-commands/start.js').default>, Argument2<typeof import('./cli-commands/start.js').default>]): ReturnType<typeof import('./cli-commands/start.js').default>
20
+ dispatch (cmd:'uninstall', ...args: [Argument0<typeof import('./cli-commands/uninstall.js').default>]): ReturnType<typeof import('./cli-commands/uninstall.js').default>
21
+ dispatch (cmd:'update', ...args: [Argument0<typeof import('./cli-commands/update.js').default>, Argument1<typeof import('./cli-commands/update.js').default>, Argument2<typeof import('./cli-commands/update.js').default>]): ReturnType<typeof import('./cli-commands/update.js').default>
22
+ dispatch (cmd:'version', ...args: [Argument0<typeof import('./cli-commands/version.js').default>, Argument1<typeof import('./cli-commands/version.js').default>]): ReturnType<typeof import('./cli-commands/version.js').default>
23
+ }
24
+ export interface proxy
25
+ {
26
+ '$init-akala'(...args: [Argument0<typeof import('./cli-commands/$init-akala.js').default>]): ReturnType<typeof import('./cli-commands/$init-akala.js').default>
27
+ 'connect'(...args: [Argument0<typeof import('./cli-commands/connect.js').default>, Argument1<typeof import('./cli-commands/connect.js').default>]): ReturnType<typeof import('./cli-commands/connect.js').default>
28
+ 'discover'(...args: [Argument0<typeof import('./cli-commands/discover.js').default>, Argument1<typeof import('./cli-commands/discover.js').default>]): ReturnType<typeof import('./cli-commands/discover.js').default>
29
+ 'install'(...args: [Argument0<typeof import('./cli-commands/install.js').default>]): ReturnType<typeof import('./cli-commands/install.js').default>
30
+ 'link'(...args: [Argument0<typeof import('./cli-commands/link.js').default>, Argument1<typeof import('./cli-commands/link.js').default>]): ReturnType<typeof import('./cli-commands/link.js').default>
31
+ 'log'(...args: [Argument0<typeof import('./cli-commands/log.js').default>]): ReturnType<typeof import('./cli-commands/log.js').default>
32
+ 'ls'(...args: []): ReturnType<typeof import('./cli-commands/ls.js').default>
33
+ 'map'(...args: [Argument0<typeof import('./cli-commands/map.js').default>, Argument1<typeof import('./cli-commands/map.js').default>, Argument2<typeof import('./cli-commands/map.js').default>, Argument3<typeof import('./cli-commands/map.js').default>]): ReturnType<typeof import('./cli-commands/map.js').default>
34
+ 'start'(...args: [Argument1<typeof import('./cli-commands/start.js').default>, Argument2<typeof import('./cli-commands/start.js').default>]): ReturnType<typeof import('./cli-commands/start.js').default>
35
+ 'uninstall'(...args: [Argument0<typeof import('./cli-commands/uninstall.js').default>]): ReturnType<typeof import('./cli-commands/uninstall.js').default>
36
+ 'update'(...args: [Argument0<typeof import('./cli-commands/update.js').default>, Argument1<typeof import('./cli-commands/update.js').default>, Argument2<typeof import('./cli-commands/update.js').default>]): ReturnType<typeof import('./cli-commands/update.js').default>
37
+ 'version'(...args: [Argument0<typeof import('./cli-commands/version.js').default>, Argument1<typeof import('./cli-commands/version.js').default>]): ReturnType<typeof import('./cli-commands/version.js').default>
38
+ }
39
+ export const meta={"name":"pm","commands":[{"name":"$init-akala","config":{"fs":{"path":"dist/esm/cli-commands/$init-akala.js","source":"src/cli-commands/$init-akala.ts","inject":["param.0"]},"cli":{"inject":["options.pmSock"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["param.0"]}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"dist/esm/cli-commands/discover.js","source":"src/cli-commands/discover.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"usage":"discover <name> <folder>","options":{"folder":{"normalize":true}},"inject":["options.name","options.folder","$container"]}}},{"name":"install","config":{"fs":{"path":"dist/esm/cli-commands/install.js","source":"src/cli-commands/install.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"link","config":{"fs":{"path":"dist/esm/cli-commands/link.js","source":"src/cli-commands/link.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"inject":["param.0","param.1","$container"]}}},{"name":"log","config":{"fs":{"path":"dist/esm/cli-commands/log.js","source":"src/cli-commands/log.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]}}},{"name":"ls","config":{"fs":{"path":"dist/esm/cli-commands/ls.js","source":"src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"dist/esm/cli-commands/map.js","source":"src/cli-commands/map.ts","inject":["param.0","param.1","param.2","param.3"]},"":{"inject":["param.0","param.1","param.2","param.3"]},"cli":{"inject":["options.name","options.path","cwd","options"],"options":{"commandable":{"aliases":["c"],"needsValue":false},"stateless":{"aliases":["s"],"needsValue":false}},"usage":"map <name> <path>"}}},{"name":"start","config":{"fs":{"path":"dist/esm/cli-commands/start.js","source":"src/cli-commands/start.ts","inject":["$container","param.0","param.1"]},"":{"inject":["$container","param.0","param.1"]},"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["$container","options.program","context"],"usage":"start pm"}}},{"name":"uninstall","config":{"fs":{"path":"dist/esm/cli-commands/uninstall.js","source":"src/cli-commands/uninstall.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"update","config":{"fs":{"path":"dist/esm/cli-commands/update.js","source":"src/cli-commands/update.ts","inject":["param.0","param.1","param.2"]},"cli":{"inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","param.2"]}}},{"name":"version","config":{"fs":{"path":"dist/esm/cli-commands/version.js","source":"src/cli-commands/version.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"string"}}}}}],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
40
+
41
+ export function connect(processor?:ICommandProcessor) {
42
+ const container = new Container<void>("cliCommands", void 0);
43
+ registerCommands(meta.commands, processor, container);
44
+ return container as container & Container<void>;
45
+ }
46
+ }
47
+
48
+ export { cliCommands as default };
package/src/container.ts CHANGED
@@ -52,7 +52,7 @@ namespace commands
52
52
  'update'(...args: [Argument0<typeof import('./cli-commands/update.js').default>, Argument1<typeof import('./cli-commands/update.js').default>, Argument2<typeof import('./cli-commands/update.js').default>]): ReturnType<typeof import('./cli-commands/update.js').default>
53
53
  'version'(...args: [Argument0<typeof import('./cli-commands/version.js').default>, Argument1<typeof import('./cli-commands/version.js').default>]): ReturnType<typeof import('./cli-commands/version.js').default>
54
54
  }
55
- export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"disabled":true,"path":"dist/esm/commands/$init.js","source":"src/commands/$init.ts","inject":["$container","param.0"]},"":{"inject":["$container","param.0"]},"cli":{"inject":["$container","context"],"usage":"$init [...args]","options":{"configFile":{"needsValue":true,"aliases":["c"]},"keepAttached":{"needsValue":true}}}}},{"name":"bridge","config":{"fs":{"path":"dist/esm/commands/bridge.js","source":"src/commands/bridge.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["param.0"]},"":{"inject":["param.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","ignore"]},"jsonrpc":{"inject":["$container","dummy","connectionAsContainer"]},"":{"inject":["$container","connectionAsContainer"]}}},{"name":"reload-metadata","config":{"fs":{"inject":["param.0"],"path":"dist/esm/commands/reload-metadata.js","source":"src/commands/reload-metadata.ts"},"jsonrpc":{"inject":["connectionAsContainer"]},"":{"inject":["param.0"]}}},{"name":"restart","config":{"fs":{"path":"dist/esm/commands/restart.js","source":"src/commands/restart.ts","inject":["$container","param.0","param.1"]},"":{"inject":["$container","param.0","param.1"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["$container","param.0","context"],"usage":"restart <program>"},"schema":{"inject":["$container","param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"}}}}},"html-form":{"inject":["$container","param.0","param.1"]}}},{"name":"start","config":{"fs":{"path":"dist/esm/commands/start.js","source":"src/commands/start.ts","inject":["$container","param.0","param.1","param.2"]},"":{"inject":["$container","param.0","param.1","param.2"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["$container","options.program","options","context"],"usage":"start <program>"},"html-form":{"inject":["$container","param.0","param.1","param.2"]},"schema":{"inject":["$container","param.0","param.1","param.2"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"},"inspect":{"type":"boolean"},"new":{"type":"boolean"},"name":{"type":"string"},"program":{"type":"string"}}},"param.2":{"type":"object","properties":{"args":{"type":"array","items":{"type":"string"}}}}}}}},{"name":"status","config":{"fs":{"path":"dist/esm/commands/status.js","source":"src/commands/status.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]},"html-form":{"inject":["param.0"]},"schema":{"inject":["param.0"],"$defs":{"param.0":{"type":"string","description":"The name of the container to get the status of"}}}}},{"name":"stop","config":{"fs":{"path":"dist/esm/commands/stop.js","source":"src/commands/stop.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["options.process","$container"],"options":{"process":{"doc":"process to stop. Stops all the processes otherwise (including pm)."}},"usage":"stop [process]"},"html-form":{"inject":["param.0","$container"]},"schema":{"inject":["param.0","$container"],"$defs":{"param.0":{"type":"string"}}}}},{"name":"$init-akala","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/$init-akala.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/$init-akala.ts","inject":["param.0"]},"cli":{"inject":["options.pmSock"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["param.0"]}}},{"name":"connect","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/connect.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/connect.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/discover.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/discover.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"usage":"discover <name> <folder>","options":{"folder":{"normalize":true}},"inject":["options.name","options.folder","$container"]}}},{"name":"install","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/install.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/install.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"link","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/link.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/link.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"inject":["param.0","param.1","$container"]}}},{"name":"log","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/log.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/log.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]}}},{"name":"ls","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/ls.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/map.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/map.ts","inject":["param.0","param.1","param.2","param.3"]},"":{"inject":["param.0","param.1","param.2","param.3"]},"cli":{"inject":["options.name","options.path","cwd","options"],"options":{"commandable":{"aliases":["c"],"needsValue":false},"stateless":{"aliases":["s"],"needsValue":false}},"usage":"map <name> <path>"}}},{"name":"uninstall","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/uninstall.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/uninstall.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"update","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/update.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/update.ts","inject":["param.0","param.1","param.2"]},"cli":{"inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","param.2"]}}},{"name":"version","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/version.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/version.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"string"}}}}}],"extends":["./cli-commands.json"],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
55
+ export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"disabled":true,"path":"dist/esm/commands/$init.js","source":"src/commands/$init.ts","inject":["$container","param.0"]},"":{"inject":["$container","param.0"]},"cli":{"inject":["$container","context"],"usage":"$init [...args]","options":{"configFile":{"needsValue":true,"aliases":["c"]},"keepAttached":{"needsValue":true}}}}},{"name":"bridge","config":{"fs":{"path":"dist/esm/commands/bridge.js","source":"src/commands/bridge.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["param.0"]},"":{"inject":["param.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","ignore"]},"jsonrpc":{"inject":["$container","dummy","connectionAsContainer"]},"":{"inject":["$container","connectionAsContainer"]}}},{"name":"reload-metadata","config":{"fs":{"inject":["param.0"],"path":"dist/esm/commands/reload-metadata.js","source":"src/commands/reload-metadata.ts"},"jsonrpc":{"inject":["connectionAsContainer"]},"":{"inject":["param.0"]}}},{"name":"restart","config":{"fs":{"path":"dist/esm/commands/restart.js","source":"src/commands/restart.ts","inject":["$container","param.0","param.1"]},"":{"inject":["$container","param.0","param.1"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["$container","param.0","context"],"usage":"restart <program>"},"schema":{"inject":["$container","param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"}}}}},"html-form":{"inject":["$container","param.0","param.1"]}}},{"name":"start","config":{"fs":{"path":"dist/esm/commands/start.js","source":"src/commands/start.ts","inject":["$container","param.0","param.1","param.2"]},"":{"inject":["$container","param.0","param.1","param.2"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"},"autostart":{"doc":"start automatically when pm starts"}},"inject":["$container","options.program","options","context"],"usage":"start <program>"},"html-form":{"inject":["$container","param.0","param.1","param.2"]},"schema":{"inject":["$container","param.0","param.1","param.2"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"},"inspect":{"type":"boolean"},"new":{"type":"boolean"},"name":{"type":"string"},"program":{"type":"string"}}},"param.2":{"type":"object","properties":{"args":{"type":"array","items":{"type":"string"}}}}}}}},{"name":"status","config":{"fs":{"path":"dist/esm/commands/status.js","source":"src/commands/status.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]},"html-form":{"inject":["param.0"]},"schema":{"inject":["param.0"],"$defs":{"param.0":{"type":"string","description":"The name of the container to get the status of"}}}}},{"name":"stop","config":{"fs":{"path":"dist/esm/commands/stop.js","source":"src/commands/stop.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["options.process","$container"],"options":{"process":{"doc":"process to stop. Stops all the processes otherwise (including pm)."}},"usage":"stop [process]"},"html-form":{"inject":["param.0","$container"]},"schema":{"inject":["param.0","$container"],"$defs":{"param.0":{"type":"string"}}}}},{"name":"$init-akala","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/$init-akala.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/$init-akala.ts","inject":["param.0"]},"cli":{"inject":["options.pmSock"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["param.0"]}}},{"name":"connect","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/connect.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/connect.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/discover.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/discover.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"usage":"discover <name> <folder>","options":{"folder":{"normalize":true}},"inject":["options.name","options.folder","$container"]}}},{"name":"install","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/install.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/install.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"link","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/link.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/link.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"inject":["param.0","param.1","$container"]}}},{"name":"log","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/log.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/log.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]}}},{"name":"ls","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/ls.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/map.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/map.ts","inject":["param.0","param.1","param.2","param.3"]},"":{"inject":["param.0","param.1","param.2","param.3"]},"cli":{"inject":["options.name","options.path","cwd","options"],"options":{"commandable":{"aliases":["c"],"needsValue":false},"stateless":{"aliases":["s"],"needsValue":false}},"usage":"map <name> <path>"}}},{"name":"uninstall","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/uninstall.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/uninstall.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"update","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/update.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/update.ts","inject":["param.0","param.1","param.2"]},"cli":{"inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","param.2"]}}},{"name":"version","config":{"fs":{"path":"/home/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/version.js","source":"/home/nicolas/dev/akala/packages/pm/src/cli-commands/version.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"string"}}}}}],"extends":["./cli-commands.json"],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
56
56
 
57
57
  export function connect(processor?:ICommandProcessor) {
58
58
  const container = new Container<void>("commands", void 0);