@sqb/builder 4.5.4 → 4.5.6
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.
package/cjs/serialize-context.js
CHANGED
|
@@ -72,6 +72,7 @@ class SerializeContext {
|
|
|
72
72
|
if (v instanceof Date) {
|
|
73
73
|
return this.serialize(enums_js_1.SerializationType.DATE_VALUE, v, () => this.dateToSQL(v));
|
|
74
74
|
}
|
|
75
|
+
return this.stringToSQL(JSON.stringify(v));
|
|
75
76
|
}
|
|
76
77
|
if (typeof v === 'string') {
|
|
77
78
|
return this.serialize(enums_js_1.SerializationType.STRING_VALUE, v, () => this.stringToSQL(v));
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpLike = void 0;
|
|
4
4
|
const enums_js_1 = require("../../enums.js");
|
|
5
|
-
const typeguards_js_1 = require("../../typeguards.js");
|
|
6
5
|
const comp_operator_js_1 = require("./comp-operator.js");
|
|
7
6
|
class OpLike extends comp_operator_js_1.CompOperator {
|
|
8
7
|
_operatorType = enums_js_1.OperatorType.like;
|
|
@@ -11,11 +10,10 @@ class OpLike extends comp_operator_js_1.CompOperator {
|
|
|
11
10
|
super(left, right);
|
|
12
11
|
}
|
|
13
12
|
__serialize(ctx, o) {
|
|
14
|
-
if (o.right
|
|
15
|
-
o.right = ctx.anyToSQL(o.right);
|
|
16
|
-
if (!o.right)
|
|
13
|
+
if (!o.right.expression)
|
|
17
14
|
return '';
|
|
18
|
-
o.right
|
|
15
|
+
if (o.right && typeof o.right.expression !== 'string')
|
|
16
|
+
o.right.expression = String(o.right.expression);
|
|
19
17
|
return ctx.serialize(this._type, o, (_ctx, _o) => this.__defaultSerialize(_ctx, _o));
|
|
20
18
|
}
|
|
21
19
|
}
|
package/esm/serialize-context.js
CHANGED
|
@@ -69,6 +69,7 @@ export class SerializeContext {
|
|
|
69
69
|
if (v instanceof Date) {
|
|
70
70
|
return this.serialize(SerializationType.DATE_VALUE, v, () => this.dateToSQL(v));
|
|
71
71
|
}
|
|
72
|
+
return this.stringToSQL(JSON.stringify(v));
|
|
72
73
|
}
|
|
73
74
|
if (typeof v === 'string') {
|
|
74
75
|
return this.serialize(SerializationType.STRING_VALUE, v, () => this.stringToSQL(v));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OperatorType } from '../../enums.js';
|
|
2
|
-
import { isSerializable } from '../../typeguards.js';
|
|
3
2
|
import { CompOperator } from './comp-operator.js';
|
|
4
3
|
export class OpLike extends CompOperator {
|
|
5
4
|
_operatorType = OperatorType.like;
|
|
@@ -8,11 +7,10 @@ export class OpLike extends CompOperator {
|
|
|
8
7
|
super(left, right);
|
|
9
8
|
}
|
|
10
9
|
__serialize(ctx, o) {
|
|
11
|
-
if (o.right
|
|
12
|
-
o.right = ctx.anyToSQL(o.right);
|
|
13
|
-
if (!o.right)
|
|
10
|
+
if (!o.right.expression)
|
|
14
11
|
return '';
|
|
15
|
-
o.right
|
|
12
|
+
if (o.right && typeof o.right.expression !== 'string')
|
|
13
|
+
o.right.expression = String(o.right.expression);
|
|
16
14
|
return ctx.serialize(this._type, o, (_ctx, _o) => this.__defaultSerialize(_ctx, _o));
|
|
17
15
|
}
|
|
18
16
|
}
|
package/esm/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataType, SerializationType } from './enums.js';
|
|
2
2
|
import type { SerializeContext } from './serialize-context.js';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type SerializeFunction = (ctx: SerializeContext, type: SerializationType | string, obj: any, defFn: DefaultSerializeFunction) => string | undefined;
|
|
4
|
+
export type DefaultSerializeFunction = (ctx: SerializeContext, o: any) => string;
|
|
5
|
+
export type IsReservedWordFunction = (ctx: SerializeContext, s: string) => boolean;
|
|
6
6
|
export interface SerializerExtension {
|
|
7
7
|
dialect: string;
|
|
8
8
|
serialize?: SerializeFunction;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/builder",
|
|
3
3
|
"description": "Extensible multi-dialect SQL query builder written with TypeScript",
|
|
4
|
-
"version": "4.5.
|
|
4
|
+
"version": "4.5.6",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"private": false,
|
|
7
7
|
"contributors": [
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
|
-
"putil-flattentext": "^2.1.
|
|
35
|
-
"putil-isplainobject": "^1.1.
|
|
36
|
-
"putil-merge": "^3.
|
|
37
|
-
"putil-varhelpers": "^1.6.
|
|
34
|
+
"putil-flattentext": "^2.1.1",
|
|
35
|
+
"putil-isplainobject": "^1.1.5",
|
|
36
|
+
"putil-merge": "^3.10.1",
|
|
37
|
+
"putil-varhelpers": "^1.6.5"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/debug": "^4.1.7"
|