Skip to content

Commit 6d270cf

Browse files
Merge branch 'main' into chore/add-log-to-category-tree-mount
2 parents 85f161b + cd118f1 commit 6d270cf

27 files changed

+2469
-1192
lines changed

.vtex/catalog-info.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: backstage.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: search-resolver
5+
description: This app is an implementation of the VTEX search protocol that
6+
wraps the VTEX catalog searches related API calls.
7+
tags:
8+
- typescript
9+
- express
10+
annotations:
11+
vtex.com/janus-acronym: ""
12+
vtex.com/o11y-os-index: ""
13+
grafana/dashboard-selector: ""
14+
github.com/project-slug: vtex-apps/search-resolver
15+
vtex.com/platform-flow-id: ""
16+
backstage.io/techdocs-ref: dir:../
17+
vtex.com/application-id: 6PIM3PYV
18+
spec:
19+
lifecycle: stable
20+
owner: te-0016
21+
type: backend-api
22+
dependsOn: []

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,56 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
- Added log to `productCategoriesToCategoryTree` fallback return if the platform is not `vtex` to detect if it is used
1313

14+
## [1.88.0] - 2025-10-27
15+
16+
### Changed
17+
18+
- Disable shadow traffic to prepare for Black Friday.
19+
20+
## [1.87.0] - 2025-10-27 [YANKED]
21+
22+
### Added
23+
24+
- Feature flag to call the productSearch and facets using the intsch api.
25+
26+
### Changed
27+
28+
- Make productSearch and facets send a % of the traffic to our routes on intsch.
29+
30+
### Fixed
31+
32+
- Make the productIdentifier call the intsch when the feature flag is on.
33+
34+
## [1.86.0] - 2025-10-21
35+
36+
### Changed
37+
38+
- Using shadow traffic to EKS to validate the v1 routes: banners, correction, suggestions.
39+
40+
## [1.85.1] - 2025-10-14
41+
42+
### Fixed
43+
44+
- Segment enconding while making PDP requests.
45+
46+
## [1.85.0] - 2025-10-13 [YANKED]
47+
48+
### Changed
49+
50+
- Using a feature flag to route the PDP traffic to some specific accounts.
51+
52+
## [1.84.0] - 2025-10-07
53+
54+
### Changed
55+
56+
- Switch banners endpoint to use intsch as primary with intelligentSearchApi as fallback.
57+
58+
## [1.83.0] - 2025-10-06
59+
60+
### Changed
61+
62+
- Start testing 10% of the fetchBanners traffic to intsch and compare the result against the VTEX /IO version.
63+
1464
## [1.82.0] - 2025-10-01
1565

1666
### Changed

manifest.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"vendor": "vtex",
33
"name": "search-resolver",
4-
"version": "1.82.0",
4+
"version": "1.88.0",
55
"title": "GraphQL resolver for the VTEX store APIs",
66
"description": "GraphQL resolvers for the VTEX API for the catalog and orders.",
77
"credentialType": "absolute",
@@ -25,6 +25,16 @@
2525
"title": "Set to slugify links. Uses default catalog slug instead",
2626
"type": "boolean",
2727
"default": false
28+
},
29+
"shouldUseNewPDPEndpoint": {
30+
"title": "Feature flag to use the new PDP endpoint",
31+
"type": "boolean",
32+
"default": false
33+
},
34+
"shouldUseNewPLPEndpoint": {
35+
"title": "Feature flag to use the new PLP endpoint",
36+
"type": "boolean",
37+
"default": false
2838
}
2939
}
3040
},

node/clients/intelligent-search-api.ts

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@ import type { InstanceOptions, IOContext } from '@vtex/api'
22
import { ExternalClient } from '@vtex/api'
33

44
import { parseState } from '../utils/searchState'
5-
import type { IIntelligentSearchClient } from './intsch/types'
6-
7-
const isPathTraversal = (str: string) => str.indexOf('..') >= 0
5+
import type {
6+
FetchBannersArgs,
7+
IIntelligentSearchClient,
8+
FetchProductArgs,
9+
FetchProductResponse,
10+
AutocompleteSuggestionsResponse,
11+
CorrectionResponse,
12+
FetchBannersResponse,
13+
SearchSuggestionsResponse,
14+
TopSearchesResponse,
15+
} from './intsch/types'
16+
import type { Options, SearchResultArgs } from '../typings/Search'
17+
18+
export const isPathTraversal = (str: string) => str.indexOf('..') >= 0
819

920
interface CorrectionParams {
1021
query: string
@@ -18,11 +29,7 @@ interface AutocompleteSearchSuggestionsParams {
1829
query: string
1930
}
2031

21-
interface BannersArgs {
22-
query: string
23-
}
24-
25-
interface FacetsArgs {
32+
export type FacetsArgs = {
2633
query?: string
2734
page?: number
2835
count?: number
@@ -40,7 +47,7 @@ interface FacetsArgs {
4047
regionId?: string | null
4148
}
4249

43-
const decodeQuery = (query: string) => {
50+
export const decodeQuery = (query: string) => {
4451
try {
4552
return decodeURIComponent(query)
4653
} catch (e) {
@@ -54,7 +61,7 @@ export class IntelligentSearchApi
5461
{
5562
private locale: string | undefined
5663

57-
public constructor(context: IOContext, options?: InstanceOptions) {
64+
constructor(context: IOContext, options?: InstanceOptions) {
5865
super(
5966
`http://${context.workspace}--${context.account}.myvtex.com/_v/api/intelligent-search`,
6067
context,
@@ -103,13 +110,13 @@ export class IntelligentSearchApi
103110
})
104111
}
105112

106-
public async banners(params: BannersArgs, path: string) {
107-
if (isPathTraversal(path)) {
113+
public async fetchBanners(params: FetchBannersArgs) {
114+
if (isPathTraversal(params.path)) {
108115
throw new Error('Malformed URL')
109116
}
110117

111-
return this.http.get(`/banners/${path}`, {
112-
params: { ...params, query: params.query, locale: this.locale },
118+
return this.http.get(`/banners/${params.path}`, {
119+
params: { query: params.query, locale: this.locale },
113120
metric: 'banners',
114121
})
115122
}
@@ -130,7 +137,6 @@ export class IntelligentSearchApi
130137
...params,
131138
query: query && decodeQuery(query),
132139
locale: this.locale,
133-
// eslint-disable-next-line @typescript-eslint/camelcase
134140
bgy_leap: leap ? true : undefined,
135141
...parseState(searchState),
136142
},
@@ -156,7 +162,6 @@ export class IntelligentSearchApi
156162
params: {
157163
query: query && decodeQuery(query),
158164
locale: this.locale,
159-
// eslint-disable-next-line @typescript-eslint/camelcase
160165
bgy_leap: leap ? true : undefined,
161166
...parseState(searchState),
162167
...params,
@@ -183,7 +188,6 @@ export class IntelligentSearchApi
183188
params: {
184189
query: query && decodeQuery(query),
185190
locale: this.locale,
186-
// eslint-disable-next-line @typescript-eslint/camelcase
187191
bgy_leap: leap ? true : undefined,
188192
...parseState(searchState),
189193
...params,
@@ -194,4 +198,30 @@ export class IntelligentSearchApi
194198
},
195199
})
196200
}
201+
202+
public async fetchAutocompleteSuggestionsV1(): Promise<AutocompleteSuggestionsResponse> {
203+
throw new Error('Method not implemented.')
204+
}
205+
206+
public async fetchTopSearchesV1(): Promise<TopSearchesResponse> {
207+
throw new Error('Method not implemented.')
208+
}
209+
210+
public async fetchSearchSuggestionsV1(): Promise<SearchSuggestionsResponse> {
211+
throw new Error('Method not implemented.')
212+
}
213+
214+
public async fetchCorrectionV1(): Promise<CorrectionResponse> {
215+
throw new Error('Method not implemented.')
216+
}
217+
218+
public async fetchBannersV1(): Promise<FetchBannersResponse> {
219+
throw new Error('Method not implemented.')
220+
}
221+
222+
public async fetchProduct(
223+
_: FetchProductArgs
224+
): Promise<FetchProductResponse> {
225+
throw new Error('Method not implemented.')
226+
}
197227
}

0 commit comments

Comments
 (0)