phonesinc 2.1.0 → 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, AuthenticatorAddRequest, AuthenticatorCode, AuthenticatorEntry, AuthenticatorUpdateRequest, ClientOptions, Endpoint, FileExport, Identity, KeyRequest, Media, MediaImported, MediaImportFailed, MediaImporting, MediaImportStatusRequest, MediaSource, MediaUploadRequest, OptionalEndpoint, Phone, PhoneFile, PhoneResult, PhoneSelection, PhoneTargets, Rental, RentRequest, RequestOptions, ScreenRequest, Screenshot, Session, Stream, TouchRequest, TypeRequest, VerificationService } 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: {
@@ -161,6 +161,55 @@ export declare class PhonesInc {
161
161
  id: string;
162
162
  }, Rental>;
163
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
+ };
164
213
  /** Raw WebDriver responses, including WebDriver errors, are returned unchanged. */
165
214
  readonly appium: ((body: AppiumRequest, options?: RequestOptions) => Promise<Response>) & {
166
215
  readonly endpoint: string;
package/dist/index.js CHANGED
@@ -207,6 +207,26 @@ export class PhonesInc {
207
207
  rentals: this.optional("/v1/verification/rentals"),
208
208
  cancel: this.required("/v1/verification/cancel"),
209
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
+ };
210
230
  /** Raw WebDriver responses, including WebDriver errors, are returned unchanged. */
211
231
  appium = this.custom("/v1/appium", async (path, request, options) => {
212
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;
@@ -166,6 +167,9 @@ export type Stream = {
166
167
  export type PhoneSelection = {
167
168
  phoneIds?: string[];
168
169
  };
170
+ export type PhoneListRequest = PhoneSelection & {
171
+ tags?: string[];
172
+ };
169
173
  export type PhoneTargets = {
170
174
  phoneIds: string[];
171
175
  };
@@ -319,3 +323,134 @@ export type VirtualPhoneHost = {
319
323
  connected: boolean;
320
324
  runningLimit: number;
321
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.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "The public Phones Inc API client",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",