@stll/anonymize 2.4.1 → 2.5.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.
@@ -74,6 +74,7 @@ type DefaultNativePipelineWarmup = (typeof DEFAULT_NATIVE_PIPELINE_WARMUPS)[keyo
74
74
  type DefaultNativePipelinePackageFileOptions = {
75
75
  language?: string;
76
76
  };
77
+ declare const setNativeBindingOverride: (binding: NativeAnonymizeBinding | undefined) => void;
77
78
  declare const loadNativeAnonymizeBinding: (options?: LoadNativeBindingOptions) => NativeAnonymizeBinding;
78
79
  declare const readNativePipelinePackageFile: (packagePath: string) => Uint8Array;
79
80
  declare const readNativePipelinePackageFileAsync: (packagePath: string) => Promise<Uint8Array>;
@@ -107,5 +108,5 @@ declare const redactDefaultTextJson: (fullText: string, operators?: NativeOperat
107
108
  declare const redact_default_text_json: (fullText: string, operators?: NativeOperatorConfig, options?: DefaultNativePipelinePackageOptions) => string;
108
109
  declare const preloadDefaultNativePipelineAsync: (options?: DefaultNativePipelinePackageOptions) => Promise<PreparedNativePipeline>;
109
110
  //#endregion
110
- export { readDefaultNativePipelinePackageFile as A, redact_text_json as B, load_prepared_package_file as C, preloadDefaultNativePipelineAsync as D, preloadDefaultNativePipeline as E, redactDefaultText as F, NativePipelineCompatibility as G, summary_diagnostics_json as H, redactDefaultTextJson as I, assertNativePipelineSupported as J, NativePipelinePackageOptions as K, redact_default_text as L, readNativePipelinePackageFile as M, readNativePipelinePackageFileAsync as N, preload_default_native_pipeline as O, read_default_native_pipeline_package_file as P, prepareNativePipelinePackage as Q, redact_default_text_json as R, load_prepared_package as S, normalize_for_search as T, DEFAULT_NATIVE_PIPELINE_CONFIG as U, redact_text_stream_json as V, NativePipelineBuildOptions as W, getNativePipelineCompatibility as X, createNativePipelineFromConfig as Y, prepareNativePipelineConfig as Z, diagnostics_json as _, LoadNativeBindingOptions as a, get_default_native_pipeline as b, NativeRequire as c, availableDefaultNativePipelineLanguages as d, available_default_native_pipeline_languages as f, create_native_pipeline_from_default_package as g, createNativePipelineFromPackageFile as h, DefaultNativePipelineWarmup as i, readDefaultNativePipelinePackageFileAsync as j, prepare_search_package as k, NativeSdkOptions as l, createNativePipelineFromDefaultPackage as m, DefaultNativePipelinePackageFileOptions as n, NativeLibc as o, convert_external_detection_batch as p, NativePipelineUnsupportedFeature as q, DefaultNativePipelinePackageOptions as r, NativePipelinePackageFileOptions as s, DEFAULT_NATIVE_PIPELINE_WARMUPS as t, NativeSdkPackageOptions as u, diagnostics_stream_json as v, native_package_version as w, loadNativeAnonymizeBinding as x, getDefaultNativePipeline as y, redact_text as z };
111
+ export { prepareNativePipelinePackage as $, readDefaultNativePipelinePackageFile as A, redact_text_json as B, load_prepared_package_file as C, preloadDefaultNativePipelineAsync as D, preloadDefaultNativePipeline as E, redactDefaultText as F, NativePipelineBuildOptions as G, setNativeBindingOverride as H, redactDefaultTextJson as I, NativePipelineUnsupportedFeature as J, NativePipelineCompatibility as K, redact_default_text as L, readNativePipelinePackageFile as M, readNativePipelinePackageFileAsync as N, preload_default_native_pipeline as O, read_default_native_pipeline_package_file as P, prepareNativePipelineConfig as Q, redact_default_text_json as R, load_prepared_package as S, normalize_for_search as T, summary_diagnostics_json as U, redact_text_stream_json as V, DEFAULT_NATIVE_PIPELINE_CONFIG as W, createNativePipelineFromConfig as X, assertNativePipelineSupported as Y, getNativePipelineCompatibility as Z, diagnostics_json as _, LoadNativeBindingOptions as a, get_default_native_pipeline as b, NativeRequire as c, availableDefaultNativePipelineLanguages as d, available_default_native_pipeline_languages as f, create_native_pipeline_from_default_package as g, createNativePipelineFromPackageFile as h, DefaultNativePipelineWarmup as i, readDefaultNativePipelinePackageFileAsync as j, prepare_search_package as k, NativeSdkOptions as l, createNativePipelineFromDefaultPackage as m, DefaultNativePipelinePackageFileOptions as n, NativeLibc as o, convert_external_detection_batch as p, NativePipelinePackageOptions as q, DefaultNativePipelinePackageOptions as r, NativePipelinePackageFileOptions as s, DEFAULT_NATIVE_PIPELINE_WARMUPS as t, NativeSdkPackageOptions as u, diagnostics_stream_json as v, native_package_version as w, loadNativeAnonymizeBinding as x, getDefaultNativePipeline as y, redact_text as z };
111
112
  //# sourceMappingURL=native-node.d.mts.map
@@ -1,3 +1,3 @@
1
1
  import { CALLER_DETECTION_CONTRACT_VERSION, EXTERNAL_DETECTION_BATCH_MAX_BYTES, EXTERNAL_DETECTION_BATCH_VERSION, EXTERNAL_DETECTION_DOCUMENT_MAX_BYTES, EXTERNAL_DETECTION_MAX_DETECTIONS, EXTERNAL_DETECTION_MAX_LABEL_MAPPINGS, EXTERNAL_DETECTION_MAX_METADATA_BYTES, EXTERNAL_DETECTION_OFFSET_UNITS, EXTERNAL_DETECTION_PROVIDER_ID_MAX_BYTES, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromPackage, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getNativeBindingVersion, prepareNativeSearchPackage } from "./native.mjs";
2
- import { A as redact_text, C as readNativePipelinePackageFile, D as redactDefaultTextJson, E as redactDefaultText, F as assertNativePipelineSupported, I as createNativePipelineFromConfig, L as getNativePipelineCompatibility, M as redact_text_stream_json, N as summary_diagnostics_json, O as redact_default_text, P as DEFAULT_NATIVE_PIPELINE_CONFIG, R as prepareNativePipelineConfig, S as readDefaultNativePipelinePackageFileAsync, T as read_default_native_pipeline_package_file, _ as preloadDefaultNativePipeline, a as createNativePipelineFromDefaultPackage, b as prepare_search_package, c as diagnostics_json, d as get_default_native_pipeline, f as loadNativeAnonymizeBinding, g as normalize_for_search, h as native_package_version, i as convert_external_detection_batch, j as redact_text_json, k as redact_default_text_json, l as diagnostics_stream_json, m as load_prepared_package_file, n as availableDefaultNativePipelineLanguages, o as createNativePipelineFromPackageFile, p as load_prepared_package, r as available_default_native_pipeline_languages, s as create_native_pipeline_from_default_package, t as DEFAULT_NATIVE_PIPELINE_WARMUPS, u as getDefaultNativePipeline, v as preloadDefaultNativePipelineAsync, w as readNativePipelinePackageFileAsync, x as readDefaultNativePipelinePackageFile, y as preload_default_native_pipeline, z as prepareNativePipelinePackage } from "./native-node2.mjs";
3
- export { CALLER_DETECTION_CONTRACT_VERSION, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, EXTERNAL_DETECTION_BATCH_MAX_BYTES, EXTERNAL_DETECTION_BATCH_VERSION, EXTERNAL_DETECTION_DOCUMENT_MAX_BYTES, EXTERNAL_DETECTION_MAX_DETECTIONS, EXTERNAL_DETECTION_MAX_LABEL_MAPPINGS, EXTERNAL_DETECTION_MAX_METADATA_BYTES, EXTERNAL_DETECTION_OFFSET_UNITS, EXTERNAL_DETECTION_PROVIDER_ID_MAX_BYTES, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, convert_external_detection_batch, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
2
+ import { A as redact_text, B as prepareNativePipelinePackage, C as readNativePipelinePackageFile, D as redactDefaultTextJson, E as redactDefaultText, F as DEFAULT_NATIVE_PIPELINE_CONFIG, I as assertNativePipelineSupported, L as createNativePipelineFromConfig, M as redact_text_stream_json, N as setNativeBindingOverride, O as redact_default_text, P as summary_diagnostics_json, R as getNativePipelineCompatibility, S as readDefaultNativePipelinePackageFileAsync, T as read_default_native_pipeline_package_file, _ as preloadDefaultNativePipeline, a as createNativePipelineFromDefaultPackage, b as prepare_search_package, c as diagnostics_json, d as get_default_native_pipeline, f as loadNativeAnonymizeBinding, g as normalize_for_search, h as native_package_version, i as convert_external_detection_batch, j as redact_text_json, k as redact_default_text_json, l as diagnostics_stream_json, m as load_prepared_package_file, n as availableDefaultNativePipelineLanguages, o as createNativePipelineFromPackageFile, p as load_prepared_package, r as available_default_native_pipeline_languages, s as create_native_pipeline_from_default_package, t as DEFAULT_NATIVE_PIPELINE_WARMUPS, u as getDefaultNativePipeline, v as preloadDefaultNativePipelineAsync, w as readNativePipelinePackageFileAsync, x as readDefaultNativePipelinePackageFile, y as preload_default_native_pipeline, z as prepareNativePipelineConfig } from "./native-node2.mjs";
3
+ export { CALLER_DETECTION_CONTRACT_VERSION, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, EXTERNAL_DETECTION_BATCH_MAX_BYTES, EXTERNAL_DETECTION_BATCH_VERSION, EXTERNAL_DETECTION_DOCUMENT_MAX_BYTES, EXTERNAL_DETECTION_MAX_DETECTIONS, EXTERNAL_DETECTION_MAX_LABEL_MAPPINGS, EXTERNAL_DETECTION_MAX_METADATA_BYTES, EXTERNAL_DETECTION_OFFSET_UNITS, EXTERNAL_DETECTION_PROVIDER_ID_MAX_BYTES, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, convert_external_detection_batch, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, setNativeBindingOverride, summary_diagnostics_json };
@@ -1,3 +1,3 @@
1
1
  import { $ as SharedNativeRedactTextOptions, A as NativeResultEventCallback, B as NativeSessionStatus, C as NativeOperatorConfig, D as NativePreparedSearchBinding, E as NativePreparedRedactionSessionBinding, F as NativeSessionCallerRedactionPlanOptions, G as PreparedNativePipeline, H as NativeTextReplacement, I as NativeSessionDeletionSummary, J as PreparedSearch, K as PreparedNativeRedactionSession, L as NativeSessionLifecycle, M as NativeSearchPackageOptions, N as NativeSessionBlockRedactionPlan, O as NativePreparedSessionRedactionPlanBinding, P as NativeSessionCallerRedactionInput, Q as SharedNativeRedactTextJsonOptions, R as NativeSessionMetadata, S as NativeOpenSessionArchiveOptions, T as NativePipelineFromPackageOptions, U as PreparedAnonymizer, V as NativeStaticRedactionResult, W as PreparedNativeAnonymizer, X as SharedNativeDiagnosticsStreamJsonOptions, Y as SharedNativeDiagnosticsJsonOptions, Z as SharedNativePreparedPackageOptions, _ as NativeCallerDetection, a as EXTERNAL_DETECTION_DOCUMENT_MAX_BYTES, at as createNativeAnonymizerFromPackage, b as NativeDiagnosticsBatchCallback, c as EXTERNAL_DETECTION_MAX_METADATA_BYTES, d as ExternalDetectionBatch, dt as getNativeBindingVersion, et as SharedNativeRedactTextStreamJsonOptions, f as ExternalDetectionOffsetUnit, g as NativeBindingVersionOptions, h as NativeAnonymizerFromPackageOptions, ht as prepareNativeSearchPackage, i as EXTERNAL_DETECTION_BATCH_VERSION, it as createNativeAnonymizerFromConfig, j as NativeSearchPackageInput, k as NativeRedactionResult, l as EXTERNAL_DETECTION_OFFSET_UNITS, lt as encodeNativeSearchConfig, m as NativeAnonymizerFromConfigOptions, n as ConvertExternalDetectionBatchOptions, nt as assertNativeBindingVersion, o as EXTERNAL_DETECTION_MAX_DETECTIONS, ot as createNativePipelineFromPackage, p as NativeAnonymizeBinding, q as PreparedNativeSessionRedactionPlan, r as EXTERNAL_DETECTION_BATCH_MAX_BYTES, s as EXTERNAL_DETECTION_MAX_LABEL_MAPPINGS, t as CALLER_DETECTION_CONTRACT_VERSION, tt as SharedNativeSearchPackageOptions, u as EXTERNAL_DETECTION_PROVIDER_ID_MAX_BYTES, ut as encodeNativeSearchConfigInput, v as NativeCallerRedactionOptions, w as NativePipelineEntity, x as NativeNormalizeOptions, y as NativeCreateSessionWithLifecycleOptions, z as NativeSessionRedactionAtOptions, zt as NativePreparedSearchConfig } from "./native.mjs";
2
- import { A as readDefaultNativePipelinePackageFile, B as redact_text_json, C as load_prepared_package_file, D as preloadDefaultNativePipelineAsync, E as preloadDefaultNativePipeline, F as redactDefaultText, G as NativePipelineCompatibility, H as summary_diagnostics_json, I as redactDefaultTextJson, J as assertNativePipelineSupported, K as NativePipelinePackageOptions, L as redact_default_text, M as readNativePipelinePackageFile, N as readNativePipelinePackageFileAsync, O as preload_default_native_pipeline, P as read_default_native_pipeline_package_file, Q as prepareNativePipelinePackage, R as redact_default_text_json, S as load_prepared_package, T as normalize_for_search, U as DEFAULT_NATIVE_PIPELINE_CONFIG, V as redact_text_stream_json, W as NativePipelineBuildOptions, X as getNativePipelineCompatibility, Y as createNativePipelineFromConfig, Z as prepareNativePipelineConfig, _ as diagnostics_json, a as LoadNativeBindingOptions, b as get_default_native_pipeline, c as NativeRequire, d as availableDefaultNativePipelineLanguages, f as available_default_native_pipeline_languages, g as create_native_pipeline_from_default_package, h as createNativePipelineFromPackageFile, i as DefaultNativePipelineWarmup, j as readDefaultNativePipelinePackageFileAsync, k as prepare_search_package, l as NativeSdkOptions, m as createNativePipelineFromDefaultPackage, n as DefaultNativePipelinePackageFileOptions, o as NativeLibc, p as convert_external_detection_batch, q as NativePipelineUnsupportedFeature, r as DefaultNativePipelinePackageOptions, s as NativePipelinePackageFileOptions, t as DEFAULT_NATIVE_PIPELINE_WARMUPS, u as NativeSdkPackageOptions, v as diagnostics_stream_json, w as native_package_version, x as loadNativeAnonymizeBinding, y as getDefaultNativePipeline, z as redact_text } from "./native-node.mjs";
3
- export { CALLER_DETECTION_CONTRACT_VERSION, ConvertExternalDetectionBatchOptions, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, DefaultNativePipelinePackageFileOptions, DefaultNativePipelinePackageOptions, DefaultNativePipelineWarmup, EXTERNAL_DETECTION_BATCH_MAX_BYTES, EXTERNAL_DETECTION_BATCH_VERSION, EXTERNAL_DETECTION_DOCUMENT_MAX_BYTES, EXTERNAL_DETECTION_MAX_DETECTIONS, EXTERNAL_DETECTION_MAX_LABEL_MAPPINGS, EXTERNAL_DETECTION_MAX_METADATA_BYTES, EXTERNAL_DETECTION_OFFSET_UNITS, EXTERNAL_DETECTION_PROVIDER_ID_MAX_BYTES, ExternalDetectionBatch, ExternalDetectionOffsetUnit, LoadNativeBindingOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeCallerDetection, NativeCallerRedactionOptions, NativeCreateSessionWithLifecycleOptions, NativeDiagnosticsBatchCallback, NativeLibc, NativeNormalizeOptions, NativeOpenSessionArchiveOptions, NativeOperatorConfig, type NativePipelineBuildOptions, type NativePipelineCompatibility, NativePipelineEntity, NativePipelineFromPackageOptions, NativePipelinePackageFileOptions, type NativePipelinePackageOptions, type NativePipelineUnsupportedFeature, NativePreparedRedactionSessionBinding, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativePreparedSessionRedactionPlanBinding, NativeRedactionResult, NativeRequire, NativeResultEventCallback, NativeSdkOptions, NativeSdkPackageOptions, NativeSearchPackageInput, NativeSearchPackageOptions, NativeSessionBlockRedactionPlan, NativeSessionCallerRedactionInput, NativeSessionCallerRedactionPlanOptions, NativeSessionDeletionSummary, NativeSessionLifecycle, NativeSessionMetadata, NativeSessionRedactionAtOptions, NativeSessionStatus, NativeStaticRedactionResult, NativeTextReplacement, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, convert_external_detection_batch, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
2
+ import { $ as prepareNativePipelinePackage, A as readDefaultNativePipelinePackageFile, B as redact_text_json, C as load_prepared_package_file, D as preloadDefaultNativePipelineAsync, E as preloadDefaultNativePipeline, F as redactDefaultText, G as NativePipelineBuildOptions, H as setNativeBindingOverride, I as redactDefaultTextJson, J as NativePipelineUnsupportedFeature, K as NativePipelineCompatibility, L as redact_default_text, M as readNativePipelinePackageFile, N as readNativePipelinePackageFileAsync, O as preload_default_native_pipeline, P as read_default_native_pipeline_package_file, Q as prepareNativePipelineConfig, R as redact_default_text_json, S as load_prepared_package, T as normalize_for_search, U as summary_diagnostics_json, V as redact_text_stream_json, W as DEFAULT_NATIVE_PIPELINE_CONFIG, X as createNativePipelineFromConfig, Y as assertNativePipelineSupported, Z as getNativePipelineCompatibility, _ as diagnostics_json, a as LoadNativeBindingOptions, b as get_default_native_pipeline, c as NativeRequire, d as availableDefaultNativePipelineLanguages, f as available_default_native_pipeline_languages, g as create_native_pipeline_from_default_package, h as createNativePipelineFromPackageFile, i as DefaultNativePipelineWarmup, j as readDefaultNativePipelinePackageFileAsync, k as prepare_search_package, l as NativeSdkOptions, m as createNativePipelineFromDefaultPackage, n as DefaultNativePipelinePackageFileOptions, o as NativeLibc, p as convert_external_detection_batch, q as NativePipelinePackageOptions, r as DefaultNativePipelinePackageOptions, s as NativePipelinePackageFileOptions, t as DEFAULT_NATIVE_PIPELINE_WARMUPS, u as NativeSdkPackageOptions, v as diagnostics_stream_json, w as native_package_version, x as loadNativeAnonymizeBinding, y as getDefaultNativePipeline, z as redact_text } from "./native-node.mjs";
3
+ export { CALLER_DETECTION_CONTRACT_VERSION, ConvertExternalDetectionBatchOptions, DEFAULT_NATIVE_PIPELINE_CONFIG, DEFAULT_NATIVE_PIPELINE_WARMUPS, DefaultNativePipelinePackageFileOptions, DefaultNativePipelinePackageOptions, DefaultNativePipelineWarmup, EXTERNAL_DETECTION_BATCH_MAX_BYTES, EXTERNAL_DETECTION_BATCH_VERSION, EXTERNAL_DETECTION_DOCUMENT_MAX_BYTES, EXTERNAL_DETECTION_MAX_DETECTIONS, EXTERNAL_DETECTION_MAX_LABEL_MAPPINGS, EXTERNAL_DETECTION_MAX_METADATA_BYTES, EXTERNAL_DETECTION_OFFSET_UNITS, EXTERNAL_DETECTION_PROVIDER_ID_MAX_BYTES, ExternalDetectionBatch, ExternalDetectionOffsetUnit, LoadNativeBindingOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeCallerDetection, NativeCallerRedactionOptions, NativeCreateSessionWithLifecycleOptions, NativeDiagnosticsBatchCallback, NativeLibc, NativeNormalizeOptions, NativeOpenSessionArchiveOptions, NativeOperatorConfig, type NativePipelineBuildOptions, type NativePipelineCompatibility, NativePipelineEntity, NativePipelineFromPackageOptions, NativePipelinePackageFileOptions, type NativePipelinePackageOptions, type NativePipelineUnsupportedFeature, NativePreparedRedactionSessionBinding, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativePreparedSessionRedactionPlanBinding, NativeRedactionResult, NativeRequire, NativeResultEventCallback, NativeSdkOptions, NativeSdkPackageOptions, NativeSearchPackageInput, NativeSearchPackageOptions, NativeSessionBlockRedactionPlan, NativeSessionCallerRedactionInput, NativeSessionCallerRedactionPlanOptions, NativeSessionDeletionSummary, NativeSessionLifecycle, NativeSessionMetadata, NativeSessionRedactionAtOptions, NativeSessionStatus, NativeStaticRedactionResult, NativeTextReplacement, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, assertNativeBindingVersion, assertNativePipelineSupported, availableDefaultNativePipelineLanguages, available_default_native_pipeline_languages, convert_external_detection_batch, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromDefaultPackage, createNativePipelineFromPackage, createNativePipelineFromPackageFile, create_native_pipeline_from_default_package, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getDefaultNativePipeline, getNativeBindingVersion, getNativePipelineCompatibility, get_default_native_pipeline, loadNativeAnonymizeBinding, load_prepared_package, load_prepared_package_file, native_package_version, normalize_for_search, preloadDefaultNativePipeline, preloadDefaultNativePipelineAsync, preload_default_native_pipeline, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, readDefaultNativePipelinePackageFile, readDefaultNativePipelinePackageFileAsync, readNativePipelinePackageFile, readNativePipelinePackageFileAsync, read_default_native_pipeline_package_file, redactDefaultText, redactDefaultTextJson, redact_default_text, redact_default_text_json, redact_text, redact_text_json, redact_text_stream_json, setNativeBindingOverride, summary_diagnostics_json };
@@ -87,6 +87,10 @@ const scopeData = {
87
87
  "nameCorpusLanguages": ["it"],
88
88
  "denyListCountries": ["IT", "CH"]
89
89
  },
90
+ "lv": {
91
+ "nameCorpusLanguages": [],
92
+ "denyListCountries": ["LV"]
93
+ },
90
94
  "pl": {
91
95
  "nameCorpusLanguages": ["pl"],
92
96
  "denyListCountries": ["PL"]
@@ -379,7 +383,25 @@ const DEFAULT_NATIVE_PIPELINE_PACKAGE_CACHE_KEY = "<default>";
379
383
  const defaultNativePipelineCache = /* @__PURE__ */ new WeakMap();
380
384
  const warmedDefaultNativePipelines = /* @__PURE__ */ new WeakSet();
381
385
  const defaultNativePipelineInflightCache = /* @__PURE__ */ new WeakMap();
386
+ /**
387
+ * A binding installed by the runtime layer to override the NAPI loader. Used to
388
+ * route every `loadNativeAnonymizeBinding()` caller (including the docx and pdf
389
+ * packages, which load the binding inline) to the portable wasm binding under
390
+ * Bun, where the NAPI addon cannot run. Undefined on Node, so the NAPI path is
391
+ * unaffected. See `native-runtime.ts` (`preloadNativeBinding`).
392
+ */
393
+ let nativeBindingOverride;
394
+ const setNativeBindingOverride = (binding) => {
395
+ nativeBindingOverride = binding;
396
+ };
382
397
  const loadNativeAnonymizeBinding = (options = {}) => {
398
+ if (nativeBindingOverride !== void 0) {
399
+ if (options.expectedVersion !== void 0) assertNativeBindingVersion({
400
+ binding: nativeBindingOverride,
401
+ expectedVersion: options.expectedVersion
402
+ });
403
+ return nativeBindingOverride;
404
+ }
383
405
  const requireModule = options.requireModule ?? createRequire(import.meta.url);
384
406
  const platform = options.platform ?? process.platform;
385
407
  const arch = options.arch ?? process.arch;
@@ -753,6 +775,6 @@ const formatLoadError = (error) => {
753
775
  return String(error);
754
776
  };
755
777
  //#endregion
756
- export { redact_text as A, readNativePipelinePackageFile as C, redactDefaultTextJson as D, redactDefaultText as E, assertNativePipelineSupported as F, createNativePipelineFromConfig as I, getNativePipelineCompatibility as L, redact_text_stream_json as M, summary_diagnostics_json as N, redact_default_text as O, DEFAULT_NATIVE_PIPELINE_CONFIG as P, prepareNativePipelineConfig as R, readDefaultNativePipelinePackageFileAsync as S, read_default_native_pipeline_package_file as T, preloadDefaultNativePipeline as _, createNativePipelineFromDefaultPackage as a, prepare_search_package as b, diagnostics_json as c, get_default_native_pipeline as d, loadNativeAnonymizeBinding as f, normalize_for_search as g, native_package_version as h, convert_external_detection_batch as i, redact_text_json as j, redact_default_text_json as k, diagnostics_stream_json as l, load_prepared_package_file as m, availableDefaultNativePipelineLanguages as n, createNativePipelineFromPackageFile as o, load_prepared_package as p, available_default_native_pipeline_languages as r, create_native_pipeline_from_default_package as s, DEFAULT_NATIVE_PIPELINE_WARMUPS as t, getDefaultNativePipeline as u, preloadDefaultNativePipelineAsync as v, readNativePipelinePackageFileAsync as w, readDefaultNativePipelinePackageFile as x, preload_default_native_pipeline as y, prepareNativePipelinePackage as z };
778
+ export { redact_text as A, prepareNativePipelinePackage as B, readNativePipelinePackageFile as C, redactDefaultTextJson as D, redactDefaultText as E, DEFAULT_NATIVE_PIPELINE_CONFIG as F, assertNativePipelineSupported as I, createNativePipelineFromConfig as L, redact_text_stream_json as M, setNativeBindingOverride as N, redact_default_text as O, summary_diagnostics_json as P, getNativePipelineCompatibility as R, readDefaultNativePipelinePackageFileAsync as S, read_default_native_pipeline_package_file as T, preloadDefaultNativePipeline as _, createNativePipelineFromDefaultPackage as a, prepare_search_package as b, diagnostics_json as c, get_default_native_pipeline as d, loadNativeAnonymizeBinding as f, normalize_for_search as g, native_package_version as h, convert_external_detection_batch as i, redact_text_json as j, redact_default_text_json as k, diagnostics_stream_json as l, load_prepared_package_file as m, availableDefaultNativePipelineLanguages as n, createNativePipelineFromPackageFile as o, load_prepared_package as p, available_default_native_pipeline_languages as r, create_native_pipeline_from_default_package as s, DEFAULT_NATIVE_PIPELINE_WARMUPS as t, getDefaultNativePipeline as u, preloadDefaultNativePipelineAsync as v, readNativePipelinePackageFileAsync as w, readDefaultNativePipelinePackageFile as x, preload_default_native_pipeline as y, prepareNativePipelineConfig as z };
757
779
 
758
780
  //# sourceMappingURL=native-node2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-node2.mjs","names":["languageScopes","nativePackageVersionWithBinding","convertExternalDetectionBatchWithBinding","normalizeForSearchWithBinding","prepareSearchPackageWithBinding","loadPreparedPackageWithBinding","redactTextWithBinding","redactTextJsonWithBinding","redactTextStreamJsonWithBinding","diagnosticsJsonWithBinding","diagnosticsStreamJsonWithBinding","summaryDiagnosticsJsonWithBinding"],"sources":["../src/context.ts","../src/data/language-scopes.json","../src/language-scope.ts","../src/types.ts","../src/util/language-selection.ts","../src/pipeline-cache-key.ts","../src/native-pipeline.ts","../src/native-default-config.ts","../src/native-node.ts"],"sourcesContent":["/**\n * Cached state for a single pipeline run (or a sequence of runs sharing the\n * same config). The native pipeline builds its prepared package once and reuses\n * it across calls with the same config; the package bytes and the key/promise\n * that guard concurrent builds live here so callers can share one warmed\n * context.\n */\nexport type PipelineContext = {\n // ── Native prepared-package cache ─────────────\n nativePipelinePackage: Uint8Array | null;\n nativePipelinePackageKey: string;\n nativePipelinePackagePromise: Promise<Uint8Array> | null;\n};\n\n/** Create a fresh, empty pipeline context. */\nexport const createPipelineContext = (): PipelineContext => ({\n nativePipelinePackage: null,\n nativePipelinePackageKey: \"\",\n nativePipelinePackagePromise: null,\n});\n\n/**\n * Module-level default context. Used when callers\n * don't provide an explicit context, preserving full\n * backward compatibility with the existing API.\n */\nexport const defaultContext: PipelineContext = createPipelineContext();\n","","import languageScopes from \"./data/language-scopes.json\";\n\nimport type { PipelineConfig } from \"./types\";\n\ntype LanguageScope = {\n nameCorpusLanguages?: readonly string[];\n denyListCountries?: readonly string[];\n};\n\ntype LanguageScopeData = {\n languages: Record<string, LanguageScope>;\n};\n\nconst scopeData = languageScopes as LanguageScopeData;\n\nconst normalizeLanguage = (language: string): string =>\n language.trim().toLowerCase();\n\nconst fallbackLanguage = (language: string): string | null => {\n const index = language.indexOf(\"-\");\n return index === -1 ? null : language.slice(0, index);\n};\n\nconst uniquePush = (target: string[], values: readonly string[]): void => {\n const seen = new Set(target);\n for (const value of values) {\n if (seen.has(value)) {\n continue;\n }\n seen.add(value);\n target.push(value);\n }\n};\n\nconst resolveLanguageScope = (language: string): LanguageScope | null => {\n const normalized = normalizeLanguage(language);\n if (normalized.length === 0) {\n return null;\n }\n const exact = scopeData.languages[normalized];\n if (exact !== undefined) {\n return exact;\n }\n const fallback = fallbackLanguage(normalized);\n return fallback === null ? null : (scopeData.languages[fallback] ?? null);\n};\n\nconst configuredLanguages = (config: PipelineConfig): readonly string[] => {\n if (config.languages !== undefined) {\n return config.languages;\n }\n return config.language === undefined ? [] : [config.language];\n};\n\nexport const configuredContentLanguages = (\n config: Pick<PipelineConfig, \"language\" | \"languages\">,\n): readonly string[] | undefined => {\n if (config.languages !== undefined) {\n return config.languages;\n }\n return config.language === undefined ? undefined : [config.language];\n};\n\nexport const applyPipelineLanguageScope = (\n config: PipelineConfig,\n): PipelineConfig => {\n const languages = configuredLanguages(config);\n if (languages.length === 0) {\n return config;\n }\n\n const nameCorpusLanguages: string[] = [];\n const denyListCountries: string[] = [];\n for (const language of languages) {\n const scope = resolveLanguageScope(language);\n if (scope === null) {\n continue;\n }\n uniquePush(nameCorpusLanguages, scope.nameCorpusLanguages ?? []);\n uniquePush(denyListCountries, scope.denyListCountries ?? []);\n }\n\n const next: Partial<PipelineConfig> = {};\n if (\n config.nameCorpusLanguages === undefined &&\n nameCorpusLanguages.length > 0\n ) {\n next.nameCorpusLanguages = nameCorpusLanguages;\n }\n if (config.denyListCountries === undefined && denyListCountries.length > 0) {\n next.denyListCountries = denyListCountries;\n }\n\n return Object.keys(next).length === 0 ? config : { ...config, ...next };\n};\n","// Runtime-free constants live in `./constants`; re-exported\n// here for back-compat with existing call sites that import\n// from `@stll/anonymize` directly.\n//\n// `verbatimModuleSyntax` requires an explicit type-only\n// import for any name used locally as a type even when it\n// is also re-exported below — applies to `DetectionSource`\n// (used by `Entity`) and `OperatorType` (used by\n// `OperatorConfig`).\nimport type { DetectionSource, OperatorType } from \"./constants\";\nimport { DETECTION_SOURCES } from \"./constants\";\n\nexport {\n DETECTION_SOURCES,\n DETECTOR_PRIORITY,\n type DetectionSource,\n} from \"./constants\";\n\n/**\n * Fields shared by every entity span in the source text.\n */\ntype EntityBase = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n sourceDetail?: \"custom-deny-list\" | \"custom-regex\" | \"gazetteer-extension\";\n};\n\n/**\n * A PII entity span found by a primary detection layer\n * (regex, NER, legal forms, deny list, ...).\n */\nexport type DetectedEntity = EntityBase & {\n source: Exclude<DetectionSource, typeof DETECTION_SOURCES.COREFERENCE>;\n};\n\n/**\n * An alias mention of a previously detected entity: a\n * defined term (\"the Seller\") or a propagated bare\n * mention (\"Acme\" after \"Acme Corp.\").\n *\n * `corefSourceText` is required by construction, so an\n * alias cannot exist without the link back to its source\n * entity. Placeholder numbering reads it to give the\n * alias the same placeholder as the source. The link\n * travels with the entity instead of living in a\n * side-channel map that a producer could forget to\n * write — or that a later pass could clear.\n */\nexport type CorefAliasEntity = EntityBase & {\n source: typeof DETECTION_SOURCES.COREFERENCE;\n /** Full text of the source entity this alias refers to. */\n corefSourceText: string;\n};\n\n/**\n * A detected PII entity span in the source text.\n * Every detection layer produces these.\n */\nexport type Entity = DetectedEntity | CorefAliasEntity;\n\n/**\n * Entity after human review. Extends the base Entity\n * with a review decision.\n */\nexport type ReviewDecision = \"confirmed\" | \"rejected\" | \"relabeled\";\n\nexport type ReviewedEntity = Entity & {\n decision?: ReviewDecision;\n originalLabel?: string;\n};\n\n/**\n * A single entry in the workspace-scoped gazetteer\n * (deny list). Persisted in IndexedDB.\n */\nexport type GazetteerEntry = {\n id: string;\n canonical: string;\n label: string;\n variants: string[];\n workspaceId: string;\n createdAt: number;\n source: \"manual\" | \"confirmed-from-model\";\n};\n\n/** Extraction strategy — closed discriminated union. */\nexport type TriggerStrategy =\n | {\n type: \"to-next-comma\";\n /**\n * Optional list of lowercase keywords that terminate\n * the value scan, in addition to commas/newlines. Useful\n * for triggers like court names that may continue past\n * a missing comma into adjacent clause text (\"Městským\n * soudem v Praze dne 1. 1. 2020\"); listing `\"dne\"` here\n * stops the scan at the date boundary. Matched on a\n * word-boundary, case-insensitive.\n */\n stopWords?: string[];\n /**\n * Hard cap on the captured span length, in characters,\n * regardless of where the next comma / stop char sits.\n * Use for triggers that label short formulaic phrases\n * (\"State of Delaware\") and must not absorb the rest\n * of a long forum-selection clause when the comma is\n * sentences away. Falls back to the default 100-char\n * fallback when omitted.\n */\n maxLength?: number;\n }\n | { type: \"to-end-of-line\" }\n | { type: \"n-words\"; count: number }\n | { type: \"company-id-value\" }\n | { type: \"address\"; maxChars?: number }\n | {\n /**\n * Extract the first regex match in the value text.\n * Useful for shape-bounded values that follow a\n * label on the same line as other fields, where\n * `to-end-of-line` would over-capture. The pattern\n * is anchored to the start of the (already\n * leading-whitespace-stripped) value, so use\n * `(?:.*?)` prefix only when intentional.\n */\n type: \"match-pattern\";\n pattern: string;\n flags?: string;\n };\n\n/** Validation rules — closed discriminated union. */\nexport type TriggerValidation =\n | { type: \"starts-uppercase\" }\n | { type: \"min-length\"; min: number }\n | { type: \"max-length\"; max: number }\n | { type: \"no-digits\" }\n | { type: \"has-digits\" }\n | {\n type: \"matches-pattern\";\n pattern: string;\n flags?: string;\n }\n /**\n * Run a named stdnum validator (checksum + length)\n * against the captured value. Keeps the trigger\n * path symmetrical with the formatted-regex\n * detectors so e.g. `CPF nº 00000000000` does not\n * survive as a tax-ID entity.\n */\n | { type: \"valid-id\"; validator: ValidIdValidator };\n\n/** Built-in stdnum validators that can be referenced\n * by `valid-id` validations. */\nexport type ValidIdValidator = \"br.cpf\" | \"br.cnpj\" | \"us.rtn\";\n\n/** Auto-generated trigger variants — closed set. */\nexport type TriggerExtension =\n | \"add-colon\"\n | \"add-trailing-space\"\n | \"add-colon-space\"\n | \"normalize-spaces\";\n\n/** V2 trigger config entry (JSON shape). */\nexport type TriggerGroupConfig = {\n id?: string;\n triggers: string[];\n label: string;\n strategy: TriggerStrategy;\n extensions?: TriggerExtension[];\n validations?: TriggerValidation[];\n /** When true, include the trigger text in the\n * entity span (e.g., court names). */\n includeTrigger?: boolean;\n};\n\n/** Compiled validation with pre-built regex. */\nexport type CompiledValidation =\n | { type: \"starts-uppercase\"; re: RegExp }\n | { type: \"min-length\"; min: number }\n | { type: \"max-length\"; max: number }\n | { type: \"no-digits\"; re: RegExp }\n | { type: \"has-digits\"; re: RegExp }\n | { type: \"matches-pattern\"; re: RegExp }\n | {\n type: \"valid-id\";\n validator: ValidIdValidator;\n check: (value: string) => boolean;\n };\n\n/**\n * Runtime rule — one per trigger string after\n * expansion. Fed to the Aho-Corasick automaton.\n */\nexport type TriggerRule = {\n trigger: string;\n label: string;\n strategy: TriggerStrategy;\n validations: CompiledValidation[];\n includeTrigger: boolean;\n};\n\nexport {\n ENTITY_CAPABILITIES,\n ENTITY_LABELS,\n ENTITY_SELECTIONS,\n OPERATOR_TYPES,\n type DefaultEntityLabel,\n type EntityCapability,\n type EntityLabel,\n type EntitySelection,\n type OperatorType,\n} from \"./constants\";\n\n/** Per-label operator selection. Key is the entity label. */\nexport type MaskDirection = \"start\" | \"end\";\n\nexport type MaskOperatorConfig = {\n type: \"mask\";\n maskingCharacter: string;\n charactersToMask: number;\n direction: MaskDirection;\n};\n\nexport type OperatorSelection =\n | Exclude<OperatorType, \"mask\">\n | MaskOperatorConfig;\n\nexport type OperatorConfig = {\n /** Operator per label. Missing labels default to \"replace\". */\n operators: Record<string, OperatorSelection>;\n /** Custom replacement string for the redact operator. */\n redactString: string;\n};\n\n/** Whether an operator produces a reversible redaction entry. */\ntype OperatorReversibility = \"reversible\" | \"irreversible\" | \"preserving\";\n\nexport type AnonymisationOperator = {\n type: OperatorType;\n reversibility: OperatorReversibility;\n /**\n * Apply the operator to a single entity occurrence.\n * Returns the replacement string to embed in the document.\n */\n apply: (\n text: string,\n label: string,\n placeholder: string,\n redactString: string,\n selection: OperatorSelection,\n ) => string;\n};\n\n/**\n * Redacted document output with stable entity mapping.\n */\nexport type RedactionResult = {\n redactedText: string;\n /**\n * Maps placeholder to original text. Only populated for\n * reversible operators (replace). Empty for redact, keep, and mask.\n */\n redactionMap: Map<string, string>;\n /** Maps placeholder to the operator that produced it. */\n operatorMap: Map<string, OperatorType>;\n entityCount: number;\n};\n\n/**\n * Configuration for the detection pipeline.\n */\nexport type DenyListCategory =\n | \"Names\"\n | \"Places\"\n | \"Addresses\"\n | \"Courts\"\n | \"Financial\"\n | \"Government\"\n | \"Healthcare\"\n | \"Education\"\n | \"Political\"\n | \"Organizations\"\n | \"International\";\n\n/**\n * Metadata for a single dictionary entry in the\n * deny-list system. Mirrors the shape from\n * the anonymize-data package so consumers can pass\n * pre-loaded data without a runtime dependency.\n */\nexport type DictionaryMeta = {\n label: string;\n category: DenyListCategory;\n country: string | null;\n};\n\n/**\n * Caller-supplied exact terms for deny-list matching.\n * These entries are merged with the published deny-list\n * dictionaries when `enableDenyList` is enabled.\n */\nexport type CustomDenyListEntry = {\n value: string;\n label: string;\n variants?: readonly string[];\n};\n\n/**\n * Caller-supplied regex detector. The pattern is passed\n * to the native Rust regex engine, so use its supported\n * regex syntax. Inline flags such as `(?i)` are accepted\n * when supported by that engine.\n */\nexport type CustomRegexPattern = {\n pattern: string;\n label: string;\n score?: number;\n preparedArtifactPolicy?: \"include\" | \"omit\";\n};\n\n/**\n * Pre-loaded dictionary data for dependency injection.\n * Consumers that want name/city/deny-list detection\n * load dictionaries themselves (e.g. from the\n * anonymize-data package) and pass them here; the\n * anonymize package has zero cross-package imports.\n *\n * All fields are optional. When a field is absent,\n * the corresponding detection path is skipped (same\n * behavior as when no dictionaries are available).\n */\nexport type Dictionaries = {\n /**\n * First names per language code (e.g., \"cs\", \"de\").\n */\n firstNames?: Readonly<Record<string, readonly string[]>>;\n /**\n * Surnames per language code.\n */\n surnames?: Readonly<Record<string, readonly string[]>>;\n /**\n * Non-Western name tokens per locale code\n * (e.g., \"in\", \"ar\", \"ja-latn\", \"ko\", \"zh-latn\",\n * \"th\", \"vi\", \"fil\", \"id\"). Merged with bundled\n * names-nw-*.json data at init time.\n */\n nonWesternNames?: Readonly<Record<string, readonly string[]>>;\n /**\n * Pre-loaded deny-list dictionaries keyed by\n * dictionary ID (e.g., \"courts/CZ\", \"banks/DE\").\n * Each value is the array of terms for that\n * dictionary.\n */\n denyList?: Readonly<Record<string, readonly string[]>>;\n /**\n * Metadata per dictionary ID. Required when\n * `denyList` is provided so the pipeline knows\n * labels, categories, and country filters.\n */\n denyListMeta?: Readonly<Record<string, DictionaryMeta>>;\n /**\n * Pre-loaded city names, already merged across\n * all desired countries.\n *\n * Prefer `citiesByCountry` when callers also pass\n * `denyListCountries` / `denyListRegions`; merged\n * city arrays cannot be scoped after injection.\n */\n cities?: readonly string[];\n /**\n * Pre-loaded city names keyed by ISO 3166-1 alpha-2\n * country code. When provided, the deny-list builder\n * applies `denyListCountries` / `denyListRegions`\n * before adding city patterns to the search automaton.\n */\n citiesByCountry?: Readonly<Record<string, readonly string[]>>;\n};\n\nexport type PipelineConfig = {\n threshold: number;\n enableTriggerPhrases: boolean;\n enableRegex: boolean;\n /**\n * Expected content language codes. When present, these\n * derive default dictionary scopes for name corpus and\n * deny-list matching unless the lower-level scope fields\n * below are set explicitly.\n */\n languages?: string[];\n /**\n * Convenience form for single-language documents. Ignored\n * when `languages` is also provided.\n */\n language?: string;\n /**\n * Enables legal-form organization detection.\n * Required for typed callers; legacy untyped\n * callers that omit this field are treated as\n * enabled at runtime for backward compatibility.\n */\n enableLegalForms: boolean;\n /**\n * Enables first-name/surname/title corpus matching.\n * When deny-list mode is enabled, this also controls\n * whether name-corpus entries are injected into the\n * deny-list search automaton.\n */\n enableNameCorpus: boolean;\n /**\n * Optional language scope for first-name/surname\n * dictionaries, using the keys present in\n * `dictionaries.firstNames` / `dictionaries.surnames`\n * (for example `[\"en\", \"de\"]`). When omitted, all\n * injected name languages are used for backward\n * compatibility.\n */\n nameCorpusLanguages?: string[];\n enableDenyList: boolean;\n denyListCountries?: string[];\n denyListRegions?: string[];\n denyListExcludeCategories?: string[];\n /**\n * Caller-owned exact terms to match through the\n * deny-list layer. Requires `enableDenyList: true`.\n */\n customDenyList?: readonly CustomDenyListEntry[];\n /**\n * Caller-owned regex detectors. Requires\n * `enableRegex: true`.\n */\n customRegexes?: readonly CustomRegexPattern[];\n enableGazetteer: boolean;\n /**\n * Detect country names (ISO 3166-1 names, curated\n * aliases, alpha-3 codes). Defaults to true. Names\n * span all manifest languages plus widely-used\n * additions (Dutch, Russian, Chinese, Arabic, etc.).\n */\n enableCountries?: boolean;\n enableConfidenceBoost: boolean;\n enableCoreference: boolean;\n enableZoneClassification?: boolean;\n enableHotwordRules?: boolean;\n /**\n * Requested output labels. An empty array means\n * \"do not filter by label\" for deterministic detectors.\n */\n labels: string[];\n workspaceId: string;\n /**\n * Pre-loaded dictionary data for name, deny-list,\n * and city detection. When omitted, dictionary-based\n * detection paths are skipped. Consumers load from\n * the anonymize-data package and pass the data here.\n */\n dictionaries?: Dictionaries;\n};\n\nexport { DEFAULT_ENTITY_LABELS } from \"./constants\";\n\nexport const isLegalFormsEnabled = (\n config: Pick<PipelineConfig, \"enableLegalForms\">,\n): boolean => config.enableLegalForms !== false;\n","const normalizeLanguageCode = (language: string): string =>\n language.trim().toLowerCase();\n\nconst normalizeLanguageSelection = (\n languages: readonly string[] | undefined,\n): string[] =>\n languages === undefined\n ? []\n : languages\n .map(normalizeLanguageCode)\n .filter((language) => language.length > 0);\n\nexport const languageSelectionKey = (\n languages: readonly string[] | undefined,\n): string => {\n const normalized = normalizeLanguageSelection(languages).toSorted();\n return normalized.length === 0 ? \"*\" : normalized.join(\",\");\n};\n\nconst baseLanguage = (language: string): string => {\n const index = language.indexOf(\"-\");\n return index === -1 ? language : language.slice(0, index);\n};\n\nexport const languageConfigMatches = (\n configLanguage: string,\n selectedLanguages: readonly string[] | undefined,\n): boolean => {\n if (selectedLanguages === undefined || selectedLanguages.length === 0) {\n return true;\n }\n const normalizedSelectedLanguages =\n normalizeLanguageSelection(selectedLanguages);\n if (normalizedSelectedLanguages.length === 0) {\n return true;\n }\n\n const normalizedConfigLanguage = normalizeLanguageCode(configLanguage);\n if (normalizedConfigLanguage.length === 0) {\n return false;\n }\n\n const genericConfig =\n baseLanguage(normalizedConfigLanguage) === normalizedConfigLanguage;\n for (const normalizedLanguage of normalizedSelectedLanguages) {\n if (normalizedLanguage === normalizedConfigLanguage) {\n return true;\n }\n if (\n genericConfig &&\n baseLanguage(normalizedLanguage) === normalizedConfigLanguage\n ) {\n return true;\n }\n }\n\n return false;\n};\n","import {\n isLegalFormsEnabled,\n type GazetteerEntry,\n type PipelineConfig,\n} from \"./types\";\nimport { languageSelectionKey } from \"./util/language-selection\";\n\nconst DEFAULT_CUSTOM_REGEX_SCORE = 0.9;\n\nconst contentLanguageFingerprint = (\n config: Pick<PipelineConfig, \"language\" | \"languages\">,\n): string => {\n const languages =\n config.languages ??\n (config.language === undefined ? [] : [config.language]);\n return languageSelectionKey(languages);\n};\n\nexport const pipelineConfigKey = (\n config: PipelineConfig,\n gazetteerEntries: readonly GazetteerEntry[],\n): string => {\n const legalFormsEnabled = isLegalFormsEnabled(config);\n const customDenyFingerprint =\n config.enableDenyList && config.customDenyList\n ? config.customDenyList\n .map((entry) =>\n JSON.stringify({\n label: entry.label,\n value: entry.value,\n variants: [...(entry.variants ?? [])].sort(),\n }),\n )\n .sort()\n .join(\"\\n\")\n : \"\";\n const customRegexFingerprint =\n config.enableRegex && config.customRegexes\n ? config.customRegexes\n .map((entry) =>\n JSON.stringify({\n label: entry.label,\n pattern: entry.pattern,\n preparedArtifactPolicy: entry.preparedArtifactPolicy ?? null,\n score: entry.score ?? DEFAULT_CUSTOM_REGEX_SCORE,\n }),\n )\n .sort()\n .join(\"\\n\")\n : \"\";\n const gazFingerprint =\n config.enableGazetteer && gazetteerEntries.length > 0\n ? gazetteerEntries\n .map(\n (entry) =>\n `${entry.id}:${entry.canonical}:${entry.label}:${[\n ...entry.variants,\n ]\n .sort()\n .join(\",\")}`,\n )\n .toSorted()\n .join(\";\")\n : \"\";\n\n return (\n `${config.enableDenyList}:` +\n `${config.enableTriggerPhrases}:` +\n `${legalFormsEnabled}:` +\n `${config.enableNameCorpus}:` +\n `${contentLanguageFingerprint(config)}:` +\n `${config.nameCorpusLanguages?.toSorted().join(\",\") ?? \"\"}:` +\n `${config.enableRegex}:` +\n `${config.threshold}:` +\n `${config.enableConfidenceBoost}:` +\n `${config.enableHotwordRules === true}:` +\n `${config.enableCoreference === true}:` +\n `${config.enableZoneClassification === true}:` +\n `${config.labels.toSorted().join(\",\")}:` +\n `${config.denyListCountries?.toSorted().join(\",\") ?? \"\"}:` +\n `${config.denyListRegions?.toSorted().join(\",\") ?? \"\"}:` +\n `${config.denyListExcludeCategories?.toSorted().join(\",\") ?? \"\"}:` +\n `${customDenyFingerprint}:` +\n `${customRegexFingerprint}:` +\n `${config.enableGazetteer}:${gazFingerprint}:` +\n `${config.enableCountries !== false}`\n );\n};\n","import type { PipelineContext } from \"./context\";\nimport { defaultContext } from \"./context\";\nimport { applyPipelineLanguageScope } from \"./language-scope\";\nimport type { NativePreparedSearchConfig } from \"./native-search-config\";\nimport { pipelineConfigKey } from \"./pipeline-cache-key\";\nimport type { Dictionaries, GazetteerEntry, PipelineConfig } from \"./types\";\nimport {\n createNativePipelineFromPackage,\n PreparedNativePipeline,\n type NativeAnonymizeBinding,\n} from \"./native\";\n\nexport {\n PreparedNativePipeline,\n createNativePipelineFromPackage,\n} from \"./native\";\n\nexport type NativePipelineUnsupportedFeature = \"enableNer\";\n\nexport type NativePipelineCompatibility =\n | { status: \"supported\" }\n | {\n status: \"unsupported\";\n unsupportedFeatures: NativePipelineUnsupportedFeature[];\n };\n\nexport type NativePipelineBuildOptions = {\n binding: NativeAnonymizeBinding;\n config: PipelineConfig;\n gazetteerEntries?: GazetteerEntry[];\n context?: PipelineContext;\n};\n\nexport type NativePipelinePackageOptions = NativePipelineBuildOptions & {\n compressed?: boolean;\n};\n\nexport type { NativePipelineFromPackageOptions } from \"./native\";\n\ntype NativePipelinePackageCacheValue = Promise<Uint8Array> | Uint8Array;\n\n// Bounds each shared package cache (the dictionary-less bucket below, and\n// each per-`Dictionaries` bucket handed out by `sharedPackageCacheFor`) to a\n// fixed number of entries. `nativePackageCacheKey` fingerprints\n// caller-suppliable config (custom deny lists, custom regexes, gazetteer\n// entries) via `pipelineConfigKey`, so without a cap a caller that varies\n// those fields grows a bucket — and the multi-MB assembled packages it\n// holds — without limit.\nexport const SHARED_PACKAGE_CACHE_MAX_ENTRIES = 32;\n\nconst sharedPackageByDictionaries = new WeakMap<\n Dictionaries,\n Map<string, NativePipelinePackageCacheValue>\n>();\nconst sharedPackageWithoutDictionaries = new Map<\n string,\n NativePipelinePackageCacheValue\n>();\nconst dictionaryCacheIds = new WeakMap<Dictionaries, number>();\nlet nextDictionaryCacheId = 0;\n\n/** Record `key` as most-recently-used in `cache`, evicting the\n * least-recently-used entry first once the cache is at capacity. A `Map`'s\n * insertion order doubles as recency order here: touching an existing key\n * deletes then re-sets it to move it to the end, and eviction drops the\n * first (oldest) key.\n *\n * Evicting a still-in-flight build only drops the cache's reference to its\n * promise; the caller that started the build (and any concurrent caller that\n * already read the promise before eviction) still resolves it correctly via\n * the guarded `sharedCache.get(key) === promise` checks in\n * `getCachedNativePipelinePackage`. A later caller for the same key just\n * misses the dedupe and starts a fresh build — bounded memory takes priority\n * over perfect dedupe under cache pressure. */\nconst touchSharedPackageCacheEntry = (\n cache: Map<string, NativePipelinePackageCacheValue>,\n key: string,\n value: NativePipelinePackageCacheValue,\n): void => {\n cache.delete(key);\n if (cache.size >= SHARED_PACKAGE_CACHE_MAX_ENTRIES) {\n const oldestKey = cache.keys().next().value;\n if (oldestKey !== undefined) {\n cache.delete(oldestKey);\n }\n }\n cache.set(key, value);\n};\n\nconst dictionaryCacheKey = (dictionaries: Dictionaries | undefined): string => {\n if (dictionaries === undefined) {\n return \"none\";\n }\n const existing = dictionaryCacheIds.get(dictionaries);\n if (existing !== undefined) {\n return `dict:${existing}`;\n }\n nextDictionaryCacheId += 1;\n dictionaryCacheIds.set(dictionaries, nextDictionaryCacheId);\n return `dict:${nextDictionaryCacheId}`;\n};\n\nconst sharedPackageCacheFor = (\n dictionaries: Dictionaries | undefined,\n): Map<string, NativePipelinePackageCacheValue> => {\n if (dictionaries === undefined) {\n return sharedPackageWithoutDictionaries;\n }\n const cached = sharedPackageByDictionaries.get(dictionaries);\n if (cached !== undefined) {\n return cached;\n }\n const created = new Map<string, NativePipelinePackageCacheValue>();\n sharedPackageByDictionaries.set(dictionaries, created);\n return created;\n};\n\nexport const getNativePipelineCompatibility = (\n config: PipelineConfig,\n): NativePipelineCompatibility => {\n const unsupportedFeatures: NativePipelineUnsupportedFeature[] = [];\n\n // `enableNer` is no longer part of `PipelineConfig`; untyped callers that\n // still request it (any truthy value, e.g. `1` or `\"true\"` from loose\n // JSON) must fail fast instead of silently losing NER spans.\n if (\"enableNer\" in config && Boolean(config.enableNer)) {\n unsupportedFeatures.push(\"enableNer\");\n }\n if (unsupportedFeatures.length === 0) {\n return { status: \"supported\" };\n }\n return { status: \"unsupported\", unsupportedFeatures };\n};\n\nexport const assertNativePipelineSupported = (config: PipelineConfig): void => {\n const compatibility = getNativePipelineCompatibility(config);\n if (compatibility.status === \"supported\") {\n return;\n }\n throw new Error(\n `Native pipeline does not yet support: ${compatibility.unsupportedFeatures.join(\", \")}`,\n );\n};\n\nconst encoder = new TextEncoder();\n\ntype AssembleInputs = {\n pipelineConfigJson: Uint8Array;\n dictionariesJson: Uint8Array | undefined;\n gazetteerJson: Uint8Array | undefined;\n};\n\n/**\n * Serialize the assembler inputs the Rust binding expects. Dictionaries are\n * stripped from the pipeline config and passed out of band: the assembler reads\n * the separate bundle preferentially, and keeping the (large) dictionaries out\n * of the config JSON avoids serializing them twice.\n */\nconst toAssembleInputs = (\n { dictionaries, ...config }: PipelineConfig,\n gazetteerEntries: readonly GazetteerEntry[],\n): AssembleInputs => ({\n pipelineConfigJson: encoder.encode(JSON.stringify(config)),\n dictionariesJson:\n dictionaries === undefined\n ? undefined\n : encoder.encode(JSON.stringify(dictionaries)),\n gazetteerJson:\n gazetteerEntries.length === 0\n ? undefined\n : encoder.encode(JSON.stringify(gazetteerEntries)),\n});\n\nconst assemblePackageBytes = (\n binding: NativeAnonymizeBinding,\n { pipelineConfigJson, dictionariesJson, gazetteerJson }: AssembleInputs,\n compressed: boolean,\n): Uint8Array => {\n const assemble = compressed\n ? binding.assembleStaticSearchCompressedPackageBytes\n : binding.assembleStaticSearchPackageBytes;\n if (assemble === undefined) {\n throw new Error(\n \"Native anonymize binding does not support static-search config assembly\",\n );\n }\n return assemble(pipelineConfigJson, dictionariesJson, gazetteerJson);\n};\n\nexport const prepareNativePipelineConfig = async ({\n binding,\n config,\n gazetteerEntries = [],\n}: Omit<\n NativePipelineBuildOptions,\n \"context\"\n>): Promise<NativePreparedSearchConfig> => {\n const scopedConfig = applyPipelineLanguageScope(config);\n assertNativePipelineSupported(scopedConfig);\n const assemble = binding.assembleStaticSearchConfigJson;\n if (assemble === undefined) {\n throw new Error(\n \"Native anonymize binding does not support static-search config assembly\",\n );\n }\n const { pipelineConfigJson, dictionariesJson, gazetteerJson } =\n toAssembleInputs(scopedConfig, gazetteerEntries);\n const configJson = assemble(\n pipelineConfigJson,\n dictionariesJson,\n gazetteerJson,\n );\n return JSON.parse(new TextDecoder().decode(configJson));\n};\n\nexport const prepareNativePipelinePackage = async ({\n binding,\n config,\n gazetteerEntries = [],\n context,\n compressed = false,\n}: NativePipelinePackageOptions): Promise<Uint8Array> => {\n const packageBytes = await getCachedNativePipelinePackage({\n config,\n binding,\n gazetteerEntries,\n ...(context ? { context } : {}),\n compressed,\n });\n // Return a genuine copy: with the real NAPI binding packageBytes is a Node\n // Buffer, and Buffer.prototype.slice() yields a memory-sharing view, so a\n // caller mutating it would corrupt the shared cache and ctx.nativePipelinePackage.\n return new Uint8Array(packageBytes);\n};\n\nexport const createNativePipelineFromConfig = async ({\n binding,\n config,\n gazetteerEntries = [],\n context,\n}: NativePipelineBuildOptions): Promise<PreparedNativePipeline> => {\n const packageBytes = await getCachedNativePipelinePackage({\n binding,\n config,\n gazetteerEntries,\n ...(context ? { context } : {}),\n });\n return createNativePipelineFromPackage({ binding, packageBytes });\n};\n\nconst getCachedNativePipelinePackage = async ({\n binding,\n config,\n gazetteerEntries = [],\n context,\n compressed = false,\n}: NativePipelinePackageOptions): Promise<Uint8Array> => {\n const scopedConfig = applyPipelineLanguageScope(config);\n assertNativePipelineSupported(scopedConfig);\n const ctx = context ?? defaultContext;\n const key = nativePackageCacheKey({\n binding,\n config: scopedConfig,\n gazetteerEntries,\n compressed,\n });\n if (ctx.nativePipelinePackage && ctx.nativePipelinePackageKey === key) {\n return ctx.nativePipelinePackage;\n }\n if (\n ctx.nativePipelinePackagePromise &&\n ctx.nativePipelinePackageKey === key\n ) {\n return ctx.nativePipelinePackagePromise;\n }\n\n const sharedCache = sharedPackageCacheFor(scopedConfig.dictionaries);\n const shared = sharedCache.get(key);\n if (shared !== undefined) {\n touchSharedPackageCacheEntry(sharedCache, key, shared);\n const packageBytes = await shared;\n ctx.nativePipelinePackage = packageBytes;\n ctx.nativePipelinePackageKey = key;\n ctx.nativePipelinePackagePromise = null;\n return packageBytes;\n }\n\n ctx.nativePipelinePackage = null;\n ctx.nativePipelinePackageKey = key;\n const promise = buildNativePipelinePackage({\n binding,\n config: scopedConfig,\n gazetteerEntries,\n compressed,\n });\n ctx.nativePipelinePackagePromise = promise;\n touchSharedPackageCacheEntry(sharedCache, key, promise);\n let packageBytes: Uint8Array;\n try {\n packageBytes = await promise;\n } catch (error) {\n if (sharedCache.get(key) === promise) {\n sharedCache.delete(key);\n }\n if (\n ctx.nativePipelinePackageKey === key &&\n ctx.nativePipelinePackagePromise === promise\n ) {\n ctx.nativePipelinePackage = null;\n ctx.nativePipelinePackagePromise = null;\n }\n throw error;\n }\n if (sharedCache.get(key) === promise) {\n sharedCache.set(key, packageBytes);\n }\n if (ctx.nativePipelinePackageKey === key) {\n ctx.nativePipelinePackage = packageBytes;\n ctx.nativePipelinePackagePromise = null;\n }\n return packageBytes;\n};\n\n// `async` so the shared package cache can store the in-flight value and dedupe\n// concurrent builds for the same key, and so assembly failures (an older\n// binding without the assemble functions, or a config the assembler rejects)\n// surface as a rejected promise rather than a synchronous throw mid-cache-flow.\nconst buildNativePipelinePackage = async ({\n binding,\n config,\n gazetteerEntries,\n compressed,\n}: Required<\n Omit<NativePipelinePackageOptions, \"context\">\n>): Promise<Uint8Array> =>\n assemblePackageBytes(\n binding,\n toAssembleInputs(config, gazetteerEntries),\n compressed,\n );\n\ntype NativePackageCacheKeyOptions = {\n binding: NativeAnonymizeBinding;\n config: PipelineConfig;\n gazetteerEntries: readonly GazetteerEntry[];\n compressed: boolean;\n};\n\nconst nativePackageCacheKey = ({\n binding,\n config,\n gazetteerEntries,\n compressed,\n}: NativePackageCacheKeyOptions): string =>\n [\n binding.nativePackageVersion(),\n compressed ? \"compressed\" : \"raw\",\n dictionaryCacheKey(config.dictionaries),\n pipelineConfigKey(config, gazetteerEntries),\n ].join(\":\");\n","import { DEFAULT_ENTITY_LABELS } from \"./constants\";\nimport type { PipelineConfig } from \"./types\";\n\nexport const DEFAULT_NATIVE_PIPELINE_CONFIG: PipelineConfig = {\n threshold: 0.3,\n enableTriggerPhrases: true,\n enableRegex: true,\n enableLegalForms: true,\n enableNameCorpus: true,\n enableDenyList: true,\n enableGazetteer: false,\n enableCountries: true,\n enableConfidenceBoost: true,\n enableCoreference: true,\n enableHotwordRules: true,\n enableZoneClassification: true,\n labels: [...DEFAULT_ENTITY_LABELS],\n workspaceId: \"native-pipeline-default\",\n};\n","import { createRequire } from \"node:module\";\nimport { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport process from \"node:process\";\n\nimport {\n assertNativeBindingVersion,\n createNativePipelineFromPackage,\n type NativeOperatorConfig,\n type NativeAnonymizeBinding,\n type NativeNormalizeOptions,\n type NativeSearchPackageInput,\n PreparedNativeAnonymizer,\n PreparedNativePipeline,\n type NativeStaticRedactionResult,\n diagnostics_json as diagnosticsJsonWithBinding,\n convert_external_detection_batch as convertExternalDetectionBatchWithBinding,\n diagnostics_stream_json as diagnosticsStreamJsonWithBinding,\n load_prepared_package as loadPreparedPackageWithBinding,\n native_package_version as nativePackageVersionWithBinding,\n normalize_for_search as normalizeForSearchWithBinding,\n prepare_search_package as prepareSearchPackageWithBinding,\n redact_text as redactTextWithBinding,\n redact_text_json as redactTextJsonWithBinding,\n redact_text_stream_json as redactTextStreamJsonWithBinding,\n summary_diagnostics_json as summaryDiagnosticsJsonWithBinding,\n} from \"./native\";\n\nexport * from \"./native\";\nexport {\n assertNativePipelineSupported,\n createNativePipelineFromConfig,\n getNativePipelineCompatibility,\n prepareNativePipelineConfig,\n prepareNativePipelinePackage,\n} from \"./native-pipeline\";\nexport type {\n NativePipelineBuildOptions,\n NativePipelineCompatibility,\n NativePipelinePackageOptions,\n NativePipelineUnsupportedFeature,\n} from \"./native-pipeline\";\n\nexport type NativeRequire = (specifier: string) => unknown;\n\nexport type NativeLibc = \"gnu\" | \"musl\";\n\nexport type LoadNativeBindingOptions = {\n expectedVersion?: string;\n platform?: string;\n arch?: string;\n libc?: NativeLibc;\n env?: Record<string, string | undefined>;\n requireModule?: NativeRequire;\n};\n\nexport type NativePipelinePackageFileOptions = LoadNativeBindingOptions & {\n binding?: NativeAnonymizeBinding;\n packagePath: string;\n};\n\nexport type NativeSdkOptions = LoadNativeBindingOptions & {\n binding?: NativeAnonymizeBinding;\n};\n\nexport type NativeSdkPackageOptions = NativeSdkOptions & {\n compressed?: boolean;\n};\n\nexport type DefaultNativePipelinePackageOptions = LoadNativeBindingOptions & {\n binding?: NativeAnonymizeBinding;\n language?: string;\n packagePath?: string;\n warmup?: DefaultNativePipelineWarmup;\n};\n\ntype ResolvedDefaultNativePipelineOptions = {\n binding: NativeAnonymizeBinding;\n language?: string;\n packagePath?: string;\n warmup: DefaultNativePipelineWarmup;\n};\n\nexport const DEFAULT_NATIVE_PIPELINE_WARMUPS = {\n lazyRegex: \"lazy-regex\",\n none: \"none\",\n} as const;\n\nexport type DefaultNativePipelineWarmup =\n (typeof DEFAULT_NATIVE_PIPELINE_WARMUPS)[keyof typeof DEFAULT_NATIVE_PIPELINE_WARMUPS];\n\nexport type DefaultNativePipelinePackageFileOptions = {\n language?: string;\n};\n\nconst LOCAL_NATIVE_LOADER = \"../index.cjs\";\nconst PACKAGE_SPECIFIC_NATIVE_PATH = \"STELLA_ANONYMIZE_NATIVE_LIBRARY_PATH\";\nconst DEFAULT_NATIVE_PIPELINE_PACKAGE_URL = new URL(\n \"../native-pipeline.stlanonpkg\",\n import.meta.url,\n);\nconst DEFAULT_NATIVE_PIPELINE_PACKAGE_DIR_URL = new URL(\"../\", import.meta.url);\nconst DEFAULT_NATIVE_PIPELINE_LANGUAGE_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\nconst DEFAULT_NATIVE_PIPELINE_LANGUAGE_PACKAGE_PATTERN =\n /^native-pipeline\\.([a-z0-9]+(?:-[a-z0-9]+)*)\\.stlanonpkg$/u;\nconst DEFAULT_NATIVE_PIPELINE_PACKAGE_CACHE_KEY = \"<default>\";\nconst defaultNativePipelineCache = new WeakMap<\n NativeAnonymizeBinding,\n Map<string, PreparedNativePipeline>\n>();\nconst warmedDefaultNativePipelines = new WeakSet<PreparedNativePipeline>();\nconst defaultNativePipelineInflightCache = new WeakMap<\n NativeAnonymizeBinding,\n Map<string, Promise<PreparedNativePipeline>>\n>();\n\nexport { DEFAULT_NATIVE_PIPELINE_CONFIG } from \"./native-default-config\";\n\nexport const loadNativeAnonymizeBinding = (\n options: LoadNativeBindingOptions = {},\n): NativeAnonymizeBinding => {\n const requireModule = options.requireModule ?? createRequire(import.meta.url);\n const platform = options.platform ?? process.platform;\n const arch = options.arch ?? process.arch;\n const libc = options.libc ?? detectNativeLibc(platform);\n const env = options.env ?? process.env;\n const specifiers = nativeBindingSpecifiers({ arch, env, libc, platform });\n const errors: string[] = [];\n\n for (const specifier of specifiers) {\n const binding = tryLoadNativeBinding({\n specifier,\n requireModule,\n errors,\n });\n if (!binding) {\n continue;\n }\n if (options.expectedVersion !== undefined) {\n assertNativeBindingVersion({\n binding,\n expectedVersion: options.expectedVersion,\n });\n }\n return binding;\n }\n\n if (nativeBindingPackageName({ arch, libc, platform }) === null) {\n throw unsupportedNativeTargetError({ arch, errors, libc, platform });\n }\n throw new Error(\n `Unable to load native anonymize binding for ${platform}/${arch}:\\n${errors.join(\"\\n\")}`,\n );\n};\n\nexport const readNativePipelinePackageFile = (\n packagePath: string,\n): Uint8Array => readFileSync(packagePath);\n\nexport const readNativePipelinePackageFileAsync = async (\n packagePath: string,\n): Promise<Uint8Array> => readFile(packagePath);\n\nexport const native_package_version = (\n options: NativeSdkOptions = {},\n): string => nativePackageVersionWithBinding(resolveNativeSdkBinding(options));\n\nexport const convert_external_detection_batch = (\n document: Uint8Array,\n batch: import(\"./native\").ExternalDetectionBatch | string,\n options: NativeSdkOptions = {},\n): import(\"./native\").NativeCallerDetection[] =>\n convertExternalDetectionBatchWithBinding({\n binding: resolveNativeSdkBinding(options),\n document,\n batch,\n });\n\nexport const normalize_for_search = (\n text: string,\n options: NativeSdkOptions = {},\n): string => {\n const args: NativeNormalizeOptions = {\n binding: resolveNativeSdkBinding(options),\n text,\n };\n return normalizeForSearchWithBinding(args);\n};\n\nexport const prepare_search_package = (\n config: NativeSearchPackageInput,\n { compressed = false, ...options }: NativeSdkPackageOptions = {},\n): Uint8Array =>\n prepareSearchPackageWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n compressed,\n });\n\nexport const load_prepared_package = (\n packageBytes: Uint8Array,\n options: NativeSdkOptions = {},\n) =>\n loadPreparedPackageWithBinding({\n binding: resolveNativeSdkBinding(options),\n packageBytes,\n });\n\nexport const load_prepared_package_file = (\n packagePath: string,\n options: NativeSdkOptions = {},\n) => load_prepared_package(readNativePipelinePackageFile(packagePath), options);\n\nexport const redact_text = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): NativeStaticRedactionResult =>\n redactTextWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const redact_text_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string =>\n redactTextJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const redact_text_stream_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n onEvent: (eventJson: string) => void,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n redactTextStreamJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n onEvent,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const diagnostics_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n diagnosticsJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const diagnostics_stream_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n onBatch: (diagnosticsJson: string) => void,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n diagnosticsStreamJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n onBatch,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const summary_diagnostics_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n summaryDiagnosticsJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const readDefaultNativePipelinePackageFile = ({\n language,\n}: DefaultNativePipelinePackageFileOptions = {}): Uint8Array => {\n const packageUrl = defaultNativePipelinePackageUrl(language);\n try {\n return readFileSync(packageUrl);\n } catch (error) {\n throw new Error(\n `${defaultNativePipelinePackageDescription(language)} is unavailable: ${formatLoadError(error)}`,\n );\n }\n};\n\nexport const read_default_native_pipeline_package_file = (\n options: DefaultNativePipelinePackageFileOptions = {},\n): Uint8Array => readDefaultNativePipelinePackageFile(options);\n\nexport const availableDefaultNativePipelineLanguages = (): string[] => {\n const languages = new Set<string>();\n try {\n for (const fileName of readdirSync(\n DEFAULT_NATIVE_PIPELINE_PACKAGE_DIR_URL,\n )) {\n const match = fileName.match(\n DEFAULT_NATIVE_PIPELINE_LANGUAGE_PACKAGE_PATTERN,\n );\n if (match?.[1] !== undefined) {\n languages.add(match[1]);\n }\n }\n } catch (error) {\n throw new Error(\n `Default native pipeline package directory is unavailable: ${formatLoadError(error)}`,\n );\n }\n return [...languages].toSorted();\n};\n\nexport const available_default_native_pipeline_languages =\n availableDefaultNativePipelineLanguages;\n\nexport const readDefaultNativePipelinePackageFileAsync = async ({\n language,\n}: DefaultNativePipelinePackageFileOptions = {}): Promise<Uint8Array> => {\n const packageUrl = defaultNativePipelinePackageUrl(language);\n try {\n return await readFile(packageUrl);\n } catch (error) {\n throw new Error(\n `${defaultNativePipelinePackageDescription(language)} is unavailable: ${formatLoadError(error)}`,\n );\n }\n};\n\nexport const createNativePipelineFromPackageFile = ({\n binding,\n packagePath,\n expectedVersion,\n ...loadOptions\n}: NativePipelinePackageFileOptions): PreparedNativePipeline => {\n const resolvedBinding =\n binding ??\n loadNativeAnonymizeBinding({\n ...loadOptions,\n ...(expectedVersion !== undefined ? { expectedVersion } : {}),\n });\n if (binding && expectedVersion !== undefined) {\n assertNativeBindingVersion({ binding, expectedVersion });\n }\n return createNativePipelineFromPackage({\n binding: resolvedBinding,\n packageBytes: readNativePipelinePackageFile(packagePath),\n });\n};\n\nexport const createNativePipelineFromDefaultPackage = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => {\n const resolvedOptions = resolveDefaultNativePipelineOptions(options);\n return applyDefaultNativePipelineWarmup(\n createNativePipelineFromResolvedDefaultPackage(resolvedOptions),\n resolvedOptions.warmup,\n );\n};\n\nexport const create_native_pipeline_from_default_package = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => createNativePipelineFromDefaultPackage(options);\n\nexport const getDefaultNativePipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => {\n const resolvedOptions = resolveDefaultNativePipelineOptions(options);\n const cache = defaultPipelineCacheFor(resolvedOptions.binding);\n const key = defaultPipelineCacheKey(resolvedOptions);\n const cached = cache.get(key);\n if (cached !== undefined) {\n return applyDefaultNativePipelineWarmup(cached, resolvedOptions.warmup);\n }\n const pipeline =\n createNativePipelineFromResolvedDefaultPackage(resolvedOptions);\n cache.set(key, pipeline);\n return applyDefaultNativePipelineWarmup(pipeline, resolvedOptions.warmup);\n};\n\nexport const get_default_native_pipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => getDefaultNativePipeline(options);\n\nexport const preloadDefaultNativePipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => {\n const pipeline = getDefaultNativePipeline(options);\n return applyDefaultNativePipelineWarmup(\n pipeline,\n DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex,\n );\n};\n\nexport const preload_default_native_pipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => preloadDefaultNativePipeline(options);\n\nexport const redactDefaultText = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): NativeStaticRedactionResult =>\n getDefaultNativePipeline(options).redactText(fullText, operators);\n\nexport const redact_default_text = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): NativeStaticRedactionResult =>\n redactDefaultText(fullText, operators, options);\n\nexport const redactDefaultTextJson = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): string =>\n getDefaultNativePipeline(options).redact_text_json(fullText, operators);\n\nexport const redact_default_text_json = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): string => redactDefaultTextJson(fullText, operators, options);\n\nexport const preloadDefaultNativePipelineAsync = (\n options: DefaultNativePipelinePackageOptions = {},\n): Promise<PreparedNativePipeline> => {\n const resolvedOptions = {\n ...resolveDefaultNativePipelineOptions(options),\n warmup: DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex,\n };\n const cache = defaultPipelineCacheFor(resolvedOptions.binding);\n const key = defaultPipelineCacheKey(resolvedOptions);\n const cached = cache.get(key);\n if (cached !== undefined) {\n return Promise.resolve(\n applyDefaultNativePipelineWarmup(cached, resolvedOptions.warmup),\n );\n }\n\n const inflightCache = defaultPipelineInflightCacheFor(\n resolvedOptions.binding,\n );\n const inflight = inflightCache.get(key);\n if (inflight !== undefined) {\n return inflight;\n }\n\n const promise = createNativePipelineFromResolvedDefaultPackageAsync(\n resolvedOptions,\n )\n .then((pipeline) => {\n cache.set(key, pipeline);\n return applyDefaultNativePipelineWarmup(pipeline, resolvedOptions.warmup);\n })\n .finally(() => {\n inflightCache.delete(key);\n });\n inflightCache.set(key, promise);\n return promise;\n};\n\nconst resolveDefaultNativePipelineOptions = ({\n binding,\n language,\n packagePath,\n warmup,\n expectedVersion,\n ...loadOptions\n}: DefaultNativePipelinePackageOptions = {}): ResolvedDefaultNativePipelineOptions => {\n if (language !== undefined && packagePath !== undefined) {\n throw new Error(\"Use either language or packagePath, not both\");\n }\n const resolvedBinding =\n binding ??\n loadNativeAnonymizeBinding({\n ...loadOptions,\n ...(expectedVersion !== undefined ? { expectedVersion } : {}),\n });\n if (binding && expectedVersion !== undefined) {\n assertNativeBindingVersion({ binding, expectedVersion });\n }\n return {\n binding: resolvedBinding,\n warmup: normalizeDefaultNativePipelineWarmup(warmup),\n ...(language !== undefined\n ? { language: resolveDefaultNativePipelineLanguage(language) }\n : {}),\n ...(packagePath !== undefined ? { packagePath } : {}),\n };\n};\n\nconst applyDefaultNativePipelineWarmup = (\n pipeline: PreparedNativePipeline,\n warmup: DefaultNativePipelineWarmup,\n): PreparedNativePipeline => {\n if (warmup !== DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex) {\n return pipeline;\n }\n if (!warmedDefaultNativePipelines.has(pipeline)) {\n pipeline.warmLazyRegex();\n warmedDefaultNativePipelines.add(pipeline);\n }\n return pipeline;\n};\n\nconst createNativePipelineFromResolvedDefaultPackage = ({\n binding,\n language,\n packagePath,\n}: ResolvedDefaultNativePipelineOptions): PreparedNativePipeline => {\n const packageBytes =\n packagePath === undefined\n ? readDefaultNativePipelinePackageFile(\n defaultPackageFileOptions(language),\n )\n : readNativePipelinePackageFile(packagePath);\n return createNativePipelineFromTrustedDefaultPackage(binding, packageBytes);\n};\n\nconst createNativePipelineFromResolvedDefaultPackageAsync = async ({\n binding,\n language,\n packagePath,\n}: ResolvedDefaultNativePipelineOptions): Promise<PreparedNativePipeline> => {\n const packageBytes =\n packagePath === undefined\n ? await readDefaultNativePipelinePackageFileAsync(\n defaultPackageFileOptions(language),\n )\n : await readNativePipelinePackageFileAsync(packagePath);\n return createNativePipelineFromTrustedDefaultPackage(binding, packageBytes);\n};\n\nconst createNativePipelineFromTrustedDefaultPackage = (\n binding: NativeAnonymizeBinding,\n packageBytes: Uint8Array,\n): PreparedNativePipeline =>\n new PreparedNativePipeline(\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromTrustedPreparedPackageBytesWithoutCache?.(\n packageBytes,\n ) ??\n binding.NativePreparedSearch.fromTrustedPreparedPackageBytes?.(\n packageBytes,\n ) ??\n binding.NativePreparedSearch.fromPreparedPackageBytesWithoutCache?.(\n packageBytes,\n ) ??\n binding.NativePreparedSearch.fromPreparedPackageBytes(packageBytes),\n ),\n );\n\nconst defaultPackageFileOptions = (\n language: string | undefined,\n): DefaultNativePipelinePackageFileOptions =>\n language === undefined ? {} : { language };\n\nconst normalizeDefaultNativePipelineWarmup = (\n warmup: DefaultNativePipelineWarmup | undefined,\n): DefaultNativePipelineWarmup => {\n if (warmup === undefined) {\n return DEFAULT_NATIVE_PIPELINE_WARMUPS.none;\n }\n switch (warmup) {\n case DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex:\n case DEFAULT_NATIVE_PIPELINE_WARMUPS.none:\n return warmup;\n }\n throw new Error(\n 'Default native pipeline warmup must be \"lazy-regex\" or \"none\"',\n );\n};\n\nconst resolveNativeSdkBinding = ({\n binding,\n expectedVersion,\n ...loadOptions\n}: NativeSdkOptions): NativeAnonymizeBinding => {\n const resolvedBinding =\n binding ??\n loadNativeAnonymizeBinding({\n ...loadOptions,\n ...(expectedVersion !== undefined ? { expectedVersion } : {}),\n });\n if (binding && expectedVersion !== undefined) {\n assertNativeBindingVersion({ binding, expectedVersion });\n }\n return resolvedBinding;\n};\n\nconst defaultPipelineCacheFor = (\n binding: NativeAnonymizeBinding,\n): Map<string, PreparedNativePipeline> => {\n const cached = defaultNativePipelineCache.get(binding);\n if (cached !== undefined) {\n return cached;\n }\n const created = new Map<string, PreparedNativePipeline>();\n defaultNativePipelineCache.set(binding, created);\n return created;\n};\n\nconst defaultPipelineInflightCacheFor = (\n binding: NativeAnonymizeBinding,\n): Map<string, Promise<PreparedNativePipeline>> => {\n const cached = defaultNativePipelineInflightCache.get(binding);\n if (cached !== undefined) {\n return cached;\n }\n const created = new Map<string, Promise<PreparedNativePipeline>>();\n defaultNativePipelineInflightCache.set(binding, created);\n return created;\n};\n\nconst defaultPipelineCacheKey = ({\n binding,\n language,\n packagePath,\n}: ResolvedDefaultNativePipelineOptions): string =>\n [\n binding.nativePackageVersion(),\n packagePath ??\n (language === undefined\n ? DEFAULT_NATIVE_PIPELINE_PACKAGE_CACHE_KEY\n : `language:${language}`),\n ].join(\"\\0\");\n\nconst defaultNativePipelinePackageUrl = (language: string | undefined): URL => {\n if (language === undefined) {\n return DEFAULT_NATIVE_PIPELINE_PACKAGE_URL;\n }\n const normalized = resolveDefaultNativePipelineLanguage(language);\n return defaultNativePipelineLanguagePackageUrl(normalized);\n};\n\nconst defaultNativePipelineLanguagePackageUrl = (language: string): URL =>\n new URL(`../native-pipeline.${language}.stlanonpkg`, import.meta.url);\n\nconst resolveDefaultNativePipelineLanguage = (language: string): string => {\n const normalized = normalizeDefaultNativePipelineLanguage(language);\n const exactUrl = defaultNativePipelineLanguagePackageUrl(normalized);\n if (existsSync(exactUrl)) {\n return normalized;\n }\n const baseLanguage = normalized.split(\"-\").at(0);\n if (baseLanguage === undefined || baseLanguage === normalized) {\n return normalized;\n }\n const baseUrl = defaultNativePipelineLanguagePackageUrl(baseLanguage);\n if (existsSync(baseUrl)) {\n return baseLanguage;\n }\n return normalized;\n};\n\nconst defaultNativePipelinePackageDescription = (\n language: string | undefined,\n): string =>\n language === undefined\n ? \"Default native pipeline package\"\n : `Default native pipeline package for language \"${resolveDefaultNativePipelineLanguage(language)}\"`;\n\nconst normalizeDefaultNativePipelineLanguage = (language: string): string => {\n const normalized = language.trim().toLowerCase();\n if (!DEFAULT_NATIVE_PIPELINE_LANGUAGE_PATTERN.test(normalized)) {\n throw new Error(\n `Default native pipeline language must match ${DEFAULT_NATIVE_PIPELINE_LANGUAGE_PATTERN.source}`,\n );\n }\n return normalized;\n};\n\ntype NativeBindingSpecifiersOptions = {\n arch: string;\n env: Record<string, string | undefined>;\n libc: NativeLibc | undefined;\n platform: string;\n};\n\nconst nativeBindingSpecifiers = ({\n arch,\n env,\n libc,\n platform,\n}: NativeBindingSpecifiersOptions): string[] => {\n const specifiers: string[] = [];\n const overridePath = env[PACKAGE_SPECIFIC_NATIVE_PATH];\n if (overridePath) {\n specifiers.push(overridePath);\n }\n specifiers.push(LOCAL_NATIVE_LOADER);\n const platformPackage = nativeBindingPackageName({ arch, libc, platform });\n if (platformPackage !== null) {\n specifiers.push(platformPackage);\n }\n return specifiers;\n};\n\ntype NativeBindingTarget = {\n platform: string;\n arch: string;\n libc?: NativeLibc;\n package: string;\n};\n\n// Single source of truth for published native sidecars. Both the runtime\n// package lookup and the \"unsupported target\" error message derive from this\n// table, so a target is never advertised as supported without a package (and\n// vice versa). musl Linux is intentionally absent: no musl sidecar is shipped.\nconst NATIVE_BINDING_TARGETS: readonly NativeBindingTarget[] = [\n {\n platform: \"darwin\",\n arch: \"arm64\",\n package: \"@stll/anonymize-darwin-arm64\",\n },\n { platform: \"darwin\", arch: \"x64\", package: \"@stll/anonymize-darwin-x64\" },\n {\n platform: \"linux\",\n arch: \"arm64\",\n libc: \"gnu\",\n package: \"@stll/anonymize-linux-arm64-gnu\",\n },\n {\n platform: \"linux\",\n arch: \"x64\",\n libc: \"gnu\",\n package: \"@stll/anonymize-linux-x64-gnu\",\n },\n { platform: \"win32\", arch: \"x64\", package: \"@stll/anonymize-win32-x64-msvc\" },\n];\n\ntype NativeBindingPackageNameOptions = {\n arch: string;\n libc: NativeLibc | undefined;\n platform: string;\n};\n\ntype DescribeNativeTargetOptions = {\n arch: string;\n libc?: NativeLibc | undefined;\n platform: string;\n};\n\nconst describeNativeTarget = ({\n arch,\n libc,\n platform,\n}: DescribeNativeTargetOptions): string =>\n libc === undefined ? `${platform}-${arch}` : `${platform}-${arch}-${libc}`;\n\nconst SUPPORTED_NATIVE_TARGETS: readonly string[] = NATIVE_BINDING_TARGETS.map(\n (target) => describeNativeTarget(target),\n);\n\nconst nativeBindingPackageName = ({\n arch,\n libc,\n platform,\n}: NativeBindingPackageNameOptions): string | null => {\n const match = NATIVE_BINDING_TARGETS.find(\n (target) =>\n target.platform === platform &&\n target.arch === arch &&\n (target.libc === undefined || target.libc === libc),\n );\n return match?.package ?? null;\n};\n\nconst unsupportedNativeTargetError = ({\n arch,\n errors,\n libc,\n platform,\n}: NativeBindingPackageNameOptions & { errors: string[] }): Error => {\n const target = describeNativeTarget({ arch, libc, platform });\n const supported = SUPPORTED_NATIVE_TARGETS.join(\", \");\n const attempts = errors.length > 0 ? `\\n${errors.join(\"\\n\")}` : \"\";\n return new Error(\n `No native anonymize binding is published for ${target}; supported targets: ${supported}. Set ${PACKAGE_SPECIFIC_NATIVE_PATH} to a locally built binding to run on this platform.${attempts}`,\n );\n};\n\nconst detectNativeLibc = (platform: string): NativeLibc | undefined => {\n if (platform !== \"linux\") {\n return undefined;\n }\n const report = process.report?.getReport();\n const header =\n isPropertyBag(report) && isPropertyBag(report[\"header\"])\n ? report[\"header\"]\n : null;\n return typeof header?.[\"glibcVersionRuntime\"] === \"string\" ? \"gnu\" : \"musl\";\n};\n\ntype TryLoadNativeBindingOptions = {\n specifier: string;\n requireModule: NativeRequire;\n errors: string[];\n};\n\nconst tryLoadNativeBinding = ({\n specifier,\n requireModule,\n errors,\n}: TryLoadNativeBindingOptions): NativeAnonymizeBinding | null => {\n try {\n const loaded = requireModule(specifier);\n const binding = toNativeAnonymizeBinding(loaded);\n if (binding) {\n return binding;\n }\n errors.push(`${specifier}: module does not match native binding shape`);\n } catch (error) {\n errors.push(`${specifier}: ${formatLoadError(error)}`);\n }\n return null;\n};\n\nconst toNativeAnonymizeBinding = (\n value: unknown,\n): NativeAnonymizeBinding | null => {\n const candidate =\n isPropertyBag(value) && isPropertyBag(value[\"default\"])\n ? value[\"default\"]\n : value;\n return isNativeAnonymizeBinding(candidate) ? candidate : null;\n};\n\nconst isNativeAnonymizeBinding = (\n candidate: unknown,\n): candidate is NativeAnonymizeBinding => {\n if (!isPropertyBag(candidate)) {\n return false;\n }\n if (typeof candidate[\"nativePackageVersion\"] !== \"function\") {\n return false;\n }\n if (typeof candidate[\"normalizeForSearch\"] !== \"function\") {\n return false;\n }\n if (typeof candidate[\"prepareStaticSearchPackageBytes\"] !== \"function\") {\n return false;\n }\n if (\n typeof candidate[\"prepareStaticSearchCompressedPackageBytes\"] !== \"function\"\n ) {\n return false;\n }\n const preparedSearch = candidate[\"NativePreparedSearch\"];\n if (!isPropertyBag(preparedSearch)) {\n return false;\n }\n if (typeof preparedSearch[\"fromConfigJsonBytes\"] !== \"function\") {\n return false;\n }\n if (typeof preparedSearch[\"fromPreparedPackageBytes\"] !== \"function\") {\n return false;\n }\n return true;\n};\n\nconst isPropertyBag = (value: unknown): value is Record<string, unknown> =>\n (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n\nconst formatLoadError = (error: unknown): string => {\n if (error instanceof Error) {\n return error.message;\n }\n return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1B,OAAO;CAET,IAAI,OAAO,UAAU,4BAA4B,YAC/C,OAAO;CAET,IAAI,OAAO,UAAU,0BAA0B,YAC7C,OAAO;CAET,IAAI,OAAO,UAAU,uCAAuC,YAC1D,OAAO;CAET,IACE,OAAO,UAAU,iDAAiD,YAElE,OAAO;CAET,MAAM,iBAAiB,UAAU;CACjC,IAAI,CAAC,cAAc,cAAc,GAC/B,OAAO;CAET,IAAI,OAAO,eAAe,2BAA2B,YACnD,OAAO;CAET,IAAI,OAAO,eAAe,gCAAgC,YACxD,OAAO;CAET,OAAO;AACT;AAEA,MAAM,iBAAiB,UACpB,OAAO,UAAU,YAAY,UAAU,QAAS,OAAO,UAAU;AAEpE,MAAM,mBAAmB,UAA2B;CAClD,IAAI,iBAAiB,OACnB,OAAO,MAAM;CAEf,OAAO,OAAO,KAAK;AACrB"}
1
+ {"version":3,"file":"native-node2.mjs","names":["languageScopes","nativePackageVersionWithBinding","convertExternalDetectionBatchWithBinding","normalizeForSearchWithBinding","prepareSearchPackageWithBinding","loadPreparedPackageWithBinding","redactTextWithBinding","redactTextJsonWithBinding","redactTextStreamJsonWithBinding","diagnosticsJsonWithBinding","diagnosticsStreamJsonWithBinding","summaryDiagnosticsJsonWithBinding"],"sources":["../src/context.ts","../src/data/language-scopes.json","../src/language-scope.ts","../src/types.ts","../src/util/language-selection.ts","../src/pipeline-cache-key.ts","../src/native-pipeline.ts","../src/native-default-config.ts","../src/native-node.ts"],"sourcesContent":["/**\n * Cached state for a single pipeline run (or a sequence of runs sharing the\n * same config). The native pipeline builds its prepared package once and reuses\n * it across calls with the same config; the package bytes and the key/promise\n * that guard concurrent builds live here so callers can share one warmed\n * context.\n */\nexport type PipelineContext = {\n // ── Native prepared-package cache ─────────────\n nativePipelinePackage: Uint8Array | null;\n nativePipelinePackageKey: string;\n nativePipelinePackagePromise: Promise<Uint8Array> | null;\n};\n\n/** Create a fresh, empty pipeline context. */\nexport const createPipelineContext = (): PipelineContext => ({\n nativePipelinePackage: null,\n nativePipelinePackageKey: \"\",\n nativePipelinePackagePromise: null,\n});\n\n/**\n * Module-level default context. Used when callers\n * don't provide an explicit context, preserving full\n * backward compatibility with the existing API.\n */\nexport const defaultContext: PipelineContext = createPipelineContext();\n","","import languageScopes from \"./data/language-scopes.json\";\n\nimport type { PipelineConfig } from \"./types\";\n\ntype LanguageScope = {\n nameCorpusLanguages?: readonly string[];\n denyListCountries?: readonly string[];\n};\n\ntype LanguageScopeData = {\n languages: Record<string, LanguageScope>;\n};\n\nconst scopeData = languageScopes as LanguageScopeData;\n\nconst normalizeLanguage = (language: string): string =>\n language.trim().toLowerCase();\n\nconst fallbackLanguage = (language: string): string | null => {\n const index = language.indexOf(\"-\");\n return index === -1 ? null : language.slice(0, index);\n};\n\nconst uniquePush = (target: string[], values: readonly string[]): void => {\n const seen = new Set(target);\n for (const value of values) {\n if (seen.has(value)) {\n continue;\n }\n seen.add(value);\n target.push(value);\n }\n};\n\nconst resolveLanguageScope = (language: string): LanguageScope | null => {\n const normalized = normalizeLanguage(language);\n if (normalized.length === 0) {\n return null;\n }\n const exact = scopeData.languages[normalized];\n if (exact !== undefined) {\n return exact;\n }\n const fallback = fallbackLanguage(normalized);\n return fallback === null ? null : (scopeData.languages[fallback] ?? null);\n};\n\nconst configuredLanguages = (config: PipelineConfig): readonly string[] => {\n if (config.languages !== undefined) {\n return config.languages;\n }\n return config.language === undefined ? [] : [config.language];\n};\n\nexport const configuredContentLanguages = (\n config: Pick<PipelineConfig, \"language\" | \"languages\">,\n): readonly string[] | undefined => {\n if (config.languages !== undefined) {\n return config.languages;\n }\n return config.language === undefined ? undefined : [config.language];\n};\n\nexport const applyPipelineLanguageScope = (\n config: PipelineConfig,\n): PipelineConfig => {\n const languages = configuredLanguages(config);\n if (languages.length === 0) {\n return config;\n }\n\n const nameCorpusLanguages: string[] = [];\n const denyListCountries: string[] = [];\n for (const language of languages) {\n const scope = resolveLanguageScope(language);\n if (scope === null) {\n continue;\n }\n uniquePush(nameCorpusLanguages, scope.nameCorpusLanguages ?? []);\n uniquePush(denyListCountries, scope.denyListCountries ?? []);\n }\n\n const next: Partial<PipelineConfig> = {};\n if (\n config.nameCorpusLanguages === undefined &&\n nameCorpusLanguages.length > 0\n ) {\n next.nameCorpusLanguages = nameCorpusLanguages;\n }\n if (config.denyListCountries === undefined && denyListCountries.length > 0) {\n next.denyListCountries = denyListCountries;\n }\n\n return Object.keys(next).length === 0 ? config : { ...config, ...next };\n};\n","// Runtime-free constants live in `./constants`; re-exported\n// here for back-compat with existing call sites that import\n// from `@stll/anonymize` directly.\n//\n// `verbatimModuleSyntax` requires an explicit type-only\n// import for any name used locally as a type even when it\n// is also re-exported below — applies to `DetectionSource`\n// (used by `Entity`) and `OperatorType` (used by\n// `OperatorConfig`).\nimport type { DetectionSource, OperatorType } from \"./constants\";\nimport { DETECTION_SOURCES } from \"./constants\";\n\nexport {\n DETECTION_SOURCES,\n DETECTOR_PRIORITY,\n type DetectionSource,\n} from \"./constants\";\n\n/**\n * Fields shared by every entity span in the source text.\n */\ntype EntityBase = {\n start: number;\n end: number;\n label: string;\n text: string;\n score: number;\n sourceDetail?: \"custom-deny-list\" | \"custom-regex\" | \"gazetteer-extension\";\n};\n\n/**\n * A PII entity span found by a primary detection layer\n * (regex, NER, legal forms, deny list, ...).\n */\nexport type DetectedEntity = EntityBase & {\n source: Exclude<DetectionSource, typeof DETECTION_SOURCES.COREFERENCE>;\n};\n\n/**\n * An alias mention of a previously detected entity: a\n * defined term (\"the Seller\") or a propagated bare\n * mention (\"Acme\" after \"Acme Corp.\").\n *\n * `corefSourceText` is required by construction, so an\n * alias cannot exist without the link back to its source\n * entity. Placeholder numbering reads it to give the\n * alias the same placeholder as the source. The link\n * travels with the entity instead of living in a\n * side-channel map that a producer could forget to\n * write — or that a later pass could clear.\n */\nexport type CorefAliasEntity = EntityBase & {\n source: typeof DETECTION_SOURCES.COREFERENCE;\n /** Full text of the source entity this alias refers to. */\n corefSourceText: string;\n};\n\n/**\n * A detected PII entity span in the source text.\n * Every detection layer produces these.\n */\nexport type Entity = DetectedEntity | CorefAliasEntity;\n\n/**\n * Entity after human review. Extends the base Entity\n * with a review decision.\n */\nexport type ReviewDecision = \"confirmed\" | \"rejected\" | \"relabeled\";\n\nexport type ReviewedEntity = Entity & {\n decision?: ReviewDecision;\n originalLabel?: string;\n};\n\n/**\n * A single entry in the workspace-scoped gazetteer\n * (deny list). Persisted in IndexedDB.\n */\nexport type GazetteerEntry = {\n id: string;\n canonical: string;\n label: string;\n variants: string[];\n workspaceId: string;\n createdAt: number;\n source: \"manual\" | \"confirmed-from-model\";\n};\n\n/** Extraction strategy — closed discriminated union. */\nexport type TriggerStrategy =\n | {\n type: \"to-next-comma\";\n /**\n * Optional list of lowercase keywords that terminate\n * the value scan, in addition to commas/newlines. Useful\n * for triggers like court names that may continue past\n * a missing comma into adjacent clause text (\"Městským\n * soudem v Praze dne 1. 1. 2020\"); listing `\"dne\"` here\n * stops the scan at the date boundary. Matched on a\n * word-boundary, case-insensitive.\n */\n stopWords?: string[];\n /**\n * Hard cap on the captured span length, in characters,\n * regardless of where the next comma / stop char sits.\n * Use for triggers that label short formulaic phrases\n * (\"State of Delaware\") and must not absorb the rest\n * of a long forum-selection clause when the comma is\n * sentences away. Falls back to the default 100-char\n * fallback when omitted.\n */\n maxLength?: number;\n }\n | { type: \"to-end-of-line\" }\n | { type: \"n-words\"; count: number }\n | { type: \"company-id-value\" }\n | { type: \"address\"; maxChars?: number }\n | {\n /**\n * Extract the first regex match in the value text.\n * Useful for shape-bounded values that follow a\n * label on the same line as other fields, where\n * `to-end-of-line` would over-capture. The pattern\n * is anchored to the start of the (already\n * leading-whitespace-stripped) value, so use\n * `(?:.*?)` prefix only when intentional.\n */\n type: \"match-pattern\";\n pattern: string;\n flags?: string;\n };\n\n/** Validation rules — closed discriminated union. */\nexport type TriggerValidation =\n | { type: \"starts-uppercase\" }\n | { type: \"min-length\"; min: number }\n | { type: \"max-length\"; max: number }\n | { type: \"no-digits\" }\n | { type: \"has-digits\" }\n | {\n type: \"matches-pattern\";\n pattern: string;\n flags?: string;\n }\n /**\n * Run a named stdnum validator (checksum + length)\n * against the captured value. Keeps the trigger\n * path symmetrical with the formatted-regex\n * detectors so e.g. `CPF nº 00000000000` does not\n * survive as a tax-ID entity.\n */\n | { type: \"valid-id\"; validator: ValidIdValidator };\n\n/** Built-in stdnum validators that can be referenced\n * by `valid-id` validations. */\nexport type ValidIdValidator = \"br.cpf\" | \"br.cnpj\" | \"us.rtn\";\n\n/** Auto-generated trigger variants — closed set. */\nexport type TriggerExtension =\n | \"add-colon\"\n | \"add-trailing-space\"\n | \"add-colon-space\"\n | \"normalize-spaces\";\n\n/** V2 trigger config entry (JSON shape). */\nexport type TriggerGroupConfig = {\n id?: string;\n triggers: string[];\n label: string;\n strategy: TriggerStrategy;\n extensions?: TriggerExtension[];\n validations?: TriggerValidation[];\n /** When true, include the trigger text in the\n * entity span (e.g., court names). */\n includeTrigger?: boolean;\n};\n\n/** Compiled validation with pre-built regex. */\nexport type CompiledValidation =\n | { type: \"starts-uppercase\"; re: RegExp }\n | { type: \"min-length\"; min: number }\n | { type: \"max-length\"; max: number }\n | { type: \"no-digits\"; re: RegExp }\n | { type: \"has-digits\"; re: RegExp }\n | { type: \"matches-pattern\"; re: RegExp }\n | {\n type: \"valid-id\";\n validator: ValidIdValidator;\n check: (value: string) => boolean;\n };\n\n/**\n * Runtime rule — one per trigger string after\n * expansion. Fed to the Aho-Corasick automaton.\n */\nexport type TriggerRule = {\n trigger: string;\n label: string;\n strategy: TriggerStrategy;\n validations: CompiledValidation[];\n includeTrigger: boolean;\n};\n\nexport {\n ENTITY_CAPABILITIES,\n ENTITY_LABELS,\n ENTITY_SELECTIONS,\n OPERATOR_TYPES,\n type DefaultEntityLabel,\n type EntityCapability,\n type EntityLabel,\n type EntitySelection,\n type OperatorType,\n} from \"./constants\";\n\n/** Per-label operator selection. Key is the entity label. */\nexport type MaskDirection = \"start\" | \"end\";\n\nexport type MaskOperatorConfig = {\n type: \"mask\";\n maskingCharacter: string;\n charactersToMask: number;\n direction: MaskDirection;\n};\n\nexport type OperatorSelection =\n | Exclude<OperatorType, \"mask\">\n | MaskOperatorConfig;\n\nexport type OperatorConfig = {\n /** Operator per label. Missing labels default to \"replace\". */\n operators: Record<string, OperatorSelection>;\n /** Custom replacement string for the redact operator. */\n redactString: string;\n};\n\n/** Whether an operator produces a reversible redaction entry. */\ntype OperatorReversibility = \"reversible\" | \"irreversible\" | \"preserving\";\n\nexport type AnonymisationOperator = {\n type: OperatorType;\n reversibility: OperatorReversibility;\n /**\n * Apply the operator to a single entity occurrence.\n * Returns the replacement string to embed in the document.\n */\n apply: (\n text: string,\n label: string,\n placeholder: string,\n redactString: string,\n selection: OperatorSelection,\n ) => string;\n};\n\n/**\n * Redacted document output with stable entity mapping.\n */\nexport type RedactionResult = {\n redactedText: string;\n /**\n * Maps placeholder to original text. Only populated for\n * reversible operators (replace). Empty for redact, keep, and mask.\n */\n redactionMap: Map<string, string>;\n /** Maps placeholder to the operator that produced it. */\n operatorMap: Map<string, OperatorType>;\n entityCount: number;\n};\n\n/**\n * Configuration for the detection pipeline.\n */\nexport type DenyListCategory =\n | \"Names\"\n | \"Places\"\n | \"Addresses\"\n | \"Courts\"\n | \"Financial\"\n | \"Government\"\n | \"Healthcare\"\n | \"Education\"\n | \"Political\"\n | \"Organizations\"\n | \"International\";\n\n/**\n * Metadata for a single dictionary entry in the\n * deny-list system. Mirrors the shape from\n * the anonymize-data package so consumers can pass\n * pre-loaded data without a runtime dependency.\n */\nexport type DictionaryMeta = {\n label: string;\n category: DenyListCategory;\n country: string | null;\n};\n\n/**\n * Caller-supplied exact terms for deny-list matching.\n * These entries are merged with the published deny-list\n * dictionaries when `enableDenyList` is enabled.\n */\nexport type CustomDenyListEntry = {\n value: string;\n label: string;\n variants?: readonly string[];\n};\n\n/**\n * Caller-supplied regex detector. The pattern is passed\n * to the native Rust regex engine, so use its supported\n * regex syntax. Inline flags such as `(?i)` are accepted\n * when supported by that engine.\n */\nexport type CustomRegexPattern = {\n pattern: string;\n label: string;\n score?: number;\n preparedArtifactPolicy?: \"include\" | \"omit\";\n};\n\n/**\n * Pre-loaded dictionary data for dependency injection.\n * Consumers that want name/city/deny-list detection\n * load dictionaries themselves (e.g. from the\n * anonymize-data package) and pass them here; the\n * anonymize package has zero cross-package imports.\n *\n * All fields are optional. When a field is absent,\n * the corresponding detection path is skipped (same\n * behavior as when no dictionaries are available).\n */\nexport type Dictionaries = {\n /**\n * First names per language code (e.g., \"cs\", \"de\").\n */\n firstNames?: Readonly<Record<string, readonly string[]>>;\n /**\n * Surnames per language code.\n */\n surnames?: Readonly<Record<string, readonly string[]>>;\n /**\n * Non-Western name tokens per locale code\n * (e.g., \"in\", \"ar\", \"ja-latn\", \"ko\", \"zh-latn\",\n * \"th\", \"vi\", \"fil\", \"id\"). Merged with bundled\n * names-nw-*.json data at init time.\n */\n nonWesternNames?: Readonly<Record<string, readonly string[]>>;\n /**\n * Pre-loaded deny-list dictionaries keyed by\n * dictionary ID (e.g., \"courts/CZ\", \"banks/DE\").\n * Each value is the array of terms for that\n * dictionary.\n */\n denyList?: Readonly<Record<string, readonly string[]>>;\n /**\n * Metadata per dictionary ID. Required when\n * `denyList` is provided so the pipeline knows\n * labels, categories, and country filters.\n */\n denyListMeta?: Readonly<Record<string, DictionaryMeta>>;\n /**\n * Pre-loaded city names, already merged across\n * all desired countries.\n *\n * Prefer `citiesByCountry` when callers also pass\n * `denyListCountries` / `denyListRegions`; merged\n * city arrays cannot be scoped after injection.\n */\n cities?: readonly string[];\n /**\n * Pre-loaded city names keyed by ISO 3166-1 alpha-2\n * country code. When provided, the deny-list builder\n * applies `denyListCountries` / `denyListRegions`\n * before adding city patterns to the search automaton.\n */\n citiesByCountry?: Readonly<Record<string, readonly string[]>>;\n};\n\nexport type PipelineConfig = {\n threshold: number;\n enableTriggerPhrases: boolean;\n enableRegex: boolean;\n /**\n * Expected content language codes. When present, these\n * derive default dictionary scopes for name corpus and\n * deny-list matching unless the lower-level scope fields\n * below are set explicitly.\n */\n languages?: string[];\n /**\n * Convenience form for single-language documents. Ignored\n * when `languages` is also provided.\n */\n language?: string;\n /**\n * Enables legal-form organization detection.\n * Required for typed callers; legacy untyped\n * callers that omit this field are treated as\n * enabled at runtime for backward compatibility.\n */\n enableLegalForms: boolean;\n /**\n * Enables first-name/surname/title corpus matching.\n * When deny-list mode is enabled, this also controls\n * whether name-corpus entries are injected into the\n * deny-list search automaton.\n */\n enableNameCorpus: boolean;\n /**\n * Optional language scope for first-name/surname\n * dictionaries, using the keys present in\n * `dictionaries.firstNames` / `dictionaries.surnames`\n * (for example `[\"en\", \"de\"]`). When omitted, all\n * injected name languages are used for backward\n * compatibility.\n */\n nameCorpusLanguages?: string[];\n enableDenyList: boolean;\n denyListCountries?: string[];\n denyListRegions?: string[];\n denyListExcludeCategories?: string[];\n /**\n * Caller-owned exact terms to match through the\n * deny-list layer. Requires `enableDenyList: true`.\n */\n customDenyList?: readonly CustomDenyListEntry[];\n /**\n * Caller-owned regex detectors. Requires\n * `enableRegex: true`.\n */\n customRegexes?: readonly CustomRegexPattern[];\n enableGazetteer: boolean;\n /**\n * Detect country names (ISO 3166-1 names, curated\n * aliases, alpha-3 codes). Defaults to true. Names\n * span all manifest languages plus widely-used\n * additions (Dutch, Russian, Chinese, Arabic, etc.).\n */\n enableCountries?: boolean;\n enableConfidenceBoost: boolean;\n enableCoreference: boolean;\n enableZoneClassification?: boolean;\n enableHotwordRules?: boolean;\n /**\n * Requested output labels. An empty array means\n * \"do not filter by label\" for deterministic detectors.\n */\n labels: string[];\n workspaceId: string;\n /**\n * Pre-loaded dictionary data for name, deny-list,\n * and city detection. When omitted, dictionary-based\n * detection paths are skipped. Consumers load from\n * the anonymize-data package and pass the data here.\n */\n dictionaries?: Dictionaries;\n};\n\nexport { DEFAULT_ENTITY_LABELS } from \"./constants\";\n\nexport const isLegalFormsEnabled = (\n config: Pick<PipelineConfig, \"enableLegalForms\">,\n): boolean => config.enableLegalForms !== false;\n","const normalizeLanguageCode = (language: string): string =>\n language.trim().toLowerCase();\n\nconst normalizeLanguageSelection = (\n languages: readonly string[] | undefined,\n): string[] =>\n languages === undefined\n ? []\n : languages\n .map(normalizeLanguageCode)\n .filter((language) => language.length > 0);\n\nexport const languageSelectionKey = (\n languages: readonly string[] | undefined,\n): string => {\n const normalized = normalizeLanguageSelection(languages).toSorted();\n return normalized.length === 0 ? \"*\" : normalized.join(\",\");\n};\n\nconst baseLanguage = (language: string): string => {\n const index = language.indexOf(\"-\");\n return index === -1 ? language : language.slice(0, index);\n};\n\nexport const languageConfigMatches = (\n configLanguage: string,\n selectedLanguages: readonly string[] | undefined,\n): boolean => {\n if (selectedLanguages === undefined || selectedLanguages.length === 0) {\n return true;\n }\n const normalizedSelectedLanguages =\n normalizeLanguageSelection(selectedLanguages);\n if (normalizedSelectedLanguages.length === 0) {\n return true;\n }\n\n const normalizedConfigLanguage = normalizeLanguageCode(configLanguage);\n if (normalizedConfigLanguage.length === 0) {\n return false;\n }\n\n const genericConfig =\n baseLanguage(normalizedConfigLanguage) === normalizedConfigLanguage;\n for (const normalizedLanguage of normalizedSelectedLanguages) {\n if (normalizedLanguage === normalizedConfigLanguage) {\n return true;\n }\n if (\n genericConfig &&\n baseLanguage(normalizedLanguage) === normalizedConfigLanguage\n ) {\n return true;\n }\n }\n\n return false;\n};\n","import {\n isLegalFormsEnabled,\n type GazetteerEntry,\n type PipelineConfig,\n} from \"./types\";\nimport { languageSelectionKey } from \"./util/language-selection\";\n\nconst DEFAULT_CUSTOM_REGEX_SCORE = 0.9;\n\nconst contentLanguageFingerprint = (\n config: Pick<PipelineConfig, \"language\" | \"languages\">,\n): string => {\n const languages =\n config.languages ??\n (config.language === undefined ? [] : [config.language]);\n return languageSelectionKey(languages);\n};\n\nexport const pipelineConfigKey = (\n config: PipelineConfig,\n gazetteerEntries: readonly GazetteerEntry[],\n): string => {\n const legalFormsEnabled = isLegalFormsEnabled(config);\n const customDenyFingerprint =\n config.enableDenyList && config.customDenyList\n ? config.customDenyList\n .map((entry) =>\n JSON.stringify({\n label: entry.label,\n value: entry.value,\n variants: [...(entry.variants ?? [])].sort(),\n }),\n )\n .sort()\n .join(\"\\n\")\n : \"\";\n const customRegexFingerprint =\n config.enableRegex && config.customRegexes\n ? config.customRegexes\n .map((entry) =>\n JSON.stringify({\n label: entry.label,\n pattern: entry.pattern,\n preparedArtifactPolicy: entry.preparedArtifactPolicy ?? null,\n score: entry.score ?? DEFAULT_CUSTOM_REGEX_SCORE,\n }),\n )\n .sort()\n .join(\"\\n\")\n : \"\";\n const gazFingerprint =\n config.enableGazetteer && gazetteerEntries.length > 0\n ? gazetteerEntries\n .map(\n (entry) =>\n `${entry.id}:${entry.canonical}:${entry.label}:${[\n ...entry.variants,\n ]\n .sort()\n .join(\",\")}`,\n )\n .toSorted()\n .join(\";\")\n : \"\";\n\n return (\n `${config.enableDenyList}:` +\n `${config.enableTriggerPhrases}:` +\n `${legalFormsEnabled}:` +\n `${config.enableNameCorpus}:` +\n `${contentLanguageFingerprint(config)}:` +\n `${config.nameCorpusLanguages?.toSorted().join(\",\") ?? \"\"}:` +\n `${config.enableRegex}:` +\n `${config.threshold}:` +\n `${config.enableConfidenceBoost}:` +\n `${config.enableHotwordRules === true}:` +\n `${config.enableCoreference === true}:` +\n `${config.enableZoneClassification === true}:` +\n `${config.labels.toSorted().join(\",\")}:` +\n `${config.denyListCountries?.toSorted().join(\",\") ?? \"\"}:` +\n `${config.denyListRegions?.toSorted().join(\",\") ?? \"\"}:` +\n `${config.denyListExcludeCategories?.toSorted().join(\",\") ?? \"\"}:` +\n `${customDenyFingerprint}:` +\n `${customRegexFingerprint}:` +\n `${config.enableGazetteer}:${gazFingerprint}:` +\n `${config.enableCountries !== false}`\n );\n};\n","import type { PipelineContext } from \"./context\";\nimport { defaultContext } from \"./context\";\nimport { applyPipelineLanguageScope } from \"./language-scope\";\nimport type { NativePreparedSearchConfig } from \"./native-search-config\";\nimport { pipelineConfigKey } from \"./pipeline-cache-key\";\nimport type { Dictionaries, GazetteerEntry, PipelineConfig } from \"./types\";\nimport {\n createNativePipelineFromPackage,\n PreparedNativePipeline,\n type NativeAnonymizeBinding,\n} from \"./native\";\n\nexport {\n PreparedNativePipeline,\n createNativePipelineFromPackage,\n} from \"./native\";\n\nexport type NativePipelineUnsupportedFeature = \"enableNer\";\n\nexport type NativePipelineCompatibility =\n | { status: \"supported\" }\n | {\n status: \"unsupported\";\n unsupportedFeatures: NativePipelineUnsupportedFeature[];\n };\n\nexport type NativePipelineBuildOptions = {\n binding: NativeAnonymizeBinding;\n config: PipelineConfig;\n gazetteerEntries?: GazetteerEntry[];\n context?: PipelineContext;\n};\n\nexport type NativePipelinePackageOptions = NativePipelineBuildOptions & {\n compressed?: boolean;\n};\n\nexport type { NativePipelineFromPackageOptions } from \"./native\";\n\ntype NativePipelinePackageCacheValue = Promise<Uint8Array> | Uint8Array;\n\n// Bounds each shared package cache (the dictionary-less bucket below, and\n// each per-`Dictionaries` bucket handed out by `sharedPackageCacheFor`) to a\n// fixed number of entries. `nativePackageCacheKey` fingerprints\n// caller-suppliable config (custom deny lists, custom regexes, gazetteer\n// entries) via `pipelineConfigKey`, so without a cap a caller that varies\n// those fields grows a bucket — and the multi-MB assembled packages it\n// holds — without limit.\nexport const SHARED_PACKAGE_CACHE_MAX_ENTRIES = 32;\n\nconst sharedPackageByDictionaries = new WeakMap<\n Dictionaries,\n Map<string, NativePipelinePackageCacheValue>\n>();\nconst sharedPackageWithoutDictionaries = new Map<\n string,\n NativePipelinePackageCacheValue\n>();\nconst dictionaryCacheIds = new WeakMap<Dictionaries, number>();\nlet nextDictionaryCacheId = 0;\n\n/** Record `key` as most-recently-used in `cache`, evicting the\n * least-recently-used entry first once the cache is at capacity. A `Map`'s\n * insertion order doubles as recency order here: touching an existing key\n * deletes then re-sets it to move it to the end, and eviction drops the\n * first (oldest) key.\n *\n * Evicting a still-in-flight build only drops the cache's reference to its\n * promise; the caller that started the build (and any concurrent caller that\n * already read the promise before eviction) still resolves it correctly via\n * the guarded `sharedCache.get(key) === promise` checks in\n * `getCachedNativePipelinePackage`. A later caller for the same key just\n * misses the dedupe and starts a fresh build — bounded memory takes priority\n * over perfect dedupe under cache pressure. */\nconst touchSharedPackageCacheEntry = (\n cache: Map<string, NativePipelinePackageCacheValue>,\n key: string,\n value: NativePipelinePackageCacheValue,\n): void => {\n cache.delete(key);\n if (cache.size >= SHARED_PACKAGE_CACHE_MAX_ENTRIES) {\n const oldestKey = cache.keys().next().value;\n if (oldestKey !== undefined) {\n cache.delete(oldestKey);\n }\n }\n cache.set(key, value);\n};\n\nconst dictionaryCacheKey = (dictionaries: Dictionaries | undefined): string => {\n if (dictionaries === undefined) {\n return \"none\";\n }\n const existing = dictionaryCacheIds.get(dictionaries);\n if (existing !== undefined) {\n return `dict:${existing}`;\n }\n nextDictionaryCacheId += 1;\n dictionaryCacheIds.set(dictionaries, nextDictionaryCacheId);\n return `dict:${nextDictionaryCacheId}`;\n};\n\nconst sharedPackageCacheFor = (\n dictionaries: Dictionaries | undefined,\n): Map<string, NativePipelinePackageCacheValue> => {\n if (dictionaries === undefined) {\n return sharedPackageWithoutDictionaries;\n }\n const cached = sharedPackageByDictionaries.get(dictionaries);\n if (cached !== undefined) {\n return cached;\n }\n const created = new Map<string, NativePipelinePackageCacheValue>();\n sharedPackageByDictionaries.set(dictionaries, created);\n return created;\n};\n\nexport const getNativePipelineCompatibility = (\n config: PipelineConfig,\n): NativePipelineCompatibility => {\n const unsupportedFeatures: NativePipelineUnsupportedFeature[] = [];\n\n // `enableNer` is no longer part of `PipelineConfig`; untyped callers that\n // still request it (any truthy value, e.g. `1` or `\"true\"` from loose\n // JSON) must fail fast instead of silently losing NER spans.\n if (\"enableNer\" in config && Boolean(config.enableNer)) {\n unsupportedFeatures.push(\"enableNer\");\n }\n if (unsupportedFeatures.length === 0) {\n return { status: \"supported\" };\n }\n return { status: \"unsupported\", unsupportedFeatures };\n};\n\nexport const assertNativePipelineSupported = (config: PipelineConfig): void => {\n const compatibility = getNativePipelineCompatibility(config);\n if (compatibility.status === \"supported\") {\n return;\n }\n throw new Error(\n `Native pipeline does not yet support: ${compatibility.unsupportedFeatures.join(\", \")}`,\n );\n};\n\nconst encoder = new TextEncoder();\n\ntype AssembleInputs = {\n pipelineConfigJson: Uint8Array;\n dictionariesJson: Uint8Array | undefined;\n gazetteerJson: Uint8Array | undefined;\n};\n\n/**\n * Serialize the assembler inputs the Rust binding expects. Dictionaries are\n * stripped from the pipeline config and passed out of band: the assembler reads\n * the separate bundle preferentially, and keeping the (large) dictionaries out\n * of the config JSON avoids serializing them twice.\n */\nconst toAssembleInputs = (\n { dictionaries, ...config }: PipelineConfig,\n gazetteerEntries: readonly GazetteerEntry[],\n): AssembleInputs => ({\n pipelineConfigJson: encoder.encode(JSON.stringify(config)),\n dictionariesJson:\n dictionaries === undefined\n ? undefined\n : encoder.encode(JSON.stringify(dictionaries)),\n gazetteerJson:\n gazetteerEntries.length === 0\n ? undefined\n : encoder.encode(JSON.stringify(gazetteerEntries)),\n});\n\nconst assemblePackageBytes = (\n binding: NativeAnonymizeBinding,\n { pipelineConfigJson, dictionariesJson, gazetteerJson }: AssembleInputs,\n compressed: boolean,\n): Uint8Array => {\n const assemble = compressed\n ? binding.assembleStaticSearchCompressedPackageBytes\n : binding.assembleStaticSearchPackageBytes;\n if (assemble === undefined) {\n throw new Error(\n \"Native anonymize binding does not support static-search config assembly\",\n );\n }\n return assemble(pipelineConfigJson, dictionariesJson, gazetteerJson);\n};\n\nexport const prepareNativePipelineConfig = async ({\n binding,\n config,\n gazetteerEntries = [],\n}: Omit<\n NativePipelineBuildOptions,\n \"context\"\n>): Promise<NativePreparedSearchConfig> => {\n const scopedConfig = applyPipelineLanguageScope(config);\n assertNativePipelineSupported(scopedConfig);\n const assemble = binding.assembleStaticSearchConfigJson;\n if (assemble === undefined) {\n throw new Error(\n \"Native anonymize binding does not support static-search config assembly\",\n );\n }\n const { pipelineConfigJson, dictionariesJson, gazetteerJson } =\n toAssembleInputs(scopedConfig, gazetteerEntries);\n const configJson = assemble(\n pipelineConfigJson,\n dictionariesJson,\n gazetteerJson,\n );\n return JSON.parse(new TextDecoder().decode(configJson));\n};\n\nexport const prepareNativePipelinePackage = async ({\n binding,\n config,\n gazetteerEntries = [],\n context,\n compressed = false,\n}: NativePipelinePackageOptions): Promise<Uint8Array> => {\n const packageBytes = await getCachedNativePipelinePackage({\n config,\n binding,\n gazetteerEntries,\n ...(context ? { context } : {}),\n compressed,\n });\n // Return a genuine copy: with the real NAPI binding packageBytes is a Node\n // Buffer, and Buffer.prototype.slice() yields a memory-sharing view, so a\n // caller mutating it would corrupt the shared cache and ctx.nativePipelinePackage.\n return new Uint8Array(packageBytes);\n};\n\nexport const createNativePipelineFromConfig = async ({\n binding,\n config,\n gazetteerEntries = [],\n context,\n}: NativePipelineBuildOptions): Promise<PreparedNativePipeline> => {\n const packageBytes = await getCachedNativePipelinePackage({\n binding,\n config,\n gazetteerEntries,\n ...(context ? { context } : {}),\n });\n return createNativePipelineFromPackage({ binding, packageBytes });\n};\n\nconst getCachedNativePipelinePackage = async ({\n binding,\n config,\n gazetteerEntries = [],\n context,\n compressed = false,\n}: NativePipelinePackageOptions): Promise<Uint8Array> => {\n const scopedConfig = applyPipelineLanguageScope(config);\n assertNativePipelineSupported(scopedConfig);\n const ctx = context ?? defaultContext;\n const key = nativePackageCacheKey({\n binding,\n config: scopedConfig,\n gazetteerEntries,\n compressed,\n });\n if (ctx.nativePipelinePackage && ctx.nativePipelinePackageKey === key) {\n return ctx.nativePipelinePackage;\n }\n if (\n ctx.nativePipelinePackagePromise &&\n ctx.nativePipelinePackageKey === key\n ) {\n return ctx.nativePipelinePackagePromise;\n }\n\n const sharedCache = sharedPackageCacheFor(scopedConfig.dictionaries);\n const shared = sharedCache.get(key);\n if (shared !== undefined) {\n touchSharedPackageCacheEntry(sharedCache, key, shared);\n const packageBytes = await shared;\n ctx.nativePipelinePackage = packageBytes;\n ctx.nativePipelinePackageKey = key;\n ctx.nativePipelinePackagePromise = null;\n return packageBytes;\n }\n\n ctx.nativePipelinePackage = null;\n ctx.nativePipelinePackageKey = key;\n const promise = buildNativePipelinePackage({\n binding,\n config: scopedConfig,\n gazetteerEntries,\n compressed,\n });\n ctx.nativePipelinePackagePromise = promise;\n touchSharedPackageCacheEntry(sharedCache, key, promise);\n let packageBytes: Uint8Array;\n try {\n packageBytes = await promise;\n } catch (error) {\n if (sharedCache.get(key) === promise) {\n sharedCache.delete(key);\n }\n if (\n ctx.nativePipelinePackageKey === key &&\n ctx.nativePipelinePackagePromise === promise\n ) {\n ctx.nativePipelinePackage = null;\n ctx.nativePipelinePackagePromise = null;\n }\n throw error;\n }\n if (sharedCache.get(key) === promise) {\n sharedCache.set(key, packageBytes);\n }\n if (ctx.nativePipelinePackageKey === key) {\n ctx.nativePipelinePackage = packageBytes;\n ctx.nativePipelinePackagePromise = null;\n }\n return packageBytes;\n};\n\n// `async` so the shared package cache can store the in-flight value and dedupe\n// concurrent builds for the same key, and so assembly failures (an older\n// binding without the assemble functions, or a config the assembler rejects)\n// surface as a rejected promise rather than a synchronous throw mid-cache-flow.\nconst buildNativePipelinePackage = async ({\n binding,\n config,\n gazetteerEntries,\n compressed,\n}: Required<\n Omit<NativePipelinePackageOptions, \"context\">\n>): Promise<Uint8Array> =>\n assemblePackageBytes(\n binding,\n toAssembleInputs(config, gazetteerEntries),\n compressed,\n );\n\ntype NativePackageCacheKeyOptions = {\n binding: NativeAnonymizeBinding;\n config: PipelineConfig;\n gazetteerEntries: readonly GazetteerEntry[];\n compressed: boolean;\n};\n\nconst nativePackageCacheKey = ({\n binding,\n config,\n gazetteerEntries,\n compressed,\n}: NativePackageCacheKeyOptions): string =>\n [\n binding.nativePackageVersion(),\n compressed ? \"compressed\" : \"raw\",\n dictionaryCacheKey(config.dictionaries),\n pipelineConfigKey(config, gazetteerEntries),\n ].join(\":\");\n","import { DEFAULT_ENTITY_LABELS } from \"./constants\";\nimport type { PipelineConfig } from \"./types\";\n\nexport const DEFAULT_NATIVE_PIPELINE_CONFIG: PipelineConfig = {\n threshold: 0.3,\n enableTriggerPhrases: true,\n enableRegex: true,\n enableLegalForms: true,\n enableNameCorpus: true,\n enableDenyList: true,\n enableGazetteer: false,\n enableCountries: true,\n enableConfidenceBoost: true,\n enableCoreference: true,\n enableHotwordRules: true,\n enableZoneClassification: true,\n labels: [...DEFAULT_ENTITY_LABELS],\n workspaceId: \"native-pipeline-default\",\n};\n","import { createRequire } from \"node:module\";\nimport { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport process from \"node:process\";\n\nimport {\n assertNativeBindingVersion,\n createNativePipelineFromPackage,\n type NativeOperatorConfig,\n type NativeAnonymizeBinding,\n type NativeNormalizeOptions,\n type NativeSearchPackageInput,\n PreparedNativeAnonymizer,\n PreparedNativePipeline,\n type NativeStaticRedactionResult,\n diagnostics_json as diagnosticsJsonWithBinding,\n convert_external_detection_batch as convertExternalDetectionBatchWithBinding,\n diagnostics_stream_json as diagnosticsStreamJsonWithBinding,\n load_prepared_package as loadPreparedPackageWithBinding,\n native_package_version as nativePackageVersionWithBinding,\n normalize_for_search as normalizeForSearchWithBinding,\n prepare_search_package as prepareSearchPackageWithBinding,\n redact_text as redactTextWithBinding,\n redact_text_json as redactTextJsonWithBinding,\n redact_text_stream_json as redactTextStreamJsonWithBinding,\n summary_diagnostics_json as summaryDiagnosticsJsonWithBinding,\n} from \"./native\";\n\nexport * from \"./native\";\nexport {\n assertNativePipelineSupported,\n createNativePipelineFromConfig,\n getNativePipelineCompatibility,\n prepareNativePipelineConfig,\n prepareNativePipelinePackage,\n} from \"./native-pipeline\";\nexport type {\n NativePipelineBuildOptions,\n NativePipelineCompatibility,\n NativePipelinePackageOptions,\n NativePipelineUnsupportedFeature,\n} from \"./native-pipeline\";\n\nexport type NativeRequire = (specifier: string) => unknown;\n\nexport type NativeLibc = \"gnu\" | \"musl\";\n\nexport type LoadNativeBindingOptions = {\n expectedVersion?: string;\n platform?: string;\n arch?: string;\n libc?: NativeLibc;\n env?: Record<string, string | undefined>;\n requireModule?: NativeRequire;\n};\n\nexport type NativePipelinePackageFileOptions = LoadNativeBindingOptions & {\n binding?: NativeAnonymizeBinding;\n packagePath: string;\n};\n\nexport type NativeSdkOptions = LoadNativeBindingOptions & {\n binding?: NativeAnonymizeBinding;\n};\n\nexport type NativeSdkPackageOptions = NativeSdkOptions & {\n compressed?: boolean;\n};\n\nexport type DefaultNativePipelinePackageOptions = LoadNativeBindingOptions & {\n binding?: NativeAnonymizeBinding;\n language?: string;\n packagePath?: string;\n warmup?: DefaultNativePipelineWarmup;\n};\n\ntype ResolvedDefaultNativePipelineOptions = {\n binding: NativeAnonymizeBinding;\n language?: string;\n packagePath?: string;\n warmup: DefaultNativePipelineWarmup;\n};\n\nexport const DEFAULT_NATIVE_PIPELINE_WARMUPS = {\n lazyRegex: \"lazy-regex\",\n none: \"none\",\n} as const;\n\nexport type DefaultNativePipelineWarmup =\n (typeof DEFAULT_NATIVE_PIPELINE_WARMUPS)[keyof typeof DEFAULT_NATIVE_PIPELINE_WARMUPS];\n\nexport type DefaultNativePipelinePackageFileOptions = {\n language?: string;\n};\n\nconst LOCAL_NATIVE_LOADER = \"../index.cjs\";\nconst PACKAGE_SPECIFIC_NATIVE_PATH = \"STELLA_ANONYMIZE_NATIVE_LIBRARY_PATH\";\nconst DEFAULT_NATIVE_PIPELINE_PACKAGE_URL = new URL(\n \"../native-pipeline.stlanonpkg\",\n import.meta.url,\n);\nconst DEFAULT_NATIVE_PIPELINE_PACKAGE_DIR_URL = new URL(\"../\", import.meta.url);\nconst DEFAULT_NATIVE_PIPELINE_LANGUAGE_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\nconst DEFAULT_NATIVE_PIPELINE_LANGUAGE_PACKAGE_PATTERN =\n /^native-pipeline\\.([a-z0-9]+(?:-[a-z0-9]+)*)\\.stlanonpkg$/u;\nconst DEFAULT_NATIVE_PIPELINE_PACKAGE_CACHE_KEY = \"<default>\";\nconst defaultNativePipelineCache = new WeakMap<\n NativeAnonymizeBinding,\n Map<string, PreparedNativePipeline>\n>();\nconst warmedDefaultNativePipelines = new WeakSet<PreparedNativePipeline>();\nconst defaultNativePipelineInflightCache = new WeakMap<\n NativeAnonymizeBinding,\n Map<string, Promise<PreparedNativePipeline>>\n>();\n\nexport { DEFAULT_NATIVE_PIPELINE_CONFIG } from \"./native-default-config\";\n\n/**\n * A binding installed by the runtime layer to override the NAPI loader. Used to\n * route every `loadNativeAnonymizeBinding()` caller (including the docx and pdf\n * packages, which load the binding inline) to the portable wasm binding under\n * Bun, where the NAPI addon cannot run. Undefined on Node, so the NAPI path is\n * unaffected. See `native-runtime.ts` (`preloadNativeBinding`).\n */\nlet nativeBindingOverride: NativeAnonymizeBinding | undefined;\n\nexport const setNativeBindingOverride = (\n binding: NativeAnonymizeBinding | undefined,\n): void => {\n nativeBindingOverride = binding;\n};\n\nexport const loadNativeAnonymizeBinding = (\n options: LoadNativeBindingOptions = {},\n): NativeAnonymizeBinding => {\n if (nativeBindingOverride !== undefined) {\n if (options.expectedVersion !== undefined) {\n assertNativeBindingVersion({\n binding: nativeBindingOverride,\n expectedVersion: options.expectedVersion,\n });\n }\n return nativeBindingOverride;\n }\n const requireModule = options.requireModule ?? createRequire(import.meta.url);\n const platform = options.platform ?? process.platform;\n const arch = options.arch ?? process.arch;\n const libc = options.libc ?? detectNativeLibc(platform);\n const env = options.env ?? process.env;\n const specifiers = nativeBindingSpecifiers({ arch, env, libc, platform });\n const errors: string[] = [];\n\n for (const specifier of specifiers) {\n const binding = tryLoadNativeBinding({\n specifier,\n requireModule,\n errors,\n });\n if (!binding) {\n continue;\n }\n if (options.expectedVersion !== undefined) {\n assertNativeBindingVersion({\n binding,\n expectedVersion: options.expectedVersion,\n });\n }\n return binding;\n }\n\n if (nativeBindingPackageName({ arch, libc, platform }) === null) {\n throw unsupportedNativeTargetError({ arch, errors, libc, platform });\n }\n throw new Error(\n `Unable to load native anonymize binding for ${platform}/${arch}:\\n${errors.join(\"\\n\")}`,\n );\n};\n\nexport const readNativePipelinePackageFile = (\n packagePath: string,\n): Uint8Array => readFileSync(packagePath);\n\nexport const readNativePipelinePackageFileAsync = async (\n packagePath: string,\n): Promise<Uint8Array> => readFile(packagePath);\n\nexport const native_package_version = (\n options: NativeSdkOptions = {},\n): string => nativePackageVersionWithBinding(resolveNativeSdkBinding(options));\n\nexport const convert_external_detection_batch = (\n document: Uint8Array,\n batch: import(\"./native\").ExternalDetectionBatch | string,\n options: NativeSdkOptions = {},\n): import(\"./native\").NativeCallerDetection[] =>\n convertExternalDetectionBatchWithBinding({\n binding: resolveNativeSdkBinding(options),\n document,\n batch,\n });\n\nexport const normalize_for_search = (\n text: string,\n options: NativeSdkOptions = {},\n): string => {\n const args: NativeNormalizeOptions = {\n binding: resolveNativeSdkBinding(options),\n text,\n };\n return normalizeForSearchWithBinding(args);\n};\n\nexport const prepare_search_package = (\n config: NativeSearchPackageInput,\n { compressed = false, ...options }: NativeSdkPackageOptions = {},\n): Uint8Array =>\n prepareSearchPackageWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n compressed,\n });\n\nexport const load_prepared_package = (\n packageBytes: Uint8Array,\n options: NativeSdkOptions = {},\n) =>\n loadPreparedPackageWithBinding({\n binding: resolveNativeSdkBinding(options),\n packageBytes,\n });\n\nexport const load_prepared_package_file = (\n packagePath: string,\n options: NativeSdkOptions = {},\n) => load_prepared_package(readNativePipelinePackageFile(packagePath), options);\n\nexport const redact_text = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): NativeStaticRedactionResult =>\n redactTextWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const redact_text_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string =>\n redactTextJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const redact_text_stream_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n onEvent: (eventJson: string) => void,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n redactTextStreamJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n onEvent,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const diagnostics_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n diagnosticsJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const diagnostics_stream_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n onBatch: (diagnosticsJson: string) => void,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n diagnosticsStreamJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n onBatch,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const summary_diagnostics_json = (\n config: NativeSearchPackageInput,\n fullText: string,\n operators?: NativeOperatorConfig,\n options: NativeSdkOptions = {},\n): string | null =>\n summaryDiagnosticsJsonWithBinding({\n binding: resolveNativeSdkBinding(options),\n config,\n fullText,\n ...(operators !== undefined ? { operators } : {}),\n });\n\nexport const readDefaultNativePipelinePackageFile = ({\n language,\n}: DefaultNativePipelinePackageFileOptions = {}): Uint8Array => {\n const packageUrl = defaultNativePipelinePackageUrl(language);\n try {\n return readFileSync(packageUrl);\n } catch (error) {\n throw new Error(\n `${defaultNativePipelinePackageDescription(language)} is unavailable: ${formatLoadError(error)}`,\n );\n }\n};\n\nexport const read_default_native_pipeline_package_file = (\n options: DefaultNativePipelinePackageFileOptions = {},\n): Uint8Array => readDefaultNativePipelinePackageFile(options);\n\nexport const availableDefaultNativePipelineLanguages = (): string[] => {\n const languages = new Set<string>();\n try {\n for (const fileName of readdirSync(\n DEFAULT_NATIVE_PIPELINE_PACKAGE_DIR_URL,\n )) {\n const match = fileName.match(\n DEFAULT_NATIVE_PIPELINE_LANGUAGE_PACKAGE_PATTERN,\n );\n if (match?.[1] !== undefined) {\n languages.add(match[1]);\n }\n }\n } catch (error) {\n throw new Error(\n `Default native pipeline package directory is unavailable: ${formatLoadError(error)}`,\n );\n }\n return [...languages].toSorted();\n};\n\nexport const available_default_native_pipeline_languages =\n availableDefaultNativePipelineLanguages;\n\nexport const readDefaultNativePipelinePackageFileAsync = async ({\n language,\n}: DefaultNativePipelinePackageFileOptions = {}): Promise<Uint8Array> => {\n const packageUrl = defaultNativePipelinePackageUrl(language);\n try {\n return await readFile(packageUrl);\n } catch (error) {\n throw new Error(\n `${defaultNativePipelinePackageDescription(language)} is unavailable: ${formatLoadError(error)}`,\n );\n }\n};\n\nexport const createNativePipelineFromPackageFile = ({\n binding,\n packagePath,\n expectedVersion,\n ...loadOptions\n}: NativePipelinePackageFileOptions): PreparedNativePipeline => {\n const resolvedBinding =\n binding ??\n loadNativeAnonymizeBinding({\n ...loadOptions,\n ...(expectedVersion !== undefined ? { expectedVersion } : {}),\n });\n if (binding && expectedVersion !== undefined) {\n assertNativeBindingVersion({ binding, expectedVersion });\n }\n return createNativePipelineFromPackage({\n binding: resolvedBinding,\n packageBytes: readNativePipelinePackageFile(packagePath),\n });\n};\n\nexport const createNativePipelineFromDefaultPackage = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => {\n const resolvedOptions = resolveDefaultNativePipelineOptions(options);\n return applyDefaultNativePipelineWarmup(\n createNativePipelineFromResolvedDefaultPackage(resolvedOptions),\n resolvedOptions.warmup,\n );\n};\n\nexport const create_native_pipeline_from_default_package = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => createNativePipelineFromDefaultPackage(options);\n\nexport const getDefaultNativePipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => {\n const resolvedOptions = resolveDefaultNativePipelineOptions(options);\n const cache = defaultPipelineCacheFor(resolvedOptions.binding);\n const key = defaultPipelineCacheKey(resolvedOptions);\n const cached = cache.get(key);\n if (cached !== undefined) {\n return applyDefaultNativePipelineWarmup(cached, resolvedOptions.warmup);\n }\n const pipeline =\n createNativePipelineFromResolvedDefaultPackage(resolvedOptions);\n cache.set(key, pipeline);\n return applyDefaultNativePipelineWarmup(pipeline, resolvedOptions.warmup);\n};\n\nexport const get_default_native_pipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => getDefaultNativePipeline(options);\n\nexport const preloadDefaultNativePipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => {\n const pipeline = getDefaultNativePipeline(options);\n return applyDefaultNativePipelineWarmup(\n pipeline,\n DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex,\n );\n};\n\nexport const preload_default_native_pipeline = (\n options: DefaultNativePipelinePackageOptions = {},\n): PreparedNativePipeline => preloadDefaultNativePipeline(options);\n\nexport const redactDefaultText = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): NativeStaticRedactionResult =>\n getDefaultNativePipeline(options).redactText(fullText, operators);\n\nexport const redact_default_text = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): NativeStaticRedactionResult =>\n redactDefaultText(fullText, operators, options);\n\nexport const redactDefaultTextJson = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): string =>\n getDefaultNativePipeline(options).redact_text_json(fullText, operators);\n\nexport const redact_default_text_json = (\n fullText: string,\n operators?: NativeOperatorConfig,\n options: DefaultNativePipelinePackageOptions = {},\n): string => redactDefaultTextJson(fullText, operators, options);\n\nexport const preloadDefaultNativePipelineAsync = (\n options: DefaultNativePipelinePackageOptions = {},\n): Promise<PreparedNativePipeline> => {\n const resolvedOptions = {\n ...resolveDefaultNativePipelineOptions(options),\n warmup: DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex,\n };\n const cache = defaultPipelineCacheFor(resolvedOptions.binding);\n const key = defaultPipelineCacheKey(resolvedOptions);\n const cached = cache.get(key);\n if (cached !== undefined) {\n return Promise.resolve(\n applyDefaultNativePipelineWarmup(cached, resolvedOptions.warmup),\n );\n }\n\n const inflightCache = defaultPipelineInflightCacheFor(\n resolvedOptions.binding,\n );\n const inflight = inflightCache.get(key);\n if (inflight !== undefined) {\n return inflight;\n }\n\n const promise = createNativePipelineFromResolvedDefaultPackageAsync(\n resolvedOptions,\n )\n .then((pipeline) => {\n cache.set(key, pipeline);\n return applyDefaultNativePipelineWarmup(pipeline, resolvedOptions.warmup);\n })\n .finally(() => {\n inflightCache.delete(key);\n });\n inflightCache.set(key, promise);\n return promise;\n};\n\nconst resolveDefaultNativePipelineOptions = ({\n binding,\n language,\n packagePath,\n warmup,\n expectedVersion,\n ...loadOptions\n}: DefaultNativePipelinePackageOptions = {}): ResolvedDefaultNativePipelineOptions => {\n if (language !== undefined && packagePath !== undefined) {\n throw new Error(\"Use either language or packagePath, not both\");\n }\n const resolvedBinding =\n binding ??\n loadNativeAnonymizeBinding({\n ...loadOptions,\n ...(expectedVersion !== undefined ? { expectedVersion } : {}),\n });\n if (binding && expectedVersion !== undefined) {\n assertNativeBindingVersion({ binding, expectedVersion });\n }\n return {\n binding: resolvedBinding,\n warmup: normalizeDefaultNativePipelineWarmup(warmup),\n ...(language !== undefined\n ? { language: resolveDefaultNativePipelineLanguage(language) }\n : {}),\n ...(packagePath !== undefined ? { packagePath } : {}),\n };\n};\n\nconst applyDefaultNativePipelineWarmup = (\n pipeline: PreparedNativePipeline,\n warmup: DefaultNativePipelineWarmup,\n): PreparedNativePipeline => {\n if (warmup !== DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex) {\n return pipeline;\n }\n if (!warmedDefaultNativePipelines.has(pipeline)) {\n pipeline.warmLazyRegex();\n warmedDefaultNativePipelines.add(pipeline);\n }\n return pipeline;\n};\n\nconst createNativePipelineFromResolvedDefaultPackage = ({\n binding,\n language,\n packagePath,\n}: ResolvedDefaultNativePipelineOptions): PreparedNativePipeline => {\n const packageBytes =\n packagePath === undefined\n ? readDefaultNativePipelinePackageFile(\n defaultPackageFileOptions(language),\n )\n : readNativePipelinePackageFile(packagePath);\n return createNativePipelineFromTrustedDefaultPackage(binding, packageBytes);\n};\n\nconst createNativePipelineFromResolvedDefaultPackageAsync = async ({\n binding,\n language,\n packagePath,\n}: ResolvedDefaultNativePipelineOptions): Promise<PreparedNativePipeline> => {\n const packageBytes =\n packagePath === undefined\n ? await readDefaultNativePipelinePackageFileAsync(\n defaultPackageFileOptions(language),\n )\n : await readNativePipelinePackageFileAsync(packagePath);\n return createNativePipelineFromTrustedDefaultPackage(binding, packageBytes);\n};\n\nconst createNativePipelineFromTrustedDefaultPackage = (\n binding: NativeAnonymizeBinding,\n packageBytes: Uint8Array,\n): PreparedNativePipeline =>\n new PreparedNativePipeline(\n new PreparedNativeAnonymizer(\n binding.NativePreparedSearch.fromTrustedPreparedPackageBytesWithoutCache?.(\n packageBytes,\n ) ??\n binding.NativePreparedSearch.fromTrustedPreparedPackageBytes?.(\n packageBytes,\n ) ??\n binding.NativePreparedSearch.fromPreparedPackageBytesWithoutCache?.(\n packageBytes,\n ) ??\n binding.NativePreparedSearch.fromPreparedPackageBytes(packageBytes),\n ),\n );\n\nconst defaultPackageFileOptions = (\n language: string | undefined,\n): DefaultNativePipelinePackageFileOptions =>\n language === undefined ? {} : { language };\n\nconst normalizeDefaultNativePipelineWarmup = (\n warmup: DefaultNativePipelineWarmup | undefined,\n): DefaultNativePipelineWarmup => {\n if (warmup === undefined) {\n return DEFAULT_NATIVE_PIPELINE_WARMUPS.none;\n }\n switch (warmup) {\n case DEFAULT_NATIVE_PIPELINE_WARMUPS.lazyRegex:\n case DEFAULT_NATIVE_PIPELINE_WARMUPS.none:\n return warmup;\n }\n throw new Error(\n 'Default native pipeline warmup must be \"lazy-regex\" or \"none\"',\n );\n};\n\nconst resolveNativeSdkBinding = ({\n binding,\n expectedVersion,\n ...loadOptions\n}: NativeSdkOptions): NativeAnonymizeBinding => {\n const resolvedBinding =\n binding ??\n loadNativeAnonymizeBinding({\n ...loadOptions,\n ...(expectedVersion !== undefined ? { expectedVersion } : {}),\n });\n if (binding && expectedVersion !== undefined) {\n assertNativeBindingVersion({ binding, expectedVersion });\n }\n return resolvedBinding;\n};\n\nconst defaultPipelineCacheFor = (\n binding: NativeAnonymizeBinding,\n): Map<string, PreparedNativePipeline> => {\n const cached = defaultNativePipelineCache.get(binding);\n if (cached !== undefined) {\n return cached;\n }\n const created = new Map<string, PreparedNativePipeline>();\n defaultNativePipelineCache.set(binding, created);\n return created;\n};\n\nconst defaultPipelineInflightCacheFor = (\n binding: NativeAnonymizeBinding,\n): Map<string, Promise<PreparedNativePipeline>> => {\n const cached = defaultNativePipelineInflightCache.get(binding);\n if (cached !== undefined) {\n return cached;\n }\n const created = new Map<string, Promise<PreparedNativePipeline>>();\n defaultNativePipelineInflightCache.set(binding, created);\n return created;\n};\n\nconst defaultPipelineCacheKey = ({\n binding,\n language,\n packagePath,\n}: ResolvedDefaultNativePipelineOptions): string =>\n [\n binding.nativePackageVersion(),\n packagePath ??\n (language === undefined\n ? DEFAULT_NATIVE_PIPELINE_PACKAGE_CACHE_KEY\n : `language:${language}`),\n ].join(\"\\0\");\n\nconst defaultNativePipelinePackageUrl = (language: string | undefined): URL => {\n if (language === undefined) {\n return DEFAULT_NATIVE_PIPELINE_PACKAGE_URL;\n }\n const normalized = resolveDefaultNativePipelineLanguage(language);\n return defaultNativePipelineLanguagePackageUrl(normalized);\n};\n\nconst defaultNativePipelineLanguagePackageUrl = (language: string): URL =>\n new URL(`../native-pipeline.${language}.stlanonpkg`, import.meta.url);\n\nconst resolveDefaultNativePipelineLanguage = (language: string): string => {\n const normalized = normalizeDefaultNativePipelineLanguage(language);\n const exactUrl = defaultNativePipelineLanguagePackageUrl(normalized);\n if (existsSync(exactUrl)) {\n return normalized;\n }\n const baseLanguage = normalized.split(\"-\").at(0);\n if (baseLanguage === undefined || baseLanguage === normalized) {\n return normalized;\n }\n const baseUrl = defaultNativePipelineLanguagePackageUrl(baseLanguage);\n if (existsSync(baseUrl)) {\n return baseLanguage;\n }\n return normalized;\n};\n\nconst defaultNativePipelinePackageDescription = (\n language: string | undefined,\n): string =>\n language === undefined\n ? \"Default native pipeline package\"\n : `Default native pipeline package for language \"${resolveDefaultNativePipelineLanguage(language)}\"`;\n\nconst normalizeDefaultNativePipelineLanguage = (language: string): string => {\n const normalized = language.trim().toLowerCase();\n if (!DEFAULT_NATIVE_PIPELINE_LANGUAGE_PATTERN.test(normalized)) {\n throw new Error(\n `Default native pipeline language must match ${DEFAULT_NATIVE_PIPELINE_LANGUAGE_PATTERN.source}`,\n );\n }\n return normalized;\n};\n\ntype NativeBindingSpecifiersOptions = {\n arch: string;\n env: Record<string, string | undefined>;\n libc: NativeLibc | undefined;\n platform: string;\n};\n\nconst nativeBindingSpecifiers = ({\n arch,\n env,\n libc,\n platform,\n}: NativeBindingSpecifiersOptions): string[] => {\n const specifiers: string[] = [];\n const overridePath = env[PACKAGE_SPECIFIC_NATIVE_PATH];\n if (overridePath) {\n specifiers.push(overridePath);\n }\n specifiers.push(LOCAL_NATIVE_LOADER);\n const platformPackage = nativeBindingPackageName({ arch, libc, platform });\n if (platformPackage !== null) {\n specifiers.push(platformPackage);\n }\n return specifiers;\n};\n\ntype NativeBindingTarget = {\n platform: string;\n arch: string;\n libc?: NativeLibc;\n package: string;\n};\n\n// Single source of truth for published native sidecars. Both the runtime\n// package lookup and the \"unsupported target\" error message derive from this\n// table, so a target is never advertised as supported without a package (and\n// vice versa). musl Linux is intentionally absent: no musl sidecar is shipped.\nconst NATIVE_BINDING_TARGETS: readonly NativeBindingTarget[] = [\n {\n platform: \"darwin\",\n arch: \"arm64\",\n package: \"@stll/anonymize-darwin-arm64\",\n },\n { platform: \"darwin\", arch: \"x64\", package: \"@stll/anonymize-darwin-x64\" },\n {\n platform: \"linux\",\n arch: \"arm64\",\n libc: \"gnu\",\n package: \"@stll/anonymize-linux-arm64-gnu\",\n },\n {\n platform: \"linux\",\n arch: \"x64\",\n libc: \"gnu\",\n package: \"@stll/anonymize-linux-x64-gnu\",\n },\n { platform: \"win32\", arch: \"x64\", package: \"@stll/anonymize-win32-x64-msvc\" },\n];\n\ntype NativeBindingPackageNameOptions = {\n arch: string;\n libc: NativeLibc | undefined;\n platform: string;\n};\n\ntype DescribeNativeTargetOptions = {\n arch: string;\n libc?: NativeLibc | undefined;\n platform: string;\n};\n\nconst describeNativeTarget = ({\n arch,\n libc,\n platform,\n}: DescribeNativeTargetOptions): string =>\n libc === undefined ? `${platform}-${arch}` : `${platform}-${arch}-${libc}`;\n\nconst SUPPORTED_NATIVE_TARGETS: readonly string[] = NATIVE_BINDING_TARGETS.map(\n (target) => describeNativeTarget(target),\n);\n\nconst nativeBindingPackageName = ({\n arch,\n libc,\n platform,\n}: NativeBindingPackageNameOptions): string | null => {\n const match = NATIVE_BINDING_TARGETS.find(\n (target) =>\n target.platform === platform &&\n target.arch === arch &&\n (target.libc === undefined || target.libc === libc),\n );\n return match?.package ?? null;\n};\n\nconst unsupportedNativeTargetError = ({\n arch,\n errors,\n libc,\n platform,\n}: NativeBindingPackageNameOptions & { errors: string[] }): Error => {\n const target = describeNativeTarget({ arch, libc, platform });\n const supported = SUPPORTED_NATIVE_TARGETS.join(\", \");\n const attempts = errors.length > 0 ? `\\n${errors.join(\"\\n\")}` : \"\";\n return new Error(\n `No native anonymize binding is published for ${target}; supported targets: ${supported}. Set ${PACKAGE_SPECIFIC_NATIVE_PATH} to a locally built binding to run on this platform.${attempts}`,\n );\n};\n\nconst detectNativeLibc = (platform: string): NativeLibc | undefined => {\n if (platform !== \"linux\") {\n return undefined;\n }\n const report = process.report?.getReport();\n const header =\n isPropertyBag(report) && isPropertyBag(report[\"header\"])\n ? report[\"header\"]\n : null;\n return typeof header?.[\"glibcVersionRuntime\"] === \"string\" ? \"gnu\" : \"musl\";\n};\n\ntype TryLoadNativeBindingOptions = {\n specifier: string;\n requireModule: NativeRequire;\n errors: string[];\n};\n\nconst tryLoadNativeBinding = ({\n specifier,\n requireModule,\n errors,\n}: TryLoadNativeBindingOptions): NativeAnonymizeBinding | null => {\n try {\n const loaded = requireModule(specifier);\n const binding = toNativeAnonymizeBinding(loaded);\n if (binding) {\n return binding;\n }\n errors.push(`${specifier}: module does not match native binding shape`);\n } catch (error) {\n errors.push(`${specifier}: ${formatLoadError(error)}`);\n }\n return null;\n};\n\nconst toNativeAnonymizeBinding = (\n value: unknown,\n): NativeAnonymizeBinding | null => {\n const candidate =\n isPropertyBag(value) && isPropertyBag(value[\"default\"])\n ? value[\"default\"]\n : value;\n return isNativeAnonymizeBinding(candidate) ? candidate : null;\n};\n\nconst isNativeAnonymizeBinding = (\n candidate: unknown,\n): candidate is NativeAnonymizeBinding => {\n if (!isPropertyBag(candidate)) {\n return false;\n }\n if (typeof candidate[\"nativePackageVersion\"] !== \"function\") {\n return false;\n }\n if (typeof candidate[\"normalizeForSearch\"] !== \"function\") {\n return false;\n }\n if (typeof candidate[\"prepareStaticSearchPackageBytes\"] !== \"function\") {\n return false;\n }\n if (\n typeof candidate[\"prepareStaticSearchCompressedPackageBytes\"] !== \"function\"\n ) {\n return false;\n }\n const preparedSearch = candidate[\"NativePreparedSearch\"];\n if (!isPropertyBag(preparedSearch)) {\n return false;\n }\n if (typeof preparedSearch[\"fromConfigJsonBytes\"] !== \"function\") {\n return false;\n }\n if (typeof preparedSearch[\"fromPreparedPackageBytes\"] !== \"function\") {\n return false;\n }\n return true;\n};\n\nconst isPropertyBag = (value: unknown): value is Record<string, unknown> =>\n (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n\nconst formatLoadError = (error: unknown): string => {\n if (error instan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B,KAAK,GAAG;CACvD;CACA,OAAO;AACT;AAEA,MAAM,4BACJ,UACkC;CAClC,MAAM,YACJ,cAAc,KAAK,KAAK,cAAc,MAAM,UAAU,IAClD,MAAM,aACN;CACN,OAAO,yBAAyB,SAAS,IAAI,YAAY;AAC3D;AAEA,MAAM,4BACJ,cACwC;CACxC,IAAI,CAAC,cAAc,SAAS,GAC1B,OAAO;CAET,IAAI,OAAO,UAAU,4BAA4B,YAC/C,OAAO;CAET,IAAI,OAAO,UAAU,0BAA0B,YAC7C,OAAO;CAET,IAAI,OAAO,UAAU,uCAAuC,YAC1D,OAAO;CAET,IACE,OAAO,UAAU,iDAAiD,YAElE,OAAO;CAET,MAAM,iBAAiB,UAAU;CACjC,IAAI,CAAC,cAAc,cAAc,GAC/B,OAAO;CAET,IAAI,OAAO,eAAe,2BAA2B,YACnD,OAAO;CAET,IAAI,OAAO,eAAe,gCAAgC,YACxD,OAAO;CAET,OAAO;AACT;AAEA,MAAM,iBAAiB,UACpB,OAAO,UAAU,YAAY,UAAU,QAAS,OAAO,UAAU;AAEpE,MAAM,mBAAmB,UAA2B;CAClD,IAAI,iBAAiB,OACnB,OAAO,MAAM;CAEf,OAAO,OAAO,KAAK;AACrB"}
@@ -0,0 +1,34 @@
1
+ import { p as NativeAnonymizeBinding } from "./native.mjs";
2
+ import { a as LoadNativeBindingOptions } from "./native-node.mjs";
3
+ //#region src/native-runtime.d.ts
4
+ /**
5
+ * Runtime-aware selection of the native binding.
6
+ *
7
+ * Node uses the fast NAPI addon (`stella_anonymize_napi.node`). Bun cannot run
8
+ * it: the addon calls libuv functions Bun's NAPI shim does not implement
9
+ * (`uv_get_osfhandle`), which aborts the process. The `@stll/anonymize-wasm`
10
+ * binding exposes the identical `NativeAnonymizeBinding` surface and runs
11
+ * cleanly under both runtimes.
12
+ *
13
+ * The wasm binding loads asynchronously, but most consumers (the docx and pdf
14
+ * packages, `getDefaultNativePipeline`) call `loadNativeAnonymizeBinding()`
15
+ * synchronously. So under Bun an entry point calls `preloadNativeBinding()`
16
+ * once (async) at startup; it installs the wasm binding as the loader override,
17
+ * after which every synchronous `loadNativeAnonymizeBinding()` returns it. On
18
+ * Node this is a no-op and the NAPI path is unchanged.
19
+ */
20
+ declare const isBunRuntime: () => boolean;
21
+ /**
22
+ * Resolve the default native binding for the current runtime: the NAPI addon on
23
+ * Node, the wasm binding on Bun (loaded and cached once).
24
+ */
25
+ declare const loadDefaultNativeBinding: (options?: LoadNativeBindingOptions) => Promise<NativeAnonymizeBinding>;
26
+ /**
27
+ * Under Bun, load the wasm binding once and install it as the synchronous
28
+ * loader override so every `loadNativeAnonymizeBinding()` caller uses it. A
29
+ * no-op on Node. Idempotent and safe to await from every entry point.
30
+ */
31
+ declare const preloadNativeBinding: () => Promise<void>;
32
+ //#endregion
33
+ export { isBunRuntime, loadDefaultNativeBinding, preloadNativeBinding };
34
+ //# sourceMappingURL=native-runtime.d.mts.map