@limrun/api 0.80.0 → 0.81.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/CHANGELOG.md +36 -0
- package/README.md +29 -0
- package/gradle-snapshot.d.mts +34 -0
- package/gradle-snapshot.d.mts.map +1 -1
- package/gradle-snapshot.d.ts +34 -0
- package/gradle-snapshot.d.ts.map +1 -1
- package/gradle-snapshot.js +14 -1
- package/gradle-snapshot.js.map +1 -1
- package/gradle-snapshot.mjs +12 -0
- package/gradle-snapshot.mjs.map +1 -1
- package/index.d.mts +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/instance-client.d.mts +36 -1
- package/instance-client.d.mts.map +1 -1
- package/instance-client.d.ts +36 -1
- package/instance-client.d.ts.map +1 -1
- package/instance-client.js +17 -0
- package/instance-client.js.map +1 -1
- package/instance-client.mjs +16 -0
- package/instance-client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/assets.d.mts +6 -0
- package/resources/assets.d.mts.map +1 -1
- package/resources/assets.d.ts +6 -0
- package/resources/assets.d.ts.map +1 -1
- package/resources/gradle-instances-helpers.d.mts +10 -0
- package/resources/gradle-instances-helpers.d.mts.map +1 -1
- package/resources/gradle-instances-helpers.d.ts +10 -0
- package/resources/gradle-instances-helpers.d.ts.map +1 -1
- package/resources/gradle-instances-helpers.js +56 -0
- package/resources/gradle-instances-helpers.js.map +1 -1
- package/resources/gradle-instances-helpers.mjs +56 -0
- package/resources/gradle-instances-helpers.mjs.map +1 -1
- package/resources/ios-instances.d.mts +62 -0
- package/resources/ios-instances.d.mts.map +1 -1
- package/resources/ios-instances.d.ts +62 -0
- package/resources/ios-instances.d.ts.map +1 -1
- package/resources/macos-instances-helpers.d.mts +29 -0
- package/resources/macos-instances-helpers.d.mts.map +1 -1
- package/resources/macos-instances-helpers.d.ts +29 -0
- package/resources/macos-instances-helpers.d.ts.map +1 -1
- package/resources/macos-instances-helpers.js +16 -0
- package/resources/macos-instances-helpers.js.map +1 -1
- package/resources/macos-instances-helpers.mjs +16 -0
- package/resources/macos-instances-helpers.mjs.map +1 -1
- package/resources/session-artifacts.d.mts +7 -4
- package/resources/session-artifacts.d.mts.map +1 -1
- package/resources/session-artifacts.d.ts +7 -4
- package/resources/session-artifacts.d.ts.map +1 -1
- package/src/gradle-snapshot.ts +40 -0
- package/src/index.ts +3 -0
- package/src/instance-client.ts +49 -1
- package/src/resources/assets.ts +7 -0
- package/src/resources/gradle-instances-helpers.ts +84 -0
- package/src/resources/ios-instances.ts +75 -0
- package/src/resources/macos-instances-helpers.ts +60 -0
- package/src/resources/session-artifacts.ts +7 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -148,6 +148,12 @@ export namespace IosInstance {
|
|
|
148
148
|
|
|
149
149
|
targetHttpPortUrlPrefix?: string;
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* How the restore of `spec.deviceState` went. Present only on the create
|
|
153
|
+
* response; get and list do not carry it.
|
|
154
|
+
*/
|
|
155
|
+
deviceState?: Status.DeviceState;
|
|
156
|
+
|
|
151
157
|
/**
|
|
152
158
|
* Machine-readable reason for instance termination. Present when state is
|
|
153
159
|
* "terminating" or "terminated". New values may be added over time, so treat any
|
|
@@ -164,6 +170,51 @@ export namespace IosInstance {
|
|
|
164
170
|
*/
|
|
165
171
|
terminationReason?: string;
|
|
166
172
|
}
|
|
173
|
+
|
|
174
|
+
export namespace Status {
|
|
175
|
+
export interface DeviceState {
|
|
176
|
+
restore: DeviceState.Restore;
|
|
177
|
+
save: DeviceState.Save;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export namespace DeviceState {
|
|
181
|
+
export interface Restore {
|
|
182
|
+
/**
|
|
183
|
+
* `restored` applied the saved state. `empty` found nothing under the key, so the
|
|
184
|
+
* simulator starts clean and the save creates the snapshot. `failed` leaves the
|
|
185
|
+
* instance ready with saving disabled, because the restore may have left partial
|
|
186
|
+
* state. `pending` has not finished; in client mode it stays pending until the
|
|
187
|
+
* caller reports the restore done.
|
|
188
|
+
*/
|
|
189
|
+
phase: 'pending' | 'restored' | 'empty' | 'failed';
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Client restore mode only: pass it to the simulator's `importDeviceState`
|
|
193
|
+
* command. An empty string means nothing is saved. It is a presigned URL, so
|
|
194
|
+
* do not log it.
|
|
195
|
+
*/
|
|
196
|
+
downloadUrl?: string;
|
|
197
|
+
|
|
198
|
+
reason?: string;
|
|
199
|
+
|
|
200
|
+
message?: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface Save {
|
|
204
|
+
/**
|
|
205
|
+
* `idle` saves when the instance is deleted. `disabled` means no key is set or the
|
|
206
|
+
* restore did not succeed. The other phases appear while the instance is deleted.
|
|
207
|
+
*/
|
|
208
|
+
phase: 'disabled' | 'idle' | 'requested' | 'saved' | 'skipped' | 'failed' | 'timed_out';
|
|
209
|
+
|
|
210
|
+
reason?: string;
|
|
211
|
+
|
|
212
|
+
message?: string;
|
|
213
|
+
|
|
214
|
+
sizeBytes?: number;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
167
218
|
}
|
|
168
219
|
|
|
169
220
|
export interface IosInstanceUpdateParams {
|
|
@@ -226,6 +277,14 @@ export namespace IosInstanceCreateParams {
|
|
|
226
277
|
*/
|
|
227
278
|
clues?: Array<Spec.Clue>;
|
|
228
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Restores the simulator snapshot saved under this key and saves back to it when
|
|
282
|
+
* the instance is deleted. A snapshot holds installed user apps, their data, app
|
|
283
|
+
* group containers, the keychain and supported privacy permissions. Keys are shared
|
|
284
|
+
* by the whole organization and the last save wins.
|
|
285
|
+
*/
|
|
286
|
+
deviceState?: Spec.DeviceState;
|
|
287
|
+
|
|
229
288
|
/**
|
|
230
289
|
* Keeps this app in the foreground after it is first observed there. This does not
|
|
231
290
|
* launch the app when the simulator starts. Once armed, closing or backgrounding
|
|
@@ -321,6 +380,22 @@ export namespace IosInstanceCreateParams {
|
|
|
321
380
|
}
|
|
322
381
|
|
|
323
382
|
export namespace Spec {
|
|
383
|
+
export interface DeviceState {
|
|
384
|
+
/**
|
|
385
|
+
* Snapshot key, up to 128 characters: a letter or digit, followed by letters,
|
|
386
|
+
* digits or `._-@:+`. A new key starts clean and the first save creates it.
|
|
387
|
+
*/
|
|
388
|
+
key: string;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* `server` (the default) restores before the instance becomes ready. `client`
|
|
392
|
+
* returns `status.deviceState.restore.downloadUrl` and leaves the restore to the
|
|
393
|
+
* caller, who must then call `POST /v1/ios_instances/{id}/device_state/ready`
|
|
394
|
+
* before the instance can save.
|
|
395
|
+
*/
|
|
396
|
+
restoreMode?: 'server' | 'client';
|
|
397
|
+
}
|
|
398
|
+
|
|
324
399
|
export interface Clue {
|
|
325
400
|
kind: 'ClientIP' | 'ClientLocation' | 'OSVersion';
|
|
326
401
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LogStream } from '../log-stream';
|
|
2
|
+
import { assetSourceFields, type AssetSource } from '../internal/asset-source';
|
|
2
3
|
import {
|
|
3
4
|
openSignalingTransport,
|
|
4
5
|
type ConnectionState,
|
|
@@ -104,6 +105,28 @@ export interface MacosLaunchAppOptions {
|
|
|
104
105
|
env?: Record<string, string>;
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
export interface MacosInstallAppOptions {
|
|
109
|
+
/** The archive's MD5. The instance checks the download against it. */
|
|
110
|
+
md5?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Opens the app once installed. Omit it to install the app closed, for example to launch it with
|
|
113
|
+
* {@link MacosClient.launchApp} and its own environment. A copy that runs stops while the new
|
|
114
|
+
* one installs, so either mode starts the new copy.
|
|
115
|
+
*/
|
|
116
|
+
launchMode?: MacosLaunchMode;
|
|
117
|
+
/** Defaults to 10 minutes: the instance downloads the whole archive first. */
|
|
118
|
+
timeoutMs?: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface MacosInstallAppResult {
|
|
122
|
+
/** Bundle ID of the installed app. */
|
|
123
|
+
bundleId: string;
|
|
124
|
+
/** The supplied URL, when installed from one. */
|
|
125
|
+
url?: string;
|
|
126
|
+
/** The supplied asset name, when installed from one. */
|
|
127
|
+
assetName?: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
107
130
|
/** One app of {@link MacosClient.listApps}, in the fields iOS's listApps returns. */
|
|
108
131
|
export interface MacosInstalledApp {
|
|
109
132
|
bundleId: string;
|
|
@@ -362,6 +385,16 @@ export interface MacosClient {
|
|
|
362
385
|
*/
|
|
363
386
|
launchApp(app: string, options?: MacosLaunchAppOptions): Promise<MacosLaunchAppResult>;
|
|
364
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Install a Mac app into the guest user's ~/Applications from a tar.gz or zip of one `.app`
|
|
390
|
+
* bundle, such as the asset `lim xcode build --sdk macosx --upload` publishes. The source is a
|
|
391
|
+
* URL, or `{ assetName }`, which the instance resolves with its role's asset read permission.
|
|
392
|
+
*/
|
|
393
|
+
installApp(source: AssetSource, options?: MacosInstallAppOptions): Promise<MacosInstallAppResult>;
|
|
394
|
+
|
|
395
|
+
/** Install an app by exact asset name using the instance role. */
|
|
396
|
+
installAppByName(assetName: string, options?: MacosInstallAppOptions): Promise<MacosInstallAppResult>;
|
|
397
|
+
|
|
365
398
|
/** Stop every process of an app. Succeeds when the app is not running. */
|
|
366
399
|
terminateApp(bundleId: string): Promise<void>;
|
|
367
400
|
|
|
@@ -522,6 +555,26 @@ class MacosInstancesHelpers extends MacosInstances {
|
|
|
522
555
|
): Promise<T> =>
|
|
523
556
|
transport.request<T>(type, params, transform ?? ((() => undefined) as () => T), timeoutMs);
|
|
524
557
|
|
|
558
|
+
// limulator's appInstallation, which the instance takes for a Mac app.
|
|
559
|
+
const installApp = (
|
|
560
|
+
source: AssetSource,
|
|
561
|
+
options?: MacosInstallAppOptions,
|
|
562
|
+
): Promise<MacosInstallAppResult> =>
|
|
563
|
+
send(
|
|
564
|
+
'appInstallation',
|
|
565
|
+
{
|
|
566
|
+
...assetSourceFields(source),
|
|
567
|
+
...(options?.md5 !== undefined && { md5: options.md5 }),
|
|
568
|
+
...(options?.launchMode !== undefined && { launchMode: options.launchMode }),
|
|
569
|
+
},
|
|
570
|
+
(msg): MacosInstallAppResult => ({
|
|
571
|
+
bundleId: msg['bundleId'],
|
|
572
|
+
...(msg['url'] !== undefined && { url: msg['url'] }),
|
|
573
|
+
...(msg['assetName'] !== undefined && { assetName: msg['assetName'] }),
|
|
574
|
+
}),
|
|
575
|
+
options?.timeoutMs ?? installAppTimeoutMs,
|
|
576
|
+
);
|
|
577
|
+
|
|
525
578
|
const filesUrl = (path: string, extra = '') =>
|
|
526
579
|
`${apiUrl}/files?${new URLSearchParams({ path }).toString()}${extra ? `&${extra}` : ''}`;
|
|
527
580
|
const checked = async (response: Response, what: string) => {
|
|
@@ -725,6 +778,12 @@ class MacosInstancesHelpers extends MacosInstances {
|
|
|
725
778
|
);
|
|
726
779
|
},
|
|
727
780
|
|
|
781
|
+
installApp,
|
|
782
|
+
|
|
783
|
+
installAppByName(assetName, options) {
|
|
784
|
+
return installApp({ assetName }, options);
|
|
785
|
+
},
|
|
786
|
+
|
|
728
787
|
async terminateApp(bundleId) {
|
|
729
788
|
await send('terminateApp', { bundleId });
|
|
730
789
|
},
|
|
@@ -873,6 +932,7 @@ const captureStopTimeoutMs = 300_000;
|
|
|
873
932
|
const recordingStopTimeoutMs = 180_000;
|
|
874
933
|
// A first launch or a relaunch can take longer than the default, as on iOS.
|
|
875
934
|
const launchAppTimeoutMs = 90_000;
|
|
935
|
+
const installAppTimeoutMs = 10 * 60_000;
|
|
876
936
|
|
|
877
937
|
MacosInstances.prototype.createClient = MacosInstancesHelpers.prototype.createClient;
|
|
878
938
|
|
|
@@ -107,10 +107,13 @@ export interface PerformanceThread {
|
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* One running app's resource use at one moment, the figures Xcode's debug
|
|
110
|
-
* gauges show. iOS instances sample every running app
|
|
111
|
-
* second, delivered live by `streamPerformance
|
|
112
|
-
* `performance` artifacts. Rates cover the second
|
|
113
|
-
* the same process, so a process's first sample
|
|
110
|
+
* gauges show. iOS and Android instances sample every running app you
|
|
111
|
+
* installed once a second, delivered live by `streamPerformance`; iOS also
|
|
112
|
+
* stores them one-per-line in `performance` artifacts. Rates cover the second
|
|
113
|
+
* since the previous sample of the same process, so a process's first sample
|
|
114
|
+
* has none. On Android only an app's main process is sampled, the footprint is
|
|
115
|
+
* its anonymous and shared memory in RAM plus swap, the peak is the highest
|
|
116
|
+
* sampled footprint, and disk rates are absent.
|
|
114
117
|
*/
|
|
115
118
|
export interface PerformanceSample {
|
|
116
119
|
/** Epoch milliseconds, same clock as SessionLogLine. */
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.81.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.81.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.81.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.81.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|