@limrun/api 0.63.0 → 0.64.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/src/ios-client.ts CHANGED
@@ -17,6 +17,7 @@ import { prepareAppBundlePath, watchAppArchive } from './app-archive';
17
17
  import { downloadFileToLocalPath } from './internal/download-file';
18
18
  import { sleep } from './internal/utils/sleep';
19
19
  import { nodeProxyTransport } from './internal/proxy-transport';
20
+ import { postTrustedCaCertificate } from './internal/trusted-ca';
20
21
  import {
21
22
  getDestinationTunnelStatus,
22
23
  stopDestinationTunnel,
@@ -78,6 +79,12 @@ export type Tunnel = DestinationTcpTunnel;
78
79
  export type TunnelOptions = DestinationTunnelStartOptions;
79
80
  export type TunnelStatus = DestinationTunnelStatus;
80
81
 
82
+ /** A CA certificate the simulator now trusts. */
83
+ export type TrustedCaCertificate = {
84
+ /** SHA-256 of the certificate's DER encoding, in hex. */
85
+ sha256: string;
86
+ };
87
+
81
88
  /**
82
89
  * Events emitted by a simctl execution
83
90
  */
@@ -183,12 +190,19 @@ export function parseElementTreeResultMessage(
183
190
  // Result Types
184
191
  // ============================================================================
185
192
 
193
+ export type ScreenshotOptions = {
194
+ /** Image encoding. Defaults to jpeg. PNG screenshots have no alpha channel. */
195
+ format?: 'jpeg' | 'png';
196
+ /** scaled uses tap-point dimensions; full preserves native pixels. Defaults to scaled. */
197
+ size?: 'scaled' | 'full';
198
+ };
199
+
186
200
  export type ScreenshotData = {
187
- /** Base64-encoded JPEG image data */
201
+ /** Base64-encoded image data in the requested format. */
188
202
  base64: string;
189
- /** Width in points (for tap coordinates) */
203
+ /** Width in points for scaled screenshots, or native pixels for full screenshots. */
190
204
  width: number;
191
- /** Height in points (for tap coordinates) */
205
+ /** Height in points for scaled screenshots, or native pixels for full screenshots. */
192
206
  height: number;
193
207
  };
194
208
 
@@ -654,7 +668,7 @@ export type InstanceClient = {
654
668
  * Take a screenshot of the active screen
655
669
  * @returns A promise that resolves to the screenshot data with base64 image and dimensions
656
670
  */
657
- screenshot: () => Promise<ScreenshotData>;
671
+ screenshot: (options?: ScreenshotOptions) => Promise<ScreenshotData>;
658
672
 
659
673
  /**
660
674
  * Get the element tree (accessibility hierarchy) of the current screen
@@ -840,7 +854,7 @@ export type InstanceClient = {
840
854
  /** Returns null for a simulator without a hinge. */
841
855
  getFoldState: () => Promise<FoldState | null>;
842
856
  /** Capture an upright Duo display. A powered-off display returns its native black image. */
843
- screenshotDisplay: (display: 'outer' | 'inner') => Promise<ScreenshotData>;
857
+ screenshotDisplay: (display: 'outer' | 'inner', options?: ScreenshotOptions) => Promise<ScreenshotData>;
844
858
  /** Tap in point coordinates returned by screenshotDisplay. */
845
859
  tapDisplay: (display: 'outer' | 'inner', x: number, y: number) => Promise<void>;
846
860
  setDuoOrientation: (orientation: DuoOrientation) => Promise<FoldState>;
@@ -1020,6 +1034,14 @@ export type InstanceClient = {
1020
1034
  */
1021
1035
  setStoreKitConfig: (bundleId: string, storekit: Buffer | Uint8Array) => Promise<void>;
1022
1036
 
1037
+ /**
1038
+ * Trust a PEM-encoded CA certificate on the simulator, for example the CA of
1039
+ * an intercepting proxy you record traffic with. Safari and apps trust it on
1040
+ * their next connection. It lasts for the life of the instance, and adding a
1041
+ * certificate the simulator already trusts changes nothing.
1042
+ */
1043
+ addCaCertificate: (pem: string) => Promise<TrustedCaCertificate>;
1044
+
1023
1045
  /**
1024
1046
  * Clear the registered StoreKit configuration for `bundleId` and
1025
1047
  * remove the app's Octane file so subsequent StoreKit requests fall
@@ -2171,6 +2193,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2171
2193
  keepAlive,
2172
2194
  syncApp,
2173
2195
  setStoreKitConfig,
2196
+ addCaCertificate,
2174
2197
  clearStoreKitConfig,
2175
2198
  discoverStoreKitConfig,
2176
2199
  softReset,
@@ -2204,8 +2227,8 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2204
2227
  // Client Methods - using centralized sendRequest
2205
2228
  // ========================================================================
2206
2229
 
2207
- const screenshot = (): Promise<ScreenshotData> => {
2208
- return sendRequest<ScreenshotData>('screenshot');
2230
+ const screenshot = (options: ScreenshotOptions = {}): Promise<ScreenshotData> => {
2231
+ return sendRequest<ScreenshotData>('screenshot', options);
2209
2232
  };
2210
2233
 
2211
2234
  const elementTree = (point?: AccessibilityPoint): Promise<ElementTree> => {
@@ -2518,8 +2541,10 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2518
2541
  return Promise.reject(new RangeError('Invalid iPhone Duo orientation'));
2519
2542
  return sendRequest('setDuoOrientation', { orientation });
2520
2543
  };
2521
- const screenshotDisplay = (display: 'outer' | 'inner'): Promise<ScreenshotData> =>
2522
- sendRequest('screenshotDisplay', { display });
2544
+ const screenshotDisplay = (
2545
+ display: 'outer' | 'inner',
2546
+ options?: ScreenshotOptions,
2547
+ ): Promise<ScreenshotData> => sendRequest('screenshotDisplay', { display, ...options });
2523
2548
  const tapDisplay = (display: 'outer' | 'inner', x: number, y: number): Promise<void> =>
2524
2549
  sendRequest('tapDisplay', { display, x, y });
2525
2550
  const getFoldState = (): Promise<FoldState | null> => sendRequest('getFoldState');
@@ -2970,6 +2995,9 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
2970
2995
  }
2971
2996
  };
2972
2997
 
2998
+ const addCaCertificate = (pem: string): Promise<TrustedCaCertificate> =>
2999
+ postTrustedCaCertificate(`${options.apiUrl}/trusted-cas`, options.token, pem);
3000
+
2973
3001
  const clearStoreKitConfig = async (bundleId: string): Promise<void> => {
2974
3002
  const url = `${options.apiUrl}/payments/storeKitConfigs/${encodeURIComponent(bundleId)}`;
2975
3003
  const response = await nodeProxyTransport.fetch(url, {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.63.0'; // x-release-please-version
1
+ export const VERSION = '0.64.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.63.0";
1
+ export declare const VERSION = "0.64.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.63.0";
1
+ export declare const VERSION = "0.64.0";
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.63.0'; // x-release-please-version
4
+ exports.VERSION = '0.64.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.63.0'; // x-release-please-version
1
+ export const VERSION = '0.64.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map