@ts-awesome/orm 1.9.0-rc.0 → 1.9.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interfaces.d.ts +1 -1
- package/jest.config.js +1 -1
- package/package.json +2 -2
- package/tests/builder.spec.ts +15 -0
package/dist/interfaces.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export type HavingBuilder<T> = (model: Queryable<T>) => IOperandable<boolean> |
|
|
|
86
86
|
export type ValuesBuilder<T> = (model: Queryable<T>) => Values<T>;
|
|
87
87
|
export type JoinBuilder<T, X> = (root: Queryable<T>, other: Queryable<X>) => IOperandable<boolean> | boolean;
|
|
88
88
|
export type OrderBuilder<T> = (x: Columns<T>) => (Column<T> | Order | IOperandable<any>)[];
|
|
89
|
-
export type GroupByBuilder<T> = (x: Columns<T>) => (Column<T> | number)[];
|
|
89
|
+
export type GroupByBuilder<T> = (x: Columns<T>) => (Column<T> | number | IOperandable<any>)[];
|
|
90
90
|
export type ColumnsBuilder<T> = (x: Queryable<T>) => (Column<T> | IOperandable<any>)[];
|
|
91
91
|
export type Column<T> = keyof T;
|
|
92
92
|
export type Columns<T> = {
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-awesome/orm",
|
|
3
|
-
"version": "1.9.0-rc.
|
|
3
|
+
"version": "1.9.0-rc.1",
|
|
4
4
|
"description": "TypeScript friendly minimalistic ORM",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build:dev": "tsc --project tsconfig.json",
|
|
13
13
|
"build": "npm run build:dev ; cp src/wrappers* dist/",
|
|
14
14
|
"lint": "eslint \"src/**/*.ts\"",
|
|
15
|
-
"test": "jest"
|
|
15
|
+
"test": "mkdir dist-tests; mkdir dist-tests/dist; cp dist/* dist-tests/dist/; jest"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/jest": "^29.5.1",
|
package/tests/builder.spec.ts
CHANGED
|
@@ -331,6 +331,21 @@ describe('Select', () => {
|
|
|
331
331
|
expect(queryThroughBuilder._groupBy).toStrictEqual(expectation);
|
|
332
332
|
});
|
|
333
333
|
|
|
334
|
+
it('Group by function', () => {
|
|
335
|
+
function test(x: IOperandable<string> | string) : IOperandable<string> {
|
|
336
|
+
return new FunctionCall('test', [x]);
|
|
337
|
+
}
|
|
338
|
+
const queryThroughBuilder = Select(Person).groupBy(x => [test(x.name)]);
|
|
339
|
+
const expectation = [{
|
|
340
|
+
_args: [
|
|
341
|
+
{_column: {name: "name", "table": "Person"}}
|
|
342
|
+
],
|
|
343
|
+
_func: "test"
|
|
344
|
+
}];
|
|
345
|
+
|
|
346
|
+
expect(queryThroughBuilder._groupBy).toStrictEqual(expectation);
|
|
347
|
+
});
|
|
348
|
+
|
|
334
349
|
it('Order By', () => {
|
|
335
350
|
const orderByThroughList = Select(Person).orderBy(['city']);
|
|
336
351
|
const defaultOrder = Select(Person).orderBy(({city}) => [city]);
|