Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add documentation for, and add withDirConfig() to the QueryBuilder TS interface #2778

Open
MatthewAry opened this issue Sep 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@MatthewAry
Copy link

Is your feature request related to a problem? Please describe

See #2195

I was going crazy as to why I couldn't find a feature that should allow me to get properties from the _dir.yml file in same folder for the document I was querying, and then I found that it exists, but it was:

  1. Not documented
  2. Not included in queryBuilder interface

Basically it would be unreasonable to expect someone to find this functionality.

withDirConfig() is undocumented and untyped.

Describe the solution you'd like

Please add a type for withDirConfig() in

export interface QueryBuilder<T = ParsedContentMeta> {
/**
* Select a subset of fields
*/
only<const K extends keyof T>(keys: K): QueryBuilder<Pick<T, K>>
only<const K extends (keyof T)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>
/**
* Remove a subset of fields
*/
without<const K extends keyof T | string>(keys: K): QueryBuilder<Omit<T, K>>
without<const K extends (keyof T | string)[]>(keys: K): QueryBuilder<Omit<T, K[number]>>
/**
* Sort results
*/
sort(options: SortOptions): QueryBuilder<T>
/**
* Filter results
*/
where(query: QueryBuilderWhere): QueryBuilder<T>
/**
* Limit number of results
*/
limit(count: number): QueryBuilder<T>
/**
* Skip number of results
*/
skip(count: number): QueryBuilder<T>
/**
* Fetch list of contents
*/
find(): Promise<Array<T>>
/**
* Fetch first matched content
*/
findOne(): Promise<T>
/**
* Fetch sorround contents
*/
findSurround(query: string | QueryBuilderWhere, options?: Partial<{ before: number; after: number }>): Promise<Array<T>>
/**
* Count matched contents
*/
count(): Promise<number>
/**
* Filter contents based on locale
*/
locale(locale: string): QueryBuilder<T>
/**
* Retrieve query builder params
* @internal
*/
params: () => QueryBuilderParams
}

@MatthewAry MatthewAry added the enhancement New feature or request label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant