smartling-api-sdk-nodejs 1.0.3 → 1.1.2
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/index.ts +21 -1
- package/api/builder/index.ts +9 -19
- package/api/context/dto/context-dto.ts +1 -1
- package/api/files/dto/file-status-for-all-locales-dto.ts +1 -1
- package/api/files/dto/last-modified-for-locale-dto.ts +1 -1
- package/api/job-batches/dto/batch-item-dto.ts +1 -1
- package/api/job-batches/dto/batch-status-dto.ts +1 -1
- package/api/jobs/dto/base-job-dto.ts +2 -2
- 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-dto.ts +1 -1
- 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 +23 -5
- 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/dto/context-dto.d.ts +1 -1
- package/built/api/context/index.js +1 -1
- package/built/api/context/index.js.map +1 -1
- package/built/api/files/dto/file-status-for-all-locales-dto.d.ts +1 -1
- package/built/api/files/dto/last-modified-for-locale-dto.d.ts +1 -1
- package/built/api/job-batches/dto/batch-item-dto.d.ts +1 -1
- package/built/api/job-batches/dto/batch-status-dto.d.ts +1 -1
- package/built/api/jobs/dto/base-job-dto.d.ts +2 -2
- 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-dto.d.ts +1 -1
- 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 +1 -1
- package/index.ts +12 -1
- package/package.json +1 -1
- package/test/base.spec.ts +44 -67
- package/test/builder.spec.ts +1 -4
- package/test/jobs.spec.ts +23 -0
- package/test/mock.ts +1 -1
- 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
|
@@ -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=AX2AqCuSdMA5141C1fch
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AX2AqCuSdMA5141C1fch
|
package/api/base/index.ts
CHANGED
|
@@ -137,7 +137,27 @@ export class SmartlingBaseApi {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
try {
|
|
140
|
-
const
|
|
140
|
+
const textResponse = await response.text();
|
|
141
|
+
const jsonResponse = JSON.parse(textResponse, (key, value) => {
|
|
142
|
+
const dateProperties = [
|
|
143
|
+
"created",
|
|
144
|
+
"modified",
|
|
145
|
+
"updated",
|
|
146
|
+
"createdDate",
|
|
147
|
+
"modifiedDate",
|
|
148
|
+
"updatedDate",
|
|
149
|
+
"dueDate",
|
|
150
|
+
"actionTime",
|
|
151
|
+
"publishDate",
|
|
152
|
+
"lastModified"
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
if (dateProperties.includes(key) && value) {
|
|
156
|
+
return new Date(value);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return value;
|
|
160
|
+
});
|
|
141
161
|
|
|
142
162
|
this.logger.debug(`Received code ${response.status}; content: ${JSON.stringify(jsonResponse)}`);
|
|
143
163
|
|
package/api/builder/index.ts
CHANGED
|
@@ -6,14 +6,14 @@ import { Logger } from "../logger";
|
|
|
6
6
|
const packageJson = require("../../package.json");
|
|
7
7
|
|
|
8
8
|
export class SmartlingApiClientBuilder {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
protected authApiClient: SmartlingAuthApi = null;
|
|
10
|
+
protected userId: string = null;
|
|
11
|
+
protected userSecret: string = null;
|
|
12
|
+
protected baseSmartlingApiUrl: string;
|
|
13
|
+
protected httpClientOptions: Record<string, unknown> = {};
|
|
14
|
+
protected clientLibId: string = packageJson.name;
|
|
15
|
+
protected clientLibVersion: string = packageJson.version;
|
|
16
|
+
protected logger: Logger = {
|
|
17
17
|
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
|
|
18
18
|
debug: () => {},
|
|
19
19
|
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
|
|
@@ -85,17 +85,7 @@ export class SmartlingApiClientBuilder {
|
|
|
85
85
|
|
|
86
86
|
instance.setClientLibId(this.clientLibId);
|
|
87
87
|
instance.setClientLibVersion(this.clientLibVersion);
|
|
88
|
-
|
|
89
|
-
instance.setOptions(
|
|
90
|
-
Object.assign(
|
|
91
|
-
this.httpClientOptions,
|
|
92
|
-
{
|
|
93
|
-
headers: {
|
|
94
|
-
"X-SL-ServiceOrigin": instance.getClientLibId()
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
);
|
|
88
|
+
instance.setOptions(this.httpClientOptions);
|
|
99
89
|
|
|
100
90
|
return instance;
|
|
101
91
|
}
|
|
@@ -2,7 +2,7 @@ import { FileType } from "../params/file-type";
|
|
|
2
2
|
import { FileStatusForLocaleItemDto } from "./file-status-for-locale-item-dto";
|
|
3
3
|
|
|
4
4
|
interface FileStatusForAllLocalesDto {
|
|
5
|
-
created:
|
|
5
|
+
created: Date;
|
|
6
6
|
fileType: FileType;
|
|
7
7
|
fileUri: string;
|
|
8
8
|
hasInstructions: boolean;
|
|
@@ -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
|
|
|
5
5
|
interface ContentProgressReportItemDto {
|
|
@@ -10,7 +10,7 @@ interface ContentProgressReportItemDto {
|
|
|
10
10
|
wordCount: number;
|
|
11
11
|
};
|
|
12
12
|
workflowProgressReportList: Array<WorkflowProgressReportItemDto>;
|
|
13
|
-
progress:
|
|
13
|
+
progress: ProgressItemDto;
|
|
14
14
|
summaryReport: Array<SummaryReportItemDto>;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
|
|
5
5
|
interface FileProgressDto {
|
|
6
6
|
contentProgressReport: Array<ContentProgressReportItemDto>;
|
|
7
|
-
progress:
|
|
7
|
+
progress: ProgressItemDto,
|
|
8
8
|
summaryReport: Array<SummaryReportItemDto>
|
|
9
9
|
}
|
|
10
10
|
|
package/api/jobs/dto/job-dto.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
|
|
5
|
+
interface JobProgressDto {
|
|
6
|
+
contentProgressReport: Array<ContentProgressReportItemDto>;
|
|
7
|
+
progress: ProgressItemDto,
|
|
8
|
+
summaryReport: Array<SummaryReportItemDto>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { JobProgressDto };
|
package/api/jobs/index.ts
CHANGED
|
@@ -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
|
|
|
17
19
|
export class SmartlingJobsApi extends SmartlingBaseApi {
|
|
18
20
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
|
|
@@ -75,6 +77,16 @@ export class SmartlingJobsApi extends SmartlingBaseApi {
|
|
|
75
77
|
);
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
async getJobProgress(
|
|
81
|
+
projectId: string, translationJobUid: string, params: JobProgressParameters
|
|
82
|
+
): Promise<JobProgressDto> {
|
|
83
|
+
return await this.makeRequest(
|
|
84
|
+
"get",
|
|
85
|
+
`${this.entrypoint}/${projectId}/jobs/${translationJobUid}/progress`,
|
|
86
|
+
params.export()
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
async getJobFileProgress(
|
|
79
91
|
projectId: string, translationJobUid: string, params: FileProgressParameters
|
|
80
92
|
): Promise<FileProgressDto> {
|
package/built/api/base/index.js
CHANGED
|
@@ -69,7 +69,7 @@ class SmartlingBaseApi {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
ua(clientId, clientVersion) {
|
|
72
|
-
return default_user_agent_1.default(clientId, clientVersion);
|
|
72
|
+
return (0, default_user_agent_1.default)(clientId, clientVersion);
|
|
73
73
|
}
|
|
74
74
|
alterRequestData(uri, opts) {
|
|
75
75
|
return opts;
|
|
@@ -86,13 +86,13 @@ class SmartlingBaseApi {
|
|
|
86
86
|
}
|
|
87
87
|
defaultHeaders["Content-Type"] = "application/json";
|
|
88
88
|
defaultHeaders["User-Agent"] = this.ua(this.clientLibId, this.clientLibVersion);
|
|
89
|
-
return merge_deep_1.default(defaultHeaders, headers);
|
|
89
|
+
return (0, merge_deep_1.default)(defaultHeaders, headers);
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
makeRequest(verb, uri, payload = null, returnRawResponseBody = false, headers = {}) {
|
|
93
93
|
var _a, _b;
|
|
94
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const opts = merge_deep_1.default({
|
|
95
|
+
const opts = (0, merge_deep_1.default)({
|
|
96
96
|
method: verb,
|
|
97
97
|
headers: yield this.getDefaultHeaders(headers)
|
|
98
98
|
}, this.options);
|
|
@@ -100,7 +100,7 @@ class SmartlingBaseApi {
|
|
|
100
100
|
opts.body = payload;
|
|
101
101
|
}
|
|
102
102
|
else if (payload) {
|
|
103
|
-
uri = `${uri}?${querystring_1.stringify(payload)}`;
|
|
103
|
+
uri = `${uri}?${(0, querystring_1.stringify)(payload)}`;
|
|
104
104
|
}
|
|
105
105
|
let response = yield this.fetch(uri, this.alterRequestData(uri, opts));
|
|
106
106
|
if (response.status === 401) {
|
|
@@ -123,7 +123,25 @@ class SmartlingBaseApi {
|
|
|
123
123
|
return response.text();
|
|
124
124
|
}
|
|
125
125
|
try {
|
|
126
|
-
const
|
|
126
|
+
const textResponse = yield response.text();
|
|
127
|
+
const jsonResponse = JSON.parse(textResponse, (key, value) => {
|
|
128
|
+
const dateProperties = [
|
|
129
|
+
"created",
|
|
130
|
+
"modified",
|
|
131
|
+
"updated",
|
|
132
|
+
"createdDate",
|
|
133
|
+
"modifiedDate",
|
|
134
|
+
"updatedDate",
|
|
135
|
+
"dueDate",
|
|
136
|
+
"actionTime",
|
|
137
|
+
"publishDate",
|
|
138
|
+
"lastModified"
|
|
139
|
+
];
|
|
140
|
+
if (dateProperties.includes(key) && value) {
|
|
141
|
+
return new Date(value);
|
|
142
|
+
}
|
|
143
|
+
return value;
|
|
144
|
+
});
|
|
127
145
|
this.logger.debug(`Received code ${response.status}; content: ${JSON.stringify(jsonResponse)}`);
|
|
128
146
|
return ((_a = jsonResponse === null || jsonResponse === void 0 ? void 0 : jsonResponse.response) === null || _a === void 0 ? void 0 : _a.data) ? (_b = jsonResponse === null || jsonResponse === void 0 ? void 0 : jsonResponse.response) === null || _b === void 0 ? void 0 : _b.data : true;
|
|
129
147
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA+B;AAC/B,4EAAoC;AAEpC,kDAAoC;AACpC,6CAA6D;AAE7D,8CAAwD;AAIxD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD,MAAa,gBAAgB;IAUzB,YAAY,MAAc;QAThB,YAAO,GAAqB,SAAS,CAAC;QAU5C,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,CAA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IAAI,EAAC,CAAC,CAAC,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,0CAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;aAC7E;YAAC,OAAO,CAAC,EAAE;gBACR,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBAEnE,MAAM,IAAI,0BAAkB,CAAC,8BAA8B,EAAE;oBACzD,UAAU,EAAE,QAAQ,CAAC,MAAM;oBAC3B,aAAa,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;oBACpC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;iBACpD,CAAC,CAAC;aACN;;KACJ;CACJ;AAlKD,4CAkKC"}
|
|
@@ -2,14 +2,14 @@ import { SmartlingAuthApi } from "../auth/index";
|
|
|
2
2
|
import { SmartlingBaseApi } from "../base/index";
|
|
3
3
|
import { Logger } from "../logger";
|
|
4
4
|
export declare class SmartlingApiClientBuilder {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
protected authApiClient: SmartlingAuthApi;
|
|
6
|
+
protected userId: string;
|
|
7
|
+
protected userSecret: string;
|
|
8
|
+
protected baseSmartlingApiUrl: string;
|
|
9
|
+
protected httpClientOptions: Record<string, unknown>;
|
|
10
|
+
protected clientLibId: string;
|
|
11
|
+
protected clientLibVersion: string;
|
|
12
|
+
protected logger: Logger;
|
|
13
13
|
setLogger(logger: Logger): SmartlingApiClientBuilder;
|
|
14
14
|
setBaseSmartlingApiUrl(baseSmartlingApiUrl: string): SmartlingApiClientBuilder;
|
|
15
15
|
setHttpClientConfiguration(httpClientOptions: Record<string, unknown>): SmartlingApiClientBuilder;
|
|
@@ -52,11 +52,7 @@ class SmartlingApiClientBuilder {
|
|
|
52
52
|
const instance = new constructor(this.baseSmartlingApiUrl, this.authApiClient, this.logger);
|
|
53
53
|
instance.setClientLibId(this.clientLibId);
|
|
54
54
|
instance.setClientLibVersion(this.clientLibVersion);
|
|
55
|
-
instance.setOptions(
|
|
56
|
-
headers: {
|
|
57
|
-
"X-SL-ServiceOrigin": instance.getClientLibId()
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
55
|
+
instance.setOptions(this.httpClientOptions);
|
|
60
56
|
return instance;
|
|
61
57
|
}
|
|
62
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/builder/index.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAKjD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD,MAAa,yBAAyB;IAAtC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/builder/index.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAKjD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD,MAAa,yBAAyB;IAAtC;QACc,kBAAa,GAAqB,IAAI,CAAC;QACvC,WAAM,GAAW,IAAI,CAAC;QACtB,eAAU,GAAW,IAAI,CAAC;QAE1B,sBAAiB,GAA4B,EAAE,CAAC;QAChD,gBAAW,GAAW,WAAW,CAAC,IAAI,CAAC;QACvC,qBAAgB,GAAW,WAAW,CAAC,OAAO,CAAC;QAC/C,WAAM,GAAW;YAEvB,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;YAEf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;YAEd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;SAClB,CAAC;IAqEN,CAAC;IAnEU,SAAS,CAAC,MAAc;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,sBAAsB,CAAC,mBAA2B;QACrD,IAAI,CAAC,mBAAmB,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,WAAW,CAAC,CAAC;QAC1C,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpD,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAE5C,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AApFD,8DAoFC"}
|
|
@@ -57,7 +57,7 @@ class SmartlingContextApi extends index_1.SmartlingBaseApi {
|
|
|
57
57
|
const formData = new form_data_1.default();
|
|
58
58
|
Object.keys(opts.body).forEach((key) => {
|
|
59
59
|
if (key === "content") {
|
|
60
|
-
formData.append(key, string_to_file_stream_1.default(opts.body[key]));
|
|
60
|
+
formData.append(key, (0, string_to_file_stream_1.default)(opts.body[key]));
|
|
61
61
|
}
|
|
62
62
|
else if (Array.isArray(opts.body[key])) {
|
|
63
63
|
opts.body[key].forEach((value) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kFAAsD;AACtD,0DAAiC;AACjC,yCAAiD;AAYjD,MAAa,mBAAoB,SAAQ,wBAAgB;IACrD,YAAY,mBAA2B,EAAE,OAAyB,EAAE,MAAc;QAC9E,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,0BAA0B,CAAC;IACvE,CAAC;IAEK,MAAM,CACR,SAAiB,EAAE,MAA+B,EAAE,aAAgC;;YAEpF,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,WAAW,EAC1C,MAAM,CAAC,MAAM,EAAE,EACf,KAAK,EACL;gBACI,qBAAqB,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,aAAa,CAAC,KAAK,SAAS,aAAa,CAAC,IAAI,YAAY,aAAa,CAA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BAAM;oBACH,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;iBACxC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,cAAc,CAAC,CAAC;YACrE,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;SACxB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAtFD,kDAsFC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileType } from "../params/file-type";
|
|
2
2
|
import { FileStatusForLocaleItemDto } from "./file-status-for-locale-item-dto";
|
|
3
3
|
interface FileStatusForAllLocalesDto {
|
|
4
|
-
created:
|
|
4
|
+
created: Date;
|
|
5
5
|
fileType: FileType;
|
|
6
6
|
fileUri: string;
|
|
7
7
|
hasInstructions: boolean;
|
|
@@ -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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AE1E,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
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
package/test/base.spec.ts
CHANGED
|
@@ -70,7 +70,6 @@ describe("Base class tests.", () => {
|
|
|
70
70
|
let baseAlterRequestDataSpy;
|
|
71
71
|
let authResetTokenStub;
|
|
72
72
|
let responseMockTextStub;
|
|
73
|
-
let responseMockJsonStub;
|
|
74
73
|
|
|
75
74
|
beforeEach(() => {
|
|
76
75
|
base = new SmartlingBaseApi(loggerMock);
|
|
@@ -82,7 +81,6 @@ describe("Base class tests.", () => {
|
|
|
82
81
|
baseAlterRequestDataSpy = sinon.spy(base, "alterRequestData");
|
|
83
82
|
authResetTokenStub = sinon.stub(base.authApi, "resetToken");
|
|
84
83
|
responseMockTextStub = sinon.stub(responseMock, "text");
|
|
85
|
-
responseMockJsonStub = sinon.stub(responseMock, "json");
|
|
86
84
|
|
|
87
85
|
baseUaStub.returns("test_user_agent");
|
|
88
86
|
});
|
|
@@ -92,7 +90,6 @@ describe("Base class tests.", () => {
|
|
|
92
90
|
baseGetDefaultHeaderSpy.restore();
|
|
93
91
|
authResetTokenStub.restore();
|
|
94
92
|
responseMockTextStub.restore();
|
|
95
|
-
responseMockJsonStub.restore();
|
|
96
93
|
baseUaStub.restore();
|
|
97
94
|
});
|
|
98
95
|
|
|
@@ -104,9 +101,8 @@ describe("Base class tests.", () => {
|
|
|
104
101
|
};
|
|
105
102
|
|
|
106
103
|
baseFetchStub.returns(responseMock);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
104
|
+
|
|
105
|
+
responseMockTextStub.returns("{\"response\": {\"data\": {}}}");
|
|
110
106
|
|
|
111
107
|
await base.makeRequest(requestVerb, requestUri, payload);
|
|
112
108
|
|
|
@@ -138,9 +134,9 @@ describe("Base class tests.", () => {
|
|
|
138
134
|
body: payload
|
|
139
135
|
});
|
|
140
136
|
|
|
137
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
138
|
+
|
|
141
139
|
sinon.assert.notCalled(authResetTokenStub);
|
|
142
|
-
sinon.assert.notCalled(responseMockTextStub);
|
|
143
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
144
140
|
});
|
|
145
141
|
|
|
146
142
|
it("Success (JSON response, object result).", async () => {
|
|
@@ -151,13 +147,22 @@ describe("Base class tests.", () => {
|
|
|
151
147
|
};
|
|
152
148
|
|
|
153
149
|
baseFetchStub.returns(responseMock);
|
|
154
|
-
responseMockJsonStub.returns({
|
|
155
|
-
response: {
|
|
156
|
-
data: {}
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
150
|
|
|
160
|
-
|
|
151
|
+
responseMockTextStub.returns("{\"response\": {\"data\": {\"created\":\"2021-08-18T09:57:59.088Z\",\"modified\":\"2021-08-18T09:57:59.088Z\",\"updated\":\"2021-08-18T09:57:59.088Z\",\"createdDate\":\"2021-08-18T09:57:59.088Z\",\"modifiedDate\":\"2021-08-18T09:57:59.088Z\",\"updatedDate\":\"2021-08-18T09:57:59.088Z\",\"dueDate\":\"2021-08-18T09:57:59.088Z\",\"actionTime\":\"2021-08-18T09:57:59.088Z\",\"publishDate\":\"2021-08-18T09:57:59.088Z\",\"lastModified\":\"2021-08-18T09:57:59.088Z\",\"createdString\":\"2021-08-18T09:57:59.088Z\"}}}");
|
|
152
|
+
|
|
153
|
+
const result = await base.makeRequest(requestVerb, requestUri, payload);
|
|
154
|
+
|
|
155
|
+
assert.equal(result.created instanceof Date, true);
|
|
156
|
+
assert.equal(result.modified instanceof Date, true);
|
|
157
|
+
assert.equal(result.updated instanceof Date, true);
|
|
158
|
+
assert.equal(result.createdDate instanceof Date, true);
|
|
159
|
+
assert.equal(result.modifiedDate instanceof Date, true);
|
|
160
|
+
assert.equal(result.updatedDate instanceof Date, true);
|
|
161
|
+
assert.equal(result.dueDate instanceof Date, true);
|
|
162
|
+
assert.equal(result.actionTime instanceof Date, true);
|
|
163
|
+
assert.equal(result.publishDate instanceof Date, true);
|
|
164
|
+
assert.equal(result.lastModified instanceof Date, true);
|
|
165
|
+
assert.equal(typeof result.createdString, "string");
|
|
161
166
|
|
|
162
167
|
sinon.assert.calledOnce(baseGetDefaultHeaderSpy);
|
|
163
168
|
|
|
@@ -187,9 +192,9 @@ describe("Base class tests.", () => {
|
|
|
187
192
|
body: payload
|
|
188
193
|
});
|
|
189
194
|
|
|
195
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
196
|
+
|
|
190
197
|
sinon.assert.notCalled(authResetTokenStub);
|
|
191
|
-
sinon.assert.notCalled(responseMockTextStub);
|
|
192
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
193
198
|
});
|
|
194
199
|
|
|
195
200
|
it("Success (raw text response).", async () => {
|
|
@@ -200,11 +205,8 @@ describe("Base class tests.", () => {
|
|
|
200
205
|
};
|
|
201
206
|
|
|
202
207
|
baseFetchStub.returns(responseMock);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
data: {}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
+
|
|
209
|
+
responseMockTextStub.returns("invalid json: this test just returns raw text response but does not parse text as json");
|
|
208
210
|
|
|
209
211
|
await base.makeRequest(requestVerb, requestUri, payload, true);
|
|
210
212
|
|
|
@@ -238,7 +240,6 @@ describe("Base class tests.", () => {
|
|
|
238
240
|
|
|
239
241
|
sinon.assert.notCalled(authResetTokenStub);
|
|
240
242
|
sinon.assert.calledOnce(responseMockTextStub);
|
|
241
|
-
sinon.assert.notCalled(responseMockJsonStub);
|
|
242
243
|
});
|
|
243
244
|
|
|
244
245
|
it("Success (re-authenticate): GET request.", async () => {
|
|
@@ -250,11 +251,8 @@ describe("Base class tests.", () => {
|
|
|
250
251
|
|
|
251
252
|
baseFetchStub.onCall(0).returns(response401Mock);
|
|
252
253
|
baseFetchStub.onCall(1).returns(responseMock);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
data: {}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
254
|
+
|
|
255
|
+
responseMockTextStub.returns("{\"response\": {\"data\": {}}}");
|
|
258
256
|
|
|
259
257
|
await base.makeRequest(requestVerb, requestUri);
|
|
260
258
|
|
|
@@ -295,8 +293,7 @@ describe("Base class tests.", () => {
|
|
|
295
293
|
}
|
|
296
294
|
});
|
|
297
295
|
|
|
298
|
-
sinon.assert.
|
|
299
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
296
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
300
297
|
});
|
|
301
298
|
|
|
302
299
|
it("Success (re-authenticate): non-GET request.", async () => {
|
|
@@ -308,11 +305,8 @@ describe("Base class tests.", () => {
|
|
|
308
305
|
|
|
309
306
|
baseFetchStub.onCall(0).returns(response401Mock);
|
|
310
307
|
baseFetchStub.onCall(1).returns(responseMock);
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
data: {}
|
|
314
|
-
}
|
|
315
|
-
});
|
|
308
|
+
|
|
309
|
+
responseMockTextStub.returns("{\"response\": {\"data\": {}}}");
|
|
316
310
|
|
|
317
311
|
await base.makeRequest(requestVerb, requestUri, {
|
|
318
312
|
foo: "bar"
|
|
@@ -364,8 +358,7 @@ describe("Base class tests.", () => {
|
|
|
364
358
|
}
|
|
365
359
|
});
|
|
366
360
|
|
|
367
|
-
sinon.assert.
|
|
368
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
361
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
369
362
|
});
|
|
370
363
|
|
|
371
364
|
it("GET: success (payload is set).", async () => {
|
|
@@ -376,11 +369,8 @@ describe("Base class tests.", () => {
|
|
|
376
369
|
};
|
|
377
370
|
|
|
378
371
|
baseFetchStub.returns(responseMock);
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
data: {}
|
|
382
|
-
}
|
|
383
|
-
});
|
|
372
|
+
|
|
373
|
+
responseMockTextStub.returns("{\"response\": {\"data\": {}}}");
|
|
384
374
|
|
|
385
375
|
await base.makeRequest(requestVerb, requestUri, payload);
|
|
386
376
|
|
|
@@ -410,9 +400,9 @@ describe("Base class tests.", () => {
|
|
|
410
400
|
}
|
|
411
401
|
});
|
|
412
402
|
|
|
403
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
404
|
+
|
|
413
405
|
sinon.assert.notCalled(authResetTokenStub);
|
|
414
|
-
sinon.assert.notCalled(responseMockTextStub);
|
|
415
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
416
406
|
});
|
|
417
407
|
|
|
418
408
|
it("GET: success (payload is not set).", async () => {
|
|
@@ -420,11 +410,8 @@ describe("Base class tests.", () => {
|
|
|
420
410
|
const requestUri = "https://test.com";
|
|
421
411
|
|
|
422
412
|
baseFetchStub.returns(responseMock);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
data: {}
|
|
426
|
-
}
|
|
427
|
-
});
|
|
413
|
+
|
|
414
|
+
responseMockTextStub.returns("{\"response\": {\"data\": {}}}");
|
|
428
415
|
|
|
429
416
|
await base.makeRequest(requestVerb, requestUri);
|
|
430
417
|
|
|
@@ -454,9 +441,9 @@ describe("Base class tests.", () => {
|
|
|
454
441
|
}
|
|
455
442
|
});
|
|
456
443
|
|
|
444
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
445
|
+
|
|
457
446
|
sinon.assert.notCalled(authResetTokenStub);
|
|
458
|
-
sinon.assert.notCalled(responseMockTextStub);
|
|
459
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
460
447
|
});
|
|
461
448
|
|
|
462
449
|
it("Custom options for api object (timeout)", async () => {
|
|
@@ -467,11 +454,8 @@ describe("Base class tests.", () => {
|
|
|
467
454
|
};
|
|
468
455
|
|
|
469
456
|
baseFetchStub.returns(responseMock);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
data: {}
|
|
473
|
-
}
|
|
474
|
-
});
|
|
457
|
+
|
|
458
|
+
responseMockTextStub.returns("{\"response\": {\"data\": {}}}");
|
|
475
459
|
|
|
476
460
|
base.setOptions({
|
|
477
461
|
timeout: 10000,
|
|
@@ -514,9 +498,9 @@ describe("Base class tests.", () => {
|
|
|
514
498
|
timeout: 10000
|
|
515
499
|
});
|
|
516
500
|
|
|
501
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
502
|
+
|
|
517
503
|
sinon.assert.notCalled(authResetTokenStub);
|
|
518
|
-
sinon.assert.notCalled(responseMockTextStub);
|
|
519
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
520
504
|
});
|
|
521
505
|
|
|
522
506
|
it("Fail (non 200/401 response).", async () => {
|
|
@@ -534,11 +518,6 @@ describe("Base class tests.", () => {
|
|
|
534
518
|
};
|
|
535
519
|
|
|
536
520
|
baseFetchStub.returns(response400Mock);
|
|
537
|
-
responseMockJsonStub.returns({
|
|
538
|
-
response: {
|
|
539
|
-
data: {}
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
521
|
|
|
543
522
|
try {
|
|
544
523
|
await base.makeRequest(requestVerb, requestUri, payload);
|
|
@@ -584,7 +563,6 @@ describe("Base class tests.", () => {
|
|
|
584
563
|
|
|
585
564
|
sinon.assert.notCalled(authResetTokenStub);
|
|
586
565
|
sinon.assert.notCalled(responseMockTextStub);
|
|
587
|
-
sinon.assert.notCalled(responseMockJsonStub);
|
|
588
566
|
}
|
|
589
567
|
});
|
|
590
568
|
|
|
@@ -601,8 +579,8 @@ describe("Base class tests.", () => {
|
|
|
601
579
|
};
|
|
602
580
|
|
|
603
581
|
baseFetchStub.returns(responseMock);
|
|
604
|
-
|
|
605
|
-
responseMockTextStub.resolves("error");
|
|
582
|
+
responseMockTextStub.onCall(0).throws(error);
|
|
583
|
+
responseMockTextStub.onCall(1).resolves("error");
|
|
606
584
|
|
|
607
585
|
try {
|
|
608
586
|
await base.makeRequest(requestVerb, requestUri, payload);
|
|
@@ -642,8 +620,7 @@ describe("Base class tests.", () => {
|
|
|
642
620
|
});
|
|
643
621
|
|
|
644
622
|
sinon.assert.notCalled(authResetTokenStub);
|
|
645
|
-
sinon.assert.
|
|
646
|
-
sinon.assert.calledOnce(responseMockJsonStub);
|
|
623
|
+
sinon.assert.calledTwice(responseMockTextStub);
|
|
647
624
|
}
|
|
648
625
|
});
|
|
649
626
|
});
|
package/test/builder.spec.ts
CHANGED
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
|
|
package/test/mock.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-progress-item-dto.js","sourceRoot":"","sources":["../../../../api/jobs/dto/file-progress-item-dto.ts"],"names":[],"mappings":""}
|