@cuboapp/database 1.0.1 → 1.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/db/utils.ts +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuboapp/database",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Database methods",
5
5
  "main": "src/index.ts",
6
6
  "repository": "git@cuboapp.gitlab.yandexcloud.net:cubo/database.git",
package/src/db/utils.ts CHANGED
@@ -21,7 +21,11 @@ export function dbPrepareUpdateQueryString(obj: Record<string, any>, prefix = ''
21
21
  } else if (typeof value === 'boolean') {
22
22
  val = value
23
23
  } else if (Array.isArray(value) || typeof value === 'object') {
24
- val = value ? JSON.stringify(value) : null
24
+ if (Buffer.isBuffer(value)) {
25
+ val = value
26
+ } else {
27
+ val = value ? JSON.stringify(value) : null
28
+ }
25
29
  }
26
30
 
27
31
  replacements[key + (prefix ? '_' + prefix : '')] = val
@@ -48,7 +52,11 @@ export function dbPrepareInsertQueryString(obj: Record<string, any>, prefix = ''
48
52
  } else if (typeof value === 'boolean') {
49
53
  val = value
50
54
  } else if (Array.isArray(value) || typeof value === 'object') {
51
- val = value ? JSON.stringify(value) : null
55
+ if (Buffer.isBuffer(value)) {
56
+ val = value
57
+ } else {
58
+ val = value ? JSON.stringify(value) : null
59
+ }
52
60
  }
53
61
 
54
62
  replacements[key + (prefix ? '_' + prefix : '')] = val