From d5d633d3fdadac04fd108554234d4e8d20d9652b Mon Sep 17 00:00:00 2001 From: Andreas Egger Date: Fri, 25 Nov 2022 10:23:02 +0100 Subject: [PATCH] fix(types): change types to expose requestBatchSize --- index.d.ts | 4 ++++ src/bin/lib/config.ts | 12 +----------- src/lib/fetcher.ts | 6 +++++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/index.d.ts b/index.d.ts index bbab44964..2e4f2e4fd 100644 --- a/index.d.ts +++ b/index.d.ts @@ -8,6 +8,7 @@ export type RunMigrationConfig = { rawProxy?: boolean yes?: boolean retryLimit?: number + requestBatchSize?: number } & ({ filePath: string } | { migrationFunction: MigrationFunction }) export function runMigration(config: RunMigrationConfig): Promise @@ -639,6 +640,9 @@ export interface ClientConfig { environmentId?: string proxy?: string rawProxy?: boolean + requestBatchSize?: number + headers?: Record + retryLimit?: number } export type MakeRequest = (requestConfig: axios.AxiosRequestConfig) => axios.AxiosResponse['data'] diff --git a/src/bin/lib/config.ts b/src/bin/lib/config.ts index 7da5ff672..8ef6c752e 100644 --- a/src/bin/lib/config.ts +++ b/src/bin/lib/config.ts @@ -1,22 +1,12 @@ import * as path from 'path' import * as os from 'os' import { v4 as uuidv4 } from 'uuid' +import type { ClientConfig } from '../../../index' // TODO: I'm ugly, maybe change me const homedir = process.env.NODE_ENV === 'test' ? '/tmp' : os.homedir() const configPath = path.resolve(homedir, '.contentfulrc.json') -interface ClientConfig { - accessToken?: string - spaceId?: string - environmentId?: string - proxy?: string - rawProxy?: boolean - requestBatchSize?: number - headers?: Record - retryLimit?: number -} - function getFileConfig(): ClientConfig { try { const config = require(configPath) diff --git a/src/lib/fetcher.ts b/src/lib/fetcher.ts index d28de1ee8..4f153e973 100644 --- a/src/lib/fetcher.ts +++ b/src/lib/fetcher.ts @@ -54,7 +54,11 @@ export default class Fetcher implements APIFetcher { const ids: string[] = _.uniq( intentList .getIntents() - .filter((intent) => (!intent.isEditorInterfaceIntent() || intent.requiresContentType()) && !intent.isTagIntent()) + .filter( + (intent) => + (!intent.isEditorInterfaceIntent() || intent.requiresContentType()) && + !intent.isTagIntent() + ) .reduce((ids, intent) => { const intentIds = intent.getRelatedContentTypeIds() return ids.concat(intentIds)