@translated/lara 1.7.2 → 1.7.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/net/client.js CHANGED
@@ -93,7 +93,13 @@ class LaraClient {
93
93
  const signature = await this.sign(method, path, _headers);
94
94
  _headers.Authorization = `Lara ${this.accessKeyId}:${signature}`;
95
95
  for await (const chunk of this.sendAndGetStream(path, _headers, requestBody)) {
96
- yield parseContent(chunk.body.content);
96
+ if (200 <= chunk.statusCode && chunk.statusCode < 300) {
97
+ yield parseContent(chunk.body.content);
98
+ }
99
+ else {
100
+ const error = chunk.body.error || {};
101
+ throw new errors_1.LaraApiError(chunk.statusCode, error.type || "UnknownError", error.message || "An unknown error occurred");
102
+ }
97
103
  }
98
104
  }
99
105
  async request(method, path, body, files, headers) {
@@ -55,6 +55,10 @@ export type TranslationStyle = "faithful" | "fluid" | "creative";
55
55
  export interface DetectResult {
56
56
  language: string;
57
57
  contentType: string;
58
+ predictions: {
59
+ language: string;
60
+ confidence: number;
61
+ }[];
58
62
  }
59
63
  export declare class Translator {
60
64
  protected readonly client: LaraClient;
@@ -1 +1 @@
1
- export declare const version = "1.7.2";
1
+ export declare const version = "1.7.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.7.2";
4
+ exports.version = "1.7.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@translated/lara",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "engines": {