@limrun/api 0.68.0 → 0.69.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 (105) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +2 -1
  3. package/client.d.mts +10 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +10 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +2 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +2 -0
  10. package/client.mjs.map +1 -1
  11. package/exec-client.d.mts +7 -0
  12. package/exec-client.d.mts.map +1 -1
  13. package/exec-client.d.ts +7 -0
  14. package/exec-client.d.ts.map +1 -1
  15. package/exec-client.js.map +1 -1
  16. package/exec-client.mjs.map +1 -1
  17. package/index.d.mts +1 -0
  18. package/index.d.mts.map +1 -1
  19. package/index.d.ts +1 -0
  20. package/index.d.ts.map +1 -1
  21. package/index.js +5 -2
  22. package/index.js.map +1 -1
  23. package/index.mjs +1 -0
  24. package/index.mjs.map +1 -1
  25. package/ios-client.d.mts +2 -4
  26. package/ios-client.d.mts.map +1 -1
  27. package/ios-client.d.ts +2 -4
  28. package/ios-client.d.ts.map +1 -1
  29. package/ios-client.js +7 -3
  30. package/ios-client.js.map +1 -1
  31. package/ios-client.mjs +7 -3
  32. package/ios-client.mjs.map +1 -1
  33. package/package.json +1 -1
  34. package/resources/android-instances.d.mts +23 -1
  35. package/resources/android-instances.d.mts.map +1 -1
  36. package/resources/android-instances.d.ts +23 -1
  37. package/resources/android-instances.d.ts.map +1 -1
  38. package/resources/android-instances.js +9 -0
  39. package/resources/android-instances.js.map +1 -1
  40. package/resources/android-instances.mjs +9 -0
  41. package/resources/android-instances.mjs.map +1 -1
  42. package/resources/gradle-instances.d.mts +23 -1
  43. package/resources/gradle-instances.d.mts.map +1 -1
  44. package/resources/gradle-instances.d.ts +23 -1
  45. package/resources/gradle-instances.d.ts.map +1 -1
  46. package/resources/gradle-instances.js +9 -0
  47. package/resources/gradle-instances.js.map +1 -1
  48. package/resources/gradle-instances.mjs +9 -0
  49. package/resources/gradle-instances.mjs.map +1 -1
  50. package/resources/index.d.mts +5 -4
  51. package/resources/index.d.mts.map +1 -1
  52. package/resources/index.d.ts +5 -4
  53. package/resources/index.d.ts.map +1 -1
  54. package/resources/index.js +4 -1
  55. package/resources/index.js.map +1 -1
  56. package/resources/index.mjs +1 -0
  57. package/resources/index.mjs.map +1 -1
  58. package/resources/ios-instances.d.mts +23 -6
  59. package/resources/ios-instances.d.mts.map +1 -1
  60. package/resources/ios-instances.d.ts +23 -6
  61. package/resources/ios-instances.d.ts.map +1 -1
  62. package/resources/ios-instances.js +9 -0
  63. package/resources/ios-instances.js.map +1 -1
  64. package/resources/ios-instances.mjs +9 -0
  65. package/resources/ios-instances.mjs.map +1 -1
  66. package/resources/snapshots.d.mts +51 -0
  67. package/resources/snapshots.d.mts.map +1 -0
  68. package/resources/snapshots.d.ts +51 -0
  69. package/resources/snapshots.d.ts.map +1 -0
  70. package/resources/snapshots.js +41 -0
  71. package/resources/snapshots.js.map +1 -0
  72. package/resources/snapshots.mjs +36 -0
  73. package/resources/snapshots.mjs.map +1 -0
  74. package/resources/xcode-instances-helpers.d.mts +4 -2
  75. package/resources/xcode-instances-helpers.d.mts.map +1 -1
  76. package/resources/xcode-instances-helpers.d.ts +4 -2
  77. package/resources/xcode-instances-helpers.d.ts.map +1 -1
  78. package/resources/xcode-instances-helpers.js +9 -2
  79. package/resources/xcode-instances-helpers.js.map +1 -1
  80. package/resources/xcode-instances-helpers.mjs +9 -2
  81. package/resources/xcode-instances-helpers.mjs.map +1 -1
  82. package/resources/xcode-instances.d.mts +23 -1
  83. package/resources/xcode-instances.d.mts.map +1 -1
  84. package/resources/xcode-instances.d.ts +23 -1
  85. package/resources/xcode-instances.d.ts.map +1 -1
  86. package/resources/xcode-instances.js +9 -0
  87. package/resources/xcode-instances.js.map +1 -1
  88. package/resources/xcode-instances.mjs +9 -0
  89. package/resources/xcode-instances.mjs.map +1 -1
  90. package/src/client.ts +10 -0
  91. package/src/exec-client.ts +7 -0
  92. package/src/index.ts +8 -0
  93. package/src/ios-client.ts +13 -17
  94. package/src/resources/android-instances.ts +27 -0
  95. package/src/resources/gradle-instances.ts +27 -0
  96. package/src/resources/index.ts +13 -0
  97. package/src/resources/ios-instances.ts +27 -6
  98. package/src/resources/snapshots.ts +88 -0
  99. package/src/resources/xcode-instances-helpers.ts +15 -7
  100. package/src/resources/xcode-instances.ts +27 -0
  101. package/src/version.ts +1 -1
  102. package/version.d.mts +1 -1
  103. package/version.d.ts +1 -1
  104. package/version.js +1 -1
  105. package/version.mjs +1 -1
@@ -0,0 +1,88 @@
1
+ import { APIResource } from '../core/resource';
2
+ import { APIPromise } from '../core/api-promise';
3
+ import { buildHeaders } from '../internal/headers';
4
+ import { RequestOptions } from '../internal/request-options';
5
+ import { path } from '../internal/utils/path';
6
+
7
+ export interface SnapshotListParams {
8
+ /** Literal key prefix. Omit to list all keys. */
9
+ prefix?: string;
10
+ /** Page size: 1–500 for Xcode, 1–100 for iOS. */
11
+ limit?: number;
12
+ offset?: number;
13
+ }
14
+
15
+ export interface SnapshotList<Snapshot> {
16
+ snapshots: Snapshot[];
17
+ /** Pass as offset to read the next page. Absent on the last page. */
18
+ nextOffset?: number;
19
+ }
20
+
21
+ export interface XcodeSnapshot {
22
+ key: string;
23
+ directoryKey: string;
24
+ rootName: string;
25
+ paths?: string[];
26
+ xcodeVersionKey: string;
27
+ archiveFormat: string;
28
+ archiveSizeBytes: number;
29
+ sha256: string;
30
+ publishedAt: string;
31
+ sourceInstanceId?: string;
32
+ }
33
+
34
+ export interface IOSSnapshot {
35
+ key: string;
36
+ saved: boolean;
37
+ createdAt: string;
38
+ lastUsedAt: string;
39
+ archiveSizeBytes?: number;
40
+ publishedAt?: string;
41
+ iosVersion?: string;
42
+ }
43
+
44
+ export class XcodeSnapshots extends APIResource {
45
+ /** List saved workspaces, newest publication first. */
46
+ list(
47
+ organizationId: string,
48
+ query: SnapshotListParams = {},
49
+ options?: RequestOptions,
50
+ ): APIPromise<SnapshotList<XcodeSnapshot>> {
51
+ return this._client.get(path`/v1/organizations/${organizationId}/xcode_snapshots`, { query, ...options });
52
+ }
53
+
54
+ get(organizationId: string, key: string, options?: RequestOptions): APIPromise<XcodeSnapshot> {
55
+ return this._client.get(path`/v1/organizations/${organizationId}/xcode_snapshots/${key}`, options);
56
+ }
57
+
58
+ /** Delete the archive and index entry. Running instances can publish this key again. */
59
+ delete(organizationId: string, key: string, options?: RequestOptions): APIPromise<void> {
60
+ return this._client.delete(path`/v1/organizations/${organizationId}/xcode_snapshots/${key}`, {
61
+ ...options,
62
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
63
+ });
64
+ }
65
+ }
66
+
67
+ export class IOSSnapshots extends APIResource {
68
+ /** List simulator snapshot keys alphabetically, including keys not saved yet. */
69
+ list(
70
+ organizationId: string,
71
+ query: SnapshotListParams = {},
72
+ options?: RequestOptions,
73
+ ): APIPromise<SnapshotList<IOSSnapshot>> {
74
+ return this._client.get(path`/v1/organizations/${organizationId}/ios_snapshots`, { query, ...options });
75
+ }
76
+
77
+ get(organizationId: string, key: string, options?: RequestOptions): APIPromise<IOSSnapshot> {
78
+ return this._client.get(path`/v1/organizations/${organizationId}/ios_snapshots/${key}`, options);
79
+ }
80
+
81
+ /** Delete saved apps, data and the index entry. Running simulators can save this key again. */
82
+ delete(organizationId: string, key: string, options?: RequestOptions): APIPromise<void> {
83
+ return this._client.delete(path`/v1/organizations/${organizationId}/ios_snapshots/${key}`, {
84
+ ...options,
85
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
86
+ });
87
+ }
88
+ }
@@ -5,7 +5,7 @@ import {
5
5
  type XcodeInstance,
6
6
  type XcodeInstanceCreateParams,
7
7
  } from './xcode-instances';
8
- import { type IosInstance } from './ios-instances';
8
+ import { type IosInstance, type IosInstanceCreateParams } from './ios-instances';
9
9
  import { APIPromise } from '../core/api-promise';
10
10
  import { RequestOptions } from '../internal/request-options';
11
11
  import { path } from '../internal/utils/path';
@@ -596,8 +596,12 @@ export type XcodeClient = {
596
596
  * Create a new iOS simulator instance and attach it to this xcode instance.
597
597
  * Deletes the simulator if attach fails so it is never leaked. Returns the new
598
598
  * simulator's instance id (record it for teardown) and the instance itself.
599
+ * `device` selects the simulator, for example `{ model: 'ipad' }` or an
600
+ * OSVersion clue. The simulator always gets no delegated permissions.
599
601
  */
600
- attachNewSimulator: () => Promise<{ iosInstanceId: string; simulator: IosInstance }>;
602
+ attachNewSimulator: (
603
+ device?: Pick<IosInstanceCreateParams.Spec, 'model' | 'clues'>,
604
+ ) => Promise<{ iosInstanceId: string; simulator: IosInstance }>;
601
605
 
602
606
  /** Best-effort delete of a simulator instance. Never throws; returns success. */
603
607
  deleteSimulator: (iosInstanceId: string) => Promise<boolean>;
@@ -917,11 +921,15 @@ export class XcodeInstances extends GeneratedXcodeInstances {
917
921
  }
918
922
  };
919
923
 
920
- const attachNewSimulatorImpl = async (): Promise<{
921
- iosInstanceId: string;
922
- simulator: IosInstance;
923
- }> => {
924
- const simulator = await client.iosInstances.create({ wait: true, spec: { role: { permissions: [] } } });
924
+ const attachNewSimulatorImpl: XcodeClient['attachNewSimulator'] = async (device) => {
925
+ const simulator = await client.iosInstances.create({
926
+ wait: true,
927
+ spec: {
928
+ ...(device?.model && { model: device.model }),
929
+ ...(device?.clues && { clues: device.clues }),
930
+ role: { permissions: [] },
931
+ },
932
+ });
925
933
  // The sim exists from here; if attach fails, delete it so we never leak an
926
934
  // orphan the caller can't reap.
927
935
  try {
@@ -36,6 +36,16 @@ export class XcodeInstances extends APIResource {
36
36
  });
37
37
  }
38
38
 
39
+ /** Update a live instance's labels or role using the ETag returned by get().withResponse(). */
40
+ update(id: string, params: XcodeInstanceUpdateParams, options?: RequestOptions): APIPromise<void> {
41
+ const { ifMatch, ...body } = params;
42
+ return this._client.patch(path`/v1/xcode_instances/${id}`, {
43
+ ...options,
44
+ body,
45
+ headers: buildHeaders([options?.headers, { 'If-Match': ifMatch, Accept: '*/*' }]),
46
+ });
47
+ }
48
+
39
49
  /**
40
50
  * Get Xcode instance with given ID
41
51
  */
@@ -70,6 +80,9 @@ export namespace XcodeInstance {
70
80
  }
71
81
 
72
82
  export interface Spec {
83
+ /** Current effective permissions. Present on live GETs; historical records may omit it. */
84
+ role?: { permissions: string[] };
85
+
73
86
  inactivityTimeout: string;
74
87
 
75
88
  region: string;
@@ -107,6 +120,19 @@ export namespace XcodeInstance {
107
120
  }
108
121
  }
109
122
 
123
+ export interface XcodeInstanceUpdateParams {
124
+ /** Quoted ETag from a live GET. A concurrent change returns HTTP 412. */
125
+ ifMatch: string;
126
+ /** Replaces all customer labels. Use {} to clear them. Omission preserves labels. */
127
+ metadata?: { labels: { [key: string]: string } };
128
+ spec?: {
129
+ role: {
130
+ /** Replaces the complete list. Use [] to remove delegated permissions. */
131
+ permissions: string[];
132
+ };
133
+ };
134
+ }
135
+
110
136
  export interface XcodeInstanceCreateParams {
111
137
  /**
112
138
  * Query param: If there is another instance with given labels and region, return
@@ -245,6 +271,7 @@ export declare namespace XcodeInstances {
245
271
  export {
246
272
  type XcodeInstance as XcodeInstance,
247
273
  type XcodeInstancesItems as XcodeInstancesItems,
274
+ type XcodeInstanceUpdateParams as XcodeInstanceUpdateParams,
248
275
  type XcodeInstanceCreateParams as XcodeInstanceCreateParams,
249
276
  type XcodeInstanceListParams as XcodeInstanceListParams,
250
277
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.68.0'; // x-release-please-version
1
+ export const VERSION = '0.69.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.68.0";
1
+ export declare const VERSION = "0.69.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.68.0";
1
+ export declare const VERSION = "0.69.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.68.0'; // x-release-please-version
4
+ exports.VERSION = '0.69.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.68.0'; // x-release-please-version
1
+ export const VERSION = '0.69.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map