@quba/sensitive-data-protection 0.0.8 → 0.0.11
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 +90 -12
- package/dist/index.cjs +891 -323
- package/dist/index.d.cts +1024 -422
- package/dist/index.d.mts +1024 -422
- package/dist/index.mjs +833 -315
- package/docs/AnonymizeRequestBody.md +3 -0
- package/docs/AnonymizeRequestBodyRulesInner.md +1 -1
- package/docs/AnonymizeResponseBody.md +3 -0
- package/docs/CreatePolicyRequest.md +36 -0
- package/docs/DetectRule.md +37 -0
- package/docs/DetectRuleEntitiesInner.md +36 -0
- package/docs/EncryptRule.md +2 -1
- package/docs/ListPolicies200Response.md +34 -0
- package/docs/MaskRule.md +2 -1
- package/docs/ModelEntity.md +1 -0
- package/docs/PoliciesApi.md +360 -0
- package/docs/Policy.md +44 -0
- package/docs/PolicyDocument.md +41 -0
- package/docs/PolicyDocumentRulesInner.md +46 -0
- package/docs/PolicySummary.md +42 -0
- package/docs/RedactRule.md +2 -1
- package/docs/RegexEntity.md +1 -0
- package/docs/ReplaceRule.md +2 -1
- package/docs/SHA256Rule.md +2 -1
- package/docs/SHA512Rule.md +2 -1
- package/docs/ScanRequestBody.md +1 -0
- package/docs/ScanResponseBody.md +3 -0
- package/docs/ScanResult.md +1 -0
- package/docs/SensitiveDataProtectionApi.md +23 -10
- package/docs/UpdatePolicyRequest.md +36 -0
- package/docs/Usage.md +37 -0
- package/docs/ValidationError.md +4 -0
- package/package.json +4 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
# PolicyDocumentRulesInner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`type` | string
|
|
10
|
+
`entities` | [Array<DetectRuleEntitiesInner>](DetectRuleEntitiesInner.md)
|
|
11
|
+
`replacement` | string
|
|
12
|
+
`masking_char` | string
|
|
13
|
+
`chars_to_mask` | number
|
|
14
|
+
`from_end` | boolean
|
|
15
|
+
`key` | string
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type { PolicyDocumentRulesInner } from '@quba/sensitive-data-protection'
|
|
21
|
+
|
|
22
|
+
// TODO: Update the object below with actual values
|
|
23
|
+
const example = {
|
|
24
|
+
"type": null,
|
|
25
|
+
"entities": null,
|
|
26
|
+
"replacement": null,
|
|
27
|
+
"masking_char": null,
|
|
28
|
+
"chars_to_mask": null,
|
|
29
|
+
"from_end": null,
|
|
30
|
+
"key": null,
|
|
31
|
+
} satisfies PolicyDocumentRulesInner
|
|
32
|
+
|
|
33
|
+
console.log(example)
|
|
34
|
+
|
|
35
|
+
// Convert the instance to a JSON string
|
|
36
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
37
|
+
console.log(exampleJSON)
|
|
38
|
+
|
|
39
|
+
// Parse the JSON string back to an object
|
|
40
|
+
const exampleParsed = JSON.parse(exampleJSON) as PolicyDocumentRulesInner
|
|
41
|
+
console.log(exampleParsed)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
# PolicySummary
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`id` | string
|
|
10
|
+
`name` | string
|
|
11
|
+
`versionId` | string
|
|
12
|
+
`createdAt` | number
|
|
13
|
+
`updatedAt` | number
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { PolicySummary } from '@quba/sensitive-data-protection'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"id": null,
|
|
23
|
+
"name": null,
|
|
24
|
+
"versionId": null,
|
|
25
|
+
"createdAt": null,
|
|
26
|
+
"updatedAt": null,
|
|
27
|
+
} satisfies PolicySummary
|
|
28
|
+
|
|
29
|
+
console.log(example)
|
|
30
|
+
|
|
31
|
+
// Convert the instance to a JSON string
|
|
32
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
33
|
+
console.log(exampleJSON)
|
|
34
|
+
|
|
35
|
+
// Parse the JSON string back to an object
|
|
36
|
+
const exampleParsed = JSON.parse(exampleJSON) as PolicySummary
|
|
37
|
+
console.log(exampleParsed)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
41
|
+
|
|
42
|
+
|
package/docs/RedactRule.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
# RedactRule
|
|
3
3
|
|
|
4
|
+
Remove each matched value entirely (replace with an empty string).
|
|
4
5
|
|
|
5
6
|
## Properties
|
|
6
7
|
|
|
7
8
|
Name | Type
|
|
8
9
|
------------ | -------------
|
|
9
10
|
`type` | string
|
|
10
|
-
`entities` | [
|
|
11
|
+
`entities` | [Array<DetectRuleEntitiesInner>](DetectRuleEntitiesInner.md)
|
|
11
12
|
|
|
12
13
|
## Example
|
|
13
14
|
|
package/docs/RegexEntity.md
CHANGED
package/docs/ReplaceRule.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
# ReplaceRule
|
|
3
3
|
|
|
4
|
+
Replace each matched value with a fixed string (default \'****\').
|
|
4
5
|
|
|
5
6
|
## Properties
|
|
6
7
|
|
|
7
8
|
Name | Type
|
|
8
9
|
------------ | -------------
|
|
9
10
|
`type` | string
|
|
10
|
-
`entities` | [
|
|
11
|
+
`entities` | [Array<DetectRuleEntitiesInner>](DetectRuleEntitiesInner.md)
|
|
11
12
|
`replacement` | string
|
|
12
13
|
|
|
13
14
|
## Example
|
package/docs/SHA256Rule.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
# SHA256Rule
|
|
3
3
|
|
|
4
|
+
Replace each matched value with its SHA-256 hex digest.
|
|
4
5
|
|
|
5
6
|
## Properties
|
|
6
7
|
|
|
7
8
|
Name | Type
|
|
8
9
|
------------ | -------------
|
|
9
10
|
`type` | string
|
|
10
|
-
`entities` | [
|
|
11
|
+
`entities` | [Array<DetectRuleEntitiesInner>](DetectRuleEntitiesInner.md)
|
|
11
12
|
|
|
12
13
|
## Example
|
|
13
14
|
|
package/docs/SHA512Rule.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
# SHA512Rule
|
|
3
3
|
|
|
4
|
+
Replace each matched value with its SHA-512 hex digest.
|
|
4
5
|
|
|
5
6
|
## Properties
|
|
6
7
|
|
|
7
8
|
Name | Type
|
|
8
9
|
------------ | -------------
|
|
9
10
|
`type` | string
|
|
10
|
-
`entities` | [
|
|
11
|
+
`entities` | [Array<DetectRuleEntitiesInner>](DetectRuleEntitiesInner.md)
|
|
11
12
|
|
|
12
13
|
## Example
|
|
13
14
|
|
package/docs/ScanRequestBody.md
CHANGED
package/docs/ScanResponseBody.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
# ScanResponseBody
|
|
3
3
|
|
|
4
|
+
Response from the scan endpoint: the sensitive-data entities detected in the text.
|
|
4
5
|
|
|
5
6
|
## Properties
|
|
6
7
|
|
|
7
8
|
Name | Type
|
|
8
9
|
------------ | -------------
|
|
9
10
|
`results` | [Array<ScanResult>](ScanResult.md)
|
|
11
|
+
`usage` | [Usage](Usage.md)
|
|
10
12
|
|
|
11
13
|
## Example
|
|
12
14
|
|
|
@@ -16,6 +18,7 @@ import type { ScanResponseBody } from '@quba/sensitive-data-protection'
|
|
|
16
18
|
// TODO: Update the object below with actual values
|
|
17
19
|
const example = {
|
|
18
20
|
"results": null,
|
|
21
|
+
"usage": null,
|
|
19
22
|
} satisfies ScanResponseBody
|
|
20
23
|
|
|
21
24
|
console.log(example)
|
package/docs/ScanResult.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SensitiveDataProtectionApi
|
|
2
2
|
|
|
3
|
-
All URIs are relative to *https://
|
|
3
|
+
All URIs are relative to *https://www.quba.co/api/sdp*
|
|
4
4
|
|
|
5
5
|
| Method | HTTP request | Description |
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
@@ -16,7 +16,7 @@ All URIs are relative to *https://app.quba.ae/api/sdp*
|
|
|
16
16
|
|
|
17
17
|
Anonymize Text
|
|
18
18
|
|
|
19
|
-
Anonymize the
|
|
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.
|
|
20
20
|
|
|
21
21
|
### Example
|
|
22
22
|
|
|
@@ -29,7 +29,11 @@ import type { AnonymizeTextRequest } from '@quba/sensitive-data-protection';
|
|
|
29
29
|
|
|
30
30
|
async function example() {
|
|
31
31
|
console.log("🚀 Testing @quba/sensitive-data-protection SDK...");
|
|
32
|
-
const
|
|
32
|
+
const config = new Configuration({
|
|
33
|
+
// To configure API key authorization: ApiKeyAuth
|
|
34
|
+
apiKey: "YOUR API KEY",
|
|
35
|
+
});
|
|
36
|
+
const api = new SensitiveDataProtectionApi(config);
|
|
33
37
|
|
|
34
38
|
const body = {
|
|
35
39
|
// AnonymizeRequestBody
|
|
@@ -61,7 +65,7 @@ example().catch(console.error);
|
|
|
61
65
|
|
|
62
66
|
### Authorization
|
|
63
67
|
|
|
64
|
-
|
|
68
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
|
65
69
|
|
|
66
70
|
### HTTP request headers
|
|
67
71
|
|
|
@@ -73,6 +77,7 @@ No authorization required
|
|
|
73
77
|
| Status code | Description | Response headers |
|
|
74
78
|
|-------------|-------------|------------------|
|
|
75
79
|
| **200** | Successful Response | - |
|
|
80
|
+
| **404** | No such policy in the calling organization. | - |
|
|
76
81
|
| **422** | Validation Error | - |
|
|
77
82
|
|
|
78
83
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -84,7 +89,7 @@ No authorization required
|
|
|
84
89
|
|
|
85
90
|
Health
|
|
86
91
|
|
|
87
|
-
|
|
92
|
+
Health check. Returns a plain-text message confirming the service is running. Use this as a liveness/readiness probe.
|
|
88
93
|
|
|
89
94
|
### Example
|
|
90
95
|
|
|
@@ -97,7 +102,11 @@ import type { HealthCheckRequest } from '@quba/sensitive-data-protection';
|
|
|
97
102
|
|
|
98
103
|
async function example() {
|
|
99
104
|
console.log("🚀 Testing @quba/sensitive-data-protection SDK...");
|
|
100
|
-
const
|
|
105
|
+
const config = new Configuration({
|
|
106
|
+
// To configure API key authorization: ApiKeyAuth
|
|
107
|
+
apiKey: "YOUR API KEY",
|
|
108
|
+
});
|
|
109
|
+
const api = new SensitiveDataProtectionApi(config);
|
|
101
110
|
|
|
102
111
|
try {
|
|
103
112
|
const data = await api.healthCheck();
|
|
@@ -121,7 +130,7 @@ This endpoint does not need any parameter.
|
|
|
121
130
|
|
|
122
131
|
### Authorization
|
|
123
132
|
|
|
124
|
-
|
|
133
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
|
125
134
|
|
|
126
135
|
### HTTP request headers
|
|
127
136
|
|
|
@@ -143,7 +152,7 @@ No authorization required
|
|
|
143
152
|
|
|
144
153
|
Scan Text
|
|
145
154
|
|
|
146
|
-
Scan
|
|
155
|
+
Scan text for sensitive data. Runs the configured detection entities over the request text and returns every match as a character range with its entity type and confidence score. Detections below the confidence threshold are omitted.
|
|
147
156
|
|
|
148
157
|
### Example
|
|
149
158
|
|
|
@@ -156,7 +165,11 @@ import type { ScanTextRequest } from '@quba/sensitive-data-protection';
|
|
|
156
165
|
|
|
157
166
|
async function example() {
|
|
158
167
|
console.log("🚀 Testing @quba/sensitive-data-protection SDK...");
|
|
159
|
-
const
|
|
168
|
+
const config = new Configuration({
|
|
169
|
+
// To configure API key authorization: ApiKeyAuth
|
|
170
|
+
apiKey: "YOUR API KEY",
|
|
171
|
+
});
|
|
172
|
+
const api = new SensitiveDataProtectionApi(config);
|
|
160
173
|
|
|
161
174
|
const body = {
|
|
162
175
|
// ScanRequestBody
|
|
@@ -188,7 +201,7 @@ example().catch(console.error);
|
|
|
188
201
|
|
|
189
202
|
### Authorization
|
|
190
203
|
|
|
191
|
-
|
|
204
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
|
192
205
|
|
|
193
206
|
### HTTP request headers
|
|
194
207
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# UpdatePolicyRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`name` | string
|
|
10
|
+
`document` | [PolicyDocument](PolicyDocument.md)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { UpdatePolicyRequest } from '@quba/sensitive-data-protection'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"name": null,
|
|
20
|
+
"document": null,
|
|
21
|
+
} satisfies UpdatePolicyRequest
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as UpdatePolicyRequest
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
35
|
+
|
|
36
|
+
|
package/docs/Usage.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
# Usage
|
|
3
|
+
|
|
4
|
+
What one request cost, the unit billing meters against. Only the text the model scanned is counted. Anonymized output is built from the input by substitution, not generated, so counting it would charge twice for the same text. Counted with the detection model\'s own tokenizer, excluding special tokens, so the same text always costs the same for a given model.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`input_tokens` | number
|
|
11
|
+
`inference_ms` | number
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { Usage } from '@quba/sensitive-data-protection'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"input_tokens": null,
|
|
21
|
+
"inference_ms": null,
|
|
22
|
+
} satisfies Usage
|
|
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 Usage
|
|
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
|
+
|
package/docs/ValidationError.md
CHANGED
|
@@ -9,6 +9,8 @@ Name | Type
|
|
|
9
9
|
`loc` | [Array<ValidationErrorLocInner>](ValidationErrorLocInner.md)
|
|
10
10
|
`msg` | string
|
|
11
11
|
`type` | string
|
|
12
|
+
`input` | any
|
|
13
|
+
`ctx` | object
|
|
12
14
|
|
|
13
15
|
## Example
|
|
14
16
|
|
|
@@ -20,6 +22,8 @@ const example = {
|
|
|
20
22
|
"loc": null,
|
|
21
23
|
"msg": null,
|
|
22
24
|
"type": null,
|
|
25
|
+
"input": null,
|
|
26
|
+
"ctx": null,
|
|
23
27
|
} satisfies ValidationError
|
|
24
28
|
|
|
25
29
|
console.log(example)
|
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"description": "SDK for Sensitive Data Protection Service",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"homepage": "https://quba.
|
|
8
|
-
"version": "0.0.
|
|
7
|
+
"homepage": "https://www.quba.co",
|
|
8
|
+
"version": "0.0.11",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"sensitive data protection",
|
|
11
11
|
"sdp",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "tsdown"
|
|
30
|
+
"build": "tsdown",
|
|
31
|
+
"prepare": "tsdown"
|
|
31
32
|
},
|
|
32
33
|
"packageManager": "pnpm@10.26.2",
|
|
33
34
|
"devDependencies": {
|