From 458d66859e256c5854e7590f0b4a11b233fe0374 Mon Sep 17 00:00:00 2001 From: David Luecke Date: Tue, 20 Dec 2022 08:25:17 -0800 Subject: [PATCH] fix(databases): Make sure adapter method signatures are exported properly (#2943) --- packages/knex/src/index.ts | 3 +++ packages/mongodb/src/index.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/knex/src/index.ts b/packages/knex/src/index.ts index 59a59e1841..7f2c347302 100644 --- a/packages/knex/src/index.ts +++ b/packages/knex/src/index.ts @@ -37,6 +37,7 @@ export class KnexService< async create(data: Data, params?: ServiceParams): Promise async create(data: Data[], params?: ServiceParams): Promise + async create(data: Data | Data[], params?: ServiceParams): Promise async create(data: Data | Data[], params?: ServiceParams): Promise { if (Array.isArray(data) && !this.allowsMulti('create', params)) { throw new MethodNotAllowed('Can not create multiple entries') @@ -54,6 +55,7 @@ export class KnexService< async patch(id: Id, data: PatchData, params?: ServiceParams): Promise async patch(id: null, data: PatchData, params?: ServiceParams): Promise + async patch(id: NullableId, data: PatchData, params?: ServiceParams): Promise async patch(id: NullableId, data: PatchData, params?: ServiceParams): Promise { const { $limit, ...query } = await this.sanitizeQuery(params) @@ -65,6 +67,7 @@ export class KnexService< async remove(id: Id, params?: ServiceParams): Promise async remove(id: null, params?: ServiceParams): Promise + async remove(id: NullableId, params?: ServiceParams): Promise async remove(id: NullableId, params?: ServiceParams): Promise { const { $limit, ...query } = await this.sanitizeQuery(params) diff --git a/packages/mongodb/src/index.ts b/packages/mongodb/src/index.ts index 1b86dffff1..e6b73579b5 100644 --- a/packages/mongodb/src/index.ts +++ b/packages/mongodb/src/index.ts @@ -32,6 +32,7 @@ export class MongoDBService< async create(data: Data, params?: ServiceParams): Promise async create(data: Data[], params?: ServiceParams): Promise + async create(data: Data | Data[], params?: ServiceParams): Promise async create(data: Data | Data[], params?: ServiceParams): Promise { if (Array.isArray(data) && !this.allowsMulti('create', params)) { throw new MethodNotAllowed('Can not create multiple entries') @@ -49,6 +50,7 @@ export class MongoDBService< async patch(id: null, data: PatchData, params?: ServiceParams): Promise async patch(id: AdapterId, data: PatchData, params?: ServiceParams): Promise + async patch(id: NullableAdapterId, data: PatchData, params?: ServiceParams): Promise async patch(id: NullableAdapterId, data: PatchData, params?: ServiceParams): Promise { const { $limit, ...query } = await this.sanitizeQuery(params) @@ -60,6 +62,7 @@ export class MongoDBService< async remove(id: AdapterId, params?: ServiceParams): Promise async remove(id: null, params?: ServiceParams): Promise + async remove(id: NullableAdapterId, params?: ServiceParams): Promise async remove(id: NullableAdapterId, params?: ServiceParams): Promise { const { $limit, ...query } = await this.sanitizeQuery(params)