diff --git a/packages/algoliasearch/lite/src/liteClient.ts b/packages/algoliasearch/lite/src/liteClient.ts index a644be68c..1ff61db67 100644 --- a/packages/algoliasearch/lite/src/liteClient.ts +++ b/packages/algoliasearch/lite/src/liteClient.ts @@ -10,9 +10,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { diff --git a/packages/algoliasearch/package.json b/packages/algoliasearch/package.json index 4316c61d7..7999ebdca 100644 --- a/packages/algoliasearch/package.json +++ b/packages/algoliasearch/package.json @@ -72,7 +72,7 @@ "@babel/preset-env": "7.23.9", "@babel/preset-typescript": "7.23.3", "@types/jest": "29.5.12", - "@types/node": "20.11.20", + "@types/node": "20.11.19", "jest": "29.7.0", "rollup": "4.12.0", "typescript": "5.3.3" diff --git a/packages/client-abtesting/package.json b/packages/client-abtesting/package.json index 120163310..b9f5e0bd4 100644 --- a/packages/client-abtesting/package.json +++ b/packages/client-abtesting/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/client-abtesting/src/abtestingClient.ts b/packages/client-abtesting/src/abtestingClient.ts index 2a54043ff..088b390bd 100644 --- a/packages/client-abtesting/src/abtestingClient.ts +++ b/packages/client-abtesting/src/abtestingClient.ts @@ -9,9 +9,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { ABTest } from '../model/aBTest'; diff --git a/packages/client-analytics/package.json b/packages/client-analytics/package.json index 767c68712..59e3a4df8 100644 --- a/packages/client-analytics/package.json +++ b/packages/client-analytics/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/client-analytics/src/analyticsClient.ts b/packages/client-analytics/src/analyticsClient.ts index 71f253789..641e2e218 100644 --- a/packages/client-analytics/src/analyticsClient.ts +++ b/packages/client-analytics/src/analyticsClient.ts @@ -9,9 +9,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { diff --git a/packages/client-insights/package.json b/packages/client-insights/package.json index a65befa52..d5a4ec459 100644 --- a/packages/client-insights/package.json +++ b/packages/client-insights/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/client-insights/src/insightsClient.ts b/packages/client-insights/src/insightsClient.ts index b01ba7e19..51d0bf9d3 100644 --- a/packages/client-insights/src/insightsClient.ts +++ b/packages/client-insights/src/insightsClient.ts @@ -9,9 +9,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { diff --git a/packages/client-personalization/package.json b/packages/client-personalization/package.json index f5f088192..b6204e88f 100644 --- a/packages/client-personalization/package.json +++ b/packages/client-personalization/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/client-personalization/src/personalizationClient.ts b/packages/client-personalization/src/personalizationClient.ts index e069b8932..6a8a0e2be 100644 --- a/packages/client-personalization/src/personalizationClient.ts +++ b/packages/client-personalization/src/personalizationClient.ts @@ -9,9 +9,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { diff --git a/packages/client-query-suggestions/package.json b/packages/client-query-suggestions/package.json index 6d51fbf5c..0ecd7b727 100644 --- a/packages/client-query-suggestions/package.json +++ b/packages/client-query-suggestions/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/client-query-suggestions/src/querySuggestionsClient.ts b/packages/client-query-suggestions/src/querySuggestionsClient.ts index 244257a13..37c60313c 100644 --- a/packages/client-query-suggestions/src/querySuggestionsClient.ts +++ b/packages/client-query-suggestions/src/querySuggestionsClient.ts @@ -9,9 +9,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { BaseResponse } from '../model/baseResponse'; diff --git a/packages/client-search/model/clientMethodProps.ts b/packages/client-search/model/clientMethodProps.ts index 09f1746c4..05957b075 100644 --- a/packages/client-search/model/clientMethodProps.ts +++ b/packages/client-search/model/clientMethodProps.ts @@ -770,46 +770,3 @@ export type WaitForApiKeyOptions = WaitForOptions & { apiKey: Partial; } ); - -export type GenerateSecuredApiKeyOptions = { - /** - * The base API key from which to generate the new secured one. - */ - parentApiKey: string; - - /** - * A set of properties defining the restrictions of the secured API key. - */ - restrictions?: SecuredApiKeyRestrictions; -}; - -export type GetSecuredApiKeyRemainingValidityOptions = { - /** - * The secured API key generated with the `generateSecuredApiKey` method. - */ - securedApiKey: string; -}; - -export type SecuredApiKeyRestrictions = { - /** - * A Unix timestamp used to define the expiration date of the API key. - */ - validUntil?: number; - - /** - * List of index names that can be queried. - */ - restrictIndices?: string[] | string; - - /** - * IPv4 network allowed to use the generated key. This is used for more protection against API key leaking and reuse. - */ - restrictSources?: string; - - /** - * Specify a user identifier. This is often used with rate limits. - */ - userToken?: string; - - searchParams?: SearchParamsObject; -}; diff --git a/packages/client-search/package.json b/packages/client-search/package.json index 92adf6ea5..045c544e1 100644 --- a/packages/client-search/package.json +++ b/packages/client-search/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/client-search/src/searchClient.ts b/packages/client-search/src/searchClient.ts index 18b14afbc..40acb5977 100644 --- a/packages/client-search/src/searchClient.ts +++ b/packages/client-search/src/searchClient.ts @@ -1,22 +1,19 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -import { createHmac } from 'crypto'; - import { createAuth, createTransporter, getAlgoliaAgent, shuffle, - serializeQueryParameters, createIterablePromise, } from '@algolia/client-common'; import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, ApiError, IterableOptions, } from '@algolia/client-common'; @@ -28,10 +25,8 @@ import type { BatchResponse } from '../model/batchResponse'; import type { BrowseResponse } from '../model/browseResponse'; import type { BrowseOptions, - GenerateSecuredApiKeyOptions, - GetSecuredApiKeyRemainingValidityOptions, - WaitForApiKeyOptions, WaitForTaskOptions, + WaitForApiKeyOptions, AddOrUpdateObjectProps, AssignUserIdProps, BatchProps, @@ -227,7 +222,7 @@ export function createSearchClient({ * Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`. * * @summary Helper method that waits for a task to be published (completed). - * @param waitForTaskOptions - The `waitForTaskOptions` object. + * @param waitForTaskOptions - The waitForTaskOptions object. * @param waitForTaskOptions.indexName - The `indexName` where the operation was performed. * @param waitForTaskOptions.taskID - The `taskID` returned in the method response. * @param waitForTaskOptions.maxRetries - The maximum number of retries. 50 by default. @@ -263,7 +258,7 @@ export function createSearchClient({ * Helper: Wait for an API key to be added, updated or deleted based on a given `operation`. * * @summary Helper method that waits for an API key task to be processed. - * @param waitForApiKeyOptions - The `waitForApiKeyOptions` object. + * @param waitForApiKeyOptions - The waitForApiKeyOptions object. * @param waitForApiKeyOptions.operation - The `operation` that was done on a `key`. * @param waitForApiKeyOptions.key - The `key` that has been added, deleted or updated. * @param waitForApiKeyOptions.apiKey - Necessary to know if an `update` operation has been processed, compare fields of the response with it. @@ -337,7 +332,7 @@ export function createSearchClient({ * Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index. * * @summary Helper method that iterates on the `browse` method. - * @param browseObjects - The `browseObjects` object. + * @param browseObjects - The browseObjects object. * @param browseObjects.indexName - The index in which to perform the request. * @param browseObjects.browseParams - The `browse` parameters. * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is no `cursor` in the response. @@ -374,11 +369,11 @@ export function createSearchClient({ * Helper: Iterate on the `searchRules` method of the client to allow aggregating rules of an index. * * @summary Helper method that iterates on the `searchRules` method. - * @param browseRules - The `browseRules` object. - * @param browseRules.indexName - The index in which to perform the request. - * @param browseRules.searchRulesParams - The `searchRules` method parameters. - * @param browseRules.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000). - * @param browseRules.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`. + * @param browseObjects - The browseObjects object. + * @param browseObjects.indexName - The index in which to perform the request. + * @param browseObjects.searchRulesParams - The `searchRules` method parameters. + * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000). + * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`. * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchRules` method and merged with the transporter requestOptions. */ browseRules( @@ -418,11 +413,11 @@ export function createSearchClient({ * Helper: Iterate on the `searchSynonyms` method of the client to allow aggregating rules of an index. * * @summary Helper method that iterates on the `searchSynonyms` method. - * @param browseSynonyms - The `browseSynonyms` object. - * @param browseSynonyms.indexName - The index in which to perform the request. - * @param browseSynonyms.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000). - * @param browseSynonyms.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`. - * @param browseSynonyms.searchSynonymsParams - The `searchSynonyms` method parameters. + * @param browseObjects - The browseObjects object. + * @param browseObjects.indexName - The index in which to perform the request. + * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000). + * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`. + * @param browseObjects.searchSynonymsParams - The `searchSynonyms` method parameters. * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions. */ browseSynonyms( @@ -492,49 +487,6 @@ export function createSearchClient({ results: SearchForFacetValuesResponse[]; }>; }, - - /** - * Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`. - * - * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`. - * @param generateSecuredApiKey - The `generateSecuredApiKey` object. - * @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one. - * @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key. - */ - generateSecuredApiKey({ - parentApiKey, - restrictions = {}, - }: GenerateSecuredApiKeyOptions): string { - const queryParameters = serializeQueryParameters(restrictions); - return Buffer.from( - createHmac('sha256', parentApiKey) - .update(queryParameters) - .digest('hex') + queryParameters - ).toString('base64'); - }, - - /** - * Helper: Retrieves the remaining validity of the previous generated `secured_api_key`, the `ValidUntil` parameter must have been provided. - * - * @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`. - * @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object. - * @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method. - */ - getSecuredApiKeyRemainingValidity({ - securedApiKey, - }: GetSecuredApiKeyRemainingValidityOptions): number { - const decodedString = Buffer.from(securedApiKey, 'base64').toString( - 'ascii' - ); - const regex = /validUntil=(\d+)/; - const match = decodedString.match(regex); - - if (match === null) { - throw new Error('ValidUntil not found in given secured api key.'); - } - - return parseInt(match[1], 10) - Math.round(new Date().getTime() / 1000); - }, /** * Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string. * diff --git a/packages/ingestion/package.json b/packages/ingestion/package.json index 95886c13c..b9edfe324 100644 --- a/packages/ingestion/package.json +++ b/packages/ingestion/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/ingestion/src/ingestionClient.ts b/packages/ingestion/src/ingestionClient.ts index 7a487f776..440e9b76a 100644 --- a/packages/ingestion/src/ingestionClient.ts +++ b/packages/ingestion/src/ingestionClient.ts @@ -9,9 +9,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { Authentication } from '../model/authentication'; diff --git a/packages/monitoring/src/monitoringClient.ts b/packages/monitoring/src/monitoringClient.ts index 41b58c046..2908a2184 100644 --- a/packages/monitoring/src/monitoringClient.ts +++ b/packages/monitoring/src/monitoringClient.ts @@ -9,9 +9,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { diff --git a/packages/recommend/package.json b/packages/recommend/package.json index b38d43538..5aac8a552 100644 --- a/packages/recommend/package.json +++ b/packages/recommend/package.json @@ -44,7 +44,7 @@ "@algolia/requester-node-http": "5.0.0-alpha.103" }, "devDependencies": { - "@types/node": "20.11.20", + "@types/node": "20.11.19", "rollup": "4.12.0", "typescript": "5.3.3" }, diff --git a/packages/recommend/src/recommendClient.ts b/packages/recommend/src/recommendClient.ts index 249a4251a..b9e8e156f 100644 --- a/packages/recommend/src/recommendClient.ts +++ b/packages/recommend/src/recommendClient.ts @@ -10,9 +10,9 @@ import type { CreateClientOptions, Headers, Host, - QueryParameters, Request, RequestOptions, + QueryParameters, } from '@algolia/client-common'; import type { diff --git a/yarn.lock b/yarn.lock index da4a02b00..3d246d93c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,7 +12,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -25,7 +25,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -53,7 +53,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -66,7 +66,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -79,7 +79,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -92,7 +92,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -105,7 +105,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -131,7 +131,7 @@ __metadata: "@algolia/client-common": "npm:5.0.0-alpha.103" "@algolia/requester-browser-xhr": "npm:5.0.0-alpha.103" "@algolia/requester-node-http": "npm:5.0.0-alpha.103" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" rollup: "npm:4.12.0" typescript: "npm:5.3.3" languageName: unknown @@ -2866,6 +2866,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:20.11.19": + version: 20.11.19 + resolution: "@types/node@npm:20.11.19" + dependencies: + undici-types: "npm:~5.26.4" + checksum: c7f4705d6c84aa21679ad180c33c13ca9567f650e66e14bcee77c7c43d14619c7cd3b4d7b2458947143030b7b1930180efa6d12d999b45366abff9fed7a17472 + languageName: node + linkType: hard + "@types/normalize-package-data@npm:^2.4.0": version: 2.4.4 resolution: "@types/normalize-package-data@npm:2.4.4" @@ -3109,7 +3118,7 @@ __metadata: "@babel/preset-env": "npm:7.23.9" "@babel/preset-typescript": "npm:7.23.3" "@types/jest": "npm:29.5.12" - "@types/node": "npm:20.11.20" + "@types/node": "npm:20.11.19" jest: "npm:29.7.0" rollup: "npm:4.12.0" typescript: "npm:5.3.3"