From 189e0c55fc5cb23a0bf8745ed18d049d482426d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:22:06 +1000 Subject: [PATCH] chore(deps): update @algolia/client-search to v5 (major) (#7979) * chore(deps): update algoliasearch-client-javascript monorepo to v5 * Fix API usage * Fix example --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> --- examples/react/algolia/package.json | 4 +- examples/react/algolia/src/algolia.ts | 17 +-- examples/react/algolia/src/useAlgolia.ts | 4 +- pnpm-lock.yaml | 182 +++++------------------ 4 files changed, 47 insertions(+), 160 deletions(-) diff --git a/examples/react/algolia/package.json b/examples/react/algolia/package.json index 52d979995c..2377209ed8 100644 --- a/examples/react/algolia/package.json +++ b/examples/react/algolia/package.json @@ -9,11 +9,9 @@ "test:types": "tsc" }, "dependencies": { - "@algolia/client-search": "4.24.0", - "@algolia/transporter": "4.24.0", + "@algolia/client-search": "5.2.1", "@tanstack/react-query": "^5.52.2", "@tanstack/react-query-devtools": "^5.52.2", - "algoliasearch": "4.24.0", "react": "19.0.0-rc-4c2e457c7c-20240522", "react-dom": "19.0.0-rc-4c2e457c7c-20240522" }, diff --git a/examples/react/algolia/src/algolia.ts b/examples/react/algolia/src/algolia.ts index bc816ac104..36625f2397 100644 --- a/examples/react/algolia/src/algolia.ts +++ b/examples/react/algolia/src/algolia.ts @@ -1,5 +1,5 @@ -import algoliasearch from 'algoliasearch' -import { Hit } from '@algolia/client-search' +import { searchClient } from '@algolia/client-search' +import type { Hit } from '@algolia/client-search' // From Algolia example // https://github.com/algolia/react-instantsearch @@ -19,17 +19,16 @@ export async function search({ pageParam, hitsPerPage = 10, }: SearchOptions): Promise<{ - hits: Hit[] + hits: Array> nextPage: number | undefined }> { - const client = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY) - const index = client.initIndex(indexName) + const client = searchClient(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY) - console.log('alogolia:search', { indexName, query, pageParam, hitsPerPage }) + console.log('algolia:search', { indexName, query, pageParam, hitsPerPage }) - const { hits, page, nbPages } = await index.search(query, { - page: pageParam, - hitsPerPage, + const { hits, page, nbPages } = await client.searchSingleIndex({ + indexName, + searchParams: { query, page: pageParam, hitsPerPage }, }) const nextPage = page + 1 < nbPages ? page + 1 : undefined diff --git a/examples/react/algolia/src/useAlgolia.ts b/examples/react/algolia/src/useAlgolia.ts index 3c0fb2eec7..edc026410e 100644 --- a/examples/react/algolia/src/useAlgolia.ts +++ b/examples/react/algolia/src/useAlgolia.ts @@ -1,4 +1,4 @@ -import { useInfiniteQuery, skipToken } from '@tanstack/react-query' +import { skipToken, useInfiniteQuery } from '@tanstack/react-query' import { search } from './algolia' export type UseAlgoliaOptions = { @@ -23,7 +23,7 @@ export default function useAlgolia({ search({ indexName, query, pageParam, hitsPerPage }) : skipToken, initialPageParam: 0, - getNextPageParam: (lastPage) => lastPage?.nextPage, + getNextPageParam: (lastPage) => lastPage.nextPage, staleTime, gcTime, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 069a15b8d7..2159835bc8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -323,20 +323,14 @@ importers: examples/react/algolia: dependencies: '@algolia/client-search': - specifier: 4.24.0 - version: 4.24.0 - '@algolia/transporter': - specifier: 4.24.0 - version: 4.24.0 + specifier: 5.2.1 + version: 5.2.1 '@tanstack/react-query': specifier: ^5.52.2 version: link:../../../packages/react-query '@tanstack/react-query-devtools': specifier: ^5.52.2 version: link:../../../packages/react-query-devtools - algoliasearch: - specifier: 4.24.0 - version: 4.24.0 react: specifier: 19.0.0-rc-4c2e457c7c-20240522 version: 19.0.0-rc-4c2e457c7c-20240522 @@ -1124,7 +1118,7 @@ importers: version: 5.1.0(astro@4.12.3(@types/node@22.0.2)(less@4.2.0)(sass@1.77.8)(terser@5.31.3)(typescript@5.3.3))(tailwindcss@3.4.7) '@astrojs/vercel': specifier: ^7.7.2 - version: 7.7.2(astro@4.12.3(@types/node@22.0.2)(less@4.2.0)(sass@1.77.8)(terser@5.31.3)(typescript@5.3.3))(encoding@0.1.13)(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@18.3.1)(sass@1.77.8))(react@18.3.1) + version: 7.7.2(astro@4.12.3(@types/node@22.0.2)(less@4.2.0)(sass@1.77.8)(terser@5.31.3)(typescript@5.3.3))(encoding@0.1.13)(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react@18.3.1) '@tanstack/solid-query': specifier: ^5.52.2 version: link:../../../packages/solid-query @@ -2303,50 +2297,21 @@ packages: '@adobe/css-tools@4.4.0': resolution: {integrity: sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==} - '@algolia/cache-browser-local-storage@4.24.0': - resolution: {integrity: sha512-t63W9BnoXVrGy9iYHBgObNXqYXM3tYXCjDSHeNwnsc324r4o5UiVKUiAB4THQ5z9U5hTj6qUvwg/Ez43ZD85ww==} + '@algolia/client-common@5.2.1': + resolution: {integrity: sha512-f4u3TdqU8310ffGhcCjYtTBXXnVVQ9U38Gnltayxm5Hh63BxgzJzvELUcEuOaZh31CvC1FqttKx127gF90aaQg==} + engines: {node: '>= 14.0.0'} - '@algolia/cache-common@4.24.0': - resolution: {integrity: sha512-emi+v+DmVLpMGhp0V9q9h5CdkURsNmFC+cOS6uK9ndeJm9J4TiqSvPYVu+THUP8P/S08rxf5x2P+p3CfID0Y4g==} + '@algolia/client-search@5.2.1': + resolution: {integrity: sha512-9os21w5CmC84FZZujufLcZPnYKuTVJ3J6LF4i1/i1BKJzy1Cbb9bTWXn+e9PGdRJBzo4DRZt0D0Pd2X5dvUucg==} + engines: {node: '>= 14.0.0'} - '@algolia/cache-in-memory@4.24.0': - resolution: {integrity: sha512-gDrt2so19jW26jY3/MkFg5mEypFIPbPoXsQGQWAi6TrCPsNOSEYepBMPlucqWigsmEy/prp5ug2jy/N3PVG/8w==} + '@algolia/requester-browser-xhr@5.2.1': + resolution: {integrity: sha512-KRDJRPEdIcej/KgqDqhUs/vhLwVh2oKYa+GaKIFGiyRaWusjwaUYdrWgiLxcHAWNKIeIpwjKnteU/dwCz+Nykg==} + engines: {node: '>= 14.0.0'} - '@algolia/client-account@4.24.0': - resolution: {integrity: sha512-adcvyJ3KjPZFDybxlqnf+5KgxJtBjwTPTeyG2aOyoJvx0Y8dUQAEOEVOJ/GBxX0WWNbmaSrhDURMhc+QeevDsA==} - - '@algolia/client-analytics@4.24.0': - resolution: {integrity: sha512-y8jOZt1OjwWU4N2qr8G4AxXAzaa8DBvyHTWlHzX/7Me1LX8OayfgHexqrsL4vSBcoMmVw2XnVW9MhL+Y2ZDJXg==} - - '@algolia/client-common@4.24.0': - resolution: {integrity: sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==} - - '@algolia/client-personalization@4.24.0': - resolution: {integrity: sha512-l5FRFm/yngztweU0HdUzz1rC4yoWCFo3IF+dVIVTfEPg906eZg5BOd1k0K6rZx5JzyyoP4LdmOikfkfGsKVE9w==} - - '@algolia/client-search@4.24.0': - resolution: {integrity: sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==} - - '@algolia/logger-common@4.24.0': - resolution: {integrity: sha512-LLUNjkahj9KtKYrQhFKCzMx0BY3RnNP4FEtO+sBybCjJ73E8jNdaKJ/Dd8A/VA4imVHP5tADZ8pn5B8Ga/wTMA==} - - '@algolia/logger-console@4.24.0': - resolution: {integrity: sha512-X4C8IoHgHfiUROfoRCV+lzSy+LHMgkoEEU1BbKcsfnV0i0S20zyy0NLww9dwVHUWNfPPxdMU+/wKmLGYf96yTg==} - - '@algolia/recommend@4.24.0': - resolution: {integrity: sha512-P9kcgerfVBpfYHDfVZDvvdJv0lEoCvzNlOy2nykyt5bK8TyieYyiD0lguIJdRZZYGre03WIAFf14pgE+V+IBlw==} - - '@algolia/requester-browser-xhr@4.24.0': - resolution: {integrity: sha512-Z2NxZMb6+nVXSjF13YpjYTdvV3032YTBSGm2vnYvYPA6mMxzM3v5rsCiSspndn9rzIW4Qp1lPHBvuoKJV6jnAA==} - - '@algolia/requester-common@4.24.0': - resolution: {integrity: sha512-k3CXJ2OVnvgE3HMwcojpvY6d9kgKMPRxs/kVohrwF5WMr2fnqojnycZkxPoEg+bXm8fi5BBfFmOqgYztRtHsQA==} - - '@algolia/requester-node-http@4.24.0': - resolution: {integrity: sha512-JF18yTjNOVYvU/L3UosRcvbPMGT9B+/GQWNWnenIImglzNVGpyzChkXLnrSf6uxwVNO6ESGu6oN8MqcGQcjQJw==} - - '@algolia/transporter@4.24.0': - resolution: {integrity: sha512-86nI7w6NzWxd1Zp9q3413dRshDqAzSbsQjhcDhPIatEFiZrL1/TjnHL8S7jVKFePlIMzDsZWXAXwXzcok9c5oA==} + '@algolia/requester-node-http@5.2.1': + resolution: {integrity: sha512-Q9LE92zL8EZhe9+H7pwG6mMdU7RNtVrGtheM7lMfZoejpkR/DBTr2/5FCB5OsUk7iLSIwP43AKWX+2rTv0cLaA==} + engines: {node: '>= 14.0.0'} '@alloc/quick-lru@5.2.0': resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} @@ -6907,9 +6872,6 @@ packages: alge@0.8.1: resolution: {integrity: sha512-kiV9nTt+XIauAXsowVygDxMZLplZxDWt0W8plE/nB32/V2ziM/P/TxDbSVK7FYIUt2Xo16h3/htDh199LNPCKQ==} - algoliasearch@4.24.0: - resolution: {integrity: sha512-bf0QV/9jVejssFBmz2HQLxUadxk574t4iwjCKp5E7NBzwKkrDEhKPISIIjAU/p6K5qDx3qoeh4+26zWN1jmw3g==} - alphanum-sort@1.0.2: resolution: {integrity: sha512-0FcBfdcmaumGPQ0qPn7Q5qTgz/ooXgIyp1rf8ik5bGX8mpE2YHjC0P/eyQvxu1GURYQgq9ozf2mteQ5ZD9YiyQ==} @@ -17152,81 +17114,21 @@ snapshots: '@adobe/css-tools@4.4.0': {} - '@algolia/cache-browser-local-storage@4.24.0': - dependencies: - '@algolia/cache-common': 4.24.0 - - '@algolia/cache-common@4.24.0': {} - - '@algolia/cache-in-memory@4.24.0': - dependencies: - '@algolia/cache-common': 4.24.0 - - '@algolia/client-account@4.24.0': - dependencies: - '@algolia/client-common': 4.24.0 - '@algolia/client-search': 4.24.0 - '@algolia/transporter': 4.24.0 - - '@algolia/client-analytics@4.24.0': - dependencies: - '@algolia/client-common': 4.24.0 - '@algolia/client-search': 4.24.0 - '@algolia/requester-common': 4.24.0 - '@algolia/transporter': 4.24.0 + '@algolia/client-common@5.2.1': {} - '@algolia/client-common@4.24.0': + '@algolia/client-search@5.2.1': dependencies: - '@algolia/requester-common': 4.24.0 - '@algolia/transporter': 4.24.0 + '@algolia/client-common': 5.2.1 + '@algolia/requester-browser-xhr': 5.2.1 + '@algolia/requester-node-http': 5.2.1 - '@algolia/client-personalization@4.24.0': + '@algolia/requester-browser-xhr@5.2.1': dependencies: - '@algolia/client-common': 4.24.0 - '@algolia/requester-common': 4.24.0 - '@algolia/transporter': 4.24.0 + '@algolia/client-common': 5.2.1 - '@algolia/client-search@4.24.0': + '@algolia/requester-node-http@5.2.1': dependencies: - '@algolia/client-common': 4.24.0 - '@algolia/requester-common': 4.24.0 - '@algolia/transporter': 4.24.0 - - '@algolia/logger-common@4.24.0': {} - - '@algolia/logger-console@4.24.0': - dependencies: - '@algolia/logger-common': 4.24.0 - - '@algolia/recommend@4.24.0': - dependencies: - '@algolia/cache-browser-local-storage': 4.24.0 - '@algolia/cache-common': 4.24.0 - '@algolia/cache-in-memory': 4.24.0 - '@algolia/client-common': 4.24.0 - '@algolia/client-search': 4.24.0 - '@algolia/logger-common': 4.24.0 - '@algolia/logger-console': 4.24.0 - '@algolia/requester-browser-xhr': 4.24.0 - '@algolia/requester-common': 4.24.0 - '@algolia/requester-node-http': 4.24.0 - '@algolia/transporter': 4.24.0 - - '@algolia/requester-browser-xhr@4.24.0': - dependencies: - '@algolia/requester-common': 4.24.0 - - '@algolia/requester-common@4.24.0': {} - - '@algolia/requester-node-http@4.24.0': - dependencies: - '@algolia/requester-common': 4.24.0 - - '@algolia/transporter@4.24.0': - dependencies: - '@algolia/cache-common': 4.24.0 - '@algolia/logger-common': 4.24.0 - '@algolia/requester-common': 4.24.0 + '@algolia/client-common': 5.2.1 '@alloc/quick-lru@5.2.0': {} @@ -17674,10 +17576,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@astrojs/vercel@7.7.2(astro@4.12.3(@types/node@22.0.2)(less@4.2.0)(sass@1.77.8)(terser@5.31.3)(typescript@5.3.3))(encoding@0.1.13)(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@18.3.1)(sass@1.77.8))(react@18.3.1)': + '@astrojs/vercel@7.7.2(astro@4.12.3(@types/node@22.0.2)(less@4.2.0)(sass@1.77.8)(terser@5.31.3)(typescript@5.3.3))(encoding@0.1.13)(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react@18.3.1)': dependencies: '@astrojs/internal-helpers': 0.4.1 - '@vercel/analytics': 1.3.1(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@18.3.1)(sass@1.77.8))(react@18.3.1) + '@vercel/analytics': 1.3.1(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react@18.3.1) '@vercel/edge': 1.1.2 '@vercel/nft': 0.27.3(encoding@0.1.13) astro: 4.12.3(@types/node@22.0.2)(less@4.2.0)(sass@1.77.8)(terser@5.31.3)(typescript@5.3.3) @@ -23020,11 +22922,11 @@ snapshots: graphql: 15.8.0 wonka: 4.0.15 - '@vercel/analytics@1.3.1(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@18.3.1)(sass@1.77.8))(react@18.3.1)': + '@vercel/analytics@1.3.1(next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@18.3.1))(react@18.3.1)(sass@1.77.8))(react@18.3.1)': dependencies: server-only: 0.0.1 optionalDependencies: - next: 14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@18.3.1)(sass@1.77.8) + next: 14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@18.3.1))(react@18.3.1)(sass@1.77.8) react: 18.3.1 '@vercel/edge@1.1.2': {} @@ -23723,24 +23625,6 @@ snapshots: ts-toolbelt: 9.6.0 zod: 3.23.8 - algoliasearch@4.24.0: - dependencies: - '@algolia/cache-browser-local-storage': 4.24.0 - '@algolia/cache-common': 4.24.0 - '@algolia/cache-in-memory': 4.24.0 - '@algolia/client-account': 4.24.0 - '@algolia/client-analytics': 4.24.0 - '@algolia/client-common': 4.24.0 - '@algolia/client-personalization': 4.24.0 - '@algolia/client-search': 4.24.0 - '@algolia/logger-common': 4.24.0 - '@algolia/logger-console': 4.24.0 - '@algolia/recommend': 4.24.0 - '@algolia/requester-browser-xhr': 4.24.0 - '@algolia/requester-common': 4.24.0 - '@algolia/requester-node-http': 4.24.0 - '@algolia/transporter': 4.24.0 - alphanum-sort@1.0.2: {} anser@1.4.10: {} @@ -30141,7 +30025,7 @@ snapshots: next-tick@1.1.0: {} - next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522))(react@18.3.1)(sass@1.77.8): + next@14.2.5(@babel/core@7.25.2)(react-dom@19.0.0-rc-4c2e457c7c-20240522(react@18.3.1))(react@18.3.1)(sass@1.77.8): dependencies: '@next/env': 14.2.5 '@swc/helpers': 0.5.5 @@ -30150,7 +30034,7 @@ snapshots: graceful-fs: 4.2.11 postcss: 8.4.31 react: 18.3.1 - react-dom: 19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522) + react-dom: 19.0.0-rc-4c2e457c7c-20240522(react@18.3.1) styled-jsx: 5.1.1(@babel/core@7.25.2)(react@18.3.1) optionalDependencies: '@next/swc-darwin-arm64': 14.2.5 @@ -32448,6 +32332,12 @@ snapshots: react: 18.3.1 scheduler: 0.23.2 + react-dom@19.0.0-rc-4c2e457c7c-20240522(react@18.3.1): + dependencies: + react: 18.3.1 + scheduler: 0.25.0-rc-4c2e457c7c-20240522 + optional: true + react-dom@19.0.0-rc-4c2e457c7c-20240522(react@19.0.0-rc-4c2e457c7c-20240522): dependencies: react: 19.0.0-rc-4c2e457c7c-20240522