@ystemsrx/cfshare 0.1.2 → 0.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/README.md CHANGED
@@ -163,12 +163,42 @@ openclaw plugins enable cfshare
163
163
  openclaw gateway restart
164
164
  ```
165
165
 
166
- > [!NOTE]
167
- > If you're running in daemon mode (`--install-daemon`), you can also restart via `openclaw restart`.
168
-
169
- ---
170
-
171
- ## ⚙️ Configuration (Optional)
166
+ > [!NOTE]
167
+ > If you're running in daemon mode (`--install-daemon`), you can also restart via `openclaw restart`.
168
+
169
+ ---
170
+
171
+ ## 🖥️ Direct CLI Usage (No OpenClaw Required)
172
+
173
+ You can now call CFShare directly from the terminal after npm installation:
174
+
175
+ ```bash
176
+ npm install -g @ystemsrx/cfshare
177
+ cfshare env_check
178
+ ```
179
+
180
+ Common examples:
181
+
182
+ ```bash
183
+ # Expose an existing local service (keeps running until Ctrl+C by default)
184
+ cfshare expose_port '{"port":3000,"opts":{"access":"token"}}'
185
+
186
+ # Share files/directories
187
+ cfshare expose_files '{"paths":["./dist"],"opts":{"access":"none"}}'
188
+
189
+ # Stop an exposure
190
+ cfshare exposure_stop '{"id":"all"}'
191
+ ```
192
+
193
+ `expose_port` and `expose_files` keep the process alive by default so the tunnel stays active.
194
+ Use `--no-keep-alive` if you only want to print the result and exit.
195
+
196
+ When running as CLI, CFShare uses `~/.cfshare` by default for state, workspaces, policy, and audit files.
197
+ This is isolated from plugin mode (`~/.openclaw/cfshare`) so both can coexist safely.
198
+
199
+ ---
200
+
201
+ ## ⚙️ Configuration (Optional)
172
202
 
173
203
  CFShare works out of the box. The defaults below suit most use cases. To customize, edit `~/.openclaw/openclaw.json`:
174
204
 
package/README.zh.md CHANGED
@@ -163,12 +163,42 @@ openclaw plugins enable cfshare
163
163
  openclaw gateway restart
164
164
  ```
165
165
 
166
- > [!NOTE]
167
- > 如果你使用守护进程模式(`--install-daemon`),也可以通过 `openclaw restart` 重启。
168
-
169
- ---
170
-
171
- ## ⚙️ 配置(可选)
166
+ > [!NOTE]
167
+ > 如果你使用守护进程模式(`--install-daemon`),也可以通过 `openclaw restart` 重启。
168
+
169
+ ---
170
+
171
+ ## 🖥️ 直接命令行调用(无需 OpenClaw)
172
+
173
+ 现在你也可以在安装后直接从终端调用 CFShare:
174
+
175
+ ```bash
176
+ npm install -g @ystemsrx/cfshare
177
+ cfshare env_check
178
+ ```
179
+
180
+ 常用示例:
181
+
182
+ ```bash
183
+ # 暴露已有本地服务(默认会持续运行,直到 Ctrl+C)
184
+ cfshare expose_port '{"port":3000,"opts":{"access":"token"}}'
185
+
186
+ # 分享文件/目录
187
+ cfshare expose_files '{"paths":["./dist"],"opts":{"access":"none"}}'
188
+
189
+ # 停止分享
190
+ cfshare exposure_stop '{"id":"all"}'
191
+ ```
192
+
193
+ `expose_port` 与 `expose_files` 默认会保持进程运行以维持隧道。
194
+ 如果你只想输出结果后立即退出,可加 `--no-keep-alive`。
195
+
196
+ 以 CLI 方式运行时,CFShare 默认使用 `~/.cfshare` 保存状态、workspace、策略和审计文件。
197
+ 它与插件模式(`~/.openclaw/cfshare`)完全隔离,可同时存在、互不干扰。
198
+
199
+ ---
200
+
201
+ ## ⚙️ 配置(可选)
172
202
 
173
203
  CFShare 开箱即用,以下默认配置适合绝大多数场景。如需调整,编辑 `~/.openclaw/openclaw.json`:
174
204
 
@@ -0,0 +1,10 @@
1
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
+ declare const plugin: {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ configSchema: Record<string, unknown>;
7
+ register(api: OpenClawPluginApi): void;
8
+ };
9
+ export default plugin;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,QAAA,MAAM,MAAM;;;;;kBAKI,iBAAiB;CAGhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
2
+ import { registerCfshareTools } from "./src/tools.js";
3
+ const plugin = {
4
+ id: "cfshare",
5
+ name: "CFShare",
6
+ description: "Cloudflare Quick Tunnel wrapper for secure temporary sharing",
7
+ configSchema: emptyPluginConfigSchema(),
8
+ register(api) {
9
+ registerCfshareTools(api);
10
+ },
11
+ };
12
+ export default plugin;
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,373 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs/promises";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import process from "node:process";
6
+ import { CfshareManager } from "./manager.js";
7
+ const TOOL_NAMES = new Set([
8
+ "env_check",
9
+ "expose_port",
10
+ "expose_files",
11
+ "exposure_list",
12
+ "exposure_get",
13
+ "exposure_stop",
14
+ "exposure_logs",
15
+ "maintenance",
16
+ "audit_query",
17
+ "audit_export",
18
+ ]);
19
+ const CLI_DEFAULT_STATE_DIR = "~/.cfshare";
20
+ function normalizeCommand(input) {
21
+ return input.trim().toLowerCase().replace(/-/g, "_");
22
+ }
23
+ function expandHome(input) {
24
+ if (input === "~") {
25
+ return os.homedir();
26
+ }
27
+ if (input.startsWith("~/")) {
28
+ return path.join(os.homedir(), input.slice(2));
29
+ }
30
+ return input;
31
+ }
32
+ function resolvePathFromCwd(input) {
33
+ const expanded = expandHome(input);
34
+ return path.isAbsolute(expanded) ? path.normalize(expanded) : path.resolve(process.cwd(), expanded);
35
+ }
36
+ function printHelp() {
37
+ const lines = [
38
+ "CFShare CLI",
39
+ "",
40
+ "Usage:",
41
+ " cfshare <tool> [params-json] [options]",
42
+ "",
43
+ "Tools:",
44
+ " env_check",
45
+ " expose_port",
46
+ " expose_files",
47
+ " exposure_list",
48
+ " exposure_get",
49
+ " exposure_stop",
50
+ " exposure_logs",
51
+ " maintenance",
52
+ " audit_query",
53
+ " audit_export",
54
+ "",
55
+ "Options:",
56
+ " --params <json> Tool parameters as JSON",
57
+ " --params-file <path> Read tool parameters from JSON file",
58
+ " --config <json> Runtime config JSON (same as plugin config)",
59
+ " --config-file <path> Read runtime config from JSON file",
60
+ " --workspace-dir <dir> Workspace dir for expose_files context",
61
+ " --keep-alive Keep process running after expose_*",
62
+ " --no-keep-alive Exit immediately after expose_* result",
63
+ " --compact Compact JSON output",
64
+ " -h, --help Show help",
65
+ " -v, --version Show version",
66
+ "",
67
+ "Examples:",
68
+ " cfshare env_check",
69
+ " cfshare expose_port '{\"port\":3000,\"opts\":{\"access\":\"token\"}}'",
70
+ " cfshare expose_files --params '{\"paths\":[\"./build\"],\"opts\":{\"access\":\"none\"}}'",
71
+ " cfshare exposure_stop --params '{\"id\":\"all\"}'",
72
+ ];
73
+ process.stdout.write(`${lines.join("\n")}\n`);
74
+ }
75
+ function assertValue(args, index, flag) {
76
+ const value = args[index];
77
+ if (!value || value.startsWith("-")) {
78
+ throw new Error(`missing value for ${flag}`);
79
+ }
80
+ return value;
81
+ }
82
+ function parseArgs(argv) {
83
+ const opts = {};
84
+ const positionals = [];
85
+ for (let i = 0; i < argv.length; i += 1) {
86
+ const token = argv[i];
87
+ if (!token) {
88
+ continue;
89
+ }
90
+ if (token === "-h" || token === "--help") {
91
+ opts.help = true;
92
+ continue;
93
+ }
94
+ if (token === "-v" || token === "--version") {
95
+ opts.version = true;
96
+ continue;
97
+ }
98
+ if (token === "--params") {
99
+ opts.paramsJson = assertValue(argv, i + 1, token);
100
+ i += 1;
101
+ continue;
102
+ }
103
+ if (token === "--params-file") {
104
+ opts.paramsFile = assertValue(argv, i + 1, token);
105
+ i += 1;
106
+ continue;
107
+ }
108
+ if (token === "--config") {
109
+ opts.configJson = assertValue(argv, i + 1, token);
110
+ i += 1;
111
+ continue;
112
+ }
113
+ if (token === "--config-file") {
114
+ opts.configFile = assertValue(argv, i + 1, token);
115
+ i += 1;
116
+ continue;
117
+ }
118
+ if (token === "--workspace-dir") {
119
+ opts.workspaceDir = assertValue(argv, i + 1, token);
120
+ i += 1;
121
+ continue;
122
+ }
123
+ if (token === "--keep-alive") {
124
+ opts.keepAlive = true;
125
+ continue;
126
+ }
127
+ if (token === "--no-keep-alive") {
128
+ opts.keepAlive = false;
129
+ continue;
130
+ }
131
+ if (token === "--compact") {
132
+ opts.compact = true;
133
+ continue;
134
+ }
135
+ if (token.startsWith("-")) {
136
+ throw new Error(`unknown option: ${token}`);
137
+ }
138
+ positionals.push(token);
139
+ }
140
+ if (positionals.length > 0) {
141
+ opts.command = positionals[0];
142
+ }
143
+ if (positionals.length > 1) {
144
+ if (opts.paramsJson || opts.paramsFile) {
145
+ throw new Error("params-json conflicts with --params/--params-file");
146
+ }
147
+ opts.paramsJson = positionals[1];
148
+ }
149
+ if (positionals.length > 2) {
150
+ throw new Error("too many positional arguments");
151
+ }
152
+ return opts;
153
+ }
154
+ async function parseJsonInput(source, label) {
155
+ try {
156
+ return JSON.parse(source);
157
+ }
158
+ catch (error) {
159
+ throw new Error(`failed to parse ${label}: ${String(error)}`);
160
+ }
161
+ }
162
+ async function parseJsonFile(filePath, label) {
163
+ const resolved = resolvePathFromCwd(filePath);
164
+ const content = await fs.readFile(resolved, "utf8");
165
+ return await parseJsonInput(content, `${label} (${resolved})`);
166
+ }
167
+ function asObject(input, label) {
168
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
169
+ throw new Error(`${label} must be a JSON object`);
170
+ }
171
+ return input;
172
+ }
173
+ function createRuntimeApi(config) {
174
+ const stringifyArgs = (args) => args
175
+ .map((value) => {
176
+ if (typeof value === "string") {
177
+ return value;
178
+ }
179
+ try {
180
+ return JSON.stringify(value);
181
+ }
182
+ catch {
183
+ return String(value);
184
+ }
185
+ })
186
+ .join(" ");
187
+ const logger = {
188
+ info: (...args) => {
189
+ if (process.env.CFSHARE_LOG_LEVEL === "info" || process.env.CFSHARE_LOG_LEVEL === "debug") {
190
+ process.stderr.write(`[cfshare] ${stringifyArgs(args)}\n`);
191
+ }
192
+ },
193
+ warn: (...args) => {
194
+ process.stderr.write(`[cfshare][warn] ${stringifyArgs(args)}\n`);
195
+ },
196
+ error: (...args) => {
197
+ process.stderr.write(`[cfshare][error] ${stringifyArgs(args)}\n`);
198
+ },
199
+ debug: (...args) => {
200
+ if (process.env.CFSHARE_LOG_LEVEL === "debug") {
201
+ process.stderr.write(`[cfshare][debug] ${stringifyArgs(args)}\n`);
202
+ }
203
+ },
204
+ };
205
+ const runtimeConfig = {
206
+ stateDir: CLI_DEFAULT_STATE_DIR,
207
+ ...config,
208
+ };
209
+ return {
210
+ logger,
211
+ resolvePath: resolvePathFromCwd,
212
+ pluginConfig: runtimeConfig,
213
+ };
214
+ }
215
+ function shouldKeepAlive(command, keepAliveFlag) {
216
+ if (typeof keepAliveFlag === "boolean") {
217
+ return keepAliveFlag;
218
+ }
219
+ return command === "expose_port" || command === "expose_files";
220
+ }
221
+ async function waitUntilExposureStops(manager, id) {
222
+ await new Promise((resolve, reject) => {
223
+ let stopping = false;
224
+ let interval;
225
+ const shutdown = async (reason) => {
226
+ if (stopping) {
227
+ return;
228
+ }
229
+ stopping = true;
230
+ if (interval) {
231
+ clearInterval(interval);
232
+ }
233
+ process.removeListener("SIGINT", onSigint);
234
+ process.removeListener("SIGTERM", onSigterm);
235
+ try {
236
+ await manager.stopExposure(id, { reason });
237
+ }
238
+ catch {
239
+ // best effort cleanup on signal
240
+ }
241
+ finally {
242
+ resolve();
243
+ }
244
+ };
245
+ const onSigint = () => {
246
+ void shutdown("cli interrupted");
247
+ };
248
+ const onSigterm = () => {
249
+ void shutdown("cli terminated");
250
+ };
251
+ process.once("SIGINT", onSigint);
252
+ process.once("SIGTERM", onSigterm);
253
+ interval = setInterval(async () => {
254
+ try {
255
+ const detail = (await manager.exposureGet({ id }));
256
+ const statusValue = detail.status;
257
+ const state = typeof statusValue === "string"
258
+ ? statusValue
259
+ : typeof statusValue === "object" && statusValue && "state" in statusValue
260
+ ? String(statusValue.state ?? "")
261
+ : "";
262
+ if (state === "stopped" || state === "expired" || state === "error" || state === "not_found") {
263
+ clearInterval(interval);
264
+ process.removeListener("SIGINT", onSigint);
265
+ process.removeListener("SIGTERM", onSigterm);
266
+ resolve();
267
+ }
268
+ }
269
+ catch (error) {
270
+ clearInterval(interval);
271
+ process.removeListener("SIGINT", onSigint);
272
+ process.removeListener("SIGTERM", onSigterm);
273
+ reject(error);
274
+ }
275
+ }, 1000);
276
+ });
277
+ }
278
+ async function runTool(manager, command, params, opts) {
279
+ if (command === "env_check") {
280
+ return await manager.envCheck();
281
+ }
282
+ if (command === "expose_port") {
283
+ return await manager.exposePort(params);
284
+ }
285
+ if (command === "expose_files") {
286
+ const ctx = opts.workspaceDir ? { workspaceDir: opts.workspaceDir } : undefined;
287
+ return await manager.exposeFiles(params, ctx);
288
+ }
289
+ if (command === "exposure_list") {
290
+ return manager.exposureList();
291
+ }
292
+ if (command === "exposure_get") {
293
+ return await manager.exposureGet(params);
294
+ }
295
+ if (command === "exposure_stop") {
296
+ const stopParams = params;
297
+ const target = stopParams.ids ?? stopParams.id;
298
+ if (!target) {
299
+ throw new Error("exposure_stop requires id or ids");
300
+ }
301
+ return await manager.stopExposure(target, stopParams.opts);
302
+ }
303
+ if (command === "exposure_logs") {
304
+ const logParams = params;
305
+ const target = logParams.ids ?? logParams.id;
306
+ if (!target) {
307
+ throw new Error("exposure_logs requires id or ids");
308
+ }
309
+ return manager.exposureLogs(target, logParams.opts);
310
+ }
311
+ if (command === "maintenance") {
312
+ const maintenanceParams = params;
313
+ return await manager.maintenance(maintenanceParams.action, maintenanceParams.opts);
314
+ }
315
+ if (command === "audit_query") {
316
+ const queryParams = params;
317
+ return await manager.auditQuery(queryParams.filters);
318
+ }
319
+ if (command === "audit_export") {
320
+ const exportParams = params;
321
+ return await manager.auditExport(exportParams.range);
322
+ }
323
+ throw new Error(`unsupported command: ${command}`);
324
+ }
325
+ async function readVersion() {
326
+ const packagePath = new URL("../../package.json", import.meta.url);
327
+ const content = await fs.readFile(packagePath, "utf8");
328
+ const parsed = JSON.parse(content);
329
+ return parsed.version ?? "unknown";
330
+ }
331
+ async function main() {
332
+ const options = parseArgs(process.argv.slice(2));
333
+ if (options.version) {
334
+ process.stdout.write(`${await readVersion()}\n`);
335
+ return;
336
+ }
337
+ if (options.help || !options.command) {
338
+ printHelp();
339
+ process.exit(options.help ? 0 : 1);
340
+ }
341
+ const command = normalizeCommand(options.command);
342
+ if (!TOOL_NAMES.has(command)) {
343
+ throw new Error(`unknown tool: ${options.command}`);
344
+ }
345
+ const paramsInput = options.paramsJson !== undefined
346
+ ? await parseJsonInput(options.paramsJson, "--params")
347
+ : options.paramsFile
348
+ ? await parseJsonFile(options.paramsFile, "--params-file")
349
+ : {};
350
+ const configInput = options.configJson !== undefined
351
+ ? await parseJsonInput(options.configJson, "--config")
352
+ : options.configFile
353
+ ? await parseJsonFile(options.configFile, "--config-file")
354
+ : {};
355
+ const params = asObject(paramsInput, "params");
356
+ const config = asObject(configInput, "config");
357
+ const manager = new CfshareManager(createRuntimeApi(config));
358
+ const result = await runTool(manager, command, params, options);
359
+ process.stdout.write(`${JSON.stringify(result, null, options.compact ? undefined : 2)}\n`);
360
+ if (shouldKeepAlive(command, options.keepAlive)) {
361
+ const exposureId = typeof result === "object" && result ? result.id : undefined;
362
+ if (typeof exposureId !== "string" || !exposureId) {
363
+ return;
364
+ }
365
+ process.stderr.write(`cfshare: exposure ${exposureId} is running. Press Ctrl+C to stop or use --no-keep-alive.\n`);
366
+ await waitUntilExposureStops(manager, exposureId);
367
+ }
368
+ }
369
+ void main().catch((error) => {
370
+ const message = error instanceof Error ? error.message : String(error);
371
+ process.stderr.write(`cfshare error: ${message}\n`);
372
+ process.exit(1);
373
+ });
@@ -0,0 +1,142 @@
1
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
+ import type { AccessMode, AuditEvent, ExposureRecord, ExposureStatus, ExposureType, FilePresentationMode } from "./types.js";
3
+ export type CfshareRuntimeApi = Pick<OpenClawPluginApi, "logger" | "resolvePath" | "pluginConfig">;
4
+ type EnvCheckResult = {
5
+ cloudflared: {
6
+ ok: boolean;
7
+ path?: string;
8
+ version?: string;
9
+ };
10
+ defaults: Record<string, unknown>;
11
+ warnings: string[];
12
+ };
13
+ type ToolContext = {
14
+ workspaceDir?: string;
15
+ };
16
+ type ExposureFilter = {
17
+ status?: ExposureStatus;
18
+ type?: ExposureType;
19
+ };
20
+ type ExposureGetField = "id" | "type" | "status" | "port" | "public_url" | "expires_at" | "local_url" | "stats" | "file_sharing" | "last_error" | "manifest" | "created_at";
21
+ type ExposureGetParams = {
22
+ id?: string;
23
+ ids?: string[];
24
+ filter?: ExposureFilter;
25
+ fields?: ExposureGetField[];
26
+ opts?: {
27
+ probe_public?: boolean;
28
+ };
29
+ };
30
+ type ExposureLogsOpts = {
31
+ lines?: number;
32
+ since_seconds?: number;
33
+ component?: "tunnel" | "origin" | "all";
34
+ };
35
+ export declare class CfshareManager {
36
+ private readonly logger;
37
+ private readonly resolvePath;
38
+ private readonly pluginConfig;
39
+ private readonly cloudflaredPathInput;
40
+ private readonly stateDir;
41
+ private readonly policyFile;
42
+ private readonly ignoreFile;
43
+ private readonly workspaceRoot;
44
+ private readonly auditFile;
45
+ private readonly sessionsFile;
46
+ private readonly exportsDir;
47
+ private initialized;
48
+ private initializing?;
49
+ private policy;
50
+ private policyWarnings;
51
+ private ignoreMatcher;
52
+ private cloudflaredResolvedPath?;
53
+ private guardTimer?;
54
+ private readonly sessions;
55
+ constructor(api: CfshareRuntimeApi);
56
+ private ensureInitialized;
57
+ private initialize;
58
+ private reloadPolicy;
59
+ private appendLog;
60
+ private writeAudit;
61
+ private persistSessionsSnapshot;
62
+ private makeAccessState;
63
+ private makeResponsePublicUrl;
64
+ private buildRateLimiter;
65
+ private isAuthorized;
66
+ private startReverseProxy;
67
+ private sendFileResponse;
68
+ private createZipArchive;
69
+ private createFolderZipArchive;
70
+ private startFileServer;
71
+ private detectWorkspaceRootBehavior;
72
+ private copyInputsToWorkspace;
73
+ private makeExposureRecord;
74
+ private summarizeExposeInputs;
75
+ private buildExposeFilesResponseManifest;
76
+ private makeManifestResponse;
77
+ private startGuard;
78
+ private reapExpired;
79
+ private startTunnel;
80
+ private startTunnelWithRetry;
81
+ private terminateProcess;
82
+ envCheck(): Promise<EnvCheckResult>;
83
+ exposePort(params: {
84
+ port: number;
85
+ opts?: {
86
+ ttl_seconds?: number;
87
+ access?: AccessMode;
88
+ protect_origin?: boolean;
89
+ allowlist_paths?: string[];
90
+ };
91
+ }): Promise<Record<string, unknown>>;
92
+ exposeFiles(params: {
93
+ paths: string[];
94
+ opts?: {
95
+ mode?: "normal" | "zip";
96
+ presentation?: FilePresentationMode;
97
+ ttl_seconds?: number;
98
+ access?: AccessMode;
99
+ max_downloads?: number;
100
+ };
101
+ }, ctx?: ToolContext): Promise<Record<string, unknown>>;
102
+ exposureList(): ExposureRecord[];
103
+ private normalizeRequestedIds;
104
+ private matchesExposureFilter;
105
+ private resolveExposureSelection;
106
+ private buildExposureDetail;
107
+ private projectExposureDetail;
108
+ private makeExposureGetNotFound;
109
+ exposureGet(params: ExposureGetParams): Promise<Record<string, unknown>>;
110
+ stopExposure(idOrIds: string | string[], opts?: {
111
+ reason?: string;
112
+ expired?: boolean;
113
+ keepAudit?: boolean;
114
+ }): Promise<Record<string, unknown>>;
115
+ private exposureLogsOne;
116
+ exposureLogs(idOrIds: string | string[], opts?: ExposureLogsOpts): Record<string, unknown>;
117
+ maintenance(action: "start_guard" | "run_gc" | "set_policy", opts?: {
118
+ policy?: unknown;
119
+ ignore_patterns?: string[];
120
+ }): Promise<Record<string, unknown>>;
121
+ private deepMerge;
122
+ private readPolicyJson;
123
+ private runGc;
124
+ auditQuery(filters?: {
125
+ id?: string;
126
+ event?: string;
127
+ type?: "port" | "files";
128
+ from_ts?: string;
129
+ to_ts?: string;
130
+ limit?: number;
131
+ }): Promise<AuditEvent[]>;
132
+ auditExport(range?: {
133
+ from_ts?: string;
134
+ to_ts?: string;
135
+ id?: string;
136
+ event?: string;
137
+ type?: "port" | "files";
138
+ output_path?: string;
139
+ }): Promise<Record<string, unknown>>;
140
+ }
141
+ export {};
142
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/manager.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EAGV,cAAc,EAEd,cAAc,EACd,YAAY,EACZ,oBAAoB,EAGrB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,aAAa,GAAG,cAAc,CAAC,CAAC;AA+CnG,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE;QACX,EAAE,EAAE,OAAO,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,KAAK,gBAAgB,GACjB,IAAI,GACJ,MAAM,GACN,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,W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