-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(javascript): add
worker
build (#4249) (generated) [skip ci]
Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Torbjørn Holtmon <[email protected]>
- Loading branch information
1 parent
d6f48a4
commit 4ffa629
Showing
45 changed files
with
862 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
clients/algoliasearch-client-javascript/packages/algoliasearch/builds/worker.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. | ||
|
||
import type { ClientOptions } from '@algolia/client-common'; | ||
|
||
import type { AbtestingClient } from '@algolia/client-abtesting'; | ||
import { abtestingClient } from '@algolia/client-abtesting'; | ||
import type { AnalyticsClient } from '@algolia/client-analytics'; | ||
import { analyticsClient } from '@algolia/client-analytics'; | ||
import type { InsightsClient } from '@algolia/client-insights'; | ||
import { insightsClient } from '@algolia/client-insights'; | ||
import type { PersonalizationClient } from '@algolia/client-personalization'; | ||
import { personalizationClient } from '@algolia/client-personalization'; | ||
import type { QuerySuggestionsClient } from '@algolia/client-query-suggestions'; | ||
import { querySuggestionsClient } from '@algolia/client-query-suggestions'; | ||
import type { SearchClient } from '@algolia/client-search'; | ||
import { searchClient } from '@algolia/client-search'; | ||
import type { IngestionClient } from '@algolia/ingestion'; | ||
import { ingestionClient } from '@algolia/ingestion'; | ||
import type { MonitoringClient } from '@algolia/monitoring'; | ||
import { monitoringClient } from '@algolia/monitoring'; | ||
import type { RecommendClient } from '@algolia/recommend'; | ||
import { recommendClient } from '@algolia/recommend'; | ||
|
||
import type { | ||
AbtestingRegionOptions, | ||
AnalyticsRegionOptions, | ||
IngestionRegionOptions, | ||
InitClientOptions, | ||
InsightsRegionOptions, | ||
PersonalizationRegionOptions, | ||
QuerySuggestionsRegionOptions, | ||
} from './models'; | ||
|
||
export * from './models'; | ||
|
||
export type Algoliasearch = SearchClient & { | ||
initAbtesting: (initOptions: InitClientOptions & AbtestingRegionOptions) => AbtestingClient; | ||
initAnalytics: (initOptions: InitClientOptions & AnalyticsRegionOptions) => AnalyticsClient; | ||
initIngestion: (initOptions: InitClientOptions & IngestionRegionOptions) => IngestionClient; | ||
initInsights: (initOptions: InitClientOptions & InsightsRegionOptions) => InsightsClient; | ||
initMonitoring: (initOptions?: InitClientOptions) => MonitoringClient; | ||
initPersonalization: (initOptions: InitClientOptions & PersonalizationRegionOptions) => PersonalizationClient; | ||
initQuerySuggestions: (initOptions: InitClientOptions & QuerySuggestionsRegionOptions) => QuerySuggestionsClient; | ||
initRecommend: (initOptions?: InitClientOptions) => RecommendClient; | ||
}; | ||
|
||
export function algoliasearch(appId: string, apiKey: string, options?: ClientOptions): Algoliasearch { | ||
if (!appId || typeof appId !== 'string') { | ||
throw new Error('`appId` is missing.'); | ||
} | ||
|
||
if (!apiKey || typeof apiKey !== 'string') { | ||
throw new Error('`apiKey` is missing.'); | ||
} | ||
|
||
const client = searchClient(appId, apiKey, options); | ||
|
||
return { | ||
...client, | ||
|
||
/** | ||
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system. | ||
*/ | ||
get _ua(): string { | ||
return client.transporter.algoliaAgent.value; | ||
}, | ||
|
||
initAbtesting: (initOptions: InitClientOptions & AbtestingRegionOptions): AbtestingClient => { | ||
return abtestingClient( | ||
initOptions.appId || appId, | ||
initOptions.apiKey || apiKey, | ||
initOptions.region, | ||
initOptions.options, | ||
); | ||
}, | ||
|
||
initAnalytics: (initOptions: InitClientOptions & AnalyticsRegionOptions): AnalyticsClient => { | ||
return analyticsClient( | ||
initOptions.appId || appId, | ||
initOptions.apiKey || apiKey, | ||
initOptions.region, | ||
initOptions.options, | ||
); | ||
}, | ||
|
||
initIngestion: (initOptions: InitClientOptions & IngestionRegionOptions): IngestionClient => { | ||
return ingestionClient( | ||
initOptions.appId || appId, | ||
initOptions.apiKey || apiKey, | ||
initOptions.region, | ||
initOptions.options, | ||
); | ||
}, | ||
|
||
initInsights: (initOptions: InitClientOptions & InsightsRegionOptions): InsightsClient => { | ||
return insightsClient( | ||
initOptions.appId || appId, | ||
initOptions.apiKey || apiKey, | ||
initOptions.region, | ||
initOptions.options, | ||
); | ||
}, | ||
|
||
initMonitoring: (initOptions: InitClientOptions = {}): MonitoringClient => { | ||
return monitoringClient(initOptions.appId || appId, initOptions.apiKey || apiKey, initOptions.options); | ||
}, | ||
|
||
initPersonalization: (initOptions: InitClientOptions & PersonalizationRegionOptions): PersonalizationClient => { | ||
return personalizationClient( | ||
initOptions.appId || appId, | ||
initOptions.apiKey || apiKey, | ||
initOptions.region, | ||
initOptions.options, | ||
); | ||
}, | ||
|
||
initQuerySuggestions: (initOptions: InitClientOptions & QuerySuggestionsRegionOptions): QuerySuggestionsClient => { | ||
return querySuggestionsClient( | ||
initOptions.appId || appId, | ||
initOptions.apiKey || apiKey, | ||
initOptions.region, | ||
initOptions.options, | ||
); | ||
}, | ||
|
||
initRecommend: (initOptions: InitClientOptions = {}): RecommendClient => { | ||
return recommendClient(initOptions.appId || appId, initOptions.apiKey || apiKey, initOptions.options); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
clients/algoliasearch-client-javascript/packages/client-abtesting/builds/worker.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. | ||
|
||
export type AbtestingClient = ReturnType<typeof createAbtestingClient>; | ||
|
||
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common'; | ||
import { createFetchRequester } from '@algolia/requester-fetch'; | ||
|
||
import type { ClientOptions } from '@algolia/client-common'; | ||
|
||
import { createAbtestingClient } from '../src/abtestingClient'; | ||
|
||
import type { Region } from '../src/abtestingClient'; | ||
import { REGIONS } from '../src/abtestingClient'; | ||
|
||
export type { Region, RegionOptions } from '../src/abtestingClient'; | ||
|
||
export { apiClientVersion } from '../src/abtestingClient'; | ||
|
||
export * from '../model'; | ||
|
||
export function abtestingClient( | ||
appId: string, | ||
apiKey: string, | ||
region?: Region, | ||
options?: ClientOptions, | ||
): AbtestingClient { | ||
if (!appId || typeof appId !== 'string') { | ||
throw new Error('`appId` is missing.'); | ||
} | ||
|
||
if (!apiKey || typeof apiKey !== 'string') { | ||
throw new Error('`apiKey` is missing.'); | ||
} | ||
|
||
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) { | ||
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`); | ||
} | ||
|
||
return { | ||
...createAbtestingClient({ | ||
appId, | ||
apiKey, | ||
region, | ||
timeouts: { | ||
connect: 2000, | ||
read: 5000, | ||
write: 30000, | ||
}, | ||
logger: createNullLogger(), | ||
requester: createFetchRequester(), | ||
algoliaAgents: [{ segment: 'Worker' }], | ||
responsesCache: createNullCache(), | ||
requestsCache: createNullCache(), | ||
hostsCache: createMemoryCache(), | ||
...options, | ||
}), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
clients/algoliasearch-client-javascript/packages/client-analytics/builds/worker.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. | ||
|
||
export type AnalyticsClient = ReturnType<typeof createAnalyticsClient>; | ||
|
||
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common'; | ||
import { createFetchRequester } from '@algolia/requester-fetch'; | ||
|
||
import type { ClientOptions } from '@algolia/client-common'; | ||
|
||
import { createAnalyticsClient } from '../src/analyticsClient'; | ||
|
||
import type { Region } from '../src/analyticsClient'; | ||
import { REGIONS } from '../src/analyticsClient'; | ||
|
||
export type { Region, RegionOptions } from '../src/analyticsClient'; | ||
|
||
export { apiClientVersion } from '../src/analyticsClient'; | ||
|
||
export * from '../model'; | ||
|
||
export function analyticsClient( | ||
appId: string, | ||
apiKey: string, | ||
region?: Region, | ||
options?: ClientOptions, | ||
): AnalyticsClient { | ||
if (!appId || typeof appId !== 'string') { | ||
throw new Error('`appId` is missing.'); | ||
} | ||
|
||
if (!apiKey || typeof apiKey !== 'string') { | ||
throw new Error('`apiKey` is missing.'); | ||
} | ||
|
||
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) { | ||
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`); | ||
} | ||
|
||
return { | ||
...createAnalyticsClient({ | ||
appId, | ||
apiKey, | ||
region, | ||
timeouts: { | ||
connect: 2000, | ||
read: 5000, | ||
write: 30000, | ||
}, | ||
logger: createNullLogger(), | ||
requester: createFetchRequester(), | ||
algoliaAgents: [{ segment: 'Worker' }], | ||
responsesCache: createNullCache(), | ||
requestsCache: createNullCache(), | ||
hostsCache: createMemoryCache(), | ||
...options, | ||
}), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.