first-commit
Some checks failed
CI Pipeline / build (push) Failing after 3m23s

This commit is contained in:
2025-08-27 14:05:33 +08:00
commit 9e1b8bdc9d
5159 changed files with 1081326 additions and 0 deletions

21
node_modules/@algolia/client-personalization/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-Present Algolia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

77
node_modules/@algolia/client-personalization/README.md generated vendored Normal file
View File

@@ -0,0 +1,77 @@
<p align="center">
<a href="https://www.algolia.com">
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
</a>
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
<p align="center">
<a href="https://npmjs.org/package/@algolia/client-personalization"><img src="https://img.shields.io/npm/v/@algolia/client-personalization.svg?style=flat-square" alt="NPM version"></img></a>
<a href="http://npm-stat.com/charts.html?package=@algolia/client-personalization"><img src="https://img.shields.io/npm/dm/@algolia/client-personalization.svg?style=flat-square" alt="NPM downloads"></a>
<a href="https://www.jsdelivr.com/package/npm/@algolia/client-personalization"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/client-personalization/badge" alt="jsDelivr Downloads"></img></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
</p>
</p>
<p align="center">
<a href="https://www.algolia.com/doc/libraries/javascript/" target="_blank">Documentation</a>
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a>
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a>
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a>
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a>
<a href="https://www.algolia.com/doc/libraries/javascript/v5/" target="_blank">FAQ</a>
<a href="https://alg.li/support" target="_blank">Support</a>
</p>
## ✨ Features
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
- Works both on the **browser** and **node.js**
- **UMD and ESM compatible**, you can use it with any module loader
- Built with TypeScript
## 💡 Getting Started
> [!TIP]
> This API client is already a dependency of [the algoliasearch client](https://www.npmjs.com/package/algoliasearch), you don't need to manually install `@algolia/client-personalization` if you already have `algoliasearch` installed.
To get started, you first need to install @algolia/client-personalization (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
### With a package manager
```bash
yarn add @algolia/client-personalization@5.34.1
# or
npm install @algolia/client-personalization@5.34.1
# or
pnpm add @algolia/client-personalization@5.34.1
```
### Without a package manager
Add the following JavaScript snippet to the <head> of your website:
```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-personalization@5.34.1/dist/builds/browser.umd.js"></script>
```
### Usage
You can now import the Algolia API client in your project and play with it.
```js
import { personalizationClient } from '@algolia/client-personalization';
const client = personalizationClient('YOUR_APP_ID', 'YOUR_API_KEY');
```
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/personalization/)**.
## ❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/libraries/javascript/v5/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
## 📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).

View File

@@ -0,0 +1,290 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
type DeleteUserProfileResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time when the user profile can be safely considered to be deleted. Any events received after the `deletedUntil` date start a new user profile.
*/
deletedUntil: string;
};
type GetUserTokenResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time of the last event from this user, in RFC 3339 format.
*/
lastEventAt: string;
/**
* Scores for different facet values. Scores represent the user affinity for a user profile towards specific facet values, given the personalization strategy and past events.
*/
scores: Record<string, unknown>;
};
/**
* Event type.
*/
type EventType = 'click' | 'conversion' | 'view';
type EventsScoring = {
/**
* Event score.
*/
score: number;
/**
* Event name.
*/
eventName: string;
eventType: EventType;
};
type FacetsScoring = {
/**
* Event score.
*/
score: number;
/**
* Facet attribute name.
*/
facetName: string;
};
type PersonalizationStrategyParams = {
/**
* Scores associated with each event. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
eventsScoring: Array<EventsScoring>;
/**
* Scores associated with each facet. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
facetsScoring: Array<FacetsScoring>;
/**
* Impact of personalization on the search results. If set to 0, personalization has no impact on the search results.
*/
personalizationImpact: number;
};
type SetPersonalizationStrategyResponse = {
/**
* A message confirming the strategy update.
*/
message: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteUserProfile` method.
*/
type DeleteUserProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
/**
* Properties for the `getUserTokenProfile` method.
*/
type GetUserTokenProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
declare const apiClientVersion = "5.34.1";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region: Region;
};
declare function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }: DeleteUserProfileProps, requestOptions?: RequestOptions): Promise<DeleteUserProfileResponse>;
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams>;
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }: GetUserTokenProfileProps, requestOptions?: RequestOptions): Promise<GetUserTokenResponse>;
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams: PersonalizationStrategyParams, requestOptions?: RequestOptions): Promise<SetPersonalizationStrategyResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions | undefined): PersonalizationClient;
type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;
export { type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteUserProfileProps, type DeleteUserProfileResponse, type ErrorBase, type EventType, type EventsScoring, type FacetsScoring, type GetUserTokenProfileProps, type GetUserTokenResponse, type PersonalizationClient, type PersonalizationStrategyParams, type Region, type RegionOptions, type SetPersonalizationStrategyResponse, apiClientVersion, personalizationClient };

View File

@@ -0,0 +1,331 @@
// builds/browser.ts
import { createXhrRequester } from "@algolia/requester-browser-xhr";
import {
createBrowserLocalStorageCache,
createFallbackableCache,
createMemoryCache,
createNullLogger
} from "@algolia/client-common";
// src/personalizationClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.34.1";
var REGIONS = ["eu", "us"];
function getDefaultHosts(region) {
const url = "personalization.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createPersonalizationClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Personalization",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");
}
const requestPath = "/1/profiles/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions) {
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");
}
const requestPath = "/1/profiles/personalization/{userToken}".replace(
"{userToken}",
encodeURIComponent(userToken)
);
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
if (!personalizationStrategyParams) {
throw new Error(
"Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.eventsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.facetsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.personalizationImpact) {
throw new Error(
"Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`."
);
}
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: personalizationStrategyParams
};
return transporter.request(request, requestOptions);
}
};
}
// builds/browser.ts
function personalizationClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (!region || region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(", ")}`);
}
return createPersonalizationClient({
appId,
apiKey,
region,
timeouts: {
connect: 1e3,
read: 2e3,
write: 3e4
},
logger: createNullLogger(),
requester: createXhrRequester(),
algoliaAgents: [{ segment: "Browser" }],
authMode: "WithinQueryParameters",
responsesCache: createMemoryCache(),
requestsCache: createMemoryCache({ serializable: false }),
hostsCache: createFallbackableCache({
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()]
}),
...options
});
}
export {
apiClientVersion,
personalizationClient
};
//# sourceMappingURL=browser.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,325 @@
// builds/fetch.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/personalizationClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.34.1";
var REGIONS = ["eu", "us"];
function getDefaultHosts(region) {
const url = "personalization.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createPersonalizationClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Personalization",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");
}
const requestPath = "/1/profiles/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions) {
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");
}
const requestPath = "/1/profiles/personalization/{userToken}".replace(
"{userToken}",
encodeURIComponent(userToken)
);
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
if (!personalizationStrategyParams) {
throw new Error(
"Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.eventsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.facetsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.personalizationImpact) {
throw new Error(
"Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`."
);
}
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: personalizationStrategyParams
};
return transporter.request(request, requestOptions);
}
};
}
// builds/fetch.ts
function personalizationClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (!region || region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createPersonalizationClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Fetch" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
apiClientVersion,
personalizationClient
};
//# sourceMappingURL=fetch.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,351 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// builds/node.ts
var node_exports = {};
__export(node_exports, {
apiClientVersion: () => apiClientVersion,
personalizationClient: () => personalizationClient
});
module.exports = __toCommonJS(node_exports);
var import_requester_node_http = require("@algolia/requester-node-http");
var import_client_common2 = require("@algolia/client-common");
// src/personalizationClient.ts
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "5.34.1";
var REGIONS = ["eu", "us"];
function getDefaultHosts(region) {
const url = "personalization.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createPersonalizationClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "Personalization",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");
}
const requestPath = "/1/profiles/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions) {
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");
}
const requestPath = "/1/profiles/personalization/{userToken}".replace(
"{userToken}",
encodeURIComponent(userToken)
);
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
if (!personalizationStrategyParams) {
throw new Error(
"Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.eventsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.facetsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.personalizationImpact) {
throw new Error(
"Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`."
);
}
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: personalizationStrategyParams
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function personalizationClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (!region || region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createPersonalizationClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: (0, import_client_common2.createNullLogger)(),
requester: (0, import_requester_node_http.createHttpRequester)(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: (0, import_client_common2.createNullCache)(),
requestsCache: (0, import_client_common2.createNullCache)(),
hostsCache: (0, import_client_common2.createMemoryCache)(),
...options
})
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
apiClientVersion,
personalizationClient
});
//# sourceMappingURL=node.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,325 @@
// builds/node.ts
import { createHttpRequester } from "@algolia/requester-node-http";
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
// src/personalizationClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.34.1";
var REGIONS = ["eu", "us"];
function getDefaultHosts(region) {
const url = "personalization.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createPersonalizationClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Personalization",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");
}
const requestPath = "/1/profiles/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions) {
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");
}
const requestPath = "/1/profiles/personalization/{userToken}".replace(
"{userToken}",
encodeURIComponent(userToken)
);
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
if (!personalizationStrategyParams) {
throw new Error(
"Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.eventsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.facetsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.personalizationImpact) {
throw new Error(
"Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`."
);
}
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: personalizationStrategyParams
};
return transporter.request(request, requestOptions);
}
};
}
// builds/node.ts
function personalizationClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (!region || region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createPersonalizationClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createHttpRequester(),
algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
apiClientVersion,
personalizationClient
};
//# sourceMappingURL=node.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,325 @@
// builds/worker.ts
import { createMemoryCache, createNullCache, createNullLogger } from "@algolia/client-common";
import { createFetchRequester } from "@algolia/requester-fetch";
// src/personalizationClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.34.1";
var REGIONS = ["eu", "us"];
function getDefaultHosts(region) {
const url = "personalization.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createPersonalizationClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Personalization",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");
}
const requestPath = "/1/profiles/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions) {
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");
}
const requestPath = "/1/profiles/personalization/{userToken}".replace(
"{userToken}",
encodeURIComponent(userToken)
);
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
if (!personalizationStrategyParams) {
throw new Error(
"Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.eventsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.facetsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.personalizationImpact) {
throw new Error(
"Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`."
);
}
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: personalizationStrategyParams
};
return transporter.request(request, requestOptions);
}
};
}
// builds/worker.ts
function personalizationClient(appId, apiKey, region, options) {
if (!appId || typeof appId !== "string") {
throw new Error("`appId` is missing.");
}
if (!apiKey || typeof apiKey !== "string") {
throw new Error("`apiKey` is missing.");
}
if (!region || region && (typeof region !== "string" || !REGIONS.includes(region))) {
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(", ")}`);
}
return {
...createPersonalizationClient({
appId,
apiKey,
region,
timeouts: {
connect: 2e3,
read: 5e3,
write: 3e4
},
logger: createNullLogger(),
requester: createFetchRequester(),
algoliaAgents: [{ segment: "Worker" }],
responsesCache: createNullCache(),
requestsCache: createNullCache(),
hostsCache: createMemoryCache(),
...options
})
};
}
export {
apiClientVersion,
personalizationClient
};
//# sourceMappingURL=worker.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,291 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
type DeleteUserProfileResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time when the user profile can be safely considered to be deleted. Any events received after the `deletedUntil` date start a new user profile.
*/
deletedUntil: string;
};
type GetUserTokenResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time of the last event from this user, in RFC 3339 format.
*/
lastEventAt: string;
/**
* Scores for different facet values. Scores represent the user affinity for a user profile towards specific facet values, given the personalization strategy and past events.
*/
scores: Record<string, unknown>;
};
/**
* Event type.
*/
type EventType = 'click' | 'conversion' | 'view';
type EventsScoring = {
/**
* Event score.
*/
score: number;
/**
* Event name.
*/
eventName: string;
eventType: EventType;
};
type FacetsScoring = {
/**
* Event score.
*/
score: number;
/**
* Facet attribute name.
*/
facetName: string;
};
type PersonalizationStrategyParams = {
/**
* Scores associated with each event. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
eventsScoring: Array<EventsScoring>;
/**
* Scores associated with each facet. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
facetsScoring: Array<FacetsScoring>;
/**
* Impact of personalization on the search results. If set to 0, personalization has no impact on the search results.
*/
personalizationImpact: number;
};
type SetPersonalizationStrategyResponse = {
/**
* A message confirming the strategy update.
*/
message: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteUserProfile` method.
*/
type DeleteUserProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
/**
* Properties for the `getUserTokenProfile` method.
*/
type GetUserTokenProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
declare const apiClientVersion = "5.34.1";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region: Region;
};
declare function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }: DeleteUserProfileProps, requestOptions?: RequestOptions): Promise<DeleteUserProfileResponse>;
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams>;
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }: GetUserTokenProfileProps, requestOptions?: RequestOptions): Promise<GetUserTokenResponse>;
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams: PersonalizationStrategyParams, requestOptions?: RequestOptions): Promise<SetPersonalizationStrategyResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;
declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions | undefined): PersonalizationClient;
export { type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteUserProfileProps, type DeleteUserProfileResponse, type ErrorBase, type EventType, type EventsScoring, type FacetsScoring, type GetUserTokenProfileProps, type GetUserTokenResponse, type PersonalizationClient, type PersonalizationStrategyParams, type Region, type RegionOptions, type SetPersonalizationStrategyResponse, apiClientVersion, personalizationClient };

View File

@@ -0,0 +1,291 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
type DeleteUserProfileResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time when the user profile can be safely considered to be deleted. Any events received after the `deletedUntil` date start a new user profile.
*/
deletedUntil: string;
};
type GetUserTokenResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time of the last event from this user, in RFC 3339 format.
*/
lastEventAt: string;
/**
* Scores for different facet values. Scores represent the user affinity for a user profile towards specific facet values, given the personalization strategy and past events.
*/
scores: Record<string, unknown>;
};
/**
* Event type.
*/
type EventType = 'click' | 'conversion' | 'view';
type EventsScoring = {
/**
* Event score.
*/
score: number;
/**
* Event name.
*/
eventName: string;
eventType: EventType;
};
type FacetsScoring = {
/**
* Event score.
*/
score: number;
/**
* Facet attribute name.
*/
facetName: string;
};
type PersonalizationStrategyParams = {
/**
* Scores associated with each event. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
eventsScoring: Array<EventsScoring>;
/**
* Scores associated with each facet. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
facetsScoring: Array<FacetsScoring>;
/**
* Impact of personalization on the search results. If set to 0, personalization has no impact on the search results.
*/
personalizationImpact: number;
};
type SetPersonalizationStrategyResponse = {
/**
* A message confirming the strategy update.
*/
message: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteUserProfile` method.
*/
type DeleteUserProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
/**
* Properties for the `getUserTokenProfile` method.
*/
type GetUserTokenProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
declare const apiClientVersion = "5.34.1";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region: Region;
};
declare function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }: DeleteUserProfileProps, requestOptions?: RequestOptions): Promise<DeleteUserProfileResponse>;
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams>;
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }: GetUserTokenProfileProps, requestOptions?: RequestOptions): Promise<GetUserTokenResponse>;
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams: PersonalizationStrategyParams, requestOptions?: RequestOptions): Promise<SetPersonalizationStrategyResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;
declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions | undefined): PersonalizationClient;
export { type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteUserProfileProps, type DeleteUserProfileResponse, type ErrorBase, type EventType, type EventsScoring, type FacetsScoring, type GetUserTokenProfileProps, type GetUserTokenResponse, type PersonalizationClient, type PersonalizationStrategyParams, type Region, type RegionOptions, type SetPersonalizationStrategyResponse, apiClientVersion, personalizationClient };

View File

@@ -0,0 +1,291 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
type DeleteUserProfileResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time when the user profile can be safely considered to be deleted. Any events received after the `deletedUntil` date start a new user profile.
*/
deletedUntil: string;
};
type GetUserTokenResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time of the last event from this user, in RFC 3339 format.
*/
lastEventAt: string;
/**
* Scores for different facet values. Scores represent the user affinity for a user profile towards specific facet values, given the personalization strategy and past events.
*/
scores: Record<string, unknown>;
};
/**
* Event type.
*/
type EventType = 'click' | 'conversion' | 'view';
type EventsScoring = {
/**
* Event score.
*/
score: number;
/**
* Event name.
*/
eventName: string;
eventType: EventType;
};
type FacetsScoring = {
/**
* Event score.
*/
score: number;
/**
* Facet attribute name.
*/
facetName: string;
};
type PersonalizationStrategyParams = {
/**
* Scores associated with each event. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
eventsScoring: Array<EventsScoring>;
/**
* Scores associated with each facet. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
facetsScoring: Array<FacetsScoring>;
/**
* Impact of personalization on the search results. If set to 0, personalization has no impact on the search results.
*/
personalizationImpact: number;
};
type SetPersonalizationStrategyResponse = {
/**
* A message confirming the strategy update.
*/
message: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteUserProfile` method.
*/
type DeleteUserProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
/**
* Properties for the `getUserTokenProfile` method.
*/
type GetUserTokenProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
declare const apiClientVersion = "5.34.1";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region: Region;
};
declare function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }: DeleteUserProfileProps, requestOptions?: RequestOptions): Promise<DeleteUserProfileResponse>;
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams>;
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }: GetUserTokenProfileProps, requestOptions?: RequestOptions): Promise<GetUserTokenResponse>;
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams: PersonalizationStrategyParams, requestOptions?: RequestOptions): Promise<SetPersonalizationStrategyResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;
declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions | undefined): PersonalizationClient;
export { type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteUserProfileProps, type DeleteUserProfileResponse, type ErrorBase, type EventType, type EventsScoring, type FacetsScoring, type GetUserTokenProfileProps, type GetUserTokenResponse, type PersonalizationClient, type PersonalizationStrategyParams, type Region, type RegionOptions, type SetPersonalizationStrategyResponse, apiClientVersion, personalizationClient };

View File

@@ -0,0 +1,317 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/personalizationClient.ts
var personalizationClient_exports = {};
__export(personalizationClient_exports, {
REGIONS: () => REGIONS,
apiClientVersion: () => apiClientVersion,
createPersonalizationClient: () => createPersonalizationClient
});
module.exports = __toCommonJS(personalizationClient_exports);
var import_client_common = require("@algolia/client-common");
var apiClientVersion = "5.34.1";
var REGIONS = ["eu", "us"];
function getDefaultHosts(region) {
const url = "personalization.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createPersonalizationClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
const transporter = (0, import_client_common.createTransporter)({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
algoliaAgents,
client: "Personalization",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");
}
const requestPath = "/1/profiles/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions) {
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");
}
const requestPath = "/1/profiles/personalization/{userToken}".replace(
"{userToken}",
encodeURIComponent(userToken)
);
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
if (!personalizationStrategyParams) {
throw new Error(
"Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.eventsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.facetsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.personalizationImpact) {
throw new Error(
"Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`."
);
}
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: personalizationStrategyParams
};
return transporter.request(request, requestOptions);
}
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
REGIONS,
apiClientVersion,
createPersonalizationClient
});
//# sourceMappingURL=personalizationClient.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,290 @@
// src/personalizationClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.34.1";
var REGIONS = ["eu", "us"];
function getDefaultHosts(region) {
const url = "personalization.{region}.algolia.com".replace("{region}", region);
return [{ url, accept: "readWrite", protocol: "https" }];
}
function createPersonalizationClient({
appId: appIdOption,
apiKey: apiKeyOption,
authMode,
algoliaAgents,
region: regionOption,
...options
}) {
const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "Personalization",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**
* The `appId` currently in use.
*/
appId: appIdOption,
/**
* The `apiKey` currently in use.
*/
apiKey: apiKeyOption,
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
},
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
get _ua() {
return transporter.algoliaAgent.value;
},
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
if (!authMode || authMode === "WithinHeaders") {
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
} else {
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
}
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customDelete`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customGet`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPost`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }, requestOptions) {
if (!path) {
throw new Error("Parameter `path` is required when calling `customPut`.");
}
const requestPath = "/{path}".replace("{path}", path);
const headers = {};
const queryParameters = parameters ? parameters : {};
const request = {
method: "PUT",
path: requestPath,
queryParameters,
headers,
data: body ? body : {}
};
return transporter.request(request, requestOptions);
},
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");
}
const requestPath = "/1/profiles/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
const headers = {};
const queryParameters = {};
const request = {
method: "DELETE",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions) {
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }, requestOptions) {
if (!userToken) {
throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");
}
const requestPath = "/1/profiles/personalization/{userToken}".replace(
"{userToken}",
encodeURIComponent(userToken)
);
const headers = {};
const queryParameters = {};
const request = {
method: "GET",
path: requestPath,
queryParameters,
headers
};
return transporter.request(request, requestOptions);
},
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
if (!personalizationStrategyParams) {
throw new Error(
"Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.eventsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.eventsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.facetsScoring) {
throw new Error(
"Parameter `personalizationStrategyParams.facetsScoring` is required when calling `setPersonalizationStrategy`."
);
}
if (!personalizationStrategyParams.personalizationImpact) {
throw new Error(
"Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`."
);
}
const requestPath = "/1/strategies/personalization";
const headers = {};
const queryParameters = {};
const request = {
method: "POST",
path: requestPath,
queryParameters,
headers,
data: personalizationStrategyParams
};
return transporter.request(request, requestOptions);
}
};
}
export {
REGIONS,
apiClientVersion,
createPersonalizationClient
};
//# sourceMappingURL=personalizationClient.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,291 @@
import * as _algolia_client_common from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
type DeleteUserProfileResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time when the user profile can be safely considered to be deleted. Any events received after the `deletedUntil` date start a new user profile.
*/
deletedUntil: string;
};
type GetUserTokenResponse = {
/**
* Unique pseudonymous or anonymous user identifier. This helps with analytics and click and conversion events. For more information, see [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/).
*/
userToken: string;
/**
* Date and time of the last event from this user, in RFC 3339 format.
*/
lastEventAt: string;
/**
* Scores for different facet values. Scores represent the user affinity for a user profile towards specific facet values, given the personalization strategy and past events.
*/
scores: Record<string, unknown>;
};
/**
* Event type.
*/
type EventType = 'click' | 'conversion' | 'view';
type EventsScoring = {
/**
* Event score.
*/
score: number;
/**
* Event name.
*/
eventName: string;
eventType: EventType;
};
type FacetsScoring = {
/**
* Event score.
*/
score: number;
/**
* Facet attribute name.
*/
facetName: string;
};
type PersonalizationStrategyParams = {
/**
* Scores associated with each event. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
eventsScoring: Array<EventsScoring>;
/**
* Scores associated with each facet. The higher the scores, the higher the impact of those events on the personalization of search results.
*/
facetsScoring: Array<FacetsScoring>;
/**
* Impact of personalization on the search results. If set to 0, personalization has no impact on the search results.
*/
personalizationImpact: number;
};
type SetPersonalizationStrategyResponse = {
/**
* A message confirming the strategy update.
*/
message: string;
};
/**
* Properties for the `customDelete` method.
*/
type CustomDeleteProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customGet` method.
*/
type CustomGetProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
};
/**
* Properties for the `customPost` method.
*/
type CustomPostProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `customPut` method.
*/
type CustomPutProps = {
/**
* Path of the endpoint, for example `1/newFeature`.
*/
path: string;
/**
* Query parameters to apply to the current query.
*/
parameters?: {
[key: string]: any;
} | undefined;
/**
* Parameters to send with the custom request.
*/
body?: Record<string, unknown> | undefined;
};
/**
* Properties for the `deleteUserProfile` method.
*/
type DeleteUserProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
/**
* Properties for the `getUserTokenProfile` method.
*/
type GetUserTokenProfileProps = {
/**
* Unique identifier representing a user for which to fetch the personalization profile.
*/
userToken: string;
};
declare const apiClientVersion = "5.34.1";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
type RegionOptions = {
region: Region;
};
declare function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* The `apiKey` currently in use.
*/
apiKey: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string | undefined): void;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* This method lets you send requests to the Algolia REST API.
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method lets you send requests to the Algolia REST API.
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* Deletes a user profile. The response includes a date and time when the user profile can safely be considered deleted.
*
* Required API Key ACLs:
* - recommendation
* @param deleteUserProfile - The deleteUserProfile object.
* @param deleteUserProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteUserProfile({ userToken }: DeleteUserProfileProps, requestOptions?: RequestOptions): Promise<DeleteUserProfileResponse>;
/**
* Retrieves the current personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getPersonalizationStrategy(requestOptions?: RequestOptions | undefined): Promise<PersonalizationStrategyParams>;
/**
* Retrieves a user profile and their affinities for different facets.
*
* Required API Key ACLs:
* - recommendation
* @param getUserTokenProfile - The getUserTokenProfile object.
* @param getUserTokenProfile.userToken - Unique identifier representing a user for which to fetch the personalization profile.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getUserTokenProfile({ userToken }: GetUserTokenProfileProps, requestOptions?: RequestOptions): Promise<GetUserTokenResponse>;
/**
* Creates a new personalization strategy.
*
* Required API Key ACLs:
* - recommendation
* @param personalizationStrategyParams - The personalizationStrategyParams object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
setPersonalizationStrategy(personalizationStrategyParams: PersonalizationStrategyParams, requestOptions?: RequestOptions): Promise<SetPersonalizationStrategyResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string | undefined;
};
type PersonalizationClient = ReturnType<typeof createPersonalizationClient>;
declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions | undefined): PersonalizationClient;
export { type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteUserProfileProps, type DeleteUserProfileResponse, type ErrorBase, type EventType, type EventsScoring, type FacetsScoring, type GetUserTokenProfileProps, type GetUserTokenResponse, type PersonalizationClient, type PersonalizationStrategyParams, type Region, type RegionOptions, type SetPersonalizationStrategyResponse, apiClientVersion, personalizationClient };

View File

@@ -0,0 +1 @@
export * from './dist/node';

View File

@@ -0,0 +1 @@
module.exports = require('./dist/builds/node.cjs');

View File

@@ -0,0 +1,68 @@
{
"version": "5.34.1",
"repository": {
"type": "git",
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
},
"homepage": "https://github.com/algolia/algoliasearch-client-javascript/tree/main/packages/client-personalization#readme",
"type": "module",
"license": "MIT",
"author": "Algolia",
"scripts": {
"build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js",
"clean": "rm -rf ./dist || true",
"test:bundle": "publint . && attw --pack ."
},
"name": "@algolia/client-personalization",
"description": "JavaScript client for client-personalization",
"exports": {
".": {
"node": {
"types": {
"import": "./dist/node.d.ts",
"module": "./dist/node.d.ts",
"require": "./dist/node.d.cts"
},
"import": "./dist/builds/node.js",
"module": "./dist/builds/node.js",
"require": "./dist/builds/node.cjs"
},
"worker": {
"types": "./dist/worker.d.ts",
"default": "./dist/builds/worker.js"
},
"default": {
"types": "./dist/browser.d.ts",
"module": "./dist/builds/browser.js",
"import": "./dist/builds/browser.js",
"default": "./dist/builds/browser.umd.js"
}
},
"./dist/builds/*": "./dist/builds/*.js"
},
"jsdelivr": "./dist/builds/browser.umd.js",
"unpkg": "./dist/builds/browser.umd.js",
"react-native": "./dist/builds/browser.js",
"files": [
"dist",
"index.js",
"index.d.ts"
],
"dependencies": {
"@algolia/client-common": "5.34.1",
"@algolia/requester-browser-xhr": "5.34.1",
"@algolia/requester-fetch": "5.34.1",
"@algolia/requester-node-http": "5.34.1"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.18.2",
"@types/node": "22.16.5",
"publint": "0.3.12",
"rollup": "4.41.0",
"tsup": "8.5.0",
"typescript": "5.8.3"
},
"engines": {
"node": ">= 14.0.0"
}
}