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