uql-orm 0.24.6 → 0.24.7

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 (56) hide show
  1. package/README.md +9 -8
  2. package/dist/cockroachdb/crdbQuerierPool.d.ts +1 -1
  3. package/dist/cockroachdb/crdbQuerierPool.js +5 -4
  4. package/dist/dialect/abstractSqlDialect.d.ts +78 -27
  5. package/dist/dialect/abstractSqlDialect.js +189 -129
  6. package/dist/dialect/hydrateColumn.d.ts +16 -0
  7. package/dist/dialect/hydrateColumn.js +66 -0
  8. package/dist/dialect/jsonSql.d.ts +24 -0
  9. package/dist/dialect/jsonSql.js +39 -0
  10. package/dist/dialect/mysqlLikeSqlDialect.d.ts +5 -0
  11. package/dist/dialect/mysqlLikeSqlDialect.js +10 -1
  12. package/dist/dialect/pgLikeSqlDialect.d.ts +3 -7
  13. package/dist/dialect/pgLikeSqlDialect.js +2 -14
  14. package/dist/dialect/vectorCast.d.ts +15 -0
  15. package/dist/dialect/vectorCast.js +58 -0
  16. package/dist/entity/metadata/definition.d.ts +0 -1
  17. package/dist/entity/metadata/definition.js +1 -1
  18. package/dist/maria/mariaDialect.d.ts +3 -2
  19. package/dist/maria/mariaDialect.js +3 -18
  20. package/dist/maria/mariadbQuerierPool.js +6 -1
  21. package/dist/migrate/builder/migrationBuilder.d.ts +12 -16
  22. package/dist/migrate/builder/migrationBuilder.js +24 -59
  23. package/dist/migrate/builder/tableBuilder.js +0 -12
  24. package/dist/migrate/cli.d.ts +0 -1
  25. package/dist/migrate/cli.js +1 -1
  26. package/dist/migrate/codegen/entityCodeGenerator.js +0 -3
  27. package/dist/migrate/drift/driftDetector.js +17 -15
  28. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.d.ts +8 -2
  29. package/dist/migrate/introspection/abstractSqlSchemaIntrospector.js +10 -9
  30. package/dist/migrate/introspection/mysqlIntrospector.d.ts +0 -3
  31. package/dist/migrate/introspection/mysqlIntrospector.js +0 -9
  32. package/dist/migrate/introspection/postgresIntrospector.d.ts +0 -3
  33. package/dist/migrate/introspection/postgresIntrospector.js +0 -12
  34. package/dist/migrate/introspection/sqliteIntrospector.d.ts +1 -0
  35. package/dist/migrate/introspection/sqliteIntrospector.js +1 -9
  36. package/dist/migrate/migrator.d.ts +8 -0
  37. package/dist/migrate/migrator.js +19 -29
  38. package/dist/migrate/schemaGenerator.js +0 -12
  39. package/dist/neon/neonQuerierPool.d.ts +1 -1
  40. package/dist/neon/neonQuerierPool.js +6 -4
  41. package/dist/postgres/abstractPgQuerierPool.d.ts +6 -0
  42. package/dist/postgres/abstractPgQuerierPool.js +3 -0
  43. package/dist/postgres/pgNumericTypes.d.ts +41 -0
  44. package/dist/postgres/pgNumericTypes.js +35 -0
  45. package/dist/postgres/pgQuerierPool.d.ts +1 -1
  46. package/dist/postgres/pgQuerierPool.js +5 -4
  47. package/dist/querier/abstractSqlQuerier.d.ts +9 -2
  48. package/dist/querier/abstractSqlQuerier.js +31 -24
  49. package/dist/schema/canonicalType.js +2 -12
  50. package/dist/schema/schemaAST.js +0 -24
  51. package/dist/schema/schemaASTBuilder.js +0 -3
  52. package/dist/type/queryAggregate.d.ts +3 -0
  53. package/dist/util/field.util.d.ts +4 -0
  54. package/dist/util/field.util.js +12 -0
  55. package/dist/util/sqlLiteral.js +18 -15
  56. package/package.json +4 -4
@@ -31,6 +31,18 @@ export function isNumericType(type) {
31
31
  }
32
32
  return false;
33
33
  }
34
+ /**
35
+ * Checks if a field type is boolean (Boolean, or an explicit boolean logical type)
36
+ */
37
+ export function isBooleanType(type) {
38
+ if (type === Boolean)
39
+ return true;
40
+ if (typeof type === 'string') {
41
+ const lowered = type.toLowerCase();
42
+ return lowered === 'bool' || lowered === 'boolean';
43
+ }
44
+ return false;
45
+ }
34
46
  /**
35
47
  * Checks if a field type is JSON
36
48
  */
@@ -64,6 +64,22 @@ function createEscaper(escapeString) {
64
64
  }
65
65
  return sql;
66
66
  };
67
+ /** Split out so the `typeof` switch below stays a flat one-line-per-type dispatch. */
68
+ const escapeObject = (value) => {
69
+ if (value instanceof Date) {
70
+ return Number.isNaN(value.getTime()) ? 'NULL' : dateLiteral(value);
71
+ }
72
+ if (Array.isArray(value)) {
73
+ return sqlList(value);
74
+ }
75
+ if (isByteSource(value)) {
76
+ return bytesToHexLiteral(value);
77
+ }
78
+ if ('toSqlString' in value && typeof value.toSqlString === 'function') {
79
+ return String(value.toSqlString());
80
+ }
81
+ throw new TypeError('escapeSqlLiteral: plain objects are not supported; use bound parameters or JSON.stringify + a string column.');
82
+ };
67
83
  const escapeValue = (value) => {
68
84
  if (value === undefined || value === null) {
69
85
  return 'NULL';
@@ -77,24 +93,11 @@ function createEscaper(escapeString) {
77
93
  return String(value);
78
94
  case 'string':
79
95
  return escapeString(value);
96
+ case 'object':
97
+ return escapeObject(value);
80
98
  case 'symbol':
81
99
  case 'function':
82
100
  throw new TypeError('escapeSqlLiteral: symbol and function values are not supported; use bound parameters.');
83
- case 'object': {
84
- if (value instanceof Date) {
85
- return Number.isNaN(value.getTime()) ? 'NULL' : dateLiteral(value);
86
- }
87
- if (Array.isArray(value)) {
88
- return sqlList(value);
89
- }
90
- if (isByteSource(value)) {
91
- return bytesToHexLiteral(value);
92
- }
93
- if ('toSqlString' in value && typeof value.toSqlString === 'function') {
94
- return String(value.toSqlString());
95
- }
96
- throw new TypeError('escapeSqlLiteral: plain objects are not supported; use bound parameters or JSON.stringify + a string column.');
97
- }
98
101
  default:
99
102
  // Unreachable today; throwing keeps a future JS type from silently becoming SQL.
100
103
  throw new TypeError(`escapeSqlLiteral: unsupported value type '${typeof value}'; use bound parameters.`);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://uql-orm.dev",
4
4
  "description": "Extremely fast, type-safe TypeScript ORM - one API for every database",
5
5
  "license": "MIT",
6
- "version": "0.24.6",
6
+ "version": "0.24.7",
7
7
  "type": "module",
8
8
  "engines": {
9
9
  "node": ">=24"
@@ -134,7 +134,7 @@
134
134
  "@tursodatabase/serverless": "^1.4.0",
135
135
  "@types/better-sqlite3": "^9.6.0",
136
136
  "@types/express": "^5.0.6",
137
- "@types/pg": "^8.20.4",
137
+ "@types/pg": "^8.21.0",
138
138
  "@types/ws": "^8.18.1",
139
139
  "better-sqlite3": "^13.0.3",
140
140
  "express": "^5.2.1",
@@ -145,7 +145,7 @@
145
145
  "pg-query-stream": "^4.16.0",
146
146
  "rxjs": "^7.8.2",
147
147
  "sqlite-vec": "^0.1.9",
148
- "ws": "^8.21.2"
148
+ "ws": "^8.21.3"
149
149
  },
150
150
  "author": "Roger Padilla",
151
151
  "repository": {
@@ -198,5 +198,5 @@
198
198
  "publishConfig": {
199
199
  "access": "public"
200
200
  },
201
- "gitHead": "2610226954cdf152705dc47ca130f6908a91825d"
201
+ "gitHead": "26ffc7e2968761bc95a0bb1ffe0aeb37600ba1f1"
202
202
  }