@sqb/connect 4.0.9 → 4.0.13
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/dist/client/Adapter.d.ts +57 -0
- package/dist/client/Adapter.js +2 -0
- package/dist/client/Cursor.d.ts +116 -0
- package/dist/client/Cursor.js +250 -0
- package/dist/client/CursorStream.d.ts +29 -0
- package/dist/client/CursorStream.js +98 -0
- package/dist/client/FieldInfoMap.d.ts +10 -0
- package/dist/client/FieldInfoMap.js +33 -0
- package/dist/client/SqbClient.d.ts +70 -0
- package/dist/client/SqbClient.js +165 -0
- package/dist/client/SqbConnection.d.ts +74 -0
- package/dist/client/SqbConnection.js +272 -0
- package/dist/client/extensions.d.ts +4 -0
- package/dist/client/extensions.js +14 -0
- package/dist/client/helpers.d.ts +9 -0
- package/dist/client/helpers.js +133 -0
- package/dist/client/types.d.ts +189 -0
- package/dist/client/types.js +5 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +37 -0
- package/dist/orm/base-entity.class.d.ts +16 -0
- package/dist/orm/base-entity.class.js +56 -0
- package/dist/orm/commands/command.helper.d.ts +14 -0
- package/dist/orm/commands/command.helper.js +140 -0
- package/dist/orm/commands/count.command.d.ts +11 -0
- package/dist/orm/commands/count.command.js +30 -0
- package/dist/orm/commands/create.command.d.ts +20 -0
- package/dist/orm/commands/create.command.js +83 -0
- package/dist/orm/commands/destroy.command.d.ts +11 -0
- package/dist/orm/commands/destroy.command.js +30 -0
- package/dist/orm/commands/find.command.d.ts +44 -0
- package/dist/orm/commands/find.command.js +308 -0
- package/dist/orm/commands/row-converter.d.ts +55 -0
- package/dist/orm/commands/row-converter.js +187 -0
- package/dist/orm/commands/update.command.d.ts +22 -0
- package/dist/orm/commands/update.command.js +82 -0
- package/dist/orm/decorators/column.decorator.d.ts +4 -0
- package/dist/orm/decorators/column.decorator.js +14 -0
- package/dist/orm/decorators/embedded.decorator.d.ts +2 -0
- package/dist/orm/decorators/embedded.decorator.js +17 -0
- package/dist/orm/decorators/entity.decorator.d.ts +6 -0
- package/dist/orm/decorators/entity.decorator.js +23 -0
- package/dist/orm/decorators/events.decorator.d.ts +6 -0
- package/dist/orm/decorators/events.decorator.js +76 -0
- package/dist/orm/decorators/foreignkey.decorator.d.ts +2 -0
- package/dist/orm/decorators/foreignkey.decorator.js +13 -0
- package/dist/orm/decorators/index.decorator.d.ts +3 -0
- package/dist/orm/decorators/index.decorator.js +22 -0
- package/dist/orm/decorators/link.decorator.d.ts +23 -0
- package/dist/orm/decorators/link.decorator.js +88 -0
- package/dist/orm/decorators/primarykey.decorator.d.ts +3 -0
- package/dist/orm/decorators/primarykey.decorator.js +23 -0
- package/dist/orm/decorators/transform.decorator.d.ts +3 -0
- package/dist/orm/decorators/transform.decorator.js +24 -0
- package/dist/orm/model/abstract-entityelement.d.ts +8 -0
- package/dist/orm/model/abstract-entityelement.js +10 -0
- package/dist/orm/model/association-node.d.ts +9 -0
- package/dist/orm/model/association-node.js +25 -0
- package/dist/orm/model/association.d.ts +28 -0
- package/dist/orm/model/association.js +129 -0
- package/dist/orm/model/entity-association-element.d.ts +9 -0
- package/dist/orm/model/entity-association-element.js +13 -0
- package/dist/orm/model/entity-column-element.d.ts +68 -0
- package/dist/orm/model/entity-column-element.js +27 -0
- package/dist/orm/model/entity-model.d.ts +59 -0
- package/dist/orm/model/entity-model.js +295 -0
- package/dist/orm/model/entity-object-element.d.ts +12 -0
- package/dist/orm/model/entity-object-element.js +24 -0
- package/dist/orm/model/index-meta.d.ts +9 -0
- package/dist/orm/model/index-meta.js +16 -0
- package/dist/orm/model/link-chain.d.ts +15 -0
- package/dist/orm/model/link-chain.js +50 -0
- package/dist/orm/orm.const.d.ts +2 -0
- package/dist/orm/orm.const.js +5 -0
- package/dist/orm/orm.type.d.ts +112 -0
- package/dist/orm/orm.type.js +2 -0
- package/dist/orm/repository.class.d.ts +125 -0
- package/dist/orm/repository.class.js +217 -0
- package/dist/orm/util/entity-mapping.d.ts +12 -0
- package/dist/orm/util/entity-mapping.js +154 -0
- package/dist/orm/util/extract-keyvalues.d.ts +2 -0
- package/dist/orm/util/extract-keyvalues.js +60 -0
- package/dist/orm/util/orm.helper.d.ts +14 -0
- package/dist/orm/util/orm.helper.js +39 -0
- package/dist/orm/util/serialize-element.d.ts +2 -0
- package/dist/orm/util/serialize-element.js +43 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OmitEntity = exports.PickEntity = exports.UnionEntity = exports.omitEntityInto = exports.pickEntityInto = exports.mixinEntities = void 0;
|
|
4
|
+
const entity_model_1 = require("../model/entity-model");
|
|
5
|
+
const association_1 = require("../model/association");
|
|
6
|
+
const index_meta_1 = require("../model/index-meta");
|
|
7
|
+
function mixinEntities(derived, classARef, classBRef, classCRef, classDRef, classERef, classFRef) {
|
|
8
|
+
const trg = entity_model_1.EntityModel.attachTo(derived);
|
|
9
|
+
for (const classRef of [classARef, classBRef, classCRef, classDRef, classERef, classFRef]) {
|
|
10
|
+
if (!classRef)
|
|
11
|
+
continue;
|
|
12
|
+
const src = entity_model_1.EntityModel.get(classRef);
|
|
13
|
+
if (!src)
|
|
14
|
+
return derived;
|
|
15
|
+
trg.tableName = src.tableName;
|
|
16
|
+
if (!trg.primaryIndex && src.primaryIndex) {
|
|
17
|
+
trg.primaryIndex = new index_meta_1.IndexMeta(trg, src.primaryIndex.columns, src.primaryIndex);
|
|
18
|
+
}
|
|
19
|
+
if (src.foreignKeys) {
|
|
20
|
+
trg.foreignKeys = trg.foreignKeys || [];
|
|
21
|
+
for (const fk of src.foreignKeys) {
|
|
22
|
+
const newFk = new association_1.Association(fk.name, { ...fk, source: derived });
|
|
23
|
+
trg.foreignKeys.push(newFk);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (src.indexes) {
|
|
27
|
+
trg.indexes = trg.indexes || [];
|
|
28
|
+
for (const idx of src.indexes) {
|
|
29
|
+
const newIdx = new index_meta_1.IndexMeta(trg, idx.columns, idx);
|
|
30
|
+
trg.indexes.push(newIdx);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (src.eventListeners) {
|
|
34
|
+
trg.eventListeners = trg.eventListeners || [];
|
|
35
|
+
trg.eventListeners.push(...src.eventListeners);
|
|
36
|
+
}
|
|
37
|
+
src.elements.forEach((p, n) => {
|
|
38
|
+
const o = Object.assign({}, p);
|
|
39
|
+
o.entity = trg;
|
|
40
|
+
Object.setPrototypeOf(o, Object.getPrototypeOf(p));
|
|
41
|
+
trg.elements.set(n, o);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return derived;
|
|
45
|
+
}
|
|
46
|
+
exports.mixinEntities = mixinEntities;
|
|
47
|
+
function pickEntityInto(derived, classRef, keys) {
|
|
48
|
+
const trg = entity_model_1.EntityModel.attachTo(derived);
|
|
49
|
+
const src = entity_model_1.EntityModel.get(classRef);
|
|
50
|
+
if (!src)
|
|
51
|
+
return derived;
|
|
52
|
+
trg.tableName = src.tableName;
|
|
53
|
+
trg.schema = src.schema;
|
|
54
|
+
trg.comment = src.comment;
|
|
55
|
+
trg.primaryIndex = src.primaryIndex;
|
|
56
|
+
const pickKeys = keys.map(x => x.toLowerCase());
|
|
57
|
+
for (const fk of src.foreignKeys) {
|
|
58
|
+
if (fk.sourceKey && pickKeys.includes(fk.sourceKey.toLowerCase())) {
|
|
59
|
+
const newFk = new association_1.Association(fk.name, { ...fk, source: derived });
|
|
60
|
+
trg.foreignKeys.push(newFk);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const idx of src.indexes) {
|
|
64
|
+
if (!idx.columns.find(x => !pickKeys.includes(x.toLowerCase()))) {
|
|
65
|
+
const newIdx = new index_meta_1.IndexMeta(trg, idx.columns, idx);
|
|
66
|
+
trg.indexes.push(newIdx);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
trg.eventListeners.push(...src.eventListeners);
|
|
70
|
+
src.elements.forEach((p, n) => {
|
|
71
|
+
if (pickKeys.includes(n))
|
|
72
|
+
trg.elements.set(n, p);
|
|
73
|
+
});
|
|
74
|
+
return derived;
|
|
75
|
+
}
|
|
76
|
+
exports.pickEntityInto = pickEntityInto;
|
|
77
|
+
function omitEntityInto(derived, classRef, keys) {
|
|
78
|
+
const trg = entity_model_1.EntityModel.attachTo(derived);
|
|
79
|
+
const src = entity_model_1.EntityModel.get(classRef);
|
|
80
|
+
if (!src)
|
|
81
|
+
return derived;
|
|
82
|
+
trg.tableName = src.tableName;
|
|
83
|
+
trg.schema = src.schema;
|
|
84
|
+
trg.comment = src.comment;
|
|
85
|
+
trg.primaryIndex = src.primaryIndex;
|
|
86
|
+
const omitKeys = keys.map(x => x.toLowerCase());
|
|
87
|
+
for (const fk of src.foreignKeys) {
|
|
88
|
+
if (!(fk.sourceKey && omitKeys.includes(fk.sourceKey.toLowerCase()))) {
|
|
89
|
+
const newFk = new association_1.Association(fk.name, { ...fk, source: derived });
|
|
90
|
+
trg.foreignKeys.push(newFk);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const idx of src.indexes) {
|
|
94
|
+
if (!idx.columns.find(x => omitKeys.includes(x.toLowerCase()))) {
|
|
95
|
+
const newIdx = new index_meta_1.IndexMeta(trg, idx.columns, idx);
|
|
96
|
+
trg.indexes.push(newIdx);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
trg.eventListeners.push(...src.eventListeners);
|
|
100
|
+
src.elements.forEach((p, n) => {
|
|
101
|
+
if (!omitKeys.includes(n.toLowerCase()))
|
|
102
|
+
trg.elements.set(n.toLowerCase(), p);
|
|
103
|
+
});
|
|
104
|
+
trg.elements.forEach((p, n) => {
|
|
105
|
+
if (omitKeys.includes(n.toLowerCase()))
|
|
106
|
+
trg.elements.delete(n.toLowerCase());
|
|
107
|
+
});
|
|
108
|
+
return derived;
|
|
109
|
+
}
|
|
110
|
+
exports.omitEntityInto = omitEntityInto;
|
|
111
|
+
function UnionEntity(classARef, classBRef) {
|
|
112
|
+
class UnionEntityClass {
|
|
113
|
+
constructor(...args) {
|
|
114
|
+
inheritPropertyInitializers(this, classARef, args);
|
|
115
|
+
inheritPropertyInitializers(this, classBRef, args);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return mixinEntities(UnionEntityClass, classARef, classBRef);
|
|
119
|
+
}
|
|
120
|
+
exports.UnionEntity = UnionEntity;
|
|
121
|
+
function PickEntity(classRef, keys) {
|
|
122
|
+
class PickEntityClass {
|
|
123
|
+
constructor(...args) {
|
|
124
|
+
inheritPropertyInitializers(this, classRef, args);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return pickEntityInto(PickEntityClass, classRef, keys);
|
|
128
|
+
}
|
|
129
|
+
exports.PickEntity = PickEntity;
|
|
130
|
+
function OmitEntity(classRef, keys) {
|
|
131
|
+
class OmitEntityClass {
|
|
132
|
+
constructor(...args) {
|
|
133
|
+
inheritPropertyInitializers(this, classRef, args);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return omitEntityInto(OmitEntityClass, classRef, keys);
|
|
137
|
+
}
|
|
138
|
+
exports.OmitEntity = OmitEntity;
|
|
139
|
+
function inheritPropertyInitializers(target, sourceClass, constructorArgs, isPropertyInherited) {
|
|
140
|
+
try {
|
|
141
|
+
const tempInstance = new sourceClass(...constructorArgs);
|
|
142
|
+
const keys = Object.getOwnPropertyNames(tempInstance);
|
|
143
|
+
for (const key of keys) {
|
|
144
|
+
const srcDesc = Object.getOwnPropertyDescriptor(tempInstance, key);
|
|
145
|
+
const trgDesc = Object.getOwnPropertyDescriptor(target, key);
|
|
146
|
+
if (!srcDesc || trgDesc || (isPropertyInherited && !isPropertyInherited(key)))
|
|
147
|
+
continue;
|
|
148
|
+
Object.defineProperty(target, key, srcDesc);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
//
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractKeyValues = void 0;
|
|
4
|
+
const orm_helper_1 = require("./orm.helper");
|
|
5
|
+
function extractKeyValues(entityDef, valueOrInstance, keepOther) {
|
|
6
|
+
const primaryIndex = entityDef.primaryIndex;
|
|
7
|
+
if (!primaryIndex)
|
|
8
|
+
throw new Error(`No primary fields defined for "${entityDef.name}" entity`);
|
|
9
|
+
const validateCol = (k) => {
|
|
10
|
+
const col = entityDef.getElement(k);
|
|
11
|
+
if (!col)
|
|
12
|
+
throw new Error(`Unknown column (${k}) defined as primary key in entity "${entityDef.name}"`);
|
|
13
|
+
if (!(0, orm_helper_1.isColumnElement)(col))
|
|
14
|
+
throw new Error(`Column (${k}) defined as primary key in entity "${entityDef.name}" is not a data column`);
|
|
15
|
+
};
|
|
16
|
+
// if entity's primary key has more than one key field
|
|
17
|
+
if (primaryIndex.columns.length > 1) {
|
|
18
|
+
if (typeof valueOrInstance !== 'object')
|
|
19
|
+
throw new Error(`"${entityDef.name}" entity` +
|
|
20
|
+
` has more than one primary key field and you must provide all values with an key/value pair`);
|
|
21
|
+
const valueKeys = Object.keys(valueOrInstance);
|
|
22
|
+
const valueKeysUpper = valueKeys.map(x => x.toUpperCase());
|
|
23
|
+
const out = {};
|
|
24
|
+
for (const k of primaryIndex.columns) {
|
|
25
|
+
const i = valueKeysUpper.indexOf(k.toUpperCase());
|
|
26
|
+
if (i < 0)
|
|
27
|
+
throw new Error(`Value of key field "${entityDef.name}.${k}" required to perform this operation`);
|
|
28
|
+
validateCol(k);
|
|
29
|
+
out[k] = valueOrInstance[valueKeys[i]];
|
|
30
|
+
}
|
|
31
|
+
if (keepOther) {
|
|
32
|
+
for (let i = 0; i < valueKeys.length; i++) {
|
|
33
|
+
if (primaryIndex.columns.find(x => x.toUpperCase() === valueKeysUpper[i]))
|
|
34
|
+
continue;
|
|
35
|
+
out[valueKeys[i]] = valueOrInstance[valueKeys[i]];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
const primaryColumnName = primaryIndex.columns[0];
|
|
41
|
+
validateCol(primaryColumnName);
|
|
42
|
+
if (typeof valueOrInstance === 'object') {
|
|
43
|
+
const valueKeys = Object.keys(valueOrInstance);
|
|
44
|
+
const valueKeysUpper = valueKeys.map(x => x.toUpperCase());
|
|
45
|
+
const k = valueKeysUpper.indexOf(primaryColumnName.toUpperCase());
|
|
46
|
+
if (k < 0)
|
|
47
|
+
throw new Error(`Value of key field "${entityDef.name}.${primaryColumnName}" required to perform this operation`);
|
|
48
|
+
const out = { [primaryColumnName]: valueOrInstance[valueKeys[k]] };
|
|
49
|
+
if (keepOther) {
|
|
50
|
+
for (let i = 0; i < valueKeys.length; i++) {
|
|
51
|
+
if (primaryIndex.columns.find(x => x.toUpperCase() === valueKeysUpper[i]))
|
|
52
|
+
continue;
|
|
53
|
+
out[valueKeys[i]] = valueOrInstance[valueKeys[i]];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
return { [primaryColumnName]: valueOrInstance };
|
|
59
|
+
}
|
|
60
|
+
exports.extractKeyValues = extractKeyValues;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Type } from 'ts-gems';
|
|
3
|
+
import type { TypeThunk } from '../orm.type';
|
|
4
|
+
import type { EntityModel } from '../model/entity-model';
|
|
5
|
+
import type { EntityColumnElement } from '../model/entity-column-element';
|
|
6
|
+
import type { EntityObjectElement } from '../model/entity-object-element';
|
|
7
|
+
import type { EntityAssociationElement } from '../model/entity-association-element';
|
|
8
|
+
export declare function isClass(fn: any): fn is Type;
|
|
9
|
+
export declare function isEntityClass(fn: any): fn is Type;
|
|
10
|
+
export declare function isColumnElement(f: any): f is EntityColumnElement;
|
|
11
|
+
export declare const isObjectElement: (f: any) => f is EntityObjectElement;
|
|
12
|
+
export declare const isAssociationElement: (f: any) => f is EntityAssociationElement;
|
|
13
|
+
export declare function resolveEntity(ctorThunk: TypeThunk): Promise<Type | undefined>;
|
|
14
|
+
export declare function resolveEntityMeta(ctorThunk: TypeThunk): Promise<EntityModel | undefined>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveEntityMeta = exports.resolveEntity = exports.isAssociationElement = exports.isObjectElement = exports.isColumnElement = exports.isEntityClass = exports.isClass = void 0;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const orm_const_1 = require("../orm.const");
|
|
6
|
+
function isClass(fn) {
|
|
7
|
+
return typeof fn === 'function' && /^\s*class/.test(fn.toString());
|
|
8
|
+
}
|
|
9
|
+
exports.isClass = isClass;
|
|
10
|
+
function isEntityClass(fn) {
|
|
11
|
+
return !!(isClass(fn) && fn[orm_const_1.ENTITY_DEFINITION_KEY]);
|
|
12
|
+
}
|
|
13
|
+
exports.isEntityClass = isEntityClass;
|
|
14
|
+
function isColumnElement(f) {
|
|
15
|
+
return !!(f && f.entity && f.kind === 'column');
|
|
16
|
+
}
|
|
17
|
+
exports.isColumnElement = isColumnElement;
|
|
18
|
+
const isObjectElement = (f) => {
|
|
19
|
+
return !!(f && f.entity && f.kind === 'object');
|
|
20
|
+
};
|
|
21
|
+
exports.isObjectElement = isObjectElement;
|
|
22
|
+
const isAssociationElement = (f) => {
|
|
23
|
+
return !!(f && f.entity && f.kind === 'association');
|
|
24
|
+
};
|
|
25
|
+
exports.isAssociationElement = isAssociationElement;
|
|
26
|
+
async function resolveEntity(ctorThunk) {
|
|
27
|
+
if (typeof ctorThunk !== 'function')
|
|
28
|
+
return;
|
|
29
|
+
if (!isClass(ctorThunk))
|
|
30
|
+
ctorThunk = await ctorThunk();
|
|
31
|
+
if (isEntityClass(ctorThunk))
|
|
32
|
+
return ctorThunk;
|
|
33
|
+
}
|
|
34
|
+
exports.resolveEntity = resolveEntity;
|
|
35
|
+
async function resolveEntityMeta(ctorThunk) {
|
|
36
|
+
const ctor = await resolveEntity(ctorThunk);
|
|
37
|
+
return ctor && ctor[orm_const_1.ENTITY_DEFINITION_KEY];
|
|
38
|
+
}
|
|
39
|
+
exports.resolveEntityMeta = resolveEntityMeta;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeColumn = void 0;
|
|
4
|
+
const builder_1 = require("@sqb/builder");
|
|
5
|
+
const orm_helper_1 = require("./orm.helper");
|
|
6
|
+
function serializeColumn(col, v) {
|
|
7
|
+
if ((0, orm_helper_1.isColumnElement)(col)) {
|
|
8
|
+
if (col.isArray) {
|
|
9
|
+
if (Array.isArray(v))
|
|
10
|
+
return v.map(x => serializeDataValue(col.dataType || builder_1.DataType.VARCHAR, x));
|
|
11
|
+
return [serializeDataValue(col.dataType || builder_1.DataType.VARCHAR, v)];
|
|
12
|
+
}
|
|
13
|
+
return serializeDataValue(col.dataType || builder_1.DataType.VARCHAR, v);
|
|
14
|
+
}
|
|
15
|
+
if (typeof v === 'object' && typeof v.toJSON === 'function')
|
|
16
|
+
return v.toJSON();
|
|
17
|
+
return v;
|
|
18
|
+
}
|
|
19
|
+
exports.serializeColumn = serializeColumn;
|
|
20
|
+
const padZero = (n) => (n < 9 ? '0' : '') + n;
|
|
21
|
+
function serializeDataValue(dataType, v) {
|
|
22
|
+
if (v == null)
|
|
23
|
+
return;
|
|
24
|
+
if (v instanceof Date &&
|
|
25
|
+
(dataType === builder_1.DataType.DATE || dataType === builder_1.DataType.TIMESTAMP)) {
|
|
26
|
+
return v.getFullYear() + '-' +
|
|
27
|
+
padZero(v.getMonth() + 1) + '-' +
|
|
28
|
+
padZero(v.getDate()) + (dataType === builder_1.DataType.TIMESTAMP ?
|
|
29
|
+
'T' + padZero(v.getHours()) + ':' +
|
|
30
|
+
padZero(v.getMinutes()) + ':' +
|
|
31
|
+
padZero(v.getSeconds()) : '');
|
|
32
|
+
}
|
|
33
|
+
if (v instanceof Buffer)
|
|
34
|
+
return v.toString('base64');
|
|
35
|
+
if (typeof v === 'number' && (dataType === builder_1.DataType.SMALLINT ||
|
|
36
|
+
dataType === builder_1.DataType.INTEGER))
|
|
37
|
+
return Math.trunc(v);
|
|
38
|
+
if (typeof v === 'bigint')
|
|
39
|
+
return v.toString();
|
|
40
|
+
if (v && typeof v === 'object' && typeof v.toJSON === 'function')
|
|
41
|
+
return v.toJSON();
|
|
42
|
+
return v;
|
|
43
|
+
}
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/connect",
|
|
3
3
|
"description": "Multi-dialect database connection framework written with TypeScript",
|
|
4
|
-
"version": "4.0.
|
|
5
|
-
"author": "Panates
|
|
4
|
+
"version": "4.0.13",
|
|
5
|
+
"author": "Panates",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>"
|
|
8
8
|
],
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"putil-varhelpers": "^1.6.1",
|
|
40
40
|
"reflect-metadata": "^0.1.13",
|
|
41
41
|
"strict-typed-events": "^2.1.0",
|
|
42
|
-
"ts-gems": "^1.
|
|
42
|
+
"ts-gems": "^1.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/debug": "^4.1.6",
|