smartling-api-sdk-nodejs 1.2.2 → 1.2.5
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/.eslintrc +62 -3
- package/.scannerwork/report-task.txt +2 -2
- package/api/exception/index.ts +8 -0
- package/api/jobs/index.ts +11 -0
- package/api/jobs/params/cancel-job-parameters.ts +9 -0
- package/built/api/exception/index.d.ts +2 -0
- package/built/api/exception/index.js +6 -0
- package/built/api/exception/index.js.map +1 -1
- package/built/api/files/params/upload-file-parameters.js +5 -1
- package/built/api/files/params/upload-file-parameters.js.map +1 -1
- package/built/api/job-batches/params/upload-batch-file-parameters.js +5 -1
- package/built/api/job-batches/params/upload-batch-file-parameters.js.map +1 -1
- package/built/api/jobs/index.d.ts +2 -0
- package/built/api/jobs/index.js +5 -0
- package/built/api/jobs/index.js.map +1 -1
- package/built/api/jobs/params/cancel-job-parameters.d.ts +4 -0
- package/built/api/jobs/params/cancel-job-parameters.js +12 -0
- package/built/api/jobs/params/cancel-job-parameters.js.map +1 -0
- package/built/index.d.ts +1 -0
- package/built/index.js +6 -1
- package/built/index.js.map +1 -1
- package/built/package.json +10 -3
- package/index.ts +1 -0
- package/package.json +10 -3
- package/test/exception.spec.ts +3 -0
- package/test/jobs.spec.ts +24 -0
- package/tsconfig.json +1 -2
package/.eslintrc
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
root: true,
|
|
3
3
|
parser: "@typescript-eslint/parser",
|
|
4
4
|
plugins: [
|
|
5
|
-
"@typescript-eslint"
|
|
5
|
+
"@typescript-eslint",
|
|
6
|
+
"flowtype",
|
|
7
|
+
"react",
|
|
8
|
+
"jsx-a11y",
|
|
9
|
+
"import",
|
|
10
|
+
"promise",
|
|
11
|
+
"fp"
|
|
6
12
|
],
|
|
7
13
|
extends: [
|
|
8
|
-
"
|
|
14
|
+
"airbnb",
|
|
15
|
+
"plugin:flowtype/recommended",
|
|
16
|
+
"plugin:jsx-a11y/recommended",
|
|
9
17
|
"eslint:recommended",
|
|
10
18
|
"plugin:@typescript-eslint/eslint-recommended",
|
|
11
19
|
"plugin:@typescript-eslint/recommended"
|
|
@@ -21,6 +29,57 @@
|
|
|
21
29
|
"no-return-await": "off",
|
|
22
30
|
"import/extensions": "off",
|
|
23
31
|
"no-shadow": "off",
|
|
24
|
-
"@typescript-eslint/no-shadow": "error"
|
|
32
|
+
"@typescript-eslint/no-shadow": "error",
|
|
33
|
+
"comma-dangle": ["error", "never"],
|
|
34
|
+
"import/prefer-default-export": "off",
|
|
35
|
+
"import/no-extraneous-dependencies": [
|
|
36
|
+
"error",
|
|
37
|
+
{ devDependencies: true }
|
|
38
|
+
],
|
|
39
|
+
indent: ["error", 4],
|
|
40
|
+
"no-confusing-arrow": "off",
|
|
41
|
+
"no-param-reassign": "off",
|
|
42
|
+
"quote-props": ["error", "as-needed", { numbers: true }],
|
|
43
|
+
quotes: [2, "double"],
|
|
44
|
+
"space-before-function-paren": ["off", "never"],
|
|
45
|
+
"fp/no-arguments": "error",
|
|
46
|
+
"fp/no-delete": "error",
|
|
47
|
+
"fp/no-mutating-methods": ["error", { allowedObjects: ["R", "EditorState"] }],
|
|
48
|
+
"function-paren-newline": ["off", "never"],
|
|
49
|
+
"object-curly-newline": ["off", "never"],
|
|
50
|
+
"prefer-destructuring": ["error", {
|
|
51
|
+
VariableDeclarator: {
|
|
52
|
+
array: false,
|
|
53
|
+
object: true
|
|
54
|
+
},
|
|
55
|
+
AssignmentExpression: {
|
|
56
|
+
array: false,
|
|
57
|
+
object: true
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
enforceForRenamedProperties: false
|
|
61
|
+
}],
|
|
62
|
+
"jsx-a11y/click-events-have-key-events": "off",
|
|
63
|
+
"jsx-a11y/mouse-events-have-key-events": "off",
|
|
64
|
+
"jsx-a11y/no-static-element-interactions": "off",
|
|
65
|
+
"promise/catch-or-return": "error",
|
|
66
|
+
"react/jsx-boolean-value": "off",
|
|
67
|
+
"react/jsx-filename-extension": "off",
|
|
68
|
+
"react/jsx-indent": ["error", 4],
|
|
69
|
+
"react/jsx-indent-props": ["error", 4],
|
|
70
|
+
"react/no-unescaped-entities": "off",
|
|
71
|
+
"react/prefer-stateless-function": "off",
|
|
72
|
+
"react/require-default-props": "off"
|
|
73
|
+
},
|
|
74
|
+
env: {
|
|
75
|
+
browser: true,
|
|
76
|
+
commonjs: true,
|
|
77
|
+
mocha: true
|
|
78
|
+
},
|
|
79
|
+
globals: {
|
|
80
|
+
sinon: true,
|
|
81
|
+
suite: true,
|
|
82
|
+
benchmark: true,
|
|
83
|
+
i18n: true
|
|
25
84
|
}
|
|
26
85
|
}
|
|
@@ -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=AYGFokOJdDCRpKLS8OFO
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYGFokOJdDCRpKLS8OFO
|
package/api/exception/index.ts
CHANGED
|
@@ -7,6 +7,14 @@ class SmartlingException extends Error {
|
|
|
7
7
|
this.payload = payload;
|
|
8
8
|
this.nestedException = e;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
public getPayload(): Record<string, unknown> {
|
|
12
|
+
return this.payload;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public getNestedException(): Error {
|
|
16
|
+
return this.nestedException;
|
|
17
|
+
}
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
SmartlingException.prototype.toString = function smartlingExceptionToString() {
|
package/api/jobs/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { SourceFileDto } from "./dto/source-file-dto";
|
|
|
15
15
|
import { RemovedFileDto } from "./dto/removed-file-dto";
|
|
16
16
|
import { JobProgressDto } from "./dto/job-progress-dto";
|
|
17
17
|
import { JobProgressParameters } from "./params/job-progress-parameters";
|
|
18
|
+
import { CancelJobParameters } from "./params/cancel-job-parameters";
|
|
18
19
|
|
|
19
20
|
export class SmartlingJobsApi extends SmartlingBaseApi {
|
|
20
21
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
|
|
@@ -96,4 +97,14 @@ export class SmartlingJobsApi extends SmartlingBaseApi {
|
|
|
96
97
|
params.export()
|
|
97
98
|
);
|
|
98
99
|
}
|
|
100
|
+
|
|
101
|
+
async cancelJob(
|
|
102
|
+
projectId: string, translationJobUid: string, params: CancelJobParameters
|
|
103
|
+
): Promise<void> {
|
|
104
|
+
await this.makeRequest(
|
|
105
|
+
"post",
|
|
106
|
+
`${this.entrypoint}/${projectId}/jobs/${translationJobUid}/cancel`,
|
|
107
|
+
JSON.stringify(params.export())
|
|
108
|
+
);
|
|
109
|
+
}
|
|
99
110
|
}
|
|
@@ -2,5 +2,7 @@ declare class SmartlingException extends Error {
|
|
|
2
2
|
protected payload: Record<string, unknown>;
|
|
3
3
|
protected nestedException: Error;
|
|
4
4
|
constructor(message: string, payload?: Record<string, unknown>, e?: Error);
|
|
5
|
+
getPayload(): Record<string, unknown>;
|
|
6
|
+
getNestedException(): Error;
|
|
5
7
|
}
|
|
6
8
|
export { SmartlingException };
|
|
@@ -7,6 +7,12 @@ class SmartlingException extends Error {
|
|
|
7
7
|
this.payload = payload;
|
|
8
8
|
this.nestedException = e;
|
|
9
9
|
}
|
|
10
|
+
getPayload() {
|
|
11
|
+
return this.payload;
|
|
12
|
+
}
|
|
13
|
+
getNestedException() {
|
|
14
|
+
return this.nestedException;
|
|
15
|
+
}
|
|
10
16
|
}
|
|
11
17
|
exports.SmartlingException = SmartlingException;
|
|
12
18
|
SmartlingException.prototype.toString = function smartlingExceptionToString() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/exception/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAmB,SAAQ,KAAK;IAIlC,YAAY,OAAe,EAAE,UAAmC,EAAE,EAAE,IAAW,IAAI;QAC/E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IAC7B,CAAC;CACJ;AAMQ,gDAAkB;AAJ3B,kBAAkB,CAAC,SAAS,CAAC,QAAQ,GAAG,SAAS,0BAA0B;IACvE,OAAO,GAAG,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAClJ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/exception/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAmB,SAAQ,KAAK;IAIlC,YAAY,OAAe,EAAE,UAAmC,EAAE,EAAE,IAAW,IAAI;QAC/E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IAC7B,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAEM,kBAAkB;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;CACJ;AAMQ,gDAAkB;AAJ3B,kBAAkB,CAAC,SAAS,CAAC,QAAQ,GAAG,SAAS,0BAA0B;IACvE,OAAO,GAAG,IAAI,CAAC,OAAO,aAAa,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAClJ,CAAC,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/upload-file-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-file-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/upload-file-parameters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,kFAAsD;AACtD,kDAAwD;AAGxD,MAAa,oBAAqB,SAAQ,sBAAc;IACpD,YAAY,CAAC,GAAW,EAAE,KAAa;QACnC,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;QAEpC,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;QACH,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;QACH,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,cAAc,CAAC,WAAmB;QAC9B,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAA,+BAAiB,EAAC,WAAW,CAAC,CAAC,CAAC;QAEjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,QAAkB;QAC1B,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAzCD,oDAyCC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -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","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C,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"}
|
|
@@ -15,6 +15,7 @@ import { SourceFileDto } from "./dto/source-file-dto";
|
|
|
15
15
|
import { RemovedFileDto } from "./dto/removed-file-dto";
|
|
16
16
|
import { JobProgressDto } from "./dto/job-progress-dto";
|
|
17
17
|
import { JobProgressParameters } from "./params/job-progress-parameters";
|
|
18
|
+
import { CancelJobParameters } from "./params/cancel-job-parameters";
|
|
18
19
|
export declare class SmartlingJobsApi extends SmartlingBaseApi {
|
|
19
20
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
|
|
20
21
|
createJob(projectId: string, params: CreateJobParameters): Promise<JobDto>;
|
|
@@ -25,4 +26,5 @@ export declare class SmartlingJobsApi extends SmartlingBaseApi {
|
|
|
25
26
|
removeFileFromJob(projectId: string, translationJobUid: string, params: RemoveFileParameters): Promise<RemovedFileDto>;
|
|
26
27
|
getJobProgress(projectId: string, translationJobUid: string, params: JobProgressParameters): Promise<JobProgressDto>;
|
|
27
28
|
getJobFileProgress(projectId: string, translationJobUid: string, params: FileProgressParameters): Promise<FileProgressDto>;
|
|
29
|
+
cancelJob(projectId: string, translationJobUid: string, params: CancelJobParameters): Promise<void>;
|
|
28
30
|
}
|
package/built/api/jobs/index.js
CHANGED
|
@@ -57,6 +57,11 @@ class SmartlingJobsApi extends index_1.SmartlingBaseApi {
|
|
|
57
57
|
return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/file/progress`, params.export());
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
+
cancelJob(projectId, translationJobUid, params) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
yield this.makeRequest("post", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/cancel`, JSON.stringify(params.export()));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
60
65
|
}
|
|
61
66
|
exports.SmartlingJobsApi = SmartlingJobsApi;
|
|
62
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -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;AAmBjD,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;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M,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAEK,SAAS,CACX,SAAiB,EAAE,iBAAyB,EAAE,MAA2B;;YAEzE,MAAM,IAAI,CAAC,WAAW,CAClB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,SAAS,EAClE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;CACJ;AA1FD,4CA0FC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancelJobParameters = void 0;
|
|
4
|
+
const index_1 = require("../../parameters/index");
|
|
5
|
+
class CancelJobParameters extends index_1.BaseParameters {
|
|
6
|
+
setReason(reason) {
|
|
7
|
+
this.set("reason", reason);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CancelJobParameters = CancelJobParameters;
|
|
12
|
+
//# sourceMappingURL=cancel-job-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-job-parameters.js","sourceRoot":"","sources":["../../../../api/jobs/params/cancel-job-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAExD,MAAa,mBAAoB,SAAQ,sBAAc;IACnD,SAAS,CAAC,MAAc;QACpB,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE3B,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAND,kDAMC"}
|
package/built/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export * from "./api/jobs/params/job-status";
|
|
|
60
60
|
export * from "./api/jobs/params/list-job-files-parameters";
|
|
61
61
|
export * from "./api/jobs/params/list-jobs-parameters";
|
|
62
62
|
export * from "./api/jobs/params/remove-file-parameters";
|
|
63
|
+
export * from "./api/jobs/params/cancel-job-parameters";
|
|
63
64
|
export * from "./api/parameters/index";
|
|
64
65
|
export * from "./api/parameters/order";
|
|
65
66
|
export * from "./api/projects/index";
|
package/built/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -72,6 +76,7 @@ __exportStar(require("./api/jobs/params/job-status"), exports);
|
|
|
72
76
|
__exportStar(require("./api/jobs/params/list-job-files-parameters"), exports);
|
|
73
77
|
__exportStar(require("./api/jobs/params/list-jobs-parameters"), exports);
|
|
74
78
|
__exportStar(require("./api/jobs/params/remove-file-parameters"), exports);
|
|
79
|
+
__exportStar(require("./api/jobs/params/cancel-job-parameters"), exports);
|
|
75
80
|
__exportStar(require("./api/parameters/index"), exports);
|
|
76
81
|
__exportStar(require("./api/parameters/order"), exports);
|
|
77
82
|
__exportStar(require("./api/projects/index"), exports);
|
package/built/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
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,0EAAwD;AACxD,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.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/Smartling/api-sdk-nodejs#readme",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@types/mocha": "^9.0.0",
|
|
29
28
|
"@types/node": "^16.4.7",
|
|
30
29
|
"cross-fetch": "^3.1.4",
|
|
31
30
|
"default-user-agent": "^1.0.0",
|
|
@@ -36,7 +35,15 @@
|
|
|
36
35
|
"typescript": "^4.3.5"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
|
-
"@
|
|
38
|
+
"@types/mocha": "^9.0.0",
|
|
39
|
+
"babel-eslint": "^8.2.1",
|
|
40
|
+
"eslint-config-airbnb": "^16.1.0",
|
|
41
|
+
"eslint-plugin-flowtype": "^2.41.0",
|
|
42
|
+
"eslint-plugin-fp": "^2.3.0",
|
|
43
|
+
"eslint-plugin-import": "^2.8.0",
|
|
44
|
+
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
45
|
+
"eslint-plugin-promise": "^3.6.0",
|
|
46
|
+
"eslint-plugin-react": "^7.10.0",
|
|
40
47
|
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
41
48
|
"@typescript-eslint/parser": "^4.29.0",
|
|
42
49
|
"eslint": "^7.31.0",
|
package/index.ts
CHANGED
|
@@ -60,6 +60,7 @@ export * from "./api/jobs/params/job-status";
|
|
|
60
60
|
export * from "./api/jobs/params/list-job-files-parameters";
|
|
61
61
|
export * from "./api/jobs/params/list-jobs-parameters";
|
|
62
62
|
export * from "./api/jobs/params/remove-file-parameters";
|
|
63
|
+
export * from "./api/jobs/params/cancel-job-parameters";
|
|
63
64
|
export * from "./api/parameters/index";
|
|
64
65
|
export * from "./api/parameters/order";
|
|
65
66
|
export * from "./api/projects/index";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartling-api-sdk-nodejs",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Package for Smartling API",
|
|
5
5
|
"main": "built/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/Smartling/api-sdk-nodejs#readme",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@types/mocha": "^9.0.0",
|
|
29
28
|
"@types/node": "^16.4.7",
|
|
30
29
|
"cross-fetch": "^3.1.4",
|
|
31
30
|
"default-user-agent": "^1.0.0",
|
|
@@ -36,7 +35,15 @@
|
|
|
36
35
|
"typescript": "^4.3.5"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
|
-
"@
|
|
38
|
+
"@types/mocha": "^9.0.0",
|
|
39
|
+
"babel-eslint": "^8.2.1",
|
|
40
|
+
"eslint-config-airbnb": "^16.1.0",
|
|
41
|
+
"eslint-plugin-flowtype": "^2.41.0",
|
|
42
|
+
"eslint-plugin-fp": "^2.3.0",
|
|
43
|
+
"eslint-plugin-import": "^2.8.0",
|
|
44
|
+
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
45
|
+
"eslint-plugin-promise": "^3.6.0",
|
|
46
|
+
"eslint-plugin-react": "^7.10.0",
|
|
40
47
|
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
|
41
48
|
"@typescript-eslint/parser": "^4.29.0",
|
|
42
49
|
"eslint": "^7.31.0",
|
package/test/exception.spec.ts
CHANGED
|
@@ -10,5 +10,8 @@ describe("Exception base class tests.", () => {
|
|
|
10
10
|
|
|
11
11
|
assert.equal(result.includes("Test root exception, payload={\"root\":\"value\"}, stack=Error: Test root exception"), true);
|
|
12
12
|
assert.equal(result.includes("Test nested exception, payload={\"foo\":\"nested\"}, stack=Error: Test nested exception"), true);
|
|
13
|
+
assert.deepEqual(rootException.getPayload(), { root: "value" });
|
|
14
|
+
assert.deepEqual(rootException.getNestedException(), nestedException);
|
|
15
|
+
assert.deepEqual((rootException.getNestedException() as SmartlingException).getPayload(), { foo: "nested" });
|
|
13
16
|
});
|
|
14
17
|
});
|
package/test/jobs.spec.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ListJobFilesParameters } from "../api/jobs/params/list-job-files-parame
|
|
|
10
10
|
import { JobStatus } from "../api/jobs/params/job-status";
|
|
11
11
|
import { RemoveFileParameters } from "../api/jobs/params/remove-file-parameters";
|
|
12
12
|
import { JobProgressParameters } from "../api/jobs/params/job-progress-parameters";
|
|
13
|
+
import { CancelJobParameters } from "../api/jobs/params/cancel-job-parameters";
|
|
13
14
|
|
|
14
15
|
describe("SmartlingJobsAPI class tests.", () => {
|
|
15
16
|
const projectId = "testProjectId";
|
|
@@ -201,5 +202,28 @@ describe("SmartlingJobsAPI class tests.", () => {
|
|
|
201
202
|
}
|
|
202
203
|
);
|
|
203
204
|
});
|
|
205
|
+
|
|
206
|
+
it("Cancel job", async () => {
|
|
207
|
+
const params = new CancelJobParameters();
|
|
208
|
+
|
|
209
|
+
params.setReason("Test reason");
|
|
210
|
+
|
|
211
|
+
await jobApi.cancelJob(projectId, jobUid, params);
|
|
212
|
+
|
|
213
|
+
sinon.assert.calledOnce(jobServiceApiFetchStub);
|
|
214
|
+
sinon.assert.calledWithExactly(
|
|
215
|
+
jobServiceApiFetchStub,
|
|
216
|
+
`https://test.com/jobs-api/v3/projects/${projectId}/jobs/${jobUid}/cancel`,
|
|
217
|
+
{
|
|
218
|
+
body: "{\"reason\":\"Test reason\"}",
|
|
219
|
+
headers: {
|
|
220
|
+
Authorization: "test_token_type test_access_token",
|
|
221
|
+
"Content-Type": "application/json",
|
|
222
|
+
"User-Agent": "test_user_agent"
|
|
223
|
+
},
|
|
224
|
+
method: "post"
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
});
|
|
204
228
|
});
|
|
205
229
|
});
|