smartling-api-sdk-nodejs 1.0.4 → 1.2.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/builder/index.ts +9 -19
- package/api/files/index.ts +1 -8
- package/api/files/params/upload-file-parameters.ts +24 -2
- package/api/job-batches/index.ts +1 -6
- package/api/job-batches/params/upload-batch-file-parameters.ts +24 -1
- package/api/jobs/dto/content-progress-report-item-dto.ts +2 -2
- package/api/jobs/dto/file-progress-dto.ts +2 -2
- package/api/jobs/dto/job-progress-dto.ts +11 -0
- package/api/jobs/dto/progress-item-dto.ts +6 -0
- package/api/jobs/index.ts +12 -0
- package/api/jobs/params/job-progress-parameters.ts +9 -0
- package/built/api/base/index.js +4 -4
- package/built/api/base/index.js.map +1 -1
- package/built/api/builder/index.d.ts +8 -8
- package/built/api/builder/index.js +1 -5
- package/built/api/builder/index.js.map +1 -1
- package/built/api/context/index.js +1 -1
- package/built/api/context/index.js.map +1 -1
- package/built/api/files/index.js +1 -26
- package/built/api/files/index.js.map +1 -1
- package/built/api/files/params/upload-file-parameters.d.ts +5 -1
- package/built/api/files/params/upload-file-parameters.js +30 -2
- package/built/api/files/params/upload-file-parameters.js.map +1 -1
- package/built/api/job-batches/index.js +1 -24
- package/built/api/job-batches/index.js.map +1 -1
- package/built/api/job-batches/params/upload-batch-file-parameters.d.ts +4 -0
- package/built/api/job-batches/params/upload-batch-file-parameters.js +29 -1
- package/built/api/job-batches/params/upload-batch-file-parameters.js.map +1 -1
- package/built/api/jobs/dto/content-progress-report-item-dto.d.ts +2 -2
- package/built/api/jobs/dto/file-progress-dto.d.ts +2 -2
- package/built/api/jobs/dto/job-progress-dto.d.ts +9 -0
- package/built/api/jobs/dto/{file-progress-item-dto.js → job-progress-dto.js} +1 -1
- package/built/api/jobs/dto/job-progress-dto.js.map +1 -0
- package/built/api/jobs/dto/progress-item-dto.d.ts +5 -0
- package/built/api/jobs/dto/progress-item-dto.js +3 -0
- package/built/api/jobs/dto/progress-item-dto.js.map +1 -0
- package/built/api/jobs/index.d.ts +3 -0
- package/built/api/jobs/index.js +5 -0
- package/built/api/jobs/index.js.map +1 -1
- package/built/api/jobs/params/job-progress-parameters.d.ts +4 -0
- package/built/api/jobs/params/job-progress-parameters.js +12 -0
- package/built/api/jobs/params/job-progress-parameters.js.map +1 -0
- package/built/index.d.ts +12 -1
- package/built/index.js +12 -1
- package/built/index.js.map +1 -1
- package/built/package.json +5 -4
- package/index.ts +12 -1
- package/package.json +5 -4
- package/test/builder.spec.ts +1 -4
- package/test/files.spec.ts +59 -2
- package/test/job-batches.spec.ts +62 -2
- package/test/jobs.spec.ts +23 -0
- package/test/stream-to-string.ts +16 -0
- package/api/jobs/dto/file-progress-item-dto.ts +0 -6
- package/built/api/jobs/dto/file-progress-item-dto.d.ts +0 -5
- package/built/api/jobs/dto/file-progress-item-dto.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-batch-file-parameters.js","sourceRoot":"","sources":["../../../../api/job-batches/params/upload-batch-file-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-batch-file-parameters.js","sourceRoot":"","sources":["../../../../api/job-batches/params/upload-batch-file-parameters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,kDAAwD;AAGxD,MAAa,yBAA0B,SAAQ,sBAAc;IACzD,cAAc,CAAC,WAAmB,EAAE,OAAe;QAC/C,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,IAAI,CAAC,SAAS,CAAC;YAC/C,MAAM,EAAE,WAAW;YACnB,OAAO;SACV,CAAC,CAAC,CAAC;QAEJ,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,mBAAmB,CAAC,gBAA+B;QAC/C,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC;IAChB,CAAC;IAOD,OAAO,CAAC,QAAgB;QACpB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAChC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAC5B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,wBAAwB,CAAC,QAAgB;QACrC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAChC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAC5B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,cAAc,CAAC,WAAqB;QAChC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAE9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,QAAkB;QAC1B,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,YAAY,CAAC,GAAW,EAAE,KAAa;QACnC,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlED,8DAkEC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkflowProgressReportItemDto } from "./workflow-progress-report-item-dto";
|
|
2
|
-
import {
|
|
2
|
+
import { ProgressItemDto } from "./progress-item-dto";
|
|
3
3
|
import { SummaryReportItemDto } from "./summary-report-item-dto";
|
|
4
4
|
interface ContentProgressReportItemDto {
|
|
5
5
|
targetLocaleDescription: string;
|
|
@@ -9,7 +9,7 @@ interface ContentProgressReportItemDto {
|
|
|
9
9
|
wordCount: number;
|
|
10
10
|
};
|
|
11
11
|
workflowProgressReportList: Array<WorkflowProgressReportItemDto>;
|
|
12
|
-
progress:
|
|
12
|
+
progress: ProgressItemDto;
|
|
13
13
|
summaryReport: Array<SummaryReportItemDto>;
|
|
14
14
|
}
|
|
15
15
|
export { ContentProgressReportItemDto };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContentProgressReportItemDto } from "./content-progress-report-item-dto";
|
|
2
|
-
import {
|
|
2
|
+
import { ProgressItemDto } from "./progress-item-dto";
|
|
3
3
|
import { SummaryReportItemDto } from "./summary-report-item-dto";
|
|
4
4
|
interface FileProgressDto {
|
|
5
5
|
contentProgressReport: Array<ContentProgressReportItemDto>;
|
|
6
|
-
progress:
|
|
6
|
+
progress: ProgressItemDto;
|
|
7
7
|
summaryReport: Array<SummaryReportItemDto>;
|
|
8
8
|
}
|
|
9
9
|
export { FileProgressDto };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContentProgressReportItemDto } from "./content-progress-report-item-dto";
|
|
2
|
+
import { ProgressItemDto } from "./progress-item-dto";
|
|
3
|
+
import { SummaryReportItemDto } from "./summary-report-item-dto";
|
|
4
|
+
interface JobProgressDto {
|
|
5
|
+
contentProgressReport: Array<ContentProgressReportItemDto>;
|
|
6
|
+
progress: ProgressItemDto;
|
|
7
|
+
summaryReport: Array<SummaryReportItemDto>;
|
|
8
|
+
}
|
|
9
|
+
export { JobProgressDto };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-progress-dto.js","sourceRoot":"","sources":["../../../../api/jobs/dto/job-progress-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-item-dto.js","sourceRoot":"","sources":["../../../../api/jobs/dto/progress-item-dto.ts"],"names":[],"mappings":""}
|
|
@@ -13,6 +13,8 @@ import { BaseJobDto } from "./dto/base-job-dto";
|
|
|
13
13
|
import { FileProgressDto } from "./dto/file-progress-dto";
|
|
14
14
|
import { SourceFileDto } from "./dto/source-file-dto";
|
|
15
15
|
import { RemovedFileDto } from "./dto/removed-file-dto";
|
|
16
|
+
import { JobProgressDto } from "./dto/job-progress-dto";
|
|
17
|
+
import { JobProgressParameters } from "./params/job-progress-parameters";
|
|
16
18
|
export declare class SmartlingJobsApi extends SmartlingBaseApi {
|
|
17
19
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
|
|
18
20
|
createJob(projectId: string, params: CreateJobParameters): Promise<JobDto>;
|
|
@@ -21,5 +23,6 @@ export declare class SmartlingJobsApi extends SmartlingBaseApi {
|
|
|
21
23
|
listJobs(projectId: string, params: ListJobsParameters): Promise<SmartlingListResponse<BaseJobDto>>;
|
|
22
24
|
searchJobs(projectId: string, params: any): Promise<any>;
|
|
23
25
|
removeFileFromJob(projectId: string, translationJobUid: string, params: RemoveFileParameters): Promise<RemovedFileDto>;
|
|
26
|
+
getJobProgress(projectId: string, translationJobUid: string, params: JobProgressParameters): Promise<JobProgressDto>;
|
|
24
27
|
getJobFileProgress(projectId: string, translationJobUid: string, params: FileProgressParameters): Promise<FileProgressDto>;
|
|
25
28
|
}
|
package/built/api/jobs/index.js
CHANGED
|
@@ -47,6 +47,11 @@ class SmartlingJobsApi extends index_1.SmartlingBaseApi {
|
|
|
47
47
|
return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/file/remove`, JSON.stringify(params.export()));
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
getJobProgress(projectId, translationJobUid, params) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/progress`, params.export());
|
|
53
|
+
});
|
|
54
|
+
}
|
|
50
55
|
getJobFileProgress(projectId, translationJobUid, params) {
|
|
51
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
57
|
return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/file/progress`, params.export());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAkBjD,MAAa,gBAAiB,SAAQ,wBAAgB;IAClD,YAAY,mBAA2B,EAAE,OAAyB,EAAE,MAAc;QAC9E,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,uBAAuB,CAAC;IACpE,CAAC;IAEK,SAAS,CAAC,SAAiB,EAAE,MAA2B;;YAC1D,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,OAAO,EACtC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,MAAM,CAAC,SAAiB,EAAE,iBAAyB;;YACrD,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,EAAE,CAC9D,CAAC;QACN,CAAC;KAAA;IAEK,WAAW,CACb,SAAiB,EAAE,iBAAyB,EAAE,MAA8B;;YAE5E,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,QAAQ,EACjE,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAEK,QAAQ,CACV,SAAiB,EAAE,MAA0B;;YAE7C,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,OAAO,EACtC,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAGK,UAAU,CAAC,SAAiB,EAAE,MAAM;;YACtC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,cAAc,EAC7C,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAEK,iBAAiB,CACnB,SAAiB,EAAE,iBAAyB,EAAE,MAA4B;;YAE1E,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,cAAc,EACvE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,cAAc,CAChB,SAAiB,EAAE,iBAAyB,EAAE,MAA6B;;YAE3E,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,WAAW,EACpE,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAEK,kBAAkB,CACpB,SAAiB,EAAE,iBAAyB,EAAE,MAA8B;;YAE5E,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,gBAAgB,EACzE,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;CACJ;AAhFD,4CAgFC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobProgressParameters = void 0;
|
|
4
|
+
const index_1 = require("../../parameters/index");
|
|
5
|
+
class JobProgressParameters extends index_1.BaseParameters {
|
|
6
|
+
setTargetLocaleId(targetLocaleId) {
|
|
7
|
+
this.set("targetLocaleId", targetLocaleId);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.JobProgressParameters = JobProgressParameters;
|
|
12
|
+
//# sourceMappingURL=job-progress-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-progress-parameters.js","sourceRoot":"","sources":["../../../../api/jobs/params/job-progress-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAExD,MAAa,qBAAsB,SAAQ,sBAAc;IACrD,iBAAiB,CAAC,cAAsB;QACpC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAE3C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAND,sDAMC"}
|
package/built/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./api/auth/index";
|
|
2
|
+
export * from "./api/auth/dto/access-token-dto";
|
|
2
3
|
export * from "./api/base/index";
|
|
3
4
|
export * from "./api/builder/index";
|
|
4
5
|
export * from "./api/context/index";
|
|
@@ -19,8 +20,16 @@ export * from "./api/files/params/download-file-parameters";
|
|
|
19
20
|
export * from "./api/files/params/retrieval-type";
|
|
20
21
|
export * from "./api/files/params/file-type";
|
|
21
22
|
export * from "./api/files/params/upload-file-parameters";
|
|
23
|
+
export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
24
|
+
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
|
25
|
+
export * from "./api/files/dto/last-modified-for-locale-dto";
|
|
26
|
+
export * from "./api/files/dto/uploaded-file-dto";
|
|
22
27
|
export * from "./api/http/smartling-list-response";
|
|
23
28
|
export * from "./api/job-batches/index";
|
|
29
|
+
export * from "./api/job-batches/dto/batch-dto";
|
|
30
|
+
export * from "./api/job-batches/dto/batch-item-dto";
|
|
31
|
+
export * from "./api/job-batches/dto/batch-locale-dto";
|
|
32
|
+
export * from "./api/job-batches/dto/batch-status-dto";
|
|
24
33
|
export * from "./api/job-batches/params/create-batch-parameters";
|
|
25
34
|
export * from "./api/job-batches/params/upload-batch-file-parameters";
|
|
26
35
|
export * from "./api/job-batches/params/process-batch-action-parameters";
|
|
@@ -41,10 +50,12 @@ export * from "./api/jobs/dto/source-file-dto";
|
|
|
41
50
|
export * from "./api/jobs/dto/workflow-progress-report-item-dto";
|
|
42
51
|
export * from "./api/jobs/dto/workflow-step-summary-report-item-dto";
|
|
43
52
|
export * from "./api/jobs/dto/removed-file-dto";
|
|
44
|
-
export * from "./api/jobs/dto/
|
|
53
|
+
export * from "./api/jobs/dto/progress-item-dto";
|
|
45
54
|
export * from "./api/jobs/dto/summary-report-item-dto";
|
|
55
|
+
export * from "./api/jobs/dto/job-progress-dto";
|
|
46
56
|
export * from "./api/jobs/params/create-job-parameters";
|
|
47
57
|
export * from "./api/jobs/params/file-progress-parameters";
|
|
58
|
+
export * from "./api/jobs/params/job-progress-parameters";
|
|
48
59
|
export * from "./api/jobs/params/job-status";
|
|
49
60
|
export * from "./api/jobs/params/list-job-files-parameters";
|
|
50
61
|
export * from "./api/jobs/params/list-jobs-parameters";
|
package/built/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./api/auth/index"), exports);
|
|
14
|
+
__exportStar(require("./api/auth/dto/access-token-dto"), exports);
|
|
14
15
|
__exportStar(require("./api/base/index"), exports);
|
|
15
16
|
__exportStar(require("./api/builder/index"), exports);
|
|
16
17
|
__exportStar(require("./api/context/index"), exports);
|
|
@@ -31,8 +32,16 @@ __exportStar(require("./api/files/params/download-file-parameters"), exports);
|
|
|
31
32
|
__exportStar(require("./api/files/params/retrieval-type"), exports);
|
|
32
33
|
__exportStar(require("./api/files/params/file-type"), exports);
|
|
33
34
|
__exportStar(require("./api/files/params/upload-file-parameters"), exports);
|
|
35
|
+
__exportStar(require("./api/files/dto/file-status-for-all-locales-dto"), exports);
|
|
36
|
+
__exportStar(require("./api/files/dto/file-status-for-locale-item-dto"), exports);
|
|
37
|
+
__exportStar(require("./api/files/dto/last-modified-for-locale-dto"), exports);
|
|
38
|
+
__exportStar(require("./api/files/dto/uploaded-file-dto"), exports);
|
|
34
39
|
__exportStar(require("./api/http/smartling-list-response"), exports);
|
|
35
40
|
__exportStar(require("./api/job-batches/index"), exports);
|
|
41
|
+
__exportStar(require("./api/job-batches/dto/batch-dto"), exports);
|
|
42
|
+
__exportStar(require("./api/job-batches/dto/batch-item-dto"), exports);
|
|
43
|
+
__exportStar(require("./api/job-batches/dto/batch-locale-dto"), exports);
|
|
44
|
+
__exportStar(require("./api/job-batches/dto/batch-status-dto"), exports);
|
|
36
45
|
__exportStar(require("./api/job-batches/params/create-batch-parameters"), exports);
|
|
37
46
|
__exportStar(require("./api/job-batches/params/upload-batch-file-parameters"), exports);
|
|
38
47
|
__exportStar(require("./api/job-batches/params/process-batch-action-parameters"), exports);
|
|
@@ -53,10 +62,12 @@ __exportStar(require("./api/jobs/dto/source-file-dto"), exports);
|
|
|
53
62
|
__exportStar(require("./api/jobs/dto/workflow-progress-report-item-dto"), exports);
|
|
54
63
|
__exportStar(require("./api/jobs/dto/workflow-step-summary-report-item-dto"), exports);
|
|
55
64
|
__exportStar(require("./api/jobs/dto/removed-file-dto"), exports);
|
|
56
|
-
__exportStar(require("./api/jobs/dto/
|
|
65
|
+
__exportStar(require("./api/jobs/dto/progress-item-dto"), exports);
|
|
57
66
|
__exportStar(require("./api/jobs/dto/summary-report-item-dto"), exports);
|
|
67
|
+
__exportStar(require("./api/jobs/dto/job-progress-dto"), exports);
|
|
58
68
|
__exportStar(require("./api/jobs/params/create-job-parameters"), exports);
|
|
59
69
|
__exportStar(require("./api/jobs/params/file-progress-parameters"), exports);
|
|
70
|
+
__exportStar(require("./api/jobs/params/job-progress-parameters"), exports);
|
|
60
71
|
__exportStar(require("./api/jobs/params/job-status"), exports);
|
|
61
72
|
__exportStar(require("./api/jobs/params/list-job-files-parameters"), exports);
|
|
62
73
|
__exportStar(require("./api/jobs/params/list-jobs-parameters"), exports);
|
package/built/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC;AACjC,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,wDAAsC;AACtC,oDAAkC;AAClC,8EAA4D;AAC5D,oEAAkD;AAClD,+DAA6C;AAC7C,4EAA0D;AAC1D,qEAAmD;AACnD,0DAAwC;AACxC,mFAAiE;AACjE,wFAAsE;AACtE,2FAAyE;AACzE,wFAAsE;AACtE,0FAAwE;AACxE,wEAAsD;AACtD,wEAAsD;AACtD,6EAA2D;AAC3D,mDAAiC;AACjC,8DAA4C;AAC5C,kFAAgE;AAChE,kEAAgD;AAChD,mEAAiD;AACjD,sEAAoD;AACpD,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C;AAC/C,mFAAiE;AACjE,uFAAqE;AACrE,kEAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AACjC,kEAAgD;AAChD,mDAAiC;AACjC,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,wDAAsC;AACtC,oDAAkC;AAClC,8EAA4D;AAC5D,oEAAkD;AAClD,+DAA6C;AAC7C,4EAA0D;AAC1D,kFAAgE;AAChE,kFAAgE;AAChE,+EAA6D;AAC7D,oEAAkD;AAClD,qEAAmD;AACnD,0DAAwC;AACxC,kEAAgD;AAChD,uEAAqD;AACrD,yEAAuD;AACvD,yEAAuD;AACvD,mFAAiE;AACjE,wFAAsE;AACtE,2FAAyE;AACzE,wFAAsE;AACtE,0FAAwE;AACxE,wEAAsD;AACtD,wEAAsD;AACtD,6EAA2D;AAC3D,mDAAiC;AACjC,8DAA4C;AAC5C,kFAAgE;AAChE,kEAAgD;AAChD,mEAAiD;AACjD,sEAAoD;AACpD,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C;AAC/C,mFAAiE;AACjE,uFAAqE;AACrE,kEAAgD;AAChD,mEAAiD;AACjD,yEAAuD;AACvD,kEAAgD;AAChD,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,uFAAqE;AACrE,+CAA6B"}
|
package/built/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartling-api-sdk-nodejs",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
41
41
|
"@typescript-eslint/parser": "^4.29.0",
|
|
42
42
|
"eslint": "^7.31.0",
|
|
43
|
-
"mocha": "^9.
|
|
44
|
-
"mocha-junit-reporter": "^2.0.
|
|
43
|
+
"mocha": "^9.1.3",
|
|
44
|
+
"mocha-junit-reporter": "^2.0.2",
|
|
45
45
|
"nyc": "^15.1.0",
|
|
46
|
-
"sinon": "^11.1.2"
|
|
46
|
+
"sinon": "^11.1.2",
|
|
47
|
+
"ansi-regex": "^5.0.1"
|
|
47
48
|
},
|
|
48
49
|
"nyc": {
|
|
49
50
|
"reporter": [
|
package/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./api/auth/index";
|
|
2
|
+
export * from "./api/auth/dto/access-token-dto";
|
|
2
3
|
export * from "./api/base/index";
|
|
3
4
|
export * from "./api/builder/index";
|
|
4
5
|
export * from "./api/context/index";
|
|
@@ -19,8 +20,16 @@ export * from "./api/files/params/download-file-parameters";
|
|
|
19
20
|
export * from "./api/files/params/retrieval-type";
|
|
20
21
|
export * from "./api/files/params/file-type";
|
|
21
22
|
export * from "./api/files/params/upload-file-parameters";
|
|
23
|
+
export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
24
|
+
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
|
25
|
+
export * from "./api/files/dto/last-modified-for-locale-dto";
|
|
26
|
+
export * from "./api/files/dto/uploaded-file-dto";
|
|
22
27
|
export * from "./api/http/smartling-list-response";
|
|
23
28
|
export * from "./api/job-batches/index";
|
|
29
|
+
export * from "./api/job-batches/dto/batch-dto";
|
|
30
|
+
export * from "./api/job-batches/dto/batch-item-dto";
|
|
31
|
+
export * from "./api/job-batches/dto/batch-locale-dto";
|
|
32
|
+
export * from "./api/job-batches/dto/batch-status-dto";
|
|
24
33
|
export * from "./api/job-batches/params/create-batch-parameters";
|
|
25
34
|
export * from "./api/job-batches/params/upload-batch-file-parameters";
|
|
26
35
|
export * from "./api/job-batches/params/process-batch-action-parameters";
|
|
@@ -41,10 +50,12 @@ export * from "./api/jobs/dto/source-file-dto";
|
|
|
41
50
|
export * from "./api/jobs/dto/workflow-progress-report-item-dto";
|
|
42
51
|
export * from "./api/jobs/dto/workflow-step-summary-report-item-dto";
|
|
43
52
|
export * from "./api/jobs/dto/removed-file-dto";
|
|
44
|
-
export * from "./api/jobs/dto/
|
|
53
|
+
export * from "./api/jobs/dto/progress-item-dto";
|
|
45
54
|
export * from "./api/jobs/dto/summary-report-item-dto";
|
|
55
|
+
export * from "./api/jobs/dto/job-progress-dto";
|
|
46
56
|
export * from "./api/jobs/params/create-job-parameters";
|
|
47
57
|
export * from "./api/jobs/params/file-progress-parameters";
|
|
58
|
+
export * from "./api/jobs/params/job-progress-parameters";
|
|
48
59
|
export * from "./api/jobs/params/job-status";
|
|
49
60
|
export * from "./api/jobs/params/list-job-files-parameters";
|
|
50
61
|
export * from "./api/jobs/params/list-jobs-parameters";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartling-api-sdk-nodejs",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
41
41
|
"@typescript-eslint/parser": "^4.29.0",
|
|
42
42
|
"eslint": "^7.31.0",
|
|
43
|
-
"mocha": "^9.
|
|
44
|
-
"mocha-junit-reporter": "^2.0.
|
|
43
|
+
"mocha": "^9.1.3",
|
|
44
|
+
"mocha-junit-reporter": "^2.0.2",
|
|
45
45
|
"nyc": "^15.1.0",
|
|
46
|
-
"sinon": "^11.1.2"
|
|
46
|
+
"sinon": "^11.1.2",
|
|
47
|
+
"ansi-regex": "^5.0.1"
|
|
47
48
|
},
|
|
48
49
|
"nyc": {
|
|
49
50
|
"reporter": [
|
package/test/builder.spec.ts
CHANGED
package/test/files.spec.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
1
2
|
import sinon from "sinon";
|
|
2
3
|
import assert from "assert";
|
|
3
4
|
import { SmartlingFilesApi } from "../api/files/index";
|
|
@@ -7,6 +8,7 @@ import { DownloadFileParameters } from "../api/files/params/download-file-parame
|
|
|
7
8
|
import { UploadFileParameters } from "../api/files/params/upload-file-parameters";
|
|
8
9
|
import { SmartlingAuthApi } from "../api/auth/index";
|
|
9
10
|
import { FileType } from "../api/files/params/file-type";
|
|
11
|
+
import { streamToString } from "./stream-to-string";
|
|
10
12
|
|
|
11
13
|
describe("SmartlingFilesApi class tests.", () => {
|
|
12
14
|
const projectId = "testProjectId";
|
|
@@ -133,11 +135,11 @@ describe("SmartlingFilesApi class tests.", () => {
|
|
|
133
135
|
);
|
|
134
136
|
});
|
|
135
137
|
|
|
136
|
-
it("Upload file", async () => {
|
|
138
|
+
it("Upload file: from disk", async () => {
|
|
137
139
|
const params = new UploadFileParameters();
|
|
138
140
|
|
|
139
141
|
params
|
|
140
|
-
.
|
|
142
|
+
.setFileFromLocalFilePath("./test/data/file.xml")
|
|
141
143
|
.setFileUri("test-file-uri")
|
|
142
144
|
.setFileType(FileType.XML)
|
|
143
145
|
.setDirective("foo", "bar");
|
|
@@ -165,6 +167,61 @@ describe("SmartlingFilesApi class tests.", () => {
|
|
|
165
167
|
filesApiFetchStub.getCall(0).args[1].headers["User-Agent"],
|
|
166
168
|
"test_user_agent"
|
|
167
169
|
);
|
|
170
|
+
|
|
171
|
+
assert.equal(
|
|
172
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
173
|
+
await streamToString(filesApiFetchStub.getCall(0).args[1].body._streams[1]),
|
|
174
|
+
fs.readFileSync(
|
|
175
|
+
fs.realpathSync("./test/data/file.xml"),
|
|
176
|
+
"utf8"
|
|
177
|
+
)
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("Upload file: as stream", async () => {
|
|
182
|
+
const params = new UploadFileParameters();
|
|
183
|
+
|
|
184
|
+
params
|
|
185
|
+
.setFileContent(fs.createReadStream(
|
|
186
|
+
fs.realpathSync("./test/data/file.xml"),
|
|
187
|
+
"utf8"
|
|
188
|
+
))
|
|
189
|
+
.setFileUri("test-file-uri")
|
|
190
|
+
.setFileType(FileType.XML)
|
|
191
|
+
.setDirective("foo", "bar");
|
|
192
|
+
|
|
193
|
+
await filesApi.uploadFile(projectId, params);
|
|
194
|
+
|
|
195
|
+
sinon.assert.calledOnce(filesApiFetchStub);
|
|
196
|
+
|
|
197
|
+
assert.equal(
|
|
198
|
+
filesApiFetchStub.getCall(0).args[0],
|
|
199
|
+
`https://test.com/files-api/v2/projects/${projectId}/file`
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
assert.equal(
|
|
203
|
+
filesApiFetchStub.getCall(0).args[1].method,
|
|
204
|
+
"post"
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
assert.equal(
|
|
208
|
+
filesApiFetchStub.getCall(0).args[1].headers.Authorization,
|
|
209
|
+
"test_token_type test_access_token"
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
assert.equal(
|
|
213
|
+
filesApiFetchStub.getCall(0).args[1].headers["User-Agent"],
|
|
214
|
+
"test_user_agent"
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
assert.equal(
|
|
218
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
219
|
+
await streamToString(filesApiFetchStub.getCall(0).args[1].body._streams[1]),
|
|
220
|
+
fs.readFileSync(
|
|
221
|
+
fs.realpathSync("./test/data/file.xml"),
|
|
222
|
+
"utf8"
|
|
223
|
+
)
|
|
224
|
+
);
|
|
168
225
|
});
|
|
169
226
|
});
|
|
170
227
|
});
|
package/test/job-batches.spec.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
1
2
|
import sinon from "sinon";
|
|
2
3
|
import assert from "assert";
|
|
3
4
|
import { loggerMock, authMock, responseMock } from "./mock";
|
|
@@ -8,6 +9,7 @@ import { UploadBatchFileParameters } from "../api/job-batches/params/upload-batc
|
|
|
8
9
|
import { FileType } from "../api/files/params/file-type";
|
|
9
10
|
import { CancelBatchFileParameters } from "../api/job-batches/params/cancel-batch-file-parameters";
|
|
10
11
|
import { RegisterBatchFileParameters } from "../api/job-batches/params/register-batch-file-parameters";
|
|
12
|
+
import { streamToString } from "./stream-to-string";
|
|
11
13
|
|
|
12
14
|
describe("SmartlingJobBatchesAPI class tests.", () => {
|
|
13
15
|
const projectId = "testProjectId";
|
|
@@ -115,11 +117,11 @@ describe("SmartlingJobBatchesAPI class tests.", () => {
|
|
|
115
117
|
);
|
|
116
118
|
});
|
|
117
119
|
|
|
118
|
-
it("Upload batch file", async () => {
|
|
120
|
+
it("Upload batch file: from disk", async () => {
|
|
119
121
|
const params = new UploadBatchFileParameters();
|
|
120
122
|
|
|
121
123
|
params
|
|
122
|
-
.
|
|
124
|
+
.setFileFromLocalFilePath("./test/data/file.xml")
|
|
123
125
|
.setFileUri("test-file-uri")
|
|
124
126
|
.setFileType(FileType.XML)
|
|
125
127
|
.setDirective("foo", "bar")
|
|
@@ -150,6 +152,64 @@ describe("SmartlingJobBatchesAPI class tests.", () => {
|
|
|
150
152
|
jobBatchesApiFetchStub.getCall(0).args[1].headers["User-Agent"],
|
|
151
153
|
"test_user_agent"
|
|
152
154
|
);
|
|
155
|
+
|
|
156
|
+
assert.equal(
|
|
157
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
158
|
+
await streamToString(jobBatchesApiFetchStub.getCall(0).args[1].body._streams[1]),
|
|
159
|
+
fs.readFileSync(
|
|
160
|
+
fs.realpathSync("./test/data/file.xml"),
|
|
161
|
+
"utf8"
|
|
162
|
+
)
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("Upload batch file: as stream", async () => {
|
|
167
|
+
const params = new UploadBatchFileParameters();
|
|
168
|
+
|
|
169
|
+
params
|
|
170
|
+
.setFileContent(fs.createReadStream(
|
|
171
|
+
fs.realpathSync("./test/data/file.xml"),
|
|
172
|
+
"utf8"
|
|
173
|
+
))
|
|
174
|
+
.setFileUri("test-file-uri")
|
|
175
|
+
.setFileType(FileType.XML)
|
|
176
|
+
.setDirective("foo", "bar")
|
|
177
|
+
.setLocalesToApprove(["fr-FR", "de-DE"])
|
|
178
|
+
.setCallbackUrl("testCallbackUrl")
|
|
179
|
+
.setClientLibId("clientLibId", "clientLibVersion");
|
|
180
|
+
|
|
181
|
+
await jobBatchesApi.uploadBatchFile(projectId, batchUid, params);
|
|
182
|
+
|
|
183
|
+
sinon.assert.calledOnce(jobBatchesApiFetchStub);
|
|
184
|
+
|
|
185
|
+
assert.equal(
|
|
186
|
+
jobBatchesApiFetchStub.getCall(0).args[0],
|
|
187
|
+
`https://test.com/job-batches-api/v2/projects/${projectId}/batches/${batchUid}/file`
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
assert.equal(
|
|
191
|
+
jobBatchesApiFetchStub.getCall(0).args[1].method,
|
|
192
|
+
"post"
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
assert.equal(
|
|
196
|
+
jobBatchesApiFetchStub.getCall(0).args[1].headers.Authorization,
|
|
197
|
+
"test_token_type test_access_token"
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
assert.equal(
|
|
201
|
+
jobBatchesApiFetchStub.getCall(0).args[1].headers["User-Agent"],
|
|
202
|
+
"test_user_agent"
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
assert.equal(
|
|
206
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
207
|
+
await streamToString(jobBatchesApiFetchStub.getCall(0).args[1].body._streams[1]),
|
|
208
|
+
fs.readFileSync(
|
|
209
|
+
fs.realpathSync("./test/data/file.xml"),
|
|
210
|
+
"utf8"
|
|
211
|
+
)
|
|
212
|
+
);
|
|
153
213
|
});
|
|
154
214
|
|
|
155
215
|
it("Get batch status", async () => {
|
package/test/jobs.spec.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { CreateJobParameters } from "../api/jobs/params/create-job-parameters";
|
|
|
9
9
|
import { ListJobFilesParameters } from "../api/jobs/params/list-job-files-parameters";
|
|
10
10
|
import { JobStatus } from "../api/jobs/params/job-status";
|
|
11
11
|
import { RemoveFileParameters } from "../api/jobs/params/remove-file-parameters";
|
|
12
|
+
import { JobProgressParameters } from "../api/jobs/params/job-progress-parameters";
|
|
12
13
|
|
|
13
14
|
describe("SmartlingJobsAPI class tests.", () => {
|
|
14
15
|
const projectId = "testProjectId";
|
|
@@ -134,6 +135,28 @@ describe("SmartlingJobsAPI class tests.", () => {
|
|
|
134
135
|
);
|
|
135
136
|
});
|
|
136
137
|
|
|
138
|
+
it("Get job progress", async () => {
|
|
139
|
+
const params = new JobProgressParameters();
|
|
140
|
+
|
|
141
|
+
params.setTargetLocaleId("fr-FR");
|
|
142
|
+
|
|
143
|
+
await jobApi.getJobProgress(projectId, jobUid, params);
|
|
144
|
+
|
|
145
|
+
sinon.assert.calledOnce(jobServiceApiFetchStub);
|
|
146
|
+
sinon.assert.calledWithExactly(
|
|
147
|
+
jobServiceApiFetchStub,
|
|
148
|
+
`https://test.com/jobs-api/v3/projects/${projectId}/jobs/${jobUid}/progress?targetLocaleId=fr-FR`,
|
|
149
|
+
{
|
|
150
|
+
headers: {
|
|
151
|
+
Authorization: "test_token_type test_access_token",
|
|
152
|
+
"Content-Type": "application/json",
|
|
153
|
+
"User-Agent": "test_user_agent"
|
|
154
|
+
},
|
|
155
|
+
method: "get"
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
});
|
|
159
|
+
|
|
137
160
|
it("Get job file progress", async () => {
|
|
138
161
|
const params = new FileProgressParameters();
|
|
139
162
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Readable } from "stream";
|
|
2
|
+
|
|
3
|
+
function streamToString(stream: Readable): Promise<string> {
|
|
4
|
+
const chunks = [];
|
|
5
|
+
|
|
6
|
+
stream.resume();
|
|
7
|
+
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
// eslint-disable-next-line fp/no-mutating-methods
|
|
10
|
+
stream.on("data", chunk => chunks.push(Buffer.from(chunk)));
|
|
11
|
+
stream.on("error", err => reject(err));
|
|
12
|
+
stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { streamToString };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-progress-item-dto.js","sourceRoot":"","sources":["../../../../api/jobs/dto/file-progress-item-dto.ts"],"names":[],"mappings":""}
|