Skip to content

Commit fdc3f58

Browse files
committed
feat(core): add optional upload.timeout to config
1 parent 173bd2f commit fdc3f58

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/core/src/lib/upload.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { jsonReportToGql } from './implementation/json-to-gql';
55
import { normalizePersistConfig } from './normalize';
66
import { GlobalOptions } from './types';
77

8-
export type UploadOptions = { upload: Required<UploadConfig> } & {
8+
export type UploadOptions = { upload: UploadConfig } & {
99
persist: Required<PersistConfig>;
1010
} & GlobalOptions;
1111

@@ -21,7 +21,7 @@ export async function upload(
2121
if (!options.upload) {
2222
throw new Error('upload config must be set');
2323
}
24-
const { apiKey, server, organization, project } = options.upload;
24+
const { apiKey, server, organization, project, timeout } = options.upload;
2525
const report: Report = await loadReport({
2626
...persist,
2727
format: 'json',
@@ -38,5 +38,5 @@ export async function upload(
3838
...jsonReportToGql(report),
3939
};
4040

41-
return uploadFn({ apiKey, server, data });
41+
return uploadFn({ apiKey, server, data, timeout });
4242
}

packages/models/src/lib/upload-config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export const uploadConfigSchema = z.object({
99
}),
1010
organization: slugSchema('Organization slug from Code PushUp portal'),
1111
project: slugSchema('Project slug from Code PushUp portal'),
12+
timeout: z
13+
.number({ description: 'Request timeout in minutes (default is 5)' })
14+
.positive()
15+
.int()
16+
.optional(),
1217
});
1318

1419
export type UploadConfig = z.infer<typeof uploadConfigSchema>;

0 commit comments

Comments
 (0)