uranio 1.4.0 → 1.4.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.
@@ -33,7 +33,7 @@
33
33
  "mongodb": "^7.1.0",
34
34
  "mysql2": "^3.17.5",
35
35
  "pg": "^8.18.0",
36
- "uranio": "1.4.0",
36
+ "uranio": "1.4.1",
37
37
  "w3i": "^0.3.2"
38
38
  }
39
39
  }
@@ -115,7 +115,8 @@ export class MySQLAtomClient<S extends atom_types.mysql_atom> {
115
115
  });
116
116
  const [rows] = await this.client.exe(query);
117
117
  if (Array.isArray(rows) && rows[0]) {
118
- return (rows[0] as any).count || 0;
118
+ const count = (rows[0] as any).count;
119
+ return typeof count === 'string' ? parseInt(count, 10) : (count || 0);
119
120
  }
120
121
  return 0;
121
122
  }
@@ -115,7 +115,8 @@ export class PostgreSQLAtomClient<S extends atom_types.postgresql_atom> {
115
115
  });
116
116
  const [rows] = await this.client.exe(query);
117
117
  if (Array.isArray(rows) && rows[0]) {
118
- return (rows[0] as any).count || 0;
118
+ const count = (rows[0] as any).count;
119
+ return typeof count === 'string' ? parseInt(count, 10) : (count || 0);
119
120
  }
120
121
  return 0;
121
122
  }
@@ -136,5 +136,25 @@ describe('MySQLAtomClient', () => {
136
136
 
137
137
  expect(count).toBe(1000000);
138
138
  });
139
+
140
+ it('should convert string count to number', async () => {
141
+ const mockResult = [[{count: '42'}], []];
142
+ (mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
143
+
144
+ const count = await atomClient.countAtoms();
145
+
146
+ expect(count).toBe(42);
147
+ expect(typeof count).toBe('number');
148
+ });
149
+
150
+ it('should handle string count with large numbers', async () => {
151
+ const mockResult = [[{count: '1000000'}], []];
152
+ (mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
153
+
154
+ const count = await atomClient.countAtoms();
155
+
156
+ expect(count).toBe(1000000);
157
+ expect(typeof count).toBe('number');
158
+ });
139
159
  });
140
160
  });
@@ -136,5 +136,25 @@ describe('PostgreSQLAtomClient', () => {
136
136
 
137
137
  expect(count).toBe(1000000);
138
138
  });
139
+
140
+ it('should convert string count to number', async () => {
141
+ const mockResult = [[{count: '42'}], []];
142
+ (mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
143
+
144
+ const count = await atomClient.countAtoms();
145
+
146
+ expect(count).toBe(42);
147
+ expect(typeof count).toBe('number');
148
+ });
149
+
150
+ it('should handle string count with large numbers', async () => {
151
+ const mockResult = [[{count: '1000000'}], []];
152
+ (mockClient.exe as jest.Mock).mockResolvedValue(mockResult);
153
+
154
+ const count = await atomClient.countAtoms();
155
+
156
+ expect(count).toBe(1000000);
157
+ expect(typeof count).toBe('number');
158
+ });
139
159
  });
140
160
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uranio",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Uranio is a type-safe ODM for MongoDB",
5
5
  "main": "dist/index.js",
6
6
  "repository": {