@quba/sensitive-data-protection 0.1.0 → 0.2.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.
- package/README.md +58 -6
- package/dist/index.cjs +2884 -569
- package/dist/index.d.cts +3059 -765
- package/dist/index.d.mts +3059 -765
- package/dist/index.mjs +2574 -535
- package/docs/Action.md +33 -0
- package/docs/AnonymizeFileResponseBody.md +43 -0
- package/docs/AnonymizeRequestBody.md +4 -2
- package/docs/AnonymizeResponseBody.md +3 -1
- package/docs/{AnonymizeResponseBodySpansInner.md → Applied.md} +7 -4
- package/docs/At.md +37 -0
- package/docs/AttributeSegment.md +37 -0
- package/docs/{ValidationErrorLocInner.md → CellKind.md} +5 -4
- package/docs/CellNoteSegment.md +35 -0
- package/docs/CellSegment.md +43 -0
- package/docs/CommentKind.md +33 -0
- package/docs/CommentSegment.md +39 -0
- package/docs/ComponentSegment.md +39 -0
- package/docs/DetectRule.md +3 -1
- package/docs/ElementSegment.md +39 -0
- package/docs/EncryptRule.md +3 -1
- package/docs/{DetectRuleEntitiesInner.md → EndnoteSegment.md} +7 -6
- package/docs/{EntitiesAnyOfInner.md → EntityBody.md} +5 -4
- package/docs/ErrorCode.md +33 -0
- package/docs/ErrorInfo.md +39 -0
- package/docs/FieldError.md +51 -0
- package/docs/FieldErrorCode.md +33 -0
- package/docs/{HTTPValidationError.md → FieldErrorPathInner.md} +5 -6
- package/docs/FieldSegment.md +39 -0
- package/docs/FileAttributeResult.md +47 -0
- package/docs/FileEmbeddedResult.md +43 -0
- package/docs/FileModelResult.md +49 -0
- package/docs/{AnonymizeResponseBodyResultsInner.md → FileRegexResult.md} +11 -8
- package/docs/FileResult.md +51 -0
- package/docs/FootnoteSegment.md +37 -0
- package/docs/FrameSegment.md +37 -0
- package/docs/HMACRule.md +43 -0
- package/docs/HeaderFooterSegment.md +37 -0
- package/docs/IndexSegment.md +37 -0
- package/docs/ItemSegment.md +37 -0
- package/docs/KeySegment.md +37 -0
- package/docs/Kind.md +33 -0
- package/docs/LineSegment.md +39 -0
- package/docs/MaskRule.md +3 -1
- package/docs/ModelError.md +2 -3
- package/docs/ModelResult.md +2 -0
- package/docs/ModelStatus.md +45 -0
- package/docs/{Entities.md → ModelType.md} +5 -4
- package/docs/ParagraphKind.md +33 -0
- package/docs/ParagraphSegment.md +39 -0
- package/docs/PartSegment.md +39 -0
- package/docs/PathSegment.md +79 -0
- package/docs/PolicyDocumentRulesInner.md +7 -1
- package/docs/{ValidationError.md → PropertySegment.md} +7 -12
- package/docs/PseudonymizeRule.md +41 -0
- package/docs/RangeKind.md +33 -0
- package/docs/RangeSegment.md +39 -0
- package/docs/RedactRule.md +3 -1
- package/docs/Refusal.md +36 -0
- package/docs/RegexResult.md +2 -0
- package/docs/RegionSegment.md +43 -0
- package/docs/ReplaceRule.md +3 -1
- package/docs/{AnonymizeRequestBodyRulesInner.md → RuleBody.md} +12 -5
- package/docs/SHA256Rule.md +3 -1
- package/docs/SHA512Rule.md +3 -1
- package/docs/ScanRequestBody.md +2 -0
- package/docs/ScanResponseBody.md +2 -0
- package/docs/SegmentSegment.md +39 -0
- package/docs/SensitiveDataProtectionApi.md +160 -3
- package/docs/ShapeKind.md +33 -0
- package/docs/ShapeSegment.md +41 -0
- package/docs/SheetSegment.md +39 -0
- package/docs/SlideSegment.md +41 -0
- package/docs/SpeakerNotesSegment.md +41 -0
- package/docs/TableSegment.md +37 -0
- package/docs/TagSegment.md +41 -0
- package/docs/TextSegment.md +39 -0
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
# RegionSegment
|
|
3
|
+
|
|
4
|
+
A box on an image, in its upright pixels, padded as painted: where a value found in it is. A value over several boxes has a path for each.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`type` | string
|
|
11
|
+
`x` | number
|
|
12
|
+
`y` | number
|
|
13
|
+
`w` | number
|
|
14
|
+
`h` | number
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import type { RegionSegment } from '@quba/sensitive-data-protection'
|
|
20
|
+
|
|
21
|
+
// TODO: Update the object below with actual values
|
|
22
|
+
const example = {
|
|
23
|
+
"type": null,
|
|
24
|
+
"x": null,
|
|
25
|
+
"y": null,
|
|
26
|
+
"w": null,
|
|
27
|
+
"h": null,
|
|
28
|
+
} satisfies RegionSegment
|
|
29
|
+
|
|
30
|
+
console.log(example)
|
|
31
|
+
|
|
32
|
+
// Convert the instance to a JSON string
|
|
33
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
34
|
+
console.log(exampleJSON)
|
|
35
|
+
|
|
36
|
+
// Parse the JSON string back to an object
|
|
37
|
+
const exampleParsed = JSON.parse(exampleJSON) as RegionSegment
|
|
38
|
+
console.log(exampleParsed)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
42
|
+
|
|
43
|
+
|
package/docs/ReplaceRule.md
CHANGED
|
@@ -8,7 +8,8 @@ Replace each matched value with a fixed string (default \'****\').
|
|
|
8
8
|
Name | Type
|
|
9
9
|
------------ | -------------
|
|
10
10
|
`type` | string
|
|
11
|
-
`entities` | [Array<
|
|
11
|
+
`entities` | [Array<EntityBody>](EntityBody.md)
|
|
12
|
+
`action` | [Action](Action.md)
|
|
12
13
|
`replacement` | string
|
|
13
14
|
|
|
14
15
|
## Example
|
|
@@ -20,6 +21,7 @@ import type { ReplaceRule } from '@quba/sensitive-data-protection'
|
|
|
20
21
|
const example = {
|
|
21
22
|
"type": null,
|
|
22
23
|
"entities": null,
|
|
24
|
+
"action": null,
|
|
23
25
|
"replacement": null,
|
|
24
26
|
} satisfies ReplaceRule
|
|
25
27
|
|
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
|
|
2
|
-
#
|
|
2
|
+
# RuleBody
|
|
3
3
|
|
|
4
|
+
One rule, chosen by its `type`.
|
|
4
5
|
|
|
5
6
|
## Properties
|
|
6
7
|
|
|
7
8
|
Name | Type
|
|
8
9
|
------------ | -------------
|
|
9
10
|
`type` | string
|
|
10
|
-
`entities` | [Array<
|
|
11
|
+
`entities` | [Array<EntityBody>](EntityBody.md)
|
|
12
|
+
`action` | [Action](Action.md)
|
|
11
13
|
`replacement` | string
|
|
12
14
|
`key` | string
|
|
13
15
|
`masking_char` | string
|
|
14
16
|
`chars_to_mask` | number
|
|
15
17
|
`from_end` | boolean
|
|
18
|
+
`tag` | string
|
|
19
|
+
`length` | number
|
|
16
20
|
|
|
17
21
|
## Example
|
|
18
22
|
|
|
19
23
|
```typescript
|
|
20
|
-
import type {
|
|
24
|
+
import type { RuleBody } from '@quba/sensitive-data-protection'
|
|
21
25
|
|
|
22
26
|
// TODO: Update the object below with actual values
|
|
23
27
|
const example = {
|
|
24
28
|
"type": null,
|
|
25
29
|
"entities": null,
|
|
30
|
+
"action": null,
|
|
26
31
|
"replacement": null,
|
|
27
32
|
"key": null,
|
|
28
33
|
"masking_char": null,
|
|
29
34
|
"chars_to_mask": null,
|
|
30
35
|
"from_end": null,
|
|
31
|
-
|
|
36
|
+
"tag": null,
|
|
37
|
+
"length": null,
|
|
38
|
+
} satisfies RuleBody
|
|
32
39
|
|
|
33
40
|
console.log(example)
|
|
34
41
|
|
|
@@ -37,7 +44,7 @@ const exampleJSON: string = JSON.stringify(example)
|
|
|
37
44
|
console.log(exampleJSON)
|
|
38
45
|
|
|
39
46
|
// Parse the JSON string back to an object
|
|
40
|
-
const exampleParsed = JSON.parse(exampleJSON) as
|
|
47
|
+
const exampleParsed = JSON.parse(exampleJSON) as RuleBody
|
|
41
48
|
console.log(exampleParsed)
|
|
42
49
|
```
|
|
43
50
|
|
package/docs/SHA256Rule.md
CHANGED
|
@@ -8,7 +8,8 @@ Replace each matched value with its SHA-256 hex digest.
|
|
|
8
8
|
Name | Type
|
|
9
9
|
------------ | -------------
|
|
10
10
|
`type` | string
|
|
11
|
-
`entities` | [Array<
|
|
11
|
+
`entities` | [Array<EntityBody>](EntityBody.md)
|
|
12
|
+
`action` | [Action](Action.md)
|
|
12
13
|
|
|
13
14
|
## Example
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ import type { SHA256Rule } from '@quba/sensitive-data-protection'
|
|
|
19
20
|
const example = {
|
|
20
21
|
"type": null,
|
|
21
22
|
"entities": null,
|
|
23
|
+
"action": null,
|
|
22
24
|
} satisfies SHA256Rule
|
|
23
25
|
|
|
24
26
|
console.log(example)
|
package/docs/SHA512Rule.md
CHANGED
|
@@ -8,7 +8,8 @@ Replace each matched value with its SHA-512 hex digest.
|
|
|
8
8
|
Name | Type
|
|
9
9
|
------------ | -------------
|
|
10
10
|
`type` | string
|
|
11
|
-
`entities` | [Array<
|
|
11
|
+
`entities` | [Array<EntityBody>](EntityBody.md)
|
|
12
|
+
`action` | [Action](Action.md)
|
|
12
13
|
|
|
13
14
|
## Example
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ import type { SHA512Rule } from '@quba/sensitive-data-protection'
|
|
|
19
20
|
const example = {
|
|
20
21
|
"type": null,
|
|
21
22
|
"entities": null,
|
|
23
|
+
"action": null,
|
|
22
24
|
} satisfies SHA512Rule
|
|
23
25
|
|
|
24
26
|
console.log(example)
|
package/docs/ScanRequestBody.md
CHANGED
|
@@ -11,6 +11,7 @@ Name | Type
|
|
|
11
11
|
`language` | string
|
|
12
12
|
`entities` | Array<string>
|
|
13
13
|
`confidence_threshold` | number
|
|
14
|
+
`models` | Array<string>
|
|
14
15
|
|
|
15
16
|
## Example
|
|
16
17
|
|
|
@@ -23,6 +24,7 @@ const example = {
|
|
|
23
24
|
"language": null,
|
|
24
25
|
"entities": null,
|
|
25
26
|
"confidence_threshold": null,
|
|
27
|
+
"models": null,
|
|
26
28
|
} satisfies ScanRequestBody
|
|
27
29
|
|
|
28
30
|
console.log(example)
|
package/docs/ScanResponseBody.md
CHANGED
|
@@ -9,6 +9,7 @@ Name | Type
|
|
|
9
9
|
------------ | -------------
|
|
10
10
|
`results` | [Array<ScanResult>](ScanResult.md)
|
|
11
11
|
`usage` | [Usage](Usage.md)
|
|
12
|
+
`models` | Array<string>
|
|
12
13
|
|
|
13
14
|
## Example
|
|
14
15
|
|
|
@@ -19,6 +20,7 @@ import type { ScanResponseBody } from '@quba/sensitive-data-protection'
|
|
|
19
20
|
const example = {
|
|
20
21
|
"results": null,
|
|
21
22
|
"usage": null,
|
|
23
|
+
"models": null,
|
|
22
24
|
} satisfies ScanResponseBody
|
|
23
25
|
|
|
24
26
|
console.log(example)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# SegmentSegment
|
|
3
|
+
|
|
4
|
+
An HL7 v2 segment (`PID`).
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`type` | string
|
|
11
|
+
`name` | string
|
|
12
|
+
`index` | number
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { SegmentSegment } from '@quba/sensitive-data-protection'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"type": null,
|
|
22
|
+
"name": null,
|
|
23
|
+
"index": null,
|
|
24
|
+
} satisfies SegmentSegment
|
|
25
|
+
|
|
26
|
+
console.log(example)
|
|
27
|
+
|
|
28
|
+
// Convert the instance to a JSON string
|
|
29
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
30
|
+
console.log(exampleJSON)
|
|
31
|
+
|
|
32
|
+
// Parse the JSON string back to an object
|
|
33
|
+
const exampleParsed = JSON.parse(exampleJSON) as SegmentSegment
|
|
34
|
+
console.log(exampleParsed)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
38
|
+
|
|
39
|
+
|
|
@@ -4,19 +4,112 @@ All URIs are relative to *https://www.quba.co/api/sdp*
|
|
|
4
4
|
|
|
5
5
|
| Method | HTTP request | Description |
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
|
+
| [**anonymizeFile**](SensitiveDataProtectionApi.md#anonymizefile) | **POST** /anonymize/file | Anonymize File |
|
|
7
8
|
| [**anonymizeText**](SensitiveDataProtectionApi.md#anonymizetext) | **POST** /anonymize | Anonymize Text |
|
|
8
9
|
| [**healthCheck**](SensitiveDataProtectionApi.md#healthcheck) | **GET** /health | Health |
|
|
10
|
+
| [**listModels**](SensitiveDataProtectionApi.md#listmodels) | **GET** /models | List Models |
|
|
9
11
|
| [**scanText**](SensitiveDataProtectionApi.md#scantext) | **POST** /scan | Scan Text |
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
|
|
15
|
+
## anonymizeFile
|
|
16
|
+
|
|
17
|
+
> AnonymizeFileResponseBody anonymizeFile(file, rules, confidence_threshold, embedded_rules, table_headers, models, dicom_options)
|
|
18
|
+
|
|
19
|
+
Anonymize File
|
|
20
|
+
|
|
21
|
+
Anonymize sensitive data in a file. Reads the file\'s text (Office parts, cells, lines), applies the rules as `/anonymize` does, and returns the file in its own format with every change made: each value found, with where it is (`path`), and each part removed. With `Accept: application/x-ndjson`, answers with one JSON event per line: `start`, a `batch` per step of reading, then `done` (the same body) or `error`. An Office file\'s images and kept embedded files are read as files of their own beside its text: each has `task` events (queued, started, then done, stopped or failed), and its own `start` and `batch` events carry its `task` path.
|
|
22
|
+
|
|
23
|
+
### Example
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import {
|
|
27
|
+
Configuration,
|
|
28
|
+
SensitiveDataProtectionApi,
|
|
29
|
+
} from '@quba/sensitive-data-protection';
|
|
30
|
+
import type { AnonymizeFileRequest } from '@quba/sensitive-data-protection';
|
|
31
|
+
|
|
32
|
+
async function example() {
|
|
33
|
+
console.log("🚀 Testing @quba/sensitive-data-protection SDK...");
|
|
34
|
+
const config = new Configuration({
|
|
35
|
+
// To configure API key authorization: ApiKeyAuth
|
|
36
|
+
apiKey: "YOUR API KEY",
|
|
37
|
+
});
|
|
38
|
+
const api = new SensitiveDataProtectionApi(config);
|
|
39
|
+
|
|
40
|
+
const body = {
|
|
41
|
+
// Blob | The file: docx, xlsx, pptx, csv, tsv, txt, md, log, json, jsonl, xml, html, hl7 (HL7 v2), png, jpg, webp, bmp, tiff (one page) or dcm (DICOM Part 10). Office files, images, DICOM, XML, HTML, HL7 v2 and FHIR JSON are told by their bytes; other text by its part\\\'s `Content-Type` when specific, else its name\\\'s extension.
|
|
42
|
+
file: BINARY_DATA_HERE,
|
|
43
|
+
// string | The de-identification rules, a JSON array as for `/anonymize`. Omit for the default rules. (optional)
|
|
44
|
+
rules: rules_example,
|
|
45
|
+
// number | Minimum score for model detections. Does not affect regex matches. (optional)
|
|
46
|
+
confidence_threshold: 8.14,
|
|
47
|
+
// string | Embedded content (embedded files, OLE objects, a FHIR JSON photo\\\'s base64 `data` on Patient, Practitioner, RelatedPerson or Person). `anonymize` (default): what can be read (an Office or text file; a PNG, JPEG, WebP, BMP or TIFF image where this server reads images) is anonymized as a file of its own and written back, the rest removed. `anonymize_or_keep`: the same, the rest kept unread. `remove`: all removed. `keep`: all kept unread. Thumbnails are always removed; fonts and printer settings always kept; an Office file\\\'s pictures are read and masked where this server reads images, whatever the rule. (optional)
|
|
48
|
+
embedded_rules: embedded_rules_example,
|
|
49
|
+
// string | CSV, TSV and xlsx only: where a table\\\'s headers are, in the data\\\'s order (field 1, column A), so each value is read with its header. (optional)
|
|
50
|
+
table_headers: table_headers_example,
|
|
51
|
+
// string | Ids from `GET /models`, comma-separated (or the field repeated), each type\\\'s in order of preference: the first `ready` text model runs, and, for a file with images (an image, a DICOM file\\\'s pixels, an Office file\\\'s images), the first `ready` image reader. A type named none of runs on the first ready of all, largest first, waiting at startup until one is. None named of a type is ready: a 503, with `Retry-After` while one still loads. An unknown id: a 422. Omit for the defaults. (optional)
|
|
52
|
+
models: models_example,
|
|
53
|
+
// string | DICOM only: the options of the Basic Application Level Confidentiality Profile (PS3.15 Annex E) to apply, comma-separated, of: `clean_descriptors`, `retain_longitudinal_full_dates`, `retain_patient_characteristics`, `retain_device_identity`, `retain_institution_identity`, `retain_uids`. Empty for none. `clean_descriptors` scans descriptions and comments with the rules instead of removing them. (optional)
|
|
54
|
+
dicom_options: dicom_options_example,
|
|
55
|
+
} satisfies AnonymizeFileRequest;
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const data = await api.anonymizeFile(body);
|
|
59
|
+
console.log(data);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Run the test
|
|
66
|
+
example().catch(console.error);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Parameters
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
| Name | Type | Description | Notes |
|
|
73
|
+
|------------- | ------------- | ------------- | -------------|
|
|
74
|
+
| **file** | `Blob` | The file: docx, xlsx, pptx, csv, tsv, txt, md, log, json, jsonl, xml, html, hl7 (HL7 v2), png, jpg, webp, bmp, tiff (one page) or dcm (DICOM Part 10). Office files, images, DICOM, XML, HTML, HL7 v2 and FHIR JSON are told by their bytes; other text by its part\\\'s `Content-Type` when specific, else its name\\\'s extension. | [Defaults to `undefined`] |
|
|
75
|
+
| **rules** | `string` | The de-identification rules, a JSON array as for `/anonymize`. Omit for the default rules. | [Optional] [Defaults to `undefined`] |
|
|
76
|
+
| **confidence_threshold** | `number` | Minimum score for model detections. Does not affect regex matches. | [Optional] [Defaults to `0.5`] |
|
|
77
|
+
| **embedded_rules** | `anonymize`, `anonymize_or_keep`, `remove`, `keep` | Embedded content (embedded files, OLE objects, a FHIR JSON photo\\\'s base64 `data` on Patient, Practitioner, RelatedPerson or Person). `anonymize` (default): what can be read (an Office or text file; a PNG, JPEG, WebP, BMP or TIFF image where this server reads images) is anonymized as a file of its own and written back, the rest removed. `anonymize_or_keep`: the same, the rest kept unread. `remove`: all removed. `keep`: all kept unread. Thumbnails are always removed; fonts and printer settings always kept; an Office file\\\'s pictures are read and masked where this server reads images, whatever the rule. | [Optional] [Defaults to `'anonymize'`] [Enum: anonymize, anonymize_or_keep, remove, keep] |
|
|
78
|
+
| **table_headers** | `none`, `first_row`, `first_column`, `last_column` | CSV, TSV and xlsx only: where a table\\\'s headers are, in the data\\\'s order (field 1, column A), so each value is read with its header. | [Optional] [Defaults to `'none'`] [Enum: none, first_row, first_column, last_column] |
|
|
79
|
+
| **models** | `string` | Ids from `GET /models`, comma-separated (or the field repeated), each type\\\'s in order of preference: the first `ready` text model runs, and, for a file with images (an image, a DICOM file\\\'s pixels, an Office file\\\'s images), the first `ready` image reader. A type named none of runs on the first ready of all, largest first, waiting at startup until one is. None named of a type is ready: a 503, with `Retry-After` while one still loads. An unknown id: a 422. Omit for the defaults. | [Optional] [Defaults to `undefined`] |
|
|
80
|
+
| **dicom_options** | `string` | DICOM only: the options of the Basic Application Level Confidentiality Profile (PS3.15 Annex E) to apply, comma-separated, of: `clean_descriptors`, `retain_longitudinal_full_dates`, `retain_patient_characteristics`, `retain_device_identity`, `retain_institution_identity`, `retain_uids`. Empty for none. `clean_descriptors` scans descriptions and comments with the rules instead of removing them. | [Optional] [Defaults to `'clean_descriptors'`] |
|
|
81
|
+
|
|
82
|
+
### Return type
|
|
83
|
+
|
|
84
|
+
[**AnonymizeFileResponseBody**](AnonymizeFileResponseBody.md)
|
|
85
|
+
|
|
86
|
+
### Authorization
|
|
87
|
+
|
|
88
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
|
89
|
+
|
|
90
|
+
### HTTP request headers
|
|
91
|
+
|
|
92
|
+
- **Content-Type**: `multipart/form-data`
|
|
93
|
+
- **Accept**: `application/json`
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### HTTP response details
|
|
97
|
+
| Status code | Description | Response headers |
|
|
98
|
+
|-------------|-------------|------------------|
|
|
99
|
+
| **200** | The anonymized file and its results. | - |
|
|
100
|
+
| **422** | A field or the file is invalid; `details` says which. | - |
|
|
101
|
+
| **500** | The request failed, or the output still held a replaced value. Retrying may help. | - |
|
|
102
|
+
|
|
103
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
104
|
+
|
|
105
|
+
|
|
13
106
|
## anonymizeText
|
|
14
107
|
|
|
15
108
|
> AnonymizeResponseBody anonymizeText(AnonymizeRequestBody)
|
|
16
109
|
|
|
17
110
|
Anonymize Text
|
|
18
111
|
|
|
19
|
-
Anonymize sensitive data in text. Scans the request text for the entities targeted by each supplied rule and applies that rule\'s operation (replace, redact, mask, hash, or encrypt) to every match. Returns the anonymized text together with a record of each transformation, including the original and resulting character ranges.
|
|
112
|
+
Anonymize sensitive data in text. Scans the request text for the entities targeted by each supplied rule and applies that rule\'s operation (replace, redact, mask, pseudonymize, hash, or encrypt) to every match. Returns the anonymized text together with a record of each transformation, including the original and resulting character ranges.
|
|
20
113
|
|
|
21
114
|
### Example
|
|
22
115
|
|
|
@@ -77,12 +170,14 @@ example().catch(console.error);
|
|
|
77
170
|
| Status code | Description | Response headers |
|
|
78
171
|
|-------------|-------------|------------------|
|
|
79
172
|
| **200** | Successful Response | - |
|
|
173
|
+
| **400** | The body is not JSON. | - |
|
|
80
174
|
| **401** | Missing or invalid API key. | - |
|
|
81
175
|
| **402** | Out of credits. | - |
|
|
82
176
|
| **403** | The calling key or member has an assigned policy, so the request may not send its own rules or confidence_threshold. | - |
|
|
83
177
|
| **409** | The policy assigned to the calling key or member cannot be read. | - |
|
|
84
178
|
| **413** | Text too long without an account. | - |
|
|
85
|
-
| **422** |
|
|
179
|
+
| **422** | Some fields are invalid; `details` says which. | - |
|
|
180
|
+
| **500** | The request failed. Retrying may help. | - |
|
|
86
181
|
| **503** | Engine unavailable. Not billed. | - |
|
|
87
182
|
|
|
88
183
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -153,6 +248,66 @@ This endpoint does not need any parameter.
|
|
|
153
248
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
154
249
|
|
|
155
250
|
|
|
251
|
+
## listModels
|
|
252
|
+
|
|
253
|
+
> Array<ModelStatus> listModels()
|
|
254
|
+
|
|
255
|
+
List Models
|
|
256
|
+
|
|
257
|
+
The models this server offers: text models (`type: text`, run on every request), then image readers (`type: image`, read a file\'s images), each type largest first. A request lists ids in `models`, each type\'s in order of preference: of each type, the first `ready` runs. If none of a type it names is ready, it is refused with a 503, with `Retry-After` while one still loads. A type it names none of runs on its `default`: the first `ready`, largest first (so `default` moves as models load); at startup, before any is ready, the request waits for the first to load. An unknown id is a 422.
|
|
258
|
+
|
|
259
|
+
### Example
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
import {
|
|
263
|
+
Configuration,
|
|
264
|
+
SensitiveDataProtectionApi,
|
|
265
|
+
} from '@quba/sensitive-data-protection';
|
|
266
|
+
import type { ListModelsRequest } from '@quba/sensitive-data-protection';
|
|
267
|
+
|
|
268
|
+
async function example() {
|
|
269
|
+
console.log("🚀 Testing @quba/sensitive-data-protection SDK...");
|
|
270
|
+
const api = new SensitiveDataProtectionApi();
|
|
271
|
+
|
|
272
|
+
try {
|
|
273
|
+
const data = await api.listModels();
|
|
274
|
+
console.log(data);
|
|
275
|
+
} catch (error) {
|
|
276
|
+
console.error(error);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Run the test
|
|
281
|
+
example().catch(console.error);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Parameters
|
|
285
|
+
|
|
286
|
+
This endpoint does not need any parameter.
|
|
287
|
+
|
|
288
|
+
### Return type
|
|
289
|
+
|
|
290
|
+
[**Array<ModelStatus>**](ModelStatus.md)
|
|
291
|
+
|
|
292
|
+
### Authorization
|
|
293
|
+
|
|
294
|
+
No authorization required
|
|
295
|
+
|
|
296
|
+
### HTTP request headers
|
|
297
|
+
|
|
298
|
+
- **Content-Type**: Not defined
|
|
299
|
+
- **Accept**: `application/json`
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
### HTTP response details
|
|
303
|
+
| Status code | Description | Response headers |
|
|
304
|
+
|-------------|-------------|------------------|
|
|
305
|
+
| **200** | Successful Response | - |
|
|
306
|
+
| **503** | Engine unavailable. Not billed. | - |
|
|
307
|
+
|
|
308
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
309
|
+
|
|
310
|
+
|
|
156
311
|
## scanText
|
|
157
312
|
|
|
158
313
|
> ScanResponseBody scanText(ScanRequestBody)
|
|
@@ -220,10 +375,12 @@ example().catch(console.error);
|
|
|
220
375
|
| Status code | Description | Response headers |
|
|
221
376
|
|-------------|-------------|------------------|
|
|
222
377
|
| **200** | Successful Response | - |
|
|
378
|
+
| **400** | The body is not JSON. | - |
|
|
223
379
|
| **401** | Missing or invalid API key. | - |
|
|
224
380
|
| **402** | Out of credits. | - |
|
|
225
381
|
| **413** | Text too long without an account. | - |
|
|
226
|
-
| **422** |
|
|
382
|
+
| **422** | Some fields are invalid; `details` says which. | - |
|
|
383
|
+
| **500** | The request failed. Retrying may help. | - |
|
|
227
384
|
| **503** | Engine unavailable. Not billed. | - |
|
|
228
385
|
|
|
229
386
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
# ShapeKind
|
|
3
|
+
|
|
4
|
+
What a shape\'s text is when it is not its own text.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { ShapeKind } from '@quba/sensitive-data-protection'
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
} satisfies ShapeKind
|
|
19
|
+
|
|
20
|
+
console.log(example)
|
|
21
|
+
|
|
22
|
+
// Convert the instance to a JSON string
|
|
23
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
24
|
+
console.log(exampleJSON)
|
|
25
|
+
|
|
26
|
+
// Parse the JSON string back to an object
|
|
27
|
+
const exampleParsed = JSON.parse(exampleJSON) as ShapeKind
|
|
28
|
+
console.log(exampleParsed)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
32
|
+
|
|
33
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
# ShapeSegment
|
|
3
|
+
|
|
4
|
+
A shape: a text box, picture, table, group; its `cNvPr` / `docPr` id and name. No `kind` for its own text.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`type` | string
|
|
11
|
+
`id` | number
|
|
12
|
+
`name` | string
|
|
13
|
+
`kind` | [ShapeKind](ShapeKind.md)
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { ShapeSegment } from '@quba/sensitive-data-protection'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"type": null,
|
|
23
|
+
"id": null,
|
|
24
|
+
"name": null,
|
|
25
|
+
"kind": null,
|
|
26
|
+
} satisfies ShapeSegment
|
|
27
|
+
|
|
28
|
+
console.log(example)
|
|
29
|
+
|
|
30
|
+
// Convert the instance to a JSON string
|
|
31
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
32
|
+
console.log(exampleJSON)
|
|
33
|
+
|
|
34
|
+
// Parse the JSON string back to an object
|
|
35
|
+
const exampleParsed = JSON.parse(exampleJSON) as ShapeSegment
|
|
36
|
+
console.log(exampleParsed)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# SheetSegment
|
|
3
|
+
|
|
4
|
+
A worksheet: its name on the tab, and its part.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`type` | string
|
|
11
|
+
`name` | string
|
|
12
|
+
`part` | string
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { SheetSegment } from '@quba/sensitive-data-protection'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"type": null,
|
|
22
|
+
"name": null,
|
|
23
|
+
"part": null,
|
|
24
|
+
} satisfies SheetSegment
|
|
25
|
+
|
|
26
|
+
console.log(example)
|
|
27
|
+
|
|
28
|
+
// Convert the instance to a JSON string
|
|
29
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
30
|
+
console.log(exampleJSON)
|
|
31
|
+
|
|
32
|
+
// Parse the JSON string back to an object
|
|
33
|
+
const exampleParsed = JSON.parse(exampleJSON) as SheetSegment
|
|
34
|
+
console.log(exampleParsed)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
38
|
+
|
|
39
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
# SlideSegment
|
|
3
|
+
|
|
4
|
+
A slide, numbered as PowerPoint shows it, and its part. `kind` until shapes hold all of a slide\'s text.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`type` | string
|
|
11
|
+
`number` | number
|
|
12
|
+
`part` | string
|
|
13
|
+
`kind` | [Kind](Kind.md)
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { SlideSegment } from '@quba/sensitive-data-protection'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"type": null,
|
|
23
|
+
"number": null,
|
|
24
|
+
"part": null,
|
|
25
|
+
"kind": null,
|
|
26
|
+
} satisfies SlideSegment
|
|
27
|
+
|
|
28
|
+
console.log(example)
|
|
29
|
+
|
|
30
|
+
// Convert the instance to a JSON string
|
|
31
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
32
|
+
console.log(exampleJSON)
|
|
33
|
+
|
|
34
|
+
// Parse the JSON string back to an object
|
|
35
|
+
const exampleParsed = JSON.parse(exampleJSON) as SlideSegment
|
|
36
|
+
console.log(exampleParsed)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
# SpeakerNotesSegment
|
|
3
|
+
|
|
4
|
+
A slide\'s speaker notes (`speaker_notes`): the slide\'s number, and the notes\' part. `kind` until shapes hold all of their text.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`type` | string
|
|
11
|
+
`slide` | number
|
|
12
|
+
`part` | string
|
|
13
|
+
`kind` | [Kind](Kind.md)
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { SpeakerNotesSegment } from '@quba/sensitive-data-protection'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"type": null,
|
|
23
|
+
"slide": null,
|
|
24
|
+
"part": null,
|
|
25
|
+
"kind": null,
|
|
26
|
+
} satisfies SpeakerNotesSegment
|
|
27
|
+
|
|
28
|
+
console.log(example)
|
|
29
|
+
|
|
30
|
+
// Convert the instance to a JSON string
|
|
31
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
32
|
+
console.log(exampleJSON)
|
|
33
|
+
|
|
34
|
+
// Parse the JSON string back to an object
|
|
35
|
+
const exampleParsed = JSON.parse(exampleJSON) as SpeakerNotesSegment
|
|
36
|
+
console.log(exampleParsed)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
# TableSegment
|
|
3
|
+
|
|
4
|
+
A table in a Word document or on a slide, numbered from 1 in what holds it.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`type` | string
|
|
11
|
+
`number` | number
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { TableSegment } from '@quba/sensitive-data-protection'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"type": null,
|
|
21
|
+
"number": null,
|
|
22
|
+
} satisfies TableSegment
|
|
23
|
+
|
|
24
|
+
console.log(example)
|
|
25
|
+
|
|
26
|
+
// Convert the instance to a JSON string
|
|
27
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
28
|
+
console.log(exampleJSON)
|
|
29
|
+
|
|
30
|
+
// Parse the JSON string back to an object
|
|
31
|
+
const exampleParsed = JSON.parse(exampleJSON) as TableSegment
|
|
32
|
+
console.log(exampleParsed)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
36
|
+
|
|
37
|
+
|