phonesinc 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +18 -1
- package/dist/index.js +14 -2
- package/dist/types.d.ts +18 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResponse, App, AppiumRequest, AppRequest, ClientOptions, Endpoint, FileExport, Identity, KeyRequest, Media, MediaImported, MediaImportFailed, MediaImporting, MediaImportStatusRequest, MediaSource, MediaUploadRequest, OptionalEndpoint, Phone, PhoneFile, PhoneResult, PhoneSelection, PhoneTargets, RequestOptions, ScreenRequest, Screenshot, Session, Stream, TouchRequest, TypeRequest } from "./types.js";
|
|
1
|
+
import type { VirtualPhone, VirtualPhoneHost, VirtualPhoneTarget, ApiResponse, App, AppiumRequest, AppRequest, ClientOptions, Endpoint, FileExport, Identity, KeyRequest, Media, MediaImported, MediaImportFailed, MediaImporting, MediaImportStatusRequest, MediaSource, MediaUploadRequest, OptionalEndpoint, Phone, PhoneFile, PhoneResult, PhoneSelection, PhoneTargets, RequestOptions, ScreenRequest, Screenshot, Session, Stream, TouchRequest, TypeRequest } from "./types.js";
|
|
2
2
|
export type * from "./types.js";
|
|
3
3
|
/** Public phone operations. A request is sent once; actions are never replayed. */
|
|
4
4
|
export declare class PhonesInc {
|
|
@@ -12,6 +12,23 @@ export declare class PhonesInc {
|
|
|
12
12
|
private required;
|
|
13
13
|
private optional;
|
|
14
14
|
private custom;
|
|
15
|
+
/** Requires an administrator login token. Creation is idempotent by key. */
|
|
16
|
+
readonly virtualPhones: {
|
|
17
|
+
hosts: OptionalEndpoint<Record<never, never>, VirtualPhoneHost[]>;
|
|
18
|
+
get: Endpoint<{
|
|
19
|
+
provider: string;
|
|
20
|
+
}, {
|
|
21
|
+
machines: VirtualPhone[];
|
|
22
|
+
runningLimit: number;
|
|
23
|
+
}>;
|
|
24
|
+
create: Endpoint<{
|
|
25
|
+
provider: string;
|
|
26
|
+
name: string;
|
|
27
|
+
idempotencyKey: string;
|
|
28
|
+
}, VirtualPhone>;
|
|
29
|
+
start: Endpoint<VirtualPhoneTarget, VirtualPhone>;
|
|
30
|
+
stop: Endpoint<VirtualPhoneTarget, VirtualPhone>;
|
|
31
|
+
};
|
|
15
32
|
readonly me: OptionalEndpoint<Record<never, never>, Identity>;
|
|
16
33
|
readonly phones: {
|
|
17
34
|
get: OptionalEndpoint<PhoneSelection, Phone[]>;
|
package/dist/index.js
CHANGED
|
@@ -83,6 +83,14 @@ export class PhonesInc {
|
|
|
83
83
|
custom(path, run) {
|
|
84
84
|
return named(path, (body, options = {}) => run(path, body, options));
|
|
85
85
|
}
|
|
86
|
+
/** Requires an administrator login token. Creation is idempotent by key. */
|
|
87
|
+
virtualPhones = {
|
|
88
|
+
hosts: this.optional("/v1/virtual-phones/hosts"),
|
|
89
|
+
get: this.required("/v1/virtual-phones"),
|
|
90
|
+
create: this.required("/v1/virtual-phones/create"),
|
|
91
|
+
start: this.required("/v1/virtual-phones/start"),
|
|
92
|
+
stop: this.required("/v1/virtual-phones/stop"),
|
|
93
|
+
};
|
|
86
94
|
me = this.optional("/v1/me");
|
|
87
95
|
phones = {
|
|
88
96
|
get: this.optional("/v1/phones"),
|
|
@@ -111,8 +119,12 @@ export class PhonesInc {
|
|
|
111
119
|
return;
|
|
112
120
|
}
|
|
113
121
|
const organizationId = options.organizationId === undefined ? this.organizationId : options.organizationId;
|
|
114
|
-
socket.send(JSON.stringify({
|
|
115
|
-
|
|
122
|
+
socket.send(JSON.stringify({
|
|
123
|
+
type: "attach",
|
|
124
|
+
token,
|
|
125
|
+
...view,
|
|
126
|
+
...(organizationId == null ? {} : { organizationId }),
|
|
127
|
+
}));
|
|
116
128
|
}, { once: true });
|
|
117
129
|
return socket;
|
|
118
130
|
}),
|
package/dist/types.d.ts
CHANGED
|
@@ -244,3 +244,21 @@ export type AppiumRequest = {
|
|
|
244
244
|
path: string;
|
|
245
245
|
body?: unknown;
|
|
246
246
|
};
|
|
247
|
+
/** Administrator-only Mac VM lifecycle; normal sessions authorize input. */
|
|
248
|
+
export type VirtualPhone = {
|
|
249
|
+
id: string;
|
|
250
|
+
name: string;
|
|
251
|
+
state: "creating" | "starting" | "running" | "stopping" | "stopped" | "error";
|
|
252
|
+
error: string | null;
|
|
253
|
+
createdAt: number;
|
|
254
|
+
updatedAt: number;
|
|
255
|
+
};
|
|
256
|
+
export type VirtualPhoneTarget = {
|
|
257
|
+
provider: string;
|
|
258
|
+
phoneId: string;
|
|
259
|
+
};
|
|
260
|
+
export type VirtualPhoneHost = {
|
|
261
|
+
provider: string;
|
|
262
|
+
connected: boolean;
|
|
263
|
+
runningLimit: number;
|
|
264
|
+
};
|