@sqb/connect 4.5.0 → 4.5.1
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/esm/orm/repository.class.d.ts +18 -18
- package/esm/types.d.ts +3 -2
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Type } from 'ts-gems';
|
|
2
2
|
import { FieldInfoMap } from '../client/field-info-map.js';
|
|
3
3
|
import { SqbClient } from '../client/sqb-client.js';
|
|
4
4
|
import { SqbConnection } from '../client/sqb-connection.js';
|
|
5
5
|
import { QueryRequest, TransactionFunction } from '../client/types.js';
|
|
6
|
-
import {
|
|
6
|
+
import { EntityInput, EntityOutput } from '../types.js';
|
|
7
7
|
import { EntityMetadata } from './model/entity-metadata.js';
|
|
8
8
|
export declare namespace Repository {
|
|
9
9
|
type TransformRowFunction = (fields: FieldInfoMap, row: object, obj: object) => void;
|
|
@@ -75,23 +75,23 @@ export declare class Repository<T> extends Repository_base {
|
|
|
75
75
|
constructor(entityDef: EntityMetadata, executor: SqbClient | SqbConnection, schema?: string);
|
|
76
76
|
get entity(): EntityMetadata;
|
|
77
77
|
get type(): Type<T>;
|
|
78
|
-
create(values:
|
|
79
|
-
createOnly(values:
|
|
78
|
+
create(values: EntityInput<T>, options?: Repository.CreateOptions): Promise<EntityOutput<T>>;
|
|
79
|
+
createOnly(values: EntityInput<T>, options?: Repository.CreateOptions): Promise<void>;
|
|
80
80
|
exists(keyValue: any | Record<string, any>, options?: Repository.ExistsOptions): Promise<boolean>;
|
|
81
81
|
count(options?: Repository.CountOptions): Promise<number>;
|
|
82
|
-
findAll(options?: Repository.FindAllOptions): Promise<
|
|
83
|
-
findOne(options?: Repository.FindOneOptions): Promise<
|
|
84
|
-
findByPk(keyValue: any | Record<string, any>, options?: Repository.GetOptions): Promise<
|
|
82
|
+
findAll(options?: Repository.FindAllOptions): Promise<EntityOutput<T>[]>;
|
|
83
|
+
findOne(options?: Repository.FindOneOptions): Promise<EntityOutput<T> | undefined>;
|
|
84
|
+
findByPk(keyValue: any | Record<string, any>, options?: Repository.GetOptions): Promise<EntityOutput<T> | undefined>;
|
|
85
85
|
destroy(keyValue: any | Record<string, any>, options?: Repository.DestroyOptions): Promise<boolean>;
|
|
86
86
|
destroyAll(options?: Repository.DestroyOptions): Promise<number>;
|
|
87
|
-
update(keyValue: any | Record<string, any>, values:
|
|
88
|
-
updateOnly(keyValue: any | Record<string, any>, values:
|
|
89
|
-
updateAll(values:
|
|
87
|
+
update(keyValue: any | Record<string, any>, values: EntityInput<T>, options?: Repository.UpdateOptions): Promise<EntityOutput<T> | undefined>;
|
|
88
|
+
updateOnly(keyValue: any | Record<string, any>, values: EntityInput<T>, options?: Repository.UpdateOptions): Promise<EntityOutput<T>>;
|
|
89
|
+
updateAll(values: EntityInput<T>, options?: Repository.UpdateAllOptions): Promise<number>;
|
|
90
90
|
protected _execute(fn: TransactionFunction, opts?: Repository.CommandOptions): Promise<any>;
|
|
91
|
-
protected _create(values:
|
|
91
|
+
protected _create(values: EntityInput<T>, options: Repository.CreateOptions & {
|
|
92
92
|
connection: SqbConnection;
|
|
93
|
-
}): Promise<
|
|
94
|
-
protected _createOnly(values:
|
|
93
|
+
}): Promise<EntityOutput<T>>;
|
|
94
|
+
protected _createOnly(values: EntityInput<T>, options: Repository.CreateOptions & {
|
|
95
95
|
connection: SqbConnection;
|
|
96
96
|
}): Promise<void>;
|
|
97
97
|
protected _exists(keyValue: any | Record<string, any>, options: Repository.ExistsOptions & {
|
|
@@ -102,23 +102,23 @@ export declare class Repository<T> extends Repository_base {
|
|
|
102
102
|
}): Promise<number>;
|
|
103
103
|
protected _findAll(options: Repository.FindAllOptions & {
|
|
104
104
|
connection: SqbConnection;
|
|
105
|
-
}): Promise<
|
|
105
|
+
}): Promise<EntityOutput<T>[]>;
|
|
106
106
|
protected _findOne(options: Repository.FindOneOptions & {
|
|
107
107
|
connection: SqbConnection;
|
|
108
|
-
}): Promise<
|
|
108
|
+
}): Promise<EntityOutput<T> | undefined>;
|
|
109
109
|
protected _findByPk(keyValue: any | Record<string, any>, options: Repository.GetOptions & {
|
|
110
110
|
connection: SqbConnection;
|
|
111
|
-
}): Promise<
|
|
111
|
+
}): Promise<EntityOutput<T> | undefined>;
|
|
112
112
|
protected _destroy(keyValue: any | Record<string, any>, options: Repository.DestroyOptions & {
|
|
113
113
|
connection: SqbConnection;
|
|
114
114
|
}): Promise<boolean>;
|
|
115
115
|
protected _destroyAll(options: Repository.DestroyOptions & {
|
|
116
116
|
connection: SqbConnection;
|
|
117
117
|
}): Promise<number>;
|
|
118
|
-
protected _update(keyValue: any | Record<string, any>, values:
|
|
118
|
+
protected _update(keyValue: any | Record<string, any>, values: EntityInput<T>, options: Repository.UpdateOptions & {
|
|
119
119
|
connection: SqbConnection;
|
|
120
120
|
}): Promise<Record<string, any> | undefined>;
|
|
121
|
-
protected _updateAll(values:
|
|
121
|
+
protected _updateAll(values: EntityInput<T>, options: Repository.UpdateAllOptions & {
|
|
122
122
|
connection: SqbConnection;
|
|
123
123
|
}): Promise<number>;
|
|
124
124
|
protected _emit(event: string, ...args: any[]): Promise<void>;
|
package/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Builtin, DeepPickWritable } from 'ts-gems';
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type EntityInput<T> = DeepNullableIfPartial<DeepPickWritable<T>>;
|
|
3
|
+
export declare type EntityOutput<T> = DeepNullableIfPartial<T>;
|
|
3
4
|
export declare type DeepNullableIfPartial<T> = _DeepNullableIfPartial<T>;
|
|
4
5
|
declare type _DeepNullableIfPartial<T> = T extends Builtin ? T : T extends Promise<infer U> ? Promise<DeepNullableIfPartial<U>> : T extends (infer U)[] ? DeepNullableIfPartial<U>[] : {
|
|
5
|
-
[P in keyof T]?: DeepNullableIfPartial<Exclude<T[P], undefined
|
|
6
|
+
[P in keyof T]?: DeepNullableIfPartial<Exclude<T[P], undefined>> | null;
|
|
6
7
|
};
|
|
7
8
|
export {};
|
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.5.
|
|
4
|
+
"version": "4.5.1",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/debug": "^4.1.7",
|
|
46
|
-
"@types/lodash": "^4.14.
|
|
46
|
+
"@types/lodash": "^4.14.185"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@sqb/builder": "^4.5.0"
|
|
@@ -86,4 +86,4 @@
|
|
|
86
86
|
"sqlite",
|
|
87
87
|
"mysql"
|
|
88
88
|
]
|
|
89
|
-
}
|
|
89
|
+
}
|