@@ -1167,6 +1167,22 @@ export type SimpleQueryFulltextOptions = {
11671167 skip ?: number ;
11681168} ;
11691169
1170+ export type IndexListOptions = {
1171+ /**
1172+ * If set to `true`, includes additional information about each index.
1173+ *
1174+ * Default: `false`
1175+ */
1176+ withStats ?: boolean ;
1177+ /**
1178+ * If set to `true`, includes indexes that are not yet fully built but are
1179+ * in the building phase.
1180+ *
1181+ * Default: `false`.
1182+ */
1183+ withHidden ?: boolean ;
1184+ } ;
1185+
11701186/**
11711187 * Options for performing a graph traversal.
11721188 *
@@ -2561,8 +2577,7 @@ export interface DocumentCollection<T extends Record<string, any> = any>
25612577 /**
25622578 * Returns a list of all index descriptions for the collection.
25632579 *
2564- * @param withHidden - If set to `true`, includes indexes that are not yet
2565- * fully built but are in the building phase. Default: `false`.
2580+ * @param options - Options for fetching the index list.
25662581 *
25672582 * @example
25682583 * ```js
@@ -2571,21 +2586,7 @@ export interface DocumentCollection<T extends Record<string, any> = any>
25712586 * const indexes = await collection.indexes();
25722587 * ```
25732588 */
2574- indexes ( withHidden ?: boolean ) : Promise < Index [ ] > ;
2575- /**
2576- * Returns a list of all index descriptions for the collection.
2577- *
2578- * @param withHidden - If set to `true`, includes indexes that are not yet
2579- * fully built but are in the building phase. Default: `false`.
2580- *
2581- * @example
2582- * ```js
2583- * const db = new Database();
2584- * const collection = db.collection("some-collection");
2585- * const indexes = await collection.indexes(true);
2586- * ```
2587- */
2588- indexes ( withHidden ?: boolean ) : Promise < ( Index & { progress : number } ) [ ] > ;
2589+ indexes ( options ?: IndexListOptions ) : Promise < Index [ ] > ;
25892590 /**
25902591 * Returns an index description by name or `id` if it exists.
25912592 *
@@ -4169,7 +4170,7 @@ export class Collection<T extends Record<string, any> = any>
41694170 method : "PUT" ,
41704171 path : "/_api/simple/remove-by-keys" ,
41714172 body : {
4172- options : options ,
4173+ options,
41734174 keys,
41744175 collection : this . _name ,
41754176 } ,
@@ -4178,11 +4179,11 @@ export class Collection<T extends Record<string, any> = any>
41784179 //#endregion
41794180
41804181 //#region indexes
4181- indexes ( withHidden = false ) {
4182+ indexes ( options ?: IndexListOptions ) {
41824183 return this . _db . request (
41834184 {
41844185 path : "/_api/index" ,
4185- search : { collection : this . _name , withHidden : String ( withHidden ) } ,
4186+ search : { collection : this . _name , ... options } ,
41864187 } ,
41874188 ( res ) => res . parsedBody . indexes
41884189 ) ;
0 commit comments