import { AnyDocDef, DocDef, LookupInMacroReturnType, MutateInMacroReturnType } from '@cbjsdev/shared'; import { CppProtocolSubdocOpcode } from './binding.js'; import type { LookupInSpecOpCode, MakeLookupInSpec } from './clusterTypes/kv/lookup/lookupIn.types.js'; import type { LookupInCountPath, LookupInExistsPath, LookupInGetPath } from './clusterTypes/kv/lookup/lookupOperations.types.js'; import type { MutateInSpecOpcode, MutateInValue } from './clusterTypes/kv/mutation/mutateIn.types.js'; import type { MutateInArrayAddUniqueOptions, MutateInArrayAddUniquePath, MutateInArrayAddUniqueValue, MutateInArrayAppendOptions, MutateInArrayAppendPath, MutateInArrayAppendValue, MutateInArrayInsertOptions, MutateInArrayInsertPath, MutateInArrayInsertValue, MutateInArrayPrependOptions, MutateInArrayPrependPath, MutateInArrayPrependValue, MutateInBinaryOptions, MutateInBinaryPath, MutateInBinaryValue, MutateInInsertOptions, MutateInInsertPath, MutateInInsertValue, MutateInRemoveOptions, MutateInRemovePath, MutateInReplaceOptions, MutateInReplacePath, MutateInReplaceValue, MutateInUpsertOptions, MutateInUpsertPath, MutateInUpsertValue } from './clusterTypes/kv/mutation/mutationOperations.types.js'; /** * Represents a macro that can be passed to a lookup-in operation to * fetch special values such as the expiry, cas, etc... * * @category Key-Value */ export declare class LookupInMacro { /** * @internal */ _value: Type; constructor(value: Type); /** * A macro which references the entirety of the document meta-data. */ static get Document(): LookupInMacro<'$document'>; /** * A macro which references the expiry of a document. */ static get Expiry(): LookupInMacro<'$document.exptime'>; /** * A macro which references the cas of a document. */ static get Cas(): LookupInMacro<'$document.CAS'>; /** * A macro which references the seqno of a document. */ static get SeqNo(): LookupInMacro<'$document.seqno'>; /** * A macro which references the last modified time of a document. */ static get LastModified(): 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<'$document.deleted'>; /** * A macro which references the size of a document, expressed in bytes. */ static get ValueSizeBytes(): LookupInMacro<'$document.value_bytes'>; /** * A macro which references the revision id of a document. */ static get RevId(): LookupInMacro<'$document.revid'>; } /** * Represents a macro that can be passed to a mutate-in operation to * write special values such as the expiry, cas, etc... * * @category Key-Value */ export declare class MutateInMacro { /** * @internal */ _value: Type; constructor(value: Type); /** * A macro which references the cas of a document. */ static get Cas(): MutateInMacro; /** * A macro which references the seqno of a document. */ static get SeqNo(): MutateInMacro; /** * A macro which references the crc32 of the value of a document. */ static get ValueCrc32c(): MutateInMacro; } /** * Represents a sub-operation to perform within a lookup-in operation. * * @category Key-Value */ export declare class LookupInSpec> { /** * BUG(JSCBC-756): Previously provided access to the expiry macro for a * lookup-in operation. * * @deprecated Use {@link LookupInMacro.Expiry} instead. */ static get Expiry(): LookupInMacro<'$document.exptime'>; /** * @internal */ _op: Opcode; /** * @internal */ _path: InternalPath; /** * @internal */ _flags: number; private constructor(); private static _create; static get>(this: void, path: '', options?: { xattr?: boolean; }): MakeLookupInSpec; static get, ''>, Options = NonNullable>(this: void, path: Path, options?: { xattr?: boolean; }): MakeLookupInSpec; /** * Returns whether a specific field exists in the document. * * @param path The path to the field. * @param options Optional parameters for this operation. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static exists>(this: void, path: Path, options?: { xattr?: boolean; }): MakeLookupInSpec; /** * Returns the number of elements in the array reference by the path. * * @param path The path to the field. * @param options Optional parameters for this operation. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static count, Options = NonNullable>(this: void, path: Path, options?: { xattr?: boolean; }): MakeLookupInSpec; } /** * Represents a sub-operation to perform within a mutate-in operation. * * @category Key-Value */ export declare class MutateInSpec { /** * BUG(JSCBC-756): Previously provided access to the document cas mutate * macro. * * @deprecated Use {@link MutateInMacro.Cas} instead. */ static get CasPlaceholder(): MutateInMacro; /** * @internal */ _op: Opcode; /** * @internal */ _path: Path; /** * @internal */ _flags: number; /** * Serialized representation of the user's value. * * @internal */ _data: string | undefined; /** * Raw user's value. * * @internal */ _rawData: Value; private constructor(); private static _create; /** * Creates a MutateInSpec for inserting a field into the document. Failing if * the field already exists at the specified path. * * @param path The path to the field. * @param value The value to insert. * @param options Optional parameters for this operation. * @param options.createPath * Whether or not the path to the field should be created if it does not * already exist. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static insert, Value extends MutateInInsertValue>(this: void, path: Path, value: Value, options?: MutateInInsertOptions): MutateInSpec; static upsert>(this: void, path: '', value: Value, options?: MutateInUpsertOptions): MutateInSpec; static upsert, Value extends MutateInUpsertValue>(this: void, path: Path, value: Value, options?: MutateInUpsertOptions): MutateInSpec; /** * Creates a MutateInSpec for replacing a field on a document. This updates * the value of the specified field, failing if the field does not exits. * * @param path The path to the field. * @param value The value to write. * @param options Optional parameters for this operation. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static replace, Value extends MutateInReplaceValue>(this: void, path: Path, value: Value, options?: MutateInReplaceOptions): MutateInSpec; static remove(this: void, path: '', options?: MutateInRemoveOptions): MutateInSpec; static remove, ''>>(this: void, path: Path, options?: MutateInRemoveOptions): MutateInSpec; /** * Creates a MutateInSpec for adding a value to the end of an array in a document. * * @param path The path to the field. * @param value The value to add. * @param options Optional parameters for this operation. * @param options.createPath * Whether or not the path to the field should be created if it does not * already exist. * @param options.multi * If set, this enables an array of values to be passed as value, and each * element of the passed array is added to the array. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static arrayAppend, Value extends MutateInArrayAppendValue, Multi extends boolean = false>(this: void, path: Path, value: Value, options?: MutateInArrayAppendOptions): MutateInSpec; /** * Creates a MutateInSpec for adding a value to the beginning of an array in a document. * * @param path The path to the field. * @param value The value to add. * @param options Optional parameters for this operation. * @param options.createPath * Whether or not the path to the field should be created if it does not * already exist. * @param options.multi * If set, this enables an array of values to be passed as value, and each * element of the passed array is added to the array. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static arrayPrepend, Value extends MutateInArrayPrependValue, Multi extends boolean = false>(this: void, path: Path, value: Value, options?: MutateInArrayPrependOptions): MutateInSpec; /** * Creates a MutateInSpec for adding a value to a specified location in an array in a * document. The path should specify a specific index in the array and the new values * are inserted at this location. * * @param path The path to an element of an array. * @param value The value to add. * @param options Optional parameters for this operation. * @param options.createPath * Whether or not the path to the field should be created if it does not * already exist. * @param options.multi * If set, this enables an array of values to be passed as value, and each * element of the passed array is added to the array. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static arrayInsert, Value extends MutateInArrayInsertValue, Multi extends boolean = false>(this: void, path: Path, value: Value, options?: MutateInArrayInsertOptions): MutateInSpec; /** * Creates a MutateInSpec for adding a unique value to an array in a document. This * operation will only add the value if it does not already exist elsewhere in the array. * * @param path The path to the field. * @param value The value to add. * @param options Optional parameters for this operation. * @param options.createPath * Whether or not the path to the field should be created if it does not * already exist. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static arrayAddUnique, Value extends MutateInArrayAddUniqueValue>(this: void, path: Path, value: Value, options?: MutateInArrayAddUniqueOptions): MutateInSpec; /** * Creates a MutateInSpec for incrementing the value of a field in a document. * * @param path The path to the field. * @param incrementBy The value to add. * @param options Optional parameters for this operation. * @param options.createPath * Whether or not the path to the field should be created if it does not * already exist. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static increment, Value extends MutateInBinaryValue>(this: void, path: Path, incrementBy: Value, options?: MutateInBinaryOptions): MutateInSpec; /** * Creates a MutateInSpec for decrementing the value of a field in a document. * * @param path The path to the field. * @param decrementBy The value to subtract. * @param options Optional parameters for this operation. * @param options.createPath * Whether or not the path to the field should be created if it does not * already exist. * @param options.xattr * Whether this operation should reference the document body or the extended * attributes data for the document. */ static decrement, Value extends MutateInBinaryValue>(this: void, path: Path, decrementBy: Value, options?: MutateInBinaryOptions): MutateInSpec; }