@arcjet/redact-wasm 1.9.0 → 1.10.0-rc.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.
@@ -1,9 +1,9 @@
1
- //#region \0./wasm/arcjet_analyze_bindings_redact.component.core2.js
1
+ //#region \0wasm/arcjet_analyze_bindings_redact.component.core2.js
2
2
  /**
3
3
  * This file contains an Arcjet Wasm binary inlined as a base64 Data URL with
4
4
  * the application/wasm MIME type, then decoded into a WebAssembly.Module.
5
5
  */
6
- const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwADAwIAAQQFAXABAgIHFAMBMAAAATEAAQgkaW1wb3J0cwEACiMCDQAgACABIAJBABEAAAsTACAAIAEgAiADIAQgBUEBEQEACwAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjQ0LjA=";
6
+ const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwADAwIAAQQFAXABAgIHFAMBMAAAATEAAQgkaW1wb3J0cwEACiMCDQAgACABIAJBABEAAAsTACAAIAEgAiADIAQgBUEBEQEACwAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjUxLjA=";
7
7
  async function wasm() {
8
8
  const buf = await (await fetch(wasmBase64, { cache: "no-store" })).arrayBuffer();
9
9
  return WebAssembly.compile(buf);
@@ -1,9 +1,9 @@
1
- //#region \0./wasm/arcjet_analyze_bindings_redact.component.core3.js
1
+ //#region \0wasm/arcjet_analyze_bindings_redact.component.core3.js
2
2
  /**
3
3
  * This file contains an Arcjet Wasm binary inlined as a base64 Data URL with
4
4
  * the application/wasm MIME type, then decoded into a WebAssembly.Module.
5
5
  */
6
- const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwACGgMAATAAAAABMQABAAgkaW1wb3J0cwFwAQICCQgBAEEACwIAAQAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjQ0LjA=";
6
+ const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwACGgMAATAAAAABMQABAAgkaW1wb3J0cwFwAQICCQgBAEEACwIAAQAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjUxLjA=";
7
7
  async function wasm() {
8
8
  const buf = await (await fetch(wasmBase64, { cache: "no-store" })).arrayBuffer();
9
9
  return WebAssembly.compile(buf);
@@ -1,6 +1,5 @@
1
1
  import { ArcjetRedactCustomRedact, SensitiveInfoEntity } from "./wasm/interfaces/arcjet-redact-custom-redact.js";
2
2
  import { RedactSensitiveInfoConfig, RedactedSensitiveInfoEntity, instantiate } from "./wasm/arcjet_analyze_bindings_redact.component.js";
3
-
4
3
  //#region src/edge-light.d.ts
5
4
  declare function initializeWasm(detect: CustomDetect, replace: CustomRedact): Promise<Awaited<ReturnType<typeof instantiate>> | undefined>;
6
5
  type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
package/dist/index.d.ts CHANGED
@@ -1,37 +1,36 @@
1
1
  import { ArcjetRedactCustomRedact, SensitiveInfoEntity } from "./wasm/interfaces/arcjet-redact-custom-redact.js";
2
2
  import { RedactSensitiveInfoConfig, RedactedSensitiveInfoEntity, instantiate } from "./wasm/arcjet_analyze_bindings_redact.component.js";
3
-
4
3
  //#region src/index.d.ts
5
4
  /**
6
- * Initialize the WebAssembly.
7
- *
8
- * @param detect
9
- * Custom detection function.
10
- * @param replace
11
- * Custom replacement function.
12
- * @returns
13
- * Promise to the initialized WebAssembly instance.
14
- */
5
+ * Initialize the WebAssembly.
6
+ *
7
+ * @param detect
8
+ * Custom detection function.
9
+ * @param replace
10
+ * Custom replacement function.
11
+ * @returns
12
+ * Promise to the initialized WebAssembly instance.
13
+ */
15
14
  declare function initializeWasm(detect: CustomDetect, replace: CustomRedact): Promise<Awaited<ReturnType<typeof instantiate>> | undefined>;
16
15
  /**
17
- * Detect sensitive info.
18
- *
19
- * @param tokens
20
- * Tokens to detect in.
21
- * @returns
22
- * Array of detected entities.
23
- */
16
+ * Detect sensitive info.
17
+ *
18
+ * @param tokens
19
+ * Tokens to detect in.
20
+ * @returns
21
+ * Array of detected entities.
22
+ */
24
23
  type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
25
24
  /**
26
- * Redact sensitive info.
27
- *
28
- * @param entityType
29
- * Entity to redact.
30
- * @param plaintext
31
- * The plaintext string to redact.
32
- * @returns
33
- * Redacted string.
34
- */
25
+ * Redact sensitive info.
26
+ *
27
+ * @param entityType
28
+ * Entity to redact.
29
+ * @param plaintext
30
+ * The plaintext string to redact.
31
+ * @returns
32
+ * Redacted string.
33
+ */
35
34
  type CustomRedact = typeof ArcjetRedactCustomRedact.redactSensitiveInfo;
36
35
  //#endregion
37
36
  export { type RedactSensitiveInfoConfig, type RedactedSensitiveInfoEntity, type SensitiveInfoEntity, initializeWasm };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { instantiate } from "./wasm/arcjet_analyze_bindings_redact.component.js";
2
- import { wasm } from "./_virtual/_./wasm/arcjet_analyze_bindings_redact.component.core.js";
3
- import { wasm as wasm$1 } from "./_virtual/_./wasm/arcjet_analyze_bindings_redact.component.core2.js";
4
- import { wasm as wasm$2 } from "./_virtual/_./wasm/arcjet_analyze_bindings_redact.component.core3.js";
2
+ import { wasm } from "./_virtual/_wasm/arcjet_analyze_bindings_redact.component.core.js";
3
+ import { wasm as wasm$1 } from "./_virtual/_wasm/arcjet_analyze_bindings_redact.component.core2.js";
4
+ import { wasm as wasm$2 } from "./_virtual/_wasm/arcjet_analyze_bindings_redact.component.core3.js";
5
5
  //#region src/index.ts
6
6
  const componentCoreWasmPromise = wasm();
7
7
  const componentCore2WasmPromise = wasm$1();
@@ -1,5 +1,4 @@
1
1
  import { ArcjetRedactCustomRedact, SensitiveInfoEntity } from "./interfaces/arcjet-redact-custom-redact.js";
2
-
3
2
  //#region src/wasm/arcjet_analyze_bindings_redact.component.d.ts
4
3
  interface RedactSensitiveInfoConfig {
5
4
  entities?: Array<SensitiveInfoEntity>;
@@ -21,24 +20,24 @@ interface Root {
21
20
  redact(content: string, options: RedactSensitiveInfoConfig): Array<RedactedSensitiveInfoEntity>;
22
21
  }
23
22
  /**
24
- * Instantiates this component with the provided imports and
25
- * returns a map of all the exports of the component.
26
- *
27
- * This function is intended to be similar to the
28
- * `WebAssembly.instantiate` function. The second `imports`
29
- * argument is the "import object" for wasm, except here it
30
- * uses component-model-layer types instead of core wasm
31
- * integers/numbers/etc.
32
- *
33
- * The first argument to this function, `getCoreModule`, is
34
- * used to compile core wasm modules within the component.
35
- * Components are composed of core wasm modules and this callback
36
- * will be invoked per core wasm module. The caller of this
37
- * function is responsible for reading the core wasm module
38
- * identified by `path` and returning its compiled
39
- * `WebAssembly.Module` object. This would use `compileStreaming`
40
- * on the web, for example.
41
- */
23
+ * Instantiates this component with the provided imports and
24
+ * returns a map of all the exports of the component.
25
+ *
26
+ * This function is intended to be similar to the
27
+ * `WebAssembly.instantiate` function. The second `imports`
28
+ * argument is the "import object" for wasm, except here it
29
+ * uses component-model-layer types instead of core wasm
30
+ * integers/numbers/etc.
31
+ *
32
+ * The first argument to this function, `getCoreModule`, is
33
+ * used to compile core wasm modules within the component.
34
+ * Components are composed of core wasm modules and this callback
35
+ * will be invoked per core wasm module. The caller of this
36
+ * function is responsible for reading the core wasm module
37
+ * identified by `path` and returning its compiled
38
+ * `WebAssembly.Module` object. This would use `compileStreaming`
39
+ * on the web, for example.
40
+ */
42
41
  declare function instantiate(getCoreModule: (path: string) => WebAssembly.Module, imports: ImportObject, instantiateCore?: (module: WebAssembly.Module, imports: Record<string, any>) => WebAssembly.Instance): Root;
43
42
  declare function instantiate(getCoreModule: (path: string) => WebAssembly.Module | Promise<WebAssembly.Module>, imports: ImportObject, instantiateCore?: (module: WebAssembly.Module, imports: Record<string, any>) => WebAssembly.Instance | Promise<WebAssembly.Instance>): Root | Promise<Root>;
44
43
  //#endregion
package/dist/workerd.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { ArcjetRedactCustomRedact, SensitiveInfoEntity } from "./wasm/interfaces/arcjet-redact-custom-redact.js";
2
2
  import { RedactSensitiveInfoConfig, RedactedSensitiveInfoEntity, instantiate } from "./wasm/arcjet_analyze_bindings_redact.component.js";
3
-
4
3
  //#region src/workerd.d.ts
5
4
  declare function initializeWasm(detect: CustomDetect, replace: CustomRedact): Promise<Awaited<ReturnType<typeof instantiate>> | undefined>;
6
5
  type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcjet/redact-wasm",
3
- "version": "1.9.0",
3
+ "version": "1.10.0-rc.0",
4
4
  "description": "Arcjet sensitive information redaction detection engine",
5
5
  "keywords": [
6
6
  "arcjet",
@@ -54,7 +54,7 @@
54
54
  "scripts": {
55
55
  "build:jco": "jco transpile --instantiation async --no-wasi-shim --out-dir src/wasm/ -- src/wasm/arcjet_analyze_bindings_redact.component.wasm",
56
56
  "build": "npm run build:jco && tsdown",
57
- "typecheck": "tsgo --noEmit",
57
+ "typecheck": "tsc --noEmit",
58
58
  "test-api": "node --test -- test/*.test.ts",
59
59
  "test-coverage": "node --experimental-test-coverage --test -- test/*.test.ts",
60
60
  "test": "npm run build && npm run test-coverage"
@@ -62,9 +62,9 @@
62
62
  "dependencies": {},
63
63
  "devDependencies": {
64
64
  "@bytecodealliance/jco": "1.5.0",
65
- "@types/node": "22.19.21",
66
- "tsdown": "0.22.3",
67
- "typescript": "6.0.3"
65
+ "@types/node": "22.20.1",
66
+ "tsdown": "0.22.7",
67
+ "typescript": "7.0.2"
68
68
  },
69
69
  "engines": {
70
70
  "node": ">=22.21.0 <23 || >=24.5.0"