@arcjet/redact-wasm 1.0.0-alpha.31 → 1.0.0-alpha.32
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/package.json +6 -7
- package/edge-light.ts +0 -56
- package/index.ts +0 -69
- package/workerd.ts +0 -56
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcjet/redact-wasm",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.32",
|
|
4
4
|
"description": "Arcjet sensitive information redaction detection engine",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://arcjet.com",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"wasm/",
|
|
37
37
|
"*.js",
|
|
38
38
|
"*.d.ts",
|
|
39
|
-
"*.ts",
|
|
40
39
|
"!*.config.js"
|
|
41
40
|
],
|
|
42
41
|
"scripts": {
|
|
@@ -49,15 +48,15 @@
|
|
|
49
48
|
},
|
|
50
49
|
"dependencies": {},
|
|
51
50
|
"devDependencies": {
|
|
52
|
-
"@arcjet/eslint-config": "1.0.0-alpha.
|
|
53
|
-
"@arcjet/rollup-config": "1.0.0-alpha.
|
|
54
|
-
"@arcjet/tsconfig": "1.0.0-alpha.
|
|
51
|
+
"@arcjet/eslint-config": "1.0.0-alpha.32",
|
|
52
|
+
"@arcjet/rollup-config": "1.0.0-alpha.32",
|
|
53
|
+
"@arcjet/tsconfig": "1.0.0-alpha.32",
|
|
55
54
|
"@bytecodealliance/jco": "1.5.0",
|
|
56
55
|
"@jest/globals": "29.7.0",
|
|
57
|
-
"@rollup/wasm-node": "4.27.
|
|
56
|
+
"@rollup/wasm-node": "4.27.4",
|
|
58
57
|
"@types/node": "18.18.0",
|
|
59
58
|
"jest": "29.7.0",
|
|
60
|
-
"typescript": "5.
|
|
59
|
+
"typescript": "5.7.2"
|
|
61
60
|
},
|
|
62
61
|
"publishConfig": {
|
|
63
62
|
"access": "public",
|
package/edge-light.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { instantiate } from "./wasm/arcjet_analyze_bindings_redact.component.js";
|
|
2
|
-
import type {
|
|
3
|
-
ImportObject,
|
|
4
|
-
RedactedSensitiveInfoEntity,
|
|
5
|
-
RedactSensitiveInfoConfig,
|
|
6
|
-
SensitiveInfoEntity,
|
|
7
|
-
} from "./wasm/arcjet_analyze_bindings_redact.component.js";
|
|
8
|
-
import type { ArcjetRedactCustomRedact } from "./wasm/interfaces/arcjet-redact-custom-redact.js";
|
|
9
|
-
|
|
10
|
-
import componentCoreWasm from "./wasm/arcjet_analyze_bindings_redact.component.core.wasm?module";
|
|
11
|
-
import componentCore2Wasm from "./wasm/arcjet_analyze_bindings_redact.component.core2.wasm?module";
|
|
12
|
-
import componentCore3Wasm from "./wasm/arcjet_analyze_bindings_redact.component.core3.wasm?module";
|
|
13
|
-
|
|
14
|
-
async function moduleFromPath(path: string): Promise<WebAssembly.Module> {
|
|
15
|
-
if (path === "arcjet_analyze_bindings_redact.component.core.wasm") {
|
|
16
|
-
return componentCoreWasm;
|
|
17
|
-
}
|
|
18
|
-
if (path === "arcjet_analyze_bindings_redact.component.core2.wasm") {
|
|
19
|
-
return componentCore2Wasm;
|
|
20
|
-
}
|
|
21
|
-
if (path === "arcjet_analyze_bindings_redact.component.core3.wasm") {
|
|
22
|
-
return componentCore3Wasm;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw new Error(`Unknown path: ${path}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export async function initializeWasm(
|
|
29
|
-
detect: CustomDetect,
|
|
30
|
-
replace: CustomRedact,
|
|
31
|
-
) {
|
|
32
|
-
const coreImports: ImportObject = {
|
|
33
|
-
"arcjet:redact/custom-redact": {
|
|
34
|
-
detectSensitiveInfo: detect,
|
|
35
|
-
redactSensitiveInfo: replace,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
// Await the instantiation to catch the failure
|
|
41
|
-
return await instantiate(moduleFromPath, coreImports);
|
|
42
|
-
} catch {
|
|
43
|
-
console.debug("WebAssembly is not supported in this runtime");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
|
|
48
|
-
type CustomRedact = typeof ArcjetRedactCustomRedact.redactSensitiveInfo;
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
type CustomDetect,
|
|
52
|
-
type CustomRedact,
|
|
53
|
-
type RedactedSensitiveInfoEntity,
|
|
54
|
-
type RedactSensitiveInfoConfig,
|
|
55
|
-
type SensitiveInfoEntity,
|
|
56
|
-
};
|
package/index.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { instantiate } from "./wasm/arcjet_analyze_bindings_redact.component.js";
|
|
2
|
-
import type {
|
|
3
|
-
ImportObject,
|
|
4
|
-
RedactedSensitiveInfoEntity,
|
|
5
|
-
RedactSensitiveInfoConfig,
|
|
6
|
-
SensitiveInfoEntity,
|
|
7
|
-
} from "./wasm/arcjet_analyze_bindings_redact.component.js";
|
|
8
|
-
import type { ArcjetRedactCustomRedact } from "./wasm/interfaces/arcjet-redact-custom-redact.js";
|
|
9
|
-
|
|
10
|
-
import { wasm as componentCoreWasm } from "./wasm/arcjet_analyze_bindings_redact.component.core.wasm?js";
|
|
11
|
-
import { wasm as componentCore2Wasm } from "./wasm/arcjet_analyze_bindings_redact.component.core2.wasm?js";
|
|
12
|
-
import { wasm as componentCore3Wasm } from "./wasm/arcjet_analyze_bindings_redact.component.core3.wasm?js";
|
|
13
|
-
|
|
14
|
-
const wasmCache = new Map<string, WebAssembly.Module>();
|
|
15
|
-
|
|
16
|
-
async function moduleFromPath(path: string): Promise<WebAssembly.Module> {
|
|
17
|
-
const cachedModule = wasmCache.get(path);
|
|
18
|
-
if (typeof cachedModule !== "undefined") {
|
|
19
|
-
return cachedModule;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (path === "arcjet_analyze_bindings_redact.component.core.wasm") {
|
|
23
|
-
const mod = await componentCoreWasm();
|
|
24
|
-
wasmCache.set(path, mod);
|
|
25
|
-
return mod;
|
|
26
|
-
}
|
|
27
|
-
if (path === "arcjet_analyze_bindings_redact.component.core2.wasm") {
|
|
28
|
-
const mod = await componentCore2Wasm();
|
|
29
|
-
wasmCache.set(path, mod);
|
|
30
|
-
return mod;
|
|
31
|
-
}
|
|
32
|
-
if (path === "arcjet_analyze_bindings_redact.component.core3.wasm") {
|
|
33
|
-
const mod = await componentCore3Wasm();
|
|
34
|
-
wasmCache.set(path, mod);
|
|
35
|
-
return mod;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
throw new Error(`Unknown path: ${path}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export async function initializeWasm(
|
|
42
|
-
detect: CustomDetect,
|
|
43
|
-
replace: CustomRedact,
|
|
44
|
-
) {
|
|
45
|
-
const coreImports: ImportObject = {
|
|
46
|
-
"arcjet:redact/custom-redact": {
|
|
47
|
-
detectSensitiveInfo: detect,
|
|
48
|
-
redactSensitiveInfo: replace,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
// Await the instantiation to catch the failure
|
|
54
|
-
return await instantiate(moduleFromPath, coreImports);
|
|
55
|
-
} catch {
|
|
56
|
-
console.debug("WebAssembly is not supported in this runtime");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
|
|
61
|
-
type CustomRedact = typeof ArcjetRedactCustomRedact.redactSensitiveInfo;
|
|
62
|
-
|
|
63
|
-
export {
|
|
64
|
-
type CustomDetect,
|
|
65
|
-
type CustomRedact,
|
|
66
|
-
type RedactedSensitiveInfoEntity,
|
|
67
|
-
type RedactSensitiveInfoConfig,
|
|
68
|
-
type SensitiveInfoEntity,
|
|
69
|
-
};
|
package/workerd.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { instantiate } from "./wasm/arcjet_analyze_bindings_redact.component.js";
|
|
2
|
-
import type {
|
|
3
|
-
ImportObject,
|
|
4
|
-
RedactedSensitiveInfoEntity,
|
|
5
|
-
RedactSensitiveInfoConfig,
|
|
6
|
-
SensitiveInfoEntity,
|
|
7
|
-
} from "./wasm/arcjet_analyze_bindings_redact.component.js";
|
|
8
|
-
import type { ArcjetRedactCustomRedact } from "./wasm/interfaces/arcjet-redact-custom-redact.js";
|
|
9
|
-
|
|
10
|
-
import componentCoreWasm from "./wasm/arcjet_analyze_bindings_redact.component.core.wasm";
|
|
11
|
-
import componentCore2Wasm from "./wasm/arcjet_analyze_bindings_redact.component.core2.wasm";
|
|
12
|
-
import componentCore3Wasm from "./wasm/arcjet_analyze_bindings_redact.component.core3.wasm";
|
|
13
|
-
|
|
14
|
-
async function moduleFromPath(path: string): Promise<WebAssembly.Module> {
|
|
15
|
-
if (path === "arcjet_analyze_bindings_redact.component.core.wasm") {
|
|
16
|
-
return componentCoreWasm;
|
|
17
|
-
}
|
|
18
|
-
if (path === "arcjet_analyze_bindings_redact.component.core2.wasm") {
|
|
19
|
-
return componentCore2Wasm;
|
|
20
|
-
}
|
|
21
|
-
if (path === "arcjet_analyze_bindings_redact.component.core3.wasm") {
|
|
22
|
-
return componentCore3Wasm;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw new Error(`Unknown path: ${path}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export async function initializeWasm(
|
|
29
|
-
detect: CustomDetect,
|
|
30
|
-
replace: CustomRedact,
|
|
31
|
-
) {
|
|
32
|
-
const coreImports: ImportObject = {
|
|
33
|
-
"arcjet:redact/custom-redact": {
|
|
34
|
-
detectSensitiveInfo: detect,
|
|
35
|
-
redactSensitiveInfo: replace,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
// Await the instantiation to catch the failure
|
|
41
|
-
return await instantiate(moduleFromPath, coreImports);
|
|
42
|
-
} catch {
|
|
43
|
-
console.debug("WebAssembly is not supported in this runtime");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
|
|
48
|
-
type CustomRedact = typeof ArcjetRedactCustomRedact.redactSensitiveInfo;
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
type CustomDetect,
|
|
52
|
-
type CustomRedact,
|
|
53
|
-
type RedactedSensitiveInfoEntity,
|
|
54
|
-
type RedactSensitiveInfoConfig,
|
|
55
|
-
type SensitiveInfoEntity,
|
|
56
|
-
};
|