deepl-node
Advanced tools
Comparing version 1.10.2 to 1.11.0
@@ -8,5 +8,25 @@ # Changelog | ||
## [Unreleased] | ||
## [1.11.0] - 2023-11-03 | ||
### Added | ||
* Add optional `context` parameter for text translation, that specifies | ||
additional context to influence translations, that is not translated itself. | ||
### Changed | ||
* Added notice in Readme that starting in 2024 the library will drop support for | ||
Node versions that are officially end-of-life. | ||
* Keep-Alive is now used by HTTP(S) agent, to reduce latency for subsequent API requests. | ||
### Fixed | ||
* CI: silence npm audit warnings in non-production dependencies due to | ||
currently-unresolvable [vulnerability in semver <7.5.2](https://github.com/npm/node-semver/pull/564). | ||
* Increase axios dependency to >=1.2.2, due to [bug in axios v1.2.1](https://github.com/axios/axios/issues/5346). | ||
* Added supported glossary languages: Italian (it), Dutch (nl), Polish (pl), | ||
Portuguese (pt), Russian (ru) and Chinese (zh). The corresponding glossary | ||
language code TypeScript types are extended. | ||
Note: older library versions also support the new glossary language pairs, | ||
this update only adds new types. | ||
* Fixed typo in readme: `createGlossaryWithCsv` not `createGlossaryFromCsv` | ||
* Issue [#36](https://github.com/DeepLcom/deepl-node/issues/36) thanks to | ||
[phenomen](https://github.com/phenomen). | ||
## [1.10.2] - 2023-06-02 | ||
@@ -193,3 +213,3 @@ ### Fixed | ||
[Unreleased]: https://github.com/DeepLcom/deepl-node/compare/v1.10.2...HEAD | ||
[1.11.0]: https://github.com/DeepLcom/deepl-node/compare/v1.10.2...v1.11.0 | ||
[1.10.2]: https://github.com/DeepLcom/deepl-node/compare/v1.9.0...v1.10.2 | ||
@@ -196,0 +216,0 @@ [1.10.1]: https://github.com/DeepLcom/deepl-node/compare/v1.9.0...v1.10.1 |
@@ -5,2 +5,25 @@ "use strict"; | ||
// license that can be found in the LICENSE file. | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -15,2 +38,8 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const form_data_1 = __importDefault(require("form-data")); | ||
const https = __importStar(require("https")); | ||
const http = __importStar(require("http")); | ||
const axiosInstance = axios_1.default.create({ | ||
httpAgent: new http.Agent({ keepAlive: true }), | ||
httpsAgent: new https.Agent({ keepAlive: true }), | ||
}); | ||
/** | ||
@@ -153,3 +182,3 @@ * Internal class implementing exponential-backoff timer. | ||
try { | ||
const response = await axios_1.default.request(axiosRequestConfig); | ||
const response = await axiosInstance.request(axiosRequestConfig); | ||
if (axiosRequestConfig.responseType === 'text') { | ||
@@ -156,0 +185,0 @@ // Workaround for axios-bug: https://github.com/axios/axios/issues/907 |
@@ -204,2 +204,5 @@ "use strict"; | ||
} | ||
if (options.context !== undefined) { | ||
data.append('context', options.context); | ||
} | ||
if (options.nonSplittingTags !== undefined) { | ||
@@ -650,3 +653,3 @@ data.append('non_splitting_tags', joinTagList(options.nonSplittingTags)); | ||
constructUserAgentString(sendPlatformInfo, appInfo) { | ||
let libraryInfoString = 'deepl-node/1.10.2'; | ||
let libraryInfoString = 'deepl-node/1.11.0'; | ||
if (sendPlatformInfo) { | ||
@@ -653,0 +656,0 @@ const systemType = os.type(); |
@@ -112,2 +112,7 @@ /** | ||
outlineDetection?: boolean; | ||
/** Specifies additional context to influence translations, that is not | ||
* translated itself. Note this is an **alpha feature**: it may be deprecated at | ||
* any time, or incur charges if it becomes generally available. | ||
* See the API documentation for more information and example usage. */ | ||
context?: string; | ||
/** List of XML tags that should be used to split text into sentences. */ | ||
@@ -165,3 +170,3 @@ splittingTags?: TagList; | ||
*/ | ||
export type SourceGlossaryLanguageCode = 'de' | 'en' | 'es' | 'fr' | 'ja'; | ||
export type SourceGlossaryLanguageCode = 'de' | 'en' | 'es' | 'fr' | 'it' | 'ja' | 'nl' | 'pl' | 'pt' | 'ru' | 'zh'; | ||
/** | ||
@@ -168,0 +173,0 @@ * Language codes that may be used as a target language for glossaries. |
{ | ||
"name": "deepl-node", | ||
"description": "deepl-node is the official DeepL Node.js client library", | ||
"version": "1.10.2", | ||
"version": "1.11.0", | ||
"author": "DeepL SE <open-source@deepl.com> (https://www.deepl.com)", | ||
@@ -23,3 +23,3 @@ "license": "MIT", | ||
"@types/node": ">=12.0", | ||
"axios": ">=0.21.2 <1.2.0 || >=1.2.1", | ||
"axios": ">=0.21.2 <1.2.0 || >=1.2.2", | ||
"form-data": "^3.0.0", | ||
@@ -26,0 +26,0 @@ "loglevel": ">=1.6.2" |
@@ -34,2 +34,7 @@ # deepl-node | ||
Starting in 2024, we will drop support for older Node versions that have reached | ||
official end-of-life. You can find the Node versions and support timelines | ||
[here][node-version-list]. | ||
To continue using this library, you should update to Node 18+. | ||
## Usage | ||
@@ -171,2 +176,7 @@ | ||
`getGlossary()`. | ||
- `context`: specifies additional context to influence translations, that is not | ||
translated itself. Note this is an **alpha feature**: it may be deprecated at | ||
any time, or incur charges if it becomes generally available. | ||
See the [API documentation][api-docs-context-param] for more information and | ||
example usage. | ||
- `tagHandling`: type of tags to parse before translation, options are `'html'` | ||
@@ -260,3 +270,3 @@ and `'xml'`. | ||
You can also upload a glossary downloaded from the DeepL website using | ||
`createGlossaryFromCsv()`. Instead of supplying the entries as a dictionary, | ||
`createGlossaryWithCsv()`. Instead of supplying the entries as a dictionary, | ||
provide the CSV file as a string containing the file path, or a Stream, Buffer, | ||
@@ -267,3 +277,3 @@ or FileHandle containing the CSV file content: | ||
const csvFilePath = '/path/to/glossary_file.csv'; | ||
const glossaryEnToDe = await translator.createGlossaryFromCsv( | ||
const glossaryEnToDe = await translator.createGlossaryWithCsv( | ||
'My glossary', | ||
@@ -494,2 +504,3 @@ 'en', | ||
[api-docs]: https://www.deepl.com/docs-api?utm_source=github&utm_medium=github-nodejs-readme | ||
[api-docs-context-param]: https://www.deepl.com/docs-api/translating-text/?utm_source=github&utm_medium=github-nodejs-readme | ||
[api-docs-csv-format]: https://www.deepl.com/docs-api/managing-glossaries/supported-glossary-formats/?utm_source=github&utm_medium=github-nodejs-readme | ||
@@ -500,2 +511,3 @@ [axios-proxy-docs]: https://axios-http.com/docs/req_config | ||
[issues]: https://www.github.com/DeepLcom/deepl-node/issues | ||
[node-version-list]: https://nodejs.dev/en/about/releases/ | ||
[pro-account]: https://www.deepl.com/pro-account/?utm_source=github&utm_medium=github-nodejs-readme |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
124229
2014
508
3