deepl-node
Advanced tools
Comparing version 1.12.0 to 1.13.0
@@ -8,2 +8,13 @@ # Changelog | ||
## [1.13.0] - 2024-04-12 | ||
### Added | ||
* Add possibility to add extra parameters to a translation request (both text and document). | ||
DeepL engineers use this to test features in the API before they are released. Library users | ||
who cannot update their DeepL library dependency could use these extra parameters to access | ||
features in the API that are released in the future. | ||
### Security | ||
* Increase `follow-redirects` locked-version due to security | ||
[vulnerability in follow-redirects <1.15.5](https://github.com/advisories/GHSA-cxjh-pqwp-8mfp) | ||
## [1.12.0] - 2024-02-27 | ||
@@ -230,2 +241,3 @@ ### Added | ||
[1.13.0]: https://github.com/DeepLcom/deepl-node/compare/v1.12.0...v1.13.0 | ||
[1.12.0]: https://github.com/DeepLcom/deepl-node/compare/v1.11.1...v1.12.0 | ||
@@ -232,0 +244,0 @@ [1.11.1]: https://github.com/DeepLcom/deepl-node/compare/v1.11.0...v1.11.1 |
@@ -104,3 +104,3 @@ "use strict"; | ||
*/ | ||
function buildURLSearchParams(sourceLang, targetLang, formality, glossary) { | ||
function buildURLSearchParams(sourceLang, targetLang, formality, glossary, extraRequestParameters) { | ||
targetLang = standardizeLanguageCode(targetLang); | ||
@@ -144,2 +144,7 @@ if (sourceLang !== null) { | ||
} | ||
if (extraRequestParameters !== undefined) { | ||
for (const paramName in extraRequestParameters) { | ||
searchParams.append(paramName, extraRequestParameters[paramName]); | ||
} | ||
} | ||
return searchParams; | ||
@@ -357,3 +362,3 @@ } | ||
async translateText(texts, sourceLang, targetLang, options) { | ||
const data = buildURLSearchParams(sourceLang, targetLang, options === null || options === void 0 ? void 0 : options.formality, options === null || options === void 0 ? void 0 : options.glossary); | ||
const data = buildURLSearchParams(sourceLang, targetLang, options === null || options === void 0 ? void 0 : options.formality, options === null || options === void 0 ? void 0 : options.glossary, options === null || options === void 0 ? void 0 : options.extraRequestParameters); | ||
const singular = appendTextsAndReturnIsSingular(data, texts); | ||
@@ -609,3 +614,3 @@ validateAndAppendTextOptions(data, options); | ||
async internalUploadDocument(fileBuffer, sourceLang, targetLang, filename, options) { | ||
const data = buildURLSearchParams(sourceLang, targetLang, options === null || options === void 0 ? void 0 : options.formality, options === null || options === void 0 ? void 0 : options.glossary); | ||
const data = buildURLSearchParams(sourceLang, targetLang, options === null || options === void 0 ? void 0 : options.formality, options === null || options === void 0 ? void 0 : options.glossary, options === null || options === void 0 ? void 0 : options.extraRequestParameters); | ||
const { statusCode, content } = await this.httpClient.sendRequestWithBackoff('POST', '/v2/document', { | ||
@@ -656,3 +661,3 @@ data, | ||
constructUserAgentString(sendPlatformInfo, appInfo) { | ||
let libraryInfoString = 'deepl-node/1.12.0'; | ||
let libraryInfoString = 'deepl-node/1.13.0'; | ||
if (sendPlatformInfo) { | ||
@@ -659,0 +664,0 @@ const systemType = os.type(); |
@@ -123,2 +123,4 @@ /** | ||
ignoreTags?: TagList; | ||
/** Extra parameters to be added to a text translation request. */ | ||
extraRequestParameters?: RequestParameters; | ||
} | ||
@@ -135,2 +137,4 @@ /** | ||
filename?: string; | ||
/** Extra parameters to be added to a text translation request. */ | ||
extraRequestParameters?: RequestParameters; | ||
} | ||
@@ -178,2 +182,7 @@ /** | ||
export type TargetGlossaryLanguageCode = SourceGlossaryLanguageCode; | ||
/** | ||
* Extra request parameters to be passed with translation requests. | ||
* They are stored as an object where each field represents a request parameter. | ||
*/ | ||
export type RequestParameters = Record<string, string>; | ||
export {}; |
{ | ||
"name": "deepl-node", | ||
"description": "deepl-node is the official DeepL Node.js client library", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"author": "DeepL SE <open-source@deepl.com> (https://www.deepl.com)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -195,3 +195,7 @@ # deepl-node | ||
translated. Format and default are the same as for `splittingTags`. | ||
- `extraRequestParameters`: Extra body parameters to be passed along with the | ||
HTTP request. Only string values are permitted. | ||
For example: `{'param': 'value', 'param2': 'value2'}` | ||
### Translating documents | ||
@@ -250,2 +254,3 @@ | ||
needed to specify the file extension. | ||
- `extraRequestParameters`: same as in [Text translation options](#text-translation-options). | ||
@@ -252,0 +257,0 @@ ### Glossaries |
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
126729
2028
513