Comparing version 1.0.10 to 1.0.11
@@ -57,4 +57,4 @@ /** | ||
type ContentsOptions = { | ||
text?: TextContentsOptions | boolean; | ||
highlights?: HighlightsContentsOptions | boolean; | ||
text?: TextContentsOptions | true; | ||
highlights?: HighlightsContentsOptions | true; | ||
}; | ||
@@ -99,2 +99,3 @@ /** | ||
}; | ||
type Default<T extends {}, U> = [keyof T] extends [never] ? U : T; | ||
/** | ||
@@ -106,3 +107,3 @@ * @typedef {Object} ContentsResultComponent | ||
*/ | ||
type ContentsResultComponent<T extends ContentsOptions> = (T['text'] extends (object | true) ? TextResponse : {}) & (T['highlights'] extends (object | true) ? HighlightsResponse : {}); | ||
type ContentsResultComponent<T extends ContentsOptions> = Default<(T['text'] extends (object | true) ? TextResponse : {}) & (T['highlights'] extends (object | true) ? HighlightsResponse : {}), TextResponse>; | ||
/** | ||
@@ -149,8 +150,8 @@ * Represents a search result object. | ||
/** | ||
* Makes a request to the Exa API. | ||
* @param {string} endpoint - The API endpoint to call. | ||
* @param {string} method - The HTTP method to use. | ||
* @param {any} [body] - The request body for POST requests. | ||
* @returns {Promise<any>} The response from the API. | ||
*/ | ||
* Makes a request to the Exa API. | ||
* @param {string} endpoint - The API endpoint to call. | ||
* @param {string} method - The HTTP method to use. | ||
* @param {any} [body] - The request body for POST requests. | ||
* @returns {Promise<any>} The response from the API. | ||
*/ | ||
private request; | ||
@@ -194,2 +195,2 @@ /** | ||
export { BaseSearchOptions, ContentsOptions, FindSimilarOptions, HighlightsContentsOptions, RegularSearchOptions, SearchResponse, SearchResult, TextContentsOptions, Exa as default }; | ||
export { BaseSearchOptions, ContentsOptions, ContentsResultComponent, Default, FindSimilarOptions, HighlightsContentsOptions, HighlightsResponse, RegularSearchOptions, SearchResponse, SearchResult, TextContentsOptions, TextResponse, Exa as default }; |
@@ -97,3 +97,3 @@ "use strict"; | ||
query, | ||
contents: { | ||
contents: !text && !highlights ? { text: true } : { | ||
...text ? { text } : {}, | ||
@@ -124,3 +124,3 @@ ...highlights ? { highlights } : {} | ||
url, | ||
contents: { | ||
contents: !text && !highlights ? { text: true } : { | ||
...text ? { text } : {}, | ||
@@ -127,0 +127,0 @@ ...highlights ? { highlights } : {} |
{ | ||
"name": "exa-js", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Exa SDK for Node.js and the browser", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50012
460