1 | import { InitOptions, Model as OriginModel, ModelAttributes, FindOptions, BuildOptions, Utils } from 'sequelize';
|
2 | import { AssociationGetOptions } from './association/association-get-options';
|
3 | import { AssociationCountOptions } from './association/association-count-options';
|
4 | import { AssociationActionOptions } from './association/association-action-options';
|
5 | import { AssociationCreateOptions } from './association/association-create-options';
|
6 | import { Repository } from '../../sequelize/repository/repository';
|
7 | export declare type ModelType<TCreationAttributes extends {}, TModelAttributes extends {}> = new (values?: TCreationAttributes, options?: any) => Model<TModelAttributes, TCreationAttributes>;
|
8 | export declare type ModelCtor<M extends Model = Model> = Repository<M>;
|
9 | export declare type ModelStatic<M extends Model = Model> = {
|
10 | new (): M;
|
11 | };
|
12 | export declare type $GetType<T> = NonNullable<T> extends any[] ? NonNullable<T> : NonNullable<T> | null;
|
13 | export declare abstract class Model<TModelAttributes extends {} = any, TCreationAttributes extends {} = TModelAttributes> extends OriginModel<TModelAttributes, TCreationAttributes> {
|
14 | id?: number | any;
|
15 | createdAt?: Date | any;
|
16 | updatedAt?: Date | any;
|
17 | deletedAt?: Date | any;
|
18 | version?: number | any;
|
19 | static isInitialized: boolean;
|
20 | static initialize<MS extends ModelStatic<Model>, M extends InstanceType<MS>>(attributes: ModelAttributes, options: InitOptions): MS;
|
21 | constructor(values?: Utils.MakeNullishOptional<TCreationAttributes>, options?: BuildOptions);
|
22 | /**
|
23 | * Adds relation between specified instances and source instance
|
24 | */
|
25 | $add<R extends Model>(propertyKey: string, instances: R | R[] | string[] | string | number[] | number, options?: AssociationActionOptions): Promise<unknown>;
|
26 | /**
|
27 | * Sets relation between specified instances and source instance
|
28 | * (replaces old relations)
|
29 | */
|
30 | $set<R extends Model>(propertyKey: keyof this, instances: R | R[] | string[] | string | number[] | number | null, options?: AssociationActionOptions): Promise<unknown>;
|
31 | /**
|
32 | * Returns related instance (specified by propertyKey) of source instance
|
33 | */
|
34 | $get<K extends keyof this>(propertyKey: K, options?: AssociationGetOptions): Promise<$GetType<this[K]>>;
|
35 | /**
|
36 | * Counts related instances (specified by propertyKey) of source instance
|
37 | */
|
38 | $count(propertyKey: string, options?: AssociationCountOptions): Promise<number>;
|
39 | /**
|
40 | * Creates instances and relate them to source instance
|
41 | */
|
42 | $create<R extends Model>(propertyKey: string, values: any, options?: AssociationCreateOptions): Promise<R>;
|
43 | /**
|
44 | * Checks if specified instances is related to source instance
|
45 | */
|
46 | $has<R extends Model>(propertyKey: string, instances: R | R[] | string[] | string | number[] | number, options?: AssociationGetOptions): Promise<boolean>;
|
47 | /**
|
48 | * Removes specified instances from source instance
|
49 | */
|
50 | $remove<R extends Model>(propertyKey: string, instances: R | R[] | string[] | string | number[] | number, options?: any): Promise<any>;
|
51 | reload(options?: FindOptions): Promise<this>;
|
52 | }
|
53 | /**
|
54 | * Indicates which static methods of Model has to be proxied,
|
55 | * to prepare include option to automatically resolve alias;
|
56 | * The index represents the index of the options of the
|
57 | * corresponding method parameter
|
58 | */
|
59 | export declare const INFER_ALIAS_MAP: {
|
60 | bulkBuild: number;
|
61 | build: number;
|
62 | create: number;
|
63 | aggregate: number;
|
64 | all: number;
|
65 | find: number;
|
66 | findAll: number;
|
67 | findAndCount: number;
|
68 | findAndCountAll: number;
|
69 | findById: number;
|
70 | findByPrimary: number;
|
71 | findCreateFind: number;
|
72 | findOne: number;
|
73 | findOrBuild: number;
|
74 | findOrCreate: number;
|
75 | findOrInitialize: number;
|
76 | reload: number;
|
77 | };
|