@mlagie/sql-connector 2.1.2 → 2.1.4

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.
Files changed (2) hide show
  1. package/index.d.ts +12 -1
  2. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -39,6 +39,17 @@ export interface SchemaDict {
39
39
  [key: string]: SchemaField;
40
40
  }
41
41
 
42
+ export type SelectAggregation = {
43
+ col?: string;
44
+ sum?: string;
45
+ distinct?: string;
46
+ dateFormat?: [string, string];
47
+ count?: string | string[] | Record<string, any>;
48
+ as?: string;
49
+ };
50
+
51
+ export type SelectItem = string | SelectAggregation;
52
+
42
53
  type NormalizeSqlType<T> =
43
54
  T extends StringConstructor
44
55
  ? "String"
@@ -193,7 +204,7 @@ export class Model<TSchema extends SchemaDict = SchemaDict> {
193
204
  * @returns {Promise<Array<Object>>}
194
205
  */
195
206
  find(options?: {
196
- select?: string[];
207
+ select?: SelectItem[];
197
208
  where?: Record<string, any> | Partial<InferSchema<TSchema>> | string;
198
209
  order?: [string, string][];
199
210
  limit?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlagie/sql-connector",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "The sql-connector module allows you to manage connections to a MySQL database, define table schemas, and interact with data in a simple and efficient way.",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -66,11 +66,11 @@
66
66
  "private": false,
67
67
  "dependencies": {
68
68
  "@mlagie/logger": "1.0.5",
69
- "mysql2": "3.23.2"
69
+ "mysql2": "3.23.3"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@eslint/js": "^10.0.1",
73
- "eslint": "^10.8.0",
73
+ "eslint": "^10.8.1",
74
74
  "eslint-plugin-security": "^4.0.1",
75
75
  "jest": "30.4.2"
76
76
  },