@translated/lara 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/sdk-version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.5.
|
|
1
|
+
export declare const version = "1.5.4";
|
package/lib/sdk-version.js
CHANGED
|
@@ -32,6 +32,7 @@ export type TranslateOptions = {
|
|
|
32
32
|
priority?: "normal" | "background";
|
|
33
33
|
useCache?: boolean | "overwrite";
|
|
34
34
|
cacheTTLSeconds?: number;
|
|
35
|
+
noTrace?: boolean;
|
|
35
36
|
};
|
|
36
37
|
export type DocumentTranslateOptions = DocumentUploadOptions & DocumentDownloadOptions;
|
|
37
38
|
export type S3UploadFields = {
|
|
@@ -112,12 +112,13 @@ class Documents {
|
|
|
112
112
|
async upload(file, filename, source, target, options) {
|
|
113
113
|
const { url, fields } = await this.client.get(`/documents/upload-url`, { filename });
|
|
114
114
|
await this.s3Client.upload(url, fields, file);
|
|
115
|
+
const headers = (options === null || options === void 0 ? void 0 : options.noTrace) ? { 'X-No-Trace': 'true' } : {};
|
|
115
116
|
return this.client.post('/documents', {
|
|
116
117
|
source,
|
|
117
118
|
target,
|
|
118
119
|
s3key: fields.key,
|
|
119
120
|
adapt_to: options === null || options === void 0 ? void 0 : options.adaptTo,
|
|
120
|
-
});
|
|
121
|
+
}, undefined, headers);
|
|
121
122
|
}
|
|
122
123
|
async status(id) {
|
|
123
124
|
return await this.client.get(`/documents/${id}`);
|
|
@@ -129,7 +130,10 @@ class Documents {
|
|
|
129
130
|
return await this.s3Client.download(url);
|
|
130
131
|
}
|
|
131
132
|
async translate(file, filename, source, target, options) {
|
|
132
|
-
const uploadOptions =
|
|
133
|
+
const uploadOptions = {
|
|
134
|
+
adaptTo: options === null || options === void 0 ? void 0 : options.adaptTo,
|
|
135
|
+
noTrace: options === null || options === void 0 ? void 0 : options.noTrace
|
|
136
|
+
};
|
|
133
137
|
const { id } = await this.upload(file, filename, source, target, uploadOptions);
|
|
134
138
|
const downloadOptions = (options === null || options === void 0 ? void 0 : options.outputFormat) ? { outputFormat: options.outputFormat } : undefined;
|
|
135
139
|
const pollingInterval = 2000;
|
|
@@ -158,13 +162,14 @@ class Translator {
|
|
|
158
162
|
return await this.client.get("/languages");
|
|
159
163
|
}
|
|
160
164
|
async translate(text, source, target, options) {
|
|
165
|
+
const headers = (options === null || options === void 0 ? void 0 : options.noTrace) ? { 'X-No-Trace': 'true' } : {};
|
|
161
166
|
return await this.client.post("/translate", {
|
|
162
167
|
q: text, source, target, source_hint: options === null || options === void 0 ? void 0 : options.sourceHint,
|
|
163
168
|
content_type: options === null || options === void 0 ? void 0 : options.contentType, multiline: (options === null || options === void 0 ? void 0 : options.multiline) !== false,
|
|
164
169
|
adapt_to: options === null || options === void 0 ? void 0 : options.adaptTo, instructions: options === null || options === void 0 ? void 0 : options.instructions,
|
|
165
170
|
timeout: options === null || options === void 0 ? void 0 : options.timeoutInMillis, priority: options === null || options === void 0 ? void 0 : options.priority,
|
|
166
171
|
use_cache: options === null || options === void 0 ? void 0 : options.useCache, cache_ttl: options === null || options === void 0 ? void 0 : options.cacheTTLSeconds
|
|
167
|
-
});
|
|
172
|
+
}, undefined, headers);
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
175
|
exports.Translator = Translator;
|