import binding , { CppSdCmdType , CppSdSpecFlag } from './binding' ; category export class LookupInMacro { internal _value : string ; constructor ( value ) { this . _value = value ; } /**
     * A macro which references the entirety of the document meta-data.
     */ static get Document ( ) : LookupInMacro { return new LookupInMacro ( '$document' ) ; } /**
     * A macro which references the expiry of a document.
     */ static get Expiry ( ) : LookupInMacro { return new LookupInMacro ( '$document.exptime' ) ; } /**
     * A macro which references the cas of a document.
     */ static get Cas ( ) : LookupInMacro { return new LookupInMacro ( '$document.CAS' ) ; } /**
     * A macro which references the seqno of a document.
     */ static get SeqNo ( ) : LookupInMacro { return new LookupInMacro ( '$document.seqno' ) ; } /**
     * A macro which references the last modified time of a document.
     */ static get LastModified ( ) : LookupInMacro { return new LookupInMacro ( '$document.last_modified' ) ; } /**
     * A macro which references the deletion state of a document.  This
     * only makes sense to use in concert with the internal AccessDeleted
     * flags, which are internal.
     */ static get IsDeleted ( ) : LookupInMacro { return new LookupInMacro ( '$document.deleted' ) ; } /**
     * A macro which references the size of a document, expressed in bytes.
     */ static get ValueSizeBytes ( ) : LookupInMacro { return new LookupInMacro ( '$document.value_bytes' ) ; } /**
     * A macro which references the revision id of a document.
     */ static get RevId ( ) : LookupInMacro { return new LookupInMacro ( '$document.revid' ) ; } } category export class MutateInMacro { internal _value : string ; constructor ( value ) { this . _value = value ; } /**
     * A macro which references the cas of a document.
     */ static get Cas ( ) : MutateInMacro { return new MutateInMacro ( '${document.CAS}' ) ; } /**
     * A macro which references the seqno of a document.
     */ static get SeqNo ( ) : MutateInMacro { return new MutateInMacro ( '${document.seqno}' ) ; } /**
     * A macro which references the crc32 of the value of a document.
     */ static get ValueCrc32c ( ) : MutateInMacro { return new MutateInMacro ( '${document.value_crc32c}' ) ; } } category export class LookupInSpec { deprecated Use  LookupInMacro . Expiry instead.
      static get Expiry ( ) : LookupInMacro { return LookupInMacro . Expiry ; } internal _op : CppSdCmdType ; internal _path : string ; internal _flags : CppSdSpecFlag ; private constructor ( op , path , flags ) { this . _op = op ; this . _path = path ; this . _flags = flags ; } private static _create ( op , path , options ? ) { if ( ! options ) { options = { } ; } let flags = 0 ; if ( path instanceof LookupInMacro ) { path = path . _value ; flags |= binding . LCB_SUBDOCSPECS_F_XATTRPATH ; } if ( options . xattr ) { flags |= binding . LCB_SUBDOCSPECS_F_XATTRPATH ; } return new LookupInSpec ( op , path , flags ) ; } param path param options param options . xattr static get ( path , options ? ) { return this . _create ( binding . LCBX_SDCMD_GET , path , options ) ; } param path param options param options . xattr static exists ( path , options ? ) { return this . _create ( binding . LCBX_SDCMD_EXISTS , path , options ) ; } param path param options param options . xattr static count ( path , options ? ) { return this . _create ( binding . LCBX_SDCMD_GET_COUNT , path , options ) ; } } category export class MutateInSpec { deprecated Use  MutateInMacro . Cas instead.
      static get CasPlaceholder ( ) : MutateInMacro { return MutateInMacro . Cas ; } internal _op : CppSdCmdType ; internal _path : string ; internal _flags : CppSdSpecFlag ; internal _data : any ; private constructor ( op , path , flags , data ) { this . _op = op ; this . _path = path ; this . _flags = flags ; this . _data = data ; } private static _create ( op , path , value ? , options ? ) { if ( ! options ) { options = { } ; } let flags = 0 ; if ( value instanceof MutateInMacro ) { value = value . _value ; flags |= binding . LCB_SUBDOCSPECS_F_XATTR_MACROVALUES ; } if ( options . createPath ) { flags |= binding . LCB_SUBDOCSPECS_F_MKINTERMEDIATES ; } if ( options . xattr ) { flags |= binding . LCB_SUBDOCSPECS_F_XATTRPATH ; } if ( value !== undefined ) { if ( ! options . multi ) { value = JSON . stringify ( value ) ; } else { if ( ! Array . isArray ( value ) ) { throw new Error ( 'value must be an array for a multi operation' ) ; } value = JSON . stringify ( value ) ; value = value . substr ( 1 , value . length - 2 ) ; } } return new MutateInSpec ( op , path , flags , value ) ; } param path param value param options param options . createPath param options . xattr static insert ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_DICT_ADD , path , value , options ) ; } param path param value param options param options . createPath param options . xattr static upsert ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_DICT_UPSERT , path , value , options ) ; } param path param value param options param options . xattr static replace ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_REPLACE , path , value , options ) ; } param path param options param options . xattr static remove ( path , options ? ) { return this . _create ( binding . LCBX_SDCMD_REMOVE , path , undefined , options ) ; } param path param value param options param options . createPath param options . multi param options . xattr static arrayAppend ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_ARRAY_ADD_LAST , path , value , options ) ; } param path param value param options param options . createPath param options . multi param options . xattr static arrayPrepend ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_ARRAY_ADD_FIRST , path , value , options ) ; } param path param value param options param options . createPath param options . multi param options . xattr static arrayInsert ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_ARRAY_INSERT , path , value , options ) ; } param path param value param options param options . createPath param options . multi param options . xattr static arrayAddUnique ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_ARRAY_ADD_UNIQUE , path , value , options ) ; } param path param value param options param options . createPath param options . xattr static increment ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_COUNTER , path , + value , options ) ; } param path param value param options param options . createPath param options . xattr static decrement ( path , value , options ? ) { return this . _create ( binding . LCBX_SDCMD_COUNTER , path , + value , options ) ; } }