import { SignedWrappedDocument } from "../@types/document" ; import { OpenAttestationDocument as OpenAttestationDocumentV3 , WrappedDocument as WrappedDocumentV3 , } from "../../3.0/types" ; import { OpenAttestationDocument as OpenAttestationDocumentV2 , WrappedDocument as WrappedDocumentV2 , } from "../../2.0/types" ; import { diagnose } from "./diagnose" ; import { Mode } from "./@types/diagnose" ; param document param mode export const isRawV2Document = ( document , { mode } = { mode : "non-strict" } ) : document is OpenAttestationDocumentV2 => { return diagnose ( { version : "2.0" , kind : "raw" , document , debug : false , mode } ) . length === 0 ; } ; param document param mode export const isRawV3Document = ( document , { mode } = { mode : "non-strict" } ) : document is OpenAttestationDocumentV3 => { return diagnose ( { version : "3.0" , kind : "raw" , document , debug : false , mode } ) . length === 0 ; } ; param document param mode export const isWrappedV3Document = ( document , { mode } = { mode : "non-strict" } ) : document is WrappedDocumentV3 < OpenAttestationDocumentV3 > => { return diagnose ( { version : "3.0" , kind : "wrapped" , document , debug : false , mode } ) . length === 0 ; } ; param document param mode export const isWrappedV2Document = ( document , { mode } = { mode : "non-strict" } ) : document is WrappedDocumentV2 < OpenAttestationDocumentV2 > => { return diagnose ( { version : "2.0" , kind : "wrapped" , document , debug : false , mode } ) . length === 0 ; } ; param document param mode export const isSignedWrappedV2Document = ( document , { mode } = { mode : "non-strict" } ) : document is SignedWrappedDocument < OpenAttestationDocumentV2 > => { return diagnose ( { version : "2.0" , kind : "signed" , document , debug : false , mode } ) . length === 0 ; } ; param document param mode export const isSignedWrappedV3Document = ( document , { mode } = { mode : "non-strict" } ) : document is SignedWrappedDocument < OpenAttestationDocumentV3 > => { return diagnose ( { version : "3.0" , kind : "signed" , document , debug : false , mode } ) . length === 0 ; } ;