zibri 1.3.0 → 1.4.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,10 +1,17 @@
1
- import { Request, Response, Express, NextFunction } from 'express';
1
+ import { Request, Response as Response$1, Express as Express$1, NextFunction } from 'express';
2
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';
3
+ import { ScheduledTask } from 'node-cron';
4
+ import { EntitySchemaRelationOptions, DataSourceOptions as DataSourceOptions$1, ColumnType as ColumnType$1, QueryRunner, FindManyOptions, FindOneOptions as FindOneOptions$1, Repository as Repository$1, EntityTarget, EntityMetadata as EntityMetadata$1, DataSource as DataSource$1, EntitySchema, EntitySchemaColumnOptions, TableColumnOptions } from 'typeorm';
4
5
  import { IsolationLevel } from 'typeorm/driver/types/IsolationLevel';
5
6
  import { ColumnMetadata } from 'typeorm/metadata/ColumnMetadata';
6
7
  import { SecuritySchemeObject } from 'openapi3-ts/dist/oas31';
7
8
  import { JwtHeader, Secret, SignOptions } from 'jsonwebtoken';
9
+ import { Readable } from 'stream';
10
+
11
+ type BasePropertyMetadata = {
12
+ required: boolean;
13
+ description: string | undefined;
14
+ };
8
15
 
9
16
  type Newable<T> = new (...args: any[]) => T;
10
17
 
@@ -12,91 +19,11 @@ type DeepPartial<T> = T | (T extends (infer U)[] ? DeepPartial<U>[] : T extends
12
19
  [K in keyof T]?: DeepPartial<T[K]>;
13
20
  } : T);
14
21
 
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"
25
- }
26
-
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;
69
- private readonly logger;
70
- private readonly parser;
71
- private readonly validationService;
72
- private readonly authService;
73
- constructor();
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;
80
- }
81
-
82
- declare function Controller(baseRoute: Route): ClassDecorator;
22
+ type ExcludeStrict<UnionType, ExcludedMembers extends UnionType> = Exclude<UnionType, ExcludedMembers>;
83
23
 
84
- declare function Get(path?: Route): MethodDecorator;
24
+ type OmitStrict<T extends object, K extends keyof T> = Pick<T, ExcludeStrict<keyof T, K>>;
85
25
 
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
- };
95
-
96
- type BasePropertyMetadata = {
97
- required: boolean;
98
- description: string | undefined;
99
- };
26
+ type Version = `${number}.${number}.${number}`;
100
27
 
101
28
  type StringFormat = 'uuid' | 'email';
102
29
  type StringPropertyMetadata = BasePropertyMetadata & {
@@ -104,6 +31,8 @@ type StringPropertyMetadata = BasePropertyMetadata & {
104
31
  primary: boolean;
105
32
  format: StringFormat | undefined;
106
33
  unique: boolean;
34
+ minLength: number | undefined;
35
+ maxLength: number | undefined;
107
36
  };
108
37
  type StringPropertyMetadataInput = Partial<OmitStrict<StringPropertyMetadata, 'type'>>;
109
38
 
@@ -116,7 +45,7 @@ type NumberPropertyMetadataInput = Partial<OmitStrict<NumberPropertyMetadata, 't
116
45
 
117
46
  type ObjectPropertyMetadata = BasePropertyMetadata & {
118
47
  type: 'object';
119
- cls: Newable<unknown>;
48
+ cls: () => Newable<unknown>;
120
49
  };
121
50
  type ObjectPropertyMetadataInput = Partial<OmitStrict<ObjectPropertyMetadata, 'type'>> & Pick<ObjectPropertyMetadata, 'cls'>;
122
51
 
@@ -124,27 +53,103 @@ type BaseEntity = {
124
53
  id: string;
125
54
  };
126
55
 
127
- type ArrayPropertyMetadata = BasePropertyMetadata & {
128
- type: 'array';
129
- items: Exclude<PropertyMetadata, RelationMetadata<BaseEntity>>;
130
- };
131
- type ArrayItemPropertyType = Exclude<PropertyMetadata['type'], RelationMetadata<BaseEntity>['type']>;
132
- type ArrayPropertyItemMetadata = PropertyMetadataInput & {
133
- type: ArrayItemPropertyType;
134
- };
135
- type ArrayPropertyMetadataInput = Partial<OmitStrict<ArrayPropertyMetadata, 'type' | 'items'>> & {
136
- items: ArrayPropertyItemMetadata;
56
+ type BooleanPropertyMetadata = BasePropertyMetadata & {
57
+ type: 'boolean';
137
58
  };
59
+ type BooleanPropertyMetadataInput = Partial<OmitStrict<BooleanPropertyMetadata, 'type'>>;
138
60
 
139
61
  type DatePropertyMetadata = BasePropertyMetadata & {
140
62
  type: 'date';
141
63
  };
142
64
  type DatePropertyMetadataInput = Partial<OmitStrict<DatePropertyMetadata, 'type'>>;
143
65
 
144
- type BooleanPropertyMetadata = BasePropertyMetadata & {
66
+ declare enum HttpMethod {
67
+ GET = "get",
68
+ POST = "post",
69
+ PUT = "put",
70
+ PATCH = "patch",
71
+ DELETE = "delete"
72
+ }
73
+
74
+ declare enum HttpStatus {
75
+ OK = 200,
76
+ CREATED = 201,
77
+ BAD_REQUEST = 400,
78
+ UNAUTHORIZED = 401,
79
+ FORBIDDEN = 403,
80
+ NOT_FOUND_ERROR = 404,
81
+ INTERNAL_SERVER_ERROR = 500
82
+ }
83
+
84
+ declare enum MimeType {
85
+ JSON = "application/json",
86
+ HTML = "text/html",
87
+ FORM_DATA = "multipart/form-data",
88
+ OCTET_STREAM = "application/octet-stream",
89
+ PNG = "image/png",
90
+ JPEG = "image/jpeg",
91
+ ZIP = "application/zip",
92
+ SVG = "image/svg+xml",
93
+ CSS = "text/css",
94
+ TTF = "font/ttf",
95
+ PDF = "application/pdf",
96
+ CSV = "text/csv",
97
+ EML = "message/rfc822",
98
+ XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
99
+ DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
100
+ TXT = "text/plain"
101
+ }
102
+ type LooseMimeType = MimeType | string & {};
103
+ declare function isMimeType(value: string): value is MimeType;
104
+
105
+ 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';
106
+
107
+ type Header = KnownHeader | (string & {});
108
+
109
+ type HttpRequest = Request;
110
+
111
+ type HttpResponse = Response$1;
112
+
113
+ type FileSize = `${number}b` | `${number}kb` | `${number}mb` | `${number}gb`;
114
+ declare function fileSizeToBytes(size: FileSize): number;
115
+ type FilePropertyMetadata = BasePropertyMetadata & {
116
+ type: 'file';
117
+ allowedMimeTypes: MimeType[] | 'all';
118
+ maxSize: FileSize;
119
+ };
120
+ type FilePropertyMetadataInput = Partial<OmitStrict<FilePropertyMetadata, 'type'>>;
121
+
122
+ type ArrayPropertyMetadata = BasePropertyMetadata & {
123
+ type: 'array';
124
+ items: ArrayPropertyItemMetadata;
125
+ };
126
+ type ArrayPropertyItemMetadata = ExcludeStrict<PropertyMetadata, RelationMetadata<BaseEntity>>;
127
+ type ArrayPropertyItemMetadataInput = StringPropertyMetadataInput & {
128
+ type: 'string';
129
+ } | NumberPropertyMetadataInput & {
130
+ type: 'number';
131
+ } | ObjectPropertyMetadataInput & {
132
+ type: 'object';
133
+ } | ArrayPropertyMetadataInput & {
134
+ type: 'array';
135
+ } | DatePropertyMetadataInput & {
136
+ type: 'date';
137
+ } | BooleanPropertyMetadataInput & {
145
138
  type: 'boolean';
139
+ } | FilePropertyMetadataInput & {
140
+ type: 'file';
146
141
  };
147
- type BooleanPropertyMetadataInput = Partial<OmitStrict<BooleanPropertyMetadata, 'type'>>;
142
+ type DefaultArrayPropertyMetadataInput = Partial<BasePropertyMetadata> & {
143
+ items: ExcludeStrict<ArrayPropertyItemMetadataInput, FileArrayPropertyMetadataInput['items']>;
144
+ totalFileSize?: never;
145
+ };
146
+ type FileArrayPropertyMetadataInput = Partial<BasePropertyMetadata> & {
147
+ items: FilePropertyMetadataInput & {
148
+ type: 'file';
149
+ };
150
+ totalFileSize?: FileSize;
151
+ };
152
+ type ArrayPropertyMetadataInput = DefaultArrayPropertyMetadataInput | FileArrayPropertyMetadataInput;
148
153
 
149
154
  type BaseRelationMetadata<T extends BaseEntity> = BasePropertyMetadata & Required<Pick<EntitySchemaRelationOptions, 'cascade' | 'persistence'>> & {
150
155
  /**
@@ -186,9 +191,9 @@ declare enum Relation {
186
191
  MANY_TO_MANY = "many-to-many"
187
192
  }
188
193
 
189
- type PropertyMetadata = StringPropertyMetadata | NumberPropertyMetadata | ObjectPropertyMetadata | ArrayPropertyMetadata | DatePropertyMetadata | BooleanPropertyMetadata | RelationMetadata<BaseEntity>;
194
+ type PropertyMetadata = StringPropertyMetadata | NumberPropertyMetadata | ObjectPropertyMetadata | ArrayPropertyMetadata | DatePropertyMetadata | BooleanPropertyMetadata | FilePropertyMetadata | RelationMetadata<BaseEntity>;
190
195
  type RelationMetadata<T extends BaseEntity> = ManyToOnePropertyMetadata<T> | OneToManyPropertyMetadata<T> | OneToOnePropertyMetadata<T> | ManyToManyPropertyMetadata<T>;
191
- type PropertyMetadataInput = StringPropertyMetadataInput | NumberPropertyMetadataInput | ObjectPropertyMetadataInput | ArrayPropertyMetadataInput | DatePropertyMetadataInput | BooleanPropertyMetadataInput;
196
+ type PropertyMetadataInput = StringPropertyMetadataInput | NumberPropertyMetadataInput | ObjectPropertyMetadataInput | ArrayPropertyMetadataInput | DatePropertyMetadataInput | FilePropertyMetadataInput | BooleanPropertyMetadataInput;
192
197
  type RelationMetadataInput<T extends BaseEntity> = ManyToOnePropertyMetadataInput<T> | OneToManyPropertyMetadataInput<T> | OneToOnePropertyMetadataInput<T> | ManyToManyPropertyMetadataInput<T>;
193
198
  declare namespace Property {
194
199
  function string(data?: StringPropertyMetadataInput): PropertyDecorator;
@@ -196,6 +201,7 @@ declare namespace Property {
196
201
  function boolean(data?: BooleanPropertyMetadataInput): PropertyDecorator;
197
202
  function date(data?: DatePropertyMetadataInput): PropertyDecorator;
198
203
  function object(data: ObjectPropertyMetadataInput): PropertyDecorator;
204
+ function file(data?: FilePropertyMetadataInput): PropertyDecorator;
199
205
  function array(data: ArrayPropertyMetadataInput): PropertyDecorator;
200
206
  function manyToOne<T extends BaseEntity>(metadata: ManyToOnePropertyMetadataInput<T>): PropertyDecorator;
201
207
  function oneToMany<T extends BaseEntity>(metadata: OneToManyPropertyMetadataInput<T>): PropertyDecorator;
@@ -218,6 +224,55 @@ declare function PickType<T, K extends keyof T>(Base: Newable<T>, keys: readonly
218
224
 
219
225
  declare function OmitType<T, K extends keyof T>(Base: Newable<T>, keys: readonly K[]): Newable<Omit<T, K>>;
220
226
 
227
+ type Route = `/${string}`;
228
+ type ControllerRouteConfiguration = {
229
+ httpMethod: HttpMethod;
230
+ route: Route;
231
+ controllerMethod: string;
232
+ };
233
+
234
+ type RouteConfiguration = {
235
+ httpMethod: HttpMethod;
236
+ route: Route;
237
+ handler: (req: HttpRequest, res: HttpResponse) => unknown | Promise<unknown>;
238
+ };
239
+
240
+ interface RouterInterface {
241
+ registerController: <T extends Object>(controllerClass: Newable<T>, ...params: any[]) => void;
242
+ register: (route: RouteConfiguration, ...params: any[]) => void;
243
+ attachTo: (app: ZibriApplication, ...params: any[]) => void;
244
+ }
245
+
246
+ declare class Router implements RouterInterface {
247
+ private readonly router;
248
+ private readonly logger;
249
+ private readonly parser;
250
+ private readonly validationService;
251
+ private readonly authService;
252
+ constructor();
253
+ attachTo(app: ZibriApplication): void;
254
+ register(route: RouteConfiguration): void;
255
+ registerController<T extends Object>(controllerClass: Newable<T>): void;
256
+ private routeToRequestHandler;
257
+ private controllerRouteToRequestHandler;
258
+ private returnResult;
259
+ private resolveRouteParams;
260
+ }
261
+
262
+ declare function Controller(baseRoute: Route): ClassDecorator;
263
+
264
+ declare function Get(path?: Route): MethodDecorator;
265
+
266
+ declare function Post(path?: Route): MethodDecorator;
267
+
268
+ declare function Delete(path?: Route): MethodDecorator;
269
+
270
+ declare function Patch(path?: Route): MethodDecorator;
271
+
272
+ type BaseParamMetadata = {
273
+ name: string;
274
+ };
275
+
221
276
  type StringParamMetadata = BaseParamMetadata & OmitStrict<StringPropertyMetadata, 'primary'>;
222
277
  type StringParamMetadataInput = Partial<OmitStrict<StringParamMetadata, 'name'>>;
223
278
 
@@ -252,12 +307,18 @@ declare namespace Param {
252
307
  function header(name: Header, options?: HeaderParamMetadataInput): ParameterDecorator;
253
308
  }
254
309
 
255
- type BodyMetadata = BasePropertyMetadata & {
310
+ type BaseBodyMetadata = BasePropertyMetadata & {
256
311
  modelClass: Newable<unknown>;
257
312
  index: number;
258
- name: string;
259
313
  };
260
- type BodyMetadataInput = Partial<OmitStrict<BodyMetadata, 'modelClass' | 'index' | 'name'>>;
314
+ type JsonBodyMetadata = BaseBodyMetadata & {
315
+ type: MimeType.JSON;
316
+ };
317
+ type FormDataBodyMetadata = BaseBodyMetadata & {
318
+ type: MimeType.FORM_DATA;
319
+ };
320
+ type BodyMetadata = JsonBodyMetadata | FormDataBodyMetadata;
321
+ type BodyMetadataInput = Partial<OmitStrict<BodyMetadata, 'modelClass' | 'index'>>;
261
322
  declare function Body(modelClass: Newable<unknown>, options?: BodyMetadataInput): ParameterDecorator;
262
323
 
263
324
  type OpenApiDefinition = oas31.OpenAPIObject;
@@ -268,6 +329,20 @@ type OpenApiRequestBodyObject = oas31.RequestBodyObject;
268
329
  type OpenApiSchemaObject = oas31.SchemaObject;
269
330
  type OpenApiSecuritySchemeObject = oas31.SecuritySchemeObject;
270
331
  type OpenApiSecurityRequirementObject = oas31.SecurityRequirementObject;
332
+ type FileOpenApiResponse = {
333
+ type: 'file';
334
+ status?: HttpStatus;
335
+ description?: string;
336
+ mimeType?: 'all' | MimeType | MimeType[];
337
+ };
338
+ type DefaultOpenApiResponse = {
339
+ type: 'default';
340
+ status?: HttpStatus;
341
+ description?: string;
342
+ cls?: Newable<unknown>;
343
+ isArray?: boolean;
344
+ };
345
+ type OpenApiResponse = DefaultOpenApiResponse | FileOpenApiResponse;
271
346
 
272
347
  interface OpenApiServiceInterface {
273
348
  readonly openApiRoute: Route;
@@ -285,13 +360,31 @@ declare class OpenApiService implements OpenApiServiceInterface {
285
360
  createOpenApiDefinition(): OpenApiDefinition;
286
361
  private resolveSecuritySchemes;
287
362
  private resolveOpenApiPaths;
363
+ private buildResponses;
364
+ private buildResponseContent;
365
+ private buildResponsesContent;
288
366
  private resolveOperationSecurity;
289
367
  private buildOpenApiBody;
290
368
  private buildOpenApiSchemaForProperties;
369
+ private getTargetClassForRelation;
291
370
  private buildParameters;
292
371
  private paramToSchema;
293
372
  }
294
373
 
374
+ declare namespace Response {
375
+ function object(entityClass: Newable<unknown>, data?: OmitStrict<DefaultOpenApiResponse, 'isArray' | 'type' | 'cls'>): MethodDecorator;
376
+ function array(entityClass: Newable<unknown>, data?: OmitStrict<DefaultOpenApiResponse, 'isArray' | 'type' | 'cls'>): MethodDecorator;
377
+ function paginated(entityClass: Newable<unknown>, data?: OmitStrict<DefaultOpenApiResponse, 'isArray' | 'type' | 'cls'>): MethodDecorator;
378
+ function empty(status?: HttpStatus, data?: OmitStrict<DefaultOpenApiResponse, 'isArray' | 'type' | 'status' | 'cls'>): MethodDecorator;
379
+ function file(data?: OmitStrict<FileOpenApiResponse, 'type'>): MethodDecorator;
380
+ function error(status: ExcludeStrict<HttpStatus, HttpStatus.OK | HttpStatus.CREATED>, data?: OmitStrict<DefaultOpenApiResponse, 'isArray' | 'type' | 'status' | 'cls'>): MethodDecorator;
381
+ }
382
+
383
+ type PaginationResult<T> = {
384
+ items: T[];
385
+ totalAmount: number;
386
+ };
387
+
295
388
  type BaseUser<Role extends string> = BaseEntity & {
296
389
  email: string;
297
390
  roles: Role[];
@@ -303,6 +396,7 @@ interface AuthStrategyInterface<RoleType extends string, UserType extends BaseUs
303
396
  login: (credentials: CredentialType) => Promise<AuthDataType>;
304
397
  isLoggedIn: (request: HttpRequest) => Promise<boolean>;
305
398
  hasRole: (request: HttpRequest, allowedRoles: RoleType[]) => Promise<boolean>;
399
+ belongsTo: <TargetEntity extends Newable<BaseEntity>>(request: HttpRequest, targetEntity: TargetEntity, targetUserIdKey: keyof InstanceType<TargetEntity>, targetIdParamKey: string) => Promise<boolean>;
306
400
  securityScheme: OpenApiSecuritySchemeObject;
307
401
  name: string;
308
402
  }
@@ -333,6 +427,21 @@ type IsNotLoggedInMetadata = {
333
427
  };
334
428
  type SkipIsNotLoggedInMetadata = {};
335
429
 
430
+ type BelongsToMetadata<TargetEntity extends Newable<BaseEntity>> = {
431
+ targetEntity: TargetEntity;
432
+ targetUserIdKey: keyof InstanceType<TargetEntity>;
433
+ targetIdParamKey: string;
434
+ allowedStrategies?: AuthStrategies;
435
+ };
436
+ type SkipBelongsToMetadata = {};
437
+
438
+ type SkipAuthMetadata = {};
439
+
440
+ interface BelongsToFn {
441
+ <T extends Newable<BaseEntity>>(targetEntity: T, targetIdParamKey?: string, targetUserIdKey?: keyof InstanceType<T>, allowedStrategies?: AuthStrategies): MethodDecorator & ClassDecorator;
442
+ skip: () => MethodDecorator & ClassDecorator;
443
+ }
444
+
336
445
  interface HasRoleFn {
337
446
  (allowedRoles: string[], allowedStrategies?: AuthStrategies): MethodDecorator & ClassDecorator;
338
447
  skip: () => MethodDecorator & ClassDecorator;
@@ -352,6 +461,8 @@ declare namespace Auth {
352
461
  const isLoggedIn: IsLoggedInFn;
353
462
  const isNotLoggedIn: IsNotLoggedInFn;
354
463
  const hasRole: HasRoleFn;
464
+ const belongsTo: BelongsToFn;
465
+ function skip(): MethodDecorator;
355
466
  }
356
467
 
357
468
  /**
@@ -379,10 +490,10 @@ declare function UserRepo<T extends string, EntityType extends Newable<BaseUser<
379
490
 
380
491
  type CurrentUserMetadata = {
381
492
  index: number;
382
- optional: boolean;
493
+ required: boolean;
383
494
  allowedStrategies?: AuthStrategies;
384
495
  };
385
- declare function CurrentUser(optional?: boolean, allowedStrategies?: AuthStrategies): ParameterDecorator;
496
+ declare function CurrentUser(required?: boolean, allowedStrategies?: AuthStrategies): ParameterDecorator;
386
497
 
387
498
  interface AuthServiceInterface {
388
499
  readonly strategies: AuthStrategies;
@@ -390,11 +501,13 @@ interface AuthServiceInterface {
390
501
  checkAccess: (controllerClass: Newable<Object>, controllerMethod: string, req: HttpRequest) => Promise<void>;
391
502
  isLoggedIn: (request: HttpRequest, allowedStrategies: AuthStrategies) => Promise<boolean>;
392
503
  hasRole: (request: HttpRequest, allowedStrategies: AuthStrategies, allowedRoles: string[]) => Promise<boolean>;
504
+ belongsTo: <TargetEntity extends Newable<BaseEntity>>(request: HttpRequest, allowedStrategies: AuthStrategies, targetEntity: TargetEntity, targetUserIdKey: keyof InstanceType<TargetEntity>, targetIdParamKey: string) => Promise<boolean>;
393
505
  resolveIsLoggedInMetadata: (controllerClass: Newable<Object>, controllerMethod: string) => IsLoggedInMetadata | undefined;
394
506
  resolveIsNotLoggedInMetadata: (controllerClass: Newable<Object>, controllerMethod: string) => IsNotLoggedInMetadata | undefined;
395
507
  resolveHasRoleMetadata: (controllerClass: Newable<Object>, controllerMethod: string) => HasRoleMetadata | undefined;
508
+ resolveBelongsToMetadata: (controllerClass: Newable<Object>, controllerMethod: string) => BelongsToMetadata<Newable<BaseEntity>> | undefined;
396
509
  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>;
510
+ getCurrentUser: <Role extends string, UserType extends BaseUser<Role>, B extends boolean = true>(request: HttpRequest, strategies: AuthStrategies, required: B) => Promise<B extends false ? UserType | undefined : UserType>;
398
511
  }
399
512
 
400
513
  declare class AuthService implements AuthServiceInterface {
@@ -403,13 +516,15 @@ declare class AuthService implements AuthServiceInterface {
403
516
  constructor();
404
517
  init(authStrategies: AuthStrategies): void;
405
518
  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>;
519
+ getCurrentUser<Role extends string, UserType extends BaseUser<Role>, B extends boolean = false>(request: HttpRequest, allowedStrategies: AuthStrategies, required: B): Promise<B extends false ? UserType | undefined : UserType>;
407
520
  checkAccess(controllerClass: Newable<Object>, controllerMethod: string, request: HttpRequest): Promise<void>;
408
521
  isLoggedIn(request: HttpRequest, allowedStrategies: AuthStrategies): Promise<boolean>;
409
522
  hasRole(request: HttpRequest, allowedStrategies: AuthStrategies, allowedRoles: string[]): Promise<boolean>;
523
+ belongsTo<TargetEntity extends Newable<BaseEntity>>(request: HttpRequest, allowedStrategies: AuthStrategies, targetEntity: TargetEntity, targetUserIdKey: keyof InstanceType<TargetEntity>, targetIdParamKey: string): Promise<boolean>;
410
524
  resolveIsLoggedInMetadata(controllerClass: Newable<Object>, controllerMethod: string): IsLoggedInMetadata | undefined;
411
525
  resolveIsNotLoggedInMetadata(controllerClass: Newable<Object>, controllerMethod: string): IsNotLoggedInMetadata | undefined;
412
526
  resolveHasRoleMetadata(controllerClass: Newable<Object>, controllerMethod: string): HasRoleMetadata | undefined;
527
+ resolveBelongsToMetadata(controllerClass: Newable<Object>, controllerMethod: string): BelongsToMetadata<Newable<BaseEntity>> | undefined;
413
528
  }
414
529
 
415
530
  type AccessTokenPayload<Role extends string, T extends BaseUser<Role>> = {
@@ -460,6 +575,7 @@ declare class JwtAuthStrategy<RoleType extends string, UserType extends BaseUser
460
575
  private readonly refreshTokenSecret;
461
576
  private readonly refreshTokenExpiresInMs;
462
577
  private readonly userService;
578
+ private readonly logger;
463
579
  constructor();
464
580
  init(): void;
465
581
  private checkForEntities;
@@ -467,6 +583,7 @@ declare class JwtAuthStrategy<RoleType extends string, UserType extends BaseUser
467
583
  resolveUser(request: HttpRequest): Promise<UserType | undefined>;
468
584
  isLoggedIn(request: HttpRequest): Promise<boolean>;
469
585
  hasRole(request: HttpRequest, allowedRoles: RoleType[]): Promise<boolean>;
586
+ belongsTo<TargetEntity extends Newable<BaseEntity>>(request: HttpRequest, targetEntity: TargetEntity, targetUserIdKey: keyof InstanceType<TargetEntity>, targetIdParamKey: string): Promise<boolean>;
470
587
  private extractTokenFromRequest;
471
588
  private generateAccessToken;
472
589
  private generateRefreshToken;
@@ -548,6 +665,18 @@ declare abstract class HashUtilities {
548
665
  static equal(value: string, hash: string): Promise<boolean>;
549
666
  }
550
667
 
668
+ declare class CronJobEntity implements BaseEntity {
669
+ id: string;
670
+ name: string;
671
+ cron: string;
672
+ active: boolean;
673
+ runOnInit: boolean;
674
+ stopOnError: boolean;
675
+ lastRun: Date | undefined;
676
+ errorMessage: string | undefined;
677
+ }
678
+ type CreateCronJobEntityData = OmitStrict<CronJobEntity, 'id'>;
679
+
551
680
  interface DataSourceServiceInterface {
552
681
  init: () => Promise<void>;
553
682
  }
@@ -580,35 +709,106 @@ type CreateOptions = BaseRepositoryOptions;
580
709
 
581
710
  type CreateAllOptions = BaseRepositoryOptions;
582
711
 
583
- type FindByIdOptions = BaseRepositoryOptions;
712
+ type ArrayWhereFilter<ItemType> = null | {
713
+ equals: ItemType[];
714
+ } | {
715
+ includes?: ItemType[];
716
+ isIncludedIn?: ItemType[];
717
+ };
584
718
 
585
- type FindOneOptions<T extends BaseEntity> = BaseRepositoryOptions & FindOneOptions$1<T>;
719
+ type BaseWhereFilter<T> = T | null;
586
720
 
587
- type FindAllOptions<T extends BaseEntity> = OmitStrict<FindManyOptions<T>, 'transaction'> & BaseRepositoryOptions;
721
+ type BooleanWhereFilter = BaseWhereFilter<boolean>;
588
722
 
589
- type UpdateByIdOptions = BaseRepositoryOptions;
723
+ type DateWhereFilter = BaseWhereFilter<Date> | {
724
+ not?: Date;
725
+ oneOf?: Date[];
726
+ notOneOf?: Date[];
727
+ after?: Date;
728
+ before?: Date;
729
+ };
590
730
 
591
- type UpdateAllOptions = BaseRepositoryOptions;
731
+ type NumberWhereFilter = BaseWhereFilter<number> | {
732
+ not?: number;
733
+ oneOf?: number[];
734
+ notOneOf?: number[];
735
+ greaterThan?: number;
736
+ greaterThanEquals?: number;
737
+ lesserThan?: number;
738
+ lesserThanEquals?: number;
739
+ };
592
740
 
593
- type DeleteByIdOptions = BaseRepositoryOptions;
741
+ type ObjectWhereFilter<T extends Object> = null | {
742
+ equals: T;
743
+ where?: never;
744
+ not?: never;
745
+ oneOf?: never;
746
+ notOneOf?: never;
747
+ } | {
748
+ equals?: never;
749
+ where: Where<T>;
750
+ not?: never;
751
+ oneOf?: never;
752
+ notOneOf?: never;
753
+ } | {
754
+ equals?: never;
755
+ where?: never;
756
+ not?: T;
757
+ oneOf?: T[];
758
+ notOneOf?: T[];
759
+ };
760
+
761
+ type StringWhereFilter = BaseWhereFilter<string> | {
762
+ not?: string;
763
+ oneOf?: string[];
764
+ notOneOf?: string[];
765
+ like?: string;
766
+ iLike?: string;
767
+ };
768
+
769
+ type Where<T extends Object> = WhereFilter<T> | WhereFilter<T>[];
770
+ type WhereFilter<T extends Object> = {
771
+ [P in keyof T]?: WhereFilterProperty<T[P]> | WhereFilterProperty<T[P]>[];
772
+ };
773
+ type WhereFilterProperty<T> = T extends string ? StringWhereFilter : T extends number ? NumberWhereFilter : T extends boolean ? BooleanWhereFilter : T extends any[] ? ArrayWhereFilter<T[number]> : T extends Date ? DateWhereFilter : T extends object ? ObjectWhereFilter<T> : never;
774
+
775
+ type FindAllOptions<T extends BaseEntity> = BaseRepositoryOptions & OmitStrict<FindManyOptions<T>, 'transaction' | 'where'> & {
776
+ where?: Where<T>;
777
+ };
594
778
 
595
779
  type DeleteAllOptions<T extends BaseEntity> = FindAllOptions<T>;
596
780
 
781
+ type DeleteByIdOptions = BaseRepositoryOptions;
782
+
783
+ type FindAllPaginatedOptions<T extends BaseEntity> = OmitStrict<FindAllOptions<T>, 'skip' | 'take'>;
784
+
785
+ type FindByIdOptions = BaseRepositoryOptions;
786
+
787
+ type FindOneOptions<T extends BaseEntity> = BaseRepositoryOptions & OmitStrict<FindOneOptions$1<T>, 'where'> & {
788
+ where?: Where<T>;
789
+ };
790
+
791
+ type UpdateAllOptions = BaseRepositoryOptions;
792
+
793
+ type UpdateByIdOptions = BaseRepositoryOptions;
794
+
597
795
  declare class Repository<T extends BaseEntity, CreateData extends DeepPartial<T> = DeepPartial<T>, UpdateData extends DeepPartial<T> = DeepPartial<T>> {
598
796
  private readonly entityClass;
599
797
  private readonly logger;
600
798
  private readonly typeOrmRepository;
601
799
  constructor(entityClass: Newable<T>, repo: Repository$1<T> | Repository<T>);
602
800
  private getManager;
801
+ private resolveFindOptionsWhere;
603
802
  create(data: CreateData, options?: CreateOptions): Promise<T>;
604
803
  createAll(data: CreateData[], options?: CreateAllOptions): Promise<T[]>;
605
804
  findById(id: T['id'], options?: FindByIdOptions): Promise<T>;
606
805
  findOne(options: FindOneOptions<T>): Promise<T>;
607
806
  findAll(options?: FindAllOptions<T>): Promise<T[]>;
807
+ findAllPaginated(page: number, limit: number, options?: FindAllPaginatedOptions<T>): Promise<PaginationResult<T>>;
608
808
  updateById(id: T['id'], data: UpdateData, options?: UpdateByIdOptions): Promise<T>;
609
- updateAll(where: FindOptionsWhere<T> | FindOptionsWhere<T>[], data: UpdateData, options?: UpdateAllOptions): Promise<T[]>;
809
+ updateAll(where: Where<T>, data: UpdateData, options?: UpdateAllOptions): Promise<T[]>;
610
810
  deleteById(id: T['id'], options?: DeleteByIdOptions): Promise<void>;
611
- deleteAll(where: FindOptionsWhere<T> | FindOptionsWhere<T>[], options?: OmitStrict<DeleteAllOptions<T>, 'where'>): Promise<T[]>;
811
+ deleteAll(where: Where<T>, options?: OmitStrict<DeleteAllOptions<T>, 'where'>): Promise<T[]>;
612
812
  }
613
813
 
614
814
  declare class MigrationEntity implements BaseEntity {
@@ -630,7 +830,7 @@ declare abstract class Migration {
630
830
  protected addColumn<T extends BaseEntity>(entity: Newable<T>, key: keyof T, transaction: Transaction): Promise<void>;
631
831
  protected changeColumn<T extends BaseEntity>(entity: Newable<T>, oldColumn: keyof T | string & {}, newColumn: PropertyMetadataInput & {
632
832
  name?: keyof T;
633
- type: Exclude<PropertyMetadata, RelationMetadata<BaseEntity>>['type'];
833
+ type: ExcludeStrict<PropertyMetadata, RelationMetadata<BaseEntity> | FilePropertyMetadata>['type'];
634
834
  }, transaction: Transaction): Promise<void>;
635
835
  protected getColumnMetadata<T extends BaseEntity>(target: EntityTarget<T>, propertyName: keyof T | string & {}, transaction: Transaction): ColumnMetadata;
636
836
  protected getEntityMetadata<T extends BaseEntity>(target: EntityTarget<T>, transaction: Transaction): EntityMetadata$1;
@@ -663,8 +863,9 @@ declare class Logger implements LoggerInterface {
663
863
  private getTimestamp;
664
864
  }
665
865
 
866
+ type ToColumnMappableTypes = ExcludeStrict<PropertyMetadata, RelationMetadata<BaseEntity> | FilePropertyMetadata>['type'];
666
867
  declare abstract class BaseDataSource {
667
- protected readonly columnTypeMappingOverride: Partial<Record<PropertyMetadata['type'], ColumnType>>;
868
+ protected readonly columnTypeMappingOverride: Partial<Record<ToColumnMappableTypes, ColumnType>>;
668
869
  private get columnTypeMapping();
669
870
  abstract readonly options: OmitStrict<DataSourceOptions, 'entities'>;
670
871
  abstract readonly entities: Newable<BaseEntity>[];
@@ -676,7 +877,7 @@ declare abstract class BaseDataSource {
676
877
  protected getEntitySchemas(): EntitySchema[];
677
878
  protected createSchemaForEntity(cls: Newable<BaseEntity>): EntitySchema;
678
879
  protected propertyToRelationOptions<T extends BaseEntity>(metadata: RelationMetadata<T>): EntitySchemaRelationOptions;
679
- protected propertyToColumnOptions(metadata: Exclude<PropertyMetadata, RelationMetadata<BaseEntity>>): EntitySchemaColumnOptions;
880
+ protected propertyToColumnOptions(metadata: ExcludeStrict<PropertyMetadata, RelationMetadata<BaseEntity> | FilePropertyMetadata>, cls: Newable<BaseEntity>, key: string): EntitySchemaColumnOptions;
680
881
  getRepository<T extends BaseEntity>(cls: Newable<T>): Repository<T>;
681
882
  startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
682
883
  createQueryRunner(): QueryRunner;
@@ -692,6 +893,49 @@ declare abstract class BaseDataSource {
692
893
  }): string;
693
894
  }
694
895
 
896
+ type CronConfig = OmitStrict<CronJobEntity, 'id' | 'lastRun' | 'errorMessage'> & {
897
+ syncToDb: boolean;
898
+ };
899
+ declare abstract class CronJob {
900
+ protected readonly overrideName?: string | undefined;
901
+ abstract readonly config: Partial<CronConfig> & Pick<CronConfig, 'name' | 'cron'>;
902
+ protected entity: CronJobEntity | undefined;
903
+ protected scheduledTask: ScheduledTask | undefined;
904
+ protected readonly cronJobRepository: Repository<CronJobEntity, CreateCronJobEntityData>;
905
+ protected readonly logger: LoggerInterface;
906
+ protected get fullConfig(): CronConfig;
907
+ get name(): string;
908
+ get task(): ScheduledTask | undefined;
909
+ get active(): boolean;
910
+ constructor(overrideName?: string | undefined);
911
+ init(): Promise<void>;
912
+ protected resolveEntity(): Promise<CronJobEntity>;
913
+ runOnTick(): Promise<boolean>;
914
+ runOnError(error: unknown): Promise<void>;
915
+ enable(): Promise<void>;
916
+ disable(): Promise<void>;
917
+ onError(error: unknown): void | Promise<void>;
918
+ abstract onTick(): void | Promise<void>;
919
+ }
920
+
921
+ interface CronServiceInterface {
922
+ readonly cronJobs: CronJob[];
923
+ init: (cronJobs: Newable<CronJob>[]) => Promise<void>;
924
+ schedule: (cronJob: CronJob) => Promise<void>;
925
+ enable: (name: string) => Promise<void>;
926
+ disable: (name: string) => Promise<void>;
927
+ }
928
+
929
+ declare class CronService implements CronServiceInterface {
930
+ protected logger: LoggerInterface;
931
+ readonly cronJobs: CronJob[];
932
+ constructor();
933
+ init(cronJobs: Newable<CronJob>[]): Promise<void>;
934
+ schedule(cronJob: CronJob): Promise<void>;
935
+ enable(name: string): Promise<void>;
936
+ disable(name: string): Promise<void>;
937
+ }
938
+
695
939
  type DiToken<T> = Newable<T> | string;
696
940
 
697
941
  type DiProvider<T> = {
@@ -723,19 +967,20 @@ declare const ZIBRI_DI_TOKENS: {
723
967
  readonly JWT_REFRESH_TOKEN_SECRET: "zi.jwt_refresh_token_secret";
724
968
  readonly JWT_REFRESH_TOKEN_EXPIRES_IN_MS: "zi.jwt_refresh_token_expires_in_ms";
725
969
  readonly USER_SERVICE: "zi.user_service";
970
+ readonly CRON_SERVICE: "zi.cron_service";
726
971
  };
727
972
 
728
973
  declare function inject<T>(token: DiToken<T>): T;
729
974
 
730
975
  interface BodyParserInterface {
731
976
  readonly contentType: MimeType;
732
- parse: (req: HttpRequest) => Promise<unknown>;
977
+ parse: (req: HttpRequest, bodyMetadata: BodyMetadata) => Promise<unknown>;
733
978
  }
734
979
 
735
980
  declare function BodyParser(): ClassDecorator;
736
981
 
737
982
  interface ParserInterface {
738
- parseRequestBody: (req: HttpRequest) => Promise<unknown>;
983
+ parseRequestBody: (req: HttpRequest, metadata: BodyMetadata) => Promise<unknown>;
739
984
  parsePathParam: (req: HttpRequest, metadata: PathParamMetadata) => unknown;
740
985
  parseQueryParam: (req: HttpRequest, metadata: QueryParamMetadata) => unknown;
741
986
  parseHeaderParam: (req: HttpRequest, metadata: HeaderParamMetadata) => unknown;
@@ -752,7 +997,7 @@ declare class Parser implements ParserInterface {
752
997
  parseHeaderParam(req: HttpRequest, metadata: HeaderParamMetadata): unknown;
753
998
  parseQueryParam(req: HttpRequest, metadata: QueryParamMetadata): unknown;
754
999
  parsePathParam(req: HttpRequest, metadata: PathParamMetadata): unknown;
755
- parseRequestBody(req: HttpRequest): Promise<unknown>;
1000
+ parseRequestBody(req: HttpRequest, metadata: BodyMetadata): Promise<unknown>;
756
1001
  attachTo(): void;
757
1002
  }
758
1003
 
@@ -761,6 +1006,83 @@ declare class JsonBodyParser implements BodyParserInterface {
761
1006
  parse(req: HttpRequest): Promise<unknown>;
762
1007
  }
763
1008
 
1009
+ /**
1010
+ * A resolved file from a multipart/form-data request.
1011
+ * Has the same properties as the File from multer but adds property metadata.
1012
+ */
1013
+ declare class File implements Omit<Express.Multer.File, 'stream'> {
1014
+ fieldname: string;
1015
+ originalname: string;
1016
+ encoding: string;
1017
+ mimetype: string;
1018
+ size: number;
1019
+ destination: string;
1020
+ filename: string;
1021
+ path: string;
1022
+ buffer: Buffer;
1023
+ }
1024
+
1025
+ /**
1026
+ * The raw value that a form-data property has.
1027
+ */
1028
+ type FormDataValue = string | File | File[] | undefined;
1029
+ /**
1030
+ * The name of the file that contains information about when a file was uploaded.
1031
+ */
1032
+ declare const CREATED_AT_FILE_NAME: string;
1033
+ /**
1034
+ * The result when parsing multipart/form-data request bodies.
1035
+ * Has a resolved object with all the request bodies values on their respective keys.
1036
+ */
1037
+ declare class FormData<FormDataType extends object> {
1038
+ /**
1039
+ * The resolved value as an object, containing all files and values correctly typed.
1040
+ */
1041
+ readonly value: FormDataType;
1042
+ /**
1043
+ * The temporary folder where all files are cached.
1044
+ * Should be deleted after you handled the form data with the cleanup method.
1045
+ */
1046
+ readonly tempFolder: string;
1047
+ private constructor();
1048
+ static create<FormDataType extends object>(value: FormDataType, tempFolder: string): Promise<FormData<FormDataType>>;
1049
+ /**
1050
+ * Deletes all temporary files belonging to this form data.
1051
+ */
1052
+ cleanup(): Promise<void>;
1053
+ }
1054
+
1055
+ declare class FormDataBodyParser implements BodyParserInterface {
1056
+ readonly contentType: MimeType;
1057
+ readonly tempPath: string;
1058
+ parse(req: HttpRequest, metadata: BodyMetadata): Promise<FormData<object>>;
1059
+ private removeTempFolder;
1060
+ private requestToDataObject;
1061
+ private addFilesToMap;
1062
+ private addFileArrayToMap;
1063
+ private addSingleFileToMap;
1064
+ private addStringValuesToMap;
1065
+ }
1066
+
1067
+ type BaseFileResponseData = {
1068
+ mimeType?: LooseMimeType;
1069
+ forceDownload?: boolean;
1070
+ };
1071
+ type FileResponseData = BaseFileResponseData & {
1072
+ path: string;
1073
+ } | BaseFileResponseData & {
1074
+ data: Buffer | Readable;
1075
+ filename: `${string}.${string}`;
1076
+ };
1077
+ declare class FileResponse {
1078
+ readonly data: Buffer | Readable | string;
1079
+ readonly filename: `${string}.${string}`;
1080
+ readonly mimeType: LooseMimeType;
1081
+ readonly forceDownload: boolean;
1082
+ constructor(data: FileResponseData);
1083
+ private validate;
1084
+ }
1085
+
764
1086
  type ZibriApplicationOptions = {
765
1087
  name: string;
766
1088
  version: Version;
@@ -769,6 +1091,7 @@ type ZibriApplicationOptions = {
769
1091
  providers?: DiProvider<unknown>[];
770
1092
  bodyParsers?: Newable<BodyParserInterface>[];
771
1093
  authStrategies?: AuthStrategies;
1094
+ cronJobs?: Newable<CronJob>[];
772
1095
  };
773
1096
 
774
1097
  /**
@@ -776,7 +1099,7 @@ type ZibriApplicationOptions = {
776
1099
  */
777
1100
  declare class ZibriApplication {
778
1101
  private readonly providedOptions;
779
- readonly express: Express;
1102
+ readonly express: Express$1;
780
1103
  private _router;
781
1104
  get router(): RouterInterface;
782
1105
  private logger;
@@ -785,6 +1108,7 @@ declare class ZibriApplication {
785
1108
  private parser;
786
1109
  private dataSourceService;
787
1110
  private authService;
1111
+ private cronService;
788
1112
  private readonly options;
789
1113
  constructor(providedOptions: ZibriApplicationOptions);
790
1114
  init(): Promise<void>;
@@ -838,6 +1162,16 @@ declare class TypeMismatchValidationProblem implements ValidationProblem {
838
1162
  readonly message: string;
839
1163
  constructor(key: string, type: string);
840
1164
  }
1165
+ declare class MaxFileSizeValidationProblem implements ValidationProblem {
1166
+ readonly key: string;
1167
+ readonly message: string;
1168
+ constructor(key: string, maxSize: FileSize);
1169
+ }
1170
+ declare class MimeTypeMismatchValidationProblem implements ValidationProblem {
1171
+ readonly key: string;
1172
+ readonly message: string;
1173
+ constructor(key: string, allowedMimeTypes: MimeType[]);
1174
+ }
841
1175
  declare class RelationsNotAllowedValidationProblem implements ValidationProblem {
842
1176
  readonly key: string;
843
1177
  readonly message: string;
@@ -930,4 +1264,4 @@ declare function compareVersion(v1: Version, v2: Version): 'bigger' | 'equal' |
930
1264
 
931
1265
  declare function isVersion(value: string): value is Version;
932
1266
 
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 };
1267
+ export { type AccessTokenPayload, type AppData, AppState, type ArrayParamMetadata, type ArrayParamMetadataInput, type ArrayPropertyItemMetadata, type ArrayPropertyItemMetadataInput, type ArrayPropertyMetadata, type ArrayPropertyMetadataInput, type ArrayWhereFilter, AssetService, type AssetServiceInterface, Auth, AuthService, type AuthServiceInterface, type AuthStrategies, type AuthStrategyInterface, BadRequestError, BaseDataSource, type BaseEntity, type BaseRepositoryOptions, type BaseUser, type BelongsToMetadata, Body, type BodyMetadata, type BodyMetadataInput, BodyParser, type BodyParserInterface, type BooleanParamMetadata, type BooleanParamMetadataInput, type BooleanPropertyMetadata, type BooleanPropertyMetadataInput, type BooleanWhereFilter, CREATED_AT_FILE_NAME, type ColumnType, Controller, type ControllerRouteConfiguration, type CreateAllOptions, type CreateCronJobEntityData, type CreateOptions, type CronConfig, CronJob, CronJobEntity, CronService, type CronServiceInterface, CurrentUser, type CurrentUserMetadata, DataSource, type DataSourceOptions, DataSourceService, type DataSourceServiceInterface, type DateParamMetadata, type DateParamMetadataInput, type DatePropertyMetadata, type DatePropertyMetadataInput, type DateWhereFilter, type DefaultOpenApiResponse, Delete, type DeleteAllOptions, type DeleteByIdOptions, type DiProvider, type DiToken, type EncodedAccessToken, Entity, type EntityMetadata, File, type FileOpenApiResponse, type FilePropertyMetadata, type FilePropertyMetadataInput, FileResponse, type FileSize, type FindAllOptions, type FindAllPaginatedOptions, type FindByIdOptions, type FindOneOptions, FormData, type FormDataBodyMetadata, FormDataBodyParser, type FormDataValue, 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, type JsonBodyMetadata, JsonBodyParser, Jwt, JwtAuthData, JwtAuthStrategy, JwtCredentials, JwtCredentialsDto, JwtUtilities, type KnownHeader, type LogLevel, type LogLevels, Logger, type LoggerInterface, type LooseMimeType, type ManyToManyPropertyMetadata, type ManyToManyPropertyMetadataInput, type ManyToOnePropertyMetadata, type ManyToOnePropertyMetadataInput, MaxFileSizeValidationProblem, Migration, MigrationEntity, MimeType, MimeTypeMismatchValidationProblem, NO_USER_REPOSITORIES_PROVIDED_ERROR_MESSAGE, type Newable, NotFoundError, type NumberParamMetadata, type NumberParamMetadataInput, type NumberPropertyMetadata, type NumberPropertyMetadataInput, type NumberWhereFilter, type ObjectParamMetadata, type ObjectParamMetadataInput, type ObjectPropertyMetadata, type ObjectPropertyMetadataInput, type ObjectWhereFilter, OmitType, type OneToManyPropertyMetadata, type OneToManyPropertyMetadataInput, type OneToOnePropertyMetadata, type OneToOnePropertyMetadataInput, type OpenApiDefinition, type OpenApiOperation, type OpenApiParameter, type OpenApiPaths, type OpenApiRequestBodyObject, type OpenApiResponse, type OpenApiSchemaObject, type OpenApiSecurityRequirementObject, type OpenApiSecuritySchemeObject, OpenApiService, type OpenApiServiceInterface, type PaginationResult, 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, Response, type Route, type RouteConfiguration, Router, type RouterInterface, type SkipAuthMetadata, type SkipBelongsToMetadata, type SkipHasRoleMetadata, type SkipIsLoggedInMetadata, type SkipIsNotLoggedInMetadata, type StringFormat, type StringParamMetadata, type StringParamMetadataInput, type StringPropertyMetadata, type StringPropertyMetadataInput, type StringWhereFilter, 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, type Where, type WhereFilter, type WhereFilterProperty, ZIBRI_DI_TOKENS, ZibriApplication, type ZibriApplicationOptions, compareVersion, errorHandler, fileSizeToBytes, inject, isHttpError, isMimeType, isVersion, repositoryTokenFor };