Skip to content

Commit f4c6429

Browse files
committed
chore: wow
1 parent 0908780 commit f4c6429

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

packages/algoliasearch/src/ingestion.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
IngestionClient,
1414
PushOptions,
1515
PushProps,
16-
REGIONS,
1716
TransformationOptions,
1817
WatchResponse,
1918
} from './types';
@@ -25,10 +24,8 @@ export function createIngestionClient(
2524
throw new Error('`region` must be provided when leveraging the transformation pipeline');
2625
}
2726

28-
if (!REGIONS.includes(options.transformation.region)) {
29-
throw new Error(
30-
`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`
31-
);
27+
if (options.transformation.region !== 'eu' && options.transformation.region !== 'us') {
28+
throw new Error('`region` is required and must be one of the following: eu, us');
3229
}
3330

3431
const appId = options.appId;

packages/algoliasearch/src/types/Ingestion.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@ import {
77
} from '@algolia/client-search';
88
import { RequestOptions } from '@algolia/transporter';
99

10-
export const REGIONS = ['eu', 'us'] as const;
11-
export type Region = typeof REGIONS[number];
12-
1310
export type TransformationOptions = {
1411
// When provided, a second transporter will be created in order to leverage the `*WithTransformation` methods exposed by the Push connector (https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push/).
1512
readonly transformation?: {
1613
// The region of your Algolia application ID, used to target the correct hosts of the transformation service.
17-
readonly region: Region;
14+
readonly region: 'eu' | 'us';
1815
};
1916
};
2017

2118
export type IngestionMethods = {
2219
/**
2320
* Helper: Similar to the `saveObjects` method but requires a Push connector (https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push/) to be created first, in order to transform records before indexing them to Algolia. The `region` must've been passed to the client instantiation method.
2421
*
25-
* @summary Save objects to an Algolia index by leveraging the Transformation pipeline setup in the Push connector (https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push/).
2622
* @param objects - The array of `objects` to store in the given Algolia `indexName`.
2723
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
2824
*/
@@ -34,7 +30,6 @@ export type IngestionMethods = {
3430
/**
3531
* Helper: Similar to the `partialUpdateObjects` method but requires a Push connector (https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push/) to be created first, in order to transform records before indexing them to Algolia. The `region` must've been passed to the client instantiation method.
3632
*
37-
* @summary Save objects to an Algolia index by leveraging the Transformation pipeline setup in the Push connector (https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/connectors/push/).
3833
* @param objects - The array of `objects` to update in the given Algolia `indexName`.
3934
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
4035
*/

0 commit comments

Comments
 (0)