@stll/anonymize-pdf 3.0.0 → 3.0.2
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/dist/index.d.mts +35 -35
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -99,7 +99,7 @@ type PdfRasterRewrite = {
|
|
|
99
99
|
fillRgb: readonly [number, number, number];
|
|
100
100
|
pages: readonly PdfRasterPage[];
|
|
101
101
|
};
|
|
102
|
-
declare const PDF_RASTER_CERTIFICATE_CONTRACT_VERSION: 2;
|
|
102
|
+
export declare const PDF_RASTER_CERTIFICATE_CONTRACT_VERSION: 2;
|
|
103
103
|
type PdfRasterRewriteCertificate = {
|
|
104
104
|
contractVersion: typeof PDF_RASTER_CERTIFICATE_CONTRACT_VERSION;
|
|
105
105
|
pageCount: number;
|
|
@@ -118,7 +118,7 @@ type PdfRasterRewriteResult = {
|
|
|
118
118
|
document: Uint8Array;
|
|
119
119
|
certificate: PdfRasterRewriteCertificate;
|
|
120
120
|
};
|
|
121
|
-
declare const PDF_INSPECTION_ERROR_CODES: {
|
|
121
|
+
export declare const PDF_INSPECTION_ERROR_CODES: {
|
|
122
122
|
readonly documentLimitExceeded: "document-limit-exceeded";
|
|
123
123
|
readonly invalidDocument: "invalid-document";
|
|
124
124
|
readonly invalidObservation: "invalid-observation";
|
|
@@ -126,7 +126,7 @@ declare const PDF_INSPECTION_ERROR_CODES: {
|
|
|
126
126
|
readonly providerFailed: "provider-failed";
|
|
127
127
|
};
|
|
128
128
|
type PdfInspectionErrorCode = (typeof PDF_INSPECTION_ERROR_CODES)[keyof typeof PDF_INSPECTION_ERROR_CODES];
|
|
129
|
-
declare const PDF_RASTER_ERROR_CODES: {
|
|
129
|
+
export declare const PDF_RASTER_ERROR_CODES: {
|
|
130
130
|
readonly detectionFailed: "detection-failed";
|
|
131
131
|
readonly invalidContract: "invalid-contract";
|
|
132
132
|
readonly limitExceeded: "limit-exceeded";
|
|
@@ -136,7 +136,7 @@ declare const PDF_RASTER_ERROR_CODES: {
|
|
|
136
136
|
type PdfRasterErrorCode = (typeof PDF_RASTER_ERROR_CODES)[keyof typeof PDF_RASTER_ERROR_CODES];
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region src/local-provider.d.ts
|
|
139
|
-
declare const PDF_LOCAL_PROVIDER_ERROR_CODES: {
|
|
139
|
+
export declare const PDF_LOCAL_PROVIDER_ERROR_CODES: {
|
|
140
140
|
readonly cleanupFailed: "cleanup-failed";
|
|
141
141
|
readonly executableFailed: "executable-failed";
|
|
142
142
|
readonly invalidOptions: "invalid-options";
|
|
@@ -145,7 +145,7 @@ declare const PDF_LOCAL_PROVIDER_ERROR_CODES: {
|
|
|
145
145
|
readonly sourceRejected: "source-rejected";
|
|
146
146
|
};
|
|
147
147
|
type PdfLocalProviderErrorCode = (typeof PDF_LOCAL_PROVIDER_ERROR_CODES)[keyof typeof PDF_LOCAL_PROVIDER_ERROR_CODES];
|
|
148
|
-
declare class PdfLocalProviderError extends Error {
|
|
148
|
+
export declare class PdfLocalProviderError extends Error {
|
|
149
149
|
readonly code: PdfLocalProviderErrorCode;
|
|
150
150
|
constructor(code: PdfLocalProviderErrorCode, message: string);
|
|
151
151
|
}
|
|
@@ -168,42 +168,42 @@ type LocalPdfRasterObservation = {
|
|
|
168
168
|
provider: PdfRasterProvider;
|
|
169
169
|
pages: readonly LocalPdfRasterPage[];
|
|
170
170
|
};
|
|
171
|
-
declare const renderPdfWithPopplerTesseract: (options: RenderPdfWithPopplerTesseractOptions) => Promise<LocalPdfRasterObservation>;
|
|
171
|
+
export declare const renderPdfWithPopplerTesseract: (options: RenderPdfWithPopplerTesseractOptions) => Promise<LocalPdfRasterObservation>;
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/index.d.ts
|
|
174
|
-
declare const PDF_INSPECTION_CONTRACT_VERSION: 1;
|
|
175
|
-
declare const PDF_RASTER_CONTRACT_VERSION: 1;
|
|
176
|
-
declare const PDF_RASTER_MAX_PAGE_BYTES: number;
|
|
177
|
-
declare const PDF_RASTER_MAX_TOTAL_BYTES: number;
|
|
178
|
-
declare const PDF_RASTER_MAX_MANUAL_REGIONS = 1000000;
|
|
179
|
-
declare const PDF_RASTER_MAX_OUTPUT_BYTES: number;
|
|
180
|
-
declare const PDF_RASTER_REQUEST_JSON_MAX_BYTES: number;
|
|
181
|
-
declare const PDF_DOCUMENT_MAX_BYTES: number;
|
|
182
|
-
declare const PDF_STREAM_DECOMPRESSED_MAX_BYTES: number;
|
|
183
|
-
declare const PDF_LOADED_PAYLOAD_MAX_BYTES: number;
|
|
184
|
-
declare const PDF_MAX_OBJECTS = 200000;
|
|
185
|
-
declare const PDF_MAX_OBJECT_NODES = 1000000;
|
|
186
|
-
declare const PDF_MAX_OBJECT_DEPTH = 128;
|
|
187
|
-
declare const PDF_MAX_PAGES = 10000;
|
|
188
|
-
declare const PDF_MAX_GLYPHS = 5000000;
|
|
189
|
-
declare const PDF_MAX_PAGE_TEXT_UTF8_BYTES: number;
|
|
190
|
-
declare const PDF_MAX_OBSERVED_TEXT_UTF8_BYTES: number;
|
|
191
|
-
declare const PDF_OBSERVATIONS_JSON_MAX_BYTES: number;
|
|
174
|
+
export declare const PDF_INSPECTION_CONTRACT_VERSION: 1;
|
|
175
|
+
export declare const PDF_RASTER_CONTRACT_VERSION: 1;
|
|
176
|
+
export declare const PDF_RASTER_MAX_PAGE_BYTES: number;
|
|
177
|
+
export declare const PDF_RASTER_MAX_TOTAL_BYTES: number;
|
|
178
|
+
export declare const PDF_RASTER_MAX_MANUAL_REGIONS = 1000000;
|
|
179
|
+
export declare const PDF_RASTER_MAX_OUTPUT_BYTES: number;
|
|
180
|
+
export declare const PDF_RASTER_REQUEST_JSON_MAX_BYTES: number;
|
|
181
|
+
export declare const PDF_DOCUMENT_MAX_BYTES: number;
|
|
182
|
+
export declare const PDF_STREAM_DECOMPRESSED_MAX_BYTES: number;
|
|
183
|
+
export declare const PDF_LOADED_PAYLOAD_MAX_BYTES: number;
|
|
184
|
+
export declare const PDF_MAX_OBJECTS = 200000;
|
|
185
|
+
export declare const PDF_MAX_OBJECT_NODES = 1000000;
|
|
186
|
+
export declare const PDF_MAX_OBJECT_DEPTH = 128;
|
|
187
|
+
export declare const PDF_MAX_PAGES = 10000;
|
|
188
|
+
export declare const PDF_MAX_GLYPHS = 5000000;
|
|
189
|
+
export declare const PDF_MAX_PAGE_TEXT_UTF8_BYTES: number;
|
|
190
|
+
export declare const PDF_MAX_OBSERVED_TEXT_UTF8_BYTES: number;
|
|
191
|
+
export declare const PDF_OBSERVATIONS_JSON_MAX_BYTES: number;
|
|
192
192
|
/** Renderer dimensions may differ by this many points due to numeric rounding. */
|
|
193
|
-
declare const PDF_PAGE_DIMENSION_TOLERANCE_POINTS = 0.25;
|
|
194
|
-
declare class PdfInspectionError extends Error {
|
|
193
|
+
export declare const PDF_PAGE_DIMENSION_TOLERANCE_POINTS = 0.25;
|
|
194
|
+
export declare class PdfInspectionError extends Error {
|
|
195
195
|
readonly code: PdfInspectionErrorCode;
|
|
196
196
|
constructor(code: PdfInspectionErrorCode, message: string);
|
|
197
197
|
}
|
|
198
|
-
declare class PdfRasterError extends Error {
|
|
198
|
+
export declare class PdfRasterError extends Error {
|
|
199
199
|
readonly code: PdfRasterErrorCode;
|
|
200
200
|
constructor(code: PdfRasterErrorCode, message: string);
|
|
201
201
|
}
|
|
202
|
-
type InspectPdfOptions = {
|
|
202
|
+
export type InspectPdfOptions = {
|
|
203
203
|
pageObservations?: readonly PdfPageObservation[];
|
|
204
204
|
};
|
|
205
|
-
declare const inspectPdf: (document: Uint8Array, options?: InspectPdfOptions) => PdfInspection;
|
|
206
|
-
type RewritePdfRasterFromDetectionsOptions = {
|
|
205
|
+
export declare const inspectPdf: (document: Uint8Array, options?: InspectPdfOptions) => PdfInspection;
|
|
206
|
+
export type RewritePdfRasterFromDetectionsOptions = {
|
|
207
207
|
document: Uint8Array;
|
|
208
208
|
request: PdfRasterRewrite;
|
|
209
209
|
/** One opaque, row-packed RGB8 buffer per request page, in page order. */
|
|
@@ -213,8 +213,8 @@ type RewritePdfRasterFromDetectionsOptions = {
|
|
|
213
213
|
* Advanced rewrite-only surface. It verifies structure and destructive pixels but
|
|
214
214
|
* does not run detection or certify that the result is PII-free.
|
|
215
215
|
*/
|
|
216
|
-
declare const rewritePdfRasterFromDetections: ({ document, request, pagePixels }: RewritePdfRasterFromDetectionsOptions) => PdfRasterRewriteResult;
|
|
217
|
-
type PdfRasterObservedPageInput = {
|
|
216
|
+
export declare const rewritePdfRasterFromDetections: ({ document, request, pagePixels }: RewritePdfRasterFromDetectionsOptions) => PdfRasterRewriteResult;
|
|
217
|
+
export type PdfRasterObservedPageInput = {
|
|
218
218
|
observation: PdfPageObservation;
|
|
219
219
|
widthPixels: number;
|
|
220
220
|
heightPixels: number;
|
|
@@ -224,7 +224,7 @@ type PdfRasterObservedPageInput = {
|
|
|
224
224
|
/** User-reviewed regions in normalized displayed-page PDF points. */
|
|
225
225
|
manualRegions?: readonly PdfRect[] | undefined;
|
|
226
226
|
};
|
|
227
|
-
type AnonymizePdfRasterOptions = {
|
|
227
|
+
export type AnonymizePdfRasterOptions = {
|
|
228
228
|
document: Uint8Array;
|
|
229
229
|
pipeline: Pick<PreparedNativePipeline, "redactText" | "redactTextWithCallerDetections">;
|
|
230
230
|
provider: PdfRasterProvider;
|
|
@@ -232,7 +232,7 @@ type AnonymizePdfRasterOptions = {
|
|
|
232
232
|
fillRgb?: readonly [number, number, number] | undefined;
|
|
233
233
|
};
|
|
234
234
|
/** Run stella detection, merge optional external detections, then rewrite pixels. */
|
|
235
|
-
declare const anonymizePdfRaster: ({ document, pipeline, provider, pages, fillRgb }: AnonymizePdfRasterOptions) => PdfRasterRewriteResult;
|
|
235
|
+
export declare const anonymizePdfRaster: ({ document, pipeline, provider, pages, fillRgb }: AnonymizePdfRasterOptions) => PdfRasterRewriteResult;
|
|
236
236
|
//#endregion
|
|
237
|
-
export {
|
|
237
|
+
export type { LocalPdfRasterObservation, LocalPdfRasterPage, PdfGlyphObservation, PdfInspection, PdfInspectionErrorCode, PdfInspectionGap, PdfLocalProviderErrorCode, PdfPageInspection, PdfPageObservation, PdfRasterDetection, PdfRasterErrorCode, PdfRasterPage, PdfRasterProvider, PdfRasterRewrite, PdfRasterRewriteCertificate, PdfRasterRewriteResult, PdfRect, PdfRiskInventory, RenderPdfWithPopplerTesseractOptions };
|
|
238
238
|
//# sourceMappingURL=index.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/anonymize-pdf",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Fail-closed PDF coverage and risk inspection contracts for stella anonymization",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"format": "oxfmt ."
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@stll/anonymize": "3.0.
|
|
35
|
+
"@stll/anonymize": "3.0.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/node": "^26.2
|
|
39
|
-
"bun-types": "1.4.
|
|
40
|
-
"tsdown": "0.
|
|
38
|
+
"@types/node": "^26.6.2",
|
|
39
|
+
"bun-types": "1.4.2",
|
|
40
|
+
"tsdown": "0.23.0",
|
|
41
41
|
"typescript": "7.0.2"
|
|
42
42
|
}
|
|
43
43
|
}
|