import { DocDef } from '@cbjsdev/shared'; import { CppProtocolSubdocOpcode } from '../../../binding.js'; import { CollectionDocDefMatchingKey, CollectionOptions, ExtractCollectionJsonDocKey } from '../../../clusterTypes/clusterTypes.js'; import type { AnyCollection } from '../../../clusterTypes/index.js'; import { LookupInGetResult, LookupInSpecResult, MakeLookupInSpec, OptimisticGetPathCheck, ValuesFromSpecResults } from '../../../clusterTypes/kv/lookup/lookupIn.types.js'; import type { LookupInCountPath, LookupInExistsPath } from '../../../clusterTypes/kv/lookup/lookupOperations.types.js'; import { LookupInOptions } from '../../../collection.js'; import { LookupInReplicaResult, LookupInResult } from '../../../crudoptypes.js'; import { LookupInMacro, LookupInSpec } from '../../../sdspecs.js'; import type { LookupMethodName } from './types.js'; type LookupResult, ThrowOnSpecError extends boolean> = Method extends 'lookupIn' ? LookupInResult : Method extends 'lookupInAnyReplica' ? LookupInReplicaResult : Method extends 'lookupInAllReplicas' ? LookupInReplicaResult[] : never; type ThisAnd = T extends ChainableLookupIn ? ChainableLookupIn : never; export declare class ChainableLookupIn, out ThrowOnSpecError extends boolean, in out Def extends DocDef = CollectionDocDefMatchingKey> implements Promise> { protected collection: C; protected method: Method; protected key: Key; protected options: LookupInOptions | undefined; protected specs: LookupInSpec[]; [Symbol.toStringTag]: string; then, TResult2 = never>(onFulfilled?: ((value: LookupResult) => TResult1 | PromiseLike) | undefined | null, onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | undefined | null): Promise; catch(onRejected?: ((reason: unknown) => TResult | PromiseLike) | null | undefined): Promise | TResult>; finally(onFinally?: (() => void) | null | undefined): Promise>; constructor(collection: C, method: Method, key: Key, options: LookupInOptions | undefined, specs: LookupInSpec[]); static for, ThrowOnSpecError extends boolean>(collection: C, method: Method, key: Key, options: LookupInOptions | undefined): ChainableLookupIn; push(spec: Spec): ThisAnd, Spec, Def>>; execute(): Promise>; /** * Get a property from the document. * * @see LookupInSpec.get * @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. */ get(path: OptimisticGetPathCheck, Def, Path>, options?: { xattr?: boolean; }): ThisAnd>; /** * Check if a property exists in the document. * * @see LookupInSpec.exists * @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. */ exists, Def>>(path: Path, options?: { xattr?: boolean; }): ThisAnd, MakeLookupInSpec, Def, CppProtocolSubdocOpcode.exists, Path>, Def>>; /** * Count the number of elements in an array, or the number of keys in an object. * * @see LookupInSpec.count * @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. */ count, Def>>(path: Path, options?: { xattr?: boolean; }): ThisAnd, MakeLookupInSpec, Def, CppProtocolSubdocOpcode.get_count, Path>, Def>>; /** * Return the array of specs. */ getSpecs(): LookupInSpec[]; /** * Return an array containing all the values. * * @example * ```ts * const [title, tags] = await cb.collection('acme') * .get('title') * .get('tags') * .values(); * ``` */ values(): Promise>; } export {};