@arcjet/redact 1.0.0-beta.5 → 1.0.0-beta.6
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/index.d.ts +1 -1
- package/index.js +3 -3
- package/package.json +8 -8
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type RedactOptions<Detect> = {
|
|
|
5
5
|
entities?: ValidEntities<Detect>;
|
|
6
6
|
contextWindowSize?: number;
|
|
7
7
|
detect?: Detect;
|
|
8
|
-
replace?: (entity: ValidEntities<Detect>[number]) => string | undefined;
|
|
8
|
+
replace?: (entity: ValidEntities<Detect>[number], plaintext: string) => string | undefined;
|
|
9
9
|
};
|
|
10
10
|
type Unredact = (input: string) => string;
|
|
11
11
|
export declare function redact<const Detect extends DetectSensitiveInfoEntities<CustomEntities> | undefined, const CustomEntities extends string>(candidate: string, options?: RedactOptions<Detect>): Promise<[string, Unredact]>;
|
package/index.js
CHANGED
|
@@ -45,7 +45,7 @@ function performReplacementInText(text, replacement, start, end) {
|
|
|
45
45
|
function noOpDetect(_tokens) {
|
|
46
46
|
return [];
|
|
47
47
|
}
|
|
48
|
-
function noOpReplace(_input) {
|
|
48
|
+
function noOpReplace(_input, _plaintext) {
|
|
49
49
|
return undefined;
|
|
50
50
|
}
|
|
51
51
|
function getWasmOptions(options) {
|
|
@@ -89,10 +89,10 @@ async function callRedactWasm(candidate, options) {
|
|
|
89
89
|
let convertedReplace = noOpReplace;
|
|
90
90
|
if (typeof options?.replace === "function") {
|
|
91
91
|
const replace = options.replace;
|
|
92
|
-
convertedReplace = (identifiedType) => {
|
|
92
|
+
convertedReplace = (identifiedType, plaintext) => {
|
|
93
93
|
return replace(
|
|
94
94
|
// @ts-ignore because we know this is coming from Wasm
|
|
95
|
-
wasmEntitiesToString(identifiedType));
|
|
95
|
+
wasmEntitiesToString(identifiedType), plaintext);
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
const wasm = await initializeWasm(convertedDetect, convertedReplace);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcjet/redact",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "Arcjet sensitive information redaction library",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://arcjet.com",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"test": "node --test --experimental-test-coverage"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@arcjet/redact-wasm": "1.0.0-beta.
|
|
42
|
+
"@arcjet/redact-wasm": "1.0.0-beta.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@arcjet/eslint-config": "1.0.0-beta.
|
|
46
|
-
"@arcjet/rollup-config": "1.0.0-beta.
|
|
47
|
-
"@arcjet/tsconfig": "1.0.0-beta.
|
|
48
|
-
"@rollup/wasm-node": "4.
|
|
45
|
+
"@arcjet/eslint-config": "1.0.0-beta.6",
|
|
46
|
+
"@arcjet/rollup-config": "1.0.0-beta.6",
|
|
47
|
+
"@arcjet/tsconfig": "1.0.0-beta.6",
|
|
48
|
+
"@rollup/wasm-node": "4.40.0",
|
|
49
49
|
"@types/node": "18.18.0",
|
|
50
|
-
"eslint": "9.
|
|
50
|
+
"eslint": "9.24.0",
|
|
51
51
|
"expect": "29.7.0",
|
|
52
|
-
"typescript": "5.8.
|
|
52
|
+
"typescript": "5.8.3"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public",
|