@form-engine-ts/privacy 4.8.0 → 5.0.1
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 -0
- package/dist/index.cjs +8 -2
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,3 +15,6 @@ import { createStandardPrivacyDetector } from "@form-engine-ts/privacy";
|
|
|
15
15
|
const detector = createStandardPrivacyDetector();
|
|
16
16
|
const findings = detector.detect(schema, values);
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
Use `normalizePiiFindingsToMetadata(findings, userConfirmed)` to persist a compact confirmation flag, distinct finding
|
|
20
|
+
types, and the detected count alongside a submission.
|
package/dist/index.cjs
CHANGED
|
@@ -20,9 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
createStandardPrivacyDetector: () => createStandardPrivacyDetector
|
|
23
|
+
createStandardPrivacyDetector: () => createStandardPrivacyDetector,
|
|
24
|
+
normalizePiiFindingsToMetadata: () => normalizePiiFindingsToMetadata
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
function normalizePiiFindingsToMetadata(findings, userConfirmed) {
|
|
28
|
+
const piiFindingTypes = [...new Set(findings.map((finding) => finding.type))];
|
|
29
|
+
return { piiConfirmed: userConfirmed, piiFindingTypes, piiDetectedCount: findings.length };
|
|
30
|
+
}
|
|
26
31
|
var STANDARD_RULES = [
|
|
27
32
|
{ type: "email", pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/giu },
|
|
28
33
|
{ type: "url", pattern: /\b(?:https?:\/\/|www\.)[^\s<>"']*[A-Z0-9/#]/giu },
|
|
@@ -115,5 +120,6 @@ function createStandardPrivacyDetector(config = {}) {
|
|
|
115
120
|
}
|
|
116
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
117
122
|
0 && (module.exports = {
|
|
118
|
-
createStandardPrivacyDetector
|
|
123
|
+
createStandardPrivacyDetector,
|
|
124
|
+
normalizePiiFindingsToMetadata
|
|
119
125
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -22,6 +22,11 @@ interface PrivacyDetectorConfig {
|
|
|
22
22
|
interface SensitiveDataDetector {
|
|
23
23
|
detect(schema: FormSchema, values: Record<string, unknown>): readonly SensitiveDataFinding[];
|
|
24
24
|
}
|
|
25
|
+
declare function normalizePiiFindingsToMetadata(findings: readonly SensitiveDataFinding[], userConfirmed: boolean): {
|
|
26
|
+
readonly piiConfirmed: boolean;
|
|
27
|
+
readonly piiFindingTypes: readonly string[];
|
|
28
|
+
readonly piiDetectedCount: number;
|
|
29
|
+
};
|
|
25
30
|
declare function createStandardPrivacyDetector(config?: PrivacyDetectorConfig): SensitiveDataDetector;
|
|
26
31
|
|
|
27
|
-
export { type PrivacyDetectorConfig, type SensitiveDataDetector, type SensitiveDataDetectorRule, type SensitiveDataFinding, createStandardPrivacyDetector };
|
|
32
|
+
export { type PrivacyDetectorConfig, type SensitiveDataDetector, type SensitiveDataDetectorRule, type SensitiveDataFinding, createStandardPrivacyDetector, normalizePiiFindingsToMetadata };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ interface PrivacyDetectorConfig {
|
|
|
22
22
|
interface SensitiveDataDetector {
|
|
23
23
|
detect(schema: FormSchema, values: Record<string, unknown>): readonly SensitiveDataFinding[];
|
|
24
24
|
}
|
|
25
|
+
declare function normalizePiiFindingsToMetadata(findings: readonly SensitiveDataFinding[], userConfirmed: boolean): {
|
|
26
|
+
readonly piiConfirmed: boolean;
|
|
27
|
+
readonly piiFindingTypes: readonly string[];
|
|
28
|
+
readonly piiDetectedCount: number;
|
|
29
|
+
};
|
|
25
30
|
declare function createStandardPrivacyDetector(config?: PrivacyDetectorConfig): SensitiveDataDetector;
|
|
26
31
|
|
|
27
|
-
export { type PrivacyDetectorConfig, type SensitiveDataDetector, type SensitiveDataDetectorRule, type SensitiveDataFinding, createStandardPrivacyDetector };
|
|
32
|
+
export { type PrivacyDetectorConfig, type SensitiveDataDetector, type SensitiveDataDetectorRule, type SensitiveDataFinding, createStandardPrivacyDetector, normalizePiiFindingsToMetadata };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
function normalizePiiFindingsToMetadata(findings, userConfirmed) {
|
|
3
|
+
const piiFindingTypes = [...new Set(findings.map((finding) => finding.type))];
|
|
4
|
+
return { piiConfirmed: userConfirmed, piiFindingTypes, piiDetectedCount: findings.length };
|
|
5
|
+
}
|
|
2
6
|
var STANDARD_RULES = [
|
|
3
7
|
{ type: "email", pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/giu },
|
|
4
8
|
{ type: "url", pattern: /\b(?:https?:\/\/|www\.)[^\s<>"']*[A-Z0-9/#]/giu },
|
|
@@ -90,5 +94,6 @@ function createStandardPrivacyDetector(config = {}) {
|
|
|
90
94
|
};
|
|
91
95
|
}
|
|
92
96
|
export {
|
|
93
|
-
createStandardPrivacyDetector
|
|
97
|
+
createStandardPrivacyDetector,
|
|
98
|
+
normalizePiiFindingsToMetadata
|
|
94
99
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@form-engine-ts/privacy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@form-engine-ts/core": "
|
|
41
|
+
"@form-engine-ts/core": "5.0.1"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean --external @form-engine-ts/core",
|