@sqb/connect 4.5.5 → 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/esm/client/types.d.ts +11 -11
- package/esm/index.d.ts +2 -1
- package/esm/orm/commands/count.command.d.ts +1 -1
- package/esm/orm/commands/create.command.d.ts +2 -2
- package/esm/orm/commands/destroy.command.d.ts +1 -1
- package/esm/orm/commands/find.command.d.ts +1 -1
- package/esm/orm/commands/update.command.d.ts +2 -2
- package/esm/orm/decorators/link.decorator.d.ts +2 -2
- package/esm/orm/model/association-field-metadata.d.ts +1 -1
- package/esm/orm/model/column-field-metadata.d.ts +1 -1
- package/esm/orm/model/embedded-field-metadata.d.ts +1 -1
- package/esm/orm/model/entity-metadata.d.ts +2 -2
- package/esm/orm/orm.type.d.ts +9 -9
- package/esm/types.d.ts +4 -4
- package/package.json +10 -10
package/esm/client/types.d.ts
CHANGED
|
@@ -6,16 +6,16 @@ import type { Cursor } from './cursor';
|
|
|
6
6
|
import type { FieldInfoMap } from './field-info-map';
|
|
7
7
|
import type { SqbConnection } from './sqb-connection';
|
|
8
8
|
export { DataType } from '@sqb/builder';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
9
|
+
export type ExecuteHookFunction = (connection: SqbConnection, request: QueryRequest) => Promise<void>;
|
|
10
|
+
export type FetchFunction = (row: any, request: QueryRequest) => void;
|
|
11
|
+
export type ValueTransformFunction = (value: any, fieldInfo?: FieldInfo) => any;
|
|
12
|
+
export type TransactionFunction = (connection: SqbConnection) => Promise<any>;
|
|
13
|
+
export type RowType = 'array' | 'object';
|
|
14
|
+
export type FieldNaming = 'original' | 'lowercase' | 'uppercase' | 'camelcase' | 'pascalcase' | ((fieldName: string) => Maybe<string>);
|
|
15
|
+
export type ObjectRow = Record<string, any>;
|
|
16
|
+
export type ArrayRow = any[];
|
|
17
|
+
export type ObjectRowset = ObjectRow[];
|
|
18
|
+
export type ArrayRowset = ArrayRow[];
|
|
19
19
|
export interface ClientConfiguration {
|
|
20
20
|
/**
|
|
21
21
|
* Dialect to be used
|
|
@@ -151,7 +151,7 @@ export interface QueryResult {
|
|
|
151
151
|
rowsAffected?: number;
|
|
152
152
|
cursor?: Cursor;
|
|
153
153
|
}
|
|
154
|
-
export
|
|
154
|
+
export type FieldInfo = {
|
|
155
155
|
index: number;
|
|
156
156
|
name: string;
|
|
157
157
|
} & Adapter.Field;
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
|
|
2
|
+
import { DeepBuildable, DeepPartial, DeepPickWritable, Maybe, Type } from 'ts-gems';
|
|
3
|
+
export { Type, Maybe, DeepPartial, DeepPickWritable, DeepBuildable };
|
|
3
4
|
export * from './types.js';
|
|
4
5
|
export * from './client/types.js';
|
|
5
6
|
export * from './client/adapter.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SqbConnection } from '../../client/sqb-connection.js';
|
|
2
2
|
import { EntityMetadata } from '../model/entity-metadata.js';
|
|
3
3
|
import { Repository } from '../repository.class.js';
|
|
4
|
-
export
|
|
4
|
+
export type CountCommandArgs = {
|
|
5
5
|
entity: EntityMetadata;
|
|
6
6
|
connection: SqbConnection;
|
|
7
7
|
} & Repository.CountOptions;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SqbConnection } from '../../client/sqb-connection.js';
|
|
2
2
|
import { EntityMetadata } from '../model/entity-metadata.js';
|
|
3
|
-
export
|
|
3
|
+
export type CreateCommandArgs = {
|
|
4
4
|
entity: EntityMetadata;
|
|
5
5
|
connection: SqbConnection;
|
|
6
6
|
values: any;
|
|
7
7
|
returning?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type CreateCommandContext = {
|
|
10
10
|
entity: EntityMetadata;
|
|
11
11
|
queryParams: any;
|
|
12
12
|
queryValues: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SqbConnection } from '../../client/sqb-connection.js';
|
|
2
2
|
import { EntityMetadata } from '../model/entity-metadata.js';
|
|
3
3
|
import { Repository } from '../repository.class.js';
|
|
4
|
-
export
|
|
4
|
+
export type DestroyCommandArgs = {
|
|
5
5
|
entity: EntityMetadata;
|
|
6
6
|
connection: SqbConnection;
|
|
7
7
|
} & Repository.DestroyOptions;
|
|
@@ -3,7 +3,7 @@ import { AssociationNode } from '../model/association-node.js';
|
|
|
3
3
|
import { EntityMetadata } from '../model/entity-metadata.js';
|
|
4
4
|
import { Repository } from '../repository.class.js';
|
|
5
5
|
import { RowConverter } from './row-converter.js';
|
|
6
|
-
export
|
|
6
|
+
export type FindCommandArgs = {
|
|
7
7
|
entity: EntityMetadata;
|
|
8
8
|
connection: SqbConnection;
|
|
9
9
|
} & Repository.FindAllOptions;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SqbConnection } from '../../client/sqb-connection.js';
|
|
2
2
|
import { EntityMetadata } from '../model/entity-metadata.js';
|
|
3
3
|
import { Repository } from '../repository.class.js';
|
|
4
|
-
export
|
|
4
|
+
export type UpdateCommandArgs = {
|
|
5
5
|
entity: EntityMetadata;
|
|
6
6
|
connection: SqbConnection;
|
|
7
7
|
values: any;
|
|
8
8
|
} & Repository.UpdateAllOptions;
|
|
9
|
-
|
|
9
|
+
type UpdateCommandContext = {
|
|
10
10
|
entity: EntityMetadata;
|
|
11
11
|
queryParams: any;
|
|
12
12
|
queryValues: any;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AssociationFieldOptions } from '../model/association-field-metadata.js';
|
|
2
2
|
import { TypeThunk } from '../orm.type.js';
|
|
3
|
-
|
|
3
|
+
type LinkArgs<T> = {
|
|
4
4
|
sourceKey?: string;
|
|
5
5
|
targetKey?: keyof T;
|
|
6
6
|
where?: object | object[];
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type LinkPropertyDecorator = PropertyDecorator & {
|
|
9
9
|
toOne<T>(type: TypeThunk<T>, args?: LinkArgs<T>): LinkPropertyDecorator;
|
|
10
10
|
toMany<T>(type: TypeThunk<T>, args?: LinkArgs<T>): LinkPropertyDecorator;
|
|
11
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AssociationNode } from './association-node.js';
|
|
2
2
|
import { EntityMetadata } from './entity-metadata.js';
|
|
3
3
|
import { FieldMetadata } from './field-metadata.js';
|
|
4
|
-
export
|
|
4
|
+
export type AssociationFieldOptions = Partial<Omit<AssociationFieldMetadata, 'entity' | 'name' | 'kind' | 'association'>>;
|
|
5
5
|
export interface AssociationFieldMetadata extends FieldMetadata {
|
|
6
6
|
readonly kind: 'association';
|
|
7
7
|
readonly association: AssociationNode;
|
|
@@ -2,7 +2,7 @@ import { DataType } from '@sqb/builder';
|
|
|
2
2
|
import type { ColumnAutoGenerationStrategy, ColumnTransformFunction, DefaultValueGetter, EnumValue, FieldValue } from '../orm.type.js';
|
|
3
3
|
import type { EntityMetadata } from './entity-metadata.js';
|
|
4
4
|
import { FieldMetadata } from './field-metadata.js';
|
|
5
|
-
export
|
|
5
|
+
export type ColumnFieldOptions = Partial<Omit<ColumnFieldMetadata, 'entity' | 'name' | 'kind'>>;
|
|
6
6
|
export interface ColumnFieldMetadata extends FieldMetadata {
|
|
7
7
|
readonly kind: 'column';
|
|
8
8
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypeThunk } from '../orm.type.js';
|
|
2
2
|
import type { EntityMetadata } from './entity-metadata.js';
|
|
3
3
|
import { FieldMetadata } from './field-metadata.js';
|
|
4
|
-
export
|
|
4
|
+
export type EmbeddedFieldOptions = Partial<Omit<EmbeddedFieldMetadata, 'entity' | 'name' | 'kind' | 'type'>>;
|
|
5
5
|
export interface EmbeddedFieldMetadata extends FieldMetadata {
|
|
6
6
|
readonly kind: 'object';
|
|
7
7
|
type: TypeThunk;
|
|
@@ -6,8 +6,8 @@ import { AssociationNode } from './association-node.js';
|
|
|
6
6
|
import { ColumnFieldMetadata, ColumnFieldOptions } from './column-field-metadata.js';
|
|
7
7
|
import { EmbeddedFieldMetadata, EmbeddedFieldOptions } from './embedded-field-metadata.js';
|
|
8
8
|
import { IndexMetadata } from './index-metadata.js';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type AnyFieldMetadata = ColumnFieldMetadata | EmbeddedFieldMetadata | AssociationFieldMetadata;
|
|
10
|
+
export type EntityOptions = Partial<Pick<EntityMetadata, 'name' | 'schema' | 'comment' | 'tableName'>>;
|
|
11
11
|
export interface EntityMetadata {
|
|
12
12
|
readonly ctor: Type;
|
|
13
13
|
readonly name: string;
|
package/esm/orm/orm.type.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Type } from 'ts-gems';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type Ctor = Type | Function;
|
|
3
|
+
export type FieldKind = 'column' | 'object' | 'association';
|
|
4
4
|
/**
|
|
5
5
|
* Indicates auto generation strategy
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
7
|
+
export type ColumnAutoGenerationStrategy = 'increment' | 'uuid' | 'rowid' | 'timestamp' | 'custom';
|
|
8
|
+
export type ColumnTransformFunction = (value: any, name: string) => any;
|
|
9
|
+
export type TypeResolver<T> = () => Type<T> | Promise<Type<T>>;
|
|
10
|
+
export type TypeThunk<T = any> = Type<T> | TypeResolver<T>;
|
|
11
|
+
export type EnumValue = (FieldValue)[] | Object;
|
|
12
|
+
export type FieldValue = string | number | boolean | Date | null;
|
|
13
|
+
export type DefaultValueGetter = (obj?: any) => FieldValue | undefined;
|
|
14
14
|
export interface AssociationSettings {
|
|
15
15
|
source: TypeThunk;
|
|
16
16
|
target: TypeThunk;
|
package/esm/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Builtin, DeepPickWritable } from 'ts-gems';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
2
|
+
export type EntityInput<T> = DeepNullableIfPartial<DeepPickWritable<T>>;
|
|
3
|
+
export type EntityOutput<T> = DeepNullableIfPartial<T>;
|
|
4
|
+
export type DeepNullableIfPartial<T> = _DeepNullableIfPartial<T>;
|
|
5
|
+
type _DeepNullableIfPartial<T> = T extends Builtin ? T : T extends Promise<infer U> ? Promise<DeepNullableIfPartial<U>> : T extends (infer U)[] ? DeepNullableIfPartial<U>[] : {
|
|
6
6
|
[P in keyof T]?: DeepNullableIfPartial<Exclude<T[P], undefined>> | null;
|
|
7
7
|
};
|
|
8
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.6",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>",
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"debug": "^4.3.4",
|
|
33
|
-
"lightning-pool": "^4.2.
|
|
33
|
+
"lightning-pool": "^4.2.1",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
35
|
-
"putil-isplainobject": "^1.1.
|
|
36
|
-
"putil-merge": "^3.
|
|
37
|
-
"putil-promisify": "^1.
|
|
38
|
-
"putil-taskqueue": "^2.5.
|
|
39
|
-
"putil-varhelpers": "^1.6.
|
|
35
|
+
"putil-isplainobject": "^1.1.5",
|
|
36
|
+
"putil-merge": "^3.10.1",
|
|
37
|
+
"putil-promisify": "^1.10.0",
|
|
38
|
+
"putil-taskqueue": "^2.5.5",
|
|
39
|
+
"putil-varhelpers": "^1.6.5",
|
|
40
40
|
"reflect-metadata": "^0.1.13",
|
|
41
41
|
"strict-typed-events": "^2.3.1",
|
|
42
|
-
"ts-gems": "^2.
|
|
42
|
+
"ts-gems": "^2.3.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/debug": "^4.1.7",
|
|
46
|
-
"@types/lodash": "^4.14.
|
|
46
|
+
"@types/lodash": "^4.14.191"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@sqb/builder": "^4.5.
|
|
49
|
+
"@sqb/builder": "^4.5.6"
|
|
50
50
|
},
|
|
51
51
|
"type": "module",
|
|
52
52
|
"types": "esm/index.d.ts",
|