@doccloak/core 0.12.1 → 0.13.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +333 -0
  2. package/NOTICE +5 -0
  3. package/README.md +131 -9
  4. package/dist/dom/errors.d.ts +1 -1
  5. package/dist/dom/ocr.d.ts +33 -7
  6. package/dist/dom/ocr.js +98 -4
  7. package/dist/dom/office.d.ts +20 -6
  8. package/dist/dom/office.js +44 -11
  9. package/dist/engine.js +4 -5
  10. package/dist/env.d.ts +3 -3
  11. package/dist/pdf/cmap.d.ts +83 -0
  12. package/dist/pdf/cmap.js +659 -0
  13. package/dist/pdf/encodings.d.ts +49 -0
  14. package/dist/pdf/encodings.js +181 -0
  15. package/dist/pdf/extract.d.ts +106 -0
  16. package/dist/pdf/extract.js +1064 -0
  17. package/dist/pdf/fallback-fonts.d.ts +146 -0
  18. package/dist/pdf/fallback-fonts.js +312 -0
  19. package/dist/pdf/fit.d.ts +35 -0
  20. package/dist/pdf/fit.js +60 -0
  21. package/dist/pdf/fonts.d.ts +82 -0
  22. package/dist/pdf/fonts.js +465 -0
  23. package/dist/pdf/glyphlist.d.ts +37 -0
  24. package/dist/pdf/glyphlist.js +485 -0
  25. package/dist/pdf/index.d.ts +21 -0
  26. package/dist/pdf/index.js +7 -0
  27. package/dist/pdf/lexer.d.ts +61 -0
  28. package/dist/pdf/lexer.js +554 -0
  29. package/dist/pdf/objects.d.ts +57 -0
  30. package/dist/pdf/objects.js +217 -0
  31. package/dist/pdf/oracle.d.ts +149 -0
  32. package/dist/pdf/oracle.js +384 -0
  33. package/dist/pdf/raster.d.ts +45 -0
  34. package/dist/pdf/raster.js +89 -0
  35. package/dist/pdf/read.d.ts +36 -0
  36. package/dist/pdf/read.js +65 -0
  37. package/dist/pdf/serializer.d.ts +21 -0
  38. package/dist/pdf/serializer.js +106 -0
  39. package/dist/pdf/standard-metrics.d.ts +27 -0
  40. package/dist/pdf/standard-metrics.js +72 -0
  41. package/dist/pdf/surgery.d.ts +131 -0
  42. package/dist/pdf/surgery.js +847 -0
  43. package/dist/pdf/textstate.d.ts +77 -0
  44. package/dist/pdf/textstate.js +280 -0
  45. package/dist/pdf/types.d.ts +191 -0
  46. package/dist/pdf/types.js +11 -0
  47. package/dist/pdf/verify.d.ts +33 -0
  48. package/dist/pdf/verify.js +446 -0
  49. package/dist/pdf/write.d.ts +52 -0
  50. package/dist/pdf/write.js +644 -0
  51. package/dist/pipeline.d.ts +15 -0
  52. package/dist/pipeline.js +123 -8
  53. package/dist/providers/bardsai.d.ts +1 -1
  54. package/dist/providers/bardsai.js +5 -1
  55. package/dist/providers/gliner-base.d.ts +1 -1
  56. package/dist/providers/gliner-base.js +5 -1
  57. package/dist/providers/gliner.d.ts +1 -1
  58. package/dist/providers/gliner.js +5 -1
  59. package/dist/regex/rules.data.js +13 -8
  60. package/dist/types.d.ts +17 -2
  61. package/dist/types.js +17 -0
  62. package/dist/worker-protocol.d.ts +11 -0
  63. package/dist/worker-protocol.js +41 -8
  64. package/fonts/liberation/LICENSE +102 -0
  65. package/fonts/liberation/LiberationMono-Bold.ttf +0 -0
  66. package/fonts/liberation/LiberationMono-BoldItalic.ttf +0 -0
  67. package/fonts/liberation/LiberationMono-Italic.ttf +0 -0
  68. package/fonts/liberation/LiberationMono-Regular.ttf +0 -0
  69. package/fonts/liberation/LiberationSans-Bold.ttf +0 -0
  70. package/fonts/liberation/LiberationSans-BoldItalic.ttf +0 -0
  71. package/fonts/liberation/LiberationSans-Italic.ttf +0 -0
  72. package/fonts/liberation/LiberationSans-Regular.ttf +0 -0
  73. package/fonts/liberation/LiberationSerif-Bold.ttf +0 -0
  74. package/fonts/liberation/LiberationSerif-BoldItalic.ttf +0 -0
  75. package/fonts/liberation/LiberationSerif-Italic.ttf +0 -0
  76. package/fonts/liberation/LiberationSerif-Regular.ttf +0 -0
  77. package/package.json +11 -2
  78. package/rules/pl.json +7 -3
  79. package/rules/universal.json +6 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doccloak/core",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "Environment-agnostic document anonymization engine for the DocCloak ecosystem.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Witold Lojek",
@@ -23,11 +23,16 @@
23
23
  "./worker-protocol": {
24
24
  "types": "./dist/worker-protocol.d.ts",
25
25
  "default": "./dist/worker-protocol.js"
26
+ },
27
+ "./pdf": {
28
+ "types": "./dist/pdf/index.d.ts",
29
+ "default": "./dist/pdf/index.js"
26
30
  }
27
31
  },
28
32
  "files": [
29
33
  "dist",
30
34
  "rules",
35
+ "fonts",
31
36
  "LICENSE",
32
37
  "NOTICE",
33
38
  "README.md",
@@ -42,7 +47,8 @@
42
47
  "gdpr",
43
48
  "onnx",
44
49
  "docx",
45
- "ocr"
50
+ "ocr",
51
+ "pdf"
46
52
  ],
47
53
  "repository": {
48
54
  "type": "git",
@@ -74,9 +80,12 @@
74
80
  "vitest": "4.1.0"
75
81
  },
76
82
  "dependencies": {
83
+ "@cantoo/fontkit": "2.0.12",
84
+ "@cantoo/pdf-lib": "2.11.1",
77
85
  "cfb": "1.2.2",
78
86
  "jszip": "3.10.1",
79
87
  "onnxruntime-web": "1.29.0",
88
+ "pdfjs-dist": "6.3.289",
80
89
  "tesseract.js": "7.0.0"
81
90
  }
82
91
  }
package/rules/pl.json CHANGED
@@ -100,17 +100,21 @@
100
100
  {
101
101
  "id": "regex:pl:phone",
102
102
  "entityType": "PHONE",
103
- "pattern": "\\b(?:\\+?48[\\s-]?)?\\d{3}[\\s-]?\\d{3}[\\s-]?\\d{3}\\b",
103
+ "pattern": "(?:\\+?48[\\s-]?)?(?:\\(\\d{2}\\)|\\b\\d{2})[\\s-]?\\d{3}[\\s-]?\\d{2}[\\s-]?\\d{2}\\b|(?:\\+?48[\\s-]?)?\\b\\d{3}[\\s-]?\\d{3}[\\s-]?\\d{3}\\b",
104
104
  "flags": "g",
105
105
  "confidence": 0.8,
106
106
  "domains": [
107
107
  "contact"
108
108
  ],
109
- "description": "Polish phone number (9 digits, optionally with +48 prefix)",
109
+ "description": "Polish phone number: 9 digits as mobile 3-3-3 or landline 2-3-2-2 (area code optionally in brackets), optionally with +48 prefix",
110
110
  "examples": [
111
111
  "+48 600 123 456",
112
112
  "600-123-456",
113
- "48 600123456"
113
+ "48 600123456",
114
+ "22 555 01 02",
115
+ "(22) 555-01-02",
116
+ "+48 22 555 01 02",
117
+ "22 5550102"
114
118
  ]
115
119
  },
116
120
  {
@@ -35,7 +35,7 @@
35
35
  {
36
36
  "id": "regex:universal:iban",
37
37
  "entityType": "IBAN",
38
- "pattern": "\\b[A-Z]{2}\\s?\\d{2}[\\s]?[A-Z\\d\\s]{10,30}\\b",
38
+ "pattern": "\\b[A-Z]{2}\\s?\\d{2}\\s?[A-Z\\d\\s]{9,29}[A-Z\\d]\\b",
39
39
  "flags": "g",
40
40
  "confidence": 0.9,
41
41
  "domains": [
@@ -262,18 +262,19 @@
262
262
  {
263
263
  "id": "regex:universal:postal_city",
264
264
  "entityType": "ADDRESS",
265
- "pattern": "\\b\\d{2,5}[-\\s]?\\d{2,4}\\s+[\\p{L}][\\p{L}]+(?![\\p{L}\\p{N}])",
265
+ "pattern": "(?:^|\\s)(?!\\d{4}-(?:\\d{2}|\\d{4})\\s)\\d{2,5}[-\\s]?\\d{2,4}\\s+[\\p{Lu}][\\p{L}]+(?![\\p{L}\\p{N}])",
266
266
  "flags": "gu",
267
267
  "confidence": 0.65,
268
268
  "domains": [
269
269
  "contact"
270
270
  ],
271
- "description": "Postal/zip code followed by city name (various country formats)",
271
+ "description": "Postal/zip code followed by a capitalised city name (various country formats); the code must not be glued to a preceding digit, slash, dot or hyphen",
272
272
  "examples": [
273
273
  "00-950 Warszawa",
274
- "75008 Paris"
274
+ "75008 Paris",
275
+ "1010 Wien"
275
276
  ],
276
- "falsePositiveNotes": "May match non-address number+word sequences"
277
+ "falsePositiveNotes": "May match non-address number+word sequences (a number followed by a capitalised word)"
277
278
  },
278
279
  {
279
280
  "id": "regex:universal:aws_access_key",