@sqb/connect 4.1.1 → 4.1.4
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/orm/backward.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { Entity } from './decorators/entity.decorator';
|
|
|
3
3
|
export declare function getInsertColumnNames<T, K extends keyof PickWritable<T>>(ctor: Type<T>): K[];
|
|
4
4
|
export declare function getUpdateColumnNames<T, K extends keyof PickWritable<T>>(ctor: Type<T>): K[];
|
|
5
5
|
export declare function getNonAssociationElementNames<T, K extends keyof PickWritable<T>>(ctor: Type<T>): K[];
|
|
6
|
+
export declare function mixinEntities<A, B>(derivedCtor: Type<A>, baseB: Type<B>): Type<A & B>;
|
|
7
|
+
export declare function mixinEntities<A, B, C>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>): Type<A & B & C>;
|
|
8
|
+
export declare function mixinEntities<A, B, C, D>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>, baseD: Type<D>): Type<A & B & C & D>;
|
|
9
|
+
export declare function mixinEntities<A, B, C, D, E>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>, baseD: Type<D>, baseE: Type<E>): Type<A & B & C & D & E>;
|
|
10
|
+
export declare function mixinEntities<A, B, C, D, E, F>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>, baseD: Type<D>, baseE: Type<E>, baseF: Type<F>): Type<A & B & C & D & E & F>;
|
|
6
11
|
export declare const OmitEntity: typeof Entity.Omit;
|
|
7
12
|
export declare const PickEntity: typeof Entity.Pick;
|
|
8
13
|
export declare const UnionEntity: typeof Entity.Union;
|
package/dist/orm/backward.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnionEntity = exports.PickEntity = exports.OmitEntity = exports.getNonAssociationElementNames = exports.getUpdateColumnNames = exports.getInsertColumnNames = void 0;
|
|
3
|
+
exports.UnionEntity = exports.PickEntity = exports.OmitEntity = exports.mixinEntities = exports.getNonAssociationElementNames = exports.getUpdateColumnNames = exports.getInsertColumnNames = void 0;
|
|
4
4
|
const entity_decorator_1 = require("./decorators/entity.decorator");
|
|
5
5
|
function getInsertColumnNames(ctor) {
|
|
6
6
|
return entity_decorator_1.Entity.getInsertColumnNames(ctor);
|
|
@@ -14,6 +14,11 @@ function getNonAssociationElementNames(ctor) {
|
|
|
14
14
|
return entity_decorator_1.Entity.getNonAssociationElementNames(ctor);
|
|
15
15
|
}
|
|
16
16
|
exports.getNonAssociationElementNames = getNonAssociationElementNames;
|
|
17
|
+
function mixinEntities(derivedCtor, ...bases) {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
return entity_decorator_1.Entity.mixin(derivedCtor, ...bases);
|
|
20
|
+
}
|
|
21
|
+
exports.mixinEntities = mixinEntities;
|
|
17
22
|
exports.OmitEntity = entity_decorator_1.Entity.Omit;
|
|
18
23
|
exports.PickEntity = entity_decorator_1.Entity.Pick;
|
|
19
24
|
exports.UnionEntity = entity_decorator_1.Entity.Union;
|
|
@@ -23,6 +23,11 @@ export declare namespace Entity {
|
|
|
23
23
|
function getUpdateColumnNames(ctor: Type): string[];
|
|
24
24
|
function getPrimaryIndex(ctor: Type): Maybe<IndexMetadata>;
|
|
25
25
|
function getPrimaryIndexColumns(ctor: Type): ColumnElementMetadata[];
|
|
26
|
+
function mixin<A, B>(derivedCtor: Type<A>, baseB: Type<B>): Type<A & B>;
|
|
27
|
+
function mixin<A, B, C>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>): Type<A & B & C>;
|
|
28
|
+
function mixin<A, B, C, D>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>, baseD: Type<D>): Type<A & B & C & D>;
|
|
29
|
+
function mixin<A, B, C, D, E>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>, baseD: Type<D>, baseE: Type<E>): Type<A & B & C & D & E>;
|
|
30
|
+
function mixin<A, B, C, D, E, F>(derivedCtor: Type<A>, baseB: Type<B>, baseC: Type<C>, baseD: Type<D>, baseE: Type<E>, baseF: Type<F>): Type<A & B & C & D & E & F>;
|
|
26
31
|
function Pick<T, K extends keyof T>(classRef: Type<T>, keys: readonly K[]): Type<Pick<T, typeof keys[number]>>;
|
|
27
32
|
function Omit<T, K extends keyof T>(classRef: Type<T>, keys: readonly K[]): Type<Omit<T, typeof keys[number]>>;
|
|
28
33
|
function Union<A, B>(baseA: Type<A>, baseB: Type<B>): Type<A & B>;
|
|
@@ -94,6 +94,20 @@ exports.Entity = Entity;
|
|
|
94
94
|
return entity_metadata_1.EntityMetadata.getPrimaryIndexColumns(model);
|
|
95
95
|
}
|
|
96
96
|
Entity.getPrimaryIndexColumns = getPrimaryIndexColumns;
|
|
97
|
+
function mixin(derivedCtor, ...bases) {
|
|
98
|
+
for (const base of bases) {
|
|
99
|
+
if (!base)
|
|
100
|
+
continue;
|
|
101
|
+
(0, apply_mixins_1.applyMixins)(derivedCtor, base);
|
|
102
|
+
const srcMeta = entity_metadata_1.EntityMetadata.get(base);
|
|
103
|
+
if (srcMeta) {
|
|
104
|
+
const trgMeta = entity_metadata_1.EntityMetadata.inject(derivedCtor);
|
|
105
|
+
entity_metadata_1.EntityMetadata.mixin(trgMeta, srcMeta);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return derivedCtor;
|
|
109
|
+
}
|
|
110
|
+
Entity.mixin = mixin;
|
|
97
111
|
function Pick(classRef, keys) {
|
|
98
112
|
const PickEntityClass = class {
|
|
99
113
|
constructor(...args) {
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.applyMixins = void 0;
|
|
4
4
|
function applyMixins(derivedCtor, baseCtor, filter) {
|
|
5
5
|
for (const name of Object.getOwnPropertyNames(baseCtor.prototype)) {
|
|
6
|
-
if (
|
|
6
|
+
if ((name === 'constructor' || name === '__proto__' || name === 'toJSON' || name === 'toString') ||
|
|
7
|
+
filter && !filter(name))
|
|
7
8
|
continue;
|
|
8
9
|
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||
|
|
9
10
|
Object.create(null));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/connect",
|
|
3
3
|
"description": "Multi-dialect database connection framework written with TypeScript",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.4",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>"
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"putil-merge": "^3.8.0",
|
|
37
37
|
"putil-promisify": "^1.8.5",
|
|
38
38
|
"putil-taskqueue": "^2.5.4",
|
|
39
|
-
"putil-varhelpers": "^1.6.
|
|
39
|
+
"putil-varhelpers": "^1.6.4",
|
|
40
40
|
"reflect-metadata": "^0.1.13",
|
|
41
41
|
"strict-typed-events": "^2.1.0",
|
|
42
42
|
"ts-gems": "^1.5.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/debug": "^4.1.7",
|
|
46
|
-
"@types/lodash": "^4.14.
|
|
46
|
+
"@types/lodash": "^4.14.182"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@sqb/builder": "^4.
|
|
49
|
+
"@sqb/builder": "^4.1.0"
|
|
50
50
|
},
|
|
51
51
|
"main": "dist/index.js",
|
|
52
52
|
"types": "dist/index.d.ts",
|
|
@@ -72,4 +72,4 @@
|
|
|
72
72
|
"lint": "eslint src/** --no-error-on-unmatched-pattern",
|
|
73
73
|
"test": "TS_NODE_PROJECT='./test/tsconfig.json' mocha -r ts-node/register -r tsconfig-paths/register --reporter spec test/**/*.spec.ts"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|