@algolia/advanced-personalization 0.0.1-alpha.40 → 0.0.1-alpha.42
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 +1 -1
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +4 -4
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +4 -4
- 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 +6 -6
package/README.md
CHANGED
|
@@ -40,11 +40,11 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
40
40
|
### With a package manager
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
yarn add @algolia/advanced-personalization@0.0.1-alpha.
|
|
43
|
+
yarn add @algolia/advanced-personalization@0.0.1-alpha.42
|
|
44
44
|
# or
|
|
45
|
-
npm install @algolia/advanced-personalization@0.0.1-alpha.
|
|
45
|
+
npm install @algolia/advanced-personalization@0.0.1-alpha.42
|
|
46
46
|
# or
|
|
47
|
-
pnpm add @algolia/advanced-personalization@0.0.1-alpha.
|
|
47
|
+
pnpm add @algolia/advanced-personalization@0.0.1-alpha.42
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
### Without a package manager
|
|
@@ -52,7 +52,7 @@ pnpm add @algolia/advanced-personalization@0.0.1-alpha.40
|
|
|
52
52
|
Add the following JavaScript snippet to the <head> of your website:
|
|
53
53
|
|
|
54
54
|
```html
|
|
55
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/advanced-personalization@0.0.1-alpha.
|
|
55
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/advanced-personalization@0.0.1-alpha.42/dist/builds/browser.umd.js"></script>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Usage
|
package/dist/browser.d.ts
CHANGED
|
@@ -320,7 +320,7 @@ type GetUsersProps = {
|
|
|
320
320
|
previousPageToken?: string | undefined;
|
|
321
321
|
};
|
|
322
322
|
|
|
323
|
-
declare const apiClientVersion = "0.0.1-alpha.
|
|
323
|
+
declare const apiClientVersion = "0.0.1-alpha.42";
|
|
324
324
|
declare const REGIONS: readonly ["eu", "us"];
|
|
325
325
|
type Region = (typeof REGIONS)[number];
|
|
326
326
|
type RegionOptions = {
|
package/dist/builds/browser.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createXhrRequester } from "@algolia/requester-browser-xhr";
|
|
|
9
9
|
|
|
10
10
|
// src/advancedPersonalizationClient.ts
|
|
11
11
|
import { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from "@algolia/client-common";
|
|
12
|
-
var apiClientVersion = "0.0.1-alpha.
|
|
12
|
+
var apiClientVersion = "0.0.1-alpha.42";
|
|
13
13
|
var REGIONS = ["eu", "us"];
|
|
14
14
|
function getDefaultHosts(region) {
|
|
15
15
|
const url = "ai-personalization.{region}.algolia.com".replace("{region}", region);
|
|
@@ -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 {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\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 const { compression: _compression, ...browserOptions } = options || {};\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 ...browserOptions,\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, validateRequired } from '@algolia/client-common';\n\nimport type { AcceptedResponse } from '../model/acceptedResponse';\nimport type { ConfigurationObject } from '../model/configurationObject';\nimport type { ConfigurationParameters } from '../model/configurationParameters';\nimport type { DeleteUserResponse } from '../model/deleteUserResponse';\nimport type { GetUsersResponse } from '../model/getUsersResponse';\nimport type { PutConfigResponse } from '../model/putConfigResponse';\nimport type { RealtimeUser } from '../model/realtimeUser';\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.40';\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 real-time user\\'s personalization profile.\n *\n * Required API Key ACLs:\n * - recommendation\n *\n * @deprecated\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 validateRequired('userToken', 'computeRealtimeUser', userToken);\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 validateRequired('path', 'customDelete', path);\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 validateRequired('path', 'customGet', path);\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 validateRequired('path', 'customPost', path);\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 validateRequired('path', 'customPut', path);\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 validateRequired('userID', 'deleteUser', userID);\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 real-time 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 validateRequired('userToken', 'getRealtimeUser', userToken);\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 validateRequired('userID', 'getUser', userID);\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 and time, in RFC 3339 format. Only users that were updated after the passed date will be returned.\n * @param getUsers.endDate - Filter users by end date and time, in RFC 3339 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 validateRequired('configurationParameters', 'putConfig', configurationParameters);\n\n validateRequired('configurationParameters.indices', 'putConfig', configurationParameters.indices);\n validateRequired(\n 'configurationParameters.personalizationReRanking',\n 'putConfig',\n configurationParameters.personalizationReRanking,\n );\n validateRequired('configurationParameters.profileType', 'putConfig', configurationParameters.profileType);\n validateRequired('configurationParameters.features', 'putConfig', configurationParameters.features);\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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,wBAAwB;AAuB1E,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;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA;AAAA;AAAA;AAAA,IAKP,QAAQ;AAAA;AAAA;AAAA;AAAA,IAKR,aAA4B;AAC1B,aAAO,QAAQ,IAAI,CAAC,YAAY,cAAc,MAAM,GAAG,YAAY,eAAe,MAAM,CAAC,CAAC,EAAE,KAAK,MAAM,MAAS;AAAA,IAClH;AAAA;AAAA;AAAA;AAAA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AAA,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 {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\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 const { compression: _compression, ...browserOptions } = options || {};\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 ...browserOptions,\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, validateRequired } from '@algolia/client-common';\n\nimport type { AcceptedResponse } from '../model/acceptedResponse';\nimport type { ConfigurationObject } from '../model/configurationObject';\nimport type { ConfigurationParameters } from '../model/configurationParameters';\nimport type { DeleteUserResponse } from '../model/deleteUserResponse';\nimport type { GetUsersResponse } from '../model/getUsersResponse';\nimport type { PutConfigResponse } from '../model/putConfigResponse';\nimport type { RealtimeUser } from '../model/realtimeUser';\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.42';\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 real-time user\\'s personalization profile.\n *\n * Required API Key ACLs:\n * - recommendation\n *\n * @deprecated\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 validateRequired('userToken', 'computeRealtimeUser', userToken);\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 validateRequired('path', 'customDelete', path);\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 validateRequired('path', 'customGet', path);\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 validateRequired('path', 'customPost', path);\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 validateRequired('path', 'customPut', path);\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 validateRequired('userID', 'deleteUser', userID);\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 real-time 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 validateRequired('userToken', 'getRealtimeUser', userToken);\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 validateRequired('userID', 'getUser', userID);\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 and time, in RFC 3339 format. Only users that were updated after the passed date will be returned.\n * @param getUsers.endDate - Filter users by end date and time, in RFC 3339 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 validateRequired('configurationParameters', 'putConfig', configurationParameters);\n\n validateRequired('configurationParameters.indices', 'putConfig', configurationParameters.indices);\n validateRequired(\n 'configurationParameters.personalizationReRanking',\n 'putConfig',\n configurationParameters.personalizationReRanking,\n );\n validateRequired('configurationParameters.profileType', 'putConfig', configurationParameters.profileType);\n validateRequired('configurationParameters.features', 'putConfig', configurationParameters.features);\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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,wBAAwB;AAuB1E,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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AAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI,WAAW,CAAC;AAErE,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,6 +1,6 @@
|
|
|
1
|
-
function Y(t){let e,
|
|
1
|
+
function Y(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(o)||"{}")}function m(s){r().setItem(o,JSON.stringify(s))}function h(){return new Promise(s=>setTimeout(s,0))}function i(){let s=t.timeToLive?t.timeToLive*1e3:null,n=a(),c=new Date().getTime(),p=!1;return{namespace:Object.fromEntries(Object.entries(n).filter(([,d])=>!d||d.timestamp===void 0||s&&d.timestamp+s<c?(p=!0,!1):!0)),changed:p}}return{get(s,n,c={miss:()=>Promise.resolve()}){return h().then(()=>{let{namespace:p,changed:f}=i(),d=p[JSON.stringify(s)];return f&&m(p),d?d.value:n().then(y=>c.miss(y).then(()=>y))})},set(s,n){return h().then(()=>{let c=a();return c[JSON.stringify(s)]={timestamp:new Date().getTime(),value:n},r().setItem(o,JSON.stringify(c)),n})},delete(s){return h().then(()=>{let n=a();delete n[JSON.stringify(s)],r().setItem(o,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{r().removeItem(o)})}}}function ce(){return{get(t,e,o={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,o.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(t){let e=[...t.caches],o=e.shift();return o===void 0?ce():{get(r,a,m={miss:()=>Promise.resolve()}){return o.get(r,a,m).catch(()=>O({caches:e}).get(r,a,m))},set(r,a){return o.set(r,a).catch(()=>O({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>O({caches:e}).delete(r))},clear(){return o.clear().catch(()=>O({caches:e}).clear())}}}function k(t={serializable:!0}){let e={};return{get(o,r,a={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let h=r();return h.then(i=>a.miss(i)).then(()=>h)},set(o,r){return e[JSON.stringify(o)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function ue(t){let e={value:`Algolia for JavaScript (${t})`,add(o){let r=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Z(t,e,o="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return o==="WithinHeaders"?r:{}},queryParameters(){return o==="WithinQueryParameters"?r:{}}}}function ee({algoliaAgents:t,client:e,version:o}){let r=ue(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}function te(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var le=10*1024*1024;async function*me(t){let e=t.getReader();try{for(;;){let{done:o,value:r}=await e.read();if(o)return;yield r}}finally{e.releaseLock()}}function de(t){return Symbol.asyncIterator in t?t:me(t)}async function*pe(t){let e=new TextDecoder("utf-8"),o=[],r=0,a=!1,m=!0;for await(let i of de(t)){let s=e.decode(i,{stream:!0}),n=0;for(a&&(a=!1,s.length>0&&s[0]===`
|
|
2
2
|
`&&(n=1));n<s.length;){let c=s.indexOf("\r",n),p=s.indexOf(`
|
|
3
|
-
`,n);if(c===-1&&p===-1){let u=s.slice(n);if(
|
|
4
|
-
`?2:1:(a=!0,d=1)):(f=p,d=1);let y=s.slice(n,f);
|
|
5
|
-
`),event:t,id:this.lastEventId,retry:this.retry};return this.data=[],e}};async function*he(t){let e=new fe;for await(let r of pe(t)){let o=e.decode(r);o!==null&&(yield o)}}var ge=750,M=120*1e3;function Q(t,e="up"){let r=Date.now();function o(){return e==="up"||Date.now()-r>M}function a(){return e==="timed out"&&Date.now()-r<=M}return{...t,status:e,lastUpdate:r,isUp:o,isTimedOut:a}}var re=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var oe=class extends re{stackTrace;constructor(t,e,r){super(t,r),this.stackTrace=e}},B=class extends oe{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError")}},j=class extends oe{status;constructor(t,e,r,o="ApiError"){super(t,r,o),this.status=e}},Pe=class extends re{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},ye=class extends j{error;constructor(t,e,r,o){super(t,e,o,"DetailedApiError"),this.error=r}};function X(t,e,r){let o=xe(r),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return o.length&&(a+=`?${o}`),a}function xe(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replace(/\+/g,"%20")}`).join("&")}function K(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let r=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(r)}function V(t,e,r){let o={Accept:"application/json",...t,...e,...r},a={};return Object.keys(o).forEach(m=>{let h=o[m];a[m.toLowerCase()]=h}),a}function Re(t){if(!(t.status===204||t.content.length===0))try{return JSON.parse(t.content)}catch(e){throw new Pe(e.message,t)}}function ve({content:t,status:e},r){try{let o=JSON.parse(t);return"error"in o?new ye(o.message,e,o.error,r):new j(o.message,e,r)}catch{}return new j(t,e,r)}function Te({isTimedOut:t,status:e}){return!t&&~~e===0}function Ee({isTimedOut:t,status:e}){return t||Te({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function qe({status:t}){return~~(t/100)===2}function we(t){return t.map(e=>se(e))}function se(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function ne({hosts:t,hostsCache:e,baseHeaders:r,logger:o,baseQueryParameters:a,algoliaAgent:m,timeouts:h,requester:i,requestsCache:s,responsesCache:n,compress:c,compression:p}){async function f(u){let l=await Promise.all(u.map(g=>e.get(g,()=>Promise.resolve(Q(g))))),P=l.filter(g=>g.isUp()),R=l.filter(g=>g.isTimedOut()),w=[...P,...R];return{hosts:w.length>0?w:u,getTimeout(g,S){return(R.length===0&&g===0?1:R.length+3+g)*S}}}async function d(u,l,P){let R=[],w=K(u,l),x=V(r,u.headers,l.headers),g=p==="gzip"&&w!==void 0&&w.length>ge&&(u.method==="POST"||u.method==="PUT");g&&c===void 0&&o.info("Compression is disabled because no compress method is available.");let S=g&&c!==void 0,_=S?await c(w):w;S&&(x["content-encoding"]="gzip");let I=u.method==="GET"?{...u.data,...l.data}:{},C={...a,...u.queryParameters,...I};if(m.value&&(C["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let v of Object.keys(l.queryParameters))!l.queryParameters[v]||Object.prototype.toString.call(l.queryParameters[v])==="[object Object]"?C[v]=l.queryParameters[v]:C[v]=l.queryParameters[v].toString();let A=0,D=async(v,z)=>{let U=v.pop();if(U===void 0)throw new B(we(R));let H={...h,...l.timeouts},F={data:_,headers:x,method:u.method,url:X(U,u.path,C),connectTimeout:z(A,H.connect),responseTimeout:z(A,P?H.read:H.write)},W=L=>{let J={request:F,response:L,host:U,triesLeft:v.length};return R.push(J),J},b=await i.send(F);if(Ee(b)){let L=W(b);return b.isTimedOut&&A++,o.info("Retryable failure",se(L)),await e.set(U,Q(U,b.isTimedOut?"timed out":"down")),D(v,z)}if(qe(b))return Re(b);throw W(b),ve(b,R)},q=t.filter(v=>v.accept==="readWrite"||(P?v.accept==="read":v.accept==="write")),$=await f(q);return D([...$.hosts].reverse(),$.getTimeout)}function y(u,l={}){let P=()=>d(u,l,R),R=u.useReadTransporter||u.method==="GET";if((l.cacheable||u.cacheable)!==!0)return P();let x={request:u,requestOptions:l,transporter:{queryParameters:a,headers:r}};return n.get(x,()=>s.get(x,()=>s.set(x,P()).then(g=>Promise.all([s.delete(x),g]),g=>Promise.all([s.delete(x),Promise.reject(g)])).then(([g,S])=>S)),{miss:g=>n.set(x,g)})}async function*E(u,l={}){if(!i.sendStream)throw new Error("This requester does not support streaming");let P=K(u,l),R=V(r,u.headers,l.headers);R.accept="text/event-stream";let w=u.method==="GET"?{...u.data,...l.data}:{},x={...a,...u.queryParameters,...w};if(m.value&&(x["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let q of Object.keys(l.queryParameters))!l.queryParameters[q]||Object.prototype.toString.call(l.queryParameters[q])==="[object Object]"?x[q]=l.queryParameters[q]:x[q]=l.queryParameters[q].toString();let g=u.useReadTransporter||u.method==="GET",S=t.filter(q=>q.accept==="readWrite"||(g?q.accept==="read":q.accept==="write")),I=(await f(S)).hosts[0];if(!I)throw new B([]);let C={...h,...l.timeouts},A={data:P,headers:R,method:u.method,url:X(I,u.path,x),connectTimeout:C.connect,responseTimeout:g?C.read:C.write},D=await i.sendStream(A);yield*he(D)}return{hostsCache:e,requester:i,timeouts:h,logger:o,algoliaAgent:m,baseHeaders:r,baseQueryParameters:a,hosts:t,request:y,requestStream:E,requestsCache:s,responsesCache:n}}function T(t,e,r){if(r==null||typeof r=="string"&&r.length===0)throw new Error(`Parameter \`${t}\` is required when calling \`${e}\`.`)}function ae(){function t(e){return new Promise(r=>{let o=new XMLHttpRequest;o.open(e.method,e.url,!0),Object.keys(e.headers).forEach(i=>o.setRequestHeader(i,e.headers[i]));let a=(i,s)=>setTimeout(()=>{o.abort(),r({status:0,content:s,isTimedOut:!0})},i),m=a(e.connectTimeout,"Connection timeout"),h;o.onreadystatechange=()=>{o.readyState>o.OPENED&&h===void 0&&(clearTimeout(m),h=a(e.responseTimeout,"Socket timeout"))},o.onerror=()=>{o.status===0&&(clearTimeout(m),clearTimeout(h),r({content:o.responseText||"Network request failed",status:o.status,isTimedOut:!1}))},o.onload=()=>{clearTimeout(m),clearTimeout(h),r({content:o.responseText,status:o.status,isTimedOut:!1})},o.send(e.data)})}return{send:t}}var N="0.0.1-alpha.40",G=["eu","us"];function Se(t){return[{url:"ai-personalization.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function ie({appId:t,apiKey:e,authMode:r,algoliaAgents:o,region:a,...m}){let h=Z(t,e,r),i=ne({hosts:Se(a),...m,algoliaAgent:ee({algoliaAgents:o,client:"AdvancedPersonalization",version:N}),baseHeaders:{"content-type":"text/plain",...h.headers(),...m.baseHeaders},baseQueryParameters:{...h.queryParameters(),...m.baseQueryParameters}});return{transporter:i,appId:t,apiKey:e,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(s,n){i.algoliaAgent.add({segment:s,version:n})},setClientApiKey({apiKey:s}){!r||r==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=s:i.baseQueryParameters["x-algolia-api-key"]=s},computeRealtimeUser({userToken:s},n){T("userToken","computeRealtimeUser",s);let d={method:"POST",path:"/2/realtime/users/{userToken}/compute".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},customDelete({path:s,parameters:n},c){T("path","customDelete",s);let y={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(y,c)},customGet({path:s,parameters:n},c){T("path","customGet",s);let y={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(y,c)},customPost({path:s,parameters:n,body:c},p){T("path","customPost",s);let E={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:c||{}};return i.request(E,p)},customPut({path:s,parameters:n,body:c},p){T("path","customPut",s);let E={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:c||{}};return i.request(E,p)},deleteUser({userID:s},n){T("userID","deleteUser",s);let d={method:"DELETE",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},getConfig(s){let f={method:"GET",path:"/2/config",queryParameters:{},headers:{}};return i.request(f,s)},getRealtimeUser({userToken:s},n){T("userToken","getRealtimeUser",s);let d={method:"GET",path:"/2/realtime/users/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},getUser({userID:s},n){T("userID","getUser",s);let d={method:"GET",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},getUsers({startDate:s,endDate:n,indices:c,affinity:p,limit:f,nextPageToken:d,previousPageToken:y}={},E=void 0){let u="/2/users",l={},P={};s!==void 0&&(P.startDate=s.toString()),n!==void 0&&(P.endDate=n.toString()),c!==void 0&&(P.indices=c.toString()),p!==void 0&&(P.affinity=p.toString()),f!==void 0&&(P.limit=f.toString()),d!==void 0&&(P.nextPageToken=d.toString()),y!==void 0&&(P.previousPageToken=y.toString());let R={method:"GET",path:u,queryParameters:P,headers:l};return i.request(R,E)},putConfig(s,n){T("configurationParameters","putConfig",s),T("configurationParameters.indices","putConfig",s.indices),T("configurationParameters.personalizationReRanking","putConfig",s.personalizationReRanking),T("configurationParameters.profileType","putConfig",s.profileType),T("configurationParameters.features","putConfig",s.features);let d={method:"PUT",path:"/2/config",queryParameters:{},headers:{},data:s};return i.request(d,n)}}}function Wt(t,e,r,o){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!r||r&&(typeof r!="string"||!G.includes(r)))throw new Error(`\`region\` is required and must be one of the following: ${G.join(", ")}`);let{compression:a,...m}=o||{};return ie({appId:t,apiKey:e,region:r,timeouts:{connect:1e3,read:2e3,write:3e4},logger:te(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinHeaders",responsesCache:k(),requestsCache:k({serializable:!1}),hostsCache:O({caches:[Y({key:`${N}-${t}`}),k()]}),...m})}export{Wt as advancedPersonalizationClient,N as apiClientVersion};
|
|
3
|
+
`,n);if(c===-1&&p===-1){let u=s.slice(n);if(o.push(u),r+=u.length,r>le)throw new Error("SSE line buffer exceeded 10MB");break}let f,d;c!==-1&&(p===-1||c<p)?(f=c,c+1<s.length?d=s[c+1]===`
|
|
4
|
+
`?2:1:(a=!0,d=1)):(f=p,d=1);let y=s.slice(n,f);o.push(y);let E=o.length===1?o[0]:o.join("");o.length=0,r=0,m&&(E.startsWith("\uFEFF")&&(E=E.slice(1)),m=!1),yield E,n=f+d}}let h=e.decode();if(h&&o.push(h),o.length>0){let i=o.join("");m&&i.startsWith("\uFEFF")&&(i=i.slice(1)),yield i}}var fe=class{data=[];eventType="";lastEventId=null;retry=null;decode(t){if(t==="")return this.dispatch();if(t[0]===":")return null;let e=t.indexOf(":"),o,r;switch(e===-1?(o=t,r=""):(o=t.slice(0,e),r=t.slice(e+1),r[0]===" "&&(r=r.slice(1))),o){case"data":this.data.push(r);break;case"event":this.eventType=r;break;case"id":r.includes("\0")||(this.lastEventId=r);break;case"retry":/^[0-9]+$/.test(r)&&(this.retry=parseInt(r,10));break}return null}dispatch(){let t=this.eventType;if(this.eventType="",this.data.length===0)return null;let e={data:this.data.join(`
|
|
5
|
+
`),event:t,id:this.lastEventId,retry:this.retry};return this.data=[],e}};async function*he(t){let e=new fe;for await(let o of pe(t)){let r=e.decode(o);r!==null&&(yield r)}}var ge=750,M=120*1e3;function Q(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>M}function a(){return e==="timed out"&&Date.now()-o<=M}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var re=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var oe=class extends re{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e}},B=class extends oe{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError")}},j=class extends oe{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},Pe=class extends re{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},ye=class extends j{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function X(t,e,o){let r=xe(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function xe(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replace(/\+/g,"%20")}`).join("&")}function K(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let o=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(o)}function V(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(m=>{let h=r[m];a[m.toLowerCase()]=h}),a}function Re(t){if(!(t.status===204||t.content.length===0))try{return JSON.parse(t.content)}catch(e){throw new Pe(e.message,t)}}function ve({content:t,status:e},o){try{let r=JSON.parse(t);return"error"in r?new ye(r.message,e,r.error,o):new j(r.message,e,o)}catch{}return new j(t,e,o)}function Te({isTimedOut:t,status:e}){return!t&&~~e===0}function Ee({isTimedOut:t,status:e}){return t||Te({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function qe({status:t}){return~~(t/100)===2}function we(t){return t.map(e=>se(e))}function se(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function ne({hosts:t,hostsCache:e,baseHeaders:o,logger:r,baseQueryParameters:a,algoliaAgent:m,timeouts:h,requester:i,requestsCache:s,responsesCache:n,compress:c,compression:p}){async function f(u){let l=await Promise.all(u.map(g=>e.get(g,()=>Promise.resolve(Q(g))))),P=l.filter(g=>g.isUp()),R=l.filter(g=>g.isTimedOut()),w=[...P,...R];return{hosts:w.length>0?w:u,getTimeout(g,S){return(R.length===0&&g===0?1:R.length+3+g)*S}}}async function d(u,l,P){let R=[],w=K(u,l),x=V(o,u.headers,l.headers),g=p==="gzip"&&w!==void 0&&w.length>ge&&(u.method==="POST"||u.method==="PUT");g&&c===void 0&&r.info("Compression is disabled because no compress method is available.");let S=g&&c!==void 0,_=S?await c(w):w;S&&(x["content-encoding"]="gzip");let I=u.method==="GET"?{...u.data,...l.data}:{},C={...a,...u.queryParameters,...I};if(m.value&&(C["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let v of Object.keys(l.queryParameters))!l.queryParameters[v]||Object.prototype.toString.call(l.queryParameters[v])==="[object Object]"?C[v]=l.queryParameters[v]:C[v]=l.queryParameters[v].toString();let A=0,D=async(v,z)=>{let U=v.pop();if(U===void 0)throw new B(we(R));let H={...h,...l.timeouts},F={data:_,headers:x,method:u.method,url:X(U,u.path,C),connectTimeout:z(A,H.connect),responseTimeout:z(A,P?H.read:H.write)},W=L=>{let J={request:F,response:L,host:U,triesLeft:v.length};return R.push(J),J},b=await i.send(F);if(Ee(b)){let L=W(b);return b.isTimedOut&&A++,r.info("Retryable failure",se(L)),await e.set(U,Q(U,b.isTimedOut?"timed out":"down")),D(v,z)}if(qe(b))return Re(b);throw W(b),ve(b,R)},q=t.filter(v=>v.accept==="readWrite"||(P?v.accept==="read":v.accept==="write")),$=await f(q);return D([...$.hosts].reverse(),$.getTimeout)}function y(u,l={}){let P=()=>d(u,l,R),R=u.useReadTransporter||u.method==="GET";if((l.cacheable||u.cacheable)!==!0)return P();let x={request:u,requestOptions:l,transporter:{queryParameters:a,headers:o}};return n.get(x,()=>s.get(x,()=>s.set(x,P()).then(g=>Promise.all([s.delete(x),g]),g=>Promise.all([s.delete(x),Promise.reject(g)])).then(([g,S])=>S)),{miss:g=>n.set(x,g)})}async function*E(u,l={}){if(!i.sendStream)throw new Error("This requester does not support streaming");let P=K(u,l),R=V(o,u.headers,l.headers);R.accept="text/event-stream";let w=u.method==="GET"?{...u.data,...l.data}:{},x={...a,...u.queryParameters,...w};if(m.value&&(x["x-algolia-agent"]=m.value),l&&l.queryParameters)for(let q of Object.keys(l.queryParameters))!l.queryParameters[q]||Object.prototype.toString.call(l.queryParameters[q])==="[object Object]"?x[q]=l.queryParameters[q]:x[q]=l.queryParameters[q].toString();let g=u.useReadTransporter||u.method==="GET",S=t.filter(q=>q.accept==="readWrite"||(g?q.accept==="read":q.accept==="write")),I=(await f(S)).hosts[0];if(!I)throw new B([]);let C={...h,...l.timeouts},A={data:P,headers:R,method:u.method,url:X(I,u.path,x),connectTimeout:C.connect,responseTimeout:g?C.read:C.write},D=await i.sendStream(A);yield*he(D)}return{hostsCache:e,requester:i,timeouts:h,logger:r,algoliaAgent:m,baseHeaders:o,baseQueryParameters:a,hosts:t,request:y,requestStream:E,requestsCache:s,responsesCache:n}}function T(t,e,o){if(o==null||typeof o=="string"&&o.length===0)throw new Error(`Parameter \`${t}\` is required when calling \`${e}\`.`)}function ae(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(i=>r.setRequestHeader(i,e.headers[i]));let a=(i,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0})},i),m=a(e.connectTimeout,"Connection timeout"),h;r.onreadystatechange=()=>{r.readyState>r.OPENED&&h===void 0&&(clearTimeout(m),h=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(h),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(m),clearTimeout(h),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var N="0.0.1-alpha.42",G=["eu","us"];function Se(t){return[{url:"ai-personalization.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function ie({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:a,...m}){let h=Z(t,e,o),i=ne({hosts:Se(a),...m,algoliaAgent:ee({algoliaAgents:r,client:"AdvancedPersonalization",version:N}),baseHeaders:{"content-type":"text/plain",...h.headers(),...m.baseHeaders},baseQueryParameters:{...h.queryParameters(),...m.baseQueryParameters}});return{transporter:i,appId:t,apiKey:e,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(s,n){i.algoliaAgent.add({segment:s,version:n})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=s:i.baseQueryParameters["x-algolia-api-key"]=s},computeRealtimeUser({userToken:s},n){T("userToken","computeRealtimeUser",s);let d={method:"POST",path:"/2/realtime/users/{userToken}/compute".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},customDelete({path:s,parameters:n},c){T("path","customDelete",s);let y={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(y,c)},customGet({path:s,parameters:n},c){T("path","customGet",s);let y={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(y,c)},customPost({path:s,parameters:n,body:c},p){T("path","customPost",s);let E={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:c||{}};return i.request(E,p)},customPut({path:s,parameters:n,body:c},p){T("path","customPut",s);let E={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:c||{}};return i.request(E,p)},deleteUser({userID:s},n){T("userID","deleteUser",s);let d={method:"DELETE",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},getConfig(s){let f={method:"GET",path:"/2/config",queryParameters:{},headers:{}};return i.request(f,s)},getRealtimeUser({userToken:s},n){T("userToken","getRealtimeUser",s);let d={method:"GET",path:"/2/realtime/users/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},getUser({userID:s},n){T("userID","getUser",s);let d={method:"GET",path:"/2/users/{userID}".replace("{userID}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(d,n)},getUsers({startDate:s,endDate:n,indices:c,affinity:p,limit:f,nextPageToken:d,previousPageToken:y}={},E=void 0){let u="/2/users",l={},P={};s!==void 0&&(P.startDate=s.toString()),n!==void 0&&(P.endDate=n.toString()),c!==void 0&&(P.indices=c.toString()),p!==void 0&&(P.affinity=p.toString()),f!==void 0&&(P.limit=f.toString()),d!==void 0&&(P.nextPageToken=d.toString()),y!==void 0&&(P.previousPageToken=y.toString());let R={method:"GET",path:u,queryParameters:P,headers:l};return i.request(R,E)},putConfig(s,n){T("configurationParameters","putConfig",s),T("configurationParameters.indices","putConfig",s.indices),T("configurationParameters.personalizationReRanking","putConfig",s.personalizationReRanking),T("configurationParameters.profileType","putConfig",s.profileType),T("configurationParameters.features","putConfig",s.features);let d={method:"PUT",path:"/2/config",queryParameters:{},headers:{},data:s};return i.request(d,n)}}}function Wt(t,e,o,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!o||o&&(typeof o!="string"||!G.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${G.join(", ")}`);let{compression:a,...m}=r||{};return ie({appId:t,apiKey:e,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:te(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinHeaders",responsesCache:k(),requestsCache:k({serializable:!1}),hostsCache:O({caches:[Y({key:`${N}-${t}`}),k()]}),...m})}export{Wt as advancedPersonalizationClient,N as apiClientVersion};
|
|
6
6
|
//# sourceMappingURL=browser.min.js.map
|