Skip to content

Commit 9cd8878

Browse files
authored
fix: minor fixes (#83)
1 parent 5a746d9 commit 9cd8878

File tree

7 files changed

+19
-23
lines changed

7 files changed

+19
-23
lines changed

packages/runtime/src/client/crud/operations/aggregate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { BaseOperationHandler } from './base';
77
export class AggregateOperationHandler<Schema extends SchemaDef> extends BaseOperationHandler<Schema> {
88
async handle(_operation: 'aggregate', args: unknown | undefined) {
99
// normalize args to strip `undefined` fields
10-
const normalizeArgs = this.normalizeArgs(args);
10+
const normalizedArgs = this.normalizeArgs(args);
1111

1212
// parse args
13-
const parsedArgs = this.inputValidator.validateAggregateArgs(this.model, normalizeArgs);
13+
const parsedArgs = this.inputValidator.validateAggregateArgs(this.model, normalizedArgs);
1414

1515
let query = this.kysely.selectFrom((eb) => {
1616
// nested query for filtering and pagination

packages/runtime/src/client/crud/operations/count.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { BaseOperationHandler } from './base';
55
export class CountOperationHandler<Schema extends SchemaDef> extends BaseOperationHandler<Schema> {
66
async handle(_operation: 'count', args: unknown | undefined) {
77
// normalize args to strip `undefined` fields
8-
const normalizeArgs = this.normalizeArgs(args);
8+
const normalizedArgs = this.normalizeArgs(args);
99

1010
// parse args
11-
const parsedArgs = this.inputValidator.validateCountArgs(this.model, normalizeArgs);
11+
const parsedArgs = this.inputValidator.validateCountArgs(this.model, normalizedArgs);
1212

1313
let query = this.kysely.selectFrom((eb) => {
1414
// nested query for filtering and pagination

packages/runtime/src/client/crud/operations/create.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import { BaseOperationHandler } from './base';
88
export class CreateOperationHandler<Schema extends SchemaDef> extends BaseOperationHandler<Schema> {
99
async handle(operation: 'create' | 'createMany' | 'createManyAndReturn', args: unknown | undefined) {
1010
// normalize args to strip `undefined` fields
11-
const normalizeArgs = this.normalizeArgs(args);
11+
const normalizedArgs = this.normalizeArgs(args);
1212

1313
return match(operation)
14-
.with('create', () => this.runCreate(this.inputValidator.validateCreateArgs(this.model, normalizeArgs)))
14+
.with('create', () => this.runCreate(this.inputValidator.validateCreateArgs(this.model, normalizedArgs)))
1515
.with('createMany', () => {
16-
return this.runCreateMany(this.inputValidator.validateCreateManyArgs(this.model, normalizeArgs));
16+
return this.runCreateMany(this.inputValidator.validateCreateManyArgs(this.model, normalizedArgs));
1717
})
1818
.with('createManyAndReturn', () => {
1919
return this.runCreateManyAndReturn(
20-
this.inputValidator.validateCreateManyAndReturnArgs(this.model, normalizeArgs),
20+
this.inputValidator.validateCreateManyAndReturnArgs(this.model, normalizedArgs),
2121
);
2222
})
2323
.exhaustive();

packages/runtime/src/client/crud/operations/delete.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { BaseOperationHandler } from './base';
77
export class DeleteOperationHandler<Schema extends SchemaDef> extends BaseOperationHandler<Schema> {
88
async handle(operation: 'delete' | 'deleteMany', args: unknown | undefined) {
99
// normalize args to strip `undefined` fields
10-
const normalizeArgs = this.normalizeArgs(args);
10+
const normalizedArgs = this.normalizeArgs(args);
1111

1212
return match(operation)
13-
.with('delete', () => this.runDelete(this.inputValidator.validateDeleteArgs(this.model, normalizeArgs)))
13+
.with('delete', () => this.runDelete(this.inputValidator.validateDeleteArgs(this.model, normalizedArgs)))
1414
.with('deleteMany', () =>
15-
this.runDeleteMany(this.inputValidator.validateDeleteManyArgs(this.model, normalizeArgs)),
15+
this.runDeleteMany(this.inputValidator.validateDeleteManyArgs(this.model, normalizedArgs)),
1616
)
1717
.exhaustive();
1818
}

packages/runtime/src/client/crud/operations/group-by.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { BaseOperationHandler } from './base';
77
export class GroupByeOperationHandler<Schema extends SchemaDef> extends BaseOperationHandler<Schema> {
88
async handle(_operation: 'groupBy', args: unknown | undefined) {
99
// normalize args to strip `undefined` fields
10-
const normalizeArgs = this.normalizeArgs(args);
10+
const normalizedArgs = this.normalizeArgs(args);
1111

1212
// parse args
13-
const parsedArgs = this.inputValidator.validateGroupByArgs(this.model, normalizeArgs);
13+
const parsedArgs = this.inputValidator.validateGroupByArgs(this.model, normalizedArgs);
1414

1515
let query = this.kysely.selectFrom((eb) => {
1616
// nested query for filtering and pagination

packages/runtime/src/client/crud/operations/update.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import { BaseOperationHandler } from './base';
88
export class UpdateOperationHandler<Schema extends SchemaDef> extends BaseOperationHandler<Schema> {
99
async handle(operation: 'update' | 'updateMany' | 'updateManyAndReturn' | 'upsert', args: unknown) {
1010
// normalize args to strip `undefined` fields
11-
const normalizeArgs = this.normalizeArgs(args);
11+
const normalizedArgs = this.normalizeArgs(args);
1212

1313
return match(operation)
14-
.with('update', () => this.runUpdate(this.inputValidator.validateUpdateArgs(this.model, normalizeArgs)))
14+
.with('update', () => this.runUpdate(this.inputValidator.validateUpdateArgs(this.model, normalizedArgs)))
1515
.with('updateMany', () =>
16-
this.runUpdateMany(this.inputValidator.validateUpdateManyArgs(this.model, normalizeArgs)),
16+
this.runUpdateMany(this.inputValidator.validateUpdateManyArgs(this.model, normalizedArgs)),
1717
)
1818
.with('updateManyAndReturn', () =>
1919
this.runUpdateManyAndReturn(
20-
this.inputValidator.validateUpdateManyAndReturnArgs(this.model, normalizeArgs),
20+
this.inputValidator.validateUpdateManyAndReturnArgs(this.model, normalizedArgs),
2121
),
2222
)
23-
.with('upsert', () => this.runUpsert(this.inputValidator.validateUpsertArgs(this.model, normalizeArgs)))
23+
.with('upsert', () => this.runUpsert(this.inputValidator.validateUpsertArgs(this.model, normalizedArgs)))
2424
.exhaustive();
2525
}
2626

packages/runtime/src/client/errors.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ export class QueryError extends Error {
1919
/**
2020
* Error thrown when an internal error occurs.
2121
*/
22-
export class InternalError extends Error {
23-
constructor(message: string) {
24-
super(message);
25-
}
26-
}
22+
export class InternalError extends Error {}
2723

2824
/**
2925
* Error thrown when an entity is not found.

0 commit comments

Comments
 (0)