diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8bce859ed..7bce55a41 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -23,7 +23,7 @@ jobs: uses: bcgov/bcregistry-sre/.github/workflows/frontend-cd.yaml@main with: target: ${{ inputs.environment }} - node_version: '20.5.1' + node_version: "24" app_name: 'namerequest' working_directory: 'app' secrets: diff --git a/app/.env.example b/app/.env.example index 6fc434521..0b609231c 100644 --- a/app/.env.example +++ b/app/.env.example @@ -24,6 +24,7 @@ VUE_APP_BUSINESS_API_KEY="" VUE_APP_NAMEX_API_GW_URL="https://test.api.connect.gov.bc.ca/namex-dev" VUE_APP_NAMEX_API_VERSION="/api/v1" VUE_APP_NAMEX_API_KEY= +VUE_APP_NAMEX_SOLR_API_URL="" VUE_APP_STATUS_API_URL="https://status-api-dev.apps.gold.devops.gov.bc.ca" VUE_APP_STATUS_API_VERSION="/api/v1" VUE_APP_REGISTRIES_SEARCH_API_URL="https://test.api.connect.gov.bc.ca/registry-search-dev" diff --git a/app/devops/vaults.env b/app/devops/vaults.env index 93771b4c6..470e138f4 100644 --- a/app/devops/vaults.env +++ b/app/devops/vaults.env @@ -25,6 +25,7 @@ VUE_APP_BUSINESS_API_KEY="op://API/$APP_ENV/business-api/BUSINESS_API_KEY" VUE_APP_NAMEX_API_GW_URL="op://API/$APP_ENV/namex-api/NAMEX_API_GW_URL" VUE_APP_NAMEX_API_VERSION="op://API/$APP_ENV/namex-api/NAMEX_API_VERSION" VUE_APP_NAMEX_API_KEY="op://API/$APP_ENV/namex-api/NAMEX_API_KEY" +VUE_APP_NAMEX_SOLR_API_URL="op://API/$APP_ENV/namex-solr-api/API_URL" VUE_APP_STATUS_API_URL="op://API/$APP_ENV/status-api/STATUS_API_URL" VUE_APP_STATUS_API_VERSION="op://API/$APP_ENV/status-api/STATUS_API_VERSION" VUE_APP_REGISTRIES_SEARCH_API_URL="op://API/$APP_ENV/registries-search-api/REGISTRIES_SEARCH_API_URL" diff --git a/app/package.json b/app/package.json index aed73e8b4..87d92ecfa 100644 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,10 @@ { "name": "name-request", - "version": "5.8.11", + "version": "5.9.0", "private": true, + "engines": { + "node": ">=24" + }, "appName": "Name Request UI", "sbcName": "SBC Common Components", "scripts": { diff --git a/app/src/plugins/getConfig.ts b/app/src/plugins/getConfig.ts index 0bf1b0002..f28eb20a4 100644 --- a/app/src/plugins/getConfig.ts +++ b/app/src/plugins/getConfig.ts @@ -31,7 +31,8 @@ export function getConfig (): void { const namexApiURL: string = import.meta.env.VUE_APP_NAMEX_API_GW_URL + import.meta.env.VUE_APP_NAMEX_API_VERSION sessionStorage.setItem('NAMEX_API_URL', namexApiURL) - + const namexSolrApiUrl: string = import.meta.env.VUE_APP_NAMEX_SOLR_API_URL + sessionStorage.setItem('NAMEX_SOLR_API_URL', namexSolrApiUrl) const legalApiUrl: string = import.meta.env.VUE_APP_LEGAL_API_URL + import.meta.env.VUE_APP_LEGAL_API_VERSION_2 sessionStorage.setItem('LEGAL_API_URL', legalApiUrl) diff --git a/app/src/store/actions.ts b/app/src/store/actions.ts index a5e39236d..2671255a9 100644 --- a/app/src/store/actions.ts +++ b/app/src/store/actions.ts @@ -30,7 +30,6 @@ import { DFLT_MIN_LENGTH, DFLT_MAX_LENGTH, MRAS_MIN_LENGTH, MRAS_MAX_LENGTH } fr // NB: can't use `this.$xxx` because we don't have `this` (ie, Vue) import { CanJurisdictions, Designations, checkInvalidDesignation, IntlJurisdictions, RequestActions } from '@/list-data' -// Interfaces import { BusinessSearchIF, CleanedNameIF, @@ -51,6 +50,7 @@ import { } from '@/interfaces' const namexApiUrl = sessionStorage.getItem('NAMEX_API_URL') +const namexSolrApiUrl = sessionStorage.getItem('NAMEX_SOLR_API_URL') export const setActiveComponent = (component: string): void => { enum Tabs { @@ -780,55 +780,42 @@ export const setWindowWidth = (width: number): void => { * FUTURE: move these into a factory if converting to composition api */ export const getMatchesExact = async (token: string, cleanedName: string): Promise> => { - const exactResp = await NamexServices.axios.get( - `${namexApiUrl}/exact-match?query=` + cleanedName, + const resp = await NamexServices.axios.post( + `${namexSolrApiUrl}/v1/search/possible-conflict-names`, + { query: { value: cleanedName } }, { headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } } ).catch(() => { Mutations.mutateNameCheckErrorAdd(state, NameCheckErrorType.ERROR_EXACT) return null }) - return exactResp?.data ? parseExactNames(exactResp.data) : [] + const results = resp?.data?.searchResults?.results || [] + return parseExactNames({ names: results.filter((r: any) => r.highlighting?.exact?.length > 0) }) } -// todo: look into differences #31690 -export const getMatchesSimilar_main_branch = async ( +export const getMatchesSimilar = async ( token: string, cleanedName: string, exactNames: Array ): Promise> => { - const synonymResp = await NamexServices.axios.get( - `${namexApiUrl}/requests/synonymbucket/` + cleanedName + '/*', + const resp = await NamexServices.axios.post( + `${namexSolrApiUrl}/v1/search/possible-conflict-names`, + { query: { value: cleanedName } }, { headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } } ).catch(() => { Mutations.mutateNameCheckErrorAdd(state, NameCheckErrorType.ERROR_SIMILAR) return null }) - if (synonymResp?.data) synonymResp.data.exactNames = exactNames || [] - return synonymResp?.data ? parseSynonymNames(synonymResp.data) : [] -} - -const getMatchesSimilar = async ( - token: string, - cleanedName: string -): Promise<{ names: Array, exactNames: Array }> => { - const synonymResp = await NamexServices.axios.get( - `${namexApiUrl}/requests/possible-conflicts/${cleanedName}`, - { - headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } - }).catch(() => { - Mutations.mutateNameCheckErrorAdd(state, NameCheckErrorType.ERROR_SIMILAR) - return null - }) - - return { - names: synonymResp.data.names || [], - exactNames: synonymResp.data.exactNames || [] + const results = resp?.data?.searchResults?.results || [] + const wrapped = { + names: results.map((r: any) => ({ name_info: { id: r.id, name: r.name } })), + exactNames: exactNames || [] } + return parseSynonymNames(wrapped) } export const getMatchesRestricted = async ( token: string, cleanedName: string ): Promise => { const restrictedResp = await NamexServices.axios.get( - `${namexApiUrl}/documents/restricted-words?content=${cleanedName}`, + `${namexApiUrl}/documents:restricted_words?content=${cleanedName}`, { headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' } } ).catch(() => { Mutations.mutateNameCheckErrorAdd(state, NameCheckErrorType.ERROR_RESTRICTED) @@ -943,10 +930,12 @@ export const getQuickSearch = async ( headers: { Authorization: `Basic ${encodedAuth}`, 'content-type': 'application/x-www-form-urlencoded' } }) const token = tokenResp.data.access_token - const { names, exactNames } = ( + const exactNames = checks.exact ? await getMatchesExact(token, cleanedName.exactMatch) : [] + // pass in exactNames so that we can check for duplicates + const synonymNames = ( checks.similar - ? await getMatchesSimilar(token, cleanedName.synonymMatch) - : { names: [], exactNames: [] } + ? await getMatchesSimilar(token, cleanedName.synonymMatch, exactNames) + : [] ) const parsedRestrictedResp: ParsedRestrictedResponseIF = ( @@ -957,7 +946,7 @@ export const getQuickSearch = async ( return { exactNames: exactNames, - synonymNames: names, + synonymNames: synonymNames, restrictedWords: parsedRestrictedResp.restrictedWords, conditionalWords: parsedRestrictedResp.conditionalWords, conditionalInstructions: parsedRestrictedResp.conditionalInstructions