phonesinc 2.0.2 → 2.2.0

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 CHANGED
@@ -1,4 +1,4 @@
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";
1
+ import type { VirtualPhone, VirtualPhoneHost, VirtualPhoneTarget, ApiResponse, App, AppiumRequest, AppRequest, AuthenticatorAddRequest, AuthenticatorCode, AuthenticatorEntry, AuthenticatorUpdateRequest, Screen, ScreenCreateRequest, ScreenUpdateRequest, Workflow, WorkflowCreateRequest, WorkflowRun, WorkflowRunRequest, WorkflowRunSummary, WorkflowSummary, WorkflowUpdateRequest, ClientOptions, Endpoint, FileExport, Identity, KeyRequest, Media, MediaImported, MediaImportFailed, MediaImporting, MediaImportStatusRequest, MediaSource, MediaUploadRequest, OptionalEndpoint, Phone, PhoneFile, PhoneResult, PhoneListRequest, PhoneSelection, PhoneTargets, Rental, RentRequest, RequestOptions, ScreenRequest, Screenshot, Session, Stream, TouchRequest, TypeRequest, VerificationService } 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 {
@@ -36,7 +36,7 @@ export declare class PhonesInc {
36
36
  };
37
37
  readonly me: OptionalEndpoint<Record<never, never>, Identity>;
38
38
  readonly phones: {
39
- get: OptionalEndpoint<PhoneSelection, Phone[]>;
39
+ get: OptionalEndpoint<PhoneListRequest, Phone[]>;
40
40
  reboot: Endpoint<PhoneTargets, PhoneResult[]>;
41
41
  };
42
42
  readonly session: {
@@ -131,6 +131,85 @@ export declare class PhonesInc {
131
131
  }, PhoneResult[]>;
132
132
  };
133
133
  readonly stream: OptionalEndpoint<PhoneSelection, Stream>;
134
+ /** The organization's 2FA codes. */
135
+ readonly authenticator: {
136
+ get: OptionalEndpoint<{
137
+ phone?: string;
138
+ }, AuthenticatorEntry[]>;
139
+ add: Endpoint<AuthenticatorAddRequest, AuthenticatorEntry>;
140
+ code: Endpoint<{
141
+ id: string;
142
+ }, AuthenticatorCode>;
143
+ update: Endpoint<AuthenticatorUpdateRequest, AuthenticatorEntry>;
144
+ delete: Endpoint<{
145
+ id: string;
146
+ }, {
147
+ id: string;
148
+ }>;
149
+ };
150
+ /** Rent an email address or phone number for a service and read the code sent to it. */
151
+ readonly verification: {
152
+ services: OptionalEndpoint<{
153
+ search?: string;
154
+ }, VerificationService[]>;
155
+ rent: Endpoint<RentRequest, Rental>;
156
+ rental: Endpoint<{
157
+ id: string;
158
+ }, Rental>;
159
+ rentals: OptionalEndpoint<Record<never, never>, Rental[]>;
160
+ cancel: Endpoint<{
161
+ id: string;
162
+ }, Rental>;
163
+ };
164
+ /** The organization's workflows: node graphs that drive phones, and their runs. */
165
+ readonly workflows: {
166
+ list: OptionalEndpoint<Record<never, never>, WorkflowSummary[]>;
167
+ get: Endpoint<{
168
+ id: string;
169
+ }, Workflow>;
170
+ create: Endpoint<WorkflowCreateRequest, Workflow>;
171
+ update: Endpoint<WorkflowUpdateRequest, Workflow>;
172
+ delete: Endpoint<{
173
+ id: string;
174
+ }, {
175
+ id: string;
176
+ deleted: boolean;
177
+ }>;
178
+ run: Endpoint<WorkflowRunRequest, {
179
+ runId: string;
180
+ }>;
181
+ runs: OptionalEndpoint<{
182
+ workflowId?: string;
183
+ limit?: number;
184
+ }, WorkflowRunSummary[]>;
185
+ runGet: Endpoint<{
186
+ runId: string;
187
+ }, WorkflowRun>;
188
+ runStop: Endpoint<{
189
+ runId: string;
190
+ }, {
191
+ runId: string;
192
+ stopped: boolean;
193
+ }>;
194
+ };
195
+ /** Screens the organization's workflows recognise. */
196
+ readonly screens: {
197
+ list: OptionalEndpoint<{
198
+ app?: string;
199
+ platform?: "android" | "ios";
200
+ }, Screen[]>;
201
+ get: Endpoint<{
202
+ id: string;
203
+ }, Screen>;
204
+ create: Endpoint<ScreenCreateRequest, Screen>;
205
+ update: Endpoint<ScreenUpdateRequest, Screen>;
206
+ delete: Endpoint<{
207
+ id: string;
208
+ }, {
209
+ id: string;
210
+ deleted: boolean;
211
+ }>;
212
+ };
134
213
  /** Raw WebDriver responses, including WebDriver errors, are returned unchanged. */
135
214
  readonly appium: ((body: AppiumRequest, options?: RequestOptions) => Promise<Response>) & {
136
215
  readonly endpoint: string;
package/dist/index.js CHANGED
@@ -191,6 +191,42 @@ export class PhonesInc {
191
191
  set: this.required("/v1/clipboard/set"),
192
192
  };
193
193
  stream = this.optional("/v1/stream");
194
+ /** The organization's 2FA codes. */
195
+ authenticator = {
196
+ get: this.optional("/v1/authenticator"),
197
+ add: this.required("/v1/authenticator/add"),
198
+ code: this.required("/v1/authenticator/code"),
199
+ update: this.required("/v1/authenticator/update"),
200
+ delete: this.required("/v1/authenticator/delete"),
201
+ };
202
+ /** Rent an email address or phone number for a service and read the code sent to it. */
203
+ verification = {
204
+ services: this.optional("/v1/verification/services"),
205
+ rent: this.required("/v1/verification/rent"),
206
+ rental: this.required("/v1/verification/rental"),
207
+ rentals: this.optional("/v1/verification/rentals"),
208
+ cancel: this.required("/v1/verification/cancel"),
209
+ };
210
+ /** The organization's workflows: node graphs that drive phones, and their runs. */
211
+ workflows = {
212
+ list: this.optional("/v1/workflows"),
213
+ get: this.required("/v1/workflows/get"),
214
+ create: this.required("/v1/workflows/create"),
215
+ update: this.required("/v1/workflows/update"),
216
+ delete: this.required("/v1/workflows/delete"),
217
+ run: this.required("/v1/workflows/run"),
218
+ runs: this.optional("/v1/workflows/runs"),
219
+ runGet: this.required("/v1/workflows/runs/get"),
220
+ runStop: this.required("/v1/workflows/runs/stop"),
221
+ };
222
+ /** Screens the organization's workflows recognise. */
223
+ screens = {
224
+ list: this.optional("/v1/screens"),
225
+ get: this.required("/v1/screens/get"),
226
+ create: this.required("/v1/screens/create"),
227
+ update: this.required("/v1/screens/update"),
228
+ delete: this.required("/v1/screens/delete"),
229
+ };
194
230
  /** Raw WebDriver responses, including WebDriver errors, are returned unchanged. */
195
231
  appium = this.custom("/v1/appium", async (path, request, options) => {
196
232
  const base = `${this.baseUrl}${path}`;
package/dist/types.d.ts CHANGED
@@ -39,6 +39,7 @@ export type Phone = {
39
39
  phoneNumber: string | null;
40
40
  appium: boolean;
41
41
  session: Session | null;
42
+ tags: string[];
42
43
  };
43
44
  export type App = {
44
45
  id: string;
@@ -60,6 +61,35 @@ export type Media = {
60
61
  url: string;
61
62
  createdAt: string;
62
63
  };
64
+ export type AuthenticatorApp = "tiktok" | "instagram";
65
+ /** A 2FA (TOTP) entry with its current code; the secret is never returned. */
66
+ export type AuthenticatorEntry = {
67
+ id: string;
68
+ app: AuthenticatorApp;
69
+ label: string;
70
+ phone: string | null;
71
+ code: string;
72
+ expiresAt: string;
73
+ createdAt: string;
74
+ };
75
+ export type AuthenticatorCode = {
76
+ code: string;
77
+ expiresAt: string;
78
+ };
79
+ /** `secret` is the setup key or an otpauth:// URI. */
80
+ export type AuthenticatorAddRequest = {
81
+ app: AuthenticatorApp;
82
+ label: string;
83
+ secret: string;
84
+ phone?: string;
85
+ };
86
+ /** `phone: null` unlinks the phone. */
87
+ export type AuthenticatorUpdateRequest = {
88
+ id: string;
89
+ label?: string;
90
+ app?: AuthenticatorApp;
91
+ phone?: string | null;
92
+ };
63
93
  export type Identity = {
64
94
  organization: {
65
95
  id: string;
@@ -95,6 +125,33 @@ export type Screenshot = {
95
125
  elements?: Element[];
96
126
  annotatedImageUrl?: string;
97
127
  };
128
+ /** A service you can rent an email address or phone number for. */
129
+ export type VerificationService = {
130
+ id: string;
131
+ name: string;
132
+ email: {
133
+ available: number;
134
+ };
135
+ phone: {
136
+ available: boolean;
137
+ };
138
+ };
139
+ /** A rented email address or phone number and the code sent to it. */
140
+ export type Rental = {
141
+ id: string;
142
+ type: "email" | "phone";
143
+ service: string;
144
+ address: string;
145
+ status: "active" | "completed" | "expired" | "cancelled";
146
+ code: string | null;
147
+ codeReceivedAt: string | null;
148
+ expiresAt: string;
149
+ createdAt: string;
150
+ };
151
+ export type RentRequest = {
152
+ type: "email" | "phone";
153
+ service: string;
154
+ };
98
155
  export type FileExport = {
99
156
  url: string;
100
157
  filename: string;
@@ -110,6 +167,9 @@ export type Stream = {
110
167
  export type PhoneSelection = {
111
168
  phoneIds?: string[];
112
169
  };
170
+ export type PhoneListRequest = PhoneSelection & {
171
+ tags?: string[];
172
+ };
113
173
  export type PhoneTargets = {
114
174
  phoneIds: string[];
115
175
  };
@@ -263,3 +323,134 @@ export type VirtualPhoneHost = {
263
323
  connected: boolean;
264
324
  runningLimit: number;
265
325
  };
326
+ /** JSON as the API answers it inside workflows (node configs, run inputs and outputs). */
327
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
328
+ [key: string]: JsonValue;
329
+ };
330
+ /** One node of a workflow graph. `inputs` maps an input port to the node and output port it reads. */
331
+ export type WorkflowNode = {
332
+ id: string;
333
+ type: string;
334
+ name?: string;
335
+ x?: number;
336
+ y?: number;
337
+ config: {
338
+ [key: string]: JsonValue;
339
+ };
340
+ inputs: {
341
+ [inputId: string]: {
342
+ sourceNodeId: string;
343
+ sourceOutputId: string;
344
+ };
345
+ };
346
+ };
347
+ /** Something that stops a workflow from running yet. */
348
+ export type WorkflowIssue = {
349
+ type: string;
350
+ nodeId: string | null;
351
+ portId: string | null;
352
+ message: string;
353
+ };
354
+ export type Workflow = {
355
+ id: string;
356
+ organization: string;
357
+ name: string;
358
+ description: string | null;
359
+ nodes: WorkflowNode[];
360
+ issues: WorkflowIssue[];
361
+ createdAt: string;
362
+ updatedAt: string;
363
+ };
364
+ export type WorkflowSummary = Omit<Workflow, "nodes" | "issues"> & {
365
+ nodeCount: number;
366
+ };
367
+ /** `nodes` is the graph as JSON text (a WorkflowNode array). */
368
+ export type WorkflowCreateRequest = {
369
+ name: string;
370
+ description?: string | null;
371
+ nodes?: string;
372
+ };
373
+ export type WorkflowUpdateRequest = {
374
+ id: string;
375
+ name?: string;
376
+ description?: string | null;
377
+ nodes?: string;
378
+ };
379
+ /** `inputs` is a JSON object of the Input nodes' values, as text. */
380
+ export type WorkflowRunRequest = {
381
+ id: string;
382
+ inputs?: string;
383
+ };
384
+ export type WorkflowRunSummary = {
385
+ id: string;
386
+ workflowId: string | null;
387
+ organization: string;
388
+ status: "running" | "completed" | "failed" | "stopped";
389
+ error: string | null;
390
+ createdAt: string;
391
+ finishedAt: string | null;
392
+ };
393
+ export type WorkflowRun = WorkflowRunSummary & {
394
+ inputs: {
395
+ [name: string]: JsonValue;
396
+ };
397
+ nodes: {
398
+ nodeId: string;
399
+ copy: string | null;
400
+ type: string;
401
+ status: "pending" | "running" | "completed" | "failed" | "skipped";
402
+ error: string | null;
403
+ outputs: {
404
+ [port: string]: JsonValue;
405
+ } | null;
406
+ startedAt: string | null;
407
+ finishedAt: string | null;
408
+ }[];
409
+ logs: {
410
+ at: string;
411
+ level: "info" | "warn" | "error";
412
+ nodeId: string | null;
413
+ message: string;
414
+ }[];
415
+ };
416
+ export type ScreenCondition = {
417
+ kind: "text";
418
+ text: string;
419
+ region?: [number, number, number, number];
420
+ exact?: boolean;
421
+ } | {
422
+ kind: "label";
423
+ label: string;
424
+ region?: [number, number, number, number];
425
+ } | {
426
+ kind: "vision";
427
+ question: string;
428
+ };
429
+ export type ScreenMatch = {
430
+ all: ScreenCondition[];
431
+ none: ScreenCondition[];
432
+ };
433
+ export type Screen = {
434
+ id: string;
435
+ organization: string;
436
+ name: string;
437
+ app: string;
438
+ platform: "android" | "ios";
439
+ match: ScreenMatch;
440
+ sampleUrl: string | null;
441
+ createdAt: string;
442
+ updatedAt: string;
443
+ };
444
+ export type ScreenCreateRequest = {
445
+ name: string;
446
+ app: string;
447
+ platform: "android" | "ios";
448
+ match: {
449
+ all?: ScreenCondition[];
450
+ none?: ScreenCondition[];
451
+ };
452
+ sampleUrl?: string | null;
453
+ };
454
+ export type ScreenUpdateRequest = Partial<ScreenCreateRequest> & {
455
+ id: string;
456
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonesinc",
3
- "version": "2.0.2",
3
+ "version": "2.2.0",
4
4
  "description": "The public Phones Inc API client",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",