@limrun/api 0.35.0 → 0.36.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 +12 -0
- package/index.d.mts +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/sse-fetch.d.mts +11 -0
- package/internal/sse-fetch.d.mts.map +1 -0
- package/internal/sse-fetch.d.ts +11 -0
- package/internal/sse-fetch.d.ts.map +1 -0
- package/internal/sse-fetch.js +23 -0
- package/internal/sse-fetch.js.map +1 -0
- package/internal/sse-fetch.mjs +20 -0
- package/internal/sse-fetch.mjs.map +1 -0
- package/ios-client.d.mts +15 -0
- package/ios-client.d.mts.map +1 -1
- package/ios-client.d.ts +15 -0
- package/ios-client.d.ts.map +1 -1
- package/ios-client.js +12 -0
- package/ios-client.js.map +1 -1
- package/ios-client.mjs +12 -0
- package/ios-client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/assets-helpers.d.mts +11 -1
- package/resources/assets-helpers.d.mts.map +1 -1
- package/resources/assets-helpers.d.ts +11 -1
- package/resources/assets-helpers.d.ts.map +1 -1
- package/resources/assets-helpers.js +6 -0
- package/resources/assets-helpers.js.map +1 -1
- package/resources/assets-helpers.mjs +6 -0
- package/resources/assets-helpers.mjs.map +1 -1
- package/resources/assets.d.mts +14 -3
- package/resources/assets.d.mts.map +1 -1
- package/resources/assets.d.ts +14 -3
- package/resources/assets.d.ts.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/ios-instances.d.mts +1 -1
- package/resources/ios-instances.d.mts.map +1 -1
- package/resources/ios-instances.d.ts +1 -1
- package/resources/ios-instances.d.ts.map +1 -1
- package/resources/xcode-instances-helpers.d.mts +32 -0
- package/resources/xcode-instances-helpers.d.mts.map +1 -1
- package/resources/xcode-instances-helpers.d.ts +32 -0
- package/resources/xcode-instances-helpers.d.ts.map +1 -1
- package/resources/xcode-instances-helpers.js +68 -0
- package/resources/xcode-instances-helpers.js.map +1 -1
- package/resources/xcode-instances-helpers.mjs +68 -0
- package/resources/xcode-instances-helpers.mjs.map +1 -1
- package/src/index.ts +2 -0
- package/src/internal/sse-fetch.ts +20 -0
- package/src/ios-client.ts +35 -0
- package/src/resources/assets-helpers.ts +19 -1
- package/src/resources/assets.ts +23 -2
- package/src/resources/index.ts +2 -0
- package/src/resources/ios-instances.ts +1 -1
- package/src/resources/xcode-instances-helpers.ts +113 -0
- 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/resources/assets.ts
CHANGED
|
@@ -56,6 +56,8 @@ export interface Asset {
|
|
|
56
56
|
|
|
57
57
|
name: string;
|
|
58
58
|
|
|
59
|
+
kind: AssetKind;
|
|
60
|
+
|
|
59
61
|
/**
|
|
60
62
|
* Human-readable display name for the asset. If not set, the name should be used.
|
|
61
63
|
*/
|
|
@@ -72,10 +74,10 @@ export interface Asset {
|
|
|
72
74
|
md5?: string;
|
|
73
75
|
|
|
74
76
|
/**
|
|
75
|
-
* The
|
|
77
|
+
* The platform this asset is for. If not set, the asset is available for
|
|
76
78
|
* all platforms.
|
|
77
79
|
*/
|
|
78
|
-
|
|
80
|
+
platform?: AssetPlatform;
|
|
79
81
|
|
|
80
82
|
signedDownloadUrl?: string;
|
|
81
83
|
|
|
@@ -89,10 +91,14 @@ export interface AssetGetOrCreateResponse {
|
|
|
89
91
|
|
|
90
92
|
name: string;
|
|
91
93
|
|
|
94
|
+
kind: AssetKind;
|
|
95
|
+
|
|
92
96
|
signedDownloadUrl: string;
|
|
93
97
|
|
|
94
98
|
signedUploadUrl: string;
|
|
95
99
|
|
|
100
|
+
platform?: AssetPlatform;
|
|
101
|
+
|
|
96
102
|
/**
|
|
97
103
|
* When set, the time after which the asset is automatically deleted.
|
|
98
104
|
*/
|
|
@@ -121,6 +127,11 @@ export interface AssetListParams {
|
|
|
121
127
|
*/
|
|
122
128
|
includeUploadUrl?: boolean;
|
|
123
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Filters assets by kind.
|
|
132
|
+
*/
|
|
133
|
+
kindFilter?: AssetKind;
|
|
134
|
+
|
|
124
135
|
/**
|
|
125
136
|
* Maximum number of items to be returned. The default is 50.
|
|
126
137
|
*/
|
|
@@ -160,6 +171,10 @@ export interface AssetGetParams {
|
|
|
160
171
|
export interface AssetGetOrCreateParams {
|
|
161
172
|
name: string;
|
|
162
173
|
|
|
174
|
+
kind?: AssetKind;
|
|
175
|
+
|
|
176
|
+
platform?: AssetPlatform;
|
|
177
|
+
|
|
163
178
|
/**
|
|
164
179
|
* Optional time-to-live as a Go duration string (e.g. "24h"). When set, the asset
|
|
165
180
|
* is deleted this long after now; minimum is 1m. Omit for no expiry. On re-upload
|
|
@@ -169,9 +184,15 @@ export interface AssetGetOrCreateParams {
|
|
|
169
184
|
ttl?: string;
|
|
170
185
|
}
|
|
171
186
|
|
|
187
|
+
export type AssetKind = 'App' | 'Keychain';
|
|
188
|
+
|
|
189
|
+
export type AssetPlatform = 'ios' | 'android' | 'xcode';
|
|
190
|
+
|
|
172
191
|
export declare namespace Assets {
|
|
173
192
|
export {
|
|
174
193
|
type Asset as Asset,
|
|
194
|
+
type AssetKind as AssetKind,
|
|
195
|
+
type AssetPlatform as AssetPlatform,
|
|
175
196
|
type AssetListResponse as AssetListResponse,
|
|
176
197
|
type AssetGetOrCreateResponse as AssetGetOrCreateResponse,
|
|
177
198
|
type AssetListParams as AssetListParams,
|
package/src/resources/index.ts
CHANGED
|
@@ -17,6 +17,8 @@ import { LimrunError } from '../core/error';
|
|
|
17
17
|
import { validateBuildSettings } from '../build-settings';
|
|
18
18
|
import { startTcpTunnel, type Tunnel } from '../tunnel';
|
|
19
19
|
import { isTransientError, retryTransient } from '../rbe-session';
|
|
20
|
+
import { sseFetch } from '../internal/sse-fetch';
|
|
21
|
+
import { createEventSource } from 'eventsource-client';
|
|
20
22
|
|
|
21
23
|
export type { Tunnel } from '../tunnel';
|
|
22
24
|
|
|
@@ -217,6 +219,22 @@ export type RbeUploadResult = {
|
|
|
217
219
|
signedDownloadUrl?: string;
|
|
218
220
|
};
|
|
219
221
|
|
|
222
|
+
/** An in-flight Bazel invocation on the instance's RBE stack. */
|
|
223
|
+
export type RbeActiveBuild = {
|
|
224
|
+
invocationId: string;
|
|
225
|
+
/** RUNNING while in flight; terminal statuses appear only on the build-end event. */
|
|
226
|
+
status: 'RUNNING' | (string & {});
|
|
227
|
+
/** The bazel target pattern(s) of the invocation, when known. */
|
|
228
|
+
pattern?: string[];
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
/** The terminal summary of a Bazel invocation, from the build stream's end event. */
|
|
232
|
+
export type RbeBuildEnd = {
|
|
233
|
+
invocationId: string;
|
|
234
|
+
status: 'SUCCEEDED' | 'FAILED' | 'CANCELLED' | 'INCOMPLETE' | (string & {});
|
|
235
|
+
error?: string;
|
|
236
|
+
};
|
|
237
|
+
|
|
220
238
|
export type XcodeClient = {
|
|
221
239
|
/**
|
|
222
240
|
* Sync source code to the xcode instance. In watch mode, keeps syncing on changes.
|
|
@@ -278,6 +296,24 @@ export type XcodeClient = {
|
|
|
278
296
|
*/
|
|
279
297
|
uploadLatestRbeBuild: (opts: RbeUploadOptions) => Promise<RbeUploadResult>;
|
|
280
298
|
|
|
299
|
+
/**
|
|
300
|
+
* List the Bazel invocations currently building on the RBE stack. Poll this
|
|
301
|
+
* to discover new builds (e.g. to auto-upload on build end).
|
|
302
|
+
*/
|
|
303
|
+
getActiveRbeBuilds: () => Promise<RbeActiveBuild[]>;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Wait for a Bazel invocation to finish and return its terminal summary.
|
|
307
|
+
* Subscribes to the invocation's build event stream (which replays from the
|
|
308
|
+
* start, so subscribing any time before the build ends is safe) and resolves
|
|
309
|
+
* on the terminal event. Rejects when the stream drops or cannot be reached,
|
|
310
|
+
* typically because the build already ended and its live stream was removed,
|
|
311
|
+
* and on abort via the optional signal. There is no internal retry; the
|
|
312
|
+
* caller owns that policy (re-subscribe while the invocation is still listed
|
|
313
|
+
* active, else treat the outcome as unknown).
|
|
314
|
+
*/
|
|
315
|
+
waitForRbeBuildEnd: (invocationId: string, opts?: { signal?: AbortSignal }) => Promise<RbeBuildEnd>;
|
|
316
|
+
|
|
281
317
|
/**
|
|
282
318
|
* Create a new iOS simulator instance and attach it to this xcode instance.
|
|
283
319
|
* Deletes the simulator if attach fails so it is never leaked. Returns the new
|
|
@@ -710,6 +746,83 @@ export class XcodeInstances extends GeneratedXcodeInstances {
|
|
|
710
746
|
const result = await retryTransient(post, { retryOn });
|
|
711
747
|
return { ...result, ...(signedDownloadUrl && { signedDownloadUrl }) };
|
|
712
748
|
},
|
|
749
|
+
|
|
750
|
+
async getActiveRbeBuilds(): Promise<RbeActiveBuild[]> {
|
|
751
|
+
const res = await nodeProxyTransport.fetch(`${apiUrl}/rbe/builds/active`, {
|
|
752
|
+
method: 'GET',
|
|
753
|
+
headers: {
|
|
754
|
+
Authorization: `Bearer ${token}`,
|
|
755
|
+
},
|
|
756
|
+
});
|
|
757
|
+
// readRbeResponse: a 404 here means a limbuild that predates this
|
|
758
|
+
// route, not a vanished instance (same trap as the other /rbe routes).
|
|
759
|
+
return readRbeResponse<RbeActiveBuild[]>(res, 'GET /rbe/builds/active');
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
waitForRbeBuildEnd(invocationId: string, opts?: { signal?: AbortSignal }): Promise<RbeBuildEnd> {
|
|
763
|
+
return new Promise<RbeBuildEnd>((resolve, reject) => {
|
|
764
|
+
if (opts?.signal?.aborted) {
|
|
765
|
+
reject(new Error(`waiting for build ${invocationId} was aborted`));
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
// Both settle paths close the source: eventsource-client
|
|
769
|
+
// auto-reconnects otherwise, which would retry-loop against the
|
|
770
|
+
// stream once the daemon removes it.
|
|
771
|
+
let settled = false;
|
|
772
|
+
const cleanup = () => {
|
|
773
|
+
eventSource.close();
|
|
774
|
+
opts?.signal?.removeEventListener('abort', onAbort);
|
|
775
|
+
};
|
|
776
|
+
const settleResolve = (end: RbeBuildEnd) => {
|
|
777
|
+
if (settled) return;
|
|
778
|
+
settled = true;
|
|
779
|
+
cleanup();
|
|
780
|
+
resolve(end);
|
|
781
|
+
};
|
|
782
|
+
const settleReject = (err: Error) => {
|
|
783
|
+
if (settled) return;
|
|
784
|
+
settled = true;
|
|
785
|
+
cleanup();
|
|
786
|
+
reject(err);
|
|
787
|
+
};
|
|
788
|
+
const onAbort = () => settleReject(new Error(`waiting for build ${invocationId} was aborted`));
|
|
789
|
+
const eventSource = createEventSource({
|
|
790
|
+
url: `${apiUrl}/exec/${invocationId}/events`,
|
|
791
|
+
fetch: sseFetch(nodeProxyTransport.fetch, (err) =>
|
|
792
|
+
settleReject(
|
|
793
|
+
new Error(
|
|
794
|
+
`build event stream for ${invocationId} is unreachable: ${
|
|
795
|
+
err instanceof Error ? err.message : err
|
|
796
|
+
}`,
|
|
797
|
+
),
|
|
798
|
+
),
|
|
799
|
+
),
|
|
800
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
801
|
+
onMessage: (message) => {
|
|
802
|
+
if (message.event !== 'end') {
|
|
803
|
+
return; // meta and log frames
|
|
804
|
+
}
|
|
805
|
+
let end: RbeBuildEnd;
|
|
806
|
+
try {
|
|
807
|
+
end = JSON.parse(message.data) as RbeBuildEnd;
|
|
808
|
+
} catch (err) {
|
|
809
|
+
settleReject(new Error(`invalid build end event for ${invocationId}: ${err}`));
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
settleResolve(end);
|
|
813
|
+
},
|
|
814
|
+
onDisconnect: () => {
|
|
815
|
+
settleReject(
|
|
816
|
+
new Error(
|
|
817
|
+
`build event stream for ${invocationId} ended without a terminal event ` +
|
|
818
|
+
'(the build may have finished and its live stream been removed)',
|
|
819
|
+
),
|
|
820
|
+
);
|
|
821
|
+
},
|
|
822
|
+
});
|
|
823
|
+
opts?.signal?.addEventListener('abort', onAbort, { once: true });
|
|
824
|
+
});
|
|
825
|
+
},
|
|
713
826
|
};
|
|
714
827
|
}
|
|
715
828
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.36.1'; // 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.36.1";
|
|
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.36.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.
|
|
1
|
+
export const VERSION = '0.36.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|