Skip to content

Commit 12d0348

Browse files
SK-2101 update samples with proper types
1 parent 1a9e562 commit 12d0348

21 files changed

+866
-47
lines changed

samples/detect-api/deidentify-file.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
Transformations,
1616
Bleep,
1717
VaultConfig,
18+
DeidentifyFileResponse,
1819
} from 'skyflow-node';
1920
import fs from 'fs';
2021

@@ -112,7 +113,7 @@ async function performDeidentifyFile() {
112113

113114

114115
// Step 6: Call deidentifyFile API
115-
const response = await skyflowClient
116+
const response: DeidentifyFileResponse = await skyflowClient
116117
.detect(primaryVaultConfig.vaultId)
117118
.deidentifyFile(deidentifyFile, options);
118119

samples/detect-api/deidentify-text.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
TokenFormat,
1212
TokenType,
1313
Transformations,
14-
DetectEntities
14+
DetectEntities,
15+
DeidentifyTextResponse
1516
} from 'skyflow-node';
1617

1718
/**
@@ -55,10 +56,10 @@ async function performDeidentifyText() {
5556
);
5657

5758
// Step 5: Configure DeidentifyTextOptions
58-
const optionsText = new DeidentifyTextOptions();
59+
const options = new DeidentifyTextOptions();
5960

6061
// setEntities: Specify which entities to deidentify
61-
optionsText.setEntities([DetectEntities.CREDIT_CARD, DetectEntities.SSN]);
62+
options.setEntities([DetectEntities.CREDIT_CARD, DetectEntities.SSN]);
6263

6364
// setAllowRegexList: Allowlist regex patterns (entities matching these will not be deidentified)
6465
// optionsText.setAllowRegexList(['<YOUR_REGEX_PATTERN>']);
@@ -69,7 +70,7 @@ async function performDeidentifyText() {
6970
// setTokenFormat: Specify the token format for deidentified entities
7071
const tokenFormat = new TokenFormat();
7172
tokenFormat.setDefault(TokenType.VAULT_TOKEN);
72-
optionsText.setTokenFormat(tokenFormat);
73+
options.setTokenFormat(tokenFormat);
7374

7475
// setTransformations: Specify custom transformations for entities
7576
const transformations = new Transformations();
@@ -78,12 +79,12 @@ async function performDeidentifyText() {
7879
min: 30, // Minimum shift days
7980
entities: [DetectEntities.DOB], // Entities to apply the shift
8081
});
81-
optionsText.setTransformations(transformations);
82+
options.setTransformations(transformations);
8283

8384
// Step 6: Call deidentifyText API
84-
const response = await skyflowClient
85+
const response: DeidentifyTextResponse = await skyflowClient
8586
.detect(primaryVaultConfig.vaultId)
86-
.deidentifyText(deidentifyTextRequest, optionsText);
87+
.deidentifyText(deidentifyTextRequest, options);
8788

8889
// Handle Successful Response
8990
console.log('Deidentify Text Response:', response);

samples/detect-api/reidentify-text.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
ReidentifyTextRequest,
99
ReidentifyTextOptions,
1010
DetectEntities,
11-
SkyflowError
11+
SkyflowError,
12+
ReidentifyTextResponse
1213
} from 'skyflow-node';
1314

1415
/**
@@ -60,7 +61,7 @@ async function performReidentifyText() {
6061
options.setPlainTextEntities([DetectEntities.PHONE_NUMBER]);
6162

6263
// Step 6: Call reidentifyText
63-
const response = await skyflowClient
64+
const response: ReidentifyTextResponse = await skyflowClient
6465
.detect(primaryVaultConfig.vaultId)
6566
.reidentifyText(reidentifyRequest, options);
6667

0 commit comments

Comments
 (0)