diff --git a/README.md b/README.md index c4c28734..8ee5dd40 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ List of all the components that are available in [instantSearch](https://github. ### Table Of Widgets - ✅ [InstantSearch](#-instantsearch) -- ❌ [index](#-index) +- ✅ [index](#-index) - ✅ [SearchBox](#-searchbox) - ✅ [Configure](#-configure) - ❌ [ConfigureRelatedItems](#-configure-related-items) @@ -339,15 +339,13 @@ const search = instantsearch({ }) ``` -### ❌ Index +### ✅ Index [Index references](https://www.algolia.com/doc/api-reference/widgets/index-widget/js/) `Index` is the component that lets you apply widgets to a dedicated index. It’s useful if you want to build an interface that targets multiple indices. -Not compatible as Meilisearch does not support federated search on multiple indexes. - -If you'd like to see federated search implemented please vote for it in the [roadmap](https://roadmap.meilisearch.com/c/74-multi-index-search?utm_medium=social&utm_source=portal_share). +Using this component, instant-meilisearch does an http-request for each different `Index` widget added. More http requests are made when using the [`RefinementList`](#✅-refinementlist) widget. ### ✅ SearchBox @@ -672,6 +670,9 @@ The `refinementList` widget is one of the most common widgets you can find in a - ✅ templates: The templates to use for the widget. - ✅ cssClasses: The CSS classes to override. +The `RefinementList` widget uses the `disjunctive facet search` principle when using the `or` operator. For each different facet category used, an additional http call is made. +For example, if I ask for `color=green` and `size=2`, three http requests are made. One for the hits, one for the `color` distribution and one for the `size` distribution. To provide any feedback on the subject, refer to [this discussion](https://github.com/meilisearch/product/issues/54). + The following example will create a UI component with the a list of genres on which you will be able to facet. ```js diff --git a/cypress/integration/search-ui.spec.js b/cypress/integration/search-ui.spec.js index bdbde734..b1e6118f 100644 --- a/cypress/integration/search-ui.spec.js +++ b/cypress/integration/search-ui.spec.js @@ -38,24 +38,26 @@ describe(`${playground} playground test`, () => { it('Sort by recommendationCound ascending', () => { const select = `.ais-SortBy-select` - cy.get(select).select('steam-video-games:recommendationCount:asc') + cy.get(select).select('games:recommendationCount:asc') cy.wait(1000) cy.get(HIT_ITEM_CLASS).eq(0).contains('Deathmatch Classic') }) it('Sort by default relevancy', () => { const select = `.ais-SortBy-select` - cy.get(select).select('steam-video-games') + cy.get(select).select('games') cy.wait(1000) cy.get(HIT_ITEM_CLASS).eq(0).contains('Counter-Strike') }) - it('click on facets', () => { - const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox` - cy.get(checkbox).eq(1).click() + it('click on facets ensure disjunctive facet search', () => { + const facet = `.ais-RefinementList-list` + const checkbox = `.ais-RefinementList-checkbox` + const facetCount = '.ais-RefinementList-count' + cy.get(facet).eq(0).find(checkbox).eq(1).click() // genres > action cy.wait(1000) - cy.get(HIT_ITEM_CLASS).eq(1).contains('Team Fortress Classic') - cy.get(HIT_ITEM_CLASS).eq(1).contains('4.99 $') + cy.get(facet).eq(0).find(facetCount).eq(0).contains('5') // genres > action count + cy.get(facet).eq(1).find(facetCount).eq(0).contains('4') // players > multiplayer }) it('Search', () => { @@ -78,6 +80,6 @@ describe(`${playground} playground test`, () => { it('Paginate Search', () => { cy.get('.ais-InfiniteHits-loadMore').click() - cy.get(HIT_ITEM_CLASS).should('have.length', 11) + cy.get(HIT_ITEM_CLASS).should('have.length', 12) }) }) diff --git a/jest.config.js b/jest.config.js index f8bc35bc..dbbf028f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -32,6 +32,7 @@ module.exports = { displayName: 'dom', testPathIgnorePatterns: [...ignoreFiles, '/tests/build*'], testMatch: ['**/*.tests.ts', '/tests/**/*.ts'], + setupFilesAfterEnv: ['/scripts/jest_teardown.js'], }, { globals: { @@ -44,6 +45,7 @@ module.exports = { testEnvironment: 'node', testPathIgnorePatterns: [...ignoreFiles], testMatch: ['**/*.tests.ts', '/tests/**/*.ts'], + setupFilesAfterEnv: ['/scripts/jest_teardown.js'], }, ], } diff --git a/scripts/jest_teardown.js b/scripts/jest_teardown.js new file mode 100644 index 00000000..132068ac --- /dev/null +++ b/scripts/jest_teardown.js @@ -0,0 +1,12 @@ +const { MeiliSearch } = require('meilisearch') + +const HOST = 'http://localhost:7700' +const API_KEY = 'masterKey' + +afterAll(async () => { + const client = new MeiliSearch({ host: HOST, apiKey: API_KEY }) + await client.deleteIndex('movies') + const task = await client.deleteIndex('games') + + await client.waitForTask(task.taskUid) +}) diff --git a/src/adapter/search-request-adapter/search-params-adapter.ts b/src/adapter/search-request-adapter/search-params-adapter.ts index af8004f1..b012acff 100644 --- a/src/adapter/search-request-adapter/search-params-adapter.ts +++ b/src/adapter/search-request-adapter/search-params-adapter.ts @@ -76,8 +76,10 @@ export function MeiliParamsCreator(searchContext: SearchContext) { return meiliSearchParams }, addFacets() { - if (facets?.length) { + if (Array.isArray(facets)) { meiliSearchParams.facets = facets + } else if (typeof facets === 'string') { + meiliSearchParams.facets = [facets] } }, addAttributesToCrop() { diff --git a/src/adapter/search-request-adapter/search-resolver.ts b/src/adapter/search-request-adapter/search-resolver.ts index 13cb15cc..2805b3e9 100644 --- a/src/adapter/search-request-adapter/search-resolver.ts +++ b/src/adapter/search-request-adapter/search-resolver.ts @@ -39,18 +39,20 @@ export function SearchResolver( // Check if specific request is already cached with its associated search response. if (cachedResponse) return cachedResponse - const cachedFacets = extractFacets(searchContext, searchParams) - // Make search request const searchResponse = await client .index(searchContext.indexUid) .search(searchContext.query, searchParams) - // Add missing facets back into facetDistribution - searchResponse.facetDistribution = addMissingFacets( - cachedFacets, - searchResponse.facetDistribution - ) + if (searchContext.keepZeroFacets) { + const cachedFacets = extractFacets(searchContext, searchParams) + + // Add missing facets back into facetDistribution + searchResponse.facetDistribution = addMissingFacets( + cachedFacets, + searchResponse.facetDistribution + ) + } // query can be: empty string, undefined or null // all of them are falsy's diff --git a/src/client/instant-meilisearch-client.ts b/src/client/instant-meilisearch-client.ts index be8ebe92..47c647e6 100644 --- a/src/client/instant-meilisearch-client.ts +++ b/src/client/instant-meilisearch-client.ts @@ -67,40 +67,49 @@ export function instantMeiliSearch( instantSearchRequests: readonly AlgoliaMultipleQueriesQuery[] ): Promise<{ results: Array> }> { try { - const searchRequest = instantSearchRequests[0] - const searchContext: SearchContext = createSearchContext( - searchRequest, - instantMeiliSearchOptions, - defaultFacetDistribution - ) + const searchResponses: { results: Array> } = { + results: [], + } - // Adapt search request to Meilisearch compliant search request - const adaptedSearchRequest = adaptSearchParams(searchContext) + const requests = instantSearchRequests - // Cache first facets distribution of the instantMeilisearch instance - // Needed to add in the facetDistribution the fields that were not returned - // When the user sets `keepZeroFacets` to true. - if (defaultFacetDistribution === undefined) { - defaultFacetDistribution = await cacheFirstFacetDistribution( - searchResolver, - searchContext + for (const searchRequest of requests) { + const searchContext: SearchContext = createSearchContext( + searchRequest, + instantMeiliSearchOptions, + defaultFacetDistribution ) - searchContext.defaultFacetDistribution = defaultFacetDistribution - } - // Search response from Meilisearch - const searchResponse = await searchResolver.searchResponse( - searchContext, - adaptedSearchRequest - ) + // Adapt search request to Meilisearch compliant search request + const adaptedSearchRequest = adaptSearchParams(searchContext) + + // Cache first facets distribution of the instantMeilisearch instance + // Needed to add in the facetDistribution the fields that were not returned + // When the user sets `keepZeroFacets` to true. + if (defaultFacetDistribution === undefined) { + defaultFacetDistribution = await cacheFirstFacetDistribution( + searchResolver, + searchContext + ) + searchContext.defaultFacetDistribution = defaultFacetDistribution + } + + // Search response from Meilisearch + const searchResponse = await searchResolver.searchResponse( + searchContext, + adaptedSearchRequest + ) - // Adapt the Meilisearch responsne to a compliant instantsearch.js response - const adaptedSearchResponse = adaptSearchResponse( - searchResponse, - searchContext - ) + // Adapt the Meilisearch response to a compliant instantsearch.js response + const adaptedSearchResponse = adaptSearchResponse( + searchResponse, + searchContext + ) + + searchResponses.results.push(adaptedSearchResponse.results[0]) + } - return adaptedSearchResponse + return searchResponses } catch (e: any) { console.error(e) throw new Error(e) diff --git a/tests/assets/games.json b/tests/assets/games.json new file mode 100644 index 00000000..5481b5b9 --- /dev/null +++ b/tests/assets/games.json @@ -0,0 +1,377 @@ +[ + { + "id": "10", + "name": "Counter-Strike", + "description": "Play the worlds number 1 online action game. Engage in an incredibly realistic brand of terrorist warfare in this wildly popular team-based game. Ally with teammates to complete strategic missions. Take out enemy sites. Rescue hostages. Your role affects your teams success. Your teams success affects your role.", + "price": "9.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/10/header.jpg?t=1447887426", + "releaseDate": "Nov 1 2000", + "recommendationCount": 68991, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Adventure", + "Science Fiction" + ], + "misc": [], + "color": [ + "blue" + ] + }, + { + "id": "20", + "name": "Team Fortress Classic", + "description": "One of the most popular online action games of all time Team Fortress Classic features over nine character classes -- from Medic to Spy to Demolition Man -- enlisted in a unique style of online team warfare. Each character class possesses unique weapons items and abilities as teams compete online in a variety of game play modes.", + "price": "4.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/20/header.jpg?t=1447350811", + "releaseDate": "Apr 1 1999", + "recommendationCount": 2439, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Romance", + "Science Fiction" + ], + "misc": [], + "color": [ + "yellow" + ] + }, + { + "id": "30", + "name": "Day of Defeat", + "description": "Enlist in an intense brand of Axis vs. Allied teamplay set in the WWII European Theatre of Operations. Players assume the role of light/assault/heavy infantry sniper or machine-gunner class each with a unique arsenal of historical weaponry at their disposal. Missions are based on key historical operations. And as war rages players must work together with their squad to accomplish a variety of mission-specific objectives.", + "price": "4.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/30/header.jpg?t=1447350812", + "releaseDate": "May 1 2003", + "recommendationCount": 2319, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Drama", + "Science Fiction" + ], + "misc": [], + "color": [ + "red" + ] + }, + { + "id": "40", + "name": "Deathmatch Classic", + "description": "Enjoy fast-paced multiplayer gaming with Deathmatch Classic (a.k.a. DMC). Valves tribute to the work of id software DMC invites players to grab their rocket launchers and put their reflexes to the test in a collection of futuristic settings.", + "price": "4.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/40/header.jpg?t=1447350812", + "releaseDate": "Jun 1 2001", + "recommendationCount": 888, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Action", + "Fantasy" + ], + "misc": [], + "color": [ + "yellow" + ] + }, + { + "id": "50", + "name": "Half-Life: Opposing Force", + "description": "Return to the Black Mesa Research Facility as one of the military specialists assigned to eliminate Gordon Freeman. Experience an entirely new episode of single player action. Meet fierce alien opponents and experiment with new weaponry. Named Game of the Year by the Academy of Interactive Arts and Sciences.", + "price": "4.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/50/header.jpg?t=1447350813", + "releaseDate": "Nov 1 1999", + "recommendationCount": 2934, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Single player", + "Multiplayer" + ], + "genres": [ + "Drama", + "Action" + ], + "misc": [], + "color": [ + "blue" + ] + }, + { + "id": "60", + "name": "Ricochet", + "description": "A futuristic action game that challenges your agility as well as your aim Ricochet features one-on-one and team matches played in a variety of futuristic battle arenas.", + "price": "4.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/60/header.jpg?t=1453942008", + "releaseDate": "Nov 1 2000", + "recommendationCount": 1965, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Adventure", + "Fantasy" + ], + "misc": [], + "color": [ + "green" + ] + }, + { + "id": "70", + "name": "Half-Life", + "description": "Named Game of the Year by over 50 publications Valves debut title blends action and adventure with award-winning technology to create a frighteningly realistic world where players must think to survive. Also includes an exciting multiplayer mode that allows you to play against friends and enemies around the world.", + "price": "9.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/70/header.jpg?t=1447890508", + "releaseDate": "Nov 8 1998", + "recommendationCount": 12486, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Single player", + "Multiplayer" + ], + "genres": [ + "Adventure", + "Action" + ], + "misc": [], + "color": [ + "yellow" + ] + }, + { + "id": "80", + "name": "Counter-Strike: Condition Zero", + "description": "With its extensive Tour of Duty campaign a near-limitless number of skirmish modes updates and new content for Counter-Strikes award-winning multiplayer game play plus over 12 bonus single player missions Counter-Strike: Condition Zero is a tremendous offering of single and multiplayer content.", + "price": "9.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/80/header.jpg?t=1447889920", + "releaseDate": "Mar 1 2004", + "recommendationCount": 7067, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Single player", + "Multiplayer" + ], + "genres": [ + "Adventure", + "Romance" + ], + "misc": [], + "color": [ + "red" + ] + }, + { + "id": "130", + "name": "Half-Life: Blue Shift", + "description": "Made by Gearbox Software and originally released in 2001 as an add-on to Half-Life Blue Shift is a return to the Black Mesa Research Facility in which you play as Barney Calhoun the security guard sidekick who helped Gordon out of so many sticky situations.", + "price": "4.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/130/header.jpg?t=1447350816", + "releaseDate": "Jun 1 2001", + "recommendationCount": 2219, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Single player" + ], + "genres": [ + "Action", + "Science Fiction" + ], + "misc": [], + "color": [ + "blue" + ] + }, + { + "id": "220", + "name": "Half-Life 2", + "description": "1998. HALF-LIFE sends a shock through the game industry with its combination of pounding action and continuous immersive storytelling. Valves debut title wins more than 50 game-of-the-year awards on its way to being named Best PC Game Ever by PC Gamer and launches a franchise with more than eight million retail units sold worldwide.NOW. By taking the suspense challenge and visceral charge of the original and adding startling new realism and responsiveness Half-Life 2 opens the door to a world where the players presence affects everything around him from the physical environment to the behaviors even the emotions of both friends and enemies.The player again picks up the crowbar of research scientist Gordon Freeman who finds himself on an alien-infested Earth being picked to the bone its resources depleted its populace dwindling. Freeman is thrust into the unenviable role of rescuing the world from the wrong he unleashed back at Black Mesa. And a lot of people he cares about are counting on him.The intense real-time gameplay of Half-Life 2 is made possible only by Source® Valves new proprietary engine technology. Source provides major enhancements in:Characters: Advanced facial animation system delivers the most sophisticated in-game characters ever seen. With 40 distinct facial muscles human characters convey the full array of human emotion and respond to the player with fluidity and intelligence.Physics: From pebbles to water to 2-ton trucks respond as expected as they obey the laws of mass friction gravity and buoyancy.Graphics: Sources shader-based renderer like the one used at Pixar to create movies such as Toy Story® and Monsters Inc.® creates the most beautiful and realistic environments ever seen in a video game.AI: Neither friends nor enemies charge blindly into the fray. They can assess threats navigate tricky terrain and fashion weapons from whatever is at hand.", + "price": "9.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/220/header.jpg?t=1456860366", + "releaseDate": "Nov 16 2004", + "recommendationCount": 35792, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Single player" + ], + "genres": [ + "Adventure" + ], + "misc": [], + "color": [ + "blue" + ] + }, + { + "id": "240", + "name": "Counter-Strike: Source", + "description": "THE NEXT INSTALLMENT OF THE WORLDS # 1 ONLINE ACTION GAME Counter-Strike: Source blends Counter-Strikes award-winning teamplay action with the advanced technology of Source™ technology. Featuring state of the art graphics all new sounds and introducing physics Counter-Strike: Source is a must-have for every action gamer.", + "price": "19.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/240/header.jpg?t=1448314295", + "releaseDate": "Nov 1 2004", + "recommendationCount": 53931, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Action", + "Adventure" + ], + "misc": [], + "color": [ + "blue" + ] + }, + { + "id": "280", + "name": "Half-Life: Source", + "description": "Winner of over 50 Game of the Year awards Half-Life set new standards for action games when it was released in 1998. Half-Life: Source is a digitally remastered version of the critically acclaimed and best selling PC game enhanced via Source technology to include physics simulation enhanced effects and more.", + "price": "9.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/280/header.jpg?t=1447350819", + "releaseDate": "Jun 1 2004", + "recommendationCount": 2547, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Single player" + ], + "genres": [ + "Drama" + ], + "misc": [], + "color": [ + "red" + ] + }, + { + "id": "300", + "name": "Day of Defeat: Source", + "description": "Day of Defeat offers intense online action gameplay set in Europe during WWII. Assume the role of infantry sniper or machine-gunner classes and more. DoD:S features enhanced graphics and sounds design to leverage the power of Source Valves new engine technology.", + "price": "9.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/300/header.jpg?t=1447350820", + "releaseDate": "Jul 12 2010", + "recommendationCount": 7185, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Adventure", + "Romance" + ], + "misc": [], + "color": [ + "yellow" + ] + }, + { + "id": "320", + "name": "Half-Life 2: Deathmatch", + "description": "Fast multiplayer action set in the Half-Life 2 universe! HL2s physics adds a new dimension to deathmatch play. Play straight deathmatch or try Combine vs. Resistance teamplay. Toss a toilet at your friend today!", + "price": "4.99 $", + "image": "http://steam.meilisearch.dev/steam/apps/320/header.jpg?t=1447350821", + "releaseDate": "Nov 1 2004", + "recommendationCount": 4328, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Multiplayer" + ], + "genres": [ + "Fantasy", + "Drama" + ], + "misc": [], + "color": [ + "red" + ] + }, + { + "id": "340", + "name": "Half-Life 2: Lost Coast", + "description": "Originally planned as a section of the Highway 17 chapter of Half-Life 2 Lost Coast is a playable technology showcase that introduces High Dynamic Range lighting to the Source engine.", + "price": "-", + "image": "http://steam.meilisearch.dev/steam/apps/340/header.jpg?t=1447350821", + "releaseDate": "Oct 27 2005", + "recommendationCount": 4352, + "platforms": [ + "MacOS", + "Linux", + "Windows" + ], + "players": [ + "Single player" + ], + "genres": [ + "Science Fiction" + ], + "misc": [], + "color": [ + "red" + ] + } +] diff --git a/tests/assets/movies.json b/tests/assets/movies.json new file mode 100644 index 00000000..aae02a49 --- /dev/null +++ b/tests/assets/movies.json @@ -0,0 +1,90 @@ +[ + { + "id": 1, + "title": "Carol", + "genres": [ + "Romance", + "Drama" + ], + "color": [ + "red" + ], + "platforms": [ + "MacOS", + "Linux", + "Windows" + ] + }, + { + "id": 2, + "title": "Wonder Woman", + "genres": [ + "Action", + "Adventure" + ], + "color": [ + "green" + ], + "platforms": [ + "MacOS" + ] + }, + { + "id": 3, + "title": "Life of Pi", + "genres": [ + "Adventure", + "Drama" + ], + "color": [ + "blue" + ], + "platforms": [ + "Windows" + ] + }, + { + "id": 4, + "title": "Mad Max: Fury Road", + "genres": [ + "Adventure", + "Science Fiction" + ], + "color": [ + "red" + ], + "platforms": [ + "MacOS", + "Linux" + ] + }, + { + "id": 5, + "title": "Moana", + "genres": [ + "Fantasy", + "Action" + ], + "color": [ + "red" + ], + "platforms": [ + "Windows" + ] + }, + { + "id": 6, + "title": "Philadelphia", + "genres": [ + "Drama" + ], + "color": [ + "blue" + ], + "platforms": [ + "MacOS", + "Linux", + "Windows" + ] + } +] diff --git a/tests/env/react/.babelrc b/tests/env/react/.babelrc index f8ff4351..f45ffb89 100644 --- a/tests/env/react/.babelrc +++ b/tests/env/react/.babelrc @@ -1,4 +1,4 @@ { "presets": ["@babel/preset-react"], - "plugins": ["@babel/plugin-syntax-jsx"] + "plugins": ["@babel/plugin-syntax-jsx", "@babel/plugin-transform-runtime"] } diff --git a/tests/env/react/package.json b/tests/env/react/package.json index 244bed7b..edae31ff 100644 --- a/tests/env/react/package.json +++ b/tests/env/react/package.json @@ -24,12 +24,14 @@ "instantsearch.css": "^7.4.5", "react": "^17.0.1", "react-dom": "^17.0.1", - "react-instantsearch-dom": "^6.12.1" + "react-instantsearch-dom": "^6.12.1", + "react-router-dom": "^6.4.3" }, "devDependencies": { - "@babel/core": "^7.13.1", - "@babel/plugin-syntax-jsx": "^7.12.13", - "@babel/preset-react": "^7.12.13", + "@babel/core": "^7.20.5", + "@babel/plugin-syntax-jsx": "^7.18.6", + "@babel/plugin-transform-runtime": "^7.19.6", + "@babel/preset-react": "^7.18.6", "parcel-bundler": "^1.12.4" } } diff --git a/tests/env/react/setup.js b/tests/env/react/setup.js index ff349371..46c66946 100644 --- a/tests/env/react/setup.js +++ b/tests/env/react/setup.js @@ -1,4 +1,6 @@ const { MeiliSearch } = require('meilisearch') +const movies = require('../../assets/movies.json') +const games = require('../../assets/games.json') ;(async () => { const client = new MeiliSearch({ @@ -6,244 +8,26 @@ const { MeiliSearch } = require('meilisearch') apiKey: 'masterKey', }) - const index = client.index('steam-video-games') + const moviesIndex = client.index('movies') + const gamesIndex = client.index('games') - const dataset = [ - { - id: '10', - name: 'Counter-Strike', - description: - 'Play the worlds number 1 online action game. Engage in an incredibly realistic brand of terrorist warfare in this wildly popular team-based game. Ally with teammates to complete strategic missions. Take out enemy sites. Rescue hostages. Your role affects your teams success. Your teams success affects your role.', - price: '9.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/10/header.jpg?t=1447887426', - releaseDate: 'Nov 1 2000', - recommendationCount: 68991, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '20', - name: 'Team Fortress Classic', - description: - 'One of the most popular online action games of all time Team Fortress Classic features over nine character classes -- from Medic to Spy to Demolition Man -- enlisted in a unique style of online team warfare. Each character class possesses unique weapons items and abilities as teams compete online in a variety of game play modes.', - price: '4.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/20/header.jpg?t=1447350811', - releaseDate: 'Apr 1 1999', - recommendationCount: 2439, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '30', - name: 'Day of Defeat', - description: - 'Enlist in an intense brand of Axis vs. Allied teamplay set in the WWII European Theatre of Operations. Players assume the role of light/assault/heavy infantry sniper or machine-gunner class each with a unique arsenal of historical weaponry at their disposal. Missions are based on key historical operations. And as war rages players must work together with their squad to accomplish a variety of mission-specific objectives.', - price: '4.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/30/header.jpg?t=1447350812', - releaseDate: 'May 1 2003', - recommendationCount: 2319, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '40', - name: 'Deathmatch Classic', - description: - 'Enjoy fast-paced multiplayer gaming with Deathmatch Classic (a.k.a. DMC). Valves tribute to the work of id software DMC invites players to grab their rocket launchers and put their reflexes to the test in a collection of futuristic settings.', - price: '4.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/40/header.jpg?t=1447350812', - releaseDate: 'Jun 1 2001', - recommendationCount: 888, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '50', - name: 'Half-Life: Opposing Force', - description: - 'Return to the Black Mesa Research Facility as one of the military specialists assigned to eliminate Gordon Freeman. Experience an entirely new episode of single player action. Meet fierce alien opponents and experiment with new weaponry. Named Game of the Year by the Academy of Interactive Arts and Sciences.', - price: '4.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/50/header.jpg?t=1447350813', - releaseDate: 'Nov 1 1999', - recommendationCount: 2934, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Single player', 'Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '60', - name: 'Ricochet', - description: - 'A futuristic action game that challenges your agility as well as your aim Ricochet features one-on-one and team matches played in a variety of futuristic battle arenas.', - price: '4.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/60/header.jpg?t=1453942008', - releaseDate: 'Nov 1 2000', - recommendationCount: 1965, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '70', - name: 'Half-Life', - description: - 'Named Game of the Year by over 50 publications Valves debut title blends action and adventure with award-winning technology to create a frighteningly realistic world where players must think to survive. Also includes an exciting multiplayer mode that allows you to play against friends and enemies around the world.', - price: '9.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/70/header.jpg?t=1447890508', - releaseDate: 'Nov 8 1998', - recommendationCount: 12486, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Single player', 'Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '80', - name: 'Counter-Strike: Condition Zero', - description: - 'With its extensive Tour of Duty campaign a near-limitless number of skirmish modes updates and new content for Counter-Strikes award-winning multiplayer game play plus over 12 bonus single player missions Counter-Strike: Condition Zero is a tremendous offering of single and multiplayer content.', - price: '9.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/80/header.jpg?t=1447889920', - releaseDate: 'Mar 1 2004', - recommendationCount: 7067, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Single player', 'Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '130', - name: 'Half-Life: Blue Shift', - description: - 'Made by Gearbox Software and originally released in 2001 as an add-on to Half-Life Blue Shift is a return to the Black Mesa Research Facility in which you play as Barney Calhoun the security guard sidekick who helped Gordon out of so many sticky situations.', - price: '4.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/130/header.jpg?t=1447350816', - releaseDate: 'Jun 1 2001', - recommendationCount: 2219, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Single player'], - genres: ['Action'], - misc: [], - }, - { - id: '220', - name: 'Half-Life 2', - description: - '1998. HALF-LIFE sends a shock through the game industry with its combination of pounding action and continuous immersive storytelling. Valves debut title wins more than 50 game-of-the-year awards on its way to being named Best PC Game Ever by PC Gamer and launches a franchise with more than eight million retail units sold worldwide.NOW. By taking the suspense challenge and visceral charge of the original and adding startling new realism and responsiveness Half-Life 2 opens the door to a world where the players presence affects everything around him from the physical environment to the behaviors even the emotions of both friends and enemies.The player again picks up the crowbar of research scientist Gordon Freeman who finds himself on an alien-infested Earth being picked to the bone its resources depleted its populace dwindling. Freeman is thrust into the unenviable role of rescuing the world from the wrong he unleashed back at Black Mesa. And a lot of people he cares about are counting on him.The intense real-time gameplay of Half-Life 2 is made possible only by Source® Valves new proprietary engine technology. Source provides major enhancements in:Characters: Advanced facial animation system delivers the most sophisticated in-game characters ever seen. With 40 distinct facial muscles human characters convey the full array of human emotion and respond to the player with fluidity and intelligence.Physics: From pebbles to water to 2-ton trucks respond as expected as they obey the laws of mass friction gravity and buoyancy.Graphics: Sources shader-based renderer like the one used at Pixar to create movies such as Toy Story® and Monsters Inc.® creates the most beautiful and realistic environments ever seen in a video game.AI: Neither friends nor enemies charge blindly into the fray. They can assess threats navigate tricky terrain and fashion weapons from whatever is at hand.', - price: '9.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/220/header.jpg?t=1456860366', - releaseDate: 'Nov 16 2004', - recommendationCount: 35792, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Single player'], - genres: ['Action'], - misc: [], - }, - { - id: '240', - name: 'Counter-Strike: Source', - description: - 'THE NEXT INSTALLMENT OF THE WORLDS # 1 ONLINE ACTION GAME Counter-Strike: Source blends Counter-Strikes award-winning teamplay action with the advanced technology of Source™ technology. Featuring state of the art graphics all new sounds and introducing physics Counter-Strike: Source is a must-have for every action gamer.', - price: '19.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/240/header.jpg?t=1448314295', - releaseDate: 'Nov 1 2004', - recommendationCount: 53931, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '280', - name: 'Half-Life: Source', - description: - 'Winner of over 50 Game of the Year awards Half-Life set new standards for action games when it was released in 1998. Half-Life: Source is a digitally remastered version of the critically acclaimed and best selling PC game enhanced via Source technology to include physics simulation enhanced effects and more.', - price: '9.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/280/header.jpg?t=1447350819', - releaseDate: 'Jun 1 2004', - recommendationCount: 2547, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Single player'], - genres: ['Action'], - misc: [], - }, - { - id: '300', - name: 'Day of Defeat: Source', - description: - 'Day of Defeat offers intense online action gameplay set in Europe during WWII. Assume the role of infantry sniper or machine-gunner classes and more. DoD:S features enhanced graphics and sounds design to leverage the power of Source Valves new engine technology.', - price: '9.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/300/header.jpg?t=1447350820', - releaseDate: 'Jul 12 2010', - recommendationCount: 7185, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '320', - name: 'Half-Life 2: Deathmatch', - description: - 'Fast multiplayer action set in the Half-Life 2 universe! HL2s physics adds a new dimension to deathmatch play. Play straight deathmatch or try Combine vs. Resistance teamplay. Toss a toilet at your friend today!', - price: '4.99 $', - image: - 'http://steam.meilisearch.dev/steam/apps/320/header.jpg?t=1447350821', - releaseDate: 'Nov 1 2004', - recommendationCount: 4328, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Multiplayer'], - genres: ['Action'], - misc: [], - }, - { - id: '340', - name: 'Half-Life 2: Lost Coast', - description: - 'Originally planned as a section of the Highway 17 chapter of Half-Life 2 Lost Coast is a playable technology showcase that introduces High Dynamic Range lighting to the Source engine.', - price: '-', - image: - 'http://steam.meilisearch.dev/steam/apps/340/header.jpg?t=1447350821', - releaseDate: 'Oct 27 2005', - recommendationCount: 4352, - platforms: ['MacOS', 'Linux', 'Windows'], - players: ['Single player'], - genres: ['Action'], - misc: [], - }, - ] + await moviesIndex.delete() + await gamesIndex.delete() - await index.updateSettings({ + await moviesIndex.updateSettings({ + filterableAttributes: ['genres', 'color', 'platforms'], + }) + await gamesIndex.updateSettings({ + filterableAttributes: ['genres', 'color', 'platforms', 'misc', 'players'], searchableAttributes: ['name', 'description'], - filterableAttributes: ['platforms', 'players', 'genres', 'misc'], sortableAttributes: ['recommendationCount'], }) - const response = await index.addDocuments(dataset) + const moviesRes = await moviesIndex.addDocuments(movies) + const gamesRes = await gamesIndex.addDocuments(games) - const task = await client.waitForTask(response.taskUid) - console.log(task) + const moviesTask = await client.waitForTask(moviesRes.taskUid) + const gamesTask = await client.waitForTask(gamesRes.taskUid) + console.log(moviesTask) + console.log(gamesTask) })() diff --git a/tests/env/react/src/App.js b/tests/env/react/src/App.js index 295beb62..cef98d01 100644 --- a/tests/env/react/src/App.js +++ b/tests/env/react/src/App.js @@ -1,100 +1,18 @@ -import 'instantsearch.css/themes/algolia-min.css' import React from 'react' -import { - InstantSearch, - InfiniteHits, - SearchBox, - Stats, - Highlight, - ClearRefinements, - RefinementList, - Configure, - SortBy, - Snippet, -} from 'react-instantsearch-dom' +import { Routes, Route, Outlet } from 'react-router-dom' +import SingleIndex from './components/SingleIndex' +import MultiIndex from './components/MultiIndex' import './App.css' -import { instantMeiliSearch } from '../../../../src/index' -const searchClient = instantMeiliSearch('http://localhost:7700', 'masterKey', { - primaryKey: 'id', -}) - -const App = () => ( -
-

Meilisearch + React InstantSearch

-

- Search in Steam video games{' '} - - 🎮 - -

-

- This is not the official Steam dataset but only for demo purpose. Enjoy - searching with Meilisearch! -

- - -
- - -

Genres

- -

Players

- -

Platforms

- -

Misc

- - -
-
- - -
-
-
-) - -const Hit = ({ hit }) => { +const App = () => { return ( -
-
- -
-
- -
- {hit.name} -
- -
-
- price: {hit.price} -
-
- release date: {hit.releaseDate} -
-
- Recommended: {hit.recommendationCount} -
+
+ + } /> + } /> + +
) } diff --git a/tests/env/react/src/components/MultiIndex.js b/tests/env/react/src/components/MultiIndex.js new file mode 100644 index 00000000..5da3b349 --- /dev/null +++ b/tests/env/react/src/components/MultiIndex.js @@ -0,0 +1,74 @@ +import 'instantsearch.css/themes/algolia-min.css' +import React from 'react' +import { + InstantSearch, + SearchBox, + Highlight, + RefinementList, + Index, + Hits, + Pagination, +} from 'react-instantsearch-dom' +import { instantMeiliSearch } from '../../../../../src/index' + +const searchClient = instantMeiliSearch('http://localhost:7700', 'masterKey', { + primaryKey: 'id', + finitePagination: true, +}) + +const Hit = ({ hit }) => { + return ( +
+
+ +
+
+ +
+
+ ) +} + +const MultiIndex = () => ( +
+ + +

Movies

+ +
+
+

Genres

+ +

Color

+ +

Platforms

+ +
+
+ +
+ +
+
+

Games

+ +
+
+

Genres

+ +

Color

+ +

Platforms

+ +
+
+ +
+ +
+
+
+
+) + +export default MultiIndex diff --git a/tests/env/react/src/components/SingleIndex.js b/tests/env/react/src/components/SingleIndex.js new file mode 100644 index 00000000..cc5b9dc6 --- /dev/null +++ b/tests/env/react/src/components/SingleIndex.js @@ -0,0 +1,100 @@ +import 'instantsearch.css/themes/algolia-min.css' +import React from 'react' +import { + InstantSearch, + InfiniteHits, + SearchBox, + Stats, + Highlight, + ClearRefinements, + RefinementList, + Configure, + SortBy, + Snippet, +} from 'react-instantsearch-dom' +import { instantMeiliSearch } from '../../../../../src/index' + +const searchClient = instantMeiliSearch('http://localhost:7700', 'masterKey', { + primaryKey: 'id', +}) + +const SingleIndex = () => ( +
+

Meilisearch + React InstantSearch

+

+ Search in Steam video games{' '} + + 🎮 + +

+

+ This is not the official Steam dataset but only for demo purpose. Enjoy + searching with Meilisearch! +

+ + +
+ + +

Genres

+ +

Players

+ +

Platforms

+ +

Misc

+ + +
+
+ + +
+
+
+) + +const Hit = ({ hit }) => { + return ( +
+
+ +
+
+ +
+ {hit.name} +
+ +
+
+ price: {hit.price} +
+
+ release date: {hit.releaseDate} +
+
+ Recommended: {hit.recommendationCount} +
+
+ ) +} + +export default SingleIndex diff --git a/tests/env/react/src/index.js b/tests/env/react/src/index.js index 97ffa576..8fb1e050 100644 --- a/tests/env/react/src/index.js +++ b/tests/env/react/src/index.js @@ -1,11 +1,15 @@ +import 'regenerator-runtime' +import './index.css' import React from 'react' import ReactDOM from 'react-dom' -import './index.css' import App from './App' +import { BrowserRouter } from 'react-router-dom' ReactDOM.render( - + + + , document.getElementById('app') ) diff --git a/tests/env/react/yarn.lock b/tests/env/react/yarn.lock index 4c7768e2..f651229b 100644 --- a/tests/env/react/yarn.lock +++ b/tests/env/react/yarn.lock @@ -2,6 +2,14 @@ # yarn lockfile v1 +"@ampproject/remapping@^2.1.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" + integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== + dependencies: + "@jridgewell/gen-mapping" "^0.1.0" + "@jridgewell/trace-mapping" "^0.3.9" + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" @@ -9,12 +17,45 @@ dependencies: "@babel/highlight" "^7.12.13" +"@babel/code-frame@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== + dependencies: + "@babel/highlight" "^7.18.6" + "@babel/compat-data@^7.13.0", "@babel/compat-data@^7.13.5": version "7.13.6" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.13.6.tgz#11972d07db4c2317afdbf41d6feb3a730301ef4e" integrity sha512-VhgqKOWYVm7lQXlvbJnWOzwfAQATd2nV52koT0HZ/LdDH0m4DUDwkKYsH+IwpXb+bKPyBJzawA4I6nBKqZcpQw== -"@babel/core@^7.13.1", "@babel/core@^7.4.4": +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.0": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.5.tgz#86f172690b093373a933223b4745deeb6049e733" + integrity sha512-KZXo2t10+/jxmkhNXc7pZTqRvSOIvVv/+lJwHS+B2rErwOyjuVRh60yVpb7liQ1U5t7lLJ1bz+t8tSypUZdm0g== + +"@babel/core@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.5.tgz#45e2114dc6cd4ab167f81daf7820e8fa1250d113" + integrity sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.20.5" + "@babel/helper-compilation-targets" "^7.20.0" + "@babel/helper-module-transforms" "^7.20.2" + "@babel/helpers" "^7.20.5" + "@babel/parser" "^7.20.5" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.5" + "@babel/types" "^7.20.5" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + +"@babel/core@^7.4.4": version "7.13.1" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.13.1.tgz#7ddd027176debe40f13bb88bac0c21218c5b1ecf" integrity sha512-FzeKfFBG2rmFtGiiMdXZPFt/5R5DXubVi82uYhjGX4Msf+pgYQMCFIqFXZWs5vbIYbf14VeBIgdGI03CDOOM1w== @@ -45,13 +86,29 @@ jsesc "^2.5.1" source-map "^0.5.0" -"@babel/helper-annotate-as-pure@^7.10.4", "@babel/helper-annotate-as-pure@^7.12.13": +"@babel/generator@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.5.tgz#cb25abee3178adf58d6814b68517c62bdbfdda95" + integrity sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA== + dependencies: + "@babel/types" "^7.20.5" + "@jridgewell/gen-mapping" "^0.3.2" + jsesc "^2.5.1" + +"@babel/helper-annotate-as-pure@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz#0f58e86dfc4bb3b1fcd7db806570e177d439b6ab" integrity sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw== dependencies: "@babel/types" "^7.12.13" +"@babel/helper-annotate-as-pure@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" + integrity sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA== + dependencies: + "@babel/types" "^7.18.6" + "@babel/helper-builder-binary-assignment-operator-visitor@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.12.13.tgz#6bc20361c88b0a74d05137a65cac8d3cbf6f61fc" @@ -70,6 +127,16 @@ browserslist "^4.14.5" semver "7.0.0" +"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.20.0": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz#6bf5374d424e1b3922822f1d9bdaa43b1a139d0a" + integrity sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ== + dependencies: + "@babel/compat-data" "^7.20.0" + "@babel/helper-validator-option" "^7.18.6" + browserslist "^4.21.3" + semver "^6.3.0" + "@babel/helper-create-class-features-plugin@^7.13.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.13.0.tgz#28d04ad9cfbd1ed1d8b988c9ea7b945263365846" @@ -103,6 +170,23 @@ resolve "^1.14.2" semver "^6.1.2" +"@babel/helper-define-polyfill-provider@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz#8612e55be5d51f0cd1f36b4a5a83924e89884b7a" + integrity sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww== + dependencies: + "@babel/helper-compilation-targets" "^7.17.7" + "@babel/helper-plugin-utils" "^7.16.7" + debug "^4.1.1" + lodash.debounce "^4.0.8" + resolve "^1.14.2" + semver "^6.1.2" + +"@babel/helper-environment-visitor@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" + integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== + "@babel/helper-explode-assignable-expression@^7.12.13": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.13.0.tgz#17b5c59ff473d9f956f40ef570cf3a76ca12657f" @@ -119,6 +203,14 @@ "@babel/template" "^7.12.13" "@babel/types" "^7.12.13" +"@babel/helper-function-name@^7.19.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" + integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== + dependencies: + "@babel/template" "^7.18.10" + "@babel/types" "^7.19.0" + "@babel/helper-get-function-arity@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz#bc63451d403a3b3082b97e1d8b3fe5bd4091e583" @@ -134,6 +226,13 @@ "@babel/traverse" "^7.13.0" "@babel/types" "^7.13.0" +"@babel/helper-hoist-variables@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" + integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== + dependencies: + "@babel/types" "^7.18.6" + "@babel/helper-member-expression-to-functions@^7.13.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.0.tgz#6aa4bb678e0f8c22f58cdb79451d30494461b091" @@ -148,6 +247,13 @@ dependencies: "@babel/types" "^7.12.13" +"@babel/helper-module-imports@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" + integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA== + dependencies: + "@babel/types" "^7.18.6" + "@babel/helper-module-transforms@^7.12.13", "@babel/helper-module-transforms@^7.13.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.13.0.tgz#42eb4bd8eea68bab46751212c357bfed8b40f6f1" @@ -163,6 +269,20 @@ "@babel/types" "^7.13.0" lodash "^4.17.19" +"@babel/helper-module-transforms@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz#ac53da669501edd37e658602a21ba14c08748712" + integrity sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA== + dependencies: + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-simple-access" "^7.20.2" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/helper-validator-identifier" "^7.19.1" + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.2" + "@babel/helper-optimise-call-expression@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz#5c02d171b4c8615b1e7163f888c1c81c30a2aaea" @@ -175,6 +295,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz#806526ce125aed03373bc416a828321e3a6a33af" integrity sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ== +"@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629" + integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ== + "@babel/helper-remap-async-to-generator@^7.13.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.13.0.tgz#376a760d9f7b4b2077a9dd05aa9c3927cadb2209" @@ -201,6 +326,13 @@ dependencies: "@babel/types" "^7.12.13" +"@babel/helper-simple-access@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9" + integrity sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA== + dependencies: + "@babel/types" "^7.20.2" + "@babel/helper-skip-transparent-expression-wrappers@^7.12.1": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.12.1.tgz#462dc63a7e435ade8468385c63d2b84cce4b3cbf" @@ -215,16 +347,38 @@ dependencies: "@babel/types" "^7.12.13" +"@babel/helper-split-export-declaration@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" + integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-string-parser@^7.19.4": + version "7.19.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" + integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== + "@babel/helper-validator-identifier@^7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== +"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": + version "7.19.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" + integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== + "@babel/helper-validator-option@^7.12.17": version "7.12.17" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831" integrity sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== +"@babel/helper-validator-option@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" + integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== + "@babel/helper-wrap-function@^7.13.0": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.13.0.tgz#bdb5c66fda8526ec235ab894ad53a1235c79fcc4" @@ -244,6 +398,15 @@ "@babel/traverse" "^7.13.0" "@babel/types" "^7.13.0" +"@babel/helpers@^7.20.5": + version "7.20.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.6.tgz#e64778046b70e04779dfbdf924e7ebb45992c763" + integrity sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w== + dependencies: + "@babel/template" "^7.18.10" + "@babel/traverse" "^7.20.5" + "@babel/types" "^7.20.5" + "@babel/highlight@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.12.13.tgz#8ab538393e00370b26271b01fa08f7f27f2e795c" @@ -253,11 +416,25 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/parser@^7.12.13", "@babel/parser@^7.13.0", "@babel/parser@^7.4.4": version "7.13.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.4.tgz#340211b0da94a351a6f10e63671fa727333d13ab" integrity sha512-uvoOulWHhI+0+1f9L4BoozY7U5cIkZ9PgJqvb041d6vypgUmtVPG4vmGm4pSggjl8BELzvHyUeJSUyEMY6b+qA== +"@babel/parser@^7.18.10", "@babel/parser@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.5.tgz#7f3c7335fe417665d929f34ae5dceae4c04015e8" + integrity sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA== + "@babel/plugin-proposal-async-generator-functions@^7.13.5": version "7.13.5" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.13.5.tgz#69e3fbb9958949b09036e27b26eba1aafa1ba3db" @@ -414,6 +591,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.12.13" +"@babel/plugin-syntax-jsx@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0" + integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q== + dependencies: + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/plugin-syntax-logical-assignment-operators@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" @@ -654,21 +838,21 @@ dependencies: "@babel/helper-plugin-utils" "^7.12.13" -"@babel/plugin-transform-react-display-name@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.12.13.tgz#c28effd771b276f4647411c9733dbb2d2da954bd" - integrity sha512-MprESJzI9O5VnJZrL7gg1MpdqmiFcUv41Jc7SahxYsNP2kDkFqClxxTZq+1Qv4AFCamm+GXMRDQINNn+qrxmiA== +"@babel/plugin-transform-react-display-name@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.18.6.tgz#8b1125f919ef36ebdfff061d664e266c666b9415" + integrity sha512-TV4sQ+T013n61uMoygyMRm+xf04Bd5oqFpv2jAEQwSZ8NwQA7zeRPg1LMVg2PWi3zWBz+CLKD+v5bcpZ/BS0aA== dependencies: - "@babel/helper-plugin-utils" "^7.12.13" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-react-jsx-development@^7.12.12": - version "7.12.17" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.17.tgz#f510c0fa7cd7234153539f9a362ced41a5ca1447" - integrity sha512-BPjYV86SVuOaudFhsJR1zjgxxOhJDt6JHNoD48DxWEIxUCAMjV1ys6DYw4SDYZh0b1QsS2vfIA9t/ZsQGsDOUQ== +"@babel/plugin-transform-react-jsx-development@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.18.6.tgz#dbe5c972811e49c7405b630e4d0d2e1380c0ddc5" + integrity sha512-SA6HEjwYFKF7WDjWcMcMGUimmw/nhNRDWxr+KaLSCrkD/LMDBvWRmHAYgE1HDeF8KUuI8OAu+RT6EOtKxSW2qA== dependencies: - "@babel/plugin-transform-react-jsx" "^7.12.17" + "@babel/plugin-transform-react-jsx" "^7.18.6" -"@babel/plugin-transform-react-jsx@^7.0.0", "@babel/plugin-transform-react-jsx@^7.12.13", "@babel/plugin-transform-react-jsx@^7.12.17": +"@babel/plugin-transform-react-jsx@^7.0.0": version "7.12.17" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.17.tgz#dd2c1299f5e26de584939892de3cfc1807a38f24" integrity sha512-mwaVNcXV+l6qJOuRhpdTEj8sT/Z0owAVWf9QujTZ0d2ye9X/K+MTOTSizcgKOj18PGnTc/7g1I4+cIUjsKhBcw== @@ -679,13 +863,24 @@ "@babel/plugin-syntax-jsx" "^7.12.13" "@babel/types" "^7.12.17" -"@babel/plugin-transform-react-pure-annotations@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.12.1.tgz#05d46f0ab4d1339ac59adf20a1462c91b37a1a42" - integrity sha512-RqeaHiwZtphSIUZ5I85PEH19LOSzxfuEazoY7/pWASCAIBuATQzpSVD+eT6MebeeZT2F4eSL0u4vw6n4Nm0Mjg== +"@babel/plugin-transform-react-jsx@^7.18.6": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.19.0.tgz#b3cbb7c3a00b92ec8ae1027910e331ba5c500eb9" + integrity sha512-UVEvX3tXie3Szm3emi1+G63jyw1w5IcMY0FSKM+CRnKRI5Mr1YbCNgsSTwoTwKphQEG9P+QqmuRFneJPZuHNhg== dependencies: - "@babel/helper-annotate-as-pure" "^7.10.4" - "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-plugin-utils" "^7.19.0" + "@babel/plugin-syntax-jsx" "^7.18.6" + "@babel/types" "^7.19.0" + +"@babel/plugin-transform-react-pure-annotations@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.18.6.tgz#561af267f19f3e5d59291f9950fd7b9663d0d844" + integrity sha512-I8VfEPg9r2TRDdvnHgPepTKvuRomzA8+u+nhY7qSI1fR2hRNebasZEETLyM5mAUr0Ku56OkXJ0I7NHJnO6cJiQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-regenerator@^7.12.13": version "7.12.13" @@ -701,6 +896,18 @@ dependencies: "@babel/helper-plugin-utils" "^7.12.13" +"@babel/plugin-transform-runtime@^7.19.6": + version "7.19.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.19.6.tgz#9d2a9dbf4e12644d6f46e5e75bfbf02b5d6e9194" + integrity sha512-PRH37lz4JU156lYFW1p8OxE5i7d6Sl/zV58ooyr+q1J1lnQPyg5tIiXlIwNVhJaY4W3TmOtdc8jqdXQcB1v5Yw== + dependencies: + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-plugin-utils" "^7.19.0" + babel-plugin-polyfill-corejs2 "^0.3.3" + babel-plugin-polyfill-corejs3 "^0.6.0" + babel-plugin-polyfill-regenerator "^0.4.1" + semver "^6.3.0" + "@babel/plugin-transform-shorthand-properties@^7.12.13": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.13.tgz#db755732b70c539d504c6390d9ce90fe64aff7ad" @@ -837,16 +1044,17 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-react@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.12.13.tgz#5f911b2eb24277fa686820d5bd81cad9a0602a0a" - integrity sha512-TYM0V9z6Abb6dj1K7i5NrEhA13oS5ujUYQYDfqIBXYHOc2c2VkFgc+q9kyssIyUfy4/hEwqrgSlJ/Qgv8zJLsA== +"@babel/preset-react@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.18.6.tgz#979f76d6277048dc19094c217b507f3ad517dd2d" + integrity sha512-zXr6atUmyYdiWRVLOZahakYmOBHtWc2WGCkP8PYTgZi0iJXDY2CN180TdrIW4OGOAdLc7TifzDIvtx6izaRIzg== dependencies: - "@babel/helper-plugin-utils" "^7.12.13" - "@babel/plugin-transform-react-display-name" "^7.12.13" - "@babel/plugin-transform-react-jsx" "^7.12.13" - "@babel/plugin-transform-react-jsx-development" "^7.12.12" - "@babel/plugin-transform-react-pure-annotations" "^7.12.1" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-validator-option" "^7.18.6" + "@babel/plugin-transform-react-display-name" "^7.18.6" + "@babel/plugin-transform-react-jsx" "^7.18.6" + "@babel/plugin-transform-react-jsx-development" "^7.18.6" + "@babel/plugin-transform-react-pure-annotations" "^7.18.6" "@babel/runtime@^7.1.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.8.4": version "7.13.6" @@ -864,6 +1072,15 @@ "@babel/parser" "^7.12.13" "@babel/types" "^7.12.13" +"@babel/template@^7.18.10": + version "7.18.10" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" + integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/parser" "^7.18.10" + "@babel/types" "^7.18.10" + "@babel/traverse@^7.13.0", "@babel/traverse@^7.4.4": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.13.0.tgz#6d95752475f86ee7ded06536de309a65fc8966cc" @@ -879,6 +1096,22 @@ globals "^11.1.0" lodash "^4.17.19" +"@babel/traverse@^7.20.1", "@babel/traverse@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.5.tgz#78eb244bea8270fdda1ef9af22a5d5e5b7e57133" + integrity sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.20.5" + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-function-name" "^7.19.0" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.20.5" + "@babel/types" "^7.20.5" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.12.1", "@babel/types@^7.12.13", "@babel/types@^7.12.17", "@babel/types@^7.13.0", "@babel/types@^7.4.4": version "7.13.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80" @@ -888,11 +1121,60 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" +"@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.5.tgz#e206ae370b5393d94dfd1d04cd687cace53efa84" + integrity sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg== + dependencies: + "@babel/helper-string-parser" "^7.19.4" + "@babel/helper-validator-identifier" "^7.19.1" + to-fast-properties "^2.0.0" + "@iarna/toml@^2.2.0": version "2.2.5" resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== +"@jridgewell/gen-mapping@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" + integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== + dependencies: + "@jridgewell/set-array" "^1.0.0" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/gen-mapping@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" + integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + +"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/trace-mapping@^0.3.9": + version "0.3.17" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" + integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" @@ -947,6 +1229,11 @@ "@parcel/utils" "^1.11.0" physical-cpu-count "^2.0.0" +"@remix-run/router@1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.0.3.tgz#953b88c20ea00d0eddaffdc1b115c08474aa295d" + integrity sha512-ceuyTSs7PZ/tQqi19YZNBc5X7kj1f8p+4DIyrcIYFY9h+hd1OKm4RqtiWldR9eGEvIiJfsqwM4BsuCtRIuEw6Q== + "@types/q@^1.5.1": version "1.5.4" resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.4.tgz#15925414e0ad2cd765bfef58842f7e26a7accb24" @@ -1152,6 +1439,15 @@ babel-plugin-polyfill-corejs2@^0.1.4: "@babel/helper-define-polyfill-provider" "^0.1.2" semver "^6.1.1" +babel-plugin-polyfill-corejs2@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz#5d1bd3836d0a19e1b84bbf2d9640ccb6f951c122" + integrity sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q== + dependencies: + "@babel/compat-data" "^7.17.7" + "@babel/helper-define-polyfill-provider" "^0.3.3" + semver "^6.1.1" + babel-plugin-polyfill-corejs3@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.1.4.tgz#2ae290200e953bade30907b7a3bebcb696e6c59d" @@ -1160,6 +1456,14 @@ babel-plugin-polyfill-corejs3@^0.1.3: "@babel/helper-define-polyfill-provider" "^0.1.2" core-js-compat "^3.8.1" +babel-plugin-polyfill-corejs3@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz#56ad88237137eade485a71b52f72dbed57c6230a" + integrity sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.3.3" + core-js-compat "^3.25.1" + babel-plugin-polyfill-regenerator@^0.1.2: version "0.1.3" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.1.3.tgz#350f857225fc640ae1ec78d1536afcbb457db841" @@ -1167,6 +1471,13 @@ babel-plugin-polyfill-regenerator@^0.1.2: dependencies: "@babel/helper-define-polyfill-provider" "^0.1.2" +babel-plugin-polyfill-regenerator@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz#390f91c38d90473592ed43351e801a9d3e0fd747" + integrity sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.3.3" + babel-runtime@^6.11.6, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -1367,6 +1678,16 @@ browserslist@^4.0.0, browserslist@^4.1.0, browserslist@^4.14.5, browserslist@^4. escalade "^3.1.1" node-releases "^1.1.71" +browserslist@^4.21.3, browserslist@^4.21.4: + version "4.21.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" + integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== + dependencies: + caniuse-lite "^1.0.30001400" + electron-to-chromium "^1.4.251" + node-releases "^2.0.6" + update-browserslist-db "^1.0.9" + buffer-equal@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/buffer-equal/-/buffer-equal-0.0.1.tgz#91bc74b11ea405bc916bc6aa908faafa5b4aac4b" @@ -1453,10 +1774,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001219: - version "1.0.30001251" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz" - integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001400: + version "1.0.30001434" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001434.tgz#ec1ec1cfb0a93a34a0600d37903853030520a4e5" + integrity sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA== caseless@~0.12.0: version "0.12.0" @@ -1666,6 +1987,13 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +core-js-compat@^3.25.1: + version "3.26.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.26.1.tgz#0e710b09ebf689d719545ac36e49041850f943df" + integrity sha512-622/KzTudvXCDLRw70iHW4KKs1aGpcRcowGWyYJr2DEBfRrd6hNJybxSWJFuZYD4ma86xhrwDDHxmDaIq4EA8A== + dependencies: + browserslist "^4.21.4" + core-js-compat@^3.8.1, core-js-compat@^3.9.0: version "3.9.0" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.9.0.tgz#29da39385f16b71e1915565aa0385c4e0963ad56" @@ -2117,6 +2445,11 @@ electron-to-chromium@^1.3.723: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.740.tgz#e38b7d2b848f632191b643e6dabca51be2162922" integrity sha512-Mi2m55JrX2BFbNZGKYR+2ItcGnR4O5HhrvgoRRyZQlaMGQULqDhoGkLWHzJoshSzi7k1PUofxcDbNhlFrDZNhg== +electron-to-chromium@^1.4.251: + version "1.4.284" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" + integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA== + elliptic@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" @@ -3121,6 +3454,11 @@ json5@^2.1.2: dependencies: minimist "^1.2.5" +json5@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" + integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== + jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -3429,6 +3767,11 @@ node-releases@^1.1.71: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.72.tgz#14802ab6b1039a79a0c7d662b610a5bbd76eacbe" integrity sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw== +node-releases@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" + integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== + normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -3747,6 +4090,11 @@ physical-cpu-count@^2.0.0: resolved "https://registry.yarnpkg.com/physical-cpu-count/-/physical-cpu-count-2.0.0.tgz#18de2f97e4bf7a9551ad7511942b5496f7aba660" integrity sha1-GN4vl+S/epVRrXURlCtUlverpmA= +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" @@ -4300,6 +4648,21 @@ react-is@^16.8.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== +react-router-dom@^6.4.3: + version "6.4.3" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.4.3.tgz#70093b5f65f85f1df9e5d4182eb7ff3a08299275" + integrity sha512-MiaYQU8CwVCaOfJdYvt84KQNjT78VF0TJrA17SIQgNHRvLnXDJO6qsFqq8F/zzB1BWZjCFIrQpu4QxcshitziQ== + dependencies: + "@remix-run/router" "1.0.3" + react-router "6.4.3" + +react-router@6.4.3: + version "6.4.3" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.4.3.tgz#9ed3ee4d6e95889e9b075a5d63e29acc7def0d49" + integrity sha512-BT6DoGn6aV1FVP5yfODMOiieakp3z46P1Fk0RNzJMACzE7C339sFuHebfvWtnB4pzBvXXkHP2vscJzWRuUjTtA== + dependencies: + "@remix-run/router" "1.0.3" + react@^17.0.1: version "17.0.1" resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127" @@ -4570,7 +4933,7 @@ semver@^5.4.1, semver@^5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.1.1, semver@^6.1.2: +semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -5150,6 +5513,14 @@ upath@^1.1.1: resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== +update-browserslist-db@^1.0.9: + version "1.0.10" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3" + integrity sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" diff --git a/tests/multi-index-search.tests.ts b/tests/multi-index-search.tests.ts new file mode 100644 index 00000000..2b0533f4 --- /dev/null +++ b/tests/multi-index-search.tests.ts @@ -0,0 +1,270 @@ +import { instantMeiliSearch } from '../src' +import { Movies, meilisearchClient } from './assets/utils' +import movies from './assets/movies.json' +import games from './assets/games.json' + +describe('Multi-index search test', () => { + beforeAll(async () => { + const moviesIndex = meilisearchClient.index('movies') + const gamesIndex = meilisearchClient.index('games') + + await moviesIndex.delete() + await gamesIndex.delete() + + await moviesIndex.updateSettings({ + filterableAttributes: ['genres', 'color', 'platforms'], + }) + await gamesIndex.updateSettings({ + filterableAttributes: ['genres', 'color', 'platforms'], + }) + + await moviesIndex.addDocuments(movies) + const response = await gamesIndex.addDocuments(games) + + await meilisearchClient.waitForTask(response.taskUid) + }) + + test('searching on two indexes', async () => { + const customClient = instantMeiliSearch( + 'http://localhost:7700', + 'masterKey' + ) + + const response = await customClient.search([ + { + indexName: 'movies', + params: { + query: 'c', + }, + }, + { + indexName: 'games', + params: { + query: 'c', + }, + }, + ]) + + const movieHits = response.results[0].hits + const gameHits = response.results[1].hits + + expect(movieHits.length).toBe(1) + expect(gameHits.length).toBe(14) + }) + + test('searching on two indexes with scroll pagination', async () => { + const customClient = instantMeiliSearch( + 'http://localhost:7700', + 'masterKey' + ) + + const response = await customClient.search([ + { + indexName: 'movies', + params: { + hitsPerPage: 1, + page: 1, + }, + }, + { + indexName: 'games', + params: { + hitsPerPage: 1, + page: 1, + }, + }, + ]) + + const movies = response.results[0] + const games = response.results[1] + + expect(movies.hits.length).toBe(1) + expect(movies.page).toBe(1) + expect(movies.nbPages).toBe(3) + + expect(games.hits.length).toBe(1) + expect(games.page).toBe(1) + expect(games.nbPages).toBe(3) + }) + + test('searching on two indexes with page selection pagination', async () => { + const customClient = instantMeiliSearch( + 'http://localhost:7700', + 'masterKey', + { + finitePagination: true, + } + ) + + const response = await customClient.search([ + { + indexName: 'movies', + params: { + hitsPerPage: 1, + page: 1, + }, + }, + { + indexName: 'games', + params: { + hitsPerPage: 1, + page: 1, + }, + }, + ]) + + const movies = response.results[0] + const games = response.results[1] + + expect(movies.hits.length).toBe(1) + expect(movies.page).toBe(1) + expect(movies.nbPages).toBe(6) + + expect(games.hits.length).toBe(1) + expect(games.page).toBe(1) + expect(games.nbPages).toBe(15) + }) + + test('searching on two indexes with facet filtering', async () => { + const customClient = instantMeiliSearch( + 'http://localhost:7700', + 'masterKey' + ) + + const response = await customClient.search([ + { + indexName: 'movies', + params: { + facetFilters: [['genres:Adventure', 'genres:Action'], ['color:blue']], + facets: ['genres', 'color', 'platforms'], + }, + }, + { + indexName: 'movies', + params: { + page: 0, + hitsPerPage: 1, + // @ts-ignore considered a read-only type in instantsearch + facets: 'genres', + facetFilters: [['color:blue']], + }, + }, + { + indexName: 'movies', + params: { + page: 0, + hitsPerPage: 1, + // @ts-ignore considered a read-only type in instantsearch + facets: 'color', + facetFilters: [['genres:Adventure', 'genres:Action']], + }, + }, + { + indexName: 'games', + params: { + facets: ['genres', 'color', 'platforms'], + }, + }, + ]) + + const moviesMainRes = response.results[0] + const moviesColorRes = response.results[1] + const moviesGenresRes = response.results[2] + const games = response.results[3] + + expect(moviesMainRes.hits.length).toBe(1) + + expect(moviesMainRes.facets).toEqual({ + color: { + blue: 1, + }, + genres: { + Adventure: 1, + Drama: 1, + }, + platforms: { + Windows: 1, + }, + }) + + expect(moviesGenresRes.facets).toEqual({ + color: { + blue: 1, + green: 1, + red: 2, + }, + }) + expect(moviesColorRes.facets).toEqual({ + genres: { + Adventure: 1, + Drama: 2, + }, + }) + expect(games.facets).toEqual({ + color: { + blue: 5, + green: 1, + red: 5, + yellow: 4, + }, + genres: { + Action: 5, + Adventure: 7, + Drama: 4, + Fantasy: 3, + Romance: 3, + 'Science Fiction': 5, + }, + platforms: { + Linux: 15, + MacOS: 15, + Windows: 15, + }, + }) + }) + + test('searching on two indexes with no placeholder search', async () => { + const customClient = instantMeiliSearch( + 'http://localhost:7700', + 'masterKey', + { + placeholderSearch: false, + } + ) + + const emptyResponse = await customClient.search([ + { + indexName: 'movies', + }, + { + indexName: 'games', + }, + ]) + + const emptyMovies = emptyResponse.results[0] + const emptyGames = emptyResponse.results[1] + + expect(emptyMovies.hits.length).toBe(0) + expect(emptyGames.hits.length).toBe(0) + + const response = await customClient.search([ + { + indexName: 'movies', + params: { + query: 'a', + }, + }, + { + indexName: 'games', + params: { + query: 'a', + }, + }, + ]) + const movies = response.results[0] + const games = response.results[1] + + expect(movies.hits.length).toBe(4) + expect(games.hits.length).toBe(15) + }) +}) diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 120c3aff..bf9803be 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -1,3 +1,6 @@ { "extends": "../tsconfig.test.json", + "compilerOptions": { + "resolveJsonModule": true + }, } diff --git a/tsconfig.json b/tsconfig.json index 5edc1295..415322e2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,7 +22,8 @@ "noImplicitReturns": true, "forceConsistentCasingInFileNames": true, "noUnusedParameters": true, - "isolatedModules": true + "isolatedModules": true, + "resolveJsonModule": true }, - "exclude": ["playgrounds/"] + "exclude": ["playgrounds/", "tests/env"] } diff --git a/tsconfig.test.json b/tsconfig.test.json index 0ace77c3..07da0c60 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "suppressImplicitAnyIndexErrors": true, + "resolveJsonModule": true }, "include": [ "./**/*"