metaharness 0.4.3 → 0.4.5
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 +22 -2
- package/dist/bin.js +0 -0
- package/dist/harness-bin.js +0 -0
- package/dist/host-config.d.ts.map +1 -1
- package/dist/host-config.js +18 -1
- package/dist/host-config.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +281 -4
- package/dist/index.js.map +1 -1
- package/dist/meta-proxy-service.d.ts +72 -0
- package/dist/meta-proxy-service.d.ts.map +1 -0
- package/dist/meta-proxy-service.js +753 -0
- package/dist/meta-proxy-service.js.map +1 -0
- package/dist/meta-proxy.d.ts +11 -2
- package/dist/meta-proxy.d.ts.map +1 -1
- package/dist/meta-proxy.js +155 -10
- package/dist/meta-proxy.js.map +1 -1
- package/dist/secrets.d.ts +11 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/secrets.js +20 -7
- package/dist/secrets.js.map +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** Reverse-DNS label, shared by the launchd job and the scheduled task. */
|
|
2
|
+
export declare const SERVICE_LABEL = "one.cognitum.meta-proxy";
|
|
3
|
+
export interface ServiceCommand {
|
|
4
|
+
command: string;
|
|
5
|
+
args: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface CommandOutcome {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
output: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export type CommandRunner = (invocation: ServiceCommand) => CommandOutcome;
|
|
13
|
+
export interface ServiceResult {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
/** The unit/plist/task definition written, when one was. */
|
|
17
|
+
unitPath?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ServiceState {
|
|
20
|
+
supported: boolean;
|
|
21
|
+
/** The service manager currently has the job/unit/task loaded. */
|
|
22
|
+
installed: boolean;
|
|
23
|
+
unitPath: string | null;
|
|
24
|
+
managerState: 'enabled' | 'disabled' | 'unknown';
|
|
25
|
+
definitionPresent: boolean;
|
|
26
|
+
/** Whether the service manager currently has the job/unit/task loaded. */
|
|
27
|
+
loaded: boolean | null;
|
|
28
|
+
/** Whether the service remains configured to start on the user's next login. */
|
|
29
|
+
enabledAtLogin: boolean;
|
|
30
|
+
/** null means the manager answered but does not expose a portable run state. */
|
|
31
|
+
running: boolean | null;
|
|
32
|
+
pid: number | null;
|
|
33
|
+
}
|
|
34
|
+
export declare function launchAgentPath(home?: string, label?: string): string;
|
|
35
|
+
export declare function systemdUnitPath(home?: string): string;
|
|
36
|
+
/** The XML definition handed to `schtasks /create /xml`. */
|
|
37
|
+
export declare function scheduledTaskPath(home?: string, label?: string): string;
|
|
38
|
+
export declare function serviceUnitPath(platform: NodeJS.Platform, home?: string, label?: string): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* launchd job. `RunAtLoad` covers start-at-login and `KeepAlive.SuccessfulExit
|
|
41
|
+
* = false` covers restart-after-crash while still letting a deliberate
|
|
42
|
+
* `proxy stop` (SIGTERM, exit 0) stay stopped — a plain `KeepAlive: true` would
|
|
43
|
+
* fight the user's own stop command forever.
|
|
44
|
+
*/
|
|
45
|
+
export declare function renderLaunchAgent(binaryPath: string, logPath: string, label?: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* systemd **user** unit. `default.target` is the user-session target, so this is
|
|
48
|
+
* start-at-login rather than start-at-boot; booting a machine nobody has logged
|
|
49
|
+
* into should not run a user's proxy. `Restart=on-failure` matches the launchd
|
|
50
|
+
* choice: a clean stop stays stopped.
|
|
51
|
+
*/
|
|
52
|
+
export declare function renderSystemdUnit(binaryPath: string): string;
|
|
53
|
+
/** Task Scheduler definition — Windows has no launchd/systemd equivalent. */
|
|
54
|
+
export declare function renderScheduledTask(binaryPath: string): string;
|
|
55
|
+
export declare function enableCommands(platform: NodeJS.Platform, unitPath: string, label?: string): ServiceCommand[];
|
|
56
|
+
export declare function disableCommands(platform: NodeJS.Platform, unitPath: string, label?: string): ServiceCommand[];
|
|
57
|
+
export declare function serviceStateCommand(platform: NodeJS.Platform, label?: string): ServiceCommand | null;
|
|
58
|
+
export declare function metaProxyServiceState(platform?: NodeJS.Platform, home?: string, run?: CommandRunner, label?: string): ServiceState;
|
|
59
|
+
export interface ServiceOptions {
|
|
60
|
+
home?: string;
|
|
61
|
+
platform?: NodeJS.Platform;
|
|
62
|
+
run?: CommandRunner;
|
|
63
|
+
/** Test/enterprise isolation hook; normal users always use SERVICE_LABEL. */
|
|
64
|
+
label?: string;
|
|
65
|
+
/** Bounded synchronous polling seam; production waits without spawning. */
|
|
66
|
+
wait?: (milliseconds: number) => void;
|
|
67
|
+
}
|
|
68
|
+
export declare function enableMetaProxyService(options?: ServiceOptions): ServiceResult;
|
|
69
|
+
export declare function startMetaProxyService(options?: ServiceOptions): ServiceResult;
|
|
70
|
+
export declare function stopMetaProxyService(options?: ServiceOptions): ServiceResult;
|
|
71
|
+
export declare function disableMetaProxyService(options?: ServiceOptions): ServiceResult;
|
|
72
|
+
//# sourceMappingURL=meta-proxy-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta-proxy-service.d.ts","sourceRoot":"","sources":["../src/meta-proxy-service.ts"],"names":[],"mappings":"AA8BA,2EAA2E;AAC3E,eAAO,MAAM,aAAa,4BAA4B,CAAC;AAQvD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,cAAc,KAAK,cAAc,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE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