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

Update tasks routes #1259

Merged
merged 8 commits into from
Jun 15, 2022
Merged

Update tasks routes #1259

merged 8 commits into from
Jun 15, 2022

Conversation

bidoubiwa
Copy link
Contributor

@bidoubiwa bidoubiwa commented Jun 14, 2022

Pull Request

Related to: meilisearch/integration-guides#205

What does this PR do?

Routes changes

  1. Remove GET /indexes/:indexUid/tasks. Use GET /tasks?indexUid=:indexUid instead.
  2. Remove GET /indexes/:indexUid/tasks/:taskUid. Use GET /tasks/:taskUid instead.
  • index.getTask & index.waitForTask now use GET /tasks/:task_uid
  • index.getTasks & index.waitForTasks now use GET/tasks?indexUid=movies
  • Rename task uid field to taskUid.

Naming changes

  • The field indexUid can be null.

Filtering

  1. In the endpoint GET /tasks we can filter by: type, status and indexUid.
  • index.getTasks and client.getTasks can filter on type status and indexUid
client.getTasks({ type: 'indexCreation', status: 'failed', indexUid: 'movies'})

@bidoubiwa bidoubiwa changed the base branch from main to bump-meilisearch-v0.28.0 June 14, 2022 14:39
@bidoubiwa bidoubiwa force-pushed the update_task_route branch from c655384 to 6058a5e Compare June 14, 2022 15:06
Comment on lines +92 to +93
const { results } = await this.getRawIndexes()
const indexes: Index[] = results.map(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to be change to be able to run the tasks tests 😕

@bidoubiwa bidoubiwa changed the title Update task route Update tasks routes Jun 14, 2022
Comment on lines +105 to +107
async getRawIndexes(): Promise<Result<IndexResponse[]>> {
const url = `indexes`
return await this.httpRequest.get<IndexResponse[]>(url)
return await this.httpRequest.get<Result<IndexResponse[]>>(url)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to be change to be able to run the tasks tests 😕

@bidoubiwa bidoubiwa requested a review from brunoocasali June 14, 2022 16:01
@bidoubiwa bidoubiwa marked this pull request as ready for review June 14, 2022 16:01
@bidoubiwa bidoubiwa marked this pull request as draft June 14, 2022 16:01
@bidoubiwa bidoubiwa marked this pull request as ready for review June 14, 2022 16:20
@bidoubiwa bidoubiwa force-pushed the update_task_route branch from b305057 to b626044 Compare June 15, 2022 11:29
@bidoubiwa bidoubiwa force-pushed the update_task_route branch from b626044 to b160c8b Compare June 15, 2022 11:36
@bidoubiwa bidoubiwa requested a review from brunoocasali June 15, 2022 11:37
@bidoubiwa bidoubiwa added the breaking-change The related changes are breaking for the users label Jun 15, 2022
@bidoubiwa bidoubiwa requested a review from mdubus June 15, 2022 12:44
Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@bidoubiwa bidoubiwa merged commit aa75407 into bump-meilisearch-v0.28.0 Jun 15, 2022
@bidoubiwa bidoubiwa deleted the update_task_route branch June 15, 2022 13:58
Comment on lines +25 to +27
* @returns { Promise<Result<Task[]>> }
*/
async getTask(uid: number): Promise<Task> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "jsdoc return" doesn't match the one of the function

return await this.httpRequest.get<Result<Task[]>>(
url,
removeUndefinedFromObject(queryParams)
)
}

/**
* Wait for a task to be processed.
*
* @param {number} uid Task identifier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taskUid - Task identifier

)
}

/**
* Waits for multiple tasks to be processed
*
* @param {number} taskIds Tasks identifier list
* @param {number} taskUids Tasks identifier list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{number[]}

meili-bors bot added a commit that referenced this pull request Jul 11, 2022
1294: Update version for the next release (v0.27.0) r=bidoubiwa a=bidoubiwa

This version makes this package compatible with Meilisearch v0.28.0 🎉
Check out the changelog of [Meilisearch v0.28.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0) for more information on the changes.

## 💥 Breaking changes

- `client.updateKey(key: string, options: KeyPayload): Promise<Key>` now can just update the `description` and/or the name. #1266
- The type `EnqueuedTask` now returns an `taskUid` instead of an `uid`
- `client.getTasks(...)` and `index.getTasks()` now returns a  TasksResults type containing the following fields: `results`, `limit`, `from`, `next`  #1269 
- `index.search` changes in the response parameters: #1263
    - `nbHits` replaced with `estimatedTotalHits`
    - `exhaustiveNbHits` is deleted
    - `exhaustiveFacetsCount` is deleted
- `index.search` changes in the request parameters:  #1263
    -  `matches` renamed `showMatchesPosition`
    -  `_matchesInfo` response parameter is renamed `_matchesPosition`
    - `facetsDistribution` request parameter is renamed `facets`.
    -  `facetsDistribution` response parameter is renamed `facetDistribution`.
- The `Index` type and returned `IndexObject` does not contain a `name` field anymore
- `client.getIndexes` and `client.getRawIndexes` now returns an `IndexesResults` type containing the following fields: `results`, `limit`, `offset`, `total` #1269
- `index.getDocuments` and `client.getDocuments` now returns an `DocumentsResults` type containing the following fields: `results`, `limit`, `offset`, `total` #1269
- `index.getDocuments` and `index.getDocument`  query parameter `attributesToRetrieve` is now called `fields` #1264
- `client.getDumpStatus` has been removed #1267
- `client.createDump()` now returns an `EnqueuedTask` #1267
- `client.generateTenantToken(apiKeyUid, searchRules, options)` has now a mandatory `apiKeyUid` parameter which should contain the uid of a specific API key. #1268  


## 🚀 Enhancements

- `client.getKeys(parameters: KeysQuery  = {})` now accepts pagination parameters: `limit`, `offset` #1269 
- `client.getKey(keyOrUid: string)` can now also find keys based on their key uid. #1266 
- `client.createKey(options: KeyCreation)` lets you specify a custom uid (optionally) to create a new Key #1269
- The returned `Key` now has an additional `name` and `uid` string fields. #1266 
- The `indexUid` field in both `EnqueuedTask` and `Task` can be null #1259 
- `client.getTasks(parameters: TasksQuery = {})` and   `index.getTasks(parameters: TasksQuery)` now accepts pagination parameters: `limit`, `from`, `next` and filters parameters: `type`, `status`, `indexUid` (same for `index.getTasks`) #1269 
- `client.getIndexes` and `client.getRawIndexes` now accepts pagination parameters: `limit`, `offset` #1269 
- `index.getDocuments` now accepts pagination parameters: `limit`, `offset` #1269 
- `new MeiliSearch({ host, apiKey, headers, clientAgents })` now accept a new parameter `clientAgents` that should contain the agent from which the library is used. #1272

Analytics is enabled by default in the server, but you can disable them by following [this guide](https://docs.meilisearch.com/learn/what_is_meilisearch/telemetry.html#how-to-disable-data-collection)
Also, of course, every analytics data we collect are **ANONYMOUS** [read the guide for more information](https://docs.meilisearch.com/learn/what_is_meilisearch/telemetry.html).

Thanks again to `@bidoubiwa` ! 🎉

Co-authored-by: Charlotte Vermandel <charlottevermandel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants