@procedures/server 0.3.0 → 0.5.0
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 +62 -0
- package/README.md +44 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +53 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +24 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +29 -0
- package/dist/module.js.map +1 -0
- package/dist/procedures/server.start.d.ts +17 -0
- package/dist/procedures/server.start.d.ts.map +1 -0
- package/dist/procedures/server.start.js +183 -0
- package/dist/procedures/server.start.js.map +1 -0
- package/dist/procedures/server.status.d.ts +15 -0
- package/dist/procedures/server.status.d.ts.map +1 -0
- package/dist/procedures/server.status.js +118 -0
- package/dist/procedures/server.status.js.map +1 -0
- package/dist/procedures/server.stop.d.ts +14 -0
- package/dist/procedures/server.stop.d.ts.map +1 -0
- package/dist/procedures/server.stop.js +98 -0
- package/dist/procedures/server.stop.js.map +1 -0
- package/dist/register.d.ts +7 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +9 -0
- package/dist/register.js.map +1 -0
- package/dist/run.d.ts +5 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +48 -3
- package/dist/run.js.map +1 -1
- package/dist/schemas.d.ts +19 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +48 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +22 -7
- package/src/config.ts +52 -1
- package/src/index.ts +27 -2
- package/src/module.ts +33 -0
- package/src/procedures/server.start.ts +213 -0
- package/src/procedures/server.status.ts +141 -0
- package/src/procedures/server.stop.ts +123 -0
- package/src/register.ts +11 -0
- package/src/run.ts +52 -3
- package/src/schemas.ts +69 -0
- package/src/types.ts +83 -0
package/dist/config.d.ts
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
* Parses command line arguments for the server.
|
|
5
5
|
*/
|
|
6
6
|
import type { ServerConfig } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* This function gives the topic patterns of an `--events` value: comma-separated exact names
|
|
9
|
+
* (`orders.created`), prefixes (`orders.*`) or `*` (`documentation/EVENTS.md`). A `*` is
|
|
10
|
+
* permitted only at the end of a pattern. The patterns are the topic rule of `topicMatcher()`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseTopicPatterns(value: string): string[];
|
|
7
13
|
/**
|
|
8
14
|
* Parse command line arguments into server configuration.
|
|
9
15
|
*
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAmBhE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAa1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAsHxD"}
|
package/dist/config.js
CHANGED
|
@@ -15,6 +15,29 @@ function parsePort(value) {
|
|
|
15
15
|
}
|
|
16
16
|
return port;
|
|
17
17
|
}
|
|
18
|
+
/** The number of characters of a topic name (`MAX_TOPIC_LENGTH` of the core). */
|
|
19
|
+
const MAX_TOPIC_LENGTH = 256;
|
|
20
|
+
/**
|
|
21
|
+
* This function gives the topic patterns of an `--events` value: comma-separated exact names
|
|
22
|
+
* (`orders.created`), prefixes (`orders.*`) or `*` (`documentation/EVENTS.md`). A `*` is
|
|
23
|
+
* permitted only at the end of a pattern. The patterns are the topic rule of `topicMatcher()`.
|
|
24
|
+
*/
|
|
25
|
+
export function parseTopicPatterns(value) {
|
|
26
|
+
const patterns = value
|
|
27
|
+
.split(",")
|
|
28
|
+
.map((pattern) => pattern.trim())
|
|
29
|
+
.filter((pattern) => pattern.length > 0);
|
|
30
|
+
if (patterns.length === 0)
|
|
31
|
+
throw new Error("--events needs a topic pattern: an exact name, a prefix such as orders.*, or *");
|
|
32
|
+
for (const pattern of patterns) {
|
|
33
|
+
if (pattern.length > MAX_TOPIC_LENGTH)
|
|
34
|
+
throw new Error(`The topic pattern "${pattern.slice(0, 40)}..." has more than ${MAX_TOPIC_LENGTH} characters`);
|
|
35
|
+
if (pattern.slice(0, -1).includes("*")) {
|
|
36
|
+
throw new Error(`Invalid topic pattern: "${pattern}". A * is permitted only at the end (orders.* or *).`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return patterns;
|
|
40
|
+
}
|
|
18
41
|
/**
|
|
19
42
|
* Parse command line arguments into server configuration.
|
|
20
43
|
*
|
|
@@ -35,6 +58,8 @@ export function parseConfig(argv) {
|
|
|
35
58
|
let verbose = false;
|
|
36
59
|
let serverToken;
|
|
37
60
|
const expose = [];
|
|
61
|
+
const events = [];
|
|
62
|
+
let fsRoot;
|
|
38
63
|
for (let i = 0; i < argv.length; i++) {
|
|
39
64
|
const token = argv[i];
|
|
40
65
|
const eq = token.startsWith("--") ? token.indexOf("=") : -1;
|
|
@@ -92,6 +117,16 @@ export function parseConfig(argv) {
|
|
|
92
117
|
case "-e":
|
|
93
118
|
expose.push(...value().split(",").map((p) => p.trim()).filter((p) => p.length > 0));
|
|
94
119
|
break;
|
|
120
|
+
case "--events":
|
|
121
|
+
// Repeatable: each value adds its patterns to the topic rule
|
|
122
|
+
for (const pattern of parseTopicPatterns(value())) {
|
|
123
|
+
if (!events.includes(pattern))
|
|
124
|
+
events.push(pattern);
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
case "--fs-root":
|
|
128
|
+
fsRoot = value();
|
|
129
|
+
break;
|
|
95
130
|
case "--verbose":
|
|
96
131
|
case "-v":
|
|
97
132
|
verbose = true;
|
|
@@ -127,7 +162,7 @@ export function parseConfig(argv) {
|
|
|
127
162
|
}
|
|
128
163
|
return { type };
|
|
129
164
|
});
|
|
130
|
-
return { procedures, transports, verbose, token: serverToken, expose };
|
|
165
|
+
return { procedures, transports, verbose, token: serverToken, expose, events, ...(fsRoot !== undefined ? { fsRoot } : {}) };
|
|
131
166
|
}
|
|
132
167
|
function printHelp() {
|
|
133
168
|
console.log(`
|
|
@@ -166,6 +201,17 @@ OPTIONS:
|
|
|
166
201
|
(git.status) or prefixes (git.*)
|
|
167
202
|
Default: every loaded procedure
|
|
168
203
|
|
|
204
|
+
--events <patterns> The topics of the event bus that a peer can
|
|
205
|
+
subscribe to with events.subscribe: exact names
|
|
206
|
+
(orders.created), prefixes (orders.*) or *.
|
|
207
|
+
Repeatable, or comma-separated.
|
|
208
|
+
Default: no topics (TOPIC_NOT_FOUND)
|
|
209
|
+
|
|
210
|
+
--fs-root <folder> Confine each path of the fs.* procedures to this
|
|
211
|
+
folder, also the paths of their nested calls
|
|
212
|
+
from other procedures. A path outside gives
|
|
213
|
+
FORBIDDEN (outside-root). Default: no root
|
|
214
|
+
|
|
169
215
|
--verbose, -v Verbose output
|
|
170
216
|
|
|
171
217
|
--help, -h Show this help
|
|
@@ -179,6 +225,12 @@ EXAMPLES:
|
|
|
179
225
|
|
|
180
226
|
# Start with both HTTP and WebSocket
|
|
181
227
|
procedure-server -p @procedures/mongo/register -t http,websocket
|
|
228
|
+
|
|
229
|
+
# Serve the topics orders.* to subscribers over WebSocket
|
|
230
|
+
procedure-server -p ./my-procedures.js -t websocket --events "orders.*"
|
|
231
|
+
|
|
232
|
+
# Confine the file procedures to one folder
|
|
233
|
+
procedure-server -p @procedures/fs --fs-root ./data
|
|
182
234
|
`);
|
|
183
235
|
}
|
|
184
236
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAU,CAAC;AAEhE;;;GAGG;AACH,SAAS,SAAS,CAAC,KAAa;IAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,mCAAmC,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,IAAc;IACxC,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,KAAK,GAA8B,EAAE,CAAC;IAC5C,IAAI,IAAwB,CAAC;IAC7B,IAAI,IAAwB,CAAC;IAC7B,IAAI,QAA4B,CAAC;IACjC,IAAI,IAAyB,CAAC;IAC9B,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,WAAsC,CAAC;IAC3C,MAAM,MAAM,GAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAU,CAAC;AAEhE;;;GAGG;AACH,SAAS,SA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C,EAAE,CAAC;AAC9H,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEb,CAAC,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
* starts nothing: `runServer(argv)` is the CLI (`server` and `mark serve`), and `startServer()`
|
|
6
6
|
* starts a server from a parsed configuration.
|
|
7
7
|
*/
|
|
8
|
-
export { parseConfig } from "./config.js";
|
|
8
|
+
export { parseConfig, parseTopicPatterns } from "./config.js";
|
|
9
9
|
export { runServer, startServer, loadProcedureModule, type RunningServer, type ServerRunOptions } from "./run.js";
|
|
10
|
-
export type { ServerConfig, TransportConfig, ServerCreateResult } from "./types.js";
|
|
10
|
+
export type { ServerConfig, TransportConfig, ServerCreateResult, ServerStartInput, ServerStartOutput, ServerStopInput, ServerStopOutput, ServerStatusInput, ServerStatusOutput, } from "./types.js";
|
|
11
|
+
export * from "./module.js";
|
|
12
|
+
export { serverStartProcedure } from "./procedures/server.start.js";
|
|
13
|
+
export { serverStopProcedure } from "./procedures/server.stop.js";
|
|
14
|
+
export { serverStatusProcedure } from "./procedures/server.status.js";
|
|
15
|
+
export { serverStartInputSchema, serverStopInputSchema, serverStatusInputSchema, ServerStartOutputSchema, ServerStopOutputSchema, ServerStatusOutputSchema, } from "./schemas.js";
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAClH,YAAY,EACV,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAIpB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* starts nothing: `runServer(argv)` is the CLI (`server` and `mark serve`), and `startServer()`
|
|
6
6
|
* starts a server from a parsed configuration.
|
|
7
7
|
*/
|
|
8
|
-
export { parseConfig } from "./config.js";
|
|
8
|
+
export { parseConfig, parseTopicPatterns } from "./config.js";
|
|
9
9
|
export { runServer, startServer, loadProcedureModule } from "./run.js";
|
|
10
|
+
// server.start, server.stop and server.status (from @procedures/peer). The root registers
|
|
11
|
+
// nothing: import "@procedures/server/register", or give the module to createRegistry().
|
|
12
|
+
export * from "./module.js";
|
|
13
|
+
export { serverStartProcedure } from "./procedures/server.start.js";
|
|
14
|
+
export { serverStopProcedure } from "./procedures/server.stop.js";
|
|
15
|
+
export { serverStatusProcedure } from "./procedures/server.status.js";
|
|
16
|
+
export { serverStartInputSchema, serverStopInputSchema, serverStatusInputSchema, ServerStartOutputSchema, ServerStopOutputSchema, ServerStatusOutputSchema, } from "./schemas.js";
|
|
10
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAA6C,MAAM,UAAU,CAAC;AAalH,0FAA0F;AAC1F,yFAAyF;AACzF,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,cAAc,CAAC"}
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module (no side effects): the procedures of this package as data, for `createRegistry()`.
|
|
3
|
+
*
|
|
4
|
+
* The package holds the host: the `server` CLI, `mark serve`, and the procedures that manage the
|
|
5
|
+
* background server of the `mark` CLI. `server.start`, `server.stop` and `server.status` came
|
|
6
|
+
* from `@procedures/peer`. Their names stay the same. The other `server.*` procedures
|
|
7
|
+
* (`server.create`, `server.connect` and the others) stay in the peer package.
|
|
8
|
+
*/
|
|
9
|
+
import { type AnyProcedure, type ProcedureModule, type ProcedureRegistry } from "@procedures/client";
|
|
10
|
+
/** The procedures of the host: `server.start`, `server.stop` and `server.status`. */
|
|
11
|
+
export declare const hostProcedures: readonly AnyProcedure[];
|
|
12
|
+
/**
|
|
13
|
+
* The module of this package, for `createRegistry()`: its procedures as data. Importing this
|
|
14
|
+
* file registers nothing. (`register.ts` registers the same procedures in the global registry.)
|
|
15
|
+
*/
|
|
16
|
+
export declare const serverModule: ProcedureModule;
|
|
17
|
+
export default serverModule;
|
|
18
|
+
/**
|
|
19
|
+
* This function registers the procedures of @procedures/server in a registry. The default is the
|
|
20
|
+
* global registry. Importing this file registers nothing: the `./register` entry starts this
|
|
21
|
+
* function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerServerProcedures(registry?: ProcedureRegistry): void;
|
|
24
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAqD,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAKxJ,qFAAqF;AACrF,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAAuE,CAAC;AAE1H;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,eAAyE,CAAC;eAEtF,YAAY;AAE3B;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,GAAE,iBAAsC,GAAG,IAAI,CAE/F"}
|
package/dist/module.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module (no side effects): the procedures of this package as data, for `createRegistry()`.
|
|
3
|
+
*
|
|
4
|
+
* The package holds the host: the `server` CLI, `mark serve`, and the procedures that manage the
|
|
5
|
+
* background server of the `mark` CLI. `server.start`, `server.stop` and `server.status` came
|
|
6
|
+
* from `@procedures/peer`. Their names stay the same. The other `server.*` procedures
|
|
7
|
+
* (`server.create`, `server.connect` and the others) stay in the peer package.
|
|
8
|
+
*/
|
|
9
|
+
import { defineModule, registerModules, PROCEDURE_REGISTRY } from "@procedures/client";
|
|
10
|
+
import { serverStartProcedure } from "./procedures/server.start.js";
|
|
11
|
+
import { serverStopProcedure } from "./procedures/server.stop.js";
|
|
12
|
+
import { serverStatusProcedure } from "./procedures/server.status.js";
|
|
13
|
+
/** The procedures of the host: `server.start`, `server.stop` and `server.status`. */
|
|
14
|
+
export const hostProcedures = [serverStartProcedure, serverStopProcedure, serverStatusProcedure];
|
|
15
|
+
/**
|
|
16
|
+
* The module of this package, for `createRegistry()`: its procedures as data. Importing this
|
|
17
|
+
* file registers nothing. (`register.ts` registers the same procedures in the global registry.)
|
|
18
|
+
*/
|
|
19
|
+
export const serverModule = defineModule("@procedures/server", [...hostProcedures]);
|
|
20
|
+
export default serverModule;
|
|
21
|
+
/**
|
|
22
|
+
* This function registers the procedures of @procedures/server in a registry. The default is the
|
|
23
|
+
* global registry. Importing this file registers nothing: the `./register` entry starts this
|
|
24
|
+
* function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
25
|
+
*/
|
|
26
|
+
export function registerServerProcedures(registry = PROCEDURE_REGISTRY) {
|
|
27
|
+
registerModules(registry, [serverModule]);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAmE,MAAM,oBAAoB,CAAC;AACxJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,qFAAqF;AACrF,MAAM,CAAC,MAAM,cAAc,GAA4B,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;AAE1H;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAoB,YAAY,CAAC,oBAAoB,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;AAErG,eAAe,YAAY,CAAC;AAE5B;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAQ,GAAsB,kBAAkB;IACvF,eAAe,CAAC,QAAQ,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedure: server.start
|
|
3
|
+
* Starts the CLI server as a background daemon
|
|
4
|
+
*
|
|
5
|
+
* The procedure came from `@procedures/peer`: it belongs to the host. The lockfiles stay in the
|
|
6
|
+
* peer package, because the peer of `mark --server` writes them.
|
|
7
|
+
*/
|
|
8
|
+
import { type Effects, type Procedure } from "@procedures/client";
|
|
9
|
+
import type { ServerStartInput, ServerStartOutput } from "../types.js";
|
|
10
|
+
export declare const serverStartProcedure: Procedure<ServerStartInput, ServerStartOutput, {
|
|
11
|
+
description: string;
|
|
12
|
+
effects: Effects;
|
|
13
|
+
args: string[];
|
|
14
|
+
shorts: Record<string, string>;
|
|
15
|
+
}>;
|
|
16
|
+
export type { ServerStartInput, ServerStartOutput };
|
|
17
|
+
//# sourceMappingURL=server.start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.start.d.ts","sourceRoot":"","sources":["../../src/procedures/server.start.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/F,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAyEvE,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAC1C,gBAAgB,EAChB,iBAAiB,EACjB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAuHjF,CAAC;AAEX,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedure: server.start
|
|
3
|
+
* Starts the CLI server as a background daemon
|
|
4
|
+
*
|
|
5
|
+
* The procedure came from `@procedures/peer`: it belongs to the host. The lockfiles stay in the
|
|
6
|
+
* peer package, because the peer of `mark --server` writes them.
|
|
7
|
+
*/
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
9
|
+
import * as fs from "node:fs";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
import * as os from "node:os";
|
|
12
|
+
import { createProcedure, zodAdapter } from "@procedures/client";
|
|
13
|
+
import { checkServer, readLockfileForPort } from "@procedures/peer/lockfile";
|
|
14
|
+
import { ServerStartOutputSchema, serverStartInputSchema } from "../schemas.js";
|
|
15
|
+
const MARK_DIR = path.join(os.homedir(), ".mark");
|
|
16
|
+
const SERVERS_DIR = path.join(MARK_DIR, "servers");
|
|
17
|
+
const LOG_PATH = path.join(MARK_DIR, "server.log");
|
|
18
|
+
const LOG_PREV_PATH = path.join(MARK_DIR, "server.log.1");
|
|
19
|
+
const serverStartOutputSchema = zodAdapter(ServerStartOutputSchema);
|
|
20
|
+
/**
|
|
21
|
+
* Check if process is alive
|
|
22
|
+
*/
|
|
23
|
+
function isProcessAlive(pid) {
|
|
24
|
+
try {
|
|
25
|
+
process.kill(pid, 0);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rotate log file
|
|
34
|
+
*/
|
|
35
|
+
function rotateLog() {
|
|
36
|
+
try {
|
|
37
|
+
fs.mkdirSync(MARK_DIR, { recursive: true });
|
|
38
|
+
if (fs.existsSync(LOG_PATH)) {
|
|
39
|
+
fs.renameSync(LOG_PATH, LOG_PREV_PATH);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Ignore rotation errors
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Find the CLI entry point
|
|
48
|
+
*/
|
|
49
|
+
function findCliPath() {
|
|
50
|
+
// First, try to use the currently running script if it's the CLI
|
|
51
|
+
const currentScript = process.argv[1];
|
|
52
|
+
if (currentScript) {
|
|
53
|
+
// Normalize path for cross-platform check
|
|
54
|
+
const normalized = currentScript.replace(/\\/g, "/");
|
|
55
|
+
// mark runs as dist/bin.js (its bin) or dist/cli.js
|
|
56
|
+
if (normalized.endsWith("/dist/bin.js") || normalized.endsWith("cli.js") || normalized.includes("cli/dist")) {
|
|
57
|
+
// Return absolute path
|
|
58
|
+
return path.resolve(currentScript);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Try to find the mark CLI in node_modules or as a direct path
|
|
62
|
+
const candidates = [
|
|
63
|
+
path.join(process.cwd(), "node_modules", "@procedures", "mark", "dist", "cli.js"),
|
|
64
|
+
path.join(process.cwd(), "node_modules", ".bin", "mark"),
|
|
65
|
+
// Check parent directories for monorepo setups
|
|
66
|
+
path.join(process.cwd(), "..", "cli", "dist", "cli.js"),
|
|
67
|
+
// Direct check in current directory
|
|
68
|
+
path.join(process.cwd(), "dist", "cli.js"),
|
|
69
|
+
];
|
|
70
|
+
// Check which candidate exists
|
|
71
|
+
for (const candidate of candidates) {
|
|
72
|
+
if (fs.existsSync(candidate)) {
|
|
73
|
+
return candidate;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Fallback: try mark in PATH (will fail if not installed globally)
|
|
77
|
+
return "mark";
|
|
78
|
+
}
|
|
79
|
+
export const serverStartProcedure = createProcedure()
|
|
80
|
+
.path(["server", "start"])
|
|
81
|
+
.input(serverStartInputSchema)
|
|
82
|
+
.output(serverStartOutputSchema)
|
|
83
|
+
.meta({
|
|
84
|
+
description: "Start CLI server as background daemon",
|
|
85
|
+
// The daemon loads the procedure packages of the workspace. The procedure moves server.log
|
|
86
|
+
// over server.log.1.
|
|
87
|
+
effects: { reads: ["fs", "server"], writes: ["fs", "network", "process", "server"] },
|
|
88
|
+
args: [],
|
|
89
|
+
shorts: { port: "p", host: "h" },
|
|
90
|
+
})
|
|
91
|
+
.handler(async (input) => {
|
|
92
|
+
const port = input.port ?? 3000;
|
|
93
|
+
// Loopback by default; pass host: "0.0.0.0" to expose on the LAN deliberately.
|
|
94
|
+
// See documentation/BUGS-2026-07.md (H19).
|
|
95
|
+
const host = input.host ?? "127.0.0.1";
|
|
96
|
+
const transport = input.transport ?? "http";
|
|
97
|
+
// Check if server is already running on this port
|
|
98
|
+
const existing = readLockfileForPort(port);
|
|
99
|
+
if (existing && (await checkServer(existing)) === "alive") {
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
message: `Server already running on port ${port} (PID ${existing.pid})`,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// Rotate log file
|
|
106
|
+
rotateLog();
|
|
107
|
+
// Ensure directories exist
|
|
108
|
+
fs.mkdirSync(SERVERS_DIR, { recursive: true });
|
|
109
|
+
// Open log file for writing
|
|
110
|
+
const logFd = fs.openSync(LOG_PATH, "a");
|
|
111
|
+
// Find CLI path
|
|
112
|
+
const cliPath = findCliPath();
|
|
113
|
+
// Build arguments
|
|
114
|
+
const args = ["--server", "--port", String(port), "--host", host];
|
|
115
|
+
if (transport !== "http") {
|
|
116
|
+
args.push("--transport", transport);
|
|
117
|
+
}
|
|
118
|
+
// Determine how to spawn
|
|
119
|
+
let spawnCmd;
|
|
120
|
+
let spawnArgs;
|
|
121
|
+
if (cliPath === "mark" || cliPath.endsWith(".bin/mark") || cliPath.endsWith(".bin\\mark")) {
|
|
122
|
+
// Use mark command directly
|
|
123
|
+
spawnCmd = cliPath;
|
|
124
|
+
spawnArgs = args;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Use node to run the JS file
|
|
128
|
+
spawnCmd = process.execPath;
|
|
129
|
+
spawnArgs = [cliPath, ...args];
|
|
130
|
+
}
|
|
131
|
+
// Spawn daemon process
|
|
132
|
+
const child = spawn(spawnCmd, spawnArgs, {
|
|
133
|
+
detached: true,
|
|
134
|
+
stdio: ["ignore", logFd, logFd],
|
|
135
|
+
env: { ...process.env },
|
|
136
|
+
cwd: process.cwd(),
|
|
137
|
+
// No console window on Windows (deep dive CLI-16)
|
|
138
|
+
windowsHide: true,
|
|
139
|
+
});
|
|
140
|
+
// Unref so parent can exit
|
|
141
|
+
child.unref();
|
|
142
|
+
fs.closeSync(logFd);
|
|
143
|
+
// Poll for lockfile (server takes ~4-8s to load ecosystem)
|
|
144
|
+
const maxWait = 15000;
|
|
145
|
+
const pollInterval = 500;
|
|
146
|
+
const startTime = Date.now();
|
|
147
|
+
while (Date.now() - startTime < maxWait) {
|
|
148
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
149
|
+
// Check if child died
|
|
150
|
+
if (child.pid && !isProcessAlive(child.pid)) {
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
// Check for lockfile
|
|
154
|
+
const lockfile = readLockfileForPort(port);
|
|
155
|
+
if (lockfile && (await checkServer(lockfile)) === "alive") {
|
|
156
|
+
return {
|
|
157
|
+
success: true,
|
|
158
|
+
pid: lockfile.pid,
|
|
159
|
+
port: lockfile.port,
|
|
160
|
+
endpoint: lockfile.endpoint,
|
|
161
|
+
logFile: LOG_PATH,
|
|
162
|
+
message: `Server started (PID ${lockfile.pid})`,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Timed out waiting for lockfile, but child may still be alive
|
|
167
|
+
if (child.pid && isProcessAlive(child.pid)) {
|
|
168
|
+
return {
|
|
169
|
+
success: true,
|
|
170
|
+
pid: child.pid,
|
|
171
|
+
port,
|
|
172
|
+
endpoint: `http://${host === "0.0.0.0" ? "localhost" : host}:${port}/api`,
|
|
173
|
+
logFile: LOG_PATH,
|
|
174
|
+
message: `Server starting (PID ${child.pid}, still loading...)`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
success: false,
|
|
179
|
+
message: `Failed to start server. Check ${LOG_PATH} for details.`,
|
|
180
|
+
};
|
|
181
|
+
})
|
|
182
|
+
.build();
|
|
183
|
+
//# sourceMappingURL=server.start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.start.js","sourceRoot":"","sources":["../../src/procedures/server.start.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAgC,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGhF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AAClD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACnD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAE1D,MAA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GAAG;gBACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE,uBAAuB,QAAQ,CAAC,GAAG,GAAG;aAChD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,+DAA+D;IAC/D,IAAI,KAAK,CAAC,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,IAAI;YACJ,QAAQ,EAAE,UAAU,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,MAAM;YACzE,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,wBAAwB,KAAK,CAAC,GAAG,qBAAqB;SAChE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,iCAAiC,QAAQ,eAAe;KAClE,CAAC;AACJ,CAAC,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedure: server.status
|
|
3
|
+
* Gets the current CLI server status
|
|
4
|
+
*
|
|
5
|
+
* The procedure came from `@procedures/peer`: it belongs to the host.
|
|
6
|
+
*/
|
|
7
|
+
import { type Effects, type Procedure } from "@procedures/client";
|
|
8
|
+
import type { ServerStatusInput, ServerStatusOutput } from "../types.js";
|
|
9
|
+
export declare const serverStatusProcedure: Procedure<ServerStatusInput, ServerStatusOutput, {
|
|
10
|
+
description: string;
|
|
11
|
+
effects: Effects;
|
|
12
|
+
output: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type { ServerStatusInput, ServerStatusOutput };
|
|
15
|
+
//# sourceMappingURL=server.status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.status.d.ts","sourceRoot":"","sources":["../../src/procedures/server.status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAqCzE,eAAO,MAAM,qBAAqB,EAAE,SAAS,CAC3C,iBAAiB,EACjB,kBAAkB,EAClB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAsFjD,CAAC;AAEX,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedure: server.status
|
|
3
|
+
* Gets the current CLI server status
|
|
4
|
+
*
|
|
5
|
+
* The procedure came from `@procedures/peer`: it belongs to the host.
|
|
6
|
+
*/
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
import * as os from "node:os";
|
|
9
|
+
import { createProcedure, zodAdapter } from "@procedures/client";
|
|
10
|
+
import { checkServer, readAllLockfiles, readLockfileForPort, removeLockfileForPort } from "@procedures/peer/lockfile";
|
|
11
|
+
import { ServerStatusOutputSchema, serverStatusInputSchema } from "../schemas.js";
|
|
12
|
+
const MARK_DIR = path.join(os.homedir(), ".mark");
|
|
13
|
+
const LOG_PATH = path.join(MARK_DIR, "server.log");
|
|
14
|
+
const serverStatusOutputSchema = zodAdapter(ServerStatusOutputSchema);
|
|
15
|
+
/**
|
|
16
|
+
* Format uptime as human-readable string
|
|
17
|
+
*/
|
|
18
|
+
function formatUptime(startedAt) {
|
|
19
|
+
const start = new Date(startedAt).getTime();
|
|
20
|
+
const now = Date.now();
|
|
21
|
+
const diff = Math.floor((now - start) / 1000);
|
|
22
|
+
if (diff < 60) {
|
|
23
|
+
return `${diff}s`;
|
|
24
|
+
}
|
|
25
|
+
if (diff < 3600) {
|
|
26
|
+
const mins = Math.floor(diff / 60);
|
|
27
|
+
const secs = diff % 60;
|
|
28
|
+
return `${mins}m ${secs}s`;
|
|
29
|
+
}
|
|
30
|
+
if (diff < 86400) {
|
|
31
|
+
const hours = Math.floor(diff / 3600);
|
|
32
|
+
const mins = Math.floor((diff % 3600) / 60);
|
|
33
|
+
return `${hours}h ${mins}m`;
|
|
34
|
+
}
|
|
35
|
+
const days = Math.floor(diff / 86400);
|
|
36
|
+
const hours = Math.floor((diff % 86400) / 3600);
|
|
37
|
+
return `${days}d ${hours}h`;
|
|
38
|
+
}
|
|
39
|
+
export const serverStatusProcedure = createProcedure()
|
|
40
|
+
.path(["server", "status"])
|
|
41
|
+
.input(serverStatusInputSchema)
|
|
42
|
+
.output(serverStatusOutputSchema)
|
|
43
|
+
.meta({
|
|
44
|
+
description: "Get CLI server status",
|
|
45
|
+
// It deletes the lockfile of a server that does not answer
|
|
46
|
+
effects: { reads: ["fs", "server"], writes: ["fs"], idempotent: true },
|
|
47
|
+
args: [],
|
|
48
|
+
shorts: { port: "p" },
|
|
49
|
+
output: "text",
|
|
50
|
+
})
|
|
51
|
+
.handler(async (input) => {
|
|
52
|
+
// Get target servers
|
|
53
|
+
let targets;
|
|
54
|
+
if (input.port !== undefined) {
|
|
55
|
+
const lockfile = readLockfileForPort(input.port);
|
|
56
|
+
targets = lockfile ? [lockfile] : [];
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
targets = readAllLockfiles();
|
|
60
|
+
}
|
|
61
|
+
if (targets.length === 0) {
|
|
62
|
+
return {
|
|
63
|
+
running: false,
|
|
64
|
+
message: input.port
|
|
65
|
+
? `No server found on port ${input.port}`
|
|
66
|
+
: "No servers running",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
// For single server, return detailed info
|
|
70
|
+
if (targets.length === 1) {
|
|
71
|
+
const lockfile = targets[0];
|
|
72
|
+
const { pid, port, endpoint, startedAt, transport } = lockfile;
|
|
73
|
+
if ((await checkServer(lockfile)) !== "alive") {
|
|
74
|
+
removeLockfileForPort(port);
|
|
75
|
+
return {
|
|
76
|
+
running: false,
|
|
77
|
+
message: "Server is not running (cleaned up stale lockfile)",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const uptime = formatUptime(startedAt);
|
|
81
|
+
return {
|
|
82
|
+
running: true,
|
|
83
|
+
pid,
|
|
84
|
+
port,
|
|
85
|
+
endpoint,
|
|
86
|
+
transport,
|
|
87
|
+
startedAt,
|
|
88
|
+
uptime,
|
|
89
|
+
logFile: LOG_PATH,
|
|
90
|
+
message: `Server running (PID ${pid}, port ${port}, uptime ${uptime})`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Multiple servers - summarize
|
|
94
|
+
const lines = [];
|
|
95
|
+
let anyRunning = false;
|
|
96
|
+
for (const lockfile of targets) {
|
|
97
|
+
const { pid, port, endpoint, startedAt } = lockfile;
|
|
98
|
+
if ((await checkServer(lockfile)) !== "alive") {
|
|
99
|
+
removeLockfileForPort(port);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
anyRunning = true;
|
|
103
|
+
const uptime = formatUptime(startedAt);
|
|
104
|
+
lines.push(` Port ${port}: PID ${pid}, uptime ${uptime}, ${endpoint}`);
|
|
105
|
+
}
|
|
106
|
+
if (!anyRunning) {
|
|
107
|
+
return {
|
|
108
|
+
running: false,
|
|
109
|
+
message: "No servers running (cleaned up stale lockfiles)",
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
running: true,
|
|
114
|
+
message: `${lines.length} server(s) running:\n${lines.join("\n")}`,
|
|
115
|
+
};
|
|
116
|
+
})
|
|
117
|
+
.build();
|
|
118
|
+
//# sourceMappingURL=server.status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.status.js","sourceRoot":"","sources":["../../src/procedures/server.status.ts"],"names":[],"mappings":"AAAA;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pD,IAAI,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;YAC9C,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QACD,UAAU,GAAG,IAAI,CAAC;QAClB,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,SAAS,GAAG,YAAY,MAAM,KAAK,QAAQ,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,iDAAiD;SAC3D,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,wBAAwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KACnE,CAAC;AACJ,CAAC,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedure: server.stop
|
|
3
|
+
* Stops the running CLI server daemon
|
|
4
|
+
*
|
|
5
|
+
* The procedure came from `@procedures/peer`: it belongs to the host.
|
|
6
|
+
*/
|
|
7
|
+
import { type Effects, type Procedure } from "@procedures/client";
|
|
8
|
+
import type { ServerStopInput, ServerStopOutput } from "../types.js";
|
|
9
|
+
export declare const serverStopProcedure: Procedure<ServerStopInput, ServerStopOutput, {
|
|
10
|
+
description: string;
|
|
11
|
+
effects: Effects;
|
|
12
|
+
}>;
|
|
13
|
+
export type { ServerStopInput, ServerStopOutput };
|
|
14
|
+
//# sourceMappingURL=server.stop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.stop.d.ts","sourceRoot":"","sources":["../../src/procedures/server.stop.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/F,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAqBrE,eAAO,MAAM,mBAAmB,EAAE,SAAS,CACzC,eAAe,EACf,gBAAgB,EAChB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAsFjC,CAAC;AAEX,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC"}
|