metal-orm 1.0.22 → 1.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metal-orm",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "bin": {
@@ -168,9 +168,12 @@ const parseColumnType = colTypeRaw => {
168
168
 
169
169
  const base = type.replace(/\(.*\)/, '');
170
170
 
171
+ if (base === 'bit') return { factory: 'col.boolean()', ts: 'boolean' };
171
172
  if (base.includes('bigint')) return { factory: 'col.bigint()', ts: 'number' };
172
173
  if (base.includes('int')) return { factory: 'col.int()', ts: 'number' };
173
- if (base.includes('uuid')) return { factory: 'col.uuid()', ts: 'string' };
174
+ if (base.includes('uuid') || base.includes('uniqueidentifier')) return { factory: 'col.uuid()', ts: 'string' };
175
+ if (base === 'date') return { factory: 'col.date()', ts: 'Date' };
176
+ if (base.includes('datetime') || base === 'time') return { factory: 'col.datetime()', ts: 'Date' };
174
177
  if (base.includes('char') || base.includes('text')) {
175
178
  const lenArg = length ? `${length}` : '255';
176
179
  return { factory: `col.varchar(${lenArg})`, ts: 'string' };
@@ -571,6 +574,8 @@ const loadDriver = async (dialect, url, dbPath) => {
571
574
  };
572
575
  connection.once('connect', onConnect);
573
576
  connection.once('error', onError);
577
+ // Tedious requires an explicit connect() call to start the handshake.
578
+ connection.connect();
574
579
  });
575
580
 
576
581
  const execQuery = (sql, params) =>
@@ -578,7 +583,7 @@ const loadDriver = async (dialect, url, dbPath) => {
578
583
  const rows = [];
579
584
  const request = new Request(sql, err => {
580
585
  if (err) return reject(err);
581
- resolve(rows);
586
+ resolve({ recordset: rows });
582
587
  });
583
588
  request.on('row', columns => {
584
589
  const row = {};