smartling-api-sdk-nodejs 2.5.0 → 2.7.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/file-translations/dto/fts-uploaded-file-dto.ts +5 -0
- package/api/file-translations/index.ts +4 -4
- package/api/file-translations/params/{upload-file-parameters.ts → fts-upload-file-parameters.ts} +4 -4
- package/api/published-files/dto/published-file-dto.ts +7 -0
- package/api/published-files/index.ts +25 -0
- package/api/published-files/params/recently-published-files-parameters.ts +42 -0
- package/built/api/file-translations/dto/fts-uploaded-file-dto.d.ts +4 -0
- package/built/api/file-translations/dto/fts-uploaded-file-dto.js +3 -0
- package/built/api/file-translations/dto/fts-uploaded-file-dto.js.map +1 -0
- package/built/api/file-translations/index.d.ts +3 -3
- package/built/api/file-translations/index.js.map +1 -1
- package/built/api/file-translations/params/fts-upload-file-parameters.d.ts +8 -0
- package/built/api/file-translations/params/{upload-file-parameters.js → fts-upload-file-parameters.js} +4 -4
- package/built/api/file-translations/params/fts-upload-file-parameters.js.map +1 -0
- package/built/api/published-files/dto/published-file-dto.d.ts +6 -0
- package/built/api/{file-translations/dto/uploaded-file-dto.js → published-files/dto/published-file-dto.js} +1 -1
- package/built/api/published-files/dto/published-file-dto.js.map +1 -0
- package/built/api/published-files/index.d.ts +10 -0
- package/built/api/published-files/index.js +27 -0
- package/built/api/published-files/index.js.map +1 -0
- package/built/api/published-files/params/recently-published-files-parameters.d.ts +8 -0
- package/built/api/published-files/params/recently-published-files-parameters.js +35 -0
- package/built/api/published-files/params/recently-published-files-parameters.js.map +1 -0
- package/built/index.d.ts +16 -0
- package/built/index.js +16 -0
- package/built/index.js.map +1 -1
- package/built/package.json +1 -1
- package/index.ts +16 -0
- package/package.json +1 -1
- package/test/file-translations.spec.ts +3 -3
- package/test/published-files.spec.ts +74 -0
- package/api/file-translations/dto/uploaded-file-dto.ts +0 -5
- package/built/api/file-translations/dto/uploaded-file-dto.d.ts +0 -4
- package/built/api/file-translations/dto/uploaded-file-dto.js.map +0 -1
- package/built/api/file-translations/params/upload-file-parameters.d.ts +0 -8
- package/built/api/file-translations/params/upload-file-parameters.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=AYzU_wxtRe7rJHsZ61o0
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYzU_wxtRe7rJHsZ61o0
|
|
@@ -2,8 +2,8 @@ import FormData from "form-data";
|
|
|
2
2
|
import { SmartlingBaseApi } from "../base";
|
|
3
3
|
import { SmartlingAuthApi } from "../auth";
|
|
4
4
|
import { Logger } from "../logger";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { FtsUploadedFileDto } from "./dto/fts-uploaded-file-dto";
|
|
6
|
+
import { FtsUploadFileParameters } from "./params/fts-upload-file-parameters";
|
|
7
7
|
import { TranslationDto } from "./dto/translation-dto";
|
|
8
8
|
import { TranslateFileParameters } from "./params/translate-file-parameters";
|
|
9
9
|
import { TranslationStatusDto } from "./dto/translation-status-dto";
|
|
@@ -18,8 +18,8 @@ export class SmartlingFileTranslationsApi extends SmartlingBaseApi {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
async uploadFile(
|
|
21
|
-
accountUid: string, parameters:
|
|
22
|
-
): Promise<
|
|
21
|
+
accountUid: string, parameters: FtsUploadFileParameters
|
|
22
|
+
): Promise<FtsUploadedFileDto> {
|
|
23
23
|
const formData = new FormData();
|
|
24
24
|
const exported = parameters.export();
|
|
25
25
|
|
package/api/file-translations/params/{upload-file-parameters.ts → fts-upload-file-parameters.ts}
RENAMED
|
@@ -3,26 +3,26 @@ import string2fileStream from "string-to-file-stream";
|
|
|
3
3
|
import { BaseParameters } from "../../parameters";
|
|
4
4
|
import { FileType } from "../../files/params/file-type";
|
|
5
5
|
|
|
6
|
-
export class
|
|
6
|
+
export class FtsUploadFileParameters extends BaseParameters {
|
|
7
7
|
constructor(parameters: Record<string, unknown> = {}) {
|
|
8
8
|
super(parameters);
|
|
9
9
|
|
|
10
10
|
this.set("request", {});
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
setFileFromLocalFilePath(filePath: string):
|
|
13
|
+
setFileFromLocalFilePath(filePath: string): FtsUploadFileParameters {
|
|
14
14
|
this.set("file", fs.createReadStream(
|
|
15
15
|
fs.realpathSync(filePath)
|
|
16
16
|
));
|
|
17
17
|
return this;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
setFileContent(fileContent: string):
|
|
20
|
+
setFileContent(fileContent: string): FtsUploadFileParameters {
|
|
21
21
|
this.set("file", string2fileStream(fileContent));
|
|
22
22
|
return this;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
setFileType(fileType: FileType):
|
|
25
|
+
setFileType(fileType: FileType): FtsUploadFileParameters {
|
|
26
26
|
this.parameters.request.fileType = fileType.toUpperCase();
|
|
27
27
|
return this;
|
|
28
28
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
+
import { SmartlingAuthApi } from "../auth/index";
|
|
3
|
+
import { Logger } from "../logger";
|
|
4
|
+
import { RecentlyPublishedFilesParameters } from "./params/recently-published-files-parameters";
|
|
5
|
+
import { PublishedFileDto } from "./dto/published-file-dto";
|
|
6
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
7
|
+
|
|
8
|
+
export class SmartlingPublishedFilesApi extends SmartlingBaseApi {
|
|
9
|
+
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
|
|
10
|
+
super(logger);
|
|
11
|
+
|
|
12
|
+
this.authApi = authApi;
|
|
13
|
+
this.entrypoint = `${smartlingApiBaseUrl}/published-files-api/v2`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public async getRecentlyPublishedFiles(
|
|
17
|
+
projectUid: string, params: RecentlyPublishedFilesParameters
|
|
18
|
+
): Promise<SmartlingListResponse<PublishedFileDto>> {
|
|
19
|
+
return await this.makeRequest(
|
|
20
|
+
"get",
|
|
21
|
+
`${this.entrypoint}/projects/${projectUid}/files/list/recently-published`,
|
|
22
|
+
params.export()
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { SmartlingException } from "../../exception";
|
|
3
|
+
|
|
4
|
+
export class RecentlyPublishedFilesParameters extends BaseParameters {
|
|
5
|
+
public setPublishedAfterDate(publishedAfterDate: Date): RecentlyPublishedFilesParameters {
|
|
6
|
+
this.set("publishedAfter", `${publishedAfterDate.toISOString().split(".")[0]}Z`);
|
|
7
|
+
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
setLimit(limit: number): RecentlyPublishedFilesParameters {
|
|
12
|
+
if (limit > 0) {
|
|
13
|
+
this.set("limit", limit);
|
|
14
|
+
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
throw new SmartlingException("Limit must be > 0");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setOffset(offset: number): RecentlyPublishedFilesParameters {
|
|
22
|
+
if (offset >= 0) {
|
|
23
|
+
this.set("offset", offset);
|
|
24
|
+
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
throw new SmartlingException("Offset must be >= 0");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setFileUris(fileUris: Array<string>): RecentlyPublishedFilesParameters {
|
|
32
|
+
this.set("fileUris[]", fileUris);
|
|
33
|
+
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setLocaleIds(localeIds: Array<string>): RecentlyPublishedFilesParameters {
|
|
38
|
+
this.set("localeIds[]", localeIds);
|
|
39
|
+
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fts-uploaded-file-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/fts-uploaded-file-dto.ts"],"names":[],"mappings":""}
|
|
@@ -2,8 +2,8 @@ import FormData from "form-data";
|
|
|
2
2
|
import { SmartlingBaseApi } from "../base";
|
|
3
3
|
import { SmartlingAuthApi } from "../auth";
|
|
4
4
|
import { Logger } from "../logger";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { FtsUploadedFileDto } from "./dto/fts-uploaded-file-dto";
|
|
6
|
+
import { FtsUploadFileParameters } from "./params/fts-upload-file-parameters";
|
|
7
7
|
import { TranslationDto } from "./dto/translation-dto";
|
|
8
8
|
import { TranslateFileParameters } from "./params/translate-file-parameters";
|
|
9
9
|
import { TranslationStatusDto } from "./dto/translation-status-dto";
|
|
@@ -11,7 +11,7 @@ import { LanguageDetectionDto } from "./dto/language-detection-dto";
|
|
|
11
11
|
import { LanguageDetectionStatusDto } from "./dto/language-detection-status-dto";
|
|
12
12
|
export declare class SmartlingFileTranslationsApi extends SmartlingBaseApi {
|
|
13
13
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
|
|
14
|
-
uploadFile(accountUid: string, parameters:
|
|
14
|
+
uploadFile(accountUid: string, parameters: FtsUploadFileParameters): Promise<FtsUploadedFileDto>;
|
|
15
15
|
translateFile(accountUid: string, fileUid: string, params: TranslateFileParameters): Promise<TranslationDto>;
|
|
16
16
|
getTranslationProgress(accountUid: string, fileUid: string, mtUid: string): Promise<TranslationStatusDto>;
|
|
17
17
|
downloadTranslatedFile(accountUid: string, fileUid: string, mtUid: string, localeId: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/file-translations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,kCAA2C;AAW3C,MAAa,4BAA6B,SAAQ,uBAAgB;IAC9D,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,oCAAoC,CAAC;IACjF,CAAC;IAEK,UAAU,CACZ,UAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/file-translations/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
import { FileType } from "../../files/params/file-type";
|
|
3
|
+
export declare class FtsUploadFileParameters extends BaseParameters {
|
|
4
|
+
constructor(parameters?: Record<string, unknown>);
|
|
5
|
+
setFileFromLocalFilePath(filePath: string): FtsUploadFileParameters;
|
|
6
|
+
setFileContent(fileContent: string): FtsUploadFileParameters;
|
|
7
|
+
setFileType(fileType: FileType): FtsUploadFileParameters;
|
|
8
|
+
}
|
|
@@ -26,11 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.FtsUploadFileParameters = void 0;
|
|
30
30
|
const fs = __importStar(require("fs"));
|
|
31
31
|
const string_to_file_stream_1 = __importDefault(require("string-to-file-stream"));
|
|
32
32
|
const parameters_1 = require("../../parameters");
|
|
33
|
-
class
|
|
33
|
+
class FtsUploadFileParameters extends parameters_1.BaseParameters {
|
|
34
34
|
constructor(parameters = {}) {
|
|
35
35
|
super(parameters);
|
|
36
36
|
this.set("request", {});
|
|
@@ -48,5 +48,5 @@ class UploadFileParameters extends parameters_1.BaseParameters {
|
|
|
48
48
|
return this;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
exports.
|
|
52
|
-
//# sourceMappingURL=upload-file-parameters.js.map
|
|
51
|
+
exports.FtsUploadFileParameters = FtsUploadFileParameters;
|
|
52
|
+
//# sourceMappingURL=fts-upload-file-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fts-upload-file-parameters.js","sourceRoot":"","sources":["../../../../api/file-translations/params/fts-upload-file-parameters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,kFAAsD;AACtD,iDAAkD;AAGlD,MAAa,uBAAwB,SAAQ,2BAAc;IACvD,YAAY,aAAsC,EAAE;QAChD,KAAK,CAAC,UAAU,CAAC,CAAC;QAElB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC5B,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;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,QAAkB;QAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAvBD,0DAuBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"published-file-dto.js","sourceRoot":"","sources":["../../../../api/published-files/dto/published-file-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
+
import { SmartlingAuthApi } from "../auth/index";
|
|
3
|
+
import { Logger } from "../logger";
|
|
4
|
+
import { RecentlyPublishedFilesParameters } from "./params/recently-published-files-parameters";
|
|
5
|
+
import { PublishedFileDto } from "./dto/published-file-dto";
|
|
6
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
7
|
+
export declare class SmartlingPublishedFilesApi extends SmartlingBaseApi {
|
|
8
|
+
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
|
|
9
|
+
getRecentlyPublishedFiles(projectUid: string, params: RecentlyPublishedFilesParameters): Promise<SmartlingListResponse<PublishedFileDto>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SmartlingPublishedFilesApi = void 0;
|
|
13
|
+
const index_1 = require("../base/index");
|
|
14
|
+
class SmartlingPublishedFilesApi extends index_1.SmartlingBaseApi {
|
|
15
|
+
constructor(smartlingApiBaseUrl, authApi, logger) {
|
|
16
|
+
super(logger);
|
|
17
|
+
this.authApi = authApi;
|
|
18
|
+
this.entrypoint = `${smartlingApiBaseUrl}/published-files-api/v2`;
|
|
19
|
+
}
|
|
20
|
+
getRecentlyPublishedFiles(projectUid, params) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return yield this.makeRequest("get", `${this.entrypoint}/projects/${projectUid}/files/list/recently-published`, params.export());
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.SmartlingPublishedFilesApi = SmartlingPublishedFilesApi;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/published-files/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAOjD,MAAa,0BAA2B,SAAQ,wBAAgB;IAC5D,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,yBAAyB,CAAC;IACtE,CAAC;IAEY,yBAAyB,CAClC,UAAkB,EAAE,MAAwC;;YAE5D,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,aAAa,UAAU,gCAAgC,EACzE,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;CACJ;AAjBD,gEAiBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
export declare class RecentlyPublishedFilesParameters extends BaseParameters {
|
|
3
|
+
setPublishedAfterDate(publishedAfterDate: Date): RecentlyPublishedFilesParameters;
|
|
4
|
+
setLimit(limit: number): RecentlyPublishedFilesParameters;
|
|
5
|
+
setOffset(offset: number): RecentlyPublishedFilesParameters;
|
|
6
|
+
setFileUris(fileUris: Array<string>): RecentlyPublishedFilesParameters;
|
|
7
|
+
setLocaleIds(localeIds: Array<string>): RecentlyPublishedFilesParameters;
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecentlyPublishedFilesParameters = void 0;
|
|
4
|
+
const parameters_1 = require("../../parameters");
|
|
5
|
+
const exception_1 = require("../../exception");
|
|
6
|
+
class RecentlyPublishedFilesParameters extends parameters_1.BaseParameters {
|
|
7
|
+
setPublishedAfterDate(publishedAfterDate) {
|
|
8
|
+
this.set("publishedAfter", `${publishedAfterDate.toISOString().split(".")[0]}Z`);
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
setLimit(limit) {
|
|
12
|
+
if (limit > 0) {
|
|
13
|
+
this.set("limit", limit);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
throw new exception_1.SmartlingException("Limit must be > 0");
|
|
17
|
+
}
|
|
18
|
+
setOffset(offset) {
|
|
19
|
+
if (offset >= 0) {
|
|
20
|
+
this.set("offset", offset);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
throw new exception_1.SmartlingException("Offset must be >= 0");
|
|
24
|
+
}
|
|
25
|
+
setFileUris(fileUris) {
|
|
26
|
+
this.set("fileUris[]", fileUris);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
setLocaleIds(localeIds) {
|
|
30
|
+
this.set("localeIds[]", localeIds);
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.RecentlyPublishedFilesParameters = RecentlyPublishedFilesParameters;
|
|
35
|
+
//# sourceMappingURL=recently-published-files-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recently-published-files-parameters.js","sourceRoot":"","sources":["../../../../api/published-files/params/recently-published-files-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAErD,MAAa,gCAAiC,SAAQ,2BAAc;IACzD,qBAAqB,CAAC,kBAAwB;QACjD,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAEjF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,IAAI,KAAK,GAAG,CAAC,EAAE;YACX,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAEzB,OAAO,IAAI,CAAC;SACf;QAED,MAAM,IAAI,8BAAkB,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;IAED,SAAS,CAAC,MAAc;QACpB,IAAI,MAAM,IAAI,CAAC,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAE3B,OAAO,IAAI,CAAC;SACf;QAED,MAAM,IAAI,8BAAkB,CAAC,qBAAqB,CAAC,CAAC;IACxD,CAAC;IAED,WAAW,CAAC,QAAuB;QAC/B,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,YAAY,CAAC,SAAwB;QACjC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAtCD,4EAsCC"}
|
package/built/index.d.ts
CHANGED
|
@@ -15,6 +15,19 @@ export * from "./api/context/params/create-bindings-parameters";
|
|
|
15
15
|
export * from "./api/context/params/list-parameters";
|
|
16
16
|
export * from "./api/context/context-http-response";
|
|
17
17
|
export * from "./api/exception/index";
|
|
18
|
+
export * from "./api/file-translations/index";
|
|
19
|
+
export * from "./api/file-translations/params/fts-upload-file-parameters";
|
|
20
|
+
export * from "./api/file-translations/params/translate-file-parameters";
|
|
21
|
+
export * from "./api/file-translations/dto/error";
|
|
22
|
+
export * from "./api/file-translations/dto/fts-uploaded-file-dto";
|
|
23
|
+
export * from "./api/file-translations/dto/language-detection-dto";
|
|
24
|
+
export * from "./api/file-translations/dto/language-detection-state";
|
|
25
|
+
export * from "./api/file-translations/dto/language-detection-status-dto";
|
|
26
|
+
export * from "./api/file-translations/dto/language-dto";
|
|
27
|
+
export * from "./api/file-translations/dto/mt-state";
|
|
28
|
+
export * from "./api/file-translations/dto/translation-dto";
|
|
29
|
+
export * from "./api/file-translations/dto/translation-locale-status-dto";
|
|
30
|
+
export * from "./api/file-translations/dto/translation-status-dto";
|
|
18
31
|
export * from "./api/files/index";
|
|
19
32
|
export * from "./api/files/params/download-file-parameters";
|
|
20
33
|
export * from "./api/files/params/retrieval-type";
|
|
@@ -70,6 +83,9 @@ export * from "./api/parameters/order";
|
|
|
70
83
|
export * from "./api/projects/index";
|
|
71
84
|
export * from "./api/projects/dto/project-dto";
|
|
72
85
|
export * from "./api/projects/dto/locale-dto";
|
|
86
|
+
export * from "./api/published-files/index";
|
|
87
|
+
export * from "./api/published-files/dto/published-file-dto";
|
|
88
|
+
export * from "./api/published-files/params/recently-published-files-parameters";
|
|
73
89
|
export * from "./api/strings/index";
|
|
74
90
|
export * from "./api/strings/dto/source-string-dto";
|
|
75
91
|
export * from "./api/strings/dto/source-string-key-dto";
|
package/built/index.js
CHANGED
|
@@ -31,6 +31,19 @@ __exportStar(require("./api/context/params/create-bindings-parameters"), exports
|
|
|
31
31
|
__exportStar(require("./api/context/params/list-parameters"), exports);
|
|
32
32
|
__exportStar(require("./api/context/context-http-response"), exports);
|
|
33
33
|
__exportStar(require("./api/exception/index"), exports);
|
|
34
|
+
__exportStar(require("./api/file-translations/index"), exports);
|
|
35
|
+
__exportStar(require("./api/file-translations/params/fts-upload-file-parameters"), exports);
|
|
36
|
+
__exportStar(require("./api/file-translations/params/translate-file-parameters"), exports);
|
|
37
|
+
__exportStar(require("./api/file-translations/dto/error"), exports);
|
|
38
|
+
__exportStar(require("./api/file-translations/dto/fts-uploaded-file-dto"), exports);
|
|
39
|
+
__exportStar(require("./api/file-translations/dto/language-detection-dto"), exports);
|
|
40
|
+
__exportStar(require("./api/file-translations/dto/language-detection-state"), exports);
|
|
41
|
+
__exportStar(require("./api/file-translations/dto/language-detection-status-dto"), exports);
|
|
42
|
+
__exportStar(require("./api/file-translations/dto/language-dto"), exports);
|
|
43
|
+
__exportStar(require("./api/file-translations/dto/mt-state"), exports);
|
|
44
|
+
__exportStar(require("./api/file-translations/dto/translation-dto"), exports);
|
|
45
|
+
__exportStar(require("./api/file-translations/dto/translation-locale-status-dto"), exports);
|
|
46
|
+
__exportStar(require("./api/file-translations/dto/translation-status-dto"), exports);
|
|
34
47
|
__exportStar(require("./api/files/index"), exports);
|
|
35
48
|
__exportStar(require("./api/files/params/download-file-parameters"), exports);
|
|
36
49
|
__exportStar(require("./api/files/params/retrieval-type"), exports);
|
|
@@ -86,6 +99,9 @@ __exportStar(require("./api/parameters/order"), exports);
|
|
|
86
99
|
__exportStar(require("./api/projects/index"), exports);
|
|
87
100
|
__exportStar(require("./api/projects/dto/project-dto"), exports);
|
|
88
101
|
__exportStar(require("./api/projects/dto/locale-dto"), exports);
|
|
102
|
+
__exportStar(require("./api/published-files/index"), exports);
|
|
103
|
+
__exportStar(require("./api/published-files/dto/published-file-dto"), exports);
|
|
104
|
+
__exportStar(require("./api/published-files/params/recently-published-files-parameters"), exports);
|
|
89
105
|
__exportStar(require("./api/strings/index"), exports);
|
|
90
106
|
__exportStar(require("./api/strings/dto/source-string-dto"), exports);
|
|
91
107
|
__exportStar(require("./api/strings/dto/source-string-key-dto"), exports);
|
package/built/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,4EAA0D;AAC1D,mFAAiE;AACjE,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,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,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;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D"}
|
|
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,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,mFAAiE;AACjE,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,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yEAAuD;AACvD,2EAAyD;AACzD,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"}
|
package/built/package.json
CHANGED
package/index.ts
CHANGED
|
@@ -15,6 +15,19 @@ export * from "./api/context/params/create-bindings-parameters";
|
|
|
15
15
|
export * from "./api/context/params/list-parameters";
|
|
16
16
|
export * from "./api/context/context-http-response";
|
|
17
17
|
export * from "./api/exception/index";
|
|
18
|
+
export * from "./api/file-translations/index";
|
|
19
|
+
export * from "./api/file-translations/params/fts-upload-file-parameters";
|
|
20
|
+
export * from "./api/file-translations/params/translate-file-parameters";
|
|
21
|
+
export * from "./api/file-translations/dto/error";
|
|
22
|
+
export * from "./api/file-translations/dto/fts-uploaded-file-dto";
|
|
23
|
+
export * from "./api/file-translations/dto/language-detection-dto";
|
|
24
|
+
export * from "./api/file-translations/dto/language-detection-state";
|
|
25
|
+
export * from "./api/file-translations/dto/language-detection-status-dto";
|
|
26
|
+
export * from "./api/file-translations/dto/language-dto";
|
|
27
|
+
export * from "./api/file-translations/dto/mt-state";
|
|
28
|
+
export * from "./api/file-translations/dto/translation-dto";
|
|
29
|
+
export * from "./api/file-translations/dto/translation-locale-status-dto";
|
|
30
|
+
export * from "./api/file-translations/dto/translation-status-dto";
|
|
18
31
|
export * from "./api/files/index";
|
|
19
32
|
export * from "./api/files/params/download-file-parameters";
|
|
20
33
|
export * from "./api/files/params/retrieval-type";
|
|
@@ -70,6 +83,9 @@ export * from "./api/parameters/order";
|
|
|
70
83
|
export * from "./api/projects/index";
|
|
71
84
|
export * from "./api/projects/dto/project-dto";
|
|
72
85
|
export * from "./api/projects/dto/locale-dto";
|
|
86
|
+
export * from "./api/published-files/index";
|
|
87
|
+
export * from "./api/published-files/dto/published-file-dto";
|
|
88
|
+
export * from "./api/published-files/params/recently-published-files-parameters";
|
|
73
89
|
export * from "./api/strings/index";
|
|
74
90
|
export * from "./api/strings/dto/source-string-dto";
|
|
75
91
|
export * from "./api/strings/dto/source-string-key-dto";
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import sinon from "sinon";
|
|
|
5
5
|
import { loggerMock, authMock, responseMock } from "./mock";
|
|
6
6
|
import { SmartlingFileTranslationsApi } from "../api/file-translations";
|
|
7
7
|
import { SmartlingAuthApi } from "../api/auth";
|
|
8
|
-
import {
|
|
8
|
+
import { FtsUploadFileParameters } from "../api/file-translations/params/fts-upload-file-parameters";
|
|
9
9
|
import { FileType } from "../api/files/params/file-type";
|
|
10
10
|
import { streamToString } from "./stream-to-string";
|
|
11
11
|
import { TranslateFileParameters } from "../api/file-translations/params/translate-file-parameters";
|
|
@@ -47,7 +47,7 @@ describe("SmartlingFileTranslationsApi class tests.", () => {
|
|
|
47
47
|
|
|
48
48
|
describe("Methods", () => {
|
|
49
49
|
it("Upload file: from disk", async () => {
|
|
50
|
-
const params = new
|
|
50
|
+
const params = new FtsUploadFileParameters();
|
|
51
51
|
|
|
52
52
|
params
|
|
53
53
|
.setFileType(FileType.XML)
|
|
@@ -96,7 +96,7 @@ describe("SmartlingFileTranslationsApi class tests.", () => {
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
it("Upload file: as string", async () => {
|
|
99
|
-
const params = new
|
|
99
|
+
const params = new FtsUploadFileParameters();
|
|
100
100
|
|
|
101
101
|
const testFileContent = fs.readFileSync(
|
|
102
102
|
fs.realpathSync("./test/data/file.xml"),
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
import { SmartlingPublishedFilesApi } from "../api/published-files";
|
|
4
|
+
import { RecentlyPublishedFilesParameters } from "../api/published-files/params/recently-published-files-parameters";
|
|
5
|
+
import { SmartlingAuthApi } from "../api/auth/index";
|
|
6
|
+
import { loggerMock, authMock, responseMock } from "./mock";
|
|
7
|
+
|
|
8
|
+
describe("SmartlingPublishedFilesApi class tests.", () => {
|
|
9
|
+
let publishedFilesApi;
|
|
10
|
+
let publishedFilesApiFetchStub;
|
|
11
|
+
let publishedFilesApiUaStub;
|
|
12
|
+
let responseMockTextStub;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
publishedFilesApi = new SmartlingPublishedFilesApi("https://test.com", authMock as unknown as SmartlingAuthApi, loggerMock);
|
|
16
|
+
|
|
17
|
+
publishedFilesApiFetchStub = sinon.stub(publishedFilesApi, "fetch");
|
|
18
|
+
publishedFilesApiUaStub = sinon.stub(publishedFilesApi, "ua");
|
|
19
|
+
responseMockTextStub = sinon.stub(responseMock, "text");
|
|
20
|
+
|
|
21
|
+
publishedFilesApiUaStub.returns("test_user_agent");
|
|
22
|
+
publishedFilesApiFetchStub.returns(responseMock);
|
|
23
|
+
responseMockTextStub.returns("{\"response\": {}}");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
publishedFilesApiFetchStub.restore();
|
|
28
|
+
responseMockTextStub.restore();
|
|
29
|
+
publishedFilesApiUaStub.restore();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("Get recently published files", async () => {
|
|
33
|
+
const params: RecentlyPublishedFilesParameters = new RecentlyPublishedFilesParameters();
|
|
34
|
+
|
|
35
|
+
params.setPublishedAfterDate(new Date("2020-09-24T00:00:00Z"));
|
|
36
|
+
params.setFileUris(["test:_1.xml", "test/file&_2.xml"]);
|
|
37
|
+
params.setLocaleIds(["fr", "de"]);
|
|
38
|
+
params.setOffset(0);
|
|
39
|
+
params.setLimit(100);
|
|
40
|
+
|
|
41
|
+
await publishedFilesApi.getRecentlyPublishedFiles("test_project", params);
|
|
42
|
+
|
|
43
|
+
sinon.assert.calledOnce(publishedFilesApiFetchStub);
|
|
44
|
+
sinon.assert.calledWithExactly(
|
|
45
|
+
publishedFilesApiFetchStub,
|
|
46
|
+
"https://test.com/published-files-api/v2/projects/test_project/files/list/recently-published?publishedAfter=2020-09-24T00%3A00%3A00Z&fileUris%5B%5D=test%3A_1.xml&fileUris%5B%5D=test%2Ffile%26_2.xml&localeIds%5B%5D=fr&localeIds%5B%5D=de&offset=0&limit=100", {
|
|
47
|
+
headers: {
|
|
48
|
+
Authorization: "test_token_type test_access_token",
|
|
49
|
+
"Content-Type": "application/json",
|
|
50
|
+
"User-Agent": "test_user_agent"
|
|
51
|
+
},
|
|
52
|
+
method: "get"
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("Invalid offset", async () => {
|
|
58
|
+
try {
|
|
59
|
+
new RecentlyPublishedFilesParameters().setOffset(-1);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
62
|
+
assert.equal(e.message, "Offset must be >= 0");
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("Invalid limit", async () => {
|
|
67
|
+
try {
|
|
68
|
+
new RecentlyPublishedFilesParameters().setLimit(0);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
assert.equal(e.constructor.name, "SmartlingException");
|
|
71
|
+
assert.equal(e.message, "Limit must be > 0");
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uploaded-file-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/uploaded-file-dto.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BaseParameters } from "../../parameters";
|
|
2
|
-
import { FileType } from "../../files/params/file-type";
|
|
3
|
-
export declare class UploadFileParameters extends BaseParameters {
|
|
4
|
-
constructor(parameters?: Record<string, unknown>);
|
|
5
|
-
setFileFromLocalFilePath(filePath: string): UploadFileParameters;
|
|
6
|
-
setFileContent(fileContent: string): UploadFileParameters;
|
|
7
|
-
setFileType(fileType: FileType): UploadFileParameters;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-file-parameters.js","sourceRoot":"","sources":["../../../../api/file-translations/params/upload-file-parameters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,kFAAsD;AACtD,iDAAkD;AAGlD,MAAa,oBAAqB,SAAQ,2BAAc;IACpD,YAAY,aAAsC,EAAE;QAChD,KAAK,CAAC,UAAU,CAAC,CAAC;QAElB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC5B,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;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,QAAkB;QAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAvBD,oDAuBC"}
|