@oino-ts/db-bunsqlite 0.13.0 → 0.13.2

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.
@@ -131,6 +131,17 @@ class OINODbBunSqlite extends db_1.OINODb {
131
131
  else if (((sqlType == "DATETIME") || (sqlType == "DATE")) && (typeof (sqlValue) == "string") && (sqlValue != "")) {
132
132
  return new Date(sqlValue);
133
133
  }
134
+ else if ((sqlType == "BOOLEAN")) {
135
+ return sqlValue == 1;
136
+ }
137
+ else if ((sqlType == "BLOB")) {
138
+ if (sqlValue instanceof Uint8Array) {
139
+ return Buffer.from(sqlValue);
140
+ }
141
+ else {
142
+ return sqlValue;
143
+ }
144
+ }
134
145
  else {
135
146
  return sqlValue;
136
147
  }
@@ -250,6 +261,7 @@ class OINODbBunSqlite extends db_1.OINODb {
250
261
  field_str = field_str.trim();
251
262
  let field_params = this._parseDbFieldParams(field_str);
252
263
  let field_match = OINODbBunSqlite._tableFieldTypeRegex.exec(field_str);
264
+ // console.log("OINODbBunSqlite.initializeApiDatamodel: field_match", field_match)
253
265
  if ((!field_match) || (field_match.length < 3)) {
254
266
  let primarykey_match = OINODbBunSqlite._tablePrimarykeyRegex.exec(field_str);
255
267
  let foreignkey_match = OINODbBunSqlite._tableForeignkeyRegex.exec(field_str);
@@ -128,6 +128,17 @@ export class OINODbBunSqlite extends OINODb {
128
128
  else if (((sqlType == "DATETIME") || (sqlType == "DATE")) && (typeof (sqlValue) == "string") && (sqlValue != "")) {
129
129
  return new Date(sqlValue);
130
130
  }
131
+ else if ((sqlType == "BOOLEAN")) {
132
+ return sqlValue == 1;
133
+ }
134
+ else if ((sqlType == "BLOB")) {
135
+ if (sqlValue instanceof Uint8Array) {
136
+ return Buffer.from(sqlValue);
137
+ }
138
+ else {
139
+ return sqlValue;
140
+ }
141
+ }
131
142
  else {
132
143
  return sqlValue;
133
144
  }
@@ -247,6 +258,7 @@ export class OINODbBunSqlite extends OINODb {
247
258
  field_str = field_str.trim();
248
259
  let field_params = this._parseDbFieldParams(field_str);
249
260
  let field_match = OINODbBunSqlite._tableFieldTypeRegex.exec(field_str);
261
+ // console.log("OINODbBunSqlite.initializeApiDatamodel: field_match", field_match)
250
262
  if ((!field_match) || (field_match.length < 3)) {
251
263
  let primarykey_match = OINODbBunSqlite._tablePrimarykeyRegex.exec(field_str);
252
264
  let foreignkey_match = OINODbBunSqlite._tableForeignkeyRegex.exec(field_str);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/db-bunsqlite",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "OINO TS package for using Bun Sqlite databases.",
5
5
  "author": "Matias Kiviniemi (pragmatta)",
6
6
  "license": "MPL-2.0",
@@ -20,7 +20,7 @@
20
20
  "module": "./dist/esm/index.js",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "dependencies": {
23
- "@oino-ts/db": "^0.13.0"
23
+ "@oino-ts/db": "^0.13.2"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/bun": "latest",
@@ -139,6 +139,15 @@ export class OINODbBunSqlite extends OINODb {
139
139
  } else if (((sqlType == "DATETIME") || (sqlType == "DATE")) && (typeof(sqlValue) == "string") && (sqlValue != "")) {
140
140
  return new Date(sqlValue)
141
141
 
142
+ } else if ((sqlType == "BOOLEAN")) {
143
+ return sqlValue == 1
144
+
145
+ } else if ((sqlType == "BLOB")) {
146
+ if (sqlValue instanceof Uint8Array) {
147
+ return Buffer.from(sqlValue)
148
+ } else {
149
+ return sqlValue
150
+ }
142
151
  } else {
143
152
  return sqlValue
144
153
  }
@@ -265,6 +274,7 @@ export class OINODbBunSqlite extends OINODb {
265
274
  field_str = field_str.trim()
266
275
  let field_params = this._parseDbFieldParams(field_str)
267
276
  let field_match = OINODbBunSqlite._tableFieldTypeRegex.exec(field_str)
277
+ // console.log("OINODbBunSqlite.initializeApiDatamodel: field_match", field_match)
268
278
  if ((!field_match) || (field_match.length < 3)) {
269
279
  let primarykey_match = OINODbBunSqlite._tablePrimarykeyRegex.exec(field_str)
270
280
  let foreignkey_match = OINODbBunSqlite._tableForeignkeyRegex.exec(field_str)