@translated/lara 1.1.0 → 1.2.1

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.1.0";
1
+ export declare const version = "1.2.1";
@@ -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.1.0";
4
+ exports.version = "1.2.1";
@@ -29,9 +29,11 @@ export type TranslateOptions = {
29
29
  multiline?: boolean;
30
30
  timeoutInMillis?: number;
31
31
  priority?: "normal" | "background";
32
+ useCache?: boolean | "overwrite";
33
+ cacheTTLSeconds?: number;
32
34
  };
33
35
  export declare class Translator {
34
- private readonly client;
36
+ protected readonly client: LaraClient;
35
37
  readonly memories: Memories;
36
38
  constructor(credentials: Credentials, options?: TranslatorOptions);
37
39
  getLanguages(): Promise<string[]>;
@@ -112,9 +112,11 @@ class Translator {
112
112
  }
113
113
  async translate(text, source, target, options) {
114
114
  return await this.client.post("/translate", {
115
- q: text, source, target, source_hint: options === null || options === void 0 ? void 0 : options.sourceHint, content_type: options === null || options === void 0 ? void 0 : options.contentType,
116
- multiline: (options === null || options === void 0 ? void 0 : options.multiline) !== false, adapt_to: options === null || options === void 0 ? void 0 : options.adaptTo,
117
- instructions: options === null || options === void 0 ? void 0 : options.instructions, timeout: options === null || options === void 0 ? void 0 : options.timeoutInMillis, priority: options === null || options === void 0 ? void 0 : options.priority
115
+ q: text, source, target, source_hint: options === null || options === void 0 ? void 0 : options.sourceHint,
116
+ content_type: options === null || options === void 0 ? void 0 : options.contentType, multiline: (options === null || options === void 0 ? void 0 : options.multiline) !== false,
117
+ adapt_to: options === null || options === void 0 ? void 0 : options.adaptTo, instructions: options === null || options === void 0 ? void 0 : options.instructions,
118
+ timeout: options === null || options === void 0 ? void 0 : options.timeoutInMillis, priority: options === null || options === void 0 ? void 0 : options.priority,
119
+ use_cache: options === null || options === void 0 ? void 0 : options.useCache, cache_ttl: options === null || options === void 0 ? void 0 : options.cacheTTLSeconds
118
120
  });
119
121
  }
120
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@translated/lara",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "engines": {
package/lib/_test.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/lib/_test.js DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const translator_1 = require("./translator/translator");
4
- const credentials_1 = require("./credentials");
5
- async function main() {
6
- const credentials = new credentials_1.Credentials("7GAFEDT3LDJAJH9HFA1CDJULDU", "EBXxbk71Mx6yR9YG48f1jDyY4s5QQLOff0GcTw2QlfY");
7
- const translator = new translator_1.Translator(credentials, {
8
- serverUrl: "http://localhost:8000/"
9
- });
10
- console.log(await translator.translate("This is a test.", "en", "it", {
11
- priority: "background"
12
- }));
13
- }
14
- main().catch(console.error);