Skip to content

Commit

Permalink
Version 2.3.0 (#237)
Browse files Browse the repository at this point in the history
### Features

Support the EU Cloud region (#233)
- We introduced two new configuration options: cloudRegion and environment. The search endpoints are hosted in both the US and in Europe, and the cloudRegion config option determines which endpoints are used. The environment config option supports both Production and Sandbox. The SandboxEndpoints object is now deprecated, and the environment config option should be used instead to specify the sandbox environment.
  • Loading branch information
cea2aj committed May 8, 2023
2 parents 3183412 + 1d659de commit 79ed8a2
Show file tree
Hide file tree
Showing 30 changed files with 293 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -1 +1 @@
* @yext/slapshot
* @yext/backfire
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,5 @@ node_modules/
dist/
temp/
coverage/
.DS_Store
.DS_Store
.idea/
13 changes: 13 additions & 0 deletions docs/search-core.basesearchconfig.cloudregion.md
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [BaseSearchConfig](./search-core.basesearchconfig.md) &gt; [cloudRegion](./search-core.basesearchconfig.cloudregion.md)

## BaseSearchConfig.cloudRegion property

Defines the cloud region of the API domains.

<b>Signature:</b>

```typescript
cloudRegion?: CloudRegion;
```
13 changes: 13 additions & 0 deletions docs/search-core.basesearchconfig.environment.md
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [BaseSearchConfig](./search-core.basesearchconfig.md) &gt; [environment](./search-core.basesearchconfig.environment.md)

## BaseSearchConfig.environment property

Defines the environment of the API domains.

<b>Signature:</b>

```typescript
environment?: Environment;
```
7 changes: 5 additions & 2 deletions docs/search-core.basesearchconfig.md
Expand Up @@ -4,20 +4,23 @@

## BaseSearchConfig interface

The base configuration options for [SearchCore](./search-core.searchcore.md)<!-- -->.
The base configuration options for [SearchCore](./search-core.searchcore.md)<!-- -->, which includes the options from [ServingConfig](./search-core.servingconfig.md)<!-- -->.

<b>Signature:</b>

```typescript
export interface BaseSearchConfig
export interface BaseSearchConfig extends ServingConfig
```
<b>Extends:</b> [ServingConfig](./search-core.servingconfig.md)
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [additionalQueryParams?](./search-core.basesearchconfig.additionalqueryparams.md) | { \[key: string\]: string \| number \| boolean; } | <i>(Optional)</i> Additional query params added on to every request. |
| [cloudRegion?](./search-core.basesearchconfig.cloudregion.md) | [CloudRegion](./search-core.cloudregion.md) | <i>(Optional)</i> Defines the cloud region of the API domains. |
| [endpoints?](./search-core.basesearchconfig.endpoints.md) | [Endpoints](./search-core.endpoints.md) | <i>(Optional)</i> Overrides for the URLs which are used when making requests to the Search API. |
| [environment?](./search-core.basesearchconfig.environment.md) | [Environment](./search-core.environment.md) | <i>(Optional)</i> Defines the environment of the API domains. |
| [experienceKey](./search-core.basesearchconfig.experiencekey.md) | string | The experience key of the search experience. |
| [experienceVersion?](./search-core.basesearchconfig.experienceversion.md) | 'STAGING' \| 'PRODUCTION' \| string \| number | <i>(Optional)</i> The version of the search experience configuration. |
| [locale](./search-core.basesearchconfig.locale.md) | string | The locale of the search experience. |
Expand Down
21 changes: 21 additions & 0 deletions docs/search-core.cloudregion.md
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [CloudRegion](./search-core.cloudregion.md)

## CloudRegion enum

Defines the cloud region of the API domains.

<b>Signature:</b>

```typescript
export declare enum CloudRegion
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| EU | <code>&quot;eu&quot;</code> | |
| US | <code>&quot;us&quot;</code> | |

21 changes: 21 additions & 0 deletions docs/search-core.environment.md
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [Environment](./search-core.environment.md)

## Environment enum

Defines the environment of the API domains.

<b>Signature:</b>

```typescript
export declare enum Environment
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| PROD | <code>&quot;prod&quot;</code> | |
| SANDBOX | <code>&quot;sbx&quot;</code> | |

5 changes: 4 additions & 1 deletion docs/search-core.md
Expand Up @@ -17,8 +17,10 @@
| --- | --- |
| [AppliedQueryFilterType](./search-core.appliedqueryfiltertype.md) | Represents the type of [AppliedQueryFilter](./search-core.appliedqueryfilter.md) applied to a search. |
| [BuiltInFieldType](./search-core.builtinfieldtype.md) | Possible built-in field types for [DirectAnswer.fieldType](./search-core.directanswer.fieldtype.md)<!-- -->. |
| [CloudRegion](./search-core.cloudregion.md) | Defines the cloud region of the API domains. |
| [DirectAnswerType](./search-core.directanswertype.md) | Represents the type of direct answer. |
| [Direction](./search-core.direction.md) | The direction of a sort. |
| [Environment](./search-core.environment.md) | Defines the environment of the API domains. |
| [ErrorType](./search-core.errortype.md) | Identifier for the type of error causing the failure. |
| [FilterCombinator](./search-core.filtercombinator.md) | Indicates how child filters in a [StaticFilter](./search-core.staticfilter.md) should be combined. |
| [LocationBiasMethod](./search-core.locationbiasmethod.md) | The method used to determine the location. |
Expand Down Expand Up @@ -50,7 +52,7 @@
| [AutocompleteService](./search-core.autocompleteservice.md) | A service for autocomplete requests. |
| [BaseFeaturedSnippetDirectAnswer](./search-core.basefeaturedsnippetdirectanswer.md) | A direct answer which was found within a document. |
| [BaseFieldValueDirectAnswer](./search-core.basefieldvaluedirectanswer.md) | A direct answer where the answer came from a field from the knowledge graph. |
| [BaseSearchConfig](./search-core.basesearchconfig.md) | The base configuration options for [SearchCore](./search-core.searchcore.md)<!-- -->. |
| [BaseSearchConfig](./search-core.basesearchconfig.md) | The base configuration options for [SearchCore](./search-core.searchcore.md)<!-- -->, which includes the options from [ServingConfig](./search-core.servingconfig.md)<!-- -->. |
| [ClientSDKHeaderValues](./search-core.clientsdkheadervalues.md) | Additional agents and their versions used to create the Search experience. The information for these agents is added to the Client-SDK HTTP header along with that of the ANSWERS\_CORE agent. |
| [ComplexURL](./search-core.complexurl.md) | The shape of a [BuiltInFieldType.ComplexURL](./search-core.builtinfieldtype.md) DirectAnswer value |
| [ComplexUrlDirectAnswer](./search-core.complexurldirectanswer.md) | A direct answer for a complex url field. |
Expand Down Expand Up @@ -100,6 +102,7 @@
| [SearchParameterField](./search-core.searchparameterfield.md) | Indicates which entity field to perform the autocomplete request on. |
| [SearchRequest](./search-core.searchrequest.md) | Options for a Search API request. |
| [SearchService](./search-core.searchservice.md) | A service which performs Yext Search. |
| [ServingConfig](./search-core.servingconfig.md) | The configuration options for getting the endpoints. |
| [Snippet](./search-core.snippet.md) | The section of text where a [FeaturedSnippetDirectAnswer](./search-core.featuredsnippetdirectanswer.md) was found. |
| [SortBy](./search-core.sortby.md) | Represents a criterion that can be used to sort results. |
| [SpellCheck](./search-core.spellcheck.md) | A spellcheck response from a search query. |
Expand Down
5 changes: 5 additions & 0 deletions docs/search-core.sandboxendpoints.md
Expand Up @@ -4,6 +4,11 @@

## SandboxEndpoints variable

> Warning: This API is now obsolete.
>
> Set the appropriate environment and cloud region in [ServingConfig](./search-core.servingconfig.md) instead.
>
The endpoints to use for sandbox experiences.

<b>Signature:</b>
Expand Down
13 changes: 13 additions & 0 deletions docs/search-core.servingconfig.cloudregion.md
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [ServingConfig](./search-core.servingconfig.md) &gt; [cloudRegion](./search-core.servingconfig.cloudregion.md)

## ServingConfig.cloudRegion property

Defines the cloud region of the API domains.

<b>Signature:</b>

```typescript
cloudRegion?: CloudRegion;
```
13 changes: 13 additions & 0 deletions docs/search-core.servingconfig.environment.md
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [ServingConfig](./search-core.servingconfig.md) &gt; [environment](./search-core.servingconfig.environment.md)

## ServingConfig.environment property

Defines the environment of the API domains.

<b>Signature:</b>

```typescript
environment?: Environment;
```
21 changes: 21 additions & 0 deletions docs/search-core.servingconfig.md
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@yext/search-core](./search-core.md) &gt; [ServingConfig](./search-core.servingconfig.md)

## ServingConfig interface

The configuration options for getting the endpoints.

<b>Signature:</b>

```typescript
export interface ServingConfig
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [cloudRegion?](./search-core.servingconfig.cloudregion.md) | [CloudRegion](./search-core.cloudregion.md) | <i>(Optional)</i> Defines the cloud region of the API domains. |
| [environment?](./search-core.servingconfig.environment.md) | [Environment](./search-core.environment.md) | <i>(Optional)</i> Defines the environment of the API domains. |

28 changes: 26 additions & 2 deletions etc/search-core.api.md
Expand Up @@ -105,11 +105,13 @@ export interface BaseFieldValueDirectAnswer<T = unknown> extends DirectAnswer<T>
}

// @public
export interface BaseSearchConfig {
export interface BaseSearchConfig extends ServingConfig {
additionalQueryParams?: {
[key: string]: string | number | boolean;
};
cloudRegion?: CloudRegion;
endpoints?: Endpoints;
environment?: Environment;
experienceKey: string;
experienceVersion?: 'STAGING' | 'PRODUCTION' | string | number;
locale: string;
Expand Down Expand Up @@ -158,6 +160,14 @@ export interface ClientSDKHeaderValues {
ANSWERS_CORE?: never;
}

// @public
export enum CloudRegion {
// (undocumented)
EU = "eu",
// (undocumented)
US = "us"
}

// @public
export interface ComplexURL {
// (undocumented)
Expand Down Expand Up @@ -266,6 +276,14 @@ export interface Endpoints {
// @public
export type EnumOrLiteral<T extends string> = T | `${T}`;

// @public
export enum Environment {
// (undocumented)
PROD = "prod",
// (undocumented)
SANDBOX = "sbx"
}

// @public
export enum ErrorType {
BackendError = "BACKEND_ERROR",
Expand Down Expand Up @@ -581,7 +599,7 @@ export interface RichTextSnippetDirectAnswer extends Omit<BaseFeaturedSnippetDir
fieldType: EnumOrLiteral<BuiltInFieldType.RichText>;
}

// @public
// @public @deprecated
export const SandboxEndpoints: Required<Endpoints>;

// @public
Expand Down Expand Up @@ -642,6 +660,12 @@ export interface SearchService {
verticalSearch(request: VerticalSearchRequest): Promise<VerticalSearchResponse>;
}

// @public
export interface ServingConfig {
cloudRegion?: CloudRegion;
environment?: Environment;
}

// @public
export interface Snippet {
matchedSubstrings: {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@yext/search-core",
"version": "2.2.0",
"version": "2.3.0",
"description": "Typescript Networking Library for the Yext Search API",
"main": "./dist/commonjs/src/index.js",
"module": "./dist/esm/src/index.js",
Expand Down
28 changes: 0 additions & 28 deletions src/constants.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.ts
@@ -1,6 +1,6 @@
// main symbols
export { SearchCore } from './SearchCore';
export { provideCore } from './provideCore';
export { SandboxEndpoints } from './constants';
export { SandboxEndpoints } from './provideEndpoints';
export * from './models';
export * from './services';
2 changes: 1 addition & 1 deletion src/infra/AutocompleteServiceImpl.ts
Expand Up @@ -5,7 +5,7 @@ import {
UniversalAutocompleteRequest
} from '../models/autocompleteservice/AutocompleteRequest';
import { AutocompleteResponse, FilterSearchResponse } from '../models/autocompleteservice/AutocompleteResponse';
import { defaultApiVersion } from '../constants';
import { defaultApiVersion } from '../provideEndpoints';
import { SearchConfigWithDefaulting } from '../models/core/SearchConfig';
import { HttpService } from '../services/HttpService';
import { AutocompleteQueryParams } from '../models/autocompleteservice/AutocompleteQueryParams';
Expand Down
2 changes: 1 addition & 1 deletion src/infra/QuestionSubmissionServiceImpl.ts
@@ -1,4 +1,4 @@
import { defaultApiVersion } from '../constants';
import { defaultApiVersion } from '../provideEndpoints';
import { QuestionSubmissionService } from '../services/QuestionSubmissionService';
import { HttpService } from '../services/HttpService';
import { SearchConfigWithDefaulting } from '../models/core/SearchConfig';
Expand Down
2 changes: 1 addition & 1 deletion src/infra/SearchServiceImpl.ts
@@ -1,6 +1,6 @@
import { createVerticalSearchResponse } from '../transformers/searchservice/createVerticalSearchResponse';
import { SearchService } from '../services/SearchService';
import { defaultApiVersion } from '../constants';
import { defaultApiVersion } from '../provideEndpoints';
import { QueryParams } from '../models/http/params';
import { QueryTrigger } from '../models/searchservice/request/QueryTrigger';
import { QuerySource } from '../models/searchservice/request/QuerySource';
Expand Down
9 changes: 9 additions & 0 deletions src/models/core/CloudRegion.ts
@@ -0,0 +1,9 @@
/**
* Defines the cloud region of the API domains.
*
* @public
*/
export enum CloudRegion {
US = 'us',
EU = 'eu',
}
9 changes: 9 additions & 0 deletions src/models/core/Environment.ts
@@ -0,0 +1,9 @@
/**
* Defines the environment of the API domains.
*
* @public
*/
export enum Environment {
PROD = 'prod',
SANDBOX = 'sbx',
}

0 comments on commit 79ed8a2

Please sign in to comment.