Comparing version 0.1.12-alpha.1 to 0.1.13-alpha.0
@@ -143,4 +143,3 @@ const { DatabaseMapper } = require('./DatabaseMapper') | ||
async stream (qs) { | ||
await this.waitForConnection() | ||
stream (qs) { | ||
return this.streamDb(qs) | ||
@@ -147,0 +146,0 @@ } |
const { getModelName } = require('../models/ModelRegistry') | ||
const { Transform } = require('stream') | ||
const { warn } = require('../logger') | ||
@@ -24,3 +25,3 @@ class DatabaseMapper extends Transform { | ||
inst.set(fieldNameStripped, null) | ||
// @TODO: Warn about this error! | ||
warn(e) | ||
} | ||
@@ -27,0 +28,0 @@ } |
@@ -115,4 +115,4 @@ const { And } = require('./And') | ||
async stream () { | ||
return await this.db.stream(this) | ||
stream () { | ||
return this.db.stream(this) | ||
} | ||
@@ -119,0 +119,0 @@ } |
@@ -11,28 +11,30 @@ const moment = require('moment') | ||
escapeChar (char) { | ||
switch (char) { | ||
case '\0': | ||
return '\\0' | ||
case '\x08': | ||
return '\\b' | ||
case '\x09': | ||
return '\\t' | ||
case '\x1a': | ||
return '\\z' | ||
case '\n': | ||
return '\\n' | ||
case '\r': | ||
return '\\r' | ||
case "'": | ||
case '\\': | ||
case '%': | ||
// prepends a backslash to backslash, percent, | ||
// and double/single quotes | ||
return '\\' + char | ||
default: | ||
return char | ||
} | ||
} | ||
escapeString (value) { | ||
// eslint-disable-next-line no-control-regex | ||
return value.replace(/[\0\x08\x09\x1a\n\r"'\\%]/g, function (char) { | ||
switch (char) { | ||
case '\0': | ||
return '\\0' | ||
case '\x08': | ||
return '\\b' | ||
case '\x09': | ||
return '\\t' | ||
case '\x1a': | ||
return '\\z' | ||
case '\n': | ||
return '\\n' | ||
case '\r': | ||
return '\\r' | ||
case "'": | ||
case '\\': | ||
case '%': | ||
// prepends a backslash to backslash, percent, | ||
// and double/single quotes | ||
return '\\' + char | ||
default: | ||
return char | ||
} | ||
}) | ||
return value.replace(/[\0\x08\x09\x1a\n\r"'\\%]/g, this.escapeChar) | ||
} | ||
@@ -39,0 +41,0 @@ |
@@ -120,4 +120,4 @@ const { And } = require('./And') | ||
async stream () { | ||
return (await super.stream()).pipe(this.getMapper()) | ||
stream () { | ||
return super.stream().pipe(this.getMapper()) | ||
} | ||
@@ -124,0 +124,0 @@ } |
@@ -27,5 +27,6 @@ const { Field } = require('../models/AttrModel') | ||
this.resolveObjectClass() | ||
if (value !== null && !(value instanceof this.model)) { | ||
if (value instanceof Object && value.constructor === Object) { | ||
return this.model.from(value) | ||
const preparsed = super.parse(value, inst) | ||
if (preparsed !== null && !(preparsed instanceof this.model)) { | ||
if (preparsed instanceof Object && preparsed.constructor === Object) { | ||
return this.model.from(preparsed) | ||
} | ||
@@ -35,6 +36,6 @@ throw new ValueError( | ||
this.model | ||
)}" but "${value}" was given` | ||
)}" but "${preparsed}" was given` | ||
) | ||
} | ||
return super.parse(value, inst) | ||
return preparsed | ||
} | ||
@@ -41,0 +42,0 @@ |
{ | ||
"name": "djorm", | ||
"version": "0.1.12-alpha.1", | ||
"version": "0.1.13-alpha.0", | ||
"description": "Django like ORM framework", | ||
@@ -39,3 +39,3 @@ "author": "Pavel Žák <pavel@zak.global>", | ||
}, | ||
"gitHead": "0a62648edf01e92f4ba57b5a7e39ec6be54ca535" | ||
"gitHead": "1cbe04a1e6110a47f86fe9b2fe2da73922c43a44" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2669
76032