Skip to content

Commit be91eeb

Browse files
ci: apply automated fixes
1 parent 98b251a commit be91eeb

File tree

17 files changed

+197
-128
lines changed

17 files changed

+197
-128
lines changed

.changeset/auto-register-operators.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ import { defineOperator, isUnknown } from '@tanstack/db'
2020
// Define a custom "between" operator
2121
const between = defineOperator<boolean>({
2222
name: 'between',
23-
evaluate: ([valueArg, minArg, maxArg]) => (data) => {
24-
const value = valueArg!(data)
25-
if (isUnknown(value)) return null
26-
return value >= minArg!(data) && value <= maxArg!(data)
27-
}
23+
evaluate:
24+
([valueArg, minArg, maxArg]) =>
25+
(data) => {
26+
const value = valueArg!(data)
27+
if (isUnknown(value)) return null
28+
return value >= minArg!(data) && value <= maxArg!(data)
29+
},
2830
})
2931

3032
// Use in a query
@@ -39,19 +41,19 @@ import { defineOperator, comparison, transform, numeric } from '@tanstack/db'
3941
// Binary comparison with automatic null handling
4042
const notEquals = defineOperator<boolean>({
4143
name: 'notEquals',
42-
evaluate: comparison((a, b) => a !== b)
44+
evaluate: comparison((a, b) => a !== b),
4345
})
4446

4547
// Unary transformation
4648
const double = defineOperator<number>({
4749
name: 'double',
48-
evaluate: transform((v) => typeof v === 'number' ? v * 2 : v)
50+
evaluate: transform((v) => (typeof v === 'number' ? v * 2 : v)),
4951
})
5052

5153
// Binary numeric operation
5254
const modulo = defineOperator<number>({
5355
name: 'modulo',
54-
evaluate: numeric((a, b) => b !== 0 ? a % b : null)
56+
evaluate: numeric((a, b) => (b !== 0 ? a % b : null)),
5557
})
5658
```
5759

@@ -70,8 +72,8 @@ const product = defineAggregate<number>({
7072
for (let i = 0; i < multiplicity; i++) result *= value
7173
}
7274
return result
73-
}
75+
},
7476
}),
75-
valueTransform: 'numeric'
77+
valueTransform: 'numeric',
7678
})
7779
```

packages/db/src/query/builder/operators/and.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import type { BasicExpression } from '../../ir.js'
55
import type { ExpressionLike } from './types.js'
66

77
// AND: short-circuits on false, returns true if all are true
8-
const andFactory = /* #__PURE__*/ booleanOp({ shortCircuit: false, default: true })
8+
const andFactory = /* #__PURE__*/ booleanOp({
9+
shortCircuit: false,
10+
default: true,
11+
})
912

1013
// Overloads for and() - support 2 or more arguments, or an array
1114
export function and(

packages/db/src/query/builder/operators/divide.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import type { EvaluatorFactory } from '../../ir.js'
55
import type { BinaryNumericReturnType, ExpressionLike } from './types.js'
66

77
// Division returns null for division by zero
8-
const divideFactory = /* #__PURE__*/ numeric((a, b) => (b !== 0 ? a / b : null)) as EvaluatorFactory
8+
const divideFactory = /* #__PURE__*/ numeric((a, b) =>
9+
b !== 0 ? a / b : null,
10+
) as EvaluatorFactory
911

1012
export function divide<T1 extends ExpressionLike, T2 extends ExpressionLike>(
1113
left: T1,

packages/db/src/query/builder/operators/eq.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export function eq<T>(
2828
left: ComparisonOperand<T>,
2929
right: ComparisonOperand<T>,
3030
): BasicExpression<boolean>
31-
export function eq<T>(left: Aggregate<T>, right: unknown): BasicExpression<boolean>
31+
export function eq<T>(
32+
left: Aggregate<T>,
33+
right: unknown,
34+
): BasicExpression<boolean>
3235
export function eq(left: unknown, right: unknown): BasicExpression<boolean> {
3336
return new Func(`eq`, [toExpression(left), toExpression(right)], eqFactory)
3437
}

packages/db/src/query/builder/operators/gt.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ import type { Aggregate, BasicExpression, EvaluatorFactory } from '../../ir.js'
55
import type { ComparisonOperand } from './types.js'
66

77
// Factory using the comparison helper - cast to EvaluatorFactory for Func constructor
8-
const gtFactory = /* #__PURE__*/ comparison<number>((a, b) => a > b) as EvaluatorFactory
8+
const gtFactory = /* #__PURE__*/ comparison<number>(
9+
(a, b) => a > b,
10+
) as EvaluatorFactory
911

1012
export function gt<T>(
1113
left: ComparisonOperand<T>,
1214
right: ComparisonOperand<T>,
1315
): BasicExpression<boolean>
14-
export function gt<T>(left: Aggregate<T>, right: unknown): BasicExpression<boolean>
16+
export function gt<T>(
17+
left: Aggregate<T>,
18+
right: unknown,
19+
): BasicExpression<boolean>
1520
export function gt(left: unknown, right: unknown): BasicExpression<boolean> {
1621
return new Func(`gt`, [toExpression(left), toExpression(right)], gtFactory)
1722
}

packages/db/src/query/builder/operators/gte.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ import type { Aggregate, BasicExpression, EvaluatorFactory } from '../../ir.js'
55
import type { ComparisonOperand } from './types.js'
66

77
// Factory using the comparison helper - cast to EvaluatorFactory for Func constructor
8-
const gteFactory = /* #__PURE__*/ comparison<number>((a, b) => a >= b) as EvaluatorFactory
8+
const gteFactory = /* #__PURE__*/ comparison<number>(
9+
(a, b) => a >= b,
10+
) as EvaluatorFactory
911

1012
export function gte<T>(
1113
left: ComparisonOperand<T>,
1214
right: ComparisonOperand<T>,
1315
): BasicExpression<boolean>
14-
export function gte<T>(left: Aggregate<T>, right: unknown): BasicExpression<boolean>
16+
export function gte<T>(
17+
left: Aggregate<T>,
18+
right: unknown,
19+
): BasicExpression<boolean>
1520
export function gte(left: unknown, right: unknown): BasicExpression<boolean> {
1621
return new Func(`gte`, [toExpression(left), toExpression(right)], gteFactory)
1722
}

packages/db/src/query/builder/operators/in.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,5 @@ export function inArray(
2727
value: ExpressionLike,
2828
array: ExpressionLike,
2929
): BasicExpression<boolean> {
30-
return new Func(
31-
`in`,
32-
[toExpression(value), toExpression(array)],
33-
inFactory,
34-
)
30+
return new Func(`in`, [toExpression(value), toExpression(array)], inFactory)
3531
}

packages/db/src/query/builder/operators/like.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,9 @@ export function like(
4545
right: ExpressionLike,
4646
): BasicExpression<boolean>
4747
export function like(left: unknown, right: unknown): BasicExpression<boolean> {
48-
return new Func(`like`, [toExpression(left), toExpression(right)], likeFactory)
48+
return new Func(
49+
`like`,
50+
[toExpression(left), toExpression(right)],
51+
likeFactory,
52+
)
4953
}

packages/db/src/query/builder/operators/lt.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ import type { Aggregate, BasicExpression, EvaluatorFactory } from '../../ir.js'
55
import type { ComparisonOperand } from './types.js'
66

77
// Factory using the comparison helper - cast to EvaluatorFactory for Func constructor
8-
const ltFactory = /* #__PURE__*/ comparison<number>((a, b) => a < b) as EvaluatorFactory
8+
const ltFactory = /* #__PURE__*/ comparison<number>(
9+
(a, b) => a < b,
10+
) as EvaluatorFactory
911

1012
export function lt<T>(
1113
left: ComparisonOperand<T>,
1214
right: ComparisonOperand<T>,
1315
): BasicExpression<boolean>
14-
export function lt<T>(left: Aggregate<T>, right: unknown): BasicExpression<boolean>
16+
export function lt<T>(
17+
left: Aggregate<T>,
18+
right: unknown,
19+
): BasicExpression<boolean>
1520
export function lt(left: unknown, right: unknown): BasicExpression<boolean> {
1621
return new Func(`lt`, [toExpression(left), toExpression(right)], ltFactory)
1722
}

packages/db/src/query/builder/operators/lte.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ import type { Aggregate, BasicExpression, EvaluatorFactory } from '../../ir.js'
55
import type { ComparisonOperand } from './types.js'
66

77
// Factory using the comparison helper - cast to EvaluatorFactory for Func constructor
8-
const lteFactory = /* #__PURE__*/ comparison<number>((a, b) => a <= b) as EvaluatorFactory
8+
const lteFactory = /* #__PURE__*/ comparison<number>(
9+
(a, b) => a <= b,
10+
) as EvaluatorFactory
911

1012
export function lte<T>(
1113
left: ComparisonOperand<T>,
1214
right: ComparisonOperand<T>,
1315
): BasicExpression<boolean>
14-
export function lte<T>(left: Aggregate<T>, right: unknown): BasicExpression<boolean>
16+
export function lte<T>(
17+
left: Aggregate<T>,
18+
right: unknown,
19+
): BasicExpression<boolean>
1520
export function lte(left: unknown, right: unknown): BasicExpression<boolean> {
1621
return new Func(`lte`, [toExpression(left), toExpression(right)], lteFactory)
1722
}

0 commit comments

Comments
 (0)