@jsorm/provider-sqlite-node 0.1.1 → 0.2.0

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/dist/index.mjs +13 -1
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -127,7 +127,19 @@ function createSqliteNodeProvider(models, options) {
127
127
  };
128
128
  }
129
129
  function normalizeParams(params) {
130
- return params.map((p) => typeof p === "boolean" ? p ? 1 : 0 : p);
130
+ return params.map((p) => {
131
+ if (typeof p === "boolean") return p ? 1 : 0;
132
+ if (p instanceof Date) return toSqliteDateTime(p);
133
+ return p;
134
+ });
135
+ }
136
+ /**
137
+ * Serialize a Date as UTC text ("YYYY-MM-DD HH:MM:SS.SSS"), the same format as
138
+ * the dateTime column default, so both compare and sort correctly as text.
139
+ */
140
+ function toSqliteDateTime(date) {
141
+ if (Number.isNaN(date.getTime())) throw new ProviderError("Invalid Date parameter: expected a valid date");
142
+ return date.toISOString().replace("T", " ").replace("Z", "");
131
143
  }
132
144
  function captureSql(result, compiled, ast) {
133
145
  if (ast.captureSql) return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsorm/provider-sqlite-node",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Provider SQLite para Node.js",
5
5
  "license": "MPL-2.0",
6
6
  "repository": {
@@ -32,8 +32,8 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@jsorm/core": "1.0.2",
36
- "@jsorm/compiler": "0.1.1",
35
+ "@jsorm/core": "1.2.0",
36
+ "@jsorm/compiler": "0.2.0",
37
37
  "better-sqlite3": "^13.0.3"
38
38
  },
39
39
  "devDependencies": {