@limrun/api 0.79.6 → 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 +23 -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/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 +23 -4
- package/ios-client.d.mts.map +1 -1
- package/ios-client.d.ts +23 -4
- package/ios-client.d.ts.map +1 -1
- package/ios-client.js +11 -2
- package/ios-client.js.map +1 -1
- package/ios-client.mjs +11 -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 +83 -0
- package/resources/macos-instances-helpers.d.mts.map +1 -1
- package/resources/macos-instances-helpers.d.ts +83 -0
- package/resources/macos-instances-helpers.d.ts.map +1 -1
- package/resources/macos-instances-helpers.js +89 -0
- package/resources/macos-instances-helpers.js.map +1 -1
- package/resources/macos-instances-helpers.mjs +88 -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/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/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 +43 -6
- 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 +197 -0
- package/src/resources/scoped-tokens.ts +14 -3
- package/src/resources/xcode-instances-helpers.ts +49 -19
- 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
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 {
|
|
@@ -431,7 +435,9 @@ export type DeviceInfo = {
|
|
|
431
435
|
};
|
|
432
436
|
|
|
433
437
|
export type AppInstallationResult = {
|
|
434
|
-
/** 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. */
|
|
435
441
|
url: string;
|
|
436
442
|
/** Bundle ID of the installed app */
|
|
437
443
|
bundleId: string;
|
|
@@ -1104,13 +1110,16 @@ export type InstanceClient = {
|
|
|
1104
1110
|
openUrl: (url: string) => Promise<void>;
|
|
1105
1111
|
|
|
1106
1112
|
/**
|
|
1107
|
-
* Install an app from a URL (supports .ipa or .app files, optionally zipped)
|
|
1108
|
-
* @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
|
|
1109
1115
|
* @param options Optional installation options (md5 for caching, launchMode)
|
|
1110
1116
|
* @returns The installation result with bundle ID on success
|
|
1111
1117
|
* @throws Error if installation fails (e.g., invalid app, download failure)
|
|
1112
1118
|
*/
|
|
1113
|
-
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>;
|
|
1114
1123
|
|
|
1115
1124
|
/**
|
|
1116
1125
|
* Save the simulator keychain as an unencrypted tar.gz archive at a presigned asset-storage URL.
|
|
@@ -1602,6 +1611,18 @@ export type InstanceClient = {
|
|
|
1602
1611
|
*/
|
|
1603
1612
|
pullFile: (name: string, opts?: ContainerTargetOptions) => Promise<Buffer>;
|
|
1604
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
|
+
|
|
1605
1626
|
/**
|
|
1606
1627
|
* List a directory in the simulator staging folder or an app container.
|
|
1607
1628
|
*
|
|
@@ -1877,6 +1898,7 @@ type ServerResponse = {
|
|
|
1877
1898
|
elementType?: string;
|
|
1878
1899
|
apps?: string;
|
|
1879
1900
|
url?: string;
|
|
1901
|
+
assetName?: string;
|
|
1880
1902
|
filename?: string;
|
|
1881
1903
|
bundleId?: string;
|
|
1882
1904
|
files?: LsofEntry[];
|
|
@@ -2414,6 +2436,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2414
2436
|
}),
|
|
2415
2437
|
openUrlResult: () => undefined,
|
|
2416
2438
|
appInstallationResult: (msg) => ({
|
|
2439
|
+
...(msg.assetName !== undefined && { assetName: msg.assetName }),
|
|
2417
2440
|
url: msg.url || '',
|
|
2418
2441
|
bundleId: msg.bundleId || '',
|
|
2419
2442
|
}),
|
|
@@ -2848,11 +2871,14 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
2848
2871
|
return sendRequest<void>('openUrl', { url });
|
|
2849
2872
|
};
|
|
2850
2873
|
|
|
2851
|
-
const installApp = (
|
|
2874
|
+
const installApp = (
|
|
2875
|
+
source: AssetSource,
|
|
2876
|
+
options?: AppInstallationOptions,
|
|
2877
|
+
): Promise<AppInstallationResult> => {
|
|
2852
2878
|
return sendRequest<AppInstallationResult>(
|
|
2853
2879
|
'appInstallation',
|
|
2854
2880
|
{
|
|
2855
|
-
|
|
2881
|
+
...assetSourceFields(source),
|
|
2856
2882
|
md5: options?.md5,
|
|
2857
2883
|
launchMode: options?.launchMode,
|
|
2858
2884
|
},
|
|
@@ -3398,6 +3424,15 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3398
3424
|
return Buffer.from(await response.arrayBuffer());
|
|
3399
3425
|
};
|
|
3400
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
|
+
|
|
3401
3436
|
const listFiles = async (path = '.', opts?: ContainerTargetOptions): Promise<IosFileEntry[]> => {
|
|
3402
3437
|
const params = new URLSearchParams();
|
|
3403
3438
|
if (path && path !== '.') {
|
|
@@ -3747,6 +3782,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3747
3782
|
listApps,
|
|
3748
3783
|
openUrl,
|
|
3749
3784
|
installApp,
|
|
3785
|
+
installAppByName: (assetName, options) => installApp({ assetName }, options),
|
|
3750
3786
|
saveKeychain,
|
|
3751
3787
|
restoreKeychain,
|
|
3752
3788
|
resetKeychain,
|
|
@@ -3805,6 +3841,7 @@ export async function createInstanceClient(options: InstanceClientOptions): Prom
|
|
|
3805
3841
|
xcodebuild,
|
|
3806
3842
|
pushFile,
|
|
3807
3843
|
pullFile,
|
|
3844
|
+
pull,
|
|
3808
3845
|
listFiles,
|
|
3809
3846
|
deleteFile,
|
|
3810
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 }
|
|
@@ -89,6 +104,20 @@ export interface MacosLaunchAppOptions {
|
|
|
89
104
|
env?: Record<string, string>;
|
|
90
105
|
}
|
|
91
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
|
+
|
|
92
121
|
export interface MacosLaunchAppResult {
|
|
93
122
|
bundleId: string;
|
|
94
123
|
pid: number;
|
|
@@ -112,6 +141,47 @@ export interface MacosPoint {
|
|
|
112
141
|
/** Modifier keys held while a key is pressed. */
|
|
113
142
|
export type MacosModifier = 'shift' | 'control' | 'option' | 'command';
|
|
114
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
|
+
|
|
115
185
|
/** Where the guest's SSH server can be reached once {@link MacosClient.enableSsh} returns. */
|
|
116
186
|
export interface MacosSshAccess {
|
|
117
187
|
/** The guest account the key logs in as. */
|
|
@@ -166,6 +236,34 @@ export interface MacosClient {
|
|
|
166
236
|
options?: TcpTunnelOptions & { hostname?: string },
|
|
167
237
|
): Promise<Tunnel>;
|
|
168
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
|
+
|
|
169
267
|
/** A JPEG of the screen. Its pixels are the coordinates the input methods take. */
|
|
170
268
|
screenshot(): Promise<Buffer>;
|
|
171
269
|
|
|
@@ -250,6 +348,12 @@ export interface MacosClient {
|
|
|
250
348
|
*/
|
|
251
349
|
stopSpeakerRecording(recordingId?: string, saveTo?: { localPath?: string }): Promise<string>;
|
|
252
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
|
+
|
|
253
357
|
/**
|
|
254
358
|
* Launch an app by bundle ID (`com.example.app`), name (`TextEdit`) or path
|
|
255
359
|
* (`/Applications/Safari.app`) and bring it to the front. An app launched this way has its
|
|
@@ -418,9 +522,94 @@ class MacosInstancesHelpers extends MacosInstances {
|
|
|
418
522
|
): Promise<T> =>
|
|
419
523
|
transport.request<T>(type, params, transform ?? ((() => undefined) as () => T), timeoutMs);
|
|
420
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
|
+
|
|
421
532
|
return {
|
|
422
533
|
run: createBuildRun({ apiUrl, token, log }),
|
|
423
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
|
+
|
|
424
613
|
disconnect: () => transport.disconnect(),
|
|
425
614
|
keepAlive: () => transport.keepAlive(),
|
|
426
615
|
getConnectionState: () => transport.getConnectionState(),
|
|
@@ -510,6 +699,14 @@ class MacosInstancesHelpers extends MacosInstances {
|
|
|
510
699
|
return downloadUrl;
|
|
511
700
|
},
|
|
512
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
|
+
|
|
513
710
|
launchApp(app, options) {
|
|
514
711
|
return send(
|
|
515
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
|
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
isTestingAction,
|
|
35
35
|
observeExecLogs,
|
|
36
36
|
type AppStoreUploadConfig,
|
|
37
|
+
type AppStoreConnectTeamKey,
|
|
37
38
|
type ExecChildProcess,
|
|
38
39
|
type ExecLogOptions,
|
|
39
40
|
type ExecLogResult,
|
|
@@ -42,7 +43,16 @@ import {
|
|
|
42
43
|
type XctestEvent,
|
|
43
44
|
} from '../exec-client';
|
|
44
45
|
|
|
45
|
-
export type {
|
|
46
|
+
export type {
|
|
47
|
+
AppStoreConnectInlineKey,
|
|
48
|
+
AppStoreConnectKey,
|
|
49
|
+
AppStoreConnectKeySecret,
|
|
50
|
+
AppStoreConnectTeamKey,
|
|
51
|
+
AppStoreUploadConfig,
|
|
52
|
+
ExecLogOptions,
|
|
53
|
+
ExecLogResult,
|
|
54
|
+
WebhookConfig,
|
|
55
|
+
} from '../exec-client';
|
|
46
56
|
import {
|
|
47
57
|
syncFolder as syncFolderImpl,
|
|
48
58
|
type AdditionalFileSyncEntry,
|
|
@@ -218,6 +228,20 @@ export type XcodeSigningConfig = {
|
|
|
218
228
|
* are matched to bundles by the application-identifier inside them.
|
|
219
229
|
*/
|
|
220
230
|
provisioningProfilesBase64?: string[];
|
|
231
|
+
/**
|
|
232
|
+
* Secret ID or name/<exact name> holding the signing certificate, read by
|
|
233
|
+
* the build itself instead of certificateP12Base64 and certificatePassword.
|
|
234
|
+
* The value is the JSON saved for an appleCertificate. The instance role
|
|
235
|
+
* needs `secret:<target>:read`. Requires a server with credential secret
|
|
236
|
+
* support.
|
|
237
|
+
*/
|
|
238
|
+
certificateSecret?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Secrets holding provisioning profiles saved for appleProvisioningProfile.
|
|
241
|
+
* The build adds them to provisioningProfilesBase64. The instance role
|
|
242
|
+
* needs `secret:<target>:read` for each.
|
|
243
|
+
*/
|
|
244
|
+
provisioningProfileSecrets?: string[];
|
|
221
245
|
};
|
|
222
246
|
|
|
223
247
|
export type XcodeCloudSigningMethod = 'app-store-connect' | 'release-testing' | 'debugging';
|
|
@@ -230,9 +254,6 @@ export type XcodeCloudSigningMethod = 'app-store-connect' | 'release-testing' |
|
|
|
230
254
|
export type XcodeCloudSigningConfig = {
|
|
231
255
|
method: XcodeCloudSigningMethod;
|
|
232
256
|
teamId: string;
|
|
233
|
-
apiKeyId: string;
|
|
234
|
-
apiIssuerId: string;
|
|
235
|
-
apiPrivateKeyBase64: string;
|
|
236
257
|
/**
|
|
237
258
|
* Base64-encoded entitlements plists keyed by bundle id, embedded into
|
|
238
259
|
* the archive so cloud signing preserves capability entitlements
|
|
@@ -242,7 +263,7 @@ export type XcodeCloudSigningConfig = {
|
|
|
242
263
|
* limbuild servers silently ignore this field.
|
|
243
264
|
*/
|
|
244
265
|
entitlements?: Record<string, string>;
|
|
245
|
-
};
|
|
266
|
+
} & AppStoreConnectTeamKey;
|
|
246
267
|
|
|
247
268
|
export type ReactNativeBuildConfig = {
|
|
248
269
|
/**
|
|
@@ -318,19 +339,23 @@ export type XcodeBuildOptions = {
|
|
|
318
339
|
*/
|
|
319
340
|
gitInit?: boolean;
|
|
320
341
|
/**
|
|
321
|
-
* Build a Debug
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
342
|
+
* Build a Debug app whose Swift code later builds can replace while it runs:
|
|
343
|
+
* an iOS simulator app on the attached simulator or, with the macosx sdk, a
|
|
344
|
+
* Mac app on the attached macOS instance. When a later build with this
|
|
345
|
+
* option changed only Swift code, the running app shows the edit as the
|
|
346
|
+
* build ends and keeps its state; any other build is installed and launched
|
|
347
|
+
* as usual. Lines starting with "Hot reload:" in the build output say which
|
|
348
|
+
* happened.
|
|
326
349
|
*
|
|
327
|
-
* Needs
|
|
328
|
-
* build. Only the iphonesimulator
|
|
329
|
-
*
|
|
330
|
-
* projects are built normally: Fast Refresh
|
|
331
|
-
* edits. Code that already ran, such as app
|
|
332
|
-
* before a reload keep their old behavior
|
|
333
|
-
* limbuild servers silently ignore this
|
|
350
|
+
* Needs the simulator or macOS instance to be attached; without it the
|
|
351
|
+
* build is a normal Debug build. Only the iphonesimulator and macosx sdks
|
|
352
|
+
* and the Debug configuration are supported, and the configuration defaults
|
|
353
|
+
* to Debug. React Native and Expo projects are built normally: Fast Refresh
|
|
354
|
+
* already shows their JavaScript edits. Code that already ran, such as app
|
|
355
|
+
* startup, and closures created before a reload keep their old behavior
|
|
356
|
+
* until the app restarts. Older limbuild servers silently ignore this
|
|
357
|
+
* option; one that reloads simulator apps only refuses it for the macosx
|
|
358
|
+
* sdk.
|
|
334
359
|
*/
|
|
335
360
|
hotReload?: boolean;
|
|
336
361
|
/** How xcodebuild stdout is processed before streaming. Defaults to 'xcbeautify'. */
|
|
@@ -1118,8 +1143,13 @@ export class XcodeInstances extends GeneratedXcodeInstances {
|
|
|
1118
1143
|
if (options?.hotReload && settings?.configuration === 'Release') {
|
|
1119
1144
|
throw new Error('hotReload is only supported for Debug builds');
|
|
1120
1145
|
}
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1146
|
+
if (
|
|
1147
|
+
options?.hotReload &&
|
|
1148
|
+
settings?.sdk !== undefined &&
|
|
1149
|
+
settings.sdk !== 'iphonesimulator' &&
|
|
1150
|
+
settings.sdk !== 'macosx'
|
|
1151
|
+
) {
|
|
1152
|
+
throw new Error('hotReload requires the iphonesimulator or macosx sdk');
|
|
1123
1153
|
}
|
|
1124
1154
|
if (settings?.onlyTesting?.length && settings?.skipTesting?.length) {
|
|
1125
1155
|
throw new Error('onlyTesting and skipTesting are mutually exclusive; pass one');
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.80.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.80.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.80.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.80.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|