mythix-orm 1.5.6 → 1.6.2
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/lib/connection/connection-base.d.ts +180 -0
- package/lib/connection/connection-base.js +242 -16
- package/lib/connection/index.d.ts +5 -0
- package/lib/connection/literals/average-literal.d.ts +5 -0
- package/lib/connection/literals/count-literal.d.ts +5 -0
- package/lib/connection/literals/distinct-literal.d.ts +5 -0
- package/lib/connection/literals/field-literal.d.ts +5 -0
- package/lib/connection/literals/index.d.ts +10 -0
- package/lib/connection/literals/literal-base.d.ts +22 -0
- package/lib/connection/literals/literal-base.js +2 -2
- package/lib/connection/literals/literal-field-base.d.ts +17 -0
- package/lib/connection/literals/literal-field-base.js +4 -4
- package/lib/connection/literals/literal.d.ts +5 -0
- package/lib/connection/literals/max-literal.d.ts +5 -0
- package/lib/connection/literals/min-literal.d.ts +5 -0
- package/lib/connection/literals/sum-literal.d.ts +5 -0
- package/lib/connection/query-generator-base.d.ts +121 -0
- package/lib/connection/query-generator-base.js +5 -6
- package/lib/field.d.ts +61 -0
- package/lib/field.js +9 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +7 -1
- package/lib/interfaces/common.ts +3 -0
- package/lib/model.d.ts +205 -0
- package/lib/model.js +136 -32
- package/lib/proxy-class/proxy-class.js +6 -6
- package/lib/query-engine/index.d.ts +1 -0
- package/lib/query-engine/model-scope.js +2 -2
- package/lib/query-engine/query-engine-base.js +2 -2
- package/lib/query-engine/query-engine.d.ts +144 -0
- package/lib/query-engine/query-engine.js +4 -0
- package/lib/types/concrete/bigint-type.d.ts +16 -0
- package/lib/types/concrete/bigint-type.js +8 -5
- package/lib/types/concrete/blob-type.d.ts +11 -0
- package/lib/types/concrete/blob-type.js +5 -4
- package/lib/types/concrete/boolean-type.d.ts +11 -0
- package/lib/types/concrete/boolean-type.js +4 -4
- package/lib/types/concrete/char-type.d.ts +11 -0
- package/lib/types/concrete/char-type.js +4 -4
- package/lib/types/concrete/date-type.d.ts +16 -0
- package/lib/types/concrete/date-type.js +9 -4
- package/lib/types/concrete/datetime-type.d.ts +16 -0
- package/lib/types/concrete/datetime-type.js +9 -4
- package/lib/types/concrete/foreign-key-type.d.ts +32 -0
- package/lib/types/concrete/foreign-key-type.js +274 -10
- package/lib/types/concrete/index.d.ts +19 -0
- package/lib/types/concrete/index.js +2 -0
- package/lib/types/concrete/integer-type.d.ts +16 -0
- package/lib/types/concrete/integer-type.js +6 -4
- package/lib/types/concrete/numeric-type.d.ts +11 -0
- package/lib/types/concrete/numeric-type.js +6 -4
- package/lib/types/concrete/real-type.d.ts +11 -0
- package/lib/types/concrete/real-type.js +111 -4
- package/lib/types/concrete/serialized-type.d.ts +25 -0
- package/lib/types/concrete/serialized-type.js +287 -5
- package/lib/types/concrete/string-type.d.ts +11 -0
- package/lib/types/concrete/string-type.js +0 -4
- package/lib/types/concrete/text-type.d.ts +11 -0
- package/lib/types/concrete/text-type.js +0 -4
- package/lib/types/concrete/uuid-base.d.ts +13 -0
- package/lib/types/concrete/uuid-base.js +4 -1
- package/lib/types/concrete/uuid-v1-type.d.ts +31 -0
- package/lib/types/concrete/uuid-v1-type.js +0 -4
- package/lib/types/concrete/uuid-v3-type.d.ts +27 -0
- package/lib/types/concrete/uuid-v3-type.js +0 -4
- package/lib/types/concrete/uuid-v4-type.d.ts +27 -0
- package/lib/types/concrete/uuid-v4-type.js +0 -4
- package/lib/types/concrete/uuid-v5-type.d.ts +27 -0
- package/lib/types/concrete/uuid-v5-type.js +0 -4
- package/lib/types/concrete/xid-type.d.ts +17 -0
- package/lib/types/concrete/xid-type.js +0 -4
- package/lib/types/helpers/default-helpers.d.ts +61 -0
- package/lib/types/helpers/index.d.ts +1 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/index.js +2 -0
- package/lib/types/type.d.ts +89 -0
- package/lib/types/type.js +57 -25
- package/lib/types/virtual/index.d.ts +4 -0
- package/lib/types/virtual/model-type.d.ts +15 -0
- package/lib/types/virtual/model-type.js +2 -2
- package/lib/types/virtual/models-type.d.ts +15 -0
- package/lib/types/virtual/models-type.js +5 -5
- package/lib/types/virtual/relational-type-base.d.ts +46 -0
- package/lib/types/virtual/relational-type-base.js +12 -20
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.js +1 -4
- package/lib/utils/misc-utils.d.ts +4 -0
- package/lib/utils/misc-utils.js +0 -35
- package/lib/utils/model-utils.d.ts +90 -0
- package/lib/utils/model-utils.js +4 -4
- package/lib/utils/query-utils.d.ts +11 -0
- package/package.json +8 -7
- package/.biblorc.js +0 -29
- package/docs/Associations.md +0 -539
- package/docs/Certifications.md +0 -22
- package/docs/Home.md +0 -54
- package/docs/Query Engine.md +0 -428
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import Field from '../field';
|
|
2
|
+
import { GenericObject } from '../interfaces/common';
|
|
3
|
+
import { ModelClass } from '../model';
|
|
4
|
+
import { QueryEngine } from '../query-engine';
|
|
5
|
+
import ConnectionBase from './connection-base';
|
|
6
|
+
import { AverageLiteral, CountLiteral, DistinctLiteral, FieldLiteral, MaxLiteral, MinLiteral, SumLiteral } from './literals';
|
|
7
|
+
import LiteralBase from './literals/literal-base';
|
|
8
|
+
|
|
9
|
+
export declare interface GetEscapedFieldNameOptions {
|
|
10
|
+
fieldNameOnly?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare interface GetEscapedTableNameNameOptions {
|
|
14
|
+
tableNamePrefix?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare interface GetEscapedColumnNameOptions extends GetEscapedTableNameNameOptions {
|
|
18
|
+
columnNamePrefix?: string
|
|
19
|
+
columnNameOnly?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare interface GetEscapedProjectionNameOptions extends GetEscapedColumnNameOptions, GetEscapedFieldNameOptions {
|
|
23
|
+
noProjectionAliases?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export declare interface GetEscapedModelFieldsOptions extends GetEscapedProjectionNameOptions {
|
|
27
|
+
asProjection?: boolean;
|
|
28
|
+
asColumn?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare interface ProjectedFieldInfo {
|
|
32
|
+
projectedName: string;
|
|
33
|
+
Model: ModelClass;
|
|
34
|
+
modelName: string;
|
|
35
|
+
Field: Field;
|
|
36
|
+
fieldName: string;
|
|
37
|
+
direction: string;
|
|
38
|
+
fullFieldName: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare interface JoinTableInfo {
|
|
42
|
+
operator: string;
|
|
43
|
+
joinType: string | LiteralBase;
|
|
44
|
+
rootModelName: string;
|
|
45
|
+
joinModel: ModelClass;
|
|
46
|
+
joinModelName: string;
|
|
47
|
+
leftSideModel: ModelClass;
|
|
48
|
+
leftSideModelName: string;
|
|
49
|
+
leftQueryContext: GenericObject;
|
|
50
|
+
leftSideField: Field;
|
|
51
|
+
rightSideModel: ModelClass;
|
|
52
|
+
rightSideModelName: string;
|
|
53
|
+
rightQueryContext: GenericObject;
|
|
54
|
+
rightSideField: Field;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare interface FieldDirectionInfo {
|
|
58
|
+
hasDirection: boolean;
|
|
59
|
+
direction: string;
|
|
60
|
+
fieldName: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare interface FieldOrderInfo {
|
|
64
|
+
Model: ModelClass;
|
|
65
|
+
Field: Field;
|
|
66
|
+
direction: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare class QueryGeneratorBase {
|
|
70
|
+
public constructor(connection);
|
|
71
|
+
public stackAssign(obj: GenericObject, ...args: Array<GenericObject>): GenericObject;
|
|
72
|
+
public getOptionsCache(options: GenericObject, keyPath: string, initialValue: any): any;
|
|
73
|
+
public setOptionsCache(options: GenericObject, keyPath: string, value: any): void;
|
|
74
|
+
public escape(field: Field, value: any, options?: GenericObject): string;
|
|
75
|
+
public escapeID(value: LiteralBase | string, options?: GenericObject): string;
|
|
76
|
+
public getEscapedFieldName(Model: ModelClass | null | undefined, field: Field, options?: GetEscapedFieldNameOptions): string;
|
|
77
|
+
public getEscapedColumnName(Model: ModelClass | null | undefined, field: Field, options?: GetEscapedColumnNameOptions): string;
|
|
78
|
+
public getEscapedTableName(modelOrField: ModelClass | Field, options?: GetEscapedTableNameNameOptions): string;
|
|
79
|
+
public getEscapedProjectionName(Model: ModelClass | null | undefined, field: Field, options?: GetEscapedProjectionNameOptions): string;
|
|
80
|
+
public getEscapedModelFields(Model: ModelClass, options?: GetEscapedModelFieldsOptions): { [ key: string ]: string };
|
|
81
|
+
public getAllModelsUsedInQuery(queryEngine: QueryEngine, options?: GenericObject): Array<ModelClass>;
|
|
82
|
+
public getProjectionRequiredFields(queryEngine: QueryEngine, options?: GenericObject): Map<string, ProjectedFieldInfo>;
|
|
83
|
+
public sortedProjectedFields(projectedFields: Array<LiteralBase | string>, options?: GenericObject): Array<LiteralBase | string>;
|
|
84
|
+
public getProjectionFromQueryEngine(queryEngine: QueryEngine, options?: GenericObject): Array<LiteralBase | string | ProjectedFieldInfo>;
|
|
85
|
+
public isFieldIdentifier(value: string): boolean;
|
|
86
|
+
public getProjectedFields(queryEngine: QueryEngine, options?: GenericObject, asMap?: false | undefined): Array<string>;
|
|
87
|
+
public getProjectedFields(queryEngine: QueryEngine, options?: GenericObject, asMap?: true): Map<string, string>;
|
|
88
|
+
|
|
89
|
+
public getJoinTableInfoFromQueryContexts(
|
|
90
|
+
leftQueryContext: GenericObject,
|
|
91
|
+
rightQueryContext: GenericObject,
|
|
92
|
+
joinType: string | LiteralBase,
|
|
93
|
+
options?: GenericObject
|
|
94
|
+
): JoinTableInfo;
|
|
95
|
+
|
|
96
|
+
public getFieldDirectionSpecifier(order: LiteralBase): LiteralBase;
|
|
97
|
+
public getFieldDirectionSpecifier(order: string | Field): FieldDirectionInfo;
|
|
98
|
+
|
|
99
|
+
public getOrderLimitOffset(
|
|
100
|
+
queryEngine: QueryEngine,
|
|
101
|
+
options?: GenericObject,
|
|
102
|
+
): {
|
|
103
|
+
limit: number | undefined,
|
|
104
|
+
offset: number | undefined,
|
|
105
|
+
order: Array<FieldOrderInfo>,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
public getQuerySliceFromQueryPart(queryPart: GenericObject): Array<GenericObject>;
|
|
109
|
+
public _averageLiteralToString(literal: AverageLiteral, options?: GenericObject): string;
|
|
110
|
+
public _countLiteralToString(literal: CountLiteral, options?: GenericObject): string;
|
|
111
|
+
public _distinctLiteralToString(literal: DistinctLiteral, options?: GenericObject): string;
|
|
112
|
+
public _fieldLiteralToString(literal: FieldLiteral, options?: GenericObject): string;
|
|
113
|
+
public _maxLiteralToString(literal: MaxLiteral, options?: GenericObject): string;
|
|
114
|
+
public _minLiteralToString(literal: MinLiteral, options?: GenericObject): string;
|
|
115
|
+
public _sumLiteralToString(literal: SumLiteral, options?: GenericObject): string;
|
|
116
|
+
public toConnectionString(queryEngine: QueryEngine, options?: GenericObject): string;
|
|
117
|
+
|
|
118
|
+
declare public connection: ConnectionBase;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default QueryGeneratorBase;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Nife
|
|
4
|
-
const QueryEngine
|
|
5
|
-
const Literals
|
|
6
|
-
const ModelBase
|
|
7
|
-
|
|
3
|
+
const Nife = require('nife');
|
|
4
|
+
const QueryEngine = require('../query-engine/query-engine');
|
|
5
|
+
const Literals = require('./literals');
|
|
6
|
+
const { Model: ModelBase } = require('../model');
|
|
8
7
|
const LiteralBase = Literals.LiteralBase;
|
|
9
8
|
const LITERAL_IS_DISTINCT_RE = (/^DISTINCT[\s(]/i);
|
|
10
9
|
|
|
@@ -13,7 +12,7 @@ class QueryGeneratorBase {
|
|
|
13
12
|
Object.defineProperties(this, {
|
|
14
13
|
'connection': {
|
|
15
14
|
writable: true,
|
|
16
|
-
|
|
15
|
+
enumerable: false,
|
|
17
16
|
configurable: true,
|
|
18
17
|
value: connection,
|
|
19
18
|
},
|
package/lib/field.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import ConnectionBase from './connection/connection-base';
|
|
2
|
+
import { GenericObject } from './interfaces/common';
|
|
3
|
+
import { Model, ModelClass } from './model';
|
|
4
|
+
import Type from './types/type';
|
|
5
|
+
import { DefaultValueProvider } from './types/helpers/default-helpers';
|
|
6
|
+
|
|
7
|
+
export declare interface GetSetContext {
|
|
8
|
+
field: Field;
|
|
9
|
+
fieldName: string;
|
|
10
|
+
get: () => any;
|
|
11
|
+
set: (value: any) => void;
|
|
12
|
+
self: Model;
|
|
13
|
+
value: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare interface ValidateContext {
|
|
17
|
+
connection: ConnectionBase;
|
|
18
|
+
Model: ModelClass;
|
|
19
|
+
options: GenericObject;
|
|
20
|
+
self: Model;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare interface FieldDefinition {
|
|
24
|
+
type: Type;
|
|
25
|
+
primaryKey: boolean;
|
|
26
|
+
fieldName: string;
|
|
27
|
+
columnName: string;
|
|
28
|
+
allowNull: boolean;
|
|
29
|
+
index: boolean | Array<boolean | string | Array<string>>;
|
|
30
|
+
unique: boolean;
|
|
31
|
+
defaultValue: any | DefaultValueProvider;
|
|
32
|
+
get: ((context: GetSetContext) => any) | undefined;
|
|
33
|
+
set: ((context: GetSetContext) => void) | undefined;
|
|
34
|
+
validate: (value: any, context: ValidateContext) => Promise<any> | any;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare class Field {
|
|
38
|
+
declare public static _isMythixField: boolean;
|
|
39
|
+
|
|
40
|
+
public static isFieldClass(value: any): boolean;
|
|
41
|
+
public static isField(value: any): boolean;
|
|
42
|
+
|
|
43
|
+
public constructor(fieldDefinition?: Field | FieldDefinition);
|
|
44
|
+
public clone(): Field;
|
|
45
|
+
public setModel(Model: ModelClass): void;
|
|
46
|
+
|
|
47
|
+
declare public Model: ModelClass;
|
|
48
|
+
declare public type: Type;
|
|
49
|
+
declare public primaryKey: boolean;
|
|
50
|
+
declare public fieldName: string;
|
|
51
|
+
declare public columnName: string;
|
|
52
|
+
declare public allowNull: boolean;
|
|
53
|
+
declare public index: boolean | Array<boolean | string | Array<string>>;
|
|
54
|
+
declare public unique: boolean;
|
|
55
|
+
declare public defaultValue: any | DefaultValueProvider;
|
|
56
|
+
declare public get: ((context: GetSetContext) => any) | undefined;
|
|
57
|
+
declare public set: ((context: GetSetContext) => void) | undefined;
|
|
58
|
+
declare public validate: (value: any, context: ValidateContext) => Promise<any> | any;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default Field;
|
package/lib/field.js
CHANGED
|
@@ -175,6 +175,7 @@ class Field {
|
|
|
175
175
|
/// `true` if the provided value is a <see>Field</see>
|
|
176
176
|
/// class, or inherits from <see>Field</see>. `false`
|
|
177
177
|
/// otherwise.
|
|
178
|
+
///
|
|
178
179
|
/// Arguments:
|
|
179
180
|
/// value: any
|
|
180
181
|
/// The value to check.
|
|
@@ -208,6 +209,7 @@ class Field {
|
|
|
208
209
|
/// `true` if the provided value is a <see>Field</see>
|
|
209
210
|
/// instance, or inherits from <see>Field</see>. `false`
|
|
210
211
|
/// otherwise.
|
|
212
|
+
///
|
|
211
213
|
/// Arguments:
|
|
212
214
|
/// value: any
|
|
213
215
|
/// The value to check.
|
|
@@ -232,10 +234,16 @@ class Field {
|
|
|
232
234
|
/// the field attributes.
|
|
233
235
|
///
|
|
234
236
|
/// Return: <see>Field</see>
|
|
237
|
+
///
|
|
235
238
|
/// Arguments:
|
|
236
239
|
/// fieldDescription: object | <see>Field</see>
|
|
237
240
|
/// The attributes to provide to this field.
|
|
238
241
|
constructor(fieldDefinition) {
|
|
242
|
+
this.primaryKey = false;
|
|
243
|
+
this.allowNull = true;
|
|
244
|
+
this.index = false;
|
|
245
|
+
this.unique = false;
|
|
246
|
+
|
|
239
247
|
Object.assign(this, fieldDefinition || {});
|
|
240
248
|
}
|
|
241
249
|
|
|
@@ -252,6 +260,7 @@ class Field {
|
|
|
252
260
|
/// for this field.
|
|
253
261
|
///
|
|
254
262
|
/// Return: undefined
|
|
263
|
+
///
|
|
255
264
|
/// Arguments:
|
|
256
265
|
/// Model: class <see>Model</see>
|
|
257
266
|
/// The parent model class of this field.
|
package/lib/index.d.ts
ADDED
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const Errors = require('./errors');
|
|
4
4
|
const Field = require('./field');
|
|
5
|
-
const
|
|
5
|
+
const _ModelScope = require('./model');
|
|
6
6
|
const ProxyClass = require('./proxy-class');
|
|
7
7
|
const QueryEngineScope = require('./query-engine');
|
|
8
8
|
const ConnectionScope = require('./connection');
|
|
@@ -22,10 +22,16 @@ const {
|
|
|
22
22
|
QueryGeneratorBase,
|
|
23
23
|
} = ConnectionScope;
|
|
24
24
|
|
|
25
|
+
const {
|
|
26
|
+
Model,
|
|
27
|
+
CacheKey,
|
|
28
|
+
} = _ModelScope;
|
|
29
|
+
|
|
25
30
|
module.exports = {
|
|
26
31
|
Errors,
|
|
27
32
|
Field,
|
|
28
33
|
Model,
|
|
34
|
+
CacheKey,
|
|
29
35
|
ProxyClass,
|
|
30
36
|
Types,
|
|
31
37
|
Utils,
|
package/lib/model.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { GenericObject } from './interfaces/common';
|
|
2
|
+
import ConnectionBase from './connection/connection-base';
|
|
3
|
+
import Field, { FieldDefinition } from './field';
|
|
4
|
+
import { QueryEngine, QueryEngineClass } from './query-engine/query-engine';
|
|
5
|
+
|
|
6
|
+
export class CacheKey {
|
|
7
|
+
constructor(number: number);
|
|
8
|
+
valueOf(): number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare interface ModelOptions extends GenericObject {
|
|
12
|
+
connection: ConnectionBase;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export declare type ModelClass = typeof Model;
|
|
16
|
+
|
|
17
|
+
export declare interface Models {
|
|
18
|
+
[ key: string ]: ModelClass;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare interface HookContext {
|
|
22
|
+
connection: ConnectionBase;
|
|
23
|
+
Model: ModelClass;
|
|
24
|
+
options: GenericObject;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare interface DirtyChanges {
|
|
28
|
+
[ key: string ]: { previous: any; current: any };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare type LooseFields = Array<Field | FieldDefinition> | { [ key: string ]: Field | FieldDefinition } | Map<string, Field | FieldDefinition> | Set<Field | FieldDefinition>;
|
|
32
|
+
export declare type Fields = Array<Field> | { [ key: string ]: Field } | Map<string, Field> | Set<Field>;
|
|
33
|
+
|
|
34
|
+
export declare interface IterateFieldsContext {
|
|
35
|
+
field: Field;
|
|
36
|
+
fieldName: string;
|
|
37
|
+
fields: Fields;
|
|
38
|
+
index: number;
|
|
39
|
+
stop: () => void;
|
|
40
|
+
isStopped: () => boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export declare type IterateFieldsCallback = (context: IterateFieldsContext) => any;
|
|
44
|
+
|
|
45
|
+
export declare class Model {
|
|
46
|
+
declare public static fields: LooseFields | undefined;
|
|
47
|
+
declare public static _sortedFields: Array<Field> | null;
|
|
48
|
+
declare public static _isMythixModel: boolean;
|
|
49
|
+
declare public static _mythixBoundConnection: ConnectionBase | null;
|
|
50
|
+
declare public static where: QueryEngine;
|
|
51
|
+
declare public static $: QueryEngine;
|
|
52
|
+
|
|
53
|
+
public static isModelClass(value: any): boolean;
|
|
54
|
+
public static isModel(value: any): boolean;
|
|
55
|
+
public static toString(showFields: boolean): string;
|
|
56
|
+
|
|
57
|
+
public static _getConnection(connection?: ConnectionBase): ConnectionBase;
|
|
58
|
+
public _getConnection(connection?: ConnectionBase): ConnectionBase;
|
|
59
|
+
|
|
60
|
+
public static getConnection(connection?: ConnectionBase): ConnectionBase;
|
|
61
|
+
public getConnection(connection?: ConnectionBase): ConnectionBase;
|
|
62
|
+
|
|
63
|
+
public static bindConnection(connection: ConnectionBase): ModelClass;
|
|
64
|
+
|
|
65
|
+
public static getQueryEngineClass(connection?: ConnectionBase): QueryEngineClass;
|
|
66
|
+
public getQueryEngineClass(connection?: ConnectionBase): QueryEngineClass;
|
|
67
|
+
|
|
68
|
+
public static getUnscopedQueryEngine(connection?: ConnectionBase, options?: GenericObject): QueryEngine;
|
|
69
|
+
public getUnscopedQueryEngine(connection?: ConnectionBase, options?: GenericObject): QueryEngine;
|
|
70
|
+
|
|
71
|
+
public static defaultScope(query: QueryEngine): QueryEngine;
|
|
72
|
+
public defaultScope(query: QueryEngine): QueryEngine;
|
|
73
|
+
|
|
74
|
+
public static getQueryEngine(connection?: ConnectionBase, options?: GenericObject): QueryEngine;
|
|
75
|
+
public getQueryEngine(connection?: ConnectionBase, options?: GenericObject): QueryEngine;
|
|
76
|
+
|
|
77
|
+
public static getForeignKeyFieldsMap(connection?: ConnectionBase): Map<string, Array<{ targetFieldName: string, sourceFieldName: string }>>;
|
|
78
|
+
public getForeignKeyFieldsMap(connection?: ConnectionBase): Map<string, Array<{ targetFieldName: string, sourceFieldName: string }>>;
|
|
79
|
+
|
|
80
|
+
public static getForeignKeysTargetModels(connection?: ConnectionBase): Map<string, ModelClass>;
|
|
81
|
+
public getForeignKeysTargetModels(connection?: ConnectionBase): Map<string, ModelClass>;
|
|
82
|
+
|
|
83
|
+
public static getForeignKeysTargetModelNames(connection?: ConnectionBase): Array<string>;
|
|
84
|
+
public getForeignKeysTargetModelNames(connection?: ConnectionBase): Array<string>;
|
|
85
|
+
|
|
86
|
+
public static getForeignKeysTargetFieldNames(connection: ConnectionBase | null | undefined, modelName: string): Array<{ targetFieldName: string, sourceFieldName: string }>;
|
|
87
|
+
public getForeignKeysTargetFieldNames(connection: ConnectionBase | null | undefined, modelName: string): Array<{ targetFieldName: string, sourceFieldName: string }>;
|
|
88
|
+
|
|
89
|
+
public static getForeignKeysTargetField(connection: ConnectionBase | null | undefined, modelName: string, fieldName: string): { targetFieldName: string, sourceFieldName: string } | undefined;
|
|
90
|
+
public getForeignKeysTargetField(connection: ConnectionBase | null | undefined, modelName: string, fieldName: string): { targetFieldName: string, sourceFieldName: string } | undefined;
|
|
91
|
+
|
|
92
|
+
public static isForeignKeyTargetModel(connection: ConnectionBase | null | undefined, modelName: string): boolean;
|
|
93
|
+
public isForeignKeyTargetModel(connection: ConnectionBase | null | undefined, modelName: string): boolean;
|
|
94
|
+
|
|
95
|
+
public static getTableName(connection?: ConnectionBase): string;
|
|
96
|
+
public getTableName(connection?: ConnectionBase): string;
|
|
97
|
+
|
|
98
|
+
public static getModelName(): string;
|
|
99
|
+
public getModelName(): string;
|
|
100
|
+
|
|
101
|
+
public static getSingularName(): string;
|
|
102
|
+
public getSingularName(): string;
|
|
103
|
+
|
|
104
|
+
public static getPluralModelName(): string;
|
|
105
|
+
public getPluralModelName(): string;
|
|
106
|
+
|
|
107
|
+
public static getModel(modelName?: string): ModelClass | undefined;
|
|
108
|
+
public getModel(modelName?: string): ModelClass | undefined;
|
|
109
|
+
|
|
110
|
+
public static getFields(fieldNames?: Array<string>): Fields;
|
|
111
|
+
public getFields(fieldNames?: Array<string>): Fields;
|
|
112
|
+
|
|
113
|
+
public static getSortedFields(fieldNames?: Array<string>): Array<Field>;
|
|
114
|
+
public getSortedFields(fieldNames?: Array<string>): Array<Field>;
|
|
115
|
+
|
|
116
|
+
public static mergeFields(mergeFields?: Fields): Fields;
|
|
117
|
+
|
|
118
|
+
public static initializeFields(fields: Fields): Fields;
|
|
119
|
+
|
|
120
|
+
public static iterateFields(callback: IterateFieldsCallback, fields: LooseFields, sorted: boolean): Array<any>;
|
|
121
|
+
public iterateFields(callback: IterateFieldsCallback, fields: LooseFields, sorted: boolean): Array<any>;
|
|
122
|
+
|
|
123
|
+
public static hasRemoteFieldValues(): boolean;
|
|
124
|
+
public hasRemoteFieldValues(): boolean;
|
|
125
|
+
|
|
126
|
+
public static getPrimaryKeyField(): Field | undefined;
|
|
127
|
+
public getPrimaryKeyField(): Field | undefined;
|
|
128
|
+
|
|
129
|
+
public static getPrimaryKeyFieldName(): string | undefined;
|
|
130
|
+
public getPrimaryKeyFieldName(): string | undefined;
|
|
131
|
+
|
|
132
|
+
public static primaryKeyHasRemoteValue(): boolean;
|
|
133
|
+
public primaryKeyHasRemoteValue(): boolean;
|
|
134
|
+
|
|
135
|
+
public static getField(findFieldName: string): Field | undefined;
|
|
136
|
+
public getField(findFieldName: string): Field | undefined;
|
|
137
|
+
|
|
138
|
+
public static hasField(fieldName: string): boolean;
|
|
139
|
+
public hasField(fieldName: string): boolean;
|
|
140
|
+
|
|
141
|
+
public static getConcreteFieldCount(): number;
|
|
142
|
+
public getConcreteFieldCount(): number;
|
|
143
|
+
|
|
144
|
+
public static defaultOrder(options?: GenericObject): Array<string>;
|
|
145
|
+
|
|
146
|
+
public static getWhereWithConnection(options?: { connection: ConnectionBase }): QueryEngine;
|
|
147
|
+
public getWhereWithConnection(options?: { connection: ConnectionBase }): QueryEngine;
|
|
148
|
+
|
|
149
|
+
public static create(models: Array<Model | GenericObject>, options?: GenericObject): Promise<Array<Model>>;
|
|
150
|
+
public static create(models: Model | GenericObject, options?: GenericObject): Promise<Model>;
|
|
151
|
+
public static count(options?: GenericObject): Promise<number>;
|
|
152
|
+
public static all(options?: GenericObject): Promise<Array<Model>>;
|
|
153
|
+
public static fetchAll(options?: GenericObject): AsyncGenerator<Model>;
|
|
154
|
+
public static first(limit?: number, options?: GenericObject): Promise<Model | undefined>;
|
|
155
|
+
public static last(limit?: number, options?: GenericObject): Promise<Model | undefined>;
|
|
156
|
+
public static pluck(fields: string | Array<string>, options?: GenericObject): Promise<Array<any>>;
|
|
157
|
+
|
|
158
|
+
public constructor(data: GenericObject, _options?: ModelOptions);
|
|
159
|
+
public getOptions(): ModelOptions;
|
|
160
|
+
public _constructor(data?: GenericObject): void;
|
|
161
|
+
public _constructFields(): void;
|
|
162
|
+
public _constructField(fieldName: string, field: Field): void;
|
|
163
|
+
public _initializeModelData(data?: GenericObject): void;
|
|
164
|
+
public _castFieldValue(field: Field, value: any): any;
|
|
165
|
+
public _initializeFieldData(fieldName: string, field: Field, fieldValue: any, data?: GenericObject): void;
|
|
166
|
+
public _getDirtyFields(options?: GenericObject): DirtyChanges;
|
|
167
|
+
public _getFieldValue(fieldName: string, field: Field): any;
|
|
168
|
+
public _setFieldValue(fieldName: string, field: Field, value: any): void;
|
|
169
|
+
public isPersisted(): boolean;
|
|
170
|
+
public updateDirtyID(): void;
|
|
171
|
+
public isDirty(fieldName?: string): boolean;
|
|
172
|
+
public clearDirty(fieldName?: string): void;
|
|
173
|
+
public getDirtyFields(options?: GenericObject): Array<Field>;
|
|
174
|
+
public getDataValue(fieldName: string): any;
|
|
175
|
+
public setDataValue(fieldName: string, value: any): void;
|
|
176
|
+
public getAttributes(): GenericObject;
|
|
177
|
+
public setAttributes(attributes: GenericObject, noPrimaryKey?: boolean): void;
|
|
178
|
+
public hasValidPrimaryKey(): boolean;
|
|
179
|
+
public onValidate(context: HookContext): Promise<any>;
|
|
180
|
+
public onBeforeCreate(context: HookContext): Promise<any>;
|
|
181
|
+
public onBeforeUpdate(context: HookContext): Promise<any>;
|
|
182
|
+
public onBeforeSave(context: HookContext): Promise<any>;
|
|
183
|
+
public onAfterCreate(context: HookContext): Promise<any>;
|
|
184
|
+
public onAfterUpdate(context: HookContext): Promise<any>;
|
|
185
|
+
public onAfterSave(context: HookContext): Promise<any>;
|
|
186
|
+
public save(options?: GenericObject): Promise<Model | boolean>;
|
|
187
|
+
public reload(options?: GenericObject): Promise<void>;
|
|
188
|
+
public destroy(options?: GenericObject): Promise<number>;
|
|
189
|
+
public toString(): string;
|
|
190
|
+
public toJSON(): GenericObject;
|
|
191
|
+
|
|
192
|
+
declare public _options: ModelOptions;
|
|
193
|
+
declare public _mythixModelInstance: boolean;
|
|
194
|
+
declare public _connection: ConnectionBase | null;
|
|
195
|
+
declare public _fieldData: GenericObject;
|
|
196
|
+
declare public _dirtyFieldData: GenericObject;
|
|
197
|
+
declare public _typeData: GenericObject;
|
|
198
|
+
declare public _dirtyID: CacheKey;
|
|
199
|
+
declare public _persisted: boolean;
|
|
200
|
+
declare public __order: number;
|
|
201
|
+
declare public __assignedRelatedModels: Map<string, ModelClass>;
|
|
202
|
+
declare public changes: DirtyChanges;
|
|
203
|
+
declare public where: QueryEngine;
|
|
204
|
+
declare public $: QueryEngine;
|
|
205
|
+
}
|