@run-cloud/sdk 0.12.1 → 0.14.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/README.md +77 -2
- package/dist/index.d.ts +342 -4
- package/dist/index.js +682 -44
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,14 +15,88 @@ const cloud = new Client();
|
|
|
15
15
|
|
|
16
16
|
const ios = await cloud.ios.create({ displayName: "CI smoke" });
|
|
17
17
|
await cloud.ios.openUrl(ios.id, "https://example.com");
|
|
18
|
-
await
|
|
18
|
+
await cloud.ios.tap(ios.id, { x: 0.5, y: 0.75 });
|
|
19
|
+
await cloud.ios.typeText(ios.id, "Hello from iOS!");
|
|
19
20
|
await writeFile("ios-screenshot.png", await cloud.ios.screenshot(ios.id));
|
|
20
21
|
await cloud.ios.delete(ios.id);
|
|
21
22
|
|
|
22
23
|
const android = await cloud.android.create({ displayName: "Android smoke" });
|
|
24
|
+
await cloud.android.swipe(
|
|
25
|
+
android.id,
|
|
26
|
+
{ x: 0.5, y: 0.8 },
|
|
27
|
+
{ x: 0.5, y: 0.2 },
|
|
28
|
+
{ durationMs: 250 },
|
|
29
|
+
);
|
|
30
|
+
await cloud.android.pressKey(android.id, "enter");
|
|
31
|
+
await writeFile("android-screenshot.png", await cloud.android.screenshot(android.id));
|
|
32
|
+
const recording = await cloud.android.startRecording(android.id, {
|
|
33
|
+
idempotencyKey: "android-readme-example",
|
|
34
|
+
});
|
|
35
|
+
await cloud.android.openUrl(android.id, "https://run.cloud");
|
|
36
|
+
await cloud.android.stopRecording(android.id, recording.id);
|
|
37
|
+
await writeFile(
|
|
38
|
+
"android-recording.mp4",
|
|
39
|
+
await cloud.android.downloadRecording(android.id, recording.id),
|
|
40
|
+
);
|
|
23
41
|
await cloud.android.delete(android.id);
|
|
24
42
|
```
|
|
25
43
|
|
|
44
|
+
## Simulator interactions
|
|
45
|
+
|
|
46
|
+
Both `cloud.ios` and `cloud.android` expose the same interaction methods:
|
|
47
|
+
`tap`, `swipe`, `gesture`, `typeText`, `pressKey`, `pressButton`, `rotate`,
|
|
48
|
+
`reload`, `scroll`, `toggleSoftwareKeyboard`, `simulateMemoryWarning`,
|
|
49
|
+
`rotateDigitalCrown`, and `setRenderDebug`. Coordinates use inclusive normalized
|
|
50
|
+
display space: `(0, 0)` is the top-left corner and `(1, 1)` is the bottom-right.
|
|
51
|
+
`typeText` uses a US keyboard and accepts tabs, line feeds, and printable ASCII.
|
|
52
|
+
On iOS, `home`, `appSwitcher`, and `recents` are momentary navigation actions;
|
|
53
|
+
physical buttons honor `durationMs`.
|
|
54
|
+
Digital Crown input is not supported by current iOS Simulator or Android
|
|
55
|
+
Emulator sessions; the typed method returns an actionable API error.
|
|
56
|
+
Android Emulator sessions also report `capsLock`, `numLock`, and `scrollLock`
|
|
57
|
+
as unsupported semantic keys.
|
|
58
|
+
|
|
59
|
+
Every method returns a correlated, action-narrowed acknowledgement. Use
|
|
60
|
+
`interact` when the action is assembled dynamically:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const result = await cloud.simulators.interact(
|
|
64
|
+
ios.id,
|
|
65
|
+
{ action: "tap", x: 0.5, y: 0.5 },
|
|
66
|
+
{ platform: "ios", requestId: "open-settings", timeoutMs: 15_000 },
|
|
67
|
+
);
|
|
68
|
+
console.log(result.requestId, result.action, result.status, result.result.pointCount);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Pass an `AbortSignal` to stop waiting without releasing the session. The SDK
|
|
72
|
+
sends the requested timeout to run.cloud and leaves a short response margin so
|
|
73
|
+
the server's completion or timeout acknowledgement can arrive.
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const controller = new AbortController();
|
|
77
|
+
process.once("SIGINT", () => controller.abort());
|
|
78
|
+
await cloud.android.typeText(android.id, "cancel-safe", {
|
|
79
|
+
signal: controller.signal,
|
|
80
|
+
timeoutMs: 15_000,
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
API failures throw `RunCloudError`. In addition to `status` and `detail`,
|
|
85
|
+
interaction failures preserve `code`, `retryable`, `details`, `requestId`,
|
|
86
|
+
`action`, and the accepted/completed timing fields when the API provides them.
|
|
87
|
+
Screenshot options also accept `requestId`; screenshot timeout, transport, and
|
|
88
|
+
invalid-image failures retain the same correlation fields with stable
|
|
89
|
+
`screenshot_*` codes.
|
|
90
|
+
|
|
91
|
+
## Simulator recordings
|
|
92
|
+
|
|
93
|
+
Both platform clients expose `startRecording`, `listRecordings`,
|
|
94
|
+
`getRecording`, `stopRecording`, and `downloadRecording`. Start accepts an
|
|
95
|
+
optional idempotency key. Status includes lifecycle events, actionable failure
|
|
96
|
+
metadata, and the retention deadline; download returns a validated MP4 without
|
|
97
|
+
exposing backing-storage credentials. Ready recordings remain available after
|
|
98
|
+
the simulator session is released.
|
|
99
|
+
|
|
26
100
|
## Linux sandboxes
|
|
27
101
|
|
|
28
102
|
Firecracker microVMs. The default reservation is 0.125 vCPU / 128 MiB — CPU
|
|
@@ -162,7 +236,8 @@ For multipart archives, `cloud.assets.uploadBatch(parts, { uploadBatchId,
|
|
|
162
236
|
uploadRunId })` numbers the parts, records per-part transfer telemetry, and
|
|
163
237
|
limits direct storage transfers to six at a time.
|
|
164
238
|
|
|
165
|
-
`cloud.ios.screenshot(sessionId)`
|
|
239
|
+
`cloud.ios.screenshot(sessionId)` and `cloud.android.screenshot(sessionId)`
|
|
240
|
+
return PNG bytes as a `Uint8Array`. Save the
|
|
166
241
|
bytes directly with `node:fs/promises.writeFile`, attach them to test artifacts,
|
|
167
242
|
or pass them to an image-processing library.
|
|
168
243
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,219 @@
|
|
|
1
1
|
import WebSocket from "ws";
|
|
2
2
|
export type SimulatorPlatform = "ios" | "android";
|
|
3
|
+
export interface SimulatorPoint {
|
|
4
|
+
/** Normalized display-space coordinate, inclusive from 0 (left) to 1 (right). */
|
|
5
|
+
x: number;
|
|
6
|
+
/** Normalized display-space coordinate, inclusive from 0 (top) to 1 (bottom). */
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
export type SimulatorOrientation = "portrait" | "portrait_upside_down" | "landscape_left" | "landscape_right";
|
|
10
|
+
export declare const SIMULATOR_KEYS: readonly ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "enter", "escape", "backspace", "tab", "space", "minus", "equal", "bracketLeft", "bracketRight", "backslash", "semicolon", "quote", "backquote", "comma", "period", "slash", "capsLock", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "printScreen", "scrollLock", "pause", "insert", "home", "pageUp", "delete", "end", "pageDown", "arrowRight", "arrowLeft", "arrowDown", "arrowUp", "numLock", "numpadDivide", "numpadMultiply", "numpadSubtract", "numpadAdd", "numpadEnter", "numpad0", "numpad1", "numpad2", "numpad3", "numpad4", "numpad5", "numpad6", "numpad7", "numpad8", "numpad9", "numpadDecimal"];
|
|
11
|
+
export type SimulatorKey = (typeof SIMULATOR_KEYS)[number];
|
|
12
|
+
export type SimulatorKeyModifier = "shift" | "control" | "alt" | "meta";
|
|
13
|
+
export declare const SIMULATOR_BUTTONS: readonly ["home", "back", "appSwitcher", "recents", "power", "volumeUp", "volumeDown", "menu", "sideButton", "actionButton", "digitalCrown"];
|
|
14
|
+
export type SimulatorButton = (typeof SIMULATOR_BUTTONS)[number];
|
|
15
|
+
export declare const SIMULATOR_RENDER_DEBUG_OPTIONS: readonly ["colorBlendedLayers", "colorCopiedImages", "colorMisalignedImages", "colorOffscreenRendered", "slowAnimations"];
|
|
16
|
+
export type SimulatorRenderDebugOption = (typeof SIMULATOR_RENDER_DEBUG_OPTIONS)[number];
|
|
17
|
+
export interface SimulatorGestureStep {
|
|
18
|
+
phase: "begin" | "move" | "end";
|
|
19
|
+
points: [SimulatorPoint] | [SimulatorPoint, SimulatorPoint];
|
|
20
|
+
/** Milliseconds to wait before the next step. The final end step must omit this or use 0. */
|
|
21
|
+
delayMs?: number;
|
|
22
|
+
}
|
|
23
|
+
export type SimulatorInteraction = {
|
|
24
|
+
action: "tap";
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
} | {
|
|
28
|
+
action: "swipe";
|
|
29
|
+
from: SimulatorPoint;
|
|
30
|
+
to: SimulatorPoint;
|
|
31
|
+
durationMs?: number;
|
|
32
|
+
} | {
|
|
33
|
+
action: "gesture";
|
|
34
|
+
steps: SimulatorGestureStep[];
|
|
35
|
+
} | {
|
|
36
|
+
action: "typeText";
|
|
37
|
+
text: string;
|
|
38
|
+
} | {
|
|
39
|
+
action: "pressKey";
|
|
40
|
+
key: SimulatorKey;
|
|
41
|
+
modifiers?: SimulatorKeyModifier[];
|
|
42
|
+
durationMs?: number;
|
|
43
|
+
} | {
|
|
44
|
+
action: "pressButton";
|
|
45
|
+
button: SimulatorButton;
|
|
46
|
+
durationMs?: number;
|
|
47
|
+
} | {
|
|
48
|
+
action: "rotate";
|
|
49
|
+
orientation: SimulatorOrientation;
|
|
50
|
+
} | {
|
|
51
|
+
action: "reload";
|
|
52
|
+
} | {
|
|
53
|
+
action: "scroll";
|
|
54
|
+
deltaX: number;
|
|
55
|
+
deltaY: number;
|
|
56
|
+
x?: number;
|
|
57
|
+
y?: number;
|
|
58
|
+
} | {
|
|
59
|
+
action: "toggleSoftwareKeyboard";
|
|
60
|
+
} | {
|
|
61
|
+
action: "simulateMemoryWarning";
|
|
62
|
+
} | {
|
|
63
|
+
action: "rotateDigitalCrown";
|
|
64
|
+
delta: number;
|
|
65
|
+
} | {
|
|
66
|
+
action: "setRenderDebug";
|
|
67
|
+
option: SimulatorRenderDebugOption;
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
};
|
|
70
|
+
export type SimulatorInteractionAction = SimulatorInteraction["action"];
|
|
71
|
+
export type SimulatorOperation = SimulatorInteractionAction | "screenshot";
|
|
72
|
+
export declare const SIMULATOR_INTERACTION_ERROR_CODES: readonly ["invalid_interaction", "active_session_not_found", "simulator_capacity_unavailable", "unsupported_action", "duplicate_request", "interaction_cancelled", "interaction_timeout", "interaction_transport_error", "interaction_invalid_response", "interaction_failed"];
|
|
73
|
+
export type SimulatorInteractionErrorCode = (typeof SIMULATOR_INTERACTION_ERROR_CODES)[number];
|
|
74
|
+
export declare const SIMULATOR_SCREENSHOT_ERROR_CODES: readonly ["invalid_screenshot_request", "active_session_not_found", "simulator_capacity_unavailable", "screenshot_cancelled", "screenshot_timeout", "screenshot_transport_error", "screenshot_invalid_response", "screenshot_failed"];
|
|
75
|
+
export type SimulatorScreenshotErrorCode = (typeof SIMULATOR_SCREENSHOT_ERROR_CODES)[number];
|
|
76
|
+
export interface SimulatorInteractionOptions {
|
|
77
|
+
/** Correlates this request with logs and the returned acknowledgement. */
|
|
78
|
+
requestId?: string;
|
|
79
|
+
/** Cancels the request without cancelling or releasing the simulator session. */
|
|
80
|
+
signal?: AbortSignal;
|
|
81
|
+
/** Maximum time to wait for the simulator acknowledgement. Defaults to 15 seconds. */
|
|
82
|
+
timeoutMs?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface SimulatorInteractionResultMap {
|
|
85
|
+
tap: {
|
|
86
|
+
pointCount: 1;
|
|
87
|
+
};
|
|
88
|
+
swipe: {
|
|
89
|
+
pointCount: 1;
|
|
90
|
+
durationMs: number;
|
|
91
|
+
};
|
|
92
|
+
gesture: {
|
|
93
|
+
pointCount: number;
|
|
94
|
+
stepCount: number;
|
|
95
|
+
};
|
|
96
|
+
typeText: {
|
|
97
|
+
characterCount: number;
|
|
98
|
+
};
|
|
99
|
+
pressKey: {
|
|
100
|
+
key: SimulatorKey;
|
|
101
|
+
modifierCount: number;
|
|
102
|
+
};
|
|
103
|
+
pressButton: {
|
|
104
|
+
button: SimulatorButton;
|
|
105
|
+
};
|
|
106
|
+
rotate: {
|
|
107
|
+
orientation: SimulatorOrientation;
|
|
108
|
+
};
|
|
109
|
+
reload: undefined;
|
|
110
|
+
scroll: {
|
|
111
|
+
deltaX: number;
|
|
112
|
+
deltaY: number;
|
|
113
|
+
};
|
|
114
|
+
toggleSoftwareKeyboard: undefined;
|
|
115
|
+
simulateMemoryWarning: undefined;
|
|
116
|
+
rotateDigitalCrown: {
|
|
117
|
+
delta: number;
|
|
118
|
+
};
|
|
119
|
+
setRenderDebug: {
|
|
120
|
+
option: SimulatorRenderDebugOption;
|
|
121
|
+
enabled: boolean;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
type SimulatorInteractionResultField<Action extends SimulatorInteractionAction> = Action extends SimulatorInteractionAction ? SimulatorInteractionResultMap[Action] extends undefined ? {
|
|
125
|
+
result?: undefined;
|
|
126
|
+
} : {
|
|
127
|
+
result: SimulatorInteractionResultMap[Action];
|
|
128
|
+
} : never;
|
|
129
|
+
export type SimulatorInteractionResult<Action extends SimulatorInteractionAction = SimulatorInteractionAction> = {
|
|
130
|
+
ok: true;
|
|
131
|
+
requestId: string;
|
|
132
|
+
sessionId: string;
|
|
133
|
+
platform: SimulatorPlatform;
|
|
134
|
+
action: Action;
|
|
135
|
+
status: "completed";
|
|
136
|
+
acceptedAt: string;
|
|
137
|
+
completedAt: string;
|
|
138
|
+
durationMs: number;
|
|
139
|
+
} & SimulatorInteractionResultField<Action>;
|
|
140
|
+
export interface SimulatorInteractionFailure {
|
|
141
|
+
ok: false;
|
|
142
|
+
requestId?: string;
|
|
143
|
+
sessionId?: string;
|
|
144
|
+
platform?: SimulatorPlatform;
|
|
145
|
+
action?: SimulatorInteractionAction;
|
|
146
|
+
status?: "failed" | "cancelled" | "timed_out";
|
|
147
|
+
acceptedAt?: string;
|
|
148
|
+
completedAt?: string;
|
|
149
|
+
durationMs?: number;
|
|
150
|
+
error: {
|
|
151
|
+
code: SimulatorInteractionErrorCode;
|
|
152
|
+
message: string;
|
|
153
|
+
retryable: boolean;
|
|
154
|
+
details?: unknown;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export type SimulatorInteractionResultFor<Interaction extends SimulatorInteraction> = SimulatorInteractionResult<Interaction["action"]>;
|
|
158
|
+
export interface SimulatorScreenshotOptions {
|
|
159
|
+
/** Correlates this capture with API errors and logs. */
|
|
160
|
+
requestId?: string;
|
|
161
|
+
signal?: AbortSignal;
|
|
162
|
+
/** Maximum time to wait for image capture. Defaults to 15 seconds. */
|
|
163
|
+
timeoutMs?: number;
|
|
164
|
+
}
|
|
165
|
+
export interface SimulatorRecordingStartOptions {
|
|
166
|
+
/** Reuse this value when retrying a start request to receive the original recording. */
|
|
167
|
+
idempotencyKey?: string;
|
|
168
|
+
signal?: AbortSignal;
|
|
169
|
+
}
|
|
170
|
+
export interface SimulatorRecordingRequestOptions {
|
|
171
|
+
signal?: AbortSignal;
|
|
172
|
+
}
|
|
173
|
+
export interface SimulatorSwipeOptions extends SimulatorInteractionOptions {
|
|
174
|
+
durationMs?: number;
|
|
175
|
+
}
|
|
176
|
+
export interface SimulatorPressKeyOptions extends SimulatorInteractionOptions {
|
|
177
|
+
modifiers?: SimulatorKeyModifier[];
|
|
178
|
+
durationMs?: number;
|
|
179
|
+
}
|
|
180
|
+
export interface SimulatorPressButtonOptions extends SimulatorInteractionOptions {
|
|
181
|
+
durationMs?: number;
|
|
182
|
+
}
|
|
183
|
+
export interface AggregateSimulatorInteractionOptions extends SimulatorInteractionOptions {
|
|
184
|
+
platform?: SimulatorPlatform;
|
|
185
|
+
}
|
|
186
|
+
export interface AggregateSimulatorSwipeOptions extends SimulatorSwipeOptions {
|
|
187
|
+
platform?: SimulatorPlatform;
|
|
188
|
+
}
|
|
189
|
+
export interface AggregateSimulatorPressKeyOptions extends SimulatorPressKeyOptions {
|
|
190
|
+
platform?: SimulatorPlatform;
|
|
191
|
+
}
|
|
192
|
+
export interface AggregateSimulatorPressButtonOptions extends SimulatorPressButtonOptions {
|
|
193
|
+
platform?: SimulatorPlatform;
|
|
194
|
+
}
|
|
195
|
+
export interface AggregateSimulatorScreenshotOptions extends SimulatorScreenshotOptions {
|
|
196
|
+
platform?: SimulatorPlatform;
|
|
197
|
+
}
|
|
198
|
+
export interface AggregateSimulatorRecordingStartOptions extends SimulatorRecordingStartOptions {
|
|
199
|
+
platform?: SimulatorPlatform;
|
|
200
|
+
}
|
|
201
|
+
export interface AggregateSimulatorRecordingRequestOptions extends SimulatorRecordingRequestOptions {
|
|
202
|
+
platform?: SimulatorPlatform;
|
|
203
|
+
}
|
|
204
|
+
export declare const DEFAULT_SIMULATOR_INTERACTION_TIMEOUT_MS = 15000;
|
|
205
|
+
export declare function validateSimulatorInteraction(interaction: SimulatorInteraction, timeoutMs?: number): void;
|
|
206
|
+
interface RequestAbortOptions {
|
|
207
|
+
signal?: AbortSignal;
|
|
208
|
+
timeoutMs?: number;
|
|
209
|
+
timeoutMessage?: string;
|
|
210
|
+
timeoutCode?: string;
|
|
211
|
+
transportErrorCode?: string;
|
|
212
|
+
transportErrorMessage?: string;
|
|
213
|
+
headers?: Record<string, string>;
|
|
214
|
+
timeoutContext?: RunCloudErrorOptions;
|
|
215
|
+
errorContext?: RunCloudErrorOptions;
|
|
216
|
+
}
|
|
3
217
|
export interface ClientOptions {
|
|
4
218
|
apiKey?: string;
|
|
5
219
|
apiUrl?: string;
|
|
@@ -117,6 +331,56 @@ export interface SimulatorSession {
|
|
|
117
331
|
queueAttempts?: number;
|
|
118
332
|
metering?: Record<string, unknown>;
|
|
119
333
|
}
|
|
334
|
+
export type SimulatorRecordingStatus = "starting" | "recording" | "finalizing" | "ready" | "failed" | "deleting" | "deleted";
|
|
335
|
+
export interface SimulatorRecordingFailure {
|
|
336
|
+
stage: string | null;
|
|
337
|
+
code: string;
|
|
338
|
+
message: string | null;
|
|
339
|
+
action: string | null;
|
|
340
|
+
retryable: boolean;
|
|
341
|
+
nextAttemptAt: string | null;
|
|
342
|
+
}
|
|
343
|
+
export interface SimulatorRecording {
|
|
344
|
+
id: string;
|
|
345
|
+
sessionId: string;
|
|
346
|
+
platform: SimulatorPlatform;
|
|
347
|
+
status: SimulatorRecordingStatus;
|
|
348
|
+
contentType: "video/mp4";
|
|
349
|
+
byteSize: number | null;
|
|
350
|
+
checksum: {
|
|
351
|
+
algorithm: string;
|
|
352
|
+
value: string;
|
|
353
|
+
} | null;
|
|
354
|
+
etag: string | null;
|
|
355
|
+
durationMs: number | null;
|
|
356
|
+
attempts: number;
|
|
357
|
+
failure: SimulatorRecordingFailure | null;
|
|
358
|
+
startedAt: string | null;
|
|
359
|
+
stoppedAt: string | null;
|
|
360
|
+
readyAt: string | null;
|
|
361
|
+
retentionExpiresAt: string;
|
|
362
|
+
deletedAt: string | null;
|
|
363
|
+
createdAt: string;
|
|
364
|
+
updatedAt: string;
|
|
365
|
+
/** Authenticated API path available while a ready recording remains retained. */
|
|
366
|
+
downloadUrl: string | null;
|
|
367
|
+
}
|
|
368
|
+
export interface SimulatorRecordingEvent {
|
|
369
|
+
id: number;
|
|
370
|
+
kind: string;
|
|
371
|
+
status: SimulatorRecordingStatus;
|
|
372
|
+
stage: string | null;
|
|
373
|
+
attempt: number | null;
|
|
374
|
+
error: {
|
|
375
|
+
code: string;
|
|
376
|
+
message: string | null;
|
|
377
|
+
} | null;
|
|
378
|
+
data: Record<string, unknown>;
|
|
379
|
+
createdAt: string;
|
|
380
|
+
}
|
|
381
|
+
export interface SimulatorRecordingDetails extends SimulatorRecording {
|
|
382
|
+
events: SimulatorRecordingEvent[];
|
|
383
|
+
}
|
|
120
384
|
export interface SimulatorLogEntry {
|
|
121
385
|
timestamp: string;
|
|
122
386
|
message: string;
|
|
@@ -227,10 +491,34 @@ export interface Snapshot {
|
|
|
227
491
|
state?: "pending" | "ready" | "failed" | string;
|
|
228
492
|
[key: string]: unknown;
|
|
229
493
|
}
|
|
494
|
+
interface RunCloudErrorOptions {
|
|
495
|
+
code?: string;
|
|
496
|
+
retryable?: boolean;
|
|
497
|
+
details?: unknown;
|
|
498
|
+
requestId?: string;
|
|
499
|
+
sessionId?: string;
|
|
500
|
+
platform?: SimulatorPlatform;
|
|
501
|
+
action?: SimulatorOperation;
|
|
502
|
+
interactionStatus?: SimulatorInteractionFailure["status"];
|
|
503
|
+
acceptedAt?: string;
|
|
504
|
+
completedAt?: string;
|
|
505
|
+
durationMs?: number;
|
|
506
|
+
}
|
|
230
507
|
export declare class RunCloudError extends Error {
|
|
231
508
|
readonly status: number;
|
|
232
509
|
readonly detail: string;
|
|
233
|
-
|
|
510
|
+
readonly code?: string;
|
|
511
|
+
readonly retryable?: boolean;
|
|
512
|
+
readonly details?: unknown;
|
|
513
|
+
readonly requestId?: string;
|
|
514
|
+
readonly sessionId?: string;
|
|
515
|
+
readonly platform?: SimulatorPlatform;
|
|
516
|
+
readonly action?: SimulatorOperation;
|
|
517
|
+
readonly interactionStatus?: SimulatorInteractionFailure["status"];
|
|
518
|
+
readonly acceptedAt?: string;
|
|
519
|
+
readonly completedAt?: string;
|
|
520
|
+
readonly durationMs?: number;
|
|
521
|
+
constructor(status: number, detail: string, options?: RunCloudErrorOptions);
|
|
234
522
|
}
|
|
235
523
|
export declare class Client {
|
|
236
524
|
readonly ios: IosSimulatorClient;
|
|
@@ -248,9 +536,9 @@ export declare class Client {
|
|
|
248
536
|
orgId?: string;
|
|
249
537
|
}): Promise<UsageReport>;
|
|
250
538
|
account(): Promise<Account>;
|
|
251
|
-
request<T>(method: string, path: string, body?: unknown, headers?: Record<string, string
|
|
539
|
+
request<T>(method: string, path: string, body?: unknown, headers?: Record<string, string>, abortOptions?: RequestAbortOptions): Promise<T>;
|
|
252
540
|
uploadForm<T>(path: string, form: FormData): Promise<T>;
|
|
253
|
-
requestBytes(path: string): Promise<Uint8Array>;
|
|
541
|
+
requestBytes(path: string, abortOptions?: RequestAbortOptions): Promise<Uint8Array>;
|
|
254
542
|
requestTextStream(path: string, signal?: AbortSignal): AsyncGenerator<string>;
|
|
255
543
|
putSigned(url: string, body: Blob, headers: Record<string, string>): Promise<void>;
|
|
256
544
|
execStream(path: string, request: Record<string, unknown>, callbacks?: Pick<ExecOptions, "onStdout" | "onStderr" | "signal">): Promise<ExecResult>;
|
|
@@ -271,6 +559,31 @@ export declare class SimulatorClient {
|
|
|
271
559
|
get(id: string): Promise<SimulatorSession>;
|
|
272
560
|
delete(id: string): Promise<SimulatorSession>;
|
|
273
561
|
openUrl(id: string, url: string): Promise<Record<string, unknown>>;
|
|
562
|
+
interact<Interaction extends SimulatorInteraction>(id: string, interaction: Interaction, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResultFor<Interaction>>;
|
|
563
|
+
tap(id: string, point: SimulatorPoint, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"tap">>;
|
|
564
|
+
swipe(id: string, from: SimulatorPoint, to: SimulatorPoint, options?: SimulatorSwipeOptions): Promise<SimulatorInteractionResult<"swipe">>;
|
|
565
|
+
gesture(id: string, steps: SimulatorGestureStep[], options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"gesture">>;
|
|
566
|
+
typeText(id: string, text: string, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"typeText">>;
|
|
567
|
+
pressKey(id: string, key: SimulatorKey, options?: SimulatorPressKeyOptions): Promise<SimulatorInteractionResult<"pressKey">>;
|
|
568
|
+
pressButton(id: string, button: SimulatorButton, options?: SimulatorPressButtonOptions): Promise<SimulatorInteractionResult<"pressButton">>;
|
|
569
|
+
rotate(id: string, orientation: SimulatorOrientation, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"rotate">>;
|
|
570
|
+
reload(id: string, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"reload">>;
|
|
571
|
+
scroll(id: string, input: {
|
|
572
|
+
deltaX: number;
|
|
573
|
+
deltaY: number;
|
|
574
|
+
x?: number;
|
|
575
|
+
y?: number;
|
|
576
|
+
}, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"scroll">>;
|
|
577
|
+
toggleSoftwareKeyboard(id: string, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"toggleSoftwareKeyboard">>;
|
|
578
|
+
simulateMemoryWarning(id: string, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"simulateMemoryWarning">>;
|
|
579
|
+
rotateDigitalCrown(id: string, delta: number, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"rotateDigitalCrown">>;
|
|
580
|
+
setRenderDebug(id: string, option: SimulatorRenderDebugOption, enabled: boolean, options?: SimulatorInteractionOptions): Promise<SimulatorInteractionResult<"setRenderDebug">>;
|
|
581
|
+
screenshot(id: string, options?: SimulatorScreenshotOptions): Promise<Uint8Array>;
|
|
582
|
+
startRecording(id: string, options?: SimulatorRecordingStartOptions): Promise<SimulatorRecording>;
|
|
583
|
+
listRecordings(id: string, options?: SimulatorRecordingRequestOptions): Promise<SimulatorRecording[]>;
|
|
584
|
+
getRecording(id: string, recordingId: string, options?: SimulatorRecordingRequestOptions): Promise<SimulatorRecordingDetails>;
|
|
585
|
+
stopRecording(id: string, recordingId: string, options?: SimulatorRecordingRequestOptions): Promise<SimulatorRecording>;
|
|
586
|
+
downloadRecording(id: string, recordingId: string, options?: SimulatorRecordingRequestOptions): Promise<Uint8Array>;
|
|
274
587
|
logs(id: string, options?: {
|
|
275
588
|
tail?: number;
|
|
276
589
|
}): Promise<SimulatorLogSnapshot>;
|
|
@@ -280,7 +593,6 @@ export declare class SimulatorClient {
|
|
|
280
593
|
}
|
|
281
594
|
export declare class IosSimulatorClient extends SimulatorClient {
|
|
282
595
|
constructor(client: Client);
|
|
283
|
-
screenshot(id: string): Promise<Uint8Array>;
|
|
284
596
|
uploadVideo(id: string, video: Blob, options?: {
|
|
285
597
|
filename?: string;
|
|
286
598
|
name?: string;
|
|
@@ -313,6 +625,31 @@ export declare class SimulatorsClient {
|
|
|
313
625
|
openUrl(id: string, url: string, options?: {
|
|
314
626
|
platform?: SimulatorPlatform;
|
|
315
627
|
}): Promise<Record<string, unknown>>;
|
|
628
|
+
interact<Interaction extends SimulatorInteraction>(id: string, interaction: Interaction, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResultFor<Interaction>>;
|
|
629
|
+
tap(id: string, point: SimulatorPoint, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"tap">>;
|
|
630
|
+
swipe(id: string, from: SimulatorPoint, to: SimulatorPoint, options?: AggregateSimulatorSwipeOptions): Promise<SimulatorInteractionResult<"swipe">>;
|
|
631
|
+
gesture(id: string, steps: SimulatorGestureStep[], options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"gesture">>;
|
|
632
|
+
typeText(id: string, text: string, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"typeText">>;
|
|
633
|
+
pressKey(id: string, key: SimulatorKey, options?: AggregateSimulatorPressKeyOptions): Promise<SimulatorInteractionResult<"pressKey">>;
|
|
634
|
+
pressButton(id: string, button: SimulatorButton, options?: AggregateSimulatorPressButtonOptions): Promise<SimulatorInteractionResult<"pressButton">>;
|
|
635
|
+
rotate(id: string, orientation: SimulatorOrientation, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"rotate">>;
|
|
636
|
+
reload(id: string, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"reload">>;
|
|
637
|
+
scroll(id: string, input: {
|
|
638
|
+
deltaX: number;
|
|
639
|
+
deltaY: number;
|
|
640
|
+
x?: number;
|
|
641
|
+
y?: number;
|
|
642
|
+
}, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"scroll">>;
|
|
643
|
+
toggleSoftwareKeyboard(id: string, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"toggleSoftwareKeyboard">>;
|
|
644
|
+
simulateMemoryWarning(id: string, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"simulateMemoryWarning">>;
|
|
645
|
+
rotateDigitalCrown(id: string, delta: number, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"rotateDigitalCrown">>;
|
|
646
|
+
setRenderDebug(id: string, option: SimulatorRenderDebugOption, enabled: boolean, options?: AggregateSimulatorInteractionOptions): Promise<SimulatorInteractionResult<"setRenderDebug">>;
|
|
647
|
+
screenshot(id: string, options?: AggregateSimulatorScreenshotOptions): Promise<Uint8Array>;
|
|
648
|
+
startRecording(id: string, options?: AggregateSimulatorRecordingStartOptions): Promise<SimulatorRecording>;
|
|
649
|
+
listRecordings(id: string, options?: AggregateSimulatorRecordingRequestOptions): Promise<SimulatorRecording[]>;
|
|
650
|
+
getRecording(id: string, recordingId: string, options?: AggregateSimulatorRecordingRequestOptions): Promise<SimulatorRecordingDetails>;
|
|
651
|
+
stopRecording(id: string, recordingId: string, options?: AggregateSimulatorRecordingRequestOptions): Promise<SimulatorRecording>;
|
|
652
|
+
downloadRecording(id: string, recordingId: string, options?: AggregateSimulatorRecordingRequestOptions): Promise<Uint8Array>;
|
|
316
653
|
}
|
|
317
654
|
export declare class SandboxClient {
|
|
318
655
|
private readonly client;
|
|
@@ -416,3 +753,4 @@ export declare class AssetsClient {
|
|
|
416
753
|
deleted: boolean;
|
|
417
754
|
}>;
|
|
418
755
|
}
|
|
756
|
+
export {};
|