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

Changes related to the next Meilisearch release (v0.28.0) #1257

Merged
merged 24 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d1d4fbb
Update README.md
meili-bot Jun 9, 2022
aa75407
Update tasks routes (#1259)
bidoubiwa Jun 15, 2022
4edba56
Update the tests impacted by the task api changes (#1260)
bidoubiwa Jun 15, 2022
1ee79b1
Fix comments on tasks method
bidoubiwa Jun 16, 2022
b8cec6e
Wrap get indexes routes in results object v0.28 (#1261)
bidoubiwa Jun 20, 2022
6fcd2a3
Update http methods in settings routes v0.28 (#1262)
bidoubiwa Jun 20, 2022
4ab9921
Update search method v0.28 (#1263)
bidoubiwa Jun 20, 2022
512adba
Update documents method v0.28 (#1264)
bidoubiwa Jun 22, 2022
e1864ab
Update key management v0.28 (#1266)
bidoubiwa Jun 22, 2022
ef27da8
Update dumps method v0.28 (#1267)
bidoubiwa Jun 22, 2022
128df4d
Update waitForTasks return format to not use resource result (#1271)
bidoubiwa Jun 22, 2022
b61f466
Update token creation v0.28.0 (#1268)
bidoubiwa Jun 27, 2022
d4a2a8a
Add pagination system on resources for v0.28.0 (#1269)
bidoubiwa Jun 27, 2022
bb9a022
Unskip get search tests
bidoubiwa Jun 27, 2022
60db7c2
Fix esm env test
bidoubiwa Jun 27, 2022
5c8aa80
Add pagination and faceting types on settings for v0.28.0 (#1281)
bidoubiwa Jun 28, 2022
bb1a824
Add client header with package information (#1272)
bidoubiwa Jun 28, 2022
bdb80db
Merge branch 'main' of github.com:meilisearch/meilisearch-js into bum…
bidoubiwa Jun 29, 2022
75da3b2
Fix readme information
bidoubiwa Jun 29, 2022
d06422b
Update FacetsDistribution type name to FacetDistribution
bidoubiwa Jun 29, 2022
ed23994
Update parameter naming in keys routes (#1283)
bidoubiwa Jul 4, 2022
c4fc383
Add fields parameter to getDocument route (#1291)
bidoubiwa Jul 6, 2022
13335b4
Fix tests failing because of bad task handling (#1295)
bidoubiwa Jul 6, 2022
d0d3f0e
Merge branch 'main' into bump-meilisearch-v0.28.0
bidoubiwa Jul 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ search_parameter_guide_highlight_tag_1: |-
})
search_parameter_guide_matches_1: |-
client.index('movies').search('winter feast', {
matches: true
showMatchesPosition: true
})
settings_guide_synonyms_1: |-
client.index('tops').updateSettings({
Expand Down Expand Up @@ -497,7 +497,7 @@ faceted_search_filter_1: |-
faceted_search_facets_distribution_1: |-
client.index('movies')
.search('Batman', {
facetsDistribution: ['genres']
facets: ['genres']
})
faceted_search_walkthrough_filter_1: |-
client.index('movies')
Expand All @@ -506,8 +506,6 @@ faceted_search_walkthrough_filter_1: |-
})
post_dump_1: |-
client.createDump()
get_dump_status_1: |-
client.getDumpStatus('20201101-110357260')
phrase_search_1: |-
client.index('movies')
.search('"african american" horror')
Expand Down
14 changes: 11 additions & 3 deletions .github/scripts/check-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

# Checking if current tag matches the package version
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | tr -d ' ',v)
file_tag=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
if [ "$current_tag" != "$file_tag" ]; then

package_json_version=$(grep '"version":' package.json | cut -d ':' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
if [ "$current_tag" != "$package_json_version" ]; then
echo "Error: the current tag does not match the version in package file(s)."
echo "$current_tag vs $file_tag"
echo "$current_tag vs $package_json_version"
exit 1
fi

package_version_ts=$(grep "PACKAGE_VERSION =" src/package-version.ts | cut -d "=" -f 2- | tr -d " " | tr -d "'")
if [ "$current_tag" != "$package_version_ts" ]; then
echo "Error: the current tag does not match the version in src/package-version.ts."
echo "$current_tag vs $package_version_ts"
exit 1
fi

Expand Down
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m

⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md).

Make a PR modifying the file [`package.json`](/package.json) with the right version.
Make a PR modifying the following files with the right version:

[`package.json`](/package.json):
```javascript
"version": "X.X.X",
```

[`src/package-version`](/src/package-version.ts)
```javascript
export const PACKAGE_VERSION = 'X.X.X'
```

Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-js/releases): on this page, click on `Edit` (related to the draft release) > update the description (be sure you apply [these recommandations](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md#writting-the-release-description)) > when you are ready, click on `Publish release`.

GitHub Actions will be triggered and push the package to [npm](https://www.npmjs.com/package/meilisearch).
Expand Down
79 changes: 36 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Output:
],
"offset": 0,
"limit": 20,
"nbHits": 1,
"estimatedTotalHits": 1,
"processingTimeMs": 1,
"query": "philoudelphia"
}
Expand Down Expand Up @@ -227,7 +227,7 @@ await index.search(
],
"offset": 0,
"limit": 20,
"nbHits": 1,
"estimatedTotalHits": 1,
"processingTimeMs": 0,
"query": "wonder"
}
Expand Down Expand Up @@ -270,7 +270,7 @@ await index.search(
],
"offset": 0,
"limit": 20,
"nbHits": 1,
"estimatedTotalHits": 1,
"processingTimeMs": 0,
"query": "wonder"
}
Expand All @@ -285,7 +285,7 @@ await index.search(
'',
{
filter: ['genres = fantasy'],
facetsDistribution: ['genres']
facets: ['genres']
}
)
```
Expand All @@ -306,10 +306,10 @@ await index.search(
],
"offset": 0,
"limit": 20,
"nbHits": 2,
"estimatedTotalHits": 2,
"processingTimeMs": 0,
"query": "",
"facetsDistribution": {
"facetDistribution": {
"genres": {
"Action": 2,
"Fantasy": 1,
Expand Down Expand Up @@ -342,7 +342,7 @@ controller.abort()

## 🤖 Compatibility with Meilisearch

This package only guarantees the compatibility with the [version v0.27.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0).
This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).

## 💡 Learn More

Expand Down Expand Up @@ -393,7 +393,7 @@ If you want to know more about the development workflow or want to contribute, p

- [Get Documents](https://docs.meilisearch.com/reference/api/documents.html#get-documents):

`index.getDocuments(params: getDocumentsParams): Promise<Document<T>[]>`
`index.getDocuments(parameters: DocumentsQuery = {}): Promise<DocumentsResults<T>>>`

- [Get one document](https://docs.meilisearch.com/reference/api/documents.html#get-one-document):

Expand All @@ -413,47 +413,44 @@ If you want to know more about the development workflow or want to contribute, p

### Tasks <!-- omit in toc -->

- [Get task info using the client](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks):
- [Get all tasks](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks)

Task list:
`client.getTasks(): Promise<Result<Task[]>>`
`client.getTasks(parameters: TasksQuery): Promise<TasksResults>`

One task:
`client.getTask(uid: number): Promise<Task>`
- [Get one task](https://docs.meilisearch.com/reference/api/tasks.html#get-task)

- [Get task info using the index](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks-by-index):
`client.getTask(uid: number): Promise<Task>`

Task list:
`index.getTasks(): Promise<Result<Task[]>>`
- [Get all tasks of an index](https://docs.meilisearch.com/reference/api/tasks.html#get-all-tasks-by-index)

One task:
`index.getTask(uid: number): Promise<Task>`
`index.getTasks(parameters: TasksQuery): Promise<TasksResults>`

- [Get one task of an index](https://docs.meilisearch.com/reference/api/tasks.html#get-task)

`index.getTask(uid: number): Promise<Task>`

- Wait for one task:

Using de client:
`client.waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>`
`client.waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>`

Using the index:
`index.waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>`
With an index instance:
`index.waitForTask(uid: number, { timeOutMs?: number, intervalMs?: number }): Promise<Task>`

- Wait for multiple tasks:
`client.waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Task[]>`

Using the client:
`client.waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Result<Task[]>>`

Using the index:
`index.waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Result<Task[]>>`
With an index instance:
`index.waitForTasks(uids: number[], { timeOutMs?: number, intervalMs?: number }): Promise<Task[]>`

### Indexes <!-- omit in toc -->

- [Get all indexes in Index instances](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes):
- [Get all indexes as Index instances](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes):

`client.getIndexes(): Promise<Index[]>`
`client.getIndexes(parameters: IndexesQuery): Promise<IndexesResults<Index[]>>`

- [Get raw indexes in JSON response from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes):
- [Get all indexes](https://docs.meilisearch.com/reference/api/indexes.html#list-all-indexes):

`client.getRawIndexes(): Promise<IndexResponse[]>`
`client.getRawIndexes(parameters: IndexesQuery): Promise<IndexesResults<IndexObject[]>>`

- [Create a new index](https://docs.meilisearch.com/reference/api/indexes.html#create-an-index):

Expand All @@ -467,10 +464,10 @@ Using the index:
`client.getIndex<T>(uid: string): Promise<Index<T>>`

- [Get the raw index JSON response from Meilisearch](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index):
`client.getRawIndex(uid: string): Promise<IndexResponse>`
`client.getRawIndex(uid: string): Promise<IndexObject>`

- [Get an object with information about the index](https://docs.meilisearch.com/reference/api/indexes.html#get-one-index):
`index.getRawInfo(): Promise<IndexResponse>`
`index.getRawInfo(): Promise<IndexObject>`

- [Update Index](https://docs.meilisearch.com/reference/api/indexes.html#update-an-index):

Expand Down Expand Up @@ -620,23 +617,23 @@ Using the index object:

- [Get keys](https://docs.meilisearch.com/reference/api/keys.html#get-all-keys):

`client.getKeys(): Promise<Result<Key[]>>`
`client.getKeys(parameters: KeysQuery): Promise<KeysResults>`

- [Get one key](https://docs.meilisearch.com/reference/api/keys.html#get-one-key):

`client.getKey(key: string): Promise<Key>`
`client.getKey(keyOrUid: string): Promise<Key>`

- [Create a key](https://docs.meilisearch.com/reference/api/keys.html#create-a-key):

`client.createKey(options: KeyPayload): Promise<Key>`
`client.createKey(options: KeyCreation): Promise<Key>`

- [Update a key](https://docs.meilisearch.com/reference/api/keys.html#update-a-key):

`client.updateKey(key: string, options: KeyPayload): Promise<Key>`
`client.updateKey(keyOrUid: string, options: KeyUpdate): Promise<Key>`

- [Delete a key](https://docs.meilisearch.com/reference/api/keys.html#delete-a-key):

`client.deleteKey(key: string): Promise<void>`
`client.deleteKey(keyOrUid: string): Promise<void>`

### isHealthy <!-- omit in toc -->

Expand Down Expand Up @@ -666,11 +663,7 @@ Using the index object:

- [Trigger a dump creation process](https://docs.meilisearch.com/reference/api/dump.html#create-a-dump):

`client.createDump(): Promise<Types.EnqueuedDump>`

- [Get the status of a dump creation process](https://docs.meilisearch.com/reference/api/dump.html#get-dump-status):

`client.getDumpStatus(dumpUid: string): Promise<Types.EnqueuedDump>`
`client.createDump(): Promise<EnqueuedTask>`

<hr>

Expand Down
10 changes: 5 additions & 5 deletions playgrounds/javascript/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const indexUid = 'movies'

const addDataset = async () => {
await client.deleteIndex(indexUid)
const { uid } = await client.createIndex(indexUid)
await client.index(indexUid).waitForTask(uid)
const { taskUid } = await client.createIndex(indexUid)
await client.index(indexUid).waitForTask(taskUid)

const documents = await client.index(indexUid).getDocuments()

Expand All @@ -27,9 +27,9 @@ const addDataset = async () => {
{ id: 5, title: 'Moana', genres: ['Fantasy', 'Action'] },
{ id: 6, title: 'Philadelphia', genres: ['Drama'] },
]
if (documents.length === 0) {
const task = await client.index(indexUid).addDocuments(dataset)
await client.index(indexUid).waitForTask(task.uid)
if (documents.results.length === 0) {
const { taskUid } = await client.index(indexUid).addDocuments(dataset)
await client.index(indexUid).waitForTask(taskUid)
}
}

Expand Down
Loading