@stll/anonymize 2.4.2 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/dist/agent-surface.d.mts +107 -0
- package/dist/agent-surface.mjs +109 -0
- package/dist/agent-surface.mjs.map +1 -0
- package/dist/feedback-sanitize.d.mts +32 -0
- package/dist/feedback-sanitize.mjs +143 -0
- package/dist/feedback-sanitize.mjs.map +1 -0
- package/dist/feedback.d.mts +39 -0
- package/dist/feedback.mjs +84 -0
- package/dist/feedback.mjs.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/native-node.d.mts +8 -7
- package/dist/native-node.mjs +3 -3
- package/dist/native-node2.d.mts +3 -3
- package/dist/native-node2.mjs +21 -15
- package/dist/native-node2.mjs.map +1 -1
- package/dist/native-runtime.d.mts +34 -0
- package/dist/native-runtime.mjs +55 -0
- package/dist/native-runtime.mjs.map +1 -0
- package/dist/native.d.mts +81 -73
- package/dist/native.mjs +87 -84
- package/dist/native.mjs.map +1 -1
- package/dist/native2.d.mts +2 -2
- package/package.json +25 -8
package/dist/native.d.mts
CHANGED
|
@@ -817,71 +817,79 @@ type NativeOpenSessionArchiveOptions = {
|
|
|
817
817
|
type NativePreparedRedactionSessionBinding = {
|
|
818
818
|
sessionId: () => string;
|
|
819
819
|
mappingCount: () => number;
|
|
820
|
-
restoreText
|
|
821
|
-
restoreTextAt
|
|
820
|
+
restoreText: (fullText: string) => string;
|
|
821
|
+
restoreTextAt: (fullText: string, observedAtEpochSeconds: number) => string;
|
|
822
822
|
toPlaintextJson: () => string;
|
|
823
|
-
toPlaintextJsonAt
|
|
824
|
-
toEncryptedArchive
|
|
825
|
-
toEncryptedArchiveAt
|
|
826
|
-
inspectJson
|
|
827
|
-
deleteJson
|
|
823
|
+
toPlaintextJsonAt: (observedAtEpochSeconds: number) => string;
|
|
824
|
+
toEncryptedArchive: (key: Uint8Array) => Uint8Array;
|
|
825
|
+
toEncryptedArchiveAt: (key: Uint8Array, observedAtEpochSeconds: number) => Uint8Array;
|
|
826
|
+
inspectJson: (observedAtEpochSeconds?: number) => string;
|
|
827
|
+
deleteJson: () => string;
|
|
828
828
|
redactStaticEntitiesJson: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
829
|
-
redactStaticEntitiesJsonAt
|
|
830
|
-
planStaticEntitiesWithCallerDetections
|
|
829
|
+
redactStaticEntitiesJsonAt: (fullText: string, observedAtEpochSeconds: number, operators?: NativeBindingOperatorConfig) => string;
|
|
830
|
+
planStaticEntitiesWithCallerDetections: (options: NativeBindingSessionCallerRedactionPlanOptions) => NativePreparedSessionRedactionPlanBinding;
|
|
831
831
|
};
|
|
832
832
|
type NativePreparedSessionRedactionPlanBinding = {
|
|
833
833
|
resultJson: () => string;
|
|
834
834
|
commit: () => void;
|
|
835
835
|
};
|
|
836
836
|
type NativePreparedSearchBinding = {
|
|
837
|
-
prepareDiagnosticsJson
|
|
838
|
-
warmLazyRegex
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
restoreRedactionSession?: (plaintextJson: string) => NativePreparedRedactionSessionBinding;
|
|
845
|
-
restoreEncryptedRedactionSession?: (options: NativeBindingOpenSessionArchiveOptions) => NativePreparedRedactionSessionBinding;
|
|
837
|
+
prepareDiagnosticsJson: () => string;
|
|
838
|
+
warmLazyRegex: () => void;
|
|
839
|
+
warmLazyRegexDiagnosticsJson: () => string;
|
|
840
|
+
createRedactionSession: (sessionId: string) => NativePreparedRedactionSessionBinding;
|
|
841
|
+
createRedactionSessionWithLifecycle: (sessionId: string, createdAtEpochSeconds: number, expiresAtEpochSeconds?: number) => NativePreparedRedactionSessionBinding;
|
|
842
|
+
restoreRedactionSession: (plaintextJson: string) => NativePreparedRedactionSessionBinding;
|
|
843
|
+
restoreEncryptedRedactionSession: (options: NativeBindingOpenSessionArchiveOptions) => NativePreparedRedactionSessionBinding;
|
|
846
844
|
redactStaticEntities: (fullText: string, operators?: NativeBindingOperatorConfig) => NativeBindingStaticRedactionResult;
|
|
847
|
-
redactStaticEntitiesJson
|
|
848
|
-
redactStaticEntitiesWithCallerDetectionsJson
|
|
849
|
-
redactStaticEntitiesWithCallerDetectionsDiagnosticsJson
|
|
850
|
-
redactStaticEntitiesResultStreamJson
|
|
851
|
-
redactStaticEntitiesDiagnosticsJson
|
|
852
|
-
redactStaticEntitiesDiagnosticsStreamJson
|
|
853
|
-
redactStaticEntitiesSummaryDiagnosticsJson
|
|
845
|
+
redactStaticEntitiesJson: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
846
|
+
redactStaticEntitiesWithCallerDetectionsJson: (fullText: string, options: NativeBindingCallerRedactionOptions) => string;
|
|
847
|
+
redactStaticEntitiesWithCallerDetectionsDiagnosticsJson: (fullText: string, options: NativeBindingCallerRedactionOptions) => string;
|
|
848
|
+
redactStaticEntitiesResultStreamJson: (fullText: string, operators: NativeBindingOperatorConfig | undefined, onEvent: NativeResultEventCallback) => string;
|
|
849
|
+
redactStaticEntitiesDiagnosticsJson: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
850
|
+
redactStaticEntitiesDiagnosticsStreamJson: (fullText: string, operators: NativeBindingOperatorConfig | undefined, onBatch: NativeDiagnosticsBatchCallback) => string;
|
|
851
|
+
redactStaticEntitiesSummaryDiagnosticsJson: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
|
|
854
852
|
};
|
|
855
853
|
type NativeAnonymizeBinding = {
|
|
856
|
-
convertExternalDetectionBatch
|
|
857
|
-
externalDetectionLimitsJson
|
|
858
|
-
extractDocxTextJson
|
|
859
|
-
inspectPdfJson
|
|
860
|
-
rewritePdfRasterFromDetectionsJson
|
|
854
|
+
convertExternalDetectionBatch: (document: Uint8Array, batchJson: string) => NativeCallerDetection[];
|
|
855
|
+
externalDetectionLimitsJson: () => string;
|
|
856
|
+
extractDocxTextJson: (document: Uint8Array) => string;
|
|
857
|
+
inspectPdfJson: (document: Uint8Array, observationsJson?: string) => string;
|
|
858
|
+
rewritePdfRasterFromDetectionsJson: (document: Uint8Array, requestJson: string, pagePixels: readonly Uint8Array[]) => {
|
|
861
859
|
document: Uint8Array;
|
|
862
860
|
certificateJson: string;
|
|
863
861
|
};
|
|
864
|
-
rewriteDocxTextNative
|
|
862
|
+
rewriteDocxTextNative: (document: Uint8Array, rewritesJson: string) => {
|
|
865
863
|
document: Uint8Array;
|
|
866
864
|
rewrittenBlockCount: number;
|
|
867
865
|
appliedReplacementCount: number;
|
|
868
866
|
};
|
|
869
|
-
planDocxRestorationJson
|
|
867
|
+
planDocxRestorationJson: (document: Uint8Array, sessionId: string) => string;
|
|
870
868
|
normalizeForSearch: (text: string) => string;
|
|
871
869
|
nativePackageVersion: () => string;
|
|
872
870
|
NativePreparedSearch: {
|
|
873
871
|
fromConfigJsonBytes: (configJson: Uint8Array) => NativePreparedSearchBinding;
|
|
874
872
|
fromPreparedPackageBytes: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
875
|
-
fromPreparedPackageBytesWithoutCache
|
|
876
|
-
fromTrustedPreparedPackageBytes
|
|
877
|
-
fromTrustedPreparedPackageBytesWithoutCache
|
|
873
|
+
fromPreparedPackageBytesWithoutCache: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
874
|
+
fromTrustedPreparedPackageBytes: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
875
|
+
fromTrustedPreparedPackageBytesWithoutCache: (packageBytes: Uint8Array) => NativePreparedSearchBinding;
|
|
878
876
|
};
|
|
879
877
|
prepareStaticSearchPackageBytes: (configJson: Uint8Array) => Uint8Array;
|
|
880
878
|
prepareStaticSearchCompressedPackageBytes: (configJson: Uint8Array) => Uint8Array;
|
|
881
|
-
assembleStaticSearchConfigJson
|
|
882
|
-
assembleStaticSearchPackageBytes
|
|
883
|
-
assembleStaticSearchCompressedPackageBytes
|
|
884
|
-
};
|
|
879
|
+
assembleStaticSearchConfigJson: (pipelineConfigJson: Uint8Array, dictionariesJson?: Uint8Array, gazetteerJson?: Uint8Array) => Uint8Array;
|
|
880
|
+
assembleStaticSearchPackageBytes: (pipelineConfigJson: Uint8Array, dictionariesJson?: Uint8Array, gazetteerJson?: Uint8Array) => Uint8Array;
|
|
881
|
+
assembleStaticSearchCompressedPackageBytes: (pipelineConfigJson: Uint8Array, dictionariesJson?: Uint8Array, gazetteerJson?: Uint8Array) => Uint8Array;
|
|
882
|
+
};
|
|
883
|
+
/** Exhaustive runtime-member contract shared by loaders and parity gates. */
|
|
884
|
+
declare const NATIVE_BINDING_PARITY_MEMBERS: {
|
|
885
|
+
readonly root: readonly ["convertExternalDetectionBatch", "externalDetectionLimitsJson", "extractDocxTextJson", "inspectPdfJson", "rewritePdfRasterFromDetectionsJson", "rewriteDocxTextNative", "planDocxRestorationJson", "normalizeForSearch", "nativePackageVersion", "prepareStaticSearchPackageBytes", "prepareStaticSearchCompressedPackageBytes", "assembleStaticSearchConfigJson", "assembleStaticSearchPackageBytes", "assembleStaticSearchCompressedPackageBytes"];
|
|
886
|
+
readonly factories: readonly ["fromConfigJsonBytes", "fromPreparedPackageBytes", "fromPreparedPackageBytesWithoutCache", "fromTrustedPreparedPackageBytes", "fromTrustedPreparedPackageBytesWithoutCache"];
|
|
887
|
+
readonly prepared: readonly ["prepareDiagnosticsJson", "warmLazyRegex", "warmLazyRegexDiagnosticsJson", "createRedactionSession", "createRedactionSessionWithLifecycle", "restoreRedactionSession", "restoreEncryptedRedactionSession", "redactStaticEntities", "redactStaticEntitiesJson", "redactStaticEntitiesWithCallerDetectionsJson", "redactStaticEntitiesWithCallerDetectionsDiagnosticsJson", "redactStaticEntitiesResultStreamJson", "redactStaticEntitiesDiagnosticsJson", "redactStaticEntitiesDiagnosticsStreamJson", "redactStaticEntitiesSummaryDiagnosticsJson"];
|
|
888
|
+
readonly session: readonly ["sessionId", "mappingCount", "restoreText", "restoreTextAt", "toPlaintextJson", "toPlaintextJsonAt", "toEncryptedArchive", "toEncryptedArchiveAt", "inspectJson", "deleteJson", "redactStaticEntitiesJson", "redactStaticEntitiesJsonAt", "planStaticEntitiesWithCallerDetections"];
|
|
889
|
+
readonly plan: readonly ["resultJson", "commit"];
|
|
890
|
+
};
|
|
891
|
+
/** Validate the complete runtime-neutral root and factory binding shape. */
|
|
892
|
+
declare const isNativeAnonymizeBinding: (candidate: unknown) => candidate is NativeAnonymizeBinding;
|
|
885
893
|
type NativeOperatorConfig = {
|
|
886
894
|
operators?: Record<string, OperatorSelection>;
|
|
887
895
|
redactString?: string;
|
|
@@ -1068,12 +1076,12 @@ declare class PreparedNativeSessionRedactionPlan {
|
|
|
1068
1076
|
declare class PreparedNativeAnonymizer {
|
|
1069
1077
|
#private;
|
|
1070
1078
|
constructor(prepared: NativePreparedSearchBinding);
|
|
1071
|
-
prepareDiagnosticsJson(): string
|
|
1072
|
-
prepare_diagnostics_json(): string
|
|
1079
|
+
prepareDiagnosticsJson(): string;
|
|
1080
|
+
prepare_diagnostics_json(): string;
|
|
1073
1081
|
warmLazyRegex(): void;
|
|
1074
1082
|
warm_lazy_regex(): void;
|
|
1075
|
-
warmLazyRegexDiagnosticsJson(): string
|
|
1076
|
-
warm_lazy_regex_diagnostics_json(): string
|
|
1083
|
+
warmLazyRegexDiagnosticsJson(): string;
|
|
1084
|
+
warm_lazy_regex_diagnostics_json(): string;
|
|
1077
1085
|
createRedactionSession(sessionId: string): PreparedNativeRedactionSession;
|
|
1078
1086
|
create_redaction_session(sessionId: string): PreparedNativeRedactionSession;
|
|
1079
1087
|
createRedactionSessionWithLifecycle({ sessionId, createdAtEpochSeconds, expiresAtEpochSeconds }: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession;
|
|
@@ -1087,27 +1095,27 @@ declare class PreparedNativeAnonymizer {
|
|
|
1087
1095
|
redact_text_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1088
1096
|
redactStaticEntitiesWithCallerDetections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
|
|
1089
1097
|
redact_text_with_caller_detections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
|
|
1090
|
-
redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(fullText: string, options: NativeCallerRedactionOptions): string
|
|
1091
|
-
redact_static_entities_with_caller_detections_diagnostics_json(fullText: string, options: NativeCallerRedactionOptions): string
|
|
1098
|
+
redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(fullText: string, options: NativeCallerRedactionOptions): string;
|
|
1099
|
+
redact_static_entities_with_caller_detections_diagnostics_json(fullText: string, options: NativeCallerRedactionOptions): string;
|
|
1092
1100
|
redactTextJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1093
|
-
redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string
|
|
1094
|
-
redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string
|
|
1095
|
-
redactStaticEntitiesDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string
|
|
1096
|
-
diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string
|
|
1097
|
-
diagnosticsStreamJson(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string
|
|
1098
|
-
diagnostics_stream_json(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string
|
|
1099
|
-
redactStaticEntitiesSummaryDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string
|
|
1100
|
-
summary_diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string
|
|
1101
|
+
redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string;
|
|
1102
|
+
redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string;
|
|
1103
|
+
redactStaticEntitiesDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1104
|
+
diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1105
|
+
diagnosticsStreamJson(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string;
|
|
1106
|
+
diagnostics_stream_json(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string;
|
|
1107
|
+
redactStaticEntitiesSummaryDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1108
|
+
summary_diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1101
1109
|
}
|
|
1102
1110
|
declare class PreparedNativePipeline {
|
|
1103
1111
|
#private;
|
|
1104
1112
|
constructor(anonymizer: PreparedNativeAnonymizer);
|
|
1105
|
-
prepareDiagnosticsJson(): string
|
|
1106
|
-
prepare_diagnostics_json(): string
|
|
1113
|
+
prepareDiagnosticsJson(): string;
|
|
1114
|
+
prepare_diagnostics_json(): string;
|
|
1107
1115
|
warmLazyRegex(): void;
|
|
1108
1116
|
warm_lazy_regex(): void;
|
|
1109
|
-
warmLazyRegexDiagnosticsJson(): string
|
|
1110
|
-
warm_lazy_regex_diagnostics_json(): string
|
|
1117
|
+
warmLazyRegexDiagnosticsJson(): string;
|
|
1118
|
+
warm_lazy_regex_diagnostics_json(): string;
|
|
1111
1119
|
createRedactionSession(sessionId: string): PreparedNativeRedactionSession;
|
|
1112
1120
|
create_redaction_session(sessionId: string): PreparedNativeRedactionSession;
|
|
1113
1121
|
createRedactionSessionWithLifecycle(options: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession;
|
|
@@ -1121,22 +1129,22 @@ declare class PreparedNativePipeline {
|
|
|
1121
1129
|
redact_text_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1122
1130
|
redactTextWithCallerDetections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
|
|
1123
1131
|
redact_text_with_caller_detections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
|
|
1124
|
-
redactTextWithCallerDetectionsDiagnosticsJson(fullText: string, options: NativeCallerRedactionOptions): string
|
|
1125
|
-
redact_text_with_caller_detections_diagnostics_json(fullText: string, options: NativeCallerRedactionOptions): string
|
|
1132
|
+
redactTextWithCallerDetectionsDiagnosticsJson(fullText: string, options: NativeCallerRedactionOptions): string;
|
|
1133
|
+
redact_text_with_caller_detections_diagnostics_json(fullText: string, options: NativeCallerRedactionOptions): string;
|
|
1126
1134
|
redactTextJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1127
|
-
redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string
|
|
1128
|
-
redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string
|
|
1129
|
-
redactTextDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string
|
|
1130
|
-
diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string
|
|
1131
|
-
diagnosticsStreamJson(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string
|
|
1132
|
-
diagnostics_stream_json(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string
|
|
1133
|
-
redactTextSummaryDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string
|
|
1134
|
-
summary_diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string
|
|
1135
|
+
redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string;
|
|
1136
|
+
redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string;
|
|
1137
|
+
redactTextDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1138
|
+
diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1139
|
+
diagnosticsStreamJson(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string;
|
|
1140
|
+
diagnostics_stream_json(fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig): string;
|
|
1141
|
+
redactTextSummaryDiagnosticsJson(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1142
|
+
summary_diagnostics_json(fullText: string, operators?: NativeOperatorConfig): string;
|
|
1135
1143
|
}
|
|
1136
1144
|
declare const encodeNativeSearchConfig: (config: NativePreparedSearchConfig) => Uint8Array;
|
|
1137
1145
|
declare const encodeNativeSearchConfigInput: (config: NativeSearchPackageInput) => Uint8Array;
|
|
1138
1146
|
declare const getNativeBindingVersion: (binding: NativeAnonymizeBinding) => string;
|
|
1139
|
-
declare const native_package_version:
|
|
1147
|
+
declare const native_package_version: typeof getNativeBindingVersion;
|
|
1140
1148
|
declare const normalize_for_search: ({ binding, text }: NativeNormalizeOptions) => string;
|
|
1141
1149
|
declare const assertNativeBindingVersion: ({ binding, expectedVersion }: NativeBindingVersionOptions) => void;
|
|
1142
1150
|
declare const prepareNativeSearchPackage: ({ binding, config, compressed }: NativeSearchPackageOptions) => Uint8Array;
|
|
@@ -1146,15 +1154,15 @@ declare const createNativeAnonymizerFromPackage: ({ binding, packageBytes }: Nat
|
|
|
1146
1154
|
declare const load_prepared_package: ({ binding, packageBytes }: SharedNativePreparedPackageOptions) => PreparedNativeAnonymizer;
|
|
1147
1155
|
declare const redact_text_json: ({ binding, config, fullText, operators }: SharedNativeRedactTextJsonOptions) => string;
|
|
1148
1156
|
declare const redact_text: ({ binding, config, fullText, operators }: SharedNativeRedactTextOptions) => NativeStaticRedactionResult;
|
|
1149
|
-
declare const redact_text_stream_json: ({ binding, config, fullText, operators, onEvent }: SharedNativeRedactTextStreamJsonOptions) => string
|
|
1150
|
-
declare const diagnostics_json: ({ binding, config, fullText, operators }: SharedNativeDiagnosticsJsonOptions) => string
|
|
1151
|
-
declare const diagnostics_stream_json: ({ binding, config, fullText, operators, onBatch }: SharedNativeDiagnosticsStreamJsonOptions) => string
|
|
1152
|
-
declare const summary_diagnostics_json: ({ binding, config, fullText, operators }: SharedNativeDiagnosticsJsonOptions) => string
|
|
1157
|
+
declare const redact_text_stream_json: ({ binding, config, fullText, operators, onEvent }: SharedNativeRedactTextStreamJsonOptions) => string;
|
|
1158
|
+
declare const diagnostics_json: ({ binding, config, fullText, operators }: SharedNativeDiagnosticsJsonOptions) => string;
|
|
1159
|
+
declare const diagnostics_stream_json: ({ binding, config, fullText, operators, onBatch }: SharedNativeDiagnosticsStreamJsonOptions) => string;
|
|
1160
|
+
declare const summary_diagnostics_json: ({ binding, config, fullText, operators }: SharedNativeDiagnosticsJsonOptions) => string;
|
|
1153
1161
|
declare const createNativePipelineFromPackage: ({ binding, packageBytes }: NativePipelineFromPackageOptions) => PreparedNativePipeline;
|
|
1154
1162
|
declare const PreparedSearch: typeof PreparedNativeAnonymizer;
|
|
1155
1163
|
type PreparedSearch = PreparedNativeAnonymizer;
|
|
1156
1164
|
declare const PreparedAnonymizer: typeof PreparedNativeAnonymizer;
|
|
1157
1165
|
type PreparedAnonymizer = PreparedNativeAnonymizer;
|
|
1158
1166
|
//#endregion
|
|
1159
|
-
export {
|
|
1167
|
+
export { SharedNativeRedactTextJsonOptions as $, NativeRedactionResult as A, GazetteerEntry as At, NativeSessionRedactionAtOptions as B, TriggerValidation as Bt, NativeOpenSessionArchiveOptions as C, AnonymisationOperator as Ct, NativePreparedRedactionSessionBinding as D, Dictionaries as Dt, NativePipelineFromPackageOptions as E, DenyListCategory as Et, NativeSessionCallerRedactionInput as F, ReviewedEntity as Ft, PreparedNativeAnonymizer as G, NativeStaticRedactionResult as H, NativeSessionCallerRedactionPlanOptions as I, TriggerExtension as It, PreparedNativeSessionRedactionPlan as J, PreparedNativePipeline as K, NativeSessionDeletionSummary as L, TriggerGroupConfig as Lt, NativeSearchPackageInput as M, PipelineConfig as Mt, NativeSearchPackageOptions as N, RedactionResult as Nt, NativePreparedSearchBinding as O, DictionaryMeta as Ot, NativeSessionBlockRedactionPlan as P, ReviewDecision as Pt, SharedNativePreparedPackageOptions as Q, NativeSessionLifecycle as R, TriggerRule as Rt, NativeNormalizeOptions as S, summary_diagnostics_json as St, NativePipelineEntity as T, CustomRegexPattern as Tt, NativeTextReplacement as U, NativeSessionStatus as V, NativePreparedSearchConfig as Vt, PreparedAnonymizer as W, SharedNativeDiagnosticsJsonOptions as X, PreparedSearch as Y, SharedNativeDiagnosticsStreamJsonOptions as Z, NativeBindingVersionOptions as _, prepareNativeSearchPackage as _t, EXTERNAL_DETECTION_DOCUMENT_MAX_BYTES as a, createNativeAnonymizerFromConfig as at, NativeCreateSessionWithLifecycleOptions as b, redact_text_json as bt, EXTERNAL_DETECTION_MAX_METADATA_BYTES as c, diagnostics_json as ct, ExternalDetectionBatch as d, encodeNativeSearchConfigInput as dt, SharedNativeRedactTextOptions as et, ExternalDetectionOffsetUnit as f, getNativeBindingVersion as ft, NativeAnonymizerFromPackageOptions as g, normalize_for_search as gt, NativeAnonymizerFromConfigOptions as h, native_package_version as ht, EXTERNAL_DETECTION_BATCH_VERSION as i, convert_external_detection_batch as it, NativeResultEventCallback as j, OperatorConfig as jt, NativePreparedSessionRedactionPlanBinding as k, Entity as kt, EXTERNAL_DETECTION_OFFSET_UNITS as l, diagnostics_stream_json as lt, NativeAnonymizeBinding as m, load_prepared_package as mt, ConvertExternalDetectionBatchOptions as n, SharedNativeSearchPackageOptions as nt, EXTERNAL_DETECTION_MAX_DETECTIONS as o, createNativeAnonymizerFromPackage as ot, NATIVE_BINDING_PARITY_MEMBERS as p, isNativeAnonymizeBinding as pt, PreparedNativeRedactionSession as q, EXTERNAL_DETECTION_BATCH_MAX_BYTES as r, assertNativeBindingVersion as rt, EXTERNAL_DETECTION_MAX_LABEL_MAPPINGS as s, createNativePipelineFromPackage as st, CALLER_DETECTION_CONTRACT_VERSION as t, SharedNativeRedactTextStreamJsonOptions as tt, EXTERNAL_DETECTION_PROVIDER_ID_MAX_BYTES as u, encodeNativeSearchConfig as ut, NativeCallerDetection as v, prepare_search_package as vt, NativeOperatorConfig as w, CustomDenyListEntry as wt, NativeDiagnosticsBatchCallback as x, redact_text_stream_json as xt, NativeCallerRedactionOptions as y, redact_text as yt, NativeSessionMetadata as z, TriggerStrategy as zt };
|
|
1160
1168
|
//# sourceMappingURL=native.d.mts.map
|
package/dist/native.mjs
CHANGED
|
@@ -1,4 +1,71 @@
|
|
|
1
1
|
//#region src/native.ts
|
|
2
|
+
/** Exhaustive runtime-member contract shared by loaders and parity gates. */
|
|
3
|
+
const NATIVE_BINDING_PARITY_MEMBERS = {
|
|
4
|
+
root: [
|
|
5
|
+
"convertExternalDetectionBatch",
|
|
6
|
+
"externalDetectionLimitsJson",
|
|
7
|
+
"extractDocxTextJson",
|
|
8
|
+
"inspectPdfJson",
|
|
9
|
+
"rewritePdfRasterFromDetectionsJson",
|
|
10
|
+
"rewriteDocxTextNative",
|
|
11
|
+
"planDocxRestorationJson",
|
|
12
|
+
"normalizeForSearch",
|
|
13
|
+
"nativePackageVersion",
|
|
14
|
+
"prepareStaticSearchPackageBytes",
|
|
15
|
+
"prepareStaticSearchCompressedPackageBytes",
|
|
16
|
+
"assembleStaticSearchConfigJson",
|
|
17
|
+
"assembleStaticSearchPackageBytes",
|
|
18
|
+
"assembleStaticSearchCompressedPackageBytes"
|
|
19
|
+
],
|
|
20
|
+
factories: [
|
|
21
|
+
"fromConfigJsonBytes",
|
|
22
|
+
"fromPreparedPackageBytes",
|
|
23
|
+
"fromPreparedPackageBytesWithoutCache",
|
|
24
|
+
"fromTrustedPreparedPackageBytes",
|
|
25
|
+
"fromTrustedPreparedPackageBytesWithoutCache"
|
|
26
|
+
],
|
|
27
|
+
prepared: [
|
|
28
|
+
"prepareDiagnosticsJson",
|
|
29
|
+
"warmLazyRegex",
|
|
30
|
+
"warmLazyRegexDiagnosticsJson",
|
|
31
|
+
"createRedactionSession",
|
|
32
|
+
"createRedactionSessionWithLifecycle",
|
|
33
|
+
"restoreRedactionSession",
|
|
34
|
+
"restoreEncryptedRedactionSession",
|
|
35
|
+
"redactStaticEntities",
|
|
36
|
+
"redactStaticEntitiesJson",
|
|
37
|
+
"redactStaticEntitiesWithCallerDetectionsJson",
|
|
38
|
+
"redactStaticEntitiesWithCallerDetectionsDiagnosticsJson",
|
|
39
|
+
"redactStaticEntitiesResultStreamJson",
|
|
40
|
+
"redactStaticEntitiesDiagnosticsJson",
|
|
41
|
+
"redactStaticEntitiesDiagnosticsStreamJson",
|
|
42
|
+
"redactStaticEntitiesSummaryDiagnosticsJson"
|
|
43
|
+
],
|
|
44
|
+
session: [
|
|
45
|
+
"sessionId",
|
|
46
|
+
"mappingCount",
|
|
47
|
+
"restoreText",
|
|
48
|
+
"restoreTextAt",
|
|
49
|
+
"toPlaintextJson",
|
|
50
|
+
"toPlaintextJsonAt",
|
|
51
|
+
"toEncryptedArchive",
|
|
52
|
+
"toEncryptedArchiveAt",
|
|
53
|
+
"inspectJson",
|
|
54
|
+
"deleteJson",
|
|
55
|
+
"redactStaticEntitiesJson",
|
|
56
|
+
"redactStaticEntitiesJsonAt",
|
|
57
|
+
"planStaticEntitiesWithCallerDetections"
|
|
58
|
+
],
|
|
59
|
+
plan: ["resultJson", "commit"]
|
|
60
|
+
};
|
|
61
|
+
const isBindingPropertyBag = (value) => typeof value === "object" && value !== null || typeof value === "function";
|
|
62
|
+
/** Validate the complete runtime-neutral root and factory binding shape. */
|
|
63
|
+
const isNativeAnonymizeBinding = (candidate) => {
|
|
64
|
+
if (!isBindingPropertyBag(candidate)) return false;
|
|
65
|
+
if (!NATIVE_BINDING_PARITY_MEMBERS.root.every((name) => typeof candidate[name] === "function")) return false;
|
|
66
|
+
const preparedSearch = candidate["NativePreparedSearch"];
|
|
67
|
+
return isBindingPropertyBag(preparedSearch) && NATIVE_BINDING_PARITY_MEMBERS.factories.every((name) => typeof preparedSearch[name] === "function");
|
|
68
|
+
};
|
|
2
69
|
const CALLER_DETECTION_CONTRACT_VERSION = 2;
|
|
3
70
|
const EXTERNAL_DETECTION_BATCH_VERSION = 1;
|
|
4
71
|
const EXTERNAL_DETECTION_BATCH_MAX_BYTES = 16 * 1024 * 1024;
|
|
@@ -13,9 +80,7 @@ const EXTERNAL_DETECTION_OFFSET_UNITS = {
|
|
|
13
80
|
utf8Byte: "utf8-byte"
|
|
14
81
|
};
|
|
15
82
|
const convert_external_detection_batch = ({ binding, document, batch }) => {
|
|
16
|
-
|
|
17
|
-
if (convert === void 0) throw new Error("Native anonymize binding does not support external detection batches");
|
|
18
|
-
return convert(document, typeof batch === "string" ? batch : JSON.stringify(batch));
|
|
83
|
+
return binding.convertExternalDetectionBatch(document, typeof batch === "string" ? batch : JSON.stringify(batch));
|
|
19
84
|
};
|
|
20
85
|
const callerDetectionRequestJson = (detections) => JSON.stringify({
|
|
21
86
|
version: 2,
|
|
@@ -46,14 +111,8 @@ var PreparedNativeRedactionSession = class {
|
|
|
46
111
|
return this.mappingCount();
|
|
47
112
|
}
|
|
48
113
|
restoreText(fullText, observedAtEpochSeconds) {
|
|
49
|
-
if (observedAtEpochSeconds === void 0)
|
|
50
|
-
|
|
51
|
-
if (!restore) throw new Error("Native anonymize binding does not support session restoration");
|
|
52
|
-
return restore.call(this.#session, fullText);
|
|
53
|
-
}
|
|
54
|
-
const restore = this.#session.restoreTextAt;
|
|
55
|
-
if (!restore) throw new Error("Native anonymize binding does not support session restoration lifecycle controls");
|
|
56
|
-
return restore.call(this.#session, fullText, observedAtEpochSeconds);
|
|
114
|
+
if (observedAtEpochSeconds === void 0) return this.#session.restoreText(fullText);
|
|
115
|
+
return this.#session.restoreTextAt(fullText, observedAtEpochSeconds);
|
|
57
116
|
}
|
|
58
117
|
restore_text(fullText, observedAtEpochSeconds) {
|
|
59
118
|
return this.restoreText(fullText, observedAtEpochSeconds);
|
|
@@ -65,33 +124,25 @@ var PreparedNativeRedactionSession = class {
|
|
|
65
124
|
return this.toPlaintextJson();
|
|
66
125
|
}
|
|
67
126
|
toPlaintextJsonAt(observedAtEpochSeconds) {
|
|
68
|
-
|
|
69
|
-
if (!serialize) throw new Error("Native anonymize binding does not support session lifecycle controls");
|
|
70
|
-
return serialize.call(this.#session, observedAtEpochSeconds);
|
|
127
|
+
return this.#session.toPlaintextJsonAt(observedAtEpochSeconds);
|
|
71
128
|
}
|
|
72
129
|
to_plaintext_json_at(observedAtEpochSeconds) {
|
|
73
130
|
return this.toPlaintextJsonAt(observedAtEpochSeconds);
|
|
74
131
|
}
|
|
75
132
|
toEncryptedArchive(key) {
|
|
76
|
-
|
|
77
|
-
if (!serialize) throw new Error("Native anonymize binding does not support encrypted session archives");
|
|
78
|
-
return serialize.call(this.#session, key);
|
|
133
|
+
return this.#session.toEncryptedArchive(key);
|
|
79
134
|
}
|
|
80
135
|
to_encrypted_archive(key) {
|
|
81
136
|
return this.toEncryptedArchive(key);
|
|
82
137
|
}
|
|
83
138
|
toEncryptedArchiveAt(key, observedAtEpochSeconds) {
|
|
84
|
-
|
|
85
|
-
if (!serialize) throw new Error("Native anonymize binding does not support encrypted session archives");
|
|
86
|
-
return serialize.call(this.#session, key, observedAtEpochSeconds);
|
|
139
|
+
return this.#session.toEncryptedArchiveAt(key, observedAtEpochSeconds);
|
|
87
140
|
}
|
|
88
141
|
to_encrypted_archive_at(key, observedAtEpochSeconds) {
|
|
89
142
|
return this.toEncryptedArchiveAt(key, observedAtEpochSeconds);
|
|
90
143
|
}
|
|
91
144
|
inspect(observedAtEpochSeconds) {
|
|
92
|
-
const
|
|
93
|
-
if (!inspect) throw new Error("Native anonymize binding does not support session lifecycle controls");
|
|
94
|
-
const metadata = JSON.parse(inspect.call(this.#session, observedAtEpochSeconds));
|
|
145
|
+
const metadata = JSON.parse(this.#session.inspectJson(observedAtEpochSeconds));
|
|
95
146
|
return {
|
|
96
147
|
sessionId: metadata.session_id,
|
|
97
148
|
createdAtEpochSeconds: metadata.created_at_epoch_seconds,
|
|
@@ -101,9 +152,7 @@ var PreparedNativeRedactionSession = class {
|
|
|
101
152
|
};
|
|
102
153
|
}
|
|
103
154
|
delete() {
|
|
104
|
-
const
|
|
105
|
-
if (!deleteSession) throw new Error("Native anonymize binding does not support session lifecycle controls");
|
|
106
|
-
const summary = JSON.parse(deleteSession.call(this.#session));
|
|
155
|
+
const summary = JSON.parse(this.#session.deleteJson());
|
|
107
156
|
return {
|
|
108
157
|
sessionId: summary.session_id,
|
|
109
158
|
deletedMappingCount: summary.deleted_mapping_count
|
|
@@ -139,18 +188,14 @@ var PreparedNativeRedactionSession = class {
|
|
|
139
188
|
return this.redactStaticEntitiesAt(options);
|
|
140
189
|
}
|
|
141
190
|
redactTextJsonAt({ fullText, observedAtEpochSeconds, operators }) {
|
|
142
|
-
|
|
143
|
-
if (!redact) throw new Error("Native anonymize binding does not support session lifecycle controls");
|
|
144
|
-
return redact.call(this.#session, fullText, observedAtEpochSeconds, toBindingOperatorConfig(operators));
|
|
191
|
+
return this.#session.redactStaticEntitiesJsonAt(fullText, observedAtEpochSeconds, toBindingOperatorConfig(operators));
|
|
145
192
|
}
|
|
146
193
|
redact_text_json_at(options) {
|
|
147
194
|
return this.redactTextJsonAt(options);
|
|
148
195
|
}
|
|
149
196
|
planTextBatchWithCallerDetections({ inputs, operators, observedAtEpochSeconds }) {
|
|
150
|
-
const plan = this.#session.planStaticEntitiesWithCallerDetections;
|
|
151
|
-
if (!plan) throw new Error("Native anonymize binding does not support transactional caller-detection session plans");
|
|
152
197
|
const bindingOperators = toBindingOperatorConfig(operators);
|
|
153
|
-
return new PreparedNativeSessionRedactionPlan(
|
|
198
|
+
return new PreparedNativeSessionRedactionPlan(this.#session.planStaticEntitiesWithCallerDetections({
|
|
154
199
|
inputs: inputs.map(({ detections, fullText }) => ({
|
|
155
200
|
fullText,
|
|
156
201
|
requestJson: callerDetectionRequestJson(detections)
|
|
@@ -182,56 +227,43 @@ var PreparedNativeAnonymizer = class {
|
|
|
182
227
|
this.#prepared = prepared;
|
|
183
228
|
}
|
|
184
229
|
prepareDiagnosticsJson() {
|
|
185
|
-
return this.#prepared.prepareDiagnosticsJson
|
|
230
|
+
return this.#prepared.prepareDiagnosticsJson();
|
|
186
231
|
}
|
|
187
232
|
prepare_diagnostics_json() {
|
|
188
233
|
return this.prepareDiagnosticsJson();
|
|
189
234
|
}
|
|
190
235
|
warmLazyRegex() {
|
|
191
|
-
|
|
192
|
-
this.#prepared.warmLazyRegex();
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
this.#prepared.warm_lazy_regex?.();
|
|
236
|
+
this.#prepared.warmLazyRegex();
|
|
196
237
|
}
|
|
197
238
|
warm_lazy_regex() {
|
|
198
239
|
this.warmLazyRegex();
|
|
199
240
|
}
|
|
200
241
|
warmLazyRegexDiagnosticsJson() {
|
|
201
|
-
|
|
202
|
-
return this.#prepared.warm_lazy_regex_diagnostics_json?.() ?? null;
|
|
242
|
+
return this.#prepared.warmLazyRegexDiagnosticsJson();
|
|
203
243
|
}
|
|
204
244
|
warm_lazy_regex_diagnostics_json() {
|
|
205
245
|
return this.warmLazyRegexDiagnosticsJson();
|
|
206
246
|
}
|
|
207
247
|
createRedactionSession(sessionId) {
|
|
208
|
-
|
|
209
|
-
if (!create) throw new Error("Native anonymize binding does not support redaction sessions");
|
|
210
|
-
return new PreparedNativeRedactionSession(create.call(this.#prepared, sessionId));
|
|
248
|
+
return new PreparedNativeRedactionSession(this.#prepared.createRedactionSession(sessionId));
|
|
211
249
|
}
|
|
212
250
|
create_redaction_session(sessionId) {
|
|
213
251
|
return this.createRedactionSession(sessionId);
|
|
214
252
|
}
|
|
215
253
|
createRedactionSessionWithLifecycle({ sessionId, createdAtEpochSeconds, expiresAtEpochSeconds }) {
|
|
216
|
-
|
|
217
|
-
if (!create) throw new Error("Native anonymize binding does not support session lifecycle controls");
|
|
218
|
-
return new PreparedNativeRedactionSession(create.call(this.#prepared, sessionId, createdAtEpochSeconds, expiresAtEpochSeconds));
|
|
254
|
+
return new PreparedNativeRedactionSession(this.#prepared.createRedactionSessionWithLifecycle(sessionId, createdAtEpochSeconds, expiresAtEpochSeconds));
|
|
219
255
|
}
|
|
220
256
|
create_redaction_session_with_lifecycle(options) {
|
|
221
257
|
return this.createRedactionSessionWithLifecycle(options);
|
|
222
258
|
}
|
|
223
259
|
restoreRedactionSession(plaintextJson) {
|
|
224
|
-
|
|
225
|
-
if (!restore) throw new Error("Native anonymize binding does not support redaction sessions");
|
|
226
|
-
return new PreparedNativeRedactionSession(restore.call(this.#prepared, plaintextJson));
|
|
260
|
+
return new PreparedNativeRedactionSession(this.#prepared.restoreRedactionSession(plaintextJson));
|
|
227
261
|
}
|
|
228
262
|
restore_redaction_session(plaintextJson) {
|
|
229
263
|
return this.restoreRedactionSession(plaintextJson);
|
|
230
264
|
}
|
|
231
265
|
restoreEncryptedRedactionSession({ archive, key, expectedSessionId, observedAtEpochSeconds }) {
|
|
232
|
-
|
|
233
|
-
if (!restore) throw new Error("Native anonymize binding does not support encrypted session archives");
|
|
234
|
-
return new PreparedNativeRedactionSession(restore.call(this.#prepared, {
|
|
266
|
+
return new PreparedNativeRedactionSession(this.#prepared.restoreEncryptedRedactionSession({
|
|
235
267
|
archive,
|
|
236
268
|
key,
|
|
237
269
|
expectedSessionId,
|
|
@@ -249,11 +281,9 @@ var PreparedNativeAnonymizer = class {
|
|
|
249
281
|
}
|
|
250
282
|
redact_text_json(fullText, operators) {
|
|
251
283
|
const bindingOperators = toBindingOperatorConfig(operators);
|
|
252
|
-
|
|
253
|
-
return JSON.stringify(toBindingStaticRedactionResult(toNativeStaticRedactionResult(this.#prepared.redactStaticEntities(fullText, bindingOperators))));
|
|
284
|
+
return this.#prepared.redactStaticEntitiesJson(fullText, bindingOperators);
|
|
254
285
|
}
|
|
255
286
|
redactStaticEntitiesWithCallerDetections(fullText, options) {
|
|
256
|
-
if (!this.#prepared.redactStaticEntitiesWithCallerDetectionsJson) throw new Error("Native anonymize binding does not support caller detections");
|
|
257
287
|
const requestJson = callerDetectionRequestJson(options.detections);
|
|
258
288
|
const operators = toBindingOperatorConfig(options.operators);
|
|
259
289
|
const result = JSON.parse(this.#prepared.redactStaticEntitiesWithCallerDetectionsJson(fullText, {
|
|
@@ -266,11 +296,9 @@ var PreparedNativeAnonymizer = class {
|
|
|
266
296
|
return this.redactStaticEntitiesWithCallerDetections(fullText, options);
|
|
267
297
|
}
|
|
268
298
|
redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(fullText, options) {
|
|
269
|
-
const redact = this.#prepared.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson;
|
|
270
|
-
if (!redact) return null;
|
|
271
299
|
const requestJson = callerDetectionRequestJson(options.detections);
|
|
272
300
|
const operators = toBindingOperatorConfig(options.operators);
|
|
273
|
-
return
|
|
301
|
+
return this.#prepared.redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(fullText, {
|
|
274
302
|
requestJson,
|
|
275
303
|
...operators ? { operators } : {}
|
|
276
304
|
});
|
|
@@ -282,28 +310,24 @@ var PreparedNativeAnonymizer = class {
|
|
|
282
310
|
return this.redact_text_json(fullText, operators);
|
|
283
311
|
}
|
|
284
312
|
redactTextStreamJson(fullText, onEvent, operators) {
|
|
285
|
-
if (!this.#prepared.redactStaticEntitiesResultStreamJson) return null;
|
|
286
313
|
return this.#prepared.redactStaticEntitiesResultStreamJson(fullText, toBindingOperatorConfig(operators), onEvent);
|
|
287
314
|
}
|
|
288
315
|
redact_text_stream_json(fullText, onEvent, operators) {
|
|
289
316
|
return this.redactTextStreamJson(fullText, onEvent, operators);
|
|
290
317
|
}
|
|
291
318
|
redactStaticEntitiesDiagnosticsJson(fullText, operators) {
|
|
292
|
-
if (!this.#prepared.redactStaticEntitiesDiagnosticsJson) return null;
|
|
293
319
|
return this.#prepared.redactStaticEntitiesDiagnosticsJson(fullText, toBindingOperatorConfig(operators));
|
|
294
320
|
}
|
|
295
321
|
diagnostics_json(fullText, operators) {
|
|
296
322
|
return this.redactStaticEntitiesDiagnosticsJson(fullText, operators);
|
|
297
323
|
}
|
|
298
324
|
diagnosticsStreamJson(fullText, onBatch, operators) {
|
|
299
|
-
if (!this.#prepared.redactStaticEntitiesDiagnosticsStreamJson) return null;
|
|
300
325
|
return this.#prepared.redactStaticEntitiesDiagnosticsStreamJson(fullText, toBindingOperatorConfig(operators), onBatch);
|
|
301
326
|
}
|
|
302
327
|
diagnostics_stream_json(fullText, onBatch, operators) {
|
|
303
328
|
return this.diagnosticsStreamJson(fullText, onBatch, operators);
|
|
304
329
|
}
|
|
305
330
|
redactStaticEntitiesSummaryDiagnosticsJson(fullText, operators) {
|
|
306
|
-
if (!this.#prepared.redactStaticEntitiesSummaryDiagnosticsJson) return null;
|
|
307
331
|
return this.#prepared.redactStaticEntitiesSummaryDiagnosticsJson(fullText, toBindingOperatorConfig(operators));
|
|
308
332
|
}
|
|
309
333
|
summary_diagnostics_json(fullText, operators) {
|
|
@@ -470,21 +494,6 @@ const fromCanonicalStaticRedactionResult = (result) => ({
|
|
|
470
494
|
entityCount: result.redaction.entity_count
|
|
471
495
|
}
|
|
472
496
|
});
|
|
473
|
-
const toBindingStaticRedactionResult = (result) => ({
|
|
474
|
-
resolved_entities: result.resolvedEntities.map(toBindingPipelineEntity),
|
|
475
|
-
redaction: {
|
|
476
|
-
redacted_text: result.redaction.redactedText,
|
|
477
|
-
redaction_map: [...result.redaction.redactionMap.entries()].map(([placeholder, original]) => ({
|
|
478
|
-
placeholder,
|
|
479
|
-
original
|
|
480
|
-
})),
|
|
481
|
-
operator_map: [...result.redaction.operatorMap.entries()].map(([placeholder, operator]) => ({
|
|
482
|
-
placeholder,
|
|
483
|
-
operator
|
|
484
|
-
})),
|
|
485
|
-
entity_count: result.redaction.entityCount
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
497
|
const toNativePipelineEntity = (entity) => ({
|
|
489
498
|
start: entity.start,
|
|
490
499
|
end: entity.end,
|
|
@@ -496,12 +505,6 @@ const toNativePipelineEntity = (entity) => ({
|
|
|
496
505
|
...entity.providerId ? { providerId: entity.providerId } : {},
|
|
497
506
|
...entity.detectionId ? { detectionId: entity.detectionId } : {}
|
|
498
507
|
});
|
|
499
|
-
const toBindingPipelineEntity = ({ sourceDetail, providerId, detectionId, ...entity }) => ({
|
|
500
|
-
...entity,
|
|
501
|
-
source_detail: sourceDetail ?? null,
|
|
502
|
-
provider_id: providerId ?? null,
|
|
503
|
-
detection_id: detectionId ?? null
|
|
504
|
-
});
|
|
505
508
|
const toNativeRedactionResult = (result) => ({
|
|
506
509
|
redactedText: result.redactedText,
|
|
507
510
|
redactionMap: toRedactionMap(result.redactionMap),
|
|
@@ -519,6 +522,6 @@ const toOperatorMap = (entries) => {
|
|
|
519
522
|
return map;
|
|
520
523
|
};
|
|
521
524
|
//#endregion
|
|
522
|
-
export { 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, convert_external_detection_batch, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromPackage, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getNativeBindingVersion, load_prepared_package, native_package_version, normalize_for_search, prepareNativeSearchPackage, prepare_search_package, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
|
|
525
|
+
export { 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, NATIVE_BINDING_PARITY_MEMBERS, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedSearch, assertNativeBindingVersion, convert_external_detection_batch, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromPackage, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, getNativeBindingVersion, isNativeAnonymizeBinding, load_prepared_package, native_package_version, normalize_for_search, prepareNativeSearchPackage, prepare_search_package, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
|
|
523
526
|
|
|
524
527
|
//# sourceMappingURL=native.mjs.map
|