@cley_faye/boilerplate 3.21.2 → 4.0.1

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 (44) hide show
  1. package/README.md +7 -220
  2. package/bin/serve_spa.js +0 -1
  3. package/lib/bin/serve_spa.js +67 -39
  4. package/lib/express/middlewares/singlepageapp.d.ts +2 -2
  5. package/lib/express/middlewares/singlepageapp.js +20 -13
  6. package/lib/grunt/args.d.ts +14 -42
  7. package/lib/grunt/args.js +27 -41
  8. package/lib/grunt/reactapp/copy.d.ts +8 -34
  9. package/lib/grunt/reactapp/copy.js +47 -49
  10. package/lib/grunt/reactapp/image.d.ts +8 -23
  11. package/lib/grunt/reactapp/image.js +45 -42
  12. package/lib/grunt/reactapp/pug.d.ts +8 -30
  13. package/lib/grunt/reactapp/pug.js +49 -50
  14. package/lib/grunt/reactapp/sass.d.ts +8 -29
  15. package/lib/grunt/reactapp/sass.js +48 -43
  16. package/lib/grunt/reactapp/util.d.ts +5 -9
  17. package/lib/grunt/reactapp/util.js +12 -15
  18. package/lib/grunt/reactapp/webpack.d.ts +10 -81
  19. package/lib/grunt/reactapp/webpack.js +72 -132
  20. package/lib/grunt/reactapp.d.ts +22 -65
  21. package/lib/grunt/reactapp.js +70 -93
  22. package/lib/grunt/util.d.ts +4 -7
  23. package/lib/grunt/util.js +5 -8
  24. package/lib/grunt.d.ts +2 -3
  25. package/lib/grunt.js +5 -5
  26. package/lib/util.js +5 -4
  27. package/package.json +24 -36
  28. package/grunt.js +0 -3
  29. package/lib/express/autoclose.d.ts +0 -17
  30. package/lib/express/autoclose.js +0 -76
  31. package/lib/express/logger.d.ts +0 -25
  32. package/lib/express/logger.js +0 -132
  33. package/lib/express/middlewares/bodylogger.d.ts +0 -9
  34. package/lib/express/middlewares/bodylogger.js +0 -90
  35. package/lib/express/pipelinebuilder.d.ts +0 -115
  36. package/lib/express/pipelinebuilder.js +0 -288
  37. package/lib/express/unprocessableentityerror.d.ts +0 -8
  38. package/lib/express/unprocessableentityerror.js +0 -57
  39. package/lib/express.d.ts +0 -158
  40. package/lib/express.js +0 -218
  41. package/lib/repl.d.ts +0 -27
  42. package/lib/repl.js +0 -68
  43. package/lib/winston.d.ts +0 -38
  44. package/lib/winston.js +0 -224
@@ -1,57 +0,0 @@
1
- /**
2
- * @license
3
- * @preserve
4
- * MIT License
5
- *
6
- * Copyright (c) 2021 Gabriel Paul "Cley Faye" Risterucci
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
25
- *
26
- */
27
- "use strict";
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.get422Fields = void 0;
30
- const UNPROCESSABLE_ENTITY = 422;
31
- const get422Fields = (error) => {
32
- const { statusCode, cause, fields } = error;
33
- if (statusCode !== UNPROCESSABLE_ENTITY
34
- || !cause
35
- || !Array.isArray(cause)
36
- || !fields
37
- || !Array.isArray(fields)) {
38
- return;
39
- }
40
- let fieldsStr;
41
- try {
42
- fieldsStr = JSON.stringify(fields);
43
- }
44
- catch {
45
- fieldsStr = "<error>";
46
- }
47
- let errorsStr;
48
- try {
49
- errorsStr = JSON.stringify(cause);
50
- }
51
- catch {
52
- errorsStr = "<error>";
53
- }
54
- const message = `${error.message}: fields=${fieldsStr}, errors=${errorsStr}`;
55
- return { message, fields, errors: cause };
56
- };
57
- exports.get422Fields = get422Fields;
package/lib/express.d.ts DELETED
@@ -1,158 +0,0 @@
1
- /// <reference types="express-serve-static-core" />
2
- /// <reference types="node" />
3
- import { Server } from "net";
4
- import express from "express";
5
- import winston from "winston";
6
- import { PipelineSettings, LogFunction } from "./express/pipelinebuilder.js";
7
- /** Create the full processing pipeline for an Express server
8
- *
9
- * This function creates a pipeline this way:
10
- * - Pass generic middlewares (see options)
11
- * - Pass custom top-level middlewares
12
- * - Pass logging middleware (see options)
13
- * - Pass routes
14
- * - Pass error logging middleware (see options)
15
- * - Pass error handlers
16
- * - Fallback to a default error handler (see below)
17
- *
18
- * The default error handler is a layer above the express default error
19
- * handler.
20
- * If it is reached, it will check if the error object looks like an
21
- * http-errors exception, and if that's the case, send the error code and the
22
- * message (if applicable).
23
- * If the request accepts json, a json object with the error is returned.
24
- * Otherwise text is returned.
25
- *
26
- * For convenience, providing timestamp and collapseNodeModules here will automatically
27
- * update the basic consoleLogger configuration.
28
- *
29
- * @param settings
30
- *
31
- * @param [settings.topLevels]
32
- * List top-level middlewares. See routes.
33
- *
34
- * @param [settings.routes]
35
- * List routes and routers.
36
- * For each router and function, a simple "use()" call is used.
37
- * If an object is provided, it must have two properties:
38
- * - route: the actual route to listen to
39
- * - handler: either a function, a router, or an array of functions that will
40
- * be called in sequence on this request.
41
- * - method: the method ("get", "post", "put", "options"). If missing,
42
- * default to "get".
43
- *
44
- * @param [settings.statics]
45
- * List of directory to serve as static content.
46
- * Can be either a string (the path) or an object with the following
47
- * properties:
48
- * - root: the root in the filesystem for this static provider
49
- * - options: (optional) the options to pass to static()
50
- * - route: (optional) the route where the static resources will be served
51
- *
52
- * @param [settings.postStatics]
53
- * Register routes handled after statics. See routes.
54
- *
55
- * @param [settings.errorHandlers]
56
- * Process errors. Must be function with four parameters.
57
- *
58
- * @param [settings.options]
59
- * @param [settings.options.log]
60
- * @param [settings.options.log.route]
61
- * Log each route. Can be an object with all properties expected from
62
- * winston-express.logger()
63
- *
64
- * @param [settings.options.log.error]
65
- * Log error content. Can be either a boolean or an object with the
66
- * "collapseNodeModules" property. The error log will then display a truncated
67
- * stacktrace where lines containing node_modules are removed.
68
- *
69
- * @param [settings.options.log.timestamp]
70
- * Log timestamps on each lines
71
- *
72
- * @param [settings.options.log.logger]
73
- * An existing winston logger to use. Only the transport will be used.
74
- *
75
- * @param [settings.options.middleware]
76
- * @param [settings.options.middleware.urlencoded]
77
- * Parse URL encoded requests. Can be true or settings for urlencoded().
78
- * Default to handling application/x-www-form-urlencoded.
79
- *
80
- * @param [settings.options.middleware.text]
81
- * Parse raw text body requests. Can be true or settings for text()
82
- * Default to handling text/plain
83
- *
84
- * @param [settings.options.middleware.raw]
85
- * Parse raw body requests into an arraybuffer. Can be true or settings for
86
- * raw()
87
- * Default to handling application/octet-stream
88
- *
89
- * @param [settings.options.middleware.json]
90
- * Parse JSON body requests. Can be true or settings for json()
91
- * Default to handling application/json
92
- *
93
- * @param [settings.options.defaultErrorHandler]
94
- * Setup the default error handler. Defaults to false.
95
- *
96
- * @param [debugLog]
97
- * Function to log debug informations
98
- *
99
- * @return
100
- * The returned object can be used
101
- */
102
- export declare const createPipeline: (settings: PipelineSettings, debugLog?: LogFunction) => express.Router;
103
- /**
104
- * Configure the views rendering engine for an ExpressJS App
105
- */
106
- export declare const setViewEngine: (app: express.Express, viewEngine: string, viewsDirectory: string, extraLocals?: Record<string, string | number>) => void;
107
- /**
108
- * Function to call when the server stops.
109
- *
110
- * This is usually triggered by a SIGTERM.
111
- *
112
- * If the function returns "true", it prevent the process from stopping.
113
- * Otherwise `process.exit()` is called.
114
- */
115
- type ShutdownFunction = () => Promise<boolean | undefined> | boolean | undefined;
116
- export interface StartDefinition {
117
- app: express.Application;
118
- /** @deprecated use listenInterface instead */
119
- allowNonLocal?: boolean;
120
- /**
121
- * Which interface to listen on.
122
- *
123
- * Defaults to `false` which means listen only on localhost.
124
- * Set to `true` to listen on all interfaces
125
- * Set to an IP to bind on a specific interface.
126
- */
127
- listenInterface?: boolean | string;
128
- port?: number;
129
- shutdownFunction?: ShutdownFunction;
130
- logger?: winston.Logger;
131
- noReady?: boolean;
132
- }
133
- export interface StartResult {
134
- port: number;
135
- server: Server;
136
- }
137
- /** Start the server and register signal for automatic closing.
138
- *
139
- * @param app
140
- * @param [allowNonLocal]
141
- * Allow requests from outside of localhost
142
- *
143
- * @param [port]
144
- * Port to listen from. Default to a random available port.
145
- *
146
- * @param [shutdownFunction]
147
- * Function to call after the server is shutdown (all connection closed)
148
- *
149
- * @param [logger]
150
- *
151
- * @return
152
- * @property port
153
- * The port the server is listening on
154
- *
155
- * @property server
156
- */
157
- export declare const appStart: ({ app, allowNonLocal, listenInterface, port, shutdownFunction, logger, noReady, }: StartDefinition) => Promise<StartResult>;
158
- export {};
package/lib/express.js DELETED
@@ -1,218 +0,0 @@
1
- /**
2
- * @license
3
- * @preserve
4
- * MIT License
5
- *
6
- * Copyright (c) 2021 Gabriel Paul "Cley Faye" Risterucci
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
25
- *
26
- */
27
- "use strict";
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.appStart = exports.setViewEngine = exports.createPipeline = void 0;
33
- const autoclose_js_1 = require("./express/autoclose.js");
34
- const pipelinebuilder_js_1 = __importDefault(require("./express/pipelinebuilder.js"));
35
- /** Create the full processing pipeline for an Express server
36
- *
37
- * This function creates a pipeline this way:
38
- * - Pass generic middlewares (see options)
39
- * - Pass custom top-level middlewares
40
- * - Pass logging middleware (see options)
41
- * - Pass routes
42
- * - Pass error logging middleware (see options)
43
- * - Pass error handlers
44
- * - Fallback to a default error handler (see below)
45
- *
46
- * The default error handler is a layer above the express default error
47
- * handler.
48
- * If it is reached, it will check if the error object looks like an
49
- * http-errors exception, and if that's the case, send the error code and the
50
- * message (if applicable).
51
- * If the request accepts json, a json object with the error is returned.
52
- * Otherwise text is returned.
53
- *
54
- * For convenience, providing timestamp and collapseNodeModules here will automatically
55
- * update the basic consoleLogger configuration.
56
- *
57
- * @param settings
58
- *
59
- * @param [settings.topLevels]
60
- * List top-level middlewares. See routes.
61
- *
62
- * @param [settings.routes]
63
- * List routes and routers.
64
- * For each router and function, a simple "use()" call is used.
65
- * If an object is provided, it must have two properties:
66
- * - route: the actual route to listen to
67
- * - handler: either a function, a router, or an array of functions that will
68
- * be called in sequence on this request.
69
- * - method: the method ("get", "post", "put", "options"). If missing,
70
- * default to "get".
71
- *
72
- * @param [settings.statics]
73
- * List of directory to serve as static content.
74
- * Can be either a string (the path) or an object with the following
75
- * properties:
76
- * - root: the root in the filesystem for this static provider
77
- * - options: (optional) the options to pass to static()
78
- * - route: (optional) the route where the static resources will be served
79
- *
80
- * @param [settings.postStatics]
81
- * Register routes handled after statics. See routes.
82
- *
83
- * @param [settings.errorHandlers]
84
- * Process errors. Must be function with four parameters.
85
- *
86
- * @param [settings.options]
87
- * @param [settings.options.log]
88
- * @param [settings.options.log.route]
89
- * Log each route. Can be an object with all properties expected from
90
- * winston-express.logger()
91
- *
92
- * @param [settings.options.log.error]
93
- * Log error content. Can be either a boolean or an object with the
94
- * "collapseNodeModules" property. The error log will then display a truncated
95
- * stacktrace where lines containing node_modules are removed.
96
- *
97
- * @param [settings.options.log.timestamp]
98
- * Log timestamps on each lines
99
- *
100
- * @param [settings.options.log.logger]
101
- * An existing winston logger to use. Only the transport will be used.
102
- *
103
- * @param [settings.options.middleware]
104
- * @param [settings.options.middleware.urlencoded]
105
- * Parse URL encoded requests. Can be true or settings for urlencoded().
106
- * Default to handling application/x-www-form-urlencoded.
107
- *
108
- * @param [settings.options.middleware.text]
109
- * Parse raw text body requests. Can be true or settings for text()
110
- * Default to handling text/plain
111
- *
112
- * @param [settings.options.middleware.raw]
113
- * Parse raw body requests into an arraybuffer. Can be true or settings for
114
- * raw()
115
- * Default to handling application/octet-stream
116
- *
117
- * @param [settings.options.middleware.json]
118
- * Parse JSON body requests. Can be true or settings for json()
119
- * Default to handling application/json
120
- *
121
- * @param [settings.options.defaultErrorHandler]
122
- * Setup the default error handler. Defaults to false.
123
- *
124
- * @param [debugLog]
125
- * Function to log debug informations
126
- *
127
- * @return
128
- * The returned object can be used
129
- */
130
- const createPipeline = (settings, debugLog) => {
131
- if (debugLog) {
132
- debugLog("Creating PipelineBuilder");
133
- }
134
- const builder = new pipelinebuilder_js_1.default(debugLog);
135
- return builder.createPipeline(settings);
136
- };
137
- exports.createPipeline = createPipeline;
138
- /**
139
- * Configure the views rendering engine for an ExpressJS App
140
- */
141
- const setViewEngine = (app, viewEngine, viewsDirectory, extraLocals) => {
142
- app.set("views", viewsDirectory);
143
- app.set("view engine", viewEngine);
144
- if (extraLocals) {
145
- app.locals = {
146
- ...app.locals,
147
- ...extraLocals,
148
- };
149
- }
150
- };
151
- exports.setViewEngine = setViewEngine;
152
- const handleShutdown = (logger, shutdownFunction) => () => {
153
- const fn = async () => {
154
- const noExit = shutdownFunction ? Boolean(await shutdownFunction()) : false;
155
- if (noExit)
156
- return;
157
- // We *want* to exit on server shutdown
158
- // eslint-disable-next-line no-process-exit
159
- process.exit();
160
- };
161
- fn().catch(err => {
162
- logger?.error(err);
163
- });
164
- };
165
- /** Start the server and register signal for automatic closing.
166
- *
167
- * @param app
168
- * @param [allowNonLocal]
169
- * Allow requests from outside of localhost
170
- *
171
- * @param [port]
172
- * Port to listen from. Default to a random available port.
173
- *
174
- * @param [shutdownFunction]
175
- * Function to call after the server is shutdown (all connection closed)
176
- *
177
- * @param [logger]
178
- *
179
- * @return
180
- * @property port
181
- * The port the server is listening on
182
- *
183
- * @property server
184
- */
185
- const appStart = ({ app, allowNonLocal, listenInterface, port, shutdownFunction, logger, noReady, }) => new Promise(resolve => {
186
- let server = null;
187
- const readyCallback = () => {
188
- if (server === null) {
189
- throw new Error("Server reference can not be null");
190
- }
191
- const effectivePort = server.address().port;
192
- if (logger) {
193
- logger.info(`Listening on port ${effectivePort} (PID: ${process.pid})`);
194
- }
195
- (0, autoclose_js_1.setRef)(server);
196
- (0, autoclose_js_1.setSignalHandler)();
197
- resolve({
198
- port: effectivePort,
199
- server,
200
- });
201
- if (!noReady && process.send)
202
- process.send("ready");
203
- };
204
- if (allowNonLocal !== undefined && listenInterface !== undefined) {
205
- throw new Error("You can't specify both allowNonLocal and listenInterface at the same time");
206
- }
207
- if (allowNonLocal ?? listenInterface === true) {
208
- server = app.listen(port ?? 0, readyCallback);
209
- }
210
- else if (typeof listenInterface === "string") {
211
- server = app.listen(port ?? 0, listenInterface, readyCallback);
212
- }
213
- else {
214
- server = app.listen(port ?? 0, "localhost", readyCallback);
215
- }
216
- server.on("close", handleShutdown(logger, shutdownFunction));
217
- });
218
- exports.appStart = appStart;
package/lib/repl.d.ts DELETED
@@ -1,27 +0,0 @@
1
- /** Function called when the REPL is closed */
2
- export type ReplCloseFunc = () => void;
3
- /** Mimic the required elements from a db object */
4
- interface DBLikeObject {
5
- /** db object can have a reference to an initialized sequelize instance */
6
- sequelize?: {
7
- /** Sequelize instance should have a close() method */
8
- close?: () => void;
9
- };
10
- }
11
- interface ReplArgs {
12
- /** Display a service name in the prompt */
13
- serviceName: string;
14
- /**
15
- * A DB object. If it exposes a db.sequelize.close() function, it will be called when the REPL is
16
- * closed.
17
- */
18
- db?: DBLikeObject;
19
- srv?: Record<string, unknown>;
20
- /** Extra properties to attach to the REPL context */
21
- extraContext?: Record<string, unknown>;
22
- onClose?: ReplCloseFunc;
23
- historyFile?: string;
24
- }
25
- /** Start the REPL prompt */
26
- export declare const startRepl: ({ serviceName, db, srv, extraContext, onClose, historyFile, }: ReplArgs) => void;
27
- export {};
package/lib/repl.js DELETED
@@ -1,68 +0,0 @@
1
- /**
2
- * @license
3
- * @preserve
4
- * MIT License
5
- *
6
- * Copyright (c) 2021 Gabriel Paul "Cley Faye" Risterucci
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- * SOFTWARE.
25
- *
26
- */
27
- "use strict";
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.startRepl = void 0;
33
- const repl_1 = __importDefault(require("repl"));
34
- const setupContext = (r, db, srv, extraContext) => {
35
- const doContextSetup = () => {
36
- Object.assign(r.context, {
37
- ...extraContext,
38
- db,
39
- srv,
40
- });
41
- };
42
- doContextSetup();
43
- r.on("reset", doContextSetup);
44
- };
45
- /** Configure action when the REPL is closed */
46
- const setupClose = (r, db, onClose) => {
47
- if (!db && !onClose)
48
- return;
49
- r.on("exit", () => {
50
- if (db?.sequelize?.close) {
51
- db.sequelize.close();
52
- }
53
- if (onClose) {
54
- onClose();
55
- }
56
- });
57
- };
58
- /** Start the REPL prompt */
59
- const startRepl = ({ serviceName = "", db, srv, extraContext, onClose, historyFile = ".node_repl_history", }) => {
60
- const r = repl_1.default.start({
61
- prompt: `${serviceName}> `,
62
- breakEvalOnSigint: true,
63
- });
64
- setupContext(r, db, srv, extraContext);
65
- setupClose(r, db, onClose);
66
- r.setupHistory(historyFile, () => { });
67
- };
68
- exports.startRepl = startRepl;
package/lib/winston.d.ts DELETED
@@ -1,38 +0,0 @@
1
- import winston from "winston";
2
- import { Format } from "logform";
3
- /**
4
- * Collapse useless lines in stacktrace
5
- */
6
- export declare const filterStacktrace: (message: string, extraFilter?: Array<RegExp> | RegExp) => Generator<string>;
7
- /**
8
- * Prefix all lines with the level and the timestamp if needed
9
- */
10
- export declare const prefixOutput: (level: string, message: string, timestamp: boolean | undefined) => string;
11
- export interface LogConfig {
12
- timestamp: boolean;
13
- /** @deprecated Use collapseStacktrace instead */
14
- collapseNodeModules: boolean;
15
- collapseStacktrace: boolean;
16
- stacktraceFilter?: Array<RegExp> | RegExp;
17
- }
18
- interface ExtendedErrorFields {
19
- cause?: unknown;
20
- response?: {
21
- data?: string | Record<string, unknown>;
22
- };
23
- request?: {
24
- _currentUrl?: string;
25
- };
26
- fields?: Set<string>;
27
- statusCode?: number;
28
- expose?: boolean;
29
- }
30
- export type ExtendedError = Error & ExtendedErrorFields;
31
- /** Return a string with the full error and stacktrace, including causes */
32
- export declare const filterError: (error: ExtendedError, collapseStacktrace?: boolean, extraFilter?: Array<RegExp> | RegExp) => string;
33
- export declare const customFormat: (timestamp?: boolean, collapseStacktrace?: boolean, stacktraceFilter?: Array<RegExp> | RegExp) => Format;
34
- /** Edit the configuration applied to consoleLogger */
35
- export declare const setConfig: (config: LogConfig) => void;
36
- export declare const transports: winston.transports.ConsoleTransportInstance[];
37
- export declare const consoleLogger: winston.Logger;
38
- export {};