@limrun/api 0.79.5 → 0.80.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 +38 -0
- package/client.d.mts +4 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -1
- package/client.d.ts.map +1 -1
- package/client.js +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/exec-client.d.mts +64 -15
- package/exec-client.d.mts.map +1 -1
- package/exec-client.d.ts +64 -15
- package/exec-client.d.ts.map +1 -1
- package/exec-client.js.map +1 -1
- package/exec-client.mjs.map +1 -1
- package/folder-sync.d.mts +2 -0
- package/folder-sync.d.mts.map +1 -1
- package/folder-sync.d.ts +2 -0
- package/folder-sync.d.ts.map +1 -1
- package/folder-sync.js +1 -1
- package/folder-sync.js.map +1 -1
- package/folder-sync.mjs +1 -1
- package/folder-sync.mjs.map +1 -1
- package/gradle-snapshot.d.mts +2 -0
- package/gradle-snapshot.d.mts.map +1 -1
- package/gradle-snapshot.d.ts +2 -0
- package/gradle-snapshot.d.ts.map +1 -1
- package/gradle-snapshot.js.map +1 -1
- package/gradle-snapshot.mjs.map +1 -1
- package/index.d.mts +2 -2
- package/index.d.mts.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/instance-client.d.mts +7 -2
- package/instance-client.d.mts.map +1 -1
- package/instance-client.d.ts +7 -2
- package/instance-client.d.ts.map +1 -1
- package/instance-client.js +27 -55
- package/instance-client.js.map +1 -1
- package/instance-client.mjs +27 -55
- package/instance-client.mjs.map +1 -1
- package/internal/asset-source.d.mts +11 -0
- package/internal/asset-source.d.mts.map +1 -0
- package/internal/asset-source.d.ts +11 -0
- package/internal/asset-source.d.ts.map +1 -0
- package/internal/asset-source.js +15 -0
- package/internal/asset-source.js.map +1 -0
- package/internal/asset-source.mjs +12 -0
- package/internal/asset-source.mjs.map +1 -0
- package/internal/file-transfer.d.mts +43 -0
- package/internal/file-transfer.d.mts.map +1 -0
- package/internal/file-transfer.d.ts +43 -0
- package/internal/file-transfer.d.ts.map +1 -0
- package/internal/file-transfer.js +270 -0
- package/internal/file-transfer.js.map +1 -0
- package/internal/file-transfer.mjs +261 -0
- package/internal/file-transfer.mjs.map +1 -0
- package/ios-client.d.mts +47 -5
- package/ios-client.d.mts.map +1 -1
- package/ios-client.d.ts +47 -5
- package/ios-client.d.ts.map +1 -1
- package/ios-client.js +44 -2
- package/ios-client.js.map +1 -1
- package/ios-client.mjs +43 -2
- package/ios-client.mjs.map +1 -1
- package/lib/workload-credentials.d.mts +2 -1
- package/lib/workload-credentials.d.mts.map +1 -1
- package/lib/workload-credentials.d.ts +2 -1
- package/lib/workload-credentials.d.ts.map +1 -1
- package/lib/workload-credentials.js +3 -0
- package/lib/workload-credentials.js.map +1 -1
- package/lib/workload-credentials.mjs +3 -0
- package/lib/workload-credentials.mjs.map +1 -1
- package/package.json +2 -1
- package/resources/access-tokens.d.mts +17 -0
- package/resources/access-tokens.d.mts.map +1 -1
- package/resources/access-tokens.d.ts +17 -0
- package/resources/access-tokens.d.ts.map +1 -1
- package/resources/access-tokens.js +39 -3
- package/resources/access-tokens.js.map +1 -1
- package/resources/access-tokens.mjs +36 -2
- package/resources/access-tokens.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/macos-instances-helpers.d.mts +100 -0
- package/resources/macos-instances-helpers.d.mts.map +1 -1
- package/resources/macos-instances-helpers.d.ts +100 -0
- package/resources/macos-instances-helpers.d.ts.map +1 -1
- package/resources/macos-instances-helpers.js +107 -0
- package/resources/macos-instances-helpers.js.map +1 -1
- package/resources/macos-instances-helpers.mjs +106 -0
- package/resources/macos-instances-helpers.mjs.map +1 -1
- package/resources/scoped-tokens.d.mts +2 -2
- package/resources/scoped-tokens.d.mts.map +1 -1
- package/resources/scoped-tokens.d.ts +2 -2
- package/resources/scoped-tokens.d.ts.map +1 -1
- package/resources/scoped-tokens.js +9 -2
- package/resources/scoped-tokens.js.map +1 -1
- package/resources/scoped-tokens.mjs +9 -2
- package/resources/scoped-tokens.mjs.map +1 -1
- package/resources/snapshots.d.mts +2 -0
- package/resources/snapshots.d.mts.map +1 -1
- package/resources/snapshots.d.ts +2 -0
- package/resources/snapshots.d.ts.map +1 -1
- package/resources/snapshots.js.map +1 -1
- package/resources/snapshots.mjs.map +1 -1
- package/resources/xcode-instances-helpers.d.mts +33 -18
- package/resources/xcode-instances-helpers.d.mts.map +1 -1
- package/resources/xcode-instances-helpers.d.ts +33 -18
- package/resources/xcode-instances-helpers.d.ts.map +1 -1
- package/resources/xcode-instances-helpers.js +5 -2
- package/resources/xcode-instances-helpers.js.map +1 -1
- package/resources/xcode-instances-helpers.mjs +5 -2
- package/resources/xcode-instances-helpers.mjs.map +1 -1
- package/src/client.ts +5 -2
- package/src/exec-client.ts +77 -22
- package/src/folder-sync.ts +3 -1
- package/src/gradle-snapshot.ts +2 -0
- package/src/index.ts +9 -0
- package/src/instance-client.ts +38 -59
- package/src/internal/asset-source.ts +13 -0
- package/src/internal/file-transfer.ts +284 -0
- package/src/ios-client.ts +96 -7
- package/src/lib/workload-credentials.ts +6 -1
- package/src/resources/access-tokens.ts +39 -2
- package/src/resources/index.ts +4 -0
- package/src/resources/macos-instances-helpers.ts +236 -0
- package/src/resources/scoped-tokens.ts +14 -3
- package/src/resources/snapshots.ts +2 -0
- package/src/resources/xcode-instances-helpers.ts +49 -19
- package/src/version.ts +1 -1
- package/src/xcode-snapshot.ts +2 -0
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/xcode-snapshot.d.mts +2 -0
- package/xcode-snapshot.d.mts.map +1 -1
- package/xcode-snapshot.d.ts +2 -0
- package/xcode-snapshot.d.ts.map +1 -1
- package/xcode-snapshot.js.map +1 -1
- package/xcode-snapshot.mjs.map +1 -1
package/src/ios-client.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { assetSourceFields, type AssetSource } from './internal/asset-source';
|
|
2
|
+
export type { AssetSource } from './internal/asset-source';
|
|
1
3
|
import os from 'os';
|
|
2
4
|
import crypto from 'crypto';
|
|
3
5
|
import path from 'path';
|
|
@@ -16,6 +18,8 @@ import { prepareAppBundlePath, watchAppArchive } from './app-archive';
|
|
|
16
18
|
import { downloadFileToLocalPath } from './internal/download-file';
|
|
17
19
|
import { sleep } from './internal/utils/sleep';
|
|
18
20
|
import { nodeProxyTransport } from './internal/proxy-transport';
|
|
21
|
+
import { pullQuery, pullTarget, pullToLocalPath, type PullResult } from './internal/file-transfer';
|
|
22
|
+
export type { PullResult } from './internal/file-transfer';
|
|
19
23
|
import { requestBlockedDomains } from './internal/blocked-domains';
|
|
20
24
|
import { postTrustedCaCertificate } from './internal/trusted-ca';
|
|
21
25
|
import {
|
|
@@ -59,6 +63,11 @@ function buildDownloadUrl(apiUrl: string, recordingId?: string): string {
|
|
|
59
63
|
return `${apiUrl}/files?name=${encodeURIComponent(filename)}`;
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
/** The speaker recording's WAV file under the instance's /files. */
|
|
67
|
+
export function speakerRecordingDownloadUrl(apiUrl: string, recordingId: string): string {
|
|
68
|
+
return `${apiUrl}/files?name=${encodeURIComponent(`speaker_${recordingId}.wav`)}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
function validateRecordingId(recordingId: string): void {
|
|
63
72
|
if (/^[a-z0-9][a-z0-9_-]{0,63}$/.exec(recordingId)?.[0] !== recordingId) {
|
|
64
73
|
throw new Error(
|
|
@@ -72,8 +81,12 @@ export type RecordingOptions = {
|
|
|
72
81
|
persist?: PersistOption;
|
|
73
82
|
display?: DuoDisplay;
|
|
74
83
|
touchIndicators?: boolean;
|
|
84
|
+
/** Record the simulator's speaker beside the screen. Defaults to true. */
|
|
85
|
+
audio?: boolean;
|
|
75
86
|
};
|
|
76
87
|
|
|
88
|
+
export type SpeakerRecordingDestination = { localPath?: string };
|
|
89
|
+
|
|
77
90
|
export type RecordingDestination = { presignedUrl?: string; localPath?: string };
|
|
78
91
|
|
|
79
92
|
export function deriveReverseTunnelUrl(apiUrl: string, remotePort: number): string {
|
|
@@ -422,7 +435,9 @@ export type DeviceInfo = {
|
|
|
422
435
|
};
|
|
423
436
|
|
|
424
437
|
export type AppInstallationResult = {
|
|
425
|
-
/** The
|
|
438
|
+
/** The asset name supplied to installApp, when used. */
|
|
439
|
+
assetName?: string;
|
|
440
|
+
/** The supplied URL, or an empty string for a named asset. */
|
|
426
441
|
url: string;
|
|
427
442
|
/** Bundle ID of the installed app */
|
|
428
443
|
bundleId: string;
|
|
@@ -1095,13 +1110,16 @@ export type InstanceClient = {
|
|
|
1095
1110
|
openUrl: (url: string) => Promise<void>;
|
|
1096
1111
|
|
|
1097
1112
|
/**
|
|
1098
|
-
* Install an app from a URL (supports .ipa or .app files, optionally zipped)
|
|
1099
|
-
* @param
|
|
1113
|
+
* Install an app from a URL or asset name (supports .ipa or .app files, optionally zipped)
|
|
1114
|
+
* @param source A URL, or { assetName } resolved using the instance role's asset read permission
|
|
1100
1115
|
* @param options Optional installation options (md5 for caching, launchMode)
|
|
1101
1116
|
* @returns The installation result with bundle ID on success
|
|
1102
1117
|
* @throws Error if installation fails (e.g., invalid app, download failure)
|
|
1103
1118
|
*/
|
|
1104
|
-
installApp: (
|
|
1119
|
+
installApp: (source: AssetSource, options?: AppInstallationOptions) => Promise<AppInstallationResult>;
|
|
1120
|
+
|
|
1121
|
+
/** Install an app by exact asset name using the instance role. */
|
|
1122
|
+
installAppByName: (assetName: string, options?: AppInstallationOptions) => Promise<AppInstallationResult>;
|
|
1105
1123
|
|
|
1106
1124
|
/**
|
|
1107
1125
|
* Save the simulator keychain as an unencrypted tar.gz archive at a presigned asset-storage URL.
|
|
@@ -1207,7 +1225,8 @@ export type InstanceClient = {
|
|
|
1207
1225
|
* canvas without stretching. Pass display to keep recording one panel.
|
|
1208
1226
|
* When provided, `quality` must be one of `5`, `6`, `7`, `8`, `9`, or `10`.
|
|
1209
1227
|
* The server default is `5`. Touch ripples and drag trails are enabled while
|
|
1210
|
-
* recording by default. Set `touchIndicators: false` to omit them.
|
|
1228
|
+
* recording by default. Set `touchIndicators: false` to omit them. The
|
|
1229
|
+
* simulator's speaker is recorded as an audio track unless `audio` is false.
|
|
1211
1230
|
* With `persist`, the completed recording is uploaded to Limrun's bucket
|
|
1212
1231
|
* when the recording stops or the instance terminates; list it with
|
|
1213
1232
|
* `iosInstances.listRecordings`.
|
|
@@ -1225,6 +1244,21 @@ export type InstanceClient = {
|
|
|
1225
1244
|
/** Stop the given recording, or the latest active recording when omitted. Returns its authenticated download URL. */
|
|
1226
1245
|
stopRecordingSession: (recordingId?: string, saveTo?: RecordingDestination) => Promise<string>;
|
|
1227
1246
|
|
|
1247
|
+
/**
|
|
1248
|
+
* Start recording the simulator's speaker alone, into a 48 kHz mono 16-bit
|
|
1249
|
+
* WAV file, and return its ID. Up to eight speaker recordings may run at
|
|
1250
|
+
* once. Omit recordingId to generate one. IDs cannot be reused during the
|
|
1251
|
+
* instance lifetime.
|
|
1252
|
+
*/
|
|
1253
|
+
startSpeakerRecording: (options?: { recordingId?: string }) => Promise<string>;
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Stop the given speaker recording, or the latest one when omitted, and
|
|
1257
|
+
* return its authenticated download URL, valid while the instance runs.
|
|
1258
|
+
* With `saveTo.localPath`, the client also downloads the WAV file there.
|
|
1259
|
+
*/
|
|
1260
|
+
stopSpeakerRecording: (recordingId?: string, saveTo?: SpeakerRecordingDestination) => Promise<string>;
|
|
1261
|
+
|
|
1228
1262
|
/**
|
|
1229
1263
|
* Stop the active server-side recording.
|
|
1230
1264
|
* If `saveTo.presignedUrl` is provided, the server uploads the completed file there before resolving.
|
|
@@ -1577,6 +1611,18 @@ export type InstanceClient = {
|
|
|
1577
1611
|
*/
|
|
1578
1612
|
pullFile: (name: string, opts?: ContainerTargetOptions) => Promise<Buffer>;
|
|
1579
1613
|
|
|
1614
|
+
/**
|
|
1615
|
+
* Download a file or folder from the simulator to `localPath`; a folder arrives as a tar,
|
|
1616
|
+
* compressed with zstd, and is unpacked there, merging with what is already there. When
|
|
1617
|
+
* `localPath` is an existing folder, the file or folder lands inside it under the remote's
|
|
1618
|
+
* name. Defaults to the remote's name in the current directory.
|
|
1619
|
+
*
|
|
1620
|
+
* `name` addresses what {@link pullFile} does: the sandbox staging folder, or a relative path
|
|
1621
|
+
* inside the app container when `opts.bundleId` is set. An instance that predates folder pulls
|
|
1622
|
+
* refuses a folder.
|
|
1623
|
+
*/
|
|
1624
|
+
pull: (name: string, localPath?: string, opts?: ContainerTargetOptions) => Promise<PullResult>;
|
|
1625
|
+
|
|
1580
1626
|
/**
|
|
1581
1627
|
* List a directory in the simulator staging folder or an app container.
|
|
1582
1628
|
*
|
|
@@ -1852,6 +1898,7 @@ type ServerResponse = {
|
|
|
1852
1898
|
elementType?: string;
|
|
1853
1899
|
apps?: string;
|
|
1854
1900
|
url?: string;
|
|
1901
|
+
assetName?: string;
|
|
1855
1902
|
filename?: string;
|
|
1856
1903
|
bundleId?: string;
|
|
1857
1904
|
files?: LsofEntry[];
|
|
@@ -2389,6 +2436,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2389
2436
|
}),
|
|
2390
2437
|
openUrlResult: () => undefined,
|
|
2391
2438
|
appInstallationResult: (msg) => ({
|
|
2439
|
+
...(msg.assetName !== undefined && { assetName: msg.assetName }),
|
|
2392
2440
|
url: msg.url || '',
|
|
2393
2441
|
bundleId: msg.bundleId || '',
|
|
2394
2442
|
}),
|
|
@@ -2403,6 +2451,8 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2403
2451
|
startVideoRecordingResult: () => undefined,
|
|
2404
2452
|
startVideoRecordingSessionResult: (msg) => ({ recordingId: msg.recordingId }),
|
|
2405
2453
|
stopVideoRecordingSessionResult: (msg) => ({ recordingId: msg.recordingId }),
|
|
2454
|
+
startSpeakerRecordingResult: (msg) => ({ recordingId: msg.recordingId }),
|
|
2455
|
+
stopSpeakerRecordingResult: (msg) => ({ recordingId: msg.recordingId }),
|
|
2406
2456
|
stopVideoRecordingResult: () => undefined,
|
|
2407
2457
|
startAppLogCaptureResult: () => undefined,
|
|
2408
2458
|
stopAppLogCaptureResult: () => undefined,
|
|
@@ -2821,11 +2871,14 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2821
2871
|
return sendRequest<void>('openUrl', { url });
|
|
2822
2872
|
};
|
|
2823
2873
|
|
|
2824
|
-
const installApp = (
|
|
2874
|
+
const installApp = (
|
|
2875
|
+
source: AssetSource,
|
|
2876
|
+
options?: AppInstallationOptions,
|
|
2877
|
+
): Promise<AppInstallationResult> => {
|
|
2825
2878
|
return sendRequest<AppInstallationResult>(
|
|
2826
2879
|
'appInstallation',
|
|
2827
2880
|
{
|
|
2828
|
-
|
|
2881
|
+
...assetSourceFields(source),
|
|
2829
2882
|
md5: options?.md5,
|
|
2830
2883
|
launchMode: options?.launchMode,
|
|
2831
2884
|
},
|
|
@@ -2941,6 +2994,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2941
2994
|
quality: opts?.quality,
|
|
2942
2995
|
display: opts?.display,
|
|
2943
2996
|
touchIndicators: opts?.touchIndicators,
|
|
2997
|
+
audio: opts?.audio,
|
|
2944
2998
|
};
|
|
2945
2999
|
};
|
|
2946
3000
|
|
|
@@ -2980,6 +3034,28 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2980
3034
|
return downloadUrl;
|
|
2981
3035
|
};
|
|
2982
3036
|
|
|
3037
|
+
const startSpeakerRecording: InstanceClient['startSpeakerRecording'] = async (opts) => {
|
|
3038
|
+
if (opts?.recordingId !== undefined) validateRecordingId(opts.recordingId);
|
|
3039
|
+
const result = await sendRequest<{ recordingId: string }>('startSpeakerRecording', {
|
|
3040
|
+
recordingId: opts?.recordingId,
|
|
3041
|
+
});
|
|
3042
|
+
validateRecordingId(result.recordingId);
|
|
3043
|
+
return result.recordingId;
|
|
3044
|
+
};
|
|
3045
|
+
|
|
3046
|
+
const stopSpeakerRecording: InstanceClient['stopSpeakerRecording'] = async (recordingId, saveTo = {}) => {
|
|
3047
|
+
if (recordingId !== undefined) validateRecordingId(recordingId);
|
|
3048
|
+
const result = await sendRequest<{ recordingId?: string }>('stopSpeakerRecording', { recordingId });
|
|
3049
|
+
const stoppedId = result.recordingId ?? recordingId;
|
|
3050
|
+
if (stoppedId === undefined) throw new Error('Runtime did not return the stopped recordingId');
|
|
3051
|
+
validateRecordingId(stoppedId);
|
|
3052
|
+
const downloadUrl = speakerRecordingDownloadUrl(options.apiUrl, stoppedId);
|
|
3053
|
+
if (saveTo.localPath) {
|
|
3054
|
+
await downloadFileToLocalPath(downloadUrl, options.token, saveTo.localPath);
|
|
3055
|
+
}
|
|
3056
|
+
return downloadUrl;
|
|
3057
|
+
};
|
|
3058
|
+
|
|
2983
3059
|
const startAppLogCapture = async (opts: { bundleId: string; persist?: PersistOption }): Promise<void> => {
|
|
2984
3060
|
if (!opts.bundleId) {
|
|
2985
3061
|
throw new Error('bundleId must be a non-empty string');
|
|
@@ -3348,6 +3424,15 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3348
3424
|
return Buffer.from(await response.arrayBuffer());
|
|
3349
3425
|
};
|
|
3350
3426
|
|
|
3427
|
+
const pull = async (
|
|
3428
|
+
name: string,
|
|
3429
|
+
localPath?: string,
|
|
3430
|
+
opts?: ContainerTargetOptions,
|
|
3431
|
+
): Promise<PullResult> => {
|
|
3432
|
+
const target = await pullTarget(name, localPath);
|
|
3433
|
+
return pullToLocalPath(`${buildFilesUrl(name, opts)}&${pullQuery()}`, options.token, name, target);
|
|
3434
|
+
};
|
|
3435
|
+
|
|
3351
3436
|
const listFiles = async (path = '.', opts?: ContainerTargetOptions): Promise<IosFileEntry[]> => {
|
|
3352
3437
|
const params = new URLSearchParams();
|
|
3353
3438
|
if (path && path !== '.') {
|
|
@@ -3697,6 +3782,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3697
3782
|
listApps,
|
|
3698
3783
|
openUrl,
|
|
3699
3784
|
installApp,
|
|
3785
|
+
installAppByName: (assetName, options) => installApp({ assetName }, options),
|
|
3700
3786
|
saveKeychain,
|
|
3701
3787
|
restoreKeychain,
|
|
3702
3788
|
resetKeychain,
|
|
@@ -3715,6 +3801,8 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3715
3801
|
stopRecording,
|
|
3716
3802
|
startRecordingSession,
|
|
3717
3803
|
stopRecordingSession,
|
|
3804
|
+
startSpeakerRecording,
|
|
3805
|
+
stopSpeakerRecording,
|
|
3718
3806
|
startAppLogCapture,
|
|
3719
3807
|
stopAppLogCapture,
|
|
3720
3808
|
startEventCapture,
|
|
@@ -3753,6 +3841,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3753
3841
|
xcodebuild,
|
|
3754
3842
|
pushFile,
|
|
3755
3843
|
pullFile,
|
|
3844
|
+
pull,
|
|
3756
3845
|
listFiles,
|
|
3757
3846
|
deleteFile,
|
|
3758
3847
|
setCameraVideo,
|
|
@@ -27,8 +27,9 @@ export class WorkloadCredentials {
|
|
|
27
27
|
private cached?: { token: string; expires: number; refreshAt: number };
|
|
28
28
|
private pending: Promise<string> | undefined;
|
|
29
29
|
|
|
30
|
+
/** endpoint is the token service. Without one, every exchange fails rather than go elsewhere. */
|
|
30
31
|
constructor(
|
|
31
|
-
private endpoint: string,
|
|
32
|
+
private endpoint: string | undefined,
|
|
32
33
|
private readIdentity: WorkloadIdentityReader,
|
|
33
34
|
private fetcher: typeof fetch,
|
|
34
35
|
private fetchOptions?: MergedRequestInit,
|
|
@@ -45,6 +46,10 @@ export class WorkloadCredentials {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
private async exchange(): Promise<string> {
|
|
49
|
+
if (!this.endpoint)
|
|
50
|
+
throw new Error(
|
|
51
|
+
"A Limrun workload identity is exchanged at the region's token service; set STS_URL or LIMRUN_STS_BASE_URL",
|
|
52
|
+
);
|
|
48
53
|
const identity = await this.readIdentity();
|
|
49
54
|
const jwt =
|
|
50
55
|
identity === null ? undefined
|
|
@@ -1,17 +1,54 @@
|
|
|
1
1
|
import { APIResource } from '../core/resource';
|
|
2
2
|
import { APIPromise } from '../core/api-promise';
|
|
3
|
+
import { LimrunError } from '../core/error';
|
|
3
4
|
import { RequestOptions } from '../internal/request-options';
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* The Limrun token service mints and revokes access tokens. A client with its own `baseURL`
|
|
8
|
+
* sends these requests to that URL instead.
|
|
9
|
+
*/
|
|
10
|
+
export const TOKEN_SERVICE_URL = 'https://sts.limrun.com';
|
|
11
|
+
|
|
5
12
|
export class AccessTokens extends APIResource {
|
|
6
13
|
/** Mint a temporary credential whose permissions are covered by the caller. */
|
|
7
14
|
create(body: AccessTokenCreateParams, options?: RequestOptions): APIPromise<AccessToken> {
|
|
8
|
-
return this._client
|
|
15
|
+
return this._client
|
|
16
|
+
.post<AccessToken>('/v1/access_tokens', {
|
|
17
|
+
body: tokenServiceBody(body),
|
|
18
|
+
defaultBaseURL: TOKEN_SERVICE_URL,
|
|
19
|
+
...options,
|
|
20
|
+
})
|
|
21
|
+
._thenUnwrap(withScopes);
|
|
9
22
|
}
|
|
10
23
|
|
|
11
24
|
/** Revoke a credential by the ID returned when it was minted. */
|
|
12
25
|
revoke(id: string, options?: RequestOptions): APIPromise<AccessTokenRevokeResponse> {
|
|
13
|
-
return this._client.delete(`/v1/access_tokens/${encodeURIComponent(id)}`,
|
|
26
|
+
return this._client.delete(`/v1/access_tokens/${encodeURIComponent(id)}`, {
|
|
27
|
+
defaultBaseURL: TOKEN_SERVICE_URL,
|
|
28
|
+
...options,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The token service accepts only `permissions`, so the deprecated `scopes` alias is
|
|
35
|
+
* resolved here, with the same rule the API applied: both must name the same set.
|
|
36
|
+
*/
|
|
37
|
+
export function tokenServiceBody({ scopes, ...body }: AccessTokenCreateParams): AccessTokenCreateParams {
|
|
38
|
+
if (!scopes) return body;
|
|
39
|
+
if (!body.permissions) return { ...body, permissions: scopes };
|
|
40
|
+
const permissions = new Set(body.permissions);
|
|
41
|
+
if (new Set(scopes).size !== permissions.size || scopes.some((scope) => !permissions.has(scope))) {
|
|
42
|
+
throw new LimrunError('permissions and the deprecated scopes must name the same permissions');
|
|
14
43
|
}
|
|
44
|
+
return body;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Fills the deprecated `scopes` field, which the token service no longer returns. */
|
|
48
|
+
export function withScopes<T extends { permissions: Array<string>; scopes?: Array<string> }>(
|
|
49
|
+
token: T,
|
|
50
|
+
): T & { scopes: Array<string> } {
|
|
51
|
+
return { ...token, scopes: token.scopes ?? token.permissions };
|
|
15
52
|
}
|
|
16
53
|
|
|
17
54
|
export interface AccessToken {
|
package/src/resources/index.ts
CHANGED
|
@@ -136,6 +136,10 @@ export {
|
|
|
136
136
|
type MacosSshAccess,
|
|
137
137
|
type MacosSnapshotRestoreOptions,
|
|
138
138
|
type MacosSnapshotProgress,
|
|
139
|
+
type MacosSyncOptions,
|
|
140
|
+
type MacosSyncResult,
|
|
141
|
+
type MacosFileEntry,
|
|
142
|
+
type PullResult,
|
|
139
143
|
} from './macos-instances-helpers';
|
|
140
144
|
|
|
141
145
|
export {
|
|
@@ -41,6 +41,21 @@ import {
|
|
|
41
41
|
type DestinationTunnelStatus,
|
|
42
42
|
} from '../internal/destination-tunnel-management';
|
|
43
43
|
import { deriveDestinationTunnelURL } from '../internal/destination-tunnel-url';
|
|
44
|
+
import { syncFolder as syncFolderImpl, type FolderSyncOptions } from '../folder-sync';
|
|
45
|
+
import { createIgnoreFn } from '../folder-sync-ignore';
|
|
46
|
+
import { deriveBasisCache, type SyncResult } from './daemon-client-shared';
|
|
47
|
+
import {
|
|
48
|
+
pullQuery,
|
|
49
|
+
pullTarget,
|
|
50
|
+
pullToLocalPath,
|
|
51
|
+
pushFile as pushLocalFile,
|
|
52
|
+
type PullResult,
|
|
53
|
+
} from '../internal/file-transfer';
|
|
54
|
+
import { nodeProxyTransport } from '../internal/proxy-transport';
|
|
55
|
+
import nodePath from 'path';
|
|
56
|
+
import { createHash } from 'crypto';
|
|
57
|
+
|
|
58
|
+
export type { PullResult } from '../internal/file-transfer';
|
|
44
59
|
|
|
45
60
|
export type MacosCreateClientParams = { logLevel?: LogLevel } & (
|
|
46
61
|
| { instance: MacosInstance }
|
|
@@ -61,6 +76,8 @@ export interface MacosRecordingOptions {
|
|
|
61
76
|
quality?: number;
|
|
62
77
|
/** Upload the recording to Limrun's bucket when it stops; list it with `listRecordings`. */
|
|
63
78
|
persist?: PersistOption;
|
|
79
|
+
/** Record the guest's speaker beside the screen. Defaults to true. */
|
|
80
|
+
audio?: boolean;
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
/** Where a stopped recording goes, besides the instance's own download URL. */
|
|
@@ -87,6 +104,20 @@ export interface MacosLaunchAppOptions {
|
|
|
87
104
|
env?: Record<string, string>;
|
|
88
105
|
}
|
|
89
106
|
|
|
107
|
+
/** One app of {@link MacosClient.listApps}, in the fields iOS's listApps returns. */
|
|
108
|
+
export interface MacosInstalledApp {
|
|
109
|
+
bundleId: string;
|
|
110
|
+
name: string;
|
|
111
|
+
/** `system` for an app macOS ships, `user` for one installed in the guest. */
|
|
112
|
+
installType: 'system' | 'user';
|
|
113
|
+
/** Present while the app runs. */
|
|
114
|
+
pid?: number;
|
|
115
|
+
/** App icon as a base64-encoded 64px PNG; absent when the guest has no icon file for it. */
|
|
116
|
+
icon?: string;
|
|
117
|
+
/** When a user app arrived, as epoch milliseconds; absent for system apps. */
|
|
118
|
+
installedAt?: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
90
121
|
export interface MacosLaunchAppResult {
|
|
91
122
|
bundleId: string;
|
|
92
123
|
pid: number;
|
|
@@ -110,6 +141,47 @@ export interface MacosPoint {
|
|
|
110
141
|
/** Modifier keys held while a key is pressed. */
|
|
111
142
|
export type MacosModifier = 'shift' | 'control' | 'option' | 'command';
|
|
112
143
|
|
|
144
|
+
/** Options of {@link MacosClient.sync}. */
|
|
145
|
+
export interface MacosSyncOptions {
|
|
146
|
+
/**
|
|
147
|
+
* The guest folder the local folder syncs into: absolute, or relative to the guest user's
|
|
148
|
+
* home. Defaults to the local folder's name in the home, `~/<local folder name>`.
|
|
149
|
+
*/
|
|
150
|
+
destination?: string;
|
|
151
|
+
/** Keep watching the local folder and sync each change. Defaults to false. */
|
|
152
|
+
watch?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Directory for the client-side sync cache, which keeps a folder per destination inside it.
|
|
155
|
+
* Defaults to one under the OS temp directory.
|
|
156
|
+
*/
|
|
157
|
+
basisCacheDir?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Predicate for paths to leave out, on top of the folder's .gitignore files. Called with the
|
|
160
|
+
* path relative to the folder, forward slashes, and a trailing '/' for folders.
|
|
161
|
+
*/
|
|
162
|
+
ignore?: (relativePath: string) => boolean;
|
|
163
|
+
/** Predicate for paths to sync that .gitignore would leave out, with `ignore`'s convention. */
|
|
164
|
+
include?: (relativePath: string) => boolean;
|
|
165
|
+
/** Called after every successful sync, including watch-triggered ones. */
|
|
166
|
+
onSyncComplete?: FolderSyncOptions['onSyncComplete'];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** What {@link MacosClient.sync} did. */
|
|
170
|
+
export interface MacosSyncResult extends SyncResult {
|
|
171
|
+
/** The guest folder the files went to, as it was sent. */
|
|
172
|
+
destination: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** One entry of {@link MacosClient.listFiles}. */
|
|
176
|
+
export interface MacosFileEntry {
|
|
177
|
+
name: string;
|
|
178
|
+
/** The listed path joined with `name`, in the form it was asked; usable with pull and deleteFile. */
|
|
179
|
+
path: string;
|
|
180
|
+
isDirectory: boolean;
|
|
181
|
+
/** Size in bytes of a regular file. */
|
|
182
|
+
size?: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
113
185
|
/** Where the guest's SSH server can be reached once {@link MacosClient.enableSsh} returns. */
|
|
114
186
|
export interface MacosSshAccess {
|
|
115
187
|
/** The guest account the key logs in as. */
|
|
@@ -164,6 +236,34 @@ export interface MacosClient {
|
|
|
164
236
|
options?: TcpTunnelOptions & { hostname?: string },
|
|
165
237
|
): Promise<Tunnel>;
|
|
166
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Upload a local folder into the guest and keep it in step: the first sync sends every file,
|
|
241
|
+
* later ones only what changed, as xdelta3 patches where that is smaller. Files the local
|
|
242
|
+
* folder no longer has are removed from the guest folder; files created in the guest folder
|
|
243
|
+
* are left alone. The folder's .gitignore files apply. What lands belongs to the guest user, so
|
|
244
|
+
* `run(..., { cwd: destination })` builds in it, and a disk snapshot keeps it.
|
|
245
|
+
*/
|
|
246
|
+
sync(localFolder: string, options?: MacosSyncOptions): Promise<MacosSyncResult>;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Upload a local file to a guest path, absolute or relative to the guest user's home. Parent
|
|
250
|
+
* folders are created and a file already there is replaced. Resolves with the absolute path.
|
|
251
|
+
*/
|
|
252
|
+
pushFile(localPath: string, remotePath: string): Promise<string>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Download a guest file or folder to `localPath`; a folder is unpacked there, merging with
|
|
256
|
+
* what is already there. When `localPath` is an existing folder, the file or folder lands
|
|
257
|
+
* inside it under the remote's name. Defaults to the remote's name in the current directory.
|
|
258
|
+
*/
|
|
259
|
+
pull(remotePath: string, localPath?: string): Promise<PullResult>;
|
|
260
|
+
|
|
261
|
+
/** List a guest folder, the guest user's home when `path` is omitted. Links are not followed. */
|
|
262
|
+
listFiles(path?: string): Promise<MacosFileEntry[]>;
|
|
263
|
+
|
|
264
|
+
/** Delete a guest file, or a folder with everything in it. */
|
|
265
|
+
deleteFile(path: string): Promise<void>;
|
|
266
|
+
|
|
167
267
|
/** A JPEG of the screen. Its pixels are the coordinates the input methods take. */
|
|
168
268
|
screenshot(): Promise<Buffer>;
|
|
169
269
|
|
|
@@ -235,6 +335,25 @@ export interface MacosClient {
|
|
|
235
335
|
*/
|
|
236
336
|
stopRecording(recordingId?: string, saveTo?: MacosRecordingDestination): Promise<string>;
|
|
237
337
|
|
|
338
|
+
/**
|
|
339
|
+
* Start recording the guest's speaker alone, into a 48 kHz mono 16-bit WAV file, and return
|
|
340
|
+
* the recording's ID. Up to eight speaker recordings may run at once. IDs are never reused.
|
|
341
|
+
*/
|
|
342
|
+
startSpeakerRecording(options?: { recordingId?: string }): Promise<string>;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Stop a speaker recording, or the latest one when `recordingId` is omitted, and return its
|
|
346
|
+
* download URL, which takes the instance token and lasts while the instance runs. With
|
|
347
|
+
* `saveTo.localPath`, the client also downloads the WAV file there.
|
|
348
|
+
*/
|
|
349
|
+
stopSpeakerRecording(recordingId?: string, saveTo?: { localPath?: string }): Promise<string>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* The apps the guest user can open: those in /Applications, /System/Applications and the user's
|
|
353
|
+
* Applications folder, and any launched from elsewhere. Running apps carry their pid.
|
|
354
|
+
*/
|
|
355
|
+
listApps(): Promise<MacosInstalledApp[]>;
|
|
356
|
+
|
|
238
357
|
/**
|
|
239
358
|
* Launch an app by bundle ID (`com.example.app`), name (`TextEdit`) or path
|
|
240
359
|
* (`/Applications/Safari.app`) and bring it to the front. An app launched this way has its
|
|
@@ -403,9 +522,94 @@ class MacosInstancesHelpers extends MacosInstances {
|
|
|
403
522
|
): Promise<T> =>
|
|
404
523
|
transport.request<T>(type, params, transform ?? ((() => undefined) as () => T), timeoutMs);
|
|
405
524
|
|
|
525
|
+
const filesUrl = (path: string, extra = '') =>
|
|
526
|
+
`${apiUrl}/files?${new URLSearchParams({ path }).toString()}${extra ? `&${extra}` : ''}`;
|
|
527
|
+
const checked = async (response: Response, what: string) => {
|
|
528
|
+
if (!response.ok) throw new Error(`${what} failed: ${response.status} ${await response.text()}`);
|
|
529
|
+
return response;
|
|
530
|
+
};
|
|
531
|
+
|
|
406
532
|
return {
|
|
407
533
|
run: createBuildRun({ apiUrl, token, log }),
|
|
408
534
|
|
|
535
|
+
async sync(localFolder, options = {}) {
|
|
536
|
+
const destination = (options.destination ?? nodePath.basename(nodePath.resolve(localFolder))).replace(
|
|
537
|
+
/\/+$/,
|
|
538
|
+
'',
|
|
539
|
+
);
|
|
540
|
+
const rootName = nodePath.posix.basename(destination);
|
|
541
|
+
if (!destination || rootName === '~' || rootName === '.' || rootName === '..') {
|
|
542
|
+
throw new Error(
|
|
543
|
+
`destination "${options.destination}" must name a folder of its own, such as ~/app`,
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
// One cache per local folder and destination, so two destinations never share a basis.
|
|
547
|
+
const { cacheKey, basisCacheDir } = deriveBasisCache(localFolder, options.basisCacheDir);
|
|
548
|
+
// A folder of its own under the cache for each destination, given or default: a basis
|
|
549
|
+
// describes what one guest folder holds, so two destinations never share one.
|
|
550
|
+
const scoped = nodePath.join(
|
|
551
|
+
basisCacheDir,
|
|
552
|
+
createHash('sha1').update(destination).digest('hex').slice(0, 8),
|
|
553
|
+
);
|
|
554
|
+
const result = await syncFolderImpl(localFolder, {
|
|
555
|
+
apiUrl,
|
|
556
|
+
token,
|
|
557
|
+
udid: cacheKey,
|
|
558
|
+
install: false,
|
|
559
|
+
launchMode: 'None',
|
|
560
|
+
url: `${apiUrl}/folder-sync?${new URLSearchParams({ path: destination }).toString()}`,
|
|
561
|
+
rootName,
|
|
562
|
+
ignoreFn: await createIgnoreFn(localFolder, {
|
|
563
|
+
// The whole cache, every destination's folder in it, stays out of the walk.
|
|
564
|
+
basisCacheDir,
|
|
565
|
+
log,
|
|
566
|
+
xcodeDefaults: false,
|
|
567
|
+
nestedGitignore: true,
|
|
568
|
+
...(options.ignore ? { additional: options.ignore } : {}),
|
|
569
|
+
...(options.include ? { include: options.include } : {}),
|
|
570
|
+
}),
|
|
571
|
+
basisCacheDir: scoped,
|
|
572
|
+
watch: options.watch ?? false,
|
|
573
|
+
log,
|
|
574
|
+
syncSymlinks: true,
|
|
575
|
+
...(options.onSyncComplete ? { onSyncComplete: options.onSyncComplete } : {}),
|
|
576
|
+
});
|
|
577
|
+
return {
|
|
578
|
+
destination,
|
|
579
|
+
...(result.bytesSent !== undefined ? { bytesSent: result.bytesSent } : {}),
|
|
580
|
+
...(result.stopWatching ? { stopWatching: result.stopWatching } : {}),
|
|
581
|
+
};
|
|
582
|
+
},
|
|
583
|
+
|
|
584
|
+
pushFile(localPath, remotePath) {
|
|
585
|
+
if (!remotePath) throw new Error('remotePath must not be empty');
|
|
586
|
+
return pushLocalFile(filesUrl(remotePath), token, localPath, true);
|
|
587
|
+
},
|
|
588
|
+
|
|
589
|
+
async pull(remotePath, localPath) {
|
|
590
|
+
if (!remotePath) throw new Error('remotePath must not be empty');
|
|
591
|
+
const target = await pullTarget(remotePath, localPath);
|
|
592
|
+
return pullToLocalPath(filesUrl(remotePath, pullQuery()), token, remotePath, target);
|
|
593
|
+
},
|
|
594
|
+
|
|
595
|
+
async listFiles(path) {
|
|
596
|
+
const query = path ? `?${new URLSearchParams({ path }).toString()}` : '';
|
|
597
|
+
const response = await nodeProxyTransport.fetch(`${apiUrl}/files/list${query}`, {
|
|
598
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
599
|
+
});
|
|
600
|
+
await checked(response as unknown as Response, `Listing of '${path ?? '~'}'`);
|
|
601
|
+
return ((await response.json()) as { entries: MacosFileEntry[] }).entries;
|
|
602
|
+
},
|
|
603
|
+
|
|
604
|
+
async deleteFile(path) {
|
|
605
|
+
if (!path) throw new Error('path must not be empty');
|
|
606
|
+
const response = await nodeProxyTransport.fetch(filesUrl(path), {
|
|
607
|
+
method: 'DELETE',
|
|
608
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
609
|
+
});
|
|
610
|
+
await checked(response as unknown as Response, `Deletion of '${path}'`);
|
|
611
|
+
},
|
|
612
|
+
|
|
409
613
|
disconnect: () => transport.disconnect(),
|
|
410
614
|
keepAlive: () => transport.keepAlive(),
|
|
411
615
|
getConnectionState: () => transport.getConnectionState(),
|
|
@@ -447,6 +651,7 @@ class MacosInstancesHelpers extends MacosInstances {
|
|
|
447
651
|
{
|
|
448
652
|
...(options?.recordingId !== undefined && { recordingId: options.recordingId }),
|
|
449
653
|
...(options?.quality !== undefined && { quality: options.quality }),
|
|
654
|
+
...(options?.audio !== undefined && { audio: options.audio }),
|
|
450
655
|
...persistFields(options?.persist),
|
|
451
656
|
},
|
|
452
657
|
(msg) => msg['recordingId'] as string,
|
|
@@ -471,6 +676,37 @@ class MacosInstancesHelpers extends MacosInstances {
|
|
|
471
676
|
return downloadUrl;
|
|
472
677
|
},
|
|
473
678
|
|
|
679
|
+
async startSpeakerRecording(options) {
|
|
680
|
+
if (options?.recordingId !== undefined) validateRecordingId(options.recordingId);
|
|
681
|
+
return send(
|
|
682
|
+
'startSpeakerRecording',
|
|
683
|
+
{ ...(options?.recordingId !== undefined && { recordingId: options.recordingId }) },
|
|
684
|
+
(msg) => msg['recordingId'] as string,
|
|
685
|
+
);
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
async stopSpeakerRecording(recordingId, saveTo = {}) {
|
|
689
|
+
if (recordingId !== undefined) validateRecordingId(recordingId);
|
|
690
|
+
const stoppedId = await send(
|
|
691
|
+
'stopSpeakerRecording',
|
|
692
|
+
{ ...(recordingId !== undefined && { recordingId }) },
|
|
693
|
+
(msg) => msg['recordingId'] as string | undefined,
|
|
694
|
+
);
|
|
695
|
+
const stopped = stoppedId || recordingId;
|
|
696
|
+
if (!stopped) throw new Error('the instance did not say which speaker recording stopped');
|
|
697
|
+
const downloadUrl = `${apiUrl}/files?name=${encodeURIComponent(`speaker_${stopped}.wav`)}`;
|
|
698
|
+
if (saveTo.localPath) await downloadFileToLocalPath(downloadUrl, token, saveTo.localPath);
|
|
699
|
+
return downloadUrl;
|
|
700
|
+
},
|
|
701
|
+
|
|
702
|
+
listApps() {
|
|
703
|
+
// The instance sends the list as JSON text, as limulator does.
|
|
704
|
+
return send('listApps', {}, (msg): MacosInstalledApp[] => {
|
|
705
|
+
const apps = typeof msg['apps'] === 'string' ? JSON.parse(msg['apps']) : msg['apps'];
|
|
706
|
+
return Array.isArray(apps) ? apps : [];
|
|
707
|
+
});
|
|
708
|
+
},
|
|
709
|
+
|
|
474
710
|
launchApp(app, options) {
|
|
475
711
|
return send(
|
|
476
712
|
'launchApp',
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
type AccessTokenCreateParams,
|
|
5
|
+
TOKEN_SERVICE_URL,
|
|
6
|
+
tokenServiceBody,
|
|
7
|
+
withScopes,
|
|
8
|
+
} from './access-tokens';
|
|
4
9
|
import { APIResource } from '../core/resource';
|
|
5
10
|
import { APIPromise } from '../core/api-promise';
|
|
6
11
|
import { RequestOptions } from '../internal/request-options';
|
|
@@ -11,10 +16,16 @@ export class ScopedTokens extends APIResource {
|
|
|
11
16
|
* Mint a short-lived access token whose permissions limit what the holder can do, e.g.
|
|
12
17
|
* install a specific asset on a device through the registry. The token is verified
|
|
13
18
|
* by services holding the signing public key. It is bound to the caller's organization.
|
|
14
|
-
* @deprecated Use client.accessTokens.create()
|
|
19
|
+
* @deprecated Use client.accessTokens.create(), which this method now calls through to.
|
|
15
20
|
*/
|
|
16
21
|
create(body: ScopedTokenCreateParams, options?: RequestOptions): APIPromise<ScopedToken> {
|
|
17
|
-
return this._client
|
|
22
|
+
return this._client
|
|
23
|
+
.post<ScopedToken & { permissions: Array<string> }>('/v1/access_tokens', {
|
|
24
|
+
body: tokenServiceBody(body),
|
|
25
|
+
defaultBaseURL: TOKEN_SERVICE_URL,
|
|
26
|
+
...options,
|
|
27
|
+
})
|
|
28
|
+
._thenUnwrap(withScopes);
|
|
18
29
|
}
|
|
19
30
|
}
|
|
20
31
|
|
|
@@ -19,6 +19,7 @@ export interface SnapshotList<Snapshot> {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface XcodeSnapshot {
|
|
22
|
+
expiresAt?: string;
|
|
22
23
|
key: string;
|
|
23
24
|
directoryKey: string;
|
|
24
25
|
rootName: string;
|
|
@@ -32,6 +33,7 @@ export interface XcodeSnapshot {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export interface GradleSnapshot {
|
|
36
|
+
expiresAt?: string;
|
|
35
37
|
key: string;
|
|
36
38
|
/** Toolchains label of the image that saved it. An instance with another label tries its next restore key. */
|
|
37
39
|
compatKey: string;
|