@fulmenhq/tsfulmen 0.3.3 → 0.4.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/CHANGELOG.md +51 -1
- package/README.md +30 -1
- package/config/crucible-ts/taxonomy/metrics.yaml +1 -1
- package/dist/appidentity/index.js +9 -2209
- package/dist/appidentity/index.js.map +1 -1
- package/dist/assets/index.d.ts +179 -0
- package/dist/assets/index.js +4 -0
- package/dist/assets/index.js.map +1 -0
- package/dist/bin/prometheus-cli.js +15 -9139
- package/dist/bin/prometheus-cli.js.map +1 -1
- package/dist/bin/schema-cli.js +4 -6098
- package/dist/bin/schema-cli.js.map +1 -1
- package/dist/bin/signals-cli.js +15 -1910
- package/dist/bin/signals-cli.js.map +1 -1
- package/dist/chunk-3HISR2XI.js +36 -0
- package/dist/chunk-3HISR2XI.js.map +1 -0
- package/dist/chunk-5HZEJGZ5.js +725 -0
- package/dist/chunk-5HZEJGZ5.js.map +1 -0
- package/dist/chunk-7SVYOPJ3.js +9412 -0
- package/dist/chunk-7SVYOPJ3.js.map +1 -0
- package/dist/chunk-BCO3FUUO.js +682 -0
- package/dist/chunk-BCO3FUUO.js.map +1 -0
- package/dist/chunk-BJDL6JEX.js +208 -0
- package/dist/chunk-BJDL6JEX.js.map +1 -0
- package/dist/chunk-BTUS6PZZ.js +302 -0
- package/dist/chunk-BTUS6PZZ.js.map +1 -0
- package/dist/chunk-CW4CSNVF.js +410 -0
- package/dist/chunk-CW4CSNVF.js.map +1 -0
- package/dist/chunk-HIBZ2AY7.js +194 -0
- package/dist/chunk-HIBZ2AY7.js.map +1 -0
- package/dist/chunk-HS4F3BRR.js +985 -0
- package/dist/chunk-HS4F3BRR.js.map +1 -0
- package/dist/chunk-HY6JQOFN.js +32 -0
- package/dist/chunk-HY6JQOFN.js.map +1 -0
- package/dist/chunk-K2FYT43R.js +837 -0
- package/dist/chunk-K2FYT43R.js.map +1 -0
- package/dist/chunk-K7BMFGQP.js +43 -0
- package/dist/chunk-K7BMFGQP.js.map +1 -0
- package/dist/chunk-LWAH2UG7.js +103 -0
- package/dist/chunk-LWAH2UG7.js.map +1 -0
- package/dist/chunk-OHE2AOH4.js +273 -0
- package/dist/chunk-OHE2AOH4.js.map +1 -0
- package/dist/chunk-P3DNOZOG.js +1488 -0
- package/dist/chunk-P3DNOZOG.js.map +1 -0
- package/dist/chunk-PQ6TKPUN.js +27 -0
- package/dist/chunk-PQ6TKPUN.js.map +1 -0
- package/dist/chunk-QCCN6POA.js +211 -0
- package/dist/chunk-QCCN6POA.js.map +1 -0
- package/dist/chunk-RSLFR4TO.js +631 -0
- package/dist/chunk-RSLFR4TO.js.map +1 -0
- package/dist/chunk-UP2VWCW5.js +33 -0
- package/dist/chunk-UP2VWCW5.js.map +1 -0
- package/dist/chunk-W6TQFTTY.js +130 -0
- package/dist/chunk-W6TQFTTY.js.map +1 -0
- package/dist/chunk-WSMVLWLB.js +269 -0
- package/dist/chunk-WSMVLWLB.js.map +1 -0
- package/dist/config/index.js +6 -1220
- package/dist/config/index.js.map +1 -1
- package/dist/crucible/fulpack/index.js +2 -25
- package/dist/crucible/fulpack/index.js.map +1 -1
- package/dist/crucible/index.js +13 -1129
- package/dist/crucible/index.js.map +1 -1
- package/dist/docscribe/index.js +2 -680
- package/dist/docscribe/index.js.map +1 -1
- package/dist/errors/index.js +5 -1831
- package/dist/errors/index.js.map +1 -1
- package/dist/errors-D7KXV3QW.js +4 -0
- package/dist/errors-D7KXV3QW.js.map +1 -0
- package/dist/errors-RBJX6ETJ.js +8 -0
- package/dist/errors-RBJX6ETJ.js.map +1 -0
- package/dist/export-BWRETGYS.js +6 -0
- package/dist/export-BWRETGYS.js.map +1 -0
- package/dist/foundry/index.js +340 -3949
- package/dist/foundry/index.js.map +1 -1
- package/dist/foundry/similarity/index.js +3 -134
- package/dist/foundry/similarity/index.js.map +1 -1
- package/dist/fulencode/index.js +3 -319
- package/dist/fulencode/index.js.map +1 -1
- package/dist/fulhash/index.js +3 -611
- package/dist/fulhash/index.js.map +1 -1
- package/dist/fulpack/index.js +3 -1515
- package/dist/fulpack/index.js.map +1 -1
- package/dist/hash-YOJYVOWH.js +4 -0
- package/dist/hash-YOJYVOWH.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -4395
- package/dist/index.js.map +1 -1
- package/dist/loader-H5K7HSO5.js +9 -0
- package/dist/loader-H5K7HSO5.js.map +1 -0
- package/dist/logging/index.js +2 -723
- package/dist/logging/index.js.map +1 -1
- package/dist/pathfinder/index.js +18 -2341
- package/dist/pathfinder/index.js.map +1 -1
- package/dist/prom-client-PNEBGD3G.js +4801 -0
- package/dist/prom-client-PNEBGD3G.js.map +1 -0
- package/dist/reports/license-inventory.csv +1 -1
- package/dist/schema/index.d.ts +19 -6
- package/dist/schema/index.js +4 -6148
- package/dist/schema/index.js.map +1 -1
- package/dist/signals/index.js +8 -2767
- package/dist/signals/index.js.map +1 -1
- package/dist/similarity/index.js +3 -134
- package/dist/similarity/index.js.map +1 -1
- package/dist/telemetry/http/index.js +9 -930
- package/dist/telemetry/http/index.js.map +1 -1
- package/dist/telemetry/index.js +4 -1561
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/prometheus/index.js +7 -8422
- package/dist/telemetry/prometheus/index.js.map +1 -1
- package/dist/validator-U4CKD2Y3.js +6 -0
- package/dist/validator-U4CKD2Y3.js.map +1 -0
- package/package.json +5 -1
- package/schemas/crucible-ts/library/module-manifest/v1.0.0/module-manifest.schema.json +1 -1
- package/schemas/crucible-ts/observability/logging/v1.0.0/definitions.schema.json +1 -1
- package/schemas/crucible-ts/observability/logging/v1.0.0/log-event.schema.json +13 -13
- package/schemas/crucible-ts/observability/logging/v1.0.0/logger-config.schema.json +2 -2
- package/schemas/crucible-ts/observability/logging/v1.0.0/logging-policy.schema.json +1 -1
- package/schemas/crucible-ts/observability/logging/v1.0.0/middleware-config.schema.json +2 -2
- package/schemas/crucible-ts/observability/logging/v1.0.0/severity-filter.schema.json +3 -3
- package/schemas/crucible-ts/upstream/3leaps/crucible/PROVENANCE.md +3 -3
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/catalog/classifiers/README.md +1 -1
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/classifiers-framework.md +1 -1
- package/schemas/crucible-ts/upstream/3leaps/crucible/docs/standards/data-sensitivity-classification.md +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/telemetry/prometheus/constants.ts","../src/telemetry/prometheus/errors.ts","../src/telemetry/prometheus/exporter.ts","../src/telemetry/prometheus/lifecycle.ts","../src/telemetry/prometheus/server.ts"],"names":["metrics"],"mappings":";;;;;;AAYO,IAAM,kBAAA,GAAqB,CAAC,CAAA,EAAG,CAAA,EAAG,EAAA,EAAI,IAAI,GAAA,EAAK,GAAA,EAAK,GAAA,EAAM,GAAA,EAAM,GAAK;AAQrE,IAAM,uBAAA,GAA0B;AAAA,EACrC,IAAA;AAAA,EAAO,IAAA;AAAA,EAAO,IAAA;AAAA,EAAM,IAAA;AAAA,EAAM,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,CAAA;AAAA,EAAK,CAAA;AAAA,EAAK;AAChD;AAKO,SAAS,YAAY,EAAA,EAAoB;AAC9C,EAAA,OAAO,EAAA,GAAK,GAAA;AACd;AAKO,IAAM,2BAAA,GAA8B;AAAA;AAAA,EAEzC,wBAAA,EAA0B,8CAAA;AAAA,EAC1B,aAAA,EAAe,mCAAA;AAAA,EACf,oBAAA,EAAsB,0CAAA;AAAA,EACtB,gBAAA,EAAkB,sCAAA;AAAA;AAAA,EAGlB,mBAAA,EAAqB,yCAAA;AAAA,EACrB,iBAAA,EAAmB,uCAAA;AAAA;AAAA,EAGnB,cAAA,EAAgB;AAClB;AAKO,IAAM,eAAA,GAAkB;AAAA;AAAA,EAE7B,oBAAA,EAAsB,oCAAA;AAAA,EACtB,mBAAA,EAAqB,mCAAA;AAAA,EACrB,oBAAA,EAAs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histogram buckets and metric names from Crucible v0.2.7 taxonomy.\n */\n\n/**\n * ADR-0007 histogram buckets for millisecond timing\n *\n * Buckets: 1ms, 5ms, 10ms, 50ms, 100ms, 500ms, 1s, 5s, 10s\n * Used for: MIME detection, error handling, FulHash operations\n */\nexport const ADR0007_BUCKETS_MS = [1, 5, 10, 50, 100, 500, 1000, 5000, 10000] as const;\n\n/**\n * ADR-0007 histogram buckets for second timing (refresh operations)\n *\n * Buckets: 1ms, 5ms, 10ms, 50ms, 100ms, 500ms, 1s, 5s, 10s (converted to seconds)\n * Used for: Prometheus exporter refresh duration\n */\nexport const ADR0007_BUCKETS_SECONDS = [\n 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0, 5.0, 10.0,\n] as const;\n\n/**\n * Convert milliseconds to seconds for Prometheus histograms\n */\nexport function msToSeconds(ms: number): number {\n return ms / 1000;\n}\n\n/**\n * Prometheus exporter metric names (Crucible v0.2.7 taxonomy)\n */\nexport const PROMETHEUS_EXPORTER_METRICS = {\n // Refresh metrics\n REFRESH_DURATION_SECONDS: \"prometheus_exporter_refresh_duration_seconds\",\n REFRESH_TOTAL: \"prometheus_exporter_refresh_total\",\n REFRESH_ERRORS_TOTAL: \"prometheus_exporter_refresh_errors_total\",\n REFRESH_INFLIGHT: \"prometheus_exporter_refresh_inflight\",\n\n // HTTP metrics\n HTTP_REQUESTS_TOTAL: \"prometheus_exporter_http_requests_total\",\n HTTP_ERRORS_TOTAL: \"prometheus_exporter_http_errors_total\",\n\n // Restart metrics\n RESTARTS_TOTAL: \"prometheus_exporter_restarts_total\",\n} as const;\n\n/**\n * Foundry module metric names (Crucible v0.2.7 taxonomy)\n */\nexport const FOUNDRY_METRICS = {\n // MIME detection counters\n MIME_DETECTIONS_JSON: \"foundry_mime_detections_total_json\",\n MIME_DETECTIONS_XML: \"foundry_mime_detections_total_xml\",\n MIME_DETECTIONS_YAML: \"foundry_mime_detections_total_yaml\",\n MIME_DETECTIONS_CSV: \"foundry_mime_detections_total_csv\",\n MIME_DETECTIONS_PLAIN_TEXT: \"foundry_mime_detections_total_plain_text\",\n MIME_DETECTIONS_UNKNOWN: \"foundry_mime_detections_total_unknown\",\n\n // MIME detection timing histograms\n MIME_DETECTION_MS_JSON: \"foundry_mime_detection_ms_json\",\n MIME_DETECTION_MS_XML: \"foundry_mime_detection_ms_xml\",\n MIME_DETECTION_MS_YAML: \"foundry_mime_detection_ms_yaml\",\n MIME_DETECTION_MS_CSV: \"foundry_mime_detection_ms_csv\",\n MIME_DETECTION_MS_PLAIN_TEXT: \"foundry_mime_detection_ms_plain_text\",\n MIME_DETECTION_MS_UNKNOWN: \"foundry_mime_detection_ms_unknown\",\n\n // General lookup counter\n LOOKUP_COUNT: \"foundry_lookup_count\",\n} as const;\n\n/**\n * Error handling module metric names (Crucible v0.2.7 taxonomy)\n */\nexport const ERROR_HANDLING_METRICS = {\n WRAPS_TOTAL: \"error_handling_wraps_total\",\n WRAP_MS: \"error_handling_wrap_ms\",\n} as const;\n\n/**\n * FulHash module metric names (Crucible v0.2.7 taxonomy)\n */\nexport const FULHASH_METRICS = {\n // Algorithm-specific counters\n OPERATIONS_XXH3_128: \"fulhash_operations_total_xxh3_128\",\n OPERATIONS_SHA256: \"fulhash_operations_total_sha256\",\n\n // General counters\n HASH_STRING_TOTAL: \"fulhash_hash_string_total\",\n BYTES_HASHED_TOTAL: \"fulhash_bytes_hashed_total\",\n\n // Timing histogram\n OPERATION_MS: \"fulhash_operation_ms\",\n} as const;\n\n/**\n * Label values for Prometheus exporter metrics (taxonomy-compliant)\n */\nexport const EXPORTER_LABELS = {\n // Refresh phases\n PHASE_COLLECT: \"collect\",\n PHASE_CONVERT: \"convert\",\n PHASE_EXPORT: \"export\",\n\n // Results\n RESULT_SUCCESS: \"success\",\n RESULT_ERROR: \"error\",\n\n // Error types\n ERROR_VALIDATION: \"validation\",\n ERROR_IO: \"io\",\n ERROR_TIMEOUT: \"timeout\",\n ERROR_OTHER: \"other\",\n\n // Restart reasons\n REASON_CONFIG_CHANGE: \"config_change\",\n REASON_ERROR: \"error\",\n REASON_MANUAL: \"manual\",\n REASON_OTHER: \"other\",\n} as const;\n","/**\n * Prometheus exporter error classes\n *\n * Specialized errors for Prometheus integration failures.\n */\n\nimport { FulmenError } from \"../../errors/index.js\";\n\n/**\n * Base error class for Prometheus exporter errors\n */\nexport class PrometheusExporterError extends FulmenError {\n constructor(\n message: string,\n options?: {\n code?: string;\n cause?: unknown;\n context?: Record<string, unknown>;\n },\n ) {\n super({\n code: options?.code || \"PROMETHEUS_EXPORTER_ERROR\",\n message,\n severity: \"medium\",\n context: options?.context,\n });\n\n if (options?.cause) {\n this.cause = options.cause;\n }\n\n this.name = \"PrometheusExporterError\";\n }\n}\n\n/**\n * Error thrown when prom-client peer dependency is not installed\n */\nexport class PromClientNotFoundError extends PrometheusExporterError {\n constructor(cause?: unknown) {\n super(\n \"prom-client peer dependency not found. Install with: bun add prom-client\\n\" +\n \"For npm: npm install prom-client\\n\" +\n \"For more information, see: https://github.com/siimon/prom-client\",\n {\n code: \"PROM_CLIENT_NOT_FOUND\",\n cause,\n context: {\n suggestion: 'Run \"bun add prom-client\" to install the required peer dependency',\n },\n },\n );\n\n this.name = \"PromClientNotFoundError\";\n }\n}\n\n/**\n * Error thrown when metric name is invalid for Prometheus\n */\nexport class InvalidMetricNameError extends PrometheusExporterError {\n constructor(metricName: string, reason: string) {\n super(`Invalid Prometheus metric name: \"${metricName}\". ${reason}`, {\n code: \"INVALID_METRIC_NAME\",\n context: {\n metricName,\n reason,\n suggestion:\n \"Prometheus metric names must match: [a-zA-Z_:][a-zA-Z0-9_:]*\\n\" +\n \"See: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels\",\n },\n });\n\n this.name = \"InvalidMetricNameError\";\n }\n}\n\n/**\n * Error thrown when label name is invalid for Prometheus\n */\nexport class InvalidLabelNameError extends PrometheusExporterError {\n constructor(labelName: string, reason: string) {\n super(`Invalid Prometheus label name: \"${labelName}\". ${reason}`, {\n code: \"INVALID_LABEL_NAME\",\n context: {\n labelName,\n reason,\n suggestion:\n \"Prometheus label names must match: [a-zA-Z_][a-zA-Z0-9_]*\\n\" +\n \"See: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels\",\n },\n });\n\n this.name = \"InvalidLabelNameError\";\n }\n}\n\n/**\n * Error thrown when metric registration fails\n */\nexport class MetricRegistrationError extends PrometheusExporterError {\n constructor(metricName: string, cause: unknown) {\n super(`Failed to register Prometheus metric: \"${metricName}\"`, {\n code: \"METRIC_REGISTRATION_FAILED\",\n cause,\n context: {\n metricName,\n suggestion: \"Check for duplicate metric names or incompatible collector types\",\n },\n });\n\n this.name = \"MetricRegistrationError\";\n }\n}\n\n/**\n * Error thrown when refresh operation fails\n *\n * This error wraps underlying errors (InvalidMetricNameError, MetricRegistrationError, etc.)\n * that occur during the refresh process. Callers should inspect the `cause` property\n * to access the root error for specific error handling.\n *\n * @example\n * ```typescript\n * try {\n * await exporter.refresh();\n * } catch (err) {\n * if (err instanceof RefreshError) {\n * // Check the underlying cause for specific error types\n * if (err.cause instanceof InvalidMetricNameError) {\n * console.error('Invalid metric name:', err.cause.message);\n * }\n * }\n * }\n * ```\n */\nexport class RefreshError extends PrometheusExporterError {\n constructor(cause: unknown, context?: Record<string, unknown>) {\n super(\"Failed to refresh Prometheus metrics from TelemetryRegistry\", {\n code: \"REFRESH_FAILED\",\n cause,\n context,\n });\n\n this.name = \"RefreshError\";\n }\n}\n","/**\n * Prometheus exporter core implementation\n *\n * Bridges TSFulmen TelemetryRegistry to prom-client for Prometheus exposition.\n * Uses dynamic imports and loose typing for optional peer dependency (prom-client).\n *\n * NOTE: This file intentionally uses 'any' types for prom-client peer dependency\n * to avoid compile-time dependency. Runtime validation ensures type safety.\n * See .plans/active/v0.2.x-plans/prometheus-type-safety-enhancement.md for future work.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { metrics as defaultRegistry } from \"../index.js\";\nimport type { MetricsEvent } from \"../types.js\";\nimport { isHistogramSummary } from \"../types.js\";\nimport {\n ADR0007_BUCKETS_SECONDS,\n EXPORTER_LABELS,\n msToSeconds,\n PROMETHEUS_EXPORTER_METRICS,\n} from \"./constants.js\";\nimport {\n InvalidLabelNameError,\n InvalidMetricNameError,\n MetricRegistrationError,\n PromClientNotFoundError,\n RefreshError,\n} from \"./errors.js\";\nimport type { ExporterStats, PrometheusExporterOptions, RefreshOptions } from \"./types.js\";\n\n/**\n * Prometheus exporter\n *\n * Converts TSFulmen TelemetryRegistry metrics to Prometheus format using prom-client.\n *\n * @example\n * ```typescript\n * import { PrometheusExporter } from '@fulmenhq/tsfulmen/telemetry/prometheus';\n * import { metrics } from '@fulmenhq/tsfulmen/telemetry';\n *\n * // Create exporter\n * const exporter = new PrometheusExporter({\n * registry: metrics,\n * namespace: 'myapp',\n * defaultLabels: { environment: 'production' }\n * });\n *\n * // Refresh metrics from registry\n * await exporter.refresh();\n *\n * // Get Prometheus text format\n * const output = await exporter.getMetrics();\n * console.log(output);\n * ```\n */\nexport class PrometheusExporter {\n private readonly telemetryRegistry: typeof defaultRegistry;\n private namespace: string;\n private subsystem: string;\n private readonly defaultLabels: Record<string, string>;\n private readonly helpText: Record<string, string>;\n private readonly metricsEnabled: boolean;\n private readonly recordClientLabel: boolean;\n private readonly moduleMetricsEnabled: boolean;\n\n // prom-client types unavailable at compile time (optional peer dependency)\n // Using 'any' with runtime validation - see file header comment for rationale\n // biome-ignore lint/suspicious/noExplicitAny: prom-client is optional peer dependency\n private promClient: any = null;\n // biome-ignore lint/suspicious/noExplicitAny: prom-client Registry type unavailable at compile time\n private promRegistry: any = null;\n // biome-ignore lint/suspicious/noExplicitAny: prom-client Counter type unavailable at compile time\n private counters: Map<string, any> = new Map();\n // biome-ignore lint/suspicious/noExplicitAny: prom-client Gauge type unavailable at compile time\n private gauges: Map<string, any> = new Map();\n // biome-ignore lint/suspicious/noExplicitAny: prom-client Histogram type unavailable at compile time\n private histograms: Map<string, any> = new Map();\n\n // Statistics\n private refreshCount = 0;\n private errorCount = 0;\n private lastRefreshTime: string | null = null;\n\n // Background refresh loop\n private refreshInterval: NodeJS.Timeout | null = null;\n private refreshPromise: Promise<void> | null = null;\n private isRefreshing = false;\n\n /**\n * Create Prometheus exporter\n *\n * @param options - Exporter configuration\n * @throws {InvalidLabelNameError} If default label names are invalid\n */\n constructor(options: PrometheusExporterOptions = {}) {\n this.telemetryRegistry = options.registry || defaultRegistry;\n this.defaultLabels = options.defaultLabels || {};\n this.helpText = options.helpText || {};\n this.metricsEnabled = options.metricsEnabled ?? true;\n this.recordClientLabel = options.recordClientLabel ?? false;\n this.moduleMetricsEnabled = options.moduleMetricsEnabled ?? true;\n\n // Validate default label names\n for (const labelName of Object.keys(this.defaultLabels)) {\n this.validateLabelName(labelName);\n }\n\n // Initialize namespace and subsystem\n // May be overridden by App Identity in init()\n this.namespace = options.namespace || \"tsfulmen\";\n this.subsystem = options.subsystem || \"app\";\n }\n\n /**\n * Initialize exporter (async setup)\n *\n * Loads prom-client and optionally loads App Identity for namespace/subsystem.\n * Called automatically on first refresh() or getMetrics() call.\n *\n * @throws {PromClientNotFoundError} If prom-client not installed\n */\n private async init(): Promise<void> {\n if (this.promClient) {\n return; // Already initialized\n }\n\n // Lazy load prom-client (peer dependency)\n try {\n this.promClient = await import(\"prom-client\");\n this.promRegistry = new this.promClient.Registry();\n } catch (err) {\n throw new PromClientNotFoundError(err);\n }\n\n // Try to load App Identity for namespace/subsystem (optional)\n if (this.namespace === \"tsfulmen\" || this.subsystem === \"app\") {\n try {\n const { loadIdentity } = await import(\"../../appidentity/index.js\");\n const identity = await loadIdentity({ skipValidation: true });\n\n if (this.namespace === \"tsfulmen\" && identity.app.vendor) {\n this.namespace = identity.app.vendor;\n }\n if (this.subsystem === \"app\" && identity.app.binary_name) {\n this.subsystem = identity.app.binary_name;\n }\n } catch {\n // App Identity not available - use defaults\n }\n }\n }\n\n /**\n * Safely emit instrumentation metric (silently fails if registry doesn't support it)\n * Used to avoid breaking tests that use mock registries\n */\n private safeInstrument(fn: () => void): void {\n try {\n fn();\n } catch {\n // Silently ignore instrumentation failures (e.g., mock registries in tests)\n }\n }\n\n /**\n * Refresh metrics from TelemetryRegistry\n *\n * Exports current metrics from TelemetryRegistry and updates Prometheus collectors.\n * Emits instrumentation metrics per Crucible v0.2.7 taxonomy.\n *\n * @throws {RefreshError} If refresh operation fails. Inspect `error.cause` for the\n * underlying error (InvalidMetricNameError, MetricRegistrationError, etc.) to handle\n * specific failure conditions.\n */\n async refresh(): Promise<void> {\n const startTime = performance.now();\n\n // Set inflight gauge to 1\n this.safeInstrument(() => {\n this.telemetryRegistry.gauge(PROMETHEUS_EXPORTER_METRICS.REFRESH_INFLIGHT).set(1);\n });\n\n try {\n // Phase: collect - export from telemetry registry\n await this.init();\n const events = await this.telemetryRegistry.export();\n\n // Phase: convert - update Prometheus collectors\n for (const event of events) {\n this.updateCollector(event);\n }\n\n // Success metrics\n this.refreshCount++;\n this.lastRefreshTime = new Date().toISOString();\n\n const durationMs = performance.now() - startTime;\n\n // Emit success metrics\n this.safeInstrument(() => {\n this.telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.REFRESH_TOTAL)\n .inc(1, { result: EXPORTER_LABELS.RESULT_SUCCESS });\n\n this.telemetryRegistry\n .histogram(PROMETHEUS_EXPORTER_METRICS.REFRESH_DURATION_SECONDS, {\n buckets: [...ADR0007_BUCKETS_SECONDS],\n })\n .observe(msToSeconds(durationMs), {\n phase: EXPORTER_LABELS.PHASE_EXPORT,\n result: EXPORTER_LABELS.RESULT_SUCCESS,\n });\n });\n } catch (err) {\n this.errorCount++;\n\n const durationMs = performance.now() - startTime;\n\n // Classify error type\n let errorType: string = EXPORTER_LABELS.ERROR_OTHER;\n if (err instanceof InvalidMetricNameError || err instanceof InvalidLabelNameError) {\n errorType = EXPORTER_LABELS.ERROR_VALIDATION;\n } else if (err instanceof MetricRegistrationError) {\n errorType = EXPORTER_LABELS.ERROR_OTHER;\n }\n\n // Emit error metrics\n this.safeInstrument(() => {\n this.telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.REFRESH_TOTAL)\n .inc(1, { result: EXPORTER_LABELS.RESULT_ERROR });\n\n this.telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.REFRESH_ERRORS_TOTAL)\n .inc(1, { error_type: errorType });\n\n this.telemetryRegistry\n .histogram(PROMETHEUS_EXPORTER_METRICS.REFRESH_DURATION_SECONDS, {\n buckets: [...ADR0007_BUCKETS_SECONDS],\n })\n .observe(msToSeconds(durationMs), {\n phase: EXPORTER_LABELS.PHASE_EXPORT,\n result: EXPORTER_LABELS.RESULT_ERROR,\n });\n });\n\n throw new RefreshError(err, {\n refreshCount: this.refreshCount,\n errorCount: this.errorCount,\n });\n } finally {\n // Clear inflight gauge\n this.safeInstrument(() => {\n this.telemetryRegistry.gauge(PROMETHEUS_EXPORTER_METRICS.REFRESH_INFLIGHT).set(0);\n });\n }\n }\n\n /**\n * Get Prometheus metrics in text format\n *\n * Returns metrics in Prometheus exposition text format.\n *\n * @returns Prometheus text format string\n */\n async getMetrics(): Promise<string> {\n await this.init();\n\n if (!this.promRegistry) {\n throw new Error(\"Prometheus registry not initialized\");\n }\n\n return this.promRegistry.metrics();\n }\n\n /**\n * Get exporter statistics\n */\n getStats(): ExporterStats {\n return {\n refreshCount: this.refreshCount,\n errorCount: this.errorCount,\n lastRefreshTime: this.lastRefreshTime,\n metricsCount: this.counters.size + this.gauges.size + this.histograms.size,\n isRefreshing: this.isRefreshing,\n };\n }\n\n /**\n * Get current metrics configuration\n *\n * Returns effective configuration being used by exporter,\n * including defaults for any unspecified options.\n *\n * @returns Current metrics configuration\n */\n getMetricsConfig() {\n return {\n metricsEnabled: this.metricsEnabled,\n recordClientLabel: this.recordClientLabel,\n moduleMetricsEnabled: this.moduleMetricsEnabled,\n namespace: this.namespace,\n subsystem: this.subsystem,\n defaultLabels: { ...this.defaultLabels },\n helpText: { ...this.helpText },\n };\n }\n\n /**\n * Get underlying prom-client Registry\n *\n * Returns null if not yet initialized.\n * Use for advanced prom-client operations.\n */\n // biome-ignore lint/suspicious/noExplicitAny: Returns prom-client Registry type (optional peer dependency)\n getRegistry(): any {\n return this.promRegistry;\n }\n\n /**\n * Get telemetry registry for self-instrumentation\n *\n * Returns the MetricsRegistry instance used for exporter self-instrumentation.\n * Useful for HTTP handler instrumentation.\n *\n * @internal\n */\n getTelemetryRegistry(): typeof defaultRegistry {\n return this.telemetryRegistry;\n }\n\n /**\n * Emit restart metric\n *\n * Records a restart event for tracking exporter or server restarts.\n * Use this when restarting the HTTP metrics server or other exporter components.\n *\n * @param reason - Reason for restart (config_change, error, manual, other)\n *\n * @example\n * ```typescript\n * // Restart server after config change\n * await stopMetricsServer(server);\n * exporter.recordRestart('config_change');\n * const newServer = await startMetricsServer(exporter, newConfig);\n * ```\n */\n recordRestart(reason: \"config_change\" | \"error\" | \"manual\" | \"other\"): void {\n this.safeInstrument(() => {\n this.telemetryRegistry.counter(PROMETHEUS_EXPORTER_METRICS.RESTARTS_TOTAL).inc(1, { reason });\n });\n }\n\n /**\n * Reset all metrics\n */\n reset(): void {\n if (this.promRegistry) {\n this.promRegistry.clear();\n }\n this.counters.clear();\n this.gauges.clear();\n this.histograms.clear();\n }\n\n /**\n * Start background refresh loop\n *\n * Automatically refreshes metrics from TelemetryRegistry at specified interval.\n * Useful for long-running services where metrics should be continuously updated.\n *\n * @param options - Refresh configuration (interval, error handler)\n *\n * @example\n * ```typescript\n * const exporter = new PrometheusExporter({ registry: metrics });\n *\n * // Start refreshing every 15 seconds (default)\n * exporter.startRefresh();\n *\n * // Custom interval and error handling\n * exporter.startRefresh({\n * intervalMs: 10000,\n * onError: (err) => logger.error('Refresh failed:', err)\n * });\n * ```\n */\n startRefresh(options: RefreshOptions = {}): void {\n const intervalMs = options.intervalMs ?? 15000;\n const _isRestart = !!this.refreshInterval;\n\n // Stop existing refresh if running (restart scenario)\n if (this.refreshInterval) {\n this.stopRefresh();\n\n // Emit restart metric\n this.safeInstrument(() => {\n this.telemetryRegistry.counter(PROMETHEUS_EXPORTER_METRICS.RESTARTS_TOTAL).inc(1, {\n reason: options.restartReason || EXPORTER_LABELS.REASON_OTHER,\n });\n });\n }\n\n // Start refresh loop\n this.refreshInterval = setInterval(() => {\n // Don't start new refresh if one is already running (serialization)\n if (this.refreshPromise) {\n return;\n }\n\n this.refreshPromise = this.refresh()\n .catch((err) => {\n // Call error handler if provided\n if (options.onError) {\n options.onError(err as Error);\n }\n })\n .finally(() => {\n this.refreshPromise = null;\n });\n }, intervalMs);\n\n // Update stats to indicate refreshing\n this.isRefreshing = true;\n }\n\n /**\n * Stop background refresh loop\n *\n * Clears the refresh interval and performs one final refresh to capture\n * the latest metrics state before stopping.\n *\n * @example\n * ```typescript\n * // Graceful shutdown\n * await exporter.stopRefresh();\n * ```\n */\n async stopRefresh(): Promise<void> {\n if (this.refreshInterval) {\n clearInterval(this.refreshInterval);\n this.refreshInterval = null;\n }\n\n // Wait for any in-flight refresh to complete\n if (this.refreshPromise) {\n await this.refreshPromise;\n }\n\n // Perform final refresh to capture latest state\n try {\n await this.refresh();\n } catch (_err) {\n // Log but don't throw during shutdown\n // Error is already tracked in stats\n }\n\n // Update stats to indicate not refreshing\n this.isRefreshing = false;\n }\n\n /**\n * Update Prometheus collector from MetricsEvent\n */\n private updateCollector(event: MetricsEvent): void {\n const metricName = this.formatMetricName(event.name);\n const help = this.getHelpText(event.name);\n const labelNames = Object.keys(this.defaultLabels);\n\n if (isHistogramSummary(event.value)) {\n this.updateHistogram(metricName, help, labelNames, event.value);\n } else if (typeof event.value === \"number\") {\n // Use Gauge for all scalar metrics (simplest approach)\n // TSFulmen doesn't distinguish Counter vs Gauge in export format\n this.updateGauge(metricName, help, labelNames, event.value);\n }\n }\n\n /**\n * Update or create Prometheus Gauge\n */\n private updateGauge(name: string, help: string, labelNames: string[], value: number): void {\n let gauge = this.gauges.get(name);\n if (!gauge) {\n try {\n gauge = new this.promClient.Gauge({\n name,\n help,\n labelNames,\n registers: [this.promRegistry],\n });\n this.gauges.set(name, gauge);\n } catch (err) {\n throw new MetricRegistrationError(name, err);\n }\n }\n\n gauge.labels(this.defaultLabels).set(value);\n }\n\n /**\n * Update or create Prometheus Histogram\n *\n * CRITICAL: Converts OTLP cumulative buckets to Prometheus format.\n * This is an approximation - see Phase 0 investigation for details.\n *\n * LIMITATION: Original observations cannot be perfectly reconstructed from bucket summary.\n * Percentiles will be approximate based on bucket midpoints.\n */\n // biome-ignore lint/suspicious/noExplicitAny: summary is HistogramSummary from TelemetryRegistry\n private updateHistogram(name: string, help: string, labelNames: string[], summary: any): void {\n // biome-ignore lint/suspicious/noExplicitAny: bucket type from HistogramSummary\n const buckets = summary.buckets.map((b: any) => b.le);\n\n let histogram = this.histograms.get(name);\n if (!histogram) {\n try {\n histogram = new this.promClient.Histogram({\n name,\n help,\n labelNames,\n buckets,\n registers: [this.promRegistry],\n });\n this.histograms.set(name, histogram);\n } catch (err) {\n throw new MetricRegistrationError(name, err);\n }\n }\n\n // Reconstruct observations from summary\n const observations = this.reconstructObservations(summary);\n for (const value of observations) {\n histogram.labels(this.defaultLabels).observe(value);\n }\n }\n\n /**\n * Reconstruct observations from histogram summary\n *\n * Converts OTLP cumulative bucket counts to approximate observation values.\n * Uses bucket midpoints to generate synthetic observations.\n *\n * LIMITATION: This is an approximation. Original observation values cannot be\n * perfectly reconstructed from bucket summaries. Percentiles will be approximate\n * based on bucket boundaries. This is acceptable for v0.1.8 initial release.\n *\n * TODO: Future enhancement - capture raw observations in TelemetryRegistry\n * for lossless Prometheus export. Track in Phase 2+ planning.\n * See: .plans/active/v0.2.x-plans/prometheus-type-safety-enhancement.md\n *\n * Algorithm:\n * 1. Calculate non-cumulative count for each bucket (delta between adjacent buckets)\n * 2. For each bucket, place observations at the midpoint between bucket boundaries\n * 3. Return array of synthetic observation values\n */\n // biome-ignore lint/suspicious/noExplicitAny: summary is HistogramSummary from TelemetryRegistry\n private reconstructObservations(summary: any): number[] {\n const observations: number[] = [];\n const buckets = summary.buckets;\n\n if (!buckets || buckets.length === 0) {\n return observations;\n }\n\n let prevCount = 0;\n for (let i = 0; i < buckets.length; i++) {\n const bucket = buckets[i];\n const count = bucket.count - prevCount; // Non-cumulative count for this bucket\n\n if (count > 0) {\n // Determine observation value (bucket midpoint)\n let value: number;\n if (i === 0) {\n // First bucket: midpoint between 0 and upper bound\n value = bucket.le / 2;\n } else {\n // Other buckets: midpoint between previous and current upper bound\n const prevLe = buckets[i - 1].le;\n value = (prevLe + bucket.le) / 2;\n }\n\n // Add 'count' observations at this value\n for (let j = 0; j < count; j++) {\n observations.push(value);\n }\n }\n\n prevCount = bucket.count;\n }\n\n return observations;\n }\n\n /**\n * Format metric name with namespace and subsystem prefix\n *\n * Format: {namespace}_{subsystem}_{metric}\n * Example: fulmen_myapp_schema_validations\n */\n private formatMetricName(name: string): string {\n this.validateMetricName(name);\n return `${this.namespace}_${this.subsystem}_${name}`;\n }\n\n /**\n * Get help text for metric\n *\n * Uses custom help text if provided, otherwise generates default.\n */\n private getHelpText(name: string): string {\n if (this.helpText[name]) {\n return this.helpText[name];\n }\n return `TSFulmen metric: ${name}`;\n }\n\n /**\n * Validate Prometheus metric name\n *\n * Rules: Must start with [a-zA-Z_:] and contain only [a-zA-Z0-9_:]\n *\n * @throws {InvalidMetricNameError} If name is invalid\n */\n private validateMetricName(name: string): void {\n const validPattern = /^[a-zA-Z_:][a-zA-Z0-9_:]*$/;\n if (!validPattern.test(name)) {\n throw new InvalidMetricNameError(\n name,\n \"Metric names must start with [a-zA-Z_:] and contain only [a-zA-Z0-9_:]\",\n );\n }\n }\n\n /**\n * Validate Prometheus label name\n *\n * Rules: Must start with [a-zA-Z_] and contain only [a-zA-Z0-9_]\n *\n * @throws {InvalidLabelNameError} If name is invalid\n */\n private validateLabelName(name: string): void {\n const validPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n if (!validPattern.test(name)) {\n throw new InvalidLabelNameError(\n name,\n \"Label names must start with [a-zA-Z_] and contain only [a-zA-Z0-9_]\",\n );\n }\n }\n}\n","/**\n * Prometheus exporter lifecycle integration\n *\n * Helpers for integrating PrometheusExporter with TSFulmen lifecycle management,\n * particularly signal handling for graceful shutdown.\n */\n\nimport type { SignalManager } from \"../../foundry/signals/index.js\";\nimport type { PrometheusExporter } from \"./exporter.js\";\n\n/**\n * Register Prometheus exporter shutdown handler\n *\n * Automatically stops the background refresh loop and performs a final refresh\n * when SIGTERM or SIGINT is received. This ensures metrics are up-to-date\n * before the process terminates.\n *\n * @param exporter - PrometheusExporter instance to manage\n * @param manager - SignalManager instance for lifecycle coordination\n *\n * @example\n * ```typescript\n * import { PrometheusExporter, registerPrometheusShutdown } from '@fulmenhq/tsfulmen/telemetry/prometheus';\n * import { createSignalManager } from '@fulmenhq/tsfulmen/foundry/signals';\n *\n * const exporter = new PrometheusExporter({ registry: metrics });\n * const signalManager = createSignalManager();\n *\n * // Register graceful shutdown\n * await registerPrometheusShutdown(exporter, signalManager);\n *\n * // Start refresh loop\n * exporter.startRefresh({ intervalMs: 15000 });\n *\n * // When SIGTERM/SIGINT received, exporter will:\n * // 1. Stop refresh loop\n * // 2. Perform final refresh\n * // 3. Allow process to exit gracefully\n * ```\n */\nexport async function registerPrometheusShutdown(\n exporter: PrometheusExporter,\n manager: SignalManager,\n): Promise<void> {\n const shutdownHandler = async () => {\n await exporter.stopRefresh();\n };\n\n // Register for both SIGTERM and SIGINT\n await manager.register(\"SIGTERM\", shutdownHandler);\n await manager.register(\"SIGINT\", shutdownHandler);\n}\n","/**\n * Prometheus HTTP server implementation\n *\n * Framework-agnostic HTTP handler and dev server for exposing Prometheus metrics.\n * Compatible with Node.js http, Express, Fastify, and other frameworks.\n */\n\nimport type { IncomingMessage, Server, ServerResponse } from \"node:http\";\nimport { createServer } from \"node:http\";\nimport { createLogger, LoggingProfile } from \"../../logging/index.js\";\nimport type { MetricsRegistry } from \"../registry.js\";\nimport { PROMETHEUS_EXPORTER_METRICS } from \"./constants.js\";\nimport type { PrometheusExporter } from \"./exporter.js\";\nimport type { ServerOptions } from \"./types.js\";\n\n/**\n * Safe instrumentation helper for HTTP metrics\n *\n * Emits HTTP metrics to provided registry, silently failing if registry\n * doesn't support operation (e.g., mock registries in tests).\n */\nfunction safeInstrumentHTTP(registry: MetricsRegistry | null, fn: () => void): void {\n if (!registry) return;\n try {\n fn();\n } catch {\n // Silently fail - instrumentation is non-critical\n }\n}\n\n/**\n * Get logger from exporter with metricsEnabled check\n */\nfunction getExporterLogger(exporter: PrometheusExporter) {\n // Access private logger property through type assertion\n // biome-ignore lint/suspicious/noExplicitAny: Need to access private logger property\n const exporterAny = exporter as any;\n const logger = exporterAny.logger;\n\n // Return null logger if metrics disabled\n return exporterAny.metricsEnabled ? logger : null;\n}\n\n/**\n * HTTP request context for hooks\n *\n * Provides minimal interface for auth and rate limiting hooks.\n * Compatible with Node.js IncomingMessage and framework request objects.\n */\nexport interface RequestContext {\n /** HTTP method (GET, POST, etc.) */\n method?: string;\n /** Request URL path */\n url?: string;\n /** Request headers */\n headers: Record<string, string | string[] | undefined>;\n /** Remote IP address */\n remoteAddress?: string;\n}\n\n/**\n * Extract request context from Node.js IncomingMessage\n */\nfunction extractRequestContext(req: IncomingMessage): RequestContext {\n return {\n method: req.method,\n url: req.url,\n headers: req.headers as Record<string, string | string[] | undefined>,\n remoteAddress: req.socket.remoteAddress,\n };\n}\n\n/**\n * Create Prometheus metrics HTTP handler\n *\n * Returns a framework-agnostic handler compatible with Node.js http, Express,\n * Fastify, and other frameworks. The handler serves Prometheus metrics in\n * text exposition format with optional authentication and rate limiting.\n *\n * @param exporter - PrometheusExporter instance\n * @param options - Server options (auth, rate limiting, refresh behavior)\n * @returns HTTP handler function\n *\n * @example\n * ```typescript\n * // Basic usage with Node.js http\n * import http from 'node:http';\n * import { PrometheusExporter, createMetricsHandler } from '@fulmenhq/tsfulmen/telemetry/prometheus';\n *\n * const exporter = new PrometheusExporter({ registry: metrics });\n * const handler = createMetricsHandler(exporter);\n *\n * const server = http.createServer(handler);\n * server.listen(9464);\n * ```\n *\n * @example\n * ```typescript\n * // With authentication\n * const handler = createMetricsHandler(exporter, {\n * authenticate: async (req) => {\n * const token = req.headers['authorization'];\n * return token === 'Bearer secret-token';\n * }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // With rate limiting\n * const handler = createMetricsHandler(exporter, {\n * rateLimit: async (req) => {\n * const ip = req.remoteAddress;\n * return rateLimiter.checkLimit(ip);\n * }\n * });\n * ```\n */\nexport function createMetricsHandler(\n exporter: PrometheusExporter,\n options: ServerOptions = {},\n): (req: IncomingMessage, res: ServerResponse) => Promise<void> {\n const path = options.path ?? \"/metrics\";\n const refreshOnScrape = options.refreshOnScrape ?? false;\n const logger = getExporterLogger(exporter);\n\n return async (req: IncomingMessage, res: ServerResponse): Promise<void> => {\n const telemetryRegistry = exporter.getTelemetryRegistry();\n let _statusCode = 200;\n const startTime = performance.now();\n\n try {\n // Extract request context for hooks\n const context = extractRequestContext(req);\n\n // Check path - only serve metrics on configured path\n if (req.url !== path) {\n _statusCode = 404;\n res.writeHead(404, { \"Content-Type\": \"text/plain\" });\n res.end(\"Not Found\");\n\n // Emit HTTP request metric (4xx)\n safeInstrumentHTTP(telemetryRegistry, () => {\n telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.HTTP_REQUESTS_TOTAL)\n .inc(1, { status: \"404\", path: req.url || \"unknown\" });\n });\n return;\n }\n\n // Check authentication if hook provided\n if (options.authenticate) {\n const authResult = await options.authenticate(context);\n if (!authResult) {\n _statusCode = 401;\n res.writeHead(401, {\n \"Content-Type\": \"text/plain\",\n \"WWW-Authenticate\": \"Bearer\",\n });\n res.end(\"Unauthorized\");\n\n // Emit HTTP request and error metrics (auth failure)\n safeInstrumentHTTP(telemetryRegistry, () => {\n telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.HTTP_REQUESTS_TOTAL)\n .inc(1, { status: \"401\", path });\n telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.HTTP_ERRORS_TOTAL)\n .inc(1, { status: \"401\", path });\n });\n return;\n }\n }\n\n // Check rate limit if hook provided\n if (options.rateLimit) {\n const rateLimitResult = await options.rateLimit(context);\n if (!rateLimitResult) {\n _statusCode = 429;\n res.writeHead(429, {\n \"Content-Type\": \"text/plain\",\n \"Retry-After\": \"60\",\n });\n res.end(\"Too Many Requests\");\n\n // Emit HTTP request metric (4xx rate limit)\n safeInstrumentHTTP(telemetryRegistry, () => {\n telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.HTTP_REQUESTS_TOTAL)\n .inc(1, { status: \"429\", path });\n });\n return;\n }\n }\n\n // Refresh metrics if configured (optional, adds latency)\n if (refreshOnScrape) {\n await exporter.refresh();\n }\n\n // Get metrics in Prometheus text format\n const metrics = await exporter.getMetrics();\n\n // Send response with correct content-type\n // Prometheus text format version 0.0.4\n _statusCode = 200;\n res.writeHead(200, {\n \"Content-Type\": \"text/plain; version=0.0.4; charset=utf-8\",\n \"Content-Length\": Buffer.byteLength(metrics, \"utf-8\"),\n });\n res.end(metrics);\n\n // Emit HTTP request metric (2xx success)\n safeInstrumentHTTP(telemetryRegistry, () => {\n telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.HTTP_REQUESTS_TOTAL)\n .inc(1, { status: \"200\", path });\n });\n } catch (err) {\n // Internal server error\n const errorMessage = err instanceof Error ? err.message : \"Internal Server Error\";\n\n _statusCode = 500;\n res.writeHead(500, { \"Content-Type\": \"text/plain\" });\n res.end(`Error: ${errorMessage}`);\n\n // Emit HTTP request and error metrics (5xx failure)\n safeInstrumentHTTP(telemetryRegistry, () => {\n telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.HTTP_REQUESTS_TOTAL)\n .inc(1, { status: \"500\", path });\n telemetryRegistry\n .counter(PROMETHEUS_EXPORTER_METRICS.HTTP_ERRORS_TOTAL)\n .inc(1, { status: \"500\", path });\n });\n } finally {\n // Log HTTP request completion\n if (logger) {\n const durationMs = performance.now() - startTime;\n const context = extractRequestContext(req);\n\n logger.info(\"HTTP request processed\", {\n metric_name: PROMETHEUS_EXPORTER_METRICS.HTTP_REQUESTS_TOTAL,\n status: _statusCode.toString(),\n path: req.url || \"unknown\",\n method: context.method || \"GET\",\n duration_ms: Math.round(durationMs),\n remote_address: context.remoteAddress,\n });\n }\n }\n };\n}\n\n/**\n * Start Prometheus metrics dev server\n *\n * Creates a standalone HTTP server for serving Prometheus metrics.\n * Useful for development, testing, and simple deployments without a full application framework.\n *\n * @param exporter - PrometheusExporter instance\n * @param options - Server configuration (host, port, path, auth, rate limiting)\n * @returns Promise that resolves to the HTTP Server instance\n *\n * @example\n * ```typescript\n * import { PrometheusExporter, startMetricsServer } from '@fulmenhq/tsfulmen/telemetry/prometheus';\n *\n * const exporter = new PrometheusExporter({ registry: metrics });\n *\n * // Start dev server\n * const server = await startMetricsServer(exporter, {\n * host: '127.0.0.1',\n * port: 9464,\n * path: '/metrics'\n * });\n *\n * console.log('Metrics server listening on http://127.0.0.1:9464/metrics');\n *\n * // Graceful shutdown\n * process.on('SIGTERM', async () => {\n * await stopMetricsServer(server);\n * });\n * ```\n */\nexport async function startMetricsServer(\n exporter: PrometheusExporter,\n options: ServerOptions = {},\n): Promise<Server> {\n const host = options.host ?? \"127.0.0.1\";\n const port = options.port ?? 9464;\n const path = options.path ?? \"/metrics\";\n\n // Create handler with options\n const handler = createMetricsHandler(exporter, options);\n\n // Create HTTP server\n const server = createServer(handler);\n\n // Create logger for server operations (only if metrics enabled)\n const exporterLogger = getExporterLogger(exporter);\n const logger =\n exporterLogger ||\n createLogger({\n service: \"prometheus_exporter\",\n profile: LoggingProfile.STRUCTURED,\n });\n\n // Start listening\n return new Promise((resolve, reject) => {\n server.listen(port, host, () => {\n // Log server startup\n logger.info(\"Prometheus metrics server started\", {\n host,\n port,\n path,\n url: `http://${host}:${port}${path}`,\n });\n resolve(server);\n });\n\n server.on(\"error\", (err) => {\n // Log server error\n logger.error(\"Prometheus metrics server error\", err as Error, {\n host,\n port,\n path,\n });\n reject(err);\n });\n });\n}\n\n/**\n * Stop Prometheus metrics server\n *\n * Gracefully shuts down the HTTP server with a configurable timeout.\n * Closes all connections and waits for in-flight requests to complete.\n *\n * @param server - HTTP Server instance from startMetricsServer\n * @param timeoutMs - Timeout in milliseconds (default: 5000)\n * @returns Promise that resolves when server is closed\n *\n * @example\n * ```typescript\n * // Graceful shutdown with 5 second timeout\n * await stopMetricsServer(server);\n *\n * // Custom timeout\n * await stopMetricsServer(server, 10000);\n * ```\n */\nexport async function stopMetricsServer(\n server: Server,\n timeoutMs = 5000,\n exporter?: PrometheusExporter,\n): Promise<void> {\n // Create logger for server operations (only if metrics enabled)\n const exporterLogger = exporter ? getExporterLogger(exporter) : null;\n const logger =\n exporterLogger ||\n createLogger({\n service: \"prometheus_exporter\",\n profile: LoggingProfile.STRUCTURED,\n });\n\n return new Promise((resolve, reject) => {\n // Set timeout for forced shutdown\n const timeout = setTimeout(() => {\n logger.warn(\"Prometheus metrics server shutdown timed out, forcing close\", {\n timeout_ms: timeoutMs,\n });\n server.closeAllConnections?.(); // Available in Node.js 18.2+\n reject(new Error(`Server shutdown timeout after ${timeoutMs}ms`));\n }, timeoutMs);\n\n // Graceful close\n server.close((err) => {\n clearTimeout(timeout);\n if (err) {\n logger.error(\"Error stopping Prometheus metrics server\", err, {\n timeout_ms: timeoutMs,\n });\n reject(err);\n } else {\n logger.info(\"Prometheus metrics server stopped\", {\n timeout_ms: timeoutMs,\n });\n resolve();\n }\n });\n\n // Close all connections immediately (allows graceful request completion)\n server.closeAllConnections?.(); // Available in Node.js 18.2+\n });\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { loadIdentity } from './chunk-BJDL6JEX.js';
|
|
2
|
+
|
|
3
|
+
// src/appidentity/helpers.ts
|
|
4
|
+
async function getBinaryName(options) {
|
|
5
|
+
const identity = await loadIdentity(options);
|
|
6
|
+
return identity.app.binary_name;
|
|
7
|
+
}
|
|
8
|
+
async function getVendor(options) {
|
|
9
|
+
const identity = await loadIdentity(options);
|
|
10
|
+
return identity.app.vendor;
|
|
11
|
+
}
|
|
12
|
+
async function getEnvPrefix(options) {
|
|
13
|
+
const identity = await loadIdentity(options);
|
|
14
|
+
return identity.app.env_prefix;
|
|
15
|
+
}
|
|
16
|
+
async function getConfigName(options) {
|
|
17
|
+
const identity = await loadIdentity(options);
|
|
18
|
+
return identity.app.config_name;
|
|
19
|
+
}
|
|
20
|
+
async function getTelemetryNamespace(options) {
|
|
21
|
+
const identity = await loadIdentity(options);
|
|
22
|
+
return identity.metadata?.telemetry_namespace ?? identity.app.binary_name;
|
|
23
|
+
}
|
|
24
|
+
async function getConfigIdentifiers(options) {
|
|
25
|
+
const identity = await loadIdentity(options);
|
|
26
|
+
return Object.freeze({
|
|
27
|
+
vendor: identity.app.vendor,
|
|
28
|
+
configName: identity.app.config_name
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async function buildEnvVar(key, options) {
|
|
32
|
+
const envPrefix = await getEnvPrefix(options);
|
|
33
|
+
const normalizedKey = key.toUpperCase().replace(/[^A-Z0-9_]/g, "_");
|
|
34
|
+
return `${envPrefix}${normalizedKey}`;
|
|
35
|
+
}
|
|
36
|
+
async function getEnvVar(key, options) {
|
|
37
|
+
const envVarName = await buildEnvVar(key, options);
|
|
38
|
+
return process.env[envVarName];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { buildEnvVar, getBinaryName, getConfigIdentifiers, getConfigName, getEnvPrefix, getEnvVar, getTelemetryNamespace, getVendor };
|
|
42
|
+
//# sourceMappingURL=chunk-K7BMFGQP.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-K7BMFGQP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/appidentity/helpers.ts"],"names":[],"mappings":";;;AAwBA,eAAsB,cAAc,OAAA,EAAgD;AAClF,EAAA,MAAM,QAAA,GA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AA,CACpB,KACA,OAAA,EAC6B;AAC7B,EAAA,MAAM,UAAA,GAAa,MAAM,WAAA,CAAY,GAAA,EAAK,OAAO,CAAA;AACjD,EAAA,OAAO,OAAA,CAAQ,IAAI,UAAU,CAAA;AAC/B","file":"chunk-K7BMFGQP.js","sourcesContent":["/**\n * Application Identity Helpers\n *\n * Convenience functions for accessing identity fields\n * All helpers use loadIdentity() under the hood for caching benefits\n */\n\nimport { loadIdentity } from \"./loader.js\";\nimport type { LoadIdentityOptions } from \"./types.js\";\n\n/**\n * Config identifiers for path construction\n */\nexport interface ConfigIdentifiers {\n readonly vendor: string;\n readonly configName: string;\n}\n\n/**\n * Get the binary name from app identity\n *\n * @param options - Load options (optional)\n * @returns Binary name (e.g., 'myapp')\n */\nexport async function getBinaryName(options?: LoadIdentityOptions): Promise<string> {\n const identity = await loadIdentity(options);\n return identity.app.binary_name;\n}\n\n/**\n * Get the vendor namespace from app identity\n *\n * @param options - Load options (optional)\n * @returns Vendor namespace (e.g., 'acmecorp')\n */\nexport async function getVendor(options?: LoadIdentityOptions): Promise<string> {\n const identity = await loadIdentity(options);\n return identity.app.vendor;\n}\n\n/**\n * Get the environment variable prefix from app identity\n *\n * @param options - Load options (optional)\n * @returns Env prefix (e.g., 'MYAPP_')\n */\nexport async function getEnvPrefix(options?: LoadIdentityOptions): Promise<string> {\n const identity = await loadIdentity(options);\n return identity.app.env_prefix;\n}\n\n/**\n * Get the config directory name from app identity\n *\n * @param options - Load options (optional)\n * @returns Config name (e.g., 'myapp')\n */\nexport async function getConfigName(options?: LoadIdentityOptions): Promise<string> {\n const identity = await loadIdentity(options);\n return identity.app.config_name;\n}\n\n/**\n * Get the telemetry namespace from app identity\n *\n * Falls back to binary_name if telemetry_namespace is not specified\n *\n * @param options - Load options (optional)\n * @returns Telemetry namespace (e.g., 'acmecorp_myapp' or 'myapp')\n */\nexport async function getTelemetryNamespace(options?: LoadIdentityOptions): Promise<string> {\n const identity = await loadIdentity(options);\n return identity.metadata?.telemetry_namespace ?? identity.app.binary_name;\n}\n\n/**\n * Get config identifiers for path construction\n *\n * Returns vendor and configName for building config paths like:\n * ~/.config/{vendor}/{configName}/config.yaml\n *\n * @param options - Load options (optional)\n * @returns Frozen config identifiers { vendor, configName }\n */\nexport async function getConfigIdentifiers(\n options?: LoadIdentityOptions,\n): Promise<ConfigIdentifiers> {\n const identity = await loadIdentity(options);\n return Object.freeze({\n vendor: identity.app.vendor,\n configName: identity.app.config_name,\n });\n}\n\n/**\n * Build environment variable name with app prefix\n *\n * Constructs env var names like: MYAPP_DATABASE_URL\n * Normalizes invalid characters (anything outside [A-Z0-9_]) to underscores\n * for conventional env var naming.\n *\n * Examples:\n * - 'database-url' → 'MYAPP_DATABASE_URL'\n * - 'my.config' → 'MYAPP_MY_CONFIG'\n * - 'log_level' → 'MYAPP_LOG_LEVEL'\n *\n * @param key - Environment variable key (will be uppercased and normalized)\n * @param options - Load options (optional)\n * @returns Full environment variable name (e.g., 'MYAPP_DATABASE_URL')\n */\nexport async function buildEnvVar(key: string, options?: LoadIdentityOptions): Promise<string> {\n const envPrefix = await getEnvPrefix(options);\n // Uppercase and replace any non-alphanumeric/underscore characters with underscores\n const normalizedKey = key.toUpperCase().replace(/[^A-Z0-9_]/g, \"_\");\n return `${envPrefix}${normalizedKey}`;\n}\n\n/**\n * Get environment variable value using app prefix\n *\n * Convenience wrapper around process.env using buildEnvVar\n *\n * @param key - Environment variable key (will be uppercased)\n * @param options - Load options (optional)\n * @returns Environment variable value or undefined\n */\nexport async function getEnvVar(\n key: string,\n options?: LoadIdentityOptions,\n): Promise<string | undefined> {\n const envVarName = await buildEnvVar(key, options);\n return process.env[envVarName];\n}\n"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { FoundryCatalogError } from './chunk-3HISR2XI.js';
|
|
2
|
+
import { substringSimilarity, jaro_winkler, damerau_levenshtein, osa_distance, levenshtein, normalize as normalize$1, score as score$1, suggest as suggest$1 } from '@3leaps/string-metrics-wasm';
|
|
3
|
+
|
|
4
|
+
function distance(a, b, metric = "levenshtein") {
|
|
5
|
+
switch (metric) {
|
|
6
|
+
case "levenshtein":
|
|
7
|
+
return levenshtein(a, b);
|
|
8
|
+
case "damerau_osa":
|
|
9
|
+
return osa_distance(a, b);
|
|
10
|
+
case "damerau_unrestricted":
|
|
11
|
+
return damerau_levenshtein(a, b);
|
|
12
|
+
case "jaro_winkler":
|
|
13
|
+
return jaro_winkler(a, b);
|
|
14
|
+
case "substring":
|
|
15
|
+
return substringSimilarity(a, b).score;
|
|
16
|
+
default:
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Invalid metric '${metric}': must be one of: levenshtein, damerau_osa, damerau_unrestricted, jaro_winkler, substring`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/foundry/similarity/errors.ts
|
|
24
|
+
var SimilarityError = class extends FoundryCatalogError {
|
|
25
|
+
constructor(message, cause) {
|
|
26
|
+
super(message, "similarity", cause);
|
|
27
|
+
this.name = "SimilarityError";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
function toNormalizationLocale(locale) {
|
|
31
|
+
if (!locale) {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
if (locale === "tr" || locale === "az" || locale === "lt") {
|
|
35
|
+
return locale;
|
|
36
|
+
}
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
function normalize(value, preset = "default", locale) {
|
|
40
|
+
if (typeof preset === "object") {
|
|
41
|
+
const targetPreset = preset.stripAccents ? "aggressive" : "default";
|
|
42
|
+
const targetLocale = toNormalizationLocale(preset.locale ?? locale);
|
|
43
|
+
return normalize$1(value, targetPreset, targetLocale);
|
|
44
|
+
}
|
|
45
|
+
return normalize$1(value, preset, toNormalizationLocale(locale));
|
|
46
|
+
}
|
|
47
|
+
function casefold(value, locale) {
|
|
48
|
+
if (locale === "tr") {
|
|
49
|
+
return value.toLocaleLowerCase("tr-TR");
|
|
50
|
+
}
|
|
51
|
+
return value.toLowerCase();
|
|
52
|
+
}
|
|
53
|
+
function stripAccents(value) {
|
|
54
|
+
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
55
|
+
}
|
|
56
|
+
function equalsIgnoreCase(a, b, options) {
|
|
57
|
+
return normalize(a, options) === normalize(b, options);
|
|
58
|
+
}
|
|
59
|
+
function score(a, b, metric = "levenshtein") {
|
|
60
|
+
if (metric === "substring") {
|
|
61
|
+
return substringSimilarity(a, b).score;
|
|
62
|
+
}
|
|
63
|
+
return score$1(a, b, metric);
|
|
64
|
+
}
|
|
65
|
+
var DEFAULT_MIN_SCORE = 0.6;
|
|
66
|
+
var DEFAULT_MAX_SUGGESTIONS = 3;
|
|
67
|
+
var DEFAULT_METRIC = "levenshtein";
|
|
68
|
+
var DEFAULT_NORMALIZE_PRESET = "default";
|
|
69
|
+
function suggest(input, candidates, options) {
|
|
70
|
+
const metric = options?.metric ?? DEFAULT_METRIC;
|
|
71
|
+
const minScore = options?.minScore ?? DEFAULT_MIN_SCORE;
|
|
72
|
+
const maxSuggestions = options?.maxSuggestions ?? DEFAULT_MAX_SUGGESTIONS;
|
|
73
|
+
let normalizePreset = options?.normalizePreset ?? DEFAULT_NORMALIZE_PRESET;
|
|
74
|
+
if (options?.normalize === false) {
|
|
75
|
+
normalizePreset = "none";
|
|
76
|
+
} else if (options?.normalize === true && !options?.normalizePreset) {
|
|
77
|
+
normalizePreset = "default";
|
|
78
|
+
}
|
|
79
|
+
const wasmOptions = {
|
|
80
|
+
metric,
|
|
81
|
+
normalizePreset,
|
|
82
|
+
minScore,
|
|
83
|
+
maxSuggestions,
|
|
84
|
+
preferPrefix: options?.preferPrefix,
|
|
85
|
+
jaroPrefixScale: options?.jaroPrefixScale,
|
|
86
|
+
jaroMaxPrefix: options?.jaroMaxPrefix
|
|
87
|
+
};
|
|
88
|
+
const results = suggest$1(input, candidates, wasmOptions);
|
|
89
|
+
return results.map((r) => ({
|
|
90
|
+
value: r.value,
|
|
91
|
+
score: r.score,
|
|
92
|
+
matchedRange: r.matchedRange,
|
|
93
|
+
reason: r.reason,
|
|
94
|
+
normalizedValue: r.normalizedValue
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/foundry/similarity/index.ts
|
|
99
|
+
var VERSION = "2.0.0";
|
|
100
|
+
|
|
101
|
+
export { SimilarityError, VERSION, casefold, distance, equalsIgnoreCase, normalize, score, stripAccents, suggest };
|
|
102
|
+
//# sourceMappingURL=chunk-LWAH2UG7.js.map
|
|
103
|
+
//# sourceMappingURL=chunk-LWAH2UG7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/foundry/similarity/distance.ts","../src/foundry/similarity/errors.ts","../src/foundry/similarity/normalization.ts","../src/foundry/similarity/score.ts","../src/foundry/similarity/suggest.ts","../src/foundry/similarity/index.ts"],"names":["wasmNormalize","substringSimilarity","wasmScore","wasmSuggest"],"mappings":";;;AA+BO,SAAS,QAAA,CAAS,CAAA,EAAW,CAAA,EAAW,MAAA,GAAqB,aAAA,EAAuB;AACzF,EAAA,QAAQ,MAAA;AAAQ,IACd,KAAK,aAAA;AACH,MAAA,OAAO,WAAA,CAAY,GAAG,CAAC,CAAA;AAAA,IACzB,KAAK,aAAA;AACH,MAAA,OAAO,YAAA,CAAa,GAAG,CAAC,CAAA;AAAA,IAC1B,KAAK,sBAAA;AACH,MAAA,OAAO,mBAAA,CAAoB,GAAG,CAAC,CAAA;AAAA,IACjC,KAAK,cAAA;AACH,MAAA,OAAO,YAAA,CAAa,GAAG,CAAC,CAAA;AAAA,IAC1B,KAAK,WAAA;AAEH,MAAA,OAAO,mBAAA,CAAoB,CAAA,EAAG,CAAC,CAAA,CAAE,KAAA;AAAA,IACnC;AACE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,mBAAmB,MAAM,CAAA,0FAAA;AAAA,OAC3B;AAAA;AAEN;;;AC/CO,IAAM,eAAA,GAA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AAM,OAAA,GAAUC,SAAA,CAAY,KAAA,EAAO,UAAA,EAAwB,WAAW,CAAA;AAGtE,EAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,MAAO;AAAA,IACzB,OAAO,CAAA,CAAE,KAAA;AAAA,IACT,OAAO,CAAA,CAAE,KAAA;AAAA,IACT,cAAc,CAAA,CAAE,YAAA;AAAA,IAChB,QAAQ,CAAA,CAAE,MAAA;AAAA,IACV,iBAAiB,CAAA,CAAE;AAAA,GACrB,CAAE,CAAA;AACJ;;;AC1DO,IAAM,OAAA,GAAU","file":"chunk-LWAH2UG7.js","sourcesContent":["/**\n * Distance calculation with multiple metric support.\n *\n * Implements Crucible Foundry Similarity Standard v2.0.0 with WASM-backed metrics.\n *\n * @module foundry/similarity/distance\n */\n\nimport {\n damerau_levenshtein,\n jaro_winkler,\n levenshtein,\n osa_distance,\n substringSimilarity,\n} from \"@3leaps/string-metrics-wasm\";\nimport type { MetricType } from \"./types.js\";\n\n/**\n * Calculate edit distance between two strings using specified metric.\n *\n * @param a - First string\n * @param b - Second string\n * @param metric - Distance metric (default: \"levenshtein\")\n * @returns Edit distance as non-negative integer (or similarity score for jaro_winkler/substring)\n *\n * @example\n * distance(\"kitten\", \"sitting\") // 3\n * distance(\"abcd\", \"abdc\", \"damerau_osa\") // 1\n * distance(\"CA\", \"ABC\", \"damerau_unrestricted\") // 2\n * distance(\"hello world\", \"world\", \"substring\") // 0.625 (as score, not distance)\n */\nexport function distance(a: string, b: string, metric: MetricType = \"levenshtein\"): number {\n switch (metric) {\n case \"levenshtein\":\n return levenshtein(a, b);\n case \"damerau_osa\":\n return osa_distance(a, b);\n case \"damerau_unrestricted\":\n return damerau_levenshtein(a, b);\n case \"jaro_winkler\":\n return jaro_winkler(a, b);\n case \"substring\":\n // Returns similarity score (not distance) with longest common substring\n return substringSimilarity(a, b).score;\n default:\n throw new Error(\n `Invalid metric '${metric}': must be one of: levenshtein, damerau_osa, damerau_unrestricted, jaro_winkler, substring`,\n );\n }\n}\n","import { FoundryCatalogError } from \"../errors.js\";\n\nexport class SimilarityError extends FoundryCatalogError {\n constructor(message: string, cause?: Error) {\n super(message, \"similarity\", cause);\n this.name = \"SimilarityError\";\n }\n}\n","/**\n * Unicode-aware text normalization utilities.\n *\n * Implements Crucible Foundry Similarity Standard v2.0.0 with normalization presets.\n *\n * @module foundry/similarity/normalization\n */\n\nimport {\n type NormalizationLocale,\n type NormalizationPreset as WasmNormalizationPreset,\n normalize as wasmNormalize,\n} from \"@3leaps/string-metrics-wasm\";\nimport type { NormalizationPreset, NormalizeOptions } from \"./types.js\";\n\nfunction toNormalizationLocale(locale?: string): NormalizationLocale | undefined {\n if (!locale) {\n return undefined;\n }\n\n if (locale === \"tr\" || locale === \"az\" || locale === \"lt\") {\n return locale;\n }\n\n return undefined;\n}\n\n/**\n * Apply normalization preset to text.\n *\n * @param value - Text to normalize\n * @param preset - Normalization preset (\"none\" | \"minimal\" | \"default\" | \"aggressive\")\n * @param locale - Optional locale for locale-aware casefolding (e.g., \"tr\" for Turkish)\n * @returns Normalized text\n *\n * @example\n * normalize(\" Café-Zürich! \", \"aggressive\") // \"cafezurich\"\n * normalize(\" Hello \", \"minimal\") // \"Hello\"\n * normalize(\"İstanbul\", \"default\", \"tr\") // \"istanbul\"\n */\nexport function normalize(\n value: string,\n preset: NormalizationPreset | NormalizeOptions = \"default\",\n locale?: string,\n): string {\n // Handle legacy NormalizeOptions interface for backward compatibility\n if (typeof preset === \"object\") {\n // Map old options to preset and extract locale\n const targetPreset = preset.stripAccents ? \"aggressive\" : \"default\";\n const targetLocale = toNormalizationLocale(preset.locale ?? locale);\n return wasmNormalize(value, targetPreset, targetLocale);\n }\n\n return wasmNormalize(value, preset as WasmNormalizationPreset, toNormalizationLocale(locale));\n}\n\n/**\n * Unicode-aware case folding.\n *\n * @param value - Text to casefold\n * @param locale - Optional locale (e.g., \"tr\" for Turkish)\n * @returns Lowercase text\n */\nexport function casefold(value: string, locale?: string): string {\n if (locale === \"tr\") {\n return value.toLocaleLowerCase(\"tr-TR\");\n }\n return value.toLowerCase();\n}\n\n/**\n * Strip diacritical marks from text.\n *\n * @param value - Text to process\n * @returns Text with accents removed\n */\nexport function stripAccents(value: string): string {\n return value.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n}\n\n/**\n * Compare strings ignoring case and optionally accents.\n *\n * @param a - First string\n * @param b - Second string\n * @param options - Normalization options\n * @returns True if strings are equal after normalization\n */\nexport function equalsIgnoreCase(a: string, b: string, options?: NormalizeOptions): boolean {\n return normalize(a, options) === normalize(b, options);\n}\n","/**\n * Normalized similarity score with metric selection.\n *\n * Implements Crucible Foundry Similarity Standard v2.0.0.\n *\n * @module foundry/similarity/score\n */\n\nimport {\n type SimilarityMetric,\n substringSimilarity,\n score as wasmScore,\n} from \"@3leaps/string-metrics-wasm\";\nimport type { MetricType } from \"./types.js\";\n\n/**\n * Calculate normalized similarity score between two strings.\n *\n * Returns a value between 0.0 (completely different) and 1.0 (identical).\n * For distance-based metrics: 1 - distance / max(len(a), len(b))\n * For jaro_winkler and substring: direct similarity score\n *\n * @param a - First string\n * @param b - Second string\n * @param metric - Similarity metric (default: \"levenshtein\")\n * @returns Similarity score in range [0.0, 1.0]\n *\n * @example\n * score(\"kitten\", \"sitting\") // 0.5714...\n * score(\"hello\", \"hallo\", \"jaro_winkler\") // 0.88\n * score(\"hello world\", \"world\", \"substring\") // 0.625\n */\nexport function score(a: string, b: string, metric: MetricType = \"levenshtein\"): number {\n // Special case: substring uses different API to get proper longest common substring\n if (metric === \"substring\") {\n return substringSimilarity(a, b).score;\n }\n\n // All other metrics supported directly by WASM score function\n return wasmScore(a, b, metric as SimilarityMetric);\n}\n","/**\n * Suggestion API with fuzzy matching and configurable metrics.\n *\n * Implements Crucible Foundry Similarity Standard v2.0.0.\n *\n * @module foundry/similarity/suggest\n */\n\nimport { type SuggestMetric, suggest as wasmSuggest } from \"@3leaps/string-metrics-wasm\";\nimport type { Suggestion, SuggestOptions } from \"./types.js\";\n\nconst DEFAULT_MIN_SCORE = 0.6;\nconst DEFAULT_MAX_SUGGESTIONS = 3;\nconst DEFAULT_METRIC = \"levenshtein\";\nconst DEFAULT_NORMALIZE_PRESET = \"default\";\n\n/**\n * Generate ranked suggestions from candidate list based on similarity.\n *\n * @param input - Input string to match against\n * @param candidates - List of candidate strings\n * @param options - Suggestion options (metric, thresholds, normalization)\n * @returns Array of suggestions sorted by score (descending)\n *\n * @example\n * suggest(\"docscrib\", [\"docscribe\", \"crucible\"], { metric: \"levenshtein\" })\n * // [{ value: \"docscribe\", score: 0.889, ... }]\n */\nexport function suggest(\n input: string,\n candidates: readonly string[],\n options?: SuggestOptions,\n): Suggestion[] {\n const metric = options?.metric ?? DEFAULT_METRIC;\n const minScore = options?.minScore ?? DEFAULT_MIN_SCORE;\n const maxSuggestions = options?.maxSuggestions ?? DEFAULT_MAX_SUGGESTIONS;\n\n // Handle legacy 'normalize' boolean option\n let normalizePreset = options?.normalizePreset ?? DEFAULT_NORMALIZE_PRESET;\n if (options?.normalize === false) {\n normalizePreset = \"none\";\n } else if (options?.normalize === true && !options?.normalizePreset) {\n normalizePreset = \"default\";\n }\n\n // Pass metric name directly to WASM library (it handles \"substring\" correctly)\n const wasmOptions = {\n metric: metric as SuggestMetric,\n normalizePreset,\n minScore,\n maxSuggestions,\n preferPrefix: options?.preferPrefix,\n jaroPrefixScale: options?.jaroPrefixScale,\n jaroMaxPrefix: options?.jaroMaxPrefix,\n };\n\n const results = wasmSuggest(input, candidates as string[], wasmOptions);\n\n // Map WASM results to our Suggestion interface\n return results.map((r) => ({\n value: r.value,\n score: r.score,\n matchedRange: r.matchedRange as [number, number] | undefined,\n reason: r.reason,\n normalizedValue: r.normalizedValue,\n }));\n}\n","/**\n * Foundry similarity module - Text similarity and normalization utilities\n *\n * Implements the Crucible Foundry Text Similarity & Normalization Standard v2.0.0 (2025.10.3).\n *\n * @module foundry/similarity\n */\n\nexport const VERSION = \"2.0.0\";\n\nexport { distance } from \"./distance.js\";\nexport { SimilarityError } from \"./errors.js\";\nexport {\n casefold,\n equalsIgnoreCase,\n normalize,\n stripAccents,\n} from \"./normalization.js\";\nexport { score } from \"./score.js\";\nexport { suggest } from \"./suggest.js\";\n\nexport type {\n MetricType,\n NormalizationPreset,\n NormalizeOptions,\n Suggestion,\n SuggestOptions,\n} from \"./types.js\";\n"]}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { createCRC32, crc32, xxhash128 } from 'hash-wasm';
|
|
2
|
+
import { createHash } from 'crypto';
|
|
3
|
+
|
|
4
|
+
// src/crucible/fulhash/types.ts
|
|
5
|
+
var Algorithm = /* @__PURE__ */ ((Algorithm2) => {
|
|
6
|
+
Algorithm2["XXH3_128"] = "xxh3-128";
|
|
7
|
+
Algorithm2["SHA256"] = "sha256";
|
|
8
|
+
Algorithm2["CRC32"] = "crc32";
|
|
9
|
+
Algorithm2["CRC32C"] = "crc32c";
|
|
10
|
+
return Algorithm2;
|
|
11
|
+
})(Algorithm || {});
|
|
12
|
+
function hexToBytes(hex) {
|
|
13
|
+
const bytes = new Uint8Array(4);
|
|
14
|
+
for (let i = 0; i < 4; i++) {
|
|
15
|
+
bytes[i] = Number.parseInt(hex.substr(i * 2, 2), 16);
|
|
16
|
+
}
|
|
17
|
+
return bytes;
|
|
18
|
+
}
|
|
19
|
+
async function hashBytes(data) {
|
|
20
|
+
const hex = await crc32(data);
|
|
21
|
+
return hexToBytes(hex);
|
|
22
|
+
}
|
|
23
|
+
async function hashString(str, encoding = "utf8") {
|
|
24
|
+
if (encoding !== "utf8") {
|
|
25
|
+
const buf = Buffer.from(str, encoding);
|
|
26
|
+
const hex2 = await crc32(buf);
|
|
27
|
+
return hexToBytes(hex2);
|
|
28
|
+
}
|
|
29
|
+
const hex = await crc32(str);
|
|
30
|
+
return hexToBytes(hex);
|
|
31
|
+
}
|
|
32
|
+
async function createHasher() {
|
|
33
|
+
const hasher = await createCRC32();
|
|
34
|
+
return hasher;
|
|
35
|
+
}
|
|
36
|
+
var CRC32C_POLYNOMIAL = 2197175160;
|
|
37
|
+
function hexToBytes2(hex) {
|
|
38
|
+
const bytes = new Uint8Array(4);
|
|
39
|
+
for (let i = 0; i < 4; i++) {
|
|
40
|
+
bytes[i] = Number.parseInt(hex.substr(i * 2, 2), 16);
|
|
41
|
+
}
|
|
42
|
+
return bytes;
|
|
43
|
+
}
|
|
44
|
+
async function hashBytes2(data) {
|
|
45
|
+
const hex = await crc32(data, CRC32C_POLYNOMIAL);
|
|
46
|
+
return hexToBytes2(hex);
|
|
47
|
+
}
|
|
48
|
+
async function hashString2(str, encoding = "utf8") {
|
|
49
|
+
if (encoding !== "utf8") {
|
|
50
|
+
const buf = Buffer.from(str, encoding);
|
|
51
|
+
const hex2 = await crc32(buf, CRC32C_POLYNOMIAL);
|
|
52
|
+
return hexToBytes2(hex2);
|
|
53
|
+
}
|
|
54
|
+
const hex = await crc32(str, CRC32C_POLYNOMIAL);
|
|
55
|
+
return hexToBytes2(hex);
|
|
56
|
+
}
|
|
57
|
+
async function createHasher2() {
|
|
58
|
+
const hasher = await createCRC32(CRC32C_POLYNOMIAL);
|
|
59
|
+
return hasher;
|
|
60
|
+
}
|
|
61
|
+
function hashBytes3(data) {
|
|
62
|
+
const hash2 = createHash("sha256");
|
|
63
|
+
hash2.update(data);
|
|
64
|
+
return new Uint8Array(hash2.digest());
|
|
65
|
+
}
|
|
66
|
+
function hashString3(str, encoding = "utf8") {
|
|
67
|
+
const hash2 = createHash("sha256");
|
|
68
|
+
hash2.update(str, encoding);
|
|
69
|
+
return new Uint8Array(hash2.digest());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/fulhash/errors.ts
|
|
73
|
+
var FulHashError = class _FulHashError extends Error {
|
|
74
|
+
constructor(message) {
|
|
75
|
+
super(message);
|
|
76
|
+
this.name = "FulHashError";
|
|
77
|
+
Object.setPrototypeOf(this, _FulHashError.prototype);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var UnsupportedAlgorithmError = class _UnsupportedAlgorithmError extends FulHashError {
|
|
81
|
+
constructor(algorithm, supportedAlgorithms) {
|
|
82
|
+
super(
|
|
83
|
+
`Unsupported algorithm "${algorithm}". Supported algorithms: ${supportedAlgorithms.join(", ")}`
|
|
84
|
+
);
|
|
85
|
+
this.name = "UnsupportedAlgorithmError";
|
|
86
|
+
Object.setPrototypeOf(this, _UnsupportedAlgorithmError.prototype);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var InvalidChecksumError = class _InvalidChecksumError extends FulHashError {
|
|
90
|
+
constructor(checksum, reason) {
|
|
91
|
+
super(`Invalid checksum "${checksum}": ${reason}. Expected format: algorithm:hex`);
|
|
92
|
+
this.name = "InvalidChecksumError";
|
|
93
|
+
Object.setPrototypeOf(this, _InvalidChecksumError.prototype);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var InvalidChecksumFormatError = class _InvalidChecksumFormatError extends InvalidChecksumError {
|
|
97
|
+
constructor(checksum, reason) {
|
|
98
|
+
super(checksum, reason);
|
|
99
|
+
this.name = "InvalidChecksumFormatError";
|
|
100
|
+
Object.setPrototypeOf(this, _InvalidChecksumFormatError.prototype);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var DigestStateError = class _DigestStateError extends FulHashError {
|
|
104
|
+
constructor(operation) {
|
|
105
|
+
super(`Cannot ${operation}: digest already finalized. Call reset() to reuse hasher.`);
|
|
106
|
+
this.name = "DigestStateError";
|
|
107
|
+
Object.setPrototypeOf(this, _DigestStateError.prototype);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// src/fulhash/algorithms/xxh3.ts
|
|
112
|
+
function hexToBytes3(hex) {
|
|
113
|
+
const bytes = new Uint8Array(16);
|
|
114
|
+
for (let i = 0; i < 16; i++) {
|
|
115
|
+
bytes[i] = Number.parseInt(hex.substr(i * 2, 2), 16);
|
|
116
|
+
}
|
|
117
|
+
return bytes;
|
|
118
|
+
}
|
|
119
|
+
async function hashBytes4(data) {
|
|
120
|
+
const hex = await xxhash128(data);
|
|
121
|
+
return hexToBytes3(hex);
|
|
122
|
+
}
|
|
123
|
+
async function hashString4(str, encoding = "utf8") {
|
|
124
|
+
if (encoding !== "utf8") {
|
|
125
|
+
throw new FulHashError(
|
|
126
|
+
"XXH3-128 only supports UTF-8 encoding. Use utf8 encoding or convert data to Uint8Array."
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
const hex = await xxhash128(str);
|
|
130
|
+
return hexToBytes3(hex);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/fulhash/digest.ts
|
|
134
|
+
var Digest = class _Digest {
|
|
135
|
+
algorithm;
|
|
136
|
+
_bytes;
|
|
137
|
+
hex;
|
|
138
|
+
formatted;
|
|
139
|
+
constructor(algorithm, bytes) {
|
|
140
|
+
this.algorithm = algorithm;
|
|
141
|
+
this._bytes = new Uint8Array(bytes);
|
|
142
|
+
this.hex = Array.from(this._bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
143
|
+
this.formatted = `${this.algorithm}:${this.hex}`;
|
|
144
|
+
Object.freeze(this);
|
|
145
|
+
}
|
|
146
|
+
get bytes() {
|
|
147
|
+
return Array.from(this._bytes);
|
|
148
|
+
}
|
|
149
|
+
toJSON() {
|
|
150
|
+
return {
|
|
151
|
+
algorithm: this.algorithm,
|
|
152
|
+
hex: this.hex,
|
|
153
|
+
formatted: this.formatted
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
toString() {
|
|
157
|
+
return this.formatted;
|
|
158
|
+
}
|
|
159
|
+
static parse(formatted) {
|
|
160
|
+
if (!formatted.includes(":")) {
|
|
161
|
+
throw new InvalidChecksumFormatError(formatted, "missing separator");
|
|
162
|
+
}
|
|
163
|
+
const [algorithmStr, hex] = formatted.split(":", 2);
|
|
164
|
+
if (!algorithmStr || !hex) {
|
|
165
|
+
throw new InvalidChecksumFormatError(formatted, "invalid format");
|
|
166
|
+
}
|
|
167
|
+
const algorithm = algorithmStr;
|
|
168
|
+
if (!Object.values(Algorithm).includes(algorithm)) {
|
|
169
|
+
throw new UnsupportedAlgorithmError(algorithm, Object.values(Algorithm));
|
|
170
|
+
}
|
|
171
|
+
if (!/^[0-9a-f]+$/.test(hex)) {
|
|
172
|
+
throw new InvalidChecksumError(
|
|
173
|
+
formatted,
|
|
174
|
+
"hex must contain only lowercase hexadecimal characters"
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
let expectedLength;
|
|
178
|
+
switch (algorithm) {
|
|
179
|
+
case "xxh3-128" /* XXH3_128 */:
|
|
180
|
+
expectedLength = 32;
|
|
181
|
+
break;
|
|
182
|
+
case "sha256" /* SHA256 */:
|
|
183
|
+
expectedLength = 64;
|
|
184
|
+
break;
|
|
185
|
+
case "crc32" /* CRC32 */:
|
|
186
|
+
case "crc32c" /* CRC32C */:
|
|
187
|
+
expectedLength = 8;
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
throw new UnsupportedAlgorithmError(algorithm, Object.values(Algorithm));
|
|
191
|
+
}
|
|
192
|
+
if (hex.length !== expectedLength) {
|
|
193
|
+
throw new InvalidChecksumError(
|
|
194
|
+
formatted,
|
|
195
|
+
`invalid hex length for ${algorithm}: expected ${expectedLength}, got ${hex.length}`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
199
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
200
|
+
bytes[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
|
|
201
|
+
}
|
|
202
|
+
return new _Digest(algorithm, bytes);
|
|
203
|
+
}
|
|
204
|
+
equals(other) {
|
|
205
|
+
if (this.algorithm !== other.algorithm) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
if (this.hex !== other.hex) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
static async verify(data, checksum) {
|
|
214
|
+
const expected = _Digest.parse(checksum);
|
|
215
|
+
const { hash: hash2 } = await import('./hash-YOJYVOWH.js');
|
|
216
|
+
const actual = await hash2(data, { algorithm: expected.algorithm });
|
|
217
|
+
return actual.equals(expected);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// src/fulhash/hash.ts
|
|
222
|
+
async function hash(input, options) {
|
|
223
|
+
const algorithm = options?.algorithm ?? "xxh3-128" /* XXH3_128 */;
|
|
224
|
+
const encoding = options?.encoding ?? "utf8";
|
|
225
|
+
let bytes;
|
|
226
|
+
switch (algorithm) {
|
|
227
|
+
case "sha256" /* SHA256 */:
|
|
228
|
+
if (typeof input === "string") {
|
|
229
|
+
bytes = hashString3(input, encoding);
|
|
230
|
+
} else {
|
|
231
|
+
bytes = hashBytes3(input);
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
case "xxh3-128" /* XXH3_128 */:
|
|
235
|
+
if (typeof input === "string") {
|
|
236
|
+
if (encoding !== "utf8") {
|
|
237
|
+
bytes = await hashBytes4(Buffer.from(input, encoding));
|
|
238
|
+
} else {
|
|
239
|
+
bytes = await hashString4(input, "utf8");
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
bytes = await hashBytes4(input);
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
case "crc32" /* CRC32 */:
|
|
246
|
+
if (typeof input === "string") {
|
|
247
|
+
bytes = await hashString(input, encoding);
|
|
248
|
+
} else {
|
|
249
|
+
bytes = await hashBytes(input);
|
|
250
|
+
}
|
|
251
|
+
break;
|
|
252
|
+
case "crc32c" /* CRC32C */:
|
|
253
|
+
if (typeof input === "string") {
|
|
254
|
+
bytes = await hashString2(input, encoding);
|
|
255
|
+
} else {
|
|
256
|
+
bytes = await hashBytes2(input);
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
default:
|
|
260
|
+
throw new UnsupportedAlgorithmError(algorithm, Object.values(Algorithm));
|
|
261
|
+
}
|
|
262
|
+
return new Digest(algorithm, bytes);
|
|
263
|
+
}
|
|
264
|
+
async function hashString5(str, options) {
|
|
265
|
+
return hash(str, options);
|
|
266
|
+
}
|
|
267
|
+
async function hashBytes5(data, options) {
|
|
268
|
+
return hash(data, options);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export { Algorithm, Digest, DigestStateError, FulHashError, InvalidChecksumError, InvalidChecksumFormatError, UnsupportedAlgorithmError, createHasher, createHasher2, hash, hashBytes5 as hashBytes, hashString5 as hashString };
|
|
272
|
+
//# sourceMappingURL=chunk-OHE2AOH4.js.map
|
|
273
|
+
//# sourceMappingURL=chunk-OHE2AOH4.js.map
|