smartling-api-sdk-nodejs 2.13.0 → 2.14.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/job-batches/dto/job-batches-parameters-mode.ts +4 -0
- package/api/job-batches/dto/job-batches-parameters-salt.ts +5 -0
- package/api/job-batches/index.ts +18 -2
- package/api/job-batches/params/cancel-batch-file-parameters.ts +1 -1
- package/api/job-batches/params/job-batches-parameters.ts +36 -0
- package/api/job-batches/params/process-batch-action-parameters.ts +2 -2
- package/api/jobs/dto/content-progress-report-item-dto.ts +1 -1
- package/built/api/job-batches/dto/job-batches-parameters-mode.d.ts +4 -0
- package/built/api/job-batches/dto/job-batches-parameters-mode.js +9 -0
- package/built/api/job-batches/dto/job-batches-parameters-mode.js.map +1 -0
- package/built/api/job-batches/dto/job-batches-parameters-salt.d.ts +5 -0
- package/built/api/job-batches/dto/job-batches-parameters-salt.js +10 -0
- package/built/api/job-batches/dto/job-batches-parameters-salt.js.map +1 -0
- package/built/api/job-batches/index.d.ts +5 -2
- package/built/api/job-batches/index.js +12 -2
- package/built/api/job-batches/index.js.map +1 -1
- package/built/api/job-batches/params/cancel-batch-file-parameters.d.ts +1 -1
- package/built/api/job-batches/params/job-batches-parameters.d.ts +10 -0
- package/built/api/job-batches/params/job-batches-parameters.js +32 -0
- package/built/api/job-batches/params/job-batches-parameters.js.map +1 -0
- package/built/api/job-batches/params/process-batch-action-parameters.d.ts +2 -2
- package/built/api/job-batches/params/process-batch-action-parameters.js +2 -2
- package/built/api/job-batches/params/process-batch-action-parameters.js.map +1 -1
- package/built/api/jobs/dto/content-progress-report-item-dto.d.ts +1 -1
- package/built/index.d.ts +3 -0
- package/built/index.js +3 -0
- package/built/index.js.map +1 -1
- package/built/package.json +7 -6
- package/index.ts +3 -0
- package/package.json +7 -6
- package/test/job-batches.spec.ts +34 -3
- package/tsconfig.json +2 -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=AZI0HTSteTFUeF_dKNmO
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZI0HTSteTFUeF_dKNmO
|
package/api/job-batches/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import FormData from "form-data";
|
|
2
|
-
import { SmartlingBaseApi } from "../base
|
|
3
|
-
import { SmartlingAuthApi } from "../auth
|
|
2
|
+
import { SmartlingBaseApi } from "../base";
|
|
3
|
+
import { SmartlingAuthApi } from "../auth";
|
|
4
4
|
import { Logger } from "../logger";
|
|
5
5
|
import { CreateBatchParameters } from "./params/create-batch-parameters";
|
|
6
6
|
import { UploadBatchFileParameters } from "./params/upload-batch-file-parameters";
|
|
@@ -11,6 +11,8 @@ import { RegisterBatchFileParameters } from "./params/register-batch-file-parame
|
|
|
11
11
|
import { BatchListItemDto } from "./dto/batch-list-item-dto";
|
|
12
12
|
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
13
13
|
import { ListBatchesParameters } from "./params/list-batches-parameters";
|
|
14
|
+
import { BaseJobDto } from "../jobs/dto/base-job-dto";
|
|
15
|
+
import { JobBatchesParameters } from "./params/job-batches-parameters";
|
|
14
16
|
|
|
15
17
|
export class SmartlingJobBatchesApi extends SmartlingBaseApi {
|
|
16
18
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
|
|
@@ -49,6 +51,20 @@ export class SmartlingJobBatchesApi extends SmartlingBaseApi {
|
|
|
49
51
|
);
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
async createJob(
|
|
55
|
+
projectId: string, nameTemplate: string, params: JobBatchesParameters
|
|
56
|
+
): Promise<BaseJobDto> {
|
|
57
|
+
if (params === undefined) {
|
|
58
|
+
params = new JobBatchesParameters();
|
|
59
|
+
}
|
|
60
|
+
params.set("nameTemplate", nameTemplate);
|
|
61
|
+
return await this.makeRequest(
|
|
62
|
+
"post",
|
|
63
|
+
`${this.entrypoint}/${projectId}/jobs`,
|
|
64
|
+
JSON.stringify(params.export())
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
52
68
|
async registerBatchFile(
|
|
53
69
|
projectId: string, batchUid: string, params: RegisterBatchFileParameters
|
|
54
70
|
): Promise<BatchDto> {
|
|
@@ -11,7 +11,7 @@ export class CancelBatchFileParameters extends ProcessBatchActionParameters {
|
|
|
11
11
|
this.set("action", BatchAction.CANCEL_FILE);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
setReason(reason: string):
|
|
14
|
+
setReason(reason: string): this {
|
|
15
15
|
this.set("reason", reason);
|
|
16
16
|
|
|
17
17
|
return this;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { SmartlingException } from "../../exception";
|
|
3
|
+
import { JobBatchesParametersMode } from "../dto/job-batches-parameters-mode";
|
|
4
|
+
import { JobBatchesParametersSalt } from "../dto/job-batches-parameters-salt";
|
|
5
|
+
|
|
6
|
+
export class JobBatchesParameters extends BaseParameters {
|
|
7
|
+
setDescription(description: string): this {
|
|
8
|
+
if (description.length >= 2000) {
|
|
9
|
+
throw new SmartlingException("Job description should be less than 2000 characters.");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
this.set("description", description);
|
|
13
|
+
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
setTargetLocaleIds(targetLocaleIds: string[]): this {
|
|
17
|
+
this.set("targetLocaleIds", targetLocaleIds);
|
|
18
|
+
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
setMode(mode: JobBatchesParametersMode): this {
|
|
22
|
+
this.set("mode", mode);
|
|
23
|
+
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
setSalt(salt: JobBatchesParametersSalt): this {
|
|
27
|
+
this.set("salt", salt);
|
|
28
|
+
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
setTimeZoneName(timeZoneName: string): this {
|
|
32
|
+
this.set("timeZoneName", timeZoneName);
|
|
33
|
+
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseParameters } from "../../parameters
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
2
|
|
|
3
3
|
export class ProcessBatchActionParameters extends BaseParameters {
|
|
4
|
-
setFileUri(fileUri: string):
|
|
4
|
+
setFileUri(fileUri: string): this {
|
|
5
5
|
this.set("fileUri", fileUri);
|
|
6
6
|
|
|
7
7
|
return this;
|
|
@@ -5,7 +5,7 @@ import { SummaryReportItemDto } from "./summary-report-item-dto";
|
|
|
5
5
|
interface ContentProgressReportItemDto {
|
|
6
6
|
targetLocaleDescription: string;
|
|
7
7
|
targetLocaleId: string;
|
|
8
|
-
|
|
8
|
+
unauthorizedProgressReport: {
|
|
9
9
|
stringCount: number;
|
|
10
10
|
wordCount: number;
|
|
11
11
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobBatchesParametersMode = void 0;
|
|
4
|
+
var JobBatchesParametersMode;
|
|
5
|
+
(function (JobBatchesParametersMode) {
|
|
6
|
+
JobBatchesParametersMode["CREATE_NEW"] = "CREATE_NEW";
|
|
7
|
+
JobBatchesParametersMode["REUSE_EXISTING"] = "REUSE_EXISTING";
|
|
8
|
+
})(JobBatchesParametersMode = exports.JobBatchesParametersMode || (exports.JobBatchesParametersMode = {}));
|
|
9
|
+
//# sourceMappingURL=job-batches-parameters-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-batches-parameters-mode.js","sourceRoot":"","sources":["../../../../api/job-batches/dto/job-batches-parameters-mode.ts"],"names":[],"mappings":";;;AAAA,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAChC,qDAAyB,CAAA;IACzB,6DAAiC,CAAA;AACrC,CAAC,EAHW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAGnC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobBatchesParametersSalt = void 0;
|
|
4
|
+
var JobBatchesParametersSalt;
|
|
5
|
+
(function (JobBatchesParametersSalt) {
|
|
6
|
+
JobBatchesParametersSalt["ORDINAL"] = "ORDINAL";
|
|
7
|
+
JobBatchesParametersSalt["TIMESTAMP"] = "TIMESTAMP";
|
|
8
|
+
JobBatchesParametersSalt["RANDOM_ALPHANUMERIC"] = "RANDOM_ALPHANUMERIC";
|
|
9
|
+
})(JobBatchesParametersSalt = exports.JobBatchesParametersSalt || (exports.JobBatchesParametersSalt = {}));
|
|
10
|
+
//# sourceMappingURL=job-batches-parameters-salt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-batches-parameters-salt.js","sourceRoot":"","sources":["../../../../api/job-batches/dto/job-batches-parameters-salt.ts"],"names":[],"mappings":";;;AAAA,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAChC,+CAAmB,CAAA;IACnB,mDAAuB,CAAA;IACvB,uEAA2C,CAAA;AAC/C,CAAC,EAJW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAInC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SmartlingBaseApi } from "../base
|
|
2
|
-
import { SmartlingAuthApi } from "../auth
|
|
1
|
+
import { SmartlingBaseApi } from "../base";
|
|
2
|
+
import { SmartlingAuthApi } from "../auth";
|
|
3
3
|
import { Logger } from "../logger";
|
|
4
4
|
import { CreateBatchParameters } from "./params/create-batch-parameters";
|
|
5
5
|
import { UploadBatchFileParameters } from "./params/upload-batch-file-parameters";
|
|
@@ -10,10 +10,13 @@ import { RegisterBatchFileParameters } from "./params/register-batch-file-parame
|
|
|
10
10
|
import { BatchListItemDto } from "./dto/batch-list-item-dto";
|
|
11
11
|
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
12
12
|
import { ListBatchesParameters } from "./params/list-batches-parameters";
|
|
13
|
+
import { BaseJobDto } from "../jobs/dto/base-job-dto";
|
|
14
|
+
import { JobBatchesParameters } from "./params/job-batches-parameters";
|
|
13
15
|
export declare class SmartlingJobBatchesApi extends SmartlingBaseApi {
|
|
14
16
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
|
|
15
17
|
alterRequestData(uri: string, opts: Record<string, unknown>): Record<string, unknown>;
|
|
16
18
|
createBatch(projectId: string, params: CreateBatchParameters): Promise<BatchDto>;
|
|
19
|
+
createJob(projectId: string, nameTemplate: string, params: JobBatchesParameters): Promise<BaseJobDto>;
|
|
17
20
|
registerBatchFile(projectId: string, batchUid: string, params: RegisterBatchFileParameters): Promise<BatchDto>;
|
|
18
21
|
cancelBatchFile(projectId: string, batchUid: string, params: CancelBatchFileParameters): Promise<BatchDto>;
|
|
19
22
|
uploadBatchFile(projectId: string, batchUid: string, params: UploadBatchFileParameters): Promise<boolean>;
|
|
@@ -14,8 +14,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SmartlingJobBatchesApi = void 0;
|
|
16
16
|
const form_data_1 = __importDefault(require("form-data"));
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
const base_1 = require("../base");
|
|
18
|
+
const job_batches_parameters_1 = require("./params/job-batches-parameters");
|
|
19
|
+
class SmartlingJobBatchesApi extends base_1.SmartlingBaseApi {
|
|
19
20
|
constructor(smartlingApiBaseUrl, authApi, logger) {
|
|
20
21
|
super(logger);
|
|
21
22
|
this.authApi = authApi;
|
|
@@ -44,6 +45,15 @@ class SmartlingJobBatchesApi extends index_1.SmartlingBaseApi {
|
|
|
44
45
|
return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/batches`, JSON.stringify(params.export()));
|
|
45
46
|
});
|
|
46
47
|
}
|
|
48
|
+
createJob(projectId, nameTemplate, params) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (params === undefined) {
|
|
51
|
+
params = new job_batches_parameters_1.JobBatchesParameters();
|
|
52
|
+
}
|
|
53
|
+
params.set("nameTemplate", nameTemplate);
|
|
54
|
+
return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/jobs`, JSON.stringify(params.export()));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
47
57
|
registerBatchFile(projectId, batchUid, params) {
|
|
48
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
59
|
return yield this.makeRequest("put", `${this.entrypoint}/${projectId}/batches/${batchUid}`, JSON.stringify(params.export()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/job-batches/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/job-batches/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,kCAA2C;AAa3C,4EAAuE;AAEvE,MAAa,sBAAuB,SAAQ,uBAAgB;IACxD,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,8BAA8B,CAAC;IAC3E,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UAAU,IAAI,SAAS,UAAU,EACzC,MAAM,CAAC,MAAM,EAAE,CAElB,CAAC;QACN,CAAC;KAAA;CACJ;AAjGD,wDAiGC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProcessBatchActionParameters } from "./process-batch-action-parameters";
|
|
2
2
|
export declare class CancelBatchFileParameters extends ProcessBatchActionParameters {
|
|
3
3
|
constructor(parameters?: Record<string, any>);
|
|
4
|
-
setReason(reason: string):
|
|
4
|
+
setReason(reason: string): this;
|
|
5
5
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { JobBatchesParametersMode } from "../dto/job-batches-parameters-mode";
|
|
3
|
+
import { JobBatchesParametersSalt } from "../dto/job-batches-parameters-salt";
|
|
4
|
+
export declare class JobBatchesParameters extends BaseParameters {
|
|
5
|
+
setDescription(description: string): this;
|
|
6
|
+
setTargetLocaleIds(targetLocaleIds: string[]): this;
|
|
7
|
+
setMode(mode: JobBatchesParametersMode): this;
|
|
8
|
+
setSalt(salt: JobBatchesParametersSalt): this;
|
|
9
|
+
setTimeZoneName(timeZoneName: string): this;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobBatchesParameters = void 0;
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
const exception_1 = require("../../exception");
|
|
6
|
+
class JobBatchesParameters extends parameters_1.BaseParameters {
|
|
7
|
+
setDescription(description) {
|
|
8
|
+
if (description.length >= 2000) {
|
|
9
|
+
throw new exception_1.SmartlingException("Job description should be less than 2000 characters.");
|
|
10
|
+
}
|
|
11
|
+
this.set("description", description);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
setTargetLocaleIds(targetLocaleIds) {
|
|
15
|
+
this.set("targetLocaleIds", targetLocaleIds);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
setMode(mode) {
|
|
19
|
+
this.set("mode", mode);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
setSalt(salt) {
|
|
23
|
+
this.set("salt", salt);
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
setTimeZoneName(timeZoneName) {
|
|
27
|
+
this.set("timeZoneName", timeZoneName);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.JobBatchesParameters = JobBatchesParameters;
|
|
32
|
+
//# sourceMappingURL=job-batches-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-batches-parameters.js","sourceRoot":"","sources":["../../../../api/job-batches/params/job-batches-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAIrD,MAAa,oBAAqB,SAAQ,2BAAc;IACpD,cAAc,CAAC,WAAmB;QAC9B,IAAI,WAAW,CAAC,MAAM,IAAI,IAAI,EAAE;YAC5B,MAAM,IAAI,8BAAkB,CAAC,sDAAsD,CAAC,CAAC;SACxF;QAED,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,kBAAkB,CAAC,eAAyB;QACxC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAE7C,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,CAAC,IAA8B;QAClC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEvB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,CAAC,IAA8B;QAClC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEvB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,eAAe,CAAC,YAAoB;QAChC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA9BD,oDA8BC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseParameters } from "../../parameters
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
2
|
export declare class ProcessBatchActionParameters extends BaseParameters {
|
|
3
|
-
setFileUri(fileUri: string):
|
|
3
|
+
setFileUri(fileUri: string): this;
|
|
4
4
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProcessBatchActionParameters = void 0;
|
|
4
|
-
const
|
|
5
|
-
class ProcessBatchActionParameters extends
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
class ProcessBatchActionParameters extends parameters_1.BaseParameters {
|
|
6
6
|
setFileUri(fileUri) {
|
|
7
7
|
this.set("fileUri", fileUri);
|
|
8
8
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-batch-action-parameters.js","sourceRoot":"","sources":["../../../../api/job-batches/params/process-batch-action-parameters.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"process-batch-action-parameters.js","sourceRoot":"","sources":["../../../../api/job-batches/params/process-batch-action-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAElD,MAAa,4BAA6B,SAAQ,2BAAc;IAC5D,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAND,oEAMC"}
|
|
@@ -4,7 +4,7 @@ import { SummaryReportItemDto } from "./summary-report-item-dto";
|
|
|
4
4
|
interface ContentProgressReportItemDto {
|
|
5
5
|
targetLocaleDescription: string;
|
|
6
6
|
targetLocaleId: string;
|
|
7
|
-
|
|
7
|
+
unauthorizedProgressReport: {
|
|
8
8
|
stringCount: number;
|
|
9
9
|
wordCount: number;
|
|
10
10
|
};
|
package/built/index.d.ts
CHANGED
|
@@ -45,7 +45,10 @@ export * from "./api/job-batches/dto/batch-item-dto";
|
|
|
45
45
|
export * from "./api/job-batches/dto/batch-locale-dto";
|
|
46
46
|
export * from "./api/job-batches/dto/batch-status-dto";
|
|
47
47
|
export * from "./api/job-batches/dto/batch-list-item-dto";
|
|
48
|
+
export * from "./api/job-batches/dto/job-batches-parameters-mode";
|
|
49
|
+
export * from "./api/job-batches/dto/job-batches-parameters-salt";
|
|
48
50
|
export * from "./api/job-batches/params/create-batch-parameters";
|
|
51
|
+
export * from "./api/job-batches/params/job-batches-parameters";
|
|
49
52
|
export * from "./api/job-batches/params/upload-batch-file-parameters";
|
|
50
53
|
export * from "./api/job-batches/params/process-batch-action-parameters";
|
|
51
54
|
export * from "./api/job-batches/params/cancel-batch-file-parameters";
|
package/built/index.js
CHANGED
|
@@ -61,7 +61,10 @@ __exportStar(require("./api/job-batches/dto/batch-item-dto"), exports);
|
|
|
61
61
|
__exportStar(require("./api/job-batches/dto/batch-locale-dto"), exports);
|
|
62
62
|
__exportStar(require("./api/job-batches/dto/batch-status-dto"), exports);
|
|
63
63
|
__exportStar(require("./api/job-batches/dto/batch-list-item-dto"), exports);
|
|
64
|
+
__exportStar(require("./api/job-batches/dto/job-batches-parameters-mode"), exports);
|
|
65
|
+
__exportStar(require("./api/job-batches/dto/job-batches-parameters-salt"), exports);
|
|
64
66
|
__exportStar(require("./api/job-batches/params/create-batch-parameters"), exports);
|
|
67
|
+
__exportStar(require("./api/job-batches/params/job-batches-parameters"), exports);
|
|
65
68
|
__exportStar(require("./api/job-batches/params/upload-batch-file-parameters"), exports);
|
|
66
69
|
__exportStar(require("./api/job-batches/params/process-batch-action-parameters"), exports);
|
|
67
70
|
__exportStar(require("./api/job-batches/params/cancel-batch-file-parameters"), exports);
|
package/built/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","s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AwD;AACxD,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,8DAA4C;AAC5C,+EAA6D;AAC7D,mGAAiF;AACjF,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,uFAAqE;AACrE,+CAA6B;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D;AAC3D,gEAA8C;AAC9C,2EAAyD;AACzD,yEAAuD;AACvD,8DAA4C;AAC5C,mEAAiD;AACjD,8EAA4D;AAC5D,sDAAoC"}
|
|
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,gEAA8C;AAC9C,4FAA0E;AAC1E,2FAAyE;AACzE,oEAAkD;AAClD,oFAAkE;AAClE,qFAAmE;AACnE,uFAAqE;AACrE,4FAA0E;AAC1E,2EAAyD;AACzD,uEAAqD;AACrD,8EAA4D;AAC5D,4FAA0E;AAC1E,qFAAmE;AACnE,oDAAkC;AAClC,8EAA4D;AAC5D,6EAA2D;AAC3D,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,4EAA0D;AAC1D,oFAAkE;AAClE,oFAAkE;AAClE,mFAAiE;AACjE,kFAAgE;AAChE,wFAAsE;AACtE,2FAAyE;AACzE,wFAAsE;AACtE,0FAAwE;AACxE,wEAAsD;AACtD,wEAAsD;AACtD,mFAAiE;AACjE,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,oEAAkD;AAClD,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,8DAA4C;AAC5C,+EAA6D;AAC7D,mGAAiF;AACjF,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,uFAAqE;AACrE,+CAA6B;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D;AAC3D,gEAA8C;AAC9C,2EAAyD;AACzD,yEAAuD;AACvD,8DAA4C;AAC5C,mEAAiD;AACjD,8EAA4D;AAC5D,sDAAoC"}
|
package/built/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartling-api-sdk-nodejs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"homepage": "https://github.com/Smartling/api-sdk-nodejs#readme",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@types/node": "^16.4.7",
|
|
32
|
+
"@types/mocha": "^9.0.0",
|
|
32
33
|
"cross-fetch": "^3.1.4",
|
|
33
34
|
"default-user-agent": "^1.0.0",
|
|
34
35
|
"form-data": "^4.0.0",
|
|
@@ -38,8 +39,11 @@
|
|
|
38
39
|
"typescript": "^4.3.5"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
43
|
+
"@typescript-eslint/parser": "^4.29.0",
|
|
44
|
+
"ansi-regex": "^5.0.1",
|
|
42
45
|
"babel-eslint": "^8.2.1",
|
|
46
|
+
"eslint": "^7.31.0",
|
|
43
47
|
"eslint-config-airbnb": "^16.1.0",
|
|
44
48
|
"eslint-plugin-flowtype": "^2.41.0",
|
|
45
49
|
"eslint-plugin-fp": "^2.3.0",
|
|
@@ -47,14 +51,11 @@
|
|
|
47
51
|
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
48
52
|
"eslint-plugin-promise": "^3.6.0",
|
|
49
53
|
"eslint-plugin-react": "^7.10.0",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
51
|
-
"@typescript-eslint/parser": "^4.29.0",
|
|
52
|
-
"eslint": "^7.31.0",
|
|
53
54
|
"mocha": "^9.1.3",
|
|
54
55
|
"mocha-junit-reporter": "^2.0.2",
|
|
55
56
|
"nyc": "^15.1.0",
|
|
56
57
|
"sinon": "^11.1.2",
|
|
57
|
-
"
|
|
58
|
+
"ts-mocha": "^10.0.0"
|
|
58
59
|
},
|
|
59
60
|
"nyc": {
|
|
60
61
|
"reporter": [
|
package/index.ts
CHANGED
|
@@ -45,7 +45,10 @@ export * from "./api/job-batches/dto/batch-item-dto";
|
|
|
45
45
|
export * from "./api/job-batches/dto/batch-locale-dto";
|
|
46
46
|
export * from "./api/job-batches/dto/batch-status-dto";
|
|
47
47
|
export * from "./api/job-batches/dto/batch-list-item-dto";
|
|
48
|
+
export * from "./api/job-batches/dto/job-batches-parameters-mode";
|
|
49
|
+
export * from "./api/job-batches/dto/job-batches-parameters-salt";
|
|
48
50
|
export * from "./api/job-batches/params/create-batch-parameters";
|
|
51
|
+
export * from "./api/job-batches/params/job-batches-parameters";
|
|
49
52
|
export * from "./api/job-batches/params/upload-batch-file-parameters";
|
|
50
53
|
export * from "./api/job-batches/params/process-batch-action-parameters";
|
|
51
54
|
export * from "./api/job-batches/params/cancel-batch-file-parameters";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartling-api-sdk-nodejs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"homepage": "https://github.com/Smartling/api-sdk-nodejs#readme",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@types/node": "^16.4.7",
|
|
32
|
+
"@types/mocha": "^9.0.0",
|
|
32
33
|
"cross-fetch": "^3.1.4",
|
|
33
34
|
"default-user-agent": "^1.0.0",
|
|
34
35
|
"form-data": "^4.0.0",
|
|
@@ -38,8 +39,11 @@
|
|
|
38
39
|
"typescript": "^4.3.5"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
43
|
+
"@typescript-eslint/parser": "^4.29.0",
|
|
44
|
+
"ansi-regex": "^5.0.1",
|
|
42
45
|
"babel-eslint": "^8.2.1",
|
|
46
|
+
"eslint": "^7.31.0",
|
|
43
47
|
"eslint-config-airbnb": "^16.1.0",
|
|
44
48
|
"eslint-plugin-flowtype": "^2.41.0",
|
|
45
49
|
"eslint-plugin-fp": "^2.3.0",
|
|
@@ -47,14 +51,11 @@
|
|
|
47
51
|
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
48
52
|
"eslint-plugin-promise": "^3.6.0",
|
|
49
53
|
"eslint-plugin-react": "^7.10.0",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
51
|
-
"@typescript-eslint/parser": "^4.29.0",
|
|
52
|
-
"eslint": "^7.31.0",
|
|
53
54
|
"mocha": "^9.1.3",
|
|
54
55
|
"mocha-junit-reporter": "^2.0.2",
|
|
55
56
|
"nyc": "^15.1.0",
|
|
56
57
|
"sinon": "^11.1.2",
|
|
57
|
-
"
|
|
58
|
+
"ts-mocha": "^10.0.0"
|
|
58
59
|
},
|
|
59
60
|
"nyc": {
|
|
60
61
|
"reporter": [
|
package/test/job-batches.spec.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import sinon from "sinon";
|
|
3
3
|
import assert from "assert";
|
|
4
|
-
import {
|
|
5
|
-
import { SmartlingJobBatchesApi } from "../api/job-batches
|
|
6
|
-
import { SmartlingAuthApi } from "../api/auth
|
|
4
|
+
import { authMock, loggerMock, responseMock } from "./mock";
|
|
5
|
+
import { SmartlingJobBatchesApi } from "../api/job-batches";
|
|
6
|
+
import { SmartlingAuthApi } from "../api/auth";
|
|
7
7
|
import { CreateBatchParameters } from "../api/job-batches/params/create-batch-parameters";
|
|
8
8
|
import { UploadBatchFileParameters } from "../api/job-batches/params/upload-batch-file-parameters";
|
|
9
9
|
import { FileType } from "../api/files/params/file-type";
|
|
@@ -13,6 +13,9 @@ import { streamToString } from "./stream-to-string";
|
|
|
13
13
|
import { ListBatchesParameters } from "../api/job-batches/params/list-batches-parameters";
|
|
14
14
|
import { Order } from "../api/parameters/order";
|
|
15
15
|
import { BatchStatus } from "../api/job-batches/params/batch-status";
|
|
16
|
+
import { JobBatchesParameters } from "../api/job-batches/params/job-batches-parameters";
|
|
17
|
+
import { JobBatchesParametersMode } from "../api/job-batches/dto/job-batches-parameters-mode";
|
|
18
|
+
import { JobBatchesParametersSalt } from "../api/job-batches/dto/job-batches-parameters-salt";
|
|
16
19
|
|
|
17
20
|
describe("SmartlingJobBatchesAPI class tests.", () => {
|
|
18
21
|
const projectId = "testProjectId";
|
|
@@ -96,6 +99,34 @@ describe("SmartlingJobBatchesAPI class tests.", () => {
|
|
|
96
99
|
);
|
|
97
100
|
});
|
|
98
101
|
|
|
102
|
+
it("should call api when creating job", async () => {
|
|
103
|
+
await jobBatchesApi.createJob(
|
|
104
|
+
projectId,
|
|
105
|
+
"jobNameTemplate",
|
|
106
|
+
new JobBatchesParameters()
|
|
107
|
+
.setDescription("testDescription")
|
|
108
|
+
.setMode(JobBatchesParametersMode.CREATE_NEW)
|
|
109
|
+
.setSalt(JobBatchesParametersSalt.RANDOM_ALPHANUMERIC)
|
|
110
|
+
.setTargetLocaleIds(["locale1", "locale2"])
|
|
111
|
+
.setTimeZoneName("testTimeZoneName")
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
sinon.assert.calledOnce(jobBatchesApiFetchStub);
|
|
115
|
+
sinon.assert.calledWithExactly(
|
|
116
|
+
jobBatchesApiFetchStub,
|
|
117
|
+
`https://test.com/job-batches-api/v2/projects/${projectId}/jobs`,
|
|
118
|
+
{
|
|
119
|
+
method: "post",
|
|
120
|
+
headers: {
|
|
121
|
+
Authorization: "test_token_type test_access_token",
|
|
122
|
+
"Content-Type": "application/json",
|
|
123
|
+
"User-Agent": "test_user_agent"
|
|
124
|
+
},
|
|
125
|
+
body: "{\"description\":\"testDescription\",\"mode\":\"CREATE_NEW\",\"salt\":\"RANDOM_ALPHANUMERIC\",\"targetLocaleIds\":[\"locale1\",\"locale2\"],\"timeZoneName\":\"testTimeZoneName\",\"nameTemplate\":\"jobNameTemplate\"}"
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
99
130
|
it("Register batch file action", async () => {
|
|
100
131
|
const params = new RegisterBatchFileParameters();
|
|
101
132
|
|