smartling-api-sdk-nodejs 2.3.0 → 2.5.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.
Files changed (87) hide show
  1. package/.scannerwork/report-task.txt +2 -2
  2. package/api/file-translations/dto/error.ts +7 -0
  3. package/api/file-translations/dto/language-detection-dto.ts +5 -0
  4. package/api/file-translations/dto/language-detection-state.ts +5 -0
  5. package/api/file-translations/dto/language-detection-status-dto.ts +11 -0
  6. package/api/file-translations/dto/language-dto.ts +6 -0
  7. package/api/file-translations/dto/mt-state.ts +7 -0
  8. package/api/file-translations/dto/translation-dto.ts +5 -0
  9. package/api/file-translations/dto/translation-locale-status-dto.ts +11 -0
  10. package/api/file-translations/dto/translation-status-dto.ts +12 -0
  11. package/api/file-translations/dto/uploaded-file-dto.ts +5 -0
  12. package/api/file-translations/index.ts +114 -0
  13. package/api/file-translations/params/translate-file-parameters.ts +13 -0
  14. package/api/file-translations/params/upload-file-parameters.ts +29 -0
  15. package/api/files/index.ts +1 -1
  16. package/api/files/params/download-file-all-translations-parameters.ts +1 -7
  17. package/api/job-batches/dto/batch-list-item-dto.ts +14 -0
  18. package/api/job-batches/index.ts +13 -0
  19. package/api/job-batches/params/list-batches-parameters.ts +41 -0
  20. package/api/jobs/params/create-job-parameters.ts +6 -0
  21. package/built/api/file-translations/dto/error.d.ts +6 -0
  22. package/built/api/file-translations/dto/error.js +3 -0
  23. package/built/api/file-translations/dto/error.js.map +1 -0
  24. package/built/api/file-translations/dto/language-detection-dto.d.ts +4 -0
  25. package/built/api/file-translations/dto/language-detection-dto.js +3 -0
  26. package/built/api/file-translations/dto/language-detection-dto.js.map +1 -0
  27. package/built/api/file-translations/dto/language-detection-state.d.ts +5 -0
  28. package/built/api/file-translations/dto/language-detection-state.js +10 -0
  29. package/built/api/file-translations/dto/language-detection-state.js.map +1 -0
  30. package/built/api/file-translations/dto/language-detection-status-dto.d.ts +9 -0
  31. package/built/api/file-translations/dto/language-detection-status-dto.js +3 -0
  32. package/built/api/file-translations/dto/language-detection-status-dto.js.map +1 -0
  33. package/built/api/file-translations/dto/language-dto.d.ts +5 -0
  34. package/built/api/file-translations/dto/language-dto.js +3 -0
  35. package/built/api/file-translations/dto/language-dto.js.map +1 -0
  36. package/built/api/file-translations/dto/mt-state.d.ts +7 -0
  37. package/built/api/file-translations/dto/mt-state.js +12 -0
  38. package/built/api/file-translations/dto/mt-state.js.map +1 -0
  39. package/built/api/file-translations/dto/translation-dto.d.ts +4 -0
  40. package/built/api/file-translations/dto/translation-dto.js +3 -0
  41. package/built/api/file-translations/dto/translation-dto.js.map +1 -0
  42. package/built/api/file-translations/dto/translation-locale-status-dto.d.ts +9 -0
  43. package/built/api/file-translations/dto/translation-locale-status-dto.js +3 -0
  44. package/built/api/file-translations/dto/translation-locale-status-dto.js.map +1 -0
  45. package/built/api/file-translations/dto/translation-status-dto.d.ts +10 -0
  46. package/built/api/file-translations/dto/translation-status-dto.js +3 -0
  47. package/built/api/file-translations/dto/translation-status-dto.js.map +1 -0
  48. package/built/api/file-translations/dto/uploaded-file-dto.d.ts +4 -0
  49. package/built/api/file-translations/dto/uploaded-file-dto.js +3 -0
  50. package/built/api/file-translations/dto/uploaded-file-dto.js.map +1 -0
  51. package/built/api/file-translations/index.d.ts +23 -0
  52. package/built/api/file-translations/index.js +78 -0
  53. package/built/api/file-translations/index.js.map +1 -0
  54. package/built/api/file-translations/params/translate-file-parameters.d.ts +5 -0
  55. package/built/api/file-translations/params/translate-file-parameters.js +16 -0
  56. package/built/api/file-translations/params/translate-file-parameters.js.map +1 -0
  57. package/built/api/file-translations/params/upload-file-parameters.d.ts +8 -0
  58. package/built/api/file-translations/params/upload-file-parameters.js +52 -0
  59. package/built/api/file-translations/params/upload-file-parameters.js.map +1 -0
  60. package/built/api/files/index.js +1 -1
  61. package/built/api/files/index.js.map +1 -1
  62. package/built/api/files/params/download-file-all-translations-parameters.d.ts +0 -1
  63. package/built/api/files/params/download-file-all-translations-parameters.js +0 -4
  64. package/built/api/files/params/download-file-all-translations-parameters.js.map +1 -1
  65. package/built/api/job-batches/dto/batch-list-item-dto.d.ts +11 -0
  66. package/built/api/job-batches/dto/batch-list-item-dto.js +3 -0
  67. package/built/api/job-batches/dto/batch-list-item-dto.js.map +1 -0
  68. package/built/api/job-batches/index.d.ts +4 -0
  69. package/built/api/job-batches/index.js +5 -0
  70. package/built/api/job-batches/index.js.map +1 -1
  71. package/built/api/job-batches/params/list-batches-parameters.d.ts +10 -0
  72. package/built/api/job-batches/params/list-batches-parameters.js +33 -0
  73. package/built/api/job-batches/params/list-batches-parameters.js.map +1 -0
  74. package/built/api/jobs/params/create-job-parameters.d.ts +1 -0
  75. package/built/api/jobs/params/create-job-parameters.js +4 -0
  76. package/built/api/jobs/params/create-job-parameters.js.map +1 -1
  77. package/built/index.d.ts +2 -0
  78. package/built/index.js +2 -0
  79. package/built/index.js.map +1 -1
  80. package/built/package.json +1 -1
  81. package/index.ts +2 -0
  82. package/package.json +1 -1
  83. package/test/builder.spec.ts +8 -0
  84. package/test/file-translations.spec.ts +282 -0
  85. package/test/files.spec.ts +1 -23
  86. package/test/job-batches.spec.ts +30 -0
  87. package/test/jobs.spec.ts +3 -2
@@ -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=AYu51urzRe7rJHsZ61mc
6
- ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYu51urzRe7rJHsZ61mc
5
+ ceTaskId=AYyGVn8fRe7rJHsZ61oS
6
+ ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYyGVn8fRe7rJHsZ61oS
@@ -0,0 +1,7 @@
1
+ interface Error {
2
+ key: string,
3
+ message: string,
4
+ details: unknown
5
+ }
6
+
7
+ export { Error };
@@ -0,0 +1,5 @@
1
+ interface LanguageDetectionDto {
2
+ languageDetectionUid: string,
3
+ }
4
+
5
+ export { LanguageDetectionDto };
@@ -0,0 +1,5 @@
1
+ export enum LanguageDetectionState {
2
+ QUEUED = "QUEUED",
3
+ FAILED = "FAILED",
4
+ COMPLETED = "COMPLETED"
5
+ }
@@ -0,0 +1,11 @@
1
+ import { Error } from "./error";
2
+ import { LanguageDetectionState } from "./language-detection-state";
3
+ import { LanguageDto } from "./language-dto";
4
+
5
+ interface LanguageDetectionStatusDto {
6
+ state: LanguageDetectionState,
7
+ error?: Error,
8
+ detectedSourceLanguages: LanguageDto[]
9
+ }
10
+
11
+ export { LanguageDetectionStatusDto };
@@ -0,0 +1,6 @@
1
+ interface LanguageDto {
2
+ languageId: string,
3
+ defaultLocaleId: string
4
+ }
5
+
6
+ export { LanguageDto };
@@ -0,0 +1,7 @@
1
+ export enum MTState {
2
+ QUEUED = "QUEUED",
3
+ PROCESSING = "PROCESSING",
4
+ FAILED = "FAILED",
5
+ CANCELED = "CANCELED",
6
+ COMPLETED = "COMPLETED"
7
+ }
@@ -0,0 +1,5 @@
1
+ interface TranslationDto {
2
+ mtUid: string
3
+ }
4
+
5
+ export { TranslationDto };
@@ -0,0 +1,11 @@
1
+ import { MTState } from "./mt-state";
2
+ import { Error } from "./error";
3
+
4
+ interface TranslationLocaleStatusDto {
5
+ localeId: string,
6
+ state: MTState,
7
+ processedStringCount: number,
8
+ error?: Error,
9
+ }
10
+
11
+ export { TranslationLocaleStatusDto };
@@ -0,0 +1,12 @@
1
+ import { MTState } from "./mt-state";
2
+ import { Error } from "./error";
3
+ import { TranslationLocaleStatusDto } from "./translation-locale-status-dto";
4
+
5
+ interface TranslationStatusDto {
6
+ state: MTState,
7
+ requestedStringCount: number,
8
+ error?: Error,
9
+ localeProcessStatuses: TranslationLocaleStatusDto[]
10
+ }
11
+
12
+ export { TranslationStatusDto };
@@ -0,0 +1,5 @@
1
+ interface UploadedFileDto {
2
+ fileUid: string
3
+ }
4
+
5
+ export { UploadedFileDto };
@@ -0,0 +1,114 @@
1
+ import FormData from "form-data";
2
+ import { SmartlingBaseApi } from "../base";
3
+ import { SmartlingAuthApi } from "../auth";
4
+ import { Logger } from "../logger";
5
+ import { UploadedFileDto } from "./dto/uploaded-file-dto";
6
+ import { UploadFileParameters } from "./params/upload-file-parameters";
7
+ import { TranslationDto } from "./dto/translation-dto";
8
+ import { TranslateFileParameters } from "./params/translate-file-parameters";
9
+ import { TranslationStatusDto } from "./dto/translation-status-dto";
10
+ import { LanguageDetectionDto } from "./dto/language-detection-dto";
11
+ import { LanguageDetectionStatusDto } from "./dto/language-detection-status-dto";
12
+
13
+ export class SmartlingFileTranslationsApi extends SmartlingBaseApi {
14
+ constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
15
+ super(logger);
16
+ this.authApi = authApi;
17
+ this.entrypoint = `${smartlingApiBaseUrl}/file-translations-api/v2/accounts`;
18
+ }
19
+
20
+ async uploadFile(
21
+ accountUid: string, parameters: UploadFileParameters
22
+ ): Promise<UploadedFileDto> {
23
+ const formData = new FormData();
24
+ const exported = parameters.export();
25
+
26
+ formData.append("file", exported.file);
27
+ formData.append("request", JSON.stringify(exported.request), {
28
+ contentType: "application/json"
29
+ });
30
+
31
+ return await this.makeRequest(
32
+ "post",
33
+ `${this.entrypoint}/${accountUid}/files`,
34
+ formData,
35
+ false,
36
+ SmartlingFileTranslationsApi.fixContentTypeHeaderCase(formData)
37
+ );
38
+ }
39
+
40
+ async translateFile(
41
+ accountUid: string, fileUid: string, params: TranslateFileParameters
42
+ ): Promise<TranslationDto> {
43
+ return await this.makeRequest(
44
+ "post",
45
+ `${this.entrypoint}/${accountUid}/files/${fileUid}/mt`,
46
+ JSON.stringify(params.export())
47
+ );
48
+ }
49
+
50
+ async getTranslationProgress(
51
+ accountUid: string, fileUid: string, mtUid: string
52
+ ): Promise<TranslationStatusDto> {
53
+ return await this.makeRequest(
54
+ "get",
55
+ `${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/status`
56
+ );
57
+ }
58
+
59
+ async downloadTranslatedFile(
60
+ accountUid: string, fileUid: string, mtUid: string, localeId: string
61
+ ): Promise<string> {
62
+ return await this.makeRequest(
63
+ "get",
64
+ `${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/locales/${localeId}/file`,
65
+ null,
66
+ true
67
+ );
68
+ }
69
+
70
+ async downloadTranslatedFiles(
71
+ accountUid: string, fileUid: string, mtUid: string
72
+ ): Promise<string> {
73
+ return await this.makeRequest(
74
+ "get",
75
+ `${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/locales/all/file/zip`,
76
+ null,
77
+ true
78
+ );
79
+ }
80
+
81
+ async cancelFileTranslation(
82
+ accountUid: string, fileUid: string, mtUid: string
83
+ ): Promise<void> {
84
+ await this.makeRequest(
85
+ "post",
86
+ `${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/cancel`
87
+ );
88
+ }
89
+
90
+ async detectFileLanguage(accountUid: string, fileUid: string): Promise<LanguageDetectionDto> {
91
+ return await this.makeRequest(
92
+ "post",
93
+ `${this.entrypoint}/${accountUid}/files/${fileUid}/language-detection`
94
+ );
95
+ }
96
+
97
+ async getLanguageDetectionProgress(
98
+ accountUid: string, fileUid: string, languageDetectionUid: string
99
+ ): Promise<LanguageDetectionStatusDto> {
100
+ return await this.makeRequest(
101
+ "get",
102
+ `${this.entrypoint}/${accountUid}/files/${fileUid}/language-detection/${languageDetectionUid}/status`
103
+ );
104
+ }
105
+
106
+ static fixContentTypeHeaderCase(form: FormData): Record<string, unknown> {
107
+ const headers = form.getHeaders();
108
+
109
+ headers["Content-Type"] = headers["content-type"];
110
+ // eslint-disable-next-line fp/no-delete
111
+ delete headers["content-type"];
112
+ return headers;
113
+ }
114
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseParameters } from "../../parameters";
2
+
3
+ export class TranslateFileParameters extends BaseParameters {
4
+ setSourceLocaleId(sourceLocaleId: string): TranslateFileParameters {
5
+ this.set("sourceLocaleId", sourceLocaleId);
6
+ return this;
7
+ }
8
+
9
+ setTargetLocaleIds(targetLocaleIds: string[]): TranslateFileParameters {
10
+ this.set("targetLocaleIds", targetLocaleIds);
11
+ return this;
12
+ }
13
+ }
@@ -0,0 +1,29 @@
1
+ import * as fs from "fs";
2
+ import string2fileStream from "string-to-file-stream";
3
+ import { BaseParameters } from "../../parameters";
4
+ import { FileType } from "../../files/params/file-type";
5
+
6
+ export class UploadFileParameters extends BaseParameters {
7
+ constructor(parameters: Record<string, unknown> = {}) {
8
+ super(parameters);
9
+
10
+ this.set("request", {});
11
+ }
12
+
13
+ setFileFromLocalFilePath(filePath: string): UploadFileParameters {
14
+ this.set("file", fs.createReadStream(
15
+ fs.realpathSync(filePath)
16
+ ));
17
+ return this;
18
+ }
19
+
20
+ setFileContent(fileContent: string): UploadFileParameters {
21
+ this.set("file", string2fileStream(fileContent));
22
+ return this;
23
+ }
24
+
25
+ setFileType(fileType: FileType): UploadFileParameters {
26
+ this.parameters.request.fileType = fileType.toUpperCase();
27
+ return this;
28
+ }
29
+ }
@@ -56,7 +56,7 @@ export class SmartlingFilesApi extends SmartlingBaseApi {
56
56
  ): Promise<string> {
57
57
  return await this.makeRequest(
58
58
  "get",
59
- `${this.entrypoint}/${projectId}/locales/all/file`,
59
+ `${this.entrypoint}/${projectId}/locales/all/file/zip`,
60
60
  Object.assign(params.export(), { fileUri }),
61
61
  true
62
62
  );
@@ -1,9 +1,3 @@
1
1
  import { DownloadFileParameters } from "./download-file-parameters";
2
2
 
3
-
4
- export class DownloadFileAllTranslationsParameters extends DownloadFileParameters {
5
- setZipFileName(fileName: string): DownloadFileAllTranslationsParameters {
6
- this.set("zipFileName", fileName);
7
- return this;
8
- }
9
- }
3
+ export class DownloadFileAllTranslationsParameters extends DownloadFileParameters {}
@@ -0,0 +1,14 @@
1
+ import { BatchStatus } from "../params/batch-status";
2
+ import { BatchDto } from "./batch-dto";
3
+
4
+ interface BatchListItemDto extends BatchDto {
5
+ status: BatchStatus;
6
+ authorized: boolean;
7
+ translationJobUid: string;
8
+ projectId: string;
9
+ createdDate: Date
10
+ modifiedDate: Date
11
+
12
+ }
13
+
14
+ export { BatchListItemDto };
@@ -8,6 +8,9 @@ import { BatchStatusDto } from "./dto/batch-status-dto";
8
8
  import { BatchDto } from "./dto/batch-dto";
9
9
  import { CancelBatchFileParameters } from "./params/cancel-batch-file-parameters";
10
10
  import { RegisterBatchFileParameters } from "./params/register-batch-file-parameters";
11
+ import { BatchListItemDto } from "./dto/batch-list-item-dto";
12
+ import { SmartlingListResponse } from "../http/smartling-list-response";
13
+ import { ListBatchesParameters } from "./params/list-batches-parameters";
11
14
 
12
15
  export class SmartlingJobBatchesApi extends SmartlingBaseApi {
13
16
  constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
@@ -82,4 +85,14 @@ export class SmartlingJobBatchesApi extends SmartlingBaseApi {
82
85
  `${this.entrypoint}/${projectId}/batches/${batchUid}`
83
86
  );
84
87
  }
88
+
89
+ async listBatches(projectId: string, params: ListBatchesParameters
90
+ ): Promise<SmartlingListResponse<BatchListItemDto>> {
91
+ return await this.makeRequest(
92
+ "get",
93
+ `${this.entrypoint}/${projectId}/batches`,
94
+ params.export()
95
+
96
+ );
97
+ }
85
98
  }
@@ -0,0 +1,41 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+ import { Order } from "../../parameters/order";
3
+ import { BatchStatus } from "./batch-status";
4
+
5
+ export class ListBatchesParameters extends BaseParameters {
6
+ setTranslationJobUid(uid: string): ListBatchesParameters {
7
+ this.set("translationJobUid", uid);
8
+
9
+ return this;
10
+ }
11
+
12
+ setLimit(limit: number): ListBatchesParameters {
13
+ if (limit > 0) {
14
+ this.set("limit", limit);
15
+ }
16
+
17
+ return this;
18
+ }
19
+
20
+ setOffset(offset: number): ListBatchesParameters {
21
+ if (offset >= 0) {
22
+ this.set("offset", offset);
23
+ }
24
+
25
+ return this;
26
+ }
27
+
28
+ setStatus(status: BatchStatus): ListBatchesParameters {
29
+ this.set("status", status);
30
+
31
+ return this;
32
+ }
33
+
34
+ setSort(field: "createdDate" | "status", order: Order): ListBatchesParameters {
35
+ this.set("sortBy", field);
36
+ this.set("sortDirection", order.toLowerCase());
37
+
38
+ return this;
39
+ }
40
+ }
41
+
@@ -37,4 +37,10 @@ export class CreateJobParameters extends BaseParameters {
37
37
 
38
38
  return this;
39
39
  }
40
+
41
+ setCallbackUrl(callbackUrl: string): CreateJobParameters {
42
+ this.set("callbackUrl", callbackUrl);
43
+
44
+ return this;
45
+ }
40
46
  }
@@ -0,0 +1,6 @@
1
+ interface Error {
2
+ key: string;
3
+ message: string;
4
+ details: unknown;
5
+ }
6
+ export { Error };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/error.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ interface LanguageDetectionDto {
2
+ languageDetectionUid: string;
3
+ }
4
+ export { LanguageDetectionDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=language-detection-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-detection-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-detection-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export declare enum LanguageDetectionState {
2
+ QUEUED = "QUEUED",
3
+ FAILED = "FAILED",
4
+ COMPLETED = "COMPLETED"
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LanguageDetectionState = void 0;
4
+ var LanguageDetectionState;
5
+ (function (LanguageDetectionState) {
6
+ LanguageDetectionState["QUEUED"] = "QUEUED";
7
+ LanguageDetectionState["FAILED"] = "FAILED";
8
+ LanguageDetectionState["COMPLETED"] = "COMPLETED";
9
+ })(LanguageDetectionState = exports.LanguageDetectionState || (exports.LanguageDetectionState = {}));
10
+ //# sourceMappingURL=language-detection-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-detection-state.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-detection-state.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAC9B,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;AAC3B,CAAC,EAJW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAIjC"}
@@ -0,0 +1,9 @@
1
+ import { Error } from "./error";
2
+ import { LanguageDetectionState } from "./language-detection-state";
3
+ import { LanguageDto } from "./language-dto";
4
+ interface LanguageDetectionStatusDto {
5
+ state: LanguageDetectionState;
6
+ error?: Error;
7
+ detectedSourceLanguages: LanguageDto[];
8
+ }
9
+ export { LanguageDetectionStatusDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=language-detection-status-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-detection-status-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-detection-status-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ interface LanguageDto {
2
+ languageId: string;
3
+ defaultLocaleId: string;
4
+ }
5
+ export { LanguageDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=language-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export declare enum MTState {
2
+ QUEUED = "QUEUED",
3
+ PROCESSING = "PROCESSING",
4
+ FAILED = "FAILED",
5
+ CANCELED = "CANCELED",
6
+ COMPLETED = "COMPLETED"
7
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MTState = void 0;
4
+ var MTState;
5
+ (function (MTState) {
6
+ MTState["QUEUED"] = "QUEUED";
7
+ MTState["PROCESSING"] = "PROCESSING";
8
+ MTState["FAILED"] = "FAILED";
9
+ MTState["CANCELED"] = "CANCELED";
10
+ MTState["COMPLETED"] = "COMPLETED";
11
+ })(MTState = exports.MTState || (exports.MTState = {}));
12
+ //# sourceMappingURL=mt-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mt-state.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/mt-state.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAMX;AAND,WAAY,OAAO;IACf,4BAAiB,CAAA;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,gCAAqB,CAAA;IACrB,kCAAuB,CAAA;AAC3B,CAAC,EANW,OAAO,GAAP,eAAO,KAAP,eAAO,QAMlB"}
@@ -0,0 +1,4 @@
1
+ interface TranslationDto {
2
+ mtUid: string;
3
+ }
4
+ export { TranslationDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=translation-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/translation-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { MTState } from "./mt-state";
2
+ import { Error } from "./error";
3
+ interface TranslationLocaleStatusDto {
4
+ localeId: string;
5
+ state: MTState;
6
+ processedStringCount: number;
7
+ error?: Error;
8
+ }
9
+ export { TranslationLocaleStatusDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=translation-locale-status-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation-locale-status-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/translation-locale-status-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { MTState } from "./mt-state";
2
+ import { Error } from "./error";
3
+ import { TranslationLocaleStatusDto } from "./translation-locale-status-dto";
4
+ interface TranslationStatusDto {
5
+ state: MTState;
6
+ requestedStringCount: number;
7
+ error?: Error;
8
+ localeProcessStatuses: TranslationLocaleStatusDto[];
9
+ }
10
+ export { TranslationStatusDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=translation-status-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation-status-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/translation-status-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ interface UploadedFileDto {
2
+ fileUid: string;
3
+ }
4
+ export { UploadedFileDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=uploaded-file-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploaded-file-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/uploaded-file-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import FormData from "form-data";
2
+ import { SmartlingBaseApi } from "../base";
3
+ import { SmartlingAuthApi } from "../auth";
4
+ import { Logger } from "../logger";
5
+ import { UploadedFileDto } from "./dto/uploaded-file-dto";
6
+ import { UploadFileParameters } from "./params/upload-file-parameters";
7
+ import { TranslationDto } from "./dto/translation-dto";
8
+ import { TranslateFileParameters } from "./params/translate-file-parameters";
9
+ import { TranslationStatusDto } from "./dto/translation-status-dto";
10
+ import { LanguageDetectionDto } from "./dto/language-detection-dto";
11
+ import { LanguageDetectionStatusDto } from "./dto/language-detection-status-dto";
12
+ export declare class SmartlingFileTranslationsApi extends SmartlingBaseApi {
13
+ constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
14
+ uploadFile(accountUid: string, parameters: UploadFileParameters): Promise<UploadedFileDto>;
15
+ translateFile(accountUid: string, fileUid: string, params: TranslateFileParameters): Promise<TranslationDto>;
16
+ getTranslationProgress(accountUid: string, fileUid: string, mtUid: string): Promise<TranslationStatusDto>;
17
+ downloadTranslatedFile(accountUid: string, fileUid: string, mtUid: string, localeId: string): Promise<string>;
18
+ downloadTranslatedFiles(accountUid: string, fileUid: string, mtUid: string): Promise<string>;
19
+ cancelFileTranslation(accountUid: string, fileUid: string, mtUid: string): Promise<void>;
20
+ detectFileLanguage(accountUid: string, fileUid: string): Promise<LanguageDetectionDto>;
21
+ getLanguageDetectionProgress(accountUid: string, fileUid: string, languageDetectionUid: string): Promise<LanguageDetectionStatusDto>;
22
+ static fixContentTypeHeaderCase(form: FormData): Record<string, unknown>;
23
+ }