UNPKG

lakutata

Version:

An IoC-based universal application framework.

404 lines (341 loc) 14.2 kB
import { Subject } from './TypeDef.internal.85.js'; import { EntityMetadata, RelationMetadata, ColumnMetadata } from './TypeDef.internal.47.js'; import { Driver } from './TypeDef.internal.45.js'; import { EntityTarget } from './TypeDef.internal.36.js'; import { ColumnType, DatabaseType } from './TypeDef.internal.44.js'; import { Migration } from './TypeDef.internal.48.js'; import './TypeDef.internal.30.js'; 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); } /** * 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[]); } export { AlreadyHasActiveConnectionError, CannotAttachTreeChildrenEntityError, CannotConnectAlreadyConnectedError, CannotCreateEntityIdMapError, CannotDetermineEntityError, CannotExecuteNotConnectedError, CannotGetEntityManagerNotConnectedError, CannotReflectMethodParameterTypeError, CircularRelationsError, ColumnTypeUndefinedError, ConnectionIsNotSetError, ConnectionNotFoundError, CustomRepositoryCannotInheritRepositoryError, CustomRepositoryDoesNotHaveEntityError, CustomRepositoryNotFoundError, DataTypeNotSupportedError, DriverOptionNotSetError, DriverPackageNotInstalledError, EntityMetadataNotFoundError, EntityNotFoundError, EntityPropertyNotFoundError, FindRelationsNotFoundError, ForbiddenTransactionModeOverrideError, InitializedRelationError, InsertValuesMissingError, LimitOnUpdateNotSupportedError, LockNotSupportedOnGivenDriverError, MetadataAlreadyExistsError, MetadataWithSuchNameAlreadyExistsError, MissingDeleteDateColumnError, MissingDriverError, MissingJoinColumnError, MissingJoinTableError, MissingPrimaryColumnError, MustBeEntityError, NoConnectionForRepositoryError, NoConnectionOptionError, NoNeedToReleaseEntityManagerError, NoVersionOrUpdateDateColumnError, OffsetWithoutLimitNotSupportedError, OptimisticLockCanNotBeUsedError, OptimisticLockVersionMismatchError, PersistedEntityNotFoundError, PessimisticLockTransactionRequiredError, PrimaryColumnCannotBeNullableError, QueryFailedError, QueryRunnerAlreadyReleasedError, QueryRunnerProviderAlreadyReleasedError, RepositoryNotTreeError, ReturningStatementNotSupportedError, SubjectRemovedAndUpdatedError, SubjectWithoutIdentifierError, TransactionAlreadyStartedError, TransactionNotStartedError, TreeRepositoryNotSupportedError, TypeORMError, UpdateValuesMissingError, UsingJoinColumnIsNotAllowedError, UsingJoinColumnOnlyOnOneSideAllowedError, UsingJoinTableIsNotAllowedError, UsingJoinTableOnlyOnOneSideAllowedError };