Skip to content

Commit d8e28ad

Browse files
committed
Add working version of refacto
1 parent f4be884 commit d8e28ad

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function getOutputFileName(fileName, isProd = false) {
1313

1414
const env = process.env.NODE_ENV || 'development'
1515
const ROOT = resolve(__dirname, '.')
16-
const INPUT = 'src/client/index.ts'
16+
const INPUT = 'src/index.ts'
1717

1818
const PLUGINS = [
1919
typescript({

src/client/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { MeiliSearch } from 'meilisearch'
2-
import {
3-
InstantMeiliSearchOptions,
4-
InstantMeiliSearchInstance,
5-
InstantSearchTypes,
6-
} from '../types'
2+
import { InstantMeiliSearchOptions, InstantMeiliSearchInstance } from '../types'
73

84
import {
95
transformToMeiliSearchParams,
@@ -17,9 +13,7 @@ export function instantMeiliSearch(
1713
): InstantMeiliSearchInstance {
1814
return {
1915
MeiliSearchClient: new MeiliSearch({ host: hostUrl, apiKey: apiKey }),
20-
search: async function ([
21-
isSearchRequest,
22-
]: InstantSearchTypes.SearchRequest[]) {
16+
search: async function ([isSearchRequest]) {
2317
try {
2418
// Params got from InstantSearch
2519
const {

src/transformers/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export * from './to-meilisearch-params'
22
export * from './to-instantsearch-response'
3+
export * from './to-instantsearch-hits'
4+
export * from './to-instantsearch-highlight'
35
export * from './pagination'

src/types/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as MStypes from 'meilisearch'
22
import * as IStypes from './instantsearch-types'
3-
export * as MeiliSearchTypes from 'meilisearch'
4-
export * as InstantSearchTypes from './instantsearch-types'
53

64
export type ISSearchParams = IStypes.SearchRequestParameters &
75
MStypes.SearchParams<any>

tests/env/express/tests/client.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe('Instant MeiliSearch Browser test', () => {
55

66
it('Should have generated a instant-meilisearch client and displayed', async () => {
77
await expect(page.content()).resolves.toMatch(
8-
'{"client":{"config":{"host":"http://localhost:7700/","apiKey":"masterKey"},"httpRequest":{"headers":{"Content-Type":"application/json","X-Meili-API-Key":"masterKey"},"url":"http://localhost:7700/"}},"paginationTotalHits":200,"placeholderSearch":true,"hitsPerPage":20,"page":0}'
8+
'{"MeiliSearchClient":{"config":{"host":"http://localhost:7700/","apiKey":"masterKey"},"httpRequest":{"headers":{"Content-Type":"application/json","X-Meili-API-Key":"masterKey"},"url":"http://localhost:7700/"}}}'
99
)
1010
})
1111
})

0 commit comments

Comments
 (0)