smartling-api-sdk-nodejs 2.15.0 → 2.16.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.
@@ -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=AZJMfmbmeTFUeF_dKNma
6
- ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZJMfmbmeTFUeF_dKNma
5
+ ceTaskId=AZM-8LehAWzBmHKPwBI7
6
+ ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZM-8LehAWzBmHKPwBI7
@@ -41,13 +41,17 @@ export class SmartlingFilesApi extends SmartlingBaseApi {
41
41
  }
42
42
 
43
43
  async downloadFile(
44
- projectId: string, fileUri: string, locale: string, params: DownloadFileParameters
44
+ projectId: string,
45
+ fileUri: string,
46
+ locale: string,
47
+ params: DownloadFileParameters,
48
+ responseType: ResponseBodyType = ResponseBodyType.TEXT
45
49
  ): Promise<string> {
46
50
  return await this.makeRequest(
47
51
  "get",
48
52
  `${this.entrypoint}/${projectId}/locales/${locale}/file`,
49
53
  Object.assign(params.export(), { fileUri }),
50
- true
54
+ responseType
51
55
  );
52
56
  }
53
57
 
@@ -11,6 +11,7 @@ export enum FileType {
11
11
  PPTX = "pptx",
12
12
  XLSX = "xlsx",
13
13
  IDML = "idml",
14
+ INDD = "indd",
14
15
  QT = "qt",
15
16
  RESX = "resx",
16
17
  PLAIN_TEXT = "plain_text",
@@ -11,11 +11,12 @@ import { UploadedFileDto } from "./dto/uploaded-file-dto";
11
11
  import { FileStatusForProjectDto } from "./dto/file-status-for-project-dto";
12
12
  import { DownloadFileAllTranslationsParameters } from "./params/download-file-all-translations-parameters";
13
13
  import { RecentlyUploadedFilesParameters } from "./params/recently-uploaded-files";
14
+ import { ResponseBodyType } from "../base/enum/response-body-type";
14
15
  export declare class SmartlingFilesApi extends SmartlingBaseApi {
15
16
  constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
16
17
  getStatusForAllLocales(projectId: string, fileUri: string): Promise<FileStatusForAllLocalesDto>;
17
18
  getLastModified(projectId: string, fileUri: string): Promise<SmartlingListResponse<LastModifiedForLocale>>;
18
- downloadFile(projectId: string, fileUri: string, locale: string, params: DownloadFileParameters): Promise<string>;
19
+ downloadFile(projectId: string, fileUri: string, locale: string, params: DownloadFileParameters, responseType?: ResponseBodyType): Promise<string>;
19
20
  downloadFileAllTranslations(projectId: string, fileUri: string, params: DownloadFileAllTranslationsParameters): Promise<string>;
20
21
  deleteFile(projectId: string, fileUri: string): Promise<boolean>;
21
22
  uploadFile(projectId: string, parameters: UploadFileParameters): Promise<UploadedFileDto>;
@@ -32,9 +32,9 @@ class SmartlingFilesApi extends index_1.SmartlingBaseApi {
32
32
  return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/file/last-modified`, { fileUri });
33
33
  });
34
34
  }
35
- downloadFile(projectId, fileUri, locale, params) {
35
+ downloadFile(projectId, fileUri, locale, params, responseType = response_body_type_1.ResponseBodyType.TEXT) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
- return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/locales/${locale}/file`, Object.assign(params.export(), { fileUri }), true);
37
+ return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/locales/${locale}/file`, Object.assign(params.export(), { fileUri }), responseType);
38
38
  });
39
39
  }
40
40
  downloadFileAllTranslations(projectId, fileUri, params) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/files/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,yCAAiD;AAYjD,wEAAmE;AAEnE,MAAa,iBAAkB,SAAQ,wBAAgB;IACnD,YAAY,mBAA2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ED,MAAM,CAAC,wBAAwB,CAAC,IAAc;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QAElD,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA1GD,8CA0GC"}
@@ -11,6 +11,7 @@ export declare enum FileType {
11
11
  PPTX = "pptx",
12
12
  XLSX = "xlsx",
13
13
  IDML = "idml",
14
+ INDD = "indd",
14
15
  QT = "qt",
15
16
  RESX = "resx",
16
17
  PLAIN_TEXT = "plain_text",
@@ -15,6 +15,7 @@ var FileType;
15
15
  FileType["PPTX"] = "pptx";
16
16
  FileType["XLSX"] = "xlsx";
17
17
  FileType["IDML"] = "idml";
18
+ FileType["INDD"] = "indd";
18
19
  FileType["QT"] = "qt";
19
20
  FileType["RESX"] = "resx";
20
21
  FileType["PLAIN_TEXT"] = "plain_text";
@@ -1 +1 @@
1
- {"version":3,"file":"file-type.js","sourceRoot":"","sources":["../../../../api/files/params/file-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,QA0BX;AA1BD,WAAY,QAAQ;IAChB,+BAAmB,CAAA;IACnB,uBAAW,CAAA;IACX,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,+CAAmC,CAAA;IACnC,2BAAe,CAAA;IACf,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,qBAAS,CAAA;IACT,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,uCAA2B,CAAA;IAC3B,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,iCAAqB,CAAA;AACzB,CAAC,EA1BW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA0BnB"}
1
+ {"version":3,"file":"file-type.js","sourceRoot":"","sources":["../../../../api/files/params/file-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,QA2BX;AA3BD,WAAY,QAAQ;IAChB,+BAAmB,CAAA;IACnB,uBAAW,CAAA;IACX,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,+CAAmC,CAAA;IACnC,2BAAe,CAAA;IACf,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,qBAAS,CAAA;IACT,yBAAa,CAAA;IACb,qCAAyB,CAAA;IACzB,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,uCAA2B,CAAA;IAC3B,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,iCAAqB,CAAA;AACzB,CAAC,EA3BW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA2BnB"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
@@ -2,7 +2,7 @@ import * as fs from "fs";
2
2
  import sinon from "sinon";
3
3
  import assert from "assert";
4
4
  import { SmartlingFilesApi } from "../api/files/index";
5
- import { loggerMock, authMock, responseMock } from "./mock";
5
+ import { authMock, loggerMock, responseMock } from "./mock";
6
6
  import { RetrievalType } from "../api/files/params/retrieval-type";
7
7
  import { DownloadFileParameters } from "../api/files/params/download-file-parameters";
8
8
  import { UploadFileParameters } from "../api/files/params/upload-file-parameters";
@@ -11,6 +11,7 @@ import { FileType } from "../api/files/params/file-type";
11
11
  import { streamToString } from "./stream-to-string";
12
12
  import { DownloadFileAllTranslationsParameters } from "../api/files/params/download-file-all-translations-parameters";
13
13
  import { RecentlyUploadedFilesParameters } from "../api/files/params/recently-uploaded-files";
14
+ import { ResponseBodyType } from "../api/base/enum/response-body-type";
14
15
 
15
16
  describe("SmartlingFilesApi class tests.", () => {
16
17
  const projectId = "testProjectId";
@@ -112,7 +113,12 @@ describe("SmartlingFilesApi class tests.", () => {
112
113
  .setRetrievalType(RetrievalType.PUBLISHED)
113
114
  .enableDebugMode();
114
115
 
115
- await filesApi.downloadFile(projectId, fileUri, localeId, params);
116
+ await filesApi.downloadFile(
117
+ projectId,
118
+ fileUri,
119
+ localeId,
120
+ params
121
+ );
116
122
 
117
123
  sinon.assert.calledOnce(filesApiFetchStub);
118
124
  sinon.assert.calledWithExactly(
@@ -132,7 +138,12 @@ describe("SmartlingFilesApi class tests.", () => {
132
138
  it("Download file with debugMode disabled and retrievalType published", async () => {
133
139
  params.setRetrievalType(RetrievalType.PUBLISHED);
134
140
 
135
- await filesApi.downloadFile(projectId, fileUri, localeId, params);
141
+ await filesApi.downloadFile(
142
+ projectId,
143
+ fileUri,
144
+ localeId,
145
+ params
146
+ );
136
147
 
137
148
  sinon.assert.calledOnce(filesApiFetchStub);
138
149
  sinon.assert.calledWithExactly(
@@ -152,7 +163,12 @@ describe("SmartlingFilesApi class tests.", () => {
152
163
  it("Download file with includeOriginalStrings enabled", async() => {
153
164
  params.setRetrievalType(RetrievalType.PUBLISHED).includeOriginalStrings();
154
165
 
155
- await filesApi.downloadFile(projectId, fileUri, localeId, params);
166
+ await filesApi.downloadFile(
167
+ projectId,
168
+ fileUri,
169
+ localeId,
170
+ params
171
+ );
156
172
 
157
173
  sinon.assert.calledOnce(filesApiFetchStub);
158
174
  sinon.assert.calledWithExactly(
@@ -172,7 +188,12 @@ describe("SmartlingFilesApi class tests.", () => {
172
188
  it("Download file with includeOriginalStrings disabled", async() => {
173
189
  params.setRetrievalType(RetrievalType.PUBLISHED).excludeOriginalStrings();
174
190
 
175
- await filesApi.downloadFile(projectId, fileUri, localeId, params);
191
+ await filesApi.downloadFile(
192
+ projectId,
193
+ fileUri,
194
+ localeId,
195
+ params
196
+ );
176
197
 
177
198
  sinon.assert.calledOnce(filesApiFetchStub);
178
199
  sinon.assert.calledWithExactly(