@limrun/api 0.20.2 → 0.21.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/client.d.mts +1 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +1 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -17
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -17
  9. package/client.mjs.map +1 -1
  10. package/folder-sync.d.mts +1 -1
  11. package/folder-sync.d.mts.map +1 -1
  12. package/folder-sync.d.ts +1 -1
  13. package/folder-sync.d.ts.map +1 -1
  14. package/instance-client.d.mts +109 -0
  15. package/instance-client.d.mts.map +1 -1
  16. package/instance-client.d.ts +109 -0
  17. package/instance-client.d.ts.map +1 -1
  18. package/instance-client.js +262 -69
  19. package/instance-client.js.map +1 -1
  20. package/instance-client.mjs +262 -69
  21. package/instance-client.mjs.map +1 -1
  22. package/internal/utils/query.d.mts +5 -0
  23. package/internal/utils/query.d.mts.map +1 -0
  24. package/internal/utils/query.d.ts +5 -0
  25. package/internal/utils/query.d.ts.map +1 -0
  26. package/internal/utils/query.js +23 -0
  27. package/internal/utils/query.js.map +1 -0
  28. package/internal/utils/query.mjs +20 -0
  29. package/internal/utils/query.mjs.map +1 -0
  30. package/internal/utils.d.mts +1 -0
  31. package/internal/utils.d.ts +1 -0
  32. package/internal/utils.js +1 -0
  33. package/internal/utils.js.map +1 -1
  34. package/internal/utils.mjs +1 -0
  35. package/ios-client.d.mts +12 -4
  36. package/ios-client.d.mts.map +1 -1
  37. package/ios-client.d.ts +12 -4
  38. package/ios-client.d.ts.map +1 -1
  39. package/ios-client.js +7 -2
  40. package/ios-client.js.map +1 -1
  41. package/ios-client.mjs +7 -2
  42. package/ios-client.mjs.map +1 -1
  43. package/package.json +12 -1
  44. package/resources/android-instances.d.mts +1 -0
  45. package/resources/android-instances.d.mts.map +1 -1
  46. package/resources/android-instances.d.ts +1 -0
  47. package/resources/android-instances.d.ts.map +1 -1
  48. package/resources/ios-instances.d.mts +1 -1
  49. package/resources/ios-instances.d.mts.map +1 -1
  50. package/resources/ios-instances.d.ts +1 -1
  51. package/resources/ios-instances.d.ts.map +1 -1
  52. package/src/client.ts +18 -21
  53. package/src/folder-sync.ts +2 -2
  54. package/src/instance-client.ts +516 -96
  55. package/src/internal/utils/query.ts +23 -0
  56. package/src/internal/utils.ts +1 -0
  57. package/src/ios-client.ts +25 -7
  58. package/src/resources/android-instances.ts +2 -0
  59. package/src/resources/ios-instances.ts +1 -1
  60. package/src/version.ts +1 -1
  61. package/version.d.mts +1 -1
  62. package/version.d.ts +1 -1
  63. package/version.js +1 -1
  64. package/version.mjs +1 -1
@@ -0,0 +1,23 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { LimrunError } from '../../core/error';
4
+
5
+ /**
6
+ * Basic re-implementation of `qs.stringify` for primitive types.
7
+ */
8
+ export function stringifyQuery(query: object | Record<string, unknown>) {
9
+ return Object.entries(query)
10
+ .filter(([_, value]) => typeof value !== 'undefined')
11
+ .map(([key, value]) => {
12
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
13
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
14
+ }
15
+ if (value === null) {
16
+ return `${encodeURIComponent(key)}=`;
17
+ }
18
+ throw new LimrunError(
19
+ `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
20
+ );
21
+ })
22
+ .join('&');
23
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';
package/src/ios-client.ts CHANGED
@@ -129,10 +129,9 @@ export type AppInstallationOptions = {
129
129
  * Launch mode after installation:
130
130
  * - 'ForegroundIfRunning': Bring to foreground if already running, otherwise launch
131
131
  * - 'RelaunchIfRunning': Kill and relaunch if already running
132
- * - 'FailIfRunning': Fail if the app is already running
133
132
  * - undefined: Don't launch after installation
134
133
  */
135
- launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning' | 'FailIfRunning';
134
+ launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning';
136
135
  };
137
136
 
138
137
  /**
@@ -222,8 +221,18 @@ export type InstanceClient = {
222
221
  /**
223
222
  * Launch an installed app by bundle identifier
224
223
  * @param bundleId Bundle identifier of the app to launch
224
+ * @param mode Optional launch mode:
225
+ * - 'ForegroundIfRunning' (default): bring to foreground if already running
226
+ * - 'RelaunchIfRunning': terminate and relaunch if already running
225
227
  */
226
- launchApp: (bundleId: string) => Promise<void>;
228
+ launchApp: (bundleId: string, mode?: 'ForegroundIfRunning' | 'RelaunchIfRunning') => Promise<void>;
229
+
230
+ /**
231
+ * Terminate a running app by bundle identifier.
232
+ * Succeeds silently if the app is not currently running.
233
+ * @param bundleId Bundle identifier of the app to terminate
234
+ */
235
+ terminateApp: (bundleId: string) => Promise<void>;
227
236
 
228
237
  /**
229
238
  * Fetch the last N lines of app logs (combined stdout/stderr)
@@ -294,7 +303,7 @@ export type InstanceClient = {
294
303
  opts?: {
295
304
  install?: boolean;
296
305
  maxPatchBytes?: number;
297
- launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning' | 'FailIfRunning';
306
+ launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning';
298
307
  watch?: boolean;
299
308
  },
300
309
  ) => Promise<SyncFolderResult>;
@@ -1004,6 +1013,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1004
1013
  pressKeyResult: () => undefined,
1005
1014
  toggleKeyboardResult: () => undefined,
1006
1015
  launchAppResult: () => undefined,
1016
+ terminateAppResult: () => undefined,
1007
1017
  appLogTailResult: (msg) => msg.logs ?? '',
1008
1018
  listAppsResult: (msg) => JSON.parse(msg.apps || '[]') as InstalledApp[],
1009
1019
  listOpenFilesResult: (msg) => msg.files || [],
@@ -1181,6 +1191,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1181
1191
  pressKey,
1182
1192
  toggleKeyboard,
1183
1193
  launchApp,
1194
+ terminateApp,
1184
1195
  appLogTail,
1185
1196
  streamAppLog,
1186
1197
  streamSyslog,
@@ -1270,8 +1281,15 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1270
1281
  return sendRequest<void>('toggleKeyboard');
1271
1282
  };
1272
1283
 
1273
- const launchApp = (bundleId: string): Promise<void> => {
1274
- return sendRequest<void>('launchApp', { bundleId });
1284
+ const launchApp = (
1285
+ bundleId: string,
1286
+ mode?: 'ForegroundIfRunning' | 'RelaunchIfRunning',
1287
+ ): Promise<void> => {
1288
+ return sendRequest<void>('launchApp', { bundleId, mode });
1289
+ };
1290
+
1291
+ const terminateApp = (bundleId: string): Promise<void> => {
1292
+ return sendRequest<void>('terminateApp', { bundleId });
1275
1293
  };
1276
1294
 
1277
1295
  const appLogTail = (bundleId: string, lines: number): Promise<string> => {
@@ -1328,7 +1346,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
1328
1346
  opts?: {
1329
1347
  install?: boolean;
1330
1348
  maxPatchBytes?: number;
1331
- launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning' | 'FailIfRunning';
1349
+ launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning';
1332
1350
  watch?: boolean;
1333
1351
  },
1334
1352
  ): Promise<SyncFolderResult> => {
@@ -101,6 +101,8 @@ export namespace AndroidInstance {
101
101
 
102
102
  errorMessage?: string;
103
103
 
104
+ mcpUrl?: string;
105
+
104
106
  sandbox?: Status.Sandbox;
105
107
 
106
108
  targetHttpPortUrlPrefix?: string;
@@ -198,7 +198,7 @@ export namespace IosInstanceCreateParams {
198
198
  * Launch mode specifies how to launch the app after installation. If not given,
199
199
  * the app won't be launched.
200
200
  */
201
- launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning' | 'FailIfRunning';
201
+ launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning';
202
202
 
203
203
  url?: string;
204
204
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.20.2'; // x-release-please-version
1
+ export const VERSION = '0.21.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.20.2";
1
+ export declare const VERSION = "0.21.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.20.2";
1
+ export declare const VERSION = "0.21.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.20.2'; // x-release-please-version
4
+ exports.VERSION = '0.21.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.20.2'; // x-release-please-version
1
+ export const VERSION = '0.21.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map