Skip to content

Commit a3ccb6a

Browse files
SK-2040: update validations for detect file
1 parent 9d2ee85 commit a3ccb6a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/utils/validations/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import ReidentifyTextRequest from "../../vault/model/request/reidentify-text";
3333
import ReidentifyTextOptions from "../../vault/model/options/reidentify-text";
3434
import DeidentifyFileOptions from "../../vault/model/options/deidentify-file";
3535
import DeidentifyFileRequest from "../../vault/model/request/deidentify-file";
36+
import { Bleep } from "../../vault/model/options/deidentify-file/bleep-audio";
3637

3738
export function isEnv(value?: string): boolean {
3839
return value !== undefined && Object.values(Env).includes(value as Env);
@@ -1058,12 +1059,12 @@ export const validateDeidentifyFileOptions = (deidentifyFileOptions: DeidentifyF
10581059
}
10591060

10601061
// Validate tokenFormat
1061-
if (deidentifyFileOptions.getTokenFormat() && typeof deidentifyFileOptions.getTokenFormat !== 'object') {
1062+
if (deidentifyFileOptions.getTokenFormat() && !(deidentifyFileOptions.getTokenFormat() instanceof TokenFormat)) {
10621063
throw new SkyflowError(SKYFLOW_ERROR_CODE.INVALID_TOKEN_FORMAT);
10631064
}
10641065

10651066
// Validate transformations
1066-
if (deidentifyFileOptions.getTransformations() && typeof deidentifyFileOptions.getTransformations() !== 'object') {
1067+
if (deidentifyFileOptions.getTransformations() && !(deidentifyFileOptions.getTransformations() instanceof Transformations)) {
10671068
throw new SkyflowError(SKYFLOW_ERROR_CODE.INVALID_TRANSFORMATIONS);
10681069
}
10691070

@@ -1098,7 +1099,7 @@ export const validateDeidentifyFileOptions = (deidentifyFileOptions: DeidentifyF
10981099
throw new SkyflowError(SKYFLOW_ERROR_CODE.INVALID_OUTPUT_TRANSCRIPTION);
10991100
}
11001101

1101-
if (deidentifyFileOptions.getBleep() !== undefined && typeof deidentifyFileOptions.getBleep() !== 'object') {
1102+
if (deidentifyFileOptions.getBleep() && !(deidentifyFileOptions.getBleep() instanceof Bleep)) {
11021103
throw new SkyflowError(SKYFLOW_ERROR_CODE.INVALID_BLEEP);
11031104
}
11041105
};

src/vault/model/response/deidentify-file/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class DeidentifyFileResponse {
22
// fields
33
file?: string;
4-
enities?: Array<{
4+
entities?: Array<{
55
file: string;
66
extension: string;
77
}> = [];
@@ -55,7 +55,7 @@ class DeidentifyFileResponse {
5555
this.durationInSeconds = durationInSeconds;
5656
this.pageCount = pageCount;
5757
this.slideCount = slideCount;
58-
this.enities = entities;
58+
this.entities = entities;
5959
this.runId = runId;
6060
}
6161

0 commit comments

Comments
 (0)