From e8e61301129ab28b55bf329526dbca752ea63ec3 Mon Sep 17 00:00:00 2001 From: jrmartin Date: Tue, 14 Jan 2025 22:18:46 -0800 Subject: [PATCH 1/3] Work in progress connecting elastic search to Search compoonent --- interlex.yaml | 34 +- mock/mutator/sciCrunchClient.ts | 20 + orval.config.js | 50 +-- package.json | 3 + src/api/custom-axios-instance.ts | 16 + src/api/endpoints/index.ts | 41 +- .../swaggerMockMissingEndpoints.msw.ts | 18 + .../endpoints/swaggerMockMissingEndpoints.ts | 17 + src/api/server.js | 43 +++ src/components/Header/Search.jsx | 11 +- src/model/backend/index.ts | 4 + src/model/backend/searchElastic200.ts | 11 + .../backend/searchElastic200ResultsItem.ts | 8 + src/model/backend/searchElasticBody.ts | 16 + src/model/backend/searchElasticBodyQuery.ts | 11 + src/parsers/termParser.tsx | 22 ++ yarn.lock | 350 +++++++++++++++++- 17 files changed, 628 insertions(+), 47 deletions(-) create mode 100644 mock/mutator/sciCrunchClient.ts create mode 100644 src/api/custom-axios-instance.ts create mode 100644 src/api/server.js create mode 100644 src/model/backend/searchElastic200.ts create mode 100644 src/model/backend/searchElastic200ResultsItem.ts create mode 100644 src/model/backend/searchElasticBody.ts create mode 100644 src/model/backend/searchElasticBodyQuery.ts diff --git a/interlex.yaml b/interlex.yaml index d93da74..c6a4dae 100644 --- a/interlex.yaml +++ b/interlex.yaml @@ -1044,7 +1044,39 @@ paths: 403: description: The request cannot be fullfilled due to the permission of your account. tags: - - API + - API + /term/elastic/search: + post: + summary: Perform an ElasticSearch query + operationId: searchElastic + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + size: + type: integer + description: Number of results to return + from: + type: integer + description: Starting index + query: + type: object + description: ElasticSearch query + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + results: + type: array + items: + type: object /ping: get: summary: Checks if the server is running diff --git a/mock/mutator/sciCrunchClient.ts b/mock/mutator/sciCrunchClient.ts new file mode 100644 index 0000000..76ef10c --- /dev/null +++ b/mock/mutator/sciCrunchClient.ts @@ -0,0 +1,20 @@ +import axios from 'axios'; + +const sciCrunchInstance = axios.create({ + baseURL: 'https://scicrunch.org/api/1', // ElasticSearch API base URL + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, +}); + +// Add API key to each request +sciCrunchInstance.interceptors.request.use((config) => { + config.params = { + ...(config.params || {}), + api_key: 'tvVqyYwrQqolqVfMo45cu31t5uEGx6RZ', // Add your API key here + }; + return config; +}); + +export default sciCrunchInstance; diff --git a/orval.config.js b/orval.config.js index 161b830..24ef3e5 100644 --- a/orval.config.js +++ b/orval.config.js @@ -28,41 +28,6 @@ module.exports = { path: './mock/mutator/customClient.ts', name: 'customInstance', }, - operations: { - /** TODO : Endpoint returns a 500, it's being reused by multiple endpoints. - * In our use case, we need this operation to ADD Ontologies with or - * without paths. - * */ - get_ontologies_ontologies: { - mock: { - data: () => ({ - status_code: 200, - message: "", - }), - }, - }, - get_endpoints_curies_ : { - mock: { - data : mockCuries - } - }, - // Override existing endpoint, return mock data for fragment ID ilx_0101431 - get_endpoints_ilx: { - mock: { - data: mockTerm, - }, - }, - patch_endpoints_ilx: { - mock: { - data: mockPatchTermResponse, - }, - }, - get_endpoints_ilx_get: { - mock: { - data: mockTerm, - }, - }, - }, allParamsOptional: true, urlEncodeParameters: true, }, @@ -220,6 +185,21 @@ module.exports = { data: mockPatchTermResponse }, }, + search_elastic: { + override: { + mutator: { + path: './src/api/mutator/sciCrunchClient.ts', + name: 'sciCrunchInstance', + }, + }, + query: { + useQuery: true, + useSuspenseQuery: true, + useSuspenseInfiniteQuery: true, + useInfinite: true, + useInfiniteQueryParam: ['filter', 'value'], + }, + }, // Search for specific 'term' and get all results get_match_terms: { mock: { diff --git a/package.json b/package.json index e20dda5..9c94dbe 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,11 @@ "@mui/lab": "^5.0.0-alpha.170", "@mui/material": "^5.15.15", "@mui/x-tree-view": "^7.5.0", + "body-parser" : "^1.20.3", + "cors" : "^2.8.5", "d3": "^7.1.1", "date-fns": "^3.6.0", + "express" : "^4.21.2", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.23.1", diff --git a/src/api/custom-axios-instance.ts b/src/api/custom-axios-instance.ts new file mode 100644 index 0000000..a683ca2 --- /dev/null +++ b/src/api/custom-axios-instance.ts @@ -0,0 +1,16 @@ +import axios from 'axios'; + +export const customAxiosInstance = axios.create({ + baseURL: 'https://scicrunch.org/api/1', // Base URL for the API + headers: { + 'Content-Type': 'application/json', + }, +}); + +customAxiosInstance.interceptors.request.use((config) => { + config.params = { + ...config.params, + api_key: 'tvVqyYwrQqolqVfMo45cu31t5uEGx6RZ', // Add the API key to all requests + }; + return config; +}); diff --git a/src/api/endpoints/index.ts b/src/api/endpoints/index.ts index 9676604..87733a5 100644 --- a/src/api/endpoints/index.ts +++ b/src/api/endpoints/index.ts @@ -3,8 +3,10 @@ import * as mockApi from './../../api/endpoints/swaggerMockMissingEndpoints'; import * as api from './../../api/endpoints/interLexURIStructureAPI' import { TERM, ONTOLOGY, ORGANIZATION } from '../../model/frontend/types' import curieParser from '../../parsers/curieParser'; -import termParser, { getTerm } from '../../parsers/termParser'; +import termParser, { elasticSearhParser, getTerm } from '../../parsers/termParser'; import { Curies } from '../../model/frontend/curies'; +import { customInstance } from '../../../mock/mutator/customClient'; +import axios from 'axios'; const useMockApi = () => mockApi; const useApi = () => api; @@ -128,6 +130,43 @@ export const getMatchTerms = async (term, filters = {}) => { }); } +export const elasticSearch = async (query) => { + const proxyUrl = 'http://localhost:3000/api/scicrunch'; // Proxy URL + + const data = { + size: 20, + from: 0, + query: { + bool: { + must: [ + { + match_phrase: { + "existing_ids.curie": { + query: query, // Use query as the search term + }, + }, + }, + ], + }, + }, + }; + + try { + const response = await axios.post(proxyUrl, data, { + headers: { + 'Content-Type': 'application/json' + }, + }); + console.log('Elastic search results:', response.data); + const newData = elasticSearhParser(response?.data?.data?.hits?.hits) + console.log("results ", newData) + return newData; + } catch (error) { + console.error('Elastic search error:', error); + throw error; + } +}; + export const searchAll = async (term, filters = {}) => { const { searchAll } = useMockApi(); diff --git a/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts b/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts index 35c48ac..f70a922 100644 --- a/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts +++ b/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts @@ -23,6 +23,7 @@ import type { Ontologies, Organization, Organizations, + SearchElastic200, Signup200, Terms, User, @@ -4111,6 +4112,8 @@ export const getAddToVariantDiscussionResponseMock = () => ((() => { }; })()) +export const getSearchElasticResponseMock = (overrideResponse: any = {}): SearchElastic200 => ({results: faker.helpers.arrayElement([Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({})), undefined]), ...overrideResponse}) + export const getLoginMockHandler = (overrideResponse?: void) => { return http.post('*/operations/login', async () => { @@ -4504,6 +4507,20 @@ export const getAddToVariantDiscussionMockHandler = (overrideResponse?: AddToVar }) } +export const getSearchElasticMockHandler = (overrideResponse?: SearchElastic200) => { + return http.post('*/term/elastic/search', async () => { + await delay(1000); + return new HttpResponse(JSON.stringify(overrideResponse !== undefined ? overrideResponse : getSearchElasticResponseMock()), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + } + } + ) + }) +} + export const getGetPingMockHandler = () => { return http.get('*/ping', async () => { await delay(1000); @@ -4546,4 +4563,5 @@ export const getSwaggerMockMissingEndpointsMock = () => [ getAddToTermDiscussionMockHandler(), getGetVariantDiscussionsMockHandler(), getAddToVariantDiscussionMockHandler(), + getSearchElasticMockHandler(), getGetPingMockHandler()] diff --git a/src/api/endpoints/swaggerMockMissingEndpoints.ts b/src/api/endpoints/swaggerMockMissingEndpoints.ts index d7004d7..80865e4 100644 --- a/src/api/endpoints/swaggerMockMissingEndpoints.ts +++ b/src/api/endpoints/swaggerMockMissingEndpoints.ts @@ -18,6 +18,8 @@ import type { Organization, Organizations, SearchAllParams, + SearchElastic200, + SearchElasticBody, Signup200, Term, Terms, @@ -400,6 +402,20 @@ export const addToVariantDiscussion = ( options); } +/** + * @summary Perform an ElasticSearch query + */ +export const searchElastic = ( + searchElasticBody: BodyType, + options?: SecondParameter,) => { + return customInstance( + {url: `/term/elastic/search`, method: 'POST', + headers: {'Content-Type': 'application/json', }, + data: searchElasticBody + }, + options); + } + /** * @summary Checks if the server is running */ @@ -445,4 +461,5 @@ export type GetTermDiscussionsResult = NonNullable>> export type GetVariantDiscussionsResult = NonNullable>> export type AddToVariantDiscussionResult = NonNullable>> +export type SearchElasticResult = NonNullable>> export type GetPingResult = NonNullable>> diff --git a/src/api/server.js b/src/api/server.js new file mode 100644 index 0000000..8e5298e --- /dev/null +++ b/src/api/server.js @@ -0,0 +1,43 @@ +const express = require('express'); +const axios = require('axios'); +const bodyParser = require('body-parser'); +const cors = require('cors'); + +const app = express(); +const PORT = 3000; + +app.use(cors()); +app.use(bodyParser.json()); + +// Proxy endpoint +app.post('/api/scicrunch', async (req, res) => { + const apiUrl = 'https://scicrunch.org/api/1/term/elastic/search'; + const apiKey = 'tvVqyYwrQqolqVfMo45cu31t5uEGx6RZ'; + + try { + console.log("Request body received:", req.body); + + const response = await axios.get(apiUrl, { + headers: { + 'api_key' : apiKey + }, + params: { + api_key: apiKey, // Correct query parameter name + }, + }); + + console.log("Response from ElasticSearch:", response.data); + res.status(response.status).json(response.data); + } catch (error) { + console.error("Error in proxy:", error.response?.data || error.message); + res.status(error.response?.status || 500).json({ + message: error.message, + error: error.response?.data, + }); + } +}); + +// Start server +app.listen(PORT, () => { + console.log(`Proxy server running at http://localhost:${PORT}`); +}); \ No newline at end of file diff --git a/src/components/Header/Search.jsx b/src/components/Header/Search.jsx index 90f9f94..46a46d1 100644 --- a/src/components/Header/Search.jsx +++ b/src/components/Header/Search.jsx @@ -13,7 +13,7 @@ import { } from "@mui/material"; import { vars } from "../../theme/variables"; import { useEffect, useState, useCallback, forwardRef } from 'react'; -import { searchAll } from "../../api/endpoints"; +import { searchAll, elasticSearch } from "../../api/endpoints"; import { CloseIcon, ForwardIcon, SearchIcon, TermsIcon } from '../../Icons'; import FolderOutlinedIcon from '@mui/icons-material/FolderOutlined'; import CorporateFareOutlinedIcon from '@mui/icons-material/CorporateFareOutlined'; @@ -132,10 +132,11 @@ const Search = () => { }, [handleKeyDown]); const fetchTerms = useCallback(debounce(async (searchTerm) => { - const data = await searchAll(searchTerm); - const dataTerms = data?.results.filter(result => result.type === "TERM") - const dataOrganizations = data?.results.filter(result => result.type === "ORGANIZATION") - const dataOntologies = data?.results.filter(result => result.type === "ONTOLOGY") + const data = await elasticSearch(searchTerm); + console.log("Elastic data search ", data) + const dataTerms = data?.results.filter(result => result.type === "term") + const dataOrganizations = data?.results.filter(result => result.type === "organization") + const dataOntologies = data?.results.filter(result => result.type === "ontology") setTerms(dataTerms); setOrganizations(dataOrganizations) setOntologies(dataOntologies) diff --git a/src/model/backend/index.ts b/src/model/backend/index.ts index 79f92ad..676a507 100644 --- a/src/model/backend/index.ts +++ b/src/model/backend/index.ts @@ -43,6 +43,10 @@ export * from './predicates'; export * from './review'; export * from './reviews'; export * from './searchAllParams'; +export * from './searchElastic200'; +export * from './searchElastic200ResultsItem'; +export * from './searchElasticBody'; +export * from './searchElasticBodyQuery'; export * from './signup200'; export * from './term'; export * from './termContext'; diff --git a/src/model/backend/searchElastic200.ts b/src/model/backend/searchElastic200.ts new file mode 100644 index 0000000..8571692 --- /dev/null +++ b/src/model/backend/searchElastic200.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.28.2 🍺 + * Do not edit manually. + * Swagger Mock Missing Endpoints + * OpenAPI spec version: 1.0.0 + */ +import type { SearchElastic200ResultsItem } from './searchElastic200ResultsItem'; + +export type SearchElastic200 = { + results?: SearchElastic200ResultsItem[]; +}; diff --git a/src/model/backend/searchElastic200ResultsItem.ts b/src/model/backend/searchElastic200ResultsItem.ts new file mode 100644 index 0000000..b1ba7db --- /dev/null +++ b/src/model/backend/searchElastic200ResultsItem.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v6.28.2 🍺 + * Do not edit manually. + * Swagger Mock Missing Endpoints + * OpenAPI spec version: 1.0.0 + */ + +export type SearchElastic200ResultsItem = { [key: string]: any }; diff --git a/src/model/backend/searchElasticBody.ts b/src/model/backend/searchElasticBody.ts new file mode 100644 index 0000000..636d967 --- /dev/null +++ b/src/model/backend/searchElasticBody.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v6.28.2 🍺 + * Do not edit manually. + * Swagger Mock Missing Endpoints + * OpenAPI spec version: 1.0.0 + */ +import type { SearchElasticBodyQuery } from './searchElasticBodyQuery'; + +export type SearchElasticBody = { + /** Starting index */ + from?: number; + /** ElasticSearch query */ + query?: SearchElasticBodyQuery; + /** Number of results to return */ + size?: number; +}; diff --git a/src/model/backend/searchElasticBodyQuery.ts b/src/model/backend/searchElasticBodyQuery.ts new file mode 100644 index 0000000..f5fd529 --- /dev/null +++ b/src/model/backend/searchElasticBodyQuery.ts @@ -0,0 +1,11 @@ +/** + * Generated by orval v6.28.2 🍺 + * Do not edit manually. + * Swagger Mock Missing Endpoints + * OpenAPI spec version: 1.0.0 + */ + +/** + * ElasticSearch query + */ +export type SearchElasticBodyQuery = { [key: string]: any }; diff --git a/src/parsers/termParser.tsx b/src/parsers/termParser.tsx index d82b601..4a7805e 100644 --- a/src/parsers/termParser.tsx +++ b/src/parsers/termParser.tsx @@ -146,4 +146,26 @@ export const termParser = (data, searchTerm, start?, end?) => { } }; +export const elasticSearhParser = (data) => { + let terms : Terms; + if ( Array.isArray(data) ){ + terms = data?.map( term => { + let newTerm : Term = {} as Term + term = term._source + return term + }) + + // We are receiving an unknown amout of terms from server, we need to control + // how much to send back based on request made (start,end) + const results = terms; + const filters = getFilters(results); + return { + filters : filters, + results : results + } + } else { + return { filters : {} ,results : []} + } +}; + export default termParser; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 93c739d..54c906b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1529,6 +1529,14 @@ abort-controller@^3.0.0: dependencies: event-target-shim "^5.0.0" +accepts@~1.3.8: + version "1.3.8" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" + integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== + dependencies: + mime-types "~2.1.34" + negotiator "0.6.3" + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -1635,6 +1643,11 @@ array-buffer-byte-length@^1.0.1: call-bind "^1.0.5" is-array-buffer "^3.0.4" +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== + array-includes@^3.1.6, array-includes@^3.1.7: version "3.1.8" resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.8.tgz#5e370cbe172fdd5dd6530c1d4aadda25281ba97d" @@ -1777,6 +1790,24 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== +body-parser@1.20.3, body-parser@^1.20.3: + version "1.20.3" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" + integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== + dependencies: + bytes "3.1.2" + content-type "~1.0.5" + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" + iconv-lite "0.4.24" + on-finished "2.4.1" + qs "6.13.0" + raw-body "2.5.2" + type-is "~1.6.18" + unpipe "1.0.0" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1809,6 +1840,11 @@ browserslist@^4.22.2: node-releases "^2.0.14" update-browserslist-db "^1.0.13" +bytes@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== + cac@^6.7.14: version "6.7.14" resolved "https://registry.yarnpkg.com/cac/-/cac-6.7.14.tgz#804e1e6f506ee363cb0e3ccbb09cad5dd9870959" @@ -1972,6 +2008,18 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +content-disposition@0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +content-type@~1.0.4, content-type@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" + integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== + convert-source-map@^1.5.0: version "1.9.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" @@ -1982,6 +2030,16 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== + +cookie@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.1.tgz#2f73c42142d5d5cf71310a74fc4ae61670e5dbc9" + integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w== + cookie@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" @@ -1997,6 +2055,14 @@ core-js@^3.6.4: resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.37.1.tgz#d21751ddb756518ac5a00e4d66499df981a62db9" integrity sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw== +cors@^2.8.5: + version "2.8.5" + resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29" + integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== + dependencies: + object-assign "^4" + vary "^1" + cosmiconfig@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6" @@ -2305,6 +2371,13 @@ date-fns@^3.6.0: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.6.0.tgz#f20ca4fe94f8b754951b24240676e8618c0206bf" integrity sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww== +debug@2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + debug@^4.1.0, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -2347,11 +2420,21 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + dependency-graph@0.11.0, dependency-graph@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.11.0.tgz#ac0ce7ed68a54da22165a85e97a01d53f5eb2e27" integrity sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg== +destroy@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" + integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -2432,6 +2515,11 @@ draft-js@>=0.10.0: immutable "~3.7.4" object-assign "^4.1.1" +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== + electron-to-chromium@^1.4.668: version "1.4.738" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.738.tgz#9a7fca98abaee61e20c9c25013d5ce60bb533436" @@ -2442,6 +2530,16 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== + +encodeurl@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" + integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== + enquirer@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.4.1.tgz#93334b3fbd74fc7097b224ab4a8fb7e40bf4ae56" @@ -2655,6 +2753,11 @@ escalade@^3.1.1: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== +escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2794,6 +2897,11 @@ esutils@2.0.3, esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== + event-target-shim@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" @@ -2814,6 +2922,43 @@ execa@^5.1.1: signal-exit "^3.0.3" strip-final-newline "^2.0.0" +express@^4.21.2: + version "4.21.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32" + integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA== + dependencies: + accepts "~1.3.8" + array-flatten "1.1.1" + body-parser "1.20.3" + content-disposition "0.5.4" + content-type "~1.0.4" + cookie "0.7.1" + cookie-signature "1.0.6" + debug "2.6.9" + depd "2.0.0" + encodeurl "~2.0.0" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.3.1" + fresh "0.5.2" + http-errors "2.0.0" + merge-descriptors "1.0.3" + methods "~1.1.2" + on-finished "2.4.1" + parseurl "~1.3.3" + path-to-regexp "0.1.12" + proxy-addr "~2.0.7" + qs "6.13.0" + range-parser "~1.2.1" + safe-buffer "5.2.1" + send "0.19.0" + serve-static "1.16.2" + setprototypeof "1.2.0" + statuses "2.0.1" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -2897,6 +3042,19 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +finalhandler@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019" + integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ== + dependencies: + debug "2.6.9" + encodeurl "~2.0.0" + escape-html "~1.0.3" + on-finished "2.4.1" + parseurl "~1.3.3" + statuses "2.0.1" + unpipe "~1.0.0" + find-root@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" @@ -2950,6 +3108,16 @@ format@^0.2.0: resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" integrity sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww== +forwarded@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" + integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== + fs-extra@^11.2.0: version "11.2.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" @@ -3182,6 +3350,17 @@ hoist-non-react-statics@^3.3.1: dependencies: react-is "^16.7.0" +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== + dependencies: + depd "2.0.0" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses "2.0.1" + toidentifier "1.0.1" + http2-client@^1.2.5: version "1.3.5" resolved "https://registry.yarnpkg.com/http2-client/-/http2-client-1.3.5.tgz#20c9dc909e3cc98284dd20af2432c524086df181" @@ -3192,6 +3371,13 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +iconv-lite@0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + iconv-lite@0.6: version "0.6.3" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" @@ -3240,7 +3426,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2: +inherits@2, inherits@2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -3259,6 +3445,11 @@ internal-slot@^1.0.7: resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + is-alphabetical@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz#9e7d6b94916be22153745d184c298cbf986a686d" @@ -3713,6 +3904,16 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== + +merge-descriptors@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz#d80319a65f3c7935351e5cfdac8f9318504dbed5" + integrity sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ== + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -3723,6 +3924,11 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== + micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" @@ -3736,13 +3942,18 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12: +mime-types@^2.1.12, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" +mime@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -3762,11 +3973,21 @@ minimatch@^6.2.0: dependencies: brace-expansion "^2.0.1" +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== + ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + msw@^2.2.14: version "2.2.14" resolved "https://registry.yarnpkg.com/msw/-/msw-2.2.14.tgz#ed16b89f99ffc105a84b0295a6fcae2ee99f5c62" @@ -3805,6 +4026,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +negotiator@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" + integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== + nimma@0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/nimma/-/nimma-0.2.2.tgz#48d00f837d17b4baa23beec22ac1380f152f15ef" @@ -3902,7 +4128,7 @@ oas-validator@^5.0.8: should "^13.2.1" yaml "^1.10.0" -object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== @@ -3964,6 +4190,13 @@ object.values@^1.1.6, object.values@^1.1.7: define-properties "^1.2.1" es-object-atoms "^1.0.0" +on-finished@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" + integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + dependencies: + ee-first "1.1.1" + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -4079,6 +4312,11 @@ parse-json@^5.0.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -4099,6 +4337,11 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-to-regexp@0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" + integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== + path-to-regexp@^6.2.0: version "6.2.2" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.2.tgz#324377a83e5049cbecadc5554d6a63a9a4866b36" @@ -4176,6 +4419,14 @@ property-information@^5.0.0: dependencies: xtend "^4.0.0" +proxy-addr@~2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" + integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== + dependencies: + forwarded "0.2.0" + ipaddr.js "1.9.1" + proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" @@ -4186,11 +4437,33 @@ punycode@^2.1.0: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== +qs@6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" + integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== + dependencies: + side-channel "^1.0.6" + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== +range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +raw-body@2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + react-dom@^18.3.1: version "18.3.1" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" @@ -4424,6 +4697,11 @@ safe-array-concat@^1.1.2: has-symbols "^1.0.3" isarray "^2.0.5" +safe-buffer@5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + safe-regex-test@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.3.tgz#a5b4c0f06e0ab50ea2c395c14d8371232924c377" @@ -4438,7 +4716,7 @@ safe-stable-stringify@^1.1: resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz#c8a220ab525cd94e60ebf47ddc404d610dc5d84a" integrity sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw== -"safer-buffer@>= 2.1.2 < 3.0.0": +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -4455,6 +4733,35 @@ semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +send@0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" + integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw== + dependencies: + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "2.0.0" + mime "1.6.0" + ms "2.1.3" + on-finished "2.4.1" + range-parser "~1.2.1" + statuses "2.0.1" + +serve-static@1.16.2: + version "1.16.2" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296" + integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw== + dependencies: + encodeurl "~2.0.0" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.19.0" + set-function-length@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" @@ -4482,6 +4789,11 @@ setimmediate@^1.0.5: resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -4590,7 +4902,7 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -statuses@^2.0.1: +statuses@2.0.1, statuses@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== @@ -4740,6 +5052,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -4782,6 +5099,14 @@ type-fest@^4.9.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.18.1.tgz#47e8d4e493cf7ed6c643bad698d5810d72cbdf79" integrity sha512-qXhgeNsX15bM63h5aapNFcQid9jRF/l3ojDoDFmekDQEUufZ9U4ErVt6SjDxnHp48Ltrw616R8yNc3giJ3KvVQ== +type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + typed-array-buffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3" @@ -4851,6 +5176,11 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + update-browserslist-db@^1.0.13: version "1.0.13" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" @@ -4876,11 +5206,21 @@ utility-types@^3.10.0: resolved "https://registry.yarnpkg.com/utility-types/-/utility-types-3.11.0.tgz#607c40edb4f258915e901ea7995607fdf319424c" integrity sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw== +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== + validator@^13.11.0: version "13.11.0" resolved "https://registry.yarnpkg.com/validator/-/validator-13.11.0.tgz#23ab3fd59290c61248364eabf4067f04955fbb1b" integrity sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ== +vary@^1, vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== + vite@^5.2.0: version "5.2.9" resolved "https://registry.yarnpkg.com/vite/-/vite-5.2.9.tgz#cd9a356c6ff5f7456c09c5ce74068ffa8df743d9" From 3466a0cc42953592afff1dc2328ca318018579b9 Mon Sep 17 00:00:00 2001 From: jrmartin Date: Thu, 16 Jan 2025 23:14:15 -0500 Subject: [PATCH 2/3] #ILEX-80 Use the elastic search endpoint instead of mock data one. Cleans up previous commit --- interlex.yaml | 32 ------------------- mock/mutator/sciCrunchClient.ts | 20 ------------ orval.config.js | 17 +--------- src/api/endpoints/index.ts | 30 +++++------------ .../swaggerMockMissingEndpoints.msw.ts | 18 ----------- .../endpoints/swaggerMockMissingEndpoints.ts | 17 ---------- src/api/server.js | 15 +++++---- src/components/Header/Search.jsx | 3 +- 8 files changed, 19 insertions(+), 133 deletions(-) delete mode 100644 mock/mutator/sciCrunchClient.ts diff --git a/interlex.yaml b/interlex.yaml index c6a4dae..126323c 100644 --- a/interlex.yaml +++ b/interlex.yaml @@ -1045,38 +1045,6 @@ paths: description: The request cannot be fullfilled due to the permission of your account. tags: - API - /term/elastic/search: - post: - summary: Perform an ElasticSearch query - operationId: searchElastic - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - size: - type: integer - description: Number of results to return - from: - type: integer - description: Starting index - query: - type: object - description: ElasticSearch query - responses: - '200': - description: Successful response - content: - application/json: - schema: - type: object - properties: - results: - type: array - items: - type: object /ping: get: summary: Checks if the server is running diff --git a/mock/mutator/sciCrunchClient.ts b/mock/mutator/sciCrunchClient.ts deleted file mode 100644 index 76ef10c..0000000 --- a/mock/mutator/sciCrunchClient.ts +++ /dev/null @@ -1,20 +0,0 @@ -import axios from 'axios'; - -const sciCrunchInstance = axios.create({ - baseURL: 'https://scicrunch.org/api/1', // ElasticSearch API base URL - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - }, -}); - -// Add API key to each request -sciCrunchInstance.interceptors.request.use((config) => { - config.params = { - ...(config.params || {}), - api_key: 'tvVqyYwrQqolqVfMo45cu31t5uEGx6RZ', // Add your API key here - }; - return config; -}); - -export default sciCrunchInstance; diff --git a/orval.config.js b/orval.config.js index 24ef3e5..dcece59 100644 --- a/orval.config.js +++ b/orval.config.js @@ -184,22 +184,7 @@ module.exports = { mock: { data: mockPatchTermResponse }, - }, - search_elastic: { - override: { - mutator: { - path: './src/api/mutator/sciCrunchClient.ts', - name: 'sciCrunchInstance', - }, - }, - query: { - useQuery: true, - useSuspenseQuery: true, - useSuspenseInfiniteQuery: true, - useInfinite: true, - useInfiniteQueryParam: ['filter', 'value'], - }, - }, + }, // Search for specific 'term' and get all results get_match_terms: { mock: { diff --git a/src/api/endpoints/index.ts b/src/api/endpoints/index.ts index 87733a5..3bda976 100644 --- a/src/api/endpoints/index.ts +++ b/src/api/endpoints/index.ts @@ -119,10 +119,10 @@ export const getCuries = async (term) => { } export const getMatchTerms = async (term, filters = {}) => { - const { getMatchTerms } = useMockApi(); + const { getEndpointsIlxGet } = useApi(); /** Call Endpoint */ - return getMatchTerms("base", term, filters).then((data) => { + return getEndpointsIlxGet("base", term, "jsonld").then((data) => { return termParser(data, term, filters); }) .catch((error) => { @@ -130,36 +130,22 @@ export const getMatchTerms = async (term, filters = {}) => { }); } +// Elastic search client function export const elasticSearch = async (query) => { - const proxyUrl = 'http://localhost:3000/api/scicrunch'; // Proxy URL + const proxyUrl = 'http://localhost:3000/api/scicrunch'; const data = { - size: 20, - from: 0, - query: { - bool: { - must: [ - { - match_phrase: { - "existing_ids.curie": { - query: query, // Use query as the search term - }, - }, - }, - ], - }, - }, + query: query }; try { const response = await axios.post(proxyUrl, data, { headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', }, }); - console.log('Elastic search results:', response.data); - const newData = elasticSearhParser(response?.data?.data?.hits?.hits) - console.log("results ", newData) + + const newData = elasticSearhParser(response?.data?.data?.hits?.hits); return newData; } catch (error) { console.error('Elastic search error:', error); diff --git a/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts b/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts index f70a922..35c48ac 100644 --- a/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts +++ b/src/api/endpoints/swaggerMockMissingEndpoints.msw.ts @@ -23,7 +23,6 @@ import type { Ontologies, Organization, Organizations, - SearchElastic200, Signup200, Terms, User, @@ -4112,8 +4111,6 @@ export const getAddToVariantDiscussionResponseMock = () => ((() => { }; })()) -export const getSearchElasticResponseMock = (overrideResponse: any = {}): SearchElastic200 => ({results: faker.helpers.arrayElement([Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({})), undefined]), ...overrideResponse}) - export const getLoginMockHandler = (overrideResponse?: void) => { return http.post('*/operations/login', async () => { @@ -4507,20 +4504,6 @@ export const getAddToVariantDiscussionMockHandler = (overrideResponse?: AddToVar }) } -export const getSearchElasticMockHandler = (overrideResponse?: SearchElastic200) => { - return http.post('*/term/elastic/search', async () => { - await delay(1000); - return new HttpResponse(JSON.stringify(overrideResponse !== undefined ? overrideResponse : getSearchElasticResponseMock()), - { - status: 200, - headers: { - 'Content-Type': 'application/json', - } - } - ) - }) -} - export const getGetPingMockHandler = () => { return http.get('*/ping', async () => { await delay(1000); @@ -4563,5 +4546,4 @@ export const getSwaggerMockMissingEndpointsMock = () => [ getAddToTermDiscussionMockHandler(), getGetVariantDiscussionsMockHandler(), getAddToVariantDiscussionMockHandler(), - getSearchElasticMockHandler(), getGetPingMockHandler()] diff --git a/src/api/endpoints/swaggerMockMissingEndpoints.ts b/src/api/endpoints/swaggerMockMissingEndpoints.ts index 80865e4..d7004d7 100644 --- a/src/api/endpoints/swaggerMockMissingEndpoints.ts +++ b/src/api/endpoints/swaggerMockMissingEndpoints.ts @@ -18,8 +18,6 @@ import type { Organization, Organizations, SearchAllParams, - SearchElastic200, - SearchElasticBody, Signup200, Term, Terms, @@ -402,20 +400,6 @@ export const addToVariantDiscussion = ( options); } -/** - * @summary Perform an ElasticSearch query - */ -export const searchElastic = ( - searchElasticBody: BodyType, - options?: SecondParameter,) => { - return customInstance( - {url: `/term/elastic/search`, method: 'POST', - headers: {'Content-Type': 'application/json', }, - data: searchElasticBody - }, - options); - } - /** * @summary Checks if the server is running */ @@ -461,5 +445,4 @@ export type GetTermDiscussionsResult = NonNullable>> export type GetVariantDiscussionsResult = NonNullable>> export type AddToVariantDiscussionResult = NonNullable>> -export type SearchElasticResult = NonNullable>> export type GetPingResult = NonNullable>> diff --git a/src/api/server.js b/src/api/server.js index 8e5298e..c2bacad 100644 --- a/src/api/server.js +++ b/src/api/server.js @@ -9,20 +9,23 @@ const PORT = 3000; app.use(cors()); app.use(bodyParser.json()); -// Proxy endpoint app.post('/api/scicrunch', async (req, res) => { const apiUrl = 'https://scicrunch.org/api/1/term/elastic/search'; const apiKey = 'tvVqyYwrQqolqVfMo45cu31t5uEGx6RZ'; try { - console.log("Request body received:", req.body); + // Extract the query from the request body + const query = req.body.query; + if (!query) { + return res.status(400).json({ message: "Missing 'query' in request body." }); + } + + // Make the GET request to the external API const response = await axios.get(apiUrl, { - headers: { - 'api_key' : apiKey - }, params: { - api_key: apiKey, // Correct query parameter name + api_key: apiKey, + query: JSON.stringify({ match: { label: query } }), }, }); diff --git a/src/components/Header/Search.jsx b/src/components/Header/Search.jsx index 46a46d1..f288206 100644 --- a/src/components/Header/Search.jsx +++ b/src/components/Header/Search.jsx @@ -100,7 +100,7 @@ const Search = () => { setSearchTerm(""); setSelectedValue(newInputValue?.label); handleCloseList(); - navigate(`/view?searchTerm=${newInputValue?.label}`); + navigate(`/view?searchTerm=${newInputValue?.ilx}`); }; const handleSearchTermClick = () => { @@ -133,7 +133,6 @@ const Search = () => { const fetchTerms = useCallback(debounce(async (searchTerm) => { const data = await elasticSearch(searchTerm); - console.log("Elastic data search ", data) const dataTerms = data?.results.filter(result => result.type === "term") const dataOrganizations = data?.results.filter(result => result.type === "organization") const dataOntologies = data?.results.filter(result => result.type === "ontology") From cfccb93f77a18b1fade52e5a70e3329b6cd20cad Mon Sep 17 00:00:00 2001 From: jrmartin Date: Fri, 17 Jan 2025 08:39:53 -0500 Subject: [PATCH 3/3] #ILEX-80 - Remove swagger methods we are not using it --- src/api/endpoints/index.ts | 1 - src/model/backend/index.ts | 4 ---- src/model/backend/searchElastic200.ts | 11 ----------- src/model/backend/searchElastic200ResultsItem.ts | 8 -------- src/model/backend/searchElasticBody.ts | 16 ---------------- src/model/backend/searchElasticBodyQuery.ts | 11 ----------- 6 files changed, 51 deletions(-) delete mode 100644 src/model/backend/searchElastic200.ts delete mode 100644 src/model/backend/searchElastic200ResultsItem.ts delete mode 100644 src/model/backend/searchElasticBody.ts delete mode 100644 src/model/backend/searchElasticBodyQuery.ts diff --git a/src/api/endpoints/index.ts b/src/api/endpoints/index.ts index 3bda976..41e1dbf 100644 --- a/src/api/endpoints/index.ts +++ b/src/api/endpoints/index.ts @@ -5,7 +5,6 @@ import { TERM, ONTOLOGY, ORGANIZATION } from '../../model/frontend/types' import curieParser from '../../parsers/curieParser'; import termParser, { elasticSearhParser, getTerm } from '../../parsers/termParser'; import { Curies } from '../../model/frontend/curies'; -import { customInstance } from '../../../mock/mutator/customClient'; import axios from 'axios'; const useMockApi = () => mockApi; diff --git a/src/model/backend/index.ts b/src/model/backend/index.ts index 676a507..79f92ad 100644 --- a/src/model/backend/index.ts +++ b/src/model/backend/index.ts @@ -43,10 +43,6 @@ export * from './predicates'; export * from './review'; export * from './reviews'; export * from './searchAllParams'; -export * from './searchElastic200'; -export * from './searchElastic200ResultsItem'; -export * from './searchElasticBody'; -export * from './searchElasticBodyQuery'; export * from './signup200'; export * from './term'; export * from './termContext'; diff --git a/src/model/backend/searchElastic200.ts b/src/model/backend/searchElastic200.ts deleted file mode 100644 index 8571692..0000000 --- a/src/model/backend/searchElastic200.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Generated by orval v6.28.2 🍺 - * Do not edit manually. - * Swagger Mock Missing Endpoints - * OpenAPI spec version: 1.0.0 - */ -import type { SearchElastic200ResultsItem } from './searchElastic200ResultsItem'; - -export type SearchElastic200 = { - results?: SearchElastic200ResultsItem[]; -}; diff --git a/src/model/backend/searchElastic200ResultsItem.ts b/src/model/backend/searchElastic200ResultsItem.ts deleted file mode 100644 index b1ba7db..0000000 --- a/src/model/backend/searchElastic200ResultsItem.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Generated by orval v6.28.2 🍺 - * Do not edit manually. - * Swagger Mock Missing Endpoints - * OpenAPI spec version: 1.0.0 - */ - -export type SearchElastic200ResultsItem = { [key: string]: any }; diff --git a/src/model/backend/searchElasticBody.ts b/src/model/backend/searchElasticBody.ts deleted file mode 100644 index 636d967..0000000 --- a/src/model/backend/searchElasticBody.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Generated by orval v6.28.2 🍺 - * Do not edit manually. - * Swagger Mock Missing Endpoints - * OpenAPI spec version: 1.0.0 - */ -import type { SearchElasticBodyQuery } from './searchElasticBodyQuery'; - -export type SearchElasticBody = { - /** Starting index */ - from?: number; - /** ElasticSearch query */ - query?: SearchElasticBodyQuery; - /** Number of results to return */ - size?: number; -}; diff --git a/src/model/backend/searchElasticBodyQuery.ts b/src/model/backend/searchElasticBodyQuery.ts deleted file mode 100644 index f5fd529..0000000 --- a/src/model/backend/searchElasticBodyQuery.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Generated by orval v6.28.2 🍺 - * Do not edit manually. - * Swagger Mock Missing Endpoints - * OpenAPI spec version: 1.0.0 - */ - -/** - * ElasticSearch query - */ -export type SearchElasticBodyQuery = { [key: string]: any };