Skip to main content
Version: 6.2

Configuration <D, EM>

Index

Constructors

constructor

Properties

staticreadonlyDEFAULTS

DEFAULTS: { allowGlobalContext: false; assign: { mergeEmbeddedProperties: true; mergeObjectProperties: false; updateByPrimaryKey: true; updateNestedEntities: true }; autoJoinOneToOneOwner: true; autoJoinRefsForFilters: true; baseDir: string; batchSize: number; colors: true; connect: true; context: (name: string) => undefined | EntityManager<IDatabaseDriver<Connection>>; contextName: string; dataloader: NONE; debug: false; discovery: { alwaysAnalyseProperties: true; checkDuplicateEntities: true; checkDuplicateFieldNames: true; checkDuplicateTableNames: true; disableDynamicFileAccess: false; inferDefaultValues: true; requireEntitiesArray: false; warnWhenNoEntities: true }; driverOptions: {}; dynamicImportProvider: (id: string) => Promise<any>; ensureDatabase: true; ensureIndexes: false; entities: never[]; entitiesTs: never[]; entityGenerator: { bidirectionalRelations: false; fileName: (className: string) => string; identifiedReferences: false; onlyPurePivotTables: false; readOnlyPivotTables: false; scalarPropertiesForRelations: never; scalarTypeInDecorator: false; useCoreBaseEntity: false }; extensions: never[]; filters: {}; findExactlyOneOrFailHandler: (entityName: string, where: IPrimaryKeyValue | Dictionary) => NotFoundError<Partial<any>>; findOneOrFailHandler: (entityName: string, where: IPrimaryKeyValue | Dictionary) => NotFoundError<Partial<any>>; flushMode: AUTO; forceEntityConstructor: false; forceUndefined: false; forceUtcTimezone: false; highlighter: NullHighlighter; hydrator: typeof ObjectHydrator; ignoreUndefinedInQuery: false; loadStrategy: JOINED; logger: (message?: any, ...optionalParams: any[]) => void; metadataCache: { adapter: typeof FileCacheAdapter; options: { cacheDir: string }; pretty: false }; metadataProvider: typeof ReflectMetadataProvider; migrations: { allOrNothing: true; disableForeignKeys: true; dropTables: true; emit: ts; fileName: (timestamp: string, name?: string) => string; glob: string; path: string; safe: false; silent: false; snapshot: true; tableName: string; transactional: true }; persistOnCreate: true; pool: {}; populateAfterFlush: true; populateWhere: ALL; preferReadReplicas: true; propagationOnPrototype: true; resultCache: { adapter: typeof MemoryCacheAdapter; expiration: number; options: {} }; schemaGenerator: { createForeignKeyConstraints: true; disableForeignKeys: true; ignoreSchema: never[] }; seeder: { defaultSeeder: string; emit: ts; fileName: (className: string) => string; glob: string; path: string }; serialization: { includePrimaryKeys: true }; strict: false; subscribers: never[]; validate: false; validateRequired: true; verbose: false } = ...

Type declaration

  • allowGlobalContext: false
  • assign: { mergeEmbeddedProperties: true; mergeObjectProperties: false; updateByPrimaryKey: true; updateNestedEntities: true }
    • mergeEmbeddedProperties: true
    • mergeObjectProperties: false
    • updateByPrimaryKey: true
    • updateNestedEntities: true
  • autoJoinOneToOneOwner: true
  • autoJoinRefsForFilters: true
  • baseDir: string
  • batchSize: number
  • colors: true
  • connect: true
  • context: (name: string) => undefined | EntityManager<IDatabaseDriver<Connection>>
  • contextName: string
  • dataloader: NONE
  • debug: false
  • discovery: { alwaysAnalyseProperties: true; checkDuplicateEntities: true; checkDuplicateFieldNames: true; checkDuplicateTableNames: true; disableDynamicFileAccess: false; inferDefaultValues: true; requireEntitiesArray: false; warnWhenNoEntities: true }
    • alwaysAnalyseProperties: true
    • checkDuplicateEntities: true
    • checkDuplicateFieldNames: true
    • checkDuplicateTableNames: true
    • disableDynamicFileAccess: false
    • inferDefaultValues: true
    • requireEntitiesArray: false
    • warnWhenNoEntities: true
  • driverOptions: {}
    • dynamicImportProvider: (id: string) => Promise<any>
        • (id: string): Promise<any>
        • Parameters

          • id: string

          Returns Promise<any>

    • ensureDatabase: true
    • ensureIndexes: false
    • entities: never[]
    • entitiesTs: never[]
    • entityGenerator: { bidirectionalRelations: false; fileName: (className: string) => string; identifiedReferences: false; onlyPurePivotTables: false; readOnlyPivotTables: false; scalarPropertiesForRelations: never; scalarTypeInDecorator: false; useCoreBaseEntity: false }
      • bidirectionalRelations: false
      • fileName: (className: string) => string
          • (className: string): string
          • Parameters

            • className: string

            Returns string

      • identifiedReferences: false
      • onlyPurePivotTables: false
      • readOnlyPivotTables: false
      • scalarPropertiesForRelations: never
      • scalarTypeInDecorator: false
      • useCoreBaseEntity: false
    • extensions: never[]
    • filters: {}
      • findExactlyOneOrFailHandler: (entityName: string, where: IPrimaryKeyValue | Dictionary) => NotFoundError<Partial<any>>
      • findOneOrFailHandler: (entityName: string, where: IPrimaryKeyValue | Dictionary) => NotFoundError<Partial<any>>
      • flushMode: AUTO
      • forceEntityConstructor: false
      • forceUndefined: false
      • forceUtcTimezone: false
      • highlighter: NullHighlighter
      • hydrator: typeof ObjectHydrator
      • ignoreUndefinedInQuery: false
      • loadStrategy: JOINED
      • logger: (message?: any, ...optionalParams: any[]) => void
          • (message?: any, ...optionalParams: any[]): void
          • Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

            const count = 5;
            console.log('count: %d', count);
            // Prints: count: 5, to stdout
            console.log('count:', count);
            // Prints: count: 5, to stdout

            See util.format() for more information.

            @since

            v0.1.100


            Parameters

            • optionalmessage: any
            • rest...optionalParams: any[]

            Returns void

      • metadataCache: { adapter: typeof FileCacheAdapter; options: { cacheDir: string }; pretty: false }
        • adapter: typeof FileCacheAdapter
        • options: { cacheDir: string }
          • cacheDir: string
        • pretty: false
      • metadataProvider: typeof ReflectMetadataProvider
      • migrations: { allOrNothing: true; disableForeignKeys: true; dropTables: true; emit: ts; fileName: (timestamp: string, name?: string) => string; glob: string; path: string; safe: false; silent: false; snapshot: true; tableName: string; transactional: true }
        • allOrNothing: true
        • disableForeignKeys: true
        • dropTables: true
        • emit: ts
        • fileName: (timestamp: string, name?: string) => string
            • (timestamp: string, name?: string): string
            • Parameters

              • timestamp: string
              • optionalname: string

              Returns string

        • glob: string
        • path: string
        • safe: false
        • silent: false
        • snapshot: true
        • tableName: string
        • transactional: true
      • persistOnCreate: true
      • pool: {}
        • populateAfterFlush: true
        • populateWhere: ALL
        • preferReadReplicas: true
        • propagationOnPrototype: true
        • resultCache: { adapter: typeof MemoryCacheAdapter; expiration: number; options: {} }
        • schemaGenerator: { createForeignKeyConstraints: true; disableForeignKeys: true; ignoreSchema: never[] }
          • createForeignKeyConstraints: true
          • disableForeignKeys: true
          • ignoreSchema: never[]
        • seeder: { defaultSeeder: string; emit: ts; fileName: (className: string) => string; glob: string; path: string }
          • defaultSeeder: string
          • emit: ts
          • fileName: (className: string) => string
              • (className: string): string
              • Parameters

                • className: string

                Returns string

          • glob: string
          • path: string
        • serialization: { includePrimaryKeys: true }
          • includePrimaryKeys: true
        • strict: false
        • subscribers: never[]
        • validate: false
        • validateRequired: true
        • verbose: false

        Methods

        get

        • get<T, U>(key: T, defaultValue?: U): U

        getAll

        getCachedService

        • getCachedService<T>(cls: T, ...args: ConstructorParameters<T>): InstanceType<T>
        • Creates instance of given service and caches it.


          Type parameters

          • T: new (...args: any[]) => InstanceType<T>

          Parameters

          • cls: T
          • rest...args: ConstructorParameters<T>

          Returns InstanceType<T>

        getClientUrl

        • getClientUrl(hidePassword?: boolean): string
        • Gets current client URL (connection string).


          Parameters

          • hidePassword: boolean = false

          Returns string

        getComparator

        getDriver

        • getDriver(): D
        • Gets current database driver instance.


          Returns D

        getExtension

        • getExtension<T>(name: string): undefined | T
        • Type parameters

          • T

          Parameters

          • name: string

          Returns undefined | T

        getHydrator

        • Gets instance of Hydrator. (cached)


          Parameters

          Returns IHydrator

        getLogger

        • Gets Logger instance.


          Returns Logger

        getMetadataCacheAdapter

        getMetadataProvider

        getNamingStrategy

        getRepositoryClass

        getResultCacheAdapter

        • Gets instance of CacheAdapter for result cache. (cached)


          Returns CacheAdapter

        registerExtension

        • registerExtension(name: string, cb: () => unknown): void
        • Parameters

          • name: string
          • cb: () => unknown

          Returns void

        reset

        • reset<T>(key: T): void
        • Resets the configuration to its default value


          Type parameters

          Parameters

          • key: T

          Returns void

        resetServiceCache

        • resetServiceCache(): void
        • Returns void

        set

        • set<T, U>(key: T, value: U): void