From c8582f48cf38b7a01d84b14a7cd072caaec5750d Mon Sep 17 00:00:00 2001 From: michaelpineirocontentful Date: Thu, 16 Jan 2025 13:32:15 -0700 Subject: [PATCH] fix: Prettier formatting --- lib/adapters/REST/endpoints/function.ts | 5 ++--- lib/common-types.ts | 16 ++++++++++++---- lib/entities/bulk-action.ts | 2 +- lib/entities/resource-type.ts | 2 +- lib/plain/entities/function.ts | 4 ++-- lib/plain/plain-client.ts | 2 +- test/unit/mocks/entities.ts | 2 +- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/adapters/REST/endpoints/function.ts b/lib/adapters/REST/endpoints/function.ts index 84cdf03872..854c26676b 100644 --- a/lib/adapters/REST/endpoints/function.ts +++ b/lib/adapters/REST/endpoints/function.ts @@ -12,11 +12,10 @@ import type { FunctionProps } from '../../../entities/function' const getBaseUrl = (params: GetFunctionParams) => `/organizations/${params.organizationId}/app_definitions/${params.appDefinitionId}/functions` -const getFunctionUrl = (params: GetFunctionParams) => - `${getBaseUrl(params)}/${params.functionId}` +const getFunctionUrl = (params: GetFunctionParams) => `${getBaseUrl(params)}/${params.functionId}` const getFunctionsEnvURL = (params: GetFunctionForEnvParams) => { - return `/spaces/${params.spaceId}/environments/${params.environmentId}/app_installations/${params.appInstallationId}/functions` + return `/spaces/${params.spaceId}/environments/${params.environmentId}/app_installations/${params.appInstallationId}/functions` } export const get: RestEndpoint<'Function', 'get'> = ( diff --git a/lib/common-types.ts b/lib/common-types.ts index b01720cbac..e84cc47849 100644 --- a/lib/common-types.ts +++ b/lib/common-types.ts @@ -554,7 +554,10 @@ type MRInternal = { (opts: MROpts<'Function', 'get', UA>): MRReturn<'Function', 'get'> (opts: MROpts<'Function', 'getMany', UA>): MRReturn<'Function', 'getMany'> - (opts: MROpts<'Function', 'getManyForEnvironment', UA>): MRReturn<'Function', 'getManyForEnvironment'> + (opts: MROpts<'Function', 'getManyForEnvironment', UA>): MRReturn< + 'Function', + 'getManyForEnvironment' + > (opts: MROpts<'Locale', 'get', UA>): MRReturn<'Locale', 'get'> (opts: MROpts<'Locale', 'getMany', UA>): MRReturn<'Locale', 'getMany'> @@ -1547,7 +1550,10 @@ export type MRActions = { Function: { get: { params: GetFunctionParams; return: FunctionProps } getMany: { params: GetFunctionParams; return: CollectionProp } - getManyForEnvironment: { params: GetFunctionForEnvParams; return: CollectionProp } + getManyForEnvironment: { + params: GetFunctionForEnvParams + return: CollectionProp + } } Locale: { get: { params: GetSpaceEnvironmentParams & { localeId: string }; return: LocaleProps } @@ -2142,8 +2148,10 @@ export type GetEditorInterfaceParams = GetSpaceEnvironmentParams & { contentType export type GetEntryParams = GetSpaceEnvironmentParams & { entryId: string } export type GetExtensionParams = GetSpaceEnvironmentParams & { extensionId: string } export type GetEnvironmentTemplateParams = GetOrganizationParams & { environmentTemplateId: string } -export type GetFunctionParams = GetAppDefinitionParams & { functionId?: string} -export type GetFunctionForEnvParams = GetSpaceParams & { environmentId: string } & { appInstallationId: string } +export type GetFunctionParams = GetAppDefinitionParams & { functionId?: string } +export type GetFunctionForEnvParams = GetSpaceParams & { environmentId: string } & { + appInstallationId: string +} export type GetOrganizationParams = { organizationId: string } export type GetReleaseParams = GetSpaceEnvironmentParams & { releaseId: string } export type GetSnapshotForContentTypeParams = GetSpaceEnvironmentParams & { contentTypeId: string } diff --git a/lib/entities/bulk-action.ts b/lib/entities/bulk-action.ts index ca697c513b..a3135de842 100644 --- a/lib/entities/bulk-action.ts +++ b/lib/entities/bulk-action.ts @@ -33,7 +33,7 @@ export enum BulkActionStatus { } const STATUSES = Object.values(BulkActionStatus) -type BulkActionStatuses = (typeof STATUSES)[number] +type BulkActionStatuses = typeof STATUSES[number] interface BulkActionFailedError { sys: { type: 'Error'; id: 'BulkActionFailed' } diff --git a/lib/entities/resource-type.ts b/lib/entities/resource-type.ts index 31e0cfd53d..ad5a3bfecc 100644 --- a/lib/entities/resource-type.ts +++ b/lib/entities/resource-type.ts @@ -54,7 +54,7 @@ type OptionalSysFields = export type SpaceEnvResourceTypeProps = Pick< ResourceTypeProps, - (typeof publicResourceTypeFields)[number] + typeof publicResourceTypeFields[number] > & { // we mark timestamps and users as optional to include system types like `Contentful:Entry` into the public response sys: Partial> & diff --git a/lib/plain/entities/function.ts b/lib/plain/entities/function.ts index 2963346a8d..ca9cf20cea 100644 --- a/lib/plain/entities/function.ts +++ b/lib/plain/entities/function.ts @@ -23,7 +23,7 @@ export type FunctionPlainClientAPI = { * ``` */ get(params: OptionalDefaults): Promise - + /** * Fetches all functions for the given app * @param params organization ID, app definition ID to identify the functions @@ -40,7 +40,7 @@ export type FunctionPlainClientAPI = { getMany( params: OptionalDefaults ): Promise> - + /** * Fetches all functions for the given environment * @param params space ID, environment ID, app installation ID to identify the functions diff --git a/lib/plain/plain-client.ts b/lib/plain/plain-client.ts index 700886f300..dfcbcdfd4d 100644 --- a/lib/plain/plain-client.ts +++ b/lib/plain/plain-client.ts @@ -131,7 +131,7 @@ export const createPlainClient = ( function: { get: wrap(wrapParams, 'Function', 'get'), getMany: wrap(wrapParams, 'Function', 'getMany'), - getManyForEnvironment: wrap(wrapParams, 'Function', 'getManyForEnvironment') + getManyForEnvironment: wrap(wrapParams, 'Function', 'getManyForEnvironment'), }, editorInterface: { get: wrap(wrapParams, 'EditorInterface', 'get'), diff --git a/test/unit/mocks/entities.ts b/test/unit/mocks/entities.ts index a96baa9be1..2e4c0f30e1 100644 --- a/test/unit/mocks/entities.ts +++ b/test/unit/mocks/entities.ts @@ -1255,7 +1255,7 @@ const mocks = { workflowsChangelogEntry: workflowsChangelogEntryMock, } -function cloneMock(name: T): (typeof mocks)[T] { +function cloneMock(name: T): typeof mocks[T] { return cloneDeep(mocks[name]) }