algoliasearch 5.0.0-alpha.104 → 5.0.0-alpha.105

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.
Files changed (32) hide show
  1. package/builds/browser.ts +13 -20
  2. package/builds/node.ts +61 -18
  3. package/dist/algoliasearch/builds/browser.d.ts +7 -6
  4. package/dist/algoliasearch/builds/browser.d.ts.map +1 -1
  5. package/dist/algoliasearch/builds/node.d.ts +25 -7
  6. package/dist/algoliasearch/builds/node.d.ts.map +1 -1
  7. package/dist/algoliasearch.cjs +35 -35
  8. package/dist/algoliasearch.esm.browser.js +4 -36
  9. package/dist/algoliasearch.esm.node.js +35 -35
  10. package/dist/algoliasearch.umd.js +2 -2
  11. package/dist/client-abtesting/src/abtestingClient.d.ts +1 -5
  12. package/dist/client-abtesting/src/abtestingClient.d.ts.map +1 -1
  13. package/dist/client-analytics/src/analyticsClient.d.ts +1 -5
  14. package/dist/client-analytics/src/analyticsClient.d.ts.map +1 -1
  15. package/dist/client-personalization/src/personalizationClient.d.ts +1 -5
  16. package/dist/client-personalization/src/personalizationClient.d.ts.map +1 -1
  17. package/dist/client-search/src/searchClient.d.ts +2 -23
  18. package/dist/client-search/src/searchClient.d.ts.map +1 -1
  19. package/dist/lite/builds/browser.d.ts +14 -3
  20. package/dist/lite/builds/browser.d.ts.map +1 -1
  21. package/dist/lite/builds/node.d.ts +14 -3
  22. package/dist/lite/builds/node.d.ts.map +1 -1
  23. package/dist/lite/lite.cjs +2 -1
  24. package/dist/lite/lite.esm.browser.js +2 -1
  25. package/dist/lite/lite.esm.node.js +2 -1
  26. package/dist/lite/lite.umd.js +2 -2
  27. package/dist/lite/src/liteClient.d.ts +1 -5
  28. package/dist/lite/src/liteClient.d.ts.map +1 -1
  29. package/lite/builds/browser.ts +11 -6
  30. package/lite/builds/node.ts +10 -5
  31. package/lite/src/liteClient.ts +1 -6
  32. package/package.json +10 -10
package/builds/browser.ts CHANGED
@@ -1,41 +1,35 @@
1
1
  // 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.
2
2
 
3
- import type {
4
- Region as AbtestingRegion,
5
- AbtestingClient,
6
- } from '@algolia/client-abtesting/src/abtestingClient';
3
+ import type { AbtestingClient } from '@algolia/client-abtesting';
4
+ import type { Region as AbtestingRegion } from '@algolia/client-abtesting/src/abtestingClient';
7
5
  import {
8
6
  createAbtestingClient,
9
7
  REGIONS as abtestingRegions,
10
8
  } from '@algolia/client-abtesting/src/abtestingClient';
11
- import type {
12
- Region as AnalyticsRegion,
13
- AnalyticsClient,
14
- } from '@algolia/client-analytics/src/analyticsClient';
9
+ import type { AnalyticsClient } from '@algolia/client-analytics';
10
+ import type { Region as AnalyticsRegion } from '@algolia/client-analytics/src/analyticsClient';
15
11
  import {
16
12
  createAnalyticsClient,
17
13
  REGIONS as analyticsRegions,
18
14
  } from '@algolia/client-analytics/src/analyticsClient';
15
+ import type {
16
+ ClientOptions,
17
+ CreateClientOptions,
18
+ } from '@algolia/client-common';
19
19
  import {
20
- createMemoryCache,
21
- createFallbackableCache,
22
- createBrowserLocalStorageCache,
23
20
  DEFAULT_CONNECT_TIMEOUT_BROWSER,
24
21
  DEFAULT_READ_TIMEOUT_BROWSER,
25
22
  DEFAULT_WRITE_TIMEOUT_BROWSER,
23
+ createBrowserLocalStorageCache,
24
+ createFallbackableCache,
25
+ createMemoryCache,
26
26
  } from '@algolia/client-common';
27
- import type {
28
- CreateClientOptions,
29
- ClientOptions,
30
- } from '@algolia/client-common';
27
+ import type { PersonalizationClient } from '@algolia/client-personalization';
28
+ import type { Region as PersonalizationRegion } from '@algolia/client-personalization/src/personalizationClient';
31
29
  import {
32
30
  createPersonalizationClient,
33
31
  REGIONS as personalizationRegions,
34
32
  } from '@algolia/client-personalization/src/personalizationClient';
35
- import type {
36
- Region as PersonalizationRegion,
37
- PersonalizationClient,
38
- } from '@algolia/client-personalization/src/personalizationClient';
39
33
  import {
40
34
  createSearchClient,
41
35
  apiClientVersion as searchClientVersion,
@@ -66,7 +60,6 @@ export function algoliasearch(
66
60
  if (!apiKey || typeof apiKey !== 'string') {
67
61
  throw new Error('`apiKey` is missing.');
68
62
  }
69
-
70
63
  const commonOptions: CreateClientOptions = {
71
64
  apiKey,
72
65
  appId,
package/builds/node.ts CHANGED
@@ -1,47 +1,49 @@
1
1
  // 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.
2
2
 
3
- import type {
4
- Region as AbtestingRegion,
5
- AbtestingClient,
6
- } from '@algolia/client-abtesting/src/abtestingClient';
3
+ import { createHmac } from 'crypto';
4
+
5
+ import type { AbtestingClient } from '@algolia/client-abtesting';
6
+ import type { Region as AbtestingRegion } from '@algolia/client-abtesting/src/abtestingClient';
7
7
  import {
8
8
  createAbtestingClient,
9
9
  REGIONS as abtestingRegions,
10
10
  } from '@algolia/client-abtesting/src/abtestingClient';
11
- import type {
12
- Region as AnalyticsRegion,
13
- AnalyticsClient,
14
- } from '@algolia/client-analytics/src/analyticsClient';
11
+ import type { AnalyticsClient } from '@algolia/client-analytics';
12
+ import type { Region as AnalyticsRegion } from '@algolia/client-analytics/src/analyticsClient';
15
13
  import {
16
14
  createAnalyticsClient,
17
15
  REGIONS as analyticsRegions,
18
16
  } from '@algolia/client-analytics/src/analyticsClient';
17
+ import type {
18
+ ClientOptions,
19
+ CreateClientOptions,
20
+ } from '@algolia/client-common';
19
21
  import {
22
+ serializeQueryParameters,
20
23
  DEFAULT_CONNECT_TIMEOUT_NODE,
21
24
  DEFAULT_READ_TIMEOUT_NODE,
22
25
  DEFAULT_WRITE_TIMEOUT_NODE,
23
26
  createMemoryCache,
24
27
  createNullCache,
25
28
  } from '@algolia/client-common';
26
- import type {
27
- CreateClientOptions,
28
- ClientOptions,
29
- } from '@algolia/client-common';
29
+ import type { PersonalizationClient } from '@algolia/client-personalization';
30
+ import type { Region as PersonalizationRegion } from '@algolia/client-personalization/src/personalizationClient';
30
31
  import {
31
32
  createPersonalizationClient,
32
33
  REGIONS as personalizationRegions,
33
34
  } from '@algolia/client-personalization/src/personalizationClient';
34
- import type {
35
- Region as PersonalizationRegion,
36
- PersonalizationClient,
37
- } from '@algolia/client-personalization/src/personalizationClient';
38
35
  import {
39
36
  createSearchClient,
40
37
  apiClientVersion as searchClientVersion,
41
38
  } from '@algolia/client-search/src/searchClient';
42
39
  import { createHttpRequester } from '@algolia/requester-node-http';
43
40
 
44
- import type { InitClientOptions, InitClientRegion } from './models';
41
+ import type {
42
+ InitClientOptions,
43
+ InitClientRegion,
44
+ GenerateSecuredApiKeyOptions,
45
+ GetSecuredApiKeyRemainingValidityOptions,
46
+ } from './models';
45
47
 
46
48
  export * from './models';
47
49
 
@@ -65,7 +67,6 @@ export function algoliasearch(
65
67
  if (!apiKey || typeof apiKey !== 'string') {
66
68
  throw new Error('`apiKey` is missing.');
67
69
  }
68
-
69
70
  const commonOptions: CreateClientOptions = {
70
71
  apiKey,
71
72
  appId,
@@ -155,5 +156,47 @@ export function algoliasearch(
155
156
  initAnalytics,
156
157
  initPersonalization,
157
158
  initAbtesting,
159
+ /**
160
+ * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
161
+ *
162
+ * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
163
+ * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
164
+ * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
165
+ * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
166
+ */
167
+ generateSecuredApiKey({
168
+ parentApiKey,
169
+ restrictions = {},
170
+ }: GenerateSecuredApiKeyOptions): string {
171
+ const queryParameters = serializeQueryParameters(restrictions);
172
+ return Buffer.from(
173
+ createHmac('sha256', parentApiKey)
174
+ .update(queryParameters)
175
+ .digest('hex') + queryParameters
176
+ ).toString('base64');
177
+ },
178
+
179
+ /**
180
+ * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
181
+ *
182
+ * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
183
+ * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
184
+ * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
185
+ */
186
+ getSecuredApiKeyRemainingValidity({
187
+ securedApiKey,
188
+ }: GetSecuredApiKeyRemainingValidityOptions): number {
189
+ const decodedString = Buffer.from(securedApiKey, 'base64').toString(
190
+ 'ascii'
191
+ );
192
+ const regex = /validUntil=(\d+)/;
193
+ const match = decodedString.match(regex);
194
+
195
+ if (match === null) {
196
+ throw new Error('validUntil not found in given secured api key.');
197
+ }
198
+
199
+ return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000);
200
+ },
158
201
  };
159
202
  }
@@ -1,10 +1,13 @@
1
- import type { Region as AbtestingRegion, AbtestingClient } from '@algolia/client-abtesting/src/abtestingClient';
2
- import type { Region as AnalyticsRegion, AnalyticsClient } from '@algolia/client-analytics/src/analyticsClient';
1
+ import type { AbtestingClient } from '@algolia/client-abtesting';
2
+ import type { Region as AbtestingRegion } from '@algolia/client-abtesting/src/abtestingClient';
3
+ import type { AnalyticsClient } from '@algolia/client-analytics';
4
+ import type { Region as AnalyticsRegion } from '@algolia/client-analytics/src/analyticsClient';
3
5
  import type { ClientOptions } from '@algolia/client-common';
4
- import type { Region as PersonalizationRegion, PersonalizationClient } from '@algolia/client-personalization/src/personalizationClient';
6
+ import type { PersonalizationClient } from '@algolia/client-personalization';
7
+ import type { Region as PersonalizationRegion } from '@algolia/client-personalization/src/personalizationClient';
5
8
  import type { InitClientOptions, InitClientRegion } from './models';
6
9
  export * from './models';
7
- export declare const apiClientVersion = "5.0.0-alpha.104";
10
+ export declare const apiClientVersion = "5.0.0-alpha.105";
8
11
  /**
9
12
  * The client type.
10
13
  */
@@ -29,8 +32,6 @@ export declare function algoliasearch(appId: string, apiKey: string, options?: C
29
32
  searchForFacets(searchMethodParams: import("@algolia/client-search/model/clientMethodProps").LegacySearchMethodProps | import("@algolia/client-search/model/searchMethodParams").SearchMethodParams, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<{
30
33
  results: import("@algolia/client-search/model/searchForFacetValuesResponse").SearchForFacetValuesResponse[];
31
34
  }>;
32
- generateSecuredApiKey({ parentApiKey, restrictions, }: import("@algolia/client-search/model/clientMethodProps").GenerateSecuredApiKeyOptions): string;
33
- getSecuredApiKeyRemainingValidity({ securedApiKey, }: import("@algolia/client-search/model/clientMethodProps").GetSecuredApiKeyRemainingValidityOptions): number;
34
35
  chunkedBatch({ indexName, objects, action, waitForTasks, batchSize, }: import("@algolia/client-search/model/clientMethodProps").ChunkedBatchOptions, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("@algolia/client-search/model/batchResponse").BatchResponse[]>;
35
36
  replaceAllObjects({ indexName, objects, batchSize }: import("@algolia/client-search/model/clientMethodProps").ReplaceAllObjectsOptions, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("@algolia/client-search/model/clientMethodProps").ReplaceAllObjectsResponse>;
36
37
  addApiKey(apiKey: import("@algolia/client-search/model/apiKey").ApiKey, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("@algolia/client-search/model/addApiKeyResponse").AddApiKeyResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,IAAI,eAAe,EACzB,eAAe,EAChB,MAAM,+CAA+C,CAAC;AAKvD,OAAO,KAAK,EACV,MAAM,IAAI,eAAe,EACzB,eAAe,EAChB,MAAM,+CAA+C,CAAC;AAavD,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EACV,MAAM,IAAI,qBAAq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AAC;AAEpE,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,gBAAgB,oBAAsB,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAG7D,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa;;kCAgCR,iBAAiB,GAAG,iBAAiB,eAAe,CAAC,KACjE,eAAe;uCAuCH,iBAAiB,GAC5B,SAAS,iBAAiB,qBAAqB,CAAC,CAAC,KAClD,qBAAqB;kCAtBT,iBAAiB,GAAG,iBAAiB,eAAe,CAAC,KACjE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDnB"}
@@ -1,10 +1,13 @@
1
- import type { Region as AbtestingRegion, AbtestingClient } from '@algolia/client-abtesting/src/abtestingClient';
2
- import type { Region as AnalyticsRegion, AnalyticsClient } from '@algolia/client-analytics/src/analyticsClient';
1
+ import type { AbtestingClient } from '@algolia/client-abtesting';
2
+ import type { Region as AbtestingRegion } from '@algolia/client-abtesting/src/abtestingClient';
3
+ import type { AnalyticsClient } from '@algolia/client-analytics';
4
+ import type { Region as AnalyticsRegion } from '@algolia/client-analytics/src/analyticsClient';
3
5
  import type { ClientOptions } from '@algolia/client-common';
4
- import type { Region as PersonalizationRegion, PersonalizationClient } from '@algolia/client-personalization/src/personalizationClient';
5
- import type { InitClientOptions, InitClientRegion } from './models';
6
+ import type { PersonalizationClient } from '@algolia/client-personalization';
7
+ import type { Region as PersonalizationRegion } from '@algolia/client-personalization/src/personalizationClient';
8
+ import type { InitClientOptions, InitClientRegion, GenerateSecuredApiKeyOptions, GetSecuredApiKeyRemainingValidityOptions } from './models';
6
9
  export * from './models';
7
- export declare const apiClientVersion = "5.0.0-alpha.104";
10
+ export declare const apiClientVersion = "5.0.0-alpha.105";
8
11
  /**
9
12
  * The client type.
10
13
  */
@@ -14,6 +17,23 @@ export declare function algoliasearch(appId: string, apiKey: string, options?: C
14
17
  initAnalytics: (initOptions?: InitClientOptions & InitClientRegion<AnalyticsRegion>) => AnalyticsClient;
15
18
  initPersonalization: (initOptions: InitClientOptions & Required<InitClientRegion<PersonalizationRegion>>) => PersonalizationClient;
16
19
  initAbtesting: (initOptions?: InitClientOptions & InitClientRegion<AbtestingRegion>) => AbtestingClient;
20
+ /**
21
+ * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
22
+ *
23
+ * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
24
+ * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
25
+ * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
26
+ * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
27
+ */
28
+ generateSecuredApiKey({ parentApiKey, restrictions, }: GenerateSecuredApiKeyOptions): string;
29
+ /**
30
+ * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
31
+ *
32
+ * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
33
+ * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
34
+ * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
35
+ */
36
+ getSecuredApiKeyRemainingValidity({ securedApiKey, }: GetSecuredApiKeyRemainingValidityOptions): number;
17
37
  transporter: import("@algolia/client-common").Transporter;
18
38
  appId: string;
19
39
  clearCache(): Promise<void>;
@@ -29,8 +49,6 @@ export declare function algoliasearch(appId: string, apiKey: string, options?: C
29
49
  searchForFacets(searchMethodParams: import("@algolia/client-search/model/clientMethodProps").LegacySearchMethodProps | import("@algolia/client-search/model/searchMethodParams").SearchMethodParams, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<{
30
50
  results: import("@algolia/client-search/model/searchForFacetValuesResponse").SearchForFacetValuesResponse[];
31
51
  }>;
32
- generateSecuredApiKey({ parentApiKey, restrictions, }: import("@algolia/client-search/model/clientMethodProps").GenerateSecuredApiKeyOptions): string;
33
- getSecuredApiKeyRemainingValidity({ securedApiKey, }: import("@algolia/client-search/model/clientMethodProps").GetSecuredApiKeyRemainingValidityOptions): number;
34
52
  chunkedBatch({ indexName, objects, action, waitForTasks, batchSize, }: import("@algolia/client-search/model/clientMethodProps").ChunkedBatchOptions, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("@algolia/client-search/model/batchResponse").BatchResponse[]>;
35
53
  replaceAllObjects({ indexName, objects, batchSize }: import("@algolia/client-search/model/clientMethodProps").ReplaceAllObjectsOptions, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("@algolia/client-search/model/clientMethodProps").ReplaceAllObjectsResponse>;
36
54
  addApiKey(apiKey: import("@algolia/client-search/model/apiKey").ApiKey, requestOptions?: import("@algolia/client-common").RequestOptions | undefined): Promise<import("@algolia/client-search/model/addApiKeyResponse").AddApiKeyResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,IAAI,eAAe,EACzB,eAAe,EAChB,MAAM,+CAA+C,CAAC;AAKvD,OAAO,KAAK,EACV,MAAM,IAAI,eAAe,EACzB,eAAe,EAChB,MAAM,+CAA+C,CAAC;AAYvD,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EACV,MAAM,IAAI,qBAAqB,EAC/B,qBAAqB,EACtB,MAAM,2DAA2D,CAAC;AAOnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEpE,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,gBAAgB,oBAAsB,CAAC;AAEpD;;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aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa;;kCA0BR,iBAAiB,GAAG,iBAAiB,eAAe,CAAC,KACjE,eAAe;uCAuCH,iBAAiB,GAC5B,SAAS,iBAAiB,qBAAqB,CAAC,CAAC,KAClD,qBAAqB;kCAtBT,iBAAiB,GAAG,iBAAiB,eAAe,CAAC,KACjE,eAAe;IAmDhB;;;;;;;OAOG;2DAIA,4BAA4B,GAAG,MAAM;IASxC;;;;;;OAMG;0DAGA,wCAAwC,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcvD"}
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var clientCommon = require('@algolia/client-common');
4
3
  var crypto = require('crypto');
4
+ var clientCommon = require('@algolia/client-common');
5
5
  var requesterNodeHttp = require('@algolia/requester-node-http');
6
6
 
7
7
  // 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.
8
- const apiClientVersion$4 = '5.0.0-alpha.104';
8
+ const apiClientVersion$4 = '5.0.0-alpha.105';
9
9
  const REGIONS$2 = ['de', 'us'];
10
10
  function getDefaultHosts$3(region) {
11
11
  const url = !region
@@ -310,7 +310,7 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
310
310
  }
311
311
 
312
312
  // 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.
313
- const apiClientVersion$3 = '5.0.0-alpha.104';
313
+ const apiClientVersion$3 = '5.0.0-alpha.105';
314
314
  const REGIONS$1 = ['de', 'us'];
315
315
  function getDefaultHosts$2(region) {
316
316
  const url = !region
@@ -1237,7 +1237,7 @@ function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authM
1237
1237
  }
1238
1238
 
1239
1239
  // 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.
1240
- const apiClientVersion$2 = '5.0.0-alpha.104';
1240
+ const apiClientVersion$2 = '5.0.0-alpha.105';
1241
1241
  const REGIONS = ['eu', 'us'];
1242
1242
  function getDefaultHosts$1(region) {
1243
1243
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -1498,7 +1498,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
1498
1498
  }
1499
1499
 
1500
1500
  // 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.
1501
- const apiClientVersion$1 = '5.0.0-alpha.104';
1501
+ const apiClientVersion$1 = '5.0.0-alpha.105';
1502
1502
  function getDefaultHosts(appId) {
1503
1503
  return [
1504
1504
  {
@@ -1770,36 +1770,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1770
1770
  searchForFacets(searchMethodParams, requestOptions) {
1771
1771
  return this.search(searchMethodParams, requestOptions);
1772
1772
  },
1773
- /**
1774
- * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
1775
- *
1776
- * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
1777
- * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
1778
- * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
1779
- * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
1780
- */
1781
- generateSecuredApiKey({ parentApiKey, restrictions = {}, }) {
1782
- const queryParameters = clientCommon.serializeQueryParameters(restrictions);
1783
- return Buffer.from(crypto.createHmac('sha256', parentApiKey)
1784
- .update(queryParameters)
1785
- .digest('hex') + queryParameters).toString('base64');
1786
- },
1787
- /**
1788
- * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
1789
- *
1790
- * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
1791
- * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
1792
- * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
1793
- */
1794
- getSecuredApiKeyRemainingValidity({ securedApiKey, }) {
1795
- const decodedString = Buffer.from(securedApiKey, 'base64').toString('ascii');
1796
- const regex = /validUntil=(\d+)/;
1797
- const match = decodedString.match(regex);
1798
- if (match === null) {
1799
- throw new Error('ValidUntil not found in given secured api key.');
1800
- }
1801
- return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000);
1802
- },
1803
1773
  /**
1804
1774
  * Helper: Chunks the given `objects` list in subset of 1000 elements max in order to make it fit in `batch` requests.
1805
1775
  *
@@ -3760,6 +3730,36 @@ function algoliasearch(appId, apiKey, options) {
3760
3730
  initAnalytics,
3761
3731
  initPersonalization,
3762
3732
  initAbtesting,
3733
+ /**
3734
+ * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
3735
+ *
3736
+ * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
3737
+ * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
3738
+ * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
3739
+ * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
3740
+ */
3741
+ generateSecuredApiKey({ parentApiKey, restrictions = {}, }) {
3742
+ const queryParameters = clientCommon.serializeQueryParameters(restrictions);
3743
+ return Buffer.from(crypto.createHmac('sha256', parentApiKey)
3744
+ .update(queryParameters)
3745
+ .digest('hex') + queryParameters).toString('base64');
3746
+ },
3747
+ /**
3748
+ * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
3749
+ *
3750
+ * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
3751
+ * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
3752
+ * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
3753
+ */
3754
+ getSecuredApiKeyRemainingValidity({ securedApiKey, }) {
3755
+ const decodedString = Buffer.from(securedApiKey, 'base64').toString('ascii');
3756
+ const regex = /validUntil=(\d+)/;
3757
+ const match = decodedString.match(regex);
3758
+ if (match === null) {
3759
+ throw new Error('validUntil not found in given secured api key.');
3760
+ }
3761
+ return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000);
3762
+ },
3763
3763
  };
3764
3764
  }
3765
3765
 
@@ -1,5 +1,3 @@
1
- import { createHmac } from 'crypto';
2
-
3
1
  function createAuth(appId, apiKey, authMode = 'WithinHeaders') {
4
2
  const credentials = {
5
3
  'x-algolia-api-key': apiKey,
@@ -687,7 +685,7 @@ const DEFAULT_READ_TIMEOUT_BROWSER = 2000;
687
685
  const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;
688
686
 
689
687
  // 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.
690
- const apiClientVersion$4 = '5.0.0-alpha.104';
688
+ const apiClientVersion$4 = '5.0.0-alpha.105';
691
689
  const REGIONS$2 = ['de', 'us'];
692
690
  function getDefaultHosts$3(region) {
693
691
  const url = !region
@@ -992,7 +990,7 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
992
990
  }
993
991
 
994
992
  // 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.
995
- const apiClientVersion$3 = '5.0.0-alpha.104';
993
+ const apiClientVersion$3 = '5.0.0-alpha.105';
996
994
  const REGIONS$1 = ['de', 'us'];
997
995
  function getDefaultHosts$2(region) {
998
996
  const url = !region
@@ -1919,7 +1917,7 @@ function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authM
1919
1917
  }
1920
1918
 
1921
1919
  // 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.
1922
- const apiClientVersion$2 = '5.0.0-alpha.104';
1920
+ const apiClientVersion$2 = '5.0.0-alpha.105';
1923
1921
  const REGIONS = ['eu', 'us'];
1924
1922
  function getDefaultHosts$1(region) {
1925
1923
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -2180,7 +2178,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
2180
2178
  }
2181
2179
 
2182
2180
  // 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.
2183
- const apiClientVersion$1 = '5.0.0-alpha.104';
2181
+ const apiClientVersion$1 = '5.0.0-alpha.105';
2184
2182
  function getDefaultHosts(appId) {
2185
2183
  return [
2186
2184
  {
@@ -2452,36 +2450,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
2452
2450
  searchForFacets(searchMethodParams, requestOptions) {
2453
2451
  return this.search(searchMethodParams, requestOptions);
2454
2452
  },
2455
- /**
2456
- * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
2457
- *
2458
- * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
2459
- * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
2460
- * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
2461
- * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
2462
- */
2463
- generateSecuredApiKey({ parentApiKey, restrictions = {}, }) {
2464
- const queryParameters = serializeQueryParameters(restrictions);
2465
- return Buffer.from(createHmac('sha256', parentApiKey)
2466
- .update(queryParameters)
2467
- .digest('hex') + queryParameters).toString('base64');
2468
- },
2469
- /**
2470
- * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
2471
- *
2472
- * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
2473
- * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
2474
- * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
2475
- */
2476
- getSecuredApiKeyRemainingValidity({ securedApiKey, }) {
2477
- const decodedString = Buffer.from(securedApiKey, 'base64').toString('ascii');
2478
- const regex = /validUntil=(\d+)/;
2479
- const match = decodedString.match(regex);
2480
- if (match === null) {
2481
- throw new Error('ValidUntil not found in given secured api key.');
2482
- }
2483
- return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000);
2484
- },
2485
2453
  /**
2486
2454
  * Helper: Chunks the given `objects` list in subset of 1000 elements max in order to make it fit in `batch` requests.
2487
2455
  *
@@ -1,9 +1,9 @@
1
- import { createAuth, createTransporter, getAlgoliaAgent, createIterablePromise, serializeQueryParameters, shuffle, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
2
1
  import { createHmac } from 'crypto';
2
+ import { createAuth, createTransporter, getAlgoliaAgent, createIterablePromise, shuffle, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache, serializeQueryParameters } from '@algolia/client-common';
3
3
  import { createHttpRequester } from '@algolia/requester-node-http';
4
4
 
5
5
  // 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.
6
- const apiClientVersion$4 = '5.0.0-alpha.104';
6
+ const apiClientVersion$4 = '5.0.0-alpha.105';
7
7
  const REGIONS$2 = ['de', 'us'];
8
8
  function getDefaultHosts$3(region) {
9
9
  const url = !region
@@ -308,7 +308,7 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
308
308
  }
309
309
 
310
310
  // 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.
311
- const apiClientVersion$3 = '5.0.0-alpha.104';
311
+ const apiClientVersion$3 = '5.0.0-alpha.105';
312
312
  const REGIONS$1 = ['de', 'us'];
313
313
  function getDefaultHosts$2(region) {
314
314
  const url = !region
@@ -1235,7 +1235,7 @@ function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authM
1235
1235
  }
1236
1236
 
1237
1237
  // 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.
1238
- const apiClientVersion$2 = '5.0.0-alpha.104';
1238
+ const apiClientVersion$2 = '5.0.0-alpha.105';
1239
1239
  const REGIONS = ['eu', 'us'];
1240
1240
  function getDefaultHosts$1(region) {
1241
1241
  const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
@@ -1496,7 +1496,7 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
1496
1496
  }
1497
1497
 
1498
1498
  // 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.
1499
- const apiClientVersion$1 = '5.0.0-alpha.104';
1499
+ const apiClientVersion$1 = '5.0.0-alpha.105';
1500
1500
  function getDefaultHosts(appId) {
1501
1501
  return [
1502
1502
  {
@@ -1768,36 +1768,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1768
1768
  searchForFacets(searchMethodParams, requestOptions) {
1769
1769
  return this.search(searchMethodParams, requestOptions);
1770
1770
  },
1771
- /**
1772
- * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
1773
- *
1774
- * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
1775
- * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
1776
- * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
1777
- * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
1778
- */
1779
- generateSecuredApiKey({ parentApiKey, restrictions = {}, }) {
1780
- const queryParameters = serializeQueryParameters(restrictions);
1781
- return Buffer.from(createHmac('sha256', parentApiKey)
1782
- .update(queryParameters)
1783
- .digest('hex') + queryParameters).toString('base64');
1784
- },
1785
- /**
1786
- * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
1787
- *
1788
- * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
1789
- * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
1790
- * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
1791
- */
1792
- getSecuredApiKeyRemainingValidity({ securedApiKey, }) {
1793
- const decodedString = Buffer.from(securedApiKey, 'base64').toString('ascii');
1794
- const regex = /validUntil=(\d+)/;
1795
- const match = decodedString.match(regex);
1796
- if (match === null) {
1797
- throw new Error('ValidUntil not found in given secured api key.');
1798
- }
1799
- return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000);
1800
- },
1801
1771
  /**
1802
1772
  * Helper: Chunks the given `objects` list in subset of 1000 elements max in order to make it fit in `batch` requests.
1803
1773
  *
@@ -3758,6 +3728,36 @@ function algoliasearch(appId, apiKey, options) {
3758
3728
  initAnalytics,
3759
3729
  initPersonalization,
3760
3730
  initAbtesting,
3731
+ /**
3732
+ * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
3733
+ *
3734
+ * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
3735
+ * @param generateSecuredApiKey - The `generateSecuredApiKey` object.
3736
+ * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
3737
+ * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
3738
+ */
3739
+ generateSecuredApiKey({ parentApiKey, restrictions = {}, }) {
3740
+ const queryParameters = serializeQueryParameters(restrictions);
3741
+ return Buffer.from(createHmac('sha256', parentApiKey)
3742
+ .update(queryParameters)
3743
+ .digest('hex') + queryParameters).toString('base64');
3744
+ },
3745
+ /**
3746
+ * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
3747
+ *
3748
+ * @summary Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided.
3749
+ * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
3750
+ * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
3751
+ */
3752
+ getSecuredApiKeyRemainingValidity({ securedApiKey, }) {
3753
+ const decodedString = Buffer.from(securedApiKey, 'base64').toString('ascii');
3754
+ const regex = /validUntil=(\d+)/;
3755
+ const match = decodedString.match(regex);
3756
+ if (match === null) {
3757
+ throw new Error('validUntil not found in given secured api key.');
3758
+ }
3759
+ return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000);
3760
+ },
3761
3761
  };
3762
3762
  }
3763
3763