Skip to content

Commit

Permalink
Merge branch 'bump-meilisearch-v1.3.0' into prototype-beta/prototype-…
Browse files Browse the repository at this point in the history
…search-for-facet-values
  • Loading branch information
bidoubiwa authored Jul 10, 2023
2 parents cbf0ca8 + 4338c47 commit d457ab3
Show file tree
Hide file tree
Showing 15 changed files with 1,485 additions and 1,045 deletions.
5 changes: 4 additions & 1 deletion .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,10 @@ getting_started_add_documents_md: |-
**Use**
```js
const client = new MeiliSearch({ host: 'http://localhost:7700' })
const client = new MeiliSearch({
host: 'http://localhost:7700',
apiKey: 'aSampleMasterKey'
})
client.index('movies').addDocuments(movies)
.then((res) => console.log(res))
```
Expand Down
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<h4 align="center">
<a href="https://github.com/meilisearch/meilisearch">Meilisearch</a> |
<a href="https://www.meilisearch.com/pricing?utm_campaign=oss&utm_source=integration&utm_medium=meilisearch-js">Meilisearch Cloud</a> |
<a href="https://www.meilisearch.com/docs">Documentation</a> |
<a href="https://discord.meilisearch.com">Discord</a> |
<a href="https://roadmap.meilisearch.com/tabs/1-under-consideration">Roadmap</a> |
Expand All @@ -30,6 +31,7 @@
## Table of Contents <!-- omit in toc -->

- [📖 Documentation](#-documentation)
- [⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
- [🔧 Installation](#-installation)
- [🎬 Getting started](#-getting-started)
- [🤖 Compatibility with Meilisearch](#-compatibility-with-meilisearch)
Expand All @@ -43,6 +45,10 @@ This readme contains all the documentation you need to start using this Meilisea

For general information on how to use Meilisearch—such as our API reference, tutorials, guides, and in-depth articles—refer to our [main documentation website](https://www.meilisearch.com/docs/).

## ⚡ Supercharge your Meilisearch experience

Say goodbye to server deployment and manual updates with [Meilisearch Cloud](https://www.meilisearch.com/pricing?utm_campaign=oss&utm_source=integration&utm_medium=meilisearch-js). No credit card required.

## 🔧 Installation

We recommend installing `meilisearch-js` in your project with your package manager of choice.
Expand Down Expand Up @@ -375,9 +381,9 @@ This package guarantees compatibility with [version v1.x of Meilisearch](https:/

The following sections in our main documentation website may interest you:

- **Manipulate documents**: see the [API references](https://www.meilisearch.com/docs/reference/api/documents) or read more about [documents](https://www.meilisearch.com/docs/learn/core_concepts/documents.html).
- **Manipulate documents**: see the [API references](https://www.meilisearch.com/docs/reference/api/documents) or read more about [documents](https://www.meilisearch.com/docs/learn/core_concepts/documents).
- **Search**: see the [API references](https://www.meilisearch.com/docs/reference/api/search) or follow our guide on [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters).
- **Manage the indexes**: see the [API references](https://www.meilisearch.com/docs/reference/api/indexes) or read more about [indexes](https://www.meilisearch.com/docs/learn/core_concepts/indexes.html).
- **Manage the indexes**: see the [API references](https://www.meilisearch.com/docs/reference/api/indexes) or read more about [indexes](https://www.meilisearch.com/docs/learn/core_concepts/indexes).
- **Configure the index settings**: see the [API references](https://www.meilisearch.com/docs/reference/api/settings) or follow our guide on [settings parameters](https://www.meilisearch.com/docs/reference/api/settings#settings_parameters).

This repository also contains [more examples](./examples).
Expand Down Expand Up @@ -490,7 +496,7 @@ client.index('myIndex').deleteAllDocuments(): Promise<Types.EnqueuedTask>

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

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

```ts
client.getTasks(parameters: TasksQuery): Promise<TasksResults>
Expand All @@ -502,19 +508,19 @@ client.getTasks(parameters: TasksQuery): Promise<TasksResults>
client.getTask(uid: number): Promise<Task>
```

#### [Delete tasks](https://www.meilisearch.com/docs/reference/api/tasks.html#delete-task)
#### [Delete tasks](https://www.meilisearch.com/docs/reference/api/tasks#delete-tasks)

```ts
client.deleteTasks(parameters: DeleteTasksQuery = {}): Promise<EnqueuedTask>
```

#### [Cancel tasks](https://www.meilisearch.com/docs/reference/api/tasks.html#cancel-task)
#### [Cancel tasks](https://www.meilisearch.com/docs/reference/api/tasks#cancel-tasks)

```ts
client.cancelTasks(parameters: CancelTasksQuery = {}): Promise<EnqueuedTask>
```

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

```ts
client.index('myIndex').getTasks(parameters: TasksQuery): Promise<TasksResults>
Expand Down Expand Up @@ -627,7 +633,7 @@ client.deleteIndex(uid): Promise<void>
client.index('myIndex').delete(): Promise<void>
```

#### [Get specific index stats](https://www.meilisearch.com/docs/reference/api/stats.html#get-stat-of-an-index)
#### [Get specific index stats](https://www.meilisearch.com/docs/reference/api/stats#get-stats-of-an-index)

```ts
client.index('myIndex').getStats(): Promise<IndexStats>
Expand Down Expand Up @@ -893,71 +899,71 @@ client.index('myIndex').resetTypoTolerance(): Promise<EnqueuedTask>

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

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

```ts
client.getKeys(parameters: KeysQuery): Promise<KeysResults>
```

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

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

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

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

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

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

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

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

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

#### [Return `true` or `false` depending on the health of the server](https://www.meilisearch.com/docs/reference/api/health.html#get-health)
#### [Return `true` or `false` depending on the health of the server](https://www.meilisearch.com/docs/reference/api/health#get-health)

```ts
client.isHealthy(): Promise<boolean>
```

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

#### [Check if the server is healthy](https://www.meilisearch.com/docs/reference/api/health.html#get-health)
#### [Check if the server is healthy](https://www.meilisearch.com/docs/reference/api/health#get-health)

```ts
client.health(): Promise<Health>
```

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

#### [Get database stats](https://www.meilisearch.com/docs/reference/api/stats.html#get-stats-of-all-indexes)
#### [Get database stats](https://www.meilisearch.com/docs/reference/api/stats#get-stats-of-all-indexes)

```ts
client.getStats(): Promise<Stats>
```

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

#### [Get binary version](https://www.meilisearch.com/docs/reference/api/version.html#get-version-of-meilisearch)
#### [Get binary version](https://www.meilisearch.com/docs/reference/api/version#get-version-of-meilisearch)

```ts
client.getVersion(): Promise<Version>
```

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

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

```ts
client.createDump(): Promise<EnqueuedTask>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meilisearch",
"version": "0.33.0-prototype-search-for-facet-values.1",
"version": "0.34.0",
"description": "The Meilisearch JS client for Node.js and the browser.",
"keywords": [
"meilisearch",
Expand Down Expand Up @@ -73,9 +73,9 @@
"cross-fetch": "^3.1.6"
},
"devDependencies": {
"@babel/preset-env": "^7.22.4",
"@babel/preset-env": "^7.22.5",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "25.0.0",
"@rollup/plugin-commonjs": "25.0.2",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "15.1.0",
"@types/jest": "^27.5.0",
Expand Down Expand Up @@ -106,7 +106,7 @@
"pretty-bytes": "^5.6.0",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.0",
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-typescript2": "^0.35.0",
"shx": "^0.3.2",
"ts-jest": "^26.5.6",
"typescript": "^4.9.5"
Expand Down
2 changes: 1 addition & 1 deletion src/clients/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class Client {
keys.results = keys.results.map((key) => ({
...key,
createdAt: new Date(key.createdAt),
updateAt: new Date(key.updateAt),
updatedAt: new Date(key.updatedAt),
}))

return keys
Expand Down
4 changes: 2 additions & 2 deletions src/indexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,9 +1040,9 @@ class Index<T extends Record<string, any> = Record<string, any>> {
*
* @returns Promise containing the typo tolerance settings.
*/
async getTypoTolerance(): Promise<string[]> {
async getTypoTolerance(): Promise<TypoTolerance> {
const url = `indexes/${this.uid}/settings/typo-tolerance`
return await this.httpRequest.get<string[]>(url)
return await this.httpRequest.get<TypoTolerance>(url)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/package-version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const PACKAGE_VERSION = '0.33.0-prototype-search-for-facet-values.1'
export const PACKAGE_VERSION = '0.34.0'
6 changes: 5 additions & 1 deletion src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,13 @@ export type TypoTolerance = {
}
} | null

export type FacetOrder = 'alpha' | 'count'

export type Faceting = {
maxValuesPerFacet?: number | null
sortFacetValuesBy?: Record<string, FacetOrder> | null
}

export type PaginationSettings = {
maxTotalHits?: number | null
}
Expand Down Expand Up @@ -473,7 +477,7 @@ export type Key = {
indexes: string[]
expiresAt: Date
createdAt: Date
updateAt: Date
updatedAt: Date
}

export type KeyCreation = {
Expand Down
75 changes: 75 additions & 0 deletions tests/__snapshots__/faceting.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test on faceting Admin key: Get default faceting object 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Reset faceting 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Update faceting at null 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Update faceting settings 1`] = `
Object {
"maxValuesPerFacet": 12,
"sortFacetValuesBy": Object {
"*": "alpha",
"test": "count",
},
}
`;

exports[`Test on faceting Master key: Get default faceting object 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Reset faceting 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Update faceting at null 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Update faceting settings 1`] = `
Object {
"maxValuesPerFacet": 12,
"sortFacetValuesBy": Object {
"*": "alpha",
"test": "count",
},
}
`;
Loading

0 comments on commit d457ab3

Please sign in to comment.