Skip to content

Commit

Permalink
Merge branch 'main' into bump-meilisearch-v0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
curquiza authored Dec 3, 2024
2 parents 118da8e + 756d856 commit 7f4fbd6
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 365 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Run Browser env
run: yarn test:env:browser
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
style_tests:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ First of all, thank you for contributing to Meilisearch! The goal of this docume

To run this project, you will need:

- Node.js >= v14 and node <= 18
- Node.js >= v16 and node <= 18
- Yarn

- vitest

### Setup

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meilisearch",
"version": "0.45.0",
"version": "0.46.0",
"description": "The Meilisearch JS client for Node.js and the browser.",
"keywords": [
"meilisearch",
Expand Down Expand Up @@ -89,33 +89,33 @@
"@rollup/plugin-terser": "^0.4.4",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@eslint/js": "^9.11.1",
"@eslint/js": "^9.16.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "28.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "15.3.0",
"@types/eslint__js": "^8.42.3",
"@vitest/coverage-v8": "2.0.5",
"@vitest/eslint-plugin": "^1.1.4",
"@types/node": "^22.8.6",
"@types/node": "^22.10.1",
"brotli-size": "^4.0.0",
"eslint": "^9.13.0",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-tsdoc": "^0.3.0",
"globals": "^15.11.0",
"globals": "^15.12.0",
"gzip-size": "^6.0.0",
"kleur": "^4.1.5",
"lint-staged": "15.2.10",
"nodemon": "^3.1.7",
"prettier": "^3.3.3",
"prettier": "^3.4.1",
"prettier-plugin-jsdoc": "^1.3.0",
"pretty-bytes": "^5.6.0",
"rollup": "^4.22.5",
"rollup-plugin-typescript2": "^0.36.0",
"shx": "^0.3.2",
"typedoc": "^0.26.10",
"typedoc": "^0.27.2",
"typescript": "^5.4.5",
"typescript-eslint": "^8.12.2",
"typescript-eslint": "^8.16.0",
"vitest": "2.0.5"
},
"packageManager": "[email protected]"
Expand Down
20 changes: 7 additions & 13 deletions src/meilisearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import {
CancelTasksQuery,
DeleteTasksQuery,
MultiSearchParams,
MultiSearchResponse,
SearchResponse,
FederatedMultiSearchParams,
MultiSearchResponseOrSearchResponse,
} from "./types";
import { HttpRequests } from "./http-requests";
import { TaskClient, Task } from "./task";
Expand Down Expand Up @@ -214,18 +213,13 @@ export class MeiliSearch {
* @param config - Additional request configuration options
* @returns Promise containing the search responses
*/
multiSearch<T extends Record<string, unknown> = Record<string, any>>(
queries: MultiSearchParams,
async multiSearch<
T1 extends MultiSearchParams | FederatedMultiSearchParams,
T2 extends Record<string, unknown> = Record<string, any>,
>(
queries: T1,
config?: Partial<Request>,
): Promise<MultiSearchResponse<T>>;
multiSearch<T extends Record<string, unknown> = Record<string, any>>(
queries: FederatedMultiSearchParams,
config?: Partial<Request>,
): Promise<SearchResponse<T>>;
async multiSearch<T extends Record<string, unknown> = Record<string, any>>(
queries: MultiSearchParams | FederatedMultiSearchParams,
config?: Partial<Request>,
): Promise<MultiSearchResponse<T> | SearchResponse<T>> {
): Promise<MultiSearchResponseOrSearchResponse<T1, T2>> {
const url = `multi-search`;

return await this.httpRequest.post(url, queries, undefined, config);
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.45.0";
export const PACKAGE_VERSION = "0.46.0";
7 changes: 7 additions & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,13 @@ export type MultiSearchResponse<T = Record<string, any>> = {
results: Array<MultiSearchResult<T>>;
};

export type MultiSearchResponseOrSearchResponse<
T1 extends FederatedMultiSearchParams | MultiSearchParams,
T2 extends Record<string, unknown> = Record<string, any>,
> = T1 extends FederatedMultiSearchParams
? SearchResponse<T2>
: MultiSearchResponse<T2>;

export type FieldDistribution = {
[field: string]: number;
};
Expand Down
Loading

0 comments on commit 7f4fbd6

Please sign in to comment.