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AC,CAAC,SAAS;YAC1C,MAAM,EAAE,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YAChD,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YAClD,QAAQ,EAAE,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YACpD,MAAM,EAAE,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YAChD,UAAU,EAAE,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YACxD,kBAAkB,EAAE,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;SAChF,CAAC,CAAC;IAC5B,CAAC,CAAC;AACN,CAAC;AA3BD,sBA2BC","file":"Index.js","sourcesContent":["import {getMetadataArgsStorage, IndexOptions} from \"../\";\nimport {IndexMetadataArgs} from \"../metadata-args/IndexMetadataArgs\";\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(options?: IndexOptions): Function;\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(name: string, options?: IndexOptions): Function;\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(name: string, options: { synchronize: false }): Function;\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(name: string, fields: string[], options?: IndexOptions): Function;\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(fields: string[], options?: IndexOptions): Function;\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(fields: (object?: any) => (any[]|{ [key: string]: number }), options?: IndexOptions): Function;\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(name: string, fields: (object?: any) => (any[]|{ [key: string]: number }), options?: IndexOptions): Function;\n\n/**\n * Creates a database index.\n * Can be used on entity property or on entity.\n * Can create indices with composite columns when used on entity.\n */\nexport function Index(nameOrFieldsOrOptions?: string|string[]|((object: any) => (any[]|{ [key: string]: number }))|IndexOptions,\n maybeFieldsOrOptions?: ((object?: any) => (any[]|{ [key: string]: number }))|IndexOptions|string[]|{ synchronize: false },\n maybeOptions?: IndexOptions): Function {\n\n // normalize parameters\n const name = typeof nameOrFieldsOrOptions === \"string\" ? nameOrFieldsOrOptions : undefined;\n const fields = typeof nameOrFieldsOrOptions === \"string\" ? <((object?: any) => (any[]|{ [key: string]: number }))|string[]> maybeFieldsOrOptions : nameOrFieldsOrOptions as string[];\n let options = (typeof nameOrFieldsOrOptions === \"object\" && !Array.isArray(nameOrFieldsOrOptions)) ? nameOrFieldsOrOptions as IndexOptions : maybeOptions;\n if (!options)\n options = (typeof maybeFieldsOrOptions === \"object\" && !Array.isArray(maybeFieldsOrOptions)) ? maybeFieldsOrOptions as IndexOptions : maybeOptions;\n\n return function (clsOrObject: Function|Object, propertyName?: string) {\n\n getMetadataArgsStorage().indices.push({\n target: propertyName ? clsOrObject.constructor : clsOrObject as Function,\n name: name,\n columns: propertyName ? [propertyName] : fields,\n synchronize: options && (options as { synchronize: false }).synchronize === false ? false : true,\n where: options ? options.where : undefined,\n unique: options && options.unique ? true : false,\n spatial: options && options.spatial ? true : false,\n fulltext: options && options.fulltext ? true : false,\n sparse: options && options.sparse ? true : false,\n background: options && options.background ? true : false,\n expireAfterSeconds: options && options.expireAfterSeconds ? options.expireAfterSeconds : undefined\n } as IndexMetadataArgs);\n };\n}\n"],"sourceRoot":".."}
\No newline at end of file