Skip to content

Commit 2af8944

Browse files
angular-robotalxhub
authored andcommitted
build: update dependency algoliasearch to v5 (angular#57397)
See associated pull request for more information. Closes angular#57387 as a pr takeover PR Close angular#57397
1 parent 32ddac1 commit 2af8944

File tree

4 files changed

+103
-164
lines changed

4 files changed

+103
-164
lines changed

adev/shared-docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@angular/material": "^18.0.0-next.6 || ^18.1.0-next || ^18.2.0-next",
1010
"@angular/platform-browser": "^18.0.0-next.6 || ^18.1.0-next || ^18.2.0-next",
1111
"@angular/router": "^18.0.0-next.6 || ^18.1.0-next || ^18.2.0-next",
12-
"algoliasearch": "^4.20.0",
12+
"algoliasearch": "^5.0.0",
1313
"rxjs": "^7.8.1"
1414
},
1515
"dependencies": {

adev/shared-docs/services/search.service.ts

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {ENVIRONMENT} from '../providers/index';
1111
import {SearchResult} from '../interfaces/index';
1212
import {toObservable} from '@angular/core/rxjs-interop';
1313
import {debounceTime, filter, from, of, switchMap} from 'rxjs';
14-
import algoliasearch, {SearchClient} from 'algoliasearch/lite';
14+
import {liteClient as algoliasearch} from 'algoliasearch/lite';
1515
import {NavigationEnd, Router} from '@angular/router';
1616

1717
export const SEARCH_DELAY = 200;
@@ -27,11 +27,7 @@ export class Search {
2727

2828
private readonly router = inject(Router);
2929
private readonly config = inject(ENVIRONMENT);
30-
private readonly client: SearchClient = (algoliasearch as any)(
31-
this.config.algolia.appId,
32-
this.config.algolia.apiKey,
33-
);
34-
private readonly index = this.client.initIndex(this.config.algolia.indexName);
30+
private readonly client = algoliasearch(this.config.algolia.appId, this.config.algolia.apiKey);
3531

3632
searchQuery = this._searchQuery.asReadonly();
3733
searchResults = this._searchResults.asReadonly();
@@ -41,35 +37,42 @@ export class Search {
4137
switchMap((query) => {
4238
return !!query
4339
? from(
44-
this.index.search(query, {
45-
maxValuesPerFacet: MAX_VALUE_PER_FACET,
46-
attributesToRetrieve: [
47-
'hierarchy.lvl0',
48-
'hierarchy.lvl1',
49-
'hierarchy.lvl2',
50-
'hierarchy.lvl3',
51-
'hierarchy.lvl4',
52-
'hierarchy.lvl5',
53-
'hierarchy.lvl6',
54-
'content',
55-
'type',
56-
'url',
57-
],
58-
hitsPerPage: 20,
59-
snippetEllipsisText: '…',
60-
highlightPreTag: '<ɵ>',
61-
highlightPostTag: '</ɵ>',
62-
attributesToHighlight: [],
63-
attributesToSnippet: [
64-
'hierarchy.lvl1:10',
65-
'hierarchy.lvl2:10',
66-
'hierarchy.lvl3:10',
67-
'hierarchy.lvl4:10',
68-
'hierarchy.lvl5:10',
69-
'hierarchy.lvl6:10',
70-
'content:10',
71-
],
72-
}),
40+
this.client.search([
41+
{
42+
indexName: this.config.algolia.indexName,
43+
params: {
44+
query: query,
45+
maxValuesPerFacet: MAX_VALUE_PER_FACET,
46+
attributesToRetrieve: [
47+
'hierarchy.lvl0',
48+
'hierarchy.lvl1',
49+
'hierarchy.lvl2',
50+
'hierarchy.lvl3',
51+
'hierarchy.lvl4',
52+
'hierarchy.lvl5',
53+
'hierarchy.lvl6',
54+
'content',
55+
'type',
56+
'url',
57+
],
58+
hitsPerPage: 20,
59+
snippetEllipsisText: '…',
60+
highlightPreTag: '<ɵ>',
61+
highlightPostTag: '</ɵ>',
62+
attributesToHighlight: [],
63+
attributesToSnippet: [
64+
'hierarchy.lvl1:10',
65+
'hierarchy.lvl2:10',
66+
'hierarchy.lvl3:10',
67+
'hierarchy.lvl4:10',
68+
'hierarchy.lvl5:10',
69+
'hierarchy.lvl6:10',
70+
'content:10',
71+
],
72+
},
73+
type: 'default',
74+
},
75+
]),
7376
)
7477
: of(undefined);
7578
}),
@@ -89,7 +92,7 @@ export class Search {
8992
private listenToSearchResults(): void {
9093
this.searchResults$.subscribe((response: any) => {
9194
this._searchResults.set(
92-
response ? this.getUniqueSearchResultItems(response.hits) : undefined,
95+
response ? this.getUniqueSearchResultItems(response.results[0].hits) : undefined,
9396
);
9497
});
9598
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"@types/yargs": "^17.0.3",
9595
"@xterm/addon-fit": "^0.10.0",
9696
"@xterm/xterm": "^5.5.0",
97-
"algoliasearch": "^4.23.3",
97+
"algoliasearch": "^5.0.0",
9898
"angular-1.5": "npm:angular@1.5",
9999
"angular-1.6": "npm:angular@1.6",
100100
"angular-1.7": "npm:angular@1.7",

yarn.lock

Lines changed: 62 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -28,126 +28,69 @@
2828
tunnel "^0.0.6"
2929
undici "^5.25.4"
3030

31-
"@algolia/cache-browser-local-storage@4.24.0":
32-
version "4.24.0"
33-
resolved "https://registry.yarnpkg.com/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.24.0.tgz#97bc6d067a9fd932b9c922faa6b7fd6e546e1348"
34-
integrity sha512-t63W9BnoXVrGy9iYHBgObNXqYXM3tYXCjDSHeNwnsc324r4o5UiVKUiAB4THQ5z9U5hTj6qUvwg/Ez43ZD85ww==
35-
dependencies:
36-
"@algolia/cache-common" "4.24.0"
37-
38-
"@algolia/cache-common@4.24.0":
39-
version "4.24.0"
40-
resolved "https://registry.yarnpkg.com/@algolia/cache-common/-/cache-common-4.24.0.tgz#81a8d3a82ceb75302abb9b150a52eba9960c9744"
41-
integrity sha512-emi+v+DmVLpMGhp0V9q9h5CdkURsNmFC+cOS6uK9ndeJm9J4TiqSvPYVu+THUP8P/S08rxf5x2P+p3CfID0Y4g==
42-
43-
"@algolia/cache-in-memory@4.24.0":
44-
version "4.24.0"
45-
resolved "https://registry.yarnpkg.com/@algolia/cache-in-memory/-/cache-in-memory-4.24.0.tgz#ffcf8872f3a10cb85c4f4641bdffd307933a6e44"
46-
integrity sha512-gDrt2so19jW26jY3/MkFg5mEypFIPbPoXsQGQWAi6TrCPsNOSEYepBMPlucqWigsmEy/prp5ug2jy/N3PVG/8w==
47-
dependencies:
48-
"@algolia/cache-common" "4.24.0"
49-
50-
"@algolia/client-account@4.24.0":
51-
version "4.24.0"
52-
resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.24.0.tgz#eba7a921d828e7c8c40a32d4add21206c7fe12f1"
53-
integrity sha512-adcvyJ3KjPZFDybxlqnf+5KgxJtBjwTPTeyG2aOyoJvx0Y8dUQAEOEVOJ/GBxX0WWNbmaSrhDURMhc+QeevDsA==
54-
dependencies:
55-
"@algolia/client-common" "4.24.0"
56-
"@algolia/client-search" "4.24.0"
57-
"@algolia/transporter" "4.24.0"
58-
59-
"@algolia/client-analytics@4.24.0":
60-
version "4.24.0"
61-
resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-4.24.0.tgz#9d2576c46a9093a14e668833c505ea697a1a3e30"
62-
integrity sha512-y8jOZt1OjwWU4N2qr8G4AxXAzaa8DBvyHTWlHzX/7Me1LX8OayfgHexqrsL4vSBcoMmVw2XnVW9MhL+Y2ZDJXg==
31+
"@algolia/client-abtesting@5.0.0":
32+
version "5.0.0"
33+
resolved "https://registry.yarnpkg.com/@algolia/client-abtesting/-/client-abtesting-5.0.0.tgz#c6d5727ee77d8ea0eac0d545a977c19155bb1c29"
34+
integrity sha512-pVSwJ2QZ9hNeINjSWRQGwN/zAk16E6fOM4VGayIULyiJnaIaRjGT/UfMRiGsIuBFib2zviq83uO8GOnCUBmXnA==
6335
dependencies:
64-
"@algolia/client-common" "4.24.0"
65-
"@algolia/client-search" "4.24.0"
66-
"@algolia/requester-common" "4.24.0"
67-
"@algolia/transporter" "4.24.0"
36+
"@algolia/client-common" "5.0.0"
37+
"@algolia/requester-browser-xhr" "5.0.0"
38+
"@algolia/requester-node-http" "5.0.0"
6839

69-
"@algolia/client-common@4.24.0":
70-
version "4.24.0"
71-
resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.24.0.tgz#77c46eee42b9444a1d1c1583a83f7df4398a649d"
72-
integrity sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==
40+
"@algolia/client-analytics@5.0.0":
41+
version "5.0.0"
42+
resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-5.0.0.tgz#582d165cf6486e441646916635e5c74487ca3226"
43+
integrity sha512-3A4JyblLorrxkYn6uOWyo7drDi3z7+Yzm45YP1MgOvzOCt0qWlEb6neIFLDe4UrBy24JqmRx54uNMBuYMOscgw==
7344
dependencies:
74-
"@algolia/requester-common" "4.24.0"
75-
"@algolia/transporter" "4.24.0"
45+
"@algolia/client-common" "5.0.0"
46+
"@algolia/requester-browser-xhr" "5.0.0"
47+
"@algolia/requester-node-http" "5.0.0"
7648

77-
"@algolia/client-personalization@4.24.0":
78-
version "4.24.0"
79-
resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-4.24.0.tgz#8b47789fb1cb0f8efbea0f79295b7c5a3850f6ae"
80-
integrity sha512-l5FRFm/yngztweU0HdUzz1rC4yoWCFo3IF+dVIVTfEPg906eZg5BOd1k0K6rZx5JzyyoP4LdmOikfkfGsKVE9w==
81-
dependencies:
82-
"@algolia/client-common" "4.24.0"
83-
"@algolia/requester-common" "4.24.0"
84-
"@algolia/transporter" "4.24.0"
49+
"@algolia/client-common@5.0.0":
50+
version "5.0.0"
51+
resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-5.0.0.tgz#ff52d29ed81cdafaa38655fc4ee958ca49f20aaf"
52+
integrity sha512-6N5Qygv/Z/B+rPufnPDLNWgsMf1uubMU7iS52xLcQSLiGlTS4f9eLUrmNXSzHccP33uoFi6xN9craN1sZi5MPQ==
8553

86-
"@algolia/client-search@4.24.0":
87-
version "4.24.0"
88-
resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.24.0.tgz#75e6c02d33ef3e0f34afd9962c085b856fc4a55f"
89-
integrity sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==
54+
"@algolia/client-personalization@5.0.0":
55+
version "5.0.0"
56+
resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-5.0.0.tgz#a5df3d5fce7a800145deca51cc10e8e9f037e568"
57+
integrity sha512-Ns9pl+YGl0qZTbMqEKIO54GJqzyrMUmLfPB3/iEEkezKMMHXAsINrOuKTfhA6vyI0vhUJL3imOPo6vmXZBDZsA==
9058
dependencies:
91-
"@algolia/client-common" "4.24.0"
92-
"@algolia/requester-common" "4.24.0"
93-
"@algolia/transporter" "4.24.0"
59+
"@algolia/client-common" "5.0.0"
60+
"@algolia/requester-browser-xhr" "5.0.0"
61+
"@algolia/requester-node-http" "5.0.0"
9462

95-
"@algolia/logger-common@4.24.0":
96-
version "4.24.0"
97-
resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.24.0.tgz#28d439976019ec0a46ba7a1a739ef493d4ef8123"
98-
integrity sha512-LLUNjkahj9KtKYrQhFKCzMx0BY3RnNP4FEtO+sBybCjJ73E8jNdaKJ/Dd8A/VA4imVHP5tADZ8pn5B8Ga/wTMA==
99-
100-
"@algolia/logger-console@4.24.0":
101-
version "4.24.0"
102-
resolved "https://registry.yarnpkg.com/@algolia/logger-console/-/logger-console-4.24.0.tgz#c6ff486036cd90b81d07a95aaba04461da7e1c65"
103-
integrity sha512-X4C8IoHgHfiUROfoRCV+lzSy+LHMgkoEEU1BbKcsfnV0i0S20zyy0NLww9dwVHUWNfPPxdMU+/wKmLGYf96yTg==
63+
"@algolia/client-search@5.0.0":
64+
version "5.0.0"
65+
resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-5.0.0.tgz#8d58f5daeffe9d19e0e0e9ebcdb5d23525edebe4"
66+
integrity sha512-QdDYMzoxYZ3axzBy6CHe+M+NlOGvHEFTa2actchGnp25Uu0N6lyVNivT7nph+P1XoxgAD08cWbeJD3wWQXnpng==
10467
dependencies:
105-
"@algolia/logger-common" "4.24.0"
68+
"@algolia/client-common" "5.0.0"
69+
"@algolia/requester-browser-xhr" "5.0.0"
70+
"@algolia/requester-node-http" "5.0.0"
10671

107-
"@algolia/recommend@4.24.0":
108-
version "4.24.0"
109-
resolved "https://registry.yarnpkg.com/@algolia/recommend/-/recommend-4.24.0.tgz#8a3f78aea471ee0a4836b78fd2aad4e9abcaaf34"
110-
integrity sha512-P9kcgerfVBpfYHDfVZDvvdJv0lEoCvzNlOy2nykyt5bK8TyieYyiD0lguIJdRZZYGre03WIAFf14pgE+V+IBlw==
111-
dependencies:
112-
"@algolia/cache-browser-local-storage" "4.24.0"
113-
"@algolia/cache-common" "4.24.0"
114-
"@algolia/cache-in-memory" "4.24.0"
115-
"@algolia/client-common" "4.24.0"
116-
"@algolia/client-search" "4.24.0"
117-
"@algolia/logger-common" "4.24.0"
118-
"@algolia/logger-console" "4.24.0"
119-
"@algolia/requester-browser-xhr" "4.24.0"
120-
"@algolia/requester-common" "4.24.0"
121-
"@algolia/requester-node-http" "4.24.0"
122-
"@algolia/transporter" "4.24.0"
123-
124-
"@algolia/requester-browser-xhr@4.24.0":
125-
version "4.24.0"
126-
resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.24.0.tgz#313c5edab4ed73a052e75803855833b62dd19c16"
127-
integrity sha512-Z2NxZMb6+nVXSjF13YpjYTdvV3032YTBSGm2vnYvYPA6mMxzM3v5rsCiSspndn9rzIW4Qp1lPHBvuoKJV6jnAA==
72+
"@algolia/recommend@5.0.0":
73+
version "5.0.0"
74+
resolved "https://registry.yarnpkg.com/@algolia/recommend/-/recommend-5.0.0.tgz#df3c63f7de2ddf6658a67308a7a5f4b805c87687"
75+
integrity sha512-aEXg4RPFIRrJjrtri782W7XFNkarxoN9X42FwYYP1bz15jKu2vrIqzGlQoNCNWuZP7WwYyUAoTtixwLRJq8grQ==
12876
dependencies:
129-
"@algolia/requester-common" "4.24.0"
77+
"@algolia/client-common" "5.0.0"
78+
"@algolia/requester-browser-xhr" "5.0.0"
79+
"@algolia/requester-node-http" "5.0.0"
13080

131-
"@algolia/requester-common@4.24.0":
132-
version "4.24.0"
133-
resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.24.0.tgz#1c60c198031f48fcdb9e34c4057a3ea987b9a436"
134-
integrity sha512-k3CXJ2OVnvgE3HMwcojpvY6d9kgKMPRxs/kVohrwF5WMr2fnqojnycZkxPoEg+bXm8fi5BBfFmOqgYztRtHsQA==
135-
136-
"@algolia/requester-node-http@4.24.0":
137-
version "4.24.0"
138-
resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.24.0.tgz#4461593714031d02aa7da221c49df675212f482f"
139-
integrity sha512-JF18yTjNOVYvU/L3UosRcvbPMGT9B+/GQWNWnenIImglzNVGpyzChkXLnrSf6uxwVNO6ESGu6oN8MqcGQcjQJw==
81+
"@algolia/requester-browser-xhr@5.0.0":
82+
version "5.0.0"
83+
resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.0.0.tgz#ddce386fd8635d79a1803c44b749289ff690db80"
84+
integrity sha512-oOoQhSpg/RGiGHjn/cqtYpHBkkd+5M/DCi1jmfW+ZOvLVx21QVt6PbWIJoKJF85moNFo4UG9pMBU35R1MaxUKQ==
14085
dependencies:
141-
"@algolia/requester-common" "4.24.0"
86+
"@algolia/client-common" "5.0.0"
14287

143-
"@algolia/transporter@4.24.0":
144-
version "4.24.0"
145-
resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.24.0.tgz#226bb1f8af62430374c1972b2e5c8580ab275102"
146-
integrity sha512-86nI7w6NzWxd1Zp9q3413dRshDqAzSbsQjhcDhPIatEFiZrL1/TjnHL8S7jVKFePlIMzDsZWXAXwXzcok9c5oA==
88+
"@algolia/requester-node-http@5.0.0":
89+
version "5.0.0"
90+
resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-5.0.0.tgz#708961cb2c069e5ed3bae83aef144ec8b3300b57"
91+
integrity sha512-FwCdugzpnW0wxbgWPauAz5vhmWGQnjZa5DCl9PBbIoDNEy/NIV8DmiL9CEA+LljQdDidG0l0ijojcTNaRRtPvQ==
14792
dependencies:
148-
"@algolia/cache-common" "4.24.0"
149-
"@algolia/logger-common" "4.24.0"
150-
"@algolia/requester-common" "4.24.0"
93+
"@algolia/client-common" "5.0.0"
15194

15295
"@ampproject/remapping@2.3.0", "@ampproject/remapping@^2.2.0":
15396
version "2.3.0"
@@ -5583,26 +5526,19 @@ ajv@~8.13.0:
55835526
require-from-string "^2.0.2"
55845527
uri-js "^4.4.1"
55855528

5586-
algoliasearch@^4.23.3:
5587-
version "4.24.0"
5588-
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.24.0.tgz#b953b3e2309ef8f25da9de311b95b994ac918275"
5589-
integrity sha512-bf0QV/9jVejssFBmz2HQLxUadxk574t4iwjCKp5E7NBzwKkrDEhKPISIIjAU/p6K5qDx3qoeh4+26zWN1jmw3g==
5590-
dependencies:
5591-
"@algolia/cache-browser-local-storage" "4.24.0"
5592-
"@algolia/cache-common" "4.24.0"
5593-
"@algolia/cache-in-memory" "4.24.0"
5594-
"@algolia/client-account" "4.24.0"
5595-
"@algolia/client-analytics" "4.24.0"
5596-
"@algolia/client-common" "4.24.0"
5597-
"@algolia/client-personalization" "4.24.0"
5598-
"@algolia/client-search" "4.24.0"
5599-
"@algolia/logger-common" "4.24.0"
5600-
"@algolia/logger-console" "4.24.0"
5601-
"@algolia/recommend" "4.24.0"
5602-
"@algolia/requester-browser-xhr" "4.24.0"
5603-
"@algolia/requester-common" "4.24.0"
5604-
"@algolia/requester-node-http" "4.24.0"
5605-
"@algolia/transporter" "4.24.0"
5529+
algoliasearch@^5.0.0:
5530+
version "5.0.0"
5531+
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-5.0.0.tgz#caa7cb9a5116291763c93f3e7ca0fc284b5784f8"
5532+
integrity sha512-j/RYIyKy7D6Vu/o142+6Gka1lXtu0j/Hj/Mw5oaPpOscOcE4jn29k465pcWYNC34HMxA4W8chiDk9cqw8nszag==
5533+
dependencies:
5534+
"@algolia/client-abtesting" "5.0.0"
5535+
"@algolia/client-analytics" "5.0.0"
5536+
"@algolia/client-common" "5.0.0"
5537+
"@algolia/client-personalization" "5.0.0"
5538+
"@algolia/client-search" "5.0.0"
5539+
"@algolia/recommend" "5.0.0"
5540+
"@algolia/requester-browser-xhr" "5.0.0"
5541+
"@algolia/requester-node-http" "5.0.0"
56065542

56075543
"angular-1.5@npm:angular@1.5":
56085544
version "1.5.11"

0 commit comments

Comments
 (0)