@pcg/core 1.0.0-alpha.1 → 1.0.0-alpha.2

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.
Files changed (98) hide show
  1. package/dist/index.d.ts +21 -1179
  2. package/dist/index.js +76 -1856
  3. package/dist/index.js.map +1 -1
  4. package/package.json +16 -4
  5. package/.turbo/turbo-build.log +0 -16
  6. package/CHANGELOG.md +0 -14
  7. package/src/abstracts/index.ts +0 -3
  8. package/src/abstracts/nestjs-resource-service.ts +0 -154
  9. package/src/abstracts/nestjs-service.ts +0 -25
  10. package/src/configs/app.config.ts +0 -185
  11. package/src/configs/db.config.ts +0 -122
  12. package/src/configs/index.ts +0 -4
  13. package/src/configs/logger.config.ts +0 -62
  14. package/src/context/action-context.ts +0 -34
  15. package/src/context/current-user.ts +0 -49
  16. package/src/context/index.ts +0 -5
  17. package/src/context/platform-method-context.ts +0 -5
  18. package/src/context/service-method-context.ts +0 -47
  19. package/src/db/snake-naming.strategy.ts +0 -277
  20. package/src/enums/app-env.enum.ts +0 -36
  21. package/src/enums/app-mode.enum.ts +0 -5
  22. package/src/enums/app-server.enum.ts +0 -39
  23. package/src/enums/index.ts +0 -4
  24. package/src/enums/worker-mode.enum.ts +0 -11
  25. package/src/errors/access-denied.error.ts +0 -18
  26. package/src/errors/bad-request.error.ts +0 -9
  27. package/src/errors/forbidden.error.ts +0 -9
  28. package/src/errors/index.ts +0 -8
  29. package/src/errors/input-validation.error.ts +0 -16
  30. package/src/errors/nest-error.filter.ts +0 -70
  31. package/src/errors/nest-error.ts +0 -63
  32. package/src/errors/not-found.error.ts +0 -9
  33. package/src/errors/unauthorized.error.ts +0 -9
  34. package/src/exceptions/http-exception-response.ts +0 -34
  35. package/src/exceptions/http-exceptions.filter.ts +0 -95
  36. package/src/index.ts +0 -32
  37. package/src/jwt/extractors.ts +0 -80
  38. package/src/jwt/types.ts +0 -209
  39. package/src/logger/classes/logger-factory.ts +0 -54
  40. package/src/logger/classes/logger.ts +0 -340
  41. package/src/logger/classes/nest-system-logger.ts +0 -63
  42. package/src/logger/classes/typeorm-logger.ts +0 -83
  43. package/src/logger/index.ts +0 -20
  44. package/src/logger/logger.constants.ts +0 -24
  45. package/src/logger/logger.interfaces.ts +0 -98
  46. package/src/logger/logger.module.ts +0 -45
  47. package/src/logger/logger.providers.ts +0 -140
  48. package/src/logger/winston.tools.ts +0 -241
  49. package/src/middlewares/app.middleware.ts +0 -26
  50. package/src/middlewares/index.ts +0 -1
  51. package/src/modules/hooks/base-hook.ts +0 -64
  52. package/src/modules/hooks/decorators/on-hook.decorator.ts +0 -19
  53. package/src/modules/hooks/hooks.module.ts +0 -10
  54. package/src/modules/hooks/hooks.service.ts +0 -28
  55. package/src/modules/hooks/index.ts +0 -11
  56. package/src/modules/id/id.module.ts +0 -26
  57. package/src/modules/id/id.service.ts +0 -57
  58. package/src/modules/id/index.ts +0 -2
  59. package/src/modules/postgres-pubsub/index.ts +0 -3
  60. package/src/modules/postgres-pubsub/postgres-pubsub.module.ts +0 -14
  61. package/src/modules/postgres-pubsub/postgres-pubsub.ts +0 -461
  62. package/src/pagination/constants.ts +0 -9
  63. package/src/pagination/cursor/cursor-pagination.exception.ts +0 -16
  64. package/src/pagination/cursor/cursor-pagination.helpers.ts +0 -145
  65. package/src/pagination/cursor/cursor-pagination.input.ts +0 -96
  66. package/src/pagination/cursor/cursor-pagination.types.ts +0 -127
  67. package/src/pagination/index.ts +0 -9
  68. package/src/pagination/offset/offset-pagination.exception.ts +0 -15
  69. package/src/pagination/offset/offset-pagination.helpers.ts +0 -122
  70. package/src/pagination/offset/offset-pagination.input.ts +0 -30
  71. package/src/pagination/offset/offset-pagination.types.ts +0 -82
  72. package/src/pagination/tools.ts +0 -53
  73. package/src/tools/compose.ts +0 -92
  74. package/src/tools/convert-to-bigint.ts +0 -27
  75. package/src/tools/create-list-meta.ts +0 -64
  76. package/src/tools/define-statuses.ts +0 -15
  77. package/src/tools/env.ts +0 -139
  78. package/src/tools/fetch-total-with-query.ts +0 -48
  79. package/src/tools/generate-entity-id.ts +0 -23
  80. package/src/tools/get-request-language.ts +0 -13
  81. package/src/tools/is-object.ts +0 -1
  82. package/src/tools/postgres/locale-to-pg-collate.ts +0 -21
  83. package/src/tools/remove-undefined-properties.ts +0 -20
  84. package/src/tools/request-id.ts +0 -25
  85. package/src/tools/stringify-opts.ts +0 -20
  86. package/src/tools/typeorm/add-filter.ts +0 -164
  87. package/src/tools/typeorm/ensure-inner-join.ts +0 -36
  88. package/src/tools/typeorm/ensure-left-join.ts +0 -36
  89. package/src/tools/typeorm/is-alias-already-busy.ts +0 -25
  90. package/src/tools/wait.ts +0 -26
  91. package/src/types/express-request.ts +0 -8
  92. package/src/types/list-mehod-options.ts +0 -32
  93. package/src/types/list-meta.ts +0 -16
  94. package/src/types/maybe.ts +0 -2
  95. package/src/validation/index.ts +0 -1
  96. package/src/validation/validation-pipe.ts +0 -14
  97. package/tsconfig.lib.json +0 -9
  98. package/tsdown.config.ts +0 -15
package/dist/index.d.ts CHANGED
@@ -1,966 +1,11 @@
1
- import { ArgumentsHost, ConsoleLogger, DynamicModule, HttpException, HttpServer, HttpStatus, LogLevel, LoggerService, OnModuleInit, Provider, Type, ValidationError, ValidationPipe } from "@nestjs/common";
2
- import { BaseEntity, DataSource, EntityManager, LogLevel as LogLevel$1, LogMessage, ObjectLiteral, Repository, SelectQueryBuilder } from "typeorm";
3
- import * as _nestjs_config0 from "@nestjs/config";
4
- import { isObject } from "@pcg/predicates";
5
- import { AbstractLogger } from "typeorm/logger/AbstractLogger.js";
6
- import * as winston from "winston";
7
- import { LogEntry, Logger as Logger$1, LoggerOptions } from "winston";
8
- import { ActionScopes, ActionScopesArray, IUser } from "@pcg/auth";
9
- import { LoggerOptions as LoggerOptions$1 } from "typeorm/logger/LoggerOptions.js";
10
- import { ModuleMetadata } from "@nestjs/common/interfaces";
11
- import { Format } from "logform";
12
- import { PostgresConnectionOptions } from "typeorm/driver/postgres/PostgresConnectionOptions.js";
1
+ import { ObjectLiteral, SelectQueryBuilder } from "typeorm";
2
+ import { Type } from "@nestjs/common";
3
+ import { CurrentUser } from "#/context/current-user";
13
4
  import { Request } from "express";
5
+ import { MaybeNull } from "#/types/maybe";
14
6
 
15
- //#region src/enums/app-env.enum.d.ts
16
- /**
17
- * Application environment enum
18
- */
19
- declare enum AppEnv {
20
- /**
21
- * Local environment.
22
- * Used for local development on your machine.
23
- */
24
- LOCAL = "local",
25
- /**
26
- * Test environment.
27
- * Used when running tests.
28
- */
29
- TEST = "test",
30
- /**
31
- * Development environment.
32
- * Used when deploying to a development server.
33
- * Development server provide early access to new features.
34
- */
35
- DEVELOPMENT = "development",
36
- /**
37
- * Stage environment.
38
- * Used when deploying to a stage server.
39
- * Stage is a pre-production environment.
40
- */
41
- STAGE = "stage",
42
- /**
43
- * Production environment.
44
- * Used when deploying to a production server.
45
- */
46
- PRODUCTION = "production",
47
- }
48
- //#endregion
49
- //#region src/enums/app-mode.enum.d.ts
50
- declare enum AppMode {
51
- STANDALONE = "standalone",
52
- PARENT = "parent",
53
- CHILD = "child",
54
- }
55
- //#endregion
56
- //#region src/configs/app.config.d.ts
57
- /**
58
- * NestJS injection token for app config
59
- */
60
- declare const APP_CONFIG_TOKEN = "APP_CONFIG_TOKEN";
61
- declare const InjectAppConfig: () => PropertyDecorator & ParameterDecorator;
62
- /**
63
- * Application config environment variables
64
- */
65
- declare class AppConfigEnvironmentVariables {
66
- /**
67
- * Application port
68
- * @example
69
- * ```yaml
70
- * PORT: 3000
71
- * ```
72
- */
73
- PORT: number;
74
- /**
75
- * Application host
76
- * @example
77
- * ```yaml
78
- * APP_HOST: 'https://app-api.example.com'
79
- * # or
80
- * APP_HOST: 'http://localhost:3000'
81
- * ```
82
- */
83
- APP_HOST: string;
84
- /**
85
- * Application UI host
86
- * @example
87
- * ```yaml
88
- * APP_UI_HOST: 'https://app.example.com'
89
- * # or
90
- * APP_UI_HOST: 'http://localhost:4200'
91
- * ```
92
- */
93
- APP_UI_HOST: string;
94
- /**
95
- * Application environment. Can be 'local', 'development', 'stage', 'production'
96
- * @example
97
- * ```yaml
98
- * APP_ENV: 'local'
99
- * ```
100
- */
101
- APP_ENV: AppEnv;
102
- /**
103
- * Application service account id (user with type SA in users table)
104
- * @example
105
- * ```yaml
106
- * APP_SERVICE_ACCOUNT_ID: 'hcu:xxxxxxxxxxx'
107
- * ```
108
- */
109
- APP_SERVICE_ACCOUNT_ID?: string;
110
- /**
111
- * Application fallback language
112
- * @example
113
- * ```yaml
114
- * FALLBACK_LANGUAGE: 'es'
115
- * ```
116
- */
117
- FALLBACK_LANGUAGE: string;
118
- }
119
- interface AppConfigType {
120
- /**
121
- * Application environment
122
- * @example 'local', 'development', 'stage', 'production'
123
- */
124
- env: AppEnv;
125
- /**
126
- * Application name
127
- * @example 'Jetstream'
128
- */
129
- name: string;
130
- /**
131
- * Application shortname
132
- * @example 'js'
133
- */
134
- shortname: string;
135
- /**
136
- * Application port
137
- * @example 3000
138
- */
139
- port: number;
140
- /**
141
- * Application mode
142
- * @example 'standalone'
143
- */
144
- mode: AppMode;
145
- /**
146
- * Application host
147
- * @example 'https://app-api.example.com or http://localhost:3000'
148
- */
149
- host?: string;
150
- /**
151
- * Application UI host
152
- * @example 'https://app.example.com or http://localhost:8080'
153
- */
154
- uiHost?: string;
155
- /**
156
- * Application fallback language
157
- * @example 'en'
158
- */
159
- fallbackLanguage: string;
160
- /**
161
- * Application service account id (user with type SA in users table)
162
- * @example 'hcu:xxxxxxxxxxx'
163
- */
164
- appServiceAccountId?: string;
165
- }
166
- interface AppConfigOptions {
167
- name: string;
168
- shortname: string;
169
- mode?: AppMode;
170
- }
171
- /**
172
- * Create Main Application Config
173
- * @example
174
- * ```ts
175
- * // src/config/index.ts
176
- *
177
- * import { createAppConfig } from '#/dist/configs';
178
- *
179
- * export const appConfig = createAppConfig({
180
- * name: 'Jetstream',
181
- * shortname: 'js',
182
- * });
183
- * ```
184
- */
185
- declare const createAppConfig: (opts: AppConfigOptions) => (() => AppConfigType) & _nestjs_config0.ConfigFactoryKeyHost<AppConfigType>;
186
- //#endregion
187
- //#region src/modules/id/id.service.d.ts
188
- /**
189
- * An IdService is a service within your application that provides methods to generate unique IDs
190
- * for entities and other data objects.
191
- */
192
- declare class IdService {
193
- private readonly appConfig;
194
- constructor(appConfig: AppConfigType);
195
- /**
196
- * Returns a delimiter string based on the current environment.
197
- * This delimiter is used in constructing the entity IDs.
198
- * The delimiter is ':dev:' for development environments,
199
- * :stage:' for staging environments and ':' for other environments.
200
- *
201
- * This allows for better differentiation and traceability of entities across various environments.
202
- */
203
- get delimiter(): ":test:" | ":dev:" | ":stage:" | ":";
204
- /**
205
- * Generates unique id for entity
206
- * @param prefix - entity id prefix in database (e.g. 'u' for users)
207
- * @param app - app shortname (e.g. 'js')
208
- * @returns id in format 'jsu:xxxxxxxxxxx' or 'jsu:stage:xxxxxxxxxxx' for staging environment
209
- */
210
- generateEntityId(prefix: string, app?: string): string;
211
- /**
212
- * Generates unique id with length 11
213
- * @returns id in format 'xxxxxxxxxxx'
214
- */
215
- generateId(size?: number): string;
216
- }
217
- //#endregion
218
- //#region src/types/maybe.d.ts
219
- type MaybeNull<T> = T | null;
220
- //#endregion
221
- //#region src/context/current-user.d.ts
222
- interface CurrentUser extends IUser {
223
- /**
224
- * User email address
225
- * @example
226
- * ```ts
227
- * 'john.doe@example.com'
228
- * ```
229
- */
230
- email: string;
231
- /**
232
- * User's first name
233
- * @example
234
- * ```ts
235
- * 'John'
236
- * ```
237
- */
238
- firstName: string;
239
- /**
240
- * User's last name
241
- * @example
242
- * ```ts
243
- * 'Doe'
244
- * ```
245
- */
246
- lastName: string;
247
- /**
248
- * User's full name
249
- * @example
250
- * ```ts
251
- * 'John Doe'
252
- * ```
253
- */
254
- fullName: string;
255
- /**
256
- * Indicates who logged in as this user
257
- * @example
258
- * ```ts
259
- * 'hcu:78thsjvx24hrx' // ID of user who impersonated this user
260
- * ```
261
- */
262
- impersonatedByUserId?: string | null;
263
- }
264
- //#endregion
265
- //#region src/context/service-method-context.d.ts
266
- /**
267
- * Context object for base service methods.
268
- */
269
- interface BaseServiceMethodContext {
270
- /**
271
- * The current user making the request.
272
- */
273
- user: CurrentUser;
274
- /**
275
- * An optional request ID.
276
- */
277
- requestId?: string;
278
- /**
279
- * Make the request silent, meaning no notifications and actions will be sent.
280
- */
281
- isSilent?: boolean;
282
- /**
283
- * Checks if the user has permission to perform the specified action.
284
- * @param action The action to check permission for.
285
- * @param actionScopes Optional scopes to check permission against.
286
- * @returns True if the user has permission, false otherwise.
287
- */
288
- isGranted(action: string, actionScopes?: ActionScopes | ActionScopesArray): boolean;
289
- /**
290
- * Check permission and throw AccessDenied error if user doesn't have permission
291
- * @param action - action string
292
- * @param scopes - scopes where action was executed
293
- * @throws AccessDenied error if the user doesn't have the permission
294
- */
295
- validateAccess(action: string, scopes?: ActionScopes | ActionScopesArray): void;
296
- /**
297
- * Check permission and throw AccessDenied error if user doesn't have permission
298
- * @param action - action string
299
- * @param actionScopes - scopes where action was executed
300
- * @throws AccessDenied error if the user doesn't have the permission
301
- */
302
- transaction?: EntityManager;
303
- }
304
- //#endregion
305
- //#region src/logger/classes/nest-system-logger.d.ts
306
- declare class NestSystemLogger extends ConsoleLogger {
307
- private readonly logger;
308
- protected printMessages(messages: unknown[], context?: string | undefined, logLevel?: LogLevel | undefined): void;
309
- protected stringifyMessage(message: unknown): string;
310
- private getWinstonLogLevel;
311
- }
312
- //#endregion
313
- //#region src/context/action-context.d.ts
314
- /**
315
- * GraphQL base action context
316
- * Used for mutations and queries
317
- */
318
- interface IBaseActionContext {
319
- /**
320
- * Request ID
321
- * Used for logging to track request
322
- */
323
- requestId: string;
324
- /**
325
- * Current user who executes action
326
- */
327
- user: CurrentUser;
328
- /**
329
- * Check if current user from context has permission
330
- * @param action - action string
331
- * @param actionScopes - scopes where action was executed
332
- */
333
- isGranted(action: string, actionScopes?: ActionScopes | ActionScopesArray): boolean;
334
- /**
335
- * Check permission and throw AccessDenied error if user doesn't have permission
336
- * @param action - action string
337
- * @param scopes - scopes where action was executed
338
- * @throws AccessDenied error if the user doesn't have the permission
339
- */
340
- validateAccess(action: string, scopes?: ActionScopes | ActionScopesArray): void;
341
- }
342
- //#endregion
343
- //#region src/context/platform-method-context.d.ts
344
- interface BasePlatformMethodContext extends BaseServiceMethodContext {
345
- organizationId: string;
346
- }
347
- //#endregion
348
- //#region src/errors/nest-error.d.ts
349
- /**
350
- * Configuration options for creating a NestError instance.
351
- *
352
- * @interface NestErrorOptions
353
- */
354
- interface NestErrorOptions {
355
- /** The human-readable error message describing what went wrong */
356
- message: string;
357
- /**
358
- * A unique identifier or error code for categorizing and handling the error
359
- * @example
360
- * 'AUTH_USER_NOT_FOUND'
361
- * */
362
- key: string;
363
- /** The underlying error that caused this error, if any */
364
- cause?: unknown;
365
- /** Additional contextual information related to the error occurrence */
366
- context?: Record<string, unknown>;
367
- /**
368
- * Whether the error should be silenced (i.e., not logged or reported)
369
- */
370
- silent?: boolean;
371
- }
372
- /**
373
- * Custom error class for NestJS applications that extends the native Error class.
374
- *
375
- * This error class provides additional context and structured error handling
376
- * capabilities beyond the standard Error object.
377
- *
378
- * @example
379
- * ```typescript
380
- * throw new NestError({
381
- * key: 'AUTH_USER_NOT_FOUND',
382
- * message: 'User with the specified ID was not found',
383
- * context: { userId: '123' },
384
- * cause: originalError
385
- * });
386
- * ```
387
- */
388
- declare class NestError extends Error {
389
- key: string;
390
- context?: Record<string, unknown>;
391
- httpStatusCode: HttpStatus;
392
- silent: boolean;
393
- constructor(opts: NestErrorOptions);
394
- }
395
- //#endregion
396
- //#region src/errors/forbidden.error.d.ts
397
- declare class ForbiddenError extends NestError {
398
- constructor(opts: NestErrorOptions);
399
- }
400
- //#endregion
401
- //#region src/errors/access-denied.error.d.ts
402
- interface AccessDeniedErrorOptions {
403
- action: string;
404
- context: Record<string, unknown>;
405
- message?: string;
406
- }
407
- declare class AccessDeniedError extends ForbiddenError {
408
- constructor(opts: AccessDeniedErrorOptions);
409
- }
410
- //#endregion
411
- //#region src/errors/bad-request.error.d.ts
412
- declare class BadRequestError extends NestError {
413
- constructor(opts: NestErrorOptions);
414
- }
415
- //#endregion
416
- //#region src/errors/input-validation.error.d.ts
417
- declare class InputValidationError extends NestError {
418
- constructor(errors?: ValidationError[]);
419
- }
420
- //#endregion
421
- //#region src/errors/not-found.error.d.ts
422
- declare class NotFoundError extends NestError {
423
- constructor(opts: NestErrorOptions);
424
- }
425
- //#endregion
426
- //#region src/errors/unauthorized.error.d.ts
427
- declare class UnauthorizedError extends NestError {
428
- constructor(opts: NestErrorOptions);
429
- }
430
- //#endregion
431
- //#region src/logger/logger.interfaces.d.ts
432
- type LoggerModuleOptions = LoggerOptions;
433
- type WinstonLogLevel = 'error' | 'warn' | 'info' | 'http' | 'verbose' | 'debug' | 'silly';
434
- /**
435
- * Logger logger context with specific data for logging
436
- */
437
- interface LoggerContext {
438
- /**
439
- * Scope where the message was logged
440
- * @example 'VideoService'
441
- */
442
- scope?: string;
443
- /**
444
- * Action where the message was logged
445
- * @example 'createOutput'
446
- */
447
- action?: string;
448
- /**
449
- * Request ID
450
- * Special marker to identify request in logs
451
- */
452
- requestId?: string;
453
- /**
454
- * Additional data
455
- */
456
- [key: string]: unknown;
457
- }
458
- interface InfoObject extends LoggerContext {
459
- message: string;
460
- }
461
- interface LoggerModuleOptionsFactory {
462
- createLoggerModuleOptions(): Promise<LoggerModuleOptions> | LoggerModuleOptions;
463
- }
464
- interface LoggerModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
465
- useFactory?: (...args: any[]) => Promise<LoggerModuleOptions> | LoggerModuleOptions;
466
- inject?: any[];
467
- useClass?: Type<LoggerModuleOptionsFactory>;
468
- }
469
- /**
470
- * Error object that is destructured and logged by Logger
471
- */
472
- interface DestructuredError {
473
- /**
474
- * Error message text
475
- */
476
- message?: string;
477
- /**
478
- * Error stack from Error object (`Error.stack`)
479
- */
480
- stack?: string;
481
- /**
482
- * Error key from 'enum'
483
- * @example 'NST_SA_EMAIL_NOT_UNIQUE'
484
- */
485
- errorKey?: string;
486
- /**
487
- * HTTP status code
488
- * @example 400
489
- */
490
- statusCode?: number;
491
- /**
492
- * Child error.
493
- */
494
- cause?: DestructuredError;
495
- /**
496
- * Error context (additional data)
497
- */
498
- context?: LoggerContext;
499
- /**
500
- * Response body if error is HTTPError
501
- */
502
- body?: unknown;
503
- }
504
- //#endregion
505
- //#region src/logger/classes/logger.d.ts
506
- /**
507
- * Logger with context for NestJS (from NestKit)
508
- */
509
- declare class Logger {
510
- private readonly winstonLogger;
511
- private context;
512
- constructor(winstonLogger: Logger$1, context?: LoggerContext);
513
- /**
514
- * Created child logger with specific context
515
- * @param context - object with scope, action and other data
516
- * @returns - new logger with context
517
- * @example
518
- * ```ts
519
- * class SomeService {
520
- * logger: Logger;
521
- *
522
- * constructor(
523
- * @InjectLoggerFactory() private readonly loggerFactory: LoggerFactory,
524
- * ) {
525
- * // Create logger for this service
526
- * this.winstonLogger = this.winstonLoggerFactory.create({
527
- * scope: SomeService.name,
528
- * })
529
- * }
530
- *
531
- * // Create child logger for some method
532
- * getOne(id: string) {
533
- * const logger = this.winstonLogger.child({
534
- * action: this.someMethod.name,
535
- * id,
536
- * });
537
- * }
538
- * ```
539
- */
540
- child(context: LoggerContext): Logger;
541
- /**
542
- * Created child logger for nest service method
543
- * Automatically parse service method context and add it to logger context
544
- * @param name - service method name
545
- * @param ctx - service method context
546
- * @param other - custom logger context
547
- * @returns - new logger with context
548
- */
549
- forMethod(name: string, ctx?: BaseServiceMethodContext, other?: LoggerContext): Logger;
550
- /**
551
- * Set data to logger context
552
- * @param key - context data key (ex: 'firstName')
553
- * @param value - context data value (ex: 'John')
554
- */
555
- setContext(key: string, value: unknown): void;
556
- setContext(context: LoggerContext): void;
557
- /**
558
- * Get logger context data
559
- * @returns - logger context
560
- */
561
- getContext(): LoggerContext;
562
- /**
563
- * Write a 'log' level log.
564
- */
565
- log(entry: LogEntry): void;
566
- log(level: WinstonLogLevel, message: string, context?: LoggerContext): void;
567
- /**
568
- * Write a 'info' level log.
569
- */
570
- info(message: string, context?: LoggerContext): void;
571
- info(infoObject: InfoObject): void;
572
- /**
573
- * Write an 'error' level log.
574
- */
575
- error(message: string, context?: LoggerContext): void;
576
- error(message: string, error: Error, context?: LoggerContext): void;
577
- error(error: NestError): void;
578
- error(error: Error, context?: LoggerContext): void;
579
- /**
580
- * Creates plain object from error
581
- * @see {@link DestructuredError}
582
- */
583
- protected destructureError(error: unknown): DestructuredError;
584
- /**
585
- * Write a 'warn' level log.
586
- */
587
- warn(message: string, context?: LoggerContext): void;
588
- warn(infoObject: InfoObject): void;
589
- /**
590
- * Write a 'debug' level log.
591
- */
592
- debug(message: string, context?: LoggerContext): void;
593
- debug(infoObject: InfoObject): void;
594
- /**
595
- * Write a 'verbose' level log.
596
- */
597
- verbose(message: string, context?: LoggerContext): void;
598
- verbose(infoObject: InfoObject): void;
599
- }
600
- //#endregion
601
- //#region src/logger/classes/typeorm-logger.d.ts
602
- declare class TypeOrmLoggerOptions {
603
- enabled?: boolean;
604
- logger: Logger;
605
- levels?: LoggerOptions$1;
606
- }
607
- declare class TypeOrmLogger extends AbstractLogger {
608
- logger: Logger;
609
- constructor(opts: TypeOrmLoggerOptions);
610
- /**
611
- * Write log to specific output.
612
- */
613
- protected writeLog(level: LogLevel$1,
614
- // "query" | "schema" | "error" | "warn" | "info" | "log" | "migration";
615
- logMessage: LogMessage | LogMessage[]): void;
616
- private getCtx;
617
- }
618
- //#endregion
619
- //#region src/logger/classes/logger-factory.d.ts
620
- /**
621
- * Logger factory for creating loggers with predefined context
622
- * Factory is singleton, so it keep original winston `Logger` instance
623
- * and is can be injected to any service
624
- */
625
- declare class LoggerFactory {
626
- private readonly winstonLogger;
627
- private context;
628
- constructor(winstonLogger: Logger$1, context?: LoggerContext);
629
- /**
630
- * Created new logger with specific context merge it with global context
631
- * @param context - specific action with scope, and other data
632
- * @returns - new logger with context
633
- * @example
634
- * ```ts
635
- * class SomeService {
636
- * logger: Logger;
637
- *
638
- * constructor(
639
- * @InjectLoggerFactory() private readonly loggerFactory: LoggerFactory,
640
- * ) {
641
- * // Create logger for this service
642
- * this.logger = this.loggerFactory.create({
643
- * scope: SomeService.name,
644
- * })
645
- * }
646
- * ```
647
- */
648
- create(context?: LoggerContext): Logger;
649
- createTypeOrmLogger(opts: Omit<TypeOrmLoggerOptions, 'logger'>): TypeOrmLogger;
650
- }
651
- //#endregion
652
- //#region src/logger/logger.constants.d.ts
653
- /**
654
- * Injection token for Winston logger module configuration options
655
- */
656
- declare const NESTKIT_LOGGER_MODULE_OPTIONS = "NestKitLoggerModuleOptions";
657
- /**
658
- * Injection token for the Winston logger instance provider
659
- */
660
- declare const NESTKIT_WINSTON_LOGGER_PROVIDER = "NestKitLogger";
661
- /**
662
- * Injection token for the main NestKit logger provider
663
- */
664
- declare const NESTKIT_LOGGER_PROVIDER = "NestKitLogger";
665
- /**
666
- * Injection token for the NestJS system logger provider
667
- */
668
- declare const NESTKIT_SYSTEM_LOGGER_PROVIDER = "NestKitSystemLogger";
669
- /**
670
- * Injection token for the logger factory provider
671
- */
672
- declare const NESTKIT_LOGGER_FACTORY_PROVIDER = "NestKitLoggerFactory";
673
- //#endregion
674
- //#region src/logger/logger.module.d.ts
675
- declare class LoggerModule {
676
- static forRoot(options: LoggerModuleOptions): DynamicModule;
677
- static forRootAsync(options: LoggerModuleAsyncOptions): DynamicModule;
678
- static createLogger(options: LoggerModuleOptions): LoggerService;
679
- }
680
- //#endregion
681
- //#region src/logger/logger.providers.d.ts
682
- /**
683
- * Syntax sugar. Injects logger via NESTKIT_LOGGER_PROVIDER token
684
- * @example
685
- * ```ts
686
- * class SomeService {
687
- * constructor(
688
- * @InjectLogger() private readonly logger: Logger
689
- * ) {}
690
- * ```
691
- */
692
- declare const InjectLogger: () => PropertyDecorator & ParameterDecorator;
693
- /**
694
- * Syntax sugar. Injects winston logger factory by WINSTON_MODULE_FACTORY_PROVIDER token
695
- * @example
696
- * ```ts
697
- * class SomeService {
698
- * constructor(
699
- * @InjectLoggerFactory() private readonly loggerFactory: LoggerFactory
700
- * ) {}
701
- * ```
702
- */
703
- declare const InjectLoggerFactory: () => PropertyDecorator & ParameterDecorator;
704
- declare const createNestLogger: (loggerOpts: LoggerModuleOptions) => Logger$1;
705
- declare const createLoggerProviders: (loggerOpts: LoggerModuleOptions) => Provider[];
706
- declare const createLoggerAsyncProviders: (options: LoggerModuleAsyncOptions) => Provider[];
707
- //#endregion
708
- //#region src/logger/winston.tools.d.ts
709
- /**
710
- * Options for nest-like formatting
711
- */
712
- interface CreatePrettyMessageOptions {
713
- /**
714
- * Application name
715
- * @example 'Jetstream'
716
- */
717
- appName: string;
718
- /**
719
- * Log level (info, error, warn, debug, verbose, log)
720
- * @example 'info'
721
- */
722
- level: LogLevel;
723
- /**
724
- * Timestamp in ISO 8601 format
725
- * @example '2021-06-10T16:33:42.000Z'
726
- */
727
- timestamp: string;
728
- /**
729
- * Message text
730
- * @example 'Failed to create cloudlfare output'
731
- */
732
- message: string;
733
- /**
734
- * Scope where the message was logged
735
- * @example 'VideoService'
736
- */
737
- scope?: string;
738
- /**
739
- * Action where the message was logged
740
- * @example 'createOutput'
741
- */
742
- action?: string;
743
- /**
744
- * Error stack from Error object (`Error.stack`)
745
- */
746
- stack?: string;
747
- /**
748
- * Message context (additional data)
749
- * @example { id: 'xxx' }
750
- */
751
- context: Record<string, unknown>;
752
- /**
753
- * Error key from 'enum'
754
- * @example 'NST_SA_EMAIL_NOT_UNIQUE'
755
- */
756
- errorKey?: string;
757
- /**
758
- * HTTP status code
759
- * @example '400'
760
- */
761
- statusCode?: string;
762
- /**
763
- * Parent path for child errors
764
- * @example 'MainService.start --> VideoService.createOutput'
765
- */
766
- parentPath?: string;
767
- /**
768
- * Error cause
769
- */
770
- cause?: DestructuredError;
771
- /**
772
- * Recursion depth
773
- * @example 0
774
- */
775
- deep?: number;
776
- }
777
- /**
778
- * Create a pretty message for the logger with nest-like formatting
779
- * Use recursion to print child errors
780
- * @param vars - message variables
781
- * @returns - formatted message
782
- * @example
783
- * [Jetstream] - 6/10/2022, 4:33:42 PM ERROR [VideoService.createOutput] Failed to create cloudlfare output
784
- */
785
- declare const createPrettyMessage: ({
786
- appName,
787
- action,
788
- level,
789
- timestamp,
790
- message,
791
- scope,
792
- stack,
793
- errorKey,
794
- context,
795
- parentPath,
796
- cause,
797
- deep
798
- }: CreatePrettyMessageOptions) => string;
799
- /**
800
- * Create a nest-like console format
801
- * @param appName - App name (Jetstream, WHATSBIBLE, etc.)
802
- * @returns Winston format
803
- */
804
- declare const nestLikeConsoleFormat: (appName?: string) => Format;
805
- //#endregion
806
- //#region src/configs/logger.config.d.ts
807
- /**
808
- * NestJS injection token for Logger config
809
- */
810
- declare const LOGGER_CONFIG_TOKEN = "LOGGER_CONFIG_TOKEN";
811
- declare const InjectLoggerConfig: () => PropertyDecorator & ParameterDecorator;
812
- interface CreateLoggerConfigOptions {
813
- appName: string;
814
- useConsole?: boolean;
815
- consoleLevel?: winston.LoggerOptions['level'];
816
- transports?: winston.transport[];
817
- }
818
- /**
819
- * Create NestJS Logger config
820
- * @example
821
- * ```ts
822
- * // src/config/index.ts
823
- *
824
- * import { createLoggerConfig } from '#/dist/configs';
825
- *
826
- * export const LoggerConfig = createLoggerConfig();
827
- * ```
828
- */
829
- declare const createLoggerConfig: (opts: CreateLoggerConfigOptions) => (() => winston.LoggerOptions) & _nestjs_config0.ConfigFactoryKeyHost<winston.LoggerOptions>;
830
- //#endregion
831
- //#region src/abstracts/nestjs-service.d.ts
832
- /**
833
- * Abstract service class for NestJS services
834
- * Automatically initializes logger with the constructor name as scope
835
- */
836
- declare abstract class NestJsService implements OnModuleInit {
837
- protected readonly loggerFactory: LoggerFactory;
838
- protected logger: Logger;
839
- /**
840
- * Initialize logger using the constructor name as scope
841
- */
842
- onModuleInit(): void;
843
- }
844
- //#endregion
845
- //#region src/abstracts/nestjs-resource-service.d.ts
846
- interface NestJsResourceFilter {
847
- ids?: string[];
848
- search?: string;
849
- }
850
- interface GetOneByOptions {
851
- id?: string;
852
- }
853
- interface NestJsResourceServiceParams<T extends BaseEntity, GOBO extends GetOneByOptions, F extends NestJsResourceFilter, O> {
854
- entity: {
855
- type: Type<T>;
856
- idPrefix: string;
857
- alias: string;
858
- };
859
- types: {
860
- getByOpts: GOBO;
861
- filter: F;
862
- orderBy: O;
863
- };
864
- }
865
- declare abstract class NestJsResourceService<T extends BaseEntity, GOBO extends GetOneByOptions, F extends NestJsResourceFilter, O> extends NestJsService {
866
- private readonly params;
867
- constructor(params: NestJsResourceServiceParams<T, GOBO, F, O>);
868
- protected readonly idService: IdService;
869
- protected readonly dataSource: DataSource;
870
- get repository(): Repository<T>;
871
- protected generateEntityId(): string;
872
- get entityName(): string;
873
- get alias(): string;
874
- getOneBy<GOBO extends GetOneByOptions>(opts: GOBO): Promise<MaybeNull<T>>;
875
- getOne(id: string): Promise<MaybeNull<T>>;
876
- getOneByOrFail<GOBO extends GetOneByOptions>(opts: GOBO, ctx: BaseServiceMethodContext): Promise<T>;
877
- protected getOneOrFail(id: string, ctx: BaseServiceMethodContext): Promise<T>;
878
- protected applyFilterToQuery(query: SelectQueryBuilder<T>, filter?: F): void;
879
- protected applySearchToQuery(query: SelectQueryBuilder<T>, search?: string): void;
880
- protected applyOrderByToQuery(query: SelectQueryBuilder<T>, orderBy: O): void;
881
- }
882
- //#endregion
883
- //#region src/configs/db.config.d.ts
884
- /**
885
- * NestJS injection token for postgres db config
886
- */
887
- declare const DB_CONFIG_TOKEN = "DB_CONFIG_TOKEN";
888
- declare const InjectDbConfig: () => PropertyDecorator & ParameterDecorator;
889
- /**
890
- * Postgres Database Config
891
- */
892
- declare const createDbConfig: (opts?: Partial<PostgresConnectionOptions>) => (() => PostgresConnectionOptions) & _nestjs_config0.ConfigFactoryKeyHost<PostgresConnectionOptions>;
893
- //#endregion
894
- //#region src/enums/app-server.enum.d.ts
895
- /**
896
- * Enum for the NestJS server mode
897
- */
898
- declare enum AppServer {
899
- /**
900
- * NestJS HTTP server with GraphQL
901
- */
902
- HTTP = "http",
903
- /**
904
- * NestJS gRPC server
905
- */
906
- GRPC = "grpc",
907
- /**
908
- * NestJS WebSocket server
909
- */
910
- WS = "ws",
911
- /**
912
- * Run as a worker
913
- */
914
- WORKER = "worker",
915
- /**
916
- * Run as an agent
917
- */
918
- AGENT = "agent",
919
- /**
920
- * Run as an bot (e.g. Slack bot)
921
- */
922
- BOT = "bot",
923
- /**
924
- * Run as Cloud Run job
925
- */
926
- CLOUDRUN_JOB = "cloudrun-job",
927
- }
928
- //#endregion
929
- //#region src/enums/worker-mode.enum.d.ts
930
- declare enum WorkerMode {
931
- /**
932
- * Run jobs in loop
933
- */
934
- LOOP = "loop",
935
- /**
936
- * Run one job and exit
937
- */
938
- ONE_JOB = "one-job",
939
- }
940
- //#endregion
941
- //#region src/tools/compose.d.ts
942
- type Constructor = new (...args: any[]) => any;
943
- type MixinFunction<TInput, TOutput> = (source: TInput) => TOutput;
944
- /**
945
- * Compose a class by applying mixins to it.
946
- * The code is inspired by https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/, its
947
- * just that I have added the support for static types too.
948
- *
949
- * @param baseClass - The base class to extend
950
- * @param mixins - One or more mixin functions to apply sequentially
951
- * @returns The composed class with all mixins applied
952
- */
953
- declare function compose<TBase extends Constructor, TResult1>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>): TResult1;
954
- declare function compose<TBase extends Constructor, TResult1, TResult2>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>): TResult2;
955
- declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>, mixin3: MixinFunction<TResult2, TResult3>): TResult3;
956
- declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3, TResult4>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>, mixin3: MixinFunction<TResult2, TResult3>, mixin4: MixinFunction<TResult3, TResult4>): TResult4;
957
- declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3, TResult4, TResult5>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>, mixin3: MixinFunction<TResult2, TResult3>, mixin4: MixinFunction<TResult3, TResult4>, mixin5: MixinFunction<TResult4, TResult5>): TResult5;
958
- declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3, TResult4, TResult5, TResult6>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>, mixin3: MixinFunction<TResult2, TResult3>, mixin4: MixinFunction<TResult3, TResult4>, mixin5: MixinFunction<TResult4, TResult5>, mixin6: MixinFunction<TResult5, TResult6>): TResult6;
959
- declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3, TResult4, TResult5, TResult6, TResult7>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>, mixin3: MixinFunction<TResult2, TResult3>, mixin4: MixinFunction<TResult3, TResult4>, mixin5: MixinFunction<TResult4, TResult5>, mixin6: MixinFunction<TResult5, TResult6>, mixin7: MixinFunction<TResult6, TResult7>): TResult7;
960
- declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3, TResult4, TResult5, TResult6, TResult7, TResult8>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>, mixin3: MixinFunction<TResult2, TResult3>, mixin4: MixinFunction<TResult3, TResult4>, mixin5: MixinFunction<TResult4, TResult5>, mixin6: MixinFunction<TResult5, TResult6>, mixin7: MixinFunction<TResult6, TResult7>, mixin8: MixinFunction<TResult7, TResult8>): TResult8;
961
- declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3, TResult4, TResult5, TResult6, TResult7, TResult8, TResult9>(baseClass: TBase, mixin1: MixinFunction<TBase, TResult1>, mixin2: MixinFunction<TResult1, TResult2>, mixin3: MixinFunction<TResult2, TResult3>, mixin4: MixinFunction<TResult3, TResult4>, mixin5: MixinFunction<TResult4, TResult5>, mixin6: MixinFunction<TResult5, TResult6>, mixin7: MixinFunction<TResult6, TResult7>, mixin8: MixinFunction<TResult7, TResult8>, mixin9: MixinFunction<TResult8, TResult9>): TResult9;
962
- //#endregion
963
7
  //#region src/tools/convert-to-bigint.d.ts
8
+
964
9
  /**
965
10
  * Converts a number or string value to a BigInt, preserving null and undefined values.
966
11
  *
@@ -979,66 +24,6 @@ declare function compose<TBase extends Constructor, TResult1, TResult2, TResult3
979
24
  */
980
25
  declare const convertToBigInt: (value: number | string | undefined | null) => bigint | undefined | null;
981
26
  //#endregion
982
- //#region src/types/list-meta.d.ts
983
- interface ListMeta {
984
- /**
985
- * Total count of items
986
- */
987
- total?: number;
988
- /**
989
- * Count of items in current page
990
- */
991
- limit?: number;
992
- /**
993
- * Offset of current page
994
- */
995
- offset?: number;
996
- }
997
- //#endregion
998
- //#region src/tools/create-list-meta.d.ts
999
- interface CreateListMetaOptions<T extends ObjectLiteral> {
1000
- /**
1001
- * Typeorm query builder
1002
- */
1003
- query: SelectQueryBuilder<T>;
1004
- /**
1005
- * If true, total count will be calculated by additional SELECT COUNT.
1006
- */
1007
- needCountTotal?: boolean;
1008
- /**
1009
- * Limit of items
1010
- */
1011
- limit?: number;
1012
- /**
1013
- * Offset of items
1014
- */
1015
- offset?: number;
1016
- }
1017
- /**
1018
- * Create list meta object
1019
- * @returns list meta object
1020
- * @example
1021
- * class UsersService {
1022
- * async getMany(opts: GetManyUsersOptions): Promise<[User[], ListMeta]> {
1023
- * ...
1024
- * return Promise.all([
1025
- * query.getMany(),
1026
- * createListMeta<User>({
1027
- * query,
1028
- * needCountTotal,
1029
- * limit,
1030
- * offset,
1031
- * }),
1032
- * ]);
1033
- * }
1034
- */
1035
- declare const createListMeta: <T extends ObjectLiteral>({
1036
- query,
1037
- needCountTotal,
1038
- limit,
1039
- offset
1040
- }: CreateListMetaOptions<T>) => Promise<ListMeta>;
1041
- //#endregion
1042
27
  //#region src/tools/define-statuses.d.ts
1043
28
  /**
1044
29
  * Define statuses. Returns array of statuses from filter or default statuses
@@ -1074,71 +59,6 @@ declare const defineStatuses: <T>(statuses: T[] | undefined, defaultStatuses: T[
1074
59
  * ```
1075
60
  */
1076
61
  declare const validateEnv: <T>(cls: Type<T>) => T;
1077
- /**
1078
- * Returns a string with a dash prefix based on the current environment.
1079
- * If the environment is development or local, returns '-dev'.
1080
- * If the environment is stage, returns '-stage'.
1081
- * Otherwise, returns an empty string.
1082
- *
1083
- * @returns a string with a dash prefix based on the current environment
1084
- * @example
1085
- * ```typescript
1086
- * const name = `my-app${withDashEnv()}`;
1087
- * ```
1088
- */
1089
- declare const withDashEnv: () => "-dev" | "-stage" | "";
1090
- /**
1091
- * Returns a string with a dash prefix based on the current environment.
1092
- * If the environment is development or local, returns '.dev'.
1093
- * If the environment is stage, returns '.stage'.
1094
- * Otherwise, returns an empty string.
1095
- *
1096
- * @returns a string with a dot prefix based on the current environment
1097
- * @example
1098
- * ```typescript
1099
- * const name = `config${withDotEnv()}`;
1100
- * ```
1101
- */
1102
- declare const withDotEnv: () => "" | ".dev" | ".stage";
1103
- /**
1104
- * Returns a string with a colon prefix based on the current environment.
1105
- * If the environment is development or local, returns ':dev'.
1106
- * If the environment is stage, returns ':stage'.
1107
- * Otherwise, returns an empty string.
1108
- *
1109
- * @returns a string with a colon prefix based on the current environment
1110
- * @example
1111
- * ```typescript
1112
- * const name = `my:app${withColonEnv()}`;
1113
- * ```
1114
- */
1115
- declare const withColonEnv: () => "" | ":dev" | ":stage";
1116
- /**
1117
- * Returns a string with an underscore prefix based on the current environment.
1118
- * If the environment is development or local, returns '_dev'.
1119
- * If the environment is stage, returns '_stage'.
1120
- * Otherwise, returns an empty string.
1121
- *
1122
- * @returns a string with an underscore prefix based on the current environment
1123
- * @example
1124
- * ```typescript
1125
- * const name = `my_app${withUnderscoreEnv()}`;
1126
- * ```
1127
- */
1128
- declare const withUnderscoreEnv: () => "" | "_dev" | "_stage";
1129
- //#endregion
1130
- //#region src/tools/fetch-total-with-query.d.ts
1131
- /**
1132
- * Returns total count of items with typeorm query
1133
- * @param query - typeorm query builder
1134
- * @returns total count of items
1135
- */
1136
- /**
1137
- * Returns total count of items with typeorm query
1138
- * @param query - typeorm query builder
1139
- * @returns total count of items
1140
- */
1141
- declare const fetchTotalWithQuery: <T extends ObjectLiteral>(query: SelectQueryBuilder<T>) => Promise<number>;
1142
62
  //#endregion
1143
63
  //#region src/tools/generate-entity-id.d.ts
1144
64
  /**
@@ -1171,21 +91,6 @@ interface NestExpressRequest extends Request {
1171
91
  //#region src/tools/get-request-language.d.ts
1172
92
  declare const getRequestLanguage: (req: NestExpressRequest, fallbackLanguage: string) => string;
1173
93
  //#endregion
1174
- //#region src/tools/postgres/locale-to-pg-collate.d.ts
1175
- /**
1176
- * Converts a locale string to a PostgreSQL collation identifier.
1177
- *
1178
- * @param locale - The locale string to convert (e.g., 'uk', 'en')
1179
- * @returns The PostgreSQL collation identifier (e.g., 'uk_UA', 'en_US')
1180
- *
1181
- * @example
1182
- * ```typescript
1183
- * localeToPgCollate('uk') // returns 'uk_UA'
1184
- * localeToPgCollate('en') // returns 'en_US'
1185
- * ```
1186
- */
1187
- declare const localeToPgCollate: (locale: string) => string;
1188
- //#endregion
1189
94
  //#region src/tools/remove-undefined-properties.d.ts
1190
95
  type DefinedValuesOnly<T> = { [K in keyof T]: T[K] extends undefined ? never : K }[keyof T];
1191
96
  type UndefinedRemoved<T> = { [K in DefinedValuesOnly<T>]: T[K] };
@@ -1228,6 +133,21 @@ declare const pauseWithPromise: (ms: number) => Promise<void>;
1228
133
  */
1229
134
  declare const wait: (ms: number) => Promise<void>;
1230
135
  //#endregion
136
+ //#region src/tools/postgres/locale-to-pg-collate.d.ts
137
+ /**
138
+ * Converts a locale string to a PostgreSQL collation identifier.
139
+ *
140
+ * @param locale - The locale string to convert (e.g., 'uk', 'en')
141
+ * @returns The PostgreSQL collation identifier (e.g., 'uk_UA', 'en_US')
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * localeToPgCollate('uk') // returns 'uk_UA'
146
+ * localeToPgCollate('en') // returns 'en_US'
147
+ * ```
148
+ */
149
+ declare const localeToPgCollate: (locale: string) => string;
150
+ //#endregion
1231
151
  //#region src/tools/typeorm/add-filter.d.ts
1232
152
  /**
1233
153
  * Adds a filter condition to a TypeORM SelectQueryBuilder based on the provided field and value(s).
@@ -1284,28 +204,6 @@ declare const addFilterByField: <T extends ObjectLiteral, K$1 extends (keyof T &
1284
204
  */
1285
205
  declare const ensureInnerJoin: <T extends ObjectLiteral>(query: SelectQueryBuilder<T>, entity: Function | string, alias: string, condition?: string) => void;
1286
206
  //#endregion
1287
- //#region src/tools/typeorm/ensure-left-join.d.ts
1288
- /**
1289
- * Ensures a left join is added to a TypeORM query builder if the alias is not already in use.
1290
- *
1291
- * This function checks if the specified alias is already being used in the query.
1292
- * If the alias is available, it performs a left join with the provided entity, alias, and optional condition.
1293
- * If the alias is already busy, the function returns early without modifying the query.
1294
- *
1295
- * @template T - The entity type that extends ObjectLiteral
1296
- * @param query - The TypeORM SelectQueryBuilder instance to add the left join to
1297
- * @param entity - The entity class (Function) or table name (string) to join
1298
- * @param alias - The alias name to use for the joined entity
1299
- * @param condition - Optional join condition as a string (e.g., "alias.id = entity.foreignId")
1300
- * @returns void
1301
- *
1302
- * @example
1303
- * ```typescript
1304
- * ensureLeftJoin(queryBuilder, User, 'user', 'user.id = post.userId');
1305
- * ```
1306
- */
1307
- declare const ensureLeftJoin: <T extends ObjectLiteral>(query: SelectQueryBuilder<T>, entity: Function | string, alias: string, condition?: string) => void;
1308
- //#endregion
1309
207
  //#region src/tools/typeorm/is-alias-already-busy.d.ts
1310
208
  /**
1311
209
  * Checks if a given alias is already used in the query builder's join attributes.
@@ -1330,61 +228,5 @@ declare const ensureLeftJoin: <T extends ObjectLiteral>(query: SelectQueryBuilde
1330
228
  */
1331
229
  declare const isAliasAlreadyBusy: <T extends ObjectLiteral>(query: SelectQueryBuilder<T>, alias: string) => boolean;
1332
230
  //#endregion
1333
- //#region src/validation/validation-pipe.d.ts
1334
- declare class NestKitValidationPipe extends ValidationPipe {
1335
- createExceptionFactory(): (validationErrors?: ValidationError[]) => any;
1336
- }
1337
- //#endregion
1338
- //#region src/exceptions/http-exception-response.d.ts
1339
- /**
1340
- * NestJS HttpException response object
1341
- * @example
1342
- * exception.getResponse()
1343
- */
1344
- interface HttpExceptionResponse {
1345
- /**
1346
- * Error message text
1347
- */
1348
- message: string;
1349
- /**
1350
- * Error key from 'enum'
1351
- */
1352
- key: string;
1353
- /**
1354
- * Error object
1355
- */
1356
- error?: Error;
1357
- /**
1358
- * Error context (additional data)
1359
- */
1360
- context: LoggerContext;
1361
- /**
1362
- * Don't log error
1363
- */
1364
- silent?: boolean;
1365
- }
1366
- //#endregion
1367
- //#region src/exceptions/http-exceptions.filter.d.ts
1368
- /**
1369
- * Http exception filter for NestJS
1370
- * It is used to correctly log all http exceptions
1371
- * @deprecated use NestErrorFilter instead
1372
- * @see NestErrorFilter
1373
- * @example
1374
- * ```ts
1375
- * // main.ts
1376
- * const { httpAdapter } = app.get(HttpAdapterHost);
1377
- * const loggerFactory = app.get(WINSTON_MODULE_FACTORY_PROVIDER);
1378
- * app.useGlobalFilters(new HttpExceptionFilter(httpAdapter, loggerFactory));
1379
- * ```
1380
- */
1381
- declare class HttpExceptionFilter {
1382
- protected readonly applicationRef: HttpServer;
1383
- private readonly loggerFactory;
1384
- private readonly logger;
1385
- constructor(applicationRef: HttpServer, loggerFactory: LoggerFactory);
1386
- catch(exception: HttpException, host: ArgumentsHost): HttpException | undefined;
1387
- }
1388
- //#endregion
1389
- export { APP_CONFIG_TOKEN, AccessDeniedError, AccessDeniedErrorOptions, AppConfigEnvironmentVariables, AppConfigOptions, AppConfigType, AppEnv, AppMode, AppServer, BadRequestError, BasePlatformMethodContext, BaseServiceMethodContext, Constructor, CreateListMetaOptions, CreateLoggerConfigOptions, CreatePrettyMessageOptions, CurrentUser, DB_CONFIG_TOKEN, DestructuredError, ForbiddenError, GetOneByOptions, HttpExceptionFilter, HttpExceptionResponse, IBaseActionContext, InfoObject, InjectAppConfig, InjectDbConfig, InjectLogger, InjectLoggerConfig, InjectLoggerFactory, InputValidationError, LOGGER_CONFIG_TOKEN, Logger, LoggerContext, LoggerFactory, LoggerModule, LoggerModuleAsyncOptions, LoggerModuleOptions, LoggerModuleOptionsFactory, NESTKIT_LOGGER_FACTORY_PROVIDER, NESTKIT_LOGGER_MODULE_OPTIONS, NESTKIT_LOGGER_PROVIDER, NESTKIT_SYSTEM_LOGGER_PROVIDER, NESTKIT_WINSTON_LOGGER_PROVIDER, NestError, NestErrorOptions, NestJsResourceFilter, NestJsResourceService, NestJsResourceServiceParams, NestJsService, NestKitValidationPipe, NestSystemLogger, NotFoundError, TypeOrmLogger, TypeOrmLoggerOptions, UnauthorizedError, WinstonLogLevel, WorkerMode, addFilterByField, compose, convertToBigInt, createAppConfig, createDbConfig, createListMeta, createLoggerAsyncProviders, createLoggerConfig, createLoggerProviders, createNestLogger, createPrettyMessage, defineStatuses, ensureInnerJoin, ensureLeftJoin, extractRequestId, fetchTotalWithQuery, generateEntityId, generateRequestId, getRequestLanguage, isAliasAlreadyBusy, isObject, localeToPgCollate, nestLikeConsoleFormat, pauseWithPromise, removeUndefinedProperties, stringifyOpts, validateEnv, wait, withColonEnv, withDashEnv, withDotEnv, withUnderscoreEnv };
231
+ export { addFilterByField, convertToBigInt, defineStatuses, ensureInnerJoin, extractRequestId, generateEntityId, generateRequestId, getRequestLanguage, isAliasAlreadyBusy, localeToPgCollate, pauseWithPromise, removeUndefinedProperties, stringifyOpts, validateEnv, wait };
1390
232
  //# sourceMappingURL=index.d.ts.map