Skip to content

Commit

Permalink
fix(databases): Make sure adapter method signatures are exported prop…
Browse files Browse the repository at this point in the history
…erly (#2943)
  • Loading branch information
daffl authored Dec 20, 2022
1 parent 9ea9e5d commit 458d668
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/knex/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class KnexService<

async create(data: Data, params?: ServiceParams): Promise<Result>
async create(data: Data[], params?: ServiceParams): Promise<Result[]>
async create(data: Data | Data[], params?: ServiceParams): Promise<Result | Result[]>
async create(data: Data | Data[], params?: ServiceParams): Promise<Result | Result[]> {
if (Array.isArray(data) && !this.allowsMulti('create', params)) {
throw new MethodNotAllowed('Can not create multiple entries')
Expand All @@ -54,6 +55,7 @@ export class KnexService<

async patch(id: Id, data: PatchData, params?: ServiceParams): Promise<Result>
async patch(id: null, data: PatchData, params?: ServiceParams): Promise<Result[]>
async patch(id: NullableId, data: PatchData, params?: ServiceParams): Promise<Result | Result[]>
async patch(id: NullableId, data: PatchData, params?: ServiceParams): Promise<Result | Result[]> {
const { $limit, ...query } = await this.sanitizeQuery(params)

Expand All @@ -65,6 +67,7 @@ export class KnexService<

async remove(id: Id, params?: ServiceParams): Promise<Result>
async remove(id: null, params?: ServiceParams): Promise<Result[]>
async remove(id: NullableId, params?: ServiceParams): Promise<Result | Result[]>
async remove(id: NullableId, params?: ServiceParams): Promise<Result | Result[]> {
const { $limit, ...query } = await this.sanitizeQuery(params)

Expand Down
3 changes: 3 additions & 0 deletions packages/mongodb/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class MongoDBService<

async create(data: Data, params?: ServiceParams): Promise<Result>
async create(data: Data[], params?: ServiceParams): Promise<Result[]>
async create(data: Data | Data[], params?: ServiceParams): Promise<Result | Result[]>
async create(data: Data | Data[], params?: ServiceParams): Promise<Result | Result[]> {
if (Array.isArray(data) && !this.allowsMulti('create', params)) {
throw new MethodNotAllowed('Can not create multiple entries')
Expand All @@ -49,6 +50,7 @@ export class MongoDBService<

async patch(id: null, data: PatchData, params?: ServiceParams): Promise<Result[]>
async patch(id: AdapterId, data: PatchData, params?: ServiceParams): Promise<Result>
async patch(id: NullableAdapterId, data: PatchData, params?: ServiceParams): Promise<Result | Result[]>
async patch(id: NullableAdapterId, data: PatchData, params?: ServiceParams): Promise<Result | Result[]> {
const { $limit, ...query } = await this.sanitizeQuery(params)

Expand All @@ -60,6 +62,7 @@ export class MongoDBService<

async remove(id: AdapterId, params?: ServiceParams): Promise<Result>
async remove(id: null, params?: ServiceParams): Promise<Result[]>
async remove(id: NullableAdapterId, params?: ServiceParams): Promise<Result | Result[]>
async remove(id: NullableAdapterId, params?: ServiceParams): Promise<Result | Result[]> {
const { $limit, ...query } = await this.sanitizeQuery(params)

Expand Down

0 comments on commit 458d668

Please # to comment.