1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | declare namespace FxOrmNS {
|
31 |
|
32 | export type Model = FxOrmModel.Model
|
33 | export type IChainFind = FxOrmQuery.IChainFind
|
34 |
|
35 | export type Instance = FxOrmInstance.Instance
|
36 | export type Hooks = FxOrmModel.Hooks
|
37 | export type FibOrmFixedExtendModel = FxOrmModel.Model
|
38 |
|
39 | export type ModelPropertyDefinition = FxOrmModel.ModelPropertyDefinition
|
40 | export type OrigDetailedModelProperty = FxOrmModel.OrigDetailedModelProperty
|
41 | export type OrigDetailedModelPropertyHash = FxOrmModel.OrigDetailedModelPropertyHash
|
42 | export type OrigModelPropertyDefinition = FxOrmModel.ComplexModelPropertyDefinition
|
43 | export type ModelPropertyDefinitionHash = FxOrmModel.ModelPropertyDefinitionHash
|
44 | export type ModelOptions = FxOrmModel.ModelOptions
|
45 | export type OrigHooks = FxOrmModel.Hooks
|
46 |
|
47 | export type ComplexModelPropertyDefinition = FxOrmModel.ComplexModelPropertyDefinition
|
48 | export type FibOrmFixedModelOptions = FxOrmModel.ModelOptions
|
49 | export type PatchedSyncfiedModelOrInstance = FxOrmPatch.PatchedSyncfiedModelOrInstance
|
50 | export type PatchedSyncfiedInstanceWithDbWriteOperation = FxOrmPatch.PatchedSyncfiedInstanceWithDbWriteOperation
|
51 | export type PatchedSyncfiedInstanceWithAssociations = FxOrmPatch.PatchedSyncfiedInstanceWithAssociations
|
52 |
|
53 | export type SettingsContainerGenerator = FxOrmSettings.SettingsContainerGenerator
|
54 | export type SettingInstance = FxOrmSettings.SettingInstance
|
55 |
|
56 | export type ModelOptions__Find = FxOrmModel.ModelOptions__Find
|
57 | export type ModelQueryConditions__Find = FxOrmModel.ModelQueryConditions__Find
|
58 | export type ModelMethodCallback__Find = FxOrmModel.ModelMethodCallback__Find
|
59 | export type ModelMethodCallback__Count = FxOrmModel.ModelMethodCallback__Count
|
60 |
|
61 | export type InstanceDataPayload = FxOrmInstance.InstanceDataPayload
|
62 | export type InstanceAssociationItem_HasMany = FxOrmAssociation.InstanceAssociationItem_HasMany
|
63 | export type InstanceAssociationItem_HasOne = FxOrmAssociation.InstanceAssociationItem_HasOne
|
64 | export type InstanceAssociationItem_ExtendTos = FxOrmAssociation.InstanceAssociationItem_ExtendTos
|
65 |
|
66 | export type QueryConditionInTypeType = FxOrmQuery.QueryConditionInTypeType
|
67 | export type QueryCondition_SimpleEq = FxOrmQuery.QueryCondition_SimpleEq
|
68 | export type QueryCondition_eq = FxOrmQuery.QueryCondition_eq
|
69 | export type QueryCondition_ne = FxOrmQuery.QueryCondition_ne
|
70 | export type QueryCondition_gt = FxOrmQuery.QueryCondition_gt
|
71 | export type QueryCondition_gte = FxOrmQuery.QueryCondition_gte
|
72 | export type QueryCondition_lt = FxOrmQuery.QueryCondition_lt
|
73 | export type QueryCondition_lte = FxOrmQuery.QueryCondition_lte
|
74 | export type QueryCondition_like = FxOrmQuery.QueryCondition_like
|
75 | export type QueryCondition_not_like = FxOrmQuery.QueryCondition_not_like
|
76 | export type QueryCondition_between = FxOrmQuery.QueryCondition_between
|
77 | export type QueryCondition_not_between = FxOrmQuery.QueryCondition_not_between
|
78 | export type QueryCondition_in = FxOrmQuery.QueryCondition_in
|
79 | export type QueryCondition_not_in = FxOrmQuery.QueryCondition_not_in
|
80 | export type QueryConditionAtomicType = FxOrmQuery.QueryConditionAtomicType
|
81 | export type QueryConditions = FxOrmQuery.QueryConditions
|
82 |
|
83 |
|
84 | interface ExtensibleError extends Error {
|
85 | [extensibleProperty: string]: any
|
86 | }
|
87 |
|
88 | interface TransformFibOrmModel2InstanceOptions extends FxOrmModel.ModelOptions {}
|
89 |
|
90 | type FibORM = ORM
|
91 |
|
92 | type FibOrmDB = ORM
|
93 |
|
94 | interface FibORMIConnectionOptions extends FxDbDriverNS.ConnectionInputArgs {
|
95 | timezone: string;
|
96 | }
|
97 |
|
98 |
|
99 | type InstanceOptions = FxOrmInstance.InnerInstanceOptions
|
100 |
|
101 | type OrigAggreteGenerator = (...args: any[]) => FxOrmQuery.IAggregated
|
102 |
|
103 | interface FibOrmFindLikeQueryObject {
|
104 | [key: string]: any;
|
105 | }
|
106 |
|
107 | interface FibOrmFixedModelInstanceFn {
|
108 | (model: FxOrmModel.Model, opts: object): FxOrmInstance.Instance
|
109 | new (model: FxOrmModel.Model, opts: object): FxOrmInstance.Instance
|
110 | }
|
111 |
|
112 | interface FibOrmPatchedSyncfiedInstantce extends FxOrmPatch.PatchedSyncfiedInstanceWithDbWriteOperation, FxOrmPatch.PatchedSyncfiedInstanceWithAssociations {
|
113 | }
|
114 |
|
115 | interface IChainFibORMFind extends FxOrmPatch.PatchedSyncfiedModelOrInstance, FxSqlQuery.ChainBuilder__Select {
|
116 | only(args: string | string[]): IChainFibORMFind;
|
117 | only(...args: string[]): IChainFibORMFind;
|
118 |
|
119 | }
|
120 |
|
121 |
|
122 |
|
123 | interface ModelAutoFetchOptions {
|
124 | autoFetchLimit?: number
|
125 | autoFetch?: boolean
|
126 | }
|
127 |
|
128 | interface InstanceAutoFetchOptions extends ModelAutoFetchOptions {
|
129 | }
|
130 |
|
131 | interface ModelExtendOptions {
|
132 |
|
133 | }
|
134 | interface InstanceExtendOptions extends ModelExtendOptions {
|
135 |
|
136 | }
|
137 |
|
138 |
|
139 | |
140 |
|
141 |
|
142 |
|
143 | type FibOrmFixedModel = FxOrmModel.Model
|
144 |
|
145 | type FibOrmFixedModelInstance = FxOrmInstance.Instance
|
146 |
|
147 | interface PluginOptions {
|
148 | [key: string]: any
|
149 | }
|
150 | interface PluginConstructor {
|
151 | new (orm?: ORM, opts?: PluginOptions): Plugin
|
152 | prototype: Plugin
|
153 | }
|
154 | type PluginConstructCallback<T1 = ORM, T2 = PluginOptions> = (orm: T1, opts: T2) => Plugin
|
155 | interface Plugin {
|
156 | beforeDefine?: {
|
157 | (name?: string, properties?: FxOrmModel.ModelPropertyDefinitionHash, opts?: FxOrmModel.ModelOptions): void
|
158 | }
|
159 | define?: {
|
160 | (model?: FxOrmModel.Model, orm?: ORM): void
|
161 | }
|
162 | beforeHasOne?: {
|
163 | (
|
164 | model?: FxOrmModel.Model,
|
165 | opts?: {
|
166 | association_name?: string,
|
167 | ext_model?: Model,
|
168 | assoc_options?: FxOrmAssociation.AssociationDefinitionOptions_HasOne
|
169 | }
|
170 | ): void
|
171 | }
|
172 | beforeHasMany?: {
|
173 | (
|
174 | model?: FxOrmModel.Model,
|
175 | opts?: {
|
176 | association_name?: string,
|
177 | ext_model?: Model,
|
178 | assoc_props?: ModelPropertyDefinitionHash,
|
179 | assoc_options?: FxOrmAssociation.AssociationDefinitionOptions_HasMany
|
180 | }
|
181 | ): void
|
182 | }
|
183 | beforeExtendsTo?: {
|
184 | (
|
185 | model?: FxOrmModel.Model,
|
186 | opts?: {
|
187 | association_name?: string,
|
188 | properties?: FxOrmModel.DetailedPropertyDefinitionHash,
|
189 | assoc_options?: FxOrmAssociation.AssociationDefinitionOptions_ExtendsTo
|
190 | }
|
191 | ): void
|
192 | }
|
193 | }
|
194 |
|
195 | interface ORMConstructor {
|
196 | new (driver_name: string, driver: FxOrmDMLDriver.DMLDriver, settings: FxOrmSettings.SettingInstance): ORM
|
197 | prototype: ORM
|
198 | }
|
199 |
|
200 | interface ORMLike extends Class_EventEmitter {
|
201 | use: Function
|
202 | define: Function
|
203 | sync: Function
|
204 | load: Function
|
205 |
|
206 | driver?: FxOrmDMLDriver.DMLDriver
|
207 |
|
208 | [k: string]: any
|
209 | }
|
210 |
|
211 | interface ORM extends ORMLike, FxOrmSynchronous.SynchronizedORMInstance, FxOrmPatch.PatchedORMInstance {
|
212 | validators: FxOrmValidators.ValidatorModules;
|
213 | enforce: FibjsEnforce.ExportModule;
|
214 | settings: FxOrmSettings.SettingInstance;
|
215 | driver_name: string;
|
216 | driver: FxOrmDMLDriver.DMLDriver;
|
217 | tools: FxSqlQueryComparator.ComparatorHash;
|
218 | models: { [key: string]: FxOrmModel.Model };
|
219 | plugins: Plugin[];
|
220 | customTypes: { [key: string]: FxOrmProperty.CustomPropertyType };
|
221 |
|
222 | use: {
|
223 | (plugin: PluginConstructCallback, options?: PluginOptions): ORM;
|
224 | }
|
225 |
|
226 | define(name: string, properties: FxOrmModel.ModelPropertyDefinitionHash, opts?: FxOrmModel.ModelOptions): FxOrmModel.Model;
|
227 | defineType(name: string, type: FxOrmProperty.CustomPropertyType): this;
|
228 |
|
229 | load(file: string, callback: FxOrmNS.VoidCallback): any;
|
230 |
|
231 | ping(callback: FxOrmNS.VoidCallback): this;
|
232 | close(callback: FxOrmNS.VoidCallback): this;
|
233 | sync(callback: FxOrmNS.VoidCallback): this;
|
234 | drop(callback: FxOrmNS.VoidCallback): this;
|
235 |
|
236 | serial: {
|
237 | (...chains: any[]): {
|
238 | get: {
|
239 | (callback?: FibOrmNS.GenericCallback<any[]>): ORM
|
240 | }
|
241 | }
|
242 | }
|
243 |
|
244 | syncSync(): void;
|
245 |
|
246 | begin: FxDbDriverNS.SQLDriver['begin'];
|
247 | commit: FxDbDriverNS.SQLDriver['commit'];
|
248 | rollback: FxDbDriverNS.SQLDriver['rollback'];
|
249 | trans: FxDbDriverNS.SQLDriver['trans'];
|
250 |
|
251 | [extraMember: string]: any;
|
252 | }
|
253 |
|
254 | interface SingletonOptions {
|
255 | identityCache?: boolean;
|
256 | saveCheck?: boolean;
|
257 | }
|
258 |
|
259 | interface IUseOptions {
|
260 | query?: {
|
261 | |
262 |
|
263 |
|
264 |
|
265 |
|
266 | debug?: string
|
267 | }
|
268 | }
|
269 |
|
270 | interface SingletonModule {
|
271 | modelClear: {
|
272 | (model: FxOrmModel.Model, key?: string): SingletonModule
|
273 | }
|
274 | clear: {
|
275 | (key?: string): SingletonModule
|
276 | };
|
277 | modelGet: {
|
278 | <T = any>(
|
279 | model: FxOrmModel.Model,
|
280 | key: string,
|
281 | opts: SingletonOptions,
|
282 | reFetchSync: () => FxOrmInstance.Instance
|
283 | ): FxOrmInstance.Instance
|
284 | };
|
285 | get: {
|
286 | <T = any>(
|
287 | key: string,
|
288 | opts: SingletonOptions,
|
289 | reFetchSync: () => FxOrmInstance.Instance
|
290 | ): FxOrmInstance.Instance
|
291 | };
|
292 | }
|
293 |
|
294 | interface PropertyModule {
|
295 | normalize: {
|
296 | (opts: {
|
297 | prop: FxOrmModel.ComplexModelPropertyDefinition
|
298 | name: string
|
299 | customTypes: FxOrmNS.ORM['customTypes']
|
300 | settings: FxOrmNS.ORM['settings']
|
301 | }): FxOrmProperty.NormalizedProperty
|
302 | }
|
303 | }
|
304 |
|
305 | interface ExportModule extends
|
306 | /* deprecated :start */
|
307 | // just use require('@fxjs/sql-query').comparators.xxx plz
|
308 | FxSqlQueryComparator.ComparatorHash
|
309 | /* deprecated :end */
|
310 | {
|
311 | Helpers: FxOrmHelper.HelperModules
|
312 | validators: FxOrmValidators.ValidatorModules
|
313 | Settings: FxOrmSettings.Settings
|
314 | settings: FxOrmSettings.SettingInstance
|
315 | singleton: any
|
316 | Property: PropertyModule
|
317 | enforce: FibjsEnforce.ExportModule
|
318 | ErrorCodes: FxOrmNS.PredefineErrorCodes
|
319 | addAdapter: FxOrmNS.AddAdapatorFunction
|
320 |
|
321 |
|
322 | Text: FxSqlQuery.TypedQueryObjectWrapper<'text'>;
|
323 |
|
324 |
|
325 | use(connection: FxOrmDb.DatabaseBase, protocol: string, options: IUseOptions, callback: (err: Error, db?: FxOrmNS.ORM) => void): any;
|
326 | connect: {
|
327 | (uri?: string | FxDbDriverNS.DBConnectionConfig, callback?: FxOrmCoreCallbackNS.ExecutionCallback<FxDbDriverNS.Driver>): FxOrmNS.ORMLike;
|
328 | };
|
329 | connectSync(uriOrOpts?: string | FxDbDriverNS.DBConnectionConfig): FxOrmNS.ORMLike;
|
330 |
|
331 | [extra: string]: any
|
332 | }
|
333 | }
|