@findhotel/sapi 0.22.8 → 0.22.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +109 -2
- package/dist/index.js +1 -1
- package/dist/types/packages/core/src/__fixtures__/suggest.d.ts +2 -0
- package/dist/types/packages/core/src/algolia/geo-search.d.ts +0 -1
- package/dist/types/packages/core/src/backend-search.d.ts +14 -0
- package/dist/types/packages/core/src/{saf-search.test.d.ts → backend-search.test.d.ts} +0 -0
- package/dist/types/packages/core/src/configs.d.ts +22 -2
- package/dist/types/packages/core/src/sapi.d.ts +6 -3
- package/dist/types/packages/core/src/types/sapi-client.d.ts +0 -2
- package/dist/types/packages/core/src/types/sapi-configs.d.ts +0 -5
- package/dist/types/packages/core/src/types/types.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/packages/core/src/saf-search.d.ts +0 -10
|
@@ -43,6 +43,7 @@ export declare const placeSuggestHit: {
|
|
|
43
43
|
export declare const placeSuggest: {
|
|
44
44
|
highlightValue: string;
|
|
45
45
|
objectID: string;
|
|
46
|
+
objectType: string;
|
|
46
47
|
placeDisplayName: string;
|
|
47
48
|
placeTypeName: string;
|
|
48
49
|
value: string;
|
|
@@ -77,6 +78,7 @@ export declare const hotelSuggestHit: {
|
|
|
77
78
|
export declare const hotelSuggest: {
|
|
78
79
|
highlightValue: string;
|
|
79
80
|
objectID: string;
|
|
81
|
+
objectType: string;
|
|
80
82
|
placeDisplayName: string;
|
|
81
83
|
placeTypeName: string;
|
|
82
84
|
value: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Base, ProfileKey } from '.';
|
|
2
|
+
import { SearchResults, SearchFn } from './search';
|
|
3
|
+
import { SearchParameters } from './types';
|
|
4
|
+
declare type AttributesToRetrieve = keyof SearchResults;
|
|
5
|
+
interface RequestParameters {
|
|
6
|
+
profileKey: ProfileKey;
|
|
7
|
+
searchParameters: SearchParameters;
|
|
8
|
+
options: Base['options'];
|
|
9
|
+
offset: number;
|
|
10
|
+
attributes?: AttributesToRetrieve[];
|
|
11
|
+
}
|
|
12
|
+
export declare function createRequestString({ profileKey, searchParameters, options, offset, attributes }: RequestParameters): string;
|
|
13
|
+
export declare function backendSearch({ getFeatureEnabled, profile, profileKey, backendConfig, raaClient, options }: Base): SearchFn;
|
|
14
|
+
export {};
|
|
File without changes
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
import { Profile, ProfileKey
|
|
1
|
+
import { Profile, ProfileKey } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Fixed number of price bucket count
|
|
4
|
+
*/
|
|
5
|
+
export declare const PRICE_BUCKET_COUNT = 31;
|
|
2
6
|
export declare const profiles: Record<ProfileKey, Profile>;
|
|
3
|
-
|
|
7
|
+
/**
|
|
8
|
+
* SAF (Search Application Frontend) configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface SafConfig {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
baseCloudFrontUrl: string;
|
|
13
|
+
endpoints: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
export declare function getSafConfig(profileKey: ProfileKey): SafConfig;
|
|
16
|
+
/**
|
|
17
|
+
* SAPI backend configuration
|
|
18
|
+
*/
|
|
19
|
+
export interface BackendConfig {
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
endpoints: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
export declare function getBackendConfig(profileKey: ProfileKey): BackendConfig;
|
|
@@ -2,11 +2,14 @@ import { SearchClient } from 'algoliasearch';
|
|
|
2
2
|
import { Except } from 'type-fest';
|
|
3
3
|
import { RaaClient } from './raa';
|
|
4
4
|
import { Configs } from './algolia';
|
|
5
|
-
import {
|
|
5
|
+
import { SafConfig, BackendConfig } from './configs';
|
|
6
|
+
import { ProfileKey, ClientOptions, SapiClient, Profile, SapiFeature, Language, Logger } from './types';
|
|
6
7
|
export declare type AlgoliaClient = Pick<SearchClient, 'search'>;
|
|
7
8
|
export interface Base {
|
|
8
9
|
/** Search application frontend config */
|
|
9
10
|
safConfig: SafConfig;
|
|
11
|
+
/** SAPI backend config */
|
|
12
|
+
backendConfig: BackendConfig;
|
|
10
13
|
/** Check if SAPI feature is enabled */
|
|
11
14
|
getFeatureEnabled: (feature: SapiFeature) => boolean;
|
|
12
15
|
/** Client profile */
|
|
@@ -15,15 +18,15 @@ export interface Base {
|
|
|
15
18
|
algoliaClient: AlgoliaClient;
|
|
16
19
|
/** Instance of Rates and Availability Client */
|
|
17
20
|
raaClient?: RaaClient;
|
|
21
|
+
/** Profile key of specific client */
|
|
22
|
+
profileKey: ProfileKey;
|
|
18
23
|
/** Options persistent within single SAPI instance */
|
|
19
24
|
options: Except<ClientOptions, 'variations' | 'logger'> & {
|
|
20
25
|
logger: Logger;
|
|
21
26
|
variations: string[];
|
|
22
27
|
pageSize: number;
|
|
23
|
-
priceBucketsCount: number;
|
|
24
28
|
languages: Language[];
|
|
25
29
|
};
|
|
26
|
-
/** Configs loaded from Algolia and local date configuration */
|
|
27
30
|
configs?: unknown;
|
|
28
31
|
}
|
|
29
32
|
export interface BaseWithConfig extends Base {
|
|
@@ -44,8 +44,6 @@ export interface ClientOptions {
|
|
|
44
44
|
sapiCliKey?: string;
|
|
45
45
|
/** Algolia client options used for debugging and setting additional options like timeouts etc. */
|
|
46
46
|
algoliaClientOptions?: AlgoliaSearchOptions;
|
|
47
|
-
/** Use or not SAP for SAPI init */
|
|
48
|
-
useSaf?: boolean;
|
|
49
47
|
/** External profile to override internal client profile */
|
|
50
48
|
initWithProfile?: Partial<Profile>;
|
|
51
49
|
/** A/B test variations */
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { DateString, Language } from './types';
|
|
2
2
|
export declare type SapiFeature = 'offers' | 'search' | 'rooms' | 'suggests' | 'configs';
|
|
3
|
-
export interface SafConfig {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
baseCloudFrontUrl: string;
|
|
6
|
-
endpoints: Record<string, string>;
|
|
7
|
-
}
|
|
8
3
|
export interface IndexVariation {
|
|
9
4
|
name: string;
|
|
10
5
|
objectID?: string;
|
|
@@ -185,6 +185,7 @@ export declare type PlaceTypeName = 'property' | 'country' | 'city' | 'airport'
|
|
|
185
185
|
export interface Suggestion {
|
|
186
186
|
highlightValue: string;
|
|
187
187
|
objectID: string;
|
|
188
|
+
objectType: string;
|
|
188
189
|
placeDisplayName: string;
|
|
189
190
|
placeTypeName: PlaceTypeName;
|
|
190
191
|
value: string;
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Except } from 'type-fest';
|
|
2
|
-
import { BaseWithConfig, ClientOptions } from '.';
|
|
3
|
-
import { SearchResults, SearchFn } from './search';
|
|
4
|
-
import { SearchParameters } from './types';
|
|
5
|
-
declare type AttributesToRetrieve = keyof SearchResults;
|
|
6
|
-
export declare function createRequestString(parameters: SearchParameters, options: Except<ClientOptions, 'variations'> & {
|
|
7
|
-
variations: string[];
|
|
8
|
-
}, offset: number, attributes?: AttributesToRetrieve[]): string;
|
|
9
|
-
export declare function safSearch({ getFeatureEnabled, profile, safConfig, raaClient, options }: BaseWithConfig): SearchFn;
|
|
10
|
-
export {};
|