@vibesdotdev/logging 0.0.2 → 1.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/README.md +101 -8
- package/dist/audit/audit-retention.job.descriptor.d.ts +60 -0
- package/dist/audit/audit-retention.job.descriptor.d.ts.map +1 -0
- package/dist/audit/audit-retention.job.descriptor.js +42 -0
- package/dist/audit/audit-retention.job.descriptor.js.map +1 -0
- package/dist/audit/audit-retention.job.impl.d.ts +23 -0
- package/dist/audit/audit-retention.job.impl.d.ts.map +1 -0
- package/dist/audit/audit-retention.job.impl.js +24 -0
- package/dist/audit/audit-retention.job.impl.js.map +1 -0
- package/dist/audit/audit.descriptor.d.ts +6 -0
- package/dist/audit/audit.descriptor.d.ts.map +1 -1
- package/dist/audit/audit.descriptor.js +72 -5
- package/dist/audit/audit.descriptor.js.map +1 -1
- package/dist/audit/audit.storage.schema.d.ts +3 -3
- package/dist/audit/index.d.ts +3 -1
- package/dist/audit/index.d.ts.map +1 -1
- package/dist/audit/index.js +4 -1
- package/dist/audit/index.js.map +1 -1
- package/dist/audit/scheduled-audit-retention.d.ts +39 -0
- package/dist/audit/scheduled-audit-retention.d.ts.map +1 -0
- package/dist/audit/scheduled-audit-retention.js +38 -0
- package/dist/audit/scheduled-audit-retention.js.map +1 -0
- package/dist/browser/capture-error.d.ts +66 -0
- package/dist/browser/capture-error.d.ts.map +1 -0
- package/dist/browser/capture-error.js +82 -0
- package/dist/browser/capture-error.js.map +1 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +16 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/logging-browser.plugin.d.ts +9 -0
- package/dist/browser/logging-browser.plugin.d.ts.map +1 -0
- package/dist/browser/logging-browser.plugin.js +26 -0
- package/dist/browser/logging-browser.plugin.js.map +1 -0
- package/dist/browser/plugin.d.ts +2 -0
- package/dist/browser/plugin.d.ts.map +1 -0
- package/dist/browser/plugin.js +2 -0
- package/dist/browser/plugin.js.map +1 -0
- package/dist/browser/read-errors.d.ts +26 -0
- package/dist/browser/read-errors.d.ts.map +1 -0
- package/dist/browser/read-errors.js +38 -0
- package/dist/browser/read-errors.js.map +1 -0
- package/dist/browser/sinks/browser/browser.browser.descriptor.d.ts +10 -0
- package/dist/browser/sinks/browser/browser.browser.descriptor.d.ts.map +1 -0
- package/dist/browser/sinks/browser/browser.browser.descriptor.js +23 -0
- package/dist/browser/sinks/browser/browser.browser.descriptor.js.map +1 -0
- package/dist/browser/sinks/browser/browser.impl.browser.d.ts +83 -0
- package/dist/browser/sinks/browser/browser.impl.browser.d.ts.map +1 -0
- package/dist/browser/sinks/browser/browser.impl.browser.js +247 -0
- package/dist/browser/sinks/browser/browser.impl.browser.js.map +1 -0
- package/dist/cli/failures.d.ts +29 -0
- package/dist/cli/failures.d.ts.map +1 -0
- package/dist/cli/failures.js +44 -0
- package/dist/cli/failures.js.map +1 -0
- package/dist/cli/flags.d.ts +24 -0
- package/dist/cli/flags.d.ts.map +1 -0
- package/dist/cli/flags.js +56 -0
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/log-line.d.ts +23 -0
- package/dist/cli/log-line.d.ts.map +1 -0
- package/dist/cli/log-line.js +39 -0
- package/dist/cli/log-line.js.map +1 -0
- package/dist/cli/logging.logs.descriptor.d.ts +9 -0
- package/dist/cli/logging.logs.descriptor.d.ts.map +1 -0
- package/dist/cli/logging.logs.descriptor.js +16 -0
- package/dist/cli/logging.logs.descriptor.js.map +1 -0
- package/dist/cli/logs.audit.cleanup.descriptor.d.ts +7 -0
- package/dist/cli/logs.audit.cleanup.descriptor.d.ts.map +1 -0
- package/dist/cli/logs.audit.cleanup.descriptor.js +21 -0
- package/dist/cli/logs.audit.cleanup.descriptor.js.map +1 -0
- package/dist/cli/logs.audit.cleanup.impl.d.ts +14 -0
- package/dist/cli/logs.audit.cleanup.impl.d.ts.map +1 -0
- package/dist/cli/logs.audit.cleanup.impl.js +60 -0
- package/dist/cli/logs.audit.cleanup.impl.js.map +1 -0
- package/dist/cli/logs.audit.descriptor.d.ts +9 -0
- package/dist/cli/logs.audit.descriptor.d.ts.map +1 -0
- package/dist/cli/logs.audit.descriptor.js +41 -0
- package/dist/cli/logs.audit.descriptor.js.map +1 -0
- package/dist/cli/logs.audit.group.descriptor.d.ts +7 -0
- package/dist/cli/logs.audit.group.descriptor.d.ts.map +1 -0
- package/dist/cli/logs.audit.group.descriptor.js +15 -0
- package/dist/cli/logs.audit.group.descriptor.js.map +1 -0
- package/dist/cli/logs.audit.impl.d.ts +19 -0
- package/dist/cli/logs.audit.impl.d.ts.map +1 -0
- package/dist/cli/logs.audit.impl.js +83 -0
- package/dist/cli/logs.audit.impl.js.map +1 -0
- package/dist/cli/logs.descriptor.d.ts +1 -8
- package/dist/cli/logs.descriptor.d.ts.map +1 -1
- package/dist/cli/logs.descriptor.js +1 -15
- package/dist/cli/logs.descriptor.js.map +1 -1
- package/dist/cli/logs.list.impl.d.ts +4 -1
- package/dist/cli/logs.list.impl.d.ts.map +1 -1
- package/dist/cli/logs.list.impl.js +60 -63
- package/dist/cli/logs.list.impl.js.map +1 -1
- package/dist/cli/logs.rotate.descriptor.d.ts.map +1 -1
- package/dist/cli/logs.rotate.descriptor.js +7 -3
- package/dist/cli/logs.rotate.descriptor.js.map +1 -1
- package/dist/cli/logs.rotate.impl.d.ts +3 -1
- package/dist/cli/logs.rotate.impl.d.ts.map +1 -1
- package/dist/cli/logs.rotate.impl.js +72 -33
- package/dist/cli/logs.rotate.impl.js.map +1 -1
- package/dist/cli/logs.search.descriptor.d.ts.map +1 -1
- package/dist/cli/logs.search.descriptor.js +4 -0
- package/dist/cli/logs.search.descriptor.js.map +1 -1
- package/dist/cli/logs.search.impl.d.ts +3 -1
- package/dist/cli/logs.search.impl.d.ts.map +1 -1
- package/dist/cli/logs.search.impl.js +114 -108
- package/dist/cli/logs.search.impl.js.map +1 -1
- package/dist/cli/logs.tail.descriptor.d.ts.map +1 -1
- package/dist/cli/logs.tail.descriptor.js +2 -1
- package/dist/cli/logs.tail.descriptor.js.map +1 -1
- package/dist/cli/logs.tail.impl.d.ts +4 -2
- package/dist/cli/logs.tail.impl.d.ts.map +1 -1
- package/dist/cli/logs.tail.impl.js +84 -57
- package/dist/cli/logs.tail.impl.js.map +1 -1
- package/dist/cli/logs.view.impl.d.ts +2 -6
- package/dist/cli/logs.view.impl.d.ts.map +1 -1
- package/dist/cli/logs.view.impl.js +32 -50
- package/dist/cli/logs.view.impl.js.map +1 -1
- package/dist/cli/output.d.ts +29 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +29 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/{logging.cli.plugin.d.ts → cli/plugin.d.ts} +3 -3
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +45 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/resolve-output.d.ts +25 -0
- package/dist/cli/resolve-output.d.ts.map +1 -0
- package/dist/cli/resolve-output.js +75 -0
- package/dist/cli/resolve-output.js.map +1 -0
- package/dist/cli/types.d.ts +13 -5
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +3 -3
- package/dist/client/logging-client.d.ts +31 -0
- package/dist/client/logging-client.d.ts.map +1 -0
- package/dist/client/logging-client.js +44 -0
- package/dist/client/logging-client.js.map +1 -0
- package/dist/config/file-rotation.d.ts +11 -0
- package/dist/config/file-rotation.d.ts.map +1 -0
- package/dist/config/file-rotation.js +18 -0
- package/dist/config/file-rotation.js.map +1 -0
- package/dist/config/load-config.d.ts +7 -0
- package/dist/config/load-config.d.ts.map +1 -0
- package/dist/config/load-config.js +68 -0
- package/dist/config/load-config.js.map +1 -0
- package/dist/config/logging.config.descriptor.d.ts +350 -0
- package/dist/config/logging.config.descriptor.d.ts.map +1 -0
- package/dist/config/logging.config.descriptor.js +208 -0
- package/dist/config/logging.config.descriptor.js.map +1 -0
- package/dist/config/otel-service.d.ts +9 -0
- package/dist/config/otel-service.d.ts.map +1 -0
- package/dist/config/otel-service.js +18 -0
- package/dist/config/otel-service.js.map +1 -0
- package/dist/contexts/bootstrap.plugin.d.ts +3 -0
- package/dist/contexts/bootstrap.plugin.d.ts.map +1 -0
- package/dist/contexts/bootstrap.plugin.js +13 -0
- package/dist/contexts/bootstrap.plugin.js.map +1 -0
- package/dist/contexts/fallback-logger.d.ts +7 -2
- package/dist/contexts/fallback-logger.d.ts.map +1 -1
- package/dist/contexts/fallback-logger.js +73 -46
- package/dist/contexts/fallback-logger.js.map +1 -1
- package/dist/contexts/index.d.ts +2 -2
- package/dist/contexts/index.d.ts.map +1 -1
- package/dist/contexts/index.js +2 -3
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/logger.d.ts +38 -14
- package/dist/contexts/logger.d.ts.map +1 -1
- package/dist/contexts/logger.js +241 -62
- package/dist/contexts/logger.js.map +1 -1
- package/dist/core/attempt.d.ts +30 -0
- package/dist/core/attempt.d.ts.map +1 -0
- package/dist/core/attempt.js +44 -0
- package/dist/core/attempt.js.map +1 -0
- package/dist/core/emission-window.d.ts +34 -0
- package/dist/core/emission-window.d.ts.map +1 -0
- package/dist/core/emission-window.js +25 -0
- package/dist/core/emission-window.js.map +1 -0
- package/dist/core/endpoint.d.ts +54 -0
- package/dist/core/endpoint.d.ts.map +1 -0
- package/dist/core/endpoint.js +256 -0
- package/dist/core/endpoint.js.map +1 -0
- package/dist/core/entry-context.d.ts +106 -0
- package/dist/core/entry-context.d.ts.map +1 -0
- package/dist/core/entry-context.js +150 -0
- package/dist/core/entry-context.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts +6 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +133 -67
- package/dist/core/logger.js.map +1 -1
- package/dist/core/namespace.d.ts +5 -2
- package/dist/core/namespace.d.ts.map +1 -1
- package/dist/core/namespace.js +15 -7
- package/dist/core/namespace.js.map +1 -1
- package/dist/core/normalize.d.ts +31 -0
- package/dist/core/normalize.d.ts.map +1 -0
- package/dist/core/normalize.js +67 -0
- package/dist/core/normalize.js.map +1 -0
- package/dist/core/otlp-headers.d.ts +53 -0
- package/dist/core/otlp-headers.d.ts.map +1 -0
- package/dist/core/otlp-headers.js +64 -0
- package/dist/core/otlp-headers.js.map +1 -0
- package/dist/core/otlp-partial-success.d.ts +48 -0
- package/dist/core/otlp-partial-success.d.ts.map +1 -0
- package/dist/core/otlp-partial-success.js +55 -0
- package/dist/core/otlp-partial-success.js.map +1 -0
- package/dist/core/outcome.d.ts +21 -0
- package/dist/core/outcome.d.ts.map +1 -0
- package/dist/core/outcome.js +24 -0
- package/dist/core/outcome.js.map +1 -0
- package/dist/core/output-resources.d.ts +15 -0
- package/dist/core/output-resources.d.ts.map +1 -0
- package/dist/core/output-resources.js +51 -0
- package/dist/core/output-resources.js.map +1 -0
- package/dist/core/parsing.d.ts.map +1 -1
- package/dist/core/parsing.js +13 -10
- package/dist/core/parsing.js.map +1 -1
- package/dist/core/redact.d.ts +161 -0
- package/dist/core/redact.d.ts.map +1 -0
- package/dist/core/redact.js +581 -0
- package/dist/core/redact.js.map +1 -0
- package/dist/core/root-identity.d.ts +13 -0
- package/dist/core/root-identity.d.ts.map +1 -0
- package/dist/core/root-identity.js +23 -0
- package/dist/core/root-identity.js.map +1 -0
- package/dist/core/types.d.ts +5 -4
- package/dist/core/types.d.ts.map +1 -1
- package/dist/docs/cli.docs.descriptor.d.ts +4 -0
- package/dist/docs/cli.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/cli.docs.descriptor.js +97 -0
- package/dist/docs/cli.docs.descriptor.js.map +1 -0
- package/dist/docs/index.d.ts +7 -0
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +7 -0
- package/dist/docs/index.js.map +1 -0
- package/dist/docs/levels.docs.descriptor.d.ts +1 -1
- package/dist/docs/levels.docs.descriptor.d.ts.map +1 -1
- package/dist/docs/levels.docs.descriptor.js +112 -246
- package/dist/docs/levels.docs.descriptor.js.map +1 -1
- package/dist/docs/logging.docs.descriptor.d.ts +4 -0
- package/dist/docs/logging.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/logging.docs.descriptor.js +105 -0
- package/dist/docs/logging.docs.descriptor.js.map +1 -0
- package/dist/docs/observability.docs.descriptor.d.ts +4 -0
- package/dist/docs/observability.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/observability.docs.descriptor.js +152 -0
- package/dist/docs/observability.docs.descriptor.js.map +1 -0
- package/dist/docs/structured.docs.descriptor.d.ts +1 -1
- package/dist/docs/structured.docs.descriptor.d.ts.map +1 -1
- package/dist/docs/structured.docs.descriptor.js +111 -267
- package/dist/docs/structured.docs.descriptor.js.map +1 -1
- package/dist/docs/transports.docs.descriptor.d.ts +1 -1
- package/dist/docs/transports.docs.descriptor.d.ts.map +1 -1
- package/dist/docs/transports.docs.descriptor.js +129 -344
- package/dist/docs/transports.docs.descriptor.js.map +1 -1
- package/dist/formatters/json/json.impl.d.ts +1 -1
- package/dist/formatters/json/json.impl.d.ts.map +1 -1
- package/dist/formatters/json/json.impl.js +3 -2
- package/dist/formatters/json/json.impl.js.map +1 -1
- package/dist/formatters/json5/json5.impl.d.ts +1 -1
- package/dist/formatters/json5/json5.impl.d.ts.map +1 -1
- package/dist/formatters/json5/json5.impl.js +3 -2
- package/dist/formatters/json5/json5.impl.js.map +1 -1
- package/dist/formatters/jsonl/jsonl.impl.d.ts +1 -1
- package/dist/formatters/jsonl/jsonl.impl.d.ts.map +1 -1
- package/dist/formatters/jsonl/jsonl.impl.js +3 -2
- package/dist/formatters/jsonl/jsonl.impl.js.map +1 -1
- package/dist/formatters/pretty/{pretty.impl.cli.d.ts → pretty.impl.consumer.d.ts} +1 -1
- package/dist/formatters/pretty/pretty.impl.consumer.d.ts.map +1 -0
- package/dist/formatters/pretty/{pretty.impl.cli.js → pretty.impl.consumer.js} +1 -1
- package/dist/formatters/pretty/pretty.impl.consumer.js.map +1 -0
- package/dist/host-files/file-audit.base.d.ts +39 -0
- package/dist/host-files/file-audit.base.d.ts.map +1 -0
- package/dist/host-files/file-audit.base.js +255 -0
- package/dist/host-files/file-audit.base.js.map +1 -0
- package/dist/host-files/file-output.base.d.ts +84 -0
- package/dist/host-files/file-output.base.d.ts.map +1 -0
- package/dist/host-files/file-output.base.js +401 -0
- package/dist/host-files/file-output.base.js.map +1 -0
- package/dist/host-files/file-output.factory.base.d.ts +31 -0
- package/dist/host-files/file-output.factory.base.d.ts.map +1 -0
- package/dist/host-files/file-output.factory.base.js +82 -0
- package/dist/host-files/file-output.factory.base.js.map +1 -0
- package/dist/host-files/file-output.read.base.d.ts +7 -0
- package/dist/host-files/file-output.read.base.d.ts.map +1 -0
- package/dist/host-files/file-output.read.base.js +229 -0
- package/dist/host-files/file-output.read.base.js.map +1 -0
- package/dist/host-files/file-sink.base.d.ts +22 -0
- package/dist/host-files/file-sink.base.d.ts.map +1 -0
- package/dist/host-files/file-sink.base.js +56 -0
- package/dist/host-files/file-sink.base.js.map +1 -0
- package/dist/host-files/host-file-logging.plugin.d.ts +11 -0
- package/dist/host-files/host-file-logging.plugin.d.ts.map +1 -0
- package/dist/host-files/host-file-logging.plugin.js +63 -0
- package/dist/host-files/host-file-logging.plugin.js.map +1 -0
- package/dist/host-files/index.d.ts +19 -0
- package/dist/host-files/index.d.ts.map +1 -0
- package/dist/host-files/index.js +18 -0
- package/dist/host-files/index.js.map +1 -0
- package/dist/host-files/rotate-appended-file.base.d.ts +35 -0
- package/dist/host-files/rotate-appended-file.base.d.ts.map +1 -0
- package/dist/host-files/rotate-appended-file.base.js +104 -0
- package/dist/host-files/rotate-appended-file.base.js.map +1 -0
- package/dist/host.d.ts +38 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +39 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +24 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -23
- package/dist/index.js.map +1 -1
- package/dist/kinds/audit.d.ts +40 -8
- package/dist/kinds/audit.d.ts.map +1 -1
- package/dist/kinds/audit.js +82 -20
- package/dist/kinds/audit.js.map +1 -1
- package/dist/kinds/contexts.d.ts +4 -3
- package/dist/kinds/contexts.d.ts.map +1 -1
- package/dist/kinds/file-output.d.ts +56 -0
- package/dist/kinds/file-output.d.ts.map +1 -0
- package/dist/kinds/file-output.js +11 -0
- package/dist/kinds/file-output.js.map +1 -0
- package/dist/kinds/formatter.d.ts +4 -6
- package/dist/kinds/formatter.d.ts.map +1 -1
- package/dist/kinds/formatter.js +4 -3
- package/dist/kinds/formatter.js.map +1 -1
- package/dist/kinds/index.d.ts +3 -3
- package/dist/kinds/index.d.ts.map +1 -1
- package/dist/kinds/index.js +3 -3
- package/dist/kinds/index.js.map +1 -1
- package/dist/kinds/logger.d.ts +4 -4
- package/dist/kinds/logger.d.ts.map +1 -1
- package/dist/kinds/logger.impl.d.ts +40 -13
- package/dist/kinds/logger.impl.d.ts.map +1 -1
- package/dist/kinds/logger.impl.js +179 -87
- package/dist/kinds/logger.impl.js.map +1 -1
- package/dist/kinds/logger.js +21 -11
- package/dist/kinds/logger.js.map +1 -1
- package/dist/kinds/logger.utils.d.ts +31 -4
- package/dist/kinds/logger.utils.d.ts.map +1 -1
- package/dist/kinds/logger.utils.js +58 -18
- package/dist/kinds/logger.utils.js.map +1 -1
- package/dist/kinds/output.d.ts +5 -11
- package/dist/kinds/output.d.ts.map +1 -1
- package/dist/kinds/output.impl.d.ts +9 -7
- package/dist/kinds/output.impl.d.ts.map +1 -1
- package/dist/kinds/output.impl.js +51 -29
- package/dist/kinds/output.impl.js.map +1 -1
- package/dist/kinds/output.js +10 -5
- package/dist/kinds/output.js.map +1 -1
- package/dist/kinds/output.types.d.ts +26 -7
- package/dist/kinds/output.types.d.ts.map +1 -1
- package/dist/kinds/sink.d.ts +6 -5
- package/dist/kinds/sink.d.ts.map +1 -1
- package/dist/kinds/sink.js +14 -7
- package/dist/kinds/sink.js.map +1 -1
- package/dist/logger.context.descriptor.d.ts +15 -1
- package/dist/logger.context.descriptor.d.ts.map +1 -1
- package/dist/logger.context.descriptor.js +1 -1
- package/dist/logger.context.descriptor.js.map +1 -1
- package/dist/logging.consumer.plugin.d.ts +4 -0
- package/dist/logging.consumer.plugin.d.ts.map +1 -0
- package/dist/logging.consumer.plugin.js +17 -0
- package/dist/logging.consumer.plugin.js.map +1 -0
- package/dist/logging.plugin.d.ts +3 -3
- package/dist/logging.plugin.d.ts.map +1 -1
- package/dist/logging.plugin.js +81 -42
- package/dist/logging.plugin.js.map +1 -1
- package/dist/observability/building-host.d.ts +11 -0
- package/dist/observability/building-host.d.ts.map +1 -0
- package/dist/observability/building-host.js +11 -0
- package/dist/observability/building-host.js.map +1 -0
- package/dist/observability/config.d.ts +36 -0
- package/dist/observability/config.d.ts.map +1 -0
- package/dist/observability/config.js +46 -0
- package/dist/observability/config.js.map +1 -0
- package/dist/observability/http/instrumented-fetch.d.ts +19 -0
- package/dist/observability/http/instrumented-fetch.d.ts.map +1 -0
- package/dist/observability/http/instrumented-fetch.js +175 -0
- package/dist/observability/http/instrumented-fetch.js.map +1 -0
- package/dist/observability/index.d.ts +8 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +10 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/lifecycle.d.ts +18 -0
- package/dist/observability/lifecycle.d.ts.map +1 -0
- package/dist/observability/lifecycle.js +44 -0
- package/dist/observability/lifecycle.js.map +1 -0
- package/dist/observability/observability/error-tracker.d.ts +43 -0
- package/dist/observability/observability/error-tracker.d.ts.map +1 -0
- package/dist/observability/observability/error-tracker.js +130 -0
- package/dist/observability/observability/error-tracker.js.map +1 -0
- package/dist/observability/should-keep-log.d.ts +8 -0
- package/dist/observability/should-keep-log.d.ts.map +1 -0
- package/dist/observability/should-keep-log.js +10 -0
- package/dist/observability/should-keep-log.js.map +1 -0
- package/dist/observability/telemetry/otel.d.ts +47 -0
- package/dist/observability/telemetry/otel.d.ts.map +1 -0
- package/dist/observability/telemetry/otel.js +542 -0
- package/dist/observability/telemetry/otel.js.map +1 -0
- package/dist/observability/telemetry/partial-success.d.ts +35 -0
- package/dist/observability/telemetry/partial-success.d.ts.map +1 -0
- package/dist/observability/telemetry/partial-success.js +94 -0
- package/dist/observability/telemetry/partial-success.js.map +1 -0
- package/dist/observability/telemetry/sdk-lifecycle.d.ts +37 -0
- package/dist/observability/telemetry/sdk-lifecycle.d.ts.map +1 -0
- package/dist/observability/telemetry/sdk-lifecycle.js +132 -0
- package/dist/observability/telemetry/sdk-lifecycle.js.map +1 -0
- package/dist/observability/telemetry/telemetry-root.d.ts +78 -0
- package/dist/observability/telemetry/telemetry-root.d.ts.map +1 -0
- package/dist/observability/telemetry/telemetry-root.js +79 -0
- package/dist/observability/telemetry/telemetry-root.js.map +1 -0
- package/dist/observability/telemetry-instrumentation.d.ts +76 -0
- package/dist/observability/telemetry-instrumentation.d.ts.map +1 -0
- package/dist/observability/telemetry-instrumentation.js +69 -0
- package/dist/observability/telemetry-instrumentation.js.map +1 -0
- package/dist/otel/index.d.ts +9 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/index.js +12 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/otel/logging-otel.plugin.d.ts +11 -0
- package/dist/otel/logging-otel.plugin.d.ts.map +1 -0
- package/dist/otel/logging-otel.plugin.js +27 -0
- package/dist/otel/logging-otel.plugin.js.map +1 -0
- package/dist/otel/sinks/otel/otel.descriptor.d.ts +10 -0
- package/dist/otel/sinks/otel/otel.descriptor.d.ts.map +1 -0
- package/dist/otel/sinks/otel/otel.descriptor.js +23 -0
- package/dist/otel/sinks/otel/otel.descriptor.js.map +1 -0
- package/dist/otel/sinks/otel/otel.impl.d.ts +47 -0
- package/dist/otel/sinks/otel/otel.impl.d.ts.map +1 -0
- package/dist/otel/sinks/otel/otel.impl.js +202 -0
- package/dist/otel/sinks/otel/otel.impl.js.map +1 -0
- package/dist/otel/sinks/otel/otlp-log-exporter.d.ts +76 -0
- package/dist/otel/sinks/otel/otlp-log-exporter.d.ts.map +1 -0
- package/dist/otel/sinks/otel/otlp-log-exporter.js +178 -0
- package/dist/otel/sinks/otel/otlp-log-exporter.js.map +1 -0
- package/dist/outputs/file/file.outputs.descriptor.d.ts +10 -0
- package/dist/outputs/file/file.outputs.descriptor.d.ts.map +1 -0
- package/dist/outputs/file/file.outputs.descriptor.js +32 -0
- package/dist/outputs/file/file.outputs.descriptor.js.map +1 -0
- package/dist/outputs/remote/remote.descriptor.d.ts +1 -1
- package/dist/outputs/remote/remote.descriptor.d.ts.map +1 -1
- package/dist/outputs/remote/remote.descriptor.js +1 -2
- package/dist/outputs/remote/remote.descriptor.js.map +1 -1
- package/dist/outputs/remote/remote.factory.d.ts +9 -0
- package/dist/outputs/remote/remote.factory.d.ts.map +1 -0
- package/dist/outputs/remote/remote.factory.js +16 -0
- package/dist/outputs/remote/remote.factory.js.map +1 -0
- package/dist/outputs/remote/remote.impl.d.ts +40 -4
- package/dist/outputs/remote/remote.impl.d.ts.map +1 -1
- package/dist/outputs/remote/remote.impl.js +224 -99
- package/dist/outputs/remote/remote.impl.js.map +1 -1
- package/dist/outputs.context.descriptor.d.ts +15 -1
- package/dist/outputs.context.descriptor.d.ts.map +1 -1
- package/dist/outputs.context.descriptor.js +1 -1
- package/dist/outputs.context.descriptor.js.map +1 -1
- package/dist/outputs.context.impl.d.ts +2 -1
- package/dist/outputs.context.impl.d.ts.map +1 -1
- package/dist/outputs.context.impl.js +17 -9
- package/dist/outputs.context.impl.js.map +1 -1
- package/dist/paths.d.ts +24 -3
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +63 -3
- package/dist/paths.js.map +1 -1
- package/dist/rotation/rotate-appended-file.d.ts +15 -0
- package/dist/rotation/rotate-appended-file.d.ts.map +1 -0
- package/dist/rotation/rotate-appended-file.js +20 -0
- package/dist/rotation/rotate-appended-file.js.map +1 -0
- package/dist/rotation/rotation-policy.d.ts +19 -0
- package/dist/rotation/rotation-policy.d.ts.map +1 -0
- package/dist/rotation/rotation-policy.js +37 -0
- package/dist/rotation/rotation-policy.js.map +1 -0
- package/dist/schemas/audit.d.ts +25 -7
- package/dist/schemas/audit.d.ts.map +1 -1
- package/dist/schemas/audit.js +10 -4
- package/dist/schemas/audit.js.map +1 -1
- package/dist/schemas/entry.d.ts +11 -5
- package/dist/schemas/entry.d.ts.map +1 -1
- package/dist/schemas/entry.js +3 -2
- package/dist/schemas/entry.js.map +1 -1
- package/dist/schemas/file-host.d.ts +86 -0
- package/dist/schemas/file-host.d.ts.map +1 -0
- package/dist/schemas/file-host.js +10 -0
- package/dist/schemas/file-host.js.map +1 -0
- package/dist/schemas/formatter.d.ts +11 -1
- package/dist/schemas/formatter.d.ts.map +1 -1
- package/dist/schemas/formatter.js +1 -1
- package/dist/schemas/formatter.js.map +1 -1
- package/dist/schemas/index.d.ts +3 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +3 -2
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/logger.d.ts +16 -1
- package/dist/schemas/logger.d.ts.map +1 -1
- package/dist/schemas/logger.js +6 -1
- package/dist/schemas/logger.js.map +1 -1
- package/dist/schemas/output-defaults.d.ts +44 -0
- package/dist/schemas/output-defaults.d.ts.map +1 -0
- package/dist/schemas/output-defaults.js +53 -0
- package/dist/schemas/output-defaults.js.map +1 -0
- package/dist/schemas/output.d.ts +25 -1
- package/dist/schemas/output.d.ts.map +1 -1
- package/dist/schemas/output.js +29 -2
- package/dist/schemas/output.js.map +1 -1
- package/dist/schemas/sink.d.ts +32 -1
- package/dist/schemas/sink.d.ts.map +1 -1
- package/dist/schemas/sink.js +17 -1
- package/dist/schemas/sink.js.map +1 -1
- package/dist/sinks/buffer/buffer.descriptor.js +1 -1
- package/dist/sinks/buffer/buffer.descriptor.js.map +1 -1
- package/dist/sinks/buffer/{buffer.impl.cli.d.ts → buffer.impl.d.ts} +3 -3
- package/dist/sinks/buffer/buffer.impl.d.ts.map +1 -0
- package/dist/sinks/buffer/buffer.impl.js +42 -0
- package/dist/sinks/buffer/buffer.impl.js.map +1 -0
- package/dist/sinks/console/console.descriptor.js +1 -1
- package/dist/sinks/console/console.descriptor.js.map +1 -1
- package/dist/sinks/console/console.impl.browser.d.ts +4 -3
- package/dist/sinks/console/console.impl.browser.d.ts.map +1 -1
- package/dist/sinks/console/console.impl.browser.js +11 -14
- package/dist/sinks/console/console.impl.browser.js.map +1 -1
- package/dist/sinks/console/{console.impl.cli.d.ts → console.impl.consumer.d.ts} +5 -4
- package/dist/sinks/console/console.impl.consumer.d.ts.map +1 -0
- package/dist/sinks/console/{console.impl.cli.js → console.impl.consumer.js} +16 -8
- package/dist/sinks/console/console.impl.consumer.js.map +1 -0
- package/dist/sinks/file/file.sinks.descriptor.d.ts +10 -0
- package/dist/sinks/file/file.sinks.descriptor.d.ts.map +1 -0
- package/dist/sinks/file/file.sinks.descriptor.js +23 -0
- package/dist/sinks/file/file.sinks.descriptor.js.map +1 -0
- package/dist/sinks/index.d.ts +1 -1
- package/dist/sinks/index.d.ts.map +1 -1
- package/dist/sinks/memory/memory.descriptor.d.ts +1 -1
- package/dist/sinks/memory/memory.descriptor.js +2 -2
- package/dist/sinks/memory/memory.descriptor.js.map +1 -1
- package/dist/sinks/memory/memory.impl.d.ts +5 -11
- package/dist/sinks/memory/memory.impl.d.ts.map +1 -1
- package/dist/sinks/memory/memory.impl.js +46 -21
- package/dist/sinks/memory/memory.impl.js.map +1 -1
- package/dist/sinks/stdout/stdout.descriptor.js +1 -1
- package/dist/sinks/stdout/stdout.descriptor.js.map +1 -1
- package/dist/sinks/stdout/{stdout.impl.cli.d.ts → stdout.impl.d.ts} +5 -4
- package/dist/sinks/stdout/stdout.impl.d.ts.map +1 -0
- package/dist/sinks/stdout/stdout.impl.js +29 -0
- package/dist/sinks/stdout/stdout.impl.js.map +1 -0
- package/dist/sinks.context.descriptor.d.ts +15 -1
- package/dist/sinks.context.descriptor.d.ts.map +1 -1
- package/dist/sinks.context.descriptor.js +1 -1
- package/dist/sinks.context.descriptor.js.map +1 -1
- package/dist/sinks.context.impl.d.ts +2 -1
- package/dist/sinks.context.impl.d.ts.map +1 -1
- package/dist/sinks.context.impl.js +17 -9
- package/dist/sinks.context.impl.js.map +1 -1
- package/dist/stdout-capture/mcp-frame.d.ts +23 -0
- package/dist/stdout-capture/mcp-frame.d.ts.map +1 -0
- package/dist/stdout-capture/mcp-frame.js +80 -0
- package/dist/stdout-capture/mcp-frame.js.map +1 -0
- package/dist/stdout-capture/stdout-capture.descriptor.d.ts +10 -0
- package/dist/stdout-capture/stdout-capture.descriptor.d.ts.map +1 -0
- package/dist/stdout-capture/stdout-capture.descriptor.js +17 -0
- package/dist/stdout-capture/stdout-capture.descriptor.js.map +1 -0
- package/dist/stdout-capture/stdout-capture.impl.d.ts +19 -0
- package/dist/stdout-capture/stdout-capture.impl.d.ts.map +1 -0
- package/dist/stdout-capture/stdout-capture.impl.js +49 -0
- package/dist/stdout-capture/stdout-capture.impl.js.map +1 -0
- package/dist/stdout-capture/stdout-capture.lease.d.ts +45 -0
- package/dist/stdout-capture/stdout-capture.lease.d.ts.map +1 -0
- package/dist/stdout-capture/stdout-capture.lease.js +338 -0
- package/dist/stdout-capture/stdout-capture.lease.js.map +1 -0
- package/dist/stdout-capture/stdout-capture.output.descriptor.d.ts +4 -0
- package/dist/stdout-capture/stdout-capture.output.descriptor.d.ts.map +1 -0
- package/dist/stdout-capture/stdout-capture.output.descriptor.js +18 -0
- package/dist/stdout-capture/stdout-capture.output.descriptor.js.map +1 -0
- package/dist/stdout-capture/stdout-capture.state.d.ts +29 -0
- package/dist/stdout-capture/stdout-capture.state.d.ts.map +1 -0
- package/dist/stdout-capture/stdout-capture.state.js +80 -0
- package/dist/stdout-capture/stdout-capture.state.js.map +1 -0
- package/dist/stdout-capture.d.ts +24 -0
- package/dist/stdout-capture.d.ts.map +1 -0
- package/dist/stdout-capture.js +28 -0
- package/dist/stdout-capture.js.map +1 -0
- package/dist/stdout-capture.plugin.d.ts +7 -0
- package/dist/stdout-capture.plugin.d.ts.map +1 -0
- package/dist/stdout-capture.plugin.js +28 -0
- package/dist/stdout-capture.plugin.js.map +1 -0
- package/package.json +308 -224
- package/dist/contexts/audit.d.ts +0 -34
- package/dist/contexts/audit.d.ts.map +0 -1
- package/dist/contexts/audit.js +0 -13
- package/dist/contexts/audit.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -7
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js +0 -8
- package/dist/formatters/index.js.map +0 -1
- package/dist/formatters/pretty/pretty.impl.cli.d.ts.map +0 -1
- package/dist/formatters/pretty/pretty.impl.cli.js.map +0 -1
- package/dist/kinds/logger.contracts.d.ts +0 -16
- package/dist/kinds/logger.contracts.d.ts.map +0 -1
- package/dist/kinds/logger.contracts.js +0 -9
- package/dist/kinds/logger.contracts.js.map +0 -1
- package/dist/kinds/output.contracts.d.ts +0 -50
- package/dist/kinds/output.contracts.d.ts.map +0 -1
- package/dist/kinds/output.contracts.js +0 -10
- package/dist/kinds/output.contracts.js.map +0 -1
- package/dist/logging.cli.plugin.d.ts.map +0 -1
- package/dist/logging.cli.plugin.js +0 -39
- package/dist/logging.cli.plugin.js.map +0 -1
- package/dist/outputs/index.d.ts +0 -7
- package/dist/outputs/index.d.ts.map +0 -1
- package/dist/outputs/index.js +0 -8
- package/dist/outputs/index.js.map +0 -1
- package/dist/sinks/buffer/buffer.impl.cli.d.ts.map +0 -1
- package/dist/sinks/buffer/buffer.impl.cli.js +0 -34
- package/dist/sinks/buffer/buffer.impl.cli.js.map +0 -1
- package/dist/sinks/console/console.impl.cli.d.ts.map +0 -1
- package/dist/sinks/console/console.impl.cli.js.map +0 -1
- package/dist/sinks/stdout/stdout.impl.cli.d.ts.map +0 -1
- package/dist/sinks/stdout/stdout.impl.cli.js +0 -21
- package/dist/sinks/stdout/stdout.impl.cli.js.map +0 -1
- package/src/audit/audit.descriptor.ts +0 -45
- package/src/audit/audit.storage.schema.ts +0 -57
- package/src/audit/index.ts +0 -8
- package/src/cli/logs.descriptor.ts +0 -19
- package/src/cli/logs.list.descriptor.ts +0 -28
- package/src/cli/logs.list.impl.ts +0 -93
- package/src/cli/logs.rotate.descriptor.ts +0 -40
- package/src/cli/logs.rotate.impl.ts +0 -61
- package/src/cli/logs.search.descriptor.ts +0 -61
- package/src/cli/logs.search.impl.ts +0 -173
- package/src/cli/logs.tail.descriptor.ts +0 -49
- package/src/cli/logs.tail.impl.ts +0 -105
- package/src/cli/logs.view.descriptor.ts +0 -57
- package/src/cli/logs.view.impl.ts +0 -108
- package/src/cli/types.ts +0 -59
- package/src/contexts/audit.ts +0 -36
- package/src/contexts/fallback-logger.ts +0 -80
- package/src/contexts/index.ts +0 -23
- package/src/contexts/logger.ts +0 -119
- package/src/core/index.ts +0 -32
- package/src/core/logger.ts +0 -150
- package/src/core/namespace.ts +0 -195
- package/src/core/parsing.ts +0 -21
- package/src/core/types.ts +0 -82
- package/src/docs/levels.docs.descriptor.ts +0 -344
- package/src/docs/structured.docs.descriptor.ts +0 -444
- package/src/docs/transports.docs.descriptor.ts +0 -428
- package/src/formatters/index.ts +0 -6
- package/src/formatters/json/json.formatters.descriptor.ts +0 -25
- package/src/formatters/json/json.impl.ts +0 -41
- package/src/formatters/json5/json5.descriptor.ts +0 -25
- package/src/formatters/json5/json5.impl.ts +0 -43
- package/src/formatters/jsonl/jsonl.descriptor.ts +0 -26
- package/src/formatters/jsonl/jsonl.impl.ts +0 -39
- package/src/formatters/pretty/pretty.descriptor.ts +0 -26
- package/src/formatters/pretty/pretty.impl.cli.ts +0 -101
- package/src/index.ts +0 -190
- package/src/kinds/audit.ts +0 -169
- package/src/kinds/contexts.ts +0 -22
- package/src/kinds/formatter.ts +0 -117
- package/src/kinds/index.ts +0 -25
- package/src/kinds/logger.contracts.ts +0 -17
- package/src/kinds/logger.impl.ts +0 -206
- package/src/kinds/logger.ts +0 -46
- package/src/kinds/logger.utils.ts +0 -91
- package/src/kinds/output.contracts.ts +0 -54
- package/src/kinds/output.impl.ts +0 -118
- package/src/kinds/output.ts +0 -59
- package/src/kinds/output.types.ts +0 -105
- package/src/kinds/sink.ts +0 -100
- package/src/logger.context.descriptor.ts +0 -13
- package/src/logging.cli.plugin.ts +0 -43
- package/src/logging.plugin.ts +0 -93
- package/src/outputs/index.ts +0 -6
- package/src/outputs/remote/remote.descriptor.ts +0 -27
- package/src/outputs/remote/remote.impl.ts +0 -218
- package/src/outputs.context.descriptor.ts +0 -10
- package/src/outputs.context.impl.ts +0 -30
- package/src/paths.ts +0 -10
- package/src/schemas/audit.ts +0 -98
- package/src/schemas/entry.ts +0 -88
- package/src/schemas/formatter.ts +0 -37
- package/src/schemas/index.ts +0 -80
- package/src/schemas/logger.ts +0 -38
- package/src/schemas/output.ts +0 -62
- package/src/schemas/sink.ts +0 -39
- package/src/sinks/buffer/buffer.descriptor.ts +0 -13
- package/src/sinks/buffer/buffer.impl.cli.ts +0 -49
- package/src/sinks/console/console.descriptor.ts +0 -20
- package/src/sinks/console/console.impl.browser.ts +0 -69
- package/src/sinks/console/console.impl.cli.ts +0 -71
- package/src/sinks/index.ts +0 -8
- package/src/sinks/memory/memory.descriptor.ts +0 -20
- package/src/sinks/memory/memory.impl.ts +0 -119
- package/src/sinks/stdout/stdout.descriptor.ts +0 -13
- package/src/sinks/stdout/stdout.impl.cli.ts +0 -27
- package/src/sinks.context.descriptor.ts +0 -10
- package/src/sinks.context.impl.ts +0 -30
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OTLP exporter headers are a credential: they resolve only through the
|
|
3
|
+
* runtime's credential capability from a declared reference, never from an
|
|
4
|
+
* environment variable, a stored config value or the SDK's ambient fallback.
|
|
5
|
+
*/
|
|
6
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
7
|
+
import * as z from 'zod/v4';
|
|
8
|
+
/**
|
|
9
|
+
* An HTTP field name: an RFC 9110 `token` (`!#$%&'*+-.^_`|~`, digits and
|
|
10
|
+
* letters), so a name a transport would refuse never reaches it.
|
|
11
|
+
*/
|
|
12
|
+
export const OtlpHeaderNameSchema = z.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/);
|
|
13
|
+
/**
|
|
14
|
+
* An HTTP field value as an exporter sends it: visible ASCII (0x21-0x7E), with
|
|
15
|
+
* spaces and tabs allowed only inside. No CR, LF, NUL, other control character
|
|
16
|
+
* or non-ASCII character (a smart quote, say), which `fetch` refuses by echoing
|
|
17
|
+
* the whole value in its error.
|
|
18
|
+
*/
|
|
19
|
+
export const OtlpHeaderValueSchema = z.string().regex(/^[\x21-\x7E](?:[\x21-\x7E \t]*[\x21-\x7E])?$/);
|
|
20
|
+
/** The headers an exporter sends: token names and visible-ASCII values. */
|
|
21
|
+
export const OtlpExporterHeadersSchema = z.record(OtlpHeaderNameSchema, OtlpHeaderValueSchema);
|
|
22
|
+
function malformedPair(credentialKey, index, pairs, part) {
|
|
23
|
+
return new CapabilityError(`The OTLP header credential '${credentialKey}' has a malformed ${part === 'pair' ? 'pair' : `header ${part}`} (pair ${index + 1} of ${pairs}).`, 'INVALID_INPUT', {
|
|
24
|
+
reason: 'otel-headers-invalid', retryable: false, details: { key: credentialKey, pair: index + 1, pairs, part }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse the resolved header credential (`key=value` pairs, comma separated).
|
|
29
|
+
* Every name must be an RFC 9110 token and every value visible ASCII (spaces
|
|
30
|
+
* and tabs only inside); a malformed pair refuses `INVALID_INPUT
|
|
31
|
+
* otel-headers-invalid` with its position and which part is malformed only:
|
|
32
|
+
* the credential value never reaches an error, a log or a detail.
|
|
33
|
+
*/
|
|
34
|
+
export function parseOtelHeaders(rawHeaders, credentialKey) {
|
|
35
|
+
const headers = {};
|
|
36
|
+
const pairs = rawHeaders.split(',');
|
|
37
|
+
for (const [index, pair] of pairs.entries()) {
|
|
38
|
+
const separator = pair.indexOf('=');
|
|
39
|
+
if (separator <= 0)
|
|
40
|
+
throw malformedPair(credentialKey, index, pairs.length, 'pair');
|
|
41
|
+
const name = OtlpHeaderNameSchema.safeParse(pair.slice(0, separator).trim());
|
|
42
|
+
if (!name.success)
|
|
43
|
+
throw malformedPair(credentialKey, index, pairs.length, 'name');
|
|
44
|
+
const value = OtlpHeaderValueSchema.safeParse(pair.slice(separator + 1).trim());
|
|
45
|
+
if (!value.success)
|
|
46
|
+
throw malformedPair(credentialKey, index, pairs.length, 'value');
|
|
47
|
+
headers[name.data] = value.data;
|
|
48
|
+
}
|
|
49
|
+
return headers;
|
|
50
|
+
}
|
|
51
|
+
/** The exporter headers from the declared credential: resolved, or confirmed not set. Other failures throw typed. */
|
|
52
|
+
export async function resolveOtelHeaders(runtime, reference) {
|
|
53
|
+
const resolution = await runtime.resolveCredential(reference);
|
|
54
|
+
if (resolution.ok) {
|
|
55
|
+
const headers = parseOtelHeaders(resolution.value, reference.key);
|
|
56
|
+
return { headers, source: { key: reference.key, state: 'resolved', count: Object.keys(headers).length } };
|
|
57
|
+
}
|
|
58
|
+
// `NOT_FOUND credential-not-set` is the one confirmed absence; every other failure is thrown typed.
|
|
59
|
+
if (resolution.error.code === 'NOT_FOUND' && resolution.error.reason === 'credential-not-set') {
|
|
60
|
+
return { headers: undefined, source: { key: reference.key, state: 'not-set', count: 0 } };
|
|
61
|
+
}
|
|
62
|
+
throw resolution.error;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=otlp-headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlp-headers.js","sourceRoot":"","sources":["../../src/core/otlp-headers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAqB,MAAM,qBAAqB,CAAC;AAEzE,OAAO,KAAK,CAAC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AU,CAAC,KAAK,CAAC,MAAM,KAAK,oBAAoB,EAAE,CAAC;QAC/F,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3F,CAAC;IACD,MAAM,UAAU,CAAC,KAAK,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An OTLP collector may accept an export and still reject part of it: the
|
|
3
|
+
* response is a success carrying `partialSuccess` with the count of rejected
|
|
4
|
+
* records (`rejectedLogRecords`, `rejectedSpans` or `rejectedDataPoints`) and
|
|
5
|
+
* an optional `errorMessage`. The OpenTelemetry SDK hands that to its diag
|
|
6
|
+
* logger, which is a no-op by default, so a rejection would be silent. A
|
|
7
|
+
* partial rejection is a collector failure: Logging reads it with this schema
|
|
8
|
+
* and reports the count, once, through the runtime.
|
|
9
|
+
*/
|
|
10
|
+
import * as z from 'zod/v4';
|
|
11
|
+
/** The OTLP signals and the field each one's partial success counts its rejected records in. */
|
|
12
|
+
export declare const OTLP_REJECTED_FIELDS: {
|
|
13
|
+
readonly logs: "rejectedLogRecords";
|
|
14
|
+
readonly traces: "rejectedSpans";
|
|
15
|
+
readonly metrics: "rejectedDataPoints";
|
|
16
|
+
};
|
|
17
|
+
/** An OTLP signal. */
|
|
18
|
+
export type OtlpSignal = keyof typeof OTLP_REJECTED_FIELDS;
|
|
19
|
+
/** The most of a collector's success body read for its partial success; past it the body is not read. */
|
|
20
|
+
export declare const OTLP_RESPONSE_BODY_LIMIT_BYTES: number;
|
|
21
|
+
/** The most of a collector's `errorMessage` a report carries, after scrubbing. */
|
|
22
|
+
export declare const OTLP_ERROR_MESSAGE_LIMIT = 512;
|
|
23
|
+
/** An OTLP export response: any object, its `partialSuccess` read when present (absent fields mean zero and no message). */
|
|
24
|
+
export declare const OtlpExportResponseSchema: z.ZodObject<{
|
|
25
|
+
partialSuccess: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
rejectedLogRecords: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>>;
|
|
27
|
+
rejectedSpans: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>>;
|
|
28
|
+
rejectedDataPoints: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>>;
|
|
29
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
/** A parsed OTLP export response. */
|
|
33
|
+
export type OtlpExportResponse = z.infer<typeof OtlpExportResponseSchema>;
|
|
34
|
+
/** What a partial rejection reports: the count and, scrubbed and bounded, the collector's message. Never a request credential. */
|
|
35
|
+
export interface OtlpPartialRejection {
|
|
36
|
+
readonly signal: OtlpSignal;
|
|
37
|
+
readonly rejected: number;
|
|
38
|
+
readonly errorMessage?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The rejection to report for one parsed export response, or `null` when the
|
|
42
|
+
* collector rejected nothing. The collector's `errorMessage` is text a peer
|
|
43
|
+
* controls (it can echo the request), so it passes the endpoint text schema
|
|
44
|
+
* with the request's header values (`secrets`) and is cut to
|
|
45
|
+
* {@link OTLP_ERROR_MESSAGE_LIMIT} characters after scrubbing.
|
|
46
|
+
*/
|
|
47
|
+
export declare function readOtlpPartialRejection(signal: OtlpSignal, response: OtlpExportResponse, endpoint: string, secrets: readonly string[]): OtlpPartialRejection | null;
|
|
48
|
+
//# sourceMappingURL=otlp-partial-success.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlp-partial-success.d.ts","sourceRoot":"","sources":["../../src/core/otlp-partial-success.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,gGAAgG;AAChG,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AACX,sBAAsB;AACtB,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAE3D,yGAAyG;AACzG,eAAO,MAAM,8BAA8B,QAAY,CAAC;AACxD,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAW5C,4HAA4H;AAC5H,eAAO,MAAM,wBAAwB;;;;;;;iBAOnC,CAAC;AAEH,qCAAqC;AACrC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,kIAAkI;AAClI,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,oBAAoB,GAAG,IAAI,CAMpK"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An OTLP collector may accept an export and still reject part of it: the
|
|
3
|
+
* response is a success carrying `partialSuccess` with the count of rejected
|
|
4
|
+
* records (`rejectedLogRecords`, `rejectedSpans` or `rejectedDataPoints`) and
|
|
5
|
+
* an optional `errorMessage`. The OpenTelemetry SDK hands that to its diag
|
|
6
|
+
* logger, which is a no-op by default, so a rejection would be silent. A
|
|
7
|
+
* partial rejection is a collector failure: Logging reads it with this schema
|
|
8
|
+
* and reports the count, once, through the runtime.
|
|
9
|
+
*/
|
|
10
|
+
import * as z from 'zod/v4';
|
|
11
|
+
import { createEndpointTextSchema } from "./endpoint.js";
|
|
12
|
+
/** The OTLP signals and the field each one's partial success counts its rejected records in. */
|
|
13
|
+
export const OTLP_REJECTED_FIELDS = {
|
|
14
|
+
logs: 'rejectedLogRecords',
|
|
15
|
+
traces: 'rejectedSpans',
|
|
16
|
+
metrics: 'rejectedDataPoints'
|
|
17
|
+
};
|
|
18
|
+
/** The most of a collector's success body read for its partial success; past it the body is not read. */
|
|
19
|
+
export const OTLP_RESPONSE_BODY_LIMIT_BYTES = 64 * 1024;
|
|
20
|
+
/** The most of a collector's `errorMessage` a report carries, after scrubbing. */
|
|
21
|
+
export const OTLP_ERROR_MESSAGE_LIMIT = 512;
|
|
22
|
+
/**
|
|
23
|
+
* A rejected-record count: OTLP/JSON writes an int64 as a JSON number or as a
|
|
24
|
+
* decimal string, the SDK's protobuf reader as a number.
|
|
25
|
+
*/
|
|
26
|
+
const RejectedCountSchema = z.union([
|
|
27
|
+
z.number().int().nonnegative(),
|
|
28
|
+
z.string().regex(/^\d{1,15}$/).transform(Number)
|
|
29
|
+
]);
|
|
30
|
+
/** An OTLP export response: any object, its `partialSuccess` read when present (absent fields mean zero and no message). */
|
|
31
|
+
export const OtlpExportResponseSchema = z.object({
|
|
32
|
+
partialSuccess: z.object({
|
|
33
|
+
rejectedLogRecords: RejectedCountSchema.optional(),
|
|
34
|
+
rejectedSpans: RejectedCountSchema.optional(),
|
|
35
|
+
rejectedDataPoints: RejectedCountSchema.optional(),
|
|
36
|
+
errorMessage: z.string().optional()
|
|
37
|
+
}).optional()
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* The rejection to report for one parsed export response, or `null` when the
|
|
41
|
+
* collector rejected nothing. The collector's `errorMessage` is text a peer
|
|
42
|
+
* controls (it can echo the request), so it passes the endpoint text schema
|
|
43
|
+
* with the request's header values (`secrets`) and is cut to
|
|
44
|
+
* {@link OTLP_ERROR_MESSAGE_LIMIT} characters after scrubbing.
|
|
45
|
+
*/
|
|
46
|
+
export function readOtlpPartialRejection(signal, response, endpoint, secrets) {
|
|
47
|
+
const partial = response.partialSuccess;
|
|
48
|
+
const rejected = partial?.[OTLP_REJECTED_FIELDS[signal]] ?? 0;
|
|
49
|
+
if (partial === undefined || rejected === 0)
|
|
50
|
+
return null;
|
|
51
|
+
if (!partial.errorMessage)
|
|
52
|
+
return { signal, rejected };
|
|
53
|
+
return { signal, rejected, errorMessage: createEndpointTextSchema(endpoint, secrets).parse(partial.errorMessage).slice(0, OTLP_ERROR_MESSAGE_LIMIT) };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=otlp-partial-success.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otlp-partial-success.js","sourceRoot":"","sources":["../../src/core/otlp-partial-success.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEzD,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,IAAI,EAAE,oBAAoB;IAC1B,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,oBAAoB;CACpB,CAAC;AAIX,yGAAyG;AACzG,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,kFAAkF;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;GAGG;AACH,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC9B,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;CAChD,CAAC,CAAC;AAEH,4HAA4H;AAC5H,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC;QACxB,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QAClD,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QAC7C,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QAClD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC;AAYH;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAkB,EAAE,QAA4B,EAAE,QAAgB,EAAE,OAA0B;IACtI,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC;IACxC,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,OAAO,KAAK,SAAS,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,CAAC,OAAO,CAAC,YAAY;QAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACvD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,wBAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,wBAAwB,CAAC,EAAE,CAAC;AACvJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failure outcomes as values.
|
|
3
|
+
*
|
|
4
|
+
* A logging backend must never break the caller that logged, and its failure
|
|
5
|
+
* must stay visible. These helpers turn a throw or a rejection into a value
|
|
6
|
+
* that carries its cause, so the owner decides what the failure means
|
|
7
|
+
* (report it, retain it for close, or rethrow it) with nothing able to drop it.
|
|
8
|
+
*/
|
|
9
|
+
/** What an operation produced, or the failure it raised. */
|
|
10
|
+
export type Outcome<T> = {
|
|
11
|
+
readonly failed: false;
|
|
12
|
+
readonly value: T;
|
|
13
|
+
} | {
|
|
14
|
+
readonly failed: true;
|
|
15
|
+
readonly cause: unknown;
|
|
16
|
+
};
|
|
17
|
+
/** Run a synchronous operation; a throw becomes a failed outcome carrying its cause. */
|
|
18
|
+
export declare function attempt<T>(run: () => T): Outcome<T>;
|
|
19
|
+
/** Observe an asynchronous operation; a rejection becomes a failed outcome carrying its cause. */
|
|
20
|
+
export declare function settle<T>(operation: PromiseLike<T>): Promise<Outcome<T>>;
|
|
21
|
+
//# sourceMappingURL=outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../src/core/outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,4DAA4D;AAC5D,MAAM,MAAM,OAAO,CAAC,CAAC,IAClB;IAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAC7C;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtD,wFAAwF;AACxF,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMnD;AAED,kGAAkG;AAClG,wBAAgB,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAOxE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failure outcomes as values.
|
|
3
|
+
*
|
|
4
|
+
* A logging backend must never break the caller that logged, and its failure
|
|
5
|
+
* must stay visible. These helpers turn a throw or a rejection into a value
|
|
6
|
+
* that carries its cause, so the owner decides what the failure means
|
|
7
|
+
* (report it, retain it for close, or rethrow it) with nothing able to drop it.
|
|
8
|
+
*/
|
|
9
|
+
/** Run a synchronous operation; a throw becomes a failed outcome carrying its cause. */
|
|
10
|
+
export function attempt(run) {
|
|
11
|
+
try {
|
|
12
|
+
return { failed: false, value: run() };
|
|
13
|
+
}
|
|
14
|
+
catch (cause) {
|
|
15
|
+
return { failed: true, cause };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Observe an asynchronous operation; a rejection becomes a failed outcome carrying its cause. */
|
|
19
|
+
export function settle(operation) {
|
|
20
|
+
// `Promise.resolve` reads a real promise's `constructor` synchronously, which a hostile
|
|
21
|
+
// getter can throw from; resolving inside the executor turns that into a rejection.
|
|
22
|
+
return new Promise((resolve) => resolve(operation)).then((value) => ({ failed: false, value }), (cause) => ({ failed: true, cause }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.js","sourceRoot":"","sources":["../../src/core/outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,wFAAwF;AACxF,MAAM,UAAU,OAAO,CAAI,GAAY;IACtC,IAAI,CAAC;QACJ,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;AACF,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,MAAM,CAAI,SAAyB;IAClD,wFAAwF;IACxF,oFAAoF;IACpF,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAC1D,CAAC,KAAK,EAAc,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EACjD,CAAC,KAAK,EAAc,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAChD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RuntimeRef } from '@vibesdotdev/kernel';
|
|
2
|
+
/** Selected sinks and outputs that own asynchronous cleanup. */
|
|
3
|
+
interface LoggingResource {
|
|
4
|
+
close(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare function trackLoggingResource(runtime: RuntimeRef, output: LoggingResource): void;
|
|
7
|
+
export declare function untrackLoggingResource(runtime: RuntimeRef, output: LoggingResource): void;
|
|
8
|
+
/** A Logging plugin registration began on `runtime`'s Root. */
|
|
9
|
+
export declare function beginLoggingRegistration(runtime: RuntimeRef): void;
|
|
10
|
+
/** A Logging plugin registration finalized; true when none remains on the Root, so the Root's Logging ends. */
|
|
11
|
+
export declare function endLoggingRegistration(runtime: RuntimeRef): boolean;
|
|
12
|
+
/** Logging's last finalization on a Root: close emission (when finalizing), then the Root's resources. */
|
|
13
|
+
export declare function disposeLoggingResources(runtime: RuntimeRef): Promise<void>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=output-resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-resources.d.ts","sourceRoot":"","sources":["../../src/core/output-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAItD,gEAAgE;AAChE,UAAU,eAAe;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAUD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAOvF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAEzF;AAUD,+DAA+D;AAC/D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAElE;AAED,+GAA+G;AAC/G,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAInE;AAED,0GAA0G;AAC1G,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAShF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { closeLoggingEmission } from "./emission-window.js";
|
|
2
|
+
import { loggingRootOf } from "./root-identity.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resources per Root (`loggingRootOf(runtime)`): a sink or output resolved
|
|
5
|
+
* through a reload generation or a plugin view is the Root's, and closes with
|
|
6
|
+
* Logging's last finalization on the Root; a generation's retirement never
|
|
7
|
+
* closes it.
|
|
8
|
+
*/
|
|
9
|
+
const resources = new WeakMap();
|
|
10
|
+
export function trackLoggingResource(runtime, output) {
|
|
11
|
+
let outputs = resources.get(loggingRootOf(runtime));
|
|
12
|
+
if (!outputs) {
|
|
13
|
+
outputs = new Set();
|
|
14
|
+
resources.set(loggingRootOf(runtime), outputs);
|
|
15
|
+
}
|
|
16
|
+
outputs.add(output);
|
|
17
|
+
}
|
|
18
|
+
export function untrackLoggingResource(runtime, output) {
|
|
19
|
+
resources.get(loggingRootOf(runtime))?.delete(output);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Live Logging plugin registrations per Root. A reload generation that
|
|
23
|
+
* replaces Logging registers a new epoch before the previous one retires, so
|
|
24
|
+
* the count tells a handover (another registration still serves the Root)
|
|
25
|
+
* from Logging's last finalization on that Root.
|
|
26
|
+
*/
|
|
27
|
+
const registrations = new WeakMap();
|
|
28
|
+
/** A Logging plugin registration began on `runtime`'s Root. */
|
|
29
|
+
export function beginLoggingRegistration(runtime) {
|
|
30
|
+
registrations.set(loggingRootOf(runtime), (registrations.get(loggingRootOf(runtime)) ?? 0) + 1);
|
|
31
|
+
}
|
|
32
|
+
/** A Logging plugin registration finalized; true when none remains on the Root, so the Root's Logging ends. */
|
|
33
|
+
export function endLoggingRegistration(runtime) {
|
|
34
|
+
const remaining = Math.max(0, (registrations.get(loggingRootOf(runtime)) ?? 0) - 1);
|
|
35
|
+
registrations.set(loggingRootOf(runtime), remaining);
|
|
36
|
+
return remaining === 0;
|
|
37
|
+
}
|
|
38
|
+
/** Logging's last finalization on a Root: close emission (when finalizing), then the Root's resources. */
|
|
39
|
+
export async function disposeLoggingResources(runtime) {
|
|
40
|
+
// Logging finalizes after every plugin that depends on it: from here on its loggers refuse.
|
|
41
|
+
closeLoggingEmission(runtime);
|
|
42
|
+
const outputs = resources.get(loggingRootOf(runtime));
|
|
43
|
+
if (!outputs)
|
|
44
|
+
return;
|
|
45
|
+
const closed = await Promise.allSettled([...outputs].map(output => output.close()));
|
|
46
|
+
const failures = closed.filter(result => result.status === 'rejected').map(result => result.reason);
|
|
47
|
+
if (failures.length > 0)
|
|
48
|
+
throw new AggregateError(failures, 'Logging output cleanup failed.');
|
|
49
|
+
resources.delete(loggingRootOf(runtime));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=output-resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-resources.js","sourceRoot":"","sources":["../../src/core/output-resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOnD;;;;;GAKG;AACH,MAAM,SAAS,GAAG,IAAI,OAAO,EAA6C,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,OAAmB,EAAE,MAAuB;IAChF,IAAI,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACpB,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,EA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AM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpG,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,cAAc,CAAC,QAAQ,EAAE,gCAAgC,CAAC,CAAC;IAC9F,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsing.d.ts","sourceRoot":"","sources":["../../src/core/parsing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parsing.d.ts","sourceRoot":"","sources":["../../src/core/parsing.ts"],"names":[],"mappings":"AAcA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAK1D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAKlE"}
|
package/dist/core/parsing.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
const SizeUnitSchema = z.enum(['B', 'KB', 'MB', 'GB']);
|
|
3
|
+
const SIZE_UNITS = { B: 1, KB: 1024, MB: 1024 ** 2, GB: 1024 ** 3 };
|
|
4
|
+
const DurationUnitSchema = z.enum(['s', 'm', 'h', 'd', 'w']);
|
|
5
|
+
const DURATION_UNITS = {
|
|
6
|
+
s: 1000,
|
|
7
|
+
m: 60 * 1000,
|
|
8
|
+
h: 60 * 60 * 1000,
|
|
9
|
+
d: 24 * 60 * 60 * 1000,
|
|
10
|
+
w: 7 * 24 * 60 * 60 * 1000
|
|
11
|
+
};
|
|
1
12
|
export function parseSize(size) {
|
|
2
13
|
if (!size)
|
|
3
14
|
return 10 * 1024 * 1024;
|
|
4
|
-
const units = { B: 1, KB: 1024, MB: 1024 ** 2, GB: 1024 ** 3 };
|
|
5
15
|
const match = size.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);
|
|
6
16
|
if (!match)
|
|
7
17
|
return 10 * 1024 * 1024;
|
|
8
|
-
return Math.floor(parseFloat(match[1]) * (
|
|
18
|
+
return Math.floor(parseFloat(match[1]) * SIZE_UNITS[SizeUnitSchema.parse(match[2].toUpperCase())]);
|
|
9
19
|
}
|
|
10
20
|
export function parseDuration(duration) {
|
|
11
21
|
if (!duration)
|
|
12
22
|
return 7 * 24 * 60 * 60 * 1000;
|
|
13
|
-
const units = {
|
|
14
|
-
s: 1000,
|
|
15
|
-
m: 60 * 1000,
|
|
16
|
-
h: 60 * 60 * 1000,
|
|
17
|
-
d: 24 * 60 * 60 * 1000,
|
|
18
|
-
w: 7 * 24 * 60 * 60 * 1000
|
|
19
|
-
};
|
|
20
23
|
const match = duration.match(/^(\d+)\s*(s|m|h|d|w)$/i);
|
|
21
24
|
if (!match)
|
|
22
25
|
return 7 * 24 * 60 * 60 * 1000;
|
|
23
|
-
return parseInt(match[1], 10) * (
|
|
26
|
+
return parseInt(match[1], 10) * DURATION_UNITS[DurationUnitSchema.parse(match[2].toLowerCase())];
|
|
24
27
|
}
|
|
25
28
|
//# sourceMappingURL=parsing.js.map
|
package/dist/core/parsing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsing.js","sourceRoot":"","sources":["../../src/core/parsing.ts"],"names":[],"mappings":"AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"parsing.js","sourceRoot":"","sources":["../../src/core/parsing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAA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CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACvD,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3C,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,cAAc,CAAC,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging-owned redaction and structured error schemas.
|
|
3
|
+
*
|
|
4
|
+
* Raw values enter the published schemas. Redaction uses keys and secret()
|
|
5
|
+
* values; free text remains data. Parsing yields a detached snapshot.
|
|
6
|
+
*
|
|
7
|
+
* One rule governs every value read off an Error or a context: each field is
|
|
8
|
+
* read exactly once, inside a guard. A string is kept (and passes the same
|
|
9
|
+
* key and `secret()` redaction as everything else); any other value goes
|
|
10
|
+
* through the one redaction walk; a value that cannot be read is never
|
|
11
|
+
* carried: an Error is then described value-free, and a context refuses with
|
|
12
|
+
* a typed `ZodError` issue holding a fixed message and the path.
|
|
13
|
+
*/
|
|
14
|
+
import * as z from 'zod/v4';
|
|
15
|
+
import type { LogContext } from '../schemas/entry.ts';
|
|
16
|
+
export declare const REDACTED = "[REDACTED]";
|
|
17
|
+
/**
|
|
18
|
+
* The credential words: a key (or query parameter name) whose last word is one
|
|
19
|
+
* of these names a credential. Matched as a whole word, never inside one, so
|
|
20
|
+
* `pwd`, `pass`, `pin`, `otp`, `totp`, `dbPwd` and `db_pass` are secret while `passage`,
|
|
21
|
+
* `bypass`, `spin` and `passCount` are not. A bare `key` is secret as the whole key only (the
|
|
22
|
+
* exact list), so `monkey`, `keyId`, `cacheKey` and `credentialKey` (which name
|
|
23
|
+
* a key, not hold one) stay readable. The endpoint scrubber's credential query
|
|
24
|
+
* parameters use the same rule (`isSecretKey`), so the two never disagree.
|
|
25
|
+
*/
|
|
26
|
+
export declare const CREDENTIAL_KEY_WORDS: readonly ["token", "secret", "password", "passwd", "pass", "pwd", "passphrase", "pin", "otp", "totp", "credential", "signature", "jwt", "bearer"];
|
|
27
|
+
/**
|
|
28
|
+
* A string a caller hands in, refused as a `ZodError` issue for any other value.
|
|
29
|
+
* Zod's own `z.string()` describes a refused value's type with `Array.isArray`,
|
|
30
|
+
* which throws a `TypeError` for a revoked Proxy; this check reads only `typeof`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const CallerStringSchema: z.ZodCustom<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* Case- and separator-insensitive matching; token counts stay readable. A key
|
|
35
|
+
* is secret when its normalized form is a listed name, ends with a listed
|
|
36
|
+
* suffix or holds a listed infix (a bare `key` is listed), or when its last
|
|
37
|
+
* word is a credential word ({@link CREDENTIAL_KEY_WORDS}).
|
|
38
|
+
*/
|
|
39
|
+
export declare function isSecretKey(key: string): boolean;
|
|
40
|
+
declare const SECRET_BRAND: unique symbol;
|
|
41
|
+
/** A secret that redacts in serialization; reveal() is the explicit escape. */
|
|
42
|
+
export declare class SecretValue {
|
|
43
|
+
#private;
|
|
44
|
+
readonly [SECRET_BRAND] = true;
|
|
45
|
+
constructor(value: string);
|
|
46
|
+
reveal(): string;
|
|
47
|
+
toJSON(): string;
|
|
48
|
+
toString(): string;
|
|
49
|
+
}
|
|
50
|
+
export declare function secret(value: string): SecretValue;
|
|
51
|
+
/**
|
|
52
|
+
* Validates the branded secret protocol without copying the secret instance.
|
|
53
|
+
* Total: a value whose protocol reads throw (a trap, a getter, a revoked
|
|
54
|
+
* Proxy) is not a secret value and refuses as an issue, never rethrowing.
|
|
55
|
+
*/
|
|
56
|
+
export declare const SecretValueSchema: z.ZodCustom<SecretValue, SecretValue>;
|
|
57
|
+
export declare const PlainLogRecordSchema: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
58
|
+
/** A complete, secret-free description of a thrown value. */
|
|
59
|
+
export interface LoggedError {
|
|
60
|
+
name: string;
|
|
61
|
+
message: string;
|
|
62
|
+
code?: string | number;
|
|
63
|
+
reason?: string;
|
|
64
|
+
status?: number;
|
|
65
|
+
retryable?: boolean;
|
|
66
|
+
details?: unknown;
|
|
67
|
+
fields?: LogContext;
|
|
68
|
+
stack?: string;
|
|
69
|
+
cause?: LoggedError | unknown;
|
|
70
|
+
errors?: LoggedError[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The breadth cap of the walk: an array keeps its first `MAX_WALK_BREADTH`
|
|
74
|
+
* items and an object its first `MAX_WALK_BREADTH` own enumerable keys (an
|
|
75
|
+
* AggregateError its first `MAX_WALK_BREADTH` members). What is past the cap
|
|
76
|
+
* is not read; it is described by one truncation marker holding the count
|
|
77
|
+
* left out ({@link truncationMarker}): a last array item, an object's
|
|
78
|
+
* {@link TRUNCATED_KEY} field, or a last aggregate member named `Truncated`.
|
|
79
|
+
* Ordinary contexts are far below it; a 100,000-item array is walked in a few
|
|
80
|
+
* milliseconds instead of the hundreds a full walk takes.
|
|
81
|
+
*/
|
|
82
|
+
export declare const MAX_WALK_BREADTH = 1000;
|
|
83
|
+
/** The key an object's truncation marker is carried under. */
|
|
84
|
+
export declare const TRUNCATED_KEY = "[Truncated]";
|
|
85
|
+
/** The marker for `omitted` items, keys or members past the breadth cap. */
|
|
86
|
+
export declare function truncationMarker(omitted: number): string;
|
|
87
|
+
/**
|
|
88
|
+
* A caller primitive that JSON cannot carry, as the JSON value every sink can
|
|
89
|
+
* serialize: a bigint as its decimal string (`10n` -> `"10"`), a symbol as its
|
|
90
|
+
* `Symbol(description)` text, a function as `[Function]`, and NaN / Infinity /
|
|
91
|
+
* -Infinity as the strings `"NaN"`, `"Infinity"`, `"-Infinity"`. JSON primitives
|
|
92
|
+
* pass unchanged. No sink downstream of the walk can then throw on a value.
|
|
93
|
+
* A function is recognized by `typeof`, which no Proxy trap can intercept.
|
|
94
|
+
*/
|
|
95
|
+
export declare const FUNCTION_MARKER = "[Function]";
|
|
96
|
+
/** The refusal message for a caller value that cannot be read: never what the read threw, which may carry the value. */
|
|
97
|
+
export declare const UNREADABLE_LOG_VALUE_MESSAGE = "A log value could not be read (a getter, Proxy trap or conversion threw), so it cannot be snapshotted; what it threw is withheld because it may carry the value.";
|
|
98
|
+
/** The refusal message for a value whose own JSON hook throws; the hook's failure value never travels with it. */
|
|
99
|
+
export declare const JSON_HOOK_REFUSAL_MESSAGE = "A log value's toJSON hook threw, so the value cannot be snapshotted.";
|
|
100
|
+
/**
|
|
101
|
+
* The named fields of a caller value (an audit input, a tracker's params), each
|
|
102
|
+
* read exactly once inside the guard, as a record of the raw values read; an
|
|
103
|
+
* absent field is left out, and a value that is not an object has no fields.
|
|
104
|
+
* A read that throws (a getter, a Proxy trap, a revoked Proxy) refuses with
|
|
105
|
+
* the value-free unreadable `ZodError` issue at that field's path: nothing it
|
|
106
|
+
* threw is carried, and the schema never throws it. The values read are still
|
|
107
|
+
* raw; the caller walks or validates them.
|
|
108
|
+
*/
|
|
109
|
+
export declare function createFieldsReadSchema(keys: readonly string[]): z.ZodType<LogContext>;
|
|
110
|
+
/** What a thrown value's description says when describing it throws: never the thrown message, which a hostile getter or trap can fill with the value. */
|
|
111
|
+
export declare const UNDESCRIBABLE_ERROR_MESSAGE = "The thrown value could not be described (a getter, toJSON, conversion or Proxy trap threw); its message is withheld because it may carry the value.";
|
|
112
|
+
/**
|
|
113
|
+
* The name a value-free description carries: a provable Error's own name when it
|
|
114
|
+
* reads without throwing and is a plain identifier naming no secret, else
|
|
115
|
+
* `Error`; `NonError` for anything not provably an Error (`instanceof` reads the
|
|
116
|
+
* prototype, which a Proxy trap or a revoked Proxy throws from).
|
|
117
|
+
*/
|
|
118
|
+
export declare const ReadableErrorNameSchema: z.ZodPipe<z.ZodUnknown, z.ZodTransform<string, unknown>>;
|
|
119
|
+
/** Describes a thrown value without the value: its readable error name and the fixed `message`. */
|
|
120
|
+
export declare function valueFreeFailureSchema(message: string): z.ZodType<LoggedError>;
|
|
121
|
+
/** A thrown value's description, and whether it is the full one (`false`: describing it threw, so it is value-free). */
|
|
122
|
+
export interface ThrownValueDescription {
|
|
123
|
+
readonly error: LoggedError;
|
|
124
|
+
readonly described: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The total describer of a thrown value, with the message its value-free form
|
|
128
|
+
* carries. It never throws, for any input, and its description is JSON.
|
|
129
|
+
*/
|
|
130
|
+
export declare function createThrownValueSchema(undescribable: string): z.ZodType<ThrownValueDescription>;
|
|
131
|
+
/** {@link createThrownValueSchema} with {@link UNDESCRIBABLE_ERROR_MESSAGE}. */
|
|
132
|
+
export declare const ThrownValueSchema: z.ZodType<ThrownValueDescription, unknown, z.core.$ZodTypeInternals<ThrownValueDescription, unknown>>;
|
|
133
|
+
/**
|
|
134
|
+
* Raw thrown values normalize here, including primitives and non-Error objects.
|
|
135
|
+
* Total: it never throws. An ordinary Error is described in full (name,
|
|
136
|
+
* message, metadata, redacted details and fields, stack, cause chain,
|
|
137
|
+
* aggregate members), each field read once: a string field is kept, a
|
|
138
|
+
* non-string one is walked and carried as its redacted JSON text. A value
|
|
139
|
+
* whose description throws is described as its readable error name
|
|
140
|
+
* (`ReadableErrorNameSchema`) and `UNDESCRIBABLE_ERROR_MESSAGE`, and a cause or
|
|
141
|
+
* aggregate member that cannot be described is described that way in place.
|
|
142
|
+
*/
|
|
143
|
+
export declare const LoggedErrorSchema: z.ZodPipe<z.ZodType<ThrownValueDescription, unknown, z.core.$ZodTypeInternals<ThrownValueDescription, unknown>>, z.ZodTransform<LoggedError, ThrownValueDescription>>;
|
|
144
|
+
/** A thrown value's message for a report line, through the total describer: never throws, never the text of a value that cannot be described. */
|
|
145
|
+
export declare const ThrownMessageSchema: z.ZodPipe<z.ZodType<ThrownValueDescription, unknown, z.core.$ZodTypeInternals<ThrownValueDescription, unknown>>, z.ZodTransform<string, ThrownValueDescription>>;
|
|
146
|
+
/**
|
|
147
|
+
* The one nested-value schema. A consumer that parses a value with it owns a
|
|
148
|
+
* detached, redacted snapshot: secret keys and `secret()` values are replaced,
|
|
149
|
+
* Errors become `LoggedError` (described in place by the total describer),
|
|
150
|
+
* every object's callable `toJSON` runs exactly once and its returned value is
|
|
151
|
+
* normalized the same way, and no caller container is retained. A value that
|
|
152
|
+
* cannot be read (a getter or Proxy trap throws) or whose hook throws refuses
|
|
153
|
+
* with a `ZodError` issue holding a fixed message and the path; nothing the
|
|
154
|
+
* value threw is carried, and the schema never throws it. `JSON.stringify` of
|
|
155
|
+
* the result runs no hook.
|
|
156
|
+
*/
|
|
157
|
+
export declare const RedactedLogValueSchema: z.ZodPipe<z.ZodUnknown, z.ZodTransform<unknown, unknown>>;
|
|
158
|
+
/** The emitted path reuses {@link RedactedLogValueSchema}: delivery and the public schema are one contract. */
|
|
159
|
+
export declare const EmittedLogValueSchema: z.ZodPipe<z.ZodUnknown, z.ZodTransform<unknown, unknown>>;
|
|
160
|
+
export {};
|
|
161
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/core/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,eAAO,MAAM,QAAQ,eAAe,CAAC;AA4BrC;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,mJAEvB,CAAC;AAQX;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,6BAA6G,CAAC;AAE7I;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAShD;AAED,QAAA,MAAM,YAAY,eAA2C,CAAC;AAE9D,+EAA+E;AAC/E,qBAAa,WAAW;;IACvB,QAAQ,CAAC,CAAC,YAAY,CAAC,QAAQ;g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