@limrun/api 0.25.2 → 0.26.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/src/ios-client.ts CHANGED
@@ -283,6 +283,13 @@ export type InstanceClient = {
283
283
  */
284
284
  elementTree: (point?: AccessibilityPoint) => Promise<ElementTree>;
285
285
 
286
+ /**
287
+ * Get the raw element tree string returned by the server.
288
+ * @param point Optional point to get the element at that specific location
289
+ * @returns A promise that resolves to the raw accessibility tree payload
290
+ */
291
+ elementTreeRaw: (point?: AccessibilityPoint) => Promise<string>;
292
+
286
293
  /**
287
294
  * Tap at the specified coordinates (uses device's native screen dimensions)
288
295
  * @param x X coordinate in points
@@ -684,6 +691,7 @@ type PendingRequest<T> = {
684
691
  resolve: (value: T) => void;
685
692
  reject: (reason: Error) => void;
686
693
  timeout: NodeJS.Timeout;
694
+ transform?: (message: ServerResponse) => T;
687
695
  };
688
696
 
689
697
  // Simctl uses streaming, so it's handled separately
@@ -1164,6 +1172,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1164
1172
  const sendRequest = <T>(
1165
1173
  type: string,
1166
1174
  params: Record<string, unknown> = {},
1175
+ transform?: (message: ServerResponse) => T,
1167
1176
  timeoutMs: number = 30000,
1168
1177
  ): Promise<T> => {
1169
1178
  return new Promise((resolve, reject) => {
@@ -1178,7 +1187,10 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1178
1187
  reject(new Error(`Request ${type} timed out`));
1179
1188
  }, timeoutMs);
1180
1189
 
1181
- pendingRequests.set(id, { resolve, reject, timeout });
1190
+ pendingRequests.set(
1191
+ id,
1192
+ transform ? { resolve, reject, timeout, transform } : { resolve, reject, timeout },
1193
+ );
1182
1194
 
1183
1195
  const request = { type, id, ...params };
1184
1196
  logger.debug('Sending request:', request);
@@ -1313,7 +1325,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1313
1325
  }
1314
1326
 
1315
1327
  // Use handler to transform response, or resolve with raw message
1316
- const handler = responseHandlers[message.type];
1328
+ const handler = request.transform ?? responseHandlers[message.type];
1317
1329
  if (handler) {
1318
1330
  try {
1319
1331
  request.resolve(handler(message));
@@ -1388,6 +1400,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1388
1400
  resolveConnection({
1389
1401
  screenshot,
1390
1402
  elementTree,
1403
+ elementTreeRaw,
1391
1404
  tap,
1392
1405
  tapWithScreenSize,
1393
1406
  tapElement,
@@ -1438,6 +1451,10 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1438
1451
  return sendRequest<ElementTree>('elementTree', { point });
1439
1452
  };
1440
1453
 
1454
+ const elementTreeRaw = (point?: AccessibilityPoint): Promise<string> => {
1455
+ return sendRequest<string>('elementTree', { point }, (msg) => msg.json ?? '');
1456
+ };
1457
+
1441
1458
  const tap = (x: number, y: number): Promise<void> => {
1442
1459
  return sendRequest<void>('tap', {
1443
1460
  x,
@@ -1561,7 +1578,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1561
1578
  // rather than sticking to sendRequest's 30s default.
1562
1579
  const waitMs = actions.reduce((acc, a) => acc + (a.type === 'wait' ? Math.max(0, a.durationMs) : 0), 0);
1563
1580
  const timeoutMs = options?.timeoutMs ?? 30_000 + waitMs + actions.length * 2_000;
1564
- return sendRequest<PerformActionsResult>('performActions', { actions }, timeoutMs);
1581
+ return sendRequest<PerformActionsResult>('performActions', { actions }, undefined, timeoutMs);
1565
1582
  };
1566
1583
 
1567
1584
  const startRecording = async (opts?: { quality?: RecordingQuality }): Promise<void> => {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.25.2'; // x-release-please-version
1
+ export const VERSION = '0.26.1'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.25.2";
1
+ export declare const VERSION = "0.26.1";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.25.2";
1
+ export declare const VERSION = "0.26.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.25.2'; // x-release-please-version
4
+ exports.VERSION = '0.26.1'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.25.2'; // x-release-please-version
1
+ export const VERSION = '0.26.1'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map