import { encodeBase64 } from './base64' ; /**
 * Encode the sequence params into an "opaque" version string
 * that can be used in the saved object API in place of numeric
 * version numbers
 */ export function encodeVersion ( seqNo ? , primaryTerm ? ) { if ( ! Number . isInteger ( primaryTerm ) ) { throw new TypeError ( '_primary_term from elasticsearch must be an integer' ) ; } if ( ! Number . isInteger ( seqNo ) ) { throw new TypeError ( '_seq_no from elasticsearch must be an integer' ) ; } return encodeBase64 ( JSON . stringify ( [ seqNo , primaryTerm ] ) ) ; }