@wbce/projen-d9 0.0.28 → 0.1.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/.jsii +184 -45
- package/API.md +153 -37
- package/CHANGELOG.md +13 -0
- package/README.md +10 -3
- package/docs/D9-plumbing.md +189 -0
- package/lib/cli/atlas.d.ts +10 -0
- package/lib/cli/atlas.js +65 -0
- package/lib/cli/commands/cedar/cedar-format.d.ts +7 -0
- package/lib/cli/commands/cedar/cedar-format.js +75 -0
- package/lib/cli/commands/cedar/cedar-to-d9-translations.d.ts +12 -0
- package/lib/cli/commands/cedar/cedar-to-d9-translations.js +130 -0
- package/lib/cli/commands/cedar/cedar-to-d9.d.ts +57 -0
- package/lib/cli/commands/cedar/cedar-to-d9.js +221 -0
- package/lib/cli/commands/cedar/cedar-translations.d.ts +9 -0
- package/lib/cli/commands/cedar/cedar-translations.js +213 -0
- package/lib/cli/commands/cedar/d9-permission.d.ts +27 -0
- package/lib/cli/commands/cedar/d9-permission.js +45 -0
- package/lib/cli/commands/cedar/d9-to-cedar.d.ts +33 -0
- package/lib/cli/commands/cedar/d9-to-cedar.js +157 -0
- package/lib/cli/commands/cedar/roles-table.d.ts +14 -0
- package/lib/cli/commands/cedar/roles-table.js +29 -0
- package/lib/cli/commands/save/apply-snapshot.js +39 -30
- package/lib/cli/commands/save/check-unsaved.d.ts +9 -0
- package/lib/cli/commands/save/check-unsaved.js +81 -0
- package/lib/cli/commands/save/env.d.ts +33 -0
- package/lib/cli/commands/save/env.js +109 -0
- package/lib/cli/commands/save/save-snapshot.d.ts +9 -0
- package/lib/cli/commands/save/save-snapshot.js +232 -0
- package/lib/cli/commands/save/sync-files.d.ts +5 -0
- package/lib/cli/commands/save/sync-files.js +46 -0
- package/lib/cli/commands/save/transfer.d.ts +18 -0
- package/lib/cli/commands/save/transfer.js +96 -0
- package/lib/cli/commands/save/utils.d.ts +5 -0
- package/lib/cli/commands/save/utils.js +33 -3
- package/lib/cli/commands/sync.js +4 -3
- package/lib/cli/index.js +65 -25
- package/lib/cli/logger.d.ts +2 -0
- package/lib/cli/logger.js +10 -0
- package/lib/cli/plumbing-config.d.ts +11 -0
- package/lib/cli/plumbing-config.js +13 -0
- package/lib/index.d.ts +44 -5
- package/lib/index.js +54 -41
- package/node_modules/@cedar-policy/cedar-wasm/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.d.ts +427 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.js +9 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.js +434 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/package.json +23 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.d.ts +427 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.js +463 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/package.json +18 -0
- package/node_modules/@cedar-policy/cedar-wasm/package.json +53 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.d.ts +486 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.js +534 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/package.json +21 -0
- package/node_modules/@types/node/README.md +5 -6
- package/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/node_modules/@types/node/assert.d.ts +1040 -79
- package/node_modules/@types/node/async_hooks.d.ts +476 -119
- package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/node_modules/@types/node/buffer.d.ts +1925 -13
- package/node_modules/@types/node/child_process.d.ts +1204 -235
- package/node_modules/@types/node/cluster.d.ts +455 -137
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/node_modules/@types/node/console.d.ts +450 -1
- package/node_modules/@types/node/constants.d.ts +20 -447
- package/node_modules/@types/node/crypto.d.ts +3962 -600
- package/node_modules/@types/node/dgram.d.ts +515 -33
- package/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/node_modules/@types/node/dns.d.ts +798 -247
- package/node_modules/@types/node/domain.d.ts +164 -10
- package/node_modules/@types/node/events.d.ts +954 -25
- package/node_modules/@types/node/fs/promises.d.ts +1295 -0
- package/node_modules/@types/node/fs.d.ts +3463 -1569
- package/node_modules/@types/node/globals.d.ts +98 -1277
- package/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/node_modules/@types/node/http.d.ts +1933 -300
- package/node_modules/@types/node/http2.d.ts +1946 -254
- package/node_modules/@types/node/https.d.ts +557 -134
- package/node_modules/@types/node/index.d.ts +54 -48
- package/node_modules/@types/node/inspector.d.ts +227 -3014
- package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/node_modules/@types/node/module.d.ts +890 -2
- package/node_modules/@types/node/net.d.ts +872 -105
- package/node_modules/@types/node/os.d.ts +452 -209
- package/node_modules/@types/node/package.json +78 -128
- package/node_modules/@types/node/path.d.ts +196 -155
- package/node_modules/@types/node/perf_hooks.d.ts +829 -120
- package/node_modules/@types/node/process.d.ts +2072 -3
- package/node_modules/@types/node/punycode.d.ts +69 -27
- package/node_modules/@types/node/querystring.d.ts +132 -9
- package/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/node_modules/@types/node/readline.d.ts +485 -49
- package/node_modules/@types/node/repl.d.ts +121 -83
- package/node_modules/@types/node/sea.d.ts +153 -0
- package/node_modules/@types/node/sqlite.d.ts +721 -0
- package/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/node_modules/@types/node/stream/web.d.ts +622 -0
- package/node_modules/@types/node/stream.d.ts +1470 -140
- package/node_modules/@types/node/string_decoder.d.ts +64 -4
- package/node_modules/@types/node/test.d.ts +2163 -0
- package/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/node_modules/@types/node/timers.d.ts +284 -13
- package/node_modules/@types/node/tls.d.ts +850 -244
- package/node_modules/@types/node/trace_events.d.ts +147 -11
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +97 -0
- package/node_modules/@types/node/tty.d.ts +160 -18
- package/node_modules/@types/node/url.d.ts +890 -53
- package/node_modules/@types/node/util.d.ts +2566 -160
- package/node_modules/@types/node/v8.d.ts +806 -83
- package/node_modules/@types/node/vm.d.ts +932 -44
- package/node_modules/@types/node/wasi.d.ts +148 -22
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +657 -80
- package/node_modules/@types/node/zlib.d.ts +510 -119
- package/node_modules/pino/.nojekyll +0 -0
- package/node_modules/pino/.prettierignore +1 -0
- package/node_modules/pino/CNAME +1 -0
- package/node_modules/pino/CONTRIBUTING.md +34 -0
- package/node_modules/pino/LICENSE +21 -0
- package/node_modules/pino/README.md +177 -0
- package/node_modules/pino/SECURITY.md +103 -0
- package/node_modules/pino/benchmarks/basic.bench.js +95 -0
- package/node_modules/pino/benchmarks/child-child.bench.js +52 -0
- package/node_modules/pino/benchmarks/child-creation.bench.js +73 -0
- package/node_modules/pino/benchmarks/child.bench.js +62 -0
- package/node_modules/pino/benchmarks/deep-object.bench.js +88 -0
- package/node_modules/pino/benchmarks/formatters.bench.js +50 -0
- package/node_modules/pino/benchmarks/internal/custom-levels.js +67 -0
- package/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js +76 -0
- package/node_modules/pino/benchmarks/internal/just-pino.bench.js +182 -0
- package/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js +75 -0
- package/node_modules/pino/benchmarks/internal/redact.bench.js +86 -0
- package/node_modules/pino/benchmarks/long-string.bench.js +81 -0
- package/node_modules/pino/benchmarks/multi-arg.bench.js +193 -0
- package/node_modules/pino/benchmarks/multistream.js +98 -0
- package/node_modules/pino/benchmarks/object.bench.js +82 -0
- package/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js +36 -0
- package/node_modules/pino/benchmarks/utils/runbench.js +138 -0
- package/node_modules/pino/benchmarks/utils/wrap-log-level.js +55 -0
- package/node_modules/pino/bin.js +6 -0
- package/node_modules/pino/browser.js +607 -0
- package/node_modules/pino/build/sync-version.js +25 -0
- package/node_modules/pino/docs/api.md +1664 -0
- package/node_modules/pino/docs/asynchronous.md +55 -0
- package/node_modules/pino/docs/benchmarks.md +55 -0
- package/node_modules/pino/docs/browser.md +341 -0
- package/node_modules/pino/docs/bundling.md +40 -0
- package/node_modules/pino/docs/child-loggers.md +116 -0
- package/node_modules/pino/docs/diagnostics.md +16 -0
- package/node_modules/pino/docs/ecosystem.md +87 -0
- package/node_modules/pino/docs/help.md +353 -0
- package/node_modules/pino/docs/lts.md +93 -0
- package/node_modules/pino/docs/pretty.md +38 -0
- package/node_modules/pino/docs/redaction.md +130 -0
- package/node_modules/pino/docs/transports.md +1447 -0
- package/node_modules/pino/docs/web.md +306 -0
- package/node_modules/pino/eslint.config.js +36 -0
- package/node_modules/pino/examples/basic.js +43 -0
- package/node_modules/pino/examples/transport.js +68 -0
- package/node_modules/pino/favicon.ico +0 -0
- package/node_modules/pino/file.js +12 -0
- package/node_modules/pino/inc-version.sh +42 -0
- package/node_modules/pino/index.html +55 -0
- package/node_modules/pino/lib/caller.js +40 -0
- package/node_modules/pino/lib/constants.js +28 -0
- package/node_modules/pino/lib/deprecations.js +8 -0
- package/node_modules/pino/lib/levels.js +241 -0
- package/node_modules/pino/lib/meta.js +3 -0
- package/node_modules/pino/lib/multistream.js +211 -0
- package/node_modules/pino/lib/proto.js +256 -0
- package/node_modules/pino/lib/redaction.js +119 -0
- package/node_modules/pino/lib/symbols.js +76 -0
- package/node_modules/pino/lib/time.js +39 -0
- package/node_modules/pino/lib/tools.js +427 -0
- package/node_modules/pino/lib/transport-stream.js +56 -0
- package/node_modules/pino/lib/transport.js +302 -0
- package/node_modules/pino/lib/worker.js +197 -0
- package/node_modules/pino/package.json +112 -0
- package/node_modules/pino/pino.d.ts +881 -0
- package/node_modules/pino/pino.js +259 -0
- package/node_modules/pino/test/basic.test.js +952 -0
- package/node_modules/pino/test/broken-pipe.test.js +59 -0
- package/node_modules/pino/test/browser-bindings.test.js +114 -0
- package/node_modules/pino/test/browser-child.test.js +132 -0
- package/node_modules/pino/test/browser-disabled.test.js +87 -0
- package/node_modules/pino/test/browser-early-console-freeze.test.js +12 -0
- package/node_modules/pino/test/browser-is-level-enabled.test.js +101 -0
- package/node_modules/pino/test/browser-levels.test.js +241 -0
- package/node_modules/pino/test/browser-redaction.test.js +264 -0
- package/node_modules/pino/test/browser-serializers.test.js +352 -0
- package/node_modules/pino/test/browser-set-bindings.test.js +99 -0
- package/node_modules/pino/test/browser-timestamp.test.js +88 -0
- package/node_modules/pino/test/browser-transmit.test.js +417 -0
- package/node_modules/pino/test/browser.test.js +698 -0
- package/node_modules/pino/test/caller.test.js +20 -0
- package/node_modules/pino/test/complex-objects.test.js +36 -0
- package/node_modules/pino/test/crlf.test.js +34 -0
- package/node_modules/pino/test/custom-levels.test.js +267 -0
- package/node_modules/pino/test/diagnostics.test.js +107 -0
- package/node_modules/pino/test/error-key.test.js +37 -0
- package/node_modules/pino/test/error.test.js +403 -0
- package/node_modules/pino/test/escaping.test.js +110 -0
- package/node_modules/pino/test/esm/esm.mjs +14 -0
- package/node_modules/pino/test/esm/index.test.js +21 -0
- package/node_modules/pino/test/esm/named-exports.mjs +29 -0
- package/node_modules/pino/test/exit.test.js +79 -0
- package/node_modules/pino/test/fixtures/broken-pipe/basic.js +9 -0
- package/node_modules/pino/test/fixtures/broken-pipe/destination.js +10 -0
- package/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js +12 -0
- package/node_modules/pino/test/fixtures/caller-loop.js +6 -0
- package/node_modules/pino/test/fixtures/console-transport.js +13 -0
- package/node_modules/pino/test/fixtures/crashing-transport.js +13 -0
- package/node_modules/pino/test/fixtures/default-exit.js +8 -0
- package/node_modules/pino/test/fixtures/destination-exit.js +8 -0
- package/node_modules/pino/test/fixtures/eval/index.js +13 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/14-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/2-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file1.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file10.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file11.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file12.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file13.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file14.js +11 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file2.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file3.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file4.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file5.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file6.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file7.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file8.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file9.js +5 -0
- package/node_modules/pino/test/fixtures/noop-transport.js +10 -0
- package/node_modules/pino/test/fixtures/pretty/null-prototype.js +8 -0
- package/node_modules/pino/test/fixtures/stdout-hack-protection.js +11 -0
- package/node_modules/pino/test/fixtures/syncfalse-child.js +6 -0
- package/node_modules/pino/test/fixtures/syncfalse-exit.js +9 -0
- package/node_modules/pino/test/fixtures/syncfalse-flush-exit.js +10 -0
- package/node_modules/pino/test/fixtures/syncfalse.js +6 -0
- package/node_modules/pino/test/fixtures/syntax-error-esm.mjs +2 -0
- package/node_modules/pino/test/fixtures/to-file-transport-with-transform.js +20 -0
- package/node_modules/pino/test/fixtures/to-file-transport.js +13 -0
- package/node_modules/pino/test/fixtures/to-file-transport.mjs +8 -0
- package/node_modules/pino/test/fixtures/transport/index.js +12 -0
- package/node_modules/pino/test/fixtures/transport/package.json +5 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately.js +11 -0
- package/node_modules/pino/test/fixtures/transport-exit-on-ready.js +12 -0
- package/node_modules/pino/test/fixtures/transport-invalid-node-options.js +26 -0
- package/node_modules/pino/test/fixtures/transport-main.js +9 -0
- package/node_modules/pino/test/fixtures/transport-many-lines.js +29 -0
- package/node_modules/pino/test/fixtures/transport-preload-main.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-preload.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-string-stdout.js +9 -0
- package/node_modules/pino/test/fixtures/transport-transform.js +21 -0
- package/node_modules/pino/test/fixtures/transport-uses-pino-config.js +33 -0
- package/node_modules/pino/test/fixtures/transport-with-on-exit.js +12 -0
- package/node_modules/pino/test/fixtures/transport-worker-data.js +19 -0
- package/node_modules/pino/test/fixtures/transport-worker-name.js +24 -0
- package/node_modules/pino/test/fixtures/transport-worker.js +15 -0
- package/node_modules/pino/test/fixtures/transport-wrong-export-type.js +3 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-native.mts +15 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transpile.cjs +36 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts +10 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transport-main.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-worker.ts +14 -0
- package/node_modules/pino/test/formatters.test.js +364 -0
- package/node_modules/pino/test/helper.d.ts +4 -0
- package/node_modules/pino/test/helper.js +159 -0
- package/node_modules/pino/test/hooks.test.js +114 -0
- package/node_modules/pino/test/http.test.js +214 -0
- package/node_modules/pino/test/internals/version.test.js +17 -0
- package/node_modules/pino/test/is-level-enabled.test.js +179 -0
- package/node_modules/pino/test/jest/basic.spec.js +10 -0
- package/node_modules/pino/test/levels.test.js +810 -0
- package/node_modules/pino/test/metadata.test.js +120 -0
- package/node_modules/pino/test/mixin-merge-strategy.test.js +57 -0
- package/node_modules/pino/test/mixin.test.js +241 -0
- package/node_modules/pino/test/multistream.test.js +793 -0
- package/node_modules/pino/test/redact.test.js +923 -0
- package/node_modules/pino/test/serializers.test.js +257 -0
- package/node_modules/pino/test/smoke.js +59 -0
- package/node_modules/pino/test/stdout-protection.test.js +41 -0
- package/node_modules/pino/test/syncfalse.test.js +186 -0
- package/node_modules/pino/test/timestamp-nano.test.js +37 -0
- package/node_modules/pino/test/timestamp.test.js +124 -0
- package/node_modules/pino/test/transport/big.test.js +42 -0
- package/node_modules/pino/test/transport/bundlers-support.test.js +99 -0
- package/node_modules/pino/test/transport/caller.test.js +24 -0
- package/node_modules/pino/test/transport/core.test.js +818 -0
- package/node_modules/pino/test/transport/core.transpiled.test.ts +114 -0
- package/node_modules/pino/test/transport/crash.test.js +36 -0
- package/node_modules/pino/test/transport/module-link.test.js +241 -0
- package/node_modules/pino/test/transport/native-type-stripping.test.mjs +151 -0
- package/node_modules/pino/test/transport/node-options.test.js +116 -0
- package/node_modules/pino/test/transport/pipeline.test.js +137 -0
- package/node_modules/pino/test/transport/preload.test.js +54 -0
- package/node_modules/pino/test/transport/repl.test.js +15 -0
- package/node_modules/pino/test/transport/sync-false.test.js +79 -0
- package/node_modules/pino/test/transport/sync-true.test.js +57 -0
- package/node_modules/pino/test/transport/targets.test.js +48 -0
- package/node_modules/pino/test/transport/uses-pino-config.test.js +166 -0
- package/node_modules/pino/test/transport-stream.test.js +40 -0
- package/node_modules/pino/test/types/pino-import.tst.cts +30 -0
- package/node_modules/pino/test/types/pino-import.tst.js +73 -0
- package/node_modules/pino/test/types/pino-multistream.tst.ts +49 -0
- package/node_modules/pino/test/types/pino-top-export.tst.ts +32 -0
- package/node_modules/pino/test/types/pino-transport.tst.ts +171 -0
- package/node_modules/pino/test/types/pino-type-only.tst.ts +77 -0
- package/node_modules/pino/test/types/pino.ts +98 -0
- package/node_modules/pino/test/types/pino.tst.ts +681 -0
- package/node_modules/pino/test/types/tsconfig.json +10 -0
- package/node_modules/pino/tsconfig.json +14 -0
- package/node_modules/pino-pretty/.borp.yaml +6 -0
- package/node_modules/pino-pretty/.editorconfig +13 -0
- package/node_modules/pino-pretty/.github/dependabot.yml +13 -0
- package/node_modules/pino-pretty/.github/workflows/ci.yml +83 -0
- package/node_modules/pino-pretty/LICENSE +21 -0
- package/node_modules/pino-pretty/Readme.md +425 -0
- package/node_modules/pino-pretty/SECURITY.md +146 -0
- package/node_modules/pino-pretty/benchmark.js +105 -0
- package/node_modules/pino-pretty/bin.js +113 -0
- package/node_modules/pino-pretty/demo.png +0 -0
- package/node_modules/pino-pretty/docs/help.md +24 -0
- package/node_modules/pino-pretty/eslint.config.js +5 -0
- package/node_modules/pino-pretty/help/help.txt +68 -0
- package/node_modules/pino-pretty/index.d.ts +227 -0
- package/node_modules/pino-pretty/index.js +234 -0
- package/node_modules/pino-pretty/lib/colors.js +134 -0
- package/node_modules/pino-pretty/lib/colors.test.js +132 -0
- package/node_modules/pino-pretty/lib/constants.js +55 -0
- package/node_modules/pino-pretty/lib/pretty.js +171 -0
- package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.js +69 -0
- package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.test.js +84 -0
- package/node_modules/pino-pretty/lib/utils/create-date.js +26 -0
- package/node_modules/pino-pretty/lib/utils/create-date.test.js +20 -0
- package/node_modules/pino-pretty/lib/utils/delete-log-property.js +28 -0
- package/node_modules/pino-pretty/lib/utils/delete-log-property.test.js +31 -0
- package/node_modules/pino-pretty/lib/utils/filter-log.js +99 -0
- package/node_modules/pino-pretty/lib/utils/filter-log.test.js +265 -0
- package/node_modules/pino-pretty/lib/utils/format-time.js +66 -0
- package/node_modules/pino-pretty/lib/utils/format-time.test.js +71 -0
- package/node_modules/pino-pretty/lib/utils/get-level-label-data.js +29 -0
- package/node_modules/pino-pretty/lib/utils/get-property-value.js +30 -0
- package/node_modules/pino-pretty/lib/utils/get-property-value.test.js +31 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.js +38 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.test.js +45 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.js +39 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.test.js +47 -0
- package/node_modules/pino-pretty/lib/utils/index.js +108 -0
- package/node_modules/pino-pretty/lib/utils/index.test.js +37 -0
- package/node_modules/pino-pretty/lib/utils/interpret-conditionals.js +41 -0
- package/node_modules/pino-pretty/lib/utils/interpret-conditionals.test.js +84 -0
- package/node_modules/pino-pretty/lib/utils/is-object.js +7 -0
- package/node_modules/pino-pretty/lib/utils/is-object.test.js +10 -0
- package/node_modules/pino-pretty/lib/utils/is-valid-date.js +14 -0
- package/node_modules/pino-pretty/lib/utils/is-valid-date.test.js +16 -0
- package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.js +29 -0
- package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.test.js +16 -0
- package/node_modules/pino-pretty/lib/utils/noop.js +3 -0
- package/node_modules/pino-pretty/lib/utils/noop.test.js +12 -0
- package/node_modules/pino-pretty/lib/utils/parse-factory-options.js +171 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error-log.js +76 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error-log.test.js +143 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error.js +54 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error.test.js +25 -0
- package/node_modules/pino-pretty/lib/utils/prettify-level.js +41 -0
- package/node_modules/pino-pretty/lib/utils/prettify-level.test.js +70 -0
- package/node_modules/pino-pretty/lib/utils/prettify-message.js +65 -0
- package/node_modules/pino-pretty/lib/utils/prettify-message.test.js +287 -0
- package/node_modules/pino-pretty/lib/utils/prettify-metadata.js +75 -0
- package/node_modules/pino-pretty/lib/utils/prettify-metadata.test.js +170 -0
- package/node_modules/pino-pretty/lib/utils/prettify-object.js +115 -0
- package/node_modules/pino-pretty/lib/utils/prettify-object.test.js +217 -0
- package/node_modules/pino-pretty/lib/utils/prettify-time.js +43 -0
- package/node_modules/pino-pretty/lib/utils/prettify-time.test.js +264 -0
- package/node_modules/pino-pretty/lib/utils/split-property-key.js +49 -0
- package/node_modules/pino-pretty/lib/utils/split-property-key.test.js +29 -0
- package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.js +18 -0
- package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.test.js +9 -0
- package/node_modules/pino-pretty/package.json +64 -0
- package/node_modules/pino-pretty/test/basic.test.js +1305 -0
- package/node_modules/pino-pretty/test/boolean-options.test.js +228 -0
- package/node_modules/pino-pretty/test/cli-rc.test.js +275 -0
- package/node_modules/pino-pretty/test/cli.test.js +360 -0
- package/node_modules/pino-pretty/test/crlf.test.js +33 -0
- package/node_modules/pino-pretty/test/error-objects.test.js +494 -0
- package/node_modules/pino-pretty/test/example/example.js +33 -0
- package/node_modules/pino-pretty/test/helper.js +19 -0
- package/node_modules/pino-pretty/test/types/exports.tst.ts +15 -0
- package/node_modules/pino-pretty/test/types/pino-pretty.tst.ts +140 -0
- package/node_modules/pino-pretty/test/types/tsconfig.json +9 -0
- package/package.json +12 -5
- package/lib/cli/commands/init.d.ts +0 -1
- package/lib/cli/commands/init.js +0 -8
- package/node_modules/@types/node/globals.global.d.ts +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const assert = require('node:assert')
|
|
5
|
+
const os = require('node:os')
|
|
6
|
+
const { join } = require('node:path')
|
|
7
|
+
const { readFile } = require('node:fs').promises
|
|
8
|
+
|
|
9
|
+
const { watchFileCreated, file } = require('../helper')
|
|
10
|
+
const pino = require('../../')
|
|
11
|
+
const { DEFAULT_LEVELS } = require('../../lib/constants')
|
|
12
|
+
|
|
13
|
+
const { pid } = process
|
|
14
|
+
const hostname = os.hostname()
|
|
15
|
+
|
|
16
|
+
test('pino.transport with a pipeline', async (t) => {
|
|
17
|
+
const destination = file()
|
|
18
|
+
const transport = pino.transport({
|
|
19
|
+
pipeline: [{
|
|
20
|
+
target: join(__dirname, '..', 'fixtures', 'transport-transform.js')
|
|
21
|
+
}, {
|
|
22
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
23
|
+
options: { destination }
|
|
24
|
+
}]
|
|
25
|
+
})
|
|
26
|
+
t.after(transport.end.bind(transport))
|
|
27
|
+
const instance = pino(transport)
|
|
28
|
+
instance.info('hello')
|
|
29
|
+
await watchFileCreated(destination)
|
|
30
|
+
const result = JSON.parse(await readFile(destination))
|
|
31
|
+
delete result.time
|
|
32
|
+
assert.deepEqual(result, {
|
|
33
|
+
pid,
|
|
34
|
+
hostname,
|
|
35
|
+
level: DEFAULT_LEVELS.info,
|
|
36
|
+
msg: 'hello',
|
|
37
|
+
service: 'pino' // this property was added by the transform
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test('pino.transport with targets containing pipelines', async (t) => {
|
|
42
|
+
const destinationA = file()
|
|
43
|
+
const destinationB = file()
|
|
44
|
+
const transport = pino.transport({
|
|
45
|
+
targets: [
|
|
46
|
+
{
|
|
47
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
48
|
+
options: { destination: destinationA }
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
pipeline: [
|
|
52
|
+
{
|
|
53
|
+
target: join(__dirname, '..', 'fixtures', 'transport-transform.js')
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
57
|
+
options: { destination: destinationB }
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
t.after(transport.end.bind(transport))
|
|
65
|
+
const instance = pino(transport)
|
|
66
|
+
instance.info('hello')
|
|
67
|
+
await watchFileCreated(destinationA)
|
|
68
|
+
await watchFileCreated(destinationB)
|
|
69
|
+
const resultA = JSON.parse(await readFile(destinationA))
|
|
70
|
+
const resultB = JSON.parse(await readFile(destinationB))
|
|
71
|
+
delete resultA.time
|
|
72
|
+
delete resultB.time
|
|
73
|
+
assert.deepEqual(resultA, {
|
|
74
|
+
pid,
|
|
75
|
+
hostname,
|
|
76
|
+
level: DEFAULT_LEVELS.info,
|
|
77
|
+
msg: 'hello'
|
|
78
|
+
})
|
|
79
|
+
assert.deepEqual(resultB, {
|
|
80
|
+
pid,
|
|
81
|
+
hostname,
|
|
82
|
+
level: DEFAULT_LEVELS.info,
|
|
83
|
+
msg: 'hello',
|
|
84
|
+
service: 'pino' // this property was added by the transform
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('pino.transport with targets containing pipelines with levels defined and dedupe', async (t) => {
|
|
89
|
+
const destinationA = file()
|
|
90
|
+
const destinationB = file()
|
|
91
|
+
const transport = pino.transport({
|
|
92
|
+
targets: [
|
|
93
|
+
{
|
|
94
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
95
|
+
options: { destination: destinationA },
|
|
96
|
+
level: DEFAULT_LEVELS.info
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
pipeline: [
|
|
100
|
+
{
|
|
101
|
+
target: join(__dirname, '..', 'fixtures', 'transport-transform.js')
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
105
|
+
options: { destination: destinationB }
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
level: DEFAULT_LEVELS.error
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
dedupe: true
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
t.after(transport.end.bind(transport))
|
|
115
|
+
const instance = pino(transport)
|
|
116
|
+
instance.info('hello info')
|
|
117
|
+
instance.error('hello error')
|
|
118
|
+
await watchFileCreated(destinationA)
|
|
119
|
+
await watchFileCreated(destinationB)
|
|
120
|
+
const resultA = JSON.parse(await readFile(destinationA))
|
|
121
|
+
const resultB = JSON.parse(await readFile(destinationB))
|
|
122
|
+
delete resultA.time
|
|
123
|
+
delete resultB.time
|
|
124
|
+
assert.deepEqual(resultA, {
|
|
125
|
+
pid,
|
|
126
|
+
hostname,
|
|
127
|
+
level: DEFAULT_LEVELS.info,
|
|
128
|
+
msg: 'hello info'
|
|
129
|
+
})
|
|
130
|
+
assert.deepEqual(resultB, {
|
|
131
|
+
pid,
|
|
132
|
+
hostname,
|
|
133
|
+
level: DEFAULT_LEVELS.error,
|
|
134
|
+
msg: 'hello error',
|
|
135
|
+
service: 'pino' // this property was added by the transform
|
|
136
|
+
})
|
|
137
|
+
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const assert = require('node:assert')
|
|
5
|
+
const { join } = require('node:path')
|
|
6
|
+
const { pathToFileURL } = require('node:url')
|
|
7
|
+
const { readFile } = require('node:fs').promises
|
|
8
|
+
const execa = require('execa')
|
|
9
|
+
|
|
10
|
+
const { file, watchFileCreated } = require('../helper')
|
|
11
|
+
|
|
12
|
+
test('pino.transport works when loaded via --import=preload', async () => {
|
|
13
|
+
const destination = file()
|
|
14
|
+
const preload = pathToFileURL(join(__dirname, '..', 'fixtures', 'transport-preload.mjs')).href
|
|
15
|
+
const main = join(__dirname, '..', 'fixtures', 'transport-preload-main.mjs')
|
|
16
|
+
|
|
17
|
+
await execa(process.argv[0], [
|
|
18
|
+
`--import=${preload}`,
|
|
19
|
+
main,
|
|
20
|
+
destination
|
|
21
|
+
], { timeout: 10000 })
|
|
22
|
+
|
|
23
|
+
await watchFileCreated(destination)
|
|
24
|
+
const result = JSON.parse(await readFile(destination))
|
|
25
|
+
assert.equal(result.msg, 'hello from main')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('pino.transport works when loaded via --import preload (space separated)', async () => {
|
|
29
|
+
const destination = file()
|
|
30
|
+
const preload = pathToFileURL(join(__dirname, '..', 'fixtures', 'transport-preload.mjs')).href
|
|
31
|
+
const main = join(__dirname, '..', 'fixtures', 'transport-preload-main.mjs')
|
|
32
|
+
|
|
33
|
+
await execa(process.argv[0], [
|
|
34
|
+
'--import',
|
|
35
|
+
preload,
|
|
36
|
+
main,
|
|
37
|
+
destination
|
|
38
|
+
], { timeout: 10000 })
|
|
39
|
+
|
|
40
|
+
await watchFileCreated(destination)
|
|
41
|
+
const result = JSON.parse(await readFile(destination))
|
|
42
|
+
assert.equal(result.msg, 'hello from main')
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test('pino.transport ignores missing absolute preload from NODE_OPTIONS in worker', async () => {
|
|
46
|
+
const destination = file()
|
|
47
|
+
const main = join(__dirname, '..', 'fixtures', 'transport-invalid-node-options.js')
|
|
48
|
+
|
|
49
|
+
await execa(process.argv[0], [main, destination], { timeout: 10000 })
|
|
50
|
+
|
|
51
|
+
await watchFileCreated(destination)
|
|
52
|
+
const result = JSON.parse(await readFile(destination))
|
|
53
|
+
assert.equal(result.msg, 'hello with invalid node options preload')
|
|
54
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const assert = require('node:assert')
|
|
5
|
+
const proxyquire = require('proxyquire')
|
|
6
|
+
|
|
7
|
+
test('pino.transport resolves targets in REPL', async () => {
|
|
8
|
+
// Arrange
|
|
9
|
+
const transport = proxyquire('../../lib/transport', {
|
|
10
|
+
'./caller': () => ['node:repl']
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Act / Assert
|
|
14
|
+
assert.doesNotThrow(() => transport({ target: 'pino-pretty' }))
|
|
15
|
+
})
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const assert = require('node:assert')
|
|
5
|
+
const os = require('node:os')
|
|
6
|
+
const { join } = require('node:path')
|
|
7
|
+
const { readFile } = require('node:fs').promises
|
|
8
|
+
const { promisify } = require('node:util')
|
|
9
|
+
const { once } = require('node:events')
|
|
10
|
+
|
|
11
|
+
const pino = require('../..')
|
|
12
|
+
const { watchFileCreated, watchForWrite, file } = require('../helper')
|
|
13
|
+
|
|
14
|
+
const { pid } = process
|
|
15
|
+
const hostname = os.hostname()
|
|
16
|
+
|
|
17
|
+
test('thread-stream async flush', async () => {
|
|
18
|
+
const destination = file()
|
|
19
|
+
const transport = pino.transport({
|
|
20
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
21
|
+
options: { destination }
|
|
22
|
+
})
|
|
23
|
+
const instance = pino(transport)
|
|
24
|
+
instance.info('hello')
|
|
25
|
+
|
|
26
|
+
assert.equal(instance.flush(), undefined)
|
|
27
|
+
|
|
28
|
+
await watchFileCreated(destination)
|
|
29
|
+
const result = JSON.parse(await readFile(destination))
|
|
30
|
+
delete result.time
|
|
31
|
+
assert.deepEqual(result, {
|
|
32
|
+
pid,
|
|
33
|
+
hostname,
|
|
34
|
+
level: 30,
|
|
35
|
+
msg: 'hello'
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('thread-stream async flush should call the passed callback', async () => {
|
|
40
|
+
const outputPath = file()
|
|
41
|
+
async function getOutputLogLines () {
|
|
42
|
+
return (await readFile(outputPath)).toString().trim().split('\n').map(JSON.parse)
|
|
43
|
+
}
|
|
44
|
+
const transport = pino.transport({
|
|
45
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
46
|
+
options: { destination: outputPath }
|
|
47
|
+
})
|
|
48
|
+
const instance = pino(transport)
|
|
49
|
+
const flushPromise = promisify(instance.flush).bind(instance)
|
|
50
|
+
|
|
51
|
+
// The worker thread backing the transport is unref'd once it becomes ready
|
|
52
|
+
// (see lib/transport.js) so it does not keep the process alive. Because this
|
|
53
|
+
// test awaits `flush()` on an otherwise idle event loop, re-ref the worker
|
|
54
|
+
// after it is ready so the loop stays alive until the flush callback runs;
|
|
55
|
+
// otherwise the awaited promise never settles and the test hangs.
|
|
56
|
+
await once(transport, 'ready')
|
|
57
|
+
transport.ref()
|
|
58
|
+
|
|
59
|
+
instance.info('hello')
|
|
60
|
+
await flushPromise()
|
|
61
|
+
await watchFileCreated(outputPath)
|
|
62
|
+
|
|
63
|
+
const [firstFlushData] = await getOutputLogLines()
|
|
64
|
+
|
|
65
|
+
assert.equal(firstFlushData.msg, 'hello')
|
|
66
|
+
|
|
67
|
+
instance.info('world')
|
|
68
|
+
|
|
69
|
+
await flushPromise()
|
|
70
|
+
await watchForWrite(outputPath, 'world')
|
|
71
|
+
|
|
72
|
+
// After flush, both messages should be present
|
|
73
|
+
const afterSecondFlush = await getOutputLogLines()
|
|
74
|
+
assert.equal(afterSecondFlush.length, 2)
|
|
75
|
+
assert.equal(afterSecondFlush[1].msg, 'world')
|
|
76
|
+
|
|
77
|
+
// Restore the unref'd state so the test process can exit cleanly.
|
|
78
|
+
transport.unref()
|
|
79
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const assert = require('node:assert')
|
|
5
|
+
const { join } = require('node:path')
|
|
6
|
+
const { readFileSync } = require('node:fs')
|
|
7
|
+
|
|
8
|
+
const { file } = require('../helper')
|
|
9
|
+
const pino = require('../..')
|
|
10
|
+
|
|
11
|
+
test('thread-stream sync true should log synchronously', async () => {
|
|
12
|
+
const outputPath = file()
|
|
13
|
+
|
|
14
|
+
function getOutputLogLines () {
|
|
15
|
+
return (readFileSync(outputPath)).toString().trim().split('\n').map(JSON.parse)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const transport = pino.transport({
|
|
19
|
+
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
|
|
20
|
+
options: { destination: outputPath, flush: true },
|
|
21
|
+
sync: true
|
|
22
|
+
})
|
|
23
|
+
const instance = pino(transport)
|
|
24
|
+
|
|
25
|
+
var value = { message: 'sync' }
|
|
26
|
+
instance.info(value)
|
|
27
|
+
instance.info(value)
|
|
28
|
+
instance.info(value)
|
|
29
|
+
instance.info(value)
|
|
30
|
+
instance.info(value)
|
|
31
|
+
instance.info(value)
|
|
32
|
+
let interrupt = false
|
|
33
|
+
let flushData
|
|
34
|
+
let loopCounter = 0
|
|
35
|
+
|
|
36
|
+
// Start a synchronous loop
|
|
37
|
+
while (!interrupt && loopCounter < (process.env.MAX_TEST_LOOP_ITERATION || 20000)) {
|
|
38
|
+
try {
|
|
39
|
+
loopCounter++
|
|
40
|
+
const data = getOutputLogLines()
|
|
41
|
+
flushData = data
|
|
42
|
+
if (data) {
|
|
43
|
+
interrupt = true
|
|
44
|
+
break
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
// File may not exist yet
|
|
48
|
+
// Wait till MAX_TEST_LOOP_ITERATION iterations
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!interrupt) {
|
|
53
|
+
throw new Error('Sync loop did not get interrupt')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
assert.equal(flushData.length, 6)
|
|
57
|
+
})
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const { join } = require('node:path')
|
|
5
|
+
const Writable = require('node:stream').Writable
|
|
6
|
+
const proxyquire = require('proxyquire')
|
|
7
|
+
const tspl = require('@matteo.collina/tspl')
|
|
8
|
+
const pino = require('../../pino')
|
|
9
|
+
|
|
10
|
+
test('file-target mocked', async function (t) {
|
|
11
|
+
const plan = tspl(t, { plan: 1 })
|
|
12
|
+
let ret
|
|
13
|
+
const fileTarget = proxyquire('../../file', {
|
|
14
|
+
'./pino': {
|
|
15
|
+
destination (opts) {
|
|
16
|
+
plan.deepEqual(opts, { dest: 1, sync: false })
|
|
17
|
+
|
|
18
|
+
ret = new Writable()
|
|
19
|
+
ret.fd = opts.dest
|
|
20
|
+
|
|
21
|
+
process.nextTick(() => {
|
|
22
|
+
ret.emit('ready')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return ret
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
await fileTarget()
|
|
31
|
+
await plan
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('pino.transport with syntax error', async (t) => {
|
|
35
|
+
const plan = tspl(t, { plan: 1 })
|
|
36
|
+
const transport = pino.transport({
|
|
37
|
+
targets: [{
|
|
38
|
+
target: join(__dirname, '..', 'fixtures', 'syntax-error-esm.mjs')
|
|
39
|
+
}]
|
|
40
|
+
})
|
|
41
|
+
t.after(transport.end.bind(transport))
|
|
42
|
+
|
|
43
|
+
transport.on('error', (err) => {
|
|
44
|
+
plan.deepEqual(err, new SyntaxError('Unexpected end of input'))
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
await plan
|
|
48
|
+
})
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const assert = require('node:assert')
|
|
5
|
+
const os = require('node:os')
|
|
6
|
+
const { join } = require('node:path')
|
|
7
|
+
const { readFile } = require('node:fs').promises
|
|
8
|
+
const writeStream = require('flush-write-stream')
|
|
9
|
+
|
|
10
|
+
const { watchForWrite, file } = require('../helper')
|
|
11
|
+
const pino = require('../../')
|
|
12
|
+
|
|
13
|
+
const { pid } = process
|
|
14
|
+
const hostname = os.hostname()
|
|
15
|
+
|
|
16
|
+
function serializeError (error) {
|
|
17
|
+
return {
|
|
18
|
+
type: error.name,
|
|
19
|
+
message: error.message,
|
|
20
|
+
stack: error.stack
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function parseLogs (buffer) {
|
|
25
|
+
return JSON.parse(`[${buffer.toString().replace(/}{/g, '},{')}]`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
test('transport uses pino config', async (t) => {
|
|
29
|
+
const destination = file()
|
|
30
|
+
const transport = pino.transport({
|
|
31
|
+
pipeline: [{
|
|
32
|
+
target: join(__dirname, '..', 'fixtures', 'transport-uses-pino-config.js')
|
|
33
|
+
}, {
|
|
34
|
+
target: 'pino/file',
|
|
35
|
+
options: { destination }
|
|
36
|
+
}]
|
|
37
|
+
})
|
|
38
|
+
t.after(transport.end.bind(transport))
|
|
39
|
+
const instance = pino({
|
|
40
|
+
messageKey: 'customMessageKey',
|
|
41
|
+
errorKey: 'customErrorKey',
|
|
42
|
+
customLevels: { custom: 35 }
|
|
43
|
+
}, transport)
|
|
44
|
+
|
|
45
|
+
const error = new Error('bar')
|
|
46
|
+
instance.custom('foo')
|
|
47
|
+
instance.error(error)
|
|
48
|
+
await watchForWrite(destination, '"body":"bar"')
|
|
49
|
+
const result = parseLogs(await readFile(destination))
|
|
50
|
+
|
|
51
|
+
assert.deepEqual(result, [{
|
|
52
|
+
severityText: 'custom',
|
|
53
|
+
body: 'foo',
|
|
54
|
+
attributes: {
|
|
55
|
+
pid,
|
|
56
|
+
hostname
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
severityText: 'error',
|
|
60
|
+
body: 'bar',
|
|
61
|
+
attributes: {
|
|
62
|
+
pid,
|
|
63
|
+
hostname
|
|
64
|
+
},
|
|
65
|
+
error: serializeError(error)
|
|
66
|
+
}])
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('transport uses pino config without customizations', async (t) => {
|
|
70
|
+
const destination = file()
|
|
71
|
+
const transport = pino.transport({
|
|
72
|
+
pipeline: [{
|
|
73
|
+
target: join(__dirname, '..', 'fixtures', 'transport-uses-pino-config.js')
|
|
74
|
+
}, {
|
|
75
|
+
target: 'pino/file',
|
|
76
|
+
options: { destination }
|
|
77
|
+
}]
|
|
78
|
+
})
|
|
79
|
+
t.after(transport.end.bind(transport))
|
|
80
|
+
const instance = pino(transport)
|
|
81
|
+
|
|
82
|
+
const error = new Error('qux')
|
|
83
|
+
instance.info('baz')
|
|
84
|
+
instance.error(error)
|
|
85
|
+
await watchForWrite(destination, '"body":"qux"')
|
|
86
|
+
const result = parseLogs(await readFile(destination))
|
|
87
|
+
|
|
88
|
+
assert.deepEqual(result, [{
|
|
89
|
+
severityText: 'info',
|
|
90
|
+
body: 'baz',
|
|
91
|
+
attributes: {
|
|
92
|
+
pid,
|
|
93
|
+
hostname
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
severityText: 'error',
|
|
97
|
+
body: 'qux',
|
|
98
|
+
attributes: {
|
|
99
|
+
pid,
|
|
100
|
+
hostname
|
|
101
|
+
},
|
|
102
|
+
error: serializeError(error)
|
|
103
|
+
}])
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test('transport uses pino config with multistream', async (t) => {
|
|
107
|
+
const destination = file()
|
|
108
|
+
const messages = []
|
|
109
|
+
const stream = writeStream(function (data, enc, cb) {
|
|
110
|
+
const message = JSON.parse(data)
|
|
111
|
+
delete message.time
|
|
112
|
+
messages.push(message)
|
|
113
|
+
cb()
|
|
114
|
+
})
|
|
115
|
+
const transport = pino.transport({
|
|
116
|
+
pipeline: [{
|
|
117
|
+
target: join(__dirname, '..', 'fixtures', 'transport-uses-pino-config.js')
|
|
118
|
+
}, {
|
|
119
|
+
target: 'pino/file',
|
|
120
|
+
options: { destination }
|
|
121
|
+
}]
|
|
122
|
+
})
|
|
123
|
+
t.after(transport.end.bind(transport))
|
|
124
|
+
const instance = pino({
|
|
125
|
+
messageKey: 'customMessageKey',
|
|
126
|
+
errorKey: 'customErrorKey',
|
|
127
|
+
customLevels: { custom: 35 }
|
|
128
|
+
}, pino.multistream([transport, { stream }]))
|
|
129
|
+
|
|
130
|
+
const error = new Error('buzz')
|
|
131
|
+
const serializedError = serializeError(error)
|
|
132
|
+
instance.custom('fizz')
|
|
133
|
+
instance.error(error)
|
|
134
|
+
await watchForWrite(destination, '"body":"buzz"')
|
|
135
|
+
const result = parseLogs(await readFile(destination))
|
|
136
|
+
|
|
137
|
+
assert.deepEqual(result, [{
|
|
138
|
+
severityText: 'custom',
|
|
139
|
+
body: 'fizz',
|
|
140
|
+
attributes: {
|
|
141
|
+
pid,
|
|
142
|
+
hostname
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
severityText: 'error',
|
|
146
|
+
body: 'buzz',
|
|
147
|
+
attributes: {
|
|
148
|
+
pid,
|
|
149
|
+
hostname
|
|
150
|
+
},
|
|
151
|
+
error: serializedError
|
|
152
|
+
}])
|
|
153
|
+
|
|
154
|
+
assert.deepEqual(messages, [{
|
|
155
|
+
level: 35,
|
|
156
|
+
pid,
|
|
157
|
+
hostname,
|
|
158
|
+
customMessageKey: 'fizz'
|
|
159
|
+
}, {
|
|
160
|
+
level: 50,
|
|
161
|
+
pid,
|
|
162
|
+
hostname,
|
|
163
|
+
customErrorKey: serializedError,
|
|
164
|
+
customMessageKey: 'buzz'
|
|
165
|
+
}])
|
|
166
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('node:test')
|
|
4
|
+
const proxyquire = require('proxyquire')
|
|
5
|
+
const tspl = require('@matteo.collina/tspl')
|
|
6
|
+
|
|
7
|
+
test('should import', async (t) => {
|
|
8
|
+
const plan = tspl(t, { plan: 2 })
|
|
9
|
+
const mockRealRequire = (target) => {
|
|
10
|
+
return {
|
|
11
|
+
default: {
|
|
12
|
+
default: () => {
|
|
13
|
+
plan.equal(target, 'pino-pretty')
|
|
14
|
+
return Promise.resolve()
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const mockRealImport = async () => {
|
|
20
|
+
await Promise.resolve()
|
|
21
|
+
throw Object.assign(new Error(), { code: 'ERR_MODULE_NOT_FOUND' })
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const loadTransportStreamBuilder = proxyquire(
|
|
25
|
+
'../lib/transport-stream.js',
|
|
26
|
+
{
|
|
27
|
+
'real-require': {
|
|
28
|
+
realRequire: mockRealRequire,
|
|
29
|
+
realImport: mockRealImport
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const fn = await loadTransportStreamBuilder('pino-pretty')
|
|
35
|
+
|
|
36
|
+
await fn()
|
|
37
|
+
plan.ok('returned promise resolved')
|
|
38
|
+
|
|
39
|
+
await plan
|
|
40
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { expect } from 'tstyche'
|
|
2
|
+
|
|
3
|
+
import * as pinoStar from '../../pino.js'
|
|
4
|
+
import pinoDefault, { default as pino, pino as pinoNamed } from '../../pino.js'
|
|
5
|
+
import pinoCjsImport = require ('../../pino.js')
|
|
6
|
+
|
|
7
|
+
const log = pino()
|
|
8
|
+
expect(log.info).type.toBe<pino.LogFn>()
|
|
9
|
+
expect(log.error).type.toBe<pino.LogFn>()
|
|
10
|
+
|
|
11
|
+
expect(pinoDefault()).type.toBe<pino.Logger>()
|
|
12
|
+
expect(pinoNamed()).type.toBe<pino.Logger>()
|
|
13
|
+
expect(pinoStar.default()).type.toBe<pino.Logger>()
|
|
14
|
+
expect(pinoStar.pino()).type.toBe<pino.Logger>()
|
|
15
|
+
expect(pinoCjsImport()).type.toBe<pino.Logger>()
|
|
16
|
+
expect(pinoCjsImport.default()).type.toBe<pino.Logger>()
|
|
17
|
+
expect(pinoCjsImport.pino()).type.toBe<pino.Logger>()
|
|
18
|
+
|
|
19
|
+
expect(pinoDefault.stdTimeFunctions.isoTimeNano()).type.toBe<string>()
|
|
20
|
+
expect(pinoNamed.stdTimeFunctions.isoTimeNano()).type.toBe<string>()
|
|
21
|
+
expect(pinoStar.stdTimeFunctions.isoTimeNano()).type.toBe<string>()
|
|
22
|
+
expect(pinoCjsImport.stdTimeFunctions.isoTimeNano()).type.toBe<string>()
|
|
23
|
+
|
|
24
|
+
const levelChangeEventListener: pino.LevelChangeEventListener = (
|
|
25
|
+
lvl: pino.LevelWithSilent | string,
|
|
26
|
+
val: number,
|
|
27
|
+
prevLvl: pino.LevelWithSilent | string,
|
|
28
|
+
prevVal: number,
|
|
29
|
+
) => {}
|
|
30
|
+
expect(levelChangeEventListener).type.toBe<pino.LevelChangeEventListener>()
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
pino,
|
|
5
|
+
destination,
|
|
6
|
+
levels,
|
|
7
|
+
multistream,
|
|
8
|
+
stdSerializers,
|
|
9
|
+
stdTimeFunctions,
|
|
10
|
+
transport,
|
|
11
|
+
version
|
|
12
|
+
} = require('../../pino.js')
|
|
13
|
+
const { default: pinoDefault } = require('../../pino.js')
|
|
14
|
+
const pinoCjs = require('../../pino.js')
|
|
15
|
+
|
|
16
|
+
const log = pino()
|
|
17
|
+
log.info('test')
|
|
18
|
+
log.error('test')
|
|
19
|
+
|
|
20
|
+
const logDefault = pinoDefault()
|
|
21
|
+
logDefault.info('test')
|
|
22
|
+
logDefault.error('test')
|
|
23
|
+
|
|
24
|
+
const logCjs = pinoCjs()
|
|
25
|
+
logCjs.info('test')
|
|
26
|
+
logCjs.error('test')
|
|
27
|
+
|
|
28
|
+
destination()
|
|
29
|
+
pino.destination()
|
|
30
|
+
pinoDefault.destination()
|
|
31
|
+
pinoCjs.destination()
|
|
32
|
+
|
|
33
|
+
levels
|
|
34
|
+
pino.levels
|
|
35
|
+
pinoDefault.levels
|
|
36
|
+
pinoCjs.levels
|
|
37
|
+
|
|
38
|
+
multistream(process.stdout)
|
|
39
|
+
pino.multistream(process.stdout)
|
|
40
|
+
pinoDefault.multistream(process.stdout)
|
|
41
|
+
pinoCjs.multistream(process.stdout)
|
|
42
|
+
|
|
43
|
+
stdSerializers.err(new Error())
|
|
44
|
+
pino.stdSerializers.err(new Error())
|
|
45
|
+
pinoDefault.stdSerializers.err(new Error())
|
|
46
|
+
pinoCjs.stdSerializers.err(new Error())
|
|
47
|
+
|
|
48
|
+
stdTimeFunctions.epochTime()
|
|
49
|
+
pino.stdTimeFunctions.epochTime()
|
|
50
|
+
pinoDefault.stdTimeFunctions.epochTime()
|
|
51
|
+
pinoCjs.stdTimeFunctions.epochTime()
|
|
52
|
+
|
|
53
|
+
transport({
|
|
54
|
+
target: '#pino/pretty',
|
|
55
|
+
options: { some: 'options for', the: 'transport' }
|
|
56
|
+
})
|
|
57
|
+
pino.transport({
|
|
58
|
+
target: '#pino/pretty',
|
|
59
|
+
options: { some: 'options for', the: 'transport' }
|
|
60
|
+
})
|
|
61
|
+
pinoDefault.transport({
|
|
62
|
+
target: '#pino/pretty',
|
|
63
|
+
options: { some: 'options for', the: 'transport' }
|
|
64
|
+
})
|
|
65
|
+
pinoCjs.transport({
|
|
66
|
+
target: '#pino/pretty',
|
|
67
|
+
options: { some: 'options for', the: 'transport' }
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
version
|
|
71
|
+
pino.version
|
|
72
|
+
pinoDefault.version
|
|
73
|
+
pinoCjs.version
|