@limrun/api 0.49.0 → 0.49.1
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 +4 -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 +55 -0
- package/resources/xcode-instances-helpers.d.mts.map +1 -1
- package/resources/xcode-instances-helpers.d.ts +55 -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 +116 -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,44 @@ 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
|
+
/** Whether this is the Xcode the sandbox binds to when nothing was selected. */
|
|
391
|
+
nodeDefault: boolean;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/** The sandbox's Xcode binding and the Xcodes it can switch to. */
|
|
395
|
+
export type XcodeStatus = {
|
|
396
|
+
bound: XcodeInfo;
|
|
397
|
+
installed: XcodeInfo[];
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
/** Result of binding the sandbox to an Xcode major. */
|
|
401
|
+
export type XcodeSelectResult = {
|
|
402
|
+
bound: XcodeInfo;
|
|
403
|
+
alreadyBound: boolean;
|
|
404
|
+
/** Whether synced projects lost their DerivedData because the Xcode changed. */
|
|
405
|
+
derivedDataReset: boolean;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/** limbuild's GET /info: the sandbox home and, on daemons that support selection, its Xcode. */
|
|
409
|
+
export type SandboxInfo = {
|
|
410
|
+
homeDir: string;
|
|
411
|
+
xcode?: XcodeInfo;
|
|
412
|
+
};
|
|
413
|
+
|
|
376
414
|
export type RbeStartOptions = {
|
|
377
415
|
/** Max size of the content-addressable store (CAS), in bytes. */
|
|
378
416
|
casMaxBytes?: number;
|
|
@@ -498,6 +536,22 @@ export type XcodeClient = {
|
|
|
498
536
|
*/
|
|
499
537
|
getSimulator: () => Promise<SimulatorStatus>;
|
|
500
538
|
|
|
539
|
+
/**
|
|
540
|
+
* Return the Xcode this sandbox builds with and the Xcodes installed on its node.
|
|
541
|
+
* Throws XcodeSelectionUnsupportedError on a sandbox whose daemon predates selection.
|
|
542
|
+
*/
|
|
543
|
+
getXcode: () => Promise<XcodeStatus>;
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Bind the sandbox to an installed Xcode major (e.g. "27"). Switching resets every
|
|
547
|
+
* synced project's DerivedData. Refused (HTTP 409) while a build, command, sync, or
|
|
548
|
+
* the RBE stack is running, and (HTTP 400) when the major is not installed.
|
|
549
|
+
*/
|
|
550
|
+
setXcode: (major: string) => Promise<XcodeSelectResult>;
|
|
551
|
+
|
|
552
|
+
/** Return the sandbox's home directory and, when the daemon reports it, its Xcode. */
|
|
553
|
+
getInfo: () => Promise<SandboxInfo>;
|
|
554
|
+
|
|
501
555
|
/**
|
|
502
556
|
* Start the instance's embedded Bazel Remote Build Execution stack.
|
|
503
557
|
* Idempotent: returns the running status when already up.
|
|
@@ -591,19 +645,20 @@ function normalizeWorkspaceRelativePath(remotePath: string): string {
|
|
|
591
645
|
return parts.join('/');
|
|
592
646
|
}
|
|
593
647
|
|
|
594
|
-
async function fetchSandboxInfo(apiUrl: string, token: string): Promise<
|
|
648
|
+
async function fetchSandboxInfo(apiUrl: string, token: string): Promise<SandboxInfo> {
|
|
595
649
|
const res = await nodeProxyTransport.fetch(`${apiUrl}/info`, {
|
|
596
650
|
method: 'GET',
|
|
597
651
|
headers: {
|
|
598
652
|
Authorization: `Bearer ${token}`,
|
|
599
653
|
},
|
|
600
654
|
});
|
|
601
|
-
const body = await readJsonResponse<{ homeDir?: string }>(res, 'GET /info');
|
|
655
|
+
const body = await readJsonResponse<{ homeDir?: string; xcode?: XcodeInfo }>(res, 'GET /info');
|
|
602
656
|
if (!body.homeDir) {
|
|
603
657
|
throw new Error('GET /info response is missing homeDir');
|
|
604
658
|
}
|
|
605
659
|
return {
|
|
606
660
|
homeDir: normalizeWorkspaceRelativePath(body.homeDir),
|
|
661
|
+
...(body.xcode ? { xcode: body.xcode } : {}),
|
|
607
662
|
};
|
|
608
663
|
}
|
|
609
664
|
|
|
@@ -646,14 +701,46 @@ export class RbeUnsupportedError extends LimrunError {
|
|
|
646
701
|
}
|
|
647
702
|
}
|
|
648
703
|
|
|
704
|
+
/**
|
|
705
|
+
* Raised when an `/xcode` request returns 404: the sandbox's daemon predates Xcode
|
|
706
|
+
* version selection. Distinct from NotFoundError for the same reason as
|
|
707
|
+
* RbeUnsupportedError: the instance exists, only the feature is missing.
|
|
708
|
+
*/
|
|
709
|
+
export class XcodeSelectionUnsupportedError extends LimrunError {
|
|
710
|
+
constructor(operation: string) {
|
|
711
|
+
super(
|
|
712
|
+
`Xcode version selection is not available on this sandbox (${operation} returned 404): ` +
|
|
713
|
+
'its daemon predates Xcode selection. Create a new sandbox, or omit the Xcode version to build with its default.',
|
|
714
|
+
);
|
|
715
|
+
this.name = 'XcodeSelectionUnsupportedError';
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/** Reads an `/xcode` JSON response, mapping a 404 to XcodeSelectionUnsupportedError. */
|
|
720
|
+
function readXcodeResponse<T>(res: Response, operation: string): Promise<T> {
|
|
721
|
+
return readOrUnsupported<T>(res, operation, (op) => new XcodeSelectionUnsupportedError(op));
|
|
722
|
+
}
|
|
723
|
+
|
|
649
724
|
/**
|
|
650
725
|
* Reads an `/rbe` JSON response, mapping a 404 to RbeUnsupportedError (a route
|
|
651
726
|
* 404 means RBE is not supported here, never a missing instance).
|
|
652
727
|
*/
|
|
653
|
-
|
|
728
|
+
function readRbeResponse<T>(res: Response, operation: string): Promise<T> {
|
|
729
|
+
return readOrUnsupported<T>(res, operation, (op) => new RbeUnsupportedError(op));
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Reads a JSON response from a limbuild route that only newer daemons serve: a 404 there means
|
|
734
|
+
* the feature is missing, never that the instance is (the caller's error class says which).
|
|
735
|
+
*/
|
|
736
|
+
async function readOrUnsupported<T>(
|
|
737
|
+
res: Response,
|
|
738
|
+
operation: string,
|
|
739
|
+
unsupported: (operation: string) => Error,
|
|
740
|
+
): Promise<T> {
|
|
654
741
|
if (res.status === 404) {
|
|
655
742
|
await res.text().catch(() => undefined);
|
|
656
|
-
throw
|
|
743
|
+
throw unsupported(operation);
|
|
657
744
|
}
|
|
658
745
|
return readJsonResponse<T>(res, operation);
|
|
659
746
|
}
|
|
@@ -777,7 +864,7 @@ export class XcodeInstances extends GeneratedXcodeInstances {
|
|
|
777
864
|
|
|
778
865
|
const log = createDaemonLogger('[XcodeInstance]', params.logLevel ?? 'info');
|
|
779
866
|
const client = this._client;
|
|
780
|
-
let sandboxInfoPromise: Promise<
|
|
867
|
+
let sandboxInfoPromise: Promise<SandboxInfo> | undefined;
|
|
781
868
|
const getSandboxInfo = () => {
|
|
782
869
|
sandboxInfoPromise ??= fetchSandboxInfo(apiUrl, token);
|
|
783
870
|
return sandboxInfoPromise;
|
|
@@ -996,6 +1083,30 @@ export class XcodeInstances extends GeneratedXcodeInstances {
|
|
|
996
1083
|
attachNewSimulator: attachNewSimulatorImpl,
|
|
997
1084
|
deleteSimulator: deleteSimulatorImpl,
|
|
998
1085
|
|
|
1086
|
+
async getXcode(): Promise<XcodeStatus> {
|
|
1087
|
+
const res = await nodeProxyTransport.fetch(`${apiUrl}/xcode`, {
|
|
1088
|
+
method: 'GET',
|
|
1089
|
+
headers: {
|
|
1090
|
+
Authorization: `Bearer ${token}`,
|
|
1091
|
+
},
|
|
1092
|
+
});
|
|
1093
|
+
return readXcodeResponse<XcodeStatus>(res, 'GET /xcode');
|
|
1094
|
+
},
|
|
1095
|
+
|
|
1096
|
+
async setXcode(major: string): Promise<XcodeSelectResult> {
|
|
1097
|
+
const res = await nodeProxyTransport.fetch(`${apiUrl}/xcode`, {
|
|
1098
|
+
method: 'POST',
|
|
1099
|
+
headers: {
|
|
1100
|
+
'Content-Type': 'application/json',
|
|
1101
|
+
Authorization: `Bearer ${token}`,
|
|
1102
|
+
},
|
|
1103
|
+
body: JSON.stringify({ version: major }),
|
|
1104
|
+
});
|
|
1105
|
+
return readXcodeResponse<XcodeSelectResult>(res, 'POST /xcode');
|
|
1106
|
+
},
|
|
1107
|
+
|
|
1108
|
+
getInfo: () => fetchSandboxInfo(apiUrl, token),
|
|
1109
|
+
|
|
999
1110
|
async startRbe(opts?: RbeStartOptions): Promise<RbeStatus> {
|
|
1000
1111
|
const res = await nodeProxyTransport.fetch(`${apiUrl}/rbe`, {
|
|
1001
1112
|
method: 'POST',
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.49.
|
|
1
|
+
export const VERSION = '0.49.1'; // 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.1";
|
|
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.1";
|
|
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.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|