@limrun/api 0.49.0 → 0.49.2
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 +8 -0
- package/build-settings.d.mts.map +1 -1
- package/build-settings.d.ts.map +1 -1
- package/build-settings.js +4 -5
- package/build-settings.js.map +1 -1
- package/build-settings.mjs +4 -5
- package/build-settings.mjs.map +1 -1
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/exec-client.d.mts +9 -0
- package/exec-client.d.mts.map +1 -1
- package/exec-client.d.ts +9 -0
- package/exec-client.d.ts.map +1 -1
- package/exec-client.js.map +1 -1
- package/exec-client.mjs.map +1 -1
- package/index.d.mts +2 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +5 -2
- package/index.js.map +1 -1
- package/index.mjs +2 -1
- package/index.mjs.map +1 -1
- package/instance-client.d.mts +2 -0
- package/instance-client.d.mts.map +1 -1
- package/instance-client.d.ts +2 -0
- package/instance-client.d.ts.map +1 -1
- package/instance-client.js.map +1 -1
- package/instance-client.mjs.map +1 -1
- package/ios-client.d.mts +3 -1
- package/ios-client.d.mts.map +1 -1
- package/ios-client.d.ts +3 -1
- package/ios-client.d.ts.map +1 -1
- package/ios-client.js.map +1 -1
- package/ios-client.mjs.map +1 -1
- package/package.json +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 +2 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/xcode-instances-helpers.d.mts +57 -0
- package/resources/xcode-instances-helpers.d.mts.map +1 -1
- package/resources/xcode-instances-helpers.d.ts +57 -0
- package/resources/xcode-instances-helpers.d.ts.map +1 -1
- package/resources/xcode-instances-helpers.js +49 -3
- package/resources/xcode-instances-helpers.js.map +1 -1
- package/resources/xcode-instances-helpers.mjs +47 -2
- package/resources/xcode-instances-helpers.mjs.map +1 -1
- package/src/build-settings.ts +4 -5
- package/src/client.ts +8 -0
- package/src/exec-client.ts +9 -0
- package/src/index.ts +6 -0
- package/src/instance-client.ts +2 -0
- package/src/ios-client.ts +3 -1
- package/src/resources/index.ts +5 -0
- package/src/resources/xcode-instances-helpers.ts +118 -5
- 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/index.ts
CHANGED
|
@@ -103,8 +103,13 @@ export {
|
|
|
103
103
|
type RbeBuildSummary,
|
|
104
104
|
type Tunnel,
|
|
105
105
|
RbeUnsupportedError,
|
|
106
|
+
XcodeSelectionUnsupportedError,
|
|
106
107
|
deriveRbeTunnelUrl,
|
|
107
108
|
DEFAULT_RBE_TUNNEL_PORT,
|
|
109
|
+
type XcodeInfo,
|
|
110
|
+
type XcodeStatus,
|
|
111
|
+
type XcodeSelectResult,
|
|
112
|
+
type SandboxInfo,
|
|
108
113
|
type XcodeProjectConfig,
|
|
109
114
|
type XcodeBuildOptions,
|
|
110
115
|
type XcodeRunOptions,
|
|
@@ -195,3 +200,4 @@ export {
|
|
|
195
200
|
PermissionDeniedError,
|
|
196
201
|
UnprocessableEntityError,
|
|
197
202
|
} from './core/error';
|
|
203
|
+
export { isDirectInstanceHttpError, type DirectInstanceHttpError } from './internal/direct-instance-errors';
|
package/src/instance-client.ts
CHANGED
|
@@ -629,6 +629,8 @@ export type InstalledApp = {
|
|
|
629
629
|
installType: string;
|
|
630
630
|
/** App icon as a base64-encoded 64px PNG; absent when the runtime could not extract one. */
|
|
631
631
|
icon?: string;
|
|
632
|
+
/** Install time as epoch milliseconds; absent when the runtime cannot tell. */
|
|
633
|
+
installedAt?: number;
|
|
632
634
|
};
|
|
633
635
|
|
|
634
636
|
/** Handle for an app watch registered via {@link InstanceClient.watchApp}. */
|
package/src/ios-client.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function deriveReverseTunnelUrl(apiUrl: string, remotePort: number): stri
|
|
|
70
70
|
export type { ReverseTunnel } from './tunnel';
|
|
71
71
|
export type Tunnel = DestinationTcpTunnel;
|
|
72
72
|
export type TunnelOptions = {
|
|
73
|
-
/** Exact endpoint selector values
|
|
73
|
+
/** Exact endpoint (host:port) and domain selector values; the server asks this client to dial exact endpoints and intercepted domains. */
|
|
74
74
|
selectors: DestinationTunnelSelectors;
|
|
75
75
|
/** Controls tunnel logging verbosity. Defaults to the instance client's log level. */
|
|
76
76
|
logLevel?: LogLevel;
|
|
@@ -243,6 +243,8 @@ export type InstalledApp = {
|
|
|
243
243
|
installType: string;
|
|
244
244
|
/** App icon as a base64-encoded 64px PNG; absent when the runtime could not extract one. */
|
|
245
245
|
icon?: string;
|
|
246
|
+
/** Install time as epoch milliseconds; absent when the runtime cannot tell (e.g. iOS system apps). */
|
|
247
|
+
installedAt?: number;
|
|
246
248
|
};
|
|
247
249
|
|
|
248
250
|
export type LsofEntry = {
|
package/src/resources/index.ts
CHANGED
|
@@ -56,7 +56,12 @@ export {
|
|
|
56
56
|
export {
|
|
57
57
|
XcodeInstances,
|
|
58
58
|
RbeUnsupportedError,
|
|
59
|
+
XcodeSelectionUnsupportedError,
|
|
59
60
|
DEFAULT_RBE_TUNNEL_PORT,
|
|
61
|
+
type XcodeInfo,
|
|
62
|
+
type XcodeStatus,
|
|
63
|
+
type XcodeSelectResult,
|
|
64
|
+
type SandboxInfo,
|
|
60
65
|
type XcodeCreateClientParams,
|
|
61
66
|
type XcodeClient,
|
|
62
67
|
type XcodeProjectConfig,
|
|
@@ -373,6 +373,46 @@ export type RbeStatus = {
|
|
|
373
373
|
/** Default local TCP port the RBE tunnel listens on. */
|
|
374
374
|
export const DEFAULT_RBE_TUNNEL_PORT = 8980;
|
|
375
375
|
|
|
376
|
+
/** One Xcode installed on the sandbox's node, as reported by limbuild's /xcode. */
|
|
377
|
+
export type XcodeInfo = {
|
|
378
|
+
/** Major version, e.g. "27". Empty on nodes that predate the Xcode inventory. */
|
|
379
|
+
major: string;
|
|
380
|
+
/** Short version, e.g. "27.0". */
|
|
381
|
+
version: string;
|
|
382
|
+
/** Build, e.g. "27A5252f". */
|
|
383
|
+
build: string;
|
|
384
|
+
/**
|
|
385
|
+
* The version key builds and caches are stamped with (major.minor.patch.build,
|
|
386
|
+
* e.g. 27.0.0.27A5252f). Empty until resolved on a cold node.
|
|
387
|
+
*/
|
|
388
|
+
versionKey: string;
|
|
389
|
+
developerDir: string;
|
|
390
|
+
/** Apple's seed number when this Xcode is a beta ("6" for beta 6). Absent for a release. */
|
|
391
|
+
betaSeed?: string;
|
|
392
|
+
/** Whether this is the Xcode the sandbox binds to when nothing was selected. */
|
|
393
|
+
nodeDefault: boolean;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/** The sandbox's Xcode binding and the Xcodes it can switch to. */
|
|
397
|
+
export type XcodeStatus = {
|
|
398
|
+
bound: XcodeInfo;
|
|
399
|
+
installed: XcodeInfo[];
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/** Result of binding the sandbox to an Xcode major. */
|
|
403
|
+
export type XcodeSelectResult = {
|
|
404
|
+
bound: XcodeInfo;
|
|
405
|
+
alreadyBound: boolean;
|
|
406
|
+
/** Whether synced projects lost their DerivedData because the Xcode changed. */
|
|
407
|
+
derivedDataReset: boolean;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
/** limbuild's GET /info: the sandbox home and, on daemons that support selection, its Xcode. */
|
|
411
|
+
export type SandboxInfo = {
|
|
412
|
+
homeDir: string;
|
|
413
|
+
xcode?: XcodeInfo;
|
|
414
|
+
};
|
|
415
|
+
|
|
376
416
|
export type RbeStartOptions = {
|
|
377
417
|
/** Max size of the content-addressable store (CAS), in bytes. */
|
|
378
418
|
casMaxBytes?: number;
|
|
@@ -498,6 +538,22 @@ export type XcodeClient = {
|
|
|
498
538
|
*/
|
|
499
539
|
getSimulator: () => Promise<SimulatorStatus>;
|
|
500
540
|
|
|
541
|
+
/**
|
|
542
|
+
* Return the Xcode this sandbox builds with and the Xcodes installed on its node.
|
|
543
|
+
* Throws XcodeSelectionUnsupportedError on a sandbox whose daemon predates selection.
|
|
544
|
+
*/
|
|
545
|
+
getXcode: () => Promise<XcodeStatus>;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Bind the sandbox to an installed Xcode major (e.g. "27"). Switching resets every
|
|
549
|
+
* synced project's DerivedData. Refused (HTTP 409) while a build, command, sync, or
|
|
550
|
+
* the RBE stack is running, and (HTTP 400) when the major is not installed.
|
|
551
|
+
*/
|
|
552
|
+
setXcode: (major: string) => Promise<XcodeSelectResult>;
|
|
553
|
+
|
|
554
|
+
/** Return the sandbox's home directory and, when the daemon reports it, its Xcode. */
|
|
555
|
+
getInfo: () => Promise<SandboxInfo>;
|
|
556
|
+
|
|
501
557
|
/**
|
|
502
558
|
* Start the instance's embedded Bazel Remote Build Execution stack.
|
|
503
559
|
* Idempotent: returns the running status when already up.
|
|
@@ -591,19 +647,20 @@ function normalizeWorkspaceRelativePath(remotePath: string): string {
|
|
|
591
647
|
return parts.join('/');
|
|
592
648
|
}
|
|
593
649
|
|
|
594
|
-
async function fetchSandboxInfo(apiUrl: string, token: string): Promise<
|
|
650
|
+
async function fetchSandboxInfo(apiUrl: string, token: string): Promise<SandboxInfo> {
|
|
595
651
|
const res = await nodeProxyTransport.fetch(`${apiUrl}/info`, {
|
|
596
652
|
method: 'GET',
|
|
597
653
|
headers: {
|
|
598
654
|
Authorization: `Bearer ${token}`,
|
|
599
655
|
},
|
|
600
656
|
});
|
|
601
|
-
const body = await readJsonResponse<{ homeDir?: string }>(res, 'GET /info');
|
|
657
|
+
const body = await readJsonResponse<{ homeDir?: string; xcode?: XcodeInfo }>(res, 'GET /info');
|
|
602
658
|
if (!body.homeDir) {
|
|
603
659
|
throw new Error('GET /info response is missing homeDir');
|
|
604
660
|
}
|
|
605
661
|
return {
|
|
606
662
|
homeDir: normalizeWorkspaceRelativePath(body.homeDir),
|
|
663
|
+
...(body.xcode ? { xcode: body.xcode } : {}),
|
|
607
664
|
};
|
|
608
665
|
}
|
|
609
666
|
|
|
@@ -646,14 +703,46 @@ export class RbeUnsupportedError extends LimrunError {
|
|
|
646
703
|
}
|
|
647
704
|
}
|
|
648
705
|
|
|
706
|
+
/**
|
|
707
|
+
* Raised when an `/xcode` request returns 404: the sandbox's daemon predates Xcode
|
|
708
|
+
* version selection. Distinct from NotFoundError for the same reason as
|
|
709
|
+
* RbeUnsupportedError: the instance exists, only the feature is missing.
|
|
710
|
+
*/
|
|
711
|
+
export class XcodeSelectionUnsupportedError extends LimrunError {
|
|
712
|
+
constructor(operation: string) {
|
|
713
|
+
super(
|
|
714
|
+
`Xcode version selection is not available on this sandbox (${operation} returned 404): ` +
|
|
715
|
+
'its daemon predates Xcode selection. Create a new sandbox, or omit the Xcode version to build with its default.',
|
|
716
|
+
);
|
|
717
|
+
this.name = 'XcodeSelectionUnsupportedError';
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/** Reads an `/xcode` JSON response, mapping a 404 to XcodeSelectionUnsupportedError. */
|
|
722
|
+
function readXcodeResponse<T>(res: Response, operation: string): Promise<T> {
|
|
723
|
+
return readOrUnsupported<T>(res, operation, (op) => new XcodeSelectionUnsupportedError(op));
|
|
724
|
+
}
|
|
725
|
+
|
|
649
726
|
/**
|
|
650
727
|
* Reads an `/rbe` JSON response, mapping a 404 to RbeUnsupportedError (a route
|
|
651
728
|
* 404 means RBE is not supported here, never a missing instance).
|
|
652
729
|
*/
|
|
653
|
-
|
|
730
|
+
function readRbeResponse<T>(res: Response, operation: string): Promise<T> {
|
|
731
|
+
return readOrUnsupported<T>(res, operation, (op) => new RbeUnsupportedError(op));
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Reads a JSON response from a limbuild route that only newer daemons serve: a 404 there means
|
|
736
|
+
* the feature is missing, never that the instance is (the caller's error class says which).
|
|
737
|
+
*/
|
|
738
|
+
async function readOrUnsupported<T>(
|
|
739
|
+
res: Response,
|
|
740
|
+
operation: string,
|
|
741
|
+
unsupported: (operation: string) => Error,
|
|
742
|
+
): Promise<T> {
|
|
654
743
|
if (res.status === 404) {
|
|
655
744
|
await res.text().catch(() => undefined);
|
|
656
|
-
throw
|
|
745
|
+
throw unsupported(operation);
|
|
657
746
|
}
|
|
658
747
|
return readJsonResponse<T>(res, operation);
|
|
659
748
|
}
|
|
@@ -777,7 +866,7 @@ export class XcodeInstances extends GeneratedXcodeInstances {
|
|
|
777
866
|
|
|
778
867
|
const log = createDaemonLogger('[XcodeInstance]', params.logLevel ?? 'info');
|
|
779
868
|
const client = this._client;
|
|
780
|
-
let sandboxInfoPromise: Promise<
|
|
869
|
+
let sandboxInfoPromise: Promise<SandboxInfo> | undefined;
|
|
781
870
|
const getSandboxInfo = () => {
|
|
782
871
|
sandboxInfoPromise ??= fetchSandboxInfo(apiUrl, token);
|
|
783
872
|
return sandboxInfoPromise;
|
|
@@ -996,6 +1085,30 @@ export class XcodeInstances extends GeneratedXcodeInstances {
|
|
|
996
1085
|
attachNewSimulator: attachNewSimulatorImpl,
|
|
997
1086
|
deleteSimulator: deleteSimulatorImpl,
|
|
998
1087
|
|
|
1088
|
+
async getXcode(): Promise<XcodeStatus> {
|
|
1089
|
+
const res = await nodeProxyTransport.fetch(`${apiUrl}/xcode`, {
|
|
1090
|
+
method: 'GET',
|
|
1091
|
+
headers: {
|
|
1092
|
+
Authorization: `Bearer ${token}`,
|
|
1093
|
+
},
|
|
1094
|
+
});
|
|
1095
|
+
return readXcodeResponse<XcodeStatus>(res, 'GET /xcode');
|
|
1096
|
+
},
|
|
1097
|
+
|
|
1098
|
+
async setXcode(major: string): Promise<XcodeSelectResult> {
|
|
1099
|
+
const res = await nodeProxyTransport.fetch(`${apiUrl}/xcode`, {
|
|
1100
|
+
method: 'POST',
|
|
1101
|
+
headers: {
|
|
1102
|
+
'Content-Type': 'application/json',
|
|
1103
|
+
Authorization: `Bearer ${token}`,
|
|
1104
|
+
},
|
|
1105
|
+
body: JSON.stringify({ version: major }),
|
|
1106
|
+
});
|
|
1107
|
+
return readXcodeResponse<XcodeSelectResult>(res, 'POST /xcode');
|
|
1108
|
+
},
|
|
1109
|
+
|
|
1110
|
+
getInfo: () => fetchSandboxInfo(apiUrl, token),
|
|
1111
|
+
|
|
999
1112
|
async startRbe(opts?: RbeStartOptions): Promise<RbeStatus> {
|
|
1000
1113
|
const res = await nodeProxyTransport.fetch(`${apiUrl}/rbe`, {
|
|
1001
1114
|
method: 'POST',
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.49.
|
|
1
|
+
export const VERSION = '0.49.2'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.49.
|
|
1
|
+
export declare const VERSION = "0.49.2";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.49.
|
|
1
|
+
export declare const VERSION = "0.49.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.49.
|
|
1
|
+
export const VERSION = '0.49.2'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|