@algolia/advanced-personalization 0.0.1-alpha.4 → 0.0.1-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser.d.ts +1 -1
- package/dist/builds/browser.js +2 -2
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +1 -1
- package/dist/builds/fetch.js +1 -1
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +1 -1
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +1 -1
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +1 -1
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/src/advancedPersonalizationClient.cjs +1 -1
- package/dist/src/advancedPersonalizationClient.cjs.map +1 -1
- package/dist/src/advancedPersonalizationClient.js +1 -1
- package/dist/src/advancedPersonalizationClient.js.map +1 -1
- package/dist/worker.d.ts +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -41,11 +41,11 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
41
41
|
### With a package manager
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
yarn add @algolia/advanced-personalization@0.0.1-alpha.
|
|
44
|
+
yarn add @algolia/advanced-personalization@0.0.1-alpha.5
|
|
45
45
|
# or
|
|
46
|
-
npm install @algolia/advanced-personalization@0.0.1-alpha.
|
|
46
|
+
npm install @algolia/advanced-personalization@0.0.1-alpha.5
|
|
47
47
|
# or
|
|
48
|
-
pnpm add @algolia/advanced-personalization@0.0.1-alpha.
|
|
48
|
+
pnpm add @algolia/advanced-personalization@0.0.1-alpha.5
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Without a package manager
|
|
@@ -53,7 +53,7 @@ pnpm add @algolia/advanced-personalization@0.0.1-alpha.4
|
|
|
53
53
|
Add the following JavaScript snippet to the <head> of your website:
|
|
54
54
|
|
|
55
55
|
```html
|
|
56
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/advanced-personalization@0.0.1-alpha.
|
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/advanced-personalization@0.0.1-alpha.5/dist/builds/browser.umd.js"></script>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Usage
|
package/dist/browser.d.ts
CHANGED
|
@@ -313,7 +313,7 @@ type GetUsersProps = {
|
|
|
313
313
|
previousPageToken?: string | undefined;
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
-
declare const apiClientVersion = "0.0.1-alpha.
|
|
316
|
+
declare const apiClientVersion = "0.0.1-alpha.5";
|
|
317
317
|
declare const REGIONS: readonly ["eu", "us"];
|
|
318
318
|
type Region = (typeof REGIONS)[number];
|
|
319
319
|
type RegionOptions = {
|
package/dist/builds/browser.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
// src/advancedPersonalizationClient.ts
|
|
11
11
|
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
12
|
-
var apiClientVersion = "0.0.1-alpha.
|
|
12
|
+
var apiClientVersion = "0.0.1-alpha.5";
|
|
13
13
|
var REGIONS = ["eu", "us"];
|
|
14
14
|
function getDefaultHosts(region) {
|
|
15
15
|
const url = "ai-personalization.{region}.algolia.com".replace("{region}", region);
|
|
@@ -415,7 +415,7 @@ function advancedPersonalizationClient(appId, apiKey, region, options) {
|
|
|
415
415
|
logger: createNullLogger(),
|
|
416
416
|
requester: createXhrRequester(),
|
|
417
417
|
algoliaAgents: [{ segment: "Browser" }],
|
|
418
|
-
authMode: "
|
|
418
|
+
authMode: "WithinHeaders",
|
|
419
419
|
responsesCache: createMemoryCache(),
|
|
420
420
|
requestsCache: createMemoryCache({ serializable: false }),
|
|
421
421
|
hostsCache: createFallbackableCache({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../builds/browser.ts","../../src/advancedPersonalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createAdvancedPersonalizationClient } from '../src/advancedPersonalizationClient';\n\nimport type { Region } from '../src/advancedPersonalizationClient';\nimport { REGIONS } from '../src/advancedPersonalizationClient';\n\nexport type { Region, RegionOptions } from '../src/advancedPersonalizationClient';\n\nexport { apiClientVersion } from '../src/advancedPersonalizationClient';\n\nexport * from '../model';\n\nexport function advancedPersonalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): AdvancedPersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return createAdvancedPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...options,\n });\n}\n\nexport type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { AcceptedResponse } from '../model/acceptedResponse';\nimport type { ConfigurationObject } from '../model/configurationObject';\nimport type { ConfigurationParameters } from '../model/configurationParameters';\n\nimport type { DeleteUserResponse } from '../model/deleteUserResponse';\n\nimport type { GetUsersResponse } from '../model/getUsersResponse';\nimport type { PutConfigResponse } from '../model/putConfigResponse';\nimport type { RealtimeUser } from '../model/realtimeUser';\n\nimport type { User } from '../model/user';\n\nimport type {\n ComputeRealtimeUserProps,\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProps,\n GetRealtimeUserProps,\n GetUserProps,\n GetUsersProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '0.0.1-alpha.4';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'ai-personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createAdvancedPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'AdvancedPersonalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Sends a request to compute the user\\'s personalization profile.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param computeRealtimeUser - The computeRealtimeUser object.\n * @param computeRealtimeUser.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n computeRealtimeUser(\n { userToken }: ComputeRealtimeUserProps,\n requestOptions?: RequestOptions,\n ): Promise<AcceptedResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `computeRealtimeUser`.');\n }\n\n const requestPath = '/2/realtime/users/{userToken}/compute'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param deleteUser - The deleteUser object.\n * @param deleteUser.userID - ID of the user.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUser({ userID }: DeleteUserProps, requestOptions?: RequestOptions): Promise<DeleteUserResponse> {\n if (!userID) {\n throw new Error('Parameter `userID` is required when calling `deleteUser`.');\n }\n\n const requestPath = '/2/users/{userID}'.replace('{userID}', encodeURIComponent(userID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a list of configuration objects for each index.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfig(requestOptions?: RequestOptions | undefined): Promise<ConfigurationObject> {\n const requestPath = '/2/config';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the user\\'s personalization profiles containing search filters.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getRealtimeUser - The getRealtimeUser object.\n * @param getRealtimeUser.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRealtimeUser({ userToken }: GetRealtimeUserProps, requestOptions?: RequestOptions): Promise<RealtimeUser> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getRealtimeUser`.');\n }\n\n const requestPath = '/2/realtime/users/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param getUser - The getUser object.\n * @param getUser.userID - ID of the user.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUser({ userID }: GetUserProps, requestOptions?: RequestOptions): Promise<User> {\n if (!userID) {\n throw new Error('Parameter `userID` is required when calling `getUser`.');\n }\n\n const requestPath = '/2/users/{userID}'.replace('{userID}', encodeURIComponent(userID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a list of user profiles in [lexicographical order](https://www.educative.io/answers/what-is-a-lexicographic-order).\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param getUsers - The getUsers object.\n * @param getUsers.startDate - Filter users by start date (in RFC3339 format). Only users that were updated after the passed date will be returned.\n * @param getUsers.endDate - Filter users by end date (in RFC3339 format). Only users that were updated before the passed date will be returned.\n * @param getUsers.indices - Filter users by matching indices. If multiple indices are passed, returned users will match all indices.\n * @param getUsers.affinity - Filter users by affinity name and value. If multiple values are passed, returned users will match all values.\n * @param getUsers.limit - Limit the number of users in the response. The value of this parameter ranges from 1 to 1000.\n * @param getUsers.nextPageToken - Reference for the next page, when navigating forward using pagination. Can\\'t be used in the same request as `previousPageToken`.\n * @param getUsers.previousPageToken - Reference for the previous page, when navigating backward using pagination. Can\\'t be used in the same request as `nextPageToken`.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUsers(\n { startDate, endDate, indices, affinity, limit, nextPageToken, previousPageToken }: GetUsersProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<GetUsersResponse> {\n const requestPath = '/2/users';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (indices !== undefined) {\n queryParameters['indices'] = indices.toString();\n }\n\n if (affinity !== undefined) {\n queryParameters['affinity'] = affinity.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (nextPageToken !== undefined) {\n queryParameters['nextPageToken'] = nextPageToken.toString();\n }\n\n if (previousPageToken !== undefined) {\n queryParameters['previousPageToken'] = previousPageToken.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Updates the configuration. The configuration is a list of configuration objects for each index. To configure Advanced Personalization for an index, create a new configuration object for the index.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param configurationParameters - The configurationParameters object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n putConfig(\n configurationParameters: ConfigurationParameters,\n requestOptions?: RequestOptions,\n ): Promise<PutConfigResponse> {\n if (!configurationParameters) {\n throw new Error('Parameter `configurationParameters` is required when calling `putConfig`.');\n }\n\n if (!configurationParameters.indices) {\n throw new Error('Parameter `configurationParameters.indices` is required when calling `putConfig`.');\n }\n if (!configurationParameters.personalizationReRanking) {\n throw new Error(\n 'Parameter `configurationParameters.personalizationReRanking` is required when calling `putConfig`.',\n );\n }\n if (!configurationParameters.profileType) {\n throw new Error('Parameter `configurationParameters.profileType` is required when calling `putConfig`.');\n }\n if (!configurationParameters.features) {\n throw new Error('Parameter `configurationParameters.features` is required when calling `putConfig`.');\n }\n\n const requestPath = '/2/config';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: configurationParameters,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA,SAAS,0BAA0B;AAEnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACCP,SAAS,YAAY,mBAAmB,uBAAuB;AA0BxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,0CAA0C,QAAQ,YAAY,MAAM;AAEhF,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,oCAAoC;AAAA,EAClD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SA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mB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,MAAM;AAAA,MACR;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;;;AD1dO,SAAS,8BACd,OACA,QACA,QACA,SAC+B;AAC/B,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO,oCAAoC;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../builds/browser.ts","../../src/advancedPersonalizationClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createAdvancedPersonalizationClient } from '../src/advancedPersonalizationClient';\n\nimport type { Region } from '../src/advancedPersonalizationClient';\nimport { REGIONS } from '../src/advancedPersonalizationClient';\n\nexport type { Region, RegionOptions } from '../src/advancedPersonalizationClient';\n\nexport { apiClientVersion } from '../src/advancedPersonalizationClient';\n\nexport * from '../model';\n\nexport function advancedPersonalizationClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): AdvancedPersonalizationClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return createAdvancedPersonalizationClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinHeaders',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...options,\n });\n}\n\nexport type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { AcceptedResponse } from '../model/acceptedResponse';\nimport type { ConfigurationObject } from '../model/configurationObject';\nimport type { ConfigurationParameters } from '../model/configurationParameters';\n\nimport type { DeleteUserResponse } from '../model/deleteUserResponse';\n\nimport type { GetUsersResponse } from '../model/getUsersResponse';\nimport type { PutConfigResponse } from '../model/putConfigResponse';\nimport type { RealtimeUser } from '../model/realtimeUser';\n\nimport type { User } from '../model/user';\n\nimport type {\n ComputeRealtimeUserProps,\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserProps,\n GetRealtimeUserProps,\n GetUserProps,\n GetUsersProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '0.0.1-alpha.5';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'ai-personalization.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createAdvancedPersonalizationClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'AdvancedPersonalization',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Sends a request to compute the user\\'s personalization profile.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param computeRealtimeUser - The computeRealtimeUser object.\n * @param computeRealtimeUser.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n computeRealtimeUser(\n { userToken }: ComputeRealtimeUserProps,\n requestOptions?: RequestOptions,\n ): Promise<AcceptedResponse> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `computeRealtimeUser`.');\n }\n\n const requestPath = '/2/realtime/users/{userToken}/compute'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a user profile.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param deleteUser - The deleteUser object.\n * @param deleteUser.userID - ID of the user.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUser({ userID }: DeleteUserProps, requestOptions?: RequestOptions): Promise<DeleteUserResponse> {\n if (!userID) {\n throw new Error('Parameter `userID` is required when calling `deleteUser`.');\n }\n\n const requestPath = '/2/users/{userID}'.replace('{userID}', encodeURIComponent(userID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a list of configuration objects for each index.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfig(requestOptions?: RequestOptions | undefined): Promise<ConfigurationObject> {\n const requestPath = '/2/config';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the user\\'s personalization profiles containing search filters.\n *\n * Required API Key ACLs:\n * - recommendation\n * @param getRealtimeUser - The getRealtimeUser object.\n * @param getRealtimeUser.userToken - Unique identifier representing a user for which to fetch the personalization profile.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRealtimeUser({ userToken }: GetRealtimeUserProps, requestOptions?: RequestOptions): Promise<RealtimeUser> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `getRealtimeUser`.');\n }\n\n const requestPath = '/2/realtime/users/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a user profile.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param getUser - The getUser object.\n * @param getUser.userID - ID of the user.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUser({ userID }: GetUserProps, requestOptions?: RequestOptions): Promise<User> {\n if (!userID) {\n throw new Error('Parameter `userID` is required when calling `getUser`.');\n }\n\n const requestPath = '/2/users/{userID}'.replace('{userID}', encodeURIComponent(userID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a list of user profiles in [lexicographical order](https://www.educative.io/answers/what-is-a-lexicographic-order).\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param getUsers - The getUsers object.\n * @param getUsers.startDate - Filter users by start date (in RFC3339 format). Only users that were updated after the passed date will be returned.\n * @param getUsers.endDate - Filter users by end date (in RFC3339 format). Only users that were updated before the passed date will be returned.\n * @param getUsers.indices - Filter users by matching indices. If multiple indices are passed, returned users will match all indices.\n * @param getUsers.affinity - Filter users by affinity name and value. If multiple values are passed, returned users will match all values.\n * @param getUsers.limit - Limit the number of users in the response. The value of this parameter ranges from 1 to 1000.\n * @param getUsers.nextPageToken - Reference for the next page, when navigating forward using pagination. Can\\'t be used in the same request as `previousPageToken`.\n * @param getUsers.previousPageToken - Reference for the previous page, when navigating backward using pagination. Can\\'t be used in the same request as `nextPageToken`.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getUsers(\n { startDate, endDate, indices, affinity, limit, nextPageToken, previousPageToken }: GetUsersProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<GetUsersResponse> {\n const requestPath = '/2/users';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (startDate !== undefined) {\n queryParameters['startDate'] = startDate.toString();\n }\n\n if (endDate !== undefined) {\n queryParameters['endDate'] = endDate.toString();\n }\n\n if (indices !== undefined) {\n queryParameters['indices'] = indices.toString();\n }\n\n if (affinity !== undefined) {\n queryParameters['affinity'] = affinity.toString();\n }\n\n if (limit !== undefined) {\n queryParameters['limit'] = limit.toString();\n }\n\n if (nextPageToken !== undefined) {\n queryParameters['nextPageToken'] = nextPageToken.toString();\n }\n\n if (previousPageToken !== undefined) {\n queryParameters['previousPageToken'] = previousPageToken.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Updates the configuration. The configuration is a list of configuration objects for each index. To configure Advanced Personalization for an index, create a new configuration object for the index.\n *\n * Required API Key ACLs:\n * - search\n * - browse\n * - recommendation\n * @param configurationParameters - The configurationParameters object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n putConfig(\n configurationParameters: ConfigurationParameters,\n requestOptions?: RequestOptions,\n ): Promise<PutConfigResponse> {\n if (!configurationParameters) {\n throw new Error('Parameter `configurationParameters` is required when calling `putConfig`.');\n }\n\n if (!configurationParameters.indices) {\n throw new Error('Parameter `configurationParameters.indices` is required when calling `putConfig`.');\n }\n if (!configurationParameters.personalizationReRanking) {\n throw new Error(\n 'Parameter `configurationParameters.personalizationReRanking` is required when calling `putConfig`.',\n );\n }\n if (!configurationParameters.profileType) {\n throw new Error('Parameter `configurationParameters.profileType` is required when calling `putConfig`.');\n }\n if (!configurationParameters.features) {\n throw new Error('Parameter `configurationParameters.features` is required when calling `putConfig`.');\n }\n\n const requestPath = '/2/config';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: configurationParameters,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA,SAAS,0BAA0B;AAEnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACCP,SAAS,YAAY,mBAAmB,uBAAuB;AA0BxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,0CAA0C,QAAQ,YAAY,MAAM;AAEhF,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,oCAAoC;AAAA,EAClD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;A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AC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO,oCAAoC;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function H(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(n=>t.setRequestHeader(n,e.headers[n]));let i=(n,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0})},n),l=i(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=i(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}function j(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function i(){return JSON.parse(t().getItem(o)||"{}")}function l(n){t().setItem(o,JSON.stringify(n))}function h(){let n=r.timeToLive?r.timeToLive*1e3:null,s=i(),a=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(l(a),!n)return;let c=Object.fromEntries(Object.entries(a).filter(([,p])=>{let g=new Date().getTime();return!(p.timestamp+n<g)}));l(c)}return{get(n,s,a={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),i()[JSON.stringify(n)])).then(c=>Promise.all([c?c.value:s(),c!==void 0])).then(([c,p])=>Promise.all([c,p||a.miss(c)])).then(([c])=>c)},set(n,s){return Promise.resolve().then(()=>{let a=i();return a[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(a)),s})},delete(n){return Promise.resolve().then(()=>{let s=i();delete s[JSON.stringify(n)],t().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function V(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(i=>Promise.all([i,o.miss(i)])).then(([i])=>i)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function w(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,i,l={miss:()=>Promise.resolve()}){return o.get(t,i,l).catch(()=>w({caches:e}).get(t,i,l))},set(t,i){return o.set(t,i).catch(()=>w({caches:e}).set(t,i))},delete(t){return o.delete(t).catch(()=>w({caches:e}).delete(t))},clear(){return o.clear().catch(()=>w({caches:e}).clear())}}}function O(r={serializable:!0}){let e={};return{get(o,t,i={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(n=>i.miss(n)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function $(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function Q({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(i=>t.add(i)),t}function W(){return{debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var G=2*60*1e3;function L(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>G}function i(){return e==="timed out"&&Date.now()-o<=G}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:i}}var J=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}};var M=class extends J{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},Z=class extends M{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError")}},b=class extends M{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},ee=class extends J{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},re=class extends b{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function te(r,e,o){let t=oe(o),i=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(i+=`?${t}`),i}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ne(r,e,o){let t={Accept:"application/json",...r,...e,...o},i={};return Object.keys(t).forEach(l=>{let h=t[l];i[l.toLowerCase()]=h}),i}function ae(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new re(t.message,e,t.error,o):new b(t.message,e,o)}catch{}return new b(r,e,o)}function ue({isTimedOut:r,status:e}){return!r&&~~e===0}function ce({isTimedOut:r,status:e}){return r||ue({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function me({status:r}){return~~(r/100)===2}function le(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:i,algoliaAgent:l,timeouts:h,requester:n,requestsCache:s,responsesCache:a}){async function c(u){let m=await Promise.all(u.map(d=>e.get(d,()=>Promise.resolve(L(d))))),y=m.filter(d=>d.isUp()),x=m.filter(d=>d.isTimedOut()),E=[...y,...x];return{hosts:E.length>0?E:u,getTimeout(d,q){return(x.length===0&&d===0?1:x.length+3+d)*q}}}async function p(u,m,y=!0){let x=[],E=se(u,m),f=ne(o,u.headers,m.headers),d=u.method==="GET"?{...u.data,...m.data}:{},q={...i,...u.queryParameters,...d};if(l.value&&(q["x-algolia-agent"]=l.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?q[P]=m.queryParameters[P]:q[P]=m.queryParameters[P].toString();let v=0,D=async(P,A)=>{let T=P.pop();if(T===void 0)throw new Z(le(x));let U={...h,...m.timeouts},k={data:E,headers:f,method:u.method,url:te(T,u.path,q),connectTimeout:A(v,U.connect),responseTimeout:A(v,y?U.read:U.write)},_=S=>{let z={request:k,response:S,host:T,triesLeft:P.length};return x.push(z),z},R=await n.send(k);if(ce(R)){let S=_(R);return R.isTimedOut&&v++,t.info("Retryable failure",F(S)),await e.set(T,L(T,R.isTimedOut?"timed out":"down")),D(P,A)}if(me(R))return ae(R);throw _(R),ie(R,x)},K=r.filter(P=>P.accept==="readWrite"||(y?P.accept==="read":P.accept==="write")),N=await c(K);return D([...N.hosts].reverse(),N.getTimeout)}function g(u,m={}){let y=u.useReadTransporter||u.method==="GET";if(!y)return p(u,m,y);let x=()=>p(u,m);if((m.cacheable||u.cacheable)!==!0)return x();let f={request:u,requestOptions:m,transporter:{queryParameters:i,headers:o}};return a.get(f,()=>s.get(f,()=>s.set(f,x()).then(d=>Promise.all([s.delete(f),d]),d=>Promise.all([s.delete(f),Promise.reject(d)])).then(([d,q])=>q)),{miss:d=>a.set(f,d)})}return{hostsCache:e,requester:n,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:i,hosts:r,request:g,requestsCache:s,responsesCache:a}}var C="0.0.1-alpha.4",I=["eu","us"];function pe(r){return[{url:"ai-personalization.{region}.algolia.com".replace("{region}",r),accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:i,...l}){let h=$(r,e,o),n=B({hosts:pe(i),...l,algoliaAgent:Q({algoliaAgents:t,client:"AdvancedPersonalization",version:C}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return{transporter:n,appId:r,apiKey:e,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,a){n.algoliaAgent.add({segment:s,version:a})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s},computeRealtimeUser({userToken:s},a){if(!s)throw new Error("Parameter `userToken` is required when calling `computeRealtimeUser`.");let u={method:"POST",path:"/2/realtime/users/{userToken}/compute".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},customDelete({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customGet({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customPost({path:s,parameters:a,body:c},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let y={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(y,p)},customPut({path:s,parameters:a,body:c},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let y={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(y,p)},deleteUser({userID:s},a){if(!s)throw new Error("Parameter `userID` is required when calling `deleteUser`.");let u={method:"DELETE",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},getConfig(s){let g={method:"GET",path:"/2/config",queryParameters:{},headers:{}};return n.request(g,s)},getRealtimeUser({userToken:s},a){if(!s)throw new Error("Parameter `userToken` is required when calling `getRealtimeUser`.");let u={method:"GET",path:"/2/realtime/users/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},getUser({userID:s},a){if(!s)throw new Error("Parameter `userID` is required when calling `getUser`.");let u={method:"GET",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},getUsers({startDate:s,endDate:a,indices:c,affinity:p,limit:g,nextPageToken:u,previousPageToken:m}={},y=void 0){let x="/2/users",E={},f={};s!==void 0&&(f.startDate=s.toString()),a!==void 0&&(f.endDate=a.toString()),c!==void 0&&(f.indices=c.toString()),p!==void 0&&(f.affinity=p.toString()),g!==void 0&&(f.limit=g.toString()),u!==void 0&&(f.nextPageToken=u.toString()),m!==void 0&&(f.previousPageToken=m.toString());let d={method:"GET",path:x,queryParameters:f,headers:E};return n.request(d,y)},putConfig(s,a){if(!s)throw new Error("Parameter `configurationParameters` is required when calling `putConfig`.");if(!s.indices)throw new Error("Parameter `configurationParameters.indices` is required when calling `putConfig`.");if(!s.personalizationReRanking)throw new Error("Parameter `configurationParameters.personalizationReRanking` is required when calling `putConfig`.");if(!s.profileType)throw new Error("Parameter `configurationParameters.profileType` is required when calling `putConfig`.");if(!s.features)throw new Error("Parameter `configurationParameters.features` is required when calling `putConfig`.");let u={method:"PUT",path:"/2/config",queryParameters:{},headers:{},data:s};return n.request(u,a)}}}function Ar(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!o||o&&(typeof o!="string"||!I.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${I.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:W(),requester:H(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:w({caches:[j({key:`${C}-${r}`}),O()]}),...t})}export{Ar as advancedPersonalizationClient,C as apiClientVersion};
|
|
1
|
+
function z(){function r(e){return new Promise(o=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(n=>t.setRequestHeader(n,e.headers[n]));let i=(n,s)=>setTimeout(()=>{t.abort(),o({status:0,content:s,isTimedOut:!0})},n),l=i(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(l),h=i(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(l),clearTimeout(h),o({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(l),clearTimeout(h),o({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}function j(r){let e,o=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function i(){return JSON.parse(t().getItem(o)||"{}")}function l(n){t().setItem(o,JSON.stringify(n))}function h(){let n=r.timeToLive?r.timeToLive*1e3:null,s=i(),a=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(l(a),!n)return;let c=Object.fromEntries(Object.entries(a).filter(([,p])=>{let g=new Date().getTime();return!(p.timestamp+n<g)}));l(c)}return{get(n,s,a={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),i()[JSON.stringify(n)])).then(c=>Promise.all([c?c.value:s(),c!==void 0])).then(([c,p])=>Promise.all([c,p||a.miss(c)])).then(([c])=>c)},set(n,s){return Promise.resolve().then(()=>{let a=i();return a[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},t().setItem(o,JSON.stringify(a)),s})},delete(n){return Promise.resolve().then(()=>{let s=i();delete s[JSON.stringify(n)],t().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{t().removeItem(o)})}}}function V(){return{get(r,e,o={miss:()=>Promise.resolve()}){return e().then(i=>Promise.all([i,o.miss(i)])).then(([i])=>i)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function w(r){let e=[...r.caches],o=e.shift();return o===void 0?V():{get(t,i,l={miss:()=>Promise.resolve()}){return o.get(t,i,l).catch(()=>w({caches:e}).get(t,i,l))},set(t,i){return o.set(t,i).catch(()=>w({caches:e}).set(t,i))},delete(t){return o.delete(t).catch(()=>w({caches:e}).delete(t))},clear(){return o.clear().catch(()=>w({caches:e}).clear())}}}function O(r={serializable:!0}){let e={};return{get(o,t,i={miss:()=>Promise.resolve()}){let l=JSON.stringify(o);if(l in e)return Promise.resolve(r.serializable?JSON.parse(e[l]):e[l]);let h=t();return h.then(n=>i.miss(n)).then(()=>h)},set(o,t){return e[JSON.stringify(o)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function Y(r){let e={value:`Algolia for JavaScript (${r})`,add(o){let t=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function $(r,e,o="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return o==="WithinHeaders"?t:{}},queryParameters(){return o==="WithinQueryParameters"?t:{}}}}function W({algoliaAgents:r,client:e,version:o}){let t=Y(o).add({segment:e,version:o});return r.forEach(i=>t.add(i)),t}function J(){return{debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var G=2*60*1e3;function L(r,e="up"){let o=Date.now();function t(){return e==="up"||Date.now()-o>G}function i(){return e==="timed out"&&Date.now()-o<=G}return{...r,status:e,lastUpdate:o,isUp:t,isTimedOut:i}}var Q=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}};var M=class extends Q{stackTrace;constructor(r,e,o){super(r,o),this.stackTrace=e}},Z=class extends M{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",r,"RetryError")}},b=class extends M{status;constructor(r,e,o,t="ApiError"){super(r,o,t),this.status=e}},ee=class extends Q{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},re=class extends b{error;constructor(r,e,o,t){super(r,e,t,"DetailedApiError"),this.error=o}};function te(r,e,o){let t=oe(o),i=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(i+=`?${t}`),i}function oe(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function se(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let o=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(o)}function ne(r,e,o){let t={Accept:"application/json",...r,...e,...o},i={};return Object.keys(t).forEach(l=>{let h=t[l];i[l.toLowerCase()]=h}),i}function ae(r){try{return JSON.parse(r.content)}catch(e){throw new ee(e.message,r)}}function ie({content:r,status:e},o){try{let t=JSON.parse(r);return"error"in t?new re(t.message,e,t.error,o):new b(t.message,e,o)}catch{}return new b(r,e,o)}function ue({isTimedOut:r,status:e}){return!r&&~~e===0}function ce({isTimedOut:r,status:e}){return r||ue({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function me({status:r}){return~~(r/100)===2}function le(r){return r.map(e=>F(e))}function F(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function B({hosts:r,hostsCache:e,baseHeaders:o,logger:t,baseQueryParameters:i,algoliaAgent:l,timeouts:h,requester:n,requestsCache:s,responsesCache:a}){async function c(u){let m=await Promise.all(u.map(d=>e.get(d,()=>Promise.resolve(L(d))))),y=m.filter(d=>d.isUp()),x=m.filter(d=>d.isTimedOut()),E=[...y,...x];return{hosts:E.length>0?E:u,getTimeout(d,q){return(x.length===0&&d===0?1:x.length+3+d)*q}}}async function p(u,m,y=!0){let x=[],E=se(u,m),f=ne(o,u.headers,m.headers),d=u.method==="GET"?{...u.data,...m.data}:{},q={...i,...u.queryParameters,...d};if(l.value&&(q["x-algolia-agent"]=l.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?q[P]=m.queryParameters[P]:q[P]=m.queryParameters[P].toString();let v=0,D=async(P,A)=>{let T=P.pop();if(T===void 0)throw new Z(le(x));let U={...h,...m.timeouts},k={data:E,headers:f,method:u.method,url:te(T,u.path,q),connectTimeout:A(v,U.connect),responseTimeout:A(v,y?U.read:U.write)},_=S=>{let H={request:k,response:S,host:T,triesLeft:P.length};return x.push(H),H},R=await n.send(k);if(ce(R)){let S=_(R);return R.isTimedOut&&v++,t.info("Retryable failure",F(S)),await e.set(T,L(T,R.isTimedOut?"timed out":"down")),D(P,A)}if(me(R))return ae(R);throw _(R),ie(R,x)},K=r.filter(P=>P.accept==="readWrite"||(y?P.accept==="read":P.accept==="write")),N=await c(K);return D([...N.hosts].reverse(),N.getTimeout)}function g(u,m={}){let y=u.useReadTransporter||u.method==="GET";if(!y)return p(u,m,y);let x=()=>p(u,m);if((m.cacheable||u.cacheable)!==!0)return x();let f={request:u,requestOptions:m,transporter:{queryParameters:i,headers:o}};return a.get(f,()=>s.get(f,()=>s.set(f,x()).then(d=>Promise.all([s.delete(f),d]),d=>Promise.all([s.delete(f),Promise.reject(d)])).then(([d,q])=>q)),{miss:d=>a.set(f,d)})}return{hostsCache:e,requester:n,timeouts:h,logger:t,algoliaAgent:l,baseHeaders:o,baseQueryParameters:i,hosts:r,request:g,requestsCache:s,responsesCache:a}}var C="0.0.1-alpha.5",I=["eu","us"];function pe(r){return[{url:"ai-personalization.{region}.algolia.com".replace("{region}",r),accept:"readWrite",protocol:"https"}]}function X({appId:r,apiKey:e,authMode:o,algoliaAgents:t,region:i,...l}){let h=$(r,e,o),n=B({hosts:pe(i),...l,algoliaAgent:W({algoliaAgents:t,client:"AdvancedPersonalization",version:C}),baseHeaders:{"content-type":"text/plain",...h.headers(),...l.baseHeaders},baseQueryParameters:{...h.queryParameters(),...l.baseQueryParameters}});return{transporter:n,appId:r,apiKey:e,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,a){n.algoliaAgent.add({segment:s,version:a})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s},computeRealtimeUser({userToken:s},a){if(!s)throw new Error("Parameter `userToken` is required when calling `computeRealtimeUser`.");let u={method:"POST",path:"/2/realtime/users/{userToken}/compute".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},customDelete({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customGet({path:s,parameters:a},c){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return n.request(m,c)},customPost({path:s,parameters:a,body:c},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let y={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(y,p)},customPut({path:s,parameters:a,body:c},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let y={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:c||{}};return n.request(y,p)},deleteUser({userID:s},a){if(!s)throw new Error("Parameter `userID` is required when calling `deleteUser`.");let u={method:"DELETE",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},getConfig(s){let g={method:"GET",path:"/2/config",queryParameters:{},headers:{}};return n.request(g,s)},getRealtimeUser({userToken:s},a){if(!s)throw new Error("Parameter `userToken` is required when calling `getRealtimeUser`.");let u={method:"GET",path:"/2/realtime/users/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},getUser({userID:s},a){if(!s)throw new Error("Parameter `userID` is required when calling `getUser`.");let u={method:"GET",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(u,a)},getUsers({startDate:s,endDate:a,indices:c,affinity:p,limit:g,nextPageToken:u,previousPageToken:m}={},y=void 0){let x="/2/users",E={},f={};s!==void 0&&(f.startDate=s.toString()),a!==void 0&&(f.endDate=a.toString()),c!==void 0&&(f.indices=c.toString()),p!==void 0&&(f.affinity=p.toString()),g!==void 0&&(f.limit=g.toString()),u!==void 0&&(f.nextPageToken=u.toString()),m!==void 0&&(f.previousPageToken=m.toString());let d={method:"GET",path:x,queryParameters:f,headers:E};return n.request(d,y)},putConfig(s,a){if(!s)throw new Error("Parameter `configurationParameters` is required when calling `putConfig`.");if(!s.indices)throw new Error("Parameter `configurationParameters.indices` is required when calling `putConfig`.");if(!s.personalizationReRanking)throw new Error("Parameter `configurationParameters.personalizationReRanking` is required when calling `putConfig`.");if(!s.profileType)throw new Error("Parameter `configurationParameters.profileType` is required when calling `putConfig`.");if(!s.features)throw new Error("Parameter `configurationParameters.features` is required when calling `putConfig`.");let u={method:"PUT",path:"/2/config",queryParameters:{},headers:{},data:s};return n.request(u,a)}}}function Ar(r,e,o,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!o||o&&(typeof o!="string"||!I.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${I.join(", ")}`);return X({appId:r,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:J(),requester:z(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinHeaders",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:w({caches:[j({key:`${C}-${r}`}),O()]}),...t})}export{Ar as advancedPersonalizationClient,C as apiClientVersion};
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|