kysely 0.21.0 → 0.21.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.
@@ -90,7 +90,7 @@ import { SchemableIdentifierNode } from './schemable-identifier-node.js';
90
90
  *
91
91
  * return {
92
92
  * ...node,
93
- * identifier: snakeCase(node.identifier),
93
+ * name: snakeCase(node.name),
94
94
  * }
95
95
  * }
96
96
  * }
@@ -23,7 +23,7 @@ const require_all_props_js_1 = require("../util/require-all-props.js");
23
23
  *
24
24
  * return {
25
25
  * ...node,
26
- * identifier: snakeCase(node.identifier),
26
+ * name: snakeCase(node.name),
27
27
  * }
28
28
  * }
29
29
  * }
@@ -1,3 +1,5 @@
1
1
  import { GroupByItemNode } from '../operation-node/group-by-item-node.js';
2
- import { ReferenceExpressionOrList } from './reference-parser.js';
3
- export declare function parseGroupBy(orderBy: ReferenceExpressionOrList<any, any>): GroupByItemNode[];
2
+ import { ReferenceExpression } from './reference-parser.js';
3
+ export declare type GroupByExpression<DB, TB extends keyof DB, O> = ReferenceExpression<DB, TB> | (keyof O & string);
4
+ export declare type GroupByExpressionOrList<DB, TB extends keyof DB, O> = ReadonlyArray<GroupByExpression<DB, TB, O>> | GroupByExpression<DB, TB, O>;
5
+ export declare function parseGroupBy(orderBy: GroupByExpressionOrList<any, any, any>): GroupByItemNode[];
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WithSchemaTransformer = void 0;
4
4
  const alias_node_js_1 = require("../../operation-node/alias-node.js");
5
+ const identifier_node_js_1 = require("../../operation-node/identifier-node.js");
5
6
  const operation_node_transformer_js_1 = require("../../operation-node/operation-node-transformer.js");
6
7
  const schemable_identifier_node_js_1 = require("../../operation-node/schemable-identifier-node.js");
7
8
  const table_node_js_1 = require("../../operation-node/table-node.js");
@@ -57,10 +58,7 @@ class WithSchemaTransformer extends operation_node_transformer_js_1.OperationNod
57
58
  }
58
59
  return {
59
60
  ...transformed,
60
- schema: (0, object_utils_js_1.freeze)({
61
- kind: 'IdentifierNode',
62
- name: this.#schema,
63
- }),
61
+ schema: identifier_node_js_1.IdentifierNode.create(this.#schema),
64
62
  };
65
63
  }
66
64
  #isRootOperationNode(node) {
@@ -12,6 +12,7 @@ import { OrderByDirectionExpression, OrderByExpression } from '../parser/order-b
12
12
  import { Compilable } from '../util/compilable.js';
13
13
  import { QueryExecutor } from '../query-executor/query-executor.js';
14
14
  import { QueryId } from '../util/query-id.js';
15
+ import { GroupByExpression } from '../parser/group-by-parser.js';
15
16
  import { UnionExpression } from '../parser/union-parser.js';
16
17
  import { KyselyPlugin } from '../plugin/kysely-plugin.js';
17
18
  import { WhereInterface } from './where-interface.js';
@@ -1144,8 +1145,8 @@ export declare class SelectQueryBuilder<DB, TB extends keyof DB, O> implements W
1144
1145
  * group by "first_name"
1145
1146
  * ```
1146
1147
  */
1147
- groupBy(groupBy: ReadonlyArray<ReferenceExpression<DB, TB>>): SelectQueryBuilder<DB, TB, O>;
1148
- groupBy(groupBy: ReferenceExpression<DB, TB>): SelectQueryBuilder<DB, TB, O>;
1148
+ groupBy(groupBy: ReadonlyArray<GroupByExpression<DB, TB, O>>): SelectQueryBuilder<DB, TB, O>;
1149
+ groupBy(groupBy: GroupByExpression<DB, TB, O>): SelectQueryBuilder<DB, TB, O>;
1149
1150
  /**
1150
1151
  * Adds a limit clause to the query.
1151
1152
  *
@@ -90,7 +90,7 @@ import { SchemableIdentifierNode } from './schemable-identifier-node.js';
90
90
  *
91
91
  * return {
92
92
  * ...node,
93
- * identifier: snakeCase(node.identifier),
93
+ * name: snakeCase(node.name),
94
94
  * }
95
95
  * }
96
96
  * }
@@ -21,7 +21,7 @@ import { requireAllProps } from '../util/require-all-props.js';
21
21
  *
22
22
  * return {
23
23
  * ...node,
24
- * identifier: snakeCase(node.identifier),
24
+ * name: snakeCase(node.name),
25
25
  * }
26
26
  * }
27
27
  * }
@@ -1,3 +1,5 @@
1
1
  import { GroupByItemNode } from '../operation-node/group-by-item-node.js';
2
- import { ReferenceExpressionOrList } from './reference-parser.js';
3
- export declare function parseGroupBy(orderBy: ReferenceExpressionOrList<any, any>): GroupByItemNode[];
2
+ import { ReferenceExpression } from './reference-parser.js';
3
+ export declare type GroupByExpression<DB, TB extends keyof DB, O> = ReferenceExpression<DB, TB> | (keyof O & string);
4
+ export declare type GroupByExpressionOrList<DB, TB extends keyof DB, O> = ReadonlyArray<GroupByExpression<DB, TB, O>> | GroupByExpression<DB, TB, O>;
5
+ export declare function parseGroupBy(orderBy: GroupByExpressionOrList<any, any, any>): GroupByItemNode[];
@@ -1,5 +1,6 @@
1
1
  /// <reference types="./with-schema-transformer.d.ts" />
2
2
  import { AliasNode } from '../../operation-node/alias-node.js';
3
+ import { IdentifierNode } from '../../operation-node/identifier-node.js';
3
4
  import { OperationNodeTransformer } from '../../operation-node/operation-node-transformer.js';
4
5
  import { SchemableIdentifierNode } from '../../operation-node/schemable-identifier-node.js';
5
6
  import { TableNode } from '../../operation-node/table-node.js';
@@ -55,10 +56,7 @@ export class WithSchemaTransformer extends OperationNodeTransformer {
55
56
  }
56
57
  return {
57
58
  ...transformed,
58
- schema: freeze({
59
- kind: 'IdentifierNode',
60
- name: this.#schema,
61
- }),
59
+ schema: IdentifierNode.create(this.#schema),
62
60
  };
63
61
  }
64
62
  #isRootOperationNode(node) {
@@ -12,6 +12,7 @@ import { OrderByDirectionExpression, OrderByExpression } from '../parser/order-b
12
12
  import { Compilable } from '../util/compilable.js';
13
13
  import { QueryExecutor } from '../query-executor/query-executor.js';
14
14
  import { QueryId } from '../util/query-id.js';
15
+ import { GroupByExpression } from '../parser/group-by-parser.js';
15
16
  import { UnionExpression } from '../parser/union-parser.js';
16
17
  import { KyselyPlugin } from '../plugin/kysely-plugin.js';
17
18
  import { WhereInterface } from './where-interface.js';
@@ -1144,8 +1145,8 @@ export declare class SelectQueryBuilder<DB, TB extends keyof DB, O> implements W
1144
1145
  * group by "first_name"
1145
1146
  * ```
1146
1147
  */
1147
- groupBy(groupBy: ReadonlyArray<ReferenceExpression<DB, TB>>): SelectQueryBuilder<DB, TB, O>;
1148
- groupBy(groupBy: ReferenceExpression<DB, TB>): SelectQueryBuilder<DB, TB, O>;
1148
+ groupBy(groupBy: ReadonlyArray<GroupByExpression<DB, TB, O>>): SelectQueryBuilder<DB, TB, O>;
1149
+ groupBy(groupBy: GroupByExpression<DB, TB, O>): SelectQueryBuilder<DB, TB, O>;
1149
1150
  /**
1150
1151
  * Adds a limit clause to the query.
1151
1152
  *
@@ -11,7 +11,7 @@ import { preventAwait } from '../util/prevent-await.js';
11
11
  import { LimitNode } from '../operation-node/limit-node.js';
12
12
  import { OffsetNode } from '../operation-node/offset-node.js';
13
13
  import { freeze } from '../util/object-utils.js';
14
- import { parseGroupBy } from '../parser/group-by-parser.js';
14
+ import { parseGroupBy, } from '../parser/group-by-parser.js';
15
15
  import { parseUnion } from '../parser/union-parser.js';
16
16
  import { NoResultError } from './no-result-error.js';
17
17
  import { IdentifierNode } from '../operation-node/identifier-node.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kysely",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "Type safe SQL query builder",
5
5
  "repository": {
6
6
  "type": "git",