Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@findhotel/sapi

Package Overview
Dependencies
Maintainers
3
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@findhotel/sapi - npm Package Compare versions

Comparing version 0.19.3 to 0.20.0

dist/types/packages/core/src/configs.d.ts

10

CHANGELOG.md

@@ -0,1 +1,11 @@

# [0.20.0](https://github.com/FindHotel/sapi/compare/v0.19.3...v0.20.0) (2021-08-10)
### Changed
- SAPI initialisation requires only `profileKey` from now
### Added
- Added fallback for RAA WS endpoint in case it's empty in e2e environment
### Removed
- `clientId` and `clientKey` from sapi initialisation
## [0.19.3](https://github.com/FindHotel/sapi/compare/v0.19.1...v0.19.3) (2021-08-09)

@@ -2,0 +12,0 @@ ### Fixed

4

dist/types/packages/core/src/algolia/configs.d.ts
import { AlgoliaClient } from '..';
import { SapiClientConfig } from '../types';
import { Profile } from '../types';
interface ExchangeRateHit {

@@ -54,3 +54,3 @@ objectID: string;

}
export declare function loadConfigs({ search }: AlgoliaClient, clientConfig: SapiClientConfig, options: LoadConfigOptions): Promise<Configs>;
export declare function loadConfigs({ search }: AlgoliaClient, profile: Profile, options: LoadConfigOptions): Promise<Configs>;
export {};
import { AlgoliaClient } from '..';
import { HsoFilter } from './configs';
import { OptionalSearchParameters, Hotel, Location, SapiClientConfig } from '../types';
import { OptionalSearchParameters, Hotel, Location, Profile } from '../types';
interface Options {

@@ -17,3 +17,3 @@ languages: string[];

}
export declare function geoSearch({ search }: AlgoliaClient, clientConfig: SapiClientConfig, options: Options): (parameters: GeoSearchParameters) => Promise<{
export declare function geoSearch({ search }: AlgoliaClient, profile: Profile, options: Options): (parameters: GeoSearchParameters) => Promise<{
hotelIds: string[];

@@ -20,0 +20,0 @@ hotelEntities: Record<string, Hotel>;

import { AlgoliaClient } from '..';
import { SapiClientConfig, Anchor, Hotel, Location } from '../types';
import { Profile, Anchor, Hotel, Location } from '../types';
interface GetAnchorParameters {

@@ -15,3 +15,3 @@ hotelId?: string;

};
export declare function getAnchor({ search }: AlgoliaClient, clientConfig: SapiClientConfig, { languages }: {
export declare function getAnchor({ search }: AlgoliaClient, profile: Profile, { languages }: {
languages: string[];

@@ -18,0 +18,0 @@ }): (parameters: GetAnchorParameters) => Promise<{

import { AlgoliaClient } from '..';
import { SapiClientConfig } from '../types';
import { Profile } from '../types';
interface Options {

@@ -7,3 +7,3 @@ languages: string[];

}
export declare function loadSuggests({ search }: AlgoliaClient, clientConfig: SapiClientConfig, { languages, suggestsCount }: Options): (query: string) => Promise<import("..").Suggestion[]>;
export declare function loadSuggests({ search }: AlgoliaClient, profile: Profile, { languages, suggestsCount }: Options): (query: string) => Promise<import("..").Suggestion[]>;
export {};

@@ -1,3 +0,2 @@

import { SafConfig } from '.';
import { SapiFeature, SapiClientId, DateString, Language, Currency } from './types';
import { SafConfig, SapiFeature, ProfileKey, DateString, Language, Currency } from './types';
import { HsoConfigFilter, ListOfValuesItem } from './algolia';

@@ -12,3 +11,3 @@ interface CurrResponse {

}
export interface SapiInitConfig {
export interface InitConfig {
autocompleteIndex: string;

@@ -28,7 +27,10 @@ blockedDefaultDates: DateString[];

};
algolia: {
apiKey: string;
};
}
export declare function sapiInit(clientId: SapiClientId, { baseUrl, endpoints }: SafConfig, { currency, language }: {
export declare function sapiInit(profileKey: ProfileKey, { baseUrl, endpoints }: SafConfig, { currency, language }: {
currency: Currency;
language: Language;
}): Promise<SapiInitConfig>;
}): Promise<InitConfig>;
export {};
import { SearchClient } from 'algoliasearch';
import { RaaClient } from './raa';
import { Configs } from './algolia';
import { SapiClientOptions, SapiClientId, SapiClientKey, SapiClient, SapiClientConfig, SapiFeature, Language } from './types';
import { ProfileKey, ClientOptions, SapiClient, Profile, SafConfig, SapiFeature, Language } from './types';
export declare type AlgoliaClient = Pick<SearchClient, 'search'>;
export interface SafConfig {
baseUrl: string;
endpoints: Record<string, string>;
}
export interface Base {

@@ -15,4 +11,4 @@ /** Search application frontend config */

getFeatureEnabled: (feature: SapiFeature) => boolean;
/** SAPI client configuration */
clientConfig: SapiClientConfig;
/** Client profile */
profile: Profile;
/** Instance of Algolia Client */

@@ -23,3 +19,3 @@ algoliaClient: AlgoliaClient;

/** Options persistent within single SAPI instance */
options: SapiClientOptions & {
options: ClientOptions & {
pageSize: number;

@@ -39,4 +35,3 @@ priceBucketsCount: number;

*
* @param clientId - SAPI client id
* @param clientKey - SAPI public client key
* @param profileKey - Profile key
* @param clientOptions - Options for initializing SAPI

@@ -46,2 +41,2 @@ *

*/
export declare function sapi(clientId: SapiClientId, clientKey: SapiClientKey, clientOptions: SapiClientOptions): Promise<SapiClient>;
export declare function sapi(profileKey: ProfileKey, clientOptions: ClientOptions): Promise<SapiClient>;

@@ -38,4 +38,4 @@ import { Except } from 'type-fest';

export declare function prepareSearchParameters(parameters: ApiSearchParameters, dates: DatesConfig): SearchParameters;
declare type SearchFnParameters = Pick<BaseWithConfig, 'options' | 'clientConfig' | 'algoliaClient' | 'raaClient' | 'configs' | 'getFeatureEnabled'>;
export declare function search({ getFeatureEnabled, clientConfig, algoliaClient, raaClient, options, configs }: SearchFnParameters): SearchFn;
declare type SearchFnParameters = Pick<BaseWithConfig, 'options' | 'profile' | 'algoliaClient' | 'raaClient' | 'configs' | 'getFeatureEnabled'>;
export declare function search({ getFeatureEnabled, profile, algoliaClient, raaClient, options, configs }: SearchFnParameters): SearchFn;
export {};
export * from './types';
export * from './rooms';
export * from './sapi-client';
export * from './sapi-configs';

@@ -1,2 +0,2 @@

import { HotelId, AnonymousId, Currency, Language, DeviceCategory } from '.';
import { HotelId, AnonymousId, Currency, Language, DeviceCategory } from './types';
export interface RoomsRequestParameters {

@@ -3,0 +3,0 @@ hotelId: HotelId;

import { AlgoliaSearchOptions } from 'algoliasearch';
import { AnonymousId, DateString, Language, Currency, Country, DeviceCategory } from '.';
import { AnonymousId, Language, Currency, Country, DeviceCategory } from './types';
import { Profile } from './sapi-configs';
import { SearchFn } from '../search';

@@ -7,19 +8,3 @@ import { RoomsFn } from '../rooms';

import { ListOfValuesItem, ExchangeRates } from '../algolia';
export declare type SapiFeature = 'offers' | 'search' | 'rooms' | 'suggests' | 'configs';
export interface SapiProfile {
features: SapiFeature[];
blockedDefaultDates: DateString[];
daysFromNow: number;
fallbackLanguages: Record<Language, Language[]>;
hotelIndex: string;
autocompleteIndex: string;
lovIndex: string;
currencyIndex: string;
hsoIndex: string;
raa: {
endpoint: string;
};
}
export interface SapiClientConfig extends SapiProfile {
}
export declare type ProfileKey = string;
export interface SapiClient {

@@ -34,6 +19,4 @@ rooms: RoomsFn;

}
export declare type SapiClientId = string;
export declare type SapiClientKey = string;
/** Options for initializing the Search API client. Persistent within single SAPI instance but may vary for different users */
export interface SapiClientOptions {
export interface ClientOptions {
/** Unique ID identifying users */

@@ -66,3 +49,3 @@ anonymousId: AnonymousId;

/** External profile to override internal client profile */
initWithProfile?: Partial<SapiProfile>;
initWithProfile?: Partial<Profile>;
}
{
"name": "@findhotel/sapi",
"version": "0.19.3",
"version": "0.20.0",
"description": "FindHotel Search API",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -54,6 +54,4 @@

const clientId = 'client-id'
const profileKey = 'profile-key'
const clientKey = 'client-key'
const options = {

@@ -66,3 +64,3 @@ anonymousId: 'fd9dbb5f-b337-4dd7-b640-1f177d1d3caa',

const sapiClient = await sapi(clientId, clientKey, options)
const sapiClient = await sapi(profileKey, options)

@@ -142,6 +140,4 @@ Now SAPI client is ready to be used in your application.

const clientId = 'client-id'
const profileKey = 'profile-key'
const clientKey = 'client-key'
const options = {

@@ -154,3 +150,3 @@ anonymousId: 'fd9dbb5f-b337-4dd7-b640-1f177d1d3caa',

const sapiClient = await sapi(clientId, clientKey, options)
const sapiClient = await sapi(profileKey, options)

@@ -157,0 +153,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc