From b1b1b06ce325a4160b57711edd679c326bc2170e Mon Sep 17 00:00:00 2001 From: fratzinger <22286818+fratzinger@users.noreply.github.com> Date: Tue, 16 Jan 2024 23:47:43 +0100 Subject: [PATCH] fix: fix build --- package.json | 2 +- src/hooks/cache.ts | 2 +- src/hooks/fgraphql.ts | 21 +++++++++------------ src/hooks/populate.ts | 6 +++--- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 04f9ff5..34f355b 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "update-dependencies": "ncu -u -x ajv", "test:unit": "vitest run", "coverage": "vitest run --coverage", - "test": "npm run lint && npm run test:unit" + "test": "npm run lint && npm run coverage" }, "repository": { "type": "git", diff --git a/src/hooks/cache.ts b/src/hooks/cache.ts index bf95c74..fe9c94d 100755 --- a/src/hooks/cache.ts +++ b/src/hooks/cache.ts @@ -60,7 +60,7 @@ export function cache( return context; case 'get': { if (!Object.keys(query).length) { - const key = makeCacheKey(context.id); + const key = makeCacheKey(context.id!); const value = cacheMap.get(key); if (value) context.result = value; } diff --git a/src/hooks/fgraphql.ts b/src/hooks/fgraphql.ts index 4ecda88..c68d813 100755 --- a/src/hooks/fgraphql.ts +++ b/src/hooks/fgraphql.ts @@ -49,18 +49,15 @@ export function fgraphql(options1: FGraphQL let ourResolvers: any; // will be initialized when hook is first called - const options = Object.assign( - {}, - { - skipHookWhen: (context: any) => !!(context.params || {}).graphql, - inclAllFieldsServer: true, - inclAllFieldsClient: true, - inclAllFields: null, // Will be initialized each hook call. - inclJoinedNames: true, - extraAuthProps: [], - }, - options1.options || {}, - ); + const options = { + skipHookWhen: (context: any) => !!(context.params || {}).graphql, + inclAllFieldsServer: true, + inclAllFieldsClient: true, + inclAllFields: null, // Will be initialized each hook call. + inclJoinedNames: true, + extraAuthProps: [], + ...(options1.options || {}), + }; // @ts-ignore schema = isFunction(schema) ? schema() : schema; diff --git a/src/hooks/populate.ts b/src/hooks/populate.ts index d08b772..65f4635 100755 --- a/src/hooks/populate.ts +++ b/src/hooks/populate.ts @@ -122,7 +122,7 @@ export function populate(options: PopulateO throw new BadRequest('Schema does not resolve to an object. (populate)'); } - const include = [].concat(schema1.include || []).map(schema => { + const include = [].concat((schema1.include || []) as any).map(schema => { if ('provider' in schema) { return schema; } else { @@ -174,11 +174,11 @@ function populateItem( const elapsed: any = {}; const startAtAllIncludes = new Date().getTime(); - const include = [].concat(includeSchema || []); + const include = [].concat(includeSchema || []) as any; if (!Object.prototype.hasOwnProperty.call(item, '_include')) item._include = []; return Promise.all( - include.map(childSchema => { + include.map((childSchema: any) => { const { query, select, parentField } = childSchema; // A related column join is required if neither the query nor select options are provided.