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

Add delete task api for v0.30.0 #1382

Merged
merged 48 commits into from
Nov 11, 2022

Conversation

bidoubiwa
Copy link
Contributor

@bidoubiwa bidoubiwa commented Nov 3, 2022

Add the cancel task api see spec

Todo

  • Create type TasksDeleteQuery
  • Extend it from TasksQuery
  • Omit from and limit
  • Add JS doc in:
    • deleteTasks client
    • deleteTasks tasks
  • Add new detail: deletedTasks in Tasks.detail
  • Add comments on new detail to explain it
    • deletedTasks
  • In client:
    • create deleteTasks(params) plural
  • In tasks:
    • create deleteTasks(params) plural
  • Add taskDeletion as new Task type
  • Tests tasks deletion on all query parameters
    • Add uid
    • Add canceledBy
    • Add beforeEnqueuedAt
    • Add afterEnqueuedAt
    • Add beforeStartedAt
    • Add afterStatedAt
    • Add beforeFinishedAt
    • Add afterFinishedAt
  • Tests new detail deletedTasks
  • Add deleteTasks in API refs

@bidoubiwa bidoubiwa added the enhancement New feature or request label Nov 3, 2022
@bidoubiwa bidoubiwa changed the base branch from main to add_cancel_api_for_v0.30.0 November 7, 2022 10:24
@bidoubiwa bidoubiwa marked this pull request as ready for review November 7, 2022 11:55
Comment on lines +600 to +601
const currentTimeStamp = Date.now()
const currentTime = new Date(currentTimeStamp)
Copy link
Member

Choose a reason for hiding this comment

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

Why not just?

Suggested change
const currentTimeStamp = Date.now()
const currentTime = new Date(currentTimeStamp)
const currentTime = new Date(Date.now())

Copy link
Member

Choose a reason for hiding this comment

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

Or even just Date.now() directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The date now returns a timestamp

The static Date.now() method returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.

The Date constructor returns an instance of Date required by the function

The Date() constructor can create a Date instance or return a string representing the current time.

})
const task = await client.waitForTask(enqueuedTask.taskUid)

expect(task.type).toEqual(TaskTypes.TASK_DELETION)
Copy link
Member

Choose a reason for hiding this comment

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

Did you miss this one?
expect(task.details?.originalQuery).toContain('afterFinishedAt')

@bidoubiwa bidoubiwa force-pushed the add_delete_task_api_for_v0.30.0 branch from 0665a4c to 2d0b305 Compare November 8, 2022 14:44
Base automatically changed from add_cancel_api_for_v0.30.0 to bump-meilisearch-v0.30.0 November 11, 2022 18:52
@bidoubiwa bidoubiwa merged commit ea102e6 into bump-meilisearch-v0.30.0 Nov 11, 2022
@bidoubiwa bidoubiwa deleted the add_delete_task_api_for_v0.30.0 branch November 11, 2022 19:01
meili-bors bot added a commit that referenced this pull request Nov 28, 2022
1406: build(deps-dev): bump @rollup/plugin-commonjs from 23.0.2 to 23.0.3 r=bidoubiwa a=dependabot[bot]

Bumps [`@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/HEAD/packages/commonjs)` from 23.0.2 to 23.0.3.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rollup/plugins/blob/master/packages/commonjs/CHANGELOG.md"><code>`@​rollup/plugin-commonjs</code>'s` changelog</a>.</em></p>
<blockquote>
<h2>v23.0.3</h2>
<p><em>2022-11-27</em></p>
<h3>Bugfixes</h3>
<ul>
<li>fix: correctly wrap a default class export from cjs module <a href="https://github-redirect.dependabot.com/rollup/plugins/pull/1350">#1350</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/rollup/plugins/commit/2114cf7c1ce269100c692cb06377d90cecd73fdb"><code>2114cf7</code></a> chore(release): commonjs v23.0.3</li>
<li><a href="https://github.com/rollup/plugins/commit/ab052169c1719d57429fa28948268758a3b5e281"><code>ab05216</code></a> fix(commonjs): correctly wrap a default class export from cjs module (<a href="https://github.com/rollup/plugins/tree/HEAD/packages/commonjs/issues/1350">#1350</a>)</li>
<li>See full diff in <a href="https://github.com/rollup/plugins/commits/commonjs-v23.0.3/packages/commonjs">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=`@rollup/plugin-commonjs&package-manager=npm_and_yarn&previous-version=23.0.2&new-version=23.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)`

You can trigger a rebase of this PR by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

1408: Update version for the next release (v0.30.0) r=bidoubiwa a=bidoubiwa

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

## 🚀 Enhancements

- New `pagination` strategy with the search parameters`page` and `hitsPerPage` #1372 
- New filters on `getTasks`: `uid`, `beforeEnqueuedAt`, `afterEnqueuedAt`, ... see #1376
- New `client.cancelTasks` method that lets you cancel `enqueued` and `processing` tasks #1379 
- New `client.deleteTasks` method that lets you deleted tasks #1382 
- New `client.swapIndexes` method that lets you swap two indexes #1384 

## ⚠️ Breaking change

- Parameters on `getTasks` name changes: #1391
   - `status` -> `statuses`
   - `index_uid` -> `index_uids`
   - `type` -> `types`
- Task detail `receivedDocumentIds` renamed to `providedIds` #1386 
- Remove `batchUid` from `Task` class #1388
- Error field in `Task` is now always present and has a `null` value when there are no errors #1389 
- Add and rename some error codes: #1393
- (ts) Make all the fields of details field of TaskObject optional (#1398) `@amit-ksh`
- (ts) Make all the fields of details field of TaskObject optional (#1398) `@amit-ksh`

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charlotte Vermandel <[email protected]>
Co-authored-by: cvermand <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants