@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,607 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const format = require('quick-format-unescaped')
|
|
4
|
+
const Redact = require('@pinojs/redact')
|
|
5
|
+
|
|
6
|
+
module.exports = pino
|
|
7
|
+
|
|
8
|
+
const CENSOR = '[Redacted]'
|
|
9
|
+
|
|
10
|
+
function handleRedactOpts (opts) {
|
|
11
|
+
if (Array.isArray(opts)) {
|
|
12
|
+
return { paths: opts, censor: CENSOR }
|
|
13
|
+
}
|
|
14
|
+
const { paths, censor = CENSOR, remove } = opts
|
|
15
|
+
if (!Array.isArray(paths)) {
|
|
16
|
+
throw Error('pino – redact must contain an array of strings')
|
|
17
|
+
}
|
|
18
|
+
return { paths, censor: remove ? undefined : censor, remove }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function buildRedactFn (redact) {
|
|
22
|
+
if (!redact) return null
|
|
23
|
+
const { paths, censor, remove } = handleRedactOpts(redact)
|
|
24
|
+
return Redact({
|
|
25
|
+
paths,
|
|
26
|
+
censor,
|
|
27
|
+
remove,
|
|
28
|
+
serialize: false
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const _console = pfGlobalThisOrFallback().console || {}
|
|
33
|
+
const stdSerializers = {
|
|
34
|
+
mapHttpRequest: mock,
|
|
35
|
+
mapHttpResponse: mock,
|
|
36
|
+
wrapRequestSerializer: passthrough,
|
|
37
|
+
wrapResponseSerializer: passthrough,
|
|
38
|
+
wrapErrorSerializer: passthrough,
|
|
39
|
+
req: mock,
|
|
40
|
+
res: mock,
|
|
41
|
+
err: asErrValue,
|
|
42
|
+
errWithCause: asErrValue
|
|
43
|
+
}
|
|
44
|
+
function levelToValue (level, logger) {
|
|
45
|
+
return level === 'silent'
|
|
46
|
+
? Infinity
|
|
47
|
+
: logger.levels.values[level]
|
|
48
|
+
}
|
|
49
|
+
const baseLogFunctionSymbol = Symbol('pino.logFuncs')
|
|
50
|
+
const hierarchySymbol = Symbol('pino.hierarchy')
|
|
51
|
+
|
|
52
|
+
const ownBindingsSymbol = Symbol('pino.ownBindings')
|
|
53
|
+
const bindingsSymbol = Symbol('pino.bindings')
|
|
54
|
+
|
|
55
|
+
const logFallbackMap = {
|
|
56
|
+
error: 'log',
|
|
57
|
+
fatal: 'error',
|
|
58
|
+
warn: 'error',
|
|
59
|
+
info: 'log',
|
|
60
|
+
debug: 'log',
|
|
61
|
+
trace: 'log'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function appendChildLogger (parentLogger, childLogger) {
|
|
65
|
+
const newEntry = {
|
|
66
|
+
logger: childLogger,
|
|
67
|
+
parent: parentLogger[hierarchySymbol]
|
|
68
|
+
}
|
|
69
|
+
childLogger[hierarchySymbol] = newEntry
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function setupBaseLogFunctions (logger, levels, proto) {
|
|
73
|
+
const logFunctions = {}
|
|
74
|
+
levels.forEach(level => {
|
|
75
|
+
logFunctions[level] = proto[level] ? proto[level] : (_console[level] || _console[logFallbackMap[level] || 'log'] || noop)
|
|
76
|
+
})
|
|
77
|
+
logger[baseLogFunctionSymbol] = logFunctions
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function shouldSerialize (serialize, serializers) {
|
|
81
|
+
if (Array.isArray(serialize)) {
|
|
82
|
+
const hasToFilter = serialize.filter(function (k) {
|
|
83
|
+
return k !== '!stdSerializers.err'
|
|
84
|
+
})
|
|
85
|
+
return hasToFilter
|
|
86
|
+
} else if (serialize === true) {
|
|
87
|
+
return Object.keys(serializers)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return false
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function pino (opts) {
|
|
94
|
+
opts = opts || {}
|
|
95
|
+
opts.browser = opts.browser || {}
|
|
96
|
+
|
|
97
|
+
const transmit = opts.browser.transmit
|
|
98
|
+
if (transmit && typeof transmit.send !== 'function') { throw Error('pino: transmit option must have a send function') }
|
|
99
|
+
|
|
100
|
+
const proto = opts.browser.write || _console
|
|
101
|
+
if (opts.browser.write) opts.browser.asObject = true
|
|
102
|
+
const serializers = opts.serializers || {}
|
|
103
|
+
const serialize = shouldSerialize(opts.browser.serialize, serializers)
|
|
104
|
+
let stdErrSerialize = opts.browser.serialize
|
|
105
|
+
|
|
106
|
+
if (
|
|
107
|
+
Array.isArray(opts.browser.serialize) &&
|
|
108
|
+
opts.browser.serialize.indexOf('!stdSerializers.err') > -1
|
|
109
|
+
) stdErrSerialize = false
|
|
110
|
+
|
|
111
|
+
const customLevels = Object.keys(opts.customLevels || {})
|
|
112
|
+
const levels = ['error', 'fatal', 'warn', 'info', 'debug', 'trace'].concat(customLevels)
|
|
113
|
+
|
|
114
|
+
if (typeof proto === 'function') {
|
|
115
|
+
levels.forEach(function (level) {
|
|
116
|
+
proto[level] = proto
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
if (opts.enabled === false || opts.browser.disabled) opts.level = 'silent'
|
|
120
|
+
const level = opts.level || 'info'
|
|
121
|
+
const logger = Object.create(proto)
|
|
122
|
+
if (!logger.log) logger.log = noop
|
|
123
|
+
|
|
124
|
+
setupBaseLogFunctions(logger, levels, proto)
|
|
125
|
+
// setup root hierarchy entry
|
|
126
|
+
appendChildLogger({}, logger)
|
|
127
|
+
|
|
128
|
+
logger[bindingsSymbol] = {}
|
|
129
|
+
|
|
130
|
+
Object.defineProperty(logger, 'levelVal', {
|
|
131
|
+
get: getLevelVal
|
|
132
|
+
})
|
|
133
|
+
Object.defineProperty(logger, 'level', {
|
|
134
|
+
get: getLevel,
|
|
135
|
+
set: setLevel
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const redactFn = buildRedactFn(opts.redact)
|
|
139
|
+
|
|
140
|
+
const setOpts = {
|
|
141
|
+
transmit,
|
|
142
|
+
serialize,
|
|
143
|
+
asObject: opts.browser.asObject,
|
|
144
|
+
asObjectBindingsOnly: opts.browser.asObjectBindingsOnly,
|
|
145
|
+
formatters: opts.browser.formatters,
|
|
146
|
+
reportCaller: opts.browser.reportCaller,
|
|
147
|
+
levels,
|
|
148
|
+
timestamp: getTimeFunction(opts),
|
|
149
|
+
messageKey: opts.messageKey || 'msg',
|
|
150
|
+
onChild: opts.onChild || noop,
|
|
151
|
+
redactFn
|
|
152
|
+
}
|
|
153
|
+
logger.levels = getLevels(opts)
|
|
154
|
+
logger.level = level
|
|
155
|
+
|
|
156
|
+
logger.isLevelEnabled = function (level) {
|
|
157
|
+
if (!this.levels.values[level]) {
|
|
158
|
+
return false
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return this.levels.values[level] >= this.levels.values[this.level]
|
|
162
|
+
}
|
|
163
|
+
logger.setMaxListeners = logger.getMaxListeners =
|
|
164
|
+
logger.emit = logger.addListener = logger.on =
|
|
165
|
+
logger.prependListener = logger.once =
|
|
166
|
+
logger.prependOnceListener = logger.removeListener =
|
|
167
|
+
logger.removeAllListeners = logger.listeners =
|
|
168
|
+
logger.listenerCount = logger.eventNames =
|
|
169
|
+
logger.write = logger.flush = noop
|
|
170
|
+
logger.serializers = serializers
|
|
171
|
+
logger._serialize = serialize
|
|
172
|
+
logger._stdErrSerialize = stdErrSerialize
|
|
173
|
+
logger.child = function (...args) { return child.call(this, setOpts, ...args) }
|
|
174
|
+
|
|
175
|
+
logger.bindings = function () {
|
|
176
|
+
return Object.assign({}, this[bindingsSymbol])
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
logger.setBindings = function (newBindings) {
|
|
180
|
+
this[ownBindingsSymbol] = Object.assign({}, this[ownBindingsSymbol], newBindings)
|
|
181
|
+
this[bindingsSymbol] = Object.assign({}, this[bindingsSymbol], newBindings)
|
|
182
|
+
if (this._logEvent) {
|
|
183
|
+
this._logEvent.bindings.push(newBindings)
|
|
184
|
+
}
|
|
185
|
+
// reassigning the level rebuilds the log functions so the updated
|
|
186
|
+
// bindings are prepended to subsequent log calls
|
|
187
|
+
this.level = this._level
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (transmit) logger._logEvent = createLogEventShape()
|
|
191
|
+
|
|
192
|
+
function getLevelVal () {
|
|
193
|
+
return levelToValue(this.level, this)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function getLevel () {
|
|
197
|
+
return this._level
|
|
198
|
+
}
|
|
199
|
+
function setLevel (level) {
|
|
200
|
+
if (level !== 'silent' && !this.levels.values[level]) {
|
|
201
|
+
throw Error('unknown level ' + level)
|
|
202
|
+
}
|
|
203
|
+
this._level = level
|
|
204
|
+
|
|
205
|
+
set(this, setOpts, logger, 'error') // <-- must stay first
|
|
206
|
+
set(this, setOpts, logger, 'fatal')
|
|
207
|
+
set(this, setOpts, logger, 'warn')
|
|
208
|
+
set(this, setOpts, logger, 'info')
|
|
209
|
+
set(this, setOpts, logger, 'debug')
|
|
210
|
+
set(this, setOpts, logger, 'trace')
|
|
211
|
+
|
|
212
|
+
customLevels.forEach((level) => {
|
|
213
|
+
set(this, setOpts, logger, level)
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function child (setOpts, bindings, childOptions) {
|
|
218
|
+
if (!bindings) {
|
|
219
|
+
throw new Error('missing bindings for child Pino')
|
|
220
|
+
}
|
|
221
|
+
childOptions = childOptions || {}
|
|
222
|
+
if (serialize && bindings.serializers) {
|
|
223
|
+
childOptions.serializers = bindings.serializers
|
|
224
|
+
}
|
|
225
|
+
const childOptionsSerializers = childOptions.serializers
|
|
226
|
+
if (serialize && childOptionsSerializers) {
|
|
227
|
+
var childSerializers = Object.assign({}, serializers, childOptionsSerializers)
|
|
228
|
+
var childSerialize = opts.browser.serialize === true
|
|
229
|
+
? Object.keys(childSerializers)
|
|
230
|
+
: serialize
|
|
231
|
+
delete bindings.serializers
|
|
232
|
+
applySerializers([bindings], childSerialize, childSerializers, this._stdErrSerialize)
|
|
233
|
+
}
|
|
234
|
+
function Child (parent) {
|
|
235
|
+
this._childLevel = (parent._childLevel | 0) + 1
|
|
236
|
+
|
|
237
|
+
// make sure bindings are available in the `set` function
|
|
238
|
+
this[ownBindingsSymbol] = bindings
|
|
239
|
+
|
|
240
|
+
this[bindingsSymbol] = Object.assign(
|
|
241
|
+
{},
|
|
242
|
+
parent[bindingsSymbol],
|
|
243
|
+
bindings
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
if (childSerializers) {
|
|
247
|
+
this.serializers = childSerializers
|
|
248
|
+
this._serialize = childSerialize
|
|
249
|
+
}
|
|
250
|
+
if (transmit) {
|
|
251
|
+
this._logEvent = createLogEventShape(
|
|
252
|
+
[].concat(parent._logEvent.bindings, bindings)
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
Child.prototype = this
|
|
257
|
+
const newLogger = new Child(this)
|
|
258
|
+
|
|
259
|
+
// must happen before the level is assigned
|
|
260
|
+
appendChildLogger(this, newLogger)
|
|
261
|
+
newLogger.child = function (...args) { return child.call(this, setOpts, ...args) }
|
|
262
|
+
// required to actually initialize the logger functions for any given child
|
|
263
|
+
newLogger.level = childOptions.level || this.level // allow level to be set by childOptions
|
|
264
|
+
setOpts.onChild(newLogger)
|
|
265
|
+
|
|
266
|
+
return newLogger
|
|
267
|
+
}
|
|
268
|
+
return logger
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function getLevels (opts) {
|
|
272
|
+
const customLevels = opts.customLevels || {}
|
|
273
|
+
|
|
274
|
+
const values = Object.assign({}, pino.levels.values, customLevels)
|
|
275
|
+
const labels = Object.assign({}, pino.levels.labels, invertObject(customLevels))
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
values,
|
|
279
|
+
labels
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function invertObject (obj) {
|
|
284
|
+
const inverted = {}
|
|
285
|
+
Object.keys(obj).forEach(function (key) {
|
|
286
|
+
inverted[obj[key]] = key
|
|
287
|
+
})
|
|
288
|
+
return inverted
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
pino.levels = {
|
|
292
|
+
values: {
|
|
293
|
+
fatal: 60,
|
|
294
|
+
error: 50,
|
|
295
|
+
warn: 40,
|
|
296
|
+
info: 30,
|
|
297
|
+
debug: 20,
|
|
298
|
+
trace: 10
|
|
299
|
+
},
|
|
300
|
+
labels: {
|
|
301
|
+
10: 'trace',
|
|
302
|
+
20: 'debug',
|
|
303
|
+
30: 'info',
|
|
304
|
+
40: 'warn',
|
|
305
|
+
50: 'error',
|
|
306
|
+
60: 'fatal'
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
pino.stdSerializers = stdSerializers
|
|
311
|
+
pino.stdTimeFunctions = Object.assign({}, { nullTime, epochTime, unixTime, isoTime })
|
|
312
|
+
|
|
313
|
+
function getBindingChain (logger) {
|
|
314
|
+
const bindings = []
|
|
315
|
+
if (logger[ownBindingsSymbol]) {
|
|
316
|
+
bindings.push(logger[ownBindingsSymbol])
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// traverse up the tree to get all bindings
|
|
320
|
+
let hierarchy = logger[hierarchySymbol]
|
|
321
|
+
while (hierarchy.parent) {
|
|
322
|
+
hierarchy = hierarchy.parent
|
|
323
|
+
if (hierarchy.logger[ownBindingsSymbol]) {
|
|
324
|
+
bindings.push(hierarchy.logger[ownBindingsSymbol])
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return bindings.reverse()
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function set (self, opts, rootLogger, level) {
|
|
332
|
+
// override the current log functions with either `noop` or the base log function
|
|
333
|
+
Object.defineProperty(self, level, {
|
|
334
|
+
value: (levelToValue(self.level, rootLogger) > levelToValue(level, rootLogger)
|
|
335
|
+
? noop
|
|
336
|
+
: rootLogger[baseLogFunctionSymbol][level]),
|
|
337
|
+
writable: true,
|
|
338
|
+
enumerable: true,
|
|
339
|
+
configurable: true
|
|
340
|
+
})
|
|
341
|
+
|
|
342
|
+
if (self[level] === noop) {
|
|
343
|
+
if (!opts.transmit) return
|
|
344
|
+
|
|
345
|
+
const transmitLevel = opts.transmit.level || self.level
|
|
346
|
+
const transmitValue = levelToValue(transmitLevel, rootLogger)
|
|
347
|
+
const methodValue = levelToValue(level, rootLogger)
|
|
348
|
+
if (methodValue < transmitValue) return
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// make sure the log format is correct
|
|
352
|
+
self[level] = createWrap(self, opts, rootLogger, level)
|
|
353
|
+
|
|
354
|
+
// prepend bindings if it is not the root logger
|
|
355
|
+
const bindings = getBindingChain(self)
|
|
356
|
+
if (bindings.length === 0) {
|
|
357
|
+
// early exit in case for rootLogger
|
|
358
|
+
return
|
|
359
|
+
}
|
|
360
|
+
self[level] = prependBindingsInArguments(bindings, self[level])
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function prependBindingsInArguments (bindings, logFunc) {
|
|
364
|
+
return function () {
|
|
365
|
+
return logFunc.apply(this, [...bindings, ...arguments])
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function createWrap (self, opts, rootLogger, level) {
|
|
370
|
+
return (function (write) {
|
|
371
|
+
return function LOG () {
|
|
372
|
+
const ts = opts.timestamp()
|
|
373
|
+
const args = new Array(arguments.length)
|
|
374
|
+
const proto = (Object.getPrototypeOf && Object.getPrototypeOf(this) === _console) ? _console : this
|
|
375
|
+
for (var i = 0; i < args.length; i++) args[i] = arguments[i]
|
|
376
|
+
|
|
377
|
+
var argsIsSerialized = false
|
|
378
|
+
if (opts.serialize) {
|
|
379
|
+
applySerializers(args, this._serialize, this.serializers, this._stdErrSerialize)
|
|
380
|
+
argsIsSerialized = true
|
|
381
|
+
}
|
|
382
|
+
if (opts.asObject || opts.formatters) {
|
|
383
|
+
const out = asObject(this, level, args, ts, opts)
|
|
384
|
+
if (opts.reportCaller && out && out.length > 0 && out[0] && typeof out[0] === 'object') {
|
|
385
|
+
try {
|
|
386
|
+
const caller = getCallerLocation()
|
|
387
|
+
if (caller) out[0].caller = caller
|
|
388
|
+
} catch (e) {}
|
|
389
|
+
}
|
|
390
|
+
write.call(proto, ...out)
|
|
391
|
+
} else {
|
|
392
|
+
if (opts.reportCaller) {
|
|
393
|
+
try {
|
|
394
|
+
const caller = getCallerLocation()
|
|
395
|
+
if (caller) args.push(caller)
|
|
396
|
+
} catch (e) {}
|
|
397
|
+
}
|
|
398
|
+
write.apply(proto, args)
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (opts.transmit) {
|
|
402
|
+
const transmitLevel = opts.transmit.level || self._level
|
|
403
|
+
const transmitValue = levelToValue(transmitLevel, rootLogger)
|
|
404
|
+
const methodValue = levelToValue(level, rootLogger)
|
|
405
|
+
if (methodValue < transmitValue) return
|
|
406
|
+
transmit(this, {
|
|
407
|
+
ts,
|
|
408
|
+
methodLevel: level,
|
|
409
|
+
methodValue,
|
|
410
|
+
transmitLevel,
|
|
411
|
+
transmitValue: rootLogger.levels.values[opts.transmit.level || self._level],
|
|
412
|
+
send: opts.transmit.send,
|
|
413
|
+
val: levelToValue(self._level, rootLogger)
|
|
414
|
+
}, args, argsIsSerialized)
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
})(self[baseLogFunctionSymbol][level])
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function asObject (logger, level, args, ts, opts) {
|
|
421
|
+
const {
|
|
422
|
+
level: levelFormatter,
|
|
423
|
+
log: logObjectFormatter = (obj) => obj
|
|
424
|
+
} = opts.formatters || {}
|
|
425
|
+
const argsCloned = args.slice()
|
|
426
|
+
let msg = argsCloned[0]
|
|
427
|
+
const logObject = {}
|
|
428
|
+
|
|
429
|
+
let lvl = (logger._childLevel | 0) + 1
|
|
430
|
+
if (lvl < 1) lvl = 1
|
|
431
|
+
|
|
432
|
+
if (ts) {
|
|
433
|
+
logObject.time = ts
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (levelFormatter) {
|
|
437
|
+
const formattedLevel = levelFormatter(level, logger.levels.values[level])
|
|
438
|
+
Object.assign(logObject, formattedLevel)
|
|
439
|
+
} else {
|
|
440
|
+
logObject.level = logger.levels.values[level]
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (opts.asObjectBindingsOnly) {
|
|
444
|
+
if (msg !== null && typeof msg === 'object') {
|
|
445
|
+
while (lvl-- && typeof argsCloned[0] === 'object') {
|
|
446
|
+
Object.assign(logObject, argsCloned.shift())
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
let formattedLogObject = logObjectFormatter(logObject)
|
|
451
|
+
if (opts.redactFn) {
|
|
452
|
+
formattedLogObject = opts.redactFn(formattedLogObject)
|
|
453
|
+
}
|
|
454
|
+
return [formattedLogObject, ...argsCloned]
|
|
455
|
+
} else {
|
|
456
|
+
// deliberate, catching objects, arrays
|
|
457
|
+
if (msg !== null && typeof msg === 'object') {
|
|
458
|
+
while (lvl-- && typeof argsCloned[0] === 'object') {
|
|
459
|
+
Object.assign(logObject, argsCloned.shift())
|
|
460
|
+
}
|
|
461
|
+
msg = argsCloned.length ? format(argsCloned.shift(), argsCloned) : undefined
|
|
462
|
+
} else if (typeof msg === 'string') msg = format(argsCloned.shift(), argsCloned)
|
|
463
|
+
if (msg !== undefined) logObject[opts.messageKey] = msg
|
|
464
|
+
|
|
465
|
+
let formattedLogObject = logObjectFormatter(logObject)
|
|
466
|
+
if (opts.redactFn) {
|
|
467
|
+
formattedLogObject = opts.redactFn(formattedLogObject)
|
|
468
|
+
}
|
|
469
|
+
return [formattedLogObject]
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function applySerializers (args, serialize, serializers, stdErrSerialize) {
|
|
474
|
+
for (const i in args) {
|
|
475
|
+
if (stdErrSerialize && args[i] instanceof Error) {
|
|
476
|
+
args[i] = pino.stdSerializers.err(args[i])
|
|
477
|
+
} else if (typeof args[i] === 'object' && !Array.isArray(args[i]) && serialize) {
|
|
478
|
+
for (const k in args[i]) {
|
|
479
|
+
if (serialize.indexOf(k) > -1 && k in serializers) {
|
|
480
|
+
args[i][k] = serializers[k](args[i][k])
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function transmit (logger, opts, args, argsIsSerialized = false) {
|
|
488
|
+
const send = opts.send
|
|
489
|
+
const ts = opts.ts
|
|
490
|
+
const methodLevel = opts.methodLevel
|
|
491
|
+
const methodValue = opts.methodValue
|
|
492
|
+
const val = opts.val
|
|
493
|
+
const bindings = logger._logEvent.bindings
|
|
494
|
+
|
|
495
|
+
if (!argsIsSerialized) {
|
|
496
|
+
applySerializers(
|
|
497
|
+
args,
|
|
498
|
+
logger._serialize || Object.keys(logger.serializers),
|
|
499
|
+
logger.serializers,
|
|
500
|
+
logger._stdErrSerialize === undefined ? true : logger._stdErrSerialize
|
|
501
|
+
)
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
logger._logEvent.ts = ts
|
|
505
|
+
logger._logEvent.messages = args.filter(function (arg) {
|
|
506
|
+
// bindings can only be objects, so reference equality check via indexOf is fine
|
|
507
|
+
return bindings.indexOf(arg) === -1
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
logger._logEvent.level.label = methodLevel
|
|
511
|
+
logger._logEvent.level.value = methodValue
|
|
512
|
+
|
|
513
|
+
send(methodLevel, logger._logEvent, val)
|
|
514
|
+
|
|
515
|
+
logger._logEvent = createLogEventShape(bindings)
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function createLogEventShape (bindings) {
|
|
519
|
+
return {
|
|
520
|
+
ts: 0,
|
|
521
|
+
messages: [],
|
|
522
|
+
bindings: bindings || [],
|
|
523
|
+
level: { label: '', value: 0 }
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function asErrValue (err) {
|
|
528
|
+
const obj = {
|
|
529
|
+
type: err.constructor.name,
|
|
530
|
+
msg: err.message,
|
|
531
|
+
stack: err.stack
|
|
532
|
+
}
|
|
533
|
+
for (const key in err) {
|
|
534
|
+
if (obj[key] === undefined) {
|
|
535
|
+
obj[key] = err[key]
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return obj
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function getTimeFunction (opts) {
|
|
542
|
+
if (typeof opts.timestamp === 'function') {
|
|
543
|
+
return opts.timestamp
|
|
544
|
+
}
|
|
545
|
+
if (opts.timestamp === false) {
|
|
546
|
+
return nullTime
|
|
547
|
+
}
|
|
548
|
+
return epochTime
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function mock () { return {} }
|
|
552
|
+
function passthrough (a) { return a }
|
|
553
|
+
function noop () {}
|
|
554
|
+
|
|
555
|
+
function nullTime () { return false }
|
|
556
|
+
function epochTime () { return Date.now() }
|
|
557
|
+
function unixTime () { return Math.round(Date.now() / 1000.0) }
|
|
558
|
+
function isoTime () { return new Date(Date.now()).toISOString() } // using Date.now() for testability
|
|
559
|
+
|
|
560
|
+
/* eslint-disable */
|
|
561
|
+
/* istanbul ignore next */
|
|
562
|
+
function pfGlobalThisOrFallback () {
|
|
563
|
+
function defd (o) { return typeof o !== 'undefined' && o }
|
|
564
|
+
try {
|
|
565
|
+
if (typeof globalThis !== 'undefined') return globalThis
|
|
566
|
+
Object.defineProperty(Object.prototype, 'globalThis', {
|
|
567
|
+
get: function () {
|
|
568
|
+
delete Object.prototype.globalThis
|
|
569
|
+
return (this.globalThis = this)
|
|
570
|
+
},
|
|
571
|
+
configurable: true
|
|
572
|
+
})
|
|
573
|
+
return globalThis
|
|
574
|
+
} catch (e) {
|
|
575
|
+
return defd(self) || defd(window) || defd(this) || {}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
/* eslint-enable */
|
|
579
|
+
|
|
580
|
+
module.exports.default = pino
|
|
581
|
+
module.exports.pino = pino
|
|
582
|
+
|
|
583
|
+
// Attempt to extract the user callsite (file:line:column)
|
|
584
|
+
/* istanbul ignore next */
|
|
585
|
+
function getCallerLocation () {
|
|
586
|
+
const stack = (new Error()).stack
|
|
587
|
+
if (!stack) return null
|
|
588
|
+
const lines = stack.split('\n')
|
|
589
|
+
for (let i = 1; i < lines.length; i++) {
|
|
590
|
+
const l = lines[i].trim()
|
|
591
|
+
// skip frames from this file and internals
|
|
592
|
+
if (/(^at\s+)?(createWrap|LOG|set\s*\(|asObject|Object\.apply|Function\.apply)/.test(l)) continue
|
|
593
|
+
if (l.indexOf('browser.js') !== -1) continue
|
|
594
|
+
if (l.indexOf('node:internal') !== -1) continue
|
|
595
|
+
if (l.indexOf('node_modules') !== -1) continue
|
|
596
|
+
// try formats like: at func (file:line:col) or at file:line:col
|
|
597
|
+
let m = l.match(/\((.*?):(\d+):(\d+)\)/)
|
|
598
|
+
if (!m) m = l.match(/at\s+(.*?):(\d+):(\d+)/)
|
|
599
|
+
if (m) {
|
|
600
|
+
const file = m[1]
|
|
601
|
+
const line = m[2]
|
|
602
|
+
const col = m[3]
|
|
603
|
+
return file + ':' + line + ':' + col
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return null
|
|
607
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs')
|
|
4
|
+
const path = require('node:path')
|
|
5
|
+
let { version } = require('../package.json')
|
|
6
|
+
|
|
7
|
+
let passedVersion = process.argv[2]
|
|
8
|
+
|
|
9
|
+
if (passedVersion) {
|
|
10
|
+
passedVersion = passedVersion.trim().replace(/^v/, '')
|
|
11
|
+
if (version !== passedVersion) {
|
|
12
|
+
console.log(`Syncing version from ${version} to ${passedVersion}`)
|
|
13
|
+
version = passedVersion
|
|
14
|
+
const packageJson = require('../package.json')
|
|
15
|
+
packageJson.version = version
|
|
16
|
+
fs.writeFileSync(path.resolve('./package.json'), JSON.stringify(packageJson, null, 2) + '\n', { encoding: 'utf-8' })
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const metaContent = `'use strict'
|
|
21
|
+
|
|
22
|
+
module.exports = { version: '${version}' }
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
fs.writeFileSync(path.resolve('./lib/meta.js'), metaContent, { encoding: 'utf-8' })
|