@waswrongassembled/pii-shield 0.0.0-stage → 0.1.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 (127) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +22 -0
  3. package/README.md +276 -2
  4. package/dist/ai-sdk/index.d.ts +19 -0
  5. package/dist/ai-sdk/index.js +30 -0
  6. package/dist/ai-sdk/middleware.d.ts +63 -0
  7. package/dist/ai-sdk/middleware.js +388 -0
  8. package/dist/bin.d.ts +2 -0
  9. package/dist/bin.js +9 -0
  10. package/dist/cli.d.ts +2 -0
  11. package/dist/cli.js +124 -0
  12. package/dist/detector.d.ts +28 -0
  13. package/dist/detector.js +3 -0
  14. package/dist/detectors/at-svnr.d.ts +14 -0
  15. package/dist/detectors/at-svnr.js +31 -0
  16. package/dist/detectors/authority-context.d.ts +22 -0
  17. package/dist/detectors/authority-context.js +278 -0
  18. package/dist/detectors/birth-date.d.ts +10 -0
  19. package/dist/detectors/birth-date.js +21 -0
  20. package/dist/detectors/email.d.ts +15 -0
  21. package/dist/detectors/email.js +29 -0
  22. package/dist/detectors/file-number.d.ts +16 -0
  23. package/dist/detectors/file-number.js +20 -0
  24. package/dist/detectors/iban.d.ts +10 -0
  25. package/dist/detectors/iban.js +41 -0
  26. package/dist/detectors/license-plate.d.ts +9 -0
  27. package/dist/detectors/license-plate.js +13 -0
  28. package/dist/detectors/phone.d.ts +13 -0
  29. package/dist/detectors/phone.js +38 -0
  30. package/dist/detectors/postal-address.d.ts +14 -0
  31. package/dist/detectors/postal-address.js +19 -0
  32. package/dist/detectors/salutation-person.d.ts +18 -0
  33. package/dist/detectors/salutation-person.js +37 -0
  34. package/dist/detectors/tax-number.d.ts +14 -0
  35. package/dist/detectors/tax-number.js +33 -0
  36. package/dist/entity-extractor.d.ts +47 -0
  37. package/dist/entity-extractor.js +245 -0
  38. package/dist/entity-type.d.ts +24 -0
  39. package/dist/entity-type.js +26 -0
  40. package/dist/entity.d.ts +28 -0
  41. package/dist/entity.js +11 -0
  42. package/dist/errors.d.ts +48 -0
  43. package/dist/errors.js +49 -0
  44. package/dist/index.d.ts +42 -0
  45. package/dist/index.js +40 -0
  46. package/dist/internal/pcre.d.ts +55 -0
  47. package/dist/internal/pcre.js +102 -0
  48. package/dist/internal/php-json.d.ts +15 -0
  49. package/dist/internal/php-json.js +48 -0
  50. package/dist/internal/placeholder-stream.d.ts +24 -0
  51. package/dist/internal/placeholder-stream.js +118 -0
  52. package/dist/internal/text-spans.d.ts +8 -0
  53. package/dist/internal/text-spans.js +15 -0
  54. package/dist/learning/char-set.d.ts +29 -0
  55. package/dist/learning/char-set.js +158 -0
  56. package/dist/learning/custom-entity-detector.d.ts +26 -0
  57. package/dist/learning/custom-entity-detector.js +70 -0
  58. package/dist/learning/custom-entity-type.d.ts +49 -0
  59. package/dist/learning/custom-entity-type.js +150 -0
  60. package/dist/learning/entity-learner.d.ts +50 -0
  61. package/dist/learning/entity-learner.js +87 -0
  62. package/dist/learning/json-file-store.d.ts +36 -0
  63. package/dist/learning/json-file-store.js +132 -0
  64. package/dist/learning/learned-pattern.d.ts +48 -0
  65. package/dist/learning/learned-pattern.js +640 -0
  66. package/dist/learning/pattern-grammar.d.ts +12 -0
  67. package/dist/learning/pattern-grammar.js +148 -0
  68. package/dist/learning/pattern-learner.d.ts +10 -0
  69. package/dist/learning/pattern-learner.js +116 -0
  70. package/dist/learning/store.d.ts +51 -0
  71. package/dist/learning/store.js +84 -0
  72. package/dist/masking/partial-mask.d.ts +23 -0
  73. package/dist/masking/partial-mask.js +43 -0
  74. package/dist/masking/strategy.d.ts +10 -0
  75. package/dist/masking/strategy.js +1 -0
  76. package/dist/masking/type-label-mask.d.ts +17 -0
  77. package/dist/masking/type-label-mask.js +28 -0
  78. package/dist/mcp/index.d.ts +33 -0
  79. package/dist/mcp/index.js +146 -0
  80. package/dist/mcp/tools.d.ts +63 -0
  81. package/dist/mcp/tools.js +183 -0
  82. package/dist/model/chunks.d.ts +13 -0
  83. package/dist/model/chunks.js +74 -0
  84. package/dist/model/model-detector.d.ts +110 -0
  85. package/dist/model/model-detector.js +420 -0
  86. package/dist/model/prompt.d.ts +16 -0
  87. package/dist/model/prompt.js +192 -0
  88. package/dist/pii-masker.d.ts +27 -0
  89. package/dist/pii-masker.js +56 -0
  90. package/dist/pii-shield.d.ts +40 -0
  91. package/dist/pii-shield.js +142 -0
  92. package/dist/placeholder.d.ts +48 -0
  93. package/dist/placeholder.js +138 -0
  94. package/dist/redaction.d.ts +76 -0
  95. package/dist/redaction.js +52 -0
  96. package/dist/server/config.d.ts +23 -0
  97. package/dist/server/config.js +187 -0
  98. package/dist/server/http-server.d.ts +63 -0
  99. package/dist/server/http-server.js +241 -0
  100. package/dist/server/index.d.ts +9 -0
  101. package/dist/server/index.js +9 -0
  102. package/dist/server/model-providers.d.ts +31 -0
  103. package/dist/server/model-providers.js +158 -0
  104. package/dist/service/json-body.d.ts +14 -0
  105. package/dist/service/json-body.js +35 -0
  106. package/dist/service/local-peer.d.ts +16 -0
  107. package/dist/service/local-peer.js +83 -0
  108. package/dist/service/service-api.d.ts +75 -0
  109. package/dist/service/service-api.js +305 -0
  110. package/dist/validators/at-svnr.d.ts +8 -0
  111. package/dist/validators/at-svnr.js +21 -0
  112. package/dist/validators/de-tax-id.d.ts +8 -0
  113. package/dist/validators/de-tax-id.js +35 -0
  114. package/dist/validators/iban.d.ts +5 -0
  115. package/dist/validators/iban.js +24 -0
  116. package/dist/vault/encrypted-vault.d.ts +37 -0
  117. package/dist/vault/encrypted-vault.js +152 -0
  118. package/dist/vault/in-memory-vault.d.ts +17 -0
  119. package/dist/vault/in-memory-vault.js +39 -0
  120. package/dist/vault/memory-vault-storage.d.ts +16 -0
  121. package/dist/vault/memory-vault-storage.js +37 -0
  122. package/dist/vault/vault.d.ts +38 -0
  123. package/dist/vault/vault.js +16 -0
  124. package/dist/vault-redis/index.d.ts +28 -0
  125. package/dist/vault-redis/index.js +33 -0
  126. package/docs/openapi.yaml +422 -0
  127. package/package.json +122 -4
package/package.json CHANGED
@@ -1,6 +1,124 @@
1
1
  {
2
2
  "name": "@waswrongassembled/pii-shield",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Reversible PII redaction for LLM applications with DACH recognizers (AT SVNR, IBAN, tax numbers) and checksum validation. Wire-compatible port of clarifile/pii-shield.",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "waswrongassembled",
8
+ "url": "https://github.com/waswrongassembled"
9
+ },
10
+ "type": "module",
11
+ "keywords": [
12
+ "pii",
13
+ "gdpr",
14
+ "dsgvo",
15
+ "redaction",
16
+ "anonymization",
17
+ "pseudonymization",
18
+ "privacy",
19
+ "llm",
20
+ "ai-sdk",
21
+ "mcp",
22
+ "iban",
23
+ "dach"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/waswrongassembled/pii-shield-js.git"
28
+ },
29
+ "homepage": "https://github.com/waswrongassembled/pii-shield-js#readme",
30
+ "bugs": {
31
+ "url": "https://github.com/waswrongassembled/pii-shield-js/issues"
32
+ },
33
+ "engines": {
34
+ "node": ">=22.12"
35
+ },
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "default": "./dist/index.js"
40
+ },
41
+ "./vault-redis": {
42
+ "types": "./dist/vault-redis/index.d.ts",
43
+ "default": "./dist/vault-redis/index.js"
44
+ },
45
+ "./ai-sdk": {
46
+ "types": "./dist/ai-sdk/index.d.ts",
47
+ "default": "./dist/ai-sdk/index.js"
48
+ },
49
+ "./server": {
50
+ "types": "./dist/server/index.d.ts",
51
+ "default": "./dist/server/index.js"
52
+ },
53
+ "./mcp": {
54
+ "types": "./dist/mcp/index.d.ts",
55
+ "default": "./dist/mcp/index.js"
56
+ },
57
+ "./package.json": "./package.json"
58
+ },
59
+ "bin": {
60
+ "pii-shield": "dist/bin.js"
61
+ },
62
+ "files": [
63
+ "dist",
64
+ "docs/openapi.yaml",
65
+ "CHANGELOG.md"
66
+ ],
67
+ "sideEffects": false,
68
+ "publishConfig": {
69
+ "access": "public",
70
+ "provenance": true
71
+ },
72
+ "scripts": {
73
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && node -e \"fs.chmodSync('dist/bin.js', 0o755)\"",
74
+ "typecheck": "tsc --noEmit",
75
+ "lint": "eslint . && prettier --check .",
76
+ "format": "prettier --write .",
77
+ "test": "vitest run",
78
+ "test:watch": "vitest",
79
+ "check:package": "npm run build && publint --strict && attw --pack . --profile esm-only",
80
+ "test:package": "npm run build && node scripts/test-package.js",
81
+ "fixtures": "php compat/export-fixtures.php",
82
+ "check": "npm run typecheck && npm run lint && npm run test && npm run build",
83
+ "compat:vault": "npm run build && node compat/export-node-payloads.js",
84
+ "prepublishOnly": "npm run build"
85
+ },
86
+ "devDependencies": {
87
+ "@arethetypeswrong/cli": "^0.18.5",
88
+ "@eslint/js": "^10.0.1",
89
+ "@modelcontextprotocol/sdk": "^1.32.2",
90
+ "@types/node": "^22.20.5",
91
+ "@vitest/coverage-v8": "^5.1.1",
92
+ "ai": "^7.0.177",
93
+ "ajv": "^8.20.0",
94
+ "eslint": "^10.15.0",
95
+ "eslint-config-prettier": "^10.1.8",
96
+ "globals": "^17.14.0",
97
+ "ioredis": "^6.0.0",
98
+ "prettier": "^3.10.1",
99
+ "publint": "^0.3.25",
100
+ "typescript": "~6.0.3",
101
+ "typescript-eslint": "^8.73.0",
102
+ "vitest": "^5.1.1",
103
+ "yaml": "^2.9.1"
104
+ },
105
+ "dependencies": {
106
+ "@noble/ciphers": "^2.4.0"
107
+ },
108
+ "peerDependencies": {
109
+ "@modelcontextprotocol/sdk": "^1.32.0",
110
+ "ai": "^7.0.0",
111
+ "ioredis": "^5.0.0 || ^6.0.0"
112
+ },
113
+ "peerDependenciesMeta": {
114
+ "@modelcontextprotocol/sdk": {
115
+ "optional": true
116
+ },
117
+ "ai": {
118
+ "optional": true
119
+ },
120
+ "ioredis": {
121
+ "optional": true
122
+ }
123
+ }
124
+ }