@arcjet/redact-wasm 1.0.0-beta.8 → 1.0.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.
@@ -24,7 +24,7 @@
24
24
  * properly support consistent asset bundling techniques.
25
25
  */
26
26
 
27
- const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwADAwIAAQQFAXABAgIHFAMBMAAAATEAAQgkaW1wb3J0cwEACiMCDQAgACABIAJBABEAAAsTACAAIAEgAiADIAQgBUEBEQEACwAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjI4LjAAlQEEbmFtZQATEndpdC1jb21wb25lbnQ6c2hpbQF5AgA6aW5kaXJlY3QtYXJjamV0OnJlZGFjdC9jdXN0b20tcmVkYWN0LWRldGVjdC1zZW5zaXRpdmUtaW5mbwE6aW5kaXJlY3QtYXJjamV0OnJlZGFjdC9jdXN0b20tcmVkYWN0LXJlZGFjdC1zZW5zaXRpdmUtaW5mbw==";
27
+ const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwADAwIAAQQFAXABAgIHFAMBMAAAATEAAQgkaW1wb3J0cwEACiMCDQAgACABIAJBABEAAAsTACAAIAEgAiADIAQgBUEBEQEACwAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjQzLjA=";
28
28
  /**
29
29
  * Returns a WebAssembly.Module for an Arcjet Wasm binary, decoded from a base64
30
30
  * Data URL.
@@ -24,7 +24,7 @@
24
24
  * properly support consistent asset bundling techniques.
25
25
  */
26
26
 
27
- const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwACGgMAATAAAAABMQABAAgkaW1wb3J0cwFwAQICCQgBAEEACwIAAQAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjI4LjAAHARuYW1lABUUd2l0LWNvbXBvbmVudDpmaXh1cHM=";
27
+ const wasmBase64 = "data:application/wasm;base64,AGFzbQEAAAABEAJgA39/fwBgBn9/f39/fwACGgMAATAAAAABMQABAAgkaW1wb3J0cwFwAQICCQgBAEEACwIAAQAvCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BzAuMjQzLjA=";
28
28
  /**
29
29
  * Returns a WebAssembly.Module for an Arcjet Wasm binary, decoded from a base64
30
30
  * Data URL.
package/index.d.ts CHANGED
@@ -1,6 +1,33 @@
1
- import type { RedactedSensitiveInfoEntity, RedactSensitiveInfoConfig, SensitiveInfoEntity } from "./wasm/arcjet_analyze_bindings_redact.component.js";
2
1
  import type { ArcjetRedactCustomRedact } from "./wasm/interfaces/arcjet-redact-custom-redact.js";
2
+ /**
3
+ * Initialize the WebAssembly.
4
+ *
5
+ * @param detect
6
+ * Custom detection function.
7
+ * @param replace
8
+ * Custom replacement function.
9
+ * @returns
10
+ * Promise to the initialized WebAssembly instance.
11
+ */
3
12
  export declare function initializeWasm(detect: CustomDetect, replace: CustomRedact): Promise<import("./wasm/arcjet_analyze_bindings_redact.component.js").Root | undefined>;
13
+ /**
14
+ * Detect sensitive info.
15
+ *
16
+ * @param tokens
17
+ * Tokens to detect in.
18
+ * @returns
19
+ * Array of detected entities.
20
+ */
4
21
  type CustomDetect = typeof ArcjetRedactCustomRedact.detectSensitiveInfo;
22
+ /**
23
+ * Redact sensitive info.
24
+ *
25
+ * @param entityType
26
+ * Entity to redact.
27
+ * @param plaintext
28
+ * The plaintext string to redact.
29
+ * @returns
30
+ * Redacted string.
31
+ */
5
32
  type CustomRedact = typeof ArcjetRedactCustomRedact.redactSensitiveInfo;
6
- export { type CustomDetect, type CustomRedact, type RedactedSensitiveInfoEntity, type RedactSensitiveInfoConfig, type SensitiveInfoEntity, };
33
+ export type { RedactedSensitiveInfoEntity, RedactSensitiveInfoConfig, SensitiveInfoEntity, } from "./wasm/arcjet_analyze_bindings_redact.component.js";
package/index.js CHANGED
@@ -3,6 +3,9 @@ import { wasm } from './_virtual/arcjet_analyze_bindings_redact.component.core.j
3
3
  import { wasm as wasm$1 } from './_virtual/arcjet_analyze_bindings_redact.component.core2.js';
4
4
  import { wasm as wasm$2 } from './_virtual/arcjet_analyze_bindings_redact.component.core3.js';
5
5
 
6
+ // Support `?js` and such:
7
+ //
8
+ /// <reference types="./wasm.js" />
6
9
  const componentCoreWasmPromise = wasm();
7
10
  const componentCore2WasmPromise = wasm$1();
8
11
  const componentCore3WasmPromise = wasm$2();
@@ -18,6 +21,16 @@ async function moduleFromPath(path) {
18
21
  }
19
22
  throw new Error(`Unknown path: ${path}`);
20
23
  }
24
+ /**
25
+ * Initialize the WebAssembly.
26
+ *
27
+ * @param detect
28
+ * Custom detection function.
29
+ * @param replace
30
+ * Custom replacement function.
31
+ * @returns
32
+ * Promise to the initialized WebAssembly instance.
33
+ */
21
34
  async function initializeWasm(detect, replace) {
22
35
  const coreImports = {
23
36
  "arcjet:redact/custom-redact": {
package/package.json CHANGED
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "name": "@arcjet/redact-wasm",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.0",
4
4
  "description": "Arcjet sensitive information redaction detection engine",
5
+ "keywords": [
6
+ "arcjet",
7
+ "redact",
8
+ "utility",
9
+ "util",
10
+ "wasm"
11
+ ],
5
12
  "license": "Apache-2.0",
6
13
  "homepage": "https://arcjet.com",
7
14
  "repository": {
@@ -19,7 +26,7 @@
19
26
  "url": "https://arcjet.com"
20
27
  },
21
28
  "engines": {
22
- "node": ">=18"
29
+ "node": ">=20"
23
30
  },
24
31
  "type": "module",
25
32
  "main": "./index.js",
@@ -30,33 +37,34 @@
30
37
  "default": "./index.js"
31
38
  },
32
39
  "files": [
33
- "LICENSE",
34
- "README.md",
35
40
  "_virtual/",
36
41
  "wasm/",
37
- "*.js",
38
- "*.d.ts",
39
- "!*.config.js"
42
+ "edge-light.d.ts",
43
+ "edge-light.js",
44
+ "index.d.ts",
45
+ "index.js",
46
+ "workerd.d.ts",
47
+ "workerd.js"
40
48
  ],
41
49
  "scripts": {
42
- "prepublishOnly": "npm run build",
43
- "jco": "jco transpile wasm/arcjet_analyze_bindings_redact.component.wasm --no-wasi-shim --instantiation async -o wasm",
44
- "build": "npm run jco; rollup --config rollup.config.js",
50
+ "build:jco": "jco transpile --instantiation async --no-wasi-shim --out-dir wasm/ -- wasm/arcjet_analyze_bindings_redact.component.wasm",
51
+ "build:rollup": "rollup --config rollup.config.js",
52
+ "build": "npm run build:jco && npm run build:rollup",
45
53
  "lint": "eslint .",
46
- "pretest": "npm run build",
47
- "test": "node --test --experimental-test-coverage"
54
+ "prepublishOnly": "npm run build",
55
+ "test-api": "node --test -- test/*.test.js",
56
+ "test-coverage": "node --experimental-test-coverage --test -- test/*.test.js",
57
+ "test": "npm run build && npm run lint && npm run test-coverage"
48
58
  },
49
59
  "dependencies": {},
50
60
  "devDependencies": {
51
- "@arcjet/eslint-config": "1.0.0-beta.8",
52
- "@arcjet/rollup-config": "1.0.0-beta.8",
53
- "@arcjet/tsconfig": "1.0.0-beta.8",
61
+ "@arcjet/eslint-config": "1.0.0",
62
+ "@arcjet/rollup-config": "1.0.0",
54
63
  "@bytecodealliance/jco": "1.5.0",
55
- "@rollup/wasm-node": "4.41.1",
56
- "@types/node": "18.18.0",
57
- "eslint": "9.27.0",
58
- "expect": "29.7.0",
59
- "typescript": "5.8.3"
64
+ "@rollup/wasm-node": "4.55.1",
65
+ "@types/node": "25.0.8",
66
+ "eslint": "9.39.2",
67
+ "typescript": "5.9.3"
60
68
  },
61
69
  "publishConfig": {
62
70
  "access": "public",
package/wasm.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * Vercel uses the `.wasm?module` suffix to make WebAssembly available in their
3
- * Vercel Functions product.
4
- *
5
- * https://vercel.com/docs/functions/wasm#using-a-webassembly-file
6
- */
7
- declare module "*.wasm?module" {
8
- export default WebAssembly.Module;
9
- }
10
-
11
- /**
12
- * The Cloudflare docs say they support the `.wasm?module` suffix, but that
13
- * seems to no longer be the case with Wrangler 2 so we need to have separate
14
- * imports for just the `.wasm` files.
15
- *
16
- * https://developers.cloudflare.com/workers/runtime-apis/webassembly/javascript/#bundling
17
- */
18
- declare module "*.wasm" {
19
- export default WebAssembly.Module;
20
- }
21
-
22
- /**
23
- * Our Rollup build turns `.wasm?js` imports into JS imports that provide the
24
- * `wasm()` function which decodes a base64 Data URL into a WebAssembly Module
25
- */
26
- declare module "*.wasm?js" {
27
- export function wasm(): Promise<WebAssembly.Module>;
28
- }