@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.
@@ -1 +1 @@
1
- export declare const version = "1.5.3";
1
+ export declare const version = "1.5.4";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = "1.5.3";
4
+ exports.version = "1.5.4";
@@ -28,6 +28,7 @@ export declare enum DocumentStatus {
28
28
  }
29
29
  export type DocumentUploadOptions = {
30
30
  adaptTo?: string[];
31
+ noTrace?: boolean;
31
32
  };
32
33
  export type DocumentDownloadOptions = {
33
34
  outputFormat?: string;
@@ -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 = (options === null || options === void 0 ? void 0 : options.adaptTo) ? { adaptTo: options.adaptTo } : undefined;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@translated/lara",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "engines": {