import { BaseEntity, TBaseIdEntity, TBaseTzEntity } from '../base/models'; import { AbstractTzRepository } from '../base/repositories'; import { Binding, BindingFromClassOptions, BindingKey, Constructor, ControllerClass } from '@loopback/core'; import { Count, DataObject, Entity, Filter, JugglerDataSource, Options, Repository, Transaction, Where } from '@loopback/repository'; import { RequestContext, SequenceHandler } from '@loopback/rest'; import { IncomingHttpHeaders } from 'node:http'; import { ParsedUrlQuery } from 'node:querystring'; export type NumberIdType = number; export type StringIdType = string; export type IdType = string | number; export type NullableType = undefined | null | void; export type AnyType = any; export type AnyObject = Record; export type ValueOrPromise = T | Promise; export type ValueOf = T[keyof T]; export type ValueOptional = Omit & Partial>; export type ValueOptionalExcept = Pick & Partial>; /** * Alias for {@link ValueOf} */ export type ClassProps = ValueOf; export type ClassType = Function & { prototype: T; }; export type TStatusFromClass> = ValueOf>; export type TStringConstValue> = Extract, string>; export type TNumberConstValue> = Extract, number>; export type TConstValue> = Extract, string | number>; export type TPrettify = { [K in keyof T]: T[K]; } & {}; export type TRelationType = 'belongsTo' | 'hasOne' | 'hasMany' | 'hasManyThrough'; export type TBullQueueRole = 'queue' | 'worker'; export type TPermissionEffect = 'allow' | 'deny'; export type TFieldMappingDataType = 'string' | 'number' | 'strings' | 'numbers' | 'boolean'; export interface IFieldMapping { name: string; type: TFieldMappingDataType; default?: string | number | Array | Array | boolean; } export type TFieldMappingNames> = Extract; }>['name']; export type TObjectFromFieldMappings = { [K in T[number]['name']]: T extends { name: K; type: 'string'; [extra: string | symbol]: any; } ? string : T extends { name: K; type: 'number'; [extra: string | symbol]: any; } ? number : T extends { name: K; type: 'boolean'; [extra: string | symbol]: any; } ? boolean : T extends { name: K; type: 'strings'; [extra: string | symbol]: any; } ? string[] : T extends { name: K; type: 'numbers'; [extra: string | symbol]: any; } ? number[] : never; }; export interface IApplication { models: Set; initialize(opts: { sequence?: Constructor; }): ValueOrPromise; staticConfigure(): void; getProjectRoot(): string; preConfigure(): ValueOrPromise; postConfigure(): ValueOrPromise; grpcController(ctor: ControllerClass, nameOrOptions?: string | BindingFromClassOptions): Binding; getServerHost(): string; getServerPort(): number; getServerAddress(): string; getDatasourceSync(dsName: string): T; getRepositorySync(c: ClassType): T; getServiceSync(c: ClassType): T; getMigrateModels(opts: { ignoreModels?: string[]; migrateModels?: string[]; }): ValueOrPromise>>; migrateModels(opts: { existingSchema: string; ignoreModels?: string[]; migrateModels?: string[]; }): ValueOrPromise; } export interface IDataSource { name: string; config: T; } export interface IEntity { id: IdType; } export type EntityClassType = typeof Entity & { prototype: T & { id?: IdType; }; }; export type EntityRelationType = {}; export interface IDangerFilter extends Omit { order: string | string[]; } export interface IRepository { } export type TDBAction = Options & { transaction?: Transaction; }; export interface IPersistableRepository extends IRepository { findOne(filter?: Filter, options?: TDBAction): Promise; existsWith(where?: Where, options?: TDBAction): Promise; create(data: DataObject, options?: TDBAction): Promise; createAll(datum: DataObject[], options?: TDBAction): Promise; createWithReturn(data: DataObject, options?: TDBAction): Promise; updateById(id: IdType, data: DataObject, options?: TDBAction): Promise; updateWithReturn(id: IdType, data: DataObject, options?: TDBAction): Promise; updateAll(data: DataObject, where?: Where, options?: TDBAction): Promise; upsertWith(data: DataObject, where: Where, options?: TDBAction): Promise; replaceById(id: IdType, data: DataObject, options?: TDBAction): Promise; } export interface ITzRepository extends IPersistableRepository { mixTimestamp(entity: DataObject, options?: { newInstance: boolean; }): DataObject; mixUserAudit(entity: DataObject, options?: { newInstance: boolean; authorId: IdType; }): DataObject; } export interface IService { } export interface ICrudMethodOptions { currentUser: { userId: IdType; roles: Array<{ id: IdType; identifier: string; priority: number; }>; [extra: string | symbol]: any; } | null; requestContext: RequestContext; [extra: symbol | string]: any; } export interface ICrudService extends IService { repository: AbstractTzRepository; find(filter: Filter, options: ICrudMethodOptions): Promise>; findById(id: IdType, filter: Filter, options: ICrudMethodOptions): Promise; findOne(filter: Filter, options: ICrudMethodOptions): Promise<(E & EntityRelationType) | null>; count(where: Where, options: ICrudMethodOptions): Promise; create(data: Omit, options: ICrudMethodOptions): Promise; updateAll(data: Partial, where: Where, options: ICrudMethodOptions): Promise; updateWithReturn(id: IdType, data: Partial, options: ICrudMethodOptions): Promise; replaceById(id: IdType, data: E, options: ICrudMethodOptions): Promise; deleteById(id: IdType, options: ICrudMethodOptions): Promise<{ id: IdType; }>; } export interface IController { } export interface ICrudController extends IController { defaultLimit: number; relation?: { name: string; type: string; }; repository?: IRepository; sourceRepository?: IRepository; targetRepository?: IRepository; } export interface IApplicationEnvironment { get(key: string): ReturnType; set(key: string, value: ValueType): any; } export interface IEnvironmentValidationResult { result: boolean; message?: string; } export interface IError extends Error { statusCode: StatusCode; message: string; [key: string]: any; } export interface IRequestedRemark { id: string; url: string; method: string; [extra: string | symbol]: any; } export type TInjectionGetter = (key: string | BindingKey) => T; export interface IHandshake { headers: IncomingHttpHeaders; time: string; address: string; xdomain: boolean; secure: boolean; issued: number; url: string; query: ParsedUrlQuery; auth: { [key: string]: any; }; } //# sourceMappingURL=types.d.ts.map