zibri 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,34 +1,103 @@
1
1
  import { Request, Response, Express, NextFunction } from 'express';
2
- import { EntitySchemaRelationOptions, DataSourceOptions as DataSourceOptions$1, ColumnType as ColumnType$1, QueryRunner, FindOneOptions as FindOneOptions$1, FindManyOptions, Repository as Repository$1, FindOptionsWhere, DataSource as DataSource$1, EntitySchema, EntitySchemaColumnOptions } from 'typeorm';
3
- import { IsolationLevel } from 'typeorm/driver/types/IsolationLevel';
4
2
  import { oas31 } from 'openapi3-ts';
3
+ import { EntitySchemaRelationOptions, DataSourceOptions as DataSourceOptions$1, ColumnType as ColumnType$1, QueryRunner, FindOneOptions as FindOneOptions$1, FindManyOptions, Repository as Repository$1, FindOptionsWhere, EntityTarget, EntityMetadata as EntityMetadata$1, DataSource as DataSource$1, EntitySchema, EntitySchemaColumnOptions, TableColumnOptions } from 'typeorm';
4
+ import { IsolationLevel } from 'typeorm/driver/types/IsolationLevel';
5
+ import { ColumnMetadata } from 'typeorm/metadata/ColumnMetadata';
6
+ import { SecuritySchemeObject } from 'openapi3-ts/dist/oas31';
7
+ import { JwtHeader, Secret, SignOptions } from 'jsonwebtoken';
5
8
 
6
- interface DataSourceServiceInterface {
7
- init: () => Promise<void>;
9
+ type Newable<T> = new (...args: any[]) => T;
10
+
11
+ type DeepPartial<T> = T | (T extends (infer U)[] ? DeepPartial<U>[] : T extends Map<infer K, infer V> ? Map<DeepPartial<K>, DeepPartial<V>> : T extends Set<infer M> ? Set<DeepPartial<M>> : T extends object ? {
12
+ [K in keyof T]?: DeepPartial<T[K]>;
13
+ } : T);
14
+
15
+ type OmitStrict<T extends object, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
16
+
17
+ type Version = `${number}.${number}.${number}`;
18
+
19
+ declare enum HttpMethod {
20
+ GET = "get",
21
+ POST = "post",
22
+ PUT = "put",
23
+ PATCH = "patch",
24
+ DELETE = "delete"
8
25
  }
9
26
 
10
- declare class DataSourceService implements DataSourceServiceInterface {
27
+ declare enum HttpStatus {
28
+ INTERNAL_SERVER_ERROR = 500,
29
+ NOT_FOUND_ERROR = 404,
30
+ BAD_REQUEST = 400,
31
+ UNAUTHORIZED = 401
32
+ }
33
+
34
+ declare enum MimeType {
35
+ JSON = "application/json",
36
+ HTML = "text/html"
37
+ }
38
+ declare function isMimeType(value: string): value is MimeType;
39
+
40
+ type KnownHeader = 'Accept' | 'Accept-Encoding' | 'Authorization' | 'Cache-Control' | 'Content-Length' | 'Content-Type' | 'Cookie' | 'Host' | 'Origin' | 'Referer' | 'User-Agent' | 'X-Requested-With' | 'X-Forwarded-For' | 'X-Forwarded-Host' | 'X-Forwarded-Proto' | 'X-Real-IP' | 'X-Correlation-ID' | 'If-None-Match' | 'If-Modified-Since' | 'Connection' | 'DNT' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'TE';
41
+
42
+ type Header = KnownHeader | (string & {});
43
+
44
+ type HttpRequest = Request;
45
+
46
+ type HttpResponse = Response;
47
+
48
+ type Route = `/${string}`;
49
+ type ControllerRouteConfiguration = {
50
+ httpMethod: HttpMethod;
51
+ route: Route;
52
+ controllerMethod: string;
53
+ };
54
+
55
+ type RouteConfiguration = {
56
+ httpMethod: HttpMethod;
57
+ route: Route;
58
+ handler: (req: HttpRequest, res: HttpResponse) => unknown | Promise<unknown>;
59
+ };
60
+
61
+ interface RouterInterface {
62
+ registerController: <T extends Object>(controllerClass: Newable<T>, ...params: any[]) => void;
63
+ register: (route: RouteConfiguration, ...params: any[]) => void;
64
+ attachTo: (app: ZibriApplication, ...params: any[]) => void;
65
+ }
66
+
67
+ declare class Router implements RouterInterface {
68
+ private readonly router;
11
69
  private readonly logger;
70
+ private readonly parser;
71
+ private readonly validationService;
72
+ private readonly authService;
12
73
  constructor();
13
- init(): Promise<void>;
14
- private checkForOrphanedEntities;
74
+ attachTo(app: ZibriApplication): void;
75
+ register(route: RouteConfiguration): void;
76
+ registerController<T extends Object>(controllerClass: Newable<T>): void;
77
+ private routeToRequestHandler;
78
+ private controllerRouteToRequestHandler;
79
+ private resolveRouteParams;
15
80
  }
16
81
 
17
- declare function DataSource(): ClassDecorator;
82
+ declare function Controller(baseRoute: Route): ClassDecorator;
83
+
84
+ declare function Get(path?: Route): MethodDecorator;
85
+
86
+ declare function Post(path?: Route): MethodDecorator;
87
+
88
+ declare function Delete(path?: Route): MethodDecorator;
89
+
90
+ declare function Patch(path?: Route): MethodDecorator;
91
+
92
+ type BaseParamMetadata = {
93
+ name: string;
94
+ };
18
95
 
19
96
  type BasePropertyMetadata = {
20
97
  required: boolean;
21
98
  description: string | undefined;
22
99
  };
23
100
 
24
- type Newable<T> = new (...args: any[]) => T;
25
-
26
- type DeepPartial<T> = T | (T extends (infer U)[] ? DeepPartial<U>[] : T extends Map<infer K, infer V> ? Map<DeepPartial<K>, DeepPartial<V>> : T extends Set<infer M> ? Set<DeepPartial<M>> : T extends object ? {
27
- [K in keyof T]?: DeepPartial<T[K]>;
28
- } : T);
29
-
30
- type OmitStrict<T extends object, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
31
-
32
101
  type StringFormat = 'uuid' | 'email';
33
102
  type StringPropertyMetadata = BasePropertyMetadata & {
34
103
  type: 'string';
@@ -52,12 +121,12 @@ type ObjectPropertyMetadata = BasePropertyMetadata & {
52
121
  type ObjectPropertyMetadataInput = Partial<OmitStrict<ObjectPropertyMetadata, 'type'>> & Pick<ObjectPropertyMetadata, 'cls'>;
53
122
 
54
123
  type BaseEntity = {
55
- id: string | number;
124
+ id: string;
56
125
  };
57
126
 
58
127
  type ArrayPropertyMetadata = BasePropertyMetadata & {
59
128
  type: 'array';
60
- items: PropertyMetadata;
129
+ items: Exclude<PropertyMetadata, RelationMetadata<BaseEntity>>;
61
130
  };
62
131
  type ArrayItemPropertyType = Exclude<PropertyMetadata['type'], RelationMetadata<BaseEntity>['type']>;
63
132
  type ArrayPropertyItemMetadata = PropertyMetadataInput & {
@@ -149,6 +218,350 @@ declare function PickType<T, K extends keyof T>(Base: Newable<T>, keys: readonly
149
218
 
150
219
  declare function OmitType<T, K extends keyof T>(Base: Newable<T>, keys: readonly K[]): Newable<Omit<T, K>>;
151
220
 
221
+ type StringParamMetadata = BaseParamMetadata & OmitStrict<StringPropertyMetadata, 'primary'>;
222
+ type StringParamMetadataInput = Partial<OmitStrict<StringParamMetadata, 'name'>>;
223
+
224
+ type NumberParamMetadata = BaseParamMetadata & OmitStrict<NumberPropertyMetadata, 'primary'>;
225
+ type NumberParamMetadataInput = Partial<OmitStrict<NumberParamMetadata, 'name'>>;
226
+
227
+ type BooleanParamMetadata = BaseParamMetadata & BooleanPropertyMetadata;
228
+ type BooleanParamMetadataInput = Partial<OmitStrict<BooleanParamMetadata, 'name'>>;
229
+
230
+ type DateParamMetadata = BaseParamMetadata & DatePropertyMetadata;
231
+ type DateParamMetadataInput = Partial<OmitStrict<DateParamMetadata, 'name'>>;
232
+
233
+ type ObjectParamMetadata = BaseParamMetadata & ObjectPropertyMetadata;
234
+ type ObjectParamMetadataInput = Partial<OmitStrict<ObjectParamMetadata, 'name'>> & Pick<ObjectParamMetadata, 'cls'>;
235
+
236
+ type ArrayParamMetadata = BaseParamMetadata & ArrayPropertyMetadata;
237
+ type ArrayParamMetadataInput = Partial<OmitStrict<ArrayParamMetadata, 'type' | 'items'>> & {
238
+ items: QueryParamMetadataInput & Pick<QueryParamMetadata, 'type'>;
239
+ };
240
+
241
+ type PathParamMetadata = StringParamMetadata | NumberParamMetadata | BooleanParamMetadata | DateParamMetadata;
242
+ type PathParamMetadataInput = StringParamMetadataInput | NumberParamMetadataInput | BooleanParamMetadataInput | DateParamMetadataInput;
243
+ type QueryParamMetadata = StringParamMetadata | NumberParamMetadata | BooleanParamMetadata | DateParamMetadata | ObjectParamMetadata | ArrayParamMetadata;
244
+ type QueryParamMetadataInput = StringParamMetadataInput | NumberParamMetadataInput | BooleanParamMetadataInput | DateParamMetadataInput | ObjectParamMetadataInput | ArrayParamMetadataInput;
245
+ type HeaderParamMetadata = (StringParamMetadata | NumberParamMetadata | BooleanParamMetadata | DateParamMetadata | ObjectParamMetadata | ArrayParamMetadata) & {
246
+ name: Header;
247
+ };
248
+ type HeaderParamMetadataInput = StringParamMetadataInput | NumberParamMetadataInput | BooleanParamMetadataInput | DateParamMetadataInput | ObjectParamMetadataInput | ArrayParamMetadataInput;
249
+ declare namespace Param {
250
+ function path(name: string, options?: PathParamMetadataInput): ParameterDecorator;
251
+ function query(name: string, options?: QueryParamMetadataInput): ParameterDecorator;
252
+ function header(name: Header, options?: HeaderParamMetadataInput): ParameterDecorator;
253
+ }
254
+
255
+ type BodyMetadata = BasePropertyMetadata & {
256
+ modelClass: Newable<unknown>;
257
+ index: number;
258
+ name: string;
259
+ };
260
+ type BodyMetadataInput = Partial<OmitStrict<BodyMetadata, 'modelClass' | 'index' | 'name'>>;
261
+ declare function Body(modelClass: Newable<unknown>, options?: BodyMetadataInput): ParameterDecorator;
262
+
263
+ type OpenApiDefinition = oas31.OpenAPIObject;
264
+ type OpenApiPaths = oas31.PathsObject;
265
+ type OpenApiOperation = oas31.OperationObject;
266
+ type OpenApiParameter = (oas31.ParameterObject | oas31.ReferenceObject);
267
+ type OpenApiRequestBodyObject = oas31.RequestBodyObject;
268
+ type OpenApiSchemaObject = oas31.SchemaObject;
269
+ type OpenApiSecuritySchemeObject = oas31.SecuritySchemeObject;
270
+ type OpenApiSecurityRequirementObject = oas31.SecurityRequirementObject;
271
+
272
+ interface OpenApiServiceInterface {
273
+ readonly openApiRoute: Route;
274
+ attachTo: (app: ZibriApplication) => void;
275
+ createOpenApiDefinition: (app: ZibriApplication) => OpenApiDefinition;
276
+ }
277
+
278
+ declare class OpenApiService implements OpenApiServiceInterface {
279
+ readonly openApiRoute: Route;
280
+ private readonly logger;
281
+ private readonly assetService;
282
+ private readonly authService;
283
+ constructor();
284
+ attachTo(app: ZibriApplication): void;
285
+ createOpenApiDefinition(): OpenApiDefinition;
286
+ private resolveSecuritySchemes;
287
+ private resolveOpenApiPaths;
288
+ private resolveOperationSecurity;
289
+ private buildOpenApiBody;
290
+ private buildOpenApiSchemaForProperties;
291
+ private buildParameters;
292
+ private paramToSchema;
293
+ }
294
+
295
+ type BaseUser<Role extends string> = BaseEntity & {
296
+ email: string;
297
+ roles: Role[];
298
+ };
299
+
300
+ interface AuthStrategyInterface<RoleType extends string, UserType extends BaseUser<RoleType>, AuthDataType, CredentialType> {
301
+ init: () => void;
302
+ resolveUser: (request: HttpRequest) => Promise<UserType | undefined>;
303
+ login: (credentials: CredentialType) => Promise<AuthDataType>;
304
+ isLoggedIn: (request: HttpRequest) => Promise<boolean>;
305
+ hasRole: (request: HttpRequest, allowedRoles: RoleType[]) => Promise<boolean>;
306
+ securityScheme: OpenApiSecuritySchemeObject;
307
+ name: string;
308
+ }
309
+
310
+ type AuthStrategies = Newable<AuthStrategyInterface<string, BaseUser<string>, any, any>>[];
311
+
312
+ type IsLoggedInMetadata = {
313
+ allowedStrategies?: AuthStrategies;
314
+ };
315
+ type SkipIsLoggedInMetadata = {};
316
+
317
+ interface UserRepositoryInterface<RoleType extends string, UserType extends BaseUser<RoleType>, CredentialsType> {
318
+ findById: (id: UserType['id']) => Promise<UserType>;
319
+ findByEmail: (email: UserType['email']) => Promise<UserType>;
320
+ resolveCredentialsFor: (user: UserType) => Promise<CredentialsType>;
321
+ }
322
+
323
+ type UserRepositories = Newable<UserRepositoryInterface<string, BaseUser<string>, any>>[];
324
+
325
+ type HasRoleMetadata = {
326
+ allowedRoles: string[];
327
+ allowedStrategies?: AuthStrategies;
328
+ };
329
+ type SkipHasRoleMetadata = {};
330
+
331
+ type IsNotLoggedInMetadata = {
332
+ allowedStrategies?: AuthStrategies;
333
+ };
334
+ type SkipIsNotLoggedInMetadata = {};
335
+
336
+ interface HasRoleFn {
337
+ (allowedRoles: string[], allowedStrategies?: AuthStrategies): MethodDecorator & ClassDecorator;
338
+ skip: () => MethodDecorator & ClassDecorator;
339
+ }
340
+
341
+ interface IsLoggedInFn {
342
+ (allowedStrategies?: AuthStrategies): MethodDecorator & ClassDecorator;
343
+ skip: () => MethodDecorator & ClassDecorator;
344
+ }
345
+
346
+ interface IsNotLoggedInFn {
347
+ (allowedStrategies?: AuthStrategies): MethodDecorator & ClassDecorator;
348
+ skip: () => MethodDecorator & ClassDecorator;
349
+ }
350
+
351
+ declare namespace Auth {
352
+ const isLoggedIn: IsLoggedInFn;
353
+ const isNotLoggedIn: IsNotLoggedInFn;
354
+ const hasRole: HasRoleFn;
355
+ }
356
+
357
+ /**
358
+ * Marks the given class as a user repository.
359
+ * This registers it to be injected directly, without using "@InjectRepository".
360
+ *
361
+ * If you store your user in a database, you probably want to extend "Repository<UserEntityClass>" and implement the constructor, so that everything works:.
362
+ *
363
+ * ```ts
364
+ * \@UserRepo(User)
365
+ * export class UserRepository extends Repository<User, UserCreateData>
366
+ * implements UserRepositoryInterface<Roles, User, JwtCredentials> {
367
+ *
368
+ * constructor(
369
+ * \@InjectRepository(User)
370
+ * repo: Repository<User> // <-- The built in repository from zibri
371
+ * ) {
372
+ * super(User, repo);
373
+ * }
374
+ * // ...
375
+ * }
376
+ * ```
377
+ */
378
+ declare function UserRepo<T extends string, EntityType extends Newable<BaseUser<T>>>(): ClassDecorator;
379
+
380
+ type CurrentUserMetadata = {
381
+ index: number;
382
+ optional: boolean;
383
+ allowedStrategies?: AuthStrategies;
384
+ };
385
+ declare function CurrentUser(optional?: boolean, allowedStrategies?: AuthStrategies): ParameterDecorator;
386
+
387
+ interface AuthServiceInterface {
388
+ readonly strategies: AuthStrategies;
389
+ init: (strategies: AuthStrategies) => void;
390
+ checkAccess: (controllerClass: Newable<Object>, controllerMethod: string, req: HttpRequest) => Promise<void>;
391
+ isLoggedIn: (request: HttpRequest, allowedStrategies: AuthStrategies) => Promise<boolean>;
392
+ hasRole: (request: HttpRequest, allowedStrategies: AuthStrategies, allowedRoles: string[]) => Promise<boolean>;
393
+ resolveIsLoggedInMetadata: (controllerClass: Newable<Object>, controllerMethod: string) => IsLoggedInMetadata | undefined;
394
+ resolveIsNotLoggedInMetadata: (controllerClass: Newable<Object>, controllerMethod: string) => IsNotLoggedInMetadata | undefined;
395
+ resolveHasRoleMetadata: (controllerClass: Newable<Object>, controllerMethod: string) => HasRoleMetadata | undefined;
396
+ login: <Role extends string, UserType extends BaseUser<Role>, AuthDataType, CredentialsType>(strategy: Newable<AuthStrategyInterface<Role, UserType, AuthDataType, CredentialsType>>, credentials: CredentialsType) => Promise<AuthDataType>;
397
+ getCurrentUser: <Role extends string, UserType extends BaseUser<Role>, B extends boolean = false>(request: HttpRequest, strategies: AuthStrategies, optional: B) => Promise<B extends true ? UserType | undefined : UserType>;
398
+ }
399
+
400
+ declare class AuthService implements AuthServiceInterface {
401
+ private readonly logger;
402
+ readonly strategies: AuthStrategies;
403
+ constructor();
404
+ init(authStrategies: AuthStrategies): void;
405
+ login<Role extends string, UserType extends BaseUser<Role>, AuthDataType, CredentialsType>(strategy: Newable<AuthStrategyInterface<Role, UserType, AuthDataType, CredentialsType>>, credentials: CredentialsType): Promise<AuthDataType>;
406
+ getCurrentUser<Role extends string, UserType extends BaseUser<Role>, B extends boolean = false>(request: HttpRequest, allowedStrategies: AuthStrategies, optional: B): Promise<B extends true ? UserType | undefined : UserType>;
407
+ checkAccess(controllerClass: Newable<Object>, controllerMethod: string, request: HttpRequest): Promise<void>;
408
+ isLoggedIn(request: HttpRequest, allowedStrategies: AuthStrategies): Promise<boolean>;
409
+ hasRole(request: HttpRequest, allowedStrategies: AuthStrategies, allowedRoles: string[]): Promise<boolean>;
410
+ resolveIsLoggedInMetadata(controllerClass: Newable<Object>, controllerMethod: string): IsLoggedInMetadata | undefined;
411
+ resolveIsNotLoggedInMetadata(controllerClass: Newable<Object>, controllerMethod: string): IsNotLoggedInMetadata | undefined;
412
+ resolveHasRoleMetadata(controllerClass: Newable<Object>, controllerMethod: string): HasRoleMetadata | undefined;
413
+ }
414
+
415
+ type AccessTokenPayload<Role extends string, T extends BaseUser<Role>> = {
416
+ /**
417
+ * The id of the user.
418
+ */
419
+ id: T['id'];
420
+ email: T['email'];
421
+ /**
422
+ * The roles of the user.
423
+ */
424
+ roles: T['roles'];
425
+ };
426
+
427
+ declare class Jwt {
428
+ /**
429
+ * The token value.
430
+ */
431
+ value: string;
432
+ /**
433
+ * The timestamp at which the token is no longer valid.
434
+ */
435
+ expirationDate: Date;
436
+ }
437
+
438
+ declare class JwtAuthData<Role extends string> {
439
+ userId: string;
440
+ accessToken: Jwt;
441
+ refreshToken: Jwt;
442
+ roles: Role[];
443
+ }
444
+
445
+ declare class JwtCredentials implements BaseEntity {
446
+ id: string;
447
+ userId: string;
448
+ username: string;
449
+ password: string;
450
+ }
451
+ declare const JwtCredentialsDto_base: Newable<Omit<JwtCredentials, "id" | "userId">>;
452
+ declare class JwtCredentialsDto extends JwtCredentialsDto_base {
453
+ }
454
+
455
+ declare class JwtAuthStrategy<RoleType extends string, UserType extends BaseUser<RoleType> = BaseUser<RoleType>> implements AuthStrategyInterface<RoleType, UserType, JwtAuthData<RoleType>, JwtCredentialsDto> {
456
+ readonly name: string;
457
+ readonly securityScheme: SecuritySchemeObject;
458
+ private readonly accessTokenSecret;
459
+ private readonly accessTokenExpiresInMs;
460
+ private readonly refreshTokenSecret;
461
+ private readonly refreshTokenExpiresInMs;
462
+ private readonly userService;
463
+ constructor();
464
+ init(): void;
465
+ private checkForEntities;
466
+ login(credentials: JwtCredentialsDto): Promise<JwtAuthData<RoleType>>;
467
+ resolveUser(request: HttpRequest): Promise<UserType | undefined>;
468
+ isLoggedIn(request: HttpRequest): Promise<boolean>;
469
+ hasRole(request: HttpRequest, allowedRoles: RoleType[]): Promise<boolean>;
470
+ private extractTokenFromRequest;
471
+ private generateAccessToken;
472
+ private generateRefreshToken;
473
+ }
474
+
475
+ /**
476
+ * An encoded token.
477
+ */
478
+ type EncodedAccessToken<Role extends string> = {
479
+ /**
480
+ * The header of the jwt, contains mostly metadata.
481
+ */
482
+ header: JwtHeader;
483
+ /**
484
+ * The payload of the jwt, everything that was put inside the token when generating it can be found here.
485
+ */
486
+ payload: AccessTokenPayload<Role, BaseUser<Role>>;
487
+ /**
488
+ * The signature of the jwt.
489
+ */
490
+ signature: string;
491
+ };
492
+
493
+ /**
494
+ * Encapsulates functionality of the jsonwebtoken package.
495
+ */
496
+ declare abstract class JwtUtilities {
497
+ /**
498
+ * Asynchronously sign the given payload into a JSON Web Token string payload.
499
+ * @param payload - Any info that should be put inside the token.
500
+ * @param secret - The secret used to encrypt the token.
501
+ * @param options - Additional options like "expiresIn".
502
+ * @returns A promise of the jwt.
503
+ */
504
+ static sign(payload: string | Buffer | object, secret: Secret, options?: SignOptions): Promise<string>;
505
+ /**
506
+ * Asynchronously verify given token using a secret or a public key to get a decoded token.
507
+ * @param token - The token to encode.
508
+ * @param secret - The secret to encode the token with.
509
+ * @returns The encoded token.
510
+ */
511
+ static verify<Role extends string>(token: string, secret: Secret): Promise<EncodedAccessToken<Role> | undefined>;
512
+ }
513
+
514
+ type RefreshTokenPayload<Role extends string, T extends BaseUser<Role>> = {
515
+ /**
516
+ * The id of the user that this refresh token belongs to.
517
+ */
518
+ userId: T['id'];
519
+ };
520
+
521
+ declare class RefreshToken implements BaseEntity {
522
+ id: string;
523
+ userId: string;
524
+ value: string;
525
+ blacklisted: boolean;
526
+ expirationDate: Date;
527
+ familyId: string;
528
+ }
529
+ declare const RefreshTokenCreateDto_base: Newable<Omit<RefreshToken, "id">>;
530
+ declare class RefreshTokenCreateDto extends RefreshTokenCreateDto_base {
531
+ }
532
+
533
+ interface UserServiceInterface {
534
+ findById: <Role extends string, T extends BaseUser<Role>>(id: T['id']) => Promise<T>;
535
+ findByEmail: <Role extends string, T extends BaseUser<Role>>(email: string) => Promise<T>;
536
+ resolveCredentialsFor: <Role extends string, T extends BaseUser<Role>, CredentialsType>(user: T) => Promise<CredentialsType>;
537
+ }
538
+
539
+ declare const NO_USER_REPOSITORIES_PROVIDED_ERROR_MESSAGE: string;
540
+ declare class UserService implements UserServiceInterface {
541
+ findById<Role extends string, T extends BaseUser<Role>>(id: T['id']): Promise<T>;
542
+ findByEmail<Role extends string, T extends BaseUser<Role>>(email: string): Promise<T>;
543
+ resolveCredentialsFor<Role extends string, T extends BaseUser<Role>, CredentialsType>(user: T): Promise<CredentialsType>;
544
+ }
545
+
546
+ declare abstract class HashUtilities {
547
+ static hash(value: string): Promise<string>;
548
+ static equal(value: string, hash: string): Promise<boolean>;
549
+ }
550
+
551
+ interface DataSourceServiceInterface {
552
+ init: () => Promise<void>;
553
+ }
554
+
555
+ declare class DataSourceService implements DataSourceServiceInterface {
556
+ private readonly logger;
557
+ private readonly allowedOrphans;
558
+ constructor();
559
+ init(): Promise<void>;
560
+ private checkForOrphanedEntities;
561
+ }
562
+
563
+ declare function DataSource(): ClassDecorator;
564
+
152
565
  type DataSourceOptions = DataSourceOptions$1;
153
566
 
154
567
  type ColumnType = ColumnType$1;
@@ -181,21 +594,73 @@ type DeleteByIdOptions = BaseRepositoryOptions;
181
594
 
182
595
  type DeleteAllOptions<T extends BaseEntity> = FindAllOptions<T>;
183
596
 
184
- declare class Repository<T extends BaseEntity> {
597
+ declare class Repository<T extends BaseEntity, CreateData extends DeepPartial<T> = DeepPartial<T>, UpdateData extends DeepPartial<T> = DeepPartial<T>> {
185
598
  private readonly entityClass;
186
- private readonly typeOrmRepository;
187
599
  private readonly logger;
188
- constructor(entityClass: Newable<T>, typeOrmRepository: Repository$1<T>);
600
+ private readonly typeOrmRepository;
601
+ constructor(entityClass: Newable<T>, repo: Repository$1<T> | Repository<T>);
189
602
  private getManager;
190
- create(data: DeepPartial<T>, options?: CreateOptions): Promise<T>;
191
- createAll(data: DeepPartial<T>[], options?: CreateAllOptions): Promise<T[]>;
603
+ create(data: CreateData, options?: CreateOptions): Promise<T>;
604
+ createAll(data: CreateData[], options?: CreateAllOptions): Promise<T[]>;
192
605
  findById(id: T['id'], options?: FindByIdOptions): Promise<T>;
193
606
  findOne(options: FindOneOptions<T>): Promise<T>;
194
607
  findAll(options?: FindAllOptions<T>): Promise<T[]>;
195
- updateById(id: T['id'], data: DeepPartial<T>, options?: UpdateByIdOptions): Promise<T>;
196
- updateAll(where: FindOptionsWhere<T> | FindOptionsWhere<T>[], data: DeepPartial<T>, options?: UpdateAllOptions): Promise<T[]>;
608
+ updateById(id: T['id'], data: UpdateData, options?: UpdateByIdOptions): Promise<T>;
609
+ updateAll(where: FindOptionsWhere<T> | FindOptionsWhere<T>[], data: UpdateData, options?: UpdateAllOptions): Promise<T[]>;
197
610
  deleteById(id: T['id'], options?: DeleteByIdOptions): Promise<void>;
198
- deleteAll(where: FindOptionsWhere<T> | FindOptionsWhere<T>[], options?: DeleteAllOptions<T>): Promise<T[]>;
611
+ deleteAll(where: FindOptionsWhere<T> | FindOptionsWhere<T>[], options?: OmitStrict<DeleteAllOptions<T>, 'where'>): Promise<T[]>;
612
+ }
613
+
614
+ declare class MigrationEntity implements BaseEntity {
615
+ id: string;
616
+ name: string;
617
+ version: Version;
618
+ ranAt: Date;
619
+ }
620
+
621
+ declare abstract class Migration {
622
+ abstract readonly version: Version;
623
+ protected readonly dataSource: BaseDataSource;
624
+ protected readonly migrationRepository: Repository<MigrationEntity>;
625
+ constructor(dataSourceClass: Newable<BaseDataSource>);
626
+ runUp(): Promise<void>;
627
+ runDown(): Promise<void>;
628
+ protected abstract up(transaction: Transaction): Promise<void>;
629
+ protected abstract down(transaction: Transaction): Promise<void>;
630
+ protected addColumn<T extends BaseEntity>(entity: Newable<T>, key: keyof T, transaction: Transaction): Promise<void>;
631
+ protected changeColumn<T extends BaseEntity>(entity: Newable<T>, oldColumn: keyof T | string & {}, newColumn: PropertyMetadataInput & {
632
+ name?: keyof T;
633
+ type: Exclude<PropertyMetadata, RelationMetadata<BaseEntity>>['type'];
634
+ }, transaction: Transaction): Promise<void>;
635
+ protected getColumnMetadata<T extends BaseEntity>(target: EntityTarget<T>, propertyName: keyof T | string & {}, transaction: Transaction): ColumnMetadata;
636
+ protected getEntityMetadata<T extends BaseEntity>(target: EntityTarget<T>, transaction: Transaction): EntityMetadata$1;
637
+ }
638
+
639
+ interface LoggerInterface {
640
+ debug: (...messages: (string | number)[]) => void;
641
+ info: (...messages: (string | number)[]) => void;
642
+ warn: (...messages: (string | number)[]) => void;
643
+ error: (...messages: (string | number | Error)[]) => void;
644
+ critical: (...messages: (string | number | Error)[]) => void;
645
+ }
646
+
647
+ declare const LOG_LEVEL_VALUES: {
648
+ readonly debug: 0;
649
+ readonly info: 1;
650
+ readonly warn: 2;
651
+ readonly error: 3;
652
+ readonly critical: 4;
653
+ };
654
+ type LogLevels = typeof LOG_LEVEL_VALUES;
655
+ type LogLevel = keyof LogLevels;
656
+ declare class Logger implements LoggerInterface {
657
+ debug(...messages: (string | number)[]): void;
658
+ info(...messages: (string | number)[]): void;
659
+ warn(...messages: (string | number)[]): void;
660
+ error(...messages: (string | number | Error)[]): void;
661
+ critical(...messages: (string | number | Error)[]): void;
662
+ private log;
663
+ private getTimestamp;
199
664
  }
200
665
 
201
666
  declare abstract class BaseDataSource {
@@ -203,13 +668,28 @@ declare abstract class BaseDataSource {
203
668
  private get columnTypeMapping();
204
669
  abstract readonly options: OmitStrict<DataSourceOptions, 'entities'>;
205
670
  abstract readonly entities: Newable<BaseEntity>[];
671
+ readonly migrations: Newable<Migration>[];
206
672
  protected ds?: DataSource$1;
673
+ protected readonly logger: LoggerInterface;
674
+ constructor();
207
675
  init(): Promise<void>;
208
676
  protected getEntitySchemas(): EntitySchema[];
677
+ protected createSchemaForEntity(cls: Newable<BaseEntity>): EntitySchema;
209
678
  protected propertyToRelationOptions<T extends BaseEntity>(metadata: RelationMetadata<T>): EntitySchemaRelationOptions;
210
679
  protected propertyToColumnOptions(metadata: Exclude<PropertyMetadata, RelationMetadata<BaseEntity>>): EntitySchemaColumnOptions;
211
680
  getRepository<T extends BaseEntity>(cls: Newable<T>): Repository<T>;
212
681
  startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
682
+ createQueryRunner(): QueryRunner;
683
+ runMigrations(): Promise<void>;
684
+ protected createMigrationTableIfNotExists(): Promise<void>;
685
+ propertyToTableColumnOptions<T extends BaseEntity>(entity: Newable<T>, property: keyof T): TableColumnOptions;
686
+ normalizeColumnType(column: {
687
+ type: ColumnType | string & {} | undefined;
688
+ length: number | string | undefined;
689
+ precision: number | null | undefined;
690
+ scale: number | undefined;
691
+ isArray: boolean | undefined;
692
+ }): string;
213
693
  }
214
694
 
215
695
  type DiToken<T> = Newable<T> | string;
@@ -234,138 +714,31 @@ declare const ZIBRI_DI_TOKENS: {
234
714
  readonly ASSET_SERVICE: "zi.asset_service";
235
715
  readonly GLOBAL_ERROR_HANDLER: "zi.global_error_handler";
236
716
  readonly OPEN_API_SERVICE: "zi.open_api_service";
717
+ readonly AUTH_SERVICE: "zi.auth_service";
237
718
  readonly PARSER: "zi.parser_service";
238
719
  readonly VALIDATION_SERVICE: "zi.validation_service";
239
720
  readonly DATA_SOURCE_SERVICE: "zi.data_source_service";
721
+ readonly JWT_ACCESS_TOKEN_SECRET: "zi.jwt_access_token_secret";
722
+ readonly JWT_ACCESS_TOKEN_EXPIRES_IN_MS: "zi.jwt_access_token_expires_in_ms";
723
+ readonly JWT_REFRESH_TOKEN_SECRET: "zi.jwt_refresh_token_secret";
724
+ readonly JWT_REFRESH_TOKEN_EXPIRES_IN_MS: "zi.jwt_refresh_token_expires_in_ms";
725
+ readonly USER_SERVICE: "zi.user_service";
240
726
  };
241
727
 
242
728
  declare function inject<T>(token: DiToken<T>): T;
243
729
 
244
- declare enum HttpMethod {
245
- GET = "get",
246
- POST = "post",
247
- PUT = "put",
248
- PATCH = "patch",
249
- DELETE = "delete"
250
- }
251
-
252
- declare enum HttpStatus {
253
- INTERNAL_SERVER_ERROR = 500,
254
- NOT_FOUND_ERROR = 404,
255
- BAD_REQUEST = 400
256
- }
257
-
258
- declare enum MimeType {
259
- JSON = "application/json",
260
- HTML = "text/html"
261
- }
262
- declare function isMimeType(value: string): value is MimeType;
263
-
264
- type KnownHeader = 'Accept' | 'Accept-Encoding' | 'Authorization' | 'Cache-Control' | 'Content-Length' | 'Content-Type' | 'Cookie' | 'Host' | 'Origin' | 'Referer' | 'User-Agent' | 'X-Requested-With' | 'X-Forwarded-For' | 'X-Forwarded-Host' | 'X-Forwarded-Proto' | 'X-Real-IP' | 'X-Correlation-ID' | 'If-None-Match' | 'If-Modified-Since' | 'Connection' | 'DNT' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'TE';
265
-
266
- type Header = KnownHeader | (string & {});
267
-
268
730
  interface BodyParserInterface {
269
731
  readonly contentType: MimeType;
270
- parse: (req: Request) => Promise<unknown>;
732
+ parse: (req: HttpRequest) => Promise<unknown>;
271
733
  }
272
734
 
273
735
  declare function BodyParser(): ClassDecorator;
274
736
 
275
- type Route = `/${string}`;
276
- type ControllerRouteConfiguration = {
277
- httpMethod: HttpMethod;
278
- route: Route;
279
- controllerMethod: string;
280
- };
281
-
282
- type RouteConfiguration = {
283
- httpMethod: HttpMethod;
284
- route: Route;
285
- handler: (req: Request, res: Response) => unknown | Promise<unknown>;
286
- };
287
-
288
- interface RouterInterface {
289
- registerController: <T extends Object>(controllerClass: Newable<T>, ...params: any[]) => void;
290
- register: (route: RouteConfiguration, ...params: any[]) => void;
291
- attachTo: (app: ZibriApplication, ...params: any[]) => void;
292
- }
293
-
294
- declare class Router implements RouterInterface {
295
- private readonly router;
296
- private readonly logger;
297
- private readonly parser;
298
- private readonly validationService;
299
- constructor();
300
- attachTo(app: ZibriApplication): void;
301
- register(route: RouteConfiguration): void;
302
- registerController<T extends Object>(controllerClass: Newable<T>): void;
303
- private routeToRequestHandler;
304
- private controllerRouteToRequestHandler;
305
- private resolveRouteParams;
306
- }
307
-
308
- declare function Controller(baseRoute: Route): ClassDecorator;
309
-
310
- declare function Get(path?: Route): MethodDecorator;
311
-
312
- declare function Post(path?: Route): MethodDecorator;
313
-
314
- declare function Delete(path?: Route): MethodDecorator;
315
-
316
- declare function Patch(path?: Route): MethodDecorator;
317
-
318
- type BaseParamMetadata = {
319
- name: string;
320
- };
321
-
322
- type StringParamMetadata = BaseParamMetadata & OmitStrict<StringPropertyMetadata, 'primary'>;
323
- type StringParamMetadataInput = Partial<OmitStrict<StringParamMetadata, 'name'>>;
324
-
325
- type NumberParamMetadata = BaseParamMetadata & OmitStrict<NumberPropertyMetadata, 'primary'>;
326
- type NumberParamMetadataInput = Partial<OmitStrict<NumberParamMetadata, 'name'>>;
327
-
328
- type BooleanParamMetadata = BaseParamMetadata & BooleanPropertyMetadata;
329
- type BooleanParamMetadataInput = Partial<OmitStrict<BooleanParamMetadata, 'name'>>;
330
-
331
- type DateParamMetadata = BaseParamMetadata & DatePropertyMetadata;
332
- type DateParamMetadataInput = Partial<OmitStrict<DateParamMetadata, 'name'>>;
333
-
334
- type ObjectParamMetadata = BaseParamMetadata & ObjectPropertyMetadata;
335
- type ObjectParamMetadataInput = Partial<OmitStrict<ObjectParamMetadata, 'name'>> & Pick<ObjectParamMetadata, 'cls'>;
336
-
337
- type ArrayParamMetadata = BaseParamMetadata & ArrayPropertyMetadata;
338
- type ArrayParamMetadataInput = Partial<OmitStrict<ArrayParamMetadata, 'type' | 'items'>> & {
339
- items: QueryParamMetadataInput & Pick<QueryParamMetadata, 'type'>;
340
- };
341
-
342
- type PathParamMetadata = StringParamMetadata | NumberParamMetadata | BooleanParamMetadata | DateParamMetadata;
343
- type PathParamMetadataInput = StringParamMetadataInput | NumberParamMetadataInput | BooleanParamMetadataInput | DateParamMetadataInput;
344
- type QueryParamMetadata = StringParamMetadata | NumberParamMetadata | BooleanParamMetadata | DateParamMetadata | ObjectParamMetadata | ArrayParamMetadata;
345
- type QueryParamMetadataInput = StringParamMetadataInput | NumberParamMetadataInput | BooleanParamMetadataInput | DateParamMetadataInput | ObjectParamMetadataInput | ArrayParamMetadataInput;
346
- type HeaderParamMetadata = (StringParamMetadata | NumberParamMetadata | BooleanParamMetadata | DateParamMetadata | ObjectParamMetadata | ArrayParamMetadata) & {
347
- name: Header;
348
- };
349
- type HeaderParamMetadataInput = StringParamMetadataInput | NumberParamMetadataInput | BooleanParamMetadataInput | DateParamMetadataInput | ObjectParamMetadataInput | ArrayParamMetadataInput;
350
- declare namespace Param {
351
- function path(name: string, options?: PathParamMetadataInput): ParameterDecorator;
352
- function query(name: string, options?: QueryParamMetadataInput): ParameterDecorator;
353
- function header(name: Header, options?: HeaderParamMetadataInput): ParameterDecorator;
354
- }
355
-
356
- type BodyMetadata = BasePropertyMetadata & {
357
- modelClass: Newable<unknown>;
358
- index: number;
359
- name: string;
360
- };
361
- type BodyMetadataInput = Partial<OmitStrict<BodyMetadata, 'modelClass' | 'index' | 'name'>>;
362
- declare function Body(modelClass: Newable<unknown>, options?: BodyMetadataInput): ParameterDecorator;
363
-
364
737
  interface ParserInterface {
365
- parseRequestBody: (req: Request) => Promise<unknown>;
366
- parsePathParam: (req: Request, metadata: PathParamMetadata) => unknown;
367
- parseQueryParam: (req: Request, metadata: QueryParamMetadata) => unknown;
368
- parseHeaderParam: (req: Request, metadata: HeaderParamMetadata) => unknown;
738
+ parseRequestBody: (req: HttpRequest) => Promise<unknown>;
739
+ parsePathParam: (req: HttpRequest, metadata: PathParamMetadata) => unknown;
740
+ parseQueryParam: (req: HttpRequest, metadata: QueryParamMetadata) => unknown;
741
+ parseHeaderParam: (req: HttpRequest, metadata: HeaderParamMetadata) => unknown;
369
742
  attachTo: (app: ZibriApplication) => void;
370
743
  }
371
744
 
@@ -376,31 +749,33 @@ declare class Parser implements ParserInterface {
376
749
  private readonly queryParamParseFunctions;
377
750
  private readonly headerParamParseFunctions;
378
751
  constructor();
379
- parseHeaderParam(req: Request, metadata: HeaderParamMetadata): unknown;
380
- parseQueryParam(req: Request, metadata: QueryParamMetadata): unknown;
381
- parsePathParam(req: Request, metadata: PathParamMetadata): unknown;
382
- parseRequestBody(req: Request): Promise<unknown>;
752
+ parseHeaderParam(req: HttpRequest, metadata: HeaderParamMetadata): unknown;
753
+ parseQueryParam(req: HttpRequest, metadata: QueryParamMetadata): unknown;
754
+ parsePathParam(req: HttpRequest, metadata: PathParamMetadata): unknown;
755
+ parseRequestBody(req: HttpRequest): Promise<unknown>;
383
756
  attachTo(): void;
384
757
  }
385
758
 
386
759
  declare class JsonBodyParser implements BodyParserInterface {
387
760
  readonly contentType: MimeType;
388
- parse(req: Request): Promise<unknown>;
761
+ parse(req: HttpRequest): Promise<unknown>;
389
762
  }
390
763
 
391
764
  type ZibriApplicationOptions = {
392
765
  name: string;
766
+ version: Version;
393
767
  controllers: Newable<unknown>[];
394
768
  dataSources?: Newable<BaseDataSource>[];
395
769
  providers?: DiProvider<unknown>[];
396
770
  bodyParsers?: Newable<BodyParserInterface>[];
771
+ authStrategies?: AuthStrategies;
397
772
  };
398
773
 
399
774
  /**
400
775
  * A zibri application.
401
776
  */
402
777
  declare class ZibriApplication {
403
- private readonly options;
778
+ private readonly providedOptions;
404
779
  readonly express: Express;
405
780
  private _router;
406
781
  get router(): RouterInterface;
@@ -409,7 +784,9 @@ declare class ZibriApplication {
409
784
  private openApiService;
410
785
  private parser;
411
786
  private dataSourceService;
412
- constructor(options: ZibriApplicationOptions);
787
+ private authService;
788
+ private readonly options;
789
+ constructor(providedOptions: ZibriApplicationOptions);
413
790
  init(): Promise<void>;
414
791
  /**
415
792
  * Starts on the given port.
@@ -419,7 +796,7 @@ declare class ZibriApplication {
419
796
  start(port: number): void;
420
797
  }
421
798
 
422
- type GlobalErrorHandler = (err: unknown, req: Request, res: Response, next: NextFunction) => void;
799
+ type GlobalErrorHandler = (err: unknown, req: HttpRequest, res: HttpResponse, next: NextFunction) => void;
423
800
 
424
801
  declare const errorHandler: GlobalErrorHandler;
425
802
 
@@ -497,6 +874,10 @@ declare class ValidationError extends BadRequestError {
497
874
  constructor(type: ValidationErrorType, problems: ValidationProblem[], options?: ErrorOptions);
498
875
  }
499
876
 
877
+ declare class UnauthorizedError extends HttpError {
878
+ constructor(message: string | string[], options?: ErrorOptions);
879
+ }
880
+
500
881
  interface AssetServiceInterface {
501
882
  readonly assetsPath: string;
502
883
  readonly assetsRoute: Route;
@@ -523,6 +904,7 @@ declare enum AppState {
523
904
  type AppData = {
524
905
  state: AppState;
525
906
  name?: string;
907
+ version?: Version;
526
908
  };
527
909
  declare abstract class GlobalRegistry {
528
910
  private static readonly appData;
@@ -531,6 +913,7 @@ declare abstract class GlobalRegistry {
531
913
  static readonly dataSourceClasses: Newable<BaseDataSource>[];
532
914
  static readonly entityClasses: Newable<BaseEntity>[];
533
915
  static readonly bodyParsers: Newable<BodyParserInterface>[];
916
+ static readonly userRepositories: UserRepositories;
534
917
  private static readonly validateAppStateChange;
535
918
  static getAppData<K extends keyof AppData>(key: K): AppData[K];
536
919
  static setAppData(options: ZibriApplicationOptions): void;
@@ -543,58 +926,8 @@ declare abstract class GlobalRegistry {
543
926
  private static changeAppState;
544
927
  }
545
928
 
546
- interface LoggerInterface {
547
- debug: (...messages: (string | number)[]) => void;
548
- info: (...messages: (string | number)[]) => void;
549
- warn: (...messages: (string | number)[]) => void;
550
- error: (...messages: (string | number | Error)[]) => void;
551
- critical: (...messages: (string | number | Error)[]) => void;
552
- }
553
-
554
- declare const LOG_LEVEL_VALUES: {
555
- readonly debug: 0;
556
- readonly info: 1;
557
- readonly warn: 2;
558
- readonly error: 3;
559
- readonly critical: 4;
560
- };
561
- type LogLevels = typeof LOG_LEVEL_VALUES;
562
- type LogLevel = keyof LogLevels;
563
- declare class Logger implements LoggerInterface {
564
- debug(...messages: (string | number)[]): void;
565
- info(...messages: (string | number)[]): void;
566
- warn(...messages: (string | number)[]): void;
567
- error(...messages: (string | number | Error)[]): void;
568
- critical(...messages: (string | number | Error)[]): void;
569
- private log;
570
- private getTimestamp;
571
- }
572
-
573
- type OpenApiDefinition = oas31.OpenAPIObject;
574
- type OpenApiPaths = oas31.PathsObject;
575
- type OpenApiOperation = oas31.OperationObject;
576
- type OpenApiParameter = (oas31.ParameterObject | oas31.ReferenceObject);
577
- type OpenApiRequestBodyObject = oas31.RequestBodyObject;
578
- type OpenApiSchemaObject = oas31.SchemaObject;
579
-
580
- interface OpenApiServiceInterface {
581
- readonly openApiRoute: Route;
582
- attachTo: (app: ZibriApplication) => void;
583
- createOpenApiDefinition: (app: ZibriApplication) => OpenApiDefinition;
584
- }
929
+ declare function compareVersion(v1: Version, v2: Version): 'bigger' | 'equal' | 'smaller';
585
930
 
586
- declare class OpenApiService implements OpenApiServiceInterface {
587
- readonly openApiRoute: Route;
588
- private readonly logger;
589
- private readonly assetService;
590
- constructor();
591
- attachTo(app: ZibriApplication): void;
592
- createOpenApiDefinition(): OpenApiDefinition;
593
- private resolveOpenApiPaths;
594
- private buildOpenApiBody;
595
- private buildOpenApiSchemaForProperties;
596
- private buildParameters;
597
- private paramToSchema;
598
- }
931
+ declare function isVersion(value: string): value is Version;
599
932
 
600
- export { type AppData, AppState, type ArrayParamMetadata, type ArrayParamMetadataInput, type ArrayPropertyItemMetadata, type ArrayPropertyMetadata, type ArrayPropertyMetadataInput, AssetService, type AssetServiceInterface, BadRequestError, BaseDataSource, type BaseEntity, Body, type BodyMetadata, type BodyMetadataInput, BodyParser, type BodyParserInterface, type BooleanParamMetadata, type BooleanParamMetadataInput, type BooleanPropertyMetadata, type BooleanPropertyMetadataInput, type ColumnType, Controller, type ControllerRouteConfiguration, type CreateAllOptions, type CreateOptions, DataSource, type DataSourceOptions, DataSourceService, type DataSourceServiceInterface, type DateParamMetadata, type DateParamMetadataInput, type DatePropertyMetadata, type DatePropertyMetadataInput, Delete, type DeleteAllOptions, type DeleteByIdOptions, type DiProvider, type DiToken, Entity, type EntityMetadata, type FindAllOptions, type FindByIdOptions, type FindOneOptions, Get, type GlobalErrorHandler, GlobalRegistry, type Header, type HeaderParamMetadata, type HeaderParamMetadataInput, HttpError, HttpMethod, HttpStatus, Inject, InjectRepository, Injectable, InternalServerError, IntersectionType, IsRequiredValidationProblem, JsonBodyParser, type KnownHeader, type LogLevel, type LogLevels, Logger, type LoggerInterface, type ManyToManyPropertyMetadata, type ManyToManyPropertyMetadataInput, type ManyToOnePropertyMetadata, type ManyToOnePropertyMetadataInput, MimeType, type Newable, NotFoundError, type NumberParamMetadata, type NumberParamMetadataInput, type NumberPropertyMetadata, type NumberPropertyMetadataInput, type ObjectParamMetadata, type ObjectParamMetadataInput, type ObjectPropertyMetadata, type ObjectPropertyMetadataInput, OmitType, type OneToManyPropertyMetadata, type OneToManyPropertyMetadataInput, type OneToOnePropertyMetadata, type OneToOnePropertyMetadataInput, type OpenApiDefinition, type OpenApiOperation, type OpenApiParameter, type OpenApiPaths, type OpenApiRequestBodyObject, type OpenApiSchemaObject, OpenApiService, type OpenApiServiceInterface, Param, Parser, type ParserInterface, PartialType, Patch, type PathParamMetadata, type PathParamMetadataInput, PickType, Post, Property, type PropertyMetadata, type PropertyMetadataInput, type QueryParamMetadata, type QueryParamMetadataInput, Relation, type RelationMetadata, type RelationMetadataInput, RelationsNotAllowedValidationProblem, Repository, type Route, type RouteConfiguration, Router, type RouterInterface, type StringFormat, type StringParamMetadata, type StringParamMetadataInput, type StringPropertyMetadata, type StringPropertyMetadataInput, type Transaction, TypeMismatchValidationProblem, UnmatchedRouteError, type UpdateAllOptions, type UpdateByIdOptions, ValidationError, type ValidationProblem, ValidationService, type ValidationServiceInterface, ZIBRI_DI_TOKENS, ZibriApplication, type ZibriApplicationOptions, errorHandler, inject, isHttpError, isMimeType, repositoryTokenFor };
933
+ export { type AccessTokenPayload, type AppData, AppState, type ArrayParamMetadata, type ArrayParamMetadataInput, type ArrayPropertyItemMetadata, type ArrayPropertyMetadata, type ArrayPropertyMetadataInput, AssetService, type AssetServiceInterface, Auth, AuthService, type AuthServiceInterface, type AuthStrategies, type AuthStrategyInterface, BadRequestError, BaseDataSource, type BaseEntity, type BaseUser, Body, type BodyMetadata, type BodyMetadataInput, BodyParser, type BodyParserInterface, type BooleanParamMetadata, type BooleanParamMetadataInput, type BooleanPropertyMetadata, type BooleanPropertyMetadataInput, type ColumnType, Controller, type ControllerRouteConfiguration, type CreateAllOptions, type CreateOptions, CurrentUser, type CurrentUserMetadata, DataSource, type DataSourceOptions, DataSourceService, type DataSourceServiceInterface, type DateParamMetadata, type DateParamMetadataInput, type DatePropertyMetadata, type DatePropertyMetadataInput, Delete, type DeleteAllOptions, type DeleteByIdOptions, type DiProvider, type DiToken, type EncodedAccessToken, Entity, type EntityMetadata, type FindAllOptions, type FindByIdOptions, type FindOneOptions, Get, type GlobalErrorHandler, GlobalRegistry, type HasRoleMetadata, HashUtilities, type Header, type HeaderParamMetadata, type HeaderParamMetadataInput, HttpError, HttpMethod, type HttpRequest, type HttpResponse, HttpStatus, Inject, InjectRepository, Injectable, InternalServerError, IntersectionType, type IsLoggedInMetadata, type IsNotLoggedInMetadata, IsRequiredValidationProblem, JsonBodyParser, Jwt, JwtAuthData, JwtAuthStrategy, JwtCredentials, JwtCredentialsDto, JwtUtilities, type KnownHeader, type LogLevel, type LogLevels, Logger, type LoggerInterface, type ManyToManyPropertyMetadata, type ManyToManyPropertyMetadataInput, type ManyToOnePropertyMetadata, type ManyToOnePropertyMetadataInput, Migration, MigrationEntity, MimeType, NO_USER_REPOSITORIES_PROVIDED_ERROR_MESSAGE, type Newable, NotFoundError, type NumberParamMetadata, type NumberParamMetadataInput, type NumberPropertyMetadata, type NumberPropertyMetadataInput, type ObjectParamMetadata, type ObjectParamMetadataInput, type ObjectPropertyMetadata, type ObjectPropertyMetadataInput, OmitType, type OneToManyPropertyMetadata, type OneToManyPropertyMetadataInput, type OneToOnePropertyMetadata, type OneToOnePropertyMetadataInput, type OpenApiDefinition, type OpenApiOperation, type OpenApiParameter, type OpenApiPaths, type OpenApiRequestBodyObject, type OpenApiSchemaObject, type OpenApiSecurityRequirementObject, type OpenApiSecuritySchemeObject, OpenApiService, type OpenApiServiceInterface, Param, Parser, type ParserInterface, PartialType, Patch, type PathParamMetadata, type PathParamMetadataInput, PickType, Post, Property, type PropertyMetadata, type PropertyMetadataInput, type QueryParamMetadata, type QueryParamMetadataInput, RefreshToken, RefreshTokenCreateDto, type RefreshTokenPayload, Relation, type RelationMetadata, type RelationMetadataInput, RelationsNotAllowedValidationProblem, Repository, type Route, type RouteConfiguration, Router, type RouterInterface, type SkipHasRoleMetadata, type SkipIsLoggedInMetadata, type SkipIsNotLoggedInMetadata, type StringFormat, type StringParamMetadata, type StringParamMetadataInput, type StringPropertyMetadata, type StringPropertyMetadataInput, type Transaction, TypeMismatchValidationProblem, UnauthorizedError, UnmatchedRouteError, type UpdateAllOptions, type UpdateByIdOptions, UserRepo, type UserRepositories, type UserRepositoryInterface, UserService, type UserServiceInterface, ValidationError, type ValidationProblem, ValidationService, type ValidationServiceInterface, type Version, ZIBRI_DI_TOKENS, ZibriApplication, type ZibriApplicationOptions, compareVersion, errorHandler, inject, isHttpError, isMimeType, isVersion, repositoryTokenFor };