smartling-api-sdk-nodejs 2.19.1 → 2.21.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/.eslintrc +2 -1
- package/.nvmrc +1 -0
- package/.scannerwork/report-task.txt +2 -2
- package/CLAUDE.md +67 -0
- package/api/auth/access-token-provider.ts +5 -0
- package/api/auth/index.ts +2 -1
- package/api/auth/static-access-token-provider.ts +27 -0
- package/api/base/index.ts +2 -2
- package/api/builder/index.ts +9 -6
- package/api/context/index.ts +2 -2
- package/api/file-translations/index.ts +2 -2
- package/api/files/index.ts +2 -2
- package/api/glossaries/dto/fallback-locale-dto.ts +4 -0
- package/api/glossaries/dto/glossary-dto.ts +17 -0
- package/api/glossaries/dto/pagination-dto.ts +4 -0
- package/api/glossaries/dto/sorting-dto.ts +4 -0
- package/api/glossaries/index.ts +32 -0
- package/api/glossaries/params/search-glossaries-parameters.ts +47 -0
- package/api/job-batches/index.ts +2 -2
- package/api/jobs/index.ts +2 -2
- package/api/locales/index.ts +2 -2
- package/api/mt/index.ts +2 -2
- package/api/projects/dto/project-dto.ts +3 -9
- package/api/projects/dto/project-without-target-locales-dto.ts +13 -0
- package/api/projects/index.ts +18 -2
- package/api/projects/params/list-projects-parameters.ts +37 -0
- package/api/published-files/index.ts +2 -2
- package/api/strings/index.ts +2 -2
- package/built/api/auth/access-token-provider.d.ts +5 -0
- package/built/api/auth/access-token-provider.js +3 -0
- package/built/api/auth/access-token-provider.js.map +1 -0
- package/built/api/auth/index.d.ts +2 -1
- package/built/api/auth/index.js.map +1 -1
- package/built/api/auth/static-access-token-provider.d.ts +9 -0
- package/built/api/auth/static-access-token-provider.js +34 -0
- package/built/api/auth/static-access-token-provider.js.map +1 -0
- package/built/api/base/index.d.ts +2 -2
- package/built/api/base/index.js.map +1 -1
- package/built/api/builder/index.d.ts +4 -4
- package/built/api/builder/index.js +5 -3
- package/built/api/builder/index.js.map +1 -1
- package/built/api/context/index.d.ts +2 -2
- package/built/api/context/index.js.map +1 -1
- package/built/api/file-translations/index.d.ts +2 -2
- package/built/api/file-translations/index.js.map +1 -1
- package/built/api/files/index.d.ts +2 -2
- package/built/api/files/index.js.map +1 -1
- package/built/api/glossaries/dto/fallback-locale-dto.d.ts +4 -0
- package/built/api/glossaries/dto/fallback-locale-dto.js +3 -0
- package/built/api/glossaries/dto/fallback-locale-dto.js.map +1 -0
- package/built/api/glossaries/dto/glossary-dto.d.ts +16 -0
- package/built/api/glossaries/dto/glossary-dto.js +3 -0
- package/built/api/glossaries/dto/glossary-dto.js.map +1 -0
- package/built/api/glossaries/dto/pagination-dto.d.ts +4 -0
- package/built/api/glossaries/dto/pagination-dto.js +3 -0
- package/built/api/glossaries/dto/pagination-dto.js.map +1 -0
- package/built/api/glossaries/dto/sorting-dto.d.ts +4 -0
- package/built/api/glossaries/dto/sorting-dto.js +3 -0
- package/built/api/glossaries/dto/sorting-dto.js.map +1 -0
- package/built/api/glossaries/index.d.ts +11 -0
- package/built/api/glossaries/index.js +32 -0
- package/built/api/glossaries/index.js.map +1 -0
- package/built/api/glossaries/params/search-glossaries-parameters.d.ts +12 -0
- package/built/api/glossaries/params/search-glossaries-parameters.js +36 -0
- package/built/api/glossaries/params/search-glossaries-parameters.js.map +1 -0
- package/built/api/job-batches/index.d.ts +2 -2
- package/built/api/job-batches/index.js.map +1 -1
- package/built/api/jobs/index.d.ts +2 -2
- package/built/api/jobs/index.js.map +1 -1
- package/built/api/locales/index.d.ts +2 -2
- package/built/api/locales/index.js.map +1 -1
- package/built/api/mt/index.d.ts +2 -2
- package/built/api/mt/index.js.map +1 -1
- package/built/api/projects/dto/project-dto.d.ts +2 -8
- package/built/api/projects/dto/project-without-target-locales-dto.d.ts +12 -0
- package/built/api/projects/dto/project-without-target-locales-dto.js +3 -0
- package/built/api/projects/dto/project-without-target-locales-dto.js.map +1 -0
- package/built/api/projects/index.d.ts +6 -2
- package/built/api/projects/index.js +6 -0
- package/built/api/projects/index.js.map +1 -1
- package/built/api/projects/params/list-projects-parameters.d.ts +9 -0
- package/built/api/projects/params/list-projects-parameters.js +36 -0
- package/built/api/projects/params/list-projects-parameters.js.map +1 -0
- package/built/api/published-files/index.d.ts +2 -2
- package/built/api/published-files/index.js.map +1 -1
- package/built/api/strings/index.d.ts +2 -2
- package/built/api/strings/index.js.map +1 -1
- package/built/index.d.ts +10 -0
- package/built/index.js +10 -0
- package/built/index.js.map +1 -1
- package/built/package.json +1 -1
- package/index.ts +10 -0
- package/package.json +1 -1
- package/test/access-token-provider.spec.ts +13 -0
- package/test/base.spec.ts +48 -0
- package/test/builder.spec.ts +12 -12
- package/test/glossaries.spec.ts +89 -0
- package/test/projects.spec.ts +45 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
export declare class ListProjectsParameters extends BaseParameters {
|
|
3
|
+
setProjectNameFilter(projectNameFilter: string): ListProjectsParameters;
|
|
4
|
+
setIncludeArchived(includeArchived: boolean): ListProjectsParameters;
|
|
5
|
+
setOffset(offset: number): ListProjectsParameters;
|
|
6
|
+
setLimit(limit: number): ListProjectsParameters;
|
|
7
|
+
setProjectTypeCode(projectTypeCode: string): ListProjectsParameters;
|
|
8
|
+
setProjectTypeCodes(projectTypeCodes: Array<string>): ListProjectsParameters;
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListProjectsParameters = void 0;
|
|
4
|
+
const index_1 = require("../../parameters/index");
|
|
5
|
+
class ListProjectsParameters extends index_1.BaseParameters {
|
|
6
|
+
setProjectNameFilter(projectNameFilter) {
|
|
7
|
+
this.set("projectNameFilter", projectNameFilter);
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
setIncludeArchived(includeArchived) {
|
|
11
|
+
this.set("includeArchived", includeArchived);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
setOffset(offset) {
|
|
15
|
+
if (offset >= 0) {
|
|
16
|
+
this.set("offset", offset);
|
|
17
|
+
}
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
setLimit(limit) {
|
|
21
|
+
if (limit > 0) {
|
|
22
|
+
this.set("limit", limit);
|
|
23
|
+
}
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
setProjectTypeCode(projectTypeCode) {
|
|
27
|
+
this.set("projectTypeCode", projectTypeCode);
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
setProjectTypeCodes(projectTypeCodes) {
|
|
31
|
+
this.set("projectTypeCodes", projectTypeCodes);
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ListProjectsParameters = ListProjectsParameters;
|
|
36
|
+
//# sourceMappingURL=list-projects-parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-projects-parameters.js","sourceRoot":"","sources":["../../../../api/projects/params/list-projects-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAExD,MAAa,sBAAuB,SAAQ,sBAAc;IACtD,oBAAoB,CAAC,iBAAyB;QAC1C,IAAI,CAAC,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB,CAAC,eAAwB;QACvC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,MAAc;QACpB,IAAI,MAAM,IAAI,CAAC,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SAC9B;QACD,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;SAC5B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB,CAAC,eAAuB;QACtC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mBAAmB,CAAC,gBAA+B;QAC/C,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAlCD,wDAkCC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
-
import {
|
|
2
|
+
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
3
|
import { Logger } from "../logger";
|
|
4
4
|
import { RecentlyPublishedFilesParameters } from "./params/recently-published-files-parameters";
|
|
5
5
|
import { PublishedFileDto } from "./dto/published-file-dto";
|
|
6
6
|
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
7
7
|
export declare class SmartlingPublishedFilesApi extends SmartlingBaseApi {
|
|
8
|
-
constructor(smartlingApiBaseUrl: string, authApi:
|
|
8
|
+
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
|
|
9
9
|
getRecentlyPublishedFiles(projectUid: string, params: RecentlyPublishedFilesParameters): Promise<SmartlingListResponse<PublishedFileDto>>;
|
|
10
10
|
}
|
|
@@ -1 +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,
|
|
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,OAA4B,EAAE,MAAc;QACjF,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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SmartlingBaseApi } from "../base/index";
|
|
2
|
-
import {
|
|
2
|
+
import { AccessTokenProvider } from "../auth/access-token-provider";
|
|
3
3
|
import { FetchSourceStringsParameters } from "./params/fetch-source-strings-parameters";
|
|
4
4
|
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
5
5
|
import { SourceStringDto } from "./dto/source-string-dto";
|
|
6
6
|
import { Logger } from "../logger";
|
|
7
7
|
export declare class SmartlingStringsApi extends SmartlingBaseApi {
|
|
8
|
-
constructor(smartlingApiBaseUrl: string, authApi:
|
|
8
|
+
constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
|
|
9
9
|
getSourceStrings(projectId: string, params: FetchSourceStringsParameters): Promise<SmartlingListResponse<SourceStringDto>>;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/strings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAOjD,MAAa,mBAAoB,SAAQ,wBAAgB;IACrD,YAAY,mBAA2B,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/strings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAOjD,MAAa,mBAAoB,SAAQ,wBAAgB;IACrD,YAAY,mBAA2B,EAAE,OAA4B,EAAE,MAAc;QACjF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,0BAA0B,CAAC;IACvE,CAAC;IAEK,gBAAgB,CAClB,SAAiB,EAAE,MAAoC;;YAEvD,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,iBAAiB,EAChD,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;CACJ;AAhBD,kDAgBC"}
|
package/built/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from "./api/auth/index";
|
|
2
2
|
export * from "./api/auth/dto/access-token-dto";
|
|
3
|
+
export * from "./api/auth/static-access-token-provider";
|
|
4
|
+
export * from "./api/auth/access-token-provider";
|
|
3
5
|
export * from "./api/base/index";
|
|
4
6
|
export * from "./api/builder/index";
|
|
5
7
|
export * from "./api/context/index";
|
|
@@ -41,6 +43,12 @@ export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
|
41
43
|
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
|
42
44
|
export * from "./api/files/dto/last-modified-for-locale-dto";
|
|
43
45
|
export * from "./api/files/dto/uploaded-file-dto";
|
|
46
|
+
export * from "./api/glossaries/index";
|
|
47
|
+
export * from "./api/glossaries/dto/glossary-dto";
|
|
48
|
+
export * from "./api/glossaries/dto/fallback-locale-dto";
|
|
49
|
+
export * from "./api/glossaries/dto/pagination-dto";
|
|
50
|
+
export * from "./api/glossaries/dto/sorting-dto";
|
|
51
|
+
export * from "./api/glossaries/params/search-glossaries-parameters";
|
|
44
52
|
export * from "./api/http/smartling-list-response";
|
|
45
53
|
export * from "./api/job-batches/index";
|
|
46
54
|
export * from "./api/job-batches/dto/batch-dto";
|
|
@@ -91,7 +99,9 @@ export * from "./api/parameters/index";
|
|
|
91
99
|
export * from "./api/parameters/order";
|
|
92
100
|
export * from "./api/projects/index";
|
|
93
101
|
export * from "./api/projects/dto/project-dto";
|
|
102
|
+
export * from "./api/projects/dto/project-without-target-locales-dto";
|
|
94
103
|
export * from "./api/projects/dto/locale-dto";
|
|
104
|
+
export * from "./api/projects/params/list-projects-parameters";
|
|
95
105
|
export * from "./api/published-files/index";
|
|
96
106
|
export * from "./api/published-files/dto/published-file-dto";
|
|
97
107
|
export * from "./api/published-files/params/recently-published-files-parameters";
|
package/built/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api/auth/index"), exports);
|
|
18
18
|
__exportStar(require("./api/auth/dto/access-token-dto"), exports);
|
|
19
|
+
__exportStar(require("./api/auth/static-access-token-provider"), exports);
|
|
20
|
+
__exportStar(require("./api/auth/access-token-provider"), exports);
|
|
19
21
|
__exportStar(require("./api/base/index"), exports);
|
|
20
22
|
__exportStar(require("./api/builder/index"), exports);
|
|
21
23
|
__exportStar(require("./api/context/index"), exports);
|
|
@@ -57,6 +59,12 @@ __exportStar(require("./api/files/dto/file-status-for-all-locales-dto"), exports
|
|
|
57
59
|
__exportStar(require("./api/files/dto/file-status-for-locale-item-dto"), exports);
|
|
58
60
|
__exportStar(require("./api/files/dto/last-modified-for-locale-dto"), exports);
|
|
59
61
|
__exportStar(require("./api/files/dto/uploaded-file-dto"), exports);
|
|
62
|
+
__exportStar(require("./api/glossaries/index"), exports);
|
|
63
|
+
__exportStar(require("./api/glossaries/dto/glossary-dto"), exports);
|
|
64
|
+
__exportStar(require("./api/glossaries/dto/fallback-locale-dto"), exports);
|
|
65
|
+
__exportStar(require("./api/glossaries/dto/pagination-dto"), exports);
|
|
66
|
+
__exportStar(require("./api/glossaries/dto/sorting-dto"), exports);
|
|
67
|
+
__exportStar(require("./api/glossaries/params/search-glossaries-parameters"), exports);
|
|
60
68
|
__exportStar(require("./api/http/smartling-list-response"), exports);
|
|
61
69
|
__exportStar(require("./api/job-batches/index"), exports);
|
|
62
70
|
__exportStar(require("./api/job-batches/dto/batch-dto"), exports);
|
|
@@ -107,7 +115,9 @@ __exportStar(require("./api/parameters/index"), exports);
|
|
|
107
115
|
__exportStar(require("./api/parameters/order"), exports);
|
|
108
116
|
__exportStar(require("./api/projects/index"), exports);
|
|
109
117
|
__exportStar(require("./api/projects/dto/project-dto"), exports);
|
|
118
|
+
__exportStar(require("./api/projects/dto/project-without-target-locales-dto"), exports);
|
|
110
119
|
__exportStar(require("./api/projects/dto/locale-dto"), exports);
|
|
120
|
+
__exportStar(require("./api/projects/params/list-projects-parameters"), exports);
|
|
111
121
|
__exportStar(require("./api/published-files/index"), exports);
|
|
112
122
|
__exportStar(require("./api/published-files/dto/published-file-dto"), exports);
|
|
113
123
|
__exportStar(require("./api/published-files/params/recently-published-files-parameters"), exports);
|
package/built/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,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,wFAAsE;AACtE,qFAAmE;AACnE,4FAA0E;AAC1E,+FAA6E;AAC7E,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;AACpC,iDAA+B;AAC/B,0EAAwD;AACxD,mEAAiD;AACjD,yEAAuD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kEAAgD;AAChD,0EAAwD;AACxD,mEAAiD;AACjD,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,wFAAsE;AACtE,qFAAmE;AACnE,4FAA0E;AAC1E,+FAA6E;AAC7E,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,yDAAuC;AACvC,oEAAkD;AAClD,2EAAyD;AACzD,sEAAoD;AACpD,mEAAiD;AACjD,uFAAqE;AACrE,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,wFAAsE;AACtE,gEAA8C;AAC9C,iFAA+D;AAC/D,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;AACpC,iDAA+B;AAC/B,0EAAwD;AACxD,mEAAiD;AACjD,yEAAuD"}
|
package/built/package.json
CHANGED
package/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from "./api/auth/index";
|
|
2
2
|
export * from "./api/auth/dto/access-token-dto";
|
|
3
|
+
export * from "./api/auth/static-access-token-provider";
|
|
4
|
+
export * from "./api/auth/access-token-provider";
|
|
3
5
|
export * from "./api/base/index";
|
|
4
6
|
export * from "./api/builder/index";
|
|
5
7
|
export * from "./api/context/index";
|
|
@@ -41,6 +43,12 @@ export * from "./api/files/dto/file-status-for-all-locales-dto";
|
|
|
41
43
|
export * from "./api/files/dto/file-status-for-locale-item-dto";
|
|
42
44
|
export * from "./api/files/dto/last-modified-for-locale-dto";
|
|
43
45
|
export * from "./api/files/dto/uploaded-file-dto";
|
|
46
|
+
export * from "./api/glossaries/index";
|
|
47
|
+
export * from "./api/glossaries/dto/glossary-dto";
|
|
48
|
+
export * from "./api/glossaries/dto/fallback-locale-dto";
|
|
49
|
+
export * from "./api/glossaries/dto/pagination-dto";
|
|
50
|
+
export * from "./api/glossaries/dto/sorting-dto";
|
|
51
|
+
export * from "./api/glossaries/params/search-glossaries-parameters";
|
|
44
52
|
export * from "./api/http/smartling-list-response";
|
|
45
53
|
export * from "./api/job-batches/index";
|
|
46
54
|
export * from "./api/job-batches/dto/batch-dto";
|
|
@@ -91,7 +99,9 @@ export * from "./api/parameters/index";
|
|
|
91
99
|
export * from "./api/parameters/order";
|
|
92
100
|
export * from "./api/projects/index";
|
|
93
101
|
export * from "./api/projects/dto/project-dto";
|
|
102
|
+
export * from "./api/projects/dto/project-without-target-locales-dto";
|
|
94
103
|
export * from "./api/projects/dto/locale-dto";
|
|
104
|
+
export * from "./api/projects/params/list-projects-parameters";
|
|
95
105
|
export * from "./api/published-files/index";
|
|
96
106
|
export * from "./api/published-files/dto/published-file-dto";
|
|
97
107
|
export * from "./api/published-files/params/recently-published-files-parameters";
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
import { StaticAccessTokenProvider } from "../api/auth/static-access-token-provider";
|
|
3
|
+
|
|
4
|
+
describe("AccessTokenProvider", () => {
|
|
5
|
+
const staticToken = "test.jwt.token";
|
|
6
|
+
|
|
7
|
+
it("should return the static token and token type", async () => {
|
|
8
|
+
const provider = new StaticAccessTokenProvider(staticToken, "Bearer");
|
|
9
|
+
|
|
10
|
+
assert.strictEqual(await provider.getAccessToken(), staticToken);
|
|
11
|
+
assert.strictEqual(await provider.getTokenType(), "Bearer");
|
|
12
|
+
});
|
|
13
|
+
});
|
package/test/base.spec.ts
CHANGED
|
@@ -2,6 +2,7 @@ import assert from "assert";
|
|
|
2
2
|
import sinon from "sinon";
|
|
3
3
|
import { SmartlingBaseApi } from "../api/base/index";
|
|
4
4
|
import { loggerMock, responseMock, authMock } from "./mock";
|
|
5
|
+
import { StaticAccessTokenProvider } from "../api/auth/static-access-token-provider";
|
|
5
6
|
// eslint-disable-next-line import/no-unresolved, @typescript-eslint/no-var-requires
|
|
6
7
|
const packageJson = require("../../package.json");
|
|
7
8
|
|
|
@@ -251,6 +252,53 @@ describe("Base class tests.", () => {
|
|
|
251
252
|
sinon.assert.calledOnce(responseMockTextStub);
|
|
252
253
|
});
|
|
253
254
|
|
|
255
|
+
it("Success (raw text response): auth client is access token provider with static token", async () => {
|
|
256
|
+
base.authApi = new StaticAccessTokenProvider("test.jwt.token", "Bearer");
|
|
257
|
+
|
|
258
|
+
const requestVerb = "POST";
|
|
259
|
+
const requestUri = "https://test.com";
|
|
260
|
+
const payload = {
|
|
261
|
+
foo: "bar"
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
baseFetchStub.returns(responseMock);
|
|
265
|
+
|
|
266
|
+
responseMockTextStub.returns("invalid json: this test just returns raw text response but does not parse text as json");
|
|
267
|
+
|
|
268
|
+
await base.makeRequest(requestVerb, requestUri, payload, true);
|
|
269
|
+
|
|
270
|
+
sinon.assert.calledOnce(baseGetDefaultHeaderSpy);
|
|
271
|
+
|
|
272
|
+
sinon.assert.calledOnce(baseAlterRequestDataSpy);
|
|
273
|
+
sinon.assert.calledWithExactly(
|
|
274
|
+
baseAlterRequestDataSpy,
|
|
275
|
+
requestUri,
|
|
276
|
+
{
|
|
277
|
+
method: requestVerb,
|
|
278
|
+
headers: {
|
|
279
|
+
Authorization: "Bearer test.jwt.token",
|
|
280
|
+
"Content-Type": "application/json",
|
|
281
|
+
"User-Agent": "test_user_agent"
|
|
282
|
+
},
|
|
283
|
+
body: payload
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
sinon.assert.calledOnce(baseFetchStub);
|
|
288
|
+
sinon.assert.calledWithExactly(baseFetchStub, requestUri, {
|
|
289
|
+
method: requestVerb,
|
|
290
|
+
headers: {
|
|
291
|
+
Authorization: "Bearer test.jwt.token",
|
|
292
|
+
"Content-Type": "application/json",
|
|
293
|
+
"User-Agent": "test_user_agent"
|
|
294
|
+
},
|
|
295
|
+
body: payload
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
sinon.assert.notCalled(authResetTokenStub);
|
|
299
|
+
sinon.assert.calledOnce(responseMockTextStub);
|
|
300
|
+
});
|
|
301
|
+
|
|
254
302
|
it("Success (re-authenticate): GET request.", async () => {
|
|
255
303
|
const response401Mock = {
|
|
256
304
|
status: 401
|
package/test/builder.spec.ts
CHANGED
|
@@ -50,12 +50,12 @@ function assertApiClient(Type: any, apiClient: SmartlingBaseApi, assertAuthClien
|
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
assert.equal(
|
|
53
|
-
apiClient
|
|
53
|
+
apiClient["getClientLibId"](),
|
|
54
54
|
"example-lib-name"
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
assert.equal(
|
|
58
|
-
apiClient
|
|
58
|
+
apiClient["getClientLibVersion"](),
|
|
59
59
|
"example-lib-version"
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -76,12 +76,12 @@ function assertApiClient(Type: any, apiClient: SmartlingBaseApi, assertAuthClien
|
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
assert.equal(
|
|
79
|
-
apiClient["authApi"]
|
|
79
|
+
apiClient["authApi"]["getClientLibId"](),
|
|
80
80
|
"example-lib-name"
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
assert.equal(
|
|
84
|
-
apiClient["authApi"]
|
|
84
|
+
apiClient["authApi"]["getClientLibVersion"](),
|
|
85
85
|
"example-lib-version"
|
|
86
86
|
);
|
|
87
87
|
}
|
|
@@ -119,22 +119,22 @@ describe("SmartlingApiClientBuilder class tests.", () => {
|
|
|
119
119
|
const apiClient = apiClientBuilder.build(SmartlingJobsApi);
|
|
120
120
|
|
|
121
121
|
assert.equal(
|
|
122
|
-
apiClient
|
|
122
|
+
apiClient["getClientLibId"](),
|
|
123
123
|
packageJson.name
|
|
124
124
|
);
|
|
125
125
|
|
|
126
126
|
assert.equal(
|
|
127
|
-
apiClient
|
|
127
|
+
apiClient["getClientLibVersion"](),
|
|
128
128
|
packageJson.version
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
assert.equal(
|
|
132
|
-
apiClient["authApi"]
|
|
132
|
+
apiClient["authApi"]["getClientLibId"](),
|
|
133
133
|
packageJson.name
|
|
134
134
|
);
|
|
135
135
|
|
|
136
136
|
assert.equal(
|
|
137
|
-
apiClient["authApi"]
|
|
137
|
+
apiClient["authApi"]["getClientLibVersion"](),
|
|
138
138
|
packageJson.version
|
|
139
139
|
);
|
|
140
140
|
});
|
|
@@ -172,12 +172,12 @@ describe("SmartlingApiClientBuilder class tests.", () => {
|
|
|
172
172
|
const apiClient = apiClientBuilder.build(SmartlingJobsApi);
|
|
173
173
|
|
|
174
174
|
assert.equal(
|
|
175
|
-
apiClient
|
|
175
|
+
apiClient["getClientLibId"](),
|
|
176
176
|
"example-lib-name"
|
|
177
177
|
);
|
|
178
178
|
|
|
179
179
|
assert.equal(
|
|
180
|
-
apiClient
|
|
180
|
+
apiClient["getClientLibVersion"](),
|
|
181
181
|
"example-lib-version"
|
|
182
182
|
);
|
|
183
183
|
|
|
@@ -197,12 +197,12 @@ describe("SmartlingApiClientBuilder class tests.", () => {
|
|
|
197
197
|
);
|
|
198
198
|
|
|
199
199
|
assert.equal(
|
|
200
|
-
apiClient["authApi"]
|
|
200
|
+
apiClient["authApi"]["getClientLibId"](),
|
|
201
201
|
packageJson.name
|
|
202
202
|
);
|
|
203
203
|
|
|
204
204
|
assert.equal(
|
|
205
|
-
apiClient["authApi"]
|
|
205
|
+
apiClient["authApi"]["getClientLibVersion"](),
|
|
206
206
|
packageJson.version
|
|
207
207
|
);
|
|
208
208
|
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import sinon from "sinon";
|
|
2
|
+
import { SmartlingGlossariesApi } from "../api/glossaries/index";
|
|
3
|
+
import { loggerMock, authMock, responseMock } from "./mock";
|
|
4
|
+
import { SmartlingAuthApi } from "../api/auth/index";
|
|
5
|
+
import { SearchGlossariesParameters } from "../api/glossaries/params/search-glossaries-parameters";
|
|
6
|
+
|
|
7
|
+
describe("SmartlingGlossariesApi class tests.", () => {
|
|
8
|
+
const accountUid = "testAccountUid";
|
|
9
|
+
const glossaryUid = "testGlossaryUid";
|
|
10
|
+
let glossariesApi: SmartlingGlossariesApi;
|
|
11
|
+
let glossariesApiFetchStub;
|
|
12
|
+
let glossariesApiUaStub;
|
|
13
|
+
let responseMockJsonStub;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
glossariesApi = new SmartlingGlossariesApi("https://test.com", authMock as unknown as SmartlingAuthApi, loggerMock);
|
|
17
|
+
glossariesApiFetchStub = sinon.stub(glossariesApi, "fetch");
|
|
18
|
+
glossariesApiUaStub = sinon.stub(glossariesApi, "ua");
|
|
19
|
+
responseMockJsonStub = sinon.stub(responseMock, "json");
|
|
20
|
+
|
|
21
|
+
glossariesApiUaStub.returns("test_user_agent");
|
|
22
|
+
glossariesApiFetchStub.returns(responseMock);
|
|
23
|
+
responseMockJsonStub.returns({
|
|
24
|
+
response: {}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
glossariesApiFetchStub.restore();
|
|
30
|
+
responseMockJsonStub.restore();
|
|
31
|
+
glossariesApiUaStub.restore();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("Methods", () => {
|
|
35
|
+
it("Search glossaries with parameters", async () => {
|
|
36
|
+
const parameters = new SearchGlossariesParameters()
|
|
37
|
+
.setQuery("test glossary")
|
|
38
|
+
.setGlossaryState("ACTIVE")
|
|
39
|
+
.setTargetLocaleId("en-US")
|
|
40
|
+
.setGlossaryUids(["uid1", "uid2"])
|
|
41
|
+
.setPaging({ offset: 0, limit: 10 })
|
|
42
|
+
.setSorting({ field: "glossaryName", direction: "ASC" })
|
|
43
|
+
.setIncludeEntriesCount(true);
|
|
44
|
+
|
|
45
|
+
await glossariesApi.searchGlossaries(accountUid, parameters);
|
|
46
|
+
|
|
47
|
+
sinon.assert.calledOnce(glossariesApiFetchStub);
|
|
48
|
+
sinon.assert.calledWithExactly(
|
|
49
|
+
glossariesApiFetchStub,
|
|
50
|
+
`https://test.com/glossary-api/v3/accounts/${accountUid}/glossaries/search`,
|
|
51
|
+
{
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: "test_token_type test_access_token",
|
|
54
|
+
"Content-Type": "application/json",
|
|
55
|
+
"User-Agent": "test_user_agent"
|
|
56
|
+
},
|
|
57
|
+
method: "post",
|
|
58
|
+
body: JSON.stringify({
|
|
59
|
+
query: "test glossary",
|
|
60
|
+
glossaryState: "ACTIVE",
|
|
61
|
+
targetLocaleId: "en-US",
|
|
62
|
+
glossaryUids: ["uid1", "uid2"],
|
|
63
|
+
paging: { offset: 0, limit: 10 },
|
|
64
|
+
sorting: { field: "glossaryName", direction: "ASC" },
|
|
65
|
+
includeEntriesCount: true
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("Get glossary", async () => {
|
|
72
|
+
await glossariesApi.getGlossary(accountUid, glossaryUid);
|
|
73
|
+
|
|
74
|
+
sinon.assert.calledOnce(glossariesApiFetchStub);
|
|
75
|
+
sinon.assert.calledWithExactly(
|
|
76
|
+
glossariesApiFetchStub,
|
|
77
|
+
`https://test.com/glossary-api/v3/accounts/${accountUid}/glossaries/${glossaryUid}`,
|
|
78
|
+
{
|
|
79
|
+
headers: {
|
|
80
|
+
Authorization: "test_token_type test_access_token",
|
|
81
|
+
"Content-Type": "application/json",
|
|
82
|
+
"User-Agent": "test_user_agent"
|
|
83
|
+
},
|
|
84
|
+
method: "get"
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
});
|
package/test/projects.spec.ts
CHANGED
|
@@ -2,6 +2,7 @@ import sinon from "sinon";
|
|
|
2
2
|
import { SmartlingProjectsApi } from "../api/projects/index";
|
|
3
3
|
import { loggerMock, authMock, responseMock } from "./mock";
|
|
4
4
|
import { SmartlingAuthApi } from "../api/auth/index";
|
|
5
|
+
import { ListProjectsParameters } from "../api/projects/params/list-projects-parameters";
|
|
5
6
|
|
|
6
7
|
describe("SmartlingProjectsApi class tests.", () => {
|
|
7
8
|
const projectId = "testProjectId";
|
|
@@ -47,5 +48,49 @@ describe("SmartlingProjectsApi class tests.", () => {
|
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
50
|
});
|
|
51
|
+
|
|
52
|
+
it("Get projects by account", async () => {
|
|
53
|
+
await projectsApi.listProjects("accountUid");
|
|
54
|
+
|
|
55
|
+
sinon.assert.calledOnce(projectsApiFetchStub);
|
|
56
|
+
sinon.assert.calledWithExactly(
|
|
57
|
+
projectsApiFetchStub,
|
|
58
|
+
"https://test.com/accounts-api/v2/accounts/accountUid/projects",
|
|
59
|
+
{
|
|
60
|
+
headers: {
|
|
61
|
+
Authorization: "test_token_type test_access_token",
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
"User-Agent": "test_user_agent"
|
|
64
|
+
},
|
|
65
|
+
method: "get"
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("Get projects by account with parameters", async () => {
|
|
71
|
+
const parameters = new ListProjectsParameters()
|
|
72
|
+
.setProjectNameFilter("test")
|
|
73
|
+
.setIncludeArchived(true)
|
|
74
|
+
.setLimit(10)
|
|
75
|
+
.setOffset(0)
|
|
76
|
+
.setProjectTypeCode("CONNECTED")
|
|
77
|
+
.setProjectTypeCodes(["CONNECTED", "STANDALONE"]);
|
|
78
|
+
|
|
79
|
+
await projectsApi.listProjects("accountUid", parameters);
|
|
80
|
+
|
|
81
|
+
sinon.assert.calledOnce(projectsApiFetchStub);
|
|
82
|
+
sinon.assert.calledWithExactly(
|
|
83
|
+
projectsApiFetchStub,
|
|
84
|
+
"https://test.com/accounts-api/v2/accounts/accountUid/projects?projectNameFilter=test&includeArchived=true&limit=10&offset=0&projectTypeCode=CONNECTED&projectTypeCodes=CONNECTED&projectTypeCodes=STANDALONE",
|
|
85
|
+
{
|
|
86
|
+
headers: {
|
|
87
|
+
Authorization: "test_token_type test_access_token",
|
|
88
|
+
"Content-Type": "application/json",
|
|
89
|
+
"User-Agent": "test_user_agent"
|
|
90
|
+
},
|
|
91
|
+
method: "get"
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
});
|
|
50
95
|
});
|
|
51
96
|
});
|