@zukhruf/launchd 0.0.0-stage → 0.8.19
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/LICENSE +21 -0
- package/README.md +672 -2
- package/dist/errors.d.ts +27 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +46 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/job/absolute-path.d.ts +5 -0
- package/dist/job/absolute-path.d.ts.map +1 -0
- package/dist/job/absolute-path.js +6 -0
- package/dist/job/absolute-path.js.map +1 -0
- package/dist/job/agent-job.d.ts +8 -0
- package/dist/job/agent-job.d.ts.map +1 -0
- package/dist/job/agent-job.js +2 -0
- package/dist/job/agent-job.js.map +1 -0
- package/dist/job/calendar-interval.d.ts +10 -0
- package/dist/job/calendar-interval.d.ts.map +1 -0
- package/dist/job/calendar-interval.js +2 -0
- package/dist/job/calendar-interval.js.map +1 -0
- package/dist/job/daemon-job.d.ts +10 -0
- package/dist/job/daemon-job.d.ts.map +1 -0
- package/dist/job/daemon-job.js +2 -0
- package/dist/job/daemon-job.js.map +1 -0
- package/dist/job/job-file.d.ts +21 -0
- package/dist/job/job-file.d.ts.map +1 -0
- package/dist/job/job-file.js +103 -0
- package/dist/job/job-file.js.map +1 -0
- package/dist/job/job.d.ts +67 -0
- package/dist/job/job.d.ts.map +1 -0
- package/dist/job/job.js +2 -0
- package/dist/job/job.js.map +1 -0
- package/dist/job/keep-alive-conditions.d.ts +15 -0
- package/dist/job/keep-alive-conditions.d.ts.map +1 -0
- package/dist/job/keep-alive-conditions.js +2 -0
- package/dist/job/keep-alive-conditions.js.map +1 -0
- package/dist/job/launch-events.d.ts +17 -0
- package/dist/job/launch-events.d.ts.map +1 -0
- package/dist/job/launch-events.js +2 -0
- package/dist/job/launch-events.js.map +1 -0
- package/dist/job/mach-service.d.ts +5 -0
- package/dist/job/mach-service.d.ts.map +1 -0
- package/dist/job/mach-service.js +2 -0
- package/dist/job/mach-service.js.map +1 -0
- package/dist/job/property-list-value.d.ts +5 -0
- package/dist/job/property-list-value.d.ts.map +1 -0
- package/dist/job/property-list-value.js +2 -0
- package/dist/job/property-list-value.js.map +1 -0
- package/dist/job/resource-limits.d.ts +13 -0
- package/dist/job/resource-limits.d.ts.map +1 -0
- package/dist/job/resource-limits.js +2 -0
- package/dist/job/resource-limits.js.map +1 -0
- package/dist/job/socket.d.ts +37 -0
- package/dist/job/socket.d.ts.map +1 -0
- package/dist/job/socket.js +2 -0
- package/dist/job/socket.js.map +1 -0
- package/dist/launchctl/cancel-options.d.ts +5 -0
- package/dist/launchctl/cancel-options.d.ts.map +1 -0
- package/dist/launchctl/cancel-options.js +2 -0
- package/dist/launchctl/cancel-options.js.map +1 -0
- package/dist/launchctl/domain.d.ts +3 -0
- package/dist/launchctl/domain.d.ts.map +1 -0
- package/dist/launchctl/domain.js +2 -0
- package/dist/launchctl/domain.js.map +1 -0
- package/dist/launchctl/launchctl.d.ts +17 -0
- package/dist/launchctl/launchctl.d.ts.map +1 -0
- package/dist/launchctl/launchctl.js +98 -0
- package/dist/launchctl/launchctl.js.map +1 -0
- package/dist/launchd/launchd.d.ts +30 -0
- package/dist/launchd/launchd.d.ts.map +1 -0
- package/dist/launchd/launchd.js +65 -0
- package/dist/launchd/launchd.js.map +1 -0
- package/dist/service/service-state.d.ts +13 -0
- package/dist/service/service-state.d.ts.map +1 -0
- package/dist/service/service-state.js +2 -0
- package/dist/service/service-state.js.map +1 -0
- package/dist/service/service.d.ts +35 -0
- package/dist/service/service.d.ts.map +1 -0
- package/dist/service/service.js +58 -0
- package/dist/service/service.js.map +1 -0
- package/package.json +50 -4
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** The base of every error of the package. */
|
|
2
|
+
export declare class LaunchdError extends Error {
|
|
3
|
+
constructor(message: string, options?: ErrorOptions);
|
|
4
|
+
}
|
|
5
|
+
/** launchctl exited with a code that is not 0. The base of every answer of launchctl that is an error. */
|
|
6
|
+
export declare class LaunchctlError extends LaunchdError {
|
|
7
|
+
/** The arguments after /bin/launchctl, such as ['kickstart', '-p', 'gui/501/com.example.sync']. */
|
|
8
|
+
readonly args: readonly string[];
|
|
9
|
+
/** `launchctl error <code>` decodes it. */
|
|
10
|
+
readonly exitCode: number;
|
|
11
|
+
readonly stderr: string;
|
|
12
|
+
constructor(args: readonly string[], exitCode: number, stderr: string);
|
|
13
|
+
}
|
|
14
|
+
/** launchctl exited 113 (Could not find specified service) for kickstart or kill. */
|
|
15
|
+
export declare class ServiceNotFoundError extends LaunchctlError {
|
|
16
|
+
readonly target: string;
|
|
17
|
+
constructor(args: readonly string[], exitCode: number, stderr: string, target: string);
|
|
18
|
+
}
|
|
19
|
+
/** EACCES or EPERM on the job file, or launchctl exit code 1. `cause` is the error of Node.js or the LaunchctlError. */
|
|
20
|
+
export declare class PermissionDeniedError extends LaunchdError {
|
|
21
|
+
constructor(cause: Error);
|
|
22
|
+
}
|
|
23
|
+
/** /bin/launchctl did not start (ENOENT): this system is not macOS. `cause` is the error of Node.js. */
|
|
24
|
+
export declare class LaunchdUnavailableError extends LaunchdError {
|
|
25
|
+
constructor(cause: Error);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,0GAA0G;AAC1G,qBAAa,cAAe,SAAQ,YAAY;IAC9C,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAOtE;AAED,qFAAqF;AACrF,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAGtB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM;CAMjB;AAED,wHAAwH;AACxH,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,KAAK,EAAE,KAAK;CAIzB;AAED,wGAAwG;AACxG,qBAAa,uBAAwB,SAAQ,YAAY;gBAC3C,KAAK,EAAE,KAAK;CAIzB"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** The base of every error of the package. */
|
|
2
|
+
export class LaunchdError extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
this.name = 'LaunchdError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** launchctl exited with a code that is not 0. The base of every answer of launchctl that is an error. */
|
|
9
|
+
export class LaunchctlError extends LaunchdError {
|
|
10
|
+
/** The arguments after /bin/launchctl, such as ['kickstart', '-p', 'gui/501/com.example.sync']. */
|
|
11
|
+
args;
|
|
12
|
+
/** `launchctl error <code>` decodes it. */
|
|
13
|
+
exitCode;
|
|
14
|
+
stderr;
|
|
15
|
+
constructor(args, exitCode, stderr) {
|
|
16
|
+
super(`launchctl ${args.join(' ')} exited ${exitCode}: ${stderr.trim()}`);
|
|
17
|
+
this.name = 'LaunchctlError';
|
|
18
|
+
this.args = args;
|
|
19
|
+
this.exitCode = exitCode;
|
|
20
|
+
this.stderr = stderr;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** launchctl exited 113 (Could not find specified service) for kickstart or kill. */
|
|
24
|
+
export class ServiceNotFoundError extends LaunchctlError {
|
|
25
|
+
target;
|
|
26
|
+
constructor(args, exitCode, stderr, target) {
|
|
27
|
+
super(args, exitCode, stderr);
|
|
28
|
+
this.name = 'ServiceNotFoundError';
|
|
29
|
+
this.target = target;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** EACCES or EPERM on the job file, or launchctl exit code 1. `cause` is the error of Node.js or the LaunchctlError. */
|
|
33
|
+
export class PermissionDeniedError extends LaunchdError {
|
|
34
|
+
constructor(cause) {
|
|
35
|
+
super(cause.message, { cause });
|
|
36
|
+
this.name = 'PermissionDeniedError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** /bin/launchctl did not start (ENOENT): this system is not macOS. `cause` is the error of Node.js. */
|
|
40
|
+
export class LaunchdUnavailableError extends LaunchdError {
|
|
41
|
+
constructor(cause) {
|
|
42
|
+
super(`/bin/launchctl did not start: ${cause.message}`, { cause });
|
|
43
|
+
this.name = 'LaunchdUnavailableError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe,EAAE,OAAsB;QACjD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,0GAA0G;AAC1G,MAAM,OAAO,cAAe,SAAQ,YAAY;IAC9C,mGAAmG;IAC1F,IAAI,CAAoB;IACjC,2CAA2C;IAClC,QAAQ,CAAS;IACjB,MAAM,CAAS;IAExB,YAAY,IAAuB,EAAE,QAAgB,EAAE,MAAc;QACnE,KAAK,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,QAAQ,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,qFAAqF;AACrF,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IAC7C,MAAM,CAAS;IAExB,YACE,IAAuB,EACvB,QAAgB,EAChB,MAAc,EACd,MAAc;QAEd,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,wHAAwH;AACxH,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IACrD,YAAY,KAAY;QACtB,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,wGAAwG;AACxG,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IACvD,YAAY,KAAY;QACtB,KAAK,CAAC,iCAAiC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { LaunchctlError, LaunchdError, LaunchdUnavailableError, PermissionDeniedError, ServiceNotFoundError, } from './errors.ts';
|
|
2
|
+
export { type AbsolutePath, isAbsolutePath } from './job/absolute-path.ts';
|
|
3
|
+
export type { AgentJob, SessionType } from './job/agent-job.ts';
|
|
4
|
+
export type { CalendarInterval } from './job/calendar-interval.ts';
|
|
5
|
+
export type { DaemonJob } from './job/daemon-job.ts';
|
|
6
|
+
export type { Job } from './job/job.ts';
|
|
7
|
+
export type { KeepAliveConditions } from './job/keep-alive-conditions.ts';
|
|
8
|
+
export type { LaunchEvents, MatchingDictionary } from './job/launch-events.ts';
|
|
9
|
+
export type { MachService } from './job/mach-service.ts';
|
|
10
|
+
export type { PropertyListValue } from './job/property-list-value.ts';
|
|
11
|
+
export type { ResourceLimits } from './job/resource-limits.ts';
|
|
12
|
+
export type { Socket } from './job/socket.ts';
|
|
13
|
+
export type { CancelOptions } from './launchctl/cancel-options.ts';
|
|
14
|
+
export type { Domain } from './launchctl/domain.ts';
|
|
15
|
+
export { Launchd, type LaunchdOptions } from './launchd/launchd.ts';
|
|
16
|
+
export { Service } from './service/service.ts';
|
|
17
|
+
export type { ServiceState } from './service/service-state.ts';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,YAAY,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,YAAY,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { LaunchctlError, LaunchdError, LaunchdUnavailableError, PermissionDeniedError, ServiceNotFoundError, } from "./errors.js";
|
|
2
|
+
export { isAbsolutePath } from "./job/absolute-path.js";
|
|
3
|
+
export { Launchd } from "./launchd/launchd.js";
|
|
4
|
+
export { Service } from "./service/service.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAqB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAa3E,OAAO,EAAE,OAAO,EAAuB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** An absolute path. launchd expands no `~` and no `$HOME`. */
|
|
2
|
+
export type AbsolutePath = `/${string}`;
|
|
3
|
+
/** Whether a path, such as one from `path.resolve()`, is an `AbsolutePath`, after `path.isAbsolute` of `node:path`. */
|
|
4
|
+
export declare function isAbsolutePath(path: string): path is AbsolutePath;
|
|
5
|
+
//# sourceMappingURL=absolute-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absolute-path.d.ts","sourceRoot":"","sources":["../../src/job/absolute-path.ts"],"names":[],"mappings":"AAEA,+DAA+D;AAC/D,MAAM,MAAM,YAAY,GAAG,IAAI,MAAM,EAAE,CAAC;AAExC,uHAAuH;AACvH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,YAAY,CAEjE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
/** Whether a path, such as one from `path.resolve()`, is an `AbsolutePath`, after `path.isAbsolute` of `node:path`. */
|
|
3
|
+
export function isAbsolutePath(path) {
|
|
4
|
+
return posix.isAbsolute(path);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=absolute-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absolute-path.js","sourceRoot":"","sources":["../../src/job/absolute-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAKlC,uHAAuH;AACvH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Job } from './job.ts';
|
|
2
|
+
/** A job for the agents of a user. */
|
|
3
|
+
export type AgentJob = Job & {
|
|
4
|
+
LimitLoadToSessionType?: SessionType | readonly SessionType[];
|
|
5
|
+
};
|
|
6
|
+
/** The session types of launchctl(1): Aqua is the default. */
|
|
7
|
+
export type SessionType = 'Aqua' | 'Background' | 'LoginWindow';
|
|
8
|
+
//# sourceMappingURL=agent-job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-job.d.ts","sourceRoot":"","sources":["../../src/job/agent-job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,sCAAsC;AACtC,MAAM,MAAM,QAAQ,GAAG,GAAG,GAAG;IAC3B,sBAAsB,CAAC,EAAE,WAAW,GAAG,SAAS,WAAW,EAAE,CAAC;CAC/D,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-job.js","sourceRoot":"","sources":["../../src/job/agent-job.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A missing field is a wildcard. When Day and Weekday are both set, either one matches. */
|
|
2
|
+
export interface CalendarInterval {
|
|
3
|
+
Minute?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59;
|
|
4
|
+
Hour?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
|
|
5
|
+
Day?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
|
|
6
|
+
/** 0 and 7 are Sunday. */
|
|
7
|
+
Weekday?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
8
|
+
Month?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=calendar-interval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-interval.d.ts","sourceRoot":"","sources":["../../src/job/calendar-interval.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EACH,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,CAAC;IACP,IAAI,CAAC,EACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,CAAC;IACP,GAAG,CAAC,EACA,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,CAAC;IACP,0BAA0B;IAC1B,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-interval.js","sourceRoot":"","sources":["../../src/job/calendar-interval.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Job } from './job.ts';
|
|
2
|
+
/** A job for the daemons of the system domain. */
|
|
3
|
+
export type DaemonJob = Job & {
|
|
4
|
+
UserName?: string;
|
|
5
|
+
/** Without it, the primary group of UserName. */
|
|
6
|
+
GroupName?: string;
|
|
7
|
+
/** true by default. Ignored without UserName. */
|
|
8
|
+
InitGroups?: boolean;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=daemon-job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-job.d.ts","sourceRoot":"","sources":["../../src/job/daemon-job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,kDAAkD;AAClD,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-job.js","sourceRoot":"","sources":["../../src/job/daemon-job.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Clock } from '@zukhruf/async';
|
|
2
|
+
import type { Job } from './job.ts';
|
|
3
|
+
/** The job file of one label: `<folder>/<label>.plist`. */
|
|
4
|
+
export declare class JobFile {
|
|
5
|
+
#private;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly path: string;
|
|
8
|
+
/** Throws a RangeError for a label that is not one file name, so the file stays in the folder. */
|
|
9
|
+
constructor(folder: string, label: string);
|
|
10
|
+
/** The labels of the job files in the folder, sorted. No folder: none. */
|
|
11
|
+
static labels(folder: string): Promise<string[]>;
|
|
12
|
+
/** The bytes of the job file of a job, with the keys of each dictionary sorted. */
|
|
13
|
+
static render(job: Job): string;
|
|
14
|
+
/** Whether the file holds these bytes. No file: false. */
|
|
15
|
+
holds(content: string): Promise<boolean>;
|
|
16
|
+
/** Makes the folder, and replaces the file in one step, with mode 0644. */
|
|
17
|
+
write(content: string, clock: Clock): Promise<void>;
|
|
18
|
+
/** Removes the file. No file: nothing to do. */
|
|
19
|
+
remove(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=job-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-file.d.ts","sourceRoot":"","sources":["../../src/job/job-file.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAIpC,2DAA2D;AAC3D,qBAAa,OAAO;;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAGtB,kGAAkG;gBACtF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAWzC,0EAA0E;WAC7D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAetD,mFAAmF;IACnF,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;IAI/B,0DAA0D;IACpD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS9C,2EAA2E;IACrE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IASzD,gDAAgD;IAC1C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CA6C9B"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { mkdir, readFile, readdir, rm } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { build } from 'plist';
|
|
4
|
+
import { atomicWrite, isErrno } from '@zukhruf/fs';
|
|
5
|
+
import { PermissionDeniedError } from "../errors.js";
|
|
6
|
+
const EXTENSION = '.plist';
|
|
7
|
+
/** The job file of one label: `<folder>/<label>.plist`. */
|
|
8
|
+
export class JobFile {
|
|
9
|
+
label;
|
|
10
|
+
path;
|
|
11
|
+
#folder;
|
|
12
|
+
/** Throws a RangeError for a label that is not one file name, so the file stays in the folder. */
|
|
13
|
+
constructor(folder, label) {
|
|
14
|
+
if (!JobFile.#isFileName(label)) {
|
|
15
|
+
throw new RangeError(`A label names its job file, so it must be one file name: ${JSON.stringify(label)}`);
|
|
16
|
+
}
|
|
17
|
+
this.label = label;
|
|
18
|
+
this.path = join(folder, `${label}${EXTENSION}`);
|
|
19
|
+
this.#folder = folder;
|
|
20
|
+
}
|
|
21
|
+
/** The labels of the job files in the folder, sorted. No folder: none. */
|
|
22
|
+
static async labels(folder) {
|
|
23
|
+
let names;
|
|
24
|
+
try {
|
|
25
|
+
names = await readdir(folder);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (isErrno(error, 'ENOENT'))
|
|
29
|
+
return [];
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
return names
|
|
33
|
+
.filter((name) => name.endsWith(EXTENSION))
|
|
34
|
+
.map((name) => name.slice(0, -EXTENSION.length))
|
|
35
|
+
.filter((label) => JobFile.#isFileName(label))
|
|
36
|
+
.toSorted();
|
|
37
|
+
}
|
|
38
|
+
/** The bytes of the job file of a job, with the keys of each dictionary sorted. */
|
|
39
|
+
static render(job) {
|
|
40
|
+
return build(JobFile.#sorted(job));
|
|
41
|
+
}
|
|
42
|
+
/** Whether the file holds these bytes. No file: false. */
|
|
43
|
+
async holds(content) {
|
|
44
|
+
try {
|
|
45
|
+
return (await readFile(this.path, 'utf8')) === content;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (isErrno(error, 'ENOENT'))
|
|
49
|
+
return false;
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Makes the folder, and replaces the file in one step, with mode 0644. */
|
|
54
|
+
async write(content, clock) {
|
|
55
|
+
try {
|
|
56
|
+
await mkdir(this.#folder, { recursive: true });
|
|
57
|
+
await atomicWrite(this.path, content, { clock, mode: 0o644 });
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw JobFile.#denied(error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Removes the file. No file: nothing to do. */
|
|
64
|
+
async remove() {
|
|
65
|
+
try {
|
|
66
|
+
await rm(this.path, { force: true });
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
throw JobFile.#denied(error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
static #denied(error) {
|
|
73
|
+
return Error.isError(error) &&
|
|
74
|
+
(isErrno(error, 'EACCES') || isErrno(error, 'EPERM'))
|
|
75
|
+
? new PermissionDeniedError(error)
|
|
76
|
+
: error;
|
|
77
|
+
}
|
|
78
|
+
static #isFileName(label) {
|
|
79
|
+
return (label !== '' &&
|
|
80
|
+
label !== '.' &&
|
|
81
|
+
label !== '..' &&
|
|
82
|
+
!label.includes('/') &&
|
|
83
|
+
!label.includes('\0'));
|
|
84
|
+
}
|
|
85
|
+
// An array keeps its order: it has a meaning in ProgramArguments. An
|
|
86
|
+
// undefined value becomes null, which plist renders as no key (ADR 0008).
|
|
87
|
+
static #sorted(value) {
|
|
88
|
+
if (Array.isArray(value))
|
|
89
|
+
return value.map((item) => JobFile.#sorted(item));
|
|
90
|
+
if (typeof value === 'object' && value !== null) {
|
|
91
|
+
return Object.fromEntries(Object.keys(value)
|
|
92
|
+
.toSorted()
|
|
93
|
+
.map((key) => [key, JobFile.#sorted(Reflect.get(value, key))]));
|
|
94
|
+
}
|
|
95
|
+
if (typeof value === 'string' ||
|
|
96
|
+
typeof value === 'number' ||
|
|
97
|
+
typeof value === 'boolean') {
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=job-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-file.js","sourceRoot":"","sources":["../../src/job/job-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAmB,KAAK,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,O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0,0 +1,67 @@
|
|
|
1
|
+
import type { AbsolutePath } from './absolute-path.ts';
|
|
2
|
+
import type { CalendarInterval } from './calendar-interval.ts';
|
|
3
|
+
import type { KeepAliveConditions } from './keep-alive-conditions.ts';
|
|
4
|
+
import type { LaunchEvents } from './launch-events.ts';
|
|
5
|
+
import type { MachService } from './mach-service.ts';
|
|
6
|
+
import type { ResourceLimits } from './resource-limits.ts';
|
|
7
|
+
import type { Socket } from './socket.ts';
|
|
8
|
+
/** The keys of launchd.plist(5) that agents and daemons share: `Program`, or a non-empty `ProgramArguments`, or both. */
|
|
9
|
+
export type Job = {
|
|
10
|
+
/** Unique in the domain. The job file is <Label>.plist. */
|
|
11
|
+
Label: string;
|
|
12
|
+
inetdCompatibility?: {
|
|
13
|
+
Wait?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** Keys of the "hw" sysctl(3) domain, such as model. */
|
|
16
|
+
LimitLoadToHardware?: Readonly<Record<string, readonly string[]>>;
|
|
17
|
+
LimitLoadFromHardware?: Readonly<Record<string, readonly string[]>>;
|
|
18
|
+
EnableGlobbing?: boolean;
|
|
19
|
+
EnableTransactions?: boolean;
|
|
20
|
+
EnablePressuredExit?: boolean;
|
|
21
|
+
KeepAlive?: boolean | KeepAliveConditions;
|
|
22
|
+
RunAtLoad?: boolean;
|
|
23
|
+
RootDirectory?: AbsolutePath;
|
|
24
|
+
WorkingDirectory?: AbsolutePath;
|
|
25
|
+
EnvironmentVariables?: Readonly<Record<string, string>>;
|
|
26
|
+
/** A decimal integer, or a string that strtoul(3) reads: '022' is octal. */
|
|
27
|
+
Umask?: number | string;
|
|
28
|
+
/** Seconds from SIGTERM to SIGKILL. 0 is infinity: do not use it. */
|
|
29
|
+
ExitTimeOut?: number;
|
|
30
|
+
/** Seconds between two starts. 10 by default. */
|
|
31
|
+
ThrottleInterval?: number;
|
|
32
|
+
WatchPaths?: readonly AbsolutePath[];
|
|
33
|
+
QueueDirectories?: readonly AbsolutePath[];
|
|
34
|
+
StartOnMount?: boolean;
|
|
35
|
+
/** Seconds. A start that falls in a sleep is missed. */
|
|
36
|
+
StartInterval?: number;
|
|
37
|
+
StartCalendarInterval?: CalendarInterval | readonly CalendarInterval[];
|
|
38
|
+
StandardInPath?: AbsolutePath;
|
|
39
|
+
StandardOutPath?: AbsolutePath;
|
|
40
|
+
StandardErrorPath?: AbsolutePath;
|
|
41
|
+
Debug?: boolean;
|
|
42
|
+
WaitForDebugger?: boolean;
|
|
43
|
+
SoftResourceLimits?: ResourceLimits;
|
|
44
|
+
HardResourceLimits?: ResourceLimits;
|
|
45
|
+
Nice?: number;
|
|
46
|
+
ProcessType?: 'Background' | 'Standard' | 'Adaptive' | 'Interactive';
|
|
47
|
+
AbandonProcessGroup?: boolean;
|
|
48
|
+
LowPriorityIO?: boolean;
|
|
49
|
+
LowPriorityBackgroundIO?: boolean;
|
|
50
|
+
MaterializeDatalessFiles?: boolean;
|
|
51
|
+
LaunchOnlyOnce?: boolean;
|
|
52
|
+
/** Each key is the name of a Mach service. The program must check in for it. */
|
|
53
|
+
MachServices?: Readonly<Record<string, true | MachService>>;
|
|
54
|
+
/** Each key is a name of your own for a socket or a group of sockets. */
|
|
55
|
+
Sockets?: Readonly<Record<string, Socket | readonly Socket[]>>;
|
|
56
|
+
LaunchEvents?: LaunchEvents;
|
|
57
|
+
SessionCreate?: boolean;
|
|
58
|
+
LegacyTimers?: boolean;
|
|
59
|
+
AssociatedBundleIdentifiers?: string | readonly string[];
|
|
60
|
+
} & ({
|
|
61
|
+
Program: AbsolutePath;
|
|
62
|
+
ProgramArguments?: readonly string[];
|
|
63
|
+
} | {
|
|
64
|
+
Program?: never;
|
|
65
|
+
ProgramArguments: readonly [string, ...string[]];
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../src/job/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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2B,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CAC1D,GAAG,CACA;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC/D;IAAE,OAAO,CAAC,EAAE,KAAK,CAAC;IAAC,gBAAgB,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;CAAE,CACxE,CAAC"}
|
package/dist/job/job.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../src/job/job.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AbsolutePath } from './absolute-path.ts';
|
|
2
|
+
/** launchd ORs the conditions. */
|
|
3
|
+
export interface KeepAliveConditions {
|
|
4
|
+
/** Evaluates the other conditions only after the first launch for another reason. PathState is not affected. */
|
|
5
|
+
AfterInitialDemand?: boolean;
|
|
6
|
+
/** true: start again after exit status 0. false: start again after another exit status. */
|
|
7
|
+
SuccessfulExit?: boolean;
|
|
8
|
+
/** true keeps the job running while the path exists; false, while it does not. */
|
|
9
|
+
PathState?: Readonly<Record<AbsolutePath, boolean>>;
|
|
10
|
+
/** Each key is a label: true keeps the job running while that job is loaded. */
|
|
11
|
+
OtherJobEnabled?: Readonly<Record<string, boolean>>;
|
|
12
|
+
/** true: start again after a crash signal (SIGILL, SIGSEGV …). false: start again after another exit. */
|
|
13
|
+
Crashed?: boolean;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=keep-alive-conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-alive-conditions.d.ts","sourceRoot":"","sources":["../../src/job/keep-alive-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,kCAAkC;AAClC,MAAM,WAAW,mBAAmB;IAClC,gHAAgH;IAChH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2FAA2F;IAC3F,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kFAAkF;IAClF,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,gFAAgF;IAChF,eAAe,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,yGAAyG;IACzG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-alive-conditions.js","sourceRoot":"","sources":["../../src/job/keep-alive-conditions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PropertyListValue } from './property-list-value.ts';
|
|
2
|
+
/** The two event streams of xpc_events(3). The keys of a stream are event names of your own. */
|
|
3
|
+
export interface LaunchEvents {
|
|
4
|
+
'com.apple.iokit.matching'?: Readonly<Record<string, MatchingDictionary>>;
|
|
5
|
+
'com.apple.notifyd.matching'?: Readonly<Record<string, {
|
|
6
|
+
Notification: string;
|
|
7
|
+
}>>;
|
|
8
|
+
}
|
|
9
|
+
/** An IOKit matching dictionary. Its other keys are the matching keys of IOKitKeys.h and the properties that the device must have, such as idVendor. */
|
|
10
|
+
export type MatchingDictionary = {
|
|
11
|
+
/** Required by xpc_events(3). launchd removes it before IOKit matches. */
|
|
12
|
+
IOMatchLaunchStream: true;
|
|
13
|
+
IOProviderClass?: string;
|
|
14
|
+
} & {
|
|
15
|
+
readonly [key: string]: PropertyListValue;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=launch-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-events.d.ts","sourceRoot":"","sources":["../../src/job/launch-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,gGAAgG;AAChG,MAAM,WAAW,YAAY;IAC3B,0BAA0B,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC1E,4BAA4B,CAAC,EAAE,QAAQ,CACrC,MAAM,CAAC,MAAM,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CACzC,CAAC;CACH;AAED,wJAAwJ;AAKxJ,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0EAA0E;IAC1E,mBAAmB,EAAE,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-events.js","sourceRoot":"","sources":["../../src/job/launch-events.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mach-service.d.ts","sourceRoot":"","sources":["../../src/job/mach-service.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mach-service.js","sourceRoot":"","sources":["../../src/job/mach-service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** A value of a property list that IOKit matches: a string, a number, a boolean, an array or a dictionary of these. */
|
|
2
|
+
export type PropertyListValue = string | number | boolean | readonly PropertyListValue[] | {
|
|
3
|
+
readonly [key: string]: PropertyListValue;
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=property-list-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-list-value.d.ts","sourceRoot":"","sources":["../../src/job/property-list-value.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,iBAAiB,EAAE,GAC5B;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-list-value.js","sourceRoot":"","sources":["../../src/job/property-list-value.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The limits of setrlimit(2), in bytes, seconds or counts. */
|
|
2
|
+
export interface ResourceLimits {
|
|
3
|
+
Core?: number;
|
|
4
|
+
CPU?: number;
|
|
5
|
+
Data?: number;
|
|
6
|
+
FileSize?: number;
|
|
7
|
+
MemoryLock?: number;
|
|
8
|
+
NumberOfFiles?: number;
|
|
9
|
+
NumberOfProcesses?: number;
|
|
10
|
+
ResidentSetSize?: number;
|
|
11
|
+
Stack?: number;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=resource-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-limits.d.ts","sourceRoot":"","sources":["../../src/job/resource-limits.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-limits.js","sourceRoot":"","sources":["../../src/job/resource-limits.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AbsolutePath } from './absolute-path.ts';
|
|
2
|
+
interface UnixDomainSocketKeys {
|
|
3
|
+
SockPathOwner?: number;
|
|
4
|
+
SockPathGroup?: number;
|
|
5
|
+
/** Decimal: property lists have no octal. */
|
|
6
|
+
SockPathMode?: number;
|
|
7
|
+
}
|
|
8
|
+
interface NetworkSocketKeys {
|
|
9
|
+
SockNodeName?: string;
|
|
10
|
+
/** A port number, or a service name such as 'ssh'. */
|
|
11
|
+
SockServiceName?: string | number;
|
|
12
|
+
SockFamily?: 'IPv4' | 'IPv6' | 'IPv4v6';
|
|
13
|
+
SockProtocol?: 'TCP' | 'UDP';
|
|
14
|
+
Bonjour?: boolean | string | readonly string[];
|
|
15
|
+
MulticastGroup?: string;
|
|
16
|
+
}
|
|
17
|
+
type Absent<Keys> = {
|
|
18
|
+
[Key in keyof Keys]?: never;
|
|
19
|
+
};
|
|
20
|
+
/** One socket: a Unix domain socket at a path, a secure Unix domain socket, or a network socket. A form never takes the keys of another form. */
|
|
21
|
+
export type Socket = {
|
|
22
|
+
SockType?: 'stream' | 'dgram' | 'seqpacket';
|
|
23
|
+
/** true (the default) listens; false connects. */
|
|
24
|
+
SockPassive?: boolean;
|
|
25
|
+
} & (({
|
|
26
|
+
SockPathName: AbsolutePath;
|
|
27
|
+
SecureSocketWithKey?: never;
|
|
28
|
+
} & UnixDomainSocketKeys & Absent<NetworkSocketKeys>) | ({
|
|
29
|
+
SockPathName?: never;
|
|
30
|
+
/** The name of the environment variable that gets the path. */
|
|
31
|
+
SecureSocketWithKey: string;
|
|
32
|
+
} & UnixDomainSocketKeys & Absent<NetworkSocketKeys>) | ({
|
|
33
|
+
SockPathName?: never;
|
|
34
|
+
SecureSocketWithKey?: never;
|
|
35
|
+
} & NetworkSocketKeys & Absent<UnixDomainSocketKeys>));
|
|
36
|
+
export {};
|
|
37
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