lakutata
Version:
An IoC-based universal application framework.
1,124 lines (1,042 loc) • 102 kB
TypeScript
import './vendor/TypeDef.2.js';
import { C as ColumnOptions, e as EntityTarget, A as RelationTypeInFunction, B as PropertyTypeFactory, w as OnDeleteType, F as OnUpdateType, z as DeferrableType, G as TableMetadataArgs, H as TreeMetadataArgs, K as IndexMetadataArgs, U as UniqueMetadataArgs, L as CheckMetadataArgs, X as ExclusionMetadataArgs, Y as ColumnMetadataArgs, Z as RelationMetadataArgs, _ as EntityListenerMetadataArgs, $ as RelationCountMetadataArgs, a0 as RelationIdMetadataArgs, a1 as EmbeddedMetadataArgs, a as DataSource, D as DataSourceOptions, E as EntityManager, a2 as MongoEntityManager, a3 as SqljsEntityManager, O as ObjectLiteral, R as Repository, T as TreeRepository, u as ObjectType, f as MongoRepository, S as SelectQueryBuilder, a4 as ColumnMetadata, a5 as RelationMetadata, d as EntityMetadata, b as Driver, r as ColumnType, a6 as DatabaseType, M as Migration, a7 as FindOperator, a8 as EqualOperator, a9 as FindOneOptions, aa as FindManyOptions, ab as FindTreeOptions, ac as Logger, ad as LoggerOptions, g as QueryRunner, ae as LogLevel, af as LogMessageType, ag as LogMessage, ah as PrepareLogMessagesOptions, ai as FileLoggerOptions, aj as SaveOptions, ak as RemoveOptions, al as DeepPartial, am as QueryDeepPartialEntity, an as InsertResult, ao as ObjectId, ap as FindOptionsWhere, aq as UpdateResult, ar as UpsertOptions, as as DeleteResult, at as PickKeysByType, N as NamingStrategyInterface, au as Table, av as SchemaBuilder, aw as SqlInMemory, ax as TableColumnOptions, ay as InsertQueryBuilder, az as DeleteQueryBuilder, aA as UpdateQueryBuilder, aB as SoftDeleteQueryBuilder, aC as RelationQueryBuilder, aD as Brackets, aE as NotBrackets, j as EntitySchema, aF as Query, aG as TableCheck, aH as TableColumn, aI as TableExclusion, aJ as TableForeignKey, aK as TableIndex, aL as TableUnique, aM as View } from './vendor/TypeDef.4.js';
export { c3 as AbstractCursor, c4 as AbstractCursorEvents, c5 as AbstractCursorOptions, c6 as AcceptedFields, c7 as AddToSetOperators, c8 as AddUserOptions, c9 as Admin, ca as AggregateOptions, cb as AggregationCursor, cc as AggregationCursorOptions, cd as AlternativeType, ce as AnyBulkWriteOperation, cf as AnyError, cg as ArrayElement, ch as ArrayOperator, b5 as AuroraMysqlConnectionCredentialsOptions, b4 as AuroraMysqlConnectionOptions, b6 as AuroraPostgresConnectionOptions, ci as Auth, cj as AuthMechanism, ck as AuthMechanismProperties, cl as AutoEncrypter, cm as AutoEncryptionLoggerLevel, cn as AutoEncryptionOptions, co as AutoEncryptionTlsOptions, bP as BSON, bQ as BSONRegExp, cs as BSONSerializeOptions, bR as BSONSymbol, bS as BSONType, ct as BSONTypeAlias, cp as Batch, cq as BatchType, b8 as BetterSqlite3ConnectionOptions, bO as Binary, cr as BitwiseFilter, cu as BulkOperationBase, cv as BulkWriteOperationError, cw as BulkWriteOptions, cx as BulkWriteResult, dE as CURSOR_FLAGS, cy as Callback, cz as CancellationToken, b9 as CapacitorConnectionOptions, cA as ChangeStream, cB as ChangeStreamCollModDocument, cC as ChangeStreamCreateDocument, cD as ChangeStreamCreateIndexDocument, cE as ChangeStreamDeleteDocument, cF as ChangeStreamDocument, cG as ChangeStreamDocumentCollectionUUID, cH as ChangeStreamDocumentCommon, cI as ChangeStreamDocumentKey, cJ as ChangeStreamDocumentOperationDescription, cK as ChangeStreamDropDatabaseDocument, cL as ChangeStreamDropDocument, cM as ChangeStreamDropIndexDocument, cN as ChangeStreamEvents, cO as ChangeStreamInsertDocument, cP as ChangeStreamInvalidateDocument, cQ as ChangeStreamNameSpace, cR as ChangeStreamOptions, cS as ChangeStreamRefineCollectionShardKeyDocument, cT as ChangeStreamRenameDocument, cU as ChangeStreamReplaceDocument, cV as ChangeStreamReshardCollectionDocument, cW as ChangeStreamShardCollectionDocument, cX as ChangeStreamUpdateDocument, cY as ClientMetadata, cZ as ClientMetadataOptions, c_ as ClientSession, c$ as ClientSessionEvents, d0 as ClientSessionOptions, d1 as CloseOptions, d3 as ClusterTime, d2 as ClusteredCollectionOptions, aT as CockroachConnectionCredentialsOptions, aS as CockroachConnectionOptions, bT as Code, d8 as CollStats, d9 as CollStatsOptions, d4 as CollationOptions, d5 as Collection, d6 as CollectionInfo, d7 as CollectionOptions, da as CommandFailedEvent, db as CommandOperationOptions, dc as CommandStartedEvent, dd as CommandSucceededEvent, de as CommonEvents, df as Compressor, dg as CompressorName, dh as Condition, dz as ConnectOptions, dk as ConnectionCheckOutFailedEvent, dl as ConnectionCheckOutStartedEvent, di as ConnectionCheckedInEvent, dj as ConnectionCheckedOutEvent, dm as ConnectionClosedEvent, dn as ConnectionCreatedEvent, dp as ConnectionEvents, dq as ConnectionOptions, dr as ConnectionPoolClearedEvent, ds as ConnectionPoolClosedEvent, dt as ConnectionPoolCreatedEvent, du as ConnectionPoolEvents, dv as ConnectionPoolMonitoringEvent, dw as ConnectionPoolOptions, dx as ConnectionPoolReadyEvent, dy as ConnectionReadyEvent, a$ as CordovaConnectionOptions, dA as CountDocumentsOptions, dB as CountOptions, dC as CreateCollectionOptions, dD as CreateIndexesOptions, dF as CursorFlag, dG as CursorStreamOptions, bU as DBRef, dH as Db, dI as DbOptions, dJ as DbStatsOptions, bV as Decimal128, dK as DeleteManyModel, dL as DeleteOneModel, dM as DeleteOptions, dN as DeleteStatement, dO as DistinctOptions, bX as Document, bY as Double, dP as DriverInfo, dQ as DropCollectionOptions, dR as DropDatabaseOptions, dS as DropIndexesOptions, dT as EndSessionOptions, dU as EnhancedOmit, br as EntitySchemaColumnOptions, be as EntitySchemaEmbeddedColumnOptions, bs as EntitySchemaIndexOptions, bf as EntitySchemaOptions, bt as EntitySchemaRelationOptions, c as EntitySubscriberInterface, dV as ErrorDescription, dW as EstimatedDocumentCountOptions, dX as EvalOptions, dY as EventEmitterWithState, dZ as EventsDescription, d_ as ExplainOptions, d$ as ExplainVerbosity, e0 as ExplainVerbosityLike, b7 as ExpoConnectionOptions, hj as Feature, hk as FeatureCollection, e1 as Filter, e2 as FilterOperations, e3 as FilterOperators, e4 as FindCursor, e5 as FindOneAndDeleteOptions, e6 as FindOneAndReplaceOptions, e7 as FindOneAndUpdateOptions, bu as FindOperatorType, e8 as FindOperators, e9 as FindOptions, bw as FindOptionsOrder, bv as FindOptionsOrderProperty, bx as FindOptionsOrderValue, bA as FindOptionsRelationByString, bz as FindOptionsRelations, by as FindOptionsRelationsProperty, bC as FindOptionsSelect, bD as FindOptionsSelectByString, bB as FindOptionsSelectProperty, bE as FindOptionsWhereProperty, ea as Flatten, em as GSSAPICanonicalizationValue, eb as GenericListener, hl as GeoJSON, hi as Geography, hh as Geometry, hg as GeometryCollection, ec as GridFSBucket, ed as GridFSBucketEvents, ee as GridFSBucketOptions, ef as GridFSBucketReadStream, eg as GridFSBucketReadStreamOptions, eh as GridFSBucketReadStreamOptionsWithRevision, ei as GridFSBucketWriteStream, ej as GridFSBucketWriteStreamOptions, ek as GridFSChunk, el as GridFSFile, en as HedgeOptions, eo as Hint, ep as HostAddress, eq as IndexDescription, er as IndexDirection, es as IndexInformationOptions, et as IndexSpecification, eu as InferIdType, bi as InsertEvent, ev as InsertManyResult, ew as InsertOneModel, ex as InsertOneOptions, ey as InsertOneResult, bZ as Int32, ez as IntegerType, eA as IsAny, I as IsolationLevel, eB as Join, J as JoinColumnOptions, bF as JoinOptions, s as JoinTableOptions, eC as KeysOfAType, eD as KeysOfOtherType, eE as LEGAL_TCP_SOCKET_OPTIONS, eF as LEGAL_TLS_SOCKET_OPTIONS, hb as LineString, eG as ListCollectionsCursor, eH as ListCollectionsOptions, eI as ListDatabasesOptions, eJ as ListDatabasesResult, eK as ListIndexesCursor, eL as ListIndexesOptions, bj as LoadEvent, bG as LogMessageFormat, b_ as Long, eO as MONGO_CLIENT_EVENTS, eM as MatchKeysAndValues, b$ as MaxKey, bh as MigrationInterface, c0 as MinKey, i as MixedList, eN as ModifyResult, eP as MongoAPIError, eQ as MongoAWSError, eR as MongoBatchReExecutionError, eS as MongoBulkWriteError, eT as MongoChangeStreamError, eU as MongoClient, eV as MongoClientEvents, eW as MongoClientOptions, eX as MongoCompatibilityError, b3 as MongoConnectionOptions, eY as MongoCredentials, eZ as MongoCredentialsOptions, e_ as MongoCursorExhaustedError, e$ as MongoCursorInUseError, f0 as MongoDBNamespace, f1 as MongoDecompressionError, f2 as MongoDriverError, f3 as MongoError, f4 as MongoErrorLabel, f5 as MongoExpiredSessionError, f6 as MongoGridFSChunkError, f7 as MongoGridFSStreamError, f8 as MongoInvalidArgumentError, f9 as MongoKerberosError, fa as MongoMissingCredentialsError, fb as MongoMissingDependencyError, fc as MongoNetworkError, fd as MongoNetworkErrorOptions, fe as MongoNetworkTimeoutError, ff as MongoNotConnectedError, fg as MongoOptions, fh as MongoParseError, fi as MongoRuntimeError, fj as MongoServerClosedError, fk as MongoServerError, fl as MongoServerSelectionError, fm as MongoSystemError, fn as MongoTailableCursorError, fo as MongoTopologyClosedError, fp as MongoTransactionError, fq as MongoUnexpectedServerResponseError, fr as MongoWriteConcernError, fs as MonitorEvents, ft as MonitorOptions, he as MultiLineString, hd as MultiPoint, hf as MultiPolygon, aP as MysqlConnectionCredentialsOptions, aO as MysqlConnectionOptions, b0 as NativescriptConnectionOptions, fu as NestedPaths, fv as NestedPathsOfType, fw as NonObjectIdLikeDocument, fx as NotAcceptedFields, fy as NumericType, fz as OIDCMechanismServerStep1, fA as OIDCRefreshFunction, fB as OIDCRequestFunction, fC as OIDCRequestTokenResult, fD as OneOrMore, fE as OnlyFieldsOfType, fF as OperationOptions, fG as OperationTime, fH as OptionalId, fI as OptionalUnlessRequiredId, a_ as OracleConnectionCredentialsOptions, aZ as OracleConnectionOptions, k as OrderByCondition, fJ as OrderedBulkOperation, fK as PkFactory, ha as Point, hc as Polygon, h9 as Position, aR as PostgresConnectionCredentialsOptions, aQ as PostgresConnectionOptions, fL as ProfilingLevel, fM as ProfilingLevelOptions, fN as PropertyType, fO as ProxyOptions, fP as PullAllOperator, fQ as PullOperator, fR as PushOperator, bc as QueryBuilder, bd as QueryResult, Q as QueryResultCache, aN as QueryResultCacheOptions, b1 as ReactNativeConnectionOptions, fS as ReadConcern, fT as ReadConcernLevel, fU as ReadConcernLike, fV as ReadPreference, fW as ReadPreferenceFromOptions, fX as ReadPreferenceLike, fY as ReadPreferenceLikeOptions, fZ as ReadPreferenceMode, f_ as ReadPreferenceOptions, bn as RecoverEvent, f$ as RegExpOrString, v as RelationOptions, bl as RemoveEvent, g0 as RemoveUserOptions, g1 as RenameOptions, g2 as ReplaceOneModel, g3 as ReplaceOptions, h as ReplicationMode, g4 as ResumeOptions, g5 as ResumeToken, g6 as ReturnDocument, g7 as RoleSpecification, g8 as RootFilterOperators, g9 as RunCommandOptions, aY as SapConnectionCredentialsOptions, aX as SapConnectionOptions, ga as SchemaMember, gb as SelectServerOptions, gc as ServerApi, gd as ServerApiVersion, ge as ServerCapabilities, gf as ServerClosedEvent, gg as ServerDescription, gh as ServerDescriptionChangedEvent, gi as ServerEvents, gj as ServerHeartbeatFailedEvent, gk as ServerHeartbeatStartedEvent, gl as ServerHeartbeatSucceededEvent, gm as ServerOpeningEvent, gn as ServerSession, go as ServerSessionId, gp as ServerType, gq as SetFields, gr as SetProfilingLevelOptions, bm as SoftRemoveEvent, gs as Sort, gt as SortDirection, bb as SpannerConnectionCredentialsOptions, ba as SpannerConnectionOptions, aW as SqlServerConnectionCredentialsOptions, aV as SqlServerConnectionOptions, aU as SqliteConnectionOptions, b2 as SqljsConnectionOptions, gu as Stream, gv as StreamDescription, gw as StreamDescriptionOptions, gx as StrictFilter, gy as StrictMatchKeysAndValues, gz as StrictUpdateFilter, gA as SupportedNodeConnectionOptions, gB as SupportedSocketOptions, gC as SupportedTLSConnectionOptions, gD as SupportedTLSSocketOptions, bH as TableCheckOptions, bI as TableExclusionOptions, bJ as TableForeignKeyOptions, bK as TableIndexOptions, bL as TableOptions, bM as TableUniqueOptions, gE as TagSet, gF as TimeSeriesCollectionOptions, c2 as Timestamp, gG as TopologyClosedEvent, gH as TopologyDescription, gI as TopologyDescriptionChangedEvent, gJ as TopologyDescriptionOptions, gK as TopologyEvents, gL as TopologyOpeningEvent, gM as TopologyType, gN as TopologyVersion, gO as Transaction, bo as TransactionCommitEvent, gP as TransactionOptions, bp as TransactionRollbackEvent, bq as TransactionStartEvent, gQ as TypedEventEmitter, gR as UnorderedBulkOperation, gS as UpdateDescription, bk as UpdateEvent, gT as UpdateFilter, gU as UpdateManyModel, gV as UpdateOneModel, gW as UpdateOptions, gX as UpdateStatement, gY as ValidateCollectionOptions, V as ValueTransformer, bN as ViewOptions, gZ as W, bg as WhereExpressionBuilder, g_ as WiredTigerData, g$ as WithId, h1 as WithSessionCallback, h2 as WithTransactionCallback, h0 as WithoutId, h3 as WriteConcern, h4 as WriteConcernError, h5 as WriteConcernErrorData, h6 as WriteConcernOptions, h7 as WriteConcernSettings, h8 as WriteError, bW as deserialize, c1 as serialize } from './vendor/TypeDef.4.js';
export { E as EntityOptions, I as IndexOptions } from './vendor/TypeDef.13.js';
import 'fs';
import 'tls';
import 'net';
import 'dns';
import 'events';
import 'stream';
/**
* Arguments for NamingStrategyMetadata class.
*/
interface NamingStrategyMetadataArgs {
/**
* Class to which this column is applied.
*/
readonly target: Function;
/**
* Strategy name.
*/
readonly name: string;
}
/**
* Arguments for JoinColumnMetadata class.
*/
interface JoinColumnMetadataArgs {
/**
* Class to which this column is applied.
*/
target: Function | string;
/**
* Class's property name to which this column is applied.
*/
propertyName: string;
/**
* Name of the column.
*/
name?: string;
/**
* Name of the column in the entity to which this column is referenced.
* This is column property name, not a column database name.
*/
referencedColumnName?: string;
/**
* Name of the foreign key constraint.
*/
foreignKeyConstraintName?: string;
}
/**
* Arguments for JoinTableMetadata class.
*/
interface JoinTableMetadataArgs {
/**
* Class to which this column is applied.
*/
readonly target: Function | string;
/**
* Class's property name to which this column is applied.
*/
readonly propertyName: string;
/**
* Name of the table that will be created to store values of the both tables (join table).
* By default is auto generated.
*/
readonly name?: string;
/**
* First column of the join table.
*/
readonly joinColumns?: JoinColumnMetadataArgs[];
/**
* Second (inverse) column of the join table.
*/
readonly inverseJoinColumns?: JoinColumnMetadataArgs[];
/**
* Database where join table will be created.
* Works only in some databases (like mysql and mssql).
*/
readonly database?: string;
/**
* Schema where join table will be created.
* Works only in some databases (like postgres and mssql).
*/
readonly schema?: string;
/**
* Indicates if schema synchronization is enabled or disabled junction table.
* If it will be set to false then schema sync will and migrations ignores junction table.
* By default schema synchronization is enabled.
*/
readonly synchronize?: boolean;
}
/**
* Arguments for EntitySubscriberMetadata class.
*/
interface EntitySubscriberMetadataArgs {
/**
* Class to which subscriber is applied.
*/
readonly target: Function;
}
/**
* Arguments for InheritanceMetadata class.
*/
interface InheritanceMetadataArgs {
/**
* Class to which inheritance is applied.
*/
readonly target?: Function | string;
/**
* Inheritance pattern.
*/
readonly pattern: "STI";
/**
* Column used as inheritance discriminator column.
*/
readonly column?: ColumnOptions;
}
/**
* DiscriminatorValue properties.
*/
interface DiscriminatorValueMetadataArgs {
/**
* Class to which discriminator name is applied.
*/
readonly target: Function | string;
/**
* Discriminator value.
*/
readonly value: any;
}
/**
* Arguments for EntityRepositoryMetadata class, helps to construct an EntityRepositoryMetadata object.
*/
interface EntityRepositoryMetadataArgs {
/**
* Constructor of the custom entity repository.
*/
readonly target: Function;
/**
* Entity managed by this custom repository.
*/
readonly entity?: EntityTarget<any>;
}
/**
* Used to inject transaction's entity managed into the method wrapped with @Transaction decorator.
*/
interface TransactionEntityMetadataArgs {
/**
* Target class on which decorator is used.
*/
readonly target: Function;
/**
* Method on which decorator is used.
*/
readonly methodName: string;
/**
* Index of the parameter on which decorator is used.
*/
readonly index: number;
}
/**
* Used to inject transaction's repository into the method wrapped with @Transaction decorator.
*/
interface TransactionRepositoryMetadataArgs {
/**
* Target class on which decorator is used.
*/
readonly target: Function;
/**
* Method on which decorator is used.
*/
readonly methodName: string;
/**
* Index of the parameter on which decorator is used.
*/
readonly index: number;
/**
* Type of the repository class (Repository, TreeRepository or MongoRepository) or custom repository class.
*/
readonly repositoryType: Function;
/**
* Argument of generic Repository<T> class if it's not custom repository class.
*/
readonly entityType?: Function;
}
/**
* Arguments for Generated decorator class.
*/
interface GeneratedMetadataArgs {
/**
* Class to which decorator is applied.
*/
readonly target: Function | string;
/**
* Class's property name to which decorator is applied.
*/
readonly propertyName: string;
/**
* Generation strategy.
*/
readonly strategy: "uuid" | "increment" | "rowid";
}
/**
* Arguments for ForeignKeyMetadata class.
*/
interface ForeignKeyMetadataArgs {
/**
* Class to which foreign key is applied.
*/
readonly target: Function | string;
/**
* Class's property name to which this foreign key is applied.
*/
readonly propertyName?: string;
/**
* Type of the relation. This type is in function because of language specifics and problems with recursive
* referenced classes.
*/
readonly type: RelationTypeInFunction;
/**
* Foreign key constraint name.
*/
readonly name?: string;
/**
* Inverse side of the relation.
*/
readonly inverseSide?: PropertyTypeFactory<any>;
/**
* Column names which included by this foreign key.
*/
readonly columnNames?: string[];
/**
* Column names which included by this foreign key.
*/
readonly referencedColumnNames?: string[];
/**
* "ON DELETE" of this foreign key, e.g. what action database should perform when
* referenced stuff is being deleted.
*/
readonly onDelete?: OnDeleteType;
/**
* "ON UPDATE" of this foreign key, e.g. what action database should perform when
* referenced stuff is being updated.
*/
readonly onUpdate?: OnUpdateType;
/**
* Set this foreign key constraint as "DEFERRABLE" e.g. check constraints at start
* or at the end of a transaction
*/
readonly deferrable?: DeferrableType;
}
/**
* Storage all metadatas args of all available types: tables, columns, subscribers, relations, etc.
* Each metadata args represents some specifications of what it represents.
* MetadataArgs used to create a real Metadata objects.
*/
declare class MetadataArgsStorage {
readonly tables: TableMetadataArgs[];
readonly trees: TreeMetadataArgs[];
readonly entityRepositories: EntityRepositoryMetadataArgs[];
readonly transactionEntityManagers: TransactionEntityMetadataArgs[];
readonly transactionRepositories: TransactionRepositoryMetadataArgs[];
readonly namingStrategies: NamingStrategyMetadataArgs[];
readonly entitySubscribers: EntitySubscriberMetadataArgs[];
readonly indices: IndexMetadataArgs[];
readonly foreignKeys: ForeignKeyMetadataArgs[];
readonly uniques: UniqueMetadataArgs[];
readonly checks: CheckMetadataArgs[];
readonly exclusions: ExclusionMetadataArgs[];
readonly columns: ColumnMetadataArgs[];
readonly generations: GeneratedMetadataArgs[];
readonly relations: RelationMetadataArgs[];
readonly joinColumns: JoinColumnMetadataArgs[];
readonly joinTables: JoinTableMetadataArgs[];
readonly entityListeners: EntityListenerMetadataArgs[];
readonly relationCounts: RelationCountMetadataArgs[];
readonly relationIds: RelationIdMetadataArgs[];
readonly embeddeds: EmbeddedMetadataArgs[];
readonly inheritances: InheritanceMetadataArgs[];
readonly discriminatorValues: DiscriminatorValueMetadataArgs[];
filterTables(target: Function | string): TableMetadataArgs[];
filterTables(target: (Function | string)[]): TableMetadataArgs[];
filterColumns(target: Function | string): ColumnMetadataArgs[];
filterColumns(target: (Function | string)[]): ColumnMetadataArgs[];
findGenerated(target: Function | string, propertyName: string): GeneratedMetadataArgs | undefined;
findGenerated(target: (Function | string)[], propertyName: string): GeneratedMetadataArgs | undefined;
findTree(target: (Function | string) | (Function | string)[]): TreeMetadataArgs | undefined;
filterRelations(target: Function | string): RelationMetadataArgs[];
filterRelations(target: (Function | string)[]): RelationMetadataArgs[];
filterRelationIds(target: Function | string): RelationIdMetadataArgs[];
filterRelationIds(target: (Function | string)[]): RelationIdMetadataArgs[];
filterRelationCounts(target: Function | string): RelationCountMetadataArgs[];
filterRelationCounts(target: (Function | string)[]): RelationCountMetadataArgs[];
filterIndices(target: Function | string): IndexMetadataArgs[];
filterIndices(target: (Function | string)[]): IndexMetadataArgs[];
filterForeignKeys(target: Function | string): ForeignKeyMetadataArgs[];
filterForeignKeys(target: (Function | string)[]): ForeignKeyMetadataArgs[];
filterUniques(target: Function | string): UniqueMetadataArgs[];
filterUniques(target: (Function | string)[]): UniqueMetadataArgs[];
filterChecks(target: Function | string): CheckMetadataArgs[];
filterChecks(target: (Function | string)[]): CheckMetadataArgs[];
filterExclusions(target: Function | string): ExclusionMetadataArgs[];
filterExclusions(target: (Function | string)[]): ExclusionMetadataArgs[];
filterListeners(target: Function | string): EntityListenerMetadataArgs[];
filterListeners(target: (Function | string)[]): EntityListenerMetadataArgs[];
filterEmbeddeds(target: Function | string): EmbeddedMetadataArgs[];
filterEmbeddeds(target: (Function | string)[]): EmbeddedMetadataArgs[];
findJoinTable(target: Function | string, propertyName: string): JoinTableMetadataArgs | undefined;
filterJoinColumns(target: Function | string, propertyName: string): JoinColumnMetadataArgs[];
filterSubscribers(target: Function | string): EntitySubscriberMetadataArgs[];
filterSubscribers(target: (Function | string)[]): EntitySubscriberMetadataArgs[];
filterNamingStrategies(target: Function | string): NamingStrategyMetadataArgs[];
filterNamingStrategies(target: (Function | string)[]): NamingStrategyMetadataArgs[];
filterTransactionEntityManagers(target: Function | string, propertyName: string): TransactionEntityMetadataArgs[];
filterTransactionRepository(target: Function | string, propertyName: string): TransactionRepositoryMetadataArgs[];
filterSingleTableChildren(target: Function | string): TableMetadataArgs[];
findInheritanceType(target: Function | string): InheritanceMetadataArgs | undefined;
findDiscriminatorValue(target: Function | string): DiscriminatorValueMetadataArgs | undefined;
/**
* Filters given array by a given target or targets.
*/
protected filterByTarget<T extends {
target: Function | string;
}>(array: T[], target: (Function | string) | (Function | string)[]): T[];
/**
* Filters given array by a given target or targets and prevents duplicate property names.
*/
protected filterByTargetAndWithoutDuplicateProperties<T extends {
target: Function | string;
propertyName: string;
}>(array: T[], target: (Function | string) | (Function | string)[]): T[];
/**
* Filters given array by a given target or targets and prevents duplicate relation property names.
*/
protected filterByTargetAndWithoutDuplicateRelationProperties<T extends RelationMetadataArgs>(array: T[], target: (Function | string) | (Function | string)[]): T[];
/**
* Filters given array by a given target or targets and prevents duplicate embedded property names.
*/
protected filterByTargetAndWithoutDuplicateEmbeddedProperties<T extends EmbeddedMetadataArgs>(array: T[], target: (Function | string) | (Function | string)[]): T[];
}
/**
* ConnectionManager is used to store and manage multiple orm connections.
* It also provides useful factory methods to simplify connection creation.
*
* @deprecated
*/
declare class ConnectionManager {
/**
* List of connections registered in this connection manager.
*/
get connections(): DataSource[];
/**
* Internal lookup to quickly get from a connection name to the Connection object.
*/
private readonly connectionMap;
/**
* Checks if connection with the given name exist in the manager.
*/
has(name: string): boolean;
/**
* Gets registered connection with the given name.
* If connection name is not given then it will get a default connection.
* Throws error if connection with the given name was not found.
*/
get(name?: string): DataSource;
/**
* Creates a new connection based on the given connection options and registers it in the manager.
* Connection won't be established, you'll need to manually call connect method to establish connection.
*/
create(options: DataSourceOptions): DataSource;
}
/**
* Gets metadata args storage.
*/
declare function getMetadataArgsStorage(): MetadataArgsStorage;
/**
* Reads connection options stored in ormconfig configuration file.
*
* @deprecated
*/
declare function getConnectionOptions(connectionName?: string): Promise<DataSourceOptions>;
/**
* Gets a ConnectionManager which creates connections.
*
* @deprecated
*/
declare function getConnectionManager(): ConnectionManager;
/**
* Creates a new connection and registers it in the manager.
* Only one connection from ormconfig will be created (name "default" or connection without name).
*
* @deprecated
*/
declare function createConnection(): Promise<DataSource>;
/**
* Creates a new connection from the ormconfig file with a given name.
*
* @deprecated
*/
declare function createConnection(name: string): Promise<DataSource>;
/**
* Creates a new connection and registers it in the manager.
*
* @deprecated
*/
declare function createConnection(options: DataSourceOptions): Promise<DataSource>;
/**
* Creates new connections and registers them in the manager.
*
* If connection options were not specified, then it will try to create connection automatically,
* based on content of ormconfig (json/js/env) file or environment variables.
* All connections from the ormconfig will be created.
*
* @deprecated
*/
declare function createConnections(options?: DataSourceOptions[]): Promise<DataSource[]>;
/**
* Gets connection from the connection manager.
* If connection name wasn't specified, then "default" connection will be retrieved.
*
* @deprecated
*/
declare function getConnection(connectionName?: string): DataSource;
/**
* Gets entity manager from the connection.
* If connection name wasn't specified, then "default" connection will be retrieved.
*
* @deprecated
*/
declare function getManager(connectionName?: string): EntityManager;
/**
* Gets MongoDB entity manager from the connection.
* If connection name wasn't specified, then "default" connection will be retrieved.
*
* @deprecated
*/
declare function getMongoManager(connectionName?: string): MongoEntityManager;
/**
* Gets Sqljs entity manager from connection name.
* "default" connection is used, when no name is specified.
* Only works when Sqljs driver is used.
*
* @deprecated
*/
declare function getSqljsManager(connectionName?: string): SqljsEntityManager;
/**
* Gets repository for the given entity class.
*
* @deprecated
*/
declare function getRepository<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, connectionName?: string): Repository<Entity>;
/**
* Gets tree repository for the given entity class.
*
* @deprecated
*/
declare function getTreeRepository<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, connectionName?: string): TreeRepository<Entity>;
/**
* Gets tree repository for the given entity class.
*
* @deprecated
*/
declare function getCustomRepository<T>(customRepository: ObjectType<T>, connectionName?: string): T;
/**
* Gets mongodb repository for the given entity class or name.
*
* @deprecated
*/
declare function getMongoRepository<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, connectionName?: string): MongoRepository<Entity>;
/**
* Creates a new query builder.
*
* @deprecated
*/
declare function createQueryBuilder<Entity extends ObjectLiteral>(entityClass?: EntityTarget<Entity>, alias?: string, connectionName?: string): SelectQueryBuilder<Entity>;
/**
* Container options.
*
* @deprecated
*/
interface UseContainerOptions {
/**
* If set to true, then default container will be used in the case if given container haven't returned anything.
*/
fallback?: boolean;
/**
* If set to true, then default container will be used in the case if given container thrown an exception.
*/
fallbackOnErrors?: boolean;
}
/**
* @deprecated
*/
type ContainedType<T> = {
new (...args: any[]): T;
} | Function;
/**
* @deprecated
*/
interface ContainerInterface {
get<T>(someClass: ContainedType<T>): T;
}
/**
* Sets container to be used by this library.
*
* @deprecated
*/
declare function useContainer(iocContainer: ContainerInterface, options?: UseContainerOptions): void;
/**
* Gets the IOC container used by this library.
*
* @deprecated
*/
declare function getFromContainer<T>(someClass: ContainedType<T>): T;
/**
* Wrapper type for relation type definitions in entities.
* Used to circumvent ESM modules circular dependency issue caused by reflection metadata saving the type of the property.
*
* Usage example:
* @Entity()
* export default class User {
*
* @OneToOne(() => Profile, profile => profile.user)
* profile: Relation<Profile>;
*
* }
*/
type Relation<T> = T;
declare class TypeORMError extends Error {
get name(): string;
constructor(message?: string);
}
/**
* Thrown when ORM cannot get method parameter's type.
* Basically, when reflect-metadata is not available or tsconfig is not properly setup.
*/
declare class CannotReflectMethodParameterTypeError extends TypeORMError {
constructor(target: Function, methodName: string);
}
/**
* Thrown when consumer tries to recreate connection with the same name, but previous connection was not closed yet.
*/
declare class AlreadyHasActiveConnectionError extends TypeORMError {
constructor(connectionName: string);
}
/**
* Change for insertion or updation of the column of the subject.
*/
interface SubjectChangeMap {
/**
* Column that needs to be changed.
* Either column, either relation must be set in the change.
*/
column?: ColumnMetadata;
/**
* Relation that needs to be changed.
* Either column, either relation must be set in the change.
*/
relation?: RelationMetadata;
/**
* Value needs to be inserted into given column.
* This value can also be another subject, when this column has a referenced column.
*/
value: Subject | any;
}
/**
* Subject is a subject of persistence.
* It holds information about each entity that needs to be persisted:
* - what entity should be persisted
* - what is database representation of the persisted entity
* - what entity metadata of the persisted entity
* - what is allowed to with persisted entity (insert/update/remove)
*
* Having this collection of subjects we can perform database queries.
*/
declare class Subject {
readonly "@instanceof": symbol;
/**
* Entity metadata of the subject entity.
*/
metadata: EntityMetadata;
/**
* Subject identifier.
* This identifier is not limited to table entity primary columns.
* This can be entity id or ids as well as some unique entity properties, like name or title.
* Insert / Update / Remove operation will be executed by a given identifier.
*/
identifier: ObjectLiteral | undefined;
/**
* Copy of entity but with relational ids fulfilled.
*/
entityWithFulfilledIds: ObjectLiteral | undefined;
/**
* If subject was created by cascades this property will contain subject
* from where this subject was created.
*/
parentSubject?: Subject;
/**
* Gets entity sent to the persistence (e.g. changed entity).
* If entity is not set then this subject is created only for the entity loaded from the database,
* or this subject is used for the junction operation (junction operations are relying only on identifier).
*/
entity?: ObjectLiteral;
/**
* Database entity.
* THIS IS NOT RAW ENTITY DATA, its a real entity.
*/
databaseEntity?: ObjectLiteral;
/**
* Indicates if database entity was loaded.
* No matter if it was found or not, it indicates the fact of loading.
*/
databaseEntityLoaded: boolean;
/**
* Changes needs to be applied in the database for the given subject.
*/
changeMaps: SubjectChangeMap[];
/**
* Generated values returned by a database (for example generated id or default values).
* Used in insert and update operations.
* Has entity-like structure (not just column database name and values).
*/
generatedMap?: ObjectLiteral;
/**
* Inserted values with updated values of special and default columns.
* Has entity-like structure (not just column database name and values).
*/
insertedValueSet?: ObjectLiteral;
/**
* Indicates if this subject can be inserted into the database.
* This means that this subject either is newly persisted, either can be inserted by cascades.
*/
canBeInserted: boolean;
/**
* Indicates if this subject can be updated in the database.
* This means that this subject either was persisted, either can be updated by cascades.
*/
canBeUpdated: boolean;
/**
* Indicates if this subject MUST be removed from the database.
* This means that this subject either was removed, either was removed by cascades.
*/
mustBeRemoved: boolean;
/**
* Indicates if this subject can be soft-removed from the database.
* This means that this subject either was soft-removed, either was soft-removed by cascades.
*/
canBeSoftRemoved: boolean;
/**
* Indicates if this subject can be recovered from the database.
* This means that this subject either was recovered, either was recovered by cascades.
*/
canBeRecovered: boolean;
/**
* Relations updated by the change maps.
*/
updatedRelationMaps: {
relation: RelationMetadata;
value: ObjectLiteral;
}[];
/**
* List of updated columns
*/
diffColumns: ColumnMetadata[];
/**
* List of updated relations
*/
diffRelations: RelationMetadata[];
constructor(options: {
metadata: EntityMetadata;
parentSubject?: Subject;
entity?: ObjectLiteral;
canBeInserted?: boolean;
canBeUpdated?: boolean;
mustBeRemoved?: boolean;
canBeSoftRemoved?: boolean;
canBeRecovered?: boolean;
identifier?: ObjectLiteral;
changeMaps?: SubjectChangeMap[];
});
/**
* Checks if this subject must be inserted into the database.
* Subject can be inserted into the database if it is allowed to be inserted (explicitly persisted or by cascades)
* and if it does not have database entity set.
*/
get mustBeInserted(): boolean;
/**
* Checks if this subject must be updated into the database.
* Subject can be updated in the database if it is allowed to be updated (explicitly persisted or by cascades)
* and if it does have differentiated columns or relations.
*/
get mustBeUpdated(): boolean | undefined;
/**
* Checks if this subject must be soft-removed into the database.
* Subject can be updated in the database if it is allowed to be soft-removed (explicitly persisted or by cascades)
* and if it does have differentiated columns or relations.
*/
get mustBeSoftRemoved(): boolean | ObjectLiteral | undefined;
/**
* Checks if this subject must be recovered into the database.
* Subject can be updated in the database if it is allowed to be recovered (explicitly persisted or by cascades)
* and if it does have differentiated columns or relations.
*/
get mustBeRecovered(): boolean | ObjectLiteral | undefined;
/**
* Creates a value set needs to be inserted / updated in the database.
* Value set is based on the entity and change maps of the subject.
* Important note: this method pops data from this subject's change maps.
*/
createValueSetAndPopChangeMap(): ObjectLiteral;
/**
* Recomputes entityWithFulfilledIds and identifier when entity changes.
*/
recompute(): void;
}
/**
* Thrown when operation is going to be executed on a subject without identifier.
* This error should never be thrown, however it still presents to prevent user from updation or removing the whole table.
* If this error occurs still, it most probably is an ORM internal problem which must be reported and fixed.
*/
declare class SubjectWithoutIdentifierError extends TypeORMError {
constructor(subject: Subject);
}
/**
* Thrown when consumer tries to connect when he already connected.
*/
declare class CannotConnectAlreadyConnectedError extends TypeORMError {
constructor(connectionName: string);
}
/**
* Thrown when selected sql driver does not supports locking.
*/
declare class LockNotSupportedOnGivenDriverError extends TypeORMError {
constructor();
}
/**
* Thrown when user tries to execute operation that requires connection to be established.
*/
declare class ConnectionIsNotSetError extends TypeORMError {
constructor(dbType: string);
}
/**
* Thrown when user tries to create entity id map from the mixed id value,
* but id value is a single value when entity requires multiple values.
*/
declare class CannotCreateEntityIdMapError extends TypeORMError {
constructor(metadata: EntityMetadata, id: any);
}
declare class MetadataAlreadyExistsError extends TypeORMError {
constructor(metadataType: string, constructor: Function, propertyName?: string);
}
/**
* Thrown when user tries to save/remove/etc. constructor-less object (object literal) instead of entity.
*/
declare class CannotDetermineEntityError extends TypeORMError {
constructor(operation: string);
}
declare class UpdateValuesMissingError extends TypeORMError {
constructor();
}
declare class TreeRepositoryNotSupportedError extends TypeORMError {
constructor(driver: Driver);
}
/**
* Thrown if custom repository was not found.
*/
declare class CustomRepositoryNotFoundError extends TypeORMError {
constructor(repository: any);
}
/**
* Thrown when transaction is not started yet and user tries to run commit or rollback.
*/
declare class TransactionNotStartedError extends TypeORMError {
constructor();
}
/**
* Thrown when transaction is already started and user tries to run it again.
*/
declare class TransactionAlreadyStartedError extends TypeORMError {
constructor();
}
/**
* Thrown when no result could be found in methods which are not allowed to return undefined or an empty set.
*/
declare class EntityNotFoundError extends TypeORMError {
readonly entityClass: EntityTarget<any>;
readonly criteria: any;
constructor(entityClass: EntityTarget<any>, criteria: any);
private stringifyTarget;
private stringifyCriteria;
}
declare class EntityMetadataNotFoundError extends TypeORMError {
constructor(target: EntityTarget<any>);
private stringifyTarget;
}
/**
* Thrown when method expects entity but instead something else is given.
*/
declare class MustBeEntityError extends TypeORMError {
constructor(operation: string, wrongValue: any);
}
/**
* Thrown when a version check on an object that uses optimistic locking through a version field fails.
*/
declare class OptimisticLockVersionMismatchError extends TypeORMError {
constructor(entity: string, expectedVersion: number | Date, actualVersion: number | Date);
}
/**
* Thrown when user tries to build an UPDATE query with LIMIT but the database does not support it.
*/
declare class LimitOnUpdateNotSupportedError extends TypeORMError {
constructor();
}
declare class PrimaryColumnCannotBeNullableError extends TypeORMError {
constructor(object: Object, propertyName: string);
}
/**
* Thrown if custom repository inherits Repository class however entity is not set in @EntityRepository decorator.
*/
declare class CustomRepositoryCannotInheritRepositoryError extends TypeORMError {
constructor(repository: any);
}
/**
* Thrown when consumer tries to use query runner from query runner provider after it was released.
*/
declare class QueryRunnerProviderAlreadyReleasedError extends TypeORMError {
constructor();
}
/**
* Thrown when user saves tree children entity but its parent is not saved yet.
*/
declare class CannotAttachTreeChildrenEntityError extends TypeORMError {
constructor(entityName: string);
}
/**
* Thrown if custom repositories that extend AbstractRepository classes does not have managed entity.
*/
declare class CustomRepositoryDoesNotHaveEntityError extends TypeORMError {
constructor(repository: any);
}
declare class MissingDeleteDateColumnError extends TypeORMError {
constructor(entityMetadata: EntityMetadata);
}
/**
* Thrown when consumer tries to access repository before connection is established.
*/
declare class NoConnectionForRepositoryError extends TypeORMError {
constructor(connectionName: string);
}
/**
* Thrown when circular relations detected with nullable set to false.
*/
declare class CircularRelationsError extends TypeORMError {
constructor(path: string);
}
/**
* Thrown when user tries to build a query with RETURNING / OUTPUT statement,
* but used database does not support it.
*/
declare class ReturningStatementNotSupportedError extends TypeORMError {
constructor();
}
declare class UsingJoinTableIsNotAllowedError extends TypeORMError {
constructor(entityMetadata: EntityMetadata, relation: RelationMetadata);
}
declare class MissingJoinColumnError extends TypeORMError {
constructor(entityMetadata: EntityMetadata, relation: RelationMetadata);
}
declare class MissingPrimaryColumnError extends TypeORMError {
constructor(entityMetadata: EntityMetadata);
}
/**
* Thrown when specified entity property was not found.
*/
declare class EntityPropertyNotFoundError extends TypeORMError {
constructor(propertyPath: string, metadata: EntityMetadata);
}
/**
* Thrown when consumer specifies driver type that does not exist or supported.
*/
declare class MissingDriverError extends TypeORMError {
constructor(driverType: string, availableDrivers?: string[]);
}
/**
* Thrown when required driver's package is not installed.
*/
declare class DriverPackageNotInstalledError extends TypeORMError {
constructor(driverName: string, packageName: string);
}
/**
* Thrown when consumer tries to access entity manager before connection is established.
*/
declare class CannotGetEntityManagerNotConnectedError extends TypeORMError {
constructor(connectionName: string);
}
/**
* Thrown when consumer tries to get connection that does not exist.
*/
declare class ConnectionNotFoundError extends TypeORMError {
constructor(name: string);
}
/**
* Thrown when an entity does not have no version and no update date column.
*/
declare class NoVersionOrUpdateDateColumnError extends TypeORMError {
constructor(entity: string);
}
/**
* Thrown when user tries to insert using QueryBuilder but do not specify what to insert.
*/
declare class InsertValuesMissingError extends TypeORMError {
constructor();
}
/**
* Thrown when an optimistic lock cannot be used in query builder.
*/
declare class OptimisticLockCanNotBeUsedError extends TypeORMError {
constructor();
}
declare class MetadataWithSuchNameAlreadyExistsError extends TypeORMError {
constructor(metadataType: string, name: string);
}
/**
* Thrown if some required driver's option is not set.
*/
declare class DriverOptionNotSetError extends TypeORMError {
constructor(optionName: string);
}
/**
* Thrown when relations specified in the find options were not found in the entities.
*/
declare class FindRelationsNotFoundError extends TypeORMError {
constructor(notFoundRelations: string[]);
}
/**
* Thrown when a transaction is required for the current operation, but there is none open.
*/
declare class PessimisticLockTransactionRequiredError extends TypeORMError {
constructor();
}
/**
* Thrown when repository for the given class is not found.
*/
declare class RepositoryNotTreeError extends TypeORMError {
constructor(entityClass: EntityTarget<any>);
}
declare class DataTypeNotSupportedError extends TypeORMError {
constructor(column: ColumnMetadata, dataType: ColumnType, database?: DatabaseType);
}
/**
* Thrown when relation has array initialized which is forbidden my ORM.
*
* @see https://github.com/typeorm/typeorm/issues/1319
* @see http://typeorm.io/#/relations-faq/avoid-relation-property-initializers
*/
declare class InitializedRelationError extends TypeORMError {
constructor(relation: RelationMetadata);
}
declare class MissingJoinTableError extends TypeORMError {
constructor(entityMetadata: EntityMetadata, relation: RelationMetadata);
}
/**
* Thrown when query execution has failed.
*/
declare class QueryFailedError<T extends Error = Error> extends TypeORMError {
readonly query: string;
readonly parameters: any[] | undefined;
readonly driverError: T;
constructor(query: string, parameters: any[] | undefined, driverError: T);
}
/**
* Thrown when consumer tries to release entity manager that does not use single database connection.
*/
declare class NoNeedToReleaseEntityManagerError extends TypeORMError {
constructor();
}
declare class UsingJoinColumnOnlyOnOneSideAllowedError extends TypeORMError {
constructor(entityMetadata: EntityMetadata, relation: RelationMetadata);
}
declare class UsingJoinTableOnlyOnOneSideAllowedError extends TypeORMError {
constructor(entityMetadata: EntityMetadata, relation: RelationMetadata);
}
/**
* Thrown when same object is scheduled for remove and updation at the same time.
*/
declare class SubjectRemovedAndUpdatedError extends TypeORMError {
constructor(subject: Subject);
}
/**
* Thrown . Theoretically can't be thrown.
*/
declare class PersistedEntityNotFoundError extends TypeORMError {
constructor();
}
declare class UsingJoinColumnIsNotAllowedError extends TypeORMError {
constructor(entityMetadata: EntityMetadata, relation: RelationMetadata);
}
/**
* Thrown when ORM cannot get column's type automatically.
* Basically, when reflect-metadata is not available or tsconfig is not properly setup.
*/
declare class ColumnTypeUndefinedError extends TypeORMError {
constructor(object: Object, propertyName: string);
}
declare class QueryRunnerAlreadyReleasedError extends TypeORMError {
constructor();
}
/**
* Thrown when user tries to build SELECT query using OFFSET without LIMIT applied but database does not support it.
*/
declare class OffsetWithoutLimitNotSupportedError extends TypeORMError {
constructor();
}
/**
* Thrown when consumer tries to execute operation allowed only if connection is opened.
*/
declare class CannotExecuteNotConnectedError extends TypeORMError {
constructor(connectionName: string);
}
/**
* Thrown when some option is not set in the connection options.
*/
declare class NoConnectionOptionError extends TypeORMError {
constructor(optionName: string);
}
/**
* Thrown when the per-migration transaction mode is overriden but the global transaction mode is set to "all".
*/
declare class ForbiddenTransactionModeOverrideError extends TypeORMError {
constructor(migrationsOverridingTransactionMode: Migration[]);
}
declare function And<T>(...values: FindOperator<T>[]): FindOperator<T>;
/**
* Find Options Operator.
* Example: { someField: Any([...]) }
*/
declare function Any<T>(value: readonly T[] | FindOperator<T>): FindOperator<T>;
/**
* FindOptions Operator.
* Example: { someField: ArrayContainedBy([...]) }
*/
declare function ArrayContainedBy<T>(value: readonly T[] | Fin