@graphty/remote-logger 0.0.1 → 1.1.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.
Files changed (48) hide show
  1. package/README.md +636 -28
  2. package/bin/remote-log-server.js +3 -0
  3. package/dist/client/RemoteLogClient.d.ts +114 -0
  4. package/dist/client/RemoteLogClient.d.ts.map +1 -0
  5. package/dist/client/RemoteLogClient.js +238 -0
  6. package/dist/client/RemoteLogClient.js.map +1 -0
  7. package/dist/client/index.d.ts +7 -0
  8. package/dist/client/index.d.ts.map +1 -0
  9. package/dist/client/index.js +6 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/client/types.d.ts +47 -0
  12. package/dist/client/types.d.ts.map +1 -0
  13. package/dist/client/types.js +6 -0
  14. package/dist/client/types.js.map +1 -0
  15. package/dist/index.d.ts +22 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +23 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/server/index.d.ts +8 -0
  20. package/dist/server/index.d.ts.map +1 -0
  21. package/dist/server/index.js +8 -0
  22. package/dist/server/index.js.map +1 -0
  23. package/dist/server/log-server.d.ts +75 -0
  24. package/dist/server/log-server.d.ts.map +1 -0
  25. package/dist/server/log-server.js +453 -0
  26. package/dist/server/log-server.js.map +1 -0
  27. package/dist/server/self-signed-cert.d.ts +30 -0
  28. package/dist/server/self-signed-cert.d.ts.map +1 -0
  29. package/dist/server/self-signed-cert.js +83 -0
  30. package/dist/server/self-signed-cert.js.map +1 -0
  31. package/dist/ui/ConsoleCaptureUI.d.ts +118 -0
  32. package/dist/ui/ConsoleCaptureUI.d.ts.map +1 -0
  33. package/dist/ui/ConsoleCaptureUI.js +571 -0
  34. package/dist/ui/ConsoleCaptureUI.js.map +1 -0
  35. package/dist/ui/index.d.ts +15 -0
  36. package/dist/ui/index.d.ts.map +1 -0
  37. package/dist/ui/index.js +15 -0
  38. package/dist/ui/index.js.map +1 -0
  39. package/package.json +80 -7
  40. package/src/client/RemoteLogClient.ts +280 -0
  41. package/src/client/index.ts +7 -0
  42. package/src/client/types.ts +49 -0
  43. package/src/index.ts +28 -0
  44. package/src/server/index.ts +17 -0
  45. package/src/server/log-server.ts +571 -0
  46. package/src/server/self-signed-cert.ts +93 -0
  47. package/src/ui/ConsoleCaptureUI.ts +649 -0
  48. package/src/ui/index.ts +15 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleCaptureUI.js","sourceRoot":"","sources":["../../src/ui/ConsoleCaptureUI.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAyBH,6CAA6C;AAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAKzB;;;OAGG;IACH;QARQ,SAAI,GAAuB,EAAE,CAAC;QAE9B,oBAAe,GAAuB,IAAI,CAAC;QAO/C,8CAA8C;QAC9C,IAAI,CAAC,eAAe,GAAG;YACnB,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC;YAC1C,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;YAC9C,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;YAC5C,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;YAC5C,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;SACjD,CAAC;QAEF,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACK,gBAAgB;QACpB,MAAM,OAAO,GAAoB;YAC7B,KAAK;YACL,OAAO;YACP,MAAM;YACN,MAAM;YACN,OAAO;SACV,CAAC;QACF,KAAK,MAAM,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CAAC;QAED,wBAAwB;QACxB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC,WAAW,CAAC;QAC9B,CAAC;IACL,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAChC,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * UI components for console capture and display.
3
+ *
4
+ * Usage:
5
+ * import { initConsoleCaptureUI } from "@graphty/remote-logger/ui";
6
+ * initConsoleCaptureUI();
7
+ *
8
+ * Or access programmatically:
9
+ * import { ConsoleCaptureUI } from "@graphty/remote-logger/ui";
10
+ * const ui = new ConsoleCaptureUI();
11
+ * console.log("This will be captured");
12
+ * console.log(ui.getLogs());
13
+ */
14
+ export { ConsoleCaptureUI, initConsoleCaptureUI } from "./ConsoleCaptureUI.js";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * UI components for console capture and display.
3
+ *
4
+ * Usage:
5
+ * import { initConsoleCaptureUI } from "@graphty/remote-logger/ui";
6
+ * initConsoleCaptureUI();
7
+ *
8
+ * Or access programmatically:
9
+ * import { ConsoleCaptureUI } from "@graphty/remote-logger/ui";
10
+ * const ui = new ConsoleCaptureUI();
11
+ * console.log("This will be captured");
12
+ * console.log(ui.getLogs());
13
+ */
14
+ export { ConsoleCaptureUI, initConsoleCaptureUI } from "./ConsoleCaptureUI.js";
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,83 @@
1
1
  {
2
2
  "name": "@graphty/remote-logger",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @graphty/remote-logger",
3
+ "version": "1.1.1",
4
+ "description": "Remote logging client and server for browser debugging",
5
+ "author": "Adam Powers <apowers@ato.ms>",
6
+ "main": "dist/index.js",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./server": {
14
+ "import": "./dist/server/index.js",
15
+ "types": "./dist/server/index.d.ts"
16
+ },
17
+ "./client": {
18
+ "import": "./dist/client/index.js",
19
+ "types": "./dist/client/index.d.ts"
20
+ },
21
+ "./ui": {
22
+ "import": "./dist/ui/index.js",
23
+ "types": "./dist/ui/index.d.ts"
24
+ }
25
+ },
26
+ "types": "dist/index.d.ts",
27
+ "bin": {
28
+ "remote-log-server": "./bin/remote-log-server.js"
29
+ },
30
+ "files": [
31
+ "dist/",
32
+ "bin/",
33
+ "src/",
34
+ "README.md",
35
+ "LICENSE"
36
+ ],
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/graphty-org/graphty-monorepo.git",
40
+ "directory": "remote-logger"
41
+ },
5
42
  "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
10
- }
43
+ "logging",
44
+ "remote-logging",
45
+ "debug",
46
+ "browser",
47
+ "server",
48
+ "typescript"
49
+ ],
50
+ "license": "MIT",
51
+ "publishConfig": {
52
+ "access": "public",
53
+ "provenance": true
54
+ },
55
+ "bugs": {
56
+ "url": "https://github.com/graphty-org/graphty-monorepo/issues"
57
+ },
58
+ "homepage": "https://github.com/graphty-org/graphty-monorepo/tree/master/remote-logger#readme",
59
+ "engines": {
60
+ "node": ">=18.19.0"
61
+ },
62
+ "dependencies": {
63
+ "selfsigned": "^2.4.1"
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "^20.0.0",
67
+ "@vitest/coverage-v8": "^3.2.3",
68
+ "typescript": "^5.8.3",
69
+ "vitest": "^3.2.3"
70
+ },
71
+ "scripts": {
72
+ "test": "vitest",
73
+ "test:run": "vitest run",
74
+ "coverage": "vitest run --coverage",
75
+ "coverage:preview": "npx serve coverage -p 9055",
76
+ "lint": "eslint && tsc --noEmit -p tsconfig.eslint.json",
77
+ "lint:fix": "eslint --fix",
78
+ "typecheck": "tsc --noEmit",
79
+ "build": "tsc",
80
+ "build:watch": "tsc --watch",
81
+ "dev": "tsc --watch"
82
+ }
83
+ }
@@ -0,0 +1,280 @@
1
+ /**
2
+ * Browser client for sending log messages to a remote server.
3
+ * Provides batching and automatic retry with exponential backoff.
4
+ * @module client/RemoteLogClient
5
+ */
6
+
7
+ import type { LogEntry, RemoteLogClientOptions, ThrottlePattern } from "./types.js";
8
+
9
+ /** Default configuration values */
10
+ const DEFAULT_BATCH_INTERVAL_MS = 1000;
11
+ const DEFAULT_MAX_RETRIES = 3;
12
+ const DEFAULT_RETRY_DELAY_MS = 1000;
13
+ const DEFAULT_SESSION_PREFIX = "session";
14
+
15
+ /**
16
+ * Generates a unique session ID with the given prefix.
17
+ * Format: {prefix}-{timestamp}-{random}
18
+ * @param prefix - The prefix to use for the session ID
19
+ * @returns A unique session ID string
20
+ */
21
+ function generateSessionId(prefix: string): string {
22
+ const timestamp = Date.now().toString(36);
23
+ const random = Math.random().toString(36).substring(2, 8);
24
+ return `${prefix}-${timestamp}-${random}`;
25
+ }
26
+
27
+ /**
28
+ * Client for sending log messages to a remote logging server.
29
+ *
30
+ * Features:
31
+ * - Batches multiple log entries before sending
32
+ * - Automatic retry with exponential backoff on network failures
33
+ * - Unique session ID for correlating logs
34
+ * @example
35
+ * ```typescript
36
+ * const client = new RemoteLogClient({
37
+ * serverUrl: "http://localhost:9080",
38
+ * sessionPrefix: "myapp",
39
+ * });
40
+ *
41
+ * client.log("INFO", "User logged in", { userId: 123 });
42
+ * client.log("DEBUG", "Loading data...");
43
+ *
44
+ * // Flush immediately when needed
45
+ * await client.flush();
46
+ *
47
+ * // Clean up when done
48
+ * await client.close();
49
+ * ```
50
+ */
51
+ export class RemoteLogClient {
52
+ /** Unique identifier for this logging session */
53
+ readonly sessionId: string;
54
+
55
+ private readonly serverUrl: string;
56
+ private readonly batchIntervalMs: number;
57
+ private readonly maxRetries: number;
58
+ private readonly retryDelayMs: number;
59
+ private readonly throttlePatterns: ThrottlePattern[];
60
+
61
+ private pendingLogs: LogEntry[] = [];
62
+ private batchTimer: ReturnType<typeof setTimeout> | null = null;
63
+ private isClosed = false;
64
+ private flushPromise: Promise<void> | null = null;
65
+
66
+ /** Tracks when each throttle pattern was last allowed through */
67
+ private throttleLastTimes = new Map<string, number>();
68
+
69
+ /**
70
+ * Creates a new RemoteLogClient.
71
+ * @param options - Configuration options
72
+ */
73
+ constructor(options: RemoteLogClientOptions) {
74
+ this.serverUrl = options.serverUrl;
75
+ this.sessionId = generateSessionId(options.sessionPrefix ?? DEFAULT_SESSION_PREFIX);
76
+ this.batchIntervalMs = options.batchIntervalMs ?? DEFAULT_BATCH_INTERVAL_MS;
77
+ this.maxRetries = options.maxRetries ?? DEFAULT_MAX_RETRIES;
78
+ this.retryDelayMs = options.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;
79
+ this.throttlePatterns = options.throttlePatterns ?? [];
80
+ }
81
+
82
+ /**
83
+ * Checks if a message should be throttled based on configured patterns.
84
+ * Updates the last time tracking if the message is allowed through.
85
+ * @param message - The message to check
86
+ * @returns true if the message should be dropped (throttled)
87
+ */
88
+ private shouldThrottle(message: string): boolean {
89
+ const now = Date.now();
90
+
91
+ for (const { pattern, intervalMs } of this.throttlePatterns) {
92
+ if (pattern.test(message)) {
93
+ const key = pattern.source;
94
+ const lastTime = this.throttleLastTimes.get(key) ?? 0;
95
+
96
+ if (now - lastTime < intervalMs) {
97
+ // Within throttle window, drop this message
98
+ return true;
99
+ }
100
+
101
+ // Outside throttle window, update timestamp and allow through
102
+ this.throttleLastTimes.set(key, now);
103
+ return false;
104
+ }
105
+ }
106
+
107
+ // No matching pattern, allow through
108
+ return false;
109
+ }
110
+
111
+ /**
112
+ * Logs a message at the specified level.
113
+ * @param level - Log level (e.g., "INFO", "DEBUG", "WARN", "ERROR")
114
+ * @param message - The log message
115
+ * @param data - Optional additional data to include
116
+ */
117
+ log(level: string, message: string, data?: Record<string, unknown>): void {
118
+ if (this.isClosed) {
119
+ return;
120
+ }
121
+
122
+ // Check throttling before adding to buffer
123
+ if (this.shouldThrottle(message)) {
124
+ return;
125
+ }
126
+
127
+ const entry: LogEntry = {
128
+ time: new Date().toISOString(),
129
+ level,
130
+ message,
131
+ ...(data !== undefined && { data }),
132
+ };
133
+
134
+ this.pendingLogs.push(entry);
135
+ this.scheduleBatchSend();
136
+ }
137
+
138
+ /**
139
+ * Schedules a batch send after the configured interval.
140
+ * If a timer is already scheduled, does nothing.
141
+ */
142
+ private scheduleBatchSend(): void {
143
+ if (this.batchTimer !== null || this.isClosed) {
144
+ return;
145
+ }
146
+
147
+ this.batchTimer = setTimeout(() => {
148
+ this.batchTimer = null;
149
+ void this.sendBatch();
150
+ }, this.batchIntervalMs);
151
+ }
152
+
153
+ /**
154
+ * Sends the current batch of logs to the server.
155
+ * Uses retry logic with exponential backoff on failure.
156
+ */
157
+ private async sendBatch(): Promise<void> {
158
+ if (this.pendingLogs.length === 0) {
159
+ return;
160
+ }
161
+
162
+ // Take the current logs and clear the pending array
163
+ const logsToSend = this.pendingLogs;
164
+ this.pendingLogs = [];
165
+
166
+ await this.sendWithRetry(logsToSend);
167
+ }
168
+
169
+ /**
170
+ * Sends logs with retry logic using exponential backoff.
171
+ * @param logs - The log entries to send
172
+ */
173
+ private async sendWithRetry(logs: LogEntry[]): Promise<void> {
174
+ let lastError: Error | null = null;
175
+
176
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
177
+ try {
178
+ await this.sendRequest(logs);
179
+ return; // Success!
180
+ } catch (error) {
181
+ lastError = error instanceof Error ? error : new Error(String(error));
182
+
183
+ if (attempt < this.maxRetries) {
184
+ // Exponential backoff: delay * 2^attempt
185
+ const delay = this.retryDelayMs * Math.pow(2, attempt);
186
+ await this.sleep(delay);
187
+ }
188
+ }
189
+ }
190
+
191
+ // All retries exhausted - log the error but don't throw
192
+ // In a browser context, we don't want to break the application
193
+ console.error("[RemoteLogClient] Failed to send logs after retries:", lastError?.message);
194
+ }
195
+
196
+ /**
197
+ * Makes the actual HTTP request to send logs.
198
+ * @param logs - The log entries to send
199
+ * @throws Error if the request fails
200
+ */
201
+ private async sendRequest(logs: LogEntry[]): Promise<void> {
202
+ const response = await fetch(`${this.serverUrl}/log`, {
203
+ method: "POST",
204
+ headers: {
205
+ "Content-Type": "application/json",
206
+ },
207
+ body: JSON.stringify({
208
+ sessionId: this.sessionId,
209
+ logs,
210
+ }),
211
+ });
212
+
213
+ if (!response.ok) {
214
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Helper to sleep for the specified duration.
220
+ * @param ms - Milliseconds to sleep
221
+ * @returns A promise that resolves after the specified time
222
+ */
223
+ private sleep(ms: number): Promise<void> {
224
+ return new Promise((resolve) => setTimeout(resolve, ms));
225
+ }
226
+
227
+ /**
228
+ * Immediately flushes all pending logs to the server.
229
+ * Useful before page unload or when immediate delivery is needed.
230
+ */
231
+ async flush(): Promise<void> {
232
+ // Cancel any scheduled batch
233
+ if (this.batchTimer !== null) {
234
+ clearTimeout(this.batchTimer);
235
+ this.batchTimer = null;
236
+ }
237
+
238
+ // Wait for any in-progress flush
239
+ if (this.flushPromise !== null) {
240
+ await this.flushPromise;
241
+ }
242
+
243
+ // Send any remaining logs
244
+ if (this.pendingLogs.length > 0) {
245
+ this.flushPromise = this.sendBatch();
246
+ await this.flushPromise;
247
+ this.flushPromise = null;
248
+ }
249
+ }
250
+
251
+ /**
252
+ * Closes the client, flushing any pending logs and stopping the batch timer.
253
+ * After calling close(), no more logs will be accepted.
254
+ */
255
+ async close(): Promise<void> {
256
+ if (this.isClosed) {
257
+ return;
258
+ }
259
+
260
+ this.isClosed = true;
261
+
262
+ // Flush remaining logs
263
+ await this.flush();
264
+ }
265
+ }
266
+
267
+ /**
268
+ * Factory function to create a RemoteLogClient.
269
+ * @param options - Configuration options
270
+ * @returns A new RemoteLogClient instance
271
+ * @example
272
+ * ```typescript
273
+ * const client = createRemoteLogClient({
274
+ * serverUrl: "http://localhost:9080",
275
+ * });
276
+ * ```
277
+ */
278
+ export function createRemoteLogClient(options: RemoteLogClientOptions): RemoteLogClient {
279
+ return new RemoteLogClient(options);
280
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Browser client for remote logging.
3
+ * @module client
4
+ */
5
+
6
+ export { createRemoteLogClient, RemoteLogClient } from "./RemoteLogClient.js";
7
+ export type { LogEntry, RemoteLogClientOptions, ThrottlePattern } from "./types.js";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Type definitions for the remote logging client.
3
+ * @module client/types
4
+ */
5
+
6
+ /**
7
+ * A single log entry to be sent to the remote server.
8
+ */
9
+ export interface LogEntry {
10
+ /** ISO 8601 timestamp when the log was created */
11
+ time: string;
12
+ /** Log level (e.g., "INFO", "DEBUG", "WARN", "ERROR") */
13
+ level: string;
14
+ /** The log message */
15
+ message: string;
16
+ /** Optional additional data to include with the log */
17
+ data?: Record<string, unknown>;
18
+ }
19
+
20
+ /**
21
+ * Configuration for throttling specific message patterns.
22
+ */
23
+ export interface ThrottlePattern {
24
+ /** Regular expression pattern to match log messages */
25
+ pattern: RegExp;
26
+ /** Minimum interval in milliseconds between matching messages */
27
+ intervalMs: number;
28
+ }
29
+
30
+ /**
31
+ * Configuration options for the RemoteLogClient.
32
+ */
33
+ export interface RemoteLogClientOptions {
34
+ /** URL of the remote log server (e.g., "http://localhost:9080") */
35
+ serverUrl: string;
36
+ /** Prefix for the generated session ID (default: "session") */
37
+ sessionPrefix?: string;
38
+ /** Interval in milliseconds between batch sends (default: 1000) */
39
+ batchIntervalMs?: number;
40
+ /** Maximum number of retry attempts for failed sends (default: 3) */
41
+ maxRetries?: number;
42
+ /** Base delay in milliseconds between retries (uses exponential backoff) (default: 1000) */
43
+ retryDelayMs?: number;
44
+ /**
45
+ * Patterns to throttle to prevent log flooding.
46
+ * Messages matching a pattern will only be sent once per the configured interval.
47
+ */
48
+ throttlePatterns?: ThrottlePattern[];
49
+ }
package/src/index.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Remote logging client and server for browser debugging.
3
+ *
4
+ * Client usage (Browser):
5
+ * import { RemoteLogClient } from "@graphty/remote-logger";
6
+ * const client = new RemoteLogClient({ serverUrl: "http://localhost:9080" });
7
+ * client.log("INFO", "Hello from browser");
8
+ *
9
+ * Server usage (Node.js):
10
+ * import { startLogServer } from "@graphty/remote-logger/server";
11
+ * startLogServer({ port: 9080 });
12
+ *
13
+ * Or via CLI:
14
+ * npx remote-log-server --port 9080
15
+ *
16
+ * UI usage (Browser):
17
+ * import { initConsoleCaptureUI } from "@graphty/remote-logger/ui";
18
+ * initConsoleCaptureUI();
19
+ */
20
+
21
+ // Client exports (primary exports for browser usage)
22
+ // Note: Server components are NOT re-exported here because they use Node.js APIs.
23
+ // Import from "@graphty/remote-logger/server" for server-side usage.
24
+ export type { LogEntry, RemoteLogClientOptions, ThrottlePattern } from "./client/index.js";
25
+ export { createRemoteLogClient, RemoteLogClient } from "./client/index.js";
26
+
27
+ // Note: UI components are NOT re-exported here to keep the main entry lightweight.
28
+ // Import from "@graphty/remote-logger/ui" for UI usage.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Server-side logging utilities.
3
+ * These are only meant to be run in Node.js, not in the browser.
4
+ * @module server
5
+ */
6
+
7
+ export {
8
+ clearLogs,
9
+ HELP_TEXT,
10
+ type LogEntry,
11
+ type LogServerOptions,
12
+ main,
13
+ parseArgs,
14
+ type ParseArgsResult,
15
+ startLogServer,
16
+ } from "./log-server.js";
17
+ export { certFilesExist, type GeneratedCert, generateSelfSignedCert, readCertFiles } from "./self-signed-cert.js";