@@ -6,14 +6,10 @@ import {Model} from "../models/Model";
66import { IPartialDefineAttributeColumnOptions } from "../interfaces/IPartialDefineAttributeColumnOptions" ;
77import { inferDataType } from "../utils/data-type" ;
88import { deepAssign } from "../utils/object" ;
9- import { IScopeOptions } from "../interfaces/IScopeOptions" ;
10- import { IFindOptions } from "../interfaces/IFindOptions" ;
119import { getAssociationsByRelation } from "./association" ;
1210import { uniqueFilter } from "../utils/array" ;
13- import { IScopeFindOptions } from "../interfaces/IScopeFindOptions" ;
1411
1512const MODEL_NAME_KEY = 'sequelize:modelName' ;
16- const SCOPES_KEY = 'sequelize:scopes' ;
1713const ATTRIBUTES_KEY = 'sequelize:attributes' ;
1814const OPTIONS_KEY = 'sequelize:options' ;
1915export const DEFAULT_DEFINE_OPTIONS : DefineOptions < any > = {
@@ -210,21 +206,6 @@ export function getModels(arg: Array<typeof Model | string>): Array<typeof Model
210206 return arg as Array < typeof Model > ;
211207}
212208
213- /**
214- * Resolves scopes and adds them to the specified models
215- */
216- export function resolveScopes ( models : Array < typeof Model > ) : void {
217- models . forEach ( model => {
218- const options = getScopeOptions ( model . prototype ) ;
219-
220- if ( options ) {
221- Object
222- . keys ( options )
223- . forEach ( key => resolveScope ( key , model , options [ key ] ) ) ;
224- }
225- } ) ;
226- }
227-
228209/**
229210 * Resolves all model getters of specified options object
230211 * recursively.
@@ -253,26 +234,6 @@ export function resolveModelGetter(options: any): void {
253234 } ) ;
254235}
255236
256- /**
257- * Adds scope option meta data for specified prototype
258- */
259- export function addScopeOptions ( target : any , options : IScopeOptions ) : void {
260- const _options = getScopeOptions ( target ) || { } ;
261-
262- setScopeOptions ( target , deepAssign ( { } , _options , options ) ) ;
263- }
264-
265- /**
266- * Returns scope option meta data from specified target
267- */
268- export function getScopeOptions ( target : any ) : IScopeOptions | undefined {
269- const options = Reflect . getMetadata ( SCOPES_KEY , target ) ;
270-
271- if ( options ) {
272- return deepAssign ( { } , options ) ;
273- }
274- }
275-
276237/**
277238 * Pre conform includes, so that "as" value can be inferred from source
278239 */
@@ -301,15 +262,6 @@ export function inferAlias(options: any, source: any): any {
301262 return options ;
302263}
303264
304- /**
305- * Resolves scope
306- */
307- function resolveScope ( scopeName : string , model : typeof Model , options : IScopeFindOptions | undefined ) : void {
308- resolveModelGetter ( options ) ;
309- options = inferAlias ( options , model ) ;
310- model . addScope ( scopeName , options as IFindOptions , { override : true } ) ;
311- }
312-
313265/**
314266 * Pre conform include, so that alias ("as") value can be inferred from source class
315267 */
@@ -344,14 +296,6 @@ function inferAliasForInclude(include: any, source: any): any {
344296 return include ;
345297}
346298
347- /**
348- * Set scope option meta data for specified prototype
349- */
350- function setScopeOptions ( target : any , options : IScopeOptions ) : void {
351-
352- Reflect . defineMetadata ( SCOPES_KEY , options , target ) ;
353- }
354-
355299/**
356300 * Checks if specified filename is importable or not;
357301 * Which means that, it needs to have a specific file extension
0 commit comments