From 36d583e35d8c14c70d5cb6f2e0c41ba4382fc515 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 15 Nov 2024 15:27:55 +0100 Subject: [PATCH] fix(specs): make the searchParams compatible with v4 [skip-bc] (#4108) --- .../client/extensions/SearchForHits.kt | 1 - .../Search/Extra/SearchQueryExtension.swift | 2 - .../codegen/AlgoliaCSharpGenerator.java | 22 +++ .../codegen/AlgoliaSwiftGenerator.java | 2 + .../java/com/algolia/playground/Insights.java | 43 ++-- .../java/com/algolia/playground/Search.java | 121 ++++++------ specs/common/schemas/IndexSettings.yml | 67 ++++--- specs/common/schemas/SearchParams.yml | 6 + .../common/schemas/SearchParams.yml | 28 +-- .../common/schemas/IndexSettings.yml | 2 - templates/csharp/modelOneOf.mustache | 8 +- .../algoliasearch/builds/models.mustache | 50 ++--- tests/output/javascript/yarn.lock | 186 ++++++++++-------- 13 files changed, 279 insertions(+), 259 deletions(-) diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/extensions/SearchForHits.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/extensions/SearchForHits.kt index a5fe6eb695..bf981ef4b4 100644 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/extensions/SearchForHits.kt +++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/extensions/SearchForHits.kt @@ -84,7 +84,6 @@ public fun SearchForHits.Companion.from( replaceSynonymsInHighlight = searchParamsObject.replaceSynonymsInHighlight, minProximity = searchParamsObject.minProximity, responseFields = searchParamsObject.responseFields, - maxFacetHits = searchParamsObject.maxFacetHits, maxValuesPerFacet = searchParamsObject.maxValuesPerFacet, sortFacetValuesBy = searchParamsObject.sortFacetValuesBy, attributeCriteriaComputedByMinProximity = searchParamsObject.attributeCriteriaComputedByMinProximity, diff --git a/clients/algoliasearch-client-swift/Sources/Search/Extra/SearchQueryExtension.swift b/clients/algoliasearch-client-swift/Sources/Search/Extra/SearchQueryExtension.swift index f603d0e173..cf5b94d158 100644 --- a/clients/algoliasearch-client-swift/Sources/Search/Extra/SearchQueryExtension.swift +++ b/clients/algoliasearch-client-swift/Sources/Search/Extra/SearchQueryExtension.swift @@ -87,7 +87,6 @@ public extension SearchForHits { self.replaceSynonymsInHighlight = searchParamsObject.replaceSynonymsInHighlight self.minProximity = searchParamsObject.minProximity self.responseFields = searchParamsObject.responseFields - self.maxFacetHits = searchParamsObject.maxFacetHits self.maxValuesPerFacet = searchParamsObject.maxValuesPerFacet self.sortFacetValuesBy = searchParamsObject.sortFacetValuesBy self.attributeCriteriaComputedByMinProximity = searchParamsObject.attributeCriteriaComputedByMinProximity @@ -175,7 +174,6 @@ public extension SearchForFacets { self.replaceSynonymsInHighlight = searchParamsObject.replaceSynonymsInHighlight self.minProximity = searchParamsObject.minProximity self.responseFields = searchParamsObject.responseFields - self.maxFacetHits = searchParamsObject.maxFacetHits self.maxValuesPerFacet = searchParamsObject.maxValuesPerFacet self.sortFacetValuesBy = searchParamsObject.sortFacetValuesBy self.attributeCriteriaComputedByMinProximity = searchParamsObject.attributeCriteriaComputedByMinProximity diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaCSharpGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaCSharpGenerator.java index b51d692126..b1d34069da 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaCSharpGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaCSharpGenerator.java @@ -2,7 +2,9 @@ import com.algolia.codegen.exceptions.*; import com.algolia.codegen.utils.*; +import com.google.common.collect.ImmutableMap.Builder; import com.samskivert.mustache.Mustache; +import com.samskivert.mustache.Mustache.Lambda; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.servers.Server; @@ -156,4 +158,24 @@ public Map postProcessAllModels(Map objs) public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { return Helpers.specifyCustomRequest(super.fromOperation(path, httpMethod, operation, servers)); } + + /** Convert a Seq type to a valid class name. */ + private String typeToName(String content) { + // for dictionary, remove the key type + String[] parts = content.replace("string, ", "").split("<"); + String name = ""; + for (int i = 0; i < parts.length; i++) { + name += Helpers.capitalize(parts[i].replace(">", "").replace(",", "").replace(" ", "")); + } + return name; + } + + @Override + protected Builder addMustacheLambdas() { + Builder lambdas = super.addMustacheLambdas(); + + lambdas.put("type-to-name", (Mustache.Lambda) (fragment, writer) -> writer.write(typeToName(fragment.execute()))); + + return lambdas; + } } diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java index 7120bbef44..4f013f34fd 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java @@ -73,12 +73,14 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "highlightresultoption", "ignoreplurals", "indexsettingsassearchparams", + "insideboundingbox", "languages", "matchedgeolocation", "matchlevel", "mode", "numericfilters", "optionalfilters", + "optionalwords", "params", "personalization", "promote", diff --git a/playground/java/src/main/java/com/algolia/playground/Insights.java b/playground/java/src/main/java/com/algolia/playground/Insights.java index f2185d5eab..f4cfb6c74d 100644 --- a/playground/java/src/main/java/com/algolia/playground/Insights.java +++ b/playground/java/src/main/java/com/algolia/playground/Insights.java @@ -5,36 +5,31 @@ import com.algolia.config.LogLevel; import com.algolia.model.insights.ClickEvent; import com.algolia.model.insights.ClickedObjectIDs; -import com.algolia.model.insights.EventsItems; import com.algolia.model.insights.InsightsEvents; import io.github.cdimascio.dotenv.Dotenv; - import java.util.List; public class Insights { - public static void main(String[] args) throws Exception { - var dotenv = Dotenv.configure().directory("../").load(); - var appId = dotenv.get("ALGOLIA_APPLICATION_ID"); - var apiKey = dotenv.get("ALGOLIA_SEARCH_KEY"); - var indexName = dotenv.get("SEARCH_INDEX"); + public static void main(String[] args) throws Exception { + var dotenv = Dotenv.configure().directory("../").load(); + var appId = dotenv.get("ALGOLIA_APPLICATION_ID"); + var apiKey = dotenv.get("ALGOLIA_SEARCH_KEY"); + var indexName = dotenv.get("SEARCH_INDEX"); - var options = new ClientOptions.Builder() - .addAlgoliaAgentSegment("Playground") - .setLogLevel(LogLevel.BODY) - .build(); + var options = new ClientOptions.Builder().addAlgoliaAgentSegment("Playground").setLogLevel(LogLevel.BODY).build(); - var client = new InsightsClient(appId, apiKey, options); - var params = new InsightsEvents(); - var event = new ClickedObjectIDs() - .setEventType(ClickEvent.CLICK) - .setUserToken("user") - .setIndex(indexName) - .setObjectIDs(List.of("id123")) - .setEventName("click"); - params.addEvents(event); - var result = client.pushEvents(params); - System.out.println(result); - client.close(); - } + var client = new InsightsClient(appId, apiKey, options); + var params = new InsightsEvents(); + var event = new ClickedObjectIDs() + .setEventType(ClickEvent.CLICK) + .setUserToken("user") + .setIndex(indexName) + .setObjectIDs(List.of("id123")) + .setEventName("click"); + params.addEvents(event); + var result = client.pushEvents(params); + System.out.println(result); + client.close(); + } } diff --git a/playground/java/src/main/java/com/algolia/playground/Search.java b/playground/java/src/main/java/com/algolia/playground/Search.java index c4acc0f67a..ac30c474cd 100644 --- a/playground/java/src/main/java/com/algolia/playground/Search.java +++ b/playground/java/src/main/java/com/algolia/playground/Search.java @@ -2,90 +2,85 @@ import com.algolia.api.SearchClient; import com.algolia.config.ClientOptions; -import com.algolia.config.LogLevel; import com.algolia.model.search.*; import io.github.cdimascio.dotenv.Dotenv; - import java.util.Arrays; import java.util.List; import java.util.Map; class Actor extends Hit { - public String name; + public String name; - public Actor() { - } + public Actor() {} - public Actor(String name) { - this.name = name; - } + public Actor(String name) { + this.name = name; + } } public class Search { - public static void main(String[] args) throws Exception { - var dotenv = Dotenv.configure().directory("../").load(); - var appId = dotenv.get("ALGOLIA_APPLICATION_ID"); - var apiKey = dotenv.get("ALGOLIA_ADMIN_KEY"); - var indexName = dotenv.get("SEARCH_INDEX"); - var query = dotenv.get("SEARCH_QUERY"); + public static void main(String[] args) throws Exception { + var dotenv = Dotenv.configure().directory("../").load(); + var appId = dotenv.get("ALGOLIA_APPLICATION_ID"); + var apiKey = dotenv.get("ALGOLIA_ADMIN_KEY"); + var indexName = dotenv.get("SEARCH_INDEX"); + var query = dotenv.get("SEARCH_QUERY"); - var options = new ClientOptions.Builder() - .addAlgoliaAgentSegment("Playground", "1.0.0") - //.setLogLevel(LogLevel.BODY) - .build(); + var options = new ClientOptions.Builder() + .addAlgoliaAgentSegment("Playground", "1.0.0") + // .setLogLevel(LogLevel.BODY) + .build(); - var client = new SearchClient(appId, apiKey, options); - var records = Arrays.asList(new Actor("Tom Cruise"), new Actor("Scarlett Johansson")); - var batch = records.stream() - .map(entry -> new BatchRequest().setAction(Action.ADD_OBJECT).setBody(entry)) - .toList(); - var response = client.batch(indexName, new BatchWriteParams().setRequests(batch)); - client.waitForTask(indexName, response.getTaskID()); + var client = new SearchClient(appId, apiKey, options); + var records = Arrays.asList(new Actor("Tom Cruise"), new Actor("Scarlett Johansson")); + var batch = records.stream().map(entry -> new BatchRequest().setAction(Action.ADD_OBJECT).setBody(entry)).toList(); + var response = client.batch(indexName, new BatchWriteParams().setRequests(batch)); + client.waitForTask(indexName, response.getTaskID()); - var browse = client.browseObjects(indexName, new BrowseParamsObject().setQuery("tom"), Actor.class); - System.out.println("-> Browse Objects:"); - for (var hit : browse) { - System.out.println("> " + hit.name); - } - - singleSearch(client, indexName, query); - multiSearch(indexName, query, client); - client.close(); + var browse = client.browseObjects(indexName, new BrowseParamsObject().setQuery("tom"), Actor.class); + System.out.println("-> Browse Objects:"); + for (var hit : browse) { + System.out.println("> " + hit.name); } - private static void singleSearch(SearchClient client, String indexName, String query) { - SearchParamsObject params = new SearchParamsObject() - .setQuery(query) - .setAroundPrecision(AroundPrecision.of(1000)) - .setAroundRadius(AroundRadiusAll.ALL); - SearchResponse actorSearchResponse = client.searchSingleIndex(indexName, params, Actor.class); - System.out.println("-> Single Index Search:"); - for (var hit : actorSearchResponse.getHits()) { - System.out.println("> " + hit.name); - } + singleSearch(client, indexName, query); + multiSearch(indexName, query, client); + client.close(); + } + + private static void singleSearch(SearchClient client, String indexName, String query) { + SearchParamsObject params = new SearchParamsObject() + .setQuery(query) + .setAroundPrecision(AroundPrecision.of(1000)) + .setAroundRadius(AroundRadiusAll.ALL); + SearchResponse actorSearchResponse = client.searchSingleIndex(indexName, params, Actor.class); + System.out.println("-> Single Index Search:"); + for (var hit : actorSearchResponse.getHits()) { + System.out.println("> " + hit.name); } + } - private static void multiSearch(String indexName, String query, SearchClient client) { - var searchMethodParams = new SearchMethodParams(); - var searchQuery = new SearchForHits() - .setIndexName(indexName) - .setQuery(query) - .addAttributesToSnippet("title") - .addAttributesToSnippet("alternative_titles"); - List requests = List.of(searchQuery); - searchMethodParams.setRequests(requests); + private static void multiSearch(String indexName, String query, SearchClient client) { + var searchMethodParams = new SearchMethodParams(); + var searchQuery = new SearchForHits() + .setIndexName(indexName) + .setQuery(query) + .addAttributesToSnippet("title") + .addAttributesToSnippet("alternative_titles"); + List requests = List.of(searchQuery); + searchMethodParams.setRequests(requests); - var responses = client.search(searchMethodParams, Actor.class); - var results = responses.getResults(); - System.out.println("-> Multi Index Search:"); - for (var result : results) { - var response = (SearchResponse) result; - for (var hit : response.getHits()) { - var record = (Map) hit; - System.out.println("> " + record.get("name")); - } - } + var responses = client.search(searchMethodParams, Actor.class); + var results = responses.getResults(); + System.out.println("-> Multi Index Search:"); + for (var result : results) { + var response = (SearchResponse) result; + for (var hit : response.getHits()) { + var record = (Map) hit; + System.out.println("> " + record.get("name")); + } } + } } diff --git a/specs/common/schemas/IndexSettings.yml b/specs/common/schemas/IndexSettings.yml index 396c7b69e1..6c6a226a4c 100644 --- a/specs/common/schemas/IndexSettings.yml +++ b/specs/common/schemas/IndexSettings.yml @@ -283,6 +283,8 @@ baseIndexSettings: This applies faceting _after_ deduplication, which will result in accurate facet counts. example: url type: string + maxFacetHits: + $ref: '#/maxFacetHits' indexSettingsAsSearchParams: type: object @@ -570,33 +572,7 @@ indexSettingsAsSearchParams: x-categories: - Query strategy optionalWords: - type: array - items: - type: string - example: - - blue - - iphone case - description: | - Words that should be considered optional when found in the query. - - By default, records must match all words in the search query to be included in the search results. - Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. - For example, if the search query is "action video" and "video" is an optional word, - the search engine runs two queries. One for "action video" and one for "action". - Records that match all words are ranked higher. - - For a search query with 4 or more words **and** all its words are optional, - the number of matched words required for a record to be included in the search results increases for every 1,000 records: - - - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: - results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). - For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. - - For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - default: [] - x-categories: - - Query strategy + $ref: '#/optionalWords' disableExactOnAttributes: type: array items: @@ -708,8 +684,6 @@ indexSettingsAsSearchParams: default: ['*'] x-categories: - Advanced - maxFacetHits: - $ref: '#/maxFacetHits' maxValuesPerFacet: type: integer description: Maximum number of facet values to return for each facet. @@ -1238,3 +1212,38 @@ booleanString: enum: - 'true' - 'false' + +optionalWords: + oneOf: + - type: string + - type: 'null' + - $ref: '#/optionalWordsArray' + +optionalWordsArray: + type: array + items: + type: string + example: + - blue + - iphone case + description: | + Words that should be considered optional when found in the query. + + By default, records must match all words in the search query to be included in the search results. + Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. + For example, if the search query is "action video" and "video" is an optional word, + the search engine runs two queries. One for "action video" and one for "action". + Records that match all words are ranked higher. + + For a search query with 4 or more words **and** all its words are optional, + the number of matched words required for a record to be included in the search results increases for every 1,000 records: + + - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: + results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. + - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). + For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. + + For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). + default: [] + x-categories: + - Query strategy diff --git a/specs/common/schemas/SearchParams.yml b/specs/common/schemas/SearchParams.yml index e97918db1c..351b080da0 100644 --- a/specs/common/schemas/SearchParams.yml +++ b/specs/common/schemas/SearchParams.yml @@ -337,6 +337,12 @@ aroundLatLngViaIP: - Geo-Search insideBoundingBox: + oneOf: + - type: string + - type: 'null' + - $ref: '#/insideBoundingBoxArray' + +insideBoundingBoxArray: type: array items: type: array diff --git a/specs/composition/common/schemas/SearchParams.yml b/specs/composition/common/schemas/SearchParams.yml index 001b338ac5..41a762a011 100644 --- a/specs/composition/common/schemas/SearchParams.yml +++ b/specs/composition/common/schemas/SearchParams.yml @@ -908,33 +908,7 @@ InsetsQueryParameters: x-categories: - Query strategy optionalWords: - type: array - items: - type: string - example: - - blue - - iphone case - description: | - Words that should be considered optional when found in the query. - - By default, records must match all words in the search query to be included in the search results. - Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. - For example, if the search query is "action video" and "video" is an optional word, - the search engine runs two queries. One for "action video" and one for "action". - Records that match all words are ranked higher. - - For a search query with 4 or more words **and** all its words are optional, - the number of matched words required for a record to be included in the search results increases for every 1,000 records: - - - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: - results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). - For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. - - For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words). - default: [] - x-categories: - - Query strategy + $ref: '../../../common/schemas/IndexSettings.yml#/optionalWords' disableExactOnAttributes: type: array items: diff --git a/specs/recommend/common/schemas/IndexSettings.yml b/specs/recommend/common/schemas/IndexSettings.yml index 11331503d7..83147692a4 100644 --- a/specs/recommend/common/schemas/IndexSettings.yml +++ b/specs/recommend/common/schemas/IndexSettings.yml @@ -72,8 +72,6 @@ baseRecommendIndexSettings: $ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/minProximity' responseFields: $ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/responseFields' - maxFacetHits: - $ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/maxFacetHits' maxValuesPerFacet: $ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/maxValuesPerFacet' sortFacetValuesBy: diff --git a/templates/csharp/modelOneOf.mustache b/templates/csharp/modelOneOf.mustache index ff4196d3bd..5476baf07d 100644 --- a/templates/csharp/modelOneOf.mustache +++ b/templates/csharp/modelOneOf.mustache @@ -30,7 +30,7 @@ /// Initializes a new instance of the {{classname}} class /// with a {{#lambdaCref}}{{{dataType}}}{{/lambdaCref}} /// - /// An instance of {{dataType}}. + /// An instance of {{{dataType}}}. public {{classname}}({{{dataType}}} actualInstance) { ActualInstance = actualInstance{{^model.isNullable}}{{^isPrimitiveType}}{{^allowableValues}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/allowableValues}}{{/isPrimitiveType}}{{#isPrimitiveType}}{{#isArray}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isArray}}{{#isFreeFormObject}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isFreeFormObject}}{{#isString}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isString}}{{/isPrimitiveType}}{{/model.isNullable}}; @@ -44,7 +44,7 @@ /// Initializes a new instance of the {{classname}} class /// with a {{#lambdaCref}}{{{dataType}}}{{/lambdaCref}} /// - /// An instance of {{dataType}}. + /// An instance of {{{dataType}}}. public {{classname}}(object actualInstance) { ActualInstance = actualInstance{{^model.isNullable}}{{^isPrimitiveType}}{{^allowableValues}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/allowableValues}}{{/isPrimitiveType}}{{#isPrimitiveType}}{{#isArray}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isArray}}{{#isFreeFormObject}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isFreeFormObject}}{{#isString}} ?? throw new ArgumentException("Invalid instance found. Must not be null."){{/isString}}{{/isPrimitiveType}}{{/model.isNullable}}; @@ -65,7 +65,7 @@ /// the InvalidClassException will be thrown{{/lambda.escape-generic}} /// /// An instance of {{#lambda.escape-generic}}{{dataType}}{{/lambda.escape-generic}} - public {{{dataType}}}{{#vendorExtensions.x-has-child-generic}}{{/vendorExtensions.x-has-child-generic}} As{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{#lambda.titlecase}}{{{items.dataType}}}{{/lambda.titlecase}}() + public {{{dataType}}}{{#vendorExtensions.x-has-child-generic}}{{/vendorExtensions.x-has-child-generic}} As{{#lambda.type-to-name}}{{{datatypeWithEnum}}}{{/lambda.type-to-name}}() { return ({{{dataType}}}{{#vendorExtensions.x-has-child-generic}}{{/vendorExtensions.x-has-child-generic}})ActualInstance; } @@ -81,7 +81,7 @@ /// {{#lambda.escape-generic}}Check if the actual instance is of `{{{dataType}}}` type.{{/lambda.escape-generic}} /// /// Whether or not the instance is the type - public bool Is{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{#lambda.titlecase}}{{{items.dataType}}}{{/lambda.titlecase}}() + public bool Is{{#lambda.type-to-name}}{{{datatypeWithEnum}}}{{/lambda.type-to-name}}() { return ActualInstance.GetType() == typeof({{{dataType}}}{{#vendorExtensions.x-has-child-generic}}{{/vendorExtensions.x-has-child-generic}}); } diff --git a/templates/javascript/clients/algoliasearch/builds/models.mustache b/templates/javascript/clients/algoliasearch/builds/models.mustache index 16a1de871a..0c683c0b2f 100644 --- a/templates/javascript/clients/algoliasearch/builds/models.mustache +++ b/templates/javascript/clients/algoliasearch/builds/models.mustache @@ -40,8 +40,8 @@ import type { CustomGetProps, CustomPostProps, CustomPutProps, - DeleteSourceProps, DeletedAtResponse, + DeleteSourceProps, Distinct, Edit, EditType, @@ -50,19 +50,21 @@ import type { Exhaustive, FacetFilters, FacetOrdering, - FacetStats, Facets, + FacetStats, GetTaskProps, HighlightResult, HighlightResultOption, IgnorePlurals, IndexSettingsAsSearchParams, + InsideBoundingBox, Languages, - MatchLevel, MatchedGeoLocation, + MatchLevel, Mode, NumericFilters, OptionalFilters, + OptionalWords, Params, Personalization, Promote, @@ -71,7 +73,6 @@ import type { QueryType, Range, RankingInfo, - ReRankingApplyFilter, Redirect, RedirectRuleIndexData, RedirectRuleIndexMetadata, @@ -79,6 +80,7 @@ import type { RemoveStopWords, RemoveWordsIfNoResults, RenderingContent, + ReRankingApplyFilter, SearchPagination, SearchParams, SearchParamsObject, @@ -105,14 +107,25 @@ import type { EventType, } from '@algolia/client-personalization'; -type Region = {{#dependencies}} {{#dependencyHasRegionalHosts}}{{^-first}}|{{/-first}}{{#lambda.titlecase}}{{{dependencyName}}}Region{{/lambda.titlecase}} {{/dependencyHasRegionalHosts}}{{/dependencies}}; -type RegionOptions = {{#dependencies}} {{#dependencyHasRegionalHosts}}{{^-first}}|{{/-first}}{{#lambda.titlecase}}{{{dependencyName}}}RegionOptions{{/lambda.titlecase}} {{/dependencyHasRegionalHosts}}{{/dependencies}}; - {{#dependencies}} export * from '{{{dependencyPackage}}}'; {{/dependencies}} export * from '@algolia/client-search'; +export type Region = {{#dependencies}} {{#dependencyHasRegionalHosts}}{{^-first}}|{{/-first}}{{#lambda.titlecase}}{{{dependencyName}}}Region{{/lambda.titlecase}} {{/dependencyHasRegionalHosts}}{{/dependencies}}; +export type RegionOptions = {{#dependencies}} {{#dependencyHasRegionalHosts}}{{^-first}}|{{/-first}}{{#lambda.titlecase}}{{{dependencyName}}}RegionOptions{{/lambda.titlecase}} {{/dependencyHasRegionalHosts}}{{/dependencies}}; + +export type { + Status, + EventType, +{{#dependencies}} + {{#dependencyHasRegionalHosts}} + {{#lambda.titlecase}}{{{dependencyName}}}Region{{/lambda.titlecase}}, + {{#lambda.titlecase}}{{{dependencyName}}}RegionOptions{{/lambda.titlecase}}, + {{/dependencyHasRegionalHosts}} +{{/dependencies}} +}; + export type { Action, AdvancedSyntaxFeatures, @@ -142,30 +155,31 @@ export type { CustomGetProps, CustomPostProps, CustomPutProps, - DeleteSourceProps, DeletedAtResponse, + DeleteSourceProps, Distinct, Edit, EditType, ErrorBase, - EventType, ExactOnSingleWordQuery, Exhaustive, FacetFilters, FacetOrdering, - FacetStats, Facets, + FacetStats, GetTaskProps, HighlightResult, HighlightResultOption, IgnorePlurals, IndexSettingsAsSearchParams, + InsideBoundingBox, Languages, - MatchLevel, MatchedGeoLocation, + MatchLevel, Mode, NumericFilters, OptionalFilters, + OptionalWords, Params, Personalization, Promote, @@ -174,16 +188,14 @@ export type { QueryType, Range, RankingInfo, - ReRankingApplyFilter, Redirect, RedirectRuleIndexData, RedirectRuleIndexMetadata, RedirectURL, - Region, - RegionOptions, RemoveStopWords, RemoveWordsIfNoResults, RenderingContent, + ReRankingApplyFilter, SearchPagination, SearchParams, SearchParamsObject, @@ -193,7 +205,6 @@ export type { SnippetResultOption, SortRemainingBy, Source, - Status, SupportedLanguage, TagFilters, TaskStatus, @@ -202,15 +213,10 @@ export type { TypoToleranceEnum, Value, Widgets, - apiClientVersion, -{{#dependencies}} - {{#dependencyHasRegionalHosts}} - {{#lambda.titlecase}}{{{dependencyName}}}Region{{/lambda.titlecase}}, - {{#lambda.titlecase}}{{{dependencyName}}}RegionOptions{{/lambda.titlecase}}, - {{/dependencyHasRegionalHosts}} -{{/dependencies}} }; +export { apiClientVersion }; + /** * Options forwarded to the client initialized via the `init` method. */ diff --git a/tests/output/javascript/yarn.lock b/tests/output/javascript/yarn.lock index 0c74a9e063..9298170490 100644 --- a/tests/output/javascript/yarn.lock +++ b/tests/output/javascript/yarn.lock @@ -347,94 +347,102 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:22.8.1": - version: 22.8.1 - resolution: "@types/node@npm:22.8.1" +"@types/node@npm:22.9.0": + version: 22.9.0 + resolution: "@types/node@npm:22.9.0" dependencies: undici-types: "npm:~6.19.8" - checksum: 10/ae969e3d956dead1422c35d568ea5d48dd124a38a1a337cbd120fec6e13cc92b45c7308f91f1139fcd2337a67d4704d5614d6a2c444b1fb268f85e9f1d24c713 + checksum: 10/a7df3426891868b0f5fb03e46aeddd8446178233521c624a44531c92a040cf08a82d8235f7e1e02af731fd16984665d4d71f3418caf9c2788313b10f040d615d languageName: node linkType: hard -"@vitest/expect@npm:2.1.3": - version: 2.1.3 - resolution: "@vitest/expect@npm:2.1.3" +"@vitest/expect@npm:2.1.4": + version: 2.1.4 + resolution: "@vitest/expect@npm:2.1.4" dependencies: - "@vitest/spy": "npm:2.1.3" - "@vitest/utils": "npm:2.1.3" - chai: "npm:^5.1.1" + "@vitest/spy": "npm:2.1.4" + "@vitest/utils": "npm:2.1.4" + chai: "npm:^5.1.2" tinyrainbow: "npm:^1.2.0" - checksum: 10/94e61e01f14cfcd9ced0e7ac1bbdeee55ff4bf68f09d8f244fd7d73f97b106f35d10cba3fe7a0132464c312206f2eee9e83b16a8d761101b61da053890062858 + checksum: 10/0b3806d39233843a9661f6d5ccde489c9b6d278426f889198a862d601dcc186f107398487374195eb0dae90c9f69628f3f216200d644f817fa25d64ae1bc537e languageName: node linkType: hard -"@vitest/mocker@npm:2.1.3": - version: 2.1.3 - resolution: "@vitest/mocker@npm:2.1.3" +"@vitest/mocker@npm:2.1.4": + version: 2.1.4 + resolution: "@vitest/mocker@npm:2.1.4" dependencies: - "@vitest/spy": "npm:2.1.3" + "@vitest/spy": "npm:2.1.4" estree-walker: "npm:^3.0.3" - magic-string: "npm:^0.30.11" + magic-string: "npm:^0.30.12" peerDependencies: - "@vitest/spy": 2.1.3 - msw: ^2.3.5 + msw: ^2.4.9 vite: ^5.0.0 peerDependenciesMeta: msw: optional: true vite: optional: true - checksum: 10/84be8830d6e965109730257d7a84b3d7594db0998ae55decdbfc304857c1c7d29b49f1f5b23f2addcbce1bd7e8bb33832407737a9bb3f95cb3bf7bb312db4d9d + checksum: 10/00f323cc184977b247a1f0b9c51fdcceb97377031d728c69ef0bd14ebf0256742a94c68c6caa90eb073ed3de4277febd7d54715508bff05bb2fb7767ce11afbe languageName: node linkType: hard -"@vitest/pretty-format@npm:2.1.3, @vitest/pretty-format@npm:^2.1.3": - version: 2.1.3 - resolution: "@vitest/pretty-format@npm:2.1.3" +"@vitest/pretty-format@npm:2.1.4": + version: 2.1.4 + resolution: "@vitest/pretty-format@npm:2.1.4" dependencies: tinyrainbow: "npm:^1.2.0" - checksum: 10/d9382ee93f0f32e2ef8fe03bda818e5277f052a50ddb05b6a6cf0864b2ccb228484f12f130c05faf62dc2140292ffafc213f2941b0fa24058b3ee2943daa286c + checksum: 10/434e6a7903f72a3796f26516ad728aca92724909e18fd3f2cd4b9b8b0ae2cc7b4cd86e92ab9f2ac7bc005c7a7ef0bcb9d768c0264b4b0625f1f0748cc615f1f6 languageName: node linkType: hard -"@vitest/runner@npm:2.1.3": - version: 2.1.3 - resolution: "@vitest/runner@npm:2.1.3" +"@vitest/pretty-format@npm:^2.1.4": + version: 2.1.5 + resolution: "@vitest/pretty-format@npm:2.1.5" dependencies: - "@vitest/utils": "npm:2.1.3" + tinyrainbow: "npm:^1.2.0" + checksum: 10/98bf4e20c0efb893ffb2fe7713f84ccafd362d5022222ce097aab2368c2b0eccf3578d7ef4c26ea2f3d52e3c95f5fc7185ba36d7475d95537aab31ec4ac55d3a + languageName: node + linkType: hard + +"@vitest/runner@npm:2.1.4": + version: 2.1.4 + resolution: "@vitest/runner@npm:2.1.4" + dependencies: + "@vitest/utils": "npm:2.1.4" pathe: "npm:^1.1.2" - checksum: 10/cdf9b82d388c1cc148753f4a8632dfcadf9c4a1c0e065fdcd485d5af824af62507fd7eab9efb21244009775c05773ccb59547043af522a5ab6d216433321066e + checksum: 10/51dbea968ace6edefb058d88c9736fa524a64f4dc750ec163b43f5015a31b31f2d80a7b20de4c2a819fbfb172162ad4d0f8428c78fa7ca832c1a1b135161ac4b languageName: node linkType: hard -"@vitest/snapshot@npm:2.1.3": - version: 2.1.3 - resolution: "@vitest/snapshot@npm:2.1.3" +"@vitest/snapshot@npm:2.1.4": + version: 2.1.4 + resolution: "@vitest/snapshot@npm:2.1.4" dependencies: - "@vitest/pretty-format": "npm:2.1.3" - magic-string: "npm:^0.30.11" + "@vitest/pretty-format": "npm:2.1.4" + magic-string: "npm:^0.30.12" pathe: "npm:^1.1.2" - checksum: 10/2c0c4ad8abb758f2f76d1d6094f8928360437e09d0a59e0c6a85a544c892cc41a5324ebbc5657a66c8a3793e51cbf58e357c7f71e899f4e5c5eb76e8c9745abf + checksum: 10/785f74cf5f7745eb0dcb73fe3c628bc1f687c6341e8ba63d722fa83609d21465302ebd208405b9f91ce87fb36720a0f361c949983d5caccbcb8ec2119f995483 languageName: node linkType: hard -"@vitest/spy@npm:2.1.3": - version: 2.1.3 - resolution: "@vitest/spy@npm:2.1.3" +"@vitest/spy@npm:2.1.4": + version: 2.1.4 + resolution: "@vitest/spy@npm:2.1.4" dependencies: - tinyspy: "npm:^3.0.0" - checksum: 10/94d6f1bc34da5d0c973d9382c133b938e555fcf2d238edf0aaad3de1a98dd57ebf7c104ba229c6beec48122d2e6f55386d8d2cf96a5804dc95ac683a54754cc7 + tinyspy: "npm:^3.0.2" + checksum: 10/4dd3e7c28928abb047c567b3711d1cbccd59aaae294c57efaab83cdd723b568882de5376fc086c919a4cb6d1df5e6cc0502b3171cce06dfce87863c731fd5d36 languageName: node linkType: hard -"@vitest/utils@npm:2.1.3": - version: 2.1.3 - resolution: "@vitest/utils@npm:2.1.3" +"@vitest/utils@npm:2.1.4": + version: 2.1.4 + resolution: "@vitest/utils@npm:2.1.4" dependencies: - "@vitest/pretty-format": "npm:2.1.3" - loupe: "npm:^3.1.1" + "@vitest/pretty-format": "npm:2.1.4" + loupe: "npm:^3.1.2" tinyrainbow: "npm:^1.2.0" - checksum: 10/f064e6634cb84c925a17d8937df7441d150c3e24fa5bbd6304151d11dab6cdeb0cb3d5a95a9aacb8b416c87fb0d9aa8c6b9cc5e174191784231e8345948d6d18 + checksum: 10/aaaf5310943abca0f0080d9638e67838f7e519d5670ec32e61184915efdfa5ec61d9b495cad6cb7dc492e8caeed14593e78dda77c8ea59c1671a231661f57142 languageName: node linkType: hard @@ -550,16 +558,16 @@ __metadata: languageName: node linkType: hard -"chai@npm:^5.1.1": - version: 5.1.1 - resolution: "chai@npm:5.1.1" +"chai@npm:^5.1.2": + version: 5.1.2 + resolution: "chai@npm:5.1.2" dependencies: assertion-error: "npm:^2.0.1" check-error: "npm:^2.1.1" deep-eql: "npm:^5.0.1" loupe: "npm:^3.1.0" pathval: "npm:^2.0.0" - checksum: 10/ee67279a5613bd36dc1dc13660042429ae2f1dc5a9030a6abcf381345866dfb5bce7bc10b9d74c8de86b6f656489f654bbbef3f3361e06925591e6a00c72afff + checksum: 10/e8c2bbc83cb5a2f87130d93056d4cfbbe04106e12aa798b504816dbe3fa538a9f68541b472e56cbf0f54558b501d7e31867d74b8218abcd5a8cc8ba536fba46c languageName: node linkType: hard @@ -611,7 +619,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.3.4, debug@npm:^4.3.6": +"debug@npm:4, debug@npm:^4.3.4, debug@npm:^4.3.7": version: 4.3.7 resolution: "debug@npm:4.3.7" dependencies: @@ -770,6 +778,13 @@ __metadata: languageName: node linkType: hard +"expect-type@npm:^1.1.0": + version: 1.1.0 + resolution: "expect-type@npm:1.1.0" + checksum: 10/05fca80ddc7d493a89361f783c6b000750fa04a8226bc24701f3b90adb0efc2fb467f2a0baaed4015a02d8b9034ef5bb87521df9dba980f50b1105bd596ef833 + languageName: node + linkType: hard + "exponential-backoff@npm:^3.1.1": version: 3.1.1 resolution: "exponential-backoff@npm:3.1.1" @@ -954,11 +969,11 @@ __metadata: dependencies: "@algolia/client-composition": "link:../../../clients/algoliasearch-client-javascript/packages/client-composition" "@algolia/requester-testing": "link:../../../clients/algoliasearch-client-javascript/packages/requester-testing" - "@types/node": "npm:22.8.1" + "@types/node": "npm:22.9.0" algoliasearch: "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch" dotenv: "npm:16.4.5" typescript: "npm:5.6.3" - vitest: "npm:2.1.3" + vitest: "npm:2.1.4" languageName: unknown linkType: soft @@ -969,7 +984,7 @@ __metadata: languageName: node linkType: hard -"loupe@npm:^3.1.0, loupe@npm:^3.1.1": +"loupe@npm:^3.1.0, loupe@npm:^3.1.2": version: 3.1.2 resolution: "loupe@npm:3.1.2" checksum: 10/8f5734e53fb64cd914aa7d986e01b6d4c2e3c6c56dcbd5428d71c2703f0ab46b5ab9f9eeaaf2b485e8a1c43f865bdd16ec08ae1a661c8f55acdbd9f4d59c607a @@ -983,7 +998,7 @@ __metadata: languageName: node linkType: hard -"magic-string@npm:^0.30.11": +"magic-string@npm:^0.30.12": version: 0.30.12 resolution: "magic-string@npm:0.30.12" dependencies: @@ -1492,17 +1507,17 @@ __metadata: languageName: node linkType: hard -"tinyexec@npm:^0.3.0": +"tinyexec@npm:^0.3.1": version: 0.3.1 resolution: "tinyexec@npm:0.3.1" checksum: 10/0537c70590d52d354f40c0255ff0f654a3d18ddb3812b440ddf9d436edf516c8057838ad5a38744c0c59670ec03e3cf23fbe04ae3d49f031d948274e99002569 languageName: node linkType: hard -"tinypool@npm:^1.0.0": - version: 1.0.1 - resolution: "tinypool@npm:1.0.1" - checksum: 10/eaceb93784b8e27e60c0e3e2c7d11c29e1e79b2a025b2c232215db73b90fe22bd4753ad53fc8e801c2b5a63b94a823af549555d8361272bc98271de7dd4a9925 +"tinypool@npm:^1.0.1": + version: 1.0.2 + resolution: "tinypool@npm:1.0.2" + checksum: 10/6109322f14b3763f65c8fa49fddab72cd3edd96b82dd50e05e63de74867329ff5353bff4377281ec963213d9314f37f4a353e9ee34bbac85fd4c1e4a568d6076 languageName: node linkType: hard @@ -1513,7 +1528,7 @@ __metadata: languageName: node linkType: hard -"tinyspy@npm:^3.0.0": +"tinyspy@npm:^3.0.2": version: 3.0.2 resolution: "tinyspy@npm:3.0.2" checksum: 10/5db671b2ff5cd309de650c8c4761ca945459d7204afb1776db9a04fb4efa28a75f08517a8620c01ee32a577748802231ad92f7d5b194dc003ee7f987a2a06337 @@ -1565,17 +1580,17 @@ __metadata: languageName: node linkType: hard -"vite-node@npm:2.1.3": - version: 2.1.3 - resolution: "vite-node@npm:2.1.3" +"vite-node@npm:2.1.4": + version: 2.1.4 + resolution: "vite-node@npm:2.1.4" dependencies: cac: "npm:^6.7.14" - debug: "npm:^4.3.6" + debug: "npm:^4.3.7" pathe: "npm:^1.1.2" vite: "npm:^5.0.0" bin: vite-node: vite-node.mjs - checksum: 10/8ba6b145cbb02a492c7bb1f0490d02383000462f234ed61d24f650547163825c16f14e6908ee1eb661403bd0a7a3fb3cdbedf116cc015b1e5cdf7bb992872a01 + checksum: 10/3c3fbe6e41ab1716f4e6e0b52dcb80e027cb481df03e31d9bb5d16bb0ffabc5c884cca705ef8a5dea60f787e5eb78a428977d0d40e61e1f331bfb8c3d486d3e2 languageName: node linkType: hard @@ -1622,34 +1637,35 @@ __metadata: languageName: node linkType: hard -"vitest@npm:2.1.3": - version: 2.1.3 - resolution: "vitest@npm:2.1.3" - dependencies: - "@vitest/expect": "npm:2.1.3" - "@vitest/mocker": "npm:2.1.3" - "@vitest/pretty-format": "npm:^2.1.3" - "@vitest/runner": "npm:2.1.3" - "@vitest/snapshot": "npm:2.1.3" - "@vitest/spy": "npm:2.1.3" - "@vitest/utils": "npm:2.1.3" - chai: "npm:^5.1.1" - debug: "npm:^4.3.6" - magic-string: "npm:^0.30.11" +"vitest@npm:2.1.4": + version: 2.1.4 + resolution: "vitest@npm:2.1.4" + dependencies: + "@vitest/expect": "npm:2.1.4" + "@vitest/mocker": "npm:2.1.4" + "@vitest/pretty-format": "npm:^2.1.4" + "@vitest/runner": "npm:2.1.4" + "@vitest/snapshot": "npm:2.1.4" + "@vitest/spy": "npm:2.1.4" + "@vitest/utils": "npm:2.1.4" + chai: "npm:^5.1.2" + debug: "npm:^4.3.7" + expect-type: "npm:^1.1.0" + magic-string: "npm:^0.30.12" pathe: "npm:^1.1.2" std-env: "npm:^3.7.0" tinybench: "npm:^2.9.0" - tinyexec: "npm:^0.3.0" - tinypool: "npm:^1.0.0" + tinyexec: "npm:^0.3.1" + tinypool: "npm:^1.0.1" tinyrainbow: "npm:^1.2.0" vite: "npm:^5.0.0" - vite-node: "npm:2.1.3" + vite-node: "npm:2.1.4" why-is-node-running: "npm:^2.3.0" peerDependencies: "@edge-runtime/vm": "*" "@types/node": ^18.0.0 || >=20.0.0 - "@vitest/browser": 2.1.3 - "@vitest/ui": 2.1.3 + "@vitest/browser": 2.1.4 + "@vitest/ui": 2.1.4 happy-dom: "*" jsdom: "*" peerDependenciesMeta: @@ -1667,7 +1683,7 @@ __metadata: optional: true bin: vitest: vitest.mjs - checksum: 10/f6079a88583045b551e6526c08774aeac4a9cf85b132793a03f9470c013326abd7fce3985e3c2217dc0dac2fadeee3506e3dc51e215f10862b2fe9da9289af0f + checksum: 10/bf0bb39e6148678ccc0d856a6a08e99458e80266558f97757bd20980812cd439f51599bcb64c807805594bf6fdb2111fdca688bc8884524819cc4a84a4598109 languageName: node linkType: hard