@chatsift/pino-rotate-file 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -5
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +56 -43
- package/src/__tests__/index.test.ts +110 -0
- package/src/index.ts +120 -0
- package/dist/tsconfig.tsbuildinfo +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-2026 ChatSift
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# `@chatsift/pino-rotate-file`
|
|
2
2
|
|
|
3
|
-
[](https://github.com/chatsift/utilities/blob/main/LICENSE)
|
|
4
4
|
[](https://www.npmjs.com/package/@chatsift/pino-rotate-file)
|
|
5
|
-
[](https://github.com/chatsift/utilities/actions/workflows/ci.yml)
|
|
6
6
|
|
|
7
7
|
Simple pino transport for rotating files
|
|
8
8
|
|
|
@@ -14,10 +14,8 @@ Simple pino transport for rotating files
|
|
|
14
14
|
|
|
15
15
|
## Contributing
|
|
16
16
|
|
|
17
|
-
Please see the main [README.md](https://github.com/chatsift/
|
|
17
|
+
Please see the main [README.md](https://github.com/chatsift/utilities) for info on how to contribute to this package or the other `@chatsift` packages.
|
|
18
18
|
|
|
19
19
|
## LICENSE
|
|
20
20
|
|
|
21
21
|
This project is licensed under the MIT license.
|
|
22
|
-
|
|
23
|
-
It should, however, be noted that some packages are forks of other open source projects, and are therefore, sub-licensed.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import build from 'pino-abstract-transport';
|
|
2
2
|
import type { PrettyOptions } from 'pino-pretty';
|
|
3
|
+
/**
|
|
4
|
+
* Options for the transport
|
|
5
|
+
*/
|
|
3
6
|
export interface PinoRotateFileOptions {
|
|
4
7
|
dir: string;
|
|
5
8
|
maxAgeDays?: number;
|
|
6
9
|
mkdir?: boolean;
|
|
7
10
|
prettyOptions?: PrettyOptions;
|
|
11
|
+
/**
|
|
12
|
+
* Distinguishes this writer's files from another process writing the same `dir`, producing
|
|
13
|
+
* `<date>.<suffix>.log` instead of `<date>.log`.
|
|
14
|
+
*
|
|
15
|
+
* Needed when several processes share one directory (#355): the day file is opened in append mode, but writes are
|
|
16
|
+
* buffered and flushed in chunks that can span a line boundary, so concurrent writers interleave and corrupt
|
|
17
|
+
* each other's lines. They would also each independently decide to rotate at midnight and end each other's
|
|
18
|
+
* stream.
|
|
19
|
+
*/
|
|
20
|
+
suffix?: string | undefined;
|
|
8
21
|
}
|
|
9
22
|
export declare function pinoRotateFile(options: PinoRotateFileOptions): Promise<import("stream").Transform & build.OnUnknown>;
|
|
10
23
|
export default pinoRotateFile;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAgDD,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,yDAuClE;AAED,eAAe,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -29,23 +29,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
|
|
31
31
|
// src/index.ts
|
|
32
|
-
var
|
|
33
|
-
__export(
|
|
34
|
-
default: () =>
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
default: () => index_default,
|
|
35
35
|
pinoRotateFile: () => pinoRotateFile
|
|
36
36
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
37
|
+
module.exports = __toCommonJS(index_exports);
|
|
38
38
|
var import_node_events = require("events");
|
|
39
39
|
var import_node_fs = require("fs");
|
|
40
40
|
var import_promises = require("fs/promises");
|
|
41
41
|
var import_node_path = require("path");
|
|
42
42
|
var import_pino_abstract_transport = __toESM(require("pino-abstract-transport"));
|
|
43
43
|
var import_pino_pretty = require("pino-pretty");
|
|
44
|
-
var import_sonic_boom = require("sonic-boom");
|
|
44
|
+
var import_sonic_boom = __toESM(require("sonic-boom"));
|
|
45
45
|
var ONE_DAY = 24 * 60 * 60 * 1e3;
|
|
46
46
|
var DEFAULT_MAX_AGE_DAYS = 14;
|
|
47
|
-
function createFileName(time) {
|
|
48
|
-
|
|
47
|
+
function createFileName(time, suffix) {
|
|
48
|
+
const date = new Date(time).toISOString().split("T")[0];
|
|
49
|
+
return suffix ? `${date}.${suffix}.log` : `${date}.log`;
|
|
49
50
|
}
|
|
50
51
|
__name(createFileName, "createFileName");
|
|
51
52
|
async function cleanup(dir, maxAgeDays) {
|
|
@@ -65,7 +66,7 @@ async function cleanup(dir, maxAgeDays) {
|
|
|
65
66
|
}
|
|
66
67
|
__name(cleanup, "cleanup");
|
|
67
68
|
async function createDest(path) {
|
|
68
|
-
const stream = new import_sonic_boom.
|
|
69
|
+
const stream = new import_sonic_boom.default({ dest: path });
|
|
69
70
|
await (0, import_node_events.once)(stream, "ready");
|
|
70
71
|
return {
|
|
71
72
|
path,
|
|
@@ -89,11 +90,11 @@ async function pinoRotateFile(options) {
|
|
|
89
90
|
}
|
|
90
91
|
await (0, import_promises.access)(options.dir, import_node_fs.constants.R_OK | import_node_fs.constants.W_OK);
|
|
91
92
|
await cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);
|
|
92
|
-
let dest = await createDest((0, import_node_path.join)(options.dir, createFileName(Date.now())));
|
|
93
|
+
let dest = await createDest((0, import_node_path.join)(options.dir, createFileName(Date.now(), options.suffix)));
|
|
93
94
|
return (0, import_pino_abstract_transport.default)(
|
|
94
95
|
async (source) => {
|
|
95
96
|
for await (const payload of source) {
|
|
96
|
-
const path = (0, import_node_path.join)(options.dir, createFileName(Date.now()));
|
|
97
|
+
const path = (0, import_node_path.join)(options.dir, createFileName(Date.now(), options.suffix));
|
|
97
98
|
if (dest.path !== path) {
|
|
98
99
|
await cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);
|
|
99
100
|
await endStream(dest.stream);
|
|
@@ -115,7 +116,7 @@ async function pinoRotateFile(options) {
|
|
|
115
116
|
);
|
|
116
117
|
}
|
|
117
118
|
__name(pinoRotateFile, "pinoRotateFile");
|
|
118
|
-
var
|
|
119
|
+
var index_default = pinoRotateFile;
|
|
119
120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
120
121
|
0 && (module.exports = {
|
|
121
122
|
pinoRotateFile
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { once } from 'node:events';\nimport { constants as fsConstants } from 'node:fs';\nimport { readdir, unlink, access, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport build from 'pino-abstract-transport';\nimport type { PrettyOptions } from 'pino-pretty';\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { once } from 'node:events';\nimport { constants as fsConstants } from 'node:fs';\nimport { readdir, unlink, access, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport build from 'pino-abstract-transport';\nimport type { PrettyOptions } from 'pino-pretty';\nimport { prettyFactory } from 'pino-pretty';\nimport SonicBoom from 'sonic-boom';\n\nconst ONE_DAY = 24 * 60 * 60 * 1_000;\nconst DEFAULT_MAX_AGE_DAYS = 14;\n\n/**\n * Options for the transport\n */\nexport interface PinoRotateFileOptions {\n\tdir: string;\n\tmaxAgeDays?: number;\n\tmkdir?: boolean;\n\tprettyOptions?: PrettyOptions;\n\t/**\n\t * Distinguishes this writer's files from another process writing the same `dir`, producing\n\t * `<date>.<suffix>.log` instead of `<date>.log`.\n\t *\n\t * Needed when several processes share one directory (#355): the day file is opened in append mode, but writes are\n\t * buffered and flushed in chunks that can span a line boundary, so concurrent writers interleave and corrupt\n\t * each other's lines. They would also each independently decide to rotate at midnight and end each other's\n\t * stream.\n\t */\n\tsuffix?: string | undefined;\n}\n\ninterface Dest {\n\tpath: string;\n\tstream: SonicBoom;\n}\n\nfunction createFileName(time: number, suffix?: string): string {\n\tconst date = new Date(time).toISOString().split('T')[0]!;\n\t// The date stays the first dot-segment either way, which is what `cleanup` parses to decide age.\n\treturn suffix ? `${date}.${suffix}.log` : `${date}.log`;\n}\n\nasync function cleanup(dir: string, maxAgeDays: number): Promise<void> {\n\tconst files = await readdir(dir);\n\tconst promises: Promise<void>[] = [];\n\n\tfor (const file of files) {\n\t\tif (!file.endsWith('.log')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst date = new Date(file.split('.')[0]!).getTime();\n\t\tconst now = Date.now();\n\n\t\tif (now - date >= maxAgeDays * ONE_DAY) {\n\t\t\tpromises.push(unlink(join(dir, file)));\n\t\t}\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function createDest(path: string): Promise<Dest> {\n\tconst stream = new SonicBoom({ dest: path });\n\tawait once(stream, 'ready');\n\n\treturn {\n\t\tpath,\n\t\tstream,\n\t};\n}\n\nasync function endStream(stream: SonicBoom) {\n\tstream.end();\n\tawait once(stream, 'close');\n}\n\nexport async function pinoRotateFile(options: PinoRotateFileOptions) {\n\tconst pretty = options.prettyOptions ? prettyFactory(options.prettyOptions) : null;\n\n\tif (options.mkdir) {\n\t\ttry {\n\t\t\tawait access(options.dir, fsConstants.F_OK);\n\t\t} catch {\n\t\t\tawait mkdir(options.dir, { recursive: true });\n\t\t}\n\t}\n\n\tawait access(options.dir, fsConstants.R_OK | fsConstants.W_OK);\n\tawait cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);\n\n\tlet dest = await createDest(join(options.dir, createFileName(Date.now(), options.suffix)));\n\treturn build(\n\t\tasync (source: AsyncIterable<{ time: number }>) => {\n\t\t\tfor await (const payload of source) {\n\t\t\t\tconst path = join(options.dir, createFileName(Date.now(), options.suffix));\n\t\t\t\tif (dest.path !== path) {\n\t\t\t\t\tawait cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);\n\t\t\t\t\tawait endStream(dest.stream);\n\t\t\t\t\t// eslint-disable-next-line require-atomic-updates\n\t\t\t\t\tdest = await createDest(path);\n\t\t\t\t}\n\n\t\t\t\tconst toDrain = !dest.stream.write(pretty?.(payload) ?? `${JSON.stringify(payload)}\\n`);\n\t\t\t\tif (toDrain) {\n\t\t\t\t\tawait once(dest.stream, 'drain');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tclose: async () => {\n\t\t\t\tawait cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);\n\t\t\t\tawait endStream(dest.stream);\n\t\t\t},\n\t\t},\n\t);\n}\n\nexport default pinoRotateFile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAqB;AACrB,qBAAyC;AACzC,sBAA+C;AAC/C,uBAAqB;AACrB,qCAAkB;AAElB,yBAA8B;AAC9B,wBAAsB;AAEtB,IAAM,UAAU,KAAK,KAAK,KAAK;AAC/B,IAAM,uBAAuB;AA2B7B,SAAS,eAAe,MAAc,QAAyB;AAC9D,QAAM,OAAO,IAAI,KAAK,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC;AAEtD,SAAO,SAAS,GAAG,IAAI,IAAI,MAAM,SAAS,GAAG,IAAI;AAClD;AAJS;AAMT,eAAe,QAAQ,KAAa,YAAmC;AACtE,QAAM,QAAQ,UAAM,yBAAQ,GAAG;AAC/B,QAAM,WAA4B,CAAC;AAEnC,aAAW,QAAQ,OAAO;AACzB,QAAI,CAAC,KAAK,SAAS,MAAM,GAAG;AAC3B;AAAA,IACD;AAEA,UAAM,OAAO,IAAI,KAAK,KAAK,MAAM,GAAG,EAAE,CAAC,CAAE,EAAE,QAAQ;AACnD,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,MAAM,QAAQ,aAAa,SAAS;AACvC,eAAS,SAAK,4BAAO,uBAAK,KAAK,IAAI,CAAC,CAAC;AAAA,IACtC;AAAA,EACD;AAEA,QAAM,QAAQ,IAAI,QAAQ;AAC3B;AAlBe;AAoBf,eAAe,WAAW,MAA6B;AACtD,QAAM,SAAS,IAAI,kBAAAA,QAAU,EAAE,MAAM,KAAK,CAAC;AAC3C,YAAM,yBAAK,QAAQ,OAAO;AAE1B,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AARe;AAUf,eAAe,UAAU,QAAmB;AAC3C,SAAO,IAAI;AACX,YAAM,yBAAK,QAAQ,OAAO;AAC3B;AAHe;AAKf,eAAsB,eAAe,SAAgC;AACpE,QAAM,SAAS,QAAQ,oBAAgB,kCAAc,QAAQ,aAAa,IAAI;AAE9E,MAAI,QAAQ,OAAO;AAClB,QAAI;AACH,gBAAM,wBAAO,QAAQ,KAAK,eAAAC,UAAY,IAAI;AAAA,IAC3C,QAAQ;AACP,gBAAM,uBAAM,QAAQ,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,IAC7C;AAAA,EACD;AAEA,YAAM,wBAAO,QAAQ,KAAK,eAAAA,UAAY,OAAO,eAAAA,UAAY,IAAI;AAC7D,QAAM,QAAQ,QAAQ,KAAK,QAAQ,cAAc,oBAAoB;AAErE,MAAI,OAAO,MAAM,eAAW,uBAAK,QAAQ,KAAK,eAAe,KAAK,IAAI,GAAG,QAAQ,MAAM,CAAC,CAAC;AACzF,aAAO,+BAAAC;AAAA,IACN,OAAO,WAA4C;AAClD,uBAAiB,WAAW,QAAQ;AACnC,cAAM,WAAO,uBAAK,QAAQ,KAAK,eAAe,KAAK,IAAI,GAAG,QAAQ,MAAM,CAAC;AACzE,YAAI,KAAK,SAAS,MAAM;AACvB,gBAAM,QAAQ,QAAQ,KAAK,QAAQ,cAAc,oBAAoB;AACrE,gBAAM,UAAU,KAAK,MAAM;AAE3B,iBAAO,MAAM,WAAW,IAAI;AAAA,QAC7B;AAEA,cAAM,UAAU,CAAC,KAAK,OAAO,MAAM,SAAS,OAAO,KAAK,GAAG,KAAK,UAAU,OAAO,CAAC;AAAA,CAAI;AACtF,YAAI,SAAS;AACZ,oBAAM,yBAAK,KAAK,QAAQ,OAAO;AAAA,QAChC;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,mCAAY;AAClB,cAAM,QAAQ,QAAQ,KAAK,QAAQ,cAAc,oBAAoB;AACrE,cAAM,UAAU,KAAK,MAAM;AAAA,MAC5B,GAHO;AAAA,IAIR;AAAA,EACD;AACD;AAvCsB;AAyCtB,IAAO,gBAAQ;","names":["SonicBoom","fsConstants","build"]}
|
package/dist/index.mjs
CHANGED
|
@@ -2,17 +2,18 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
|
-
import { once } from "
|
|
6
|
-
import { constants as fsConstants } from "
|
|
7
|
-
import { readdir, unlink, access, mkdir } from "
|
|
8
|
-
import { join } from "
|
|
5
|
+
import { once } from "events";
|
|
6
|
+
import { constants as fsConstants } from "fs";
|
|
7
|
+
import { readdir, unlink, access, mkdir } from "fs/promises";
|
|
8
|
+
import { join } from "path";
|
|
9
9
|
import build from "pino-abstract-transport";
|
|
10
10
|
import { prettyFactory } from "pino-pretty";
|
|
11
|
-
import
|
|
11
|
+
import SonicBoom from "sonic-boom";
|
|
12
12
|
var ONE_DAY = 24 * 60 * 60 * 1e3;
|
|
13
13
|
var DEFAULT_MAX_AGE_DAYS = 14;
|
|
14
|
-
function createFileName(time) {
|
|
15
|
-
|
|
14
|
+
function createFileName(time, suffix) {
|
|
15
|
+
const date = new Date(time).toISOString().split("T")[0];
|
|
16
|
+
return suffix ? `${date}.${suffix}.log` : `${date}.log`;
|
|
16
17
|
}
|
|
17
18
|
__name(createFileName, "createFileName");
|
|
18
19
|
async function cleanup(dir, maxAgeDays) {
|
|
@@ -56,11 +57,11 @@ async function pinoRotateFile(options) {
|
|
|
56
57
|
}
|
|
57
58
|
await access(options.dir, fsConstants.R_OK | fsConstants.W_OK);
|
|
58
59
|
await cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);
|
|
59
|
-
let dest = await createDest(join(options.dir, createFileName(Date.now())));
|
|
60
|
+
let dest = await createDest(join(options.dir, createFileName(Date.now(), options.suffix)));
|
|
60
61
|
return build(
|
|
61
62
|
async (source) => {
|
|
62
63
|
for await (const payload of source) {
|
|
63
|
-
const path = join(options.dir, createFileName(Date.now()));
|
|
64
|
+
const path = join(options.dir, createFileName(Date.now(), options.suffix));
|
|
64
65
|
if (dest.path !== path) {
|
|
65
66
|
await cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);
|
|
66
67
|
await endStream(dest.stream);
|
|
@@ -82,9 +83,9 @@ async function pinoRotateFile(options) {
|
|
|
82
83
|
);
|
|
83
84
|
}
|
|
84
85
|
__name(pinoRotateFile, "pinoRotateFile");
|
|
85
|
-
var
|
|
86
|
+
var index_default = pinoRotateFile;
|
|
86
87
|
export {
|
|
87
|
-
|
|
88
|
+
index_default as default,
|
|
88
89
|
pinoRotateFile
|
|
89
90
|
};
|
|
90
91
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { once } from 'node:events';\nimport { constants as fsConstants } from 'node:fs';\nimport { readdir, unlink, access, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport build from 'pino-abstract-transport';\nimport type { PrettyOptions } from 'pino-pretty';\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { once } from 'node:events';\nimport { constants as fsConstants } from 'node:fs';\nimport { readdir, unlink, access, mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport build from 'pino-abstract-transport';\nimport type { PrettyOptions } from 'pino-pretty';\nimport { prettyFactory } from 'pino-pretty';\nimport SonicBoom from 'sonic-boom';\n\nconst ONE_DAY = 24 * 60 * 60 * 1_000;\nconst DEFAULT_MAX_AGE_DAYS = 14;\n\n/**\n * Options for the transport\n */\nexport interface PinoRotateFileOptions {\n\tdir: string;\n\tmaxAgeDays?: number;\n\tmkdir?: boolean;\n\tprettyOptions?: PrettyOptions;\n\t/**\n\t * Distinguishes this writer's files from another process writing the same `dir`, producing\n\t * `<date>.<suffix>.log` instead of `<date>.log`.\n\t *\n\t * Needed when several processes share one directory (#355): the day file is opened in append mode, but writes are\n\t * buffered and flushed in chunks that can span a line boundary, so concurrent writers interleave and corrupt\n\t * each other's lines. They would also each independently decide to rotate at midnight and end each other's\n\t * stream.\n\t */\n\tsuffix?: string | undefined;\n}\n\ninterface Dest {\n\tpath: string;\n\tstream: SonicBoom;\n}\n\nfunction createFileName(time: number, suffix?: string): string {\n\tconst date = new Date(time).toISOString().split('T')[0]!;\n\t// The date stays the first dot-segment either way, which is what `cleanup` parses to decide age.\n\treturn suffix ? `${date}.${suffix}.log` : `${date}.log`;\n}\n\nasync function cleanup(dir: string, maxAgeDays: number): Promise<void> {\n\tconst files = await readdir(dir);\n\tconst promises: Promise<void>[] = [];\n\n\tfor (const file of files) {\n\t\tif (!file.endsWith('.log')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst date = new Date(file.split('.')[0]!).getTime();\n\t\tconst now = Date.now();\n\n\t\tif (now - date >= maxAgeDays * ONE_DAY) {\n\t\t\tpromises.push(unlink(join(dir, file)));\n\t\t}\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function createDest(path: string): Promise<Dest> {\n\tconst stream = new SonicBoom({ dest: path });\n\tawait once(stream, 'ready');\n\n\treturn {\n\t\tpath,\n\t\tstream,\n\t};\n}\n\nasync function endStream(stream: SonicBoom) {\n\tstream.end();\n\tawait once(stream, 'close');\n}\n\nexport async function pinoRotateFile(options: PinoRotateFileOptions) {\n\tconst pretty = options.prettyOptions ? prettyFactory(options.prettyOptions) : null;\n\n\tif (options.mkdir) {\n\t\ttry {\n\t\t\tawait access(options.dir, fsConstants.F_OK);\n\t\t} catch {\n\t\t\tawait mkdir(options.dir, { recursive: true });\n\t\t}\n\t}\n\n\tawait access(options.dir, fsConstants.R_OK | fsConstants.W_OK);\n\tawait cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);\n\n\tlet dest = await createDest(join(options.dir, createFileName(Date.now(), options.suffix)));\n\treturn build(\n\t\tasync (source: AsyncIterable<{ time: number }>) => {\n\t\t\tfor await (const payload of source) {\n\t\t\t\tconst path = join(options.dir, createFileName(Date.now(), options.suffix));\n\t\t\t\tif (dest.path !== path) {\n\t\t\t\t\tawait cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);\n\t\t\t\t\tawait endStream(dest.stream);\n\t\t\t\t\t// eslint-disable-next-line require-atomic-updates\n\t\t\t\t\tdest = await createDest(path);\n\t\t\t\t}\n\n\t\t\t\tconst toDrain = !dest.stream.write(pretty?.(payload) ?? `${JSON.stringify(payload)}\\n`);\n\t\t\t\tif (toDrain) {\n\t\t\t\t\tawait once(dest.stream, 'drain');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tclose: async () => {\n\t\t\t\tawait cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);\n\t\t\t\tawait endStream(dest.stream);\n\t\t\t},\n\t\t},\n\t);\n}\n\nexport default pinoRotateFile;\n"],"mappings":";;;;AAAA,SAAS,YAAY;AACrB,SAAS,aAAa,mBAAmB;AACzC,SAAS,SAAS,QAAQ,QAAQ,aAAa;AAC/C,SAAS,YAAY;AACrB,OAAO,WAAW;AAElB,SAAS,qBAAqB;AAC9B,OAAO,eAAe;AAEtB,IAAM,UAAU,KAAK,KAAK,KAAK;AAC/B,IAAM,uBAAuB;AA2B7B,SAAS,eAAe,MAAc,QAAyB;AAC9D,QAAM,OAAO,IAAI,KAAK,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC;AAEtD,SAAO,SAAS,GAAG,IAAI,IAAI,MAAM,SAAS,GAAG,IAAI;AAClD;AAJS;AAMT,eAAe,QAAQ,KAAa,YAAmC;AACtE,QAAM,QAAQ,MAAM,QAAQ,GAAG;AAC/B,QAAM,WAA4B,CAAC;AAEnC,aAAW,QAAQ,OAAO;AACzB,QAAI,CAAC,KAAK,SAAS,MAAM,GAAG;AAC3B;AAAA,IACD;AAEA,UAAM,OAAO,IAAI,KAAK,KAAK,MAAM,GAAG,EAAE,CAAC,CAAE,EAAE,QAAQ;AACnD,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,MAAM,QAAQ,aAAa,SAAS;AACvC,eAAS,KAAK,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;AAAA,IACtC;AAAA,EACD;AAEA,QAAM,QAAQ,IAAI,QAAQ;AAC3B;AAlBe;AAoBf,eAAe,WAAW,MAA6B;AACtD,QAAM,SAAS,IAAI,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3C,QAAM,KAAK,QAAQ,OAAO;AAE1B,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AARe;AAUf,eAAe,UAAU,QAAmB;AAC3C,SAAO,IAAI;AACX,QAAM,KAAK,QAAQ,OAAO;AAC3B;AAHe;AAKf,eAAsB,eAAe,SAAgC;AACpE,QAAM,SAAS,QAAQ,gBAAgB,cAAc,QAAQ,aAAa,IAAI;AAE9E,MAAI,QAAQ,OAAO;AAClB,QAAI;AACH,YAAM,OAAO,QAAQ,KAAK,YAAY,IAAI;AAAA,IAC3C,QAAQ;AACP,YAAM,MAAM,QAAQ,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,IAC7C;AAAA,EACD;AAEA,QAAM,OAAO,QAAQ,KAAK,YAAY,OAAO,YAAY,IAAI;AAC7D,QAAM,QAAQ,QAAQ,KAAK,QAAQ,cAAc,oBAAoB;AAErE,MAAI,OAAO,MAAM,WAAW,KAAK,QAAQ,KAAK,eAAe,KAAK,IAAI,GAAG,QAAQ,MAAM,CAAC,CAAC;AACzF,SAAO;AAAA,IACN,OAAO,WAA4C;AAClD,uBAAiB,WAAW,QAAQ;AACnC,cAAM,OAAO,KAAK,QAAQ,KAAK,eAAe,KAAK,IAAI,GAAG,QAAQ,MAAM,CAAC;AACzE,YAAI,KAAK,SAAS,MAAM;AACvB,gBAAM,QAAQ,QAAQ,KAAK,QAAQ,cAAc,oBAAoB;AACrE,gBAAM,UAAU,KAAK,MAAM;AAE3B,iBAAO,MAAM,WAAW,IAAI;AAAA,QAC7B;AAEA,cAAM,UAAU,CAAC,KAAK,OAAO,MAAM,SAAS,OAAO,KAAK,GAAG,KAAK,UAAU,OAAO,CAAC;AAAA,CAAI;AACtF,YAAI,SAAS;AACZ,gBAAM,KAAK,KAAK,QAAQ,OAAO;AAAA,QAChC;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO,mCAAY;AAClB,cAAM,QAAQ,QAAQ,KAAK,QAAQ,cAAc,oBAAoB;AACrE,cAAM,UAAU,KAAK,MAAM;AAAA,MAC5B,GAHO;AAAA,IAIR;AAAA,EACD;AACD;AAvCsB;AAyCtB,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,44 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
2
|
+
"$schema": "http://json.schemastore.org/package",
|
|
3
|
+
"name": "@chatsift/pino-rotate-file",
|
|
4
|
+
"description": "Simple pino transport for rotating files",
|
|
5
|
+
"version": "0.6.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"directories": {
|
|
15
|
+
"lib": "src"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"src"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup && tsc",
|
|
26
|
+
"prepack": "yarn build",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"lint": "eslint src",
|
|
30
|
+
"lint:fix": "eslint src --fix",
|
|
31
|
+
"format": "prettier --write . --ignore-path ../../.gitignore --ignore-path ../../.prettierignore",
|
|
32
|
+
"format:check": "prettier --check . --ignore-path ../../.gitignore --ignore-path ../../.prettierignore",
|
|
33
|
+
"clean": "rimraf dist"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/chatsift/utilities.git",
|
|
38
|
+
"directory": "packages/pino-rotate-file"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/chatsift/utilities/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/chatsift/utilities/tree/main/packages/pino-rotate-file#readme",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^24.13.4",
|
|
46
|
+
"sonic-boom": "^5.0.1",
|
|
47
|
+
"tsup": "^8.5.1",
|
|
48
|
+
"typescript": "~6.0.3",
|
|
49
|
+
"vitest": "^4.1.11"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"pino": "^10.3.1",
|
|
53
|
+
"pino-abstract-transport": "^3.0.0",
|
|
54
|
+
"pino-pretty": "^13.1.3",
|
|
55
|
+
"tslib": "^2.8.1"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import process from 'node:process';
|
|
4
|
+
import * as sonicBoom from 'sonic-boom';
|
|
5
|
+
import type { Mock } from 'vitest';
|
|
6
|
+
import { afterEach, describe, expect, test, vi } from 'vitest';
|
|
7
|
+
import { pinoRotateFile } from '../index.js';
|
|
8
|
+
|
|
9
|
+
function toPlatformPath(name: string): string {
|
|
10
|
+
return name.replaceAll(path.posix.sep, path.sep);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function toPlatformPaths(paths: string[]): string[] {
|
|
14
|
+
return paths.map((name) => toPlatformPath(name));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
vi.useFakeTimers();
|
|
18
|
+
|
|
19
|
+
const nowMock = vi.fn(() => Date.now());
|
|
20
|
+
global.Date.now = nowMock;
|
|
21
|
+
|
|
22
|
+
const readdirSpy = vi.spyOn(fs, 'readdir') as unknown as Mock<(path: string) => Promise<string[]>>;
|
|
23
|
+
const unlinkSpy = vi.spyOn(fs, 'unlink');
|
|
24
|
+
const accessSpy = vi.spyOn(fs, 'access');
|
|
25
|
+
const mkdirSpy = vi.spyOn(fs, 'mkdir');
|
|
26
|
+
|
|
27
|
+
vi.mock('node:fs/promises', () => ({
|
|
28
|
+
readdir: vi.fn(async () => []),
|
|
29
|
+
unlink: vi.fn(async () => {}),
|
|
30
|
+
access: vi.fn(async () => {}),
|
|
31
|
+
mkdir: vi.fn(async () => {}),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
// The real module is default-only (`module.exports = SonicBoom`, see the comment on the source's import), so
|
|
35
|
+
// the mock -- and the spy on it -- must target `default`, matching the source's `import SonicBoom from 'sonic-boom'`.
|
|
36
|
+
const sonicBoomConstructorSpy = vi.spyOn(sonicBoom, 'default');
|
|
37
|
+
|
|
38
|
+
vi.mock('sonic-boom', async () => {
|
|
39
|
+
const { EventEmitter } = await vi.importActual<typeof import('node:events')>('node:events');
|
|
40
|
+
|
|
41
|
+
class MockSonicBoom extends EventEmitter {
|
|
42
|
+
public constructor() {
|
|
43
|
+
super();
|
|
44
|
+
// Need to wait an event loop cycle so the `once` call gets to run
|
|
45
|
+
process.nextTick(() => this.emit('ready'));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
// Must be a real function, not an arrow -- vitest 4's `new mockFn()` only invokes the mock as a
|
|
51
|
+
// constructor (rather than a plain call) when the implementation itself is constructible.
|
|
52
|
+
// eslint-disable-next-line prefer-arrow-callback
|
|
53
|
+
default: vi.fn(function SonicBoom() {
|
|
54
|
+
return new MockSonicBoom();
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
afterEach(() => {
|
|
60
|
+
vi.clearAllMocks();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('initial file creation', () => {
|
|
64
|
+
test('it can create a file if the dir exists', async () => {
|
|
65
|
+
// dir exists
|
|
66
|
+
accessSpy.mockReturnValue(Promise.resolve());
|
|
67
|
+
// no files exist in dir
|
|
68
|
+
readdirSpy.mockReturnValue(Promise.resolve([]));
|
|
69
|
+
nowMock.mockReturnValue(new Date('2022-01-01').getTime());
|
|
70
|
+
|
|
71
|
+
await pinoRotateFile({ dir: 'foo' });
|
|
72
|
+
// SonicBoom instance is created with the appropriate destination
|
|
73
|
+
expect(sonicBoomConstructorSpy).toHaveBeenCalledWith({ dest: toPlatformPath('foo/2022-01-01.log') });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('it creates the dir if mkdir is true', async () => {
|
|
77
|
+
// dir doesn't exist
|
|
78
|
+
accessSpy.mockImplementation(async () => {
|
|
79
|
+
throw new Error('boom');
|
|
80
|
+
});
|
|
81
|
+
// no files exist in dir
|
|
82
|
+
readdirSpy.mockReturnValue(Promise.resolve([]));
|
|
83
|
+
mkdirSpy.mockImplementation(async () => {
|
|
84
|
+
// Update access implementation to reflect on dir being created
|
|
85
|
+
accessSpy.mockImplementation(async () => {});
|
|
86
|
+
return Promise.resolve() as Promise<undefined>;
|
|
87
|
+
});
|
|
88
|
+
nowMock.mockReturnValue(new Date('2022-01-01').getTime());
|
|
89
|
+
|
|
90
|
+
await pinoRotateFile({ dir: 'foo', mkdir: true });
|
|
91
|
+
// mkdir is called with the correct path
|
|
92
|
+
expect(mkdirSpy).toHaveBeenCalledWith('foo', { recursive: true });
|
|
93
|
+
expect(sonicBoomConstructorSpy).toHaveBeenCalledWith({ dest: toPlatformPath('foo/2022-01-01.log') });
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('it cleans up', async () => {
|
|
98
|
+
// dir exists
|
|
99
|
+
accessSpy.mockReturnValue(Promise.resolve());
|
|
100
|
+
// few files exist in dir
|
|
101
|
+
readdirSpy.mockReturnValue(Promise.resolve(['2022-01-01.log', '2022-01-02.log', '2022-01-03.log']));
|
|
102
|
+
// We want the first 2 deleted and the last one kept
|
|
103
|
+
nowMock.mockReturnValue(new Date('2022-01-04').getTime());
|
|
104
|
+
await pinoRotateFile({ dir: 'foo', maxAgeDays: 2 });
|
|
105
|
+
|
|
106
|
+
// first 2 files were deleted
|
|
107
|
+
expect(unlinkSpy).toHaveBeenCalledTimes(2);
|
|
108
|
+
expect(unlinkSpy).toHaveBeenNthCalledWith(1, toPlatformPath('foo/2022-01-01.log'));
|
|
109
|
+
expect(unlinkSpy).toHaveBeenNthCalledWith(2, toPlatformPath('foo/2022-01-02.log'));
|
|
110
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { once } from 'node:events';
|
|
2
|
+
import { constants as fsConstants } from 'node:fs';
|
|
3
|
+
import { readdir, unlink, access, mkdir } from 'node:fs/promises';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import build from 'pino-abstract-transport';
|
|
6
|
+
import type { PrettyOptions } from 'pino-pretty';
|
|
7
|
+
import { prettyFactory } from 'pino-pretty';
|
|
8
|
+
import SonicBoom from 'sonic-boom';
|
|
9
|
+
|
|
10
|
+
const ONE_DAY = 24 * 60 * 60 * 1_000;
|
|
11
|
+
const DEFAULT_MAX_AGE_DAYS = 14;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Options for the transport
|
|
15
|
+
*/
|
|
16
|
+
export interface PinoRotateFileOptions {
|
|
17
|
+
dir: string;
|
|
18
|
+
maxAgeDays?: number;
|
|
19
|
+
mkdir?: boolean;
|
|
20
|
+
prettyOptions?: PrettyOptions;
|
|
21
|
+
/**
|
|
22
|
+
* Distinguishes this writer's files from another process writing the same `dir`, producing
|
|
23
|
+
* `<date>.<suffix>.log` instead of `<date>.log`.
|
|
24
|
+
*
|
|
25
|
+
* Needed when several processes share one directory (#355): the day file is opened in append mode, but writes are
|
|
26
|
+
* buffered and flushed in chunks that can span a line boundary, so concurrent writers interleave and corrupt
|
|
27
|
+
* each other's lines. They would also each independently decide to rotate at midnight and end each other's
|
|
28
|
+
* stream.
|
|
29
|
+
*/
|
|
30
|
+
suffix?: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Dest {
|
|
34
|
+
path: string;
|
|
35
|
+
stream: SonicBoom;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function createFileName(time: number, suffix?: string): string {
|
|
39
|
+
const date = new Date(time).toISOString().split('T')[0]!;
|
|
40
|
+
// The date stays the first dot-segment either way, which is what `cleanup` parses to decide age.
|
|
41
|
+
return suffix ? `${date}.${suffix}.log` : `${date}.log`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function cleanup(dir: string, maxAgeDays: number): Promise<void> {
|
|
45
|
+
const files = await readdir(dir);
|
|
46
|
+
const promises: Promise<void>[] = [];
|
|
47
|
+
|
|
48
|
+
for (const file of files) {
|
|
49
|
+
if (!file.endsWith('.log')) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const date = new Date(file.split('.')[0]!).getTime();
|
|
54
|
+
const now = Date.now();
|
|
55
|
+
|
|
56
|
+
if (now - date >= maxAgeDays * ONE_DAY) {
|
|
57
|
+
promises.push(unlink(join(dir, file)));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
await Promise.all(promises);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function createDest(path: string): Promise<Dest> {
|
|
65
|
+
const stream = new SonicBoom({ dest: path });
|
|
66
|
+
await once(stream, 'ready');
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
path,
|
|
70
|
+
stream,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function endStream(stream: SonicBoom) {
|
|
75
|
+
stream.end();
|
|
76
|
+
await once(stream, 'close');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function pinoRotateFile(options: PinoRotateFileOptions) {
|
|
80
|
+
const pretty = options.prettyOptions ? prettyFactory(options.prettyOptions) : null;
|
|
81
|
+
|
|
82
|
+
if (options.mkdir) {
|
|
83
|
+
try {
|
|
84
|
+
await access(options.dir, fsConstants.F_OK);
|
|
85
|
+
} catch {
|
|
86
|
+
await mkdir(options.dir, { recursive: true });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
await access(options.dir, fsConstants.R_OK | fsConstants.W_OK);
|
|
91
|
+
await cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);
|
|
92
|
+
|
|
93
|
+
let dest = await createDest(join(options.dir, createFileName(Date.now(), options.suffix)));
|
|
94
|
+
return build(
|
|
95
|
+
async (source: AsyncIterable<{ time: number }>) => {
|
|
96
|
+
for await (const payload of source) {
|
|
97
|
+
const path = join(options.dir, createFileName(Date.now(), options.suffix));
|
|
98
|
+
if (dest.path !== path) {
|
|
99
|
+
await cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);
|
|
100
|
+
await endStream(dest.stream);
|
|
101
|
+
// eslint-disable-next-line require-atomic-updates
|
|
102
|
+
dest = await createDest(path);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const toDrain = !dest.stream.write(pretty?.(payload) ?? `${JSON.stringify(payload)}\n`);
|
|
106
|
+
if (toDrain) {
|
|
107
|
+
await once(dest.stream, 'drain');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
close: async () => {
|
|
113
|
+
await cleanup(options.dir, options.maxAgeDays ?? DEFAULT_MAX_AGE_DAYS);
|
|
114
|
+
await endStream(dest.stream);
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default pinoRotateFile;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.es2023.d.ts","../../../node_modules/typescript/lib/lib.esnext.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/typescript/lib/lib.esnext.string.d.ts","../../../node_modules/typescript/lib/lib.esnext.promise.d.ts","../../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../node_modules/typescript/lib/lib.esnext.object.d.ts","../../../node_modules/typescript/lib/lib.esnext.regexp.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/tslib/tslib.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/file.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/filereader.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/pino-abstract-transport/index.d.ts","../../../node_modules/pino-std-serializers/index.d.ts","../../../node_modules/sonic-boom/types/index.d.ts","../../../node_modules/pino/pino.d.ts","../../../node_modules/colorette/index.d.ts","../../../node_modules/pino-pretty/index.d.ts","../src/index.ts","../../../node_modules/@types/acorn/node_modules/@types/estree/index.d.ts","../../../node_modules/@types/acorn/index.d.ts","../../../node_modules/@types/concat-stream/index.d.ts","../../../node_modules/@types/conventional-commits-parser/index.d.ts","../../../node_modules/@types/cross-spawn/index.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/eslint/node_modules/@types/estree/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/estree-jsx/node_modules/@types/estree/index.d.ts","../../../node_modules/@types/estree-jsx/index.d.ts","../../../node_modules/@types/unist/index.d.ts","../../../node_modules/@types/hast/index.d.ts","../../../node_modules/@types/is-empty/index.d.ts","../../../node_modules/@types/mdast/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/pg-types/index.d.ts","../../../node_modules/pg-protocol/dist/messages.d.ts","../../../node_modules/pg-protocol/dist/serializer.d.ts","../../../node_modules/pg-protocol/dist/parser.d.ts","../../../node_modules/pg-protocol/dist/index.d.ts","../../../node_modules/@types/pg/index.d.ts","../../../node_modules/@types/retry/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/supports-color/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","17edc026abf73c5c2dd508652d63f68ec4efd9d4856e3469890d27598209feb5",{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"9d540251809289a05349b70ab5f4b7b99f922af66ab3c39ba56a475dcf95d5ff","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true},{"version":"0b11f3ca66aa33124202c80b70cd203219c3d4460cfc165e0707aa9ec710fc53","affectsGlobalScope":true},{"version":"6a3f5a0129cc80cf439ab71164334d649b47059a4f5afca90282362407d0c87f","affectsGlobalScope":true},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true},{"version":"15b98a533864d324e5f57cd3cfc0579b231df58c1c0f6063ea0fcb13c3c74ff9","affectsGlobalScope":true},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"4a882ffbb4ed09d9b7734f784aebb1dfe488d63725c40759165c5d9c657ca029","2db0dd3aaa2ed285950273ce96ae8a450b45423aa9da2d10e194570f1233fa6b","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"e7be367719c613d580d4b27fdf8fe64c9736f48217f4b322c0d63b2971460918","affectsGlobalScope":true},"3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36",{"version":"dd78bfe9dfcadb2c4cd3a3a36df38fb3ef8ed2c601b57f6ad9a29e38a17ff39c","affectsGlobalScope":true},"62f1c00d3d246e0e3cf0224f91e122d560428ec1ccc36bb51d4574a84f1dbad0","53f0960fdcc53d097918adfd8861ffbe0db989c56ffc16c052197bf115da5ed6",{"version":"662163e5327f260b23ca0a1a1ad8a74078aabb587c904fcb5ef518986987eaff","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb",{"version":"f85c06e750743acf31f0cfd3be284a364d469761649e29547d0dd6be48875150","affectsGlobalScope":true},"b0c0d1d13be149f790a75b381b413490f98558649428bb916fd2d71a3f47a134","3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","0364f8bb461d6e84252412d4e5590feda4eb582f77d47f7a024a7a9ff105dfdc","5433f7f77cd1fd53f45bd82445a4e437b2f6a72a32070e907530a4fea56c30c8","d0ca5d7df114035258a9d01165be309371fcccf0cccd9d57b1453204686d1ed0",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"9a30b7fefd7f8abbca4828d481c61c18e40fe5ff107e113b1c1fcd2c8dcf2743","affectsGlobalScope":true},"173b6275a81ebdb283b180654890f46516c21199734fed01a773b1c168b8c45c","304f66274aa8119e8d65a49b1cff84cbf803def6afe1b2cc987386e9a9890e22","1b9adafe8a7fefaeaf9099a0e06f602903f6268438147b843a33a5233ac71745","98273274f2dbb79b0b2009b20f74eca4a7146a3447c912d580cd5d2d94a7ae30","c933f7ba4b201c98b14275fd11a14abb950178afd2074703250fe3654fc10cd2","2eaa31492906bc8525aff3c3ec2236e22d90b0dfeee77089f196cd0adf0b3e3b",{"version":"ea455cc68871b049bcecd9f56d4cf27b852d6dafd5e3b54468ca87cc11604e4d","affectsGlobalScope":true},"8f5814f29dbaf8bacd1764aebdf1c8a6eb86381f6a188ddbac0fcbaab855ce52","a63d03de72adfb91777784015bd3b4125abd2f5ef867fc5a13920b5649e8f52b","d20e003f3d518a7c1f749dbe27c6ab5e3be7b3c905a48361b04a9557de4a6900",{"version":"1d4d78c8b23c9ddaaaa49485e6adc2ec01086dfe5d8d4d36ca4cdc98d2f7e74a","affectsGlobalScope":true},{"version":"44fc16356b81c0463cc7d7b2b35dcf324d8144136f5bc5ce73ced86f2b3475b5","affectsGlobalScope":true},"575fb200043b11b464db8e42cc64379c5fd322b6d787638e005b5ee98a64486d","6de2f225d942562733e231a695534b30039bdf1875b377bb7255881f0df8ede8","56249fd3ef1f6b90888e606f4ea648c43978ef43a7263aafad64f8d83cd3b8aa","139ad1dc93a503da85b7a0d5f615bddbae61ad796bc68fedd049150db67a1e26","7b166975fdbd3b37afb64707b98bca88e46577bbc6c59871f9383a7df2daacd1","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","81505c54d7cad0009352eaa21bd923ab7cdee7ec3405357a54d9a5da033a2084","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","3c1f19c7abcda6b3a4cf9438a15c7307a080bd3b51dfd56b198d9f86baf19447","2ee1645e0df9d84467cfe1d67b0ad3003c2f387de55874d565094464ee6f2927",{"version":"7da97d603bf3dd0000f56467c56cb6efaf5f94692980474925fae6c33412b12a","affectsGlobalScope":true},{"version":"9cf780e96b687e4bdfd1907ed26a688c18b89797490a00598fa8b8ab683335dd","affectsGlobalScope":true},"98e00f3613402504bc2a2c9a621800ab48e0a463d1eed062208a4ae98ad8f84c","9ae88ce9f73446c24b2d2452e993b676da1b31fca5ceb7276e7f36279f693ed1","e49d7625faff2a7842e4e7b9b197f972633fca685afcf6b4403400c97d087c36","b82c38abc53922b1b3670c3af6f333c21b735722a8f156e7d357a2da7c53a0a0",{"version":"b423f53647708043299ded4daa68d95c967a2ac30aa1437adc4442129d7d0a6c","affectsGlobalScope":true},{"version":"7245af181218216bacb01fbdf51095617a51661f20d77178c69a377e16fb69ed","affectsGlobalScope":true},"4f0fc7b7f54422bd97cfaf558ddb4bca86893839367b746a8f86b60ac7619673","4cdd8b6b51599180a387cc7c1c50f49eca5ce06595d781638fd0216520d98246","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"8704423bf338bff381ebc951ed819935d0252d90cd6de7dffe5b0a5debb65d07","affectsGlobalScope":true},"7c6929fd7cbf38499b6a600b91c3b603d1d78395046dc3499b2b92d01418b94b",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a42be67ed1ddaec743582f41fc219db96a1b69719fccac6d1464321178d610fc","89bf59c1d834a4b01c7d9b5b4cfa64ffed09e59580d27bbadf1acdd69706c200","4fe80f12b1d5189384a219095c2eabadbb389c2d3703aae7c5376dbaa56061df","ad70fdf3826676b87e49c859035690311e6e1f27fc58c76ebfd5c714f7cee2e6","780c4d3dd037f2c47d6d77e85f932d8d40fbdf0e887ac8f793cc4842dea8345e","c8adda9f45d2f7ec9fb28c59859db32da6c2835f1fec96433e2729e5805fa46f","6e62bd2dd3001609b2854c61e751972b30845d8b1a52bbbf5ea2d83471f2fc2e",{"version":"8e508e4a922cd24412985cdf733250b29927f6038c778c4329b027ee7c0f3208","signature":"9db2e1bfb67f7c4a29d216c793d18c250c1dd60e2ffe9e7795b44725f51799e0"},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","3777eb752cef9aa8dd35bb997145413310008aa54ec44766de81a7ad891526cd","d009e415638e5ec78f1073f698f2f2aa6a66883989dced9a46b3ac3967cb56f8","f96f3c445afc7d65d4790386e37c5b57f095f285cc89b8315b209fe0c81837c1","5e3a55837aa1f42af2d2334c9b750f59f5f50a2205471875f5dd6aadc3e49ddb","68cc8d6fcc2f270d7108f02f3ebc59480a54615be3e09a47e14527f349e9d53e","3eb11dbf3489064a47a2e1cf9d261b1f100ef0b3b50ffca6c44dd99d6dd81ac1",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","bee89e1eb6425eb49894f3f25e4562dc2564e84e5aa7610b7e13d8ecddf8f5db","ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","5d08a179b846f5ee674624b349ebebe2121c455e3a265dc93da4e8d9e89722b4","89121c1bf2990f5219bfd802a3e7fc557de447c62058d6af68d6b6348d64499a","79b4369233a12c6fa4a07301ecb7085802c98f3a77cf9ab97eee27e1656f82e6","b3bcbf3f1afe9bd5ad07f57ef717a9178e099416a939f01427c5972e8dab7122","d4a22007b481fe2a2e6bfd3a42c00cd62d41edb36d30fc4697df2692e9891fc8","22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","a589f9f052276a3fc00b75e62f73b93ea568fce3e935b86ed7052945f99d9dc2","17230b34bb564a3a2e36f9d3985372ccab4ad1722df2c43f7c5c2b553f68e5db","6e5c9272f6b3783be7bdddaf207cccdb8e033be3d14c5beacc03ae9d27d50929","9b4f7ff9681448c72abe38ea8eefd7ffe0c3aefe495137f02012a08801373f71","0dfe35191a04e8f9dc7caeb9f52f2ee07402736563d12cbccd15fb5f31ac877f","5e3ded3624072ab70ba827b9279789f5c761456eb4e859281a5dd60537dedb25","199f9ead0daf25ae4c5632e3d1f42570af59685294a38123eef457407e13f365","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","1e60b6a5f644623f61e7ddb2f7f81cc56a0142329ca253e5fb237e7a719026c7","a9bf72dc672eed91bf61d8086559e11d84c8faa3bd42d11859feee3ff33fc8af","bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","5d30d04a14ed8527ac5d654dc345a4db11b593334c11a65efb6e4facc5484a0e"],"root":[167],"options":{"alwaysStrict":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"importHelpers":true,"module":99,"noEmitHelpers":true,"noImplicitOverride":true,"noUncheckedIndexedAccess":true,"outDir":"./","removeComments":true,"skipLibCheck":true,"sourceMap":true,"strict":true,"target":7,"verbatimModuleSyntax":true},"fileIdsList":[[168,181],[141,160],[111,160],[173],[168,175,177,181],[182],[73],[109],[110,115,144],[111,116,122,123,130,141,152],[111,112,122,130],[113,153],[114,115,123,131],[115,141,149],[116,118,122,130],[109,117],[118,119],[122],[120,122],[109,122],[122,123,124,141,152],[122,123,124,137,141,144],[107,110,157],[118,122,125,130,141,152],[122,123,125,126,130,141,149,152],[125,127,141,149,152],[73,74,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159],[122,128],[129,152,157],[118,122,130,141],[131],[132],[109,133],[130,131,134,151,157],[135],[136],[122,137,138],[137,139,153,155],[110,122,141,142,143,144],[110,141,143],[141,142],[144],[145],[109,141],[122,147,148],[147,148],[115,130,141,149],[150],[130,151],[110,125,136,152],[115,153],[141,154],[129,155],[156],[110,115,122,124,133,141,152,155,157],[141,158],[122,141,149,160,187,188,191,192],[194,233],[194,218,233],[233],[194],[194,219,233],[194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232],[219,233],[122,125,127,141,149,152,158,160],[236],[160,188,189,190],[160],[141,160,188],[141,160,161,164,165],[125,160],[122,157,162,163],[122,160],[84,88,152],[84,141,152],[79],[81,84,149,152],[130,149],[79,160],[81,84,130,152],[76,77,80,83,110,122,141,152],[76,82],[80,84,110,144,152,160],[110,160],[100,110,160],[78,79,160],[84],[78,79,80,81,82,83,84,85,86,88,89,90,91,92,93,94,95,96,97,98,99,101,102,103,104,105,106],[84,91,92],[82,84,92,93],[83],[76,79,84],[84,88,92,93],[88],[82,84,87,152],[76,81,82,84,88,91],[110,141],[79,84,100,110,157,160],[72,122,123,124,132,161,163,166]],"referencedMap":[[169,1],[170,2],[171,2],[172,3],[174,4],[178,5],[181,1],[183,6],[185,6],[73,7],[74,7],[109,8],[110,9],[111,10],[112,11],[113,12],[114,13],[115,14],[116,15],[117,16],[118,17],[119,17],[121,18],[120,19],[122,20],[123,21],[124,22],[108,23],[125,24],[126,25],[127,26],[160,27],[128,28],[129,29],[130,30],[131,31],[132,32],[133,33],[134,34],[135,35],[136,36],[137,37],[138,37],[139,38],[141,39],[143,40],[142,41],[144,42],[145,43],[146,44],[147,45],[148,46],[149,47],[150,48],[151,49],[152,50],[153,51],[154,52],[155,53],[156,54],[157,55],[158,56],[192,57],[218,58],[219,59],[194,60],[197,60],[216,58],[217,58],[207,58],[206,61],[204,58],[199,58],[212,58],[210,58],[214,58],[198,58],[211,58],[215,58],[200,58],[201,58],[213,58],[195,58],[202,58],[203,58],[205,58],[209,58],[220,62],[208,58],[196,58],[233,63],[227,62],[229,64],[228,62],[221,62],[222,62],[224,62],[226,62],[230,64],[231,64],[223,64],[225,64],[235,65],[237,66],[191,67],[188,68],[190,69],[161,2],[166,70],[162,71],[164,72],[163,73],[91,74],[98,75],[90,74],[105,76],[82,77],[81,78],[104,68],[99,79],[102,80],[84,81],[83,82],[79,83],[78,84],[101,85],[80,86],[85,87],[89,87],[107,88],[106,87],[93,89],[94,90],[96,91],[92,92],[95,93],[100,68],[87,94],[88,95],[97,96],[77,97],[103,98],[167,99]]},"version":"5.5.4"}
|