smartling-api-sdk-nodejs 2.28.0 → 2.29.0
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/.scannerwork/report-task.txt +2 -2
- package/api/base/base-api.ts +1 -1
- package/api/files/index.ts +19 -0
- package/api/files/params/download-file-base-parameters.ts +22 -0
- package/api/files/params/download-file-parameters.ts +2 -21
- package/api/files/params/download-multiple-files-translations-parameters.ts +50 -0
- package/api/files/params/file-filter.ts +4 -0
- package/api/files/params/file-locale-mode.ts +19 -0
- package/api/files/params/file-locales.ts +6 -0
- package/api/files/params/translation-file-name-mode.ts +18 -0
- package/built/api/base/base-api.js +1 -1
- package/built/api/base/base-api.js.map +1 -1
- package/built/api/files/index.d.ts +2 -0
- package/built/api/files/index.js +5 -0
- package/built/api/files/index.js.map +1 -1
- package/built/api/files/params/download-file-base-parameters.d.ts +7 -0
- package/built/api/files/params/download-file-base-parameters.js +20 -0
- package/built/api/files/params/download-file-base-parameters.js.map +1 -0
- package/built/api/files/params/download-file-parameters.d.ts +2 -6
- package/built/api/files/params/download-file-parameters.js +2 -14
- package/built/api/files/params/download-file-parameters.js.map +1 -1
- package/built/api/files/params/download-multiple-files-translations-parameters.d.ts +12 -0
- package/built/api/files/params/download-multiple-files-translations-parameters.js +37 -0
- package/built/api/files/params/download-multiple-files-translations-parameters.js.map +1 -0
- package/built/api/files/params/file-filter.d.ts +4 -0
- package/built/api/files/params/file-filter.js +9 -0
- package/built/api/files/params/file-filter.js.map +1 -0
- package/built/api/files/params/file-locale-mode.d.ts +5 -0
- package/built/api/files/params/file-locale-mode.js +10 -0
- package/built/api/files/params/file-locale-mode.js.map +1 -0
- package/built/api/files/params/file-locales.d.ts +5 -0
- package/built/api/files/params/file-locales.js +3 -0
- package/built/api/files/params/file-locales.js.map +1 -0
- package/built/api/files/params/translation-file-name-mode.d.ts +5 -0
- package/built/api/files/params/translation-file-name-mode.js +10 -0
- package/built/api/files/params/translation-file-name-mode.js.map +1 -0
- package/built/index.d.ts +5 -0
- package/built/index.js +5 -0
- package/built/index.js.map +1 -1
- package/built/package.json +1 -1
- package/index.ts +5 -0
- package/package.json +1 -1
- package/test/files.spec.ts +107 -0
|
@@ -2,5 +2,5 @@ projectKey=smartling-api-sdk-nodejs
|
|
|
2
2
|
serverUrl=https://sonar-next.connectors.stg.smartling.net
|
|
3
3
|
serverVersion=8.6.1.40680
|
|
4
4
|
dashboardUrl=https://sonar-next.connectors.stg.smartling.net/dashboard?id=smartling-api-sdk-nodejs
|
|
5
|
-
ceTaskId=
|
|
6
|
-
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=
|
|
5
|
+
ceTaskId=AZoGEvjgPfHZTFZmYaY0
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZoGEvjgPfHZTFZmYaY0
|
package/api/base/base-api.ts
CHANGED
|
@@ -141,7 +141,7 @@ export class SmartlingBaseApi {
|
|
|
141
141
|
|
|
142
142
|
// Special case for zip file download - return raw response array buffer.
|
|
143
143
|
if (returnRawResponseBody === ResponseBodyType.ARRAY_BUFFER) {
|
|
144
|
-
return response.arrayBuffer();
|
|
144
|
+
return response.status === 204 ? null : response.arrayBuffer();
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// Special case for download file with metadata - return raw response.
|
package/api/files/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { UploadedFileDto } from "./dto/uploaded-file-dto";
|
|
|
12
12
|
import { FileStatusForProjectDto } from "./dto/file-status-for-project-dto";
|
|
13
13
|
import { DownloadFileAllTranslationsParameters } from "./params/download-file-all-translations-parameters";
|
|
14
14
|
import { RecentlyUploadedFilesParameters } from "./params/recently-uploaded-files";
|
|
15
|
+
import { DownloadMultipleFilesTranslationsParameters } from "./params/download-multiple-files-translations-parameters";
|
|
15
16
|
import { ResponseBodyType } from "../base/enum/response-body-type";
|
|
16
17
|
import { TranslatedFileDto } from "../dto/translated-file-dto";
|
|
17
18
|
|
|
@@ -129,6 +130,24 @@ export class SmartlingFilesApi extends SmartlingBaseFileApi {
|
|
|
129
130
|
);
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Downloads multiple files translations as a ZIP archive.
|
|
135
|
+
* @returns ArrayBuffer for zip archive with translated files,
|
|
136
|
+
* if files found for the given file filter;
|
|
137
|
+
* null, if no files found for the given file filter.
|
|
138
|
+
*/
|
|
139
|
+
async downloadMultipleFilesTranslations(
|
|
140
|
+
projectId: string,
|
|
141
|
+
params: DownloadMultipleFilesTranslationsParameters
|
|
142
|
+
): Promise<ArrayBuffer | null> {
|
|
143
|
+
return await this.makeRequest(
|
|
144
|
+
"post",
|
|
145
|
+
`${this.entrypoint}/${projectId}/files/zip`,
|
|
146
|
+
JSON.stringify(params.export()),
|
|
147
|
+
ResponseBodyType.ARRAY_BUFFER
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
132
151
|
static fixContentTypeHeaderCase(form: FormData): Record<string, unknown> {
|
|
133
152
|
const headers = form.getHeaders();
|
|
134
153
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
import { RetrievalType } from "./retrieval-type";
|
|
3
|
+
|
|
4
|
+
export class DownloadFileBaseParameters extends BaseParameters {
|
|
5
|
+
setRetrievalType(retrievalType: RetrievalType): this {
|
|
6
|
+
this.set("retrievalType", retrievalType);
|
|
7
|
+
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
includeOriginalStrings(): this {
|
|
12
|
+
this.set("includeOriginalStrings", true);
|
|
13
|
+
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
excludeOriginalStrings(): this {
|
|
18
|
+
this.set("includeOriginalStrings", false);
|
|
19
|
+
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RetrievalType } from "./retrieval-type";
|
|
1
|
+
import { DownloadFileBaseParameters } from "./download-file-base-parameters";
|
|
3
2
|
|
|
4
|
-
export class DownloadFileParameters extends
|
|
3
|
+
export class DownloadFileParameters extends DownloadFileBaseParameters {
|
|
5
4
|
enableDebugMode(): DownloadFileParameters {
|
|
6
5
|
this.set("debugMode", 1);
|
|
7
6
|
|
|
8
7
|
return this;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
setRetrievalType(retrievalType: RetrievalType): DownloadFileParameters {
|
|
12
|
-
this.set("retrievalType", retrievalType);
|
|
13
|
-
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
includeOriginalStrings(): DownloadFileParameters {
|
|
18
|
-
this.set("includeOriginalStrings", true);
|
|
19
|
-
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
excludeOriginalStrings(): DownloadFileParameters {
|
|
24
|
-
this.set("includeOriginalStrings", false);
|
|
25
|
-
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
9
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SmartlingException } from "../../exception";
|
|
2
|
+
import { FileFilter } from "./file-filter";
|
|
3
|
+
import { FileLocaleMode } from "./file-locale-mode";
|
|
4
|
+
import { FileLocales } from "./file-locales";
|
|
5
|
+
import { TranslationFileNameMode } from "./translation-file-name-mode";
|
|
6
|
+
import { DownloadFileBaseParameters } from "./download-file-base-parameters";
|
|
7
|
+
|
|
8
|
+
export class DownloadMultipleFilesTranslationsParameters extends DownloadFileBaseParameters {
|
|
9
|
+
constructor(
|
|
10
|
+
files: FileLocales[]
|
|
11
|
+
) {
|
|
12
|
+
super();
|
|
13
|
+
|
|
14
|
+
if (!files.length) {
|
|
15
|
+
throw new SmartlingException("At least one file is required.");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
files.forEach((file) => {
|
|
19
|
+
if (!file.localeIds.length) {
|
|
20
|
+
throw new SmartlingException(`At least one locale is required for fileUri: ${file.fileUri}`);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
this.set("files", files);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setFileNameMode(fileNameMode: TranslationFileNameMode): this {
|
|
28
|
+
this.set("fileNameMode", fileNameMode);
|
|
29
|
+
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setFileLocaleMode(fileLocaleMode: FileLocaleMode): this {
|
|
34
|
+
this.set("localeMode", fileLocaleMode);
|
|
35
|
+
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setZipFileName(zipFileName: string): this {
|
|
40
|
+
this.set("zipFileName", zipFileName);
|
|
41
|
+
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
setFileFilter(fileFilter: FileFilter): this {
|
|
46
|
+
this.set("fileFilter", fileFilter);
|
|
47
|
+
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export enum FileLocaleMode {
|
|
2
|
+
/**
|
|
3
|
+
* Locale code is added to the end of the file path.
|
|
4
|
+
* e.g. /strings/es-ES/file.properties
|
|
5
|
+
*/
|
|
6
|
+
LOCALE_IN_PATH = "locale_in_path",
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Locale code is added to the end of the file name.
|
|
10
|
+
* e.g. /strings/file_es-ES.properties
|
|
11
|
+
*/
|
|
12
|
+
LOCALE_IN_NAME = "locale_in_name",
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Locale code is added to both the path and the filename.
|
|
16
|
+
* e.g. /strings/es-ES/file_es-ES.properties
|
|
17
|
+
*/
|
|
18
|
+
LOCALE_IN_NAME_AND_PATH = "locale_in_name_and_path"
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export enum TranslationFileNameMode {
|
|
2
|
+
/**
|
|
3
|
+
* Full original file path is used
|
|
4
|
+
*/
|
|
5
|
+
UNCHANGED = "unchanged",
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Remove all except the last path segment.
|
|
9
|
+
* e.g. /en/strings/file.properties becomes file.properties
|
|
10
|
+
*/
|
|
11
|
+
TRIM_LEADING = "trim_leading",
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Adds a locale folder to the file path directly before the filename.
|
|
15
|
+
* e.g. /strings/file.properties becomes /strings/es-ES/file.properties
|
|
16
|
+
*/
|
|
17
|
+
LOCALE_LAST = "locale_last"
|
|
18
|
+
}
|
|
@@ -106,7 +106,7 @@ class SmartlingBaseApi {
|
|
|
106
106
|
return response.text();
|
|
107
107
|
}
|
|
108
108
|
if (returnRawResponseBody === response_body_type_1.ResponseBodyType.ARRAY_BUFFER) {
|
|
109
|
-
return response.arrayBuffer();
|
|
109
|
+
return response.status === 204 ? null : response.arrayBuffer();
|
|
110
110
|
}
|
|
111
111
|
if (returnRawResponseBody === response_body_type_1.ResponseBodyType.RAW_RESPONSE) {
|
|
112
112
|
return response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-api.js","sourceRoot":"","sources":["../../../api/base/base-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAA+B;AAC/B,4EAAoC;AAEpC,8DAAgC;AAChC,6CAA6D;AAE7D,8CAAwD;AAExD,kEAA6D;AAG7D,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD,MAAa,gBAAgB;IAUzB,YAAY,MAAc;QAThB,YAAO,GAAwB,SAAS,CAAC;QAU/C,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC,IAAI,CAAC;QAC3C,IAAI,CAAC,oBAAoB,GAAG,WAAW,CAAC,OAAO,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,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CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC;SAC3C;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA/LD,4CA+LC"}
|
|
@@ -12,6 +12,7 @@ import { UploadedFileDto } from "./dto/uploaded-file-dto";
|
|
|
12
12
|
import { FileStatusForProjectDto } from "./dto/file-status-for-project-dto";
|
|
13
13
|
import { DownloadFileAllTranslationsParameters } from "./params/download-file-all-translations-parameters";
|
|
14
14
|
import { RecentlyUploadedFilesParameters } from "./params/recently-uploaded-files";
|
|
15
|
+
import { DownloadMultipleFilesTranslationsParameters } from "./params/download-multiple-files-translations-parameters";
|
|
15
16
|
import { ResponseBodyType } from "../base/enum/response-body-type";
|
|
16
17
|
import { TranslatedFileDto } from "../dto/translated-file-dto";
|
|
17
18
|
export declare class SmartlingFilesApi extends SmartlingBaseFileApi {
|
|
@@ -24,5 +25,6 @@ export declare class SmartlingFilesApi extends SmartlingBaseFileApi {
|
|
|
24
25
|
deleteFile(projectId: string, fileUri: string): Promise<boolean>;
|
|
25
26
|
uploadFile(projectId: string, parameters: UploadFileParameters): Promise<UploadedFileDto>;
|
|
26
27
|
getRecentlyUploadedFiles(projectId: string, params: RecentlyUploadedFilesParameters): Promise<SmartlingListResponse<FileStatusForProjectDto>>;
|
|
28
|
+
downloadMultipleFilesTranslations(projectId: string, params: DownloadMultipleFilesTranslationsParameters): Promise<ArrayBuffer | null>;
|
|
27
29
|
static fixContentTypeHeaderCase(form: FormData): Record<string, unknown>;
|
|
28
30
|
}
|
package/built/api/files/index.js
CHANGED
|
@@ -69,6 +69,11 @@ class SmartlingFilesApi extends base_1.SmartlingBaseFileApi {
|
|
|
69
69
|
return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/files/list`, params.export());
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
downloadMultipleFilesTranslations(projectId, params) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/files/zip`, JSON.stringify(params.export()), response_body_type_1.ResponseBodyType.ARRAY_BUFFER);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
72
77
|
static fixContentTypeHeaderCase(form) {
|
|
73
78
|
const headers = form.getHeaders();
|
|
74
79
|
headers["Content-Type"] = headers["content-type"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/files/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,kCAA+C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/files/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,kCAA+C;AAc/C,wEAAmE;AAGnE,MAAa,iBAAkB,SAAQ,2BAAoB;IACvD,YAAY,mBAA2B,EAAE,OAA4B,EAAE,MAAc;QACjF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,wBAAwB,CAAC;IACrE,CAAC;IAEK,sBAAsB,CACxB,SAAiB,EAAE,OAAe;;YAElC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,cAAc,EAC7C,EAAE,OAAO,EAAE,CACd,CAAC;QACN,CAAC;KAAA;IAEK,eAAe,CACjB,SAAiB,EAAE,OAAe;;YAElC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,qBAAqB,EACpD,EAAE,OAAO,EAAE,CACd,CAAC;QACN,CAAC;KAAA;IAEK,YAAY,CACd,SAAiB,EACjB,OAAe,EACf,MAAc,EACd,MAA8B,EAC9B,eAAiC,qCAAgB,CAAC,IAAI;;YAEtD,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GA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import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
import { RetrievalType } from "./retrieval-type";
|
|
3
|
+
export declare class DownloadFileBaseParameters extends BaseParameters {
|
|
4
|
+
setRetrievalType(retrievalType: RetrievalType): this;
|
|
5
|
+
includeOriginalStrings(): this;
|
|
6
|
+
excludeOriginalStrings(): this;
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DownloadFileBaseParameters = void 0;
|
|
4
|
+
const index_1 = require("../../parameters/index");
|
|
5
|
+
class DownloadFileBaseParameters extends index_1.BaseParameters {
|
|
6
|
+
setRetrievalType(retrievalType) {
|
|
7
|
+
this.set("retrievalType", retrievalType);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
includeOriginalStrings() {
|
|
11
|
+
this.set("includeOriginalStrings", true);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
excludeOriginalStrings() {
|
|
15
|
+
this.set("includeOriginalStrings", false);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.DownloadFileBaseParameters = DownloadFileBaseParameters;
|
|
20
|
+
//# sourceMappingURL=download-file-base-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-file-base-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/download-file-base-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAGxD,MAAa,0BAA2B,SAAQ,sBAAc;IAC1D,gBAAgB,CAAC,aAA4B;QACzC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,sBAAsB;QAClB,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,sBAAsB;QAClB,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAE1C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlBD,gEAkBC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare class DownloadFileParameters extends BaseParameters {
|
|
1
|
+
import { DownloadFileBaseParameters } from "./download-file-base-parameters";
|
|
2
|
+
export declare class DownloadFileParameters extends DownloadFileBaseParameters {
|
|
4
3
|
enableDebugMode(): DownloadFileParameters;
|
|
5
|
-
setRetrievalType(retrievalType: RetrievalType): DownloadFileParameters;
|
|
6
|
-
includeOriginalStrings(): DownloadFileParameters;
|
|
7
|
-
excludeOriginalStrings(): DownloadFileParameters;
|
|
8
4
|
}
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DownloadFileParameters = void 0;
|
|
4
|
-
const
|
|
5
|
-
class DownloadFileParameters extends
|
|
4
|
+
const download_file_base_parameters_1 = require("./download-file-base-parameters");
|
|
5
|
+
class DownloadFileParameters extends download_file_base_parameters_1.DownloadFileBaseParameters {
|
|
6
6
|
enableDebugMode() {
|
|
7
7
|
this.set("debugMode", 1);
|
|
8
8
|
return this;
|
|
9
9
|
}
|
|
10
|
-
setRetrievalType(retrievalType) {
|
|
11
|
-
this.set("retrievalType", retrievalType);
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
includeOriginalStrings() {
|
|
15
|
-
this.set("includeOriginalStrings", true);
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
excludeOriginalStrings() {
|
|
19
|
-
this.set("includeOriginalStrings", false);
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
10
|
}
|
|
23
11
|
exports.DownloadFileParameters = DownloadFileParameters;
|
|
24
12
|
//# sourceMappingURL=download-file-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-file-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/download-file-parameters.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"download-file-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/download-file-parameters.ts"],"names":[],"mappings":";;;AAAA,mFAA6E;AAE7E,MAAa,sBAAuB,SAAQ,0DAA0B;IAClE,eAAe;QACX,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAND,wDAMC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileFilter } from "./file-filter";
|
|
2
|
+
import { FileLocaleMode } from "./file-locale-mode";
|
|
3
|
+
import { FileLocales } from "./file-locales";
|
|
4
|
+
import { TranslationFileNameMode } from "./translation-file-name-mode";
|
|
5
|
+
import { DownloadFileBaseParameters } from "./download-file-base-parameters";
|
|
6
|
+
export declare class DownloadMultipleFilesTranslationsParameters extends DownloadFileBaseParameters {
|
|
7
|
+
constructor(files: FileLocales[]);
|
|
8
|
+
setFileNameMode(fileNameMode: TranslationFileNameMode): this;
|
|
9
|
+
setFileLocaleMode(fileLocaleMode: FileLocaleMode): this;
|
|
10
|
+
setZipFileName(zipFileName: string): this;
|
|
11
|
+
setFileFilter(fileFilter: FileFilter): this;
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DownloadMultipleFilesTranslationsParameters = void 0;
|
|
4
|
+
const exception_1 = require("../../exception");
|
|
5
|
+
const download_file_base_parameters_1 = require("./download-file-base-parameters");
|
|
6
|
+
class DownloadMultipleFilesTranslationsParameters extends download_file_base_parameters_1.DownloadFileBaseParameters {
|
|
7
|
+
constructor(files) {
|
|
8
|
+
super();
|
|
9
|
+
if (!files.length) {
|
|
10
|
+
throw new exception_1.SmartlingException("At least one file is required.");
|
|
11
|
+
}
|
|
12
|
+
files.forEach((file) => {
|
|
13
|
+
if (!file.localeIds.length) {
|
|
14
|
+
throw new exception_1.SmartlingException(`At least one locale is required for fileUri: ${file.fileUri}`);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
this.set("files", files);
|
|
18
|
+
}
|
|
19
|
+
setFileNameMode(fileNameMode) {
|
|
20
|
+
this.set("fileNameMode", fileNameMode);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
setFileLocaleMode(fileLocaleMode) {
|
|
24
|
+
this.set("localeMode", fileLocaleMode);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
setZipFileName(zipFileName) {
|
|
28
|
+
this.set("zipFileName", zipFileName);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
setFileFilter(fileFilter) {
|
|
32
|
+
this.set("fileFilter", fileFilter);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.DownloadMultipleFilesTranslationsParameters = DownloadMultipleFilesTranslationsParameters;
|
|
37
|
+
//# sourceMappingURL=download-multiple-files-translations-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-multiple-files-translations-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/download-multiple-files-translations-parameters.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAKrD,mFAA6E;AAE7E,MAAa,2CAA4C,SAAQ,0DAA0B;IACvF,YACI,KAAoB;QAEpB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YACf,MAAM,IAAI,8BAAkB,CAAC,gCAAgC,CAAC,CAAC;SAClE;QAED,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACnB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;gBACxB,MAAM,IAAI,8BAAkB,CAAC,gDAAgD,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;aAChG;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,eAAe,CAAC,YAAqC;QACjD,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,iBAAiB,CAAC,cAA8B;QAC5C,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,cAAc,CAAC,WAAmB;QAC9B,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,aAAa,CAAC,UAAsB;QAChC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA1CD,kGA0CC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileFilter = void 0;
|
|
4
|
+
var FileFilter;
|
|
5
|
+
(function (FileFilter) {
|
|
6
|
+
FileFilter["ALL_FILES"] = "all_files";
|
|
7
|
+
FileFilter["PUBLISHED_FILES_ONLY"] = "published_files_only";
|
|
8
|
+
})(FileFilter = exports.FileFilter || (exports.FileFilter = {}));
|
|
9
|
+
//# sourceMappingURL=file-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-filter.js","sourceRoot":"","sources":["../../../../api/files/params/file-filter.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,qCAAuB,CAAA;IACvB,2DAA6C,CAAA;AACjD,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileLocaleMode = void 0;
|
|
4
|
+
var FileLocaleMode;
|
|
5
|
+
(function (FileLocaleMode) {
|
|
6
|
+
FileLocaleMode["LOCALE_IN_PATH"] = "locale_in_path";
|
|
7
|
+
FileLocaleMode["LOCALE_IN_NAME"] = "locale_in_name";
|
|
8
|
+
FileLocaleMode["LOCALE_IN_NAME_AND_PATH"] = "locale_in_name_and_path";
|
|
9
|
+
})(FileLocaleMode = exports.FileLocaleMode || (exports.FileLocaleMode = {}));
|
|
10
|
+
//# sourceMappingURL=file-locale-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-locale-mode.js","sourceRoot":"","sources":["../../../../api/files/params/file-locale-mode.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAkBX;AAlBD,WAAY,cAAc;IAKtB,mDAAiC,CAAA;IAMjC,mDAAiC,CAAA;IAMjC,qEAAmD,CAAA;AACvD,CAAC,EAlBW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAkBzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-locales.js","sourceRoot":"","sources":["../../../../api/files/params/file-locales.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TranslationFileNameMode = void 0;
|
|
4
|
+
var TranslationFileNameMode;
|
|
5
|
+
(function (TranslationFileNameMode) {
|
|
6
|
+
TranslationFileNameMode["UNCHANGED"] = "unchanged";
|
|
7
|
+
TranslationFileNameMode["TRIM_LEADING"] = "trim_leading";
|
|
8
|
+
TranslationFileNameMode["LOCALE_LAST"] = "locale_last";
|
|
9
|
+
})(TranslationFileNameMode = exports.TranslationFileNameMode || (exports.TranslationFileNameMode = {}));
|
|
10
|
+
//# sourceMappingURL=translation-file-name-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-file-name-mode.js","sourceRoot":"","sources":["../../../../api/files/params/translation-file-name-mode.ts"],"names":[],"mappings":";;;AAAA,IAAY,uBAiBX;AAjBD,WAAY,uBAAuB;IAI/B,kDAAuB,CAAA;IAMvB,wDAA6B,CAAA;IAM7B,sDAA2B,CAAA;AAC/B,CAAC,EAjBW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAiBlC"}
|
package/built/index.d.ts
CHANGED
|
@@ -38,10 +38,15 @@ export * from "./api/file-translations/dto/translation-status-dto";
|
|
|
38
38
|
export * from "./api/files/index";
|
|
39
39
|
export * from "./api/files/params/download-file-parameters";
|
|
40
40
|
export * from "./api/files/params/download-file-with-metadata-parameters";
|
|
41
|
+
export * from "./api/files/params/download-multiple-files-translations-parameters";
|
|
42
|
+
export * from "./api/files/params/file-filter";
|
|
43
|
+
export * from "./api/files/params/file-locale-mode";
|
|
44
|
+
export * from "./api/files/params/file-locales";
|
|
41
45
|
export * from "./api/files/params/recently-uploaded-files";
|
|
42
46
|
export * from "./api/files/params/retrieval-type";
|
|
43
47
|
export * from "./api/files/params/file-type";
|
|
44
48
|
export * from "./api/files/params/filename-mode";
|
|
49
|
+
export * from "./api/files/params/translation-file-name-mode";
|
|
45
50
|
export * from "./api/files/params/upload-file-parameters";
|
|
46
51
|
export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
47
52
|
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
package/built/index.js
CHANGED
|
@@ -54,10 +54,15 @@ __exportStar(require("./api/file-translations/dto/translation-status-dto"), expo
|
|
|
54
54
|
__exportStar(require("./api/files/index"), exports);
|
|
55
55
|
__exportStar(require("./api/files/params/download-file-parameters"), exports);
|
|
56
56
|
__exportStar(require("./api/files/params/download-file-with-metadata-parameters"), exports);
|
|
57
|
+
__exportStar(require("./api/files/params/download-multiple-files-translations-parameters"), exports);
|
|
58
|
+
__exportStar(require("./api/files/params/file-filter"), exports);
|
|
59
|
+
__exportStar(require("./api/files/params/file-locale-mode"), exports);
|
|
60
|
+
__exportStar(require("./api/files/params/file-locales"), exports);
|
|
57
61
|
__exportStar(require("./api/files/params/recently-uploaded-files"), exports);
|
|
58
62
|
__exportStar(require("./api/files/params/retrieval-type"), exports);
|
|
59
63
|
__exportStar(require("./api/files/params/file-type"), exports);
|
|
60
64
|
__exportStar(require("./api/files/params/filename-mode"), exports);
|
|
65
|
+
__exportStar(require("./api/files/params/translation-file-name-mode"), exports);
|
|
61
66
|
__exportStar(require("./api/files/params/upload-file-parameters"), exports);
|
|
62
67
|
__exportStar(require("./api/files/dto/file-status-for-all-locales-dto"), exports);
|
|
63
68
|
__exportStar(require("./api/files/dto/file-status-for-locale-item-dto"), exports);
|
package/built/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kEAAgD;AAChD,0EAAwD;AACxD,mEAAiD;AACjD,6CAA2B;AAC3B,qEAAmD;AACnD,sDAAoC;AACpC,sDAAoC;AACpC,wEAAsD;AACtD,6EAA2D;AAC3D,gEAA8C;AAC9C,4EAA0D;AAC1D,uEAAqD;AACrD,0FAAwE;AACxE,oEAAkD;AAClD,iFAA+D;AAC/D,kFAAgE;AAChE,uEAAqD;AACrD,sEAAoD;AACpD,gEAA8C;AAC9C,wDAAsC;AACtC,gEAA8C;AAC9C,wFAAsE;AACtE,qFAAmE;AACnE,4FAA0E;AAC1E,+FAA6E;AAC7E,2FAAyE;AACzE,oEAAkD;AAClD,oFAAkE;AAClE,qFAAmE;AACnE,uFAAqE;AACrE,4FAA0E;AAC1E,2EAAyD;AACzD,uEAAqD;AACrD,8EAA4D;AAC5D,4FAA0E;AAC1E,qFAAmE;AACnE,oDAAkC;AAClC,8EAA4D;AAC5D,4FAA0E;AAC1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AkD;AAClD,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,uFAAqE;AACrE,0EAAwD;AACxD,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,wFAAsE;AACtE,gEAA8C;AAC9C,iFAA+D;AAC/D,8DAA4C;AAC5C,+EAA6D;AAC7D,mGAAiF;AACjF,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,gFAA8D;AAC9D,4EAA0D;AAC1D,uEAAqD;AACrD,uEAAqD;AACrD,2EAAyD;AACzD,uFAAqE;AACrE,iFAA+D;AAC/D,8EAA4D;AAC5D,mDAAiC;AACjC,yDAAuC;AACvC,oEAAkD;AAClD,iEAA+C;AAC/C,iFAA+D;AAC/D,iFAA+D;AAC/D,kFAAgE;AAChE,iFAA+D;AAC/D,mFAAiE;AACjE,wFAAsE;AACtE,4FAA0E;AAC1E,+CAA6B;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D;AAC3D,gEAA8C;AAC9C,2EAAyD;AACzD,yEAAuD;AACvD,8DAA4C;AAC5C,mEAAiD;AACjD,8EAA4D;AAC5D,sDAAoC;AACpC,iDAA+B;AAC/B,0EAAwD;AACxD,mEAAiD;AACjD,yEAAuD;AACvD,sDAAoC;AACpC,oEAAkD;AAClD,+DAA6C;AAC7C,mEAAiD;AACjD,6EAA2D;AAC3D,sEAAoD;AACpD,iDAA+B"}
|
package/built/package.json
CHANGED
package/index.ts
CHANGED
|
@@ -38,10 +38,15 @@ export * from "./api/file-translations/dto/translation-status-dto";
|
|
|
38
38
|
export * from "./api/files/index";
|
|
39
39
|
export * from "./api/files/params/download-file-parameters";
|
|
40
40
|
export * from "./api/files/params/download-file-with-metadata-parameters";
|
|
41
|
+
export * from "./api/files/params/download-multiple-files-translations-parameters";
|
|
42
|
+
export * from "./api/files/params/file-filter";
|
|
43
|
+
export * from "./api/files/params/file-locale-mode";
|
|
44
|
+
export * from "./api/files/params/file-locales";
|
|
41
45
|
export * from "./api/files/params/recently-uploaded-files";
|
|
42
46
|
export * from "./api/files/params/retrieval-type";
|
|
43
47
|
export * from "./api/files/params/file-type";
|
|
44
48
|
export * from "./api/files/params/filename-mode";
|
|
49
|
+
export * from "./api/files/params/translation-file-name-mode";
|
|
45
50
|
export * from "./api/files/params/upload-file-parameters";
|
|
46
51
|
export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
47
52
|
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
package/package.json
CHANGED
package/test/files.spec.ts
CHANGED
|
@@ -13,6 +13,12 @@ import { streamToString } from "./stream-to-string";
|
|
|
13
13
|
import { DownloadFileAllTranslationsParameters } from "../api/files/params/download-file-all-translations-parameters";
|
|
14
14
|
import { RecentlyUploadedFilesParameters } from "../api/files/params/recently-uploaded-files";
|
|
15
15
|
import { FileNameMode } from "../api/files/params/filename-mode";
|
|
16
|
+
import { DownloadMultipleFilesTranslationsParameters } from "../api/files/params/download-multiple-files-translations-parameters";
|
|
17
|
+
import { FileLocales } from "../api/files/params/file-locales";
|
|
18
|
+
import { SmartlingException } from "../api/exception";
|
|
19
|
+
import { TranslationFileNameMode } from "../api/files/params/translation-file-name-mode";
|
|
20
|
+
import { FileLocaleMode } from "../api/files/params/file-locale-mode";
|
|
21
|
+
import { FileFilter } from "../api/files/params/file-filter";
|
|
16
22
|
|
|
17
23
|
describe("SmartlingFilesApi class tests.", () => {
|
|
18
24
|
const projectId = "testProjectId";
|
|
@@ -646,5 +652,106 @@ describe("SmartlingFilesApi class tests.", () => {
|
|
|
646
652
|
)
|
|
647
653
|
);
|
|
648
654
|
});
|
|
655
|
+
|
|
656
|
+
describe("Download multiple files translations", () => {
|
|
657
|
+
const localeId = "fr-FR";
|
|
658
|
+
const anotherLocaleId = "de-DE";
|
|
659
|
+
const files: FileLocales[] = [
|
|
660
|
+
{
|
|
661
|
+
fileUri,
|
|
662
|
+
localeIds: [localeId, anotherLocaleId]
|
|
663
|
+
}
|
|
664
|
+
];
|
|
665
|
+
let params: DownloadMultipleFilesTranslationsParameters;
|
|
666
|
+
|
|
667
|
+
beforeEach(() => {
|
|
668
|
+
params = new DownloadMultipleFilesTranslationsParameters(files);
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
it("throws error if file is missing", () => {
|
|
672
|
+
assert.throws(() => {
|
|
673
|
+
// eslint-disable-next-line no-new
|
|
674
|
+
new DownloadMultipleFilesTranslationsParameters([]);
|
|
675
|
+
}, SmartlingException);
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
it("throws error if localeId is missing", () => {
|
|
679
|
+
assert.throws(() => {
|
|
680
|
+
// eslint-disable-next-line no-new
|
|
681
|
+
new DownloadMultipleFilesTranslationsParameters([{
|
|
682
|
+
fileUri,
|
|
683
|
+
localeIds: []
|
|
684
|
+
}]);
|
|
685
|
+
}, SmartlingException);
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
it("Download mutliple files translations", async () => {
|
|
689
|
+
await filesApi.downloadMultipleFilesTranslations(
|
|
690
|
+
projectId,
|
|
691
|
+
params
|
|
692
|
+
);
|
|
693
|
+
|
|
694
|
+
sinon.assert.calledOnce(filesApiFetchStub);
|
|
695
|
+
sinon.assert.calledWithExactly(
|
|
696
|
+
filesApiFetchStub,
|
|
697
|
+
`https://test.com/files-api/v2/projects/${projectId}/files/zip`,
|
|
698
|
+
{
|
|
699
|
+
headers: {
|
|
700
|
+
Authorization: "test_token_type test_access_token",
|
|
701
|
+
"Content-Type": "application/json",
|
|
702
|
+
"User-Agent": "test_user_agent"
|
|
703
|
+
},
|
|
704
|
+
method: "post",
|
|
705
|
+
body: JSON.stringify({
|
|
706
|
+
files: [{
|
|
707
|
+
fileUri,
|
|
708
|
+
localeIds: [localeId, anotherLocaleId]
|
|
709
|
+
}]
|
|
710
|
+
})
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
it("Download mutliple files translations with parameters", async () => {
|
|
716
|
+
params
|
|
717
|
+
.setRetrievalType(RetrievalType.PUBLISHED)
|
|
718
|
+
.includeOriginalStrings()
|
|
719
|
+
.setFileNameMode(TranslationFileNameMode.UNCHANGED)
|
|
720
|
+
.setFileLocaleMode(FileLocaleMode.LOCALE_IN_PATH)
|
|
721
|
+
.setZipFileName("translations.zip")
|
|
722
|
+
.setFileFilter(FileFilter.ALL_FILES);
|
|
723
|
+
|
|
724
|
+
await filesApi.downloadMultipleFilesTranslations(
|
|
725
|
+
projectId,
|
|
726
|
+
params
|
|
727
|
+
);
|
|
728
|
+
|
|
729
|
+
sinon.assert.calledOnce(filesApiFetchStub);
|
|
730
|
+
sinon.assert.calledWithExactly(
|
|
731
|
+
filesApiFetchStub,
|
|
732
|
+
`https://test.com/files-api/v2/projects/${projectId}/files/zip`,
|
|
733
|
+
{
|
|
734
|
+
headers: {
|
|
735
|
+
Authorization: "test_token_type test_access_token",
|
|
736
|
+
"Content-Type": "application/json",
|
|
737
|
+
"User-Agent": "test_user_agent"
|
|
738
|
+
},
|
|
739
|
+
method: "post",
|
|
740
|
+
body: JSON.stringify({
|
|
741
|
+
files: [{
|
|
742
|
+
fileUri,
|
|
743
|
+
localeIds: [localeId, anotherLocaleId]
|
|
744
|
+
}],
|
|
745
|
+
retrievalType: "published",
|
|
746
|
+
includeOriginalStrings: true,
|
|
747
|
+
fileNameMode: "unchanged",
|
|
748
|
+
localeMode: "locale_in_path",
|
|
749
|
+
zipFileName: "translations.zip",
|
|
750
|
+
fileFilter: "all_files"
|
|
751
|
+
})
|
|
752
|
+
}
|
|
753
|
+
);
|
|
754
|
+
});
|
|
755
|
+
});
|
|
649
756
|
});
|
|
650
757
|
});
|