@translated/lara 1.5.2 → 1.5.3
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.
|
@@ -15,6 +15,7 @@ class BrowserLaraClient extends client_1.LaraClient {
|
|
|
15
15
|
this.baseUrl = url;
|
|
16
16
|
}
|
|
17
17
|
async send(path, headers, body) {
|
|
18
|
+
var _a;
|
|
18
19
|
let requestBody = undefined;
|
|
19
20
|
if (body) {
|
|
20
21
|
if (headers["Content-Type"] === "multipart/form-data") {
|
|
@@ -39,6 +40,14 @@ class BrowserLaraClient extends client_1.LaraClient {
|
|
|
39
40
|
method: "POST",
|
|
40
41
|
body: requestBody
|
|
41
42
|
});
|
|
43
|
+
if ((_a = response.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.includes("text/csv")) {
|
|
44
|
+
return {
|
|
45
|
+
statusCode: response.status,
|
|
46
|
+
body: {
|
|
47
|
+
content: await response.text()
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
42
51
|
return { statusCode: response.status, body: await response.json() };
|
|
43
52
|
}
|
|
44
53
|
wrapMultiPartFile(file) {
|
package/lib/net/node-client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseURL, ClientResponse, LaraClient, MultiPartFile } from "./client";
|
|
2
1
|
import { Readable } from "stream";
|
|
2
|
+
import { BaseURL, ClientResponse, LaraClient, MultiPartFile } from "./client";
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare class NodeLaraClient extends LaraClient {
|
|
5
5
|
private readonly baseUrl;
|
package/lib/net/node-client.js
CHANGED
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.NodeLaraClient = void 0;
|
|
7
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
9
|
const http_1 = __importDefault(require("http"));
|
|
8
10
|
const https_1 = __importDefault(require("https"));
|
|
9
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
10
|
-
const client_1 = require("./client");
|
|
11
11
|
const stream_1 = require("stream");
|
|
12
|
-
const
|
|
12
|
+
const client_1 = require("./client");
|
|
13
13
|
/** @internal */
|
|
14
14
|
class NodeLaraClient extends client_1.LaraClient {
|
|
15
15
|
constructor(baseUrl, accessKeyId, accessKeySecret) {
|
|
@@ -53,7 +53,16 @@ class NodeLaraClient extends client_1.LaraClient {
|
|
|
53
53
|
let data = "";
|
|
54
54
|
res.on("data", (chunk) => data += chunk);
|
|
55
55
|
res.on("end", () => {
|
|
56
|
+
var _a;
|
|
56
57
|
let json;
|
|
58
|
+
if ((_a = res.headers['content-type']) === null || _a === void 0 ? void 0 : _a.includes('text/csv')) {
|
|
59
|
+
return resolve({
|
|
60
|
+
statusCode: res.statusCode,
|
|
61
|
+
body: {
|
|
62
|
+
content: data
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
57
66
|
try {
|
|
58
67
|
json = JSON.parse(data);
|
|
59
68
|
}
|
package/lib/sdk-version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.5.
|
|
1
|
+
export declare const version = "1.5.3";
|
package/lib/sdk-version.js
CHANGED
|
@@ -45,8 +45,8 @@ export declare class Documents {
|
|
|
45
45
|
constructor(client: LaraClient);
|
|
46
46
|
upload(file: MultiPartFile, filename: string, source: string | null, target: string, options?: DocumentUploadOptions): Promise<Document>;
|
|
47
47
|
status(id: string): Promise<Document>;
|
|
48
|
-
download(id: string, options?: DocumentDownloadOptions): Promise<Blob | Buffer
|
|
49
|
-
translate(file: MultiPartFile, filename: string, source: string | null, target: string, options?: DocumentTranslateOptions): Promise<Blob | Buffer
|
|
48
|
+
download(id: string, options?: DocumentDownloadOptions): Promise<Blob | Buffer>;
|
|
49
|
+
translate(file: MultiPartFile, filename: string, source: string | null, target: string, options?: DocumentTranslateOptions): Promise<Blob | Buffer>;
|
|
50
50
|
}
|
|
51
51
|
export declare class Translator {
|
|
52
52
|
protected readonly client: LaraClient;
|