mythix-orm 1.5.5 → 1.6.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/lib/connection/connection-base.d.ts +180 -0
- package/lib/connection/connection-base.js +272 -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/field-literal.js +14 -0
- package/lib/connection/literals/index.d.ts +10 -0
- package/lib/connection/literals/index.js +15 -13
- 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 +32 -26
- 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/field-scope.js +1 -0
- 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 +18 -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 +3 -2
- 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
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
|
+
}
|