Skip to content

Commit

Permalink
improvement(builder.orderBy()): OrderBy now accepts literal templates…
Browse files Browse the repository at this point in the history
… to identify nested keys of an
  • Loading branch information
Bastianowicz committed Nov 14, 2021
1 parent 362ee38 commit 3dd5812
Show file tree
Hide file tree
Showing 4 changed files with 5,560 additions and 6,688 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,31 +102,31 @@
},
"devDependencies": {
"@babel/core": "^7.5.0",
"@semantic-release/changelog": "^3.0.4",
"@semantic-release/git": "^7.0.16",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@types/chai": "^4.0.4",
"@types/chai-as-promised": "^7.1.0",
"@types/mocha": "^5.2.5",
"@types/sinon": "^7.0.13",
"babel-plugin-lodash": "^3.3.4",
"chai": "^4.0.2",
"chai-as-promised": "^7.0.0",
"commitizen": "^4.0.3",
"commitizen": "^3.0.0",
"coveralls": "^3.0.4",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"rollup": "^1.19.3",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-typescript": "^1.0.0",
"semantic-release": "^15.13.18",
"semantic-release": "^18.0.0",
"sinon": "^7.3.2",
"source-map-support": "^0.5.0",
"ts-node": "^8.3.0",
"ts-node": "^10.4.0",
"tslint": "^5.18.0",
"tslint-config-airbnb": "^5.11.1",
"typedoc": "^0.15.3",
"typescript": "^3.5.3"
"typedoc": "^0.22.8",
"typescript": "^4.4.4"
}
}
5 changes: 3 additions & 2 deletions src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Clause } from './clause';
import { RemoveProperties } from './clauses/remove';
import { Union } from './clauses/union';
import { ReturnOptions } from './clauses/return';
import { StringKeyOf, TypedDictionary, ValueOf } from './types';
import {NestedKeyOf, StringKeyOf, TypedDictionary, ValueOf} from './types';
import { Query } from './query';
import { Selector } from './selector';
import { ReturnObject, Selectable } from './clauses/returnObject';
Expand All @@ -29,6 +29,7 @@ export interface WrapperClause {
new(clause: Set): Clause;
}


/**
* @internal
*/
Expand Down Expand Up @@ -550,7 +551,7 @@ export abstract class Builder
* @returns {Q}
*/
orderBy(
fields: StringKeyOf<G> | (StringKeyOf<G> | OrderConstraint)[] | OrderConstraints,
fields: StringKeyOf<G> | NestedKeyOf<G> | (StringKeyOf<G> | NestedKeyOf<G> | OrderConstraint)[] | OrderConstraints,
dir?: Direction) {
return this.continueChainClause(new OrderBy(fields, dir));
}
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export type StringKeyOf<T extends {
export type TypedDictionary<K extends string, V = any> = {
[key in K]? : V
};

export type NestedKeyOf<M> = `${string & keyof M}.${string & keyof M[keyof M]}`;
Loading

0 comments on commit 3dd5812

Please sign in to comment.