frida 16.7.14 → 16.7.15

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 (172) hide show
  1. package/README.md +1 -10
  2. package/build/BSDmakefile +6 -0
  3. package/build/Makefile +10 -0
  4. package/build/src/frida.d.ts +364 -0
  5. package/build/src/frida.js +962 -0
  6. package/build/src/frida_binding.d.ts +938 -0
  7. package/meson.build +34 -67
  8. package/package.json +30 -20
  9. package/scripts/fetch-abi-bits.py +15 -65
  10. package/scripts/install.js +5 -4
  11. package/src/addon.def +3 -0
  12. package/src/addon.symbols +2 -1
  13. package/src/addon.version +4 -0
  14. package/src/frida_bindgen/__init__.py +0 -0
  15. package/src/frida_bindgen/__main__.py +4 -0
  16. package/src/frida_bindgen/__pycache__/__init__.cpython-312.pyc +0 -0
  17. package/src/frida_bindgen/__pycache__/__main__.cpython-312.pyc +0 -0
  18. package/src/frida_bindgen/__pycache__/cli.cpython-312.pyc +0 -0
  19. package/src/frida_bindgen/__pycache__/codegen.cpython-312.pyc +0 -0
  20. package/src/frida_bindgen/__pycache__/customization.cpython-312.pyc +0 -0
  21. package/src/frida_bindgen/__pycache__/loader.cpython-312.pyc +0 -0
  22. package/src/frida_bindgen/__pycache__/model.cpython-312.pyc +0 -0
  23. package/src/frida_bindgen/assets/codegen_helpers.c +1970 -0
  24. package/src/frida_bindgen/assets/codegen_helpers.ts +100 -0
  25. package/src/frida_bindgen/assets/codegen_prototypes.h +78 -0
  26. package/src/frida_bindgen/assets/codegen_types.h +57 -0
  27. package/src/frida_bindgen/assets/customization_facade.exports +13 -0
  28. package/src/frida_bindgen/assets/customization_facade.ts +157 -0
  29. package/src/frida_bindgen/assets/customization_helpers.imports +2 -0
  30. package/src/frida_bindgen/assets/customization_helpers.ts +396 -0
  31. package/src/frida_bindgen/cli.py +96 -0
  32. package/src/frida_bindgen/codegen.py +2233 -0
  33. package/src/frida_bindgen/customization.py +924 -0
  34. package/src/frida_bindgen/loader.py +60 -0
  35. package/src/frida_bindgen/model.py +1357 -0
  36. package/src/meson.build +92 -27
  37. package/{lib/build.py → src/tsc.py} +12 -12
  38. package/src/win_delay_load_hook.c +56 -0
  39. package/subprojects/frida-core.wrap +1 -1
  40. package/test/data/index.ts +2 -2
  41. package/test/device.ts +1 -2
  42. package/test/device_manager.ts +1 -2
  43. package/test/labrat.ts +2 -2
  44. package/test/script.ts +12 -12
  45. package/test/session.ts +3 -3
  46. package/tsconfig.json +6 -11
  47. package/dist/application.d.ts +0 -81
  48. package/dist/application.js +0 -2
  49. package/dist/authentication.d.ts +0 -3
  50. package/dist/authentication.js +0 -2
  51. package/dist/bus.d.ts +0 -16
  52. package/dist/bus.js +0 -23
  53. package/dist/cancellable.d.ts +0 -15
  54. package/dist/cancellable.js +0 -41
  55. package/dist/child.d.ts +0 -16
  56. package/dist/child.js +0 -9
  57. package/dist/crash.d.ts +0 -10
  58. package/dist/crash.js +0 -2
  59. package/dist/device.d.ts +0 -156
  60. package/dist/device.js +0 -188
  61. package/dist/device_manager.d.ts +0 -25
  62. package/dist/device_manager.js +0 -42
  63. package/dist/endpoint_parameters.d.ts +0 -26
  64. package/dist/endpoint_parameters.js +0 -24
  65. package/dist/icon.d.ts +0 -14
  66. package/dist/icon.js +0 -2
  67. package/dist/index.d.ts +0 -161
  68. package/dist/index.js +0 -170
  69. package/dist/iostream.d.ts +0 -13
  70. package/dist/iostream.js +0 -73
  71. package/dist/native.d.ts +0 -1
  72. package/dist/native.js +0 -11
  73. package/dist/portal_membership.d.ts +0 -6
  74. package/dist/portal_membership.js +0 -12
  75. package/dist/portal_service.d.ts +0 -48
  76. package/dist/portal_service.js +0 -52
  77. package/dist/process.d.ts +0 -47
  78. package/dist/process.js +0 -2
  79. package/dist/relay.d.ts +0 -22
  80. package/dist/relay.js +0 -32
  81. package/dist/script.d.ts +0 -70
  82. package/dist/script.js +0 -266
  83. package/dist/service.d.ts +0 -16
  84. package/dist/service.js +0 -26
  85. package/dist/session.d.ts +0 -45
  86. package/dist/session.js +0 -73
  87. package/dist/signals.d.ts +0 -20
  88. package/dist/signals.js +0 -40
  89. package/dist/socket_address.d.ts +0 -25
  90. package/dist/socket_address.js +0 -2
  91. package/dist/spawn.d.ts +0 -4
  92. package/dist/spawn.js +0 -2
  93. package/dist/system_parameters.d.ts +0 -84
  94. package/dist/system_parameters.js +0 -2
  95. package/lib/application.ts +0 -98
  96. package/lib/authentication.ts +0 -3
  97. package/lib/bus.ts +0 -30
  98. package/lib/cancellable.ts +0 -48
  99. package/lib/child.ts +0 -15
  100. package/lib/crash.ts +0 -11
  101. package/lib/device.ts +0 -331
  102. package/lib/device_manager.ts +0 -69
  103. package/lib/endpoint_parameters.ts +0 -56
  104. package/lib/icon.ts +0 -15
  105. package/lib/index.ts +0 -316
  106. package/lib/iostream.ts +0 -78
  107. package/lib/meson.build +0 -53
  108. package/lib/native.ts +0 -9
  109. package/lib/portal_membership.ts +0 -10
  110. package/lib/portal_service.ts +0 -105
  111. package/lib/process.ts +0 -57
  112. package/lib/relay.ts +0 -44
  113. package/lib/script.ts +0 -361
  114. package/lib/service.ts +0 -34
  115. package/lib/session.ts +0 -113
  116. package/lib/signals.ts +0 -45
  117. package/lib/socket_address.ts +0 -35
  118. package/lib/spawn.ts +0 -4
  119. package/lib/system_parameters.ts +0 -103
  120. package/meson.options +0 -11
  121. package/src/addon.cc +0 -78
  122. package/src/application.cc +0 -148
  123. package/src/application.h +0 -31
  124. package/src/authentication.cc +0 -174
  125. package/src/authentication.h +0 -24
  126. package/src/bus.cc +0 -167
  127. package/src/bus.h +0 -33
  128. package/src/cancellable.cc +0 -117
  129. package/src/cancellable.h +0 -31
  130. package/src/child.cc +0 -150
  131. package/src/child.h +0 -32
  132. package/src/crash.cc +0 -122
  133. package/src/crash.h +0 -30
  134. package/src/device.cc +0 -1350
  135. package/src/device.h +0 -56
  136. package/src/device_manager.cc +0 -362
  137. package/src/device_manager.h +0 -35
  138. package/src/endpoint_parameters.cc +0 -171
  139. package/src/endpoint_parameters.h +0 -28
  140. package/src/glib_context.cc +0 -62
  141. package/src/glib_context.h +0 -29
  142. package/src/glib_object.cc +0 -25
  143. package/src/glib_object.h +0 -37
  144. package/src/iostream.cc +0 -243
  145. package/src/iostream.h +0 -30
  146. package/src/operation.h +0 -94
  147. package/src/portal_membership.cc +0 -100
  148. package/src/portal_membership.h +0 -26
  149. package/src/portal_service.cc +0 -401
  150. package/src/portal_service.h +0 -40
  151. package/src/process.cc +0 -135
  152. package/src/process.h +0 -30
  153. package/src/relay.cc +0 -139
  154. package/src/relay.h +0 -31
  155. package/src/runtime.cc +0 -568
  156. package/src/runtime.h +0 -69
  157. package/src/script.cc +0 -301
  158. package/src/script.h +0 -36
  159. package/src/service.cc +0 -224
  160. package/src/service.h +0 -36
  161. package/src/session.cc +0 -860
  162. package/src/session.h +0 -42
  163. package/src/signals.cc +0 -334
  164. package/src/signals.h +0 -47
  165. package/src/spawn.cc +0 -95
  166. package/src/spawn.h +0 -27
  167. package/src/usage_monitor.h +0 -117
  168. package/src/uv_context.cc +0 -118
  169. package/src/uv_context.h +0 -40
  170. package/src/win_delay_load_hook.cc +0 -63
  171. package/subprojects/nan.wrap +0 -9
  172. package/subprojects/packagefiles/nan.patch +0 -13
@@ -1,98 +0,0 @@
1
- import { Icon } from "./icon";
2
- import { SystemParameters } from "./system_parameters";
3
-
4
- export interface Application {
5
- identifier: string;
6
- name: string;
7
- pid: number;
8
- parameters: ApplicationParameters;
9
- }
10
-
11
- /**
12
- * Application parameters typically obtained through `enumerateApplications({ scope })`,
13
- * where `scope` is either `Scope.Metadata` or `Scope.Full`. The default of `Scope.Minimal`
14
- * means no parameters will be included.
15
- */
16
- export interface ApplicationParameters {
17
- /**
18
- * Version. Exposes `CFBundleShortVersionString` on Apple OSes, `versionName` on Android.
19
- */
20
- version?: string;
21
-
22
- /**
23
- * Build stamp. Exposes `CFBundleVersion` on Apple OSes, `versionCode` on Android.
24
- */
25
- build?: string;
26
-
27
- /**
28
- * Filesystem path of application. On Apple OSes this is where the bundle is.
29
- */
30
- path?: string;
31
-
32
- /**
33
- * Apple storage container locations.
34
- */
35
- containers?: {
36
- /**
37
- * Data container location.
38
- */
39
- data?: string;
40
-
41
- /**
42
- * App group container locations.
43
- */
44
- [name: string]: string | undefined;
45
- }
46
-
47
- /**
48
- * Android source APKs. Exposes `publicSourceDir` followed by `splitPublicSourceDirs`.
49
- */
50
- sources?: string[];
51
-
52
- /**
53
- * Android data directory location.
54
- */
55
- dataDir?: string;
56
-
57
- /**
58
- * Android target SDK.
59
- */
60
- targetSdk?: number;
61
-
62
- /**
63
- * Whether the application is debuggable. Applicable on e.g. iOS and Android.
64
- */
65
- debuggable?: boolean;
66
-
67
- /**
68
- * If application is running, whether it is currently frontmost.
69
- */
70
- frontmost?: boolean;
71
-
72
- /**
73
- * If application is running, name of user that it is running as.
74
- */
75
- user?: string;
76
-
77
- /**
78
- * If application is running, PID of its parent process.
79
- */
80
- ppid?: number;
81
-
82
- /**
83
- * If application is running, when it was started.
84
- */
85
- started?: Date;
86
-
87
- /**
88
- * One or more icons. Only included when `scope` is set to `Scope.Full`.
89
- */
90
- icons?: Icon[];
91
-
92
- /**
93
- * System parameters, available for applications accessed through a portal.
94
- */
95
- system?: SystemParameters;
96
-
97
- [name: string]: any;
98
- }
@@ -1,3 +0,0 @@
1
- export interface AuthenticatedSessionInfo {
2
- [key: string]: any;
3
- }
package/lib/bus.ts DELETED
@@ -1,30 +0,0 @@
1
- import { Cancellable } from "./cancellable";
2
- import { Signals, Signal } from "./signals";
3
-
4
- import { inspect } from "util";
5
-
6
- export class Bus {
7
- detached: Signal<BusDetachedHandler>;
8
- message: Signal<BusMessageHandler>;
9
-
10
- constructor(private impl: any) {
11
- const signals: Signals = impl.signals;
12
- this.detached = new Signal<BusDetachedHandler>(signals, "detached");
13
- this.message = new Signal<BusMessageHandler>(signals, "message");
14
- }
15
-
16
- attach(cancellable?: Cancellable): Promise<void> {
17
- return this.impl.attach(cancellable);
18
- }
19
-
20
- post(message: any, data: Buffer | null = null): void {
21
- this.impl.post(message, data);
22
- }
23
-
24
- [inspect.custom](depth, options) {
25
- return "Bus {}";
26
- }
27
- }
28
-
29
- export type BusDetachedHandler = () => void;
30
- export type BusMessageHandler = (message: any, data: Buffer | null) => void;
@@ -1,48 +0,0 @@
1
- import { binding } from "./native";
2
- import { Signal } from "./signals";
3
-
4
- import { inspect } from "util";
5
-
6
- export class Cancellable {
7
- private impl = new binding.Cancellable();
8
-
9
- cancelled: Signal<CancelledHandler>;
10
-
11
- constructor() {
12
- const { signals } = this.impl;
13
- this.cancelled = new Signal<CancelledHandler>(signals, "cancelled");
14
- }
15
-
16
- get isCancelled(): boolean {
17
- return this.impl.isCancelled;
18
- }
19
-
20
- throwIfCancelled(): void {
21
- this.impl.throwIfCancelled();
22
- }
23
-
24
- cancel(): void {
25
- return this.impl.cancel();
26
- }
27
-
28
- [inspect.custom]() {
29
- return "Cancellable {}";
30
- }
31
-
32
- combine(other: Cancellable): Cancellable {
33
- const cancel = new Cancellable();
34
- this.cancelled.connect(() => cancel.cancel());
35
- other.cancelled.connect(() => cancel.cancel());
36
- if (this.isCancelled) cancel.cancel();
37
- if (other.isCancelled) cancel.cancel();
38
- return cancel;
39
- }
40
-
41
- public static withTimeout(ms): Cancellable {
42
- const cancel = new Cancellable();
43
- setTimeout(() => cancel.cancel(), ms).unref();
44
- return cancel;
45
- }
46
- }
47
-
48
- export type CancelledHandler = () => void;
package/lib/child.ts DELETED
@@ -1,15 +0,0 @@
1
- export interface Child {
2
- pid: number;
3
- parentPid: number;
4
- origin: ChildOrigin;
5
- identifier: string | null;
6
- path: string | null;
7
- argv: string[] | null;
8
- envp: { [name: string]: string } | null;
9
- }
10
-
11
- export enum ChildOrigin {
12
- Fork = "fork",
13
- Exec = "exec",
14
- Spawn = "spawn"
15
- }
package/lib/crash.ts DELETED
@@ -1,11 +0,0 @@
1
- export interface Crash {
2
- pid: number;
3
- processName: string;
4
- summary: string;
5
- report: string;
6
- parameters: CrashParameters;
7
- }
8
-
9
- export interface CrashParameters {
10
- [name: string]: string | number | boolean;
11
- }
package/lib/device.ts DELETED
@@ -1,331 +0,0 @@
1
- import { Application } from "./application";
2
- import { Bus } from "./bus";
3
- import { Cancellable } from "./cancellable";
4
- import { Child } from "./child";
5
- import { Crash } from "./crash";
6
- import { Icon } from "./icon";
7
- import { IOStream } from "./iostream";
8
- import { Process } from "./process";
9
- import { Service } from "./service";
10
- import { Session } from "./session";
11
- import { Signal } from "./signals";
12
- import { Spawn } from "./spawn";
13
- import { SystemParameters } from "./system_parameters";
14
-
15
- import { Minimatch } from "minimatch";
16
- import { inspect } from "util";
17
-
18
- export class Device {
19
- spawnAdded: Signal<SpawnAddedHandler>;
20
- spawnRemoved: Signal<SpawnRemovedHandler>;
21
- childAdded: Signal<ChildAddedHandler>;
22
- childRemoved: Signal<ChildRemovedHandler>;
23
- processCrashed: Signal<ProcessCrashedHandler>;
24
- output: Signal<OutputHandler>;
25
- uninjected: Signal<UninjectedHandler>;
26
- lost: Signal<DeviceLostHandler>;
27
-
28
- bus: Bus;
29
-
30
- constructor(private impl: any) {
31
- this.bus = new Bus(impl.bus);
32
-
33
- const { signals } = impl;
34
- this.spawnAdded = new Signal<SpawnAddedHandler>(signals, "spawn-added");
35
- this.spawnRemoved = new Signal<SpawnRemovedHandler>(signals, "spawn-removed");
36
- this.childAdded = new Signal<ChildAddedHandler>(signals, "child-added");
37
- this.childRemoved = new Signal<ChildRemovedHandler>(signals, "child-removed");
38
- this.processCrashed = new Signal<ProcessCrashedHandler>(signals, "process-crashed");
39
- this.output = new Signal<OutputHandler>(signals, "output");
40
- this.uninjected = new Signal<UninjectedHandler>(signals, "uninjected");
41
- this.lost = new Signal<DeviceLostHandler>(signals, "lost");
42
- }
43
-
44
- get id(): string {
45
- return this.impl.id;
46
- }
47
-
48
- get name(): string {
49
- return this.impl.name;
50
- }
51
-
52
- get icon(): Icon | null {
53
- return this.impl.icon;
54
- }
55
-
56
- get type(): DeviceType {
57
- return this.impl.type;
58
- }
59
-
60
- get isLost(): boolean {
61
- return this.impl.isLost;
62
- }
63
-
64
- querySystemParameters(cancellable?: Cancellable): Promise<SystemParameters> {
65
- return this.impl.querySystemParameters(cancellable);
66
- }
67
-
68
- getFrontmostApplication(options: FrontmostQueryOptions = {}, cancellable?: Cancellable): Promise<Application | null> {
69
- const {
70
- scope = null,
71
- } = options;
72
- return this.impl.getFrontmostApplication(scope, cancellable);
73
- }
74
-
75
- enumerateApplications(options: ApplicationQueryOptions = {}, cancellable?: Cancellable): Promise<Application[]> {
76
- const {
77
- identifiers = [],
78
- scope = null,
79
- } = options;
80
- return this.impl.enumerateApplications(identifiers, scope, cancellable);
81
- }
82
-
83
- enumerateProcesses(options: ProcessQueryOptions = {}, cancellable?: Cancellable): Promise<Process[]> {
84
- const {
85
- pids = [],
86
- scope = null,
87
- } = options;
88
- return this.impl.enumerateProcesses(pids, scope, cancellable);
89
- }
90
-
91
- async getProcess(name: string, options: ProcessMatchOptions = {}, cancellable?: Cancellable): Promise<Process> {
92
- const {
93
- scope = Scope.Minimal,
94
- } = options;
95
- const processes = await this.enumerateProcesses({ scope }, cancellable);
96
- const mm = new Minimatch(name.toLowerCase());
97
- const matching = processes.filter(process => mm.match(process.name.toLowerCase()));
98
- if (matching.length === 1) {
99
- return matching[0];
100
- } else if (matching.length > 1) {
101
- throw new Error("Ambiguous name; it matches: " + matching.map(process => `${process.name} (pid: ${process.pid})`).join(", "));
102
- } else {
103
- throw new Error("Process not found");
104
- }
105
- }
106
-
107
- enableSpawnGating(cancellable?: Cancellable): Promise<void> {
108
- return this.impl.enableSpawnGating(cancellable);
109
- }
110
-
111
- disableSpawnGating(cancellable?: Cancellable): Promise<void> {
112
- return this.impl.disableSpawnGating(cancellable);
113
- }
114
-
115
- enumeratePendingSpawn(cancellable?: Cancellable): Promise<Spawn[]> {
116
- return this.impl.enumeratePendingSpawn(cancellable);
117
- }
118
-
119
- enumeratePendingChildren(cancellable?: Cancellable): Promise<Child[]> {
120
- return this.impl.enumeratePendingChildren(cancellable);
121
- }
122
-
123
- spawn(program: string | string[], options: SpawnOptions = {}, cancellable?: Cancellable): Promise<ProcessID> {
124
- const pendingOptions = Object.assign({}, options);
125
-
126
- let argv = consumeOption("argv");
127
- if (typeof program !== "string") {
128
- argv = program;
129
- program = argv[0];
130
- if (argv.length === 1) {
131
- argv = null;
132
- }
133
- }
134
- const envp = consumeOption("envp");
135
- const env = consumeOption("env");
136
- const cwd = consumeOption("cwd");
137
- const stdio = consumeOption("stdio");
138
- const aux = pendingOptions;
139
-
140
- return this.impl.spawn(program, argv, envp, env, cwd, stdio, aux, cancellable);
141
-
142
- function consumeOption(name) {
143
- const value = pendingOptions[name];
144
- delete pendingOptions[name];
145
- return value ?? null;
146
- }
147
- }
148
-
149
- async input(target: TargetProcess, data: Buffer, cancellable?: Cancellable): Promise<void> {
150
- const pid = await this.getPid(target, cancellable);
151
- return this.impl.input(pid, data, cancellable);
152
- }
153
-
154
- async resume(target: TargetProcess, cancellable?: Cancellable): Promise<void> {
155
- const pid = await this.getPid(target, cancellable);
156
- return this.impl.resume(pid, cancellable);
157
- }
158
-
159
- async kill(target: TargetProcess, cancellable?: Cancellable): Promise<void> {
160
- const pid = await this.getPid(target, cancellable);
161
- return this.impl.kill(pid, cancellable);
162
- }
163
-
164
- async attach(target: TargetProcess, options: SessionOptions = {}, cancellable?: Cancellable): Promise<Session> {
165
- const {
166
- realm = null,
167
- persistTimeout = null,
168
- } = options;
169
-
170
- const pid = await this.getPid(target, cancellable);
171
-
172
- return new Session(await this.impl.attach(pid, realm, persistTimeout, cancellable));
173
- }
174
-
175
- async injectLibraryFile(target: TargetProcess, path: string, entrypoint: string, data: string,
176
- cancellable?: Cancellable): Promise<InjecteeID> {
177
- const pid = await this.getPid(target, cancellable);
178
- return this.impl.injectLibraryFile(pid, path, entrypoint, data, cancellable);
179
- }
180
-
181
- async injectLibraryBlob(target: TargetProcess, blob: Buffer, entrypoint: string, data: string,
182
- cancellable?: Cancellable): Promise<InjecteeID> {
183
- const pid = await this.getPid(target, cancellable);
184
- return this.impl.injectLibraryBlob(pid, blob, entrypoint, data, cancellable);
185
- }
186
-
187
- async openChannel(address: string, cancellable?: Cancellable): Promise<IOStream> {
188
- return new IOStream(await this.impl.openChannel(address, cancellable));
189
- }
190
-
191
- async openService(address: string, cancellable?: Cancellable): Promise<Service> {
192
- return new Service(await this.impl.openService(address, cancellable));
193
- }
194
-
195
- async unpair(cancellable?: Cancellable): Promise<void> {
196
- await this.impl.unpair(cancellable);
197
- }
198
-
199
- private async getPid(target: TargetProcess, cancellable?: Cancellable): Promise<ProcessID> {
200
- if (typeof target === "number") {
201
- return target;
202
- }
203
-
204
- const process = await this.getProcess(target, {}, cancellable);
205
- return process.pid;
206
- }
207
-
208
- [inspect.custom](depth, options) {
209
- return "Device " + inspect({
210
- id: this.id,
211
- name: this.name,
212
- icon: this.icon,
213
- type: this.type
214
- }, options);
215
- }
216
- }
217
-
218
- export type ProcessID = number;
219
- export type ProcessName = string;
220
- export type InjecteeID = number;
221
- export type FileDescriptor = number;
222
-
223
- export type SpawnAddedHandler = (spawn: Spawn) => void;
224
- export type SpawnRemovedHandler = (spawn: Spawn) => void;
225
- export type ChildAddedHandler = (child: Child) => void;
226
- export type ChildRemovedHandler = (child: Child) => void;
227
- export type ProcessCrashedHandler = (crash: Crash) => void;
228
- export type OutputHandler = (pid: ProcessID, fd: FileDescriptor, data: Buffer) => void;
229
- export type UninjectedHandler = (id: InjecteeID) => void;
230
- export type DeviceLostHandler = () => void;
231
-
232
- export enum DeviceType {
233
- Local = "local",
234
- Remote = "remote",
235
- Usb = "usb"
236
- }
237
-
238
- export interface FrontmostQueryOptions {
239
- /**
240
- * How much data to collect about the frontmost application. The default is `Scope.Minimal`,
241
- * which means no parameters will be collected. Specify `Scope.Metadata` to collect all
242
- * parameters except icons, which can be included by specifying `Scope.Full`.
243
- */
244
- scope?: Scope;
245
- }
246
-
247
- export interface ApplicationQueryOptions {
248
- /**
249
- * Limit enumeration to one or more application IDs only. Typically used to fetch additional
250
- * details about a subset, e.g. based on user interaction.
251
- */
252
- identifiers?: string[];
253
-
254
- /**
255
- * How much data to collect about each application. The default is `Scope.Minimal`, which
256
- * means no parameters will be collected. Specify `Scope.Metadata` to collect all parameters
257
- * except icons, which can be included by specifying `Scope.Full`.
258
- */
259
- scope?: Scope;
260
- }
261
-
262
- export interface ProcessQueryOptions {
263
- /**
264
- * Limit enumeration to one or more process IDs only. Typically used to fetch additional
265
- * details about a subset, e.g. based on user interaction.
266
- */
267
- pids?: number[];
268
-
269
- /**
270
- * How much data to collect about each process. The default is `Scope.Minimal`, which
271
- * means no parameters will be collected. Specify `Scope.Metadata` to collect all
272
- * parameters except icons, which can be included by specifying `Scope.Full`.
273
- */
274
- scope?: Scope;
275
- }
276
-
277
- export interface ProcessMatchOptions {
278
- /**
279
- * How much data to collect about the matching process. The default is `Scope.Minimal`,
280
- * which means no parameters will be collected. Specify `Scope.Metadata` to collect all
281
- * parameters except icons, which can be included by specifying `Scope.Full`.
282
- */
283
- scope?: Scope;
284
- }
285
-
286
- /**
287
- * How much data to collect about a given application or process.
288
- */
289
- export enum Scope {
290
- /**
291
- * Don't collect any parameters. This is the default.
292
- */
293
- Minimal = "minimal",
294
-
295
- /**
296
- * Collect all parameters except icons.
297
- */
298
- Metadata = "metadata",
299
-
300
- /**
301
- * Collect all parameters, including icons.
302
- */
303
- Full = "full"
304
- }
305
-
306
- export interface SpawnOptions {
307
- argv?: string[];
308
- envp?: { [name: string]: string };
309
- env?: { [name: string]: string };
310
- cwd?: string;
311
- stdio?: Stdio;
312
-
313
- [name: string]: any;
314
- }
315
-
316
- export enum Stdio {
317
- Inherit = "inherit",
318
- Pipe = "pipe"
319
- }
320
-
321
- export type TargetProcess = ProcessID | ProcessName;
322
-
323
- export interface SessionOptions {
324
- realm?: Realm;
325
- persistTimeout?: number;
326
- }
327
-
328
- export enum Realm {
329
- Native = "native",
330
- Emulated = "emulated",
331
- }
@@ -1,69 +0,0 @@
1
- import { Cancellable } from "./cancellable";
2
- import { Device } from "./device";
3
- import { binding } from "./native";
4
- import { Signals, Signal, SignalHandler, SignalAdapter } from "./signals";
5
-
6
- import { inspect } from "util";
7
-
8
- export class DeviceManager {
9
- private impl = new binding.DeviceManager();
10
-
11
- added: Signal<DeviceAddedHandler>;
12
- removed: Signal<DeviceRemovedHandler>;
13
- changed: Signal<DevicesChangedHandler>;
14
-
15
- constructor() {
16
- const signals = new DeviceManagerSignals(this.impl.signals);
17
- this.added = new Signal<DeviceAddedHandler>(signals, "added");
18
- this.removed = new Signal<DeviceRemovedHandler>(signals, "removed");
19
- this.changed = new Signal<DevicesChangedHandler>(signals, "changed");
20
- }
21
-
22
- async enumerateDevices(cancellable?: Cancellable): Promise<Device[]> {
23
- const devices: any[] = await this.impl.enumerateDevices(cancellable);
24
- return devices.map(impl => new Device(impl));
25
- }
26
-
27
- async addRemoteDevice(address: string, options: RemoteDeviceOptions = {}, cancellable?: Cancellable): Promise<Device> {
28
- const {
29
- certificate = null,
30
- origin = null,
31
- token = null,
32
- keepaliveInterval = null,
33
- } = options;
34
- return new Device(await this.impl.addRemoteDevice(address, certificate, origin, token, keepaliveInterval, cancellable));
35
- }
36
-
37
- removeRemoteDevice(address: string, cancellable?: Cancellable): Promise<void> {
38
- return this.impl.removeRemoteDevice(address, cancellable);
39
- }
40
-
41
- [inspect.custom]() {
42
- return "DeviceManager {}";
43
- }
44
- }
45
-
46
- export interface RemoteDeviceOptions {
47
- certificate?: string;
48
- origin?: string;
49
- token?: string;
50
- keepaliveInterval?: number;
51
- }
52
-
53
- export type DeviceAddedHandler = (device: Device) => void;
54
- export type DeviceRemovedHandler = (device: Device) => void;
55
- export type DevicesChangedHandler = () => void;
56
-
57
- class DeviceManagerSignals extends SignalAdapter {
58
- constructor(signals: Signals) {
59
- super(signals);
60
- }
61
-
62
- protected getProxy(name: string, userHandler: SignalHandler): SignalHandler | null {
63
- if (name === "added" || name === "removed") {
64
- return impl => userHandler(new Device(impl));
65
- }
66
-
67
- return null;
68
- }
69
- }
@@ -1,56 +0,0 @@
1
- import { AuthenticatedSessionInfo } from "./authentication";
2
- import { binding } from "./native";
3
-
4
- import { inspect } from "util";
5
-
6
- export class EndpointParameters {
7
- private impl: any;
8
-
9
- constructor({
10
- address = null,
11
- port = null,
12
- certificate = null,
13
- origin = null,
14
- authentication = null,
15
- assetRoot = null,
16
- }: EndpointParametersSubset = {}) {
17
- let authToken: string | null = null;
18
- let authCallback: AuthenticationCallback | null = null;
19
- if (authentication !== null) {
20
- if (authentication.scheme === "token") {
21
- authToken = authentication.token;
22
- } else {
23
- authCallback = authentication.callback;
24
- }
25
- }
26
-
27
- this.impl = new binding.EndpointParameters(address, port, certificate, origin, authToken, authCallback, assetRoot);
28
- }
29
-
30
- [inspect.custom]() {
31
- return "EndpointParameters {}";
32
- }
33
- }
34
-
35
- export interface EndpointParametersSubset {
36
- address?: string;
37
- port?: number;
38
- certificate?: string;
39
- origin?: string;
40
- authentication?: AuthenticationScheme;
41
- assetRoot?: string;
42
- }
43
-
44
- export type AuthenticationScheme = TokenAuthenticationScheme | CallbackAuthenticationScheme;
45
-
46
- export interface TokenAuthenticationScheme {
47
- scheme: "token";
48
- token: string;
49
- }
50
-
51
- export interface CallbackAuthenticationScheme {
52
- scheme: "callback";
53
- callback: AuthenticationCallback;
54
- }
55
-
56
- export type AuthenticationCallback = (token: string) => Promise<AuthenticatedSessionInfo>;
package/lib/icon.ts DELETED
@@ -1,15 +0,0 @@
1
- export type Icon = RGBAIcon | PNGIcon;
2
-
3
- export interface RGBAIcon {
4
- format: "rgba";
5
- width: number;
6
- height: number;
7
- image: Buffer;
8
- }
9
-
10
- export interface PNGIcon {
11
- format: "png";
12
- width?: number;
13
- height?: number;
14
- image: Buffer;
15
- }