@arcjet/redact 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.
Files changed (2) hide show
  1. package/dist/index.d.ts +50 -51
  2. package/package.json +6 -6
package/dist/index.d.ts CHANGED
@@ -1,71 +1,70 @@
1
1
  import { SensitiveInfoEntity } from "@arcjet/redact-wasm";
2
-
3
2
  //#region src/index.d.ts
4
3
  /**
5
- * Types of standard sensitive information that can be detected.
6
- */
4
+ * Types of standard sensitive information that can be detected.
5
+ */
7
6
  type ArcjetSensitiveInfoType = Exclude<SensitiveInfoEntity["tag"], "custom">;
8
7
  /**
9
- * Options for the `redact` function.
10
- *
11
- * @template DetectedEntities
12
- * Custom entity names that are returned from `detect` and optionally listed in `entities`.
13
- * @template ListedEntities
14
- * Entity names that can be listed in the `entities` option.
15
- */
8
+ * Options for the `redact` function.
9
+ *
10
+ * @template DetectedEntities
11
+ * Custom entity names that are returned from `detect` and optionally listed in `entities`.
12
+ * @template ListedEntities
13
+ * Entity names that can be listed in the `entities` option.
14
+ */
16
15
  type RedactOptions<DetectedEntities extends string | undefined = undefined, ListedEntities extends ArcjetSensitiveInfoType | Exclude<DetectedEntities, undefined> = ArcjetSensitiveInfoType | Exclude<DetectedEntities, undefined>> = {
17
16
  /**
18
- * Entities to redact.
19
- */
17
+ * Entities to redact.
18
+ */
20
19
  entities?: ReadonlyArray<ListedEntities | Exclude<DetectedEntities, undefined>>;
21
20
  /**
22
- * Size of tokens to consider.
23
- */
21
+ * Size of tokens to consider.
22
+ */
24
23
  contextWindowSize?: number;
25
24
  /**
26
- * Custom detection function to identify sensitive information.
27
- *
28
- * @template DetectedEntities
29
- * Custom entity names that are returned from `detect` and optionally listed in `entities`.
30
- * @template ListedEntities
31
- * Entity names that can be listed in the `entities` option.
32
- * @param tokens
33
- * Tokens.
34
- * @returns
35
- * List of entities (or undefined).
36
- */
25
+ * Custom detection function to identify sensitive information.
26
+ *
27
+ * @template DetectedEntities
28
+ * Custom entity names that are returned from `detect` and optionally listed in `entities`.
29
+ * @template ListedEntities
30
+ * Entity names that can be listed in the `entities` option.
31
+ * @param tokens
32
+ * Tokens.
33
+ * @returns
34
+ * List of entities (or undefined).
35
+ */
37
36
  detect?: (tokens: string[]) => ReadonlyArray<DetectedEntities>;
38
37
  /**
39
- * Custom replace function to redact sensitive information.
40
- *
41
- * @template DetectedEntities
42
- * Custom entity names that are returned from `detect` and optionally listed in `entities`.
43
- * @template ListedEntities
44
- * Entity names that can be listed in the `entities` option.
45
- * @param entity
46
- * Entity to redact.
47
- * @param plaintext
48
- * The plaintext string to redact.
49
- * @returns
50
- * Redacted string or nothing.
51
- */
38
+ * Custom replace function to redact sensitive information.
39
+ *
40
+ * @template DetectedEntities
41
+ * Custom entity names that are returned from `detect` and optionally listed in `entities`.
42
+ * @template ListedEntities
43
+ * Entity names that can be listed in the `entities` option.
44
+ * @param entity
45
+ * Entity to redact.
46
+ * @param plaintext
47
+ * The plaintext string to redact.
48
+ * @returns
49
+ * Redacted string or nothing.
50
+ */
52
51
  replace?: (entity: ListedEntities, plaintext: string) => string | undefined;
53
52
  };
54
53
  type Unredact = (input: string) => string;
55
54
  /**
56
- * Redact sensitive info.
57
- *
58
- * @template DetectedEntities
59
- * Custom entity names that are returned from `detect` and optionally listed in `entities`.
60
- * @template ListedEntities
61
- * Entity names that can be listed in the `entities` option.
62
- * @param candidate
63
- * Value to redact.
64
- * @param options
65
- * Configuration.
66
- * @returns
67
- * Promise to a tuple with the redacted string and a function to unredact it.
68
- */
55
+ * Redact sensitive info.
56
+ *
57
+ * @template DetectedEntities
58
+ * Custom entity names that are returned from `detect` and optionally listed in `entities`.
59
+ * @template ListedEntities
60
+ * Entity names that can be listed in the `entities` option.
61
+ * @param candidate
62
+ * Value to redact.
63
+ * @param options
64
+ * Configuration.
65
+ * @returns
66
+ * Promise to a tuple with the redacted string and a function to unredact it.
67
+ */
69
68
  declare function redact<const DetectedEntities extends string | undefined = undefined, const ListedEntities extends ArcjetSensitiveInfoType | Exclude<DetectedEntities, undefined> = ArcjetSensitiveInfoType | Exclude<DetectedEntities, undefined>>(candidate: string, options?: RedactOptions<DetectedEntities, ListedEntities>): Promise<[string, Unredact]>;
70
69
  //#endregion
71
70
  export { ArcjetSensitiveInfoType, RedactOptions, redact };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcjet/redact",
3
- "version": "1.9.0",
3
+ "version": "1.10.0-rc.0",
4
4
  "description": "Arcjet sensitive information redaction library",
5
5
  "keywords": [
6
6
  "arcjet",
@@ -42,18 +42,18 @@
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsdown",
45
- "typecheck": "tsgo --noEmit",
45
+ "typecheck": "tsc --noEmit",
46
46
  "test-api": "node --test -- test/*.test.ts",
47
47
  "test-coverage": "node --experimental-test-coverage --test -- test/*.test.ts",
48
48
  "test": "npm run build && npm run test-coverage"
49
49
  },
50
50
  "dependencies": {
51
- "@arcjet/redact-wasm": "1.9.0"
51
+ "@arcjet/redact-wasm": "1.10.0-rc.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "22.19.21",
55
- "tsdown": "0.22.3",
56
- "typescript": "6.0.3"
54
+ "@types/node": "22.20.1",
55
+ "tsdown": "0.22.7",
56
+ "typescript": "7.0.2"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=22.21.0 <23 || >=24.5.0"