Skip to main content
Version: 6.4

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; checkNonPersistentCompositeProps: true; disableDynamicFileAccess: false; inferDefaultValues: true; requireEntitiesArray: false; warnWhenNoEntities: true }; driverOptions: {}; dynamicImportProvider: (id: string) => Promise<any>; embeddables: { prefixMode: absolute }; ensureDatabase: true; ensureIndexes: false; entities: never[]; entitiesTs: never[]; entityGenerator: { bidirectionalRelations: false; fileName: (className: string) => string; forceUndefined: true; identifiedReferences: false; onlyPurePivotTables: false; outputPurePivotTables: false; readOnlyPivotTables: false; scalarPropertiesForRelations: never; scalarTypeInDecorator: false; undefinedDefaults: 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; highlighter: NullHighlighter; hydrator: typeof ObjectHydrator; ignoreDeprecations: false; 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: false; dropTables: true; emit: ts; fileName: (timestamp: string, name?: string) => string; glob: string; path: string; safe: false; silent: false; snapshot: true; tableName: string; transactional: true }; onQuery: (sql: string) => string; persistOnCreate: true; pool: {}; populateAfterFlush: true; populateWhere: ALL; preferReadReplicas: true; propagationOnPrototype: true; resultCache: { adapter: typeof MemoryCacheAdapter; expiration: number; options: {} }; schemaGenerator: { createForeignKeyConstraints: true; disableForeignKeys: false; ignoreSchema: never[] }; seeder: { defaultSeeder: string; emit: ts; fileName: (className: string) => string; glob: string; path: string }; serialization: { includePrimaryKeys: true }; strict: false; subscribers: never[]; upsertManaged: true; 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; checkNonPersistentCompositeProps: true; disableDynamicFileAccess: false; inferDefaultValues: true; requireEntitiesArray: false; warnWhenNoEntities: true }
    • alwaysAnalyseProperties: true
    • checkDuplicateEntities: true
    • checkDuplicateFieldNames: true
    • checkDuplicateTableNames: true
    • checkNonPersistentCompositeProps: 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>

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

            • className: string

            Returns string

      • forceUndefined: true
      • identifiedReferences: false
      • onlyPurePivotTables: false
      • outputPurePivotTables: false
      • readOnlyPivotTables: false
      • scalarPropertiesForRelations: never
      • scalarTypeInDecorator: false
      • undefinedDefaults: 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
      • highlighter: NullHighlighter
      • hydrator: typeof ObjectHydrator
      • ignoreDeprecations: false
      • 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: false; 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: false
        • 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
      • onQuery: (sql: string) => string
          • (sql: string): string
          • Parameters

            • sql: string

            Returns string

      • persistOnCreate: true
      • pool: {}
        • populateAfterFlush: true
        • populateWhere: ALL
        • preferReadReplicas: true
        • propagationOnPrototype: true
        • resultCache: { adapter: typeof MemoryCacheAdapter; expiration: number; options: {} }
        • schemaGenerator: { createForeignKeyConstraints: true; disableForeignKeys: false; ignoreSchema: never[] }
          • createForeignKeyConstraints: true
          • disableForeignKeys: false
          • 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[]
        • upsertManaged: true
        • validate: false
        • validateRequired: true
        • verbose: false

        Methods

        get

        • get(key: T, defaultValue?: U): U
        • Gets specific configuration option. Falls back to specified defaultValue if provided.


          Parameters

          • key: T
          • optionaldefaultValue: U

          Returns U

        getAll

        getCachedService

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


          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(name: string): undefined | 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(key: T): void
          • Resets the configuration to its default value


            Parameters

            • key: T

            Returns void

          resetServiceCache

          • resetServiceCache(): void
          • Returns void

          set

          • set(key: T, value: U): void
          • Overrides specified configuration value.


            Parameters

            • key: T
            • value: U

            Returns void