@superblocksteam/sabs-client 0.382.0 → 0.385.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/dist/sabs.d.ts +9 -2
- package/dist/sabs.d.ts.map +1 -1
- package/dist/sabs.js +13 -2
- package/dist/sabs.js.map +1 -1
- package/dist/sabs.test.js +142 -0
- package/dist/sabs.test.js.map +1 -1
- package/package.json +2 -2
- package/src/sabs.test.ts +167 -0
- package/src/sabs.ts +27 -10
- package/tsconfig.tsbuildinfo +1 -1
package/src/sabs.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
BuildResponse,
|
|
5
5
|
BuildStatus,
|
|
6
6
|
BuildStepTimings,
|
|
7
|
+
BuildSizeMetrics,
|
|
7
8
|
ListRequest,
|
|
8
9
|
ListResponse,
|
|
9
10
|
StatusResponse,
|
|
@@ -245,6 +246,7 @@ export class SabsClient {
|
|
|
245
246
|
* @param params.buildKey - Secret build key for authentication
|
|
246
247
|
* @param params.error - Optional error message if build failed
|
|
247
248
|
* @param params.stepTimings - Optional step timing metrics in milliseconds
|
|
249
|
+
* @param params.sizeMetrics - Optional size metrics in bytes
|
|
248
250
|
* @param params.accessToken - JWT access token for authorization
|
|
249
251
|
* @returns Promise resolving to termination confirmation
|
|
250
252
|
* @throws BadRequestError if the build ID, build status, build key, or access token are empty or invalid
|
|
@@ -259,21 +261,26 @@ export class SabsClient {
|
|
|
259
261
|
buildKey,
|
|
260
262
|
error,
|
|
261
263
|
stepTimings,
|
|
264
|
+
sizeMetrics,
|
|
262
265
|
accessToken
|
|
263
266
|
}: {
|
|
264
267
|
buildId: string;
|
|
265
268
|
status: BuildStatus;
|
|
266
269
|
buildKey?: string;
|
|
267
270
|
error?: string;
|
|
268
|
-
stepTimings?:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
stepTimings?: {
|
|
272
|
+
createTempDirMs?: number;
|
|
273
|
+
fetchAppBundleMs?: number;
|
|
274
|
+
npmInstallMs?: number;
|
|
275
|
+
buildMs?: number;
|
|
276
|
+
uploadMs?: number;
|
|
277
|
+
};
|
|
278
|
+
sizeMetrics?: {
|
|
279
|
+
sourceBundleSizeBytes?: number;
|
|
280
|
+
nodeModulesSizeBytes?: number;
|
|
281
|
+
buildOutputSizeBytes?: number;
|
|
282
|
+
dependencyCount?: number;
|
|
283
|
+
};
|
|
277
284
|
accessToken?: string;
|
|
278
285
|
}): Promise<TerminateResponse> {
|
|
279
286
|
if (!buildId || buildId.length === 0) {
|
|
@@ -305,10 +312,20 @@ export class SabsClient {
|
|
|
305
312
|
uploadMs: stepTimings.uploadMs ? BigInt(stepTimings.uploadMs) : undefined
|
|
306
313
|
});
|
|
307
314
|
} else {
|
|
308
|
-
// log a warning
|
|
309
315
|
console.warn('No step timings provided for build termination');
|
|
310
316
|
}
|
|
311
317
|
|
|
318
|
+
if (sizeMetrics) {
|
|
319
|
+
requestData.sizeMetrics = new BuildSizeMetrics({
|
|
320
|
+
sourceBundleSizeBytes: sizeMetrics.sourceBundleSizeBytes ? BigInt(sizeMetrics.sourceBundleSizeBytes) : undefined,
|
|
321
|
+
nodeModulesSizeBytes: sizeMetrics.nodeModulesSizeBytes ? BigInt(sizeMetrics.nodeModulesSizeBytes) : undefined,
|
|
322
|
+
buildOutputSizeBytes: sizeMetrics.buildOutputSizeBytes ? BigInt(sizeMetrics.buildOutputSizeBytes) : undefined,
|
|
323
|
+
dependencyCount: sizeMetrics.dependencyCount ? BigInt(sizeMetrics.dependencyCount) : undefined
|
|
324
|
+
});
|
|
325
|
+
} else {
|
|
326
|
+
console.warn('No size metrics provided for build termination');
|
|
327
|
+
}
|
|
328
|
+
|
|
312
329
|
return this.executeRequest<TerminateResponse>(
|
|
313
330
|
{
|
|
314
331
|
method: 'POST',
|