Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(databases): Make sure adapter method signatures are exported properly #2943

Merged
merged 3 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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